IPipelineContext
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:12
Rich context available to every pipeline behavior during execution.
Behaviors should type-hint against this interface to stay decoupled. The concrete implementation (BasePipelineContext) provides shared logic; extend it only when you need a custom context variant.
Type Parameters
Section titled “Type Parameters”TRequest
Section titled “TRequest”TRequest = unknown
TResponse
Section titled “TResponse”TResponse = unknown
Properties
Section titled “Properties”correlationId
Section titled “correlationId”
readonlycorrelationId:string
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:20
Immutable correlation ID for distributed tracing: the current correlation
id when the pipeline starts (from @cqrs-ddd/pipeline-correlation, or the
enclosing pipeline), otherwise a new one from the correlation source’s
create() (uuidv7() without one). Nested dispatches
inherit it.
handlerName
Section titled “handlerName”
readonlyhandlerName:string
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:43
The handler class name string, e.g. “CreateUserHandler”.
handlerType
Section titled “handlerType”
readonlyhandlerType:Constructor
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:40
The handler class (constructor) that will process this request.
readonlyitems:Map<string|symbol,unknown>
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:73
Bag for sharing arbitrary data between behaviors in the same execution. Use createPipelineItem and the typed item accessors for compile-time value checks. Raw map access remains supported and bypasses those checks.
Keys can be strings or exported unique symbol constants. Exported symbols
are strongly recommended to prevent collision between behaviors or third-party packages.
Example
Section titled “Example”export const MY_ITEM = Symbol('MY_ITEM');context.items.set(MY_ITEM, customData);const val = context.items.get(MY_ITEM);request
Section titled “request”
readonlyrequest:TRequest
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:31
The command/query/event instance with all its property values.
requestKind
Section titled “requestKind”
readonlyrequestKind:"command"|"query"|"event"|"unknown"
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:46
‘command’, ‘query’, or ‘event’: declared when wrapping, or read from the request’s brand.
requestName
Section titled “requestName”
readonlyrequestName:string
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:37
The class name string, e.g. “CreateUserCommand”.
requestType
Section titled “requestType”
readonlyrequestType:Constructor<TRequest>
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:34
The class (constructor) of the command/query/event.
response
Section titled “response”
readonlyresponse:TResponse|undefined
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:56
The handler’s return value, set automatically after the real handler executes.
Available to behaviors in their post-next() code path.
undefined before the handler runs or for event handlers that return void.
startedAt
Section titled “startedAt”
readonlystartedAt:Date
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:49
UTC timestamp when the pipeline execution started.
tenantId?
Section titled “tenantId?”
readonlyoptionaltenantId?:string
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:28
Tenant of this execution: the current tenant when the pipeline starts
(from @cqrs-ddd/pipeline-tenant, or the enclosing pipeline), which nested
dispatches inherit. Absent when there is none; tenant-scoped behaviors
then fail closed.
Methods
Section titled “Methods”getBehaviorOptions()
Section titled “getBehaviorOptions()”getBehaviorOptions<
T>(behaviorType):T|undefined
Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:81
Returns the options for a behavior on this handler: the options from a
global [Behavior, opts] tuple, shallowly overridden by the options of the
call site’s [Behavior, opts] entry. Returns undefined when
neither supplies options for that behavior.
Type Parameters
Section titled “Type Parameters”T = Record<string, unknown>
Parameters
Section titled “Parameters”behaviorType
Section titled “behaviorType”Returns
Section titled “Returns”T | undefined