Skip to main content

WorkflowHandler

@adamondo/backend


@adamondo/backend / core/workflow/handlers/WorkflowHandler

core/workflow/handlers/WorkflowHandler

Classes

WorkflowHandler

Defined in: src/core/workflow/handlers/WorkflowHandler.ts:14

Default handler that adapts workflow engine APIs to dispatcher execution contracts.

Type Parameters

TStatus

TStatus = AnyValue

TAction

TAction extends string = string

TActor

TActor = AnyValue

TContext

TContext extends BaseWorkflowContext<TStatus> = BaseWorkflowContext<TStatus>

TResultMap

TResultMap extends Record<AnyValue, AnyValue> = AnyValue

TPayloadMap

TPayloadMap extends Record<string, AnyValue> = Record<string, AnyValue>

Implements

Constructors

Constructor

new WorkflowHandler<TStatus, TAction, TActor, TContext, TResultMap, TPayloadMap>(workflowEngine): WorkflowHandler<TStatus, TAction, TActor, TContext, TResultMap, TPayloadMap>

Defined in: src/core/workflow/handlers/WorkflowHandler.ts:16

Parameters
workflowEngine

BaseWorkflowEngine<TStatus, TAction, TActor, TContext, TResultMap, TPayloadMap>

Returns

WorkflowHandler<TStatus, TAction, TActor, TContext, TResultMap, TPayloadMap>

Properties

workflowEngine

workflowEngine: BaseWorkflowEngine<TStatus, TAction, TActor, TContext, TResultMap, TPayloadMap>

Defined in: src/core/workflow/handlers/WorkflowHandler.ts:15

Methods

execute()

execute<K>(userId, action, targetId, payload, actorContext?): Promise<WorkflowActionResult<TResultMap[K]>>

Defined in: src/core/workflow/handlers/WorkflowHandler.ts:22

Resolves context, infers actor, executes workflow transition, and normalizes errors.

Type Parameters
K

K extends string

Parameters
userId

string

action

K

targetId

number | undefined

payload

TPayloadMap[K]

actorContext?

unknown

Returns

Promise<WorkflowActionResult<TResultMap[K]>>

Implementation of

IWorkflowHandler.execute