@daiso-tech/core 0.33.0 → 0.35.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/README.md +66 -45
- package/dist/async/_module-exports.d.ts +1 -1
- package/dist/async/_module-exports.js +1 -1
- package/dist/async/_module-exports.js.map +1 -1
- package/dist/async/async.errors.d.ts +27 -19
- package/dist/async/async.errors.js +33 -20
- package/dist/async/async.errors.js.map +1 -1
- package/dist/async/backof-policies/_shared.d.ts +6 -2
- package/dist/async/backof-policies/_shared.js +1 -0
- package/dist/async/backof-policies/_shared.js.map +1 -1
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +1 -1
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +1 -1
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +1 -1
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +1 -1
- package/dist/async/middlewares/_module.d.ts +8 -0
- package/dist/async/middlewares/_module.js +9 -0
- package/dist/async/middlewares/_module.js.map +1 -0
- package/dist/async/middlewares/_shared.d.ts +10 -0
- package/dist/async/middlewares/_shared.js +5 -0
- package/dist/async/middlewares/_shared.js.map +1 -0
- package/dist/async/middlewares/bulkhead/_module.d.ts +1 -0
- package/dist/async/middlewares/bulkhead/_module.js +2 -0
- package/dist/async/middlewares/bulkhead/_module.js.map +1 -0
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.d.ts +80 -0
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.js +46 -0
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.js.map +1 -0
- package/dist/async/middlewares/dynamic/_module.d.ts +1 -0
- package/dist/async/middlewares/dynamic/_module.js +2 -0
- package/dist/async/middlewares/dynamic/_module.js.map +1 -0
- package/dist/async/middlewares/dynamic/dynamic.middleware.d.ts +34 -0
- package/dist/async/middlewares/dynamic/dynamic.middleware.js +36 -0
- package/dist/async/middlewares/dynamic/dynamic.middleware.js.map +1 -0
- package/dist/async/middlewares/fallback/_module.d.ts +1 -0
- package/dist/async/middlewares/fallback/_module.js +2 -0
- package/dist/async/middlewares/fallback/_module.js.map +1 -0
- package/dist/async/middlewares/fallback/fallback.middleware.d.ts +78 -0
- package/dist/async/middlewares/fallback/fallback.middleware.js +52 -0
- package/dist/async/middlewares/fallback/fallback.middleware.js.map +1 -0
- package/dist/async/middlewares/hedging/_module.d.ts +2 -0
- package/dist/async/middlewares/hedging/_module.js +3 -0
- package/dist/async/middlewares/hedging/_module.js.map +1 -0
- package/dist/async/middlewares/hedging/_shared.d.ts +93 -0
- package/dist/async/middlewares/hedging/_shared.js +5 -0
- package/dist/async/middlewares/hedging/_shared.js.map +1 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/_module.d.ts +1 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/_module.js +2 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/_module.js.map +1 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.d.ts +51 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js +138 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js.map +1 -0
- package/dist/async/middlewares/hedging/sequential-hedging/_module.d.ts +1 -0
- package/dist/async/middlewares/hedging/sequential-hedging/_module.js +2 -0
- package/dist/async/middlewares/hedging/sequential-hedging/_module.js.map +1 -0
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.d.ts +51 -0
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js +104 -0
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js.map +1 -0
- package/dist/async/middlewares/observe/_module.d.ts +1 -0
- package/dist/async/middlewares/observe/_module.js +2 -0
- package/dist/async/middlewares/observe/_module.js.map +1 -0
- package/dist/async/middlewares/observe/observe.middleware.d.ts +130 -0
- package/dist/async/middlewares/observe/observe.middleware.js +80 -0
- package/dist/async/middlewares/observe/observe.middleware.js.map +1 -0
- package/dist/async/middlewares/retry/_module.d.ts +1 -0
- package/dist/async/middlewares/retry/_module.js +2 -0
- package/dist/async/middlewares/retry/_module.js.map +1 -0
- package/dist/async/middlewares/retry/retry.middleware.d.ts +117 -0
- package/dist/async/middlewares/retry/retry.middleware.js +82 -0
- package/dist/async/middlewares/retry/retry.middleware.js.map +1 -0
- package/dist/async/middlewares/timeout/_module.d.ts +1 -0
- package/dist/async/middlewares/timeout/_module.js +2 -0
- package/dist/async/middlewares/timeout/_module.js.map +1 -0
- package/dist/async/middlewares/timeout/timeout.middleware.d.ts +83 -0
- package/dist/async/middlewares/timeout/timeout.middleware.js +60 -0
- package/dist/async/middlewares/timeout/timeout.middleware.js.map +1 -0
- package/dist/async/utilities/_module.d.ts +3 -4
- package/dist/async/utilities/_module.js +3 -4
- package/dist/async/utilities/_module.js.map +1 -1
- package/dist/async/utilities/abort-and-fail/_module.d.ts +1 -0
- package/dist/async/utilities/abort-and-fail/_module.js +2 -0
- package/dist/async/utilities/abort-and-fail/_module.js.map +1 -0
- package/dist/async/utilities/abort-and-fail/abort-and-fail.d.ts +7 -0
- package/dist/async/utilities/{abort → abort-and-fail}/abort-and-fail.js +6 -6
- package/dist/async/utilities/abort-and-fail/abort-and-fail.js.map +1 -0
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +37 -194
- package/dist/async/utilities/lazy-promise/lazy-promise.js +62 -359
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/async/utilities/promise-queue/_module.d.ts +1 -0
- package/dist/async/utilities/promise-queue/_module.js +2 -0
- package/dist/async/utilities/promise-queue/_module.js.map +1 -0
- package/dist/async/utilities/promise-queue/promise-queue.d.ts +32 -0
- package/dist/async/utilities/promise-queue/promise-queue.js +107 -0
- package/dist/async/utilities/promise-queue/promise-queue.js.map +1 -0
- package/dist/async/utilities/timeout-and-fail/_module.d.ts +1 -0
- package/dist/async/utilities/timeout-and-fail/_module.js +2 -0
- package/dist/async/utilities/timeout-and-fail/_module.js.map +1 -0
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.d.ts +7 -0
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js +19 -0
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js.map +1 -0
- package/dist/cache/contracts/cache-adapter.contract.d.ts +14 -14
- package/dist/cache/contracts/cache-factory.contract.d.ts +3 -3
- package/dist/cache/contracts/cache.contract.d.ts +73 -73
- package/dist/cache/contracts/cache.errors.d.ts +7 -7
- package/dist/cache/contracts/cache.errors.js +7 -7
- package/dist/cache/contracts/cache.events.d.ts +54 -58
- package/dist/cache/contracts/cache.events.js +6 -104
- package/dist/cache/contracts/cache.events.js.map +1 -1
- package/dist/cache/contracts/database-cache-adapter.contract.d.ts +16 -16
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +3 -3
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +3 -9
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +3 -9
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +4 -4
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +3 -3
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +2 -2
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +3 -3
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +3 -3
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +2 -2
- package/dist/cache/implementations/derivables/cache/cache.d.ts +26 -27
- package/dist/cache/implementations/derivables/cache/cache.js +102 -91
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +5 -4
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +2 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +3 -3
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +2 -2
- package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +3 -3
- package/dist/cache/implementations/test-utilities/cache.test-suite.js +140 -149
- package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.d.ts +3 -3
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +2 -2
- package/dist/collection/contracts/_shared/compartor.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/cross-join-result.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/ensure-map.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/ensure-record.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/foreach.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/map.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/modifier.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/predicate.type.d.ts +7 -7
- package/dist/collection/contracts/_shared/reduce.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/tap.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/transform.type.d.ts +2 -2
- package/dist/collection/contracts/async-collection.contract.d.ts +109 -198
- package/dist/collection/contracts/collection.contract.d.ts +103 -103
- package/dist/collection/contracts/collection.errors.d.ts +11 -11
- package/dist/collection/contracts/collection.errors.js +11 -11
- package/dist/collection/implementations/_shared.d.ts +8 -8
- package/dist/collection/implementations/_shared.js +8 -8
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.d.ts +0 -4
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.js +0 -4
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js +21 -19
- package/dist/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +15 -19
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +15 -30
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.d.ts +3 -3
- package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.js +18 -20
- package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +11 -12
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +11 -12
- package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/collection/implementations/list-collection/list-collection.d.ts +11 -11
- package/dist/collection/implementations/list-collection/list-collection.js +24 -30
- package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/event-bus/contracts/_module-exports.d.ts +0 -1
- package/dist/event-bus/contracts/_module-exports.js +0 -1
- package/dist/event-bus/contracts/_module-exports.js.map +1 -1
- package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +13 -8
- package/dist/event-bus/contracts/event-bus-factory.contract.d.ts +6 -7
- package/dist/event-bus/contracts/event-bus-factory.contract.js.map +1 -1
- package/dist/event-bus/contracts/event-bus.contract.d.ts +30 -41
- package/dist/event-bus/contracts/event-bus.errors.d.ts +8 -8
- package/dist/event-bus/contracts/event-bus.errors.js +8 -8
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +3 -3
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +3 -3
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +2 -2
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +2 -2
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +3 -3
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +2 -2
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +15 -15
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +32 -32
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +17 -10
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +13 -6
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.d.ts +3 -5
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +15 -22
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +3 -5
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +189 -209
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/lock/contracts/database-lock-adapter.contract.d.ts +9 -9
- package/dist/lock/contracts/lock-adapter.contract.d.ts +7 -7
- package/dist/lock/contracts/lock-provider-factory.contract.d.ts +4 -4
- package/dist/lock/contracts/lock-provider.contract.d.ts +14 -14
- package/dist/lock/contracts/lock.contract.d.ts +22 -22
- package/dist/lock/contracts/lock.errors.d.ts +10 -10
- package/dist/lock/contracts/lock.errors.js +10 -10
- package/dist/lock/contracts/lock.events.d.ts +45 -54
- package/dist/lock/contracts/lock.events.js +9 -91
- package/dist/lock/contracts/lock.events.js.map +1 -1
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +5 -5
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +4 -4
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +3 -3
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +3 -3
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +5 -5
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +4 -4
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +2 -2
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +2 -2
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +3 -3
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +3 -3
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +5 -5
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +4 -4
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +33 -33
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +30 -30
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +2 -2
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +3 -3
- package/dist/lock/implementations/derivables/lock-provider/lock.js +77 -58
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +5 -4
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +2 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +3 -3
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +2 -2
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +3 -3
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +2 -2
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +3 -3
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +214 -214
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/serde/contracts/deserializer.contract.d.ts +2 -2
- package/dist/serde/contracts/flexible-serde-adapter.contract.d.ts +4 -4
- package/dist/serde/contracts/flexible-serde.contract.d.ts +8 -19
- package/dist/serde/contracts/serde.contract.d.ts +2 -2
- package/dist/serde/contracts/serde.errors.d.ts +4 -4
- package/dist/serde/contracts/serde.errors.js +4 -4
- package/dist/serde/contracts/serializable.contract.d.ts +2 -2
- package/dist/serde/contracts/serializer.contract.d.ts +2 -2
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +2 -2
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +2 -2
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.d.ts +1 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +1 -1
- package/dist/serde/implementations/derivables/serde.d.ts +4 -35
- package/dist/serde/implementations/derivables/serde.js +2 -47
- package/dist/serde/implementations/derivables/serde.js.map +1 -1
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.d.ts +3 -3
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +2 -2
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +3 -3
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +2 -2
- package/dist/utilities/classes/_module.d.ts +1 -1
- package/dist/utilities/classes/_module.js +1 -1
- package/dist/utilities/classes/_module.js.map +1 -1
- package/dist/utilities/classes/hooks/_module.d.ts +3 -0
- package/dist/utilities/classes/hooks/_module.js +4 -0
- package/dist/utilities/classes/hooks/_module.js.map +1 -0
- package/dist/utilities/classes/hooks/async-hooks.d.ts +209 -0
- package/dist/utilities/classes/hooks/async-hooks.js +145 -0
- package/dist/utilities/classes/hooks/async-hooks.js.map +1 -0
- package/dist/utilities/classes/hooks/hooks.d.ts +139 -0
- package/dist/utilities/classes/hooks/hooks.js +116 -0
- package/dist/utilities/classes/hooks/hooks.js.map +1 -0
- package/dist/utilities/classes/hooks/types.d.ts +9 -0
- package/dist/utilities/classes/hooks/types.js +5 -0
- package/dist/utilities/classes/hooks/types.js.map +1 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +3 -3
- package/dist/utilities/classes/key-prefixer/key-prefixer.js +4 -4
- package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
- package/dist/utilities/classes/time-span/time-span.d.ts +5 -5
- package/dist/utilities/classes/time-span/time-span.js +5 -5
- package/dist/utilities/contracts/_module.d.ts +0 -1
- package/dist/utilities/contracts/_module.js +0 -1
- package/dist/utilities/contracts/_module.js.map +1 -1
- package/dist/utilities/contracts/deinitizable.contract.d.ts +1 -1
- package/dist/utilities/contracts/initizable.contract.d.ts +1 -1
- package/dist/utilities/contracts/prunable.contract.d.ts +1 -1
- package/dist/utilities/contracts/serialized-error.contract.d.ts +1 -1
- package/dist/utilities/contracts/sqlite-database.contract.d.ts +2 -2
- package/dist/utilities/errors.d.ts +5 -5
- package/dist/utilities/errors.js +5 -5
- package/dist/utilities/functions/factory.js +3 -3
- package/dist/utilities/functions/factory.js.map +1 -1
- package/dist/utilities/functions/invokable.d.ts +9 -5
- package/dist/utilities/functions/invokable.js +12 -2
- package/dist/utilities/functions/invokable.js.map +1 -1
- package/dist/utilities/functions/lazy.d.ts +5 -0
- package/dist/utilities/functions/lazy.js +12 -3
- package/dist/utilities/functions/lazy.js.map +1 -1
- package/dist/utilities/types/async-iterable-value.type.d.ts +1 -1
- package/dist/utilities/types/at-least-one.type.d.ts +1 -1
- package/dist/utilities/types/factory.type.d.ts +8 -8
- package/dist/utilities/types/invokable.type.d.ts +3 -3
- package/dist/utilities/types/items.type.d.ts +1 -1
- package/dist/utilities/types/lazy.type.d.ts +5 -5
- package/dist/utilities/types/none-func.type.d.ts +1 -1
- package/dist/utilities/types/one-or-more.type.d.ts +1 -1
- package/dist/utilities/types/promiseable.type.d.ts +1 -1
- package/dist/utilities/types/result.type.d.ts +1 -1
- package/package.json +22 -2
- package/dist/async/async.events.d.ts +0 -105
- package/dist/async/async.events.js +0 -82
- package/dist/async/async.events.js.map +0 -1
- package/dist/async/utilities/abort/_module.d.ts +0 -2
- package/dist/async/utilities/abort/_module.js +0 -3
- package/dist/async/utilities/abort/_module.js.map +0 -1
- package/dist/async/utilities/abort/abort-and-fail.d.ts +0 -4
- package/dist/async/utilities/abort/abort-and-fail.js.map +0 -1
- package/dist/async/utilities/abort/abort.d.ts +0 -9
- package/dist/async/utilities/abort/abort.js +0 -18
- package/dist/async/utilities/abort/abort.js.map +0 -1
- package/dist/async/utilities/delay/_module.d.ts +0 -1
- package/dist/async/utilities/delay/_module.js +0 -2
- package/dist/async/utilities/delay/_module.js.map +0 -1
- package/dist/async/utilities/delay/delay.d.ts +0 -10
- package/dist/async/utilities/delay/delay.js +0 -34
- package/dist/async/utilities/delay/delay.js.map +0 -1
- package/dist/async/utilities/retry/_module.d.ts +0 -2
- package/dist/async/utilities/retry/_module.js +0 -3
- package/dist/async/utilities/retry/_module.js.map +0 -1
- package/dist/async/utilities/retry/retry-or-fail.d.ts +0 -29
- package/dist/async/utilities/retry/retry-or-fail.js +0 -39
- package/dist/async/utilities/retry/retry-or-fail.js.map +0 -1
- package/dist/async/utilities/retry/retry.d.ts +0 -10
- package/dist/async/utilities/retry/retry.js +0 -21
- package/dist/async/utilities/retry/retry.js.map +0 -1
- package/dist/async/utilities/timeout/_module.d.ts +0 -2
- package/dist/async/utilities/timeout/_module.js +0 -3
- package/dist/async/utilities/timeout/_module.js.map +0 -1
- package/dist/async/utilities/timeout/timeout-and-fail.d.ts +0 -5
- package/dist/async/utilities/timeout/timeout-and-fail.js +0 -28
- package/dist/async/utilities/timeout/timeout-and-fail.js.map +0 -1
- package/dist/async/utilities/timeout/timeout.d.ts +0 -10
- package/dist/async/utilities/timeout/timeout.js +0 -21
- package/dist/async/utilities/timeout/timeout.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.d.ts +0 -13
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +0 -30
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.d.ts +0 -13
- package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +0 -36
- package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.d.ts +0 -9
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +0 -39
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.d.ts +0 -13
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +0 -52
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +0 -1
- package/dist/event-bus/contracts/_shared.d.ts +0 -12
- package/dist/event-bus/contracts/_shared.js +0 -15
- package/dist/event-bus/contracts/_shared.js.map +0 -1
- package/dist/utilities/classes/sync-event-bus/_module.d.ts +0 -1
- package/dist/utilities/classes/sync-event-bus/_module.js +0 -2
- package/dist/utilities/classes/sync-event-bus/_module.js.map +0 -1
- package/dist/utilities/classes/sync-event-bus/sync-event-bus.d.ts +0 -16
- package/dist/utilities/classes/sync-event-bus/sync-event-bus.js +0 -53
- package/dist/utilities/classes/sync-event-bus/sync-event-bus.js.map +0 -1
- package/dist/utilities/contracts/sync-event-bus-listenable.d.ts +0 -13
- package/dist/utilities/contracts/sync-event-bus-listenable.js +0 -5
- package/dist/utilities/contracts/sync-event-bus-listenable.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Async
|
|
3
|
+
*/
|
|
4
|
+
import { callInvokable, TimeSpan, } from "../../../utilities/_module-exports.js";
|
|
5
|
+
import { PromiseQueue } from "../../../async/utilities/_module.js";
|
|
6
|
+
/**
|
|
7
|
+
* The `bulkhead` middlewares ensures that a given amount of {@link Promiselike | `PromiseLike`} objects run at the same time concurrently and the rest will be queued up.
|
|
8
|
+
* You can provide {@link BulkheadSettings | `settings.maxCapacity`}
|
|
9
|
+
*
|
|
10
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
11
|
+
* @group Middleware
|
|
12
|
+
* @throws {CapacityFullAsyncError} {@link CapacityFullAsyncError}
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { bulkhead } from "@daiso-tech/core/async";
|
|
15
|
+
* import { AsyncHooks } from "@daiso-tech/core/utilities";
|
|
16
|
+
*
|
|
17
|
+
* const fetchData = new AsyncHooks(async (url: string): Promise<unknown> => {
|
|
18
|
+
* const response = await fetch(url);
|
|
19
|
+
* const json = await response.json();
|
|
20
|
+
* return json;
|
|
21
|
+
* }, [
|
|
22
|
+
* bulkhead()
|
|
23
|
+
* ]);
|
|
24
|
+
*
|
|
25
|
+
* // Will run only 25 promises concurrently by default.
|
|
26
|
+
* await Promise.all(Array(50).fill("").map(() => fetchData.invoke("URL")));
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function bulkhead(settings = {}) {
|
|
30
|
+
const { maxConcurrency = 25, maxCapacity = null, interval = TimeSpan.fromMilliseconds(0), onProcessing = () => { }, } = settings;
|
|
31
|
+
const promiseQueue = new PromiseQueue({
|
|
32
|
+
maxCapacity,
|
|
33
|
+
maxConcurrency,
|
|
34
|
+
interval,
|
|
35
|
+
});
|
|
36
|
+
return async (args, next, { context, signal }) => {
|
|
37
|
+
return await promiseQueue.add(() => {
|
|
38
|
+
callInvokable(onProcessing, {
|
|
39
|
+
args,
|
|
40
|
+
context,
|
|
41
|
+
});
|
|
42
|
+
return next(...args);
|
|
43
|
+
}, signal);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=bulkhead.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulkhead.middleware.js","sourceRoot":"","sources":["../../../../src/async/middlewares/bulkhead/bulkhead.middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,aAAa,EACb,QAAQ,GAIX,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAwE5D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,QAAQ,CAKpB,WAAoD,EAAE;IAEtD,MAAM,EACF,cAAc,GAAG,EAAE,EACnB,WAAW,GAAG,IAAI,EAClB,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,EACvC,YAAY,GAAG,GAAG,EAAE,GAAE,CAAC,GAC1B,GAAG,QAAQ,CAAC;IACb,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC;QAClC,WAAW;QACX,cAAc;QACd,QAAQ;KACX,CAAC,CAAC;IACH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC7C,OAAO,MAAM,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE;YAC/B,aAAa,CAAC,YAAY,EAAE;gBACxB,IAAI;gBACJ,OAAO;aACV,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QACzB,CAAC,EAAE,MAAM,CAAC,CAAC;IACf,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../async/middlewares/dynamic/dynamic.middleware.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/middlewares/dynamic/_module.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Async
|
|
3
|
+
*/
|
|
4
|
+
import type { HookContext, AsyncMiddleware } from "../../../utilities/_module-exports.js";
|
|
5
|
+
import { type AsyncMiddlewareFn, type Invokable } from "../../../utilities/_module-exports.js";
|
|
6
|
+
/**
|
|
7
|
+
* The `dynamic` is wrapper middleware that allows configuration of other middlewares dynamically based on the function arguments and context.
|
|
8
|
+
*
|
|
9
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
10
|
+
* @group Middleware
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { dynamic, fallback } from "@daiso-tech/core/async";
|
|
15
|
+
* import { AsyncHooks } from "@daiso-tech/core/utilities";
|
|
16
|
+
*
|
|
17
|
+
* await new AsyncHooks(
|
|
18
|
+
* (a: number, b: number) => a / b,
|
|
19
|
+
* [
|
|
20
|
+
* // You pass callback function where you get access to the function arguments and context.
|
|
21
|
+
* // The callback function must return a middleware.
|
|
22
|
+
* dynamic((_args, _context) =>
|
|
23
|
+
* fallback({
|
|
24
|
+
* fallbackValue: 1,
|
|
25
|
+
* }),
|
|
26
|
+
* ),
|
|
27
|
+
* ],
|
|
28
|
+
* ).invoke(1, 0);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function dynamic<TParameters extends unknown[], TReturn, TContext extends HookContext>(dynamic: NoInfer<Invokable<[
|
|
32
|
+
arguments_: TParameters,
|
|
33
|
+
context: TContext
|
|
34
|
+
], AsyncMiddleware<TParameters, TReturn, TContext>>>): AsyncMiddlewareFn<TParameters, TReturn, TContext>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Async
|
|
3
|
+
*/
|
|
4
|
+
import { callInvokable, } from "../../../utilities/_module-exports.js";
|
|
5
|
+
/**
|
|
6
|
+
* The `dynamic` is wrapper middleware that allows configuration of other middlewares dynamically based on the function arguments and context.
|
|
7
|
+
*
|
|
8
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
9
|
+
* @group Middleware
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { dynamic, fallback } from "@daiso-tech/core/async";
|
|
14
|
+
* import { AsyncHooks } from "@daiso-tech/core/utilities";
|
|
15
|
+
*
|
|
16
|
+
* await new AsyncHooks(
|
|
17
|
+
* (a: number, b: number) => a / b,
|
|
18
|
+
* [
|
|
19
|
+
* // You pass callback function where you get access to the function arguments and context.
|
|
20
|
+
* // The callback function must return a middleware.
|
|
21
|
+
* dynamic((_args, _context) =>
|
|
22
|
+
* fallback({
|
|
23
|
+
* fallbackValue: 1,
|
|
24
|
+
* }),
|
|
25
|
+
* ),
|
|
26
|
+
* ],
|
|
27
|
+
* ).invoke(1, 0);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function dynamic(dynamic) {
|
|
31
|
+
return (args, next, settings) => {
|
|
32
|
+
const middleware = callInvokable(dynamic, args, settings.context);
|
|
33
|
+
return callInvokable(middleware, args, next, settings);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=dynamic.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic.middleware.js","sourceRoot":"","sources":["../../../../src/async/middlewares/dynamic/dynamic.middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EACH,aAAa,GAGhB,MAAM,gCAAgC,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,OAAO,CAKnB,OAKC;IAED,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC5B,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClE,OAAO,aAAa,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../async/middlewares/fallback/fallback.middleware.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/middlewares/fallback/_module.ts"],"names":[],"mappings":"AAAA,cAAc,qDAAqD,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Async
|
|
3
|
+
*/
|
|
4
|
+
import type { HookContext, AsyncLazyable } from "../../../utilities/_module-exports.js";
|
|
5
|
+
import { type AsyncMiddlewareFn, type Invokable } from "../../../utilities/_module-exports.js";
|
|
6
|
+
import type { ErrorPolicy } from "../../../async/middlewares/_shared.js";
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
10
|
+
* @group Middleware
|
|
11
|
+
*/
|
|
12
|
+
export type OnFallbackData<TParameters extends unknown[] = unknown[], TFallbackValue = unknown, TContext extends HookContext = HookContext> = {
|
|
13
|
+
error: unknown;
|
|
14
|
+
fallbackValue: TFallbackValue;
|
|
15
|
+
args: TParameters;
|
|
16
|
+
context: TContext;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
21
|
+
* @group Middleware
|
|
22
|
+
*/
|
|
23
|
+
export type OnFallback<TParameters extends unknown[] = unknown[], TFallbackValue = unknown, TContext extends HookContext = HookContext> = Invokable<[data: OnFallbackData<TParameters, TFallbackValue, TContext>]>;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
27
|
+
* @group Middleware
|
|
28
|
+
*/
|
|
29
|
+
export type FallbackCallbacks<TParameters extends unknown[] = unknown[], TReturn = unknown, TContext extends HookContext = HookContext> = {
|
|
30
|
+
/**
|
|
31
|
+
* Callback function that will be called before fallback values is returned.
|
|
32
|
+
*/
|
|
33
|
+
onFallback?: OnFallback<TParameters, TReturn, TContext>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
38
|
+
* @group Middleware
|
|
39
|
+
*/
|
|
40
|
+
export type FallbackSettings<TParameters extends unknown[] = unknown[], TReturn = unknown, TContext extends HookContext = HookContext> = FallbackCallbacks<TParameters, TReturn, TContext> & {
|
|
41
|
+
fallbackValue: AsyncLazyable<TReturn>;
|
|
42
|
+
/**
|
|
43
|
+
* You can choose what errors you want to add fallback value. By default fallback value will be added to all errors.
|
|
44
|
+
*
|
|
45
|
+
* @default
|
|
46
|
+
* ```ts
|
|
47
|
+
* (_error: unknown) => true
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
fallbackPolicy?: ErrorPolicy;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* The `fallback` middleware adds fallback value when an error occurs.
|
|
54
|
+
*
|
|
55
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
56
|
+
* @group Middleware
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import { fallback } from "@daiso-tech/core/async";
|
|
61
|
+
* import { AsyncHooks } from "@daiso-tech/core/utilities";
|
|
62
|
+
*
|
|
63
|
+
* const fetchData = new AsyncHooks(async (url: string): Promise<unknown> => {
|
|
64
|
+
* const response = await fetch(url);
|
|
65
|
+
* const json = await response.json();
|
|
66
|
+
* if (!response.ok) {
|
|
67
|
+
* throw json
|
|
68
|
+
* }
|
|
69
|
+
* return json;
|
|
70
|
+
* }, [
|
|
71
|
+
* fallback({ fallbackValue: null })
|
|
72
|
+
* ]);
|
|
73
|
+
*
|
|
74
|
+
* // Will return null when the fetch method throws an error.
|
|
75
|
+
* console.log(await fetchData.invoke("URL_ENDPOINT"));
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function fallback<TParameters extends unknown[], TReturn, TContext extends HookContext>(settings: NoInfer<FallbackSettings<TParameters, TReturn, TContext>>): AsyncMiddlewareFn<TParameters, TReturn, TContext>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Async
|
|
3
|
+
*/
|
|
4
|
+
import { callInvokable, resolveAsyncLazyable, } from "../../../utilities/_module-exports.js";
|
|
5
|
+
/**
|
|
6
|
+
* The `fallback` middleware adds fallback value when an error occurs.
|
|
7
|
+
*
|
|
8
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
9
|
+
* @group Middleware
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { fallback } from "@daiso-tech/core/async";
|
|
14
|
+
* import { AsyncHooks } from "@daiso-tech/core/utilities";
|
|
15
|
+
*
|
|
16
|
+
* const fetchData = new AsyncHooks(async (url: string): Promise<unknown> => {
|
|
17
|
+
* const response = await fetch(url);
|
|
18
|
+
* const json = await response.json();
|
|
19
|
+
* if (!response.ok) {
|
|
20
|
+
* throw json
|
|
21
|
+
* }
|
|
22
|
+
* return json;
|
|
23
|
+
* }, [
|
|
24
|
+
* fallback({ fallbackValue: null })
|
|
25
|
+
* ]);
|
|
26
|
+
*
|
|
27
|
+
* // Will return null when the fetch method throws an error.
|
|
28
|
+
* console.log(await fetchData.invoke("URL_ENDPOINT"));
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function fallback(settings) {
|
|
32
|
+
const { fallbackValue, fallbackPolicy = () => true, onFallback = () => { }, } = settings;
|
|
33
|
+
return async (args, next, { context }) => {
|
|
34
|
+
try {
|
|
35
|
+
return await next(...args);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (callInvokable(fallbackPolicy, error)) {
|
|
39
|
+
const resolvedFallbackValue = await resolveAsyncLazyable(fallbackValue);
|
|
40
|
+
callInvokable(onFallback, {
|
|
41
|
+
error,
|
|
42
|
+
fallbackValue: resolvedFallbackValue,
|
|
43
|
+
args,
|
|
44
|
+
context,
|
|
45
|
+
});
|
|
46
|
+
return resolvedFallbackValue;
|
|
47
|
+
}
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=fallback.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback.middleware.js","sourceRoot":"","sources":["../../../../src/async/middlewares/fallback/fallback.middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EACH,aAAa,EACb,oBAAoB,GAGvB,MAAM,gCAAgC,CAAC;AAqExC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,QAAQ,CAKpB,QAAmE;IAEnE,MAAM,EACF,aAAa,EACb,cAAc,GAAG,GAAG,EAAE,CAAC,IAAI,EAC3B,UAAU,GAAG,GAAG,EAAE,GAAE,CAAC,GACxB,GAAG,QAAQ,CAAC;IACb,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAoB,EAAE;QACvD,IAAI,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,IAAI,aAAa,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;gBACvC,MAAM,qBAAqB,GACvB,MAAM,oBAAoB,CAAC,aAAa,CAAC,CAAC;gBAC9C,aAAa,CAAC,UAAU,EAAE;oBACtB,KAAK;oBACL,aAAa,EAAE,qBAAqB;oBACpC,IAAI;oBACJ,OAAO;iBACV,CAAC,CAAC;gBACH,OAAO,qBAAqB,CAAC;YACjC,CAAC;YACD,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/middlewares/hedging/_module.ts"],"names":[],"mappings":"AAAA,cAAc,2DAA2D,CAAC;AAC1E,cAAc,2DAA2D,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Async
|
|
3
|
+
*/
|
|
4
|
+
import type { TimeSpan } from "../../../utilities/_module-exports.js";
|
|
5
|
+
import { type HookContext, type Invokable, type OneOrMore, type Promisable } from "../../../utilities/_module-exports.js";
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
9
|
+
* @group Middlewares
|
|
10
|
+
*/
|
|
11
|
+
export type OnHedgeAttemptData<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
12
|
+
name: string;
|
|
13
|
+
args: TParameters;
|
|
14
|
+
context: TContext;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
19
|
+
* @group Middlewares
|
|
20
|
+
*/
|
|
21
|
+
export type OnHedgeAttempt<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = Invokable<[data: OnHedgeAttemptData<TParameters, TContext>]>;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
25
|
+
* @group Middlewares
|
|
26
|
+
*/
|
|
27
|
+
export type OnHedgeErrorData<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
28
|
+
name: string;
|
|
29
|
+
error: unknown;
|
|
30
|
+
args: TParameters;
|
|
31
|
+
context: TContext;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
36
|
+
* @group Middlewares
|
|
37
|
+
*/
|
|
38
|
+
export type OnHedgeError<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = Invokable<[data: OnHedgeErrorData<TParameters, TContext>]>;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
42
|
+
* @group Middlewares
|
|
43
|
+
*/
|
|
44
|
+
export type HedgingCallbacks<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
45
|
+
/**
|
|
46
|
+
* Callback function that will be called before execution attempt.
|
|
47
|
+
*/
|
|
48
|
+
onHedgeAttempt?: OnHedgeAttempt<TParameters, TContext>;
|
|
49
|
+
/**
|
|
50
|
+
* Callback function that will be called when the error occurs.
|
|
51
|
+
*/
|
|
52
|
+
onHedgeError?: OnHedgeError<TParameters, TContext>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
57
|
+
* @group Middlewares
|
|
58
|
+
*/
|
|
59
|
+
export type Fallback<TParameters extends unknown[] = unknown[], TReturn = unknown> = Invokable<TParameters, Promisable<TReturn>>;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
63
|
+
* @group Middlewares
|
|
64
|
+
*/
|
|
65
|
+
export type NamedFallback<TParameters extends unknown[] = unknown[], TReturn = unknown> = {
|
|
66
|
+
/**
|
|
67
|
+
* You can assign a custom name to the fallback function for easier identification in logs.
|
|
68
|
+
*/
|
|
69
|
+
name: string;
|
|
70
|
+
func: Fallback<TParameters, TReturn>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
75
|
+
* @group Middlewares
|
|
76
|
+
*/
|
|
77
|
+
export type HedgingSettings<TParameters extends unknown[] = unknown[], TReturn = unknown, TContext extends HookContext = HookContext> = HedgingCallbacks<TParameters, TContext> & {
|
|
78
|
+
/**
|
|
79
|
+
* The maximum time to wait before automatically aborting the executing primary function or fallback functions.
|
|
80
|
+
*
|
|
81
|
+
* @default
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
84
|
+
*
|
|
85
|
+
* TimeSpan.fromSeconds(2)
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
waitTime?: TimeSpan;
|
|
89
|
+
/**
|
|
90
|
+
* The fallback functions that run in case the primary function fails.
|
|
91
|
+
*/
|
|
92
|
+
fallbacks: OneOrMore<Fallback<TParameters, TReturn> | NamedFallback<TParameters, TReturn>>;
|
|
93
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../../src/async/middlewares/hedging/_shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAKN,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../async/middlewares/hedging/concurrent-hedging/_module.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/async/middlewares/hedging/concurrent-hedging/_module.ts"],"names":[],"mappings":"AAAA,cAAc,2DAA2D,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Async
|
|
3
|
+
*/
|
|
4
|
+
import { type AsyncMiddlewareFn, type HookContext } from "../../../../utilities/_module-exports.js";
|
|
5
|
+
import type { HedgingSettings } from "../../../../async/middlewares/hedging/_shared.js";
|
|
6
|
+
/**
|
|
7
|
+
* The `concurrentHedging` middleware executes the primary function and all fallback functions concurrently.
|
|
8
|
+
* It returns the result of the first successful function and automatically aborts all remaining functions.
|
|
9
|
+
* If all function fail than error is thrown.
|
|
10
|
+
*
|
|
11
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
12
|
+
* @group Middleware
|
|
13
|
+
* @throws {HedgingAsyncError} {@link HedgingAsyncError}
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { concurrentHedging } from "@daiso-tech/core/async";
|
|
18
|
+
* import { AsyncHooks } from "@daiso-tech/core/utilities";
|
|
19
|
+
*
|
|
20
|
+
* async function fn1(signal?: AbortSignal): Promise<unknown> {
|
|
21
|
+
* const response = await fetch("ENDPOINT-1", { signal });
|
|
22
|
+
* return await response.json();
|
|
23
|
+
* }
|
|
24
|
+
* async function fn2(signal?: AbortSignal): Promise<unknown> {
|
|
25
|
+
* const response = await fetch("ENDPOINT-2", { signal });
|
|
26
|
+
* return await response.json();
|
|
27
|
+
* }
|
|
28
|
+
* async function fn3(signal?: AbortSignal): Promise<unknown> {
|
|
29
|
+
* const response = await fetch("ENDPOINT-3", { signal });
|
|
30
|
+
* return await response.json();
|
|
31
|
+
* }
|
|
32
|
+
* const fetchData = new AsyncHooks(fn1, [
|
|
33
|
+
* concurrentHedging({
|
|
34
|
+
* fallbacks: [
|
|
35
|
+
* fn2,
|
|
36
|
+
* fn3
|
|
37
|
+
* ]
|
|
38
|
+
* })
|
|
39
|
+
* ], {
|
|
40
|
+
* signalBinder: {
|
|
41
|
+
* getSignal: (args) => args[0],
|
|
42
|
+
* forwardSignal: (args, signal) => {
|
|
43
|
+
* args[0] = signal;
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* console.log(await fetchData.invoke());
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function concurrentHedging<TParameters extends unknown[], TReturn, TContext extends HookContext>(settings: NoInfer<HedgingSettings<TParameters, TReturn, TContext>>): AsyncMiddlewareFn<TParameters, TReturn, TContext>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Async
|
|
3
|
+
*/
|
|
4
|
+
import { callInvokable, isInvokable, resolveOneOrMore, TimeSpan, } from "../../../../utilities/_module-exports.js";
|
|
5
|
+
import { HedgingAsyncError } from "../../../../async/async.errors.js";
|
|
6
|
+
import { timeoutAndFail } from "../../../../async/utilities/_module.js";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
class ResolvedError extends Error {
|
|
11
|
+
constructor(message, cause) {
|
|
12
|
+
super(message, { cause });
|
|
13
|
+
this.name = ResolvedError.name;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The `concurrentHedging` middleware executes the primary function and all fallback functions concurrently.
|
|
18
|
+
* It returns the result of the first successful function and automatically aborts all remaining functions.
|
|
19
|
+
* If all function fail than error is thrown.
|
|
20
|
+
*
|
|
21
|
+
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
22
|
+
* @group Middleware
|
|
23
|
+
* @throws {HedgingAsyncError} {@link HedgingAsyncError}
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { concurrentHedging } from "@daiso-tech/core/async";
|
|
28
|
+
* import { AsyncHooks } from "@daiso-tech/core/utilities";
|
|
29
|
+
*
|
|
30
|
+
* async function fn1(signal?: AbortSignal): Promise<unknown> {
|
|
31
|
+
* const response = await fetch("ENDPOINT-1", { signal });
|
|
32
|
+
* return await response.json();
|
|
33
|
+
* }
|
|
34
|
+
* async function fn2(signal?: AbortSignal): Promise<unknown> {
|
|
35
|
+
* const response = await fetch("ENDPOINT-2", { signal });
|
|
36
|
+
* return await response.json();
|
|
37
|
+
* }
|
|
38
|
+
* async function fn3(signal?: AbortSignal): Promise<unknown> {
|
|
39
|
+
* const response = await fetch("ENDPOINT-3", { signal });
|
|
40
|
+
* return await response.json();
|
|
41
|
+
* }
|
|
42
|
+
* const fetchData = new AsyncHooks(fn1, [
|
|
43
|
+
* concurrentHedging({
|
|
44
|
+
* fallbacks: [
|
|
45
|
+
* fn2,
|
|
46
|
+
* fn3
|
|
47
|
+
* ]
|
|
48
|
+
* })
|
|
49
|
+
* ], {
|
|
50
|
+
* signalBinder: {
|
|
51
|
+
* getSignal: (args) => args[0],
|
|
52
|
+
* forwardSignal: (args, signal) => {
|
|
53
|
+
* args[0] = signal;
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* console.log(await fetchData.invoke());
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export function concurrentHedging(settings) {
|
|
62
|
+
const { waitTime = TimeSpan.fromSeconds(2), fallbacks, onHedgeAttempt = () => { }, onHedgeError = () => { }, } = settings;
|
|
63
|
+
const resolvedFallbacks = resolveOneOrMore(fallbacks).map((fallback, index) => {
|
|
64
|
+
if (isInvokable(fallback)) {
|
|
65
|
+
return {
|
|
66
|
+
name: `fallback-${String(index + 1)}`,
|
|
67
|
+
func: fallback,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return fallback;
|
|
71
|
+
});
|
|
72
|
+
return async (args, next, { context, abort, signal }) => {
|
|
73
|
+
function step1({ name, func }) {
|
|
74
|
+
return {
|
|
75
|
+
name,
|
|
76
|
+
promise: timeoutAndFail((async () => callInvokable(func, ...args))(), waitTime, (error) => {
|
|
77
|
+
abort(error);
|
|
78
|
+
}, signal),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
async function step2({ name, promise }) {
|
|
82
|
+
try {
|
|
83
|
+
const value = await promise;
|
|
84
|
+
// We abort all other promises when on promise succeds.
|
|
85
|
+
abort(new ResolvedError("Already resolved"));
|
|
86
|
+
return {
|
|
87
|
+
type: "success",
|
|
88
|
+
value,
|
|
89
|
+
name,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
return {
|
|
94
|
+
type: "failure",
|
|
95
|
+
error,
|
|
96
|
+
name,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const funcs = [
|
|
101
|
+
{
|
|
102
|
+
name: "__initial",
|
|
103
|
+
func: next,
|
|
104
|
+
},
|
|
105
|
+
...resolvedFallbacks,
|
|
106
|
+
];
|
|
107
|
+
const promises = funcs.map(step1).map(step2);
|
|
108
|
+
const errors = [];
|
|
109
|
+
const promiseResults = await Promise.all(promises);
|
|
110
|
+
for (const promiseResult of promiseResults) {
|
|
111
|
+
callInvokable(onHedgeAttempt, {
|
|
112
|
+
args,
|
|
113
|
+
context,
|
|
114
|
+
name: promiseResult.name,
|
|
115
|
+
});
|
|
116
|
+
// We return the first fulfilled value
|
|
117
|
+
if (promiseResult.type === "success") {
|
|
118
|
+
return promiseResult.value;
|
|
119
|
+
}
|
|
120
|
+
else if (!(promiseResult.error instanceof ResolvedError)) {
|
|
121
|
+
callInvokable(onHedgeError, {
|
|
122
|
+
args,
|
|
123
|
+
context,
|
|
124
|
+
error: promiseResult.error,
|
|
125
|
+
name: promiseResult.name,
|
|
126
|
+
});
|
|
127
|
+
errors.push(promiseResult.error);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// If all promiseResults are rejected we will throw an error
|
|
131
|
+
const funcNames = funcs
|
|
132
|
+
.slice(1)
|
|
133
|
+
.map(({ name }) => `"${name}"`)
|
|
134
|
+
.join(", ");
|
|
135
|
+
throw new HedgingAsyncError(`The original function and fallback functions failed: ${funcNames}`, errors);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=concurrent-hedging.middleware.js.map
|
package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concurrent-hedging.middleware.js","sourceRoot":"","sources":["../../../../../src/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../async/middlewares/hedging/sequential-hedging/_module.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/async/middlewares/hedging/sequential-hedging/_module.ts"],"names":[],"mappings":"AAAA,cAAc,2DAA2D,CAAC"}
|