PURISTA API / Modules / @purista/core / CommandDefinitionBuilder
Class: CommandDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>
@purista/core.CommandDefinitionBuilder
Command definition builder is a helper to create and define a command for a service. It helps to set all needed information like schemas and hooks. With these information, the types are automatically set and extended.
A working schema definition needs at least a command name, a short description and the function implementation.
Type parameters
Name | Type |
---|---|
ServiceClassType | extends ServiceClass |
MessagePayloadType | unknown |
MessageParamsType | {} |
MessageResultType | void |
PayloadSchema | extends Schema = ZodAny |
ParameterSchema | extends Schema = ZodAny |
ResultSchema | extends Schema = ZodAny |
Invokes | {} |
EmitListType | {} |
Table of contents
Constructors
Properties
- autoacknowledge
- commandDescription
- commandName
- deprecated
- durable
- emitList
- errorStatusCodes
- eventName
- fn
- hooks
- httpMetadata
- inputContentEncoding
- inputContentType
- inputSchema
- invokes
- isSecure
- operationId
- outputContentEncoding
- outputContentType
- outputSchema
- parameterSchema
- queryParameter
- summary
- tags
Methods
- addOpenApiErrorStatusCodes
- addOpenApiTags
- addOutputSchema
- addParameterSchema
- addPayloadSchema
- addQueryParameters
- adviceAutoacknowledgeMessages
- canEmit
- canInvoke
- disableHttpSecurity
- enableHttpSecurity
- exposeAsHttpEndpoint
- extendWithHttpMetadata
- getCommandContextMock
- getCommandFunction
- getCommandFunctionPlain
- getCommandTransformContextMock
- getDefinition
- getTransformInputFunction
- getTransformOutputFunction
- markAsDeprecated
- setAfterGuardHooks
- setBeforeGuardHooks
- setCommandFunction
- setOpenApiOperationId
- setOpenApiSummary
- setSuccessEventName
- setTransformInput
- setTransformOutput
Constructors
constructor
• new CommandDefinitionBuilder<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>(commandName
, commandDescription
, eventName?
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Type parameters
Name | Type |
---|---|
ServiceClassType | extends ServiceClass <unknown > |
MessagePayloadType | unknown |
MessageParamsType | {} |
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 |
---|---|
commandName | string |
commandDescription | string |
eventName? | string |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:135
Properties
autoacknowledge
• Private
autoacknowledge: boolean
= true
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:72
commandDescription
• Private
commandDescription: string
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:137
commandName
• Private
commandName: string
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:136
deprecated
• Private
deprecated: boolean
= false
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:61
durable
• Private
durable: boolean
= false
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:71
emitList
• Private
emitList: EmitListType
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:79
errorStatusCodes
• Private
errorStatusCodes: StatusCode
[] = []
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:65
eventName
• Private
Optional
eventName: string
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:138
fn
• Private
Optional
fn: CommandFunction
<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
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:123
hooks
• Private
hooks: Object
Type declaration
Name | Type |
---|---|
afterGuard | Record <string , CommandAfterGuardHook <ServiceClassType , MessagePayloadType , MessageParamsType , Infer <ResultSchema >, Infer <PayloadSchema >, Infer <ParameterSchema >, Invokes , EmitListType >> |
beforeGuard | Record <string , CommandBeforeGuardHook <ServiceClassType , MessagePayloadType , MessageParamsType , Infer <PayloadSchema >, Infer <ParameterSchema >, Invokes , EmitListType >> |
transformInput? | { transformFunction : CommandTransformInputHook <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 | CommandTransformInputHook <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 : CommandTransformOutputHook <ServiceClassType , any , any , any , any , any > ; transformOutputSchema : Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > } |
transformOutput.transformFunction | CommandTransformOutputHook <ServiceClassType , any , any , any , any , any > |
transformOutput.transformOutputSchema | Schema <any , any , any , "" > | ZodType <any , ZodTypeDef , any > |
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:81
httpMetadata
• Private
Optional
httpMetadata: Object
Type declaration
Name | Type |
---|---|
expose | { contentEncodingRequest? : string ; contentEncodingResponse? : string ; contentTypeRequest? : string ; contentTypeResponse? : string ; deprecated? : boolean ; inputPayload? : SchemaObject ; outputPayload? : SchemaObject ; parameter? : SchemaObject } & { http : { method : "GET" | "POST" | "PATCH" | "PUT" | "DELETE" ; openApi? : { additionalStatusCodes? : StatusCode [] ; description : string ; isSecure : boolean ; operationId? : string ; query? : QueryParameter <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 >>>[] ; summary : string ; tags? : string [] } ; path : string } } |
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:49
inputContentEncoding
• Private
inputContentEncoding: undefined
| string
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:52
inputContentType
• Private
inputContentType: undefined
| string
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:51
inputSchema
• Private
Optional
inputSchema: PayloadSchema
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:50
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
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:74
isSecure
• Private
isSecure: boolean
= true
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:67
operationId
• Private
Optional
operationId: string
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:69
outputContentEncoding
• Private
outputContentEncoding: undefined
| string
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:55
outputContentType
• Private
outputContentType: undefined
| string
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:54
outputSchema
• Private
Optional
outputSchema: ResultSchema
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:53
parameterSchema
• Private
Optional
parameterSchema: ParameterSchema
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:56
queryParameter
• Private
queryParameter: QueryParameter
<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
>>>[] = []
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:57
summary
• Private
Optional
summary: string
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:63
tags
• Private
tags: string
[] = []
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:59
Methods
addOpenApiErrorStatusCodes
▸ addOpenApiErrorStatusCodes(...codes
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
If a function can return other status codes, than the default ones, you should add them to openApi definition. Per default, 200, 204, 400, 401 and 500 can be autogenerated in most cases. Special cases or different status codes should be added with this function.
Parameters
Name | Type | Description |
---|---|---|
...codes | StatusCode [] | List of status codes |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Example
addErrorStatusCodes(StatusCode.PaymentRequired, StatusCode.Conflict)
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:394
addOpenApiTags
▸ addOpenApiTags(...tags
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Add tags for openApi definition for given function. It is recommended to use some enum for tags to avoid typo issues.
Parameters
Name | Type | Description |
---|---|---|
...tags | string [] | List of tag strings |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Example
addTags('User','Public')
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:376
addOutputSchema
▸ addOutputSchema<T
>(outputSchema
, outputContentType?
, outputContentEncoding?
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, 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
> ? output
<T
> : never
> : never
>>, 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 | Description |
---|---|---|
outputSchema | T | The schema validation for output payload |
outputContentType? | string | optional the content type of payload |
outputContentEncoding? | string | optional the content encoding |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, 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
> ? output
<T
> : never
> : never
>>, PayloadSchema
, ParameterSchema
, T
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:290
addParameterSchema
▸ addParameterSchema<T
>(parameterSchema
): CommandDefinitionBuilder
<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 schema validation for output parameter |
Returns
CommandDefinitionBuilder
<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
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:322
addPayloadSchema
▸ addPayloadSchema<T
>(inputSchema
, inputContentType?
, inputContentEncoding?
): CommandDefinitionBuilder
<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 | Description |
---|---|---|
inputSchema | T | The schema validation for input payload |
inputContentType? | string | optional the content type of payload |
inputContentEncoding? | string | optional the content encoding |
Returns
CommandDefinitionBuilder
<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
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:265
addQueryParameters
▸ addQueryParameters(...queryParams
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Define query parameters if you expose the function as http endpoint. Query parameters are add to openApi definition. Query parameters are add to input parameters.
Parameters
Name | Type | Description |
---|---|---|
...queryParams | QueryParameter <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 >>>[] | Add one or more query parameter definitions |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Example
.addQueryParameters(
{
required: false,
name: 'search',
},
{
required: false,
name: 'limit',
},
)
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:359
adviceAutoacknowledgeMessages
▸ adviceAutoacknowledgeMessages(acknowledge?
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Instruct the event bridge message broker to autoacknowledge commands as soon as they arrive. This means, a message will not be resent, if the command execution fails unexpected.
If set to false, the command message will be resent from message broker to eventbridge, if:
- the underlaying message broker supports it
- if the command execution fails unexpected
- if sending of command response failed
Parameters
Name | Type | Default value | Description |
---|---|---|---|
acknowledge | boolean | true | Enable (true) and disable (false) |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinition
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:726
canEmit
▸ canEmit<EventName
, T
>(eventName
, schema
): CommandDefinitionBuilder
<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
CommandDefinitionBuilder
<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
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:226
canInvoke
▸ canInvoke<Output
, Payload
, Parameter
, SName
, Version
, Fname
>(serviceName
, serviceVersion
, serviceTarget
, outputSchema?
, payloadSchema?
, parameterSchema?
): CommandDefinitionBuilder
<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
>
Define a command which can be invoked by the current command
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
CommandDefinitionBuilder
<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
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:151
disableHttpSecurity
▸ disableHttpSecurity(disabled?
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
enable or disable security for this endpoint
Parameters
Name | Type | Default value |
---|---|---|
disabled | boolean | true |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:626
enableHttpSecurity
▸ enableHttpSecurity(enabled?
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
enable or disable security for this endpoint
Parameters
Name | Type | Default value | Description |
---|---|---|---|
enabled | boolean | true | Defaults to true if not set means "enable security" |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:616
exposeAsHttpEndpoint
▸ exposeAsHttpEndpoint(method
, path
, contentTypeRequest?
, contentEncodingRequest?
, contentTypeResponse?
, contentEncodingResponse?
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Mark the function to be exposed as http endpoint.
Api url prefix and service version are prepended automatically
For exposing a url like: /api/V1/user/login
simply provide user/login
as path
Parameters
Name | Type | Description |
---|---|---|
method | SupportedHttpMethod | Http method POST, PUT, PATCH, GET, DELETE |
path | string | The url path |
contentTypeRequest? | string | input content type defaults to application/json |
contentEncodingRequest? | string | input content encoding defaults to utf-8 |
contentTypeResponse? | string | input content type defaults to application/json |
contentEncodingResponse? | string | input content encoding defaults to utf-8 |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:588
extendWithHttpMetadata
▸ extendWithHttpMetadata(definition
): Complete
<CommandDefinition
<ServiceClassType
, CommandDefinitionMetadataBase
, MessagePayloadType
, MessageParamsType
, MessageResultType
, 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
> ? output
<ResultSchema
> : never
> : never
>>, Invokes
, EmitListType
>>
Parameters
Name | Type |
---|---|
definition | Complete <CommandDefinition <ServiceClassType , CommandDefinitionMetadataBase , MessagePayloadType , MessageParamsType , MessageResultType , 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 > ? output <ResultSchema > : never > : never >>, Invokes , EmitListType >> |
Returns
Complete
<CommandDefinition
<ServiceClassType
, CommandDefinitionMetadataBase
, MessagePayloadType
, MessageParamsType
, MessageResultType
, 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
> ? output
<ResultSchema
> : never
> : never
>>, Invokes
, EmitListType
>>
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:657
getCommandContextMock
▸ getCommandContextMock(payload
, parameter
, sandbox?
): Object
Returns a mocked command function context, which can be used in unit tests.
Parameters
Name | Type | Description |
---|---|---|
payload | MessagePayloadType | - |
parameter | MessageParamsType | - |
sandbox? | SinonSandbox | Sinon sandbox |
Returns
Object
a mocked command function context
Name | Type |
---|---|
mock | { configs : { getConfig : ConfigGetterFunction ; removeConfig : ConfigDeleteFunction ; setConfig : ConfigSetterFunction } ; emit : EmitCustomMessageFunction <EmitListType > ; invoke : InvokeFunction ; logger : Logger ; message : Readonly <{ contentEncoding : string ; contentType : string ; correlationId : string ; eventName? : string ; id : string ; messageType : Command ; otp? : string ; payload : { parameter : MessageParamsType ; payload : MessagePayloadType } ; principalId? : string ; receiver : EBMessageAddress ; sender : { instanceId : string ; serviceName : string ; serviceTarget : string ; serviceVersion : string } ; tenantId? : string ; timestamp : number ; traceId? : string }> ; 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 <EmitListType > |
mock.invoke | InvokeFunction |
mock.logger | Logger |
mock.message | Readonly <{ contentEncoding : string ; contentType : string ; correlationId : string ; eventName? : string ; id : string ; messageType : Command ; otp? : string ; payload : { parameter : MessageParamsType ; payload : MessagePayloadType } ; principalId? : string ; receiver : EBMessageAddress ; sender : { instanceId : string ; serviceName : string ; serviceTarget : string ; serviceVersion : string } ; tenantId? : string ; timestamp : number ; traceId? : string }> |
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
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:940
getCommandFunction
▸ getCommandFunction(): CommandFunction
<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
CommandFunction
<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 function
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:880
getCommandFunctionPlain
▸ getCommandFunctionPlain(): CommandFunction
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, Infer
<PayloadSchema
>, Infer
<ParameterSchema
>, InferIn
<ResultSchema
>, Invokes
, EmitListType
>
Get the function implementation without input and output validation. No hooks are triggered during execution.
Returns
CommandFunction
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, Infer
<PayloadSchema
>, Infer
<ParameterSchema
>, InferIn
<ResultSchema
>, Invokes
, EmitListType
>
the function
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:913
getCommandTransformContextMock
▸ getCommandTransformContextMock(payload
, parameter
, sandbox?
): Object
Returns a mocked transform function context, which can be used in unit tests.
Parameters
Name | Type | Description |
---|---|---|
payload | MessagePayloadType | - |
parameter | MessageParamsType | - |
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 <{ contentEncoding : string ; contentType : string ; correlationId : string ; eventName? : string ; id : string ; messageType : Command ; otp? : string ; payload : { parameter : MessageParamsType ; payload : MessagePayloadType } ; principalId? : string ; receiver : EBMessageAddress ; sender : { instanceId : string ; serviceName : string ; serviceTarget : string ; serviceVersion : string } ; tenantId? : string ; timestamp : number ; traceId? : string }> ; 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 <{ contentEncoding : string ; contentType : string ; correlationId : string ; eventName? : string ; id : string ; messageType : Command ; otp? : string ; payload : { parameter : MessageParamsType ; payload : MessagePayloadType } ; principalId? : string ; receiver : EBMessageAddress ; sender : { instanceId : string ; serviceName : string ; serviceTarget : string ; serviceVersion : string } ; tenantId? : string ; timestamp : number ; traceId? : string }> |
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
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:957
getDefinition
▸ getDefinition(): Promise
<CommandDefinition
<ServiceClassType
, CommandDefinitionMetadataBase
, MessagePayloadType
, MessageParamsType
, MessageResultType
, Infer
<PayloadSchema
>, Infer
<ParameterSchema
>, Infer
<ResultSchema
>, Invokes
, EmitListType
>>
Creates and returns the CommandDefinition used as input for the service.
Returns
Promise
<CommandDefinition
<ServiceClassType
, CommandDefinitionMetadataBase
, MessagePayloadType
, MessageParamsType
, MessageResultType
, Infer
<PayloadSchema
>, Infer
<ParameterSchema
>, Infer
<ResultSchema
>, Invokes
, EmitListType
>>
CommandDefinition
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:735
getTransformInputFunction
▸ getTransformInputFunction(): undefined
| CommandTransformInputHook
<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
| CommandTransformInputHook
<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
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:448
getTransformOutputFunction
▸ getTransformOutputFunction(): undefined
| CommandTransformOutputHook
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, 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
>>>
Return the transform output function
Returns
undefined
| CommandTransformOutputHook
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, 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
>>>
the transform output function if defined
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:509
markAsDeprecated
▸ markAsDeprecated(): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Mark this endpoint/command as deprecated
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:311
setAfterGuardHooks
▸ setAfterGuardHooks(afterGuards
): CommandDefinitionBuilder
<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 , CommandAfterGuardHook <ServiceClassType , MessagePayloadType , MessageParamsType , 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
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:554
setBeforeGuardHooks
▸ setBeforeGuardHooks(beforeGuards
): CommandDefinitionBuilder
<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 , CommandBeforeGuardHook <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 >>, Invokes , EmitListType >> | Object of key = name of guard, value = function |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:530
setCommandFunction
▸ setCommandFunction(fn
): CommandDefinitionBuilder
<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 | CommandFunction <ServiceClassType , MessagePayloadType , MessageParamsType , Infer <PayloadSchema >, Infer <ParameterSchema >, InferIn <ResultSchema >, Invokes , EmitListType > | the function implementation |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Example
async function (context, payload, parameter) {
return `the result output payload`
}
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:828
setOpenApiOperationId
▸ setOpenApiOperationId(operationId
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Set the operationId for openApi documentation
Parameters
Name | Type |
---|---|
operationId | string |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:652
setOpenApiSummary
▸ setOpenApiSummary(summary
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Set the function summary text used for example in openApi documentation
Parameters
Name | Type | Description |
---|---|---|
summary | string | Summary text |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
CommandDefinitionBuilder
Example
setSummary('Some function summary')
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:642
setSuccessEventName
▸ setSuccessEventName<N
>(eventName
): CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Type parameters
Name | Type |
---|---|
N | extends string |
Parameters
Name | Type |
---|---|
eventName | NonEmptyString <N > |
Returns
CommandDefinitionBuilder
<ServiceClassType
, MessagePayloadType
, MessageParamsType
, MessageResultType
, PayloadSchema
, ParameterSchema
, ResultSchema
, Invokes
, EmitListType
>
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:252
setTransformInput
▸ setTransformInput<TransFormPayloadSchema
, TransFormParameterSchema
>(transformInputSchema
, transformParameterSchema
, transformFunction
, inputContentType?
, inputContentEncoding?
): CommandDefinitionBuilder
<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 | CommandTransformInputHook <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 > ? output <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 > ? output <TransFormParameterSchema > : never > : never >>> | Transform input function |
inputContentType? | string | optional the content type of payload |
inputContentEncoding? | string | optional the content encoding |
Returns
CommandDefinitionBuilder
<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
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:410
setTransformOutput
▸ setTransformOutput<Output
>(transformOutputSchema
, transformFunction
, outputContentType?
, outputContentEncoding?
): CommandDefinitionBuilder
<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 | CommandTransformOutputHook <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 > ? input <Output > : 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 >>, 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 >>> | Transform output function |
outputContentType? | string | optional the content type of payload |
outputContentEncoding? | string | optional the content encoding |
Returns
CommandDefinitionBuilder
<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
>
CommandDefinitionBuilder
Defined in
CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:472