PURISTA API / @purista/core / getSubscriptionFunctionWithValidation
Function: getSubscriptionFunctionWithValidation()
getSubscriptionFunctionWithValidation<
S>(fn,inputPayloadSchema,inputParameterSchema,outputPayloadSchema,beforeGuards?): (this,context,payload,parameter) =>Promise<unknown>
Defined in: SubscriptionDefinitionBuilder/getSubscriptionFunctionWithValidation.impl.ts:18
Wraps a subscription handler with schema validation and guard execution. Input payload/parameter is validated before execution and output can be validated after execution.
Type Parameters
S
S extends Service<ServiceClassTypes<any, any, any>>
Parameters
fn
SubscriptionFunction<S, unknown, unknown, unknown, any, any, any, any, any>
inputPayloadSchema
Schema | undefined
inputParameterSchema
Schema | undefined
outputPayloadSchema
Schema | undefined
beforeGuards?
Record<string, SubscriptionBeforeGuardHook<S, unknown, unknown, any, any, any, any, any>> = {}
Returns
(this, context, payload, parameter) => Promise<unknown>
