node-cqrs 1.0.0-rc.13 → 1.0.0-rc.15

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,3 +1,11 @@
1
+ # [1.0.0-rc.15](https://github.com/snatalenko/node-cqrs/compare/v1.0.0-rc.14...v1.0.0-rc.15) (2025-08-24)
2
+
3
+
4
+
5
+ # [1.0.0-rc.14](https://github.com/snatalenko/node-cqrs/compare/v1.0.0-rc.13...v1.0.0-rc.14) (2025-08-15)
6
+
7
+
8
+
1
9
  # [1.0.0-rc.13](https://github.com/snatalenko/node-cqrs/compare/v1.0.0-rc.12...v1.0.0-rc.13) (2025-08-14)
2
10
 
3
11
 
@@ -51,36 +59,21 @@
51
59
  * Remove `publishAsync` setting, simplify publishing sequence ([79257e5](https://github.com/snatalenko/node-cqrs/commit/79257e59d322df5dd8e41bedf5273c97ae77b609))
52
60
 
53
61
 
54
- # [1.0.0-rc.6](https://github.com/snatalenko/node-cqrs/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2025-03-21)
62
+ # [1.0.0-rc.6](https://github.com/snatalenko/node-cqrs/compare/v0.16.4...v1.0.0-rc.6) (2025-03-21)
55
63
 
56
64
 
57
- ### Changes
58
-
59
- * Support persistent views; Add SQLite infrastructure ([c235573](https://github.com/snatalenko/node-cqrs/commit/c235573678be349d031d1a696cab3993224979a2))
60
-
61
-
62
- # [1.0.0-rc.5](https://github.com/snatalenko/node-cqrs/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2024-10-27)
65
+ ### Fixes
63
66
 
67
+ * Vulnerability in minimist dependency ([07b8c68](https://github.com/snatalenko/node-cqrs/commit/07b8c682fae4278965aa13a06caa994c037934e9))
64
68
 
65
69
  ### Changes
66
70
 
67
71
  * Add `InMemoryView.prototype.getSync` method ([5d4adb9](https://github.com/snatalenko/node-cqrs/commit/5d4adb9109c4c85edae2b0f3dfd995e8c51aef06))
72
+ * Support persistent views; Add SQLite infrastructure ([c235573](https://github.com/snatalenko/node-cqrs/commit/c235573678be349d031d1a696cab3993224979a2))
68
73
 
74
+ ### Refactoring
69
75
 
70
- # [1.0.0-rc.4](https://github.com/snatalenko/node-cqrs/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2024-10-02)
71
-
72
-
73
-
74
- # [1.0.0-rc.3](https://github.com/snatalenko/node-cqrs/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2024-09-23)
75
-
76
-
77
-
78
- # [1.0.0-rc.2](https://github.com/snatalenko/node-cqrs/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2024-08-03)
79
-
80
-
81
-
82
- # [1.0.0-rc.1](https://github.com/snatalenko/node-cqrs/compare/v1.0.0-rc.0...v1.0.0-rc.1) (2024-08-03)
83
-
76
+ * Migrate to TS and Jest ([6737d55](https://github.com/snatalenko/node-cqrs/commit/6737d5566a9dc6314df0b20a65d32414fc503e54))
84
77
 
85
78
  ### Build System
86
79
 
@@ -88,18 +81,6 @@
88
81
  * Suppress audit and test for tags ([574a00c](https://github.com/snatalenko/node-cqrs/commit/574a00cc53af009994ca4dd3278cb764743b4ad6))
89
82
 
90
83
 
91
- # [1.0.0-rc.0](https://github.com/snatalenko/node-cqrs/compare/v0.16.4...v1.0.0-rc.0) (2024-08-02)
92
-
93
-
94
- ### Fixes
95
-
96
- * Vulnerability in minimist dependency ([07b8c68](https://github.com/snatalenko/node-cqrs/commit/07b8c682fae4278965aa13a06caa994c037934e9))
97
-
98
- ### Refactoring
99
-
100
- * Migrate to TS and Jest ([6737d55](https://github.com/snatalenko/node-cqrs/commit/6737d5566a9dc6314df0b20a65d32414fc503e54))
101
-
102
-
103
84
  ## [0.16.4](https://github.com/snatalenko/node-cqrs/compare/v0.16.3...v0.16.4) (2022-08-28)
104
85
 
105
86
 
@@ -137,36 +118,24 @@
137
118
  * Postpone view.get responses to next loop iteration ([950c2e4](https://github.com/snatalenko/node-cqrs/commit/950c2e42f62d7388b0cc668e81fb4f6718656fca))
138
119
 
139
120
 
140
- # [0.16.0](https://github.com/snatalenko/node-cqrs/compare/v0.16.0-5...v0.16.0) (2020-03-18)
141
-
142
-
143
- ### Fixes
144
-
145
- * Moderate security issue in "minimist" dev dependency ([579d523](https://github.com/snatalenko/node-cqrs/commit/579d523745a6d33902a5245bc7e9f3fe843abc2b))
146
-
147
-
148
- # [0.16.0-5](https://github.com/snatalenko/node-cqrs/compare/v0.16.0-4...v0.16.0-5) (2020-02-19)
149
-
150
-
151
-
152
- # [0.16.0-4](https://github.com/snatalenko/node-cqrs/compare/v0.16.0-3...v0.16.0-4) (2020-02-19)
153
-
154
-
155
-
156
- # [0.16.0-3](https://github.com/snatalenko/node-cqrs/compare/v0.16.0-2...v0.16.0-3) (2020-01-28)
121
+ # [0.16.0](https://github.com/snatalenko/node-cqrs/compare/v0.15.1...v0.16.0) (2020-03-18)
157
122
 
158
123
 
159
124
  ### Features
160
125
 
126
+ * Accept logger as an optional dependency ([65fe5ad](https://github.com/snatalenko/node-cqrs/commit/65fe5ad8a9de48d548715a2bd651f6d9c4cb0af1))
161
127
  * Detect circular dependencies in DI container ([1490b51](https://github.com/snatalenko/node-cqrs/commit/1490b519c7581b1de6cd084d91f61875751d773b))
162
128
 
163
129
  ### Fixes
164
130
 
131
+ * Debug output not using toString in Node 12 ([ca0d32f](https://github.com/snatalenko/node-cqrs/commit/ca0d32f78a676faf45a342f4198ef4a93a3d0702))
165
132
  * Debug output on one time subscriptions ([2fd7601](https://github.com/snatalenko/node-cqrs/commit/2fd7601b6b8e8059f0b777af6c1294cc78cb787b))
166
133
  * Correctly set type of the extended container builder created from container ([1f2f632](https://github.com/snatalenko/node-cqrs/commit/1f2f6325ceab65c4c81494d145261668125d03b1))
134
+ * Moderate security issue in "minimist" dev dependency ([579d523](https://github.com/snatalenko/node-cqrs/commit/579d523745a6d33902a5245bc7e9f3fe843abc2b))
167
135
 
168
136
  ### Changes
169
137
 
138
+ * Debug, mocha, sinon ([ac80c27](https://github.com/snatalenko/node-cqrs/commit/ac80c27653828904cf7b80d37b0ecade860b7490))
170
139
  * Move DI container to a separate package ([350f3f4](https://github.com/snatalenko/node-cqrs/commit/350f3f405a98fea2c7a85ea92f2b0f1aa945c75c))
171
140
  * Do not bind masterHandler to observer automatically ([d2ec79d](https://github.com/snatalenko/node-cqrs/commit/d2ec79dced5460f619cf9bed5f34df1bbb8e0132))
172
141
  * Remove deprecated InMemoryView..markAsReady method ([23015ec](https://github.com/snatalenko/node-cqrs/commit/23015ec3f5bc69f843cf6815caa1f4cda9fea27c))
@@ -180,122 +149,213 @@
180
149
 
181
150
  ### Tests
182
151
 
152
+ * Fix tests in Node 12 ([beeb471](https://github.com/snatalenko/node-cqrs/commit/beeb471faee9e1259f11b4c1c65877cd27309637))
183
153
  * Run example domain tests with unit tests ([5ffdb43](https://github.com/snatalenko/node-cqrs/commit/5ffdb43c0398fc6650a7a1d62a5f07870ee20bfd))
184
154
  * Run eslint for entire project folder ([d9055a1](https://github.com/snatalenko/node-cqrs/commit/d9055a158faa67dc9ece4f77b01517a5480b0a18))
185
155
 
186
156
  ### Build System
187
157
 
158
+ * Prevent git push on version ([3ea9e38](https://github.com/snatalenko/node-cqrs/commit/3ea9e38babf440ab384235e69d248fd92a2dfdff))
159
+ * Add conventional-changelog script ([da26a1c](https://github.com/snatalenko/node-cqrs/commit/da26a1cf6db0a609fcb3f1ba3a29ce6db6d0ab95))
160
+ * Run tests in NodeJS 12 env ([1d4239c](https://github.com/snatalenko/node-cqrs/commit/1d4239cf0f48e64105bfd6b28ab9a22f3fd23e7e))
161
+ * Replace changelog eslint preset with custom one ([8507262](https://github.com/snatalenko/node-cqrs/commit/8507262eeb7c367bbb8bd52b74e04c678bfcf956))
188
162
  * Exclude unnecessary files from package ([47b6797](https://github.com/snatalenko/node-cqrs/commit/47b679750780c0d7840d4d45a1296dc9bef7d674))
189
163
  * Do not install global dependencies ([158783c](https://github.com/snatalenko/node-cqrs/commit/158783c299720e709b8a34f3ef74fba1390d03ad))
190
164
 
191
165
 
192
- # [0.16.0-2](https://github.com/snatalenko/node-cqrs/compare/v0.16.0-1...v0.16.0-2) (2019-12-18)
166
+ ## [0.15.1](https://github.com/snatalenko/node-cqrs/compare/v0.15.0...v0.15.1) (2019-08-26)
193
167
 
194
168
 
195
- ### Features
169
+ ### Changes
196
170
 
197
- * Accept logger as an optional dependency ([65fe5ad](https://github.com/snatalenko/node-cqrs/commit/65fe5ad8a9de48d548715a2bd651f6d9c4cb0af1))
171
+ * Upgrade dev dependencies to fix audit script ([ef01cc3](https://github.com/snatalenko/node-cqrs/commit/ef01cc33b63a95a8783a83b34c4fcb3f4830fe52))
198
172
 
199
- ### Build System
200
173
 
201
- * Replace changelog eslint preset with custom one ([8507262](https://github.com/snatalenko/node-cqrs/commit/8507262eeb7c367bbb8bd52b74e04c678bfcf956))
174
+ # [0.15.0](https://github.com/snatalenko/node-cqrs/compare/v0.14.2...v0.15.0) (2019-08-25)
202
175
 
203
176
 
204
- ## [0.15.1](https://github.com/snatalenko/node-cqrs/compare/v0.15.0...v0.15.1) (2019-08-26)
205
177
 
178
+ ## [0.14.2](https://github.com/snatalenko/node-cqrs/compare/v0.14.1...v0.14.2) (2018-07-29)
206
179
 
207
- ### Changes
208
180
 
209
- * Upgrade dev dependencies to fix audit script ([ef01cc3](https://github.com/snatalenko/node-cqrs/commit/ef01cc33b63a95a8783a83b34c4fcb3f4830fe52))
210
181
 
182
+ ## [0.14.1](https://github.com/snatalenko/node-cqrs/compare/v0.14.0...v0.14.1) (2018-07-14)
211
183
 
212
- # [0.16.0-1](https://github.com/snatalenko/node-cqrs/compare/v0.16.0-0...v0.16.0-1) (2019-11-28)
213
184
 
214
- ### Changes
215
185
 
216
- * EventStore to return async event generators (requires NodeJS version 10+)
186
+ # [0.14.0](https://github.com/snatalenko/node-cqrs/compare/v0.13.0...v0.14.0) (2018-05-17)
217
187
 
218
- ### Build
219
188
 
220
- * Add conventional-changelog script ([da26a1c](https://github.com/snatalenko/node-cqrs/commit/da26a1cf6db0a609fcb3f1ba3a29ce6db6d0ab95))
221
- * Prevent git push on version ([3ea9e38](https://github.com/snatalenko/node-cqrs/commit/3ea9e38babf440ab384235e69d248fd92a2dfdff))
222
- * Run tests in NodeJS 12 env ([1d4239c](https://github.com/snatalenko/node-cqrs/commit/1d4239cf0f48e64105bfd6b28ab9a22f3fd23e7e))
223
189
 
224
- ### Fix
190
+ # [0.13.0](https://github.com/snatalenko/node-cqrs/compare/v0.12.6...v0.13.0) (2017-10-04)
225
191
 
226
- * Debug output not using toString in Node 12 ([ca0d32f](https://github.com/snatalenko/node-cqrs/commit/ca0d32f78a676faf45a342f4198ef4a93a3d0702))
227
192
 
228
- ### Tests
229
193
 
230
- * Fix tests in Node 12 ([beeb471](https://github.com/snatalenko/node-cqrs/commit/beeb471faee9e1259f11b4c1c65877cd27309637))
194
+ ## [0.12.6](https://github.com/snatalenko/node-cqrs/compare/v0.12.5...v0.12.6) (2017-08-23)
231
195
 
232
- ### Upgrade
233
196
 
234
- * debug, mocha, sinon ([ac80c27](https://github.com/snatalenko/node-cqrs/commit/ac80c27653828904cf7b80d37b0ecade860b7490))
235
197
 
236
- ## 0.15.0 - 2018-08-25
198
+ ## [0.12.5](https://github.com/snatalenko/node-cqrs/compare/v0.12.4...v0.12.5) (2017-06-23)
237
199
 
238
200
 
239
- ### Features
240
201
 
241
- * `InMemoryView.prototype.getAll` as an alternative to the deprecated `state` property
202
+ ## [0.12.4](https://github.com/snatalenko/node-cqrs/compare/v0.12.3...v0.12.4) (2017-04-25)
242
203
 
243
- ### Changes
244
204
 
245
- * `InMemoryView.prototype.create` 2nd parameter must be an instance of an Object, not a factory function
246
- * `InMemoryView.prototype.updateEnforcingNew` does not pass an empty object as a parameter when record does not exist
247
- * Observable `on(,,{queueName})` replaced with `queue(name).on(,)`;
248
- * separated IProjectionView and IConcurrentView interfaces
249
- * `IProjectionView.prototype.shouldRestore` can return Promise
250
- * Projection `restore` process flow to support async concurrent views
251
205
 
252
- ### Fixes
206
+ ## [0.12.3](https://github.com/snatalenko/node-cqrs/compare/v0.12.1...v0.12.3) (2017-04-24)
253
207
 
254
- * Typings
255
- * Call stack overflow in EventStream constructor on large number of events
256
208
 
257
- ## 0.14.2 (2018-07-29)
258
209
 
210
+ ## [0.12.1](https://github.com/snatalenko/node-cqrs/compare/v0.12.0...v0.12.1) (2017-04-24)
259
211
 
260
- ### Fixes
261
212
 
262
- * `Container.prototype.registerInstance` requires an Object as first parameter
263
213
 
264
- ## 0.14.1 (2018-07-14)
214
+ # [0.12.0](https://github.com/snatalenko/node-cqrs/compare/v0.11.1...v0.12.0) (2017-04-22)
265
215
 
266
- ### Features
267
216
 
268
- * `Aggregate.prototype.makeEvent` as a separate method for testing purposes
269
217
 
270
- ### Fixes
218
+ ## [0.11.1](https://github.com/snatalenko/node-cqrs/compare/v0.11.0...v0.11.1) (2017-03-01)
271
219
 
272
- * Aggregate snapshot modification thru Aggregate state
273
- * Tests with NodeJS@^10
274
220
 
275
- ## 0.14.0 (2018-05-17)
276
221
 
222
+ # [0.11.0](https://github.com/snatalenko/node-cqrs/compare/v0.10.0...v0.11.0) (2017-01-18)
277
223
 
278
- ### Features
279
224
 
280
- * examples/user-domain
281
- * typings
282
- * changelog
283
225
 
284
- ### Changes
226
+ # [0.10.0](https://github.com/snatalenko/node-cqrs/compare/v0.9.3...v0.10.0) (2017-01-16)
285
227
 
286
- * snapshotStorage moved to a separate interface/entity
287
- * named queues handling moved out of EventStore to InMemoryMessageBus implementation
288
- * command-to-event context copying moved out of EventStore to AbstractAggregate.prototype.emit, which frees up road for a concurrent operations on same aggregate implementation
289
- * EventStream is immutable
290
- * `AbstractProjection.prototype.shouldRestoreView` can be overriden in projection for own view implementations
291
228
 
292
- ## 0.13.0 (2017-10-04)
293
229
 
294
- ### Documentation
230
+ ## [0.9.3](https://github.com/snatalenko/node-cqrs/compare/v0.9.2...v0.9.3) (2017-01-06)
231
+
232
+
233
+
234
+ ## [0.9.2](https://github.com/snatalenko/node-cqrs/compare/v0.9.1...v0.9.2) (2016-12-19)
235
+
236
+
237
+
238
+ ## [0.9.1](https://github.com/snatalenko/node-cqrs/compare/v0.9.0...v0.9.1) (2016-12-17)
239
+
240
+
241
+
242
+ # [0.9.0](https://github.com/snatalenko/node-cqrs/compare/v0.8.0...v0.9.0) (2016-12-17)
243
+
244
+
245
+
246
+ # [0.8.0](https://github.com/snatalenko/node-cqrs/compare/v0.7.8...v0.8.0) (2016-12-07)
247
+
248
+
249
+
250
+ ## [0.7.8](https://github.com/snatalenko/node-cqrs/compare/v0.7.7...v0.7.8) (2016-12-05)
251
+
252
+
253
+
254
+ ## [0.7.7](https://github.com/snatalenko/node-cqrs/compare/v0.7.6...v0.7.7) (2016-12-04)
255
+
256
+
257
+
258
+ ## [0.7.6](https://github.com/snatalenko/node-cqrs/compare/v0.7.5...v0.7.6) (2016-12-01)
259
+
260
+
261
+
262
+ ## [0.7.5](https://github.com/snatalenko/node-cqrs/compare/v0.7.4...v0.7.5) (2016-12-01)
263
+
264
+
265
+
266
+ ## [0.7.4](https://github.com/snatalenko/node-cqrs/compare/v0.7.3...v0.7.4) (2016-11-30)
267
+
268
+
269
+
270
+ ## [0.7.3](https://github.com/snatalenko/node-cqrs/compare/v0.7.2...v0.7.3) (2016-11-29)
271
+
272
+
273
+
274
+ ## [0.7.2](https://github.com/snatalenko/node-cqrs/compare/v0.7.1...v0.7.2) (2016-11-25)
275
+
276
+
277
+
278
+ ## [0.7.1](https://github.com/snatalenko/node-cqrs/compare/v0.7.0...v0.7.1) (2016-11-20)
279
+
280
+
281
+
282
+ # [0.7.0](https://github.com/snatalenko/node-cqrs/compare/v0.6.10...v0.7.0) (2016-11-18)
283
+
284
+
285
+
286
+ ## [0.6.10](https://github.com/snatalenko/node-cqrs/compare/v0.6.9...v0.6.10) (2016-10-24)
287
+
288
+
289
+
290
+ ## [0.6.9](https://github.com/snatalenko/node-cqrs/compare/v0.6.8...v0.6.9) (2016-10-24)
291
+
292
+
293
+
294
+ ## [0.6.8](https://github.com/snatalenko/node-cqrs/compare/v0.6.7...v0.6.8) (2016-10-23)
295
+
296
+
297
+
298
+ ## [0.6.7](https://github.com/snatalenko/node-cqrs/compare/v0.6.6...v0.6.7) (2016-10-23)
299
+
300
+
301
+
302
+ ## [0.6.6](https://github.com/snatalenko/node-cqrs/compare/v0.6.5...v0.6.6) (2016-08-23)
303
+
304
+
305
+
306
+ ## [0.6.5](https://github.com/snatalenko/node-cqrs/compare/v0.6.4...v0.6.5) (2016-08-23)
307
+
308
+
309
+
310
+ ## [0.6.4](https://github.com/snatalenko/node-cqrs/compare/v0.6.3...v0.6.4) (2016-07-24)
311
+
312
+
313
+
314
+ ## [0.6.3](https://github.com/snatalenko/node-cqrs/compare/v0.6.2...v0.6.3) (2016-07-06)
315
+
316
+
317
+
318
+ ## [0.6.2](https://github.com/snatalenko/node-cqrs/compare/v0.6.1...v0.6.2) (2016-07-02)
319
+
320
+
321
+
322
+ ## [0.6.1](https://github.com/snatalenko/node-cqrs/compare/v0.6.0...v0.6.1) (2016-05-31)
323
+
324
+
325
+
326
+ # [0.6.0](https://github.com/snatalenko/node-cqrs/compare/v0.5.0...v0.6.0) (2016-03-06)
327
+
328
+
329
+
330
+ # [0.5.0](https://github.com/snatalenko/node-cqrs/compare/v0.4.0...v0.5.0) (2016-03-03)
331
+
332
+
333
+
334
+ # [0.4.0](https://github.com/snatalenko/node-cqrs/compare/v0.3.2...v0.4.0) (2016-03-03)
335
+
336
+
337
+
338
+ ## [0.3.2](https://github.com/snatalenko/node-cqrs/compare/v0.3.1...v0.3.2) (2016-02-29)
339
+
340
+
341
+
342
+ ## [0.3.1](https://github.com/snatalenko/node-cqrs/compare/v0.3.0...v0.3.1) (2016-02-29)
343
+
344
+
345
+
346
+ # [0.3.0](https://github.com/snatalenko/node-cqrs/compare/v0.2.2...v0.3.0) (2016-02-29)
347
+
348
+
349
+
350
+ ## [0.2.2](https://github.com/snatalenko/node-cqrs/compare/v0.2.1...v0.2.2) (2015-12-23)
351
+
352
+
353
+
354
+ ## [0.2.1](https://github.com/snatalenko/node-cqrs/compare/v0.2.0...v0.2.1) (2015-12-22)
355
+
356
+
357
+
358
+ # 0.2.0 (2015-12-22)
295
359
 
296
- * docs publishing to [node-cqrs.org](https://www.node-cqrs.org)
297
360
 
298
- ### Changes
299
361
 
300
- * In-Memory views do not respond to get(..) requests until they are restored
301
- * In-Memory views restoring is handled by AbstractProjection
@@ -8,8 +8,8 @@ const EventStore_1 = require("./EventStore");
8
8
  const SagaEventHandler_1 = require("./SagaEventHandler");
9
9
  const EventDispatcher_1 = require("./EventDispatcher");
10
10
  const in_memory_1 = require("./in-memory");
11
- const EventValidationProcessor_1 = require("./EventValidationProcessor");
12
11
  const utils_1 = require("./utils");
12
+ const interfaces_1 = require("./interfaces");
13
13
  class CqrsContainerBuilder extends di0_1.ContainerBuilder {
14
14
  constructor(options) {
15
15
  super(options);
@@ -17,15 +17,11 @@ class CqrsContainerBuilder extends di0_1.ContainerBuilder {
17
17
  super.register(EventStore_1.EventStore).as('eventStore');
18
18
  super.register(CommandBus_1.CommandBus).as('commandBus');
19
19
  super.register(EventDispatcher_1.EventDispatcher).as('eventDispatcher');
20
- super.register(in_memory_1.InMemoryEventStorage).as('eventStorageWriter');
21
- super.register(in_memory_1.InMemorySnapshotStorage).as('snapshotStorage');
22
- // Register default event dispatch pipeline:
23
- // validate events, write to event storage, write to snapshot storage.
24
- // If any of the processors is not defined, it will be skipped.
25
- super.register((container) => [
26
- new EventValidationProcessor_1.EventValidationProcessor(),
27
- container.eventStorageWriter,
28
- container.snapshotStorage
20
+ super.register(c => [
21
+ // automatically add `eventStorageWrite` and `snapshotStorage` to the default dispatch pipeline
22
+ // if they're registered in the DI container and implement `IDispatchPipelineProcessor` interface
23
+ ...(0, interfaces_1.isDispatchPipelineProcessor)(c.eventStorageWriter) ? [c.eventStorageWriter] : [],
24
+ ...(0, interfaces_1.isDispatchPipelineProcessor)(c.snapshotStorage) ? [c.snapshotStorage] : []
29
25
  ]).as('eventDispatchPipeline');
30
26
  }
31
27
  /** Register command handler, which will be subscribed to commandBus upon instance creation */
@@ -1 +1 @@
1
- {"version":3,"file":"CqrsContainerBuilder.js","sourceRoot":"","sources":["../src/CqrsContainerBuilder.ts"],"names":[],"mappings":";;;AAAA,6BAAoE;AACpE,uEAAoE;AACpE,6CAA0C;AAC1C,6CAA0C;AAC1C,yDAAsD;AACtD,uDAAoD;AACpD,2CAAgG;AAChG,yEAAsE;AACtE,mCAAkC;AAWlC,MAAa,oBAAqB,SAAQ,sBAAgB;IAEzD,YAAY,OAGX;QACA,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,KAAK,CAAC,QAAQ,CAAC,8BAAkB,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QAClD,KAAK,CAAC,QAAQ,CAAC,uBAAU,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAC5C,KAAK,CAAC,QAAQ,CAAC,uBAAU,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAC5C,KAAK,CAAC,QAAQ,CAAC,iCAAe,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;QAEtD,KAAK,CAAC,QAAQ,CAAC,gCAAoB,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC;QAC9D,KAAK,CAAC,QAAQ,CAAC,mCAAuB,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;QAE9D,4CAA4C;QAC5C,sEAAsE;QACtE,+DAA+D;QAC/D,KAAK,CAAC,QAAQ,CAAC,CAAC,SAAqB,EAAE,EAAE,CAAC;YACzC,IAAI,mDAAwB,EAAE;YAC9B,SAAS,CAAC,kBAAkB;YAC5B,SAAS,CAAC,eAAe;SACzB,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC;IAChC,CAAC;IAED,8FAA8F;IAC9F,sBAAsB,CAAC,aAA+C;QACrE,OAAO,KAAK,CAAC,QAAQ,CACpB,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AO,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC;IAC3D,CAAC;IAGD,0CAA0C;IAC1C,YAAY,CAAC,QAA0B;QACtC,IAAI,CAAC,IAAA,eAAO,EAAC,QAAQ,CAAC;YACrB,MAAM,IAAI,SAAS,CAAC,kDAAkD,CAAC,CAAC;QAEzE,MAAM,oBAAoB,GAAG,CAAC,SAAqB,EAAkB,EAAE,CACtE,SAAS,CAAC,cAAc,CAAC,mCAAgB,EAAE;YAC1C,WAAW,EAAE,CAAC,OAAY,EAAE,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC;YAC1E,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,SAAS,EAAE,QAAQ,CAAC,IAAI;SACxB,CAAC,CAAC;QAEJ,OAAO,IAAI,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;IACzD,CAAC;CACD;AAnGD,oDAmGC"}
package/dist/Event.js CHANGED
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.describe = describe;
4
4
  exports.describeMultiple = describeMultiple;
5
- exports.validate = validate;
6
5
  /**
7
6
  * Get text description of an event for logging purposes
8
7
  */
@@ -17,17 +16,4 @@ function describeMultiple(events) {
17
16
  return describe(events[0]);
18
17
  return `${events.length} events`;
19
18
  }
20
- /**
21
- * Validate event structure
22
- */
23
- function validate(event) {
24
- if (typeof event !== 'object' || !event)
25
- throw new TypeError('event must be an Object');
26
- if (typeof event.type !== 'string' || !event.type.length)
27
- throw new TypeError('event.type must be a non-empty String');
28
- if (!event.aggregateId && !event.sagaId)
29
- throw new TypeError('either event.aggregateId or event.sagaId is required');
30
- if (event.sagaId && typeof event.sagaVersion === 'undefined')
31
- throw new TypeError('event.sagaVersion is required, when event.sagaId is defined');
32
- }
33
19
  //# sourceMappingURL=Event.js.map
package/dist/Event.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Event.js","sourceRoot":"","sources":["../src/Event.ts"],"names":[],"mappings":";;AAKA,4BAEC;AAKD,4CAKC;AAKD,4BASC;AA7BD;;GAEG;AACH,SAAgB,QAAQ,CAAC,KAAa;IACrC,OAAO,IAAI,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,WAAW,MAAM,KAAK,CAAC,gBAAgB,GAAG,CAAC;AAC/E,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,MAA6B;IAC7D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QACtB,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5B,OAAO,GAAG,MAAM,CAAC,MAAM,SAAS,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,QAAQ,CAAC,KAAa;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK;QACtC,MAAM,IAAI,SAAS,CAAC,yBAAyB,CAAC,CAAC;IAChD,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM;QACvD,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;IAC9D,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,MAAM;QACtC,MAAM,IAAI,SAAS,CAAC,sDAAsD,CAAC,CAAC;IAC7E,IAAI,KAAK,CAAC,MAAM,IAAI,OAAO,KAAK,CAAC,WAAW,KAAK,WAAW;QAC3D,MAAM,IAAI,SAAS,CAAC,6DAA6D,CAAC,CAAC;AACrF,CAAC"}
1
+ {"version":3,"file":"Event.js","sourceRoot":"","sources":["../src/Event.ts"],"names":[],"mappings":";;AAKA,4BAEC;AAKD,4CAKC;AAfD;;GAEG;AACH,SAAgB,QAAQ,CAAC,KAAa;IACrC,OAAO,IAAI,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,WAAW,MAA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AAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBAC1B,KAAK;gBACL,GAAG,IAAI;aACP,CAAC,CAAC;YACH,OAAO;YACP,MAAM;SACN,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,mBAAmB;YAC5B,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEjC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEnC,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAvJD,0CAuJC"}
package/dist/index.js CHANGED
@@ -25,7 +25,6 @@ __exportStar(require("./AbstractSaga"), exports);
25
25
  __exportStar(require("./SagaEventHandler"), exports);
26
26
  __exportStar(require("./AbstractProjection"), exports);
27
27
  __exportStar(require("./EventDispatcher"), exports);
28
- __exportStar(require("./EventValidationProcessor"), exports);
29
28
  __exportStar(require("./in-memory"), exports);
30
29
  exports.Event = require("./Event");
31
30
  var utils_1 = require("./utils");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+DAAkF;AAAzE,wHAAA,oBAAoB,OAAoB;AAEjD,+CAA6B;AAC7B,+CAA6B;AAE7B,sDAAoC;AACpC,4DAA0C;AAC1C,iDAA+B;AAC/B,qDAAmC;AACnC,uDAAqC;AACrC,oDAAkC;AAClC,6DAA2C;AAE3C,8CAA4B;AAE5B,mCAAiC;AACjC,iCAGiB;AAFhB,+GAAA,sBAAsB,OAAA;AACtB,kGAAA,SAAS,OAAA;AAGV,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+DAAkF;AAAzE,wHAAA,oBAAoB,OAAoB;AAEjD,+CAA6B;AAC7B,+CAA6B;AAE7B,sDAAoC;AACpC,4DAA0C;AAC1C,iDAA+B;AAC/B,qDAAmC;AACnC,uDAAqC;AACrC,oDAAkC;AAElC,8CAA4B;AAE5B,mCAAiC;AACjC,iCAGiB;AAFhB,+GAAA,sBAAsB,OAAA;AACtB,kGAAA,SAAS,OAAA;AAGV,+CAA6B"}
@@ -4,6 +4,7 @@ exports.isEvent = void 0;
4
4
  const isObject_1 = require("./isObject");
5
5
  const isEvent = (event) => (0, isObject_1.isObject)(event)
6
6
  && 'type' in event
7
- && typeof event.type === 'string';
7
+ && typeof event.type === 'string'
8
+ && event.type.length > 0;
8
9
  exports.isEvent = isEvent;
9
10
  //# sourceMappingURL=IEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IEvent.js","sourceRoot":"","sources":["../../src/interfaces/IEvent.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAQ/B,MAAM,OAAO,GAAG,CAAC,KAAc,EAAmB,EAAE,CAC1D,IAAA,mBAAQ,EAAC,KAAK,CAAC;OACZ,MAAM,IAAI,KAAK;OACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAHtB,QAAA,OAAO,WAGe"}
1
+ {"version":3,"file":"IEvent.js","sourceRoot":"","sources":["../../src/interfaces/IEvent.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAQ/B,MAAM,OAAO,GAAG,CAAC,KAAc,EAAmB,EAAE,CAC1D,IAAA,mBAAQ,EAAC,KAAK,CAAC;OACZ,MAAM,IAAI,KAAK;OACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;OAC9B,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AAJb,QAAA,OAAO,WAIM"}
@@ -1 +1 @@
1
- {"root":["../src/AbstractAggregate.ts","../src/AbstractProjection.ts","../src/AbstractSaga.ts","../src/AggregateCommandHandler.ts","../src/CommandBus.ts","../src/CqrsContainerBuilder.ts","../src/Event.ts","../src/EventDispatcher.ts","../src/EventStore.ts","../src/EventValidationProcessor.ts","../src/SagaEventHandler.ts","../src/index.ts","../src/in-memory/InMemoryEventStorage.ts","../src/in-memory/InMemoryLock.ts","../src/in-memory/InMemoryMessageBus.ts","../src/in-memory/InMemorySnapshotStorage.ts","../src/in-memory/InMemoryView.ts","../src/in-memory/index.ts","../src/in-memory/utils/index.ts","../src/in-memory/utils/nextCycle.ts","../src/interfaces/IAggregate.ts","../src/interfaces/IAggregateSnapshotStorage.ts","../src/interfaces/ICommand.ts","../src/interfaces/ICommandBus.ts","../src/interfaces/IContainer.ts","../src/interfaces/IDispatchPipelineProcessor.ts","../src/interfaces/IEvent.ts","../src/interfaces/IEventBus.ts","../src/interfaces/IEventDispatcher.ts","../src/interfaces/IEventLocker.ts","../src/interfaces/IEventReceptor.ts","../src/interfaces/IEventSet.ts","../src/interfaces/IEventStorage.ts","../src/interfaces/IEventStore.ts","../src/interfaces/IEventStream.ts","../src/interfaces/IIdentifierProvider.ts","../src/interfaces/ILogger.ts","../src/interfaces/IMessage.ts","../src/interfaces/IMessageBus.ts","../src/interfaces/IObjectStorage.ts","../src/interfaces/IObservable.ts","../src/interfaces/IObserver.ts","../src/interfaces/IProjection.ts","../src/interfaces/ISaga.ts","../src/interfaces/IViewLocker.ts","../src/interfaces/Identifier.ts","../src/interfaces/index.ts","../src/interfaces/isObject.ts","../src/rabbitmq/IContainer.ts","../src/rabbitmq/RabbitMqEventBus.ts","../src/rabbitmq/RabbitMqEventInjector.ts","../src/rabbitmq/RabbitMqGateway.ts","../src/rabbitmq/TerminationHandler.ts","../src/rabbitmq/constants.ts","../src/rabbitmq/index.ts","../src/sqlite/AbstractSqliteAccessor.ts","../src/sqlite/AbstractSqliteObjectProjection.ts","../src/sqlite/AbstractSqliteView.ts","../src/sqlite/IContainer.ts","../src/sqlite/SqliteEventLocker.ts","../src/sqlite/SqliteObjectStorage.ts","../src/sqlite/SqliteObjectView.ts","../src/sqlite/SqliteProjectionDataParams.ts","../src/sqlite/SqliteViewLocker.ts","../src/sqlite/index.ts","../src/sqlite/queries/eventLockTableInit.ts","../src/sqlite/queries/index.ts","../src/sqlite/queries/viewLockTableInit.ts","../src/sqlite/utils/getEventId.ts","../src/sqlite/utils/guid.ts","../src/sqlite/utils/index.ts","../src/utils/Deferred.ts","../src/utils/Lock.ts","../src/utils/MapAssertable.ts","../src/utils/delay.ts","../src/utils/getClassName.ts","../src/utils/getHandler.ts","../src/utils/getMessageHandlerNames.ts","../src/utils/index.ts","../src/utils/isClass.ts","../src/utils/iteratorToArray.ts","../src/utils/notEmpty.ts","../src/utils/setupOneTimeEmitterSubscription.ts","../src/utils/subscribe.ts","../src/utils/validateHandlers.ts"],"version":"5.9.2"}
1
+ {"root":["../src/AbstractAggregate.ts","../src/AbstractProjection.ts","../src/AbstractSaga.ts","../src/AggregateCommandHandler.ts","../src/CommandBus.ts","../src/CqrsContainerBuilder.ts","../src/Event.ts","../src/EventDispatcher.ts","../src/EventStore.ts","../src/SagaEventHandler.ts","../src/index.ts","../src/in-memory/InMemoryEventStorage.ts","../src/in-memory/InMemoryLock.ts","../src/in-memory/InMemoryMessageBus.ts","../src/in-memory/InMemorySnapshotStorage.ts","../src/in-memory/InMemoryView.ts","../src/in-memory/index.ts","../src/in-memory/utils/index.ts","../src/in-memory/utils/nextCycle.ts","../src/interfaces/IAggregate.ts","../src/interfaces/IAggregateSnapshotStorage.ts","../src/interfaces/ICommand.ts","../src/interfaces/ICommandBus.ts","../src/interfaces/IContainer.ts","../src/interfaces/IDispatchPipelineProcessor.ts","../src/interfaces/IEvent.ts","../src/interfaces/IEventBus.ts","../src/interfaces/IEventDispatcher.ts","../src/interfaces/IEventLocker.ts","../src/interfaces/IEventReceptor.ts","../src/interfaces/IEventSet.ts","../src/interfaces/IEventStorage.ts","../src/interfaces/IEventStore.ts","../src/interfaces/IEventStream.ts","../src/interfaces/IIdentifierProvider.ts","../src/interfaces/ILogger.ts","../src/interfaces/IMessage.ts","../src/interfaces/IMessageBus.ts","../src/interfaces/IObjectStorage.ts","../src/interfaces/IObservable.ts","../src/interfaces/IObserver.ts","../src/interfaces/IProjection.ts","../src/interfaces/ISaga.ts","../src/interfaces/IViewLocker.ts","../src/interfaces/Identifier.ts","../src/interfaces/index.ts","../src/interfaces/isObject.ts","../src/rabbitmq/IContainer.ts","../src/rabbitmq/RabbitMqEventBus.ts","../src/rabbitmq/RabbitMqEventInjector.ts","../src/rabbitmq/RabbitMqGateway.ts","../src/rabbitmq/TerminationHandler.ts","../src/rabbitmq/constants.ts","../src/rabbitmq/index.ts","../src/sqlite/AbstractSqliteAccessor.ts","../src/sqlite/AbstractSqliteObjectProjection.ts","../src/sqlite/AbstractSqliteView.ts","../src/sqlite/IContainer.ts","../src/sqlite/SqliteEventLocker.ts","../src/sqlite/SqliteObjectStorage.ts","../src/sqlite/SqliteObjectView.ts","../src/sqlite/SqliteProjectionDataParams.ts","../src/sqlite/SqliteViewLocker.ts","../src/sqlite/index.ts","../src/sqlite/queries/eventLockTableInit.ts","../src/sqlite/queries/index.ts","../src/sqlite/queries/viewLockTableInit.ts","../src/sqlite/utils/getEventId.ts","../src/sqlite/utils/guid.ts","../src/sqlite/utils/index.ts","../src/utils/Deferred.ts","../src/utils/Lock.ts","../src/utils/MapAssertable.ts","../src/utils/delay.ts","../src/utils/getClassName.ts","../src/utils/getHandler.ts","../src/utils/getMessageHandlerNames.ts","../src/utils/index.ts","../src/utils/isClass.ts","../src/utils/iteratorToArray.ts","../src/utils/notEmpty.ts","../src/utils/setupOneTimeEmitterSubscription.ts","../src/utils/subscribe.ts","../src/utils/validateHandlers.ts"],"version":"5.9.2"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-cqrs",
3
- "version": "1.0.0-rc.13",
3
+ "version": "1.0.0-rc.15",
4
4
  "description": "Basic ES6 backbone for CQRS app development",
5
5
  "keywords": [
6
6
  "cqrs",
@@ -53,12 +53,12 @@
53
53
  "test:coverage": "jest --collect-coverage tests/unit",
54
54
  "pretest:integration": "npm run build",
55
55
  "test:integration": "jest --verbose examples/user-domain-tests tests/integration",
56
- "changelog": "conventional-changelog -n ./scripts/changelog -i CHANGELOG.md -s",
56
+ "changelog": "conventional-changelog -n ./scripts/changelog -r 0 > CHANGELOG.md",
57
57
  "clean": "tsc --build --clean",
58
58
  "build": "tsc --build",
59
59
  "prepare": "npm run build",
60
60
  "preversion": "npm test",
61
- "version": "npm run changelog && git add CHANGELOG.md",
61
+ "version": "./scripts/cleanup_obsolete_tags.sh v$npm_package_version && npm run changelog && git add CHANGELOG.md",
62
62
  "lint": "eslint"
63
63
  },
64
64
  "author": "@snatalenko",
@@ -4,8 +4,7 @@ import { CommandBus } from './CommandBus';
4
4
  import { EventStore } from './EventStore';
5
5
  import { SagaEventHandler } from './SagaEventHandler';
6
6
  import { EventDispatcher } from './EventDispatcher';
7
- import { InMemoryEventStorage, InMemoryMessageBus, InMemorySnapshotStorage } from './in-memory';
8
- import { EventValidationProcessor } from './EventValidationProcessor';
7
+ import { InMemoryMessageBus } from './in-memory';
9
8
  import { isClass } from './utils';
10
9
  import {
11
10
  IAggregateConstructor,
@@ -14,7 +13,8 @@ import {
14
13
  IEventReceptor,
15
14
  IProjection,
16
15
  IProjectionConstructor,
17
- ISagaConstructor
16
+ ISagaConstructor,
17
+ isDispatchPipelineProcessor
18
18
  } from './interfaces';
19
19
 
20
20
  export class CqrsContainerBuilder extends ContainerBuilder {
@@ -29,16 +29,11 @@ export class CqrsContainerBuilder extends ContainerBuilder {
29
29
  super.register(CommandBus).as('commandBus');
30
30
  super.register(EventDispatcher).as('eventDispatcher');
31
31
 
32
- super.register(InMemoryEventStorage).as('eventStorageWriter');
33
- super.register(InMemorySnapshotStorage).as('snapshotStorage');
34
-
35
- // Register default event dispatch pipeline:
36
- // validate events, write to event storage, write to snapshot storage.
37
- // If any of the processors is not defined, it will be skipped.
38
- super.register((container: IContainer) => [
39
- new EventValidationProcessor(),
40
- container.eventStorageWriter,
41
- container.snapshotStorage
32
+ super.register(c => [
33
+ // automatically add `eventStorageWrite` and `snapshotStorage` to the default dispatch pipeline
34
+ // if they're registered in the DI container and implement `IDispatchPipelineProcessor` interface
35
+ ...isDispatchPipelineProcessor(c.eventStorageWriter) ? [c.eventStorageWriter] : [],
36
+ ...isDispatchPipelineProcessor(c.snapshotStorage) ? [c.snapshotStorage] : []
42
37
  ]).as('eventDispatchPipeline');
43
38
  }
44
39
 
package/src/Event.ts CHANGED
@@ -16,17 +16,3 @@ export function describeMultiple(events: ReadonlyArray<IEvent>): string {
16
16
 
17
17
  return `${events.length} events`;
18
18
  }
19
-
20
- /**
21
- * Validate event structure
22
- */
23
- export function validate(event: IEvent) {
24
- if (typeof event !== 'object' || !event)
25
- throw new TypeError('event must be an Object');
26
- if (typeof event.type !== 'string' || !event.type.length)
27
- throw new TypeError('event.type must be a non-empty String');
28
- if (!event.aggregateId && !event.sagaId)
29
- throw new TypeError('either event.aggregateId or event.sagaId is required');
30
- if (event.sagaId && typeof event.sagaVersion === 'undefined')
31
- throw new TypeError('event.sagaVersion is required, when event.sagaId is defined');
32
- }
@@ -11,7 +11,7 @@ import {
11
11
  } from './interfaces';
12
12
  import { parallelPipe } from 'async-parallel-pipe';
13
13
  import { AsyncIterableBuffer } from 'async-iterable-buffer';
14
- import { getClassName, notEmpty } from './utils';
14
+ import { getClassName } from './utils';
15
15
  import { InMemoryMessageBus } from './in-memory';
16
16
 
17
17
  type EventBatchEnvelope = {
package/src/index.ts CHANGED
@@ -9,7 +9,6 @@ export * from './AbstractSaga';
9
9
  export * from './SagaEventHandler';
10
10
  export * from './AbstractProjection';
11
11
  export * from './EventDispatcher';
12
- export * from './EventValidationProcessor';
13
12
 
14
13
  export * from './in-memory';
15
14
 
@@ -4,7 +4,7 @@ import { IEventDispatcher } from './IEventDispatcher';
4
4
  import { IEventStore } from './IEventStore';
5
5
  import { IEventBus } from './IEventBus';
6
6
  import { IDispatchPipelineProcessor } from './IDispatchPipelineProcessor';
7
- import { IEventStorageReader, IEventStorageWriter } from './IEventStorage';
7
+ import { IEventStorageReader } from './IEventStorage';
8
8
  import { IAggregateSnapshotStorage } from './IAggregateSnapshotStorage';
9
9
  import { IIdentifierProvider } from './IIdentifierProvider';
10
10
  import { IExtendableLogger, ILogger } from './ILogger';
@@ -13,7 +13,6 @@ export interface IContainer extends Container {
13
13
  eventBus: IEventBus;
14
14
  eventStore: IEventStore
15
15
  eventStorageReader: IEventStorageReader;
16
- eventStorageWriter?: IEventStorageWriter;
17
16
  identifierProvider?: IIdentifierProvider;
18
17
  snapshotStorage?: IAggregateSnapshotStorage;
19
18
 
@@ -10,4 +10,5 @@ export type IEvent<TPayload = any> = IMessage<TPayload> & {
10
10
  export const isEvent = (event: unknown): event is IEvent =>
11
11
  isObject(event)
12
12
  && 'type' in event
13
- && typeof event.type === 'string';
13
+ && typeof event.type === 'string'
14
+ && event.type.length > 0;
package/types/Event.d.ts CHANGED
@@ -7,7 +7,3 @@ export declare function describe(event: IEvent): string;
7
7
  * Get text description of a set of events for logging purposes
8
8
  */
9
9
  export declare function describeMultiple(events: ReadonlyArray<IEvent>): string;
10
- /**
11
- * Validate event structure
12
- */
13
- export declare function validate(event: IEvent): void;
package/types/index.d.ts CHANGED
@@ -7,7 +7,6 @@ export * from './AbstractSaga';
7
7
  export * from './SagaEventHandler';
8
8
  export * from './AbstractProjection';
9
9
  export * from './EventDispatcher';
10
- export * from './EventValidationProcessor';
11
10
  export * from './in-memory';
12
11
  export * as Event from './Event';
13
12
  export { getMessageHandlerNames, subscribe } from './utils';
@@ -4,7 +4,7 @@ import { IEventDispatcher } from './IEventDispatcher';
4
4
  import { IEventStore } from './IEventStore';
5
5
  import { IEventBus } from './IEventBus';
6
6
  import { IDispatchPipelineProcessor } from './IDispatchPipelineProcessor';
7
- import { IEventStorageReader, IEventStorageWriter } from './IEventStorage';
7
+ import { IEventStorageReader } from './IEventStorage';
8
8
  import { IAggregateSnapshotStorage } from './IAggregateSnapshotStorage';
9
9
  import { IIdentifierProvider } from './IIdentifierProvider';
10
10
  import { IExtendableLogger, ILogger } from './ILogger';
@@ -12,7 +12,6 @@ export interface IContainer extends Container {
12
12
  eventBus: IEventBus;
13
13
  eventStore: IEventStore;
14
14
  eventStorageReader: IEventStorageReader;
15
- eventStorageWriter?: IEventStorageWriter;
16
15
  identifierProvider?: IIdentifierProvider;
17
16
  snapshotStorage?: IAggregateSnapshotStorage;
18
17
  commandBus: ICommandBus;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventValidationProcessor = void 0;
4
- const Event_1 = require("./Event");
5
- /**
6
- * Processor that validates the format of events.
7
- * Rejects the batch if any event fails validation.
8
- */
9
- class EventValidationProcessor {
10
- #validate;
11
- constructor(o) {
12
- this.#validate = o?.eventFormatValidator ?? Event_1.validate;
13
- }
14
- /**
15
- * Processes a batch of dispatch pipeline items by validating each event within the batch.
16
- * It iterates through the batch and calls the private `#validate` method for each event found.
17
- *
18
- * This method is part of the `IDispatchPipelineProcessor` interface.
19
- */
20
- async process(batch) {
21
- for (const { event } of batch) {
22
- if (event)
23
- this.#validate(event);
24
- }
25
- return batch;
26
- }
27
- }
28
- exports.EventValidationProcessor = EventValidationProcessor;
29
- //# sourceMappingURL=EventValidationProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EventValidationProcessor.js","sourceRoot":"","sources":["../src/EventValidationProcessor.ts"],"names":[],"mappings":";;;AACA,mCAAuD;AAIvD;;;GAGG;AACH,MAAa,wBAAwB;IAEpC,SAAS,CAAiB;IAE1B,YAAY,CAEX;QACA,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,oBAAoB,IAAI,gBAAgB,CAAC;IAC9D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,KAA4B;QACzC,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;YAC/B,IAAI,KAAK;gBACR,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAvBD,4DAuBC"}
@@ -1,33 +0,0 @@
1
- import { DispatchPipelineBatch, IEvent, IDispatchPipelineProcessor } from './interfaces';
2
- import { validate as defaultValidator } from './Event';
3
-
4
- export type EventValidator = (event: IEvent) => void;
5
-
6
- /**
7
- * Processor that validates the format of events.
8
- * Rejects the batch if any event fails validation.
9
- */
10
- export class EventValidationProcessor implements IDispatchPipelineProcessor {
11
-
12
- #validate: EventValidator;
13
-
14
- constructor(o?: {
15
- eventFormatValidator?: EventValidator
16
- }) {
17
- this.#validate = o?.eventFormatValidator ?? defaultValidator;
18
- }
19
-
20
- /**
21
- * Processes a batch of dispatch pipeline items by validating each event within the batch.
22
- * It iterates through the batch and calls the private `#validate` method for each event found.
23
- *
24
- * This method is part of the `IDispatchPipelineProcessor` interface.
25
- */
26
- async process(batch: DispatchPipelineBatch): Promise<DispatchPipelineBatch> {
27
- for (const { event } of batch) {
28
- if (event)
29
- this.#validate(event);
30
- }
31
- return batch;
32
- }
33
- }
@@ -1,19 +0,0 @@
1
- import { DispatchPipelineBatch, IEvent, IDispatchPipelineProcessor } from './interfaces';
2
- export type EventValidator = (event: IEvent) => void;
3
- /**
4
- * Processor that validates the format of events.
5
- * Rejects the batch if any event fails validation.
6
- */
7
- export declare class EventValidationProcessor implements IDispatchPipelineProcessor {
8
- #private;
9
- constructor(o?: {
10
- eventFormatValidator?: EventValidator;
11
- });
12
- /**
13
- * Processes a batch of dispatch pipeline items by validating each event within the batch.
14
- * It iterates through the batch and calls the private `#validate` method for each event found.
15
- *
16
- * This method is part of the `IDispatchPipelineProcessor` interface.
17
- */
18
- process(batch: DispatchPipelineBatch): Promise<DispatchPipelineBatch>;
19
- }