Μετάβαση στο περιεχόμενο

PipelineContext

Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.

Defined in: packages/pipeline/src/pipeline.context.ts:128

Concrete pipeline context created per request. Pre-computed handler metadata is injected via PipelineHandlerMeta.

TRequest = unknown

TResponse = unknown

new PipelineContext<TRequest, TResponse>(request, meta): PipelineContext<TRequest, TResponse>

Defined in: packages/pipeline/src/pipeline.context.ts:154

TRequest

PipelineHandlerMeta

PipelineContext<TRequest, TResponse>

BasePipelineContext.constructor

protected readonly behaviorOptionsMap: Map<BehaviorId, Record<string, unknown>> | undefined

Defined in: packages/pipeline/src/pipeline.context.ts:138

Options per behavior for this handler: global [Behavior, opts] tuple options, shallowly overridden by the call site’s options.

BasePipelineContext.behaviorOptionsMap


readonly handlerName: string

Defined in: packages/pipeline/src/pipeline.context.ts:135

The handler class name string, e.g. “CreateUserHandler”.

BasePipelineContext.handlerName


readonly handlerType: Constructor

Defined in: packages/pipeline/src/pipeline.context.ts:134

The handler class (constructor) that will process this request.

BasePipelineContext.handlerType


readonly items: Map<string | symbol, unknown>

Defined in: packages/pipeline/src/pipeline.context.ts:79

Bag for sharing arbitrary data between behaviors in the same execution. Supports string and unique symbol keys.

BasePipelineContext.items


readonly requestKind: "command" | "query" | "event" | "unknown"

Defined in: packages/pipeline/src/pipeline.context.ts:136

‘command’, ‘query’, or ‘event’: declared when wrapping, or read from the request’s brand.

BasePipelineContext.requestKind


readonly requestName: string

Defined in: packages/pipeline/src/pipeline.context.ts:133

The class name string, e.g. “CreateUserCommand”.

BasePipelineContext.requestName


readonly requestType: Constructor<TRequest>

Defined in: packages/pipeline/src/pipeline.context.ts:132

The class (constructor) of the command/query/event.

BasePipelineContext.requestType


readonly startedAt: Date

Defined in: packages/pipeline/src/pipeline.context.ts:74

UTC timestamp when the pipeline execution started.

BasePipelineContext.startedAt

get correlationId(): string

Defined in: packages/pipeline/src/pipeline.context.ts:34

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.

string

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.

BasePipelineContext.correlationId


get request(): TRequest

Defined in: packages/pipeline/src/pipeline.context.ts:145

The input of this execution, or the replacement a behavior handed in.

TRequest

The command/query/event instance with all its property values.

BasePipelineContext.request


get response(): TResponse | undefined

Defined in: packages/pipeline/src/pipeline.context.ts:85

The handler’s return value. Read-only for behaviors.

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.

BasePipelineContext.response


get tenantId(): string | undefined

Defined in: packages/pipeline/src/pipeline.context.ts:48

Active tenant identifier for multi-tenant pipeline executions.

string | undefined

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.

BasePipelineContext.tenantId

[SET_CORRELATION_ID](value): void

Defined in: packages/pipeline/src/pipeline.context.ts:39

Internal

Assigns the ID before the behavior chain starts.

string

void

BasePipelineContext.[SET_CORRELATION_ID]


[SET_REQUEST](value): void

Defined in: packages/pipeline/src/pipeline.context.ts:150

Replaces the input the handler receives; see replaceRequest.

TRequest

void


[SET_RESPONSE](value): void

Defined in: packages/pipeline/src/pipeline.context.ts:93

Symbol-keyed setter — only callable by code that imports SET_RESPONSE. This keeps response effectively readonly for behaviors.

TResponse | undefined

void

BasePipelineContext.[SET_RESPONSE]


[SET_TENANT_ID](value): void

Defined in: packages/pipeline/src/pipeline.context.ts:58

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.

string | undefined

void

BasePipelineContext.[SET_TENANT_ID]


getBehaviorOptions<T>(behaviorType): T | undefined

Defined in: packages/pipeline/src/pipeline.context.ts:115

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.

T = Record<string, unknown>

Constructor

T | undefined

BasePipelineContext.getBehaviorOptions