MiddlewareHandler
type MiddlewareHandler<TContext, TResult, TEvent> = (context, next) => AsyncGenerator<TEvent, TResult, undefined>;Defined in: src/middleware/types.ts:69
A middleware handler function (Wrap phase).
Receives the context and a next function to call the next layer.
Must be an async generator that yields TEvent and returns TResult.
Middleware can yield its own events, forward events from next, or suppress them.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
TContext |
TResult |
TEvent |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | TContext |
next | MiddlewareNext<TContext, TResult, TEvent> |
Returns
Section titled “Returns”AsyncGenerator<TEvent, TResult, undefined>