Middleware
Interface for middleware that can modify the flow state
Type Parameters
Section titled “Type Parameters”TName
extends string
= string
Type of the name of the middleware (should be a string literal)
Properties
Section titled “Properties”execute()
Section titled “execute()”execute: (
context
,next
,cancel
) =>void
|Promise
<void
>
The function that executes the middleware logic
Parameters
Section titled “Parameters”context
Section titled “context”MiddlewareContext
The context of the middleware
(stateUpdate?
) => Promise
<FlowState
>
Function to call to apply the state update and continue to the next middleware
cancel
Section titled “cancel”() => void
Function to call to cancel the middleware execution
Returns
Section titled “Returns”void
| Promise
<void
>
name:
TName
The name of the middleware