@daiso-tech/core 0.7.0 → 0.8.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/cjs/_module.js +2 -0
- package/dist/cjs/_module.js.map +1 -1
- package/dist/cjs/_shared/utilities.js +9 -0
- package/dist/cjs/_shared/utilities.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-chunk-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-collapse-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-entries-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-group-by-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-pad-end-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-pad-start-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-reverse-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-shuffle-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-skip-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-slice-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-sliding-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-sort-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-split-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-zip-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/chunk-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/chunk-while-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/collapse-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/count-by-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/entries-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/filter-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/group-by-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/map-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/pad-end-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/pad-start-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/partion-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/repeat-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/reverse-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/skip-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/slice-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/sliding-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/sort-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/split-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/take-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/take-until-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/tap-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/unique-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/when-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/zip-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/list-collection/list-collection.js +2 -1
- package/dist/cjs/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/cjs/{utilities/async/backof-policies/exponential-backoff-policy → event-bus/contracts}/_module.js +4 -1
- package/dist/cjs/event-bus/contracts/_module.js.map +1 -0
- package/dist/cjs/event-bus/contracts/_shared.js +32 -0
- package/dist/cjs/event-bus/contracts/_shared.js.map +1 -0
- package/dist/cjs/event-bus/contracts/event-bus-adapter.contract.js +3 -0
- package/dist/cjs/event-bus/contracts/event-bus-adapter.contract.js.map +1 -0
- package/dist/cjs/event-bus/contracts/event-bus-manager.contract.js +3 -0
- package/dist/cjs/event-bus/contracts/event-bus-manager.contract.js.map +1 -0
- package/dist/cjs/event-bus/contracts/event-bus.contract.js +3 -0
- package/dist/cjs/event-bus/contracts/event-bus.contract.js.map +1 -0
- package/dist/cjs/{serializer → event-bus/implementations}/_module.js +5 -5
- package/dist/cjs/event-bus/implementations/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/_shared/test-utilities/_module.js +18 -0
- package/dist/cjs/event-bus/implementations/_shared/test-utilities/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js +51 -0
- package/dist/cjs/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js.map +1 -0
- package/dist/cjs/event-bus/implementations/event-bus/_module.js +19 -0
- package/dist/cjs/event-bus/implementations/event-bus/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/event-bus/event-bus-manager.js +24 -0
- package/dist/cjs/event-bus/implementations/event-bus/event-bus-manager.js.map +1 -0
- package/dist/cjs/event-bus/implementations/event-bus/event-bus.js +104 -0
- package/dist/cjs/event-bus/implementations/event-bus/event-bus.js.map +1 -0
- package/dist/cjs/event-bus/implementations/event-bus/with-namespace-event-bus-adapter.js +41 -0
- package/dist/cjs/event-bus/implementations/event-bus/with-namespace-event-bus-adapter.js.map +1 -0
- package/dist/cjs/event-bus/implementations/event-bus/with-validation-event-bus-adapter.js +35 -0
- package/dist/cjs/event-bus/implementations/event-bus/with-validation-event-bus-adapter.js.map +1 -0
- package/dist/cjs/{utilities/async-iterable/timeout-iterable → event-bus/implementations/memory-event-bus-adapter}/_module.js +1 -1
- package/dist/cjs/event-bus/implementations/memory-event-bus-adapter/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js +23 -0
- package/dist/cjs/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -0
- package/dist/cjs/event-bus/implementations/no-op-event-bus-adapter/_module.js +18 -0
- package/dist/cjs/event-bus/implementations/no-op-event-bus-adapter/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.js +16 -0
- package/dist/cjs/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -0
- package/dist/cjs/{utilities/async-iterable/abortable-iterable → event-bus/implementations/redis-event-bus-adapter}/_module.js +1 -1
- package/dist/cjs/event-bus/implementations/redis-event-bus-adapter/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.js +45 -0
- package/dist/cjs/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.js.map +1 -0
- package/dist/cjs/storage/contracts/_module.js +2 -0
- package/dist/cjs/storage/contracts/_module.js.map +1 -1
- package/dist/cjs/storage/contracts/storage-events.contract.js +14 -0
- package/dist/cjs/storage/contracts/storage-events.contract.js.map +1 -0
- package/dist/cjs/storage/contracts/storage-manager.contract.js +3 -0
- package/dist/cjs/storage/contracts/storage-manager.contract.js.map +1 -0
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +292 -4
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +1 -1
- package/dist/cjs/storage/implementations/storage/_module.js +1 -0
- package/dist/cjs/storage/implementations/storage/_module.js.map +1 -1
- package/dist/cjs/storage/implementations/storage/storage-manager.js +24 -0
- package/dist/cjs/storage/implementations/storage/storage-manager.js.map +1 -0
- package/dist/cjs/storage/implementations/storage/storage.js +67 -21
- package/dist/cjs/storage/implementations/storage/storage.js.map +1 -1
- package/dist/cjs/storage/implementations/storage/with-event-storage-adapter.js +254 -0
- package/dist/cjs/storage/implementations/storage/with-event-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/implementations/storage/with-namespace-storage-adapter.js +0 -3
- package/dist/cjs/storage/implementations/storage/with-namespace-storage-adapter.js.map +1 -1
- package/dist/cjs/storage/implementations/storage/with-validation-storage-adapter.js.map +1 -1
- package/dist/cjs/utilities/_module.js +1 -2
- package/dist/cjs/utilities/_module.js.map +1 -1
- package/dist/cjs/utilities/async/_module.js +6 -1
- package/dist/cjs/utilities/async/_module.js.map +1 -1
- package/dist/cjs/utilities/{async-iterable/retry-iterable → async/abortable-iterable}/_module.js +1 -1
- package/dist/cjs/utilities/async/abortable-iterable/_module.js.map +1 -0
- package/dist/cjs/utilities/async/abortable-iterable/abortable-iterable.js.map +1 -0
- package/dist/cjs/utilities/{async-iterable → async}/delay-iterable/_module.js +1 -1
- package/dist/cjs/utilities/async/delay-iterable/_module.js.map +1 -0
- package/dist/cjs/utilities/async/delay-iterable/delay-iterable.js.map +1 -0
- package/dist/cjs/utilities/async/retry/retry.js +1 -1
- package/dist/cjs/utilities/async/retry/retry.js.map +1 -1
- package/dist/cjs/utilities/async/retry-iterable/_module.js +18 -0
- package/dist/cjs/utilities/async/retry-iterable/_module.js.map +1 -0
- package/dist/cjs/utilities/async/retry-iterable/retry-iterable.js.map +1 -0
- package/dist/cjs/utilities/async/timeout-iterable/_module.js +18 -0
- package/dist/cjs/utilities/async/timeout-iterable/_module.js.map +1 -0
- package/dist/cjs/utilities/{async-iterable → async}/timeout-iterable/timeout-iterable.js +1 -1
- package/dist/cjs/utilities/async/timeout-iterable/timeout-iterable.js.map +1 -0
- package/dist/cjs/utilities/backof-policies/_module.js +21 -0
- package/dist/cjs/utilities/backof-policies/_module.js.map +1 -0
- package/dist/cjs/utilities/backof-policies/_shared.js.map +1 -0
- package/dist/cjs/utilities/backof-policies/constant-backoff-policy/_module.js +18 -0
- package/dist/cjs/utilities/backof-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/utilities/{async/backof-policies → backof-policies}/constant-backoff-policy/constant-backoff-policy.js +2 -2
- package/dist/cjs/utilities/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
- package/dist/cjs/utilities/backof-policies/exponential-backoff-policy/_module.js +18 -0
- package/dist/cjs/utilities/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/utilities/{async/backof-policies → backof-policies}/exponential-backoff-policy/exponential-backoff-policy.js +2 -2
- package/dist/cjs/utilities/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/cjs/utilities/backof-policies/linear-backoff-policy/_module.js +18 -0
- package/dist/cjs/utilities/backof-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/utilities/{async/backof-policies → backof-policies}/linear-backoff-policy/linear-backoff-policy.js +2 -2
- package/dist/cjs/utilities/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
- package/dist/cjs/utilities/backof-policies/polynomial-backoff-policy/_module.js +18 -0
- package/dist/cjs/utilities/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/utilities/{async/backof-policies → backof-policies}/polynomial-backoff-policy/polynomial-backoff-policy.js +2 -2
- package/dist/cjs/utilities/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/cjs/utilities/time-span/time-span.js.map +1 -1
- package/dist/cjs/utilities/validation/_module.js.map +1 -1
- package/dist/esm/_module.js +2 -0
- package/dist/esm/_module.js.map +1 -1
- package/dist/esm/_shared/utilities.js +7 -0
- package/dist/esm/_shared/utilities.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-chunk-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-collapse-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-entries-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-group-by-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-pad-end-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-pad-start-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-reverse-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-shuffle-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-skip-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-slice-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-sliding-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-sort-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-split-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-zip-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/chunk-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/chunk-while-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/collapse-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/count-by-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/entries-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/filter-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/group-by-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/map-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/pad-end-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/pad-start-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/partion-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/repeat-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/reverse-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/skip-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/slice-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/sliding-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/sort-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/split-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/take-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/take-until-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/tap-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/unique-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/when-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/zip-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/list-collection/list-collection.js +2 -1
- package/dist/esm/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/esm/event-bus/contracts/_module.js +5 -0
- package/dist/esm/event-bus/contracts/_module.js.map +1 -0
- package/dist/esm/event-bus/contracts/_shared.js +25 -0
- package/dist/esm/event-bus/contracts/_shared.js.map +1 -0
- package/dist/esm/event-bus/contracts/event-bus-adapter.contract.js +1 -0
- package/dist/esm/event-bus/contracts/event-bus-adapter.contract.js.map +1 -0
- package/dist/esm/event-bus/contracts/event-bus-manager.contract.js +1 -0
- package/dist/esm/event-bus/contracts/event-bus-manager.contract.js.map +1 -0
- package/dist/esm/event-bus/contracts/event-bus.contract.js +1 -0
- package/dist/esm/event-bus/contracts/event-bus.contract.js.map +1 -0
- package/dist/esm/event-bus/implementations/_module.js +6 -0
- package/dist/esm/event-bus/implementations/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/_shared/test-utilities/_module.js +2 -0
- package/dist/esm/event-bus/implementations/_shared/test-utilities/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js +48 -0
- package/dist/esm/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js.map +1 -0
- package/dist/esm/event-bus/implementations/event-bus/_module.js +3 -0
- package/dist/esm/event-bus/implementations/event-bus/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/event-bus/event-bus-manager.js +20 -0
- package/dist/esm/event-bus/implementations/event-bus/event-bus-manager.js.map +1 -0
- package/dist/esm/event-bus/implementations/event-bus/event-bus.js +100 -0
- package/dist/esm/event-bus/implementations/event-bus/event-bus.js.map +1 -0
- package/dist/esm/event-bus/implementations/event-bus/with-namespace-event-bus-adapter.js +37 -0
- package/dist/esm/event-bus/implementations/event-bus/with-namespace-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/event-bus/with-validation-event-bus-adapter.js +31 -0
- package/dist/esm/event-bus/implementations/event-bus/with-validation-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/memory-event-bus-adapter/_module.js +2 -0
- package/dist/esm/event-bus/implementations/memory-event-bus-adapter/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js +19 -0
- package/dist/esm/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/_module.js +2 -0
- package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.js +12 -0
- package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/redis-event-bus-adapter/_module.js +2 -0
- package/dist/esm/event-bus/implementations/redis-event-bus-adapter/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.js +41 -0
- package/dist/esm/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.js.map +1 -0
- package/dist/esm/storage/contracts/_module.js +2 -0
- package/dist/esm/storage/contracts/_module.js.map +1 -1
- package/dist/esm/storage/contracts/storage-events.contract.js +11 -0
- package/dist/esm/storage/contracts/storage-events.contract.js.map +1 -0
- package/dist/esm/storage/contracts/storage-manager.contract.js +1 -0
- package/dist/esm/storage/contracts/storage-manager.contract.js.map +1 -0
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +292 -4
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +1 -1
- package/dist/esm/storage/implementations/storage/_module.js +1 -0
- package/dist/esm/storage/implementations/storage/_module.js.map +1 -1
- package/dist/esm/storage/implementations/storage/storage-manager.js +20 -0
- package/dist/esm/storage/implementations/storage/storage-manager.js.map +1 -0
- package/dist/esm/storage/implementations/storage/storage.js +69 -23
- package/dist/esm/storage/implementations/storage/storage.js.map +1 -1
- package/dist/esm/storage/implementations/storage/with-event-storage-adapter.js +250 -0
- package/dist/esm/storage/implementations/storage/with-event-storage-adapter.js.map +1 -0
- package/dist/esm/storage/implementations/storage/with-namespace-storage-adapter.js +0 -3
- package/dist/esm/storage/implementations/storage/with-namespace-storage-adapter.js.map +1 -1
- package/dist/esm/storage/implementations/storage/with-validation-storage-adapter.js.map +1 -1
- package/dist/esm/utilities/_module.js +1 -2
- package/dist/esm/utilities/_module.js.map +1 -1
- package/dist/esm/utilities/async/_module.js +4 -1
- package/dist/esm/utilities/async/_module.js.map +1 -1
- package/dist/esm/utilities/async/abortable-iterable/_module.js +2 -0
- package/dist/esm/utilities/async/abortable-iterable/_module.js.map +1 -0
- package/dist/esm/utilities/async/abortable-iterable/abortable-iterable.js.map +1 -0
- package/dist/esm/utilities/async/delay-iterable/_module.js +2 -0
- package/dist/esm/utilities/async/delay-iterable/_module.js.map +1 -0
- package/dist/esm/utilities/async/delay-iterable/delay-iterable.js.map +1 -0
- package/dist/esm/utilities/async/retry/retry.js +1 -1
- package/dist/esm/utilities/async/retry/retry.js.map +1 -1
- package/dist/esm/utilities/async/retry-iterable/_module.js +2 -0
- package/dist/esm/utilities/async/retry-iterable/_module.js.map +1 -0
- package/dist/esm/utilities/async/retry-iterable/retry-iterable.js.map +1 -0
- package/dist/esm/utilities/async/timeout-iterable/_module.js +2 -0
- package/dist/esm/utilities/async/timeout-iterable/_module.js.map +1 -0
- package/dist/esm/utilities/{async-iterable → async}/timeout-iterable/timeout-iterable.js +1 -1
- package/dist/esm/utilities/async/timeout-iterable/timeout-iterable.js.map +1 -0
- package/dist/esm/utilities/backof-policies/_module.js +5 -0
- package/dist/esm/utilities/backof-policies/_module.js.map +1 -0
- package/dist/esm/utilities/backof-policies/_shared.js.map +1 -0
- package/dist/esm/utilities/backof-policies/constant-backoff-policy/_module.js +2 -0
- package/dist/esm/utilities/backof-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/esm/utilities/{async/backof-policies → backof-policies}/constant-backoff-policy/constant-backoff-policy.js +2 -2
- package/dist/esm/utilities/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
- package/dist/esm/utilities/backof-policies/exponential-backoff-policy/_module.js +2 -0
- package/dist/esm/utilities/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
- package/dist/esm/utilities/{async/backof-policies → backof-policies}/exponential-backoff-policy/exponential-backoff-policy.js +2 -2
- package/dist/esm/utilities/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/esm/utilities/backof-policies/linear-backoff-policy/_module.js +2 -0
- package/dist/esm/utilities/backof-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/esm/utilities/{async/backof-policies → backof-policies}/linear-backoff-policy/linear-backoff-policy.js +2 -2
- package/dist/esm/utilities/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
- package/dist/esm/utilities/backof-policies/polynomial-backoff-policy/_module.js +2 -0
- package/dist/esm/utilities/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
- package/dist/esm/utilities/{async/backof-policies → backof-policies}/polynomial-backoff-policy/polynomial-backoff-policy.js +2 -2
- package/dist/esm/utilities/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/esm/utilities/time-span/time-span.js.map +1 -1
- package/dist/esm/utilities/validation/_module.js.map +1 -1
- package/dist/types/_module.d.ts +2 -0
- package/dist/types/_shared/types.d.ts +1 -1
- package/dist/types/_shared/utilities.d.ts +8 -0
- package/dist/types/collection/contracts/async-collection.contract.d.ts +9 -8
- package/dist/types/collection/contracts/collection.contract.d.ts +8 -7
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-chunk-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-collapse-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-entries-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-group-by-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-insert-after-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-insert-before-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-map-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-pad-end-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-pad-start-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-partion-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-repeat-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-reverse-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-shuffle-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-skip-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-skip-until-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-slice-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-sliding-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-sort-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-split-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-take-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-take-until-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-tap-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-unique-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-update-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-when-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-zip-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +10 -9
- package/dist/types/collection/implementations/iterable-collection/_shared/chunk-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/chunk-while-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/collapse-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/count-by-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/cross-join-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/entries-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/filter-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/flat-map-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/group-by-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/insert-after-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/insert-before-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/map-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/merge-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/pad-end-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/pad-start-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/partion-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/repeat-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/reverse-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/shuffle-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/skip-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/skip-until-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/slice-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/sliding-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/sort-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/split-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/take-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/take-until-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/tap-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/unique-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/update-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/when-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/zip-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/iterable-collection.d.ts +7 -7
- package/dist/types/collection/implementations/list-collection/list-collection.d.ts +7 -7
- package/dist/types/event-bus/contracts/_module.d.ts +4 -0
- package/dist/types/event-bus/contracts/_shared.d.ts +32 -0
- package/dist/types/event-bus/contracts/event-bus-adapter.contract.d.ts +23 -0
- package/dist/types/event-bus/contracts/event-bus-manager.contract.d.ts +20 -0
- package/dist/types/event-bus/contracts/event-bus.contract.d.ts +91 -0
- package/dist/types/event-bus/implementations/_module.d.ts +5 -0
- package/dist/types/event-bus/implementations/_shared/test-utilities/_module.d.ts +1 -0
- package/dist/types/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.d.ts +20 -0
- package/dist/types/event-bus/implementations/event-bus/_module.d.ts +2 -0
- package/dist/types/event-bus/implementations/event-bus/event-bus-manager.d.ts +23 -0
- package/dist/types/event-bus/implementations/event-bus/event-bus.d.ts +102 -0
- package/dist/types/event-bus/implementations/event-bus/with-namespace-event-bus-adapter.d.ts +16 -0
- package/dist/types/event-bus/implementations/event-bus/with-validation-event-bus-adapter.d.ts +17 -0
- package/dist/types/event-bus/implementations/memory-event-bus-adapter/_module.d.ts +1 -0
- package/dist/types/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +15 -0
- package/dist/types/event-bus/implementations/no-op-event-bus-adapter/_module.d.ts +1 -0
- package/dist/types/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +14 -0
- package/dist/types/event-bus/implementations/redis-event-bus-adapter/_module.d.ts +1 -0
- package/dist/types/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.d.ts +28 -0
- package/dist/types/storage/contracts/_module.d.ts +2 -0
- package/dist/types/storage/contracts/storage-adapter.contract.d.ts +11 -6
- package/dist/types/storage/contracts/storage-events.contract.d.ts +90 -0
- package/dist/types/storage/contracts/storage-manager.contract.d.ts +19 -0
- package/dist/types/storage/contracts/storage.contract.d.ts +51 -26
- package/dist/types/storage/implementations/storage/_module.d.ts +1 -0
- package/dist/types/storage/implementations/storage/storage-manager.d.ts +23 -0
- package/dist/types/storage/implementations/storage/storage.d.ts +81 -8
- package/dist/types/storage/implementations/storage/with-event-storage-adapter.d.ts +31 -0
- package/dist/types/storage/implementations/storage/with-namespace-storage-adapter.d.ts +0 -1
- package/dist/types/storage/implementations/storage/with-validation-storage-adapter.d.ts +3 -0
- package/dist/types/utilities/_module.d.ts +1 -2
- package/dist/types/utilities/async/_module.d.ts +4 -1
- package/dist/types/utilities/async/_shared.d.ts +6 -6
- package/dist/types/utilities/async/abortable/abortable.d.ts +2 -2
- package/dist/types/utilities/async/abortable-iterable/_module.d.ts +1 -0
- package/dist/types/utilities/{async-iterable → async}/abortable-iterable/abortable-iterable.d.ts +2 -2
- package/dist/types/utilities/async/delay/delay.d.ts +2 -2
- package/dist/types/utilities/async/delay-iterable/_module.d.ts +1 -0
- package/dist/types/utilities/{async-iterable → async}/delay-iterable/delay-iterable.d.ts +2 -2
- package/dist/types/utilities/async/lazy-promise/lazy-promise.d.ts +3 -3
- package/dist/types/utilities/async/retry/retry.d.ts +7 -4
- package/dist/types/utilities/async/retry-iterable/_module.d.ts +1 -0
- package/dist/types/utilities/{async-iterable → async}/retry-iterable/retry-iterable.d.ts +1 -1
- package/dist/types/utilities/async/timeout/timeout.d.ts +2 -2
- package/dist/types/utilities/async/timeout-iterable/_module.d.ts +1 -0
- package/dist/types/utilities/{async-iterable → async}/timeout-iterable/timeout-iterable.d.ts +2 -2
- package/dist/types/utilities/backof-policies/_module.d.ts +5 -0
- package/dist/types/utilities/{async/backof-policies → backof-policies}/_shared.d.ts +2 -2
- package/dist/types/utilities/backof-policies/constant-backoff-policy/_module.d.ts +1 -0
- package/dist/types/utilities/{async/backof-policies → backof-policies}/constant-backoff-policy/constant-backoff-policy.d.ts +3 -3
- package/dist/types/utilities/backof-policies/exponential-backoff-policy/_module.d.ts +1 -0
- package/dist/types/utilities/{async/backof-policies → backof-policies}/exponential-backoff-policy/exponential-backoff-policy.d.ts +3 -3
- package/dist/types/utilities/backof-policies/linear-backoff-policy/_module.d.ts +1 -0
- package/dist/types/utilities/{async/backof-policies → backof-policies}/linear-backoff-policy/linear-backoff-policy.d.ts +3 -3
- package/dist/types/utilities/backof-policies/polynomial-backoff-policy/_module.d.ts +1 -0
- package/dist/types/utilities/{async/backof-policies → backof-policies}/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +3 -3
- package/dist/types/utilities/time-span/time-span.d.ts +2 -1
- package/dist/types/utilities/validation/_module.d.ts +21 -1
- package/package.json +1 -1
- package/dist/cjs/serializer/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter-api.test-suite.js +0 -300
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter-api.test-suite.js.map +0 -1
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter-value.test-suite.js +0 -1208
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter-value.test-suite.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/_module.js +0 -21
- package/dist/cjs/utilities/async/backof-policies/_module.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/_shared.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/constant-backoff-policy/_module.js +0 -18
- package/dist/cjs/utilities/async/backof-policies/constant-backoff-policy/_module.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/exponential-backoff-policy/_module.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/linear-backoff-policy/_module.js +0 -18
- package/dist/cjs/utilities/async/backof-policies/linear-backoff-policy/_module.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/polynomial-backoff-policy/_module.js +0 -18
- package/dist/cjs/utilities/async/backof-policies/polynomial-backoff-policy/_module.js.map +0 -1
- package/dist/cjs/utilities/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +0 -1
- package/dist/cjs/utilities/async-iterable/_module.js +0 -23
- package/dist/cjs/utilities/async-iterable/_module.js.map +0 -1
- package/dist/cjs/utilities/async-iterable/abortable-iterable/_module.js.map +0 -1
- package/dist/cjs/utilities/async-iterable/abortable-iterable/abortable-iterable.js.map +0 -1
- package/dist/cjs/utilities/async-iterable/delay-iterable/_module.js.map +0 -1
- package/dist/cjs/utilities/async-iterable/delay-iterable/delay-iterable.js.map +0 -1
- package/dist/cjs/utilities/async-iterable/retry-iterable/_module.js.map +0 -1
- package/dist/cjs/utilities/async-iterable/retry-iterable/retry-iterable.js.map +0 -1
- package/dist/cjs/utilities/async-iterable/timeout-iterable/_module.js.map +0 -1
- package/dist/cjs/utilities/async-iterable/timeout-iterable/timeout-iterable.js.map +0 -1
- package/dist/esm/serializer/_module.js +0 -6
- package/dist/esm/serializer/_module.js.map +0 -1
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter-api.test-suite.js +0 -297
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter-api.test-suite.js.map +0 -1
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter-value.test-suite.js +0 -1205
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter-value.test-suite.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/_module.js +0 -5
- package/dist/esm/utilities/async/backof-policies/_module.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/_shared.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/constant-backoff-policy/_module.js +0 -2
- package/dist/esm/utilities/async/backof-policies/constant-backoff-policy/_module.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/exponential-backoff-policy/_module.js +0 -2
- package/dist/esm/utilities/async/backof-policies/exponential-backoff-policy/_module.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/linear-backoff-policy/_module.js +0 -2
- package/dist/esm/utilities/async/backof-policies/linear-backoff-policy/_module.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/polynomial-backoff-policy/_module.js +0 -2
- package/dist/esm/utilities/async/backof-policies/polynomial-backoff-policy/_module.js.map +0 -1
- package/dist/esm/utilities/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +0 -1
- package/dist/esm/utilities/async-iterable/_module.js +0 -5
- package/dist/esm/utilities/async-iterable/_module.js.map +0 -1
- package/dist/esm/utilities/async-iterable/abortable-iterable/_module.js +0 -2
- package/dist/esm/utilities/async-iterable/abortable-iterable/_module.js.map +0 -1
- package/dist/esm/utilities/async-iterable/abortable-iterable/abortable-iterable.js.map +0 -1
- package/dist/esm/utilities/async-iterable/delay-iterable/_module.js +0 -2
- package/dist/esm/utilities/async-iterable/delay-iterable/_module.js.map +0 -1
- package/dist/esm/utilities/async-iterable/delay-iterable/delay-iterable.js.map +0 -1
- package/dist/esm/utilities/async-iterable/retry-iterable/_module.js +0 -2
- package/dist/esm/utilities/async-iterable/retry-iterable/_module.js.map +0 -1
- package/dist/esm/utilities/async-iterable/retry-iterable/retry-iterable.js.map +0 -1
- package/dist/esm/utilities/async-iterable/timeout-iterable/_module.js +0 -2
- package/dist/esm/utilities/async-iterable/timeout-iterable/_module.js.map +0 -1
- package/dist/esm/utilities/async-iterable/timeout-iterable/timeout-iterable.js.map +0 -1
- package/dist/types/serializer/_module.d.ts +0 -5
- package/dist/types/storage/implementations/_shared/test-utilities/storage-adapter-api.test-suite.d.ts +0 -20
- package/dist/types/storage/implementations/_shared/test-utilities/storage-adapter-value.test-suite.d.ts +0 -20
- package/dist/types/utilities/async/backof-policies/_module.d.ts +0 -5
- package/dist/types/utilities/async/backof-policies/constant-backoff-policy/_module.d.ts +0 -1
- package/dist/types/utilities/async/backof-policies/exponential-backoff-policy/_module.d.ts +0 -1
- package/dist/types/utilities/async/backof-policies/linear-backoff-policy/_module.d.ts +0 -1
- package/dist/types/utilities/async/backof-policies/polynomial-backoff-policy/_module.d.ts +0 -1
- package/dist/types/utilities/async-iterable/_module.d.ts +0 -4
- package/dist/types/utilities/async-iterable/abortable-iterable/_module.d.ts +0 -1
- package/dist/types/utilities/async-iterable/delay-iterable/_module.d.ts +0 -1
- package/dist/types/utilities/async-iterable/retry-iterable/_module.d.ts +0 -1
- package/dist/types/utilities/async-iterable/timeout-iterable/_module.d.ts +0 -1
- /package/dist/cjs/utilities/{async-iterable → async}/abortable-iterable/abortable-iterable.js +0 -0
- /package/dist/cjs/utilities/{async-iterable → async}/delay-iterable/delay-iterable.js +0 -0
- /package/dist/cjs/utilities/{async-iterable → async}/retry-iterable/retry-iterable.js +0 -0
- /package/dist/cjs/utilities/{async/backof-policies → backof-policies}/_shared.js +0 -0
- /package/dist/esm/utilities/{async-iterable → async}/abortable-iterable/abortable-iterable.js +0 -0
- /package/dist/esm/utilities/{async-iterable → async}/delay-iterable/delay-iterable.js +0 -0
- /package/dist/esm/utilities/{async-iterable → async}/retry-iterable/retry-iterable.js +0 -0
- /package/dist/esm/utilities/{async/backof-policies → backof-policies}/_shared.js +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { LazyPromise } from "../../../utilities/_module";
|
|
2
|
+
import { DispatchEventBusError, RemoveListenerEventBusError, AddListenerEventBusError, } from "../../../event-bus/contracts/_module";
|
|
3
|
+
import { WithNamespaceEventBusAdapter } from "../../../event-bus/implementations/event-bus/with-namespace-event-bus-adapter";
|
|
4
|
+
import { WithValidationEventBusAdapter } from "../../../event-bus/implementations/event-bus/with-validation-event-bus-adapter";
|
|
5
|
+
import { isArrayEmpty } from "../../../_shared/utilities";
|
|
6
|
+
export class EventBus {
|
|
7
|
+
eventBusAdapter;
|
|
8
|
+
namespace_;
|
|
9
|
+
validator;
|
|
10
|
+
constructor(eventBusAdapter, settings = {}) {
|
|
11
|
+
const { rootNamespace: namespace = "", validator = (value) => value, } = settings;
|
|
12
|
+
this.namespace_ = namespace;
|
|
13
|
+
this.validator = validator;
|
|
14
|
+
this.eventBusAdapter = new WithNamespaceEventBusAdapter(new WithValidationEventBusAdapter(eventBusAdapter, this.validator), this.namespace_);
|
|
15
|
+
}
|
|
16
|
+
withNamespace(namespace) {
|
|
17
|
+
return new EventBus(this.eventBusAdapter, {
|
|
18
|
+
validator: this.validator,
|
|
19
|
+
rootNamespace: `${this.namespace_}${namespace}`,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
getNamespace() {
|
|
23
|
+
return this.namespace_;
|
|
24
|
+
}
|
|
25
|
+
addListener(event, listener) {
|
|
26
|
+
return new LazyPromise(async () => {
|
|
27
|
+
try {
|
|
28
|
+
await this.eventBusAdapter.addListener(event, listener);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw new AddListenerEventBusError(`A listener with name of "${listener.name}" could not added for "${event}" event`, error);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
addListenerMany(events, listener) {
|
|
36
|
+
return new LazyPromise(async () => {
|
|
37
|
+
if (isArrayEmpty(events)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const promises = [];
|
|
41
|
+
for (const event of events) {
|
|
42
|
+
promises.push(this.addListener(event, listener));
|
|
43
|
+
}
|
|
44
|
+
await Promise.all(promises);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
removeListener(event, listener) {
|
|
48
|
+
return new LazyPromise(async () => {
|
|
49
|
+
try {
|
|
50
|
+
await this.eventBusAdapter.removeListener(event, listener);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
throw new RemoveListenerEventBusError(`A listener with name of "${listener.name}" could not removed of "${event}" event`, error);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
removeListenerMany(events, listener) {
|
|
58
|
+
return new LazyPromise(async () => {
|
|
59
|
+
if (isArrayEmpty(events)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const promises = [];
|
|
63
|
+
for (const event of events) {
|
|
64
|
+
promises.push(this.removeListener(event, listener));
|
|
65
|
+
}
|
|
66
|
+
await Promise.all(promises);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
subscribe(event, listener) {
|
|
70
|
+
return this.subscribeMany([event], listener);
|
|
71
|
+
}
|
|
72
|
+
subscribeMany(events, listener) {
|
|
73
|
+
return new LazyPromise(async () => {
|
|
74
|
+
await this.addListenerMany(events, listener);
|
|
75
|
+
const unsubscribe = () => {
|
|
76
|
+
return new LazyPromise(async () => {
|
|
77
|
+
await this.removeListenerMany(events, listener);
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
return unsubscribe;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
dispatch(events) {
|
|
84
|
+
return new LazyPromise(async () => {
|
|
85
|
+
if (!Array.isArray(events)) {
|
|
86
|
+
events = [events];
|
|
87
|
+
}
|
|
88
|
+
if (isArrayEmpty(events)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
await this.eventBusAdapter.dispatch(events);
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
throw new DispatchEventBusError(`Events "${events.map((event) => event.type).join(", ")}" could not be dispatched`, error);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=event-bus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/event-bus/event-bus.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA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IAAI,CAAC,2BAA2B,EAClF,KAAK,CACR,CAAC;YACN,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class WithNamespaceEventBusAdapter {
|
|
2
|
+
eventBusAdapter;
|
|
3
|
+
namespace;
|
|
4
|
+
listenerMap = new Map();
|
|
5
|
+
constructor(eventBusAdapter, namespace) {
|
|
6
|
+
this.eventBusAdapter = eventBusAdapter;
|
|
7
|
+
this.namespace = namespace;
|
|
8
|
+
}
|
|
9
|
+
async addListener(event, listener) {
|
|
10
|
+
let wrappedListener = this.listenerMap.get(listener);
|
|
11
|
+
if (wrappedListener === undefined) {
|
|
12
|
+
wrappedListener = async (eventObj) => {
|
|
13
|
+
await listener({
|
|
14
|
+
...eventObj,
|
|
15
|
+
type: eventObj.type.slice(this.namespace.length),
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
this.listenerMap.set(listener, wrappedListener);
|
|
19
|
+
}
|
|
20
|
+
await this.eventBusAdapter.addListener(`${this.namespace}${event}`, wrappedListener);
|
|
21
|
+
}
|
|
22
|
+
async removeListener(event, listener) {
|
|
23
|
+
const wrappedListener = this.listenerMap.get(listener);
|
|
24
|
+
if (wrappedListener === undefined) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
await this.eventBusAdapter.removeListener(`${this.namespace}${event}`, wrappedListener);
|
|
28
|
+
this.listenerMap.delete(listener);
|
|
29
|
+
}
|
|
30
|
+
async dispatch(events) {
|
|
31
|
+
await this.eventBusAdapter.dispatch(events.map((event) => ({
|
|
32
|
+
...event,
|
|
33
|
+
type: `${this.namespace}${event.type}`,
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=with-namespace-event-bus-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-namespace-event-bus-adapter.js","sourceRoot":"","sources":["../../../../../src/event-bus/impl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CAAC,QAAQ,CAAC,MAAoB;QAC/B,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAC/B,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACnB,GAAG,KAAK;YACR,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE;SACzC,CAAC,CAAC,CACN,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export class WithValidationEventBusAdapter {
|
|
2
|
+
eventBusAdapter;
|
|
3
|
+
validator;
|
|
4
|
+
listenerMap = new Map();
|
|
5
|
+
constructor(eventBusAdapter, validator) {
|
|
6
|
+
this.eventBusAdapter = eventBusAdapter;
|
|
7
|
+
this.validator = validator;
|
|
8
|
+
}
|
|
9
|
+
async addListener(event, listener) {
|
|
10
|
+
let wrappedListener = this.listenerMap.get(listener);
|
|
11
|
+
if (wrappedListener === undefined) {
|
|
12
|
+
wrappedListener = async (event) => {
|
|
13
|
+
await listener(this.validator(event));
|
|
14
|
+
};
|
|
15
|
+
this.listenerMap.set(listener, wrappedListener);
|
|
16
|
+
}
|
|
17
|
+
await this.eventBusAdapter.addListener(event, wrappedListener);
|
|
18
|
+
}
|
|
19
|
+
async removeListener(event, listener) {
|
|
20
|
+
const wrappedListener = this.listenerMap.get(listener);
|
|
21
|
+
if (wrappedListener === undefined) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
await this.eventBusAdapter.removeListener(event, wrappedListener);
|
|
25
|
+
this.listenerMap.delete(listener);
|
|
26
|
+
}
|
|
27
|
+
async dispatch(events) {
|
|
28
|
+
await this.eventBusAdapter.dispatch(events.map(this.validator));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=with-validation-event-bus-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-validation-event-bus-adapter.js","sourceRoot":"","sources":["../../../../../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CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/memory-event-bus-adapter/_module.ts"],"names":[],"mappings":"AAAA,cAAc,8DAA8D,CAAC"}
|
package/dist/esm/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
export class MemoryEventBusAdapter {
|
|
3
|
+
eventEmiter;
|
|
4
|
+
constructor(eventEmiter = new EventEmitter()) {
|
|
5
|
+
this.eventEmiter = eventEmiter;
|
|
6
|
+
}
|
|
7
|
+
async addListener(event, listener) {
|
|
8
|
+
this.eventEmiter.addListener(event, listener);
|
|
9
|
+
}
|
|
10
|
+
async removeListener(event, listener) {
|
|
11
|
+
this.eventEmiter.removeListener(event, listener);
|
|
12
|
+
}
|
|
13
|
+
async dispatch(events) {
|
|
14
|
+
for (const event of events) {
|
|
15
|
+
this.eventEmiter.emit(event.type, event);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=memory-event-bus-adapter.js.map
|
package/dist/esm/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-event-bus-adapter.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,MAAM,OAAO,qBAAqB;IACD;IAA7B,YAA6B,cAAc,IAAI,YAAY,EAAE;QAAhC,gBAAW,GAAX,WAAW,CAAqB;IAAG,CAAC;IAGjE,KAAK,CAAC,WAAW,CACb,KAAa,EACb,QAA8B;QAG9B,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;IAGD,KAAK,CAAC,cAAc,CAChB,KAAa,EACb,QAA8B;QAG9B,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;IAGD,KAAK,CAAC,QAAQ,CAAC,MAAoB;QAC/B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/no-op-event-bus-adapter/_module.ts"],"names":[],"mappings":"AAAA,cAAc,6EAA6E,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class NoOpEventBusAdapter {
|
|
2
|
+
addListener(_event, _listener) {
|
|
3
|
+
return Promise.resolve();
|
|
4
|
+
}
|
|
5
|
+
removeListener(_event, _listener) {
|
|
6
|
+
return Promise.resolve();
|
|
7
|
+
}
|
|
8
|
+
dispatch(_events) {
|
|
9
|
+
return Promise.resolve();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=no-op-event-bus-adapter.js.map
|
package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-op-event-bus-adapter.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,mBAAmB;IAC5B,WAAW,CACP,MAAc,EACd,SAA+B;QAE/B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,cAAc,CACV,MAAc,EACd,SAA+B;QAE/B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,QAAQ,CAAC,OAAqB;QAC1B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/redis-event-bus-adapter/_module.ts"],"names":[],"mappings":"AAAA,cAAc,8DAA8D,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { RedisSerializer, SuperJsonSerializer, } from "../../../serializer/implementations/_module";
|
|
2
|
+
import { LazyPromise } from "../../../utilities/_module";
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
4
|
+
export class RedisEventBusAdapter {
|
|
5
|
+
serializer;
|
|
6
|
+
dispatcherClient;
|
|
7
|
+
listenerClient;
|
|
8
|
+
eventEmitter = new EventEmitter();
|
|
9
|
+
constructor({ dispatcherClient, listenerClient, serializer = new SuperJsonSerializer(), }) {
|
|
10
|
+
this.dispatcherClient = dispatcherClient;
|
|
11
|
+
this.listenerClient = listenerClient;
|
|
12
|
+
this.serializer = new RedisSerializer(serializer);
|
|
13
|
+
}
|
|
14
|
+
redisListener = async (channel, message) => {
|
|
15
|
+
this.eventEmitter.emit(channel, await this.serializer.deserialize(message));
|
|
16
|
+
};
|
|
17
|
+
async addListener(event, listener) {
|
|
18
|
+
await this.listenerClient.subscribe(event);
|
|
19
|
+
this.listenerClient.on("message", this.redisListener);
|
|
20
|
+
this.eventEmitter.on(event, listener);
|
|
21
|
+
}
|
|
22
|
+
async removeListener(event, listener) {
|
|
23
|
+
await this.listenerClient.unsubscribe(event);
|
|
24
|
+
this.eventEmitter.off(event, listener);
|
|
25
|
+
let totalListenerCount = 0;
|
|
26
|
+
for (const event of this.eventEmitter.eventNames()) {
|
|
27
|
+
totalListenerCount += this.eventEmitter.listenerCount(event);
|
|
28
|
+
}
|
|
29
|
+
if (totalListenerCount === 0) {
|
|
30
|
+
this.listenerClient.off("message", this.redisListener);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async dispatch(events) {
|
|
34
|
+
const promises = [];
|
|
35
|
+
for (const event of events) {
|
|
36
|
+
promises.push(new LazyPromise(async () => this.dispatcherClient.publish(event.type, await this.serializer.serialize(event))));
|
|
37
|
+
}
|
|
38
|
+
await Promise.all(promises);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=redis-event-bus-adapter.js.map
|
package/dist/esm/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-event-bus-adapter.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,eAAe,EACf,mBAAmB,GACtB,MAAM,sCAAsC,CAAC;AAO9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAc3C,MAAM,OAAO,oBAAoB;IACZ,UAAU,CAAsB;IAChC,gBAAgB,CAAQ;IACxB,cAAc,CAAQ;IACtB,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;IAEnD,YAAY,EACR,gBAAgB,EAChB,cAAc,EACd,UAAU,GAAG,IAAI,mBAAmB,EAAE,GACX;QAC3B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;IACtD,CAAC;IAEO,aAAa,GAAG,KAAK,EAAE,OAAe,EAAE,OAAe,EAAE,EAAE;QAC/D,IAAI,CAAC,YAAY,CAAC,IAAI,CAClB,OAAO,EACP,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAC7C,CAAC;IACN,CAAC,CAAC;IA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AC;IAChC,CAAC;CACJ"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from "../../storage/contracts/_shared";
|
|
2
2
|
export * from "../../storage/contracts/storage.contract";
|
|
3
3
|
export * from "../../storage/contracts/storage-adapter.contract";
|
|
4
|
+
export * from "../../storage/contracts/storage-events.contract";
|
|
5
|
+
export * from "../../storage/contracts/storage-manager.contract";
|
|
4
6
|
//# sourceMappingURL=_module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/storage/contracts/_module.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AACrD,cAAc,8CAA8C,CAAC"}
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/storage/contracts/_module.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AACrD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8CAA8C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const STORAGE_EVENTS = {
|
|
2
|
+
KEYS_FOUND: "keys_found",
|
|
3
|
+
KEYS_NOT_FOUND: "keys_not_found",
|
|
4
|
+
KEYS_ADDED: "keys_added",
|
|
5
|
+
KEYS_UPDATED: "keys_updated",
|
|
6
|
+
KEYS_REMOVED: "keys_removed",
|
|
7
|
+
KEYS_CLEARED: "keys_cleared",
|
|
8
|
+
KEY_INCREMENTED: "key_incremented",
|
|
9
|
+
KEY_DECREMENTED: "key_decremented",
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=storage-events.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-events.contract.js","sourceRoot":"","sources":["../../../../src/storage/contracts/storage-events.contract.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;CAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=storage-manager.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-manager.contract.js","sourceRoot":"","sources":["../../../../src/storage/contracts/storage-manager.contract.ts"],"names":[],"mappings":""}
|
package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js
CHANGED
|
@@ -1,7 +1,295 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { storageAdapterApiTestSuite } from "../../../../storage/implementations/_shared/test-utilities/storage-adapter-api.test-suite";
|
|
1
|
+
import { TypeStorageError, } from "../../../../storage/contracts/_module";
|
|
3
2
|
export function storageTestSuite(settings) {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const { expect, test, createAdapter, describe, beforeEach } = settings;
|
|
4
|
+
let storageAdapter;
|
|
5
|
+
beforeEach(async () => {
|
|
6
|
+
storageAdapter = await createAdapter();
|
|
7
|
+
});
|
|
8
|
+
describe("method: getMany", () => {
|
|
9
|
+
test("Should return only values when all keys exists", async () => {
|
|
10
|
+
await storageAdapter.addMany({
|
|
11
|
+
a: 1,
|
|
12
|
+
b: 1,
|
|
13
|
+
});
|
|
14
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
15
|
+
a: 1,
|
|
16
|
+
b: 1,
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
test("Should return only null when all keys doesnt exists", async () => {
|
|
20
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
21
|
+
a: null,
|
|
22
|
+
b: null,
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
test("Should return values and null when some keys exists", async () => {
|
|
26
|
+
await storageAdapter.addMany({ a: 1 });
|
|
27
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
28
|
+
a: 1,
|
|
29
|
+
b: null,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe("method: addMany", () => {
|
|
34
|
+
test("Should return only true when all keys doesnt exists", async () => {
|
|
35
|
+
expect(await storageAdapter.addMany({
|
|
36
|
+
a: 1,
|
|
37
|
+
b: 1,
|
|
38
|
+
})).toEqual({
|
|
39
|
+
a: true,
|
|
40
|
+
b: true,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
test("Should persist values when all keys doesnt exist", async () => {
|
|
44
|
+
await storageAdapter.addMany({
|
|
45
|
+
a: 1,
|
|
46
|
+
b: 1,
|
|
47
|
+
});
|
|
48
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
49
|
+
a: 1,
|
|
50
|
+
b: 1,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
test("Should return only false when all keys exists", async () => {
|
|
54
|
+
await storageAdapter.addMany({
|
|
55
|
+
a: 1,
|
|
56
|
+
b: 1,
|
|
57
|
+
});
|
|
58
|
+
expect(await storageAdapter.addMany({
|
|
59
|
+
a: 1,
|
|
60
|
+
b: 1,
|
|
61
|
+
})).toEqual({
|
|
62
|
+
a: false,
|
|
63
|
+
b: false,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
test("Should not persist values when key exist", async () => {
|
|
67
|
+
await storageAdapter.addMany({
|
|
68
|
+
a: 1,
|
|
69
|
+
b: 1,
|
|
70
|
+
});
|
|
71
|
+
await storageAdapter.addMany({
|
|
72
|
+
a: 2,
|
|
73
|
+
b: 2,
|
|
74
|
+
});
|
|
75
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
76
|
+
a: 1,
|
|
77
|
+
b: 1,
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
test("Should return true and false when some keys exists", async () => {
|
|
81
|
+
await storageAdapter.addMany({ a: 1 });
|
|
82
|
+
expect(await storageAdapter.addMany({
|
|
83
|
+
a: 1,
|
|
84
|
+
b: 1,
|
|
85
|
+
})).toEqual({
|
|
86
|
+
a: false,
|
|
87
|
+
b: true,
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
test("Should persist and not persist values when some keys exists", async () => {
|
|
91
|
+
await storageAdapter.addMany({
|
|
92
|
+
a: 1,
|
|
93
|
+
});
|
|
94
|
+
await storageAdapter.addMany({
|
|
95
|
+
a: 2,
|
|
96
|
+
b: 2,
|
|
97
|
+
});
|
|
98
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
99
|
+
a: 1,
|
|
100
|
+
b: 2,
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
describe("method: updateMany", () => {
|
|
105
|
+
test("Should return only true when all keys exists", async () => {
|
|
106
|
+
await storageAdapter.addMany({
|
|
107
|
+
a: 1,
|
|
108
|
+
b: 1,
|
|
109
|
+
});
|
|
110
|
+
expect(await storageAdapter.updateMany({ a: -1, b: -1 })).toEqual({
|
|
111
|
+
a: true,
|
|
112
|
+
b: true,
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
test("Should persist values when all keys exist", async () => {
|
|
116
|
+
await storageAdapter.addMany({
|
|
117
|
+
a: 1,
|
|
118
|
+
b: 1,
|
|
119
|
+
});
|
|
120
|
+
await storageAdapter.updateMany({ a: -1, b: -1 });
|
|
121
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
122
|
+
a: -1,
|
|
123
|
+
b: -1,
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
test("Should return only false when all keys doesnt exists", async () => {
|
|
127
|
+
expect(await storageAdapter.updateMany({ a: -1, b: -1 })).toEqual({
|
|
128
|
+
a: false,
|
|
129
|
+
b: false,
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
test("Should not persist values when all keys doesnt exist", async () => {
|
|
133
|
+
await storageAdapter.updateMany({ a: -1, b: -1 });
|
|
134
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
135
|
+
a: null,
|
|
136
|
+
b: null,
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
test("Should return true and false when some keys exists", async () => {
|
|
140
|
+
await storageAdapter.addMany({ a: 1 });
|
|
141
|
+
expect(await storageAdapter.updateMany({ a: -1, b: -1 })).toEqual({
|
|
142
|
+
a: true,
|
|
143
|
+
b: false,
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
test("Should persist and not persist values when some keys exists", async () => {
|
|
147
|
+
await storageAdapter.addMany({ a: 1 });
|
|
148
|
+
await storageAdapter.updateMany({ a: -1, b: -1 });
|
|
149
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
150
|
+
a: -1,
|
|
151
|
+
b: null,
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
describe("method: putMany", () => {
|
|
156
|
+
test("Should return only true when all keys exists", async () => {
|
|
157
|
+
await storageAdapter.addMany({
|
|
158
|
+
a: 1,
|
|
159
|
+
b: 1,
|
|
160
|
+
});
|
|
161
|
+
expect(await storageAdapter.putMany({ a: -1, b: -1 })).toEqual({
|
|
162
|
+
a: true,
|
|
163
|
+
b: true,
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
test("Should persist values when all keys exist", async () => {
|
|
167
|
+
await storageAdapter.addMany({
|
|
168
|
+
a: 1,
|
|
169
|
+
b: 1,
|
|
170
|
+
});
|
|
171
|
+
await storageAdapter.putMany({ a: -1, b: -1 });
|
|
172
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
173
|
+
a: -1,
|
|
174
|
+
b: -1,
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
test("Should return only false when all keys doesnt exists", async () => {
|
|
178
|
+
expect(await storageAdapter.putMany({ a: -1, b: -1 })).toEqual({
|
|
179
|
+
a: false,
|
|
180
|
+
b: false,
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
test("Should persist values when all keys doesnt exist", async () => {
|
|
184
|
+
await storageAdapter.putMany({ a: -1, b: -1 });
|
|
185
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
186
|
+
a: -1,
|
|
187
|
+
b: -1,
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
test("Should return true and false when some keys exists", async () => {
|
|
191
|
+
await storageAdapter.addMany({ a: 1 });
|
|
192
|
+
expect(await storageAdapter.putMany({ a: -1, b: -1 })).toEqual({
|
|
193
|
+
a: true,
|
|
194
|
+
b: false,
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
test("Should persist all values when some keys exists", async () => {
|
|
198
|
+
await storageAdapter.addMany({ a: 1 });
|
|
199
|
+
await storageAdapter.putMany({ a: -1, b: -1 });
|
|
200
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
201
|
+
a: -1,
|
|
202
|
+
b: -1,
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
describe("method: removeMany", () => {
|
|
207
|
+
test("Should return only true when all keys exists", async () => {
|
|
208
|
+
await storageAdapter.addMany({
|
|
209
|
+
a: 1,
|
|
210
|
+
b: 1,
|
|
211
|
+
});
|
|
212
|
+
expect(await storageAdapter.removeMany(["a", "b"])).toEqual({
|
|
213
|
+
a: true,
|
|
214
|
+
b: true,
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
test("Should persist values when all keys exist", async () => {
|
|
218
|
+
await storageAdapter.addMany({
|
|
219
|
+
a: 1,
|
|
220
|
+
b: 1,
|
|
221
|
+
});
|
|
222
|
+
await storageAdapter.removeMany(["a", "b"]);
|
|
223
|
+
expect(await storageAdapter.getMany(["a", "b"])).toEqual({
|
|
224
|
+
a: null,
|
|
225
|
+
b: null,
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
test("Should return only false when all keys doesnt exists", async () => {
|
|
229
|
+
expect(await storageAdapter.removeMany(["a", "b"])).toEqual({
|
|
230
|
+
a: false,
|
|
231
|
+
b: false,
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
test("Should return true and false when some keys exists", async () => {
|
|
235
|
+
await storageAdapter.addMany({ a: 1 });
|
|
236
|
+
expect(await storageAdapter.removeMany(["a", "b"])).toEqual({
|
|
237
|
+
a: true,
|
|
238
|
+
b: false,
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
describe("method: increment", () => {
|
|
243
|
+
test("Should return true when key exists", async () => {
|
|
244
|
+
await storageAdapter.addMany({ a: 1 });
|
|
245
|
+
expect(await storageAdapter.increment("a", 1)).toBe(true);
|
|
246
|
+
});
|
|
247
|
+
test("Should persist increment when key exists", async () => {
|
|
248
|
+
await storageAdapter.addMany({ a: 1 });
|
|
249
|
+
await storageAdapter.increment("a", 1);
|
|
250
|
+
expect(await storageAdapter.getMany(["a"])).toEqual({ a: 2 });
|
|
251
|
+
});
|
|
252
|
+
test("Should return false when key doesnt exists", async () => {
|
|
253
|
+
expect(await storageAdapter.increment("a", 1)).toBe(false);
|
|
254
|
+
});
|
|
255
|
+
test("Should not persist increment when key doesnt exists", async () => {
|
|
256
|
+
await storageAdapter.increment("a", 1);
|
|
257
|
+
expect(await storageAdapter.getMany(["a"])).toEqual({
|
|
258
|
+
a: null,
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
test("Should throw TypeStorageError key value is not number type", async () => {
|
|
262
|
+
await storageAdapter.addMany({ a: "str" });
|
|
263
|
+
await expect(storageAdapter.increment("a", 1)).rejects.toBeInstanceOf(TypeStorageError);
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
describe("method: clear", () => {
|
|
267
|
+
test("Should remove all keys", async () => {
|
|
268
|
+
await storageAdapter.addMany({
|
|
269
|
+
"@a/a": 1,
|
|
270
|
+
"@a/b": 2,
|
|
271
|
+
"@a/c": 3,
|
|
272
|
+
"@b/d": 4,
|
|
273
|
+
"@b/e": 5,
|
|
274
|
+
"@b/f": 6,
|
|
275
|
+
});
|
|
276
|
+
await storageAdapter.clear("@a/");
|
|
277
|
+
expect(await storageAdapter.getMany([
|
|
278
|
+
"@a/a",
|
|
279
|
+
"@a/b",
|
|
280
|
+
"@a/c",
|
|
281
|
+
"@b/d",
|
|
282
|
+
"@b/e",
|
|
283
|
+
"@b/f",
|
|
284
|
+
])).toEqual({
|
|
285
|
+
"@a/a": null,
|
|
286
|
+
"@a/b": null,
|
|
287
|
+
"@a/c": null,
|
|
288
|
+
"@b/d": 4,
|
|
289
|
+
"@b/e": 5,
|
|
290
|
+
"@b/f": 6,
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
});
|
|
6
294
|
}
|
|
7
295
|
//# sourceMappingURL=storage-adapter.test-suite.js.map
|