Skip to content

PURISTA API / Modules / @purista/core / SubscriptionDefinitionBuilder

Class: SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

@purista/core.SubscriptionDefinitionBuilder

Subscription definition builder is a helper to create and define a subscriptions for a service. It helps to set all needed filters.

A working schema definition needs at least a subscription name, a short description and the subscription implementation.

Type parameters

NameType
ServiceClassTypeextends ServiceClass = ServiceClass
MessagePayloadTypeunknown
MessageParamsTypeundefined
MessageResultTypevoid
PayloadSchemaextends Schema = ZodAny
ParameterSchemaextends Schema = ZodAny
ResultSchemaextends Schema = ZodAny
Invokes{}
EmitListType{}

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>(subscriptionName, subscriptionDescription): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Type parameters

NameType
ServiceClassTypeextends ServiceClass<unknown> = ServiceClass<unknown>
MessagePayloadTypeunknown
MessageParamsTypeundefined
MessageResultTypevoid
PayloadSchemaextends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> = ZodAny
ParameterSchemaextends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> = ZodAny
ResultSchemaextends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> = ZodAny
Invokes{}
EmitListType{}

Parameters

NameType
subscriptionNamestring
subscriptionDescriptionstring

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:141

Properties

autoacknowledge

Private autoacknowledge: boolean = false

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:131


durable

Private durable: boolean = true

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:128


emitEventName

Private Optional emitEventName: string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:123


emitList

Private emitList: EmitListType

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:138


eventName

Private Optional eventName: string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:122


fn

Private Optional fn: SubscriptionFunction<ServiceClassType, MessagePayloadType, MessageParamsType, UnknownIfNever<IfDefined<PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends Schema<any, any, any, ""> ? IfDefined<PayloadSchema extends Schema<any, any, any, ""> ? InferType<PayloadSchema> : never> : never | PayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<PayloadSchema extends ZodType<any, ZodTypeDef, any> ? output<PayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? output<ParameterSchema> : never> : never>>, UnknownIfNever<IfDefined<ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends Schema<any, any, any, ""> ? IfDefined<ResultSchema extends Schema<any, any, any, ""> ? InferType<ResultSchema> : never> : never | ResultSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ResultSchema extends ZodType<any, ZodTypeDef, any> ? input<ResultSchema> : never> : never>>, Invokes, EmitListType>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:111


hooks

Private hooks: Object

Type declaration

NameType
afterGuardRecord<string, SubscriptionAfterGuardHook<ServiceClassType, Infer<ResultSchema>, Infer<PayloadSchema>, Infer<ParameterSchema>, Invokes, EmitListType>>
beforeGuardRecord<string, SubscriptionBeforeGuardHook<ServiceClassType, Infer<PayloadSchema>, Infer<ParameterSchema>, Invokes, EmitListType>>
transformInput?{ transformFunction: SubscriptionTransformInputHook<ServiceClassType, any, any, any, any> ; transformInputSchema: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> ; transformParameterSchema: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> }
transformInput.transformFunctionSubscriptionTransformInputHook<ServiceClassType, any, any, any, any>
transformInput.transformInputSchemaSchema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>
transformInput.transformParameterSchemaSchema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>
transformOutput?{ transformFunction: SubscriptionTransformOutputHook<ServiceClassType, Infer<ResultSchema>, Infer<PayloadSchema>, any> ; transformOutputSchema: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> }
transformOutput.transformFunctionSubscriptionTransformOutputHook<ServiceClassType, Infer<ResultSchema>, Infer<PayloadSchema>, any>
transformOutput.transformOutputSchemaSchema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:60


inputContentEncoding

Private inputContentEncoding: undefined | string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:54


inputContentType

Private inputContentType: undefined | string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:53


inputSchema

Private Optional inputSchema: PayloadSchema

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:52


invokes

Private invokes: FromInvokeToOtherType<Invokes, { outputSchema?: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> ; parameterSchema?: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> ; payloadSchema?: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> }>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:133


messageType

Private messageType: undefined | EBMessageType

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:50


outputContentEncoding

Private outputContentEncoding: undefined | string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:57


outputContentType

Private outputContentType: undefined | string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:56


outputSchema

Private Optional outputSchema: ResultSchema

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:55


parameterSchema

Private Optional parameterSchema: ParameterSchema

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:58


principalId

Private Optional principalId: string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:125


receiver

Private Optional receiver: Object

Type declaration

NameType
instanceId?string
serviceName?string
serviceTarget?string
serviceVersion?string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:104


sender

Private Optional sender: Object

Type declaration

