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
Name | Type |
---|---|
ServiceClassType | extends ServiceClass = ServiceClass |
MessagePayloadType | unknown |
MessageParamsType | undefined |
MessageResultType | void |
PayloadSchema | extends Schema = ZodAny |
ParameterSchema | extends Schema = ZodAny |
ResultSchema | extends Schema = ZodAny |
Invokes | {} |
EmitListType | {} |
Table of contents
Constructors
Properties
- autoacknowledge
- durable
- emitEventName
- emitList
- eventName
- fn
- hooks
- inputContentEncoding
- inputContentType
- inputSchema
- invokes
- messageType
- outputContentEncoding
- outputContentType
- outputSchema
- parameterSchema
- principalId
- receiver
- sender
- shared
- subscriptionDescription
- subscriptionName
- tenantId
Methods
- addOutputSchema
- addParameterSchema
- addPayloadSchema
- adviceAutoacknowledgeMessage
- adviceDurable
- canEmit
- canInvoke
- filterForMessageType
- filterPrincipalId
- filterReceivedBy
- filterSentFrom
- filterTenantId
- getDefinition
- getSubscriptionContextMock
- getSubscriptionFunction
- getSubscriptionFunctionPlain
- getSubscriptionTransformContextMock
- getTransformInputFunction
- getTransformOutputFunction
- receiveMessageOnEveryInstance
- setAfterGuardHooks
- setBeforeGuardHooks
- setSubscriptionFunction
- setTransformInput
- setTransformOutput
- subscribeToEvent
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
Name | Type |
---|---|
ServiceClassType | extends ServiceClass <unknown > = ServiceClass <unknown > |
MessagePayloadType | unknown |
MessageParamsType | undefined |
MessageResultType | void |
PayloadSchema | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > = ZodAny |
ParameterSchema | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > = ZodAny |
ResultSchema | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > = ZodAny |
Invokes | {} |
EmitListType | {} |
Parameters
Name | Type |
---|---|
subscriptionName | string |
subscriptionDescription | string |
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
Name | Type |
---|---|
afterGuard | Record <string , SubscriptionAfterGuardHook <ServiceClassType , Infer <ResultSchema >, Infer <PayloadSchema >, Infer <ParameterSchema >, Invokes , EmitListType >> |
beforeGuard | Record <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.transformFunction | SubscriptionTransformInputHook <ServiceClassType , any , any , any , any > |
transformInput.transformInputSchema | Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
transformInput.transformParameterSchema | Schema <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.transformFunction | SubscriptionTransformOutputHook <ServiceClassType , Infer <ResultSchema >, Infer <PayloadSchema >, any > |
transformOutput.transformOutputSchema | Schema <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
Name | Type |
---|---|
instanceId? | string |
serviceName? | string |
serviceTarget? | string |
serviceVersion? | string |
Defined in
SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:104
sender
• Private
Optional
sender: Object
Type declaration
Name | Type |
---|---|
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
Name | Type |
---|---|
T | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
eventName | string | undefined | the event name to be used when the subscription result is emitted as custom event |
outputSchema | T | undefined | the validation schema for the output payload |
outputContentType | string | 'application/json' | optional the content type of payload |
outputContentEncoding | string | '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
Name | Type |
---|---|
T | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
Parameters
Name | Type | Description |
---|---|---|
parameterSchema | T | the 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
Name | Type |
---|---|
T | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
inputSchema | T | undefined | the validation schema for input payload |
inputContentType | string | 'application/json' | optional the content type of payload |
inputContentEncoding | string | '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
Name | Type | Default value | Description |
---|---|---|---|
acknowledge | boolean | true | Enable (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
Name | Type |
---|---|
durable | boolean |
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
Name | Type |
---|---|
EventName | extends string |
T | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
Parameters
Name | Type | Description |
---|---|---|
eventName | EventName | The custom event name |
schema | T | the 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
Name | Type |
---|---|
Output | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
Payload | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
Parameter | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
SName | extends string = string |
Version | extends string = string |
Fname | extends string = string |
Parameters
Name | Type |
---|---|
serviceName | SName |
serviceVersion | Version |
serviceTarget | Fname |
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
Name | Type | Description |
---|---|---|
messageType | EBMessageType | the 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
Name | Type |
---|---|
T | extends string |
Parameters
Name | Type | Description |
---|---|---|
principalId | NonEmptyString <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.
receivedBy('UserService', undefined, 'testFunction')
Type parameters
Name | Type |
---|---|
N | extends string |
V | extends string |
T | extends string |
I | extends string |
Parameters
Name | Type | Description |
---|---|---|
serviceName | undefined | NonEmptyString <N > | the name of the service that consumes the message |
serviceVersion | undefined | NonEmptyString <V > | the version of the service that consumes the message |
serviceTarget | undefined | NonEmptyString <T > | the command or subscription name of the service that consumes the message |
instanceId | undefined | 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.
sentFrom('UserService', undefined, 'testFunction')
Type parameters
Name | Type |
---|---|
N | extends string |
V | extends string |
T | extends string |
I | extends string |
Parameters
Name | Type | Description |
---|---|---|
serviceName | undefined | NonEmptyString <N > | the name of the service that produces the message |
serviceVersion | undefined | NonEmptyString <V > | the version of the service that produces the message |
serviceTarget | undefined | NonEmptyString <T > | the command or subscription name of the service that produces the message |
instanceId | undefined | 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
Name | Type |
---|---|
T | extends string |
Parameters
Name | Type | Description |
---|---|---|
tenantId | NonEmptyString <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
Name | Type | Description |
---|---|---|
message | EBMessage | - |
sandbox? | SinonSandbox | Sinon sandbox |
Returns
Object
a mocked command function context
Name | Type |
---|---|
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.getConfig | ConfigGetterFunction |
mock.configs.removeConfig | ConfigDeleteFunction |
mock.configs.setConfig | ConfigSetterFunction |
mock.emit | EmitCustomMessageFunction <{}> |
mock.invoke | InvokeFunction |
mock.logger | Logger |
mock.message | Readonly <EBMessage > |
mock.secrets | { getSecret : SecretGetterFunction ; removeSecret : SecretDeleteFunction ; setSecret : SecretSetterFunction } |
mock.secrets.getSecret | SecretGetterFunction |
mock.secrets.removeSecret | SecretDeleteFunction |
mock.secrets.setSecret | SecretSetterFunction |
mock.service | Invokes |
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.getState | StateGetterFunction |
mock.states.removeState | StateDeleteFunction |
mock.states.setState | StateSetterFunction |
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.emit | FromEmitToOtherType <EmitListType , SinonStub <any [], any >> |
stubs.getConfig | SinonStub <any [], any > |
stubs.getSecret | SinonStub <any [], any > |
stubs.getState | SinonStub <any [], any > |
stubs.invoke | SinonStub <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.debug | SinonStub <any [], any > |
stubs.logger.error | SinonStub <any [], any > |
stubs.logger.fatal | SinonStub <any [], any > |
stubs.logger.info | SinonStub <any [], any > |
stubs.logger.trace | SinonStub <any [], any > |
stubs.logger.warn | SinonStub <any [], any > |
stubs.removeConfig | SinonStub <any [], any > |
stubs.removeSecret | SinonStub <any [], any > |
stubs.removeState | SinonStub <any [], any > |
stubs.service | FromInvokeToOtherType <Invokes , SinonStub <any [], any >> |
stubs.setConfig | SinonStub <any [], any > |
stubs.setSecret | SinonStub <any [], any > |
stubs.setState | SinonStub <any [], any > |
stubs.startActiveSpan | SinonStub <any [], any > |
stubs.wrapInSpan | SinonStub <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
Name | Type | Description |
---|---|---|
message | EBMessage | - |
sandbox? | SinonSandbox | Sinon sandbox |
Returns
Object
a mocked transform function context
Name | Type |
---|---|
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.getConfig | ConfigGetterFunction |
mock.configs.removeConfig | ConfigDeleteFunction |
mock.configs.setConfig | ConfigSetterFunction |
mock.logger | Logger |
mock.message | Readonly <EBMessage > |
mock.secrets | { getSecret : SecretGetterFunction ; removeSecret : SecretDeleteFunction ; setSecret : SecretSetterFunction } |
mock.secrets.getSecret | SecretGetterFunction |
mock.secrets.removeSecret | SecretDeleteFunction |
mock.secrets.setSecret | SecretSetterFunction |
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.getState | StateGetterFunction |
mock.states.removeState | StateDeleteFunction |
mock.states.setState | StateSetterFunction |
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.getConfig | SinonStub <any [], any > |
stubs.getSecret | SinonStub <any [], any > |
stubs.getState | SinonStub <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.debug | SinonStub <any [], any > |
stubs.logger.error | SinonStub <any [], any > |
stubs.logger.fatal | SinonStub <any [], any > |
stubs.logger.info | SinonStub <any [], any > |
stubs.logger.trace | SinonStub <any [], any > |
stubs.logger.warn | SinonStub <any [], any > |
stubs.removeConfig | SinonStub <any [], any > |
stubs.removeSecret | SinonStub <any [], any > |
stubs.removeState | SinonStub <any [], any > |
stubs.setConfig | SinonStub <any [], any > |
stubs.setSecret | SinonStub <any [], any > |
stubs.setState | SinonStub <any [], any > |
stubs.startActiveSpan | SinonStub <any [], any > |
stubs.wrapInSpan | SinonStub <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
Name | Type | Default value |
---|---|---|
enforce | boolean | true |
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
Name | Type |
---|---|
afterGuards | Record <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
Name | Type | Description |
---|---|---|
beforeGuards | Record <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
Name | Type | Description |
---|---|---|
fn | SubscriptionFunction <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
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
Name | Type |
---|---|
TransFormPayloadSchema | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
TransFormParameterSchema | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
Parameters
Name | Type | Description |
---|---|---|
transformInputSchema | TransFormPayloadSchema | Input payload validation schema |
transformParameterSchema | TransFormParameterSchema | Input parameter validation schema |
transformFunction | 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 >>, 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? | string | optional the content type of payload |
inputContentEncoding? | string | optional 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
Name | Type |
---|---|
Output | extends Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
Parameters
Name | Type | Description |
---|---|---|
transformOutputSchema | Output | The output validation schema |
transformFunction | 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 <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? | string | optional the content type of payload |
outputContentEncoding? | string | optional 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
Name | Type |
---|---|
N | extends string |
V | extends string |
Parameters
Name | Type | Description |
---|---|---|
eventName | NonEmptyString <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