@nestjs-pipeline/correlation
v0.6.1
Published
Correlation ID propagation for NestJS under the @nestjs-pipeline name: re-exports @cqrs-ddd/pipeline-correlation and @cqrs-ddd/nestjs/correlation, which hold the code
Readme
@nestjs-pipeline/correlation
The main repository is ddd-cqrs. You can use
@cqrs-ddd/pipeline-correlationand@cqrs-ddd/nestjsdirectly.This package has no code of its own. From 0.6.1 it re-exports
@cqrs-ddd/pipeline-correlationand@cqrs-ddd/nestjs/correlationat the same version. The code, the issues and the releases are in ddd-cqrs. The documentation is at aristoteliss.github.io/ddd-cqrs.This package is not deprecated. An application can keep the
@nestjs-pipeline/correlationname, or replace it with the@cqrs-dddpackages. The import paths change, and the code stays the same. Versions 0.1 to 0.4 stay on npm unchanged.
Correlation ID propagation for NestJS applications: HTTP, Bull/BullMQ, RabbitMQ, Kafka, NATS, gRPC, cron jobs and custom transports.
Documentation: @cqrs-ddd/pipeline-correlation · @cqrs-ddd/nestjs/correlation · from @nestjs-pipeline 0.4.x
Installation
pnpm add @nestjs-pipeline/correlation @cqrs-ddd/pipeline-correlation \
@cqrs-ddd/pipeline @cqrs-ddd/core @nestjs/common @nestjs/core @nestjs/cqrsRequires Node.js 22.12 or later and NestJS 12.
Exports
- Everything of
@cqrs-ddd/pipeline-correlation:getCorrelationId,runWithCorrelationId,@WithCorrelation,httpCorrelation,correlationSourceand theCorrelationFrompresets. - Everything of
@cqrs-ddd/nestjs/correlation:CorrelationMiddleware.
Example
import { CorrelationMiddleware } from '@nestjs-pipeline/correlation';
import { type MiddlewareConsumer, Module, type NestModule } from '@nestjs/common';
@Module({})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer.apply(CorrelationMiddleware).forRoutes('*');
}
}Upgrade from 0.4.x
The API of 0.6.1 is the API of @cqrs-ddd 0.6.1. The guide
From @nestjs-pipeline 0.4.x gives all the changes. The changes for this package:
HttpCorrelationMiddlewareisCorrelationMiddleware. It reads thex-correlation-idheader. For other options, make a middleware fromhttpCorrelation(options).CORRELATION_OPTIONSis not exported.- The package requires the peers of
@cqrs-ddd/nestjs:@cqrs-ddd/core,@cqrs-ddd/pipeline,@nestjs/coreand@nestjs/cqrs.
License
Dual-licensed under AGPL-3.0-or-later or a Commercial License. See
LICENSE and COMMERCIAL_LICENSE.txt
at the repository root.