NameType
instanceId?string
serviceName?string
serviceTarget?string
serviceVersion?string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:97


shared

Private shared: boolean = true

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:130


subscriptionDescription

Private subscriptionDescription: string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:143


subscriptionName

Private subscriptionName: string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:142


tenantId

Private Optional tenantId: string

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:126

Methods

addOutputSchema

addOutputSchema<T>(eventName, outputSchema, outputContentType?, outputContentEncoding?): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, T, PayloadSchema, ParameterSchema, T, Invokes, EmitListType>

Add a schema for output payload validation. Types for payload of message and function payload output are generated from given schema.

Type parameters

NameType
Textends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>

Parameters

NameTypeDefault valueDescription
eventNamestringundefinedthe event name to be used when the subscription result is emitted as custom event
outputSchemaTundefinedthe validation schema for the output payload
outputContentTypestring'application/json'optional the content type of payload
outputContentEncodingstring'utf-8'optional the content encoding

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, T, PayloadSchema, ParameterSchema, T, Invokes, EmitListType>

SubscriptionDefinitionBuilder

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:440


addParameterSchema

addParameterSchema<T>(parameterSchema): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, UnknownIfNever<IfDefined<T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends Schema<any, any, any, ""> ? IfDefined<T extends Schema<any, any, any, ""> ? InferType<T> : never> : never | T extends ZodType<any, ZodTypeDef, any> ? IfDefined<T extends ZodType<any, ZodTypeDef, any> ? input<T> : never> : never>>, MessageResultType, PayloadSchema, T, ResultSchema, Invokes, EmitListType>

Add a schema for output parameter validation. Types for parameter of message and function parameter output are generated from given schema.

Type parameters

NameType
Textends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>

Parameters

NameTypeDescription
parameterSchemaTthe validation schema for output parameter

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, UnknownIfNever<IfDefined<T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends Schema<any, any, any, ""> ? IfDefined<T extends Schema<any, any, any, ""> ? InferType<T> : never> : never | T extends ZodType<any, ZodTypeDef, any> ? IfDefined<T extends ZodType<any, ZodTypeDef, any> ? input<T> : never> : never>>, MessageResultType, PayloadSchema, T, ResultSchema, Invokes, EmitListType>

SubscriptionDefinitionBuilder

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:469


addPayloadSchema

addPayloadSchema<T>(inputSchema, inputContentType?, inputContentEncoding?): SubscriptionDefinitionBuilder<ServiceClassType, UnknownIfNever<IfDefined<T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends Schema<any, any, any, ""> ? IfDefined<T extends Schema<any, any, any, ""> ? InferType<T> : never> : never | T extends ZodType<any, ZodTypeDef, any> ? IfDefined<T extends ZodType<any, ZodTypeDef, any> ? input<T> : never> : never>>, MessageParamsType, MessageResultType, T, ParameterSchema, ResultSchema, Invokes, EmitListType>

Add a schema for input payload validation. Types for payload of message and function payload input are generated from given schema.

Type parameters

NameType
Textends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>

Parameters

NameTypeDefault valueDescription
inputSchemaTundefinedthe validation schema for input payload
inputContentTypestring'application/json'optional the content type of payload
inputContentEncodingstring'utf-8'optional the content encoding

Returns

SubscriptionDefinitionBuilder<ServiceClassType, UnknownIfNever<IfDefined<T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends Schema<any, any, any, ""> ? IfDefined<T extends Schema<any, any, any, ""> ? InferType<T> : never> : never | T extends ZodType<any, ZodTypeDef, any> ? IfDefined<T extends ZodType<any, ZodTypeDef, any> ? input<T> : never> : never>>, MessageParamsType, MessageResultType, T, ParameterSchema, ResultSchema, Invokes, EmitListType>

SubscriptionDefinitionBuilder

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:409


adviceAutoacknowledgeMessage

adviceAutoacknowledgeMessage(acknowledge?): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Instruct the event bridge message broker to autoacknowledge messages as soon as they arrive. This means, a message will not be resent, if the subscription execution fails unexpected.

If set to false, the message will be resent from message broker to eventbridge, if:

  • the underlaying message broker supports it
  • if the subscription execution fails unexpected
  • if sending of optional subscription response failed

Parameters

NameTypeDefault valueDescription
acknowledgebooleantrueEnable (true) and disable (false)

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

SubscriptionDefinition

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:289


adviceDurable

adviceDurable(durable): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

False: defines the subscription as a live-subscription, which is only able to process messages while the subscription itself is running.

