@ocoda/event-sourcing-mariadb 2.0.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 CHANGED
@@ -1,5 +1,54 @@
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
+
17
+ ## 2.1.0
18
+
19
+ ### Minor Changes
20
+
21
+ - [#419](https://github.com/ocoda/event-sourcing/pull/419) [`cbc7b08`](https://github.com/ocoda/event-sourcing/commit/cbc7b082555cb0855cd26965020b152c679e6e47) Thanks [@drieshooghe](https://github.com/drieshooghe)! - # Fixes
22
+ Fixes an issue where the metadata from custom event-serializers wasn't returned as an object, resulting in them not being registered by the handlers loader.
23
+
24
+ # Deprecates
25
+
26
+ Removes the `disableDefaultSerializer` option from the module, but falls back to the default serializer for each event that doesn't have a custom event-serializer registered. Refactored because the previous behavior left the event-serializer for an event empty, which doesn't make sense.
27
+
28
+ # Dependencies
29
+
30
+ Updated various dependencies to their latest versions, including:
31
+
32
+ - `@aws-sdk/client-dynamodb` & `@aws-sdk/util-dynamodb` to `3.758.0`
33
+ - `@nestjs/common`, `@nestjs/core`, `@nestjs/platform-express`, and `@nestjs/testing` to `11.0.11`
34
+ - `@changesets/changelog-github` & `@changesets/cli` to their latest versions
35
+ - `@faker-js/faker` to `9.5.1`
36
+ - `@swc/core` to `1.11.5`
37
+ - `mongodb` to `6.14.0`
38
+ - `next` to `15.2.0`
39
+ - `pg` to `8.13.3` and `pg-cursor` to `2.12.3`
40
+ - `rxjs` to `7.8.2`
41
+ - `tsup` to `8.4.0`
42
+ - `turbo` to `2.4.4`
43
+ - `typescript` to `5.8.2`
44
+
45
+ These updates include minor fixes, performance improvements, and compatibility enhancements.
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [[`cbc7b08`](https://github.com/ocoda/event-sourcing/commit/cbc7b082555cb0855cd26965020b152c679e6e47)]:
50
+ - @ocoda/event-sourcing@2.1.0
51
+
3
52
  ## 2.0.0
4
53
 
5
54
  ### Major 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
@@ -57,12 +57,12 @@ var __asyncGenerator = (__this, __arguments, generator) => {
57
57
  var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
58
58
 
59
59
  // lib/index.ts
60
- var lib_exports = {};
61
- __export(lib_exports, {
60
+ var index_exports = {};
61
+ __export(index_exports, {
62
62
  MariaDBEventStore: () => MariaDBEventStore,
63
63
  MariaDBSnapshotStore: () => MariaDBSnapshotStore
64
64
  });
65
- module.exports = __toCommonJS(lib_exports);
65
+ module.exports = __toCommonJS(index_exports);
66
66
 
67
67
  // lib/mariadb.event-store.ts
68
68
  var import_event_sourcing = require("@ocoda/event-sourcing");
@@ -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 new Map(entities.map(({ stream_id, payload }) => [
643
- streams.find(({ streamId: currentStreamId }) => currentStreamId === stream_id),
644
- payload
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 new Map(entities.map(({ stream_id, payload, aggregate_id, registered_on, snapshot_id, version }) => [
823
- streams.find(({ streamId: currentStreamId }) => currentStreamId === stream_id),
824
- import_event_sourcing2.SnapshotEnvelope.from(payload, {
825
- aggregateId: aggregate_id,
826
- registeredOn: new Date(registered_on),
827
- snapshotId: snapshot_id,
828
- version
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.0.0",
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,26 +19,26 @@
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.0.0"
22
+ "@ocoda/event-sourcing": "2.1.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@biomejs/biome": "1.9.4",
26
- "@faker-js/faker": "^9.4.0",
27
- "@nestjs/common": "11.0.9",
28
- "@nestjs/core": "11.0.9",
29
- "@nestjs/platform-express": "11.0.9",
30
- "@nestjs/testing": "11.0.9",
31
- "@swc-node/register": "^1.10.9",
32
- "@swc/core": "1.10.15",
26
+ "@faker-js/faker": "^9.5.1",
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",
36
36
  "jest": "29.7.0",
37
37
  "jest-mock": "29.7.0",
38
38
  "reflect-metadata": "0.2.2",
39
- "rxjs": "7.8.1",
40
- "tsup": "^8.3.6",
41
- "typescript": "5.7.3",
39
+ "rxjs": "7.8.2",
40
+ "tsup": "^8.4.0",
41
+ "typescript": "5.8.2",
42
42
  "@ocoda/event-sourcing-config": "1.0.0",
43
43
  "@ocoda/event-sourcing-testing": "1.0.0"
44
44
  },