@event-driven-io/emmett 0.26.0 → 0.28.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/index.cjs CHANGED
@@ -276,11 +276,12 @@ var getInMemoryEventStore = (eventStoreOptions) => {
276
276
  const getAllEventsCount = () => {
277
277
  return Array.from(streams.values()).map((s) => s.length).reduce((p, c) => p + c, 0);
278
278
  };
279
+ const _inlineProjections = (_nullishCoalesce(_optionalChain([eventStoreOptions, 'optionalAccess', _13 => _13.projections]), () => ( []))).filter(({ type }) => type === "inline").map(({ projection: projection2 }) => projection2);
279
280
  return {
280
281
  async aggregateStream(streamName, options) {
281
282
  const { evolve, initialState, read } = options;
282
283
  const result = await this.readStream(streamName, read);
283
- const events = _nullishCoalesce(_optionalChain([result, 'optionalAccess', _13 => _13.events]), () => ( []));
284
+ const events = _nullishCoalesce(_optionalChain([result, 'optionalAccess', _14 => _14.events]), () => ( []));
284
285
  return {
285
286
  currentStreamVersion: BigInt(events.length),
286
287
  state: events.reduce(evolve, initialState()),
@@ -292,12 +293,12 @@ var getInMemoryEventStore = (eventStoreOptions) => {
292
293
  const currentStreamVersion = events ? BigInt(events.length) : InMemoryEventStoreDefaultStreamVersion;
293
294
  assertExpectedVersionMatchesCurrent(
294
295
  currentStreamVersion,
295
- _optionalChain([options, 'optionalAccess', _14 => _14.expectedStreamVersion]),
296
+ _optionalChain([options, 'optionalAccess', _15 => _15.expectedStreamVersion]),
296
297
  InMemoryEventStoreDefaultStreamVersion
297
298
  );
298
299
  const from = Number(options && "from" in options ? options.from : 0);
299
300
  const to = Number(
300
- options && "to" in options ? options.to : options && "maxCount" in options && options.maxCount ? options.from + options.maxCount : _nullishCoalesce(_optionalChain([events, 'optionalAccess', _15 => _15.length]), () => ( 1))
301
+ options && "to" in options ? options.to : options && "maxCount" in options && options.maxCount ? options.from + options.maxCount : _nullishCoalesce(_optionalChain([events, 'optionalAccess', _16 => _16.length]), () => ( 1))
301
302
  );
302
303
  const resultEvents = events !== void 0 && events.length > 0 ? events.map(
303
304
  (e) => e
@@ -314,7 +315,7 @@ var getInMemoryEventStore = (eventStoreOptions) => {
314
315
  const currentStreamVersion = currentEvents.length > 0 ? BigInt(currentEvents.length) : InMemoryEventStoreDefaultStreamVersion;
315
316
  assertExpectedVersionMatchesCurrent(
316
317
  currentStreamVersion,
317
- _optionalChain([options, 'optionalAccess', _16 => _16.expectedStreamVersion]),
318
+ _optionalChain([options, 'optionalAccess', _17 => _17.expectedStreamVersion]),
318
319
  InMemoryEventStoreDefaultStreamVersion
319
320
  );
320
321
  const newEvents = events.map((event2, index) => {
@@ -341,7 +342,10 @@ var getInMemoryEventStore = (eventStoreOptions) => {
341
342
  nextExpectedStreamVersion: positionOfLastEventInTheStream,
342
343
  createdNewStream: currentStreamVersion === InMemoryEventStoreDefaultStreamVersion
343
344
  };
344
- await tryPublishMessagesAfterCommit(newEvents, _optionalChain([eventStoreOptions, 'optionalAccess', _17 => _17.hooks]));
345
+ await tryPublishMessagesAfterCommit(
346
+ newEvents,
347
+ _optionalChain([eventStoreOptions, 'optionalAccess', _18 => _18.hooks])
348
+ );
345
349
  return result;
346
350
  }
347
351
  //streamEvents: streamingCoordinator.stream,
@@ -486,7 +490,7 @@ var TaskProcessor = (_class2 = class {
486
490
  while (this.activeTasks < this.options.maxActiveTasks && this.queue.length > 0) {
487
491
  const item = this.takeFirstAvailableItem();
488
492
  if (item === null) return;
489
- const groupId = _optionalChain([item, 'access', _22 => _22.options, 'optionalAccess', _23 => _23.taskGroupId]);
493
+ const groupId = _optionalChain([item, 'access', _23 => _23.options, 'optionalAccess', _24 => _24.taskGroupId]);
490
494
  if (groupId) {
491
495
  this.activeGroups.add(groupId);
492
496
  }
@@ -516,7 +520,7 @@ var TaskProcessor = (_class2 = class {
516
520
  }
517
521
  __init7() {this.takeFirstAvailableItem = () => {
518
522
  const taskIndex = this.queue.findIndex(
519
- (item2) => !_optionalChain([item2, 'access', _24 => _24.options, 'optionalAccess', _25 => _25.taskGroupId]) || !this.activeGroups.has(item2.options.taskGroupId)
523
+ (item2) => !_optionalChain([item2, 'access', _25 => _25.options, 'optionalAccess', _26 => _26.taskGroupId]) || !this.activeGroups.has(item2.options.taskGroupId)
520
524
  );
521
525
  if (taskIndex === -1) {
522
526
  return null;
@@ -525,7 +529,7 @@ var TaskProcessor = (_class2 = class {
525
529
  return _nullishCoalesce(item, () => ( null));
526
530
  }}
527
531
  __init8() {this.hasItemsToProcess = () => this.queue.findIndex(
528
- (item) => !_optionalChain([item, 'access', _26 => _26.options, 'optionalAccess', _27 => _27.taskGroupId]) || !this.activeGroups.has(item.options.taskGroupId)
532
+ (item) => !_optionalChain([item, 'access', _27 => _27.options, 'optionalAccess', _28 => _28.taskGroupId]) || !this.activeGroups.has(item.options.taskGroupId)
529
533
  ) !== -1}
530
534
  }, _class2);
531
535
  var DEFAULT_PROMISE_DEADLINE = 2147483647;
@@ -614,7 +618,7 @@ var asyncRetry = async (fn, opts) => {
614
618
  try {
615
619
  return await fn();
616
620
  } catch (error2) {
617
- if (_optionalChain([opts, 'optionalAccess', _28 => _28.shouldRetryError]) && !opts.shouldRetryError(error2)) {
621
+ if (_optionalChain([opts, 'optionalAccess', _29 => _29.shouldRetryError]) && !opts.shouldRetryError(error2)) {
618
622
  bail(error2);
619
623
  }
620
624
  throw error2;
@@ -657,7 +661,7 @@ var CommandHandler = (options) => async (store, id, handle, handleOptions) => as
657
661
  read: {
658
662
  // expected stream version is passed to fail fast
659
663
  // if stream is in the wrong state
660
- expectedStreamVersion: _nullishCoalesce(_optionalChain([handleOptions, 'optionalAccess', _29 => _29.expectedStreamVersion]), () => ( NO_CONCURRENCY_CHECK))
664
+ expectedStreamVersion: _nullishCoalesce(_optionalChain([handleOptions, 'optionalAccess', _30 => _30.expectedStreamVersion]), () => ( NO_CONCURRENCY_CHECK))
661
665
  }
662
666
  });
663
667
  const {
@@ -679,7 +683,7 @@ var CommandHandler = (options) => async (store, id, handle, handleOptions) => as
679
683
  createdNewStream: false
680
684
  };
681
685
  }
682
- const expectedStreamVersion = _nullishCoalesce(_optionalChain([handleOptions, 'optionalAccess', _30 => _30.expectedStreamVersion]), () => ( (aggregationResult.streamExists ? currentStreamVersion : STREAM_DOES_NOT_EXIST)));
686
+ const expectedStreamVersion = _nullishCoalesce(_optionalChain([handleOptions, 'optionalAccess', _31 => _31.expectedStreamVersion]), () => ( (aggregationResult.streamExists ? currentStreamVersion : STREAM_DOES_NOT_EXIST)));
683
687
  const appendResult = await eventStore.appendToStream(
684
688
  streamName,
685
689
  newEvents,
@@ -716,6 +720,55 @@ var DeciderCommandHandler = (options) => async (eventStore, id, command2, handle
716
720
  );
717
721
  };
718
722
 
723
+ // src/serialization/json/JSONParser.ts
724
+ var ParseError = class extends Error {
725
+ constructor(text) {
726
+ super(`Cannot parse! ${text}`);
727
+ }
728
+ };
729
+ var JSONParser = {
730
+ stringify: (value, options) => {
731
+ return JSON.stringify(
732
+ _optionalChain([options, 'optionalAccess', _32 => _32.map]) ? options.map(value) : value,
733
+ //TODO: Consider adding support to DateTime and adding specific format to mark that's a bigint
734
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
735
+ (_, v) => typeof v === "bigint" ? v.toString() : v
736
+ );
737
+ },
738
+ parse: (text, options) => {
739
+ const parsed = JSON.parse(text, _optionalChain([options, 'optionalAccess', _33 => _33.reviver]));
740
+ if (_optionalChain([options, 'optionalAccess', _34 => _34.typeCheck]) && !_optionalChain([options, 'optionalAccess', _35 => _35.typeCheck, 'call', _36 => _36(parsed)]))
741
+ throw new ParseError(text);
742
+ return _optionalChain([options, 'optionalAccess', _37 => _37.map]) ? options.map(parsed) : parsed;
743
+ }
744
+ };
745
+
746
+ // src/database/inMemoryDatabase.ts
747
+ var getInMemoryDatabase = () => {
748
+ const storage = /* @__PURE__ */ new Map();
749
+ return {
750
+ collection: (collectionName, _collectionOptions = {}) => {
751
+ const toFullId = (id) => `${collectionName}-${id}`;
752
+ const collection = {
753
+ store: (id, obj) => {
754
+ storage.set(toFullId(id), obj);
755
+ },
756
+ delete: (id) => {
757
+ storage.delete(toFullId(id));
758
+ },
759
+ get: (id) => {
760
+ const result = storage.get(toFullId(id));
761
+ return result ? (
762
+ // Clone to simulate getting new instance on loading
763
+ JSONParser.parse(JSONParser.stringify(result))
764
+ ) : null;
765
+ }
766
+ };
767
+ return collection;
768
+ }
769
+ };
770
+ };
771
+
719
772
  // src/messageBus/index.ts
720
773
  var getInMemoryMessageBus = () => {
721
774
  const allHandlers = /* @__PURE__ */ new Map();
@@ -769,29 +822,6 @@ var getInMemoryMessageBus = () => {
769
822
  };
770
823
  };
771
824
 
772
- // src/serialization/json/JSONParser.ts
773
- var ParseError = class extends Error {
774
- constructor(text) {
775
- super(`Cannot parse! ${text}`);
776
- }
777
- };
778
- var JSONParser = {
779
- stringify: (value, options) => {
780
- return JSON.stringify(
781
- _optionalChain([options, 'optionalAccess', _31 => _31.map]) ? options.map(value) : value,
782
- //TODO: Consider adding support to DateTime and adding specific format to mark that's a bigint
783
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
784
- (_, v) => typeof v === "bigint" ? v.toString() : v
785
- );
786
- },
787
- parse: (text, options) => {
788
- const parsed = JSON.parse(text, _optionalChain([options, 'optionalAccess', _32 => _32.reviver]));
789
- if (_optionalChain([options, 'optionalAccess', _33 => _33.typeCheck]) && !_optionalChain([options, 'optionalAccess', _34 => _34.typeCheck, 'call', _35 => _35(parsed)]))
790
- throw new ParseError(text);
791
- return _optionalChain([options, 'optionalAccess', _36 => _36.map]) ? options.map(parsed) : parsed;
792
- }
793
- };
794
-
795
825
  // src/projections/index.ts
796
826
  var filterProjections = (type, projections2) => {
797
827
  const inlineProjections2 = projections2.filter((projection2) => projection2.type === type).map(({ projection: projection2 }) => projection2);
@@ -938,7 +968,7 @@ var CompositeDecoder = class {
938
968
  return decoder[1];
939
969
  }
940
970
  addToBuffer(data) {
941
- _optionalChain([this, 'access', _37 => _37.decoderFor, 'call', _38 => _38(data), 'optionalAccess', _39 => _39.addToBuffer, 'call', _40 => _40(data)]);
971
+ _optionalChain([this, 'access', _38 => _38.decoderFor, 'call', _39 => _39(data), 'optionalAccess', _40 => _40.addToBuffer, 'call', _41 => _41(data)]);
942
972
  }
943
973
  clearBuffer() {
944
974
  for (const decoder of this.decoders.map((d) => d[1])) {
@@ -950,7 +980,7 @@ var CompositeDecoder = class {
950
980
  }
951
981
  decode() {
952
982
  const decoder = this.decoders.map((d) => d[1]).find((d) => d.hasCompleteMessage());
953
- return _nullishCoalesce(_optionalChain([decoder, 'optionalAccess', _41 => _41.decode, 'call', _42 => _42()]), () => ( null));
983
+ return _nullishCoalesce(_optionalChain([decoder, 'optionalAccess', _42 => _42.decode, 'call', _43 => _43()]), () => ( null));
954
984
  }
955
985
  };
956
986
  var DefaultDecoder = class extends CompositeDecoder {
@@ -1165,7 +1195,7 @@ var decodeAndTransform = (decoder, transform, controller) => {
1165
1195
  const transformed = transform(decoded);
1166
1196
  controller.enqueue(transformed);
1167
1197
  } catch (error2) {
1168
- controller.error(new Error(`Decoding error: ${_optionalChain([error2, 'optionalAccess', _43 => _43.toString, 'call', _44 => _44()])}`));
1198
+ controller.error(new Error(`Decoding error: ${_optionalChain([error2, 'optionalAccess', _44 => _44.toString, 'call', _45 => _45()])}`));
1169
1199
  }
1170
1200
  };
1171
1201
 
@@ -1326,39 +1356,39 @@ var argMatches = (matches) => (arg) => matches(arg);
1326
1356
  function verifyThat(fn) {
1327
1357
  return {
1328
1358
  calledTimes: (times) => {
1329
- assertEqual(_optionalChain([fn, 'access', _45 => _45.mock, 'optionalAccess', _46 => _46.calls, 'optionalAccess', _47 => _47.length]), times);
1359
+ assertEqual(_optionalChain([fn, 'access', _46 => _46.mock, 'optionalAccess', _47 => _47.calls, 'optionalAccess', _48 => _48.length]), times);
1330
1360
  },
1331
1361
  notCalled: () => {
1332
- assertEqual(_optionalChain([fn, 'optionalAccess', _48 => _48.mock, 'optionalAccess', _49 => _49.calls, 'optionalAccess', _50 => _50.length]), 0);
1362
+ assertEqual(_optionalChain([fn, 'optionalAccess', _49 => _49.mock, 'optionalAccess', _50 => _50.calls, 'optionalAccess', _51 => _51.length]), 0);
1333
1363
  },
1334
1364
  called: () => {
1335
1365
  assertTrue(
1336
- _optionalChain([fn, 'access', _51 => _51.mock, 'optionalAccess', _52 => _52.calls, 'access', _53 => _53.length]) !== void 0 && fn.mock.calls.length > 0
1366
+ _optionalChain([fn, 'access', _52 => _52.mock, 'optionalAccess', _53 => _53.calls, 'access', _54 => _54.length]) !== void 0 && fn.mock.calls.length > 0
1337
1367
  );
1338
1368
  },
1339
1369
  calledWith: (...args) => {
1340
1370
  assertTrue(
1341
- _optionalChain([fn, 'access', _54 => _54.mock, 'optionalAccess', _55 => _55.calls, 'access', _56 => _56.length]) !== void 0 && fn.mock.calls.length >= 1 && fn.mock.calls.some((call) => deepEquals(call.arguments, args))
1371
+ _optionalChain([fn, 'access', _55 => _55.mock, 'optionalAccess', _56 => _56.calls, 'access', _57 => _57.length]) !== void 0 && fn.mock.calls.length >= 1 && fn.mock.calls.some((call) => deepEquals(call.arguments, args))
1342
1372
  );
1343
1373
  },
1344
1374
  calledOnceWith: (...args) => {
1345
1375
  assertTrue(
1346
- _optionalChain([fn, 'access', _57 => _57.mock, 'optionalAccess', _58 => _58.calls, 'access', _59 => _59.length]) !== void 0 && fn.mock.calls.length === 1 && fn.mock.calls.some((call) => deepEquals(call.arguments, args))
1376
+ _optionalChain([fn, 'access', _58 => _58.mock, 'optionalAccess', _59 => _59.calls, 'access', _60 => _60.length]) !== void 0 && fn.mock.calls.length === 1 && fn.mock.calls.some((call) => deepEquals(call.arguments, args))
1347
1377
  );
1348
1378
  },
1349
1379
  calledWithArgumentMatching: (...matches) => {
1350
1380
  assertTrue(
1351
- _optionalChain([fn, 'access', _60 => _60.mock, 'optionalAccess', _61 => _61.calls, 'access', _62 => _62.length]) !== void 0 && fn.mock.calls.length >= 1
1381
+ _optionalChain([fn, 'access', _61 => _61.mock, 'optionalAccess', _62 => _62.calls, 'access', _63 => _63.length]) !== void 0 && fn.mock.calls.length >= 1
1352
1382
  );
1353
1383
  assertTrue(
1354
- _optionalChain([fn, 'access', _63 => _63.mock, 'optionalAccess', _64 => _64.calls, 'access', _65 => _65.length]) !== void 0 && fn.mock.calls.length >= 1 && fn.mock.calls.some(
1384
+ _optionalChain([fn, 'access', _64 => _64.mock, 'optionalAccess', _65 => _65.calls, 'access', _66 => _66.length]) !== void 0 && fn.mock.calls.length >= 1 && fn.mock.calls.some(
1355
1385
  (call) => call.arguments && call.arguments.length >= matches.length && matches.every((match, index) => match(call.arguments[index]))
1356
1386
  )
1357
1387
  );
1358
1388
  },
1359
1389
  notCalledWithArgumentMatching: (...matches) => {
1360
1390
  assertFalse(
1361
- _optionalChain([fn, 'access', _66 => _66.mock, 'optionalAccess', _67 => _67.calls, 'access', _68 => _68.length]) !== void 0 && fn.mock.calls.length >= 1 && fn.mock.calls[0].arguments && fn.mock.calls[0].arguments.length >= matches.length && matches.every(
1391
+ _optionalChain([fn, 'access', _67 => _67.mock, 'optionalAccess', _68 => _68.calls, 'access', _69 => _69.length]) !== void 0 && fn.mock.calls.length >= 1 && fn.mock.calls[0].arguments && fn.mock.calls[0].arguments.length >= matches.length && matches.every(
1362
1392
  (match, index) => match(fn.mock.calls[0].arguments[index])
1363
1393
  )
1364
1394
  );
@@ -1429,66 +1459,95 @@ var assertThatArray = (array) => {
1429
1459
 
1430
1460
  // src/testing/deciderSpecification.ts
1431
1461
  var DeciderSpecification = {
1432
- for: (decider) => {
1433
- {
1434
- return (givenEvents) => {
1435
- return {
1436
- when: (command2) => {
1437
- const handle = () => {
1438
- const existingEvents = Array.isArray(givenEvents) ? givenEvents : [givenEvents];
1439
- const currentState = existingEvents.reduce(
1440
- decider.evolve,
1441
- decider.initialState()
1442
- );
1443
- return decider.decide(command2, currentState);
1444
- };
1445
- return {
1446
- then: (expectedEvents) => {
1447
- const resultEvents = handle();
1448
- const resultEventsArray = Array.isArray(resultEvents) ? resultEvents : [resultEvents];
1449
- const expectedEventsArray = Array.isArray(expectedEvents) ? expectedEvents : [expectedEvents];
1450
- assertThatArray(resultEventsArray).containsOnlyElementsMatching(
1451
- expectedEventsArray
1452
- );
1453
- },
1454
- thenNothingHappened: () => {
1455
- const resultEvents = handle();
1456
- const resultEventsArray = Array.isArray(resultEvents) ? resultEvents : [resultEvents];
1457
- assertThatArray(resultEventsArray).isEmpty();
1458
- },
1459
- thenThrows: (...args) => {
1460
- try {
1461
- handle();
1462
- throw new AssertionError("Handler did not fail as expected");
1463
- } catch (error2) {
1464
- if (error2 instanceof AssertionError) throw error2;
1465
- if (args.length === 0) return;
1466
- if (!_chunkWM5VB4U5cjs.isErrorConstructor.call(void 0, args[0])) {
1467
- assertTrue(
1468
- args[0](error2),
1469
- `Error didn't match the error condition: ${_optionalChain([error2, 'optionalAccess', _69 => _69.toString, 'call', _70 => _70()])}`
1470
- );
1471
- return;
1472
- }
1473
- assertTrue(
1474
- error2 instanceof args[0],
1475
- `Caught error is not an instance of the expected type: ${_optionalChain([error2, 'optionalAccess', _71 => _71.toString, 'call', _72 => _72()])}`
1476
- );
1477
- if (args[1]) {
1478
- assertTrue(
1479
- args[1](error2),
1480
- `Error didn't match the error condition: ${_optionalChain([error2, 'optionalAccess', _73 => _73.toString, 'call', _74 => _74()])}`
1462
+ for: deciderSpecificationFor
1463
+ };
1464
+ function deciderSpecificationFor(decider) {
1465
+ {
1466
+ return (givenEvents) => {
1467
+ return {
1468
+ when: (command2) => {
1469
+ const handle = () => {
1470
+ const existingEvents = Array.isArray(givenEvents) ? givenEvents : [givenEvents];
1471
+ const currentState = existingEvents.reduce(
1472
+ decider.evolve,
1473
+ decider.initialState()
1474
+ );
1475
+ return decider.decide(command2, currentState);
1476
+ };
1477
+ return {
1478
+ then: (expectedEvents) => {
1479
+ const resultEvents = handle();
1480
+ if (resultEvents instanceof Promise) {
1481
+ return resultEvents.then((events) => {
1482
+ thenHandler(events, expectedEvents);
1483
+ });
1484
+ }
1485
+ thenHandler(resultEvents, expectedEvents);
1486
+ },
1487
+ thenNothingHappened: () => {
1488
+ const resultEvents = handle();
1489
+ if (resultEvents instanceof Promise) {
1490
+ return resultEvents.then((events) => {
1491
+ thenNothingHappensHandler(events);
1492
+ });
1493
+ }
1494
+ thenNothingHappensHandler(resultEvents);
1495
+ },
1496
+ thenThrows: (...args) => {
1497
+ try {
1498
+ const result = handle();
1499
+ if (result instanceof Promise) {
1500
+ return result.then(() => {
1501
+ throw new AssertionError(
1502
+ "Handler did not fail as expected"
1481
1503
  );
1482
- }
1504
+ }).catch((error2) => {
1505
+ thenThrowsErrorHandler(error2, args);
1506
+ });
1483
1507
  }
1508
+ throw new AssertionError("Handler did not fail as expected");
1509
+ } catch (error2) {
1510
+ thenThrowsErrorHandler(error2, args);
1484
1511
  }
1485
- };
1486
- }
1487
- };
1512
+ }
1513
+ };
1514
+ }
1488
1515
  };
1489
- }
1516
+ };
1490
1517
  }
1491
- };
1518
+ }
1519
+ function thenHandler(events, expectedEvents) {
1520
+ const resultEventsArray = Array.isArray(events) ? events : [events];
1521
+ const expectedEventsArray = Array.isArray(expectedEvents) ? expectedEvents : [expectedEvents];
1522
+ assertThatArray(resultEventsArray).containsOnlyElementsMatching(
1523
+ expectedEventsArray
1524
+ );
1525
+ }
1526
+ function thenNothingHappensHandler(events) {
1527
+ const resultEventsArray = Array.isArray(events) ? events : [events];
1528
+ assertThatArray(resultEventsArray).isEmpty();
1529
+ }
1530
+ function thenThrowsErrorHandler(error2, args) {
1531
+ if (error2 instanceof AssertionError) throw error2;
1532
+ if (args.length === 0) return;
1533
+ if (!_chunkWM5VB4U5cjs.isErrorConstructor.call(void 0, args[0])) {
1534
+ assertTrue(
1535
+ args[0](error2),
1536
+ `Error didn't match the error condition: ${_optionalChain([error2, 'optionalAccess', _70 => _70.toString, 'call', _71 => _71()])}`
1537
+ );
1538
+ return;
1539
+ }
1540
+ assertTrue(
1541
+ error2 instanceof args[0],
1542
+ `Caught error is not an instance of the expected type: ${_optionalChain([error2, 'optionalAccess', _72 => _72.toString, 'call', _73 => _73()])}`
1543
+ );
1544
+ if (args[1]) {
1545
+ assertTrue(
1546
+ args[1](error2),
1547
+ `Error didn't match the error condition: ${_optionalChain([error2, 'optionalAccess', _74 => _74.toString, 'call', _75 => _75()])}`
1548
+ );
1549
+ }
1550
+ }
1492
1551
 
1493
1552
  // src/testing/wrapEventStore.ts
1494
1553
  var WrapEventStore = (eventStore) => {
@@ -1634,5 +1693,6 @@ var WrapEventStore = (eventStore) => {
1634
1693
 
1635
1694
 
1636
1695
 
1637
- exports.AssertionError = AssertionError; exports.BinaryJsonDecoder = BinaryJsonDecoder; exports.CaughtUpTransformStream = CaughtUpTransformStream; exports.CommandHandler = CommandHandler; exports.CommandHandlerStreamVersionConflictRetryOptions = CommandHandlerStreamVersionConflictRetryOptions; exports.CompositeDecoder = CompositeDecoder; exports.ConcurrencyError = _chunkWM5VB4U5cjs.ConcurrencyError; exports.DeciderCommandHandler = DeciderCommandHandler; exports.DeciderSpecification = DeciderSpecification; exports.DefaultDecoder = DefaultDecoder; exports.EmmettError = _chunkWM5VB4U5cjs.EmmettError; exports.ExpectedVersionConflictError = ExpectedVersionConflictError; exports.GlobalStreamCaughtUpType = GlobalStreamCaughtUpType; exports.IllegalStateError = _chunkWM5VB4U5cjs.IllegalStateError; exports.InMemoryEventStoreDefaultStreamVersion = InMemoryEventStoreDefaultStreamVersion; exports.InProcessLock = InProcessLock; exports.JSONParser = JSONParser; exports.JsonDecoder = JsonDecoder; exports.NO_CONCURRENCY_CHECK = NO_CONCURRENCY_CHECK; exports.NoRetries = NoRetries; exports.NotFoundError = _chunkWM5VB4U5cjs.NotFoundError; exports.ObjectDecoder = ObjectDecoder; exports.ParseError = ParseError; exports.STREAM_DOES_NOT_EXIST = STREAM_DOES_NOT_EXIST; exports.STREAM_EXISTS = STREAM_EXISTS; exports.StreamingCoordinator = StreamingCoordinator; exports.StringDecoder = StringDecoder; exports.TaskProcessor = TaskProcessor; exports.ValidationError = _chunkWM5VB4U5cjs.ValidationError; exports.ValidationErrors = _chunkWM5VB4U5cjs.ValidationErrors; exports.WrapEventStore = WrapEventStore; exports.accept = accept; exports.argMatches = argMatches; exports.argValue = argValue; exports.arrayUtils = arrayUtils; exports.assertDeepEqual = assertDeepEqual; exports.assertDoesNotThrow = assertDoesNotThrow; exports.assertEqual = assertEqual; exports.assertExpectedVersionMatchesCurrent = assertExpectedVersionMatchesCurrent; exports.assertFails = assertFails; exports.assertFalse = assertFalse; exports.assertIsNotNull = assertIsNotNull; exports.assertIsNull = assertIsNull; exports.assertMatches = assertMatches; exports.assertNotDeepEqual = assertNotDeepEqual; exports.assertNotEmptyString = _chunkWM5VB4U5cjs.assertNotEmptyString; exports.assertNotEqual = assertNotEqual; exports.assertOk = assertOk; exports.assertPositiveNumber = _chunkWM5VB4U5cjs.assertPositiveNumber; exports.assertRejects = assertRejects; exports.assertThat = assertThat; exports.assertThatArray = assertThatArray; exports.assertThrows = assertThrows; exports.assertThrowsAsync = assertThrowsAsync; exports.assertTrue = assertTrue; exports.assertUnsignedBigInt = _chunkWM5VB4U5cjs.assertUnsignedBigInt; exports.asyncProjections = asyncProjections; exports.asyncRetry = asyncRetry; exports.canCreateEventStoreSession = canCreateEventStoreSession; exports.caughtUpEventFrom = caughtUpEventFrom; exports.collect = collect; exports.command = command; exports.complete = complete; exports.concatUint8Arrays = concatUint8Arrays; exports.deepEquals = deepEquals; exports.error = error; exports.event = event; exports.filterProjections = filterProjections; exports.formatDateToUtcYYYYMMDD = _chunkWM5VB4U5cjs.formatDateToUtcYYYYMMDD; exports.forwardToMessageBus = forwardToMessageBus; exports.getInMemoryEventStore = getInMemoryEventStore; exports.getInMemoryMessageBus = getInMemoryMessageBus; exports.globalStreamCaughtUp = globalStreamCaughtUp; exports.ignore = ignore; exports.inlineProjections = inlineProjections; exports.isEquatable = isEquatable; exports.isErrorConstructor = _chunkWM5VB4U5cjs.isErrorConstructor; exports.isExpectedVersionConflictError = isExpectedVersionConflictError; exports.isGlobalStreamCaughtUp = isGlobalStreamCaughtUp; exports.isNotInternalEvent = isNotInternalEvent; exports.isNumber = _chunkWM5VB4U5cjs.isNumber; exports.isPluginConfig = _chunkWM5VB4U5cjs.isPluginConfig; exports.isString = _chunkWM5VB4U5cjs.isString; exports.isSubscriptionEvent = isSubscriptionEvent; exports.isSubset = isSubset; exports.isValidYYYYMMDD = _chunkWM5VB4U5cjs.isValidYYYYMMDD; exports.matchesExpectedVersion = matchesExpectedVersion; exports.merge = merge; exports.nulloSessionFactory = nulloSessionFactory; exports.parseDateFromUtcYYYYMMDD = _chunkWM5VB4U5cjs.parseDateFromUtcYYYYMMDD; exports.projection = projection; exports.projections = projections; exports.publish = publish; exports.reply = reply; exports.restream = restream; exports.schedule = schedule; exports.send = send; exports.streamGenerators = streamGenerators; exports.streamTrackingGlobalPosition = streamTrackingGlobalPosition; exports.streamTransformations = streamTransformations; exports.sum = sum; exports.tryPublishMessagesAfterCommit = tryPublishMessagesAfterCommit; exports.verifyThat = verifyThat;
1696
+
1697
+ exports.AssertionError = AssertionError; exports.BinaryJsonDecoder = BinaryJsonDecoder; exports.CaughtUpTransformStream = CaughtUpTransformStream; exports.CommandHandler = CommandHandler; exports.CommandHandlerStreamVersionConflictRetryOptions = CommandHandlerStreamVersionConflictRetryOptions; exports.CompositeDecoder = CompositeDecoder; exports.ConcurrencyError = _chunkWM5VB4U5cjs.ConcurrencyError; exports.DeciderCommandHandler = DeciderCommandHandler; exports.DeciderSpecification = DeciderSpecification; exports.DefaultDecoder = DefaultDecoder; exports.EmmettError = _chunkWM5VB4U5cjs.EmmettError; exports.ExpectedVersionConflictError = ExpectedVersionConflictError; exports.GlobalStreamCaughtUpType = GlobalStreamCaughtUpType; exports.IllegalStateError = _chunkWM5VB4U5cjs.IllegalStateError; exports.InMemoryEventStoreDefaultStreamVersion = InMemoryEventStoreDefaultStreamVersion; exports.InProcessLock = InProcessLock; exports.JSONParser = JSONParser; exports.JsonDecoder = JsonDecoder; exports.NO_CONCURRENCY_CHECK = NO_CONCURRENCY_CHECK; exports.NoRetries = NoRetries; exports.NotFoundError = _chunkWM5VB4U5cjs.NotFoundError; exports.ObjectDecoder = ObjectDecoder; exports.ParseError = ParseError; exports.STREAM_DOES_NOT_EXIST = STREAM_DOES_NOT_EXIST; exports.STREAM_EXISTS = STREAM_EXISTS; exports.StreamingCoordinator = StreamingCoordinator; exports.StringDecoder = StringDecoder; exports.TaskProcessor = TaskProcessor; exports.ValidationError = _chunkWM5VB4U5cjs.ValidationError; exports.ValidationErrors = _chunkWM5VB4U5cjs.ValidationErrors; exports.WrapEventStore = WrapEventStore; exports.accept = accept; exports.argMatches = argMatches; exports.argValue = argValue; exports.arrayUtils = arrayUtils; exports.assertDeepEqual = assertDeepEqual; exports.assertDoesNotThrow = assertDoesNotThrow; exports.assertEqual = assertEqual; exports.assertExpectedVersionMatchesCurrent = assertExpectedVersionMatchesCurrent; exports.assertFails = assertFails; exports.assertFalse = assertFalse; exports.assertIsNotNull = assertIsNotNull; exports.assertIsNull = assertIsNull; exports.assertMatches = assertMatches; exports.assertNotDeepEqual = assertNotDeepEqual; exports.assertNotEmptyString = _chunkWM5VB4U5cjs.assertNotEmptyString; exports.assertNotEqual = assertNotEqual; exports.assertOk = assertOk; exports.assertPositiveNumber = _chunkWM5VB4U5cjs.assertPositiveNumber; exports.assertRejects = assertRejects; exports.assertThat = assertThat; exports.assertThatArray = assertThatArray; exports.assertThrows = assertThrows; exports.assertThrowsAsync = assertThrowsAsync; exports.assertTrue = assertTrue; exports.assertUnsignedBigInt = _chunkWM5VB4U5cjs.assertUnsignedBigInt; exports.asyncProjections = asyncProjections; exports.asyncRetry = asyncRetry; exports.canCreateEventStoreSession = canCreateEventStoreSession; exports.caughtUpEventFrom = caughtUpEventFrom; exports.collect = collect; exports.command = command; exports.complete = complete; exports.concatUint8Arrays = concatUint8Arrays; exports.deepEquals = deepEquals; exports.error = error; exports.event = event; exports.filterProjections = filterProjections; exports.formatDateToUtcYYYYMMDD = _chunkWM5VB4U5cjs.formatDateToUtcYYYYMMDD; exports.forwardToMessageBus = forwardToMessageBus; exports.getInMemoryDatabase = getInMemoryDatabase; exports.getInMemoryEventStore = getInMemoryEventStore; exports.getInMemoryMessageBus = getInMemoryMessageBus; exports.globalStreamCaughtUp = globalStreamCaughtUp; exports.ignore = ignore; exports.inlineProjections = inlineProjections; exports.isEquatable = isEquatable; exports.isErrorConstructor = _chunkWM5VB4U5cjs.isErrorConstructor; exports.isExpectedVersionConflictError = isExpectedVersionConflictError; exports.isGlobalStreamCaughtUp = isGlobalStreamCaughtUp; exports.isNotInternalEvent = isNotInternalEvent; exports.isNumber = _chunkWM5VB4U5cjs.isNumber; exports.isPluginConfig = _chunkWM5VB4U5cjs.isPluginConfig; exports.isString = _chunkWM5VB4U5cjs.isString; exports.isSubscriptionEvent = isSubscriptionEvent; exports.isSubset = isSubset; exports.isValidYYYYMMDD = _chunkWM5VB4U5cjs.isValidYYYYMMDD; exports.matchesExpectedVersion = matchesExpectedVersion; exports.merge = merge; exports.nulloSessionFactory = nulloSessionFactory; exports.parseDateFromUtcYYYYMMDD = _chunkWM5VB4U5cjs.parseDateFromUtcYYYYMMDD; exports.projection = projection; exports.projections = projections; exports.publish = publish; exports.reply = reply; exports.restream = restream; exports.schedule = schedule; exports.send = send; exports.streamGenerators = streamGenerators; exports.streamTrackingGlobalPosition = streamTrackingGlobalPosition; exports.streamTransformations = streamTransformations; exports.sum = sum; exports.tryPublishMessagesAfterCommit = tryPublishMessagesAfterCommit; exports.verifyThat = verifyThat;
1638
1698
  //# sourceMappingURL=index.cjs.map