@quanticjs/events-core 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,8 +7,10 @@ export declare class DomainEvent {
7
7
  readonly payload: DomainEventPayload;
8
8
  readonly organizationId?: string | undefined;
9
9
  readonly routingKey?: string | undefined;
10
+ readonly correlationId?: string | undefined;
11
+ readonly causationId?: string | undefined;
10
12
  readonly eventId: string;
11
13
  readonly occurredAt: Date;
12
- constructor(eventType: string, aggregateId: string, payload: DomainEventPayload, organizationId?: string | undefined, routingKey?: string | undefined);
14
+ constructor(eventType: string, aggregateId: string, payload: DomainEventPayload, organizationId?: string | undefined, routingKey?: string | undefined, correlationId?: string | undefined, causationId?: string | undefined);
13
15
  get topic(): string;
14
16
  }
@@ -8,14 +8,18 @@ class DomainEvent {
8
8
  payload;
9
9
  organizationId;
10
10
  routingKey;
11
+ correlationId;
12
+ causationId;
11
13
  eventId;
12
14
  occurredAt;
13
- constructor(eventType, aggregateId, payload, organizationId, routingKey) {
15
+ constructor(eventType, aggregateId, payload, organizationId, routingKey, correlationId, causationId) {
14
16
  this.eventType = eventType;
15
17
  this.aggregateId = aggregateId;
16
18
  this.payload = payload;
17
19
  this.organizationId = organizationId;
18
20
  this.routingKey = routingKey;
21
+ this.correlationId = correlationId;
22
+ this.causationId = causationId;
19
23
  this.eventId = (0, uuid_1.v4)();
20
24
  this.occurredAt = new Date();
21
25
  }
@@ -10,6 +10,8 @@ export declare class OutboxEvent {
10
10
  topic: string;
11
11
  payload: Record<string, unknown>;
12
12
  organizationId: string | null;
13
+ correlationId: string | null;
14
+ causationId: string | null;
13
15
  status: OutboxEventStatus;
14
16
  publishAttempts: number;
15
17
  lastError: string | null;
@@ -24,6 +24,8 @@ let OutboxEvent = class OutboxEvent {
24
24
  topic;
25
25
  payload;
26
26
  organizationId;
27
+ correlationId;
28
+ causationId;
27
29
  status;
28
30
  publishAttempts;
29
31
  lastError;
@@ -55,6 +57,14 @@ __decorate([
55
57
  (0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
56
58
  __metadata("design:type", Object)
57
59
  ], OutboxEvent.prototype, "organizationId", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
62
+ __metadata("design:type", Object)
63
+ ], OutboxEvent.prototype, "correlationId", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
66
+ __metadata("design:type", Object)
67
+ ], OutboxEvent.prototype, "causationId", void 0);
58
68
  __decorate([
59
69
  (0, typeorm_1.Column)({
60
70
  type: 'enum',
@@ -61,6 +61,8 @@ let OutboxPublisherService = OutboxPublisherService_1 = class OutboxPublisherSer
61
61
  eventType: event.eventType,
62
62
  aggregateId: event.aggregateId,
63
63
  organizationId: event.organizationId || '',
64
+ correlationId: event.correlationId || '',
65
+ causationId: event.causationId || '',
64
66
  payload: JSON.stringify(event.payload),
65
67
  occurredAt: event.createdAt.toISOString(),
66
68
  });
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export { OutboxPublisherService } from './OutboxPublisherService';
6
6
  export { OutboxCleanupService } from './OutboxCleanupService';
7
7
  export { QuanticEventsCoreModule } from './QuanticEventsCoreModule';
8
8
  export { RenameStreamKeyToTopic1717700000000 } from './migrations/1717700000000-RenameStreamKeyToTopic';
9
+ export { AddCorrelationIdToOutbox1749225600000 } from './migrations/1749225600000-AddCorrelationIdToOutbox';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RenameStreamKeyToTopic1717700000000 = exports.QuanticEventsCoreModule = exports.OutboxCleanupService = exports.OutboxPublisherService = exports.EVENT_PUBLISHER = exports.OutboxEventStatus = exports.OutboxEvent = exports.DomainEvent = void 0;
3
+ exports.AddCorrelationIdToOutbox1749225600000 = exports.RenameStreamKeyToTopic1717700000000 = exports.QuanticEventsCoreModule = exports.OutboxCleanupService = exports.OutboxPublisherService = exports.EVENT_PUBLISHER = exports.OutboxEventStatus = exports.OutboxEvent = exports.DomainEvent = void 0;
4
4
  var DomainEvent_1 = require("./DomainEvent");
5
5
  Object.defineProperty(exports, "DomainEvent", { enumerable: true, get: function () { return DomainEvent_1.DomainEvent; } });
6
6
  var OutboxEvent_entity_1 = require("./OutboxEvent.entity");
@@ -16,3 +16,5 @@ var QuanticEventsCoreModule_1 = require("./QuanticEventsCoreModule");
16
16
  Object.defineProperty(exports, "QuanticEventsCoreModule", { enumerable: true, get: function () { return QuanticEventsCoreModule_1.QuanticEventsCoreModule; } });
17
17
  var _1717700000000_RenameStreamKeyToTopic_1 = require("./migrations/1717700000000-RenameStreamKeyToTopic");
18
18
  Object.defineProperty(exports, "RenameStreamKeyToTopic1717700000000", { enumerable: true, get: function () { return _1717700000000_RenameStreamKeyToTopic_1.RenameStreamKeyToTopic1717700000000; } });
19
+ var _1749225600000_AddCorrelationIdToOutbox_1 = require("./migrations/1749225600000-AddCorrelationIdToOutbox");
20
+ Object.defineProperty(exports, "AddCorrelationIdToOutbox1749225600000", { enumerable: true, get: function () { return _1749225600000_AddCorrelationIdToOutbox_1.AddCorrelationIdToOutbox1749225600000; } });
@@ -0,0 +1,6 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+ export declare class AddCorrelationIdToOutbox1749225600000 implements MigrationInterface {
3
+ name: string;
4
+ up(queryRunner: QueryRunner): Promise<void>;
5
+ down(queryRunner: QueryRunner): Promise<void>;
6
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddCorrelationIdToOutbox1749225600000 = void 0;
4
+ class AddCorrelationIdToOutbox1749225600000 {
5
+ name = 'AddCorrelationIdToOutbox1749225600000';
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE outbox_events ADD COLUMN "correlationId" VARCHAR NULL`);
8
+ await queryRunner.query(`ALTER TABLE outbox_events ADD COLUMN "causationId" VARCHAR NULL`);
9
+ }
10
+ async down(queryRunner) {
11
+ await queryRunner.query(`ALTER TABLE outbox_events DROP COLUMN "causationId"`);
12
+ await queryRunner.query(`ALTER TABLE outbox_events DROP COLUMN "correlationId"`);
13
+ }
14
+ }
15
+ exports.AddCorrelationIdToOutbox1749225600000 = AddCorrelationIdToOutbox1749225600000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quanticjs/events-core",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Transport-agnostic domain event abstractions — DomainEvent, OutboxEvent, IEventPublisher, outbox services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "clean": "rm -rf dist"
19
19
  },
20
20
  "dependencies": {
21
- "@quanticjs/core": "^6.0.0",
21
+ "@quanticjs/core": "^6.1.0",
22
22
  "uuid": "^11.1.0"
23
23
  },
24
24
  "peerDependencies": {