@ocoda/event-sourcing-mariadb 2.1.0 → 2.1.1
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/CHANGELOG.md +14 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +26 -19
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ocoda/event-sourcing-mariadb
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#422](https://github.com/ocoda/event-sourcing/pull/422) [`2711e2e`](https://github.com/ocoda/event-sourcing/commit/2711e2e3d26b1ee5ea76e6c0922e92f86ef74a4b) Thanks [@MartinLG-LaFourche](https://github.com/MartinLG-LaFourche)! - # Enhancements
|
|
8
|
+
Enforces the linter to check for strictNullChecks.
|
|
9
|
+
|
|
10
|
+
# Dependencies
|
|
11
|
+
|
|
12
|
+
Updated various dependencies to their latest versions.
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`2711e2e`](https://github.com/ocoda/event-sourcing/commit/2711e2e3d26b1ee5ea76e6c0922e92f86ef74a4b)]:
|
|
15
|
+
- @ocoda/event-sourcing@2.1.1
|
|
16
|
+
|
|
3
17
|
## 2.1.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -52,9 +52,9 @@ declare class MariaDBSnapshotStore extends SnapshotStore<MariaDBSnapshotStoreCon
|
|
|
52
52
|
getSnapshots<A extends AggregateRoot>({ streamId }: SnapshotStream, filter?: ISnapshotFilter): AsyncGenerator<ISnapshot<A>[]>;
|
|
53
53
|
getSnapshot<A extends AggregateRoot>({ streamId }: SnapshotStream, version: number, pool?: ISnapshotPool): Promise<ISnapshot<A>>;
|
|
54
54
|
appendSnapshot<A extends AggregateRoot>(stream: SnapshotStream, aggregateVersion: number, snapshot: ISnapshot<A>, pool?: ISnapshotPool): Promise<SnapshotEnvelope<A>>;
|
|
55
|
-
getLastSnapshot<A extends AggregateRoot>(stream: SnapshotStream, pool?: ISnapshotPool): Promise<ISnapshot<A
|
|
55
|
+
getLastSnapshot<A extends AggregateRoot>(stream: SnapshotStream, pool?: ISnapshotPool): Promise<ISnapshot<A> | void>;
|
|
56
56
|
getLastSnapshots<A extends AggregateRoot>(streams: SnapshotStream[], pool?: ISnapshotPool): Promise<Map<SnapshotStream, ISnapshot<A>>>;
|
|
57
|
-
getLastEnvelope<A extends AggregateRoot>(stream: SnapshotStream, pool?: ISnapshotPool): Promise<SnapshotEnvelope<A
|
|
57
|
+
getLastEnvelope<A extends AggregateRoot>(stream: SnapshotStream, pool?: ISnapshotPool): Promise<SnapshotEnvelope<A> | void>;
|
|
58
58
|
getEnvelopes<A extends AggregateRoot>({ streamId }: SnapshotStream, filter?: ISnapshotFilter): AsyncGenerator<SnapshotEnvelope<A>[]>;
|
|
59
59
|
getEnvelope<A extends AggregateRoot>({ streamId }: SnapshotStream, version: number, pool?: ISnapshotPool): Promise<SnapshotEnvelope<A>>;
|
|
60
60
|
getLastEnvelopesForAggregate<A extends AggregateRoot>(aggregate: Type<A>, filter?: ILatestSnapshotFilter): AsyncGenerator<SnapshotEnvelope<A>[]>;
|
package/dist/index.js
CHANGED
|
@@ -278,6 +278,7 @@ var _MariaDBEventStore = class _MariaDBEventStore extends import_event_sourcing.
|
|
|
278
278
|
}
|
|
279
279
|
getEnvelope(_0, _1, _2) {
|
|
280
280
|
return __async(this, arguments, function* ({ streamId }, version, pool) {
|
|
281
|
+
var _a, _b;
|
|
281
282
|
const collection = import_event_sourcing.EventCollection.get(pool);
|
|
282
283
|
const [entity] = yield this.pool.query(`SELECT event, payload, event_id, aggregate_id, version, occurred_on, correlation_id, causation_id FROM \`${collection}\` WHERE stream_id = ? AND version = ?`, [
|
|
283
284
|
streamId,
|
|
@@ -291,8 +292,8 @@ var _MariaDBEventStore = class _MariaDBEventStore extends import_event_sourcing.
|
|
|
291
292
|
aggregateId: entity.aggregate_id,
|
|
292
293
|
version: entity.version,
|
|
293
294
|
occurredOn: entity.occurred_on,
|
|
294
|
-
correlationId: entity.correlation_id,
|
|
295
|
-
causationId: entity.causation_id
|
|
295
|
+
correlationId: (_a = entity.correlation_id) != null ? _a : void 0,
|
|
296
|
+
causationId: (_b = entity.causation_id) != null ? _b : void 0
|
|
296
297
|
});
|
|
297
298
|
});
|
|
298
299
|
}
|
|
@@ -332,8 +333,8 @@ var _MariaDBEventStore = class _MariaDBEventStore extends import_event_sourcing.
|
|
|
332
333
|
aggregateId: aggregate_id,
|
|
333
334
|
version,
|
|
334
335
|
occurredOn: occurred_on,
|
|
335
|
-
correlationId: correlation_id,
|
|
336
|
-
causationId: causation_id
|
|
336
|
+
correlationId: correlation_id != null ? correlation_id : void 0,
|
|
337
|
+
causationId: causation_id != null ? causation_id : void 0
|
|
337
338
|
}));
|
|
338
339
|
if (batchedEvents.length === batch) {
|
|
339
340
|
yield batchedEvents;
|
|
@@ -387,8 +388,8 @@ var _MariaDBEventStore = class _MariaDBEventStore extends import_event_sourcing.
|
|
|
387
388
|
aggregateId: aggregate_id,
|
|
388
389
|
version,
|
|
389
390
|
occurredOn: occurred_on,
|
|
390
|
-
correlationId: correlation_id,
|
|
391
|
-
causationId: causation_id
|
|
391
|
+
correlationId: correlation_id != null ? correlation_id : void 0,
|
|
392
|
+
causationId: causation_id != null ? causation_id : void 0
|
|
392
393
|
}));
|
|
393
394
|
if (batchedEvents.length === batch) {
|
|
394
395
|
yield batchedEvents;
|
|
@@ -639,10 +640,13 @@ var _MariaDBSnapshotStore = class _MariaDBSnapshotStore extends import_event_sou
|
|
|
639
640
|
"stream_id",
|
|
640
641
|
"payload"
|
|
641
642
|
]);
|
|
642
|
-
return
|
|
643
|
-
streams.find(({ streamId: currentStreamId }) => currentStreamId === stream_id)
|
|
644
|
-
|
|
645
|
-
|
|
643
|
+
return entities.reduce((acc, { stream_id, payload }) => {
|
|
644
|
+
const stream = streams.find(({ streamId: currentStreamId }) => currentStreamId === stream_id);
|
|
645
|
+
if (stream) {
|
|
646
|
+
acc.set(stream, payload);
|
|
647
|
+
}
|
|
648
|
+
return acc;
|
|
649
|
+
}, /* @__PURE__ */ new Map());
|
|
646
650
|
});
|
|
647
651
|
}
|
|
648
652
|
getLastEnvelope(stream, pool) {
|
|
@@ -819,15 +823,18 @@ var _MariaDBSnapshotStore = class _MariaDBSnapshotStore extends import_event_sou
|
|
|
819
823
|
"snapshot_id",
|
|
820
824
|
"version"
|
|
821
825
|
]);
|
|
822
|
-
return
|
|
823
|
-
streams.find(({ streamId: currentStreamId }) => currentStreamId === stream_id)
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
826
|
+
return entities.reduce((acc, { stream_id, payload, aggregate_id, registered_on, snapshot_id, version }) => {
|
|
827
|
+
const stream = streams.find(({ streamId: currentStreamId }) => currentStreamId === stream_id);
|
|
828
|
+
if (stream) {
|
|
829
|
+
acc.set(stream, import_event_sourcing2.SnapshotEnvelope.from(payload, {
|
|
830
|
+
aggregateId: aggregate_id,
|
|
831
|
+
registeredOn: new Date(registered_on),
|
|
832
|
+
snapshotId: snapshot_id,
|
|
833
|
+
version
|
|
834
|
+
}));
|
|
835
|
+
}
|
|
836
|
+
return acc;
|
|
837
|
+
}, /* @__PURE__ */ new Map());
|
|
831
838
|
});
|
|
832
839
|
}
|
|
833
840
|
getLastStreamEntities(collection, streams, fields, connection) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocoda/event-sourcing-mariadb",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "NestJS Event Sourcing Library (@mariadb)",
|
|
5
5
|
"author": "Dries Hooghe <dries@drieshooghe.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
"@nestjs/core": "^10.0.0",
|
|
20
20
|
"reflect-metadata": "^0.2.0",
|
|
21
21
|
"rxjs": "^7.2.0",
|
|
22
|
-
"@ocoda/event-sourcing": "2.1.
|
|
22
|
+
"@ocoda/event-sourcing": "2.1.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@biomejs/biome": "1.9.4",
|
|
26
26
|
"@faker-js/faker": "^9.5.1",
|
|
27
|
-
"@nestjs/common": "11.0.
|
|
28
|
-
"@nestjs/core": "11.0.
|
|
29
|
-
"@nestjs/platform-express": "11.0.
|
|
30
|
-
"@nestjs/testing": "11.0.
|
|
31
|
-
"@swc-node/register": "^1.10.
|
|
32
|
-
"@swc/core": "1.11.
|
|
27
|
+
"@nestjs/common": "11.0.12",
|
|
28
|
+
"@nestjs/core": "11.0.12",
|
|
29
|
+
"@nestjs/platform-express": "11.0.12",
|
|
30
|
+
"@nestjs/testing": "11.0.12",
|
|
31
|
+
"@swc-node/register": "^1.10.10",
|
|
32
|
+
"@swc/core": "1.11.13",
|
|
33
33
|
"@swc/jest": "0.2.37",
|
|
34
34
|
"@types/jest": "29.5.14",
|
|
35
35
|
"@types/node": "20.17.6",
|