True: Advises the event bridge (like rabbitMQ) to store all messages if the subscription is not running. As soon as the subscription is back again, all missed messages will be sent first, before it starts working like a live-subscription.

Parameters

NameType
durableboolean

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:314


canEmit

canEmit<EventName, T>(eventName, schema): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType & Record<EventName, UnknownIfNever<IfDefined<T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends Schema<any, any, any, ""> ? IfDefined<T extends Schema<any, any, any, ""> ? InferType<T> : never> : never | T extends ZodType<any, ZodTypeDef, any> ? IfDefined<T extends ZodType<any, ZodTypeDef, any> ? input<T> : never> : never>>>>

Define which custom events the command can emit.

Type parameters

NameType
EventNameextends string
Textends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>

Parameters

NameTypeDescription
eventNameEventNameThe custom event name
schemaTthe payload schema

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType & Record<EventName, UnknownIfNever<IfDefined<T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends never ? never : never | T extends Schema<any, any, any, ""> ? IfDefined<T extends Schema<any, any, any, ""> ? InferType<T> : never> : never | T extends ZodType<any, ZodTypeDef, any> ? IfDefined<T extends ZodType<any, ZodTypeDef, any> ? input<T> : never> : never>>>>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:221


canInvoke

canInvoke<Output, Payload, Parameter, SName, Version, Fname>(serviceName, serviceVersion, serviceTarget, outputSchema?, payloadSchema?, parameterSchema?): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes & Record<SName, Record<Version, Record<Fname, (payload: UnknownIfNever<IfDefined<Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends Schema<any, any, any, ""> ? IfDefined<Payload extends Schema<any, any, any, ""> ? InferType<Payload> : never> : never | Payload extends ZodType<any, ZodTypeDef, any> ? IfDefined<Payload extends ZodType<any, ZodTypeDef, any> ? input<Payload> : never> : never>>, parameter: UnknownIfNever<IfDefined<Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends Schema<any, any, any, ""> ? IfDefined<Parameter extends Schema<any, any, any, ""> ? InferType<Parameter> : never> : never | Parameter extends ZodType<any, ZodTypeDef, any> ? IfDefined<Parameter extends ZodType<any, ZodTypeDef, any> ? input<Parameter> : never> : never>>) => Promise<UnknownIfNever<IfDefined<Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends Schema<any, any, any, ""> ? IfDefined<Output extends Schema<any, any, any, ""> ? InferType<Output> : never> : never | Output extends ZodType<any, ZodTypeDef, any> ? IfDefined<Output extends ZodType<any, ZodTypeDef, any> ? output<Output> : never> : never>>>>>>, EmitListType>

Type parameters

NameType
Outputextends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>
Payloadextends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>
Parameterextends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>
SNameextends string = string
Versionextends string = string
Fnameextends string = string

Parameters

NameType
serviceNameSName
serviceVersionVersion
serviceTargetFname
outputSchema?Output
payloadSchema?Payload
parameterSchema?Parameter

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes & Record<SName, Record<Version, Record<Fname, (payload: UnknownIfNever<IfDefined<Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends never ? never : never | Payload extends Schema<any, any, any, ""> ? IfDefined<Payload extends Schema<any, any, any, ""> ? InferType<Payload> : never> : never | Payload extends ZodType<any, ZodTypeDef, any> ? IfDefined<Payload extends ZodType<any, ZodTypeDef, any> ? input<Payload> : never> : never>>, parameter: UnknownIfNever<IfDefined<Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends never ? never : never | Parameter extends Schema<any, any, any, ""> ? IfDefined<Parameter extends Schema<any, any, any, ""> ? InferType<Parameter> : never> : never | Parameter extends ZodType<any, ZodTypeDef, any> ? IfDefined<Parameter extends ZodType<any, ZodTypeDef, any> ? input<Parameter> : never> : never>>) => Promise<UnknownIfNever<IfDefined<Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends Schema<any, any, any, ""> ? IfDefined<Output extends Schema<any, any, any, ""> ? InferType<Output> : never> : never | Output extends ZodType<any, ZodTypeDef, any> ? IfDefined<Output extends ZodType<any, ZodTypeDef, any> ? output<Output> : never> : never>>>>>>, EmitListType>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:146


filterForMessageType

filterForMessageType(messageType): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Adds a filter to match specific message type.

Common message types are Command, CommandSuccessResponse and CommandErrorResponse.

See EBMessageType for full available list.

Parameters

NameTypeDescription
messageTypeEBMessageTypethe type of message

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:395


filterPrincipalId

filterPrincipalId<T>(principalId): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Filter messages only for principalId

Type parameters

NameType
Textends string

Parameters

