BasePipelineContext
Defined in: packages/pipeline/src/pipeline.context.ts:29
Abstract base class with shared implementation for all pipeline contexts.
Provides default implementations for:
getBehaviorOptions()— reads from the pre-computed options mapresponse— readonly holder for the handler’s return value (set via Symbol)- Common fields (correlationId, startedAt, items)
Extend this class to create custom context variants for specialized pipelines. Behaviors should still type-hint against IPipelineContext (the interface).
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”TRequest
Section titled “TRequest”TRequest = unknown
TResponse
Section titled “TResponse”TResponse = unknown
Implements
Section titled “Implements”IPipelineContext<TRequest,TResponse>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BasePipelineContext<
TRequest,TResponse>():BasePipelineContext<TRequest,TResponse>
Defined in: packages/pipeline/src/pipeline.context.ts:107
Returns
Section titled “Returns”BasePipelineContext<TRequest, TResponse>
Properties
Section titled “Properties”behaviorOptionsMap
Section titled “behaviorOptionsMap”
abstractprotectedreadonlybehaviorOptionsMap:Map<BehaviorId,Record<string,unknown>> |undefined
Defined in: packages/pipeline/src/pipeline.context.ts:103
Options per behavior for this handler: global [Behavior, opts] tuple
options, shallowly overridden by the handler’s @UsePipeline options.
handlerName
Section titled “handlerName”
abstractreadonlyhandlerName:string
Defined in: packages/pipeline/src/pipeline.context.ts:73
The handler class name string, e.g. “CreateUserHandler”.
Implementation of
Section titled “Implementation of”handlerType
Section titled “handlerType”
abstractreadonlyhandlerType:Type
Defined in: packages/pipeline/src/pipeline.context.ts:72
The handler class (constructor) that will process this request.
Implementation of
Section titled “Implementation of”
readonlyitems:Map<string|symbol,unknown>
Defined in: packages/pipeline/src/pipeline.context.ts:81
Bag for sharing arbitrary data between behaviors in the same execution. Supports string and unique symbol keys.
Implementation of
Section titled “Implementation of”request
Section titled “request”
abstractreadonlyrequest:TRequest
Defined in: packages/pipeline/src/pipeline.context.ts:69
The command/query/event instance with all its property values.
Implementation of
Section titled “Implementation of”requestKind
Section titled “requestKind”
abstractreadonlyrequestKind:"command"|"query"|"event"|"unknown"
Defined in: packages/pipeline/src/pipeline.context.ts:74
‘command’, ‘query’, or ‘event’ — detected at bootstrap from NestJS metadata.
Implementation of
Section titled “Implementation of”requestName
Section titled “requestName”
abstractreadonlyrequestName:string
Defined in: packages/pipeline/src/pipeline.context.ts:71
The class name string, e.g. “CreateUserCommand”.
Implementation of
Section titled “Implementation of”requestType
Section titled “requestType”
abstractreadonlyrequestType:Type<TRequest>
Defined in: packages/pipeline/src/pipeline.context.ts:70
The class (constructor) of the command/query/event.
Implementation of
Section titled “Implementation of”startedAt
Section titled “startedAt”
readonlystartedAt:Date
Defined in: packages/pipeline/src/pipeline.context.ts:76
UTC timestamp when the pipeline execution started.
Implementation of
Section titled “Implementation of”Accessors
Section titled “Accessors”correlationId
Section titled “correlationId”Get Signature
Section titled “Get Signature”get correlationId():
string
Defined in: packages/pipeline/src/pipeline.context.ts:36
Immutable correlation ID for distributed tracing: the current correlation
id when the pipeline starts (from @nestjs-pipeline/correlation, or the
enclosing pipeline), otherwise a new one from the correlation source’s
create() (uuidv7() without one). Nested dispatches
inherit it.
Returns
Section titled “Returns”string
Immutable correlation ID for distributed tracing: the current correlation
id when the pipeline starts (from @nestjs-pipeline/correlation, or the
enclosing pipeline), otherwise a new one from the correlation source’s
create() (uuidv7() without one). Nested dispatches
inherit it.
Implementation of
Section titled “Implementation of”IPipelineContext.correlationId
response
Section titled “response”Get Signature
Section titled “Get Signature”get response():
TResponse|undefined
Defined in: packages/pipeline/src/pipeline.context.ts:87
The handler’s return value. Read-only for behaviors.
Returns
Section titled “Returns”TResponse | undefined
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.
Implementation of
Section titled “Implementation of”tenantId
Section titled “tenantId”Get Signature
Section titled “Get Signature”get tenantId():
string|undefined
Defined in: packages/pipeline/src/pipeline.context.ts:50
Active tenant identifier for multi-tenant pipeline executions.
Returns
Section titled “Returns”string | undefined
Tenant of this execution: the current tenant when the pipeline starts
(from @nestjs-pipeline/tenant, or the enclosing pipeline), which nested
dispatches inherit. Absent when there is none; tenant-scoped behaviors
then fail closed.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”[SET_CORRELATION_ID]()
Section titled “[SET_CORRELATION_ID]()”[SET_CORRELATION_ID](
value):void
Defined in: packages/pipeline/src/pipeline.context.ts:41
Internal
Assigns the ID before the behavior chain starts.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
[SET_RESPONSE]()
Section titled “[SET_RESPONSE]()”[SET_RESPONSE](
value):void
Defined in: packages/pipeline/src/pipeline.context.ts:95
Symbol-keyed setter — only callable by code that imports SET_RESPONSE.
This keeps response effectively readonly for behaviors.
Parameters
Section titled “Parameters”TResponse | undefined
Returns
Section titled “Returns”void
[SET_TENANT_ID]()
Section titled “[SET_TENANT_ID]()”[SET_TENANT_ID](
value):void
Defined in: packages/pipeline/src/pipeline.context.ts:60
Assigns the tenant once per execution. A different value after one is set (by the runner, from the tenant source or the enclosing pipeline) throws, so a behavior cannot move an execution to another tenant after an earlier behavior has used it.
Parameters
Section titled “Parameters”string | undefined
Returns
Section titled “Returns”void
getBehaviorOptions()
Section titled “getBehaviorOptions()”getBehaviorOptions<
T>(behaviorType):T|undefined
Defined in: packages/pipeline/src/pipeline.context.ts:117
Returns the options for a behavior on this handler: the options from a
global [Behavior, opts] tuple, shallowly overridden by the options from
the handler’s @UsePipeline([Behavior, opts]).
Type Parameters
Section titled “Type Parameters”T = Record<string, unknown>
Parameters
Section titled “Parameters”behaviorType
Section titled “behaviorType”Type
Returns
Section titled “Returns”T | undefined