Skip to content

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 Parameter
TContext
TResult
TEvent
ParameterType
contextTContext
nextMiddlewareNext<TContext, TResult, TEvent>

AsyncGenerator<TEvent, TResult, undefined>