NameTypeDescription
principalIdNonEmptyString<T>the principal id to subscribe

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:262


filterReceivedBy

filterReceivedBy<N, V, T, I>(serviceName, serviceVersion, serviceTarget, instanceId): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Add filter to only match messages received by given service function & version. Set one or more parameters to undefined means "do not filter by this criteria". For example:

This will filter for all messages send to function testFunction of service UserService. This will include messages from all versions of this function.

typescript
receivedBy('UserService', undefined, 'testFunction')

Type parameters

NameType
Nextends string
Vextends string
Textends string
Iextends string

Parameters

NameTypeDescription
serviceNameundefined | NonEmptyString<N>the name of the service that consumes the message
serviceVersionundefined | NonEmptyString<V>the version of the service that consumes the message
serviceTargetundefined | NonEmptyString<T>the command or subscription name of the service that consumes the message
instanceIdundefined | NonEmptyString<I>the event bridge instance id which should receive the message

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:370


filterSentFrom

filterSentFrom<N, V, T, I>(serviceName, serviceVersion, serviceTarget, instanceId): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Add filter to only match messages send by given service function & version. Set one or more parameters to undefined means "do not filter by this criteria". For example:

This will filter for all messages send from function testFunction of service UserService. This will include messages from all versions of this function.

typescript
sentFrom('UserService', undefined, 'testFunction')

Type parameters

NameType
Nextends string
Vextends string
Textends string
Iextends string

Parameters

NameTypeDescription
serviceNameundefined | NonEmptyString<N>the name of the service that produces the message
serviceVersionundefined | NonEmptyString<V>the version of the service that produces the message
serviceTargetundefined | NonEmptyString<T>the command or subscription name of the service that produces the message
instanceIdundefined | NonEmptyString<I>the event bridge instance id which was publishing the message

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:337


filterTenantId

filterTenantId<T>(tenantId): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Filter messages only for tenantId

Type parameters

NameType
Textends string

Parameters

NameTypeDescription
tenantIdNonEmptyString<T>the principal id to subscribe

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:272


getDefinition

getDefinition(): Promise<SubscriptionDefinition<ServiceClassType, SubscriptionDefinitionMetadataBase, MessagePayloadType, MessageParamsType, MessageResultType, Infer<PayloadSchema>, Infer<ParameterSchema>, Infer<ResultSchema>, Invokes, EmitListType>>

Returns the final subscription definition which will be passed into the service class.

Returns

Promise<SubscriptionDefinition<ServiceClassType, SubscriptionDefinitionMetadataBase, MessagePayloadType, MessageParamsType, MessageResultType, Infer<PayloadSchema>, Infer<ParameterSchema>, Infer<ResultSchema>, Invokes, EmitListType>>

SubscriptionDefinition

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:772


getSubscriptionContextMock

getSubscriptionContextMock(message, sandbox?): Object

Returns a mocked command function context, which can be used in unit tests.

Parameters

NameTypeDescription
messageEBMessage-
sandbox?SinonSandboxSinon sandbox

Returns

Object

a mocked command function context

