Skip to content

Middleware

Interface for middleware that can modify the flow state

TName extends string = string

Type of the name of the middleware (should be a string literal)

execute: (context, next, cancel) => void | Promise<void>

The function that executes the middleware logic

MiddlewareContext

The context of the middleware

(stateUpdate?) => Promise<FlowState>

Function to call to apply the state update and continue to the next middleware

() => void

Function to call to cancel the middleware execution

void | Promise<void>


name: TName

The name of the middleware