diff --git a/CHANGELOG.md b/CHANGELOG.md index 2847a9c..6602599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,8 @@ `alert_on_message_delivery` and `broadcast_area_identifier`, the names they read back under. The two alternate names are gone from `tlvs` too, which is now typed by `TlvName`: narrow a `string` with `isTlvName()` before indexing it. - `cmds.broadcast_sm_resp.tlvMap` is removed; nothing read it. +- The `SmsInput` type is no longer exported; nothing exported took one. Read the `Sms` an `sms` + event carries. - `session.boundAs` and `session.peerInterfaceVersion` are read-only, and `session.loggedIn` is removed: read `session.boundAs !== undefined`. A session you wire yourself records the bind it accepted or had accepted with `session.bound(bindType, declaredVersion)`, which returns `err` for a diff --git a/src/held-messages.ts b/src/held-messages.ts index a952835..a970f6a 100644 --- a/src/held-messages.ts +++ b/src/held-messages.ts @@ -9,8 +9,6 @@ import { IdleWaiters } from './idle-waiters.ts'; import { createSms } from './sms.ts'; import { retainedOctets } from './retained-pdu.ts'; -type Send = (input: PduObjectInput) => Promise>; - export type HeldMessagesOptions = { link: LinkLife; log: SmppLog; @@ -19,7 +17,7 @@ export type HeldMessagesOptions = { /** Injected so expiry can be exercised without a wall clock. */ now?: (() => number) | undefined; /** Past a drain's refusal, for a receipt the drain is itself waiting for. */ - sendPastDrain: Send; + sendPastDrain: SmsHandlers['send']; session: Session; timeout: number; }; @@ -34,9 +32,9 @@ function keyOf(pduObjs: PduObject[]): string | undefined { type HoldRoute = Pick; /** - * One message offered to the application, and the handlers its `Sms` answers through. A drain waits on it until the first of: `answered()`, - * every listener that took it rejecting, no listener taking it or one throwing, a later message on - * its sequence number, its deadline, or the link going. + * One message offered to the application, and the handlers its `Sms` answers through. A drain + * waits on it until the first of: `answered()`, every listener that took it rejecting, no listener + * taking it or one throwing, a later message on its sequence number, its deadline, or the link going. */ export class MessageHold implements SmsHandlers { private readonly generation: number; @@ -160,14 +158,12 @@ export class HeldMessages { this.offered.get(message)?.listenerGaveUp(); } - /** Called by `MessageHold`; everything else asks the hold. */ holds(pduObjs: PduObject[]): boolean { const key = keyOf(pduObjs); return key !== undefined && this.held.get(key) === pduObjs; } - /** Called by `MessageHold`; everything else releases through the hold. */ release(pduObjs: PduObject[]): void { const key = keyOf(pduObjs); diff --git a/src/incoming-requests.ts b/src/incoming-requests.ts index cf61499..51aeec7 100644 --- a/src/incoming-requests.ts +++ b/src/incoming-requests.ts @@ -1,11 +1,12 @@ import type { Concat } from './concat.ts'; import type { DlrMerger } from './dlr-merger.ts'; import type { ErrorName } from './defs/errors.ts'; +import type { HeldMessagesOptions } from './held-messages.ts'; import type { LinkLife } from './link-life.ts'; import type { LostGroup, Refusal } from './reassembly.ts'; import type { OnRequest } from './session-options.ts'; -import type { PduObject, PduObjectInput } from './pdu.ts'; -import type { Result, VoidResult } from './result.ts'; +import type { PduObject } from './pdu.ts'; +import type { VoidResult } from './result.ts'; import type { Session } from './session.ts'; import type { SmppLog } from './log.ts'; import type { SmsIdFormat } from './sms-id.ts'; @@ -50,8 +51,7 @@ export type IncomingRequestsOptions = { maxReassembly?: number | undefined; onRequest?: OnRequest | undefined; reassemblyTimeout?: number | undefined; - /** Past a drain's refusal, for a receipt the drain is itself waiting for. */ - sendPastDrain: (input: PduObjectInput) => Promise>; + sendPastDrain: HeldMessagesOptions['sendPastDrain']; session: Session; smsIdFormat?: SmsIdFormat | undefined; systemId?: string | undefined; diff --git a/src/index.ts b/src/index.ts index 509250a..71fa973 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,7 +38,7 @@ export { uuidv7 } from './uuid.ts'; export type { BindType, ClientOptions } from './client.ts'; export type { Dlr, Receipt } from './dlr.ts'; -export type { SendDlrResult, SendRespOptions, Sms, SmsInput } from './sms.ts'; +export type { SendDlrResult, SendRespOptions, Sms } from './sms.ts'; export type { Concat } from './concat.ts'; export type { ConcatInfo } from './udh.ts'; export type { Result, VoidResult } from './result.ts';