NameType
mock{ configs: { getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction } ; emit: EmitCustomMessageFunction<{}> ; invoke: InvokeFunction ; logger: Logger ; message: Readonly<EBMessage> ; secrets: { getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction } ; service: Invokes ; startActiveSpan: <F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F> ; states: { getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction } ; wrapInSpan: <F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F> }
mock.configs{ getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction }
mock.configs.getConfigConfigGetterFunction
mock.configs.removeConfigConfigDeleteFunction
mock.configs.setConfigConfigSetterFunction
mock.emitEmitCustomMessageFunction<{}>
mock.invokeInvokeFunction
mock.loggerLogger
mock.messageReadonly<EBMessage>
mock.secrets{ getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction }
mock.secrets.getSecretSecretGetterFunction
mock.secrets.removeSecretSecretDeleteFunction
mock.secrets.setSecretSecretSetterFunction
mock.serviceInvokes
mock.startActiveSpan<F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F>
mock.states{ getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction }
mock.states.getStateStateGetterFunction
mock.states.removeStateStateDeleteFunction
mock.states.setStateStateSetterFunction
mock.wrapInSpan<F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F>
stubs{ emit: FromEmitToOtherType<EmitListType, SinonStub<any[], any>> = eventList; getConfig: SinonStub<any[], any> ; getSecret: SinonStub<any[], any> ; getState: SinonStub<any[], any> ; invoke: SinonStub<any[], any> ; logger: { debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> } = logger.stubs; removeConfig: SinonStub<any[], any> ; removeSecret: SinonStub<any[], any> ; removeState: SinonStub<any[], any> ; service: FromInvokeToOtherType<Invokes, SinonStub<any[], any>> ; setConfig: SinonStub<any[], any> ; setSecret: SinonStub<any[], any> ; setState: SinonStub<any[], any> ; startActiveSpan: SinonStub<any[], any> ; wrapInSpan: SinonStub<any[], any> }
stubs.emitFromEmitToOtherType<EmitListType, SinonStub<any[], any>>
stubs.getConfigSinonStub<any[], any>
stubs.getSecretSinonStub<any[], any>
stubs.getStateSinonStub<any[], any>
stubs.invokeSinonStub<any[], any>
stubs.logger{ debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> }
stubs.logger.debugSinonStub<any[], any>
stubs.logger.errorSinonStub<any[], any>
stubs.logger.fatalSinonStub<any[], any>
stubs.logger.infoSinonStub<any[], any>
stubs.logger.traceSinonStub<any[], any>
stubs.logger.warnSinonStub<any[], any>
stubs.removeConfigSinonStub<any[], any>
stubs.removeSecretSinonStub<any[], any>
stubs.removeStateSinonStub<any[], any>
stubs.serviceFromInvokeToOtherType<Invokes, SinonStub<any[], any>>
stubs.setConfigSinonStub<any[], any>
stubs.setSecretSinonStub<any[], any>
stubs.setStateSinonStub<any[], any>
stubs.startActiveSpanSinonStub<any[], any>
stubs.wrapInSpanSinonStub<any[], any>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:859


getSubscriptionFunction

getSubscriptionFunction(): SubscriptionFunction<ServiceClassType, MessagePayloadType, MessageParamsType, UnknownIfNever<IfDefined<PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends Schema<any, any, any, ""> ? IfDefined<PayloadSchema extends Schema<any, any, any, ""> ? InferType<PayloadSchema> : never> : never | PayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<PayloadSchema extends ZodType<any, ZodTypeDef, any> ? input<PayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? input<ParameterSchema> : never> : never>>, UnknownIfNever<IfDefined<ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends Schema<any, any, any, ""> ? IfDefined<ResultSchema extends Schema<any, any, any, ""> ? InferType<ResultSchema> : never> : never | ResultSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ResultSchema extends ZodType<any, ZodTypeDef, any> ? output<ResultSchema> : never> : never>>, Invokes, EmitListType>

Get the function implementation including input and output validation. Also, before and after hooks are triggered during execution.

Returns

SubscriptionFunction<ServiceClassType, MessagePayloadType, MessageParamsType, UnknownIfNever<IfDefined<PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends Schema<any, any, any, ""> ? IfDefined<PayloadSchema extends Schema<any, any, any, ""> ? InferType<PayloadSchema> : never> : never | PayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<PayloadSchema extends ZodType<any, ZodTypeDef, any> ? input<PayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? input<ParameterSchema> : never> : never>>, UnknownIfNever<IfDefined<ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends Schema<any, any, any, ""> ? IfDefined<ResultSchema extends Schema<any, any, any, ""> ? InferType<ResultSchema> : never> : never | ResultSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ResultSchema extends ZodType<any, ZodTypeDef, any> ? output<ResultSchema> : never> : never>>, Invokes, EmitListType>

the subscription function

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:712


getSubscriptionFunctionPlain

getSubscriptionFunctionPlain(): void

Get the function implementation without input and output validation. No hooks are triggered during execution.

Returns

void

the subscription function

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:749


getSubscriptionTransformContextMock

getSubscriptionTransformContextMock(message, sandbox?): Object

Returns a mocked transform function context, which can be used in unit tests.

Parameters

NameTypeDescription
messageEBMessage-
sandbox?SinonSandboxSinon sandbox

Returns

Object

a mocked transform function context

