Type Alias: HandlerResult {#type-alias-handlerresult}

HandlerResult = object

The value returned by a process handler after execution.

Properties {#properties}

deferred? {#deferred}

optional deferred: boolean

When true, triggerEvent is stored on the completed run but not emitted. Call engine.resume(runId) later to continue the chain. This enables human-in-the-loop workflows where a pipeline pauses for external approval.

Default Value {#deferred-default-value}

false

Example {#deferred-example}

// Handler defers the next step
engine.register('validate', 'order:new', async (ctx) => ({
  success: true,
  triggerEvent: 'order:approved',
  deferred: true,
  payload: { orderId: ctx.payload.orderId },
}))

// Later, after approval:
engine.resume(runId) // emits 'order:approved', continuing the chain

error? {#error}

optional error: string

Error message if the handler failed.


errorCode? {#errorcode}

optional errorCode: ErrorCode

Structured error code if the handler failed.


payload? {#payload}

optional payload: unknown

Optional result payload.


success {#success}

success: boolean

Whether the handler completed successfully.


triggerEvent? {#triggerevent}

optional triggerEvent: string

Optional event name to emit as a chained event. When deferred is true, the event is stored but not emitted until engine.resume(runId) is called.