interface IPipelineBehavior
Since 0.1.0

Wraps a handler with cross-cutting logic (logging, timing, validation, etc.).

Behaviors are typed to CqrsRequest so they can read request.type/request.data type-safely without any.

Type Parameters

TRequest extends CqrsRequest = CqrsRequest

The request type (must extend CqrsRequest)

TResult = unknown

The result type

Methods

handle(
request: TRequest,
next: () => Promise<TResult>
): TResult | Promise<TResult>

Wraps the next handler in the pipeline.

Usage

import { type IPipelineBehavior } from "cqrs-plugin/src/index.ts";