@event-driven-io/emmett-esdb 0.38.7 → 0.39.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
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;// ../emmett/dist/chunk-O2VMBOV4.js
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// ../emmett/dist/chunk-O2VMBOV4.js
2
2
  var isNumber = (val) => typeof val === "number" && val === val;
3
3
  var isBigint = (val) => typeof val === "bigint" && val === val;
4
4
  var isString = (val) => typeof val === "string";
@@ -47,23 +47,6 @@ var _uuid = require('uuid');
47
47
 
48
48
  var _asyncretry = require('async-retry'); var _asyncretry2 = _interopRequireDefault(_asyncretry);
49
49
 
50
- var _webstreamspolyfill = require('web-streams-polyfill');
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
50
  var STREAM_EXISTS = "STREAM_EXISTS";
68
51
  var STREAM_DOES_NOT_EXIST = "STREAM_DOES_NOT_EXIST";
69
52
  var NO_CONCURRENCY_CHECK = "NO_CONCURRENCY_CHECK";
@@ -576,44 +559,6 @@ var getInMemoryDatabase = () => {
576
559
  }
577
560
  };
578
561
  };
579
- var notifyAboutNoActiveReadersStream = (onNoActiveReaderCallback, options = {}) => new NotifyAboutNoActiveReadersStream(onNoActiveReaderCallback, options);
580
- var NotifyAboutNoActiveReadersStream = (_class = class extends _webstreamspolyfill.TransformStream {
581
- constructor(onNoActiveReaderCallback, options = {}) {
582
- super({
583
- cancel: (reason) => {
584
- console.log("Stream was canceled. Reason:", reason);
585
- this.stopChecking();
586
- }
587
- });_class.prototype.__init.call(this);_class.prototype.__init2.call(this);;
588
- this.onNoActiveReaderCallback = onNoActiveReaderCallback;
589
- this.streamId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _24 => _24.streamId]), () => ( _uuid.v4.call(void 0, )));
590
- this.onNoActiveReaderCallback = onNoActiveReaderCallback;
591
- this.startChecking(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _25 => _25.intervalCheckInMs]), () => ( 20)));
592
- }
593
- __init() {this.checkInterval = null}
594
-
595
- __init2() {this._isStopped = false}
596
- get hasActiveSubscribers() {
597
- return !this._isStopped;
598
- }
599
- startChecking(interval) {
600
- this.checkInterval = setInterval(() => {
601
- this.checkNoActiveReader();
602
- }, interval);
603
- }
604
- stopChecking() {
605
- if (!this.checkInterval) return;
606
- clearInterval(this.checkInterval);
607
- this.checkInterval = null;
608
- this._isStopped = true;
609
- this.onNoActiveReaderCallback(this);
610
- }
611
- checkNoActiveReader() {
612
- if (!this.readable.locked && !this._isStopped) {
613
- this.stopChecking();
614
- }
615
- }
616
- }, _class);
617
562
  var getCheckpoint = (message2) => {
618
563
  return "checkpoint" in message2.metadata && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
619
564
  isBigint(message2.metadata.checkpoint) ? (
@@ -648,7 +593,7 @@ var reactor = (options) => {
648
593
  return {
649
594
  id: options.processorId,
650
595
  type: _nullishCoalesce(options.type, () => ( MessageProcessorType.REACTOR)),
651
- close: () => _optionalChain([options, 'access', _26 => _26.hooks, 'optionalAccess', _27 => _27.onClose]) ? _optionalChain([options, 'access', _28 => _28.hooks, 'optionalAccess', _29 => _29.onClose, 'call', _30 => _30()]) : Promise.resolve(),
596
+ close: () => _optionalChain([options, 'access', _24 => _24.hooks, 'optionalAccess', _25 => _25.onClose]) ? _optionalChain([options, 'access', _26 => _26.hooks, 'optionalAccess', _27 => _27.onClose, 'call', _28 => _28()]) : Promise.resolve(),
652
597
  start: async (startOptions) => {
653
598
  isActive = true;
654
599
  if (lastCheckpoint !== null)
@@ -656,13 +601,13 @@ var reactor = (options) => {
656
601
  lastCheckpoint
657
602
  };
658
603
  return await processingScope(async (context) => {
659
- if (_optionalChain([options, 'access', _31 => _31.hooks, 'optionalAccess', _32 => _32.onStart])) {
660
- await _optionalChain([options, 'access', _33 => _33.hooks, 'optionalAccess', _34 => _34.onStart, 'call', _35 => _35(context)]);
604
+ if (_optionalChain([options, 'access', _29 => _29.hooks, 'optionalAccess', _30 => _30.onStart])) {
605
+ await _optionalChain([options, 'access', _31 => _31.hooks, 'optionalAccess', _32 => _32.onStart, 'call', _33 => _33(context)]);
661
606
  }
662
607
  if (options.startFrom !== "CURRENT" && options.startFrom)
663
608
  return options.startFrom;
664
609
  if (checkpoints) {
665
- const readResult = await _optionalChain([checkpoints, 'optionalAccess', _36 => _36.read, 'call', _37 => _37(
610
+ const readResult = await _optionalChain([checkpoints, 'optionalAccess', _34 => _34.read, 'call', _35 => _35(
666
611
  {
667
612
  processorId,
668
613
  partition
@@ -727,12 +672,12 @@ var projector = (options) => {
727
672
  type: MessageProcessorType.PROJECTOR,
728
673
  processorId: _nullishCoalesce(options.processorId, () => ( `projection:${projection2.name}`)),
729
674
  hooks: {
730
- onStart: options.truncateOnStart && options.projection.truncate || _optionalChain([options, 'access', _38 => _38.hooks, 'optionalAccess', _39 => _39.onStart]) ? async (context) => {
675
+ onStart: options.truncateOnStart && options.projection.truncate || _optionalChain([options, 'access', _36 => _36.hooks, 'optionalAccess', _37 => _37.onStart]) ? async (context) => {
731
676
  if (options.truncateOnStart && options.projection.truncate)
732
677
  await options.projection.truncate(context);
733
- if (_optionalChain([options, 'access', _40 => _40.hooks, 'optionalAccess', _41 => _41.onStart])) await _optionalChain([options, 'access', _42 => _42.hooks, 'optionalAccess', _43 => _43.onStart, 'call', _44 => _44(context)]);
678
+ if (_optionalChain([options, 'access', _38 => _38.hooks, 'optionalAccess', _39 => _39.onStart])) await _optionalChain([options, 'access', _40 => _40.hooks, 'optionalAccess', _41 => _41.onStart, 'call', _42 => _42(context)]);
734
679
  } : void 0,
735
- onClose: _optionalChain([options, 'access', _45 => _45.hooks, 'optionalAccess', _46 => _46.onClose])
680
+ onClose: _optionalChain([options, 'access', _43 => _43.hooks, 'optionalAccess', _44 => _44.onClose])
736
681
  },
737
682
  eachMessage: async (event2, context) => {
738
683
  if (!projection2.canHandle.includes(event2.type)) return;
@@ -745,7 +690,7 @@ var inMemoryCheckpointer = () => {
745
690
  read: async ({ processorId }, { database }) => {
746
691
  const checkpoint = await database.collection("emt_processor_checkpoints").findOne((d) => d._id === processorId);
747
692
  return Promise.resolve({
748
- lastCheckpoint: _nullishCoalesce(_optionalChain([checkpoint, 'optionalAccess', _47 => _47.lastCheckpoint]), () => ( null))
693
+ lastCheckpoint: _nullishCoalesce(_optionalChain([checkpoint, 'optionalAccess', _45 => _45.lastCheckpoint]), () => ( null))
749
694
  });
750
695
  },
751
696
  store: async (context, { database }) => {
@@ -756,7 +701,7 @@ var inMemoryCheckpointer = () => {
756
701
  const checkpoint = await checkpoints.findOne(
757
702
  (d) => d._id === processorId
758
703
  );
759
- const currentPosition = _nullishCoalesce(_optionalChain([checkpoint, 'optionalAccess', _48 => _48.lastCheckpoint]), () => ( null));
704
+ const currentPosition = _nullishCoalesce(_optionalChain([checkpoint, 'optionalAccess', _46 => _46.lastCheckpoint]), () => ( null));
760
705
  const newCheckpoint = getCheckpoint(message2);
761
706
  if (currentPosition && (currentPosition === newCheckpoint || currentPosition !== lastCheckpoint)) {
762
707
  return {
@@ -776,7 +721,7 @@ var inMemoryCheckpointer = () => {
776
721
  var inMemoryProcessingScope = (options) => {
777
722
  const processorDatabase = options.database;
778
723
  const processingScope = (handler, partialContext) => {
779
- const database = _nullishCoalesce(processorDatabase, () => ( _optionalChain([partialContext, 'optionalAccess', _49 => _49.database])));
724
+ const database = _nullishCoalesce(processorDatabase, () => ( _optionalChain([partialContext, 'optionalAccess', _47 => _47.database])));
780
725
  if (!database)
781
726
  throw new EmmettError(
782
727
  `InMemory processor '${options.processorId}' is missing database. Ensure that you passed it through options`
@@ -786,11 +731,11 @@ var inMemoryProcessingScope = (options) => {
786
731
  return processingScope;
787
732
  };
788
733
  var inMemoryProjector = (options) => {
789
- const database = _nullishCoalesce(_optionalChain([options, 'access', _50 => _50.connectionOptions, 'optionalAccess', _51 => _51.database]), () => ( getInMemoryDatabase()));
734
+ const database = _nullishCoalesce(_optionalChain([options, 'access', _48 => _48.connectionOptions, 'optionalAccess', _49 => _49.database]), () => ( getInMemoryDatabase()));
790
735
  const hooks = {
791
- onStart: _optionalChain([options, 'access', _52 => _52.hooks, 'optionalAccess', _53 => _53.onStart]),
792
- onClose: _optionalChain([options, 'access', _54 => _54.hooks, 'optionalAccess', _55 => _55.onClose]) ? async () => {
793
- if (_optionalChain([options, 'access', _56 => _56.hooks, 'optionalAccess', _57 => _57.onClose])) await _optionalChain([options, 'access', _58 => _58.hooks, 'optionalAccess', _59 => _59.onClose, 'call', _60 => _60()]);
736
+ onStart: _optionalChain([options, 'access', _50 => _50.hooks, 'optionalAccess', _51 => _51.onStart]),
737
+ onClose: _optionalChain([options, 'access', _52 => _52.hooks, 'optionalAccess', _53 => _53.onClose]) ? async () => {
738
+ if (_optionalChain([options, 'access', _54 => _54.hooks, 'optionalAccess', _55 => _55.onClose])) await _optionalChain([options, 'access', _56 => _56.hooks, 'optionalAccess', _57 => _57.onClose, 'call', _58 => _58()]);
794
739
  } : void 0
795
740
  };
796
741
  return {
@@ -807,11 +752,11 @@ var inMemoryProjector = (options) => {
807
752
  };
808
753
  };
809
754
  var inMemoryReactor = (options) => {
810
- const database = _nullishCoalesce(_optionalChain([options, 'access', _61 => _61.connectionOptions, 'optionalAccess', _62 => _62.database]), () => ( getInMemoryDatabase()));
755
+ const database = _nullishCoalesce(_optionalChain([options, 'access', _59 => _59.connectionOptions, 'optionalAccess', _60 => _60.database]), () => ( getInMemoryDatabase()));
811
756
  const hooks = {
812
- onStart: _optionalChain([options, 'access', _63 => _63.hooks, 'optionalAccess', _64 => _64.onStart]),
813
- onClose: _optionalChain([options, 'access', _65 => _65.hooks, 'optionalAccess', _66 => _66.onClose]) ? async () => {
814
- if (_optionalChain([options, 'access', _67 => _67.hooks, 'optionalAccess', _68 => _68.onClose])) await _optionalChain([options, 'access', _69 => _69.hooks, 'optionalAccess', _70 => _70.onClose, 'call', _71 => _71()]);
757
+ onStart: _optionalChain([options, 'access', _61 => _61.hooks, 'optionalAccess', _62 => _62.onStart]),
758
+ onClose: _optionalChain([options, 'access', _63 => _63.hooks, 'optionalAccess', _64 => _64.onClose]) ? async () => {
759
+ if (_optionalChain([options, 'access', _65 => _65.hooks, 'optionalAccess', _66 => _66.onClose])) await _optionalChain([options, 'access', _67 => _67.hooks, 'optionalAccess', _68 => _68.onClose, 'call', _69 => _69()]);
815
760
  } : void 0
816
761
  };
817
762
  return {
@@ -827,147 +772,6 @@ var inMemoryReactor = (options) => {
827
772
  database
828
773
  };
829
774
  };
830
- var filter = (filter2) => new (0, _webstreamspolyfill.TransformStream)({
831
- transform(chunk, controller) {
832
- if (filter2(chunk)) {
833
- controller.enqueue(chunk);
834
- }
835
- }
836
- });
837
- var map = (map2) => new (0, _webstreamspolyfill.TransformStream)({
838
- transform(chunk, controller) {
839
- controller.enqueue(map2(chunk));
840
- }
841
- });
842
- var reduce = (reducer, initialValue) => new ReduceTransformStream(reducer, initialValue);
843
- var ReduceTransformStream = class extends _webstreamspolyfill.TransformStream {
844
-
845
-
846
- constructor(reducer, initialValue) {
847
- super({
848
- transform: (chunk) => {
849
- this.accumulator = this.reducer(this.accumulator, chunk);
850
- },
851
- flush: (controller) => {
852
- controller.enqueue(this.accumulator);
853
- controller.terminate();
854
- }
855
- });
856
- this.accumulator = initialValue;
857
- this.reducer = reducer;
858
- }
859
- };
860
- var retryStream = (createSourceStream, handleChunk2, retryOptions = { forever: true, minTimeout: 25 }) => new (0, _webstreamspolyfill.TransformStream)({
861
- start(controller) {
862
- asyncRetry(
863
- () => onRestream(createSourceStream, handleChunk2, controller),
864
- retryOptions
865
- ).catch((error2) => {
866
- controller.error(error2);
867
- });
868
- }
869
- });
870
- var onRestream = async (createSourceStream, handleChunk2, controller) => {
871
- const sourceStream = createSourceStream();
872
- const reader = sourceStream.getReader();
873
- try {
874
- let done;
875
- do {
876
- const result = await reader.read();
877
- done = result.done;
878
- await handleChunk2(result, controller);
879
- if (done) {
880
- controller.terminate();
881
- }
882
- } while (!done);
883
- } finally {
884
- reader.releaseLock();
885
- }
886
- };
887
- var skip = (limit) => new SkipTransformStream(limit);
888
- var SkipTransformStream = (_class2 = class extends _webstreamspolyfill.TransformStream {
889
- __init3() {this.count = 0}
890
-
891
- constructor(skip2) {
892
- super({
893
- transform: (chunk, controller) => {
894
- this.count++;
895
- if (this.count > this.skip) {
896
- controller.enqueue(chunk);
897
- }
898
- }
899
- });_class2.prototype.__init3.call(this);;
900
- this.skip = skip2;
901
- }
902
- }, _class2);
903
- var stopAfter = (stopCondition) => new (0, _webstreamspolyfill.TransformStream)({
904
- transform(chunk, controller) {
905
- controller.enqueue(chunk);
906
- if (stopCondition(chunk)) {
907
- controller.terminate();
908
- }
909
- }
910
- });
911
- var stopOn = (stopCondition) => new (0, _webstreamspolyfill.TransformStream)({
912
- async transform(chunk, controller) {
913
- if (!stopCondition(chunk)) {
914
- controller.enqueue(chunk);
915
- return;
916
- }
917
- await Promise.resolve();
918
- controller.terminate();
919
- }
920
- });
921
- var take = (limit) => new TakeTransformStream(limit);
922
- var TakeTransformStream = (_class3 = class extends _webstreamspolyfill.TransformStream {
923
- __init4() {this.count = 0}
924
-
925
- constructor(limit) {
926
- super({
927
- transform: (chunk, controller) => {
928
- if (this.count < this.limit) {
929
- this.count++;
930
- controller.enqueue(chunk);
931
- } else {
932
- controller.terminate();
933
- }
934
- }
935
- });_class3.prototype.__init4.call(this);;
936
- this.limit = limit;
937
- }
938
- }, _class3);
939
- var waitAtMost = (waitTimeInMs) => new (0, _webstreamspolyfill.TransformStream)({
940
- start(controller) {
941
- const timeoutId = setTimeout(() => {
942
- controller.terminate();
943
- }, waitTimeInMs);
944
- const originalTerminate = controller.terminate.bind(controller);
945
- controller.terminate = () => {
946
- clearTimeout(timeoutId);
947
- originalTerminate();
948
- };
949
- },
950
- transform(chunk, controller) {
951
- controller.enqueue(chunk);
952
- }
953
- });
954
- var streamTransformations = {
955
- filter,
956
- take,
957
- TakeTransformStream,
958
- skip,
959
- SkipTransformStream,
960
- map,
961
- notifyAboutNoActiveReadersStream,
962
- NotifyAboutNoActiveReadersStream,
963
- reduce,
964
- ReduceTransformStream,
965
- retry: retryStream,
966
- stopAfter,
967
- stopOn,
968
- waitAtMost
969
- };
970
- var { retry: retry2 } = streamTransformations;
971
775
 
972
776
  // src/eventStore/consumers/eventStoreDBEventStoreConsumer.ts
973
777
 
@@ -1003,7 +807,7 @@ var getEventStoreDBEventStore = (eventStore) => {
1003
807
  return {
1004
808
  async aggregateStream(streamName, options) {
1005
809
  const { evolve, initialState, read } = options;
1006
- const expectedStreamVersion = _optionalChain([read, 'optionalAccess', _72 => _72.expectedStreamVersion]);
810
+ const expectedStreamVersion = _optionalChain([read, 'optionalAccess', _70 => _70.expectedStreamVersion]);
1007
811
  let state = initialState();
1008
812
  let currentStreamVersion = EventStoreDBEventStoreDefaultStreamVersion;
1009
813
  let lastEventGlobalPosition = void 0;
@@ -1016,7 +820,7 @@ var getEventStoreDBEventStore = (eventStore) => {
1016
820
  if (!event) continue;
1017
821
  state = evolve(state, mapFromESDBEvent(resolvedEvent));
1018
822
  currentStreamVersion = event.revision;
1019
- lastEventGlobalPosition = _optionalChain([event, 'access', _73 => _73.position, 'optionalAccess', _74 => _74.commit]);
823
+ lastEventGlobalPosition = _optionalChain([event, 'access', _71 => _71.position, 'optionalAccess', _72 => _72.commit]);
1020
824
  }
1021
825
  assertExpectedVersionMatchesCurrent(
1022
826
  currentStreamVersion,
@@ -1077,7 +881,7 @@ var getEventStoreDBEventStore = (eventStore) => {
1077
881
  try {
1078
882
  const serializedEvents = events.map(_dbclient.jsonEvent);
1079
883
  const expectedRevision = toExpectedRevision(
1080
- _optionalChain([options, 'optionalAccess', _75 => _75.expectedStreamVersion])
884
+ _optionalChain([options, 'optionalAccess', _73 => _73.expectedStreamVersion])
1081
885
  );
1082
886
  const appendResult = await eventStore.appendToStream(
1083
887
  streamName,
@@ -1109,7 +913,7 @@ var getEventStoreDBEventStore = (eventStore) => {
1109
913
  };
1110
914
  };
1111
915
  var getCheckpoint2 = (resolvedEvent, from) => {
1112
- return !from || _optionalChain([from, 'optionalAccess', _76 => _76.stream]) === $all ? _nullishCoalesce(_optionalChain([resolvedEvent, 'access', _77 => _77.link, 'optionalAccess', _78 => _78.position, 'optionalAccess', _79 => _79.commit]), () => ( _optionalChain([resolvedEvent, 'access', _80 => _80.event, 'optionalAccess', _81 => _81.position, 'optionalAccess', _82 => _82.commit]))) : _nullishCoalesce(_optionalChain([resolvedEvent, 'access', _83 => _83.link, 'optionalAccess', _84 => _84.revision]), () => ( resolvedEvent.event.revision));
916
+ return !from || _optionalChain([from, 'optionalAccess', _74 => _74.stream]) === $all ? _nullishCoalesce(_optionalChain([resolvedEvent, 'access', _75 => _75.link, 'optionalAccess', _76 => _76.position, 'optionalAccess', _77 => _77.commit]), () => ( _optionalChain([resolvedEvent, 'access', _78 => _78.event, 'optionalAccess', _79 => _79.position, 'optionalAccess', _80 => _80.commit]))) : _nullishCoalesce(_optionalChain([resolvedEvent, 'access', _81 => _81.link, 'optionalAccess', _82 => _82.revision]), () => ( resolvedEvent.event.revision));
1113
917
  };
1114
918
  var mapFromESDBEvent = (resolvedEvent, from) => {
1115
919
  const event = resolvedEvent.event;
@@ -1150,7 +954,7 @@ var toGlobalPosition = (startFrom) => startFrom === "BEGINNING" ? _dbclient.STAR
1150
954
  };
1151
955
  var toStreamPosition = (startFrom) => startFrom === "BEGINNING" ? _dbclient.START : startFrom === "END" ? _dbclient.END : startFrom.lastCheckpoint;
1152
956
  var subscribe = (client, from, options) => from == void 0 || from.stream == $all ? client.subscribeToAll({
1153
- ..._nullishCoalesce(_optionalChain([from, 'optionalAccess', _85 => _85.options]), () => ( {})),
957
+ ..._nullishCoalesce(_optionalChain([from, 'optionalAccess', _83 => _83.options]), () => ( {})),
1154
958
  fromPosition: toGlobalPosition(options.startFrom),
1155
959
  filter: _dbclient.excludeSystemEvents.call(void 0, )
1156
960
  }) : client.subscribeToStream(from.stream, {
@@ -1209,7 +1013,7 @@ var eventStoreDBSubscription = ({
1209
1013
  let start;
1210
1014
  let processor;
1211
1015
  let subscription;
1212
- const resubscribeOptions = _nullishCoalesce(_optionalChain([resilience, 'optionalAccess', _86 => _86.resubscribeOptions]), () => ( {
1016
+ const resubscribeOptions = _nullishCoalesce(_optionalChain([resilience, 'optionalAccess', _84 => _84.resubscribeOptions]), () => ( {
1213
1017
  ...EventStoreDBResubscribeDefaultOptions,
1214
1018
  shouldRetryResult: () => isRunning,
1215
1019
  shouldRetryError: (error) => isRunning && EventStoreDBResubscribeDefaultOptions.shouldRetryError(error)
@@ -1223,11 +1027,11 @@ var eventStoreDBSubscription = ({
1223
1027
  }))));
1224
1028
  };
1225
1029
  const pipeMessages = (options) => {
1226
- let retry3 = 0;
1030
+ let retry2 = 0;
1227
1031
  return asyncRetry(
1228
1032
  () => new Promise((resolve, reject) => {
1229
1033
  console.info(
1230
- `Starting subscription. ${retry3++} retries. From: ${JSONParser.stringify(_nullishCoalesce(from, () => ( "$all")))}, Start from: ${JSONParser.stringify(
1034
+ `Starting subscription. ${retry2++} retries. From: ${JSONParser.stringify(_nullishCoalesce(from, () => ( "$all")))}, Start from: ${JSONParser.stringify(
1231
1035
  options.startFrom
1232
1036
  )}`
1233
1037
  );
@@ -1324,13 +1128,13 @@ var eventStoreDBEventStoreConsumer = (options) => {
1324
1128
  reason: "No active processors"
1325
1129
  };
1326
1130
  const result = await Promise.allSettled(
1327
- activeProcessors.map((s) => {
1328
- return s.handle(messagesBatch, { client });
1131
+ activeProcessors.map(async (s) => {
1132
+ return await s.handle(messagesBatch, { client });
1329
1133
  })
1330
1134
  );
1331
- const error = _optionalChain([result, 'access', _87 => _87.find, 'call', _88 => _88((r) => r.status === "rejected"), 'optionalAccess', _89 => _89.reason]);
1135
+ const error = _optionalChain([result, 'access', _85 => _85.find, 'call', _86 => _86((r) => r.status === "rejected"), 'optionalAccess', _87 => _87.reason]);
1332
1136
  return result.some(
1333
- (r) => r.status === "fulfilled" && _optionalChain([r, 'access', _90 => _90.value, 'optionalAccess', _91 => _91.type]) !== "STOP"
1137
+ (r) => r.status === "fulfilled" && _optionalChain([r, 'access', _88 => _88.value, 'optionalAccess', _89 => _89.type]) !== "STOP"
1334
1138
  ) ? void 0 : {
1335
1139
  type: "STOP",
1336
1140
  error: error ? EmmettError.mapFrom(error) : void 0
@@ -1340,7 +1144,7 @@ var eventStoreDBEventStoreConsumer = (options) => {
1340
1144
  client,
1341
1145
  from: options.from,
1342
1146
  eachBatch,
1343
- batchSize: _nullishCoalesce(_optionalChain([pulling, 'optionalAccess', _92 => _92.batchSize]), () => ( DefaultEventStoreDBEventStoreProcessorBatchSize)),
1147
+ batchSize: _nullishCoalesce(_optionalChain([pulling, 'optionalAccess', _90 => _90.batchSize]), () => ( DefaultEventStoreDBEventStoreProcessorBatchSize)),
1344
1148
  resilience: options.resilience
1345
1149
  });
1346
1150
  const stop = async () => {