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

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.

TRequest = unknown

TResponse = unknown

readonly correlationId: 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.


readonly handlerName: string

Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:43

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


readonly handlerType: Constructor

Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:40

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


readonly items: 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.

export const MY_ITEM = Symbol('MY_ITEM');
context.items.set(MY_ITEM, customData);
const val = context.items.get(MY_ITEM);

readonly request: TRequest

Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:31

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


readonly requestKind: "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.


readonly requestName: string

Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:37

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


readonly requestType: Constructor<TRequest>

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

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


readonly response: 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.


readonly startedAt: Date

Defined in: packages/pipeline/src/interfaces/pipeline.context.interface.ts:49

UTC timestamp when the pipeline execution started.


readonly optional tenantId?: 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.

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.

T = Record<string, unknown>

Constructor

T | undefined