NameType
mock{ configs: { getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction } ; logger: Logger ; message: Readonly<EBMessage> ; secrets: { getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction } ; startActiveSpan: <F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F> ; states: { getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction } ; wrapInSpan: <F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F> }
mock.configs{ getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction }
mock.configs.getConfigConfigGetterFunction
mock.configs.removeConfigConfigDeleteFunction
mock.configs.setConfigConfigSetterFunction
mock.loggerLogger
mock.messageReadonly<EBMessage>
mock.secrets{ getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction }
mock.secrets.getSecretSecretGetterFunction
mock.secrets.removeSecretSecretDeleteFunction
mock.secrets.setSecretSecretSetterFunction
mock.startActiveSpan<F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F>
mock.states{ getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction }
mock.states.getStateStateGetterFunction
mock.states.removeStateStateDeleteFunction
mock.states.setStateStateSetterFunction
mock.wrapInSpan<F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F>
stubs{ getConfig: SinonStub<any[], any> ; getSecret: SinonStub<any[], any> ; getState: SinonStub<any[], any> ; logger: { debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> } = logger.stubs; removeConfig: SinonStub<any[], any> ; removeSecret: SinonStub<any[], any> ; removeState: SinonStub<any[], any> ; setConfig: SinonStub<any[], any> ; setSecret: SinonStub<any[], any> ; setState: SinonStub<any[], any> ; startActiveSpan: SinonStub<any[], any> ; wrapInSpan: SinonStub<any[], any> }
stubs.getConfigSinonStub<any[], any>
stubs.getSecretSinonStub<any[], any>
stubs.getStateSinonStub<any[], any>
stubs.logger{ debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> }
stubs.logger.debugSinonStub<any[], any>
stubs.logger.errorSinonStub<any[], any>
stubs.logger.fatalSinonStub<any[], any>
stubs.logger.infoSinonStub<any[], any>
stubs.logger.traceSinonStub<any[], any>
stubs.logger.warnSinonStub<any[], any>
stubs.removeConfigSinonStub<any[], any>
stubs.removeSecretSinonStub<any[], any>
stubs.removeStateSinonStub<any[], any>
stubs.setConfigSinonStub<any[], any>
stubs.setSecretSinonStub<any[], any>
stubs.setStateSinonStub<any[], any>
stubs.startActiveSpanSinonStub<any[], any>
stubs.wrapInSpanSinonStub<any[], any>

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:870


getTransformInputFunction

getTransformInputFunction(): undefined | SubscriptionTransformInputHook<ServiceClassType, UnknownIfNever<IfDefined<PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends Schema<any, any, any, ""> ? IfDefined<PayloadSchema extends Schema<any, any, any, ""> ? InferType<PayloadSchema> : never> : never | PayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<PayloadSchema extends ZodType<any, ZodTypeDef, any> ? input<PayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? input<ParameterSchema> : never> : never>>, MessagePayloadType, MessageParamsType>

Return the transform input function

Returns

undefined | SubscriptionTransformInputHook<ServiceClassType, UnknownIfNever<IfDefined<PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends Schema<any, any, any, ""> ? IfDefined<PayloadSchema extends Schema<any, any, any, ""> ? InferType<PayloadSchema> : never> : never | PayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<PayloadSchema extends ZodType<any, ZodTypeDef, any> ? input<PayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? input<ParameterSchema> : never> : never>>, MessagePayloadType, MessageParamsType>

the input transform function if defined

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:533


getTransformOutputFunction

getTransformOutputFunction(): undefined | SubscriptionTransformOutputHook<ServiceClassType, UnknownIfNever<IfDefined<ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends Schema<any, any, any, ""> ? IfDefined<ResultSchema extends Schema<any, any, any, ""> ? InferType<ResultSchema> : never> : never | ResultSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ResultSchema extends ZodType<any, ZodTypeDef, any> ? output<ResultSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? output<ParameterSchema> : never> : never>>, UnknownIfNever<IfDefined<ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends Schema<any, any, any, ""> ? IfDefined<ResultSchema extends Schema<any, any, any, ""> ? InferType<ResultSchema> : never> : never | ResultSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ResultSchema extends ZodType<any, ZodTypeDef, any> ? output<ResultSchema> : never> : never>>>

Return the transform output function

Returns

undefined | SubscriptionTransformOutputHook<ServiceClassType, UnknownIfNever<IfDefined<ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends Schema<any, any, any, ""> ? IfDefined<ResultSchema extends Schema<any, any, any, ""> ? InferType<ResultSchema> : never> : never | ResultSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ResultSchema extends ZodType<any, ZodTypeDef, any> ? output<ResultSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? output<ParameterSchema> : never> : never>>, UnknownIfNever<IfDefined<ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends Schema<any, any, any, ""> ? IfDefined<ResultSchema extends Schema<any, any, any, ""> ? InferType<ResultSchema> : never> : never | ResultSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ResultSchema extends ZodType<any, ZodTypeDef, any> ? output<ResultSchema> : never> : never>>>

the transform output function if defined

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:592


receiveMessageOnEveryInstance

receiveMessageOnEveryInstance(enforce?): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Instruct the event bridge message broker to send the matching message to every running instance. The underlaying message broker must support this functionality.

In serverless environments, this flag should not have any effect

Parameters

NameTypeDefault value
enforcebooleantrue

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

SubscriptionDefinition

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:303


setAfterGuardHooks

setAfterGuardHooks(afterGuards): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Set one or more after guard hook(s). If there are multiple after guard hooks, they are executed in parallel

Parameters

NameType
afterGuardsRecord<string, SubscriptionAfterGuardHook<ServiceClassType, UnknownIfNever<IfDefined<ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends Schema<any, any, any, ""> ? IfDefined<ResultSchema extends Schema<any, any, any, ""> ? InferType<ResultSchema> : never> : never | ResultSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ResultSchema extends ZodType<any, ZodTypeDef, any> ? output<ResultSchema> : never> : never>>, UnknownIfNever<IfDefined<PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends Schema<any, any, any, ""> ? IfDefined<PayloadSchema extends Schema<any, any, any, ""> ? InferType<PayloadSchema> : never> : never | PayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<PayloadSchema extends ZodType<any, ZodTypeDef, any> ? output<PayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? output<ParameterSchema> : never> : never>>, Invokes, EmitListType>>

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

SubscriptionDefinitionBuilder

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:627


setBeforeGuardHooks

setBeforeGuardHooks(beforeGuards): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Set one or more before guard hook(s). If there are multiple before guard hooks, they are executed in parallel

Parameters

NameTypeDescription
beforeGuardsRecord<string, SubscriptionBeforeGuardHook<ServiceClassType, UnknownIfNever<IfDefined<PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends Schema<any, any, any, ""> ? IfDefined<PayloadSchema extends Schema<any, any, any, ""> ? InferType<PayloadSchema> : never> : never | PayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<PayloadSchema extends ZodType<any, ZodTypeDef, any> ? output<PayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? output<ParameterSchema> : never> : never>>, Invokes, EmitListType>>Object of key = name of guard, value = function

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

SubscriptionDefinitionBuilder

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:611


setSubscriptionFunction

setSubscriptionFunction(fn): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Required: Set the function implementation. The types should be automatically set as soon as schemas previously defined. As the function will be a a function of a service class you need to implement as function declaration. Anonymous functions do not have access to the this scope.

Parameters

NameTypeDescription
fnSubscriptionFunction<ServiceClassType, MessagePayloadType, MessageParamsType, Infer<PayloadSchema>, Infer<ParameterSchema>, Infer<ResultSchema>, Invokes, EmitListType>the function implementation

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

SubscriptionDefinitionBuilder

Example

ts
async function (context, payload, parameter) {

   return `the result output payload`
}

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:660


setTransformInput

setTransformInput<TransFormPayloadSchema, TransFormParameterSchema>(transformInputSchema, transformParameterSchema, transformFunction, inputContentType?, inputContentEncoding?): SubscriptionDefinitionBuilder<ServiceClassType, UnknownIfNever<IfDefined<TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends Schema<any, any, any, ""> ? IfDefined<TransFormPayloadSchema extends Schema<any, any, any, ""> ? InferType<TransFormPayloadSchema> : never> : never | TransFormPayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<TransFormPayloadSchema extends ZodType<any, ZodTypeDef, any> ? input<TransFormPayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends Schema<any, any, any, ""> ? IfDefined<TransFormParameterSchema extends Schema<any, any, any, ""> ? InferType<TransFormParameterSchema> : never> : never | TransFormParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<TransFormParameterSchema extends ZodType<any, ZodTypeDef, any> ? input<TransFormParameterSchema> : never> : never>>, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Set a transform input hook which will encode or transform the input payload and parameters. Will be executed as first step before input validation, before guard and the function itself. This will change the type of input message payload and input message parameter.

Type parameters

NameType
TransFormPayloadSchemaextends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>
TransFormParameterSchemaextends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>

Parameters

NameTypeDescription
transformInputSchemaTransFormPayloadSchemaInput payload validation schema
transformParameterSchemaTransFormParameterSchemaInput parameter validation schema
transformFunctionSubscriptionTransformInputHook<ServiceClassType, UnknownIfNever<IfDefined<PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends never ? never : never | PayloadSchema extends Schema<any, any, any, ""> ? IfDefined<PayloadSchema extends Schema<any, any, any, ""> ? InferType<PayloadSchema> : never> : never | PayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<PayloadSchema extends ZodType<any, ZodTypeDef, any> ? input<PayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? input<ParameterSchema> : never> : never>>, UnknownIfNever<IfDefined<TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends Schema<any, any, any, ""> ? IfDefined<TransFormPayloadSchema extends Schema<any, any, any, ""> ? InferType<TransFormPayloadSchema> : never> : never | TransFormPayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<TransFormPayloadSchema extends ZodType<any, ZodTypeDef, any> ? input<TransFormPayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends Schema<any, any, any, ""> ? IfDefined<TransFormParameterSchema extends Schema<any, any, any, ""> ? InferType<TransFormParameterSchema> : never> : never | TransFormParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<TransFormParameterSchema extends ZodType<any, ZodTypeDef, any> ? input<TransFormParameterSchema> : never> : never>>>the transform input function
inputContentType?stringoptional the content type of payload
inputContentEncoding?stringoptional the content encoding

