createChannelRouter(Parametersoptions):Readonly<{delivery(event):Promise<{runId:string; } |undefined>;receive(inbound):Promise<{duplicate:boolean;runId:string; }>;reply(request):Promise<{providerRequestId:string; }>;send(request):Promise<{providerRequestId:string; }>; }>
Returns
Readonly<{ delivery(event): Promise<{ runId: string; } | undefined>; receive(inbound): Promise<{ duplicate: boolean; runId: string; }>; reply(request): Promise<{ providerRequestId: string; }>; send(request): Promise<{ providerRequestId: string; }>; }>
ChannelRouterOptions
Properties acceptParametersreadonlyaccept: (request) =>Promise<{runId:string; }>
Returns
Promise<{ runId: string; }>
adapters
ledgerreadonlyadapters: readonlyChannelAdapter[]
policyreadonlyledger:ChannelLedger
readonlypolicy:OutboundChannelPolicy
ChannelAdapter
Properties channelMethods send()readonlychannel:string
send(Parametersrequest):Promise<{providerRequestId:string; }>
Returns
Promise<{ providerRequestId: string; }>
ChannelLedger
Methods acceptInbound()acceptInbound(Atomically claims an inbound provider message and persists its run mapping as one recovery unit. Persistent implementations must share this claim across router processes and must not release a claim afterchannel,externalMessageId,conversationId,accept):Promise<Readonly<{duplicate:boolean;runId:string; }>>
accept succeeds.
Parameters
Returns
Promise<Readonly<{ duplicate: boolean; runId: string; }>>
findOutbound()
findOutbound(Parameterschannel,providerRequestId):Promise<string|undefined>
Returns
Promise<string | undefined>
findRun()
findRun(ParametersrunId):Promise<Readonly<{channel:string;conversationId:string; }> |undefined>
Returns
Promise<Readonly<{ channel: string; conversationId: string; }> | undefined>
recoverOutbound()
recoverOutbound(Reconciles a previous provider success without authorizing or sending again. Parameterschannel,runId,idempotencyKey):Promise<{providerRequestId:string; } |undefined>
Returns
Promise<{ providerRequestId: string; } | undefined>
sendOutbound()
sendOutbound(Reserves and completes one correlated outbound attempt. Implementations must retain the stable idempotency key through retries/recovery so a provider never observes an unkeyed resend after persistence uncertainty. Parameterschannel,runId,idempotencyKey,send):Promise<{providerRequestId:string; }>
Returns
Promise<{ providerRequestId: string; }>
OutboundChannelPolicy
Methods authorize()authorize(Parametersrequest):Promise<boolean>
Returns
Promise<boolean>
ChannelContent
ChannelContent =Generic discrete-message channel contract. The harness never accepts provider payloads or provider-specific addressing fields. A reference adapter owns those transformations before this boundary.Readonly<Record<string,unknown>>
NormalizedChannelInbound
Properties channelcontentreadonlychannel:string
conversationIdreadonlycontent:ChannelContent
externalMessageIdreadonlyconversationId:string
receivedAtreadonlyexternalMessageId:string
readonlyreceivedAt:number
ChannelAcceptance
Properties channelcontentreadonlychannel:string
conversationIdreadonlycontent:ChannelContent
externalMessageIdreadonlyconversationId:string
receivedAtreadonlyexternalMessageId:string
readonlyreceivedAt:number
ChannelSendRequest
Properties contentconversationIdreadonlycontent:ChannelContent
idempotencyKey?readonlyconversationId:string
Stable retry token supplied for replies that require delivery correlation.readonlyoptionalidempotencyKey?:string
ChannelReplyRequest
Properties contentidempotencyKeyreadonlycontent:ChannelContent
Caller-supplied stable key for this retryable reply. runIdreadonlyidempotencyKey:string
serviceAccountId?readonlyrunId:string
readonlyoptionalserviceAccountId?:string
ChannelOutboundRequest
Properties channelcontentreadonlychannel:string
conversationIdreadonlycontent:ChannelContent
idempotencyKeyreadonlyconversationId:string
Caller-supplied stable key for this retryable out-of-band send. runIdreadonlyidempotencyKey:string
Exact harness run to correlate this out-of-band send with delivery events. serviceAccountId?readonlyrunId:string
readonlyoptionalserviceAccountId?:string
ChannelDeliveryEvent
Properties channeloccurredAtreadonlychannel:string
providerRequestIdreadonlyoccurredAt:number
statusreadonlyproviderRequestId:string
readonlystatus:string
ChannelAuthorizationError
Constructors Constructor
new ChannelAuthorizationError(): ChannelAuthorizationError
Returns
ChannelAuthorizationError
Properties
cause?
messageoptionalcause?:unknown
message: string
name
name: string
stack?
stackTraceLimitoptionalstack?:string
ThestaticstackTraceLimit:number
Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will
not capture any frames.
Methods
captureStackTrace()
Creates astaticcaptureStackTrace(targetObject,constructorOpt?):void
.stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
Returns
void
prepareStackTrace()
ParametersstaticprepareStackTrace(err,stackTraces):any
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces