@quanticjs/events 3.0.0 → 3.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.
- package/dist/DomainEvent.d.ts +2 -1
- package/dist/DomainEvent.js +5 -2
- package/package.json +2 -2
package/dist/DomainEvent.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ export declare class DomainEvent {
|
|
|
6
6
|
readonly aggregateId: string;
|
|
7
7
|
readonly payload: DomainEventPayload;
|
|
8
8
|
readonly organizationId?: string | undefined;
|
|
9
|
+
readonly routingKey?: string | undefined;
|
|
9
10
|
readonly eventId: string;
|
|
10
11
|
readonly occurredAt: Date;
|
|
11
|
-
constructor(eventType: string, aggregateId: string, payload: DomainEventPayload, organizationId?: string | undefined);
|
|
12
|
+
constructor(eventType: string, aggregateId: string, payload: DomainEventPayload, organizationId?: string | undefined, routingKey?: string | undefined);
|
|
12
13
|
get streamKey(): string;
|
|
13
14
|
}
|
package/dist/DomainEvent.js
CHANGED
|
@@ -7,19 +7,22 @@ class DomainEvent {
|
|
|
7
7
|
aggregateId;
|
|
8
8
|
payload;
|
|
9
9
|
organizationId;
|
|
10
|
+
routingKey;
|
|
10
11
|
eventId;
|
|
11
12
|
occurredAt;
|
|
12
|
-
constructor(eventType, aggregateId, payload, organizationId) {
|
|
13
|
+
constructor(eventType, aggregateId, payload, organizationId, routingKey) {
|
|
13
14
|
this.eventType = eventType;
|
|
14
15
|
this.aggregateId = aggregateId;
|
|
15
16
|
this.payload = payload;
|
|
16
17
|
this.organizationId = organizationId;
|
|
18
|
+
this.routingKey = routingKey;
|
|
17
19
|
this.eventId = (0, uuid_1.v4)();
|
|
18
20
|
this.occurredAt = new Date();
|
|
19
21
|
}
|
|
20
22
|
get streamKey() {
|
|
21
23
|
const category = this.eventType.split('.')[0];
|
|
22
|
-
|
|
24
|
+
const base = `arex:events:${category}s`;
|
|
25
|
+
return this.routingKey ? `${base}:${this.routingKey}` : base;
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
exports.DomainEvent = DomainEvent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quanticjs/events",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Domain events for quanticjs — outbox pattern, Redis Streams pub/sub",
|
|
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": "^3.
|
|
21
|
+
"@quanticjs/core": "^3.1.0",
|
|
22
22
|
"uuid": "^11.1.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|