Returns

SubscriptionDefinitionBuilder<ServiceClassType, UnknownIfNever<IfDefined<TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends never ? never : never | TransFormPayloadSchema extends Schema<any, any, any, ""> ? IfDefined<TransFormPayloadSchema extends Schema<any, any, any, ""> ? InferType<TransFormPayloadSchema> : never> : never | TransFormPayloadSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<TransFormPayloadSchema extends ZodType<any, ZodTypeDef, any> ? input<TransFormPayloadSchema> : never> : never>>, UnknownIfNever<IfDefined<TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends never ? never : never | TransFormParameterSchema extends Schema<any, any, any, ""> ? IfDefined<TransFormParameterSchema extends Schema<any, any, any, ""> ? InferType<TransFormParameterSchema> : never> : never | TransFormParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<TransFormParameterSchema extends ZodType<any, ZodTypeDef, any> ? input<TransFormParameterSchema> : never> : never>>, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

SubscriptionDefinitionBuilder

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:495


setTransformOutput

setTransformOutput<Output>(transformOutputSchema, transformFunction, outputContentType?, outputContentEncoding?): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, UnknownIfNever<IfDefined<Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends Schema<any, any, any, ""> ? IfDefined<Output extends Schema<any, any, any, ""> ? InferType<Output> : never> : never | Output extends ZodType<any, ZodTypeDef, any> ? IfDefined<Output extends ZodType<any, ZodTypeDef, any> ? output<Output> : never> : never>>, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Set a transform output hook which will encode or transform the response payload. Will be executed at very last step after function execution, output validation and after guard hooks. This will change the type of output message payload.

Type parameters

NameType
Outputextends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>

Parameters

NameTypeDescription
transformOutputSchemaOutputThe output validation schema
transformFunctionSubscriptionTransformOutputHook<ServiceClassType, UnknownIfNever<IfDefined<ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends never ? never : never | ResultSchema extends Schema<any, any, any, ""> ? IfDefined<ResultSchema extends Schema<any, any, any, ""> ? InferType<ResultSchema> : never> : never | ResultSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ResultSchema extends ZodType<any, ZodTypeDef, any> ? output<ResultSchema> : never> : never>>, UnknownIfNever<IfDefined<ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends never ? never : never | ParameterSchema extends Schema<any, any, any, ""> ? IfDefined<ParameterSchema extends Schema<any, any, any, ""> ? InferType<ParameterSchema> : never> : never | ParameterSchema extends ZodType<any, ZodTypeDef, any> ? IfDefined<ParameterSchema extends ZodType<any, ZodTypeDef, any> ? output<ParameterSchema> : never> : never>>, UnknownIfNever<IfDefined<Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends Schema<any, any, any, ""> ? IfDefined<Output extends Schema<any, any, any, ""> ? InferType<Output> : never> : never | Output extends ZodType<any, ZodTypeDef, any> ? IfDefined<Output extends ZodType<any, ZodTypeDef, any> ? input<Output> : never> : never>>>the transform output function
outputContentType?stringoptional the content type of payload
outputContentEncoding?stringoptional the content encoding

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, UnknownIfNever<IfDefined<Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends never ? never : never | Output extends Schema<any, any, any, ""> ? IfDefined<Output extends Schema<any, any, any, ""> ? InferType<Output> : never> : never | Output extends ZodType<any, ZodTypeDef, any> ? IfDefined<Output extends ZodType<any, ZodTypeDef, any> ? output<Output> : never> : never>>, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

SubscriptionDefinitionBuilder

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:557


subscribeToEvent

subscribeToEvent<N, V>(eventName, serviceVersion?): SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

Add a filter to only subscribe to messages with matching event name

Type parameters

NameType
Nextends string
Vextends string

Parameters

NameTypeDescription
eventNameNonEmptyString<N>The name of event to subscribe
serviceVersion?NonEmptyString<V>the version of the service that produces the event

Returns

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>

SubscriptionDefinitionBuilder

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:247