@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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module Utilities
|
|
3
3
|
*/
|
|
4
4
|
import { isNullable } from "../../utilities/functions/is-nullable.js";
|
|
5
|
+
import { getConstructorName } from "../../utilities/functions/get-constructor-name.js";
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
@@ -26,9 +27,9 @@ export function isInvokable(invokable) {
|
|
|
26
27
|
*/
|
|
27
28
|
export function resolveInvokable(invokable) {
|
|
28
29
|
if (isInvokableObject(invokable)) {
|
|
29
|
-
return invokable.invoke
|
|
30
|
+
return (...args) => invokable.invoke(...args);
|
|
30
31
|
}
|
|
31
|
-
return invokable;
|
|
32
|
+
return (...args) => invokable(...args);
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
35
|
* @internal
|
|
@@ -39,4 +40,13 @@ export function callInvokable(invokable, ...args) {
|
|
|
39
40
|
}
|
|
40
41
|
return invokable(...args);
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export function getInvokableName(invokable) {
|
|
47
|
+
if (isInvokableFn(invokable)) {
|
|
48
|
+
return invokable.name;
|
|
49
|
+
}
|
|
50
|
+
return getConstructorName(invokable);
|
|
51
|
+
}
|
|
42
52
|
//# sourceMappingURL=invokable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invokable.js","sourceRoot":"","sources":["../../../src/utilities/functions/invokable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"invokable.js","sourceRoot":"","sources":["../../../src/utilities/functions/invokable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAEnF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAK7B,SAAmD;IAEnD,MAAM,UAAU,GAAG,SAAoC,CAAC;IACxD,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,SAAmD;IAEnD,OAAO,OAAO,SAAS,KAAK,UAAU,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACvB,SAAmD;IAEnD,OAAO,iBAAiB,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC5B,SAA0C;IAE1C,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,SAA0C,EAC1C,GAAG,IAAiB;IAEpB,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC5B,SAA0C;IAE1C,IAAI,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC,IAAI,CAAC;IAC1B,CAAC;IACD,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Utilities
|
|
3
3
|
*/
|
|
4
|
+
import type { LazyPromise } from "../../async/utilities/_module.js";
|
|
4
5
|
import type { AsyncLazyable, Lazyable, Lazy, AsyncLazy } from "../../utilities/types/_module.js";
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
8
9
|
export declare function isLazy<TValue>(lazyable: Lazyable<TValue>): lazyable is Lazy<TValue>;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function isLazyPromise<TValue>(lazyable: AsyncLazyable<TValue>): lazyable is LazyPromise<TValue>;
|
|
9
14
|
/**
|
|
10
15
|
* @internal
|
|
11
16
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Utilities
|
|
3
3
|
*/
|
|
4
|
-
import { LazyPromise } from "../../async/_module-exports.js";
|
|
5
4
|
import { isInvokable, resolveInvokable, } from "../../utilities/functions/invokable.js";
|
|
6
5
|
/**
|
|
7
6
|
* @internal
|
|
@@ -9,11 +8,21 @@ import { isInvokable, resolveInvokable, } from "../../utilities/functions/invoka
|
|
|
9
8
|
export function isLazy(lazyable) {
|
|
10
9
|
return isInvokable(lazyable);
|
|
11
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export function isLazyPromise(lazyable) {
|
|
15
|
+
return (typeof lazyable === "object" &&
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
17
|
+
typeof lazyable?.then === "function" &&
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
19
|
+
typeof lazyable?.defer === "function");
|
|
20
|
+
}
|
|
12
21
|
/**
|
|
13
22
|
* @internal
|
|
14
23
|
*/
|
|
15
24
|
export function isAsyncLazy(lazyable) {
|
|
16
|
-
return isInvokable(lazyable) || lazyable
|
|
25
|
+
return isInvokable(lazyable) || isLazyPromise(lazyable);
|
|
17
26
|
}
|
|
18
27
|
/**
|
|
19
28
|
* @internal
|
|
@@ -29,7 +38,7 @@ export function resolveLazyable(lazyable) {
|
|
|
29
38
|
*/
|
|
30
39
|
export async function resolveAsyncLazyable(lazyable) {
|
|
31
40
|
if (isAsyncLazy(lazyable)) {
|
|
32
|
-
if (lazyable
|
|
41
|
+
if (isLazyPromise(lazyable)) {
|
|
33
42
|
return await lazyable;
|
|
34
43
|
}
|
|
35
44
|
return await resolveInvokable(lazyable)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.js","sourceRoot":"","sources":["../../../src/utilities/functions/lazy.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"lazy.js","sourceRoot":"","sources":["../../../src/utilities/functions/lazy.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EACH,WAAW,EACX,gBAAgB,GACnB,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,MAAM,CAClB,QAA0B;IAE1B,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,QAA+B;IAE/B,OAAO,CACH,OAAO,QAAQ,KAAK,QAAQ;QAC5B,sEAAsE;QACtE,OAAQ,QAAgB,EAAE,IAAI,KAAK,UAAU;QAC7C,sEAAsE;QACtE,OAAQ,QAAgB,EAAE,KAAK,KAAK,UAAU,CACjD,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACvB,QAA+B;IAE/B,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAS,QAA0B;IAC9D,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnB,OAAO,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxC,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACtC,QAA+B;IAE/B,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAM,QAAQ,CAAC;QAC1B,CAAC;QACD,OAAO,MAAM,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
|
@@ -5,45 +5,45 @@ import type { NoneFunc } from "../../utilities/types/none-func.type.js";
|
|
|
5
5
|
import type { Promisable } from "../../utilities/types/promiseable.type.js";
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
|
-
* IMPORT_PATH:
|
|
8
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
9
9
|
*/
|
|
10
10
|
export type FactoryFn<TInput, TOutput> = (value: TInput) => NoneFunc<TOutput>;
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
|
-
* IMPORT_PATH:
|
|
13
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
14
14
|
*/
|
|
15
15
|
export type IFactoryObject<TInput, TOutput> = {
|
|
16
16
|
use(value: TInput): NoneFunc<TOutput>;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
|
-
* IMPORT_PATH:
|
|
20
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
21
21
|
*/
|
|
22
22
|
export type Factory<TInput, TOutput> = FactoryFn<TInput, TOutput> | IFactoryObject<TInput, TOutput>;
|
|
23
23
|
/**
|
|
24
24
|
*
|
|
25
|
-
* IMPORT_PATH:
|
|
25
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
26
26
|
*/
|
|
27
27
|
export type Factoryable<TInput, TOutput> = TOutput | Factory<TInput, TOutput>;
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
|
-
* IMPORT_PATH:
|
|
30
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
31
31
|
*/
|
|
32
32
|
export type AsyncFactoryFn<TInput, TOutput> = (value: TInput) => Promisable<NoneFunc<TOutput>>;
|
|
33
33
|
/**
|
|
34
34
|
*
|
|
35
|
-
* IMPORT_PATH:
|
|
35
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
36
36
|
*/
|
|
37
37
|
export type IAsyncFactoryObject<TInput, TOutput> = {
|
|
38
38
|
use(value: TInput): Promisable<NoneFunc<TOutput>>;
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
41
|
*
|
|
42
|
-
* IMPORT_PATH:
|
|
42
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
43
43
|
*/
|
|
44
44
|
export type AsyncFactory<TInput, TOutput> = AsyncFactoryFn<TInput, TOutput> | IAsyncFactoryObject<TInput, TOutput>;
|
|
45
45
|
/**
|
|
46
46
|
*
|
|
47
|
-
* IMPORT_PATH:
|
|
47
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
48
48
|
*/
|
|
49
49
|
export type AsyncFactoryable<TInput, TOutput> = TOutput | AsyncFactory<TInput, TOutput>;
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
|
-
* IMPORT_PATH:
|
|
6
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
7
7
|
*/
|
|
8
8
|
export type InvokableFn<TArgs extends unknown[] = unknown[], TReturn = unknown> = (...args: TArgs) => TReturn;
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
|
-
* IMPORT_PATH:
|
|
11
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
12
12
|
*/
|
|
13
13
|
export type IInvokableObject<TArgs extends unknown[] = unknown[], TReturn = unknown> = {
|
|
14
14
|
invoke(...args: TArgs): TReturn;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
|
-
* IMPORT_PATH:
|
|
18
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
19
19
|
*/
|
|
20
20
|
export type Invokable<TArgs extends unknown[] = unknown[], TReturn = unknown> = InvokableFn<TArgs, TReturn> | IInvokableObject<TArgs, TReturn>;
|
|
@@ -6,26 +6,26 @@ import type { Promisable } from "../../utilities/types/promiseable.type.js";
|
|
|
6
6
|
import type { Invokable } from "../../utilities/types/invokable.type.js";
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
|
-
* IMPORT_PATH:
|
|
9
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
10
10
|
*/
|
|
11
11
|
export type Lazy<TValue> = Invokable<[], TValue>;
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
|
-
* IMPORT_PATH:
|
|
14
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
15
15
|
*/
|
|
16
16
|
export type Lazyable<TValue> = TValue | Lazy<TValue>;
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
19
|
-
* IMPORT_PATH:
|
|
19
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
20
20
|
*/
|
|
21
21
|
export type AsyncLazy_<TValue> = Invokable<[], Promisable<TValue>>;
|
|
22
22
|
/**
|
|
23
23
|
*
|
|
24
|
-
* IMPORT_PATH:
|
|
24
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
25
25
|
*/
|
|
26
26
|
export type AsyncLazy<TValue> = AsyncLazy_<TValue> | LazyPromise<TValue>;
|
|
27
27
|
/**
|
|
28
28
|
*
|
|
29
|
-
* IMPORT_PATH:
|
|
29
|
+
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
|
|
30
30
|
*/
|
|
31
31
|
export type AsyncLazyable<TValue> = TValue | AsyncLazy<TValue>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daiso-tech/core",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.35.0",
|
|
5
5
|
"author": "Yousif Abdulkarim",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"type": "module",
|
|
@@ -37,7 +37,27 @@
|
|
|
37
37
|
"TypeScript",
|
|
38
38
|
"JavaScript",
|
|
39
39
|
"Multitenant",
|
|
40
|
-
"Multitenancy"
|
|
40
|
+
"Multitenancy",
|
|
41
|
+
"LazyPromise",
|
|
42
|
+
"AsyncMiddleware",
|
|
43
|
+
"AsyncHooks",
|
|
44
|
+
"Async middlewares",
|
|
45
|
+
"Async hooks",
|
|
46
|
+
"Middleware",
|
|
47
|
+
"Middlewares",
|
|
48
|
+
"Hooks",
|
|
49
|
+
"Fallback",
|
|
50
|
+
"Retry",
|
|
51
|
+
"Timeout",
|
|
52
|
+
"Deadline",
|
|
53
|
+
"resilience",
|
|
54
|
+
"Resilience",
|
|
55
|
+
"Hedging",
|
|
56
|
+
"Fallback hedging",
|
|
57
|
+
"Sequential hedging",
|
|
58
|
+
"Parallel hedging",
|
|
59
|
+
"Concurrent hedging",
|
|
60
|
+
"Latency hedging"
|
|
41
61
|
],
|
|
42
62
|
"files": [
|
|
43
63
|
"./dist"
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Async
|
|
3
|
-
*/
|
|
4
|
-
import type { AbortAsyncError, RetryAsyncError, TimeoutAsyncError } from "../async/async.errors.js";
|
|
5
|
-
import { BaseEvent } from "../event-bus/contracts/_shared.js";
|
|
6
|
-
/**
|
|
7
|
-
* This event is dispatched when the <i>LazyPromise</i> has been rejected.
|
|
8
|
-
*
|
|
9
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
10
|
-
* @group Events
|
|
11
|
-
*/
|
|
12
|
-
export declare class FailureAsyncEvent extends BaseEvent<{
|
|
13
|
-
error: unknown;
|
|
14
|
-
}> {
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* This event is dispatched when the <i>LazyPromise</i> has been fulfilled.
|
|
18
|
-
*
|
|
19
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
20
|
-
* @group Events
|
|
21
|
-
*/
|
|
22
|
-
export declare class SuccessAsyncEvent<TValue> extends BaseEvent<{
|
|
23
|
-
value: TValue;
|
|
24
|
-
}> {
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* This event is dispatched when the <i>LazyPromise</i> has been fulfilled or rejected.
|
|
28
|
-
*
|
|
29
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
30
|
-
* @group Events
|
|
31
|
-
*/
|
|
32
|
-
export declare class FinallyAsyncEvent extends BaseEvent<{}> {
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* This event is dispatched on every retry attempt of the <i>LazyPromise</i>.
|
|
36
|
-
*
|
|
37
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
38
|
-
* @group Events
|
|
39
|
-
*/
|
|
40
|
-
export declare class RetryAttemptAsyncEvent extends BaseEvent<{
|
|
41
|
-
attempt: number;
|
|
42
|
-
error: unknown;
|
|
43
|
-
}> {
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* This event is dispatched when the rety attempt of the <i>LazyPromise</i> has exceeded the given time limit.
|
|
47
|
-
*
|
|
48
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
49
|
-
* @group Events
|
|
50
|
-
*/
|
|
51
|
-
export declare class RetryTimeoutAsyncEvent extends BaseEvent<{
|
|
52
|
-
error: TimeoutAsyncError;
|
|
53
|
-
}> {
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* This event is dispatched when the <i>LazyPromise</i> has failed all retry attempts.
|
|
57
|
-
*
|
|
58
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
59
|
-
* @group Events
|
|
60
|
-
*/
|
|
61
|
-
export declare class RetryFailureAsyncEvent extends BaseEvent<{
|
|
62
|
-
error: RetryAsyncError;
|
|
63
|
-
}> {
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* This event is dispatched when <i>LazyPromise</i> has exceeded the given total time limit.
|
|
67
|
-
*
|
|
68
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
69
|
-
* @group Events
|
|
70
|
-
*/
|
|
71
|
-
export declare class TotalTimeoutFailureAsyncEvent extends BaseEvent<{
|
|
72
|
-
error: TimeoutAsyncError;
|
|
73
|
-
}> {
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* This event is dispatched when <i>LazyPromise</i> is aborted.
|
|
77
|
-
*
|
|
78
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
79
|
-
* @group Events
|
|
80
|
-
*/
|
|
81
|
-
export declare class AbortAsyncEvent extends BaseEvent<{
|
|
82
|
-
error: AbortAsyncError;
|
|
83
|
-
}> {
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
87
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
88
|
-
* @group Events
|
|
89
|
-
*/
|
|
90
|
-
export declare const ASYNC_EVENTS: {
|
|
91
|
-
readonly Failure: typeof FailureAsyncEvent;
|
|
92
|
-
readonly Success: typeof SuccessAsyncEvent;
|
|
93
|
-
readonly Finally: typeof FinallyAsyncEvent;
|
|
94
|
-
readonly RetryAttempt: typeof RetryAttemptAsyncEvent;
|
|
95
|
-
readonly RetryTimeout: typeof RetryTimeoutAsyncEvent;
|
|
96
|
-
readonly RetryFailure: typeof RetryFailureAsyncEvent;
|
|
97
|
-
readonly TotalTimeoutFailure: typeof TotalTimeoutFailureAsyncEvent;
|
|
98
|
-
readonly Abort: typeof AbortAsyncEvent;
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
102
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
103
|
-
* @group Events
|
|
104
|
-
*/
|
|
105
|
-
export type AsyncEvents<TValue> = FailureAsyncEvent | SuccessAsyncEvent<TValue> | FinallyAsyncEvent | RetryAttemptAsyncEvent | RetryTimeoutAsyncEvent | RetryFailureAsyncEvent | TotalTimeoutFailureAsyncEvent | AbortAsyncEvent;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { BaseEvent } from "../event-bus/contracts/_shared.js";
|
|
2
|
-
/**
|
|
3
|
-
* This event is dispatched when the <i>LazyPromise</i> has been rejected.
|
|
4
|
-
*
|
|
5
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
6
|
-
* @group Events
|
|
7
|
-
*/
|
|
8
|
-
export class FailureAsyncEvent extends BaseEvent {
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* This event is dispatched when the <i>LazyPromise</i> has been fulfilled.
|
|
12
|
-
*
|
|
13
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
14
|
-
* @group Events
|
|
15
|
-
*/
|
|
16
|
-
export class SuccessAsyncEvent extends BaseEvent {
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* This event is dispatched when the <i>LazyPromise</i> has been fulfilled or rejected.
|
|
20
|
-
*
|
|
21
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
22
|
-
* @group Events
|
|
23
|
-
*/
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
25
|
-
export class FinallyAsyncEvent extends BaseEvent {
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* This event is dispatched on every retry attempt of the <i>LazyPromise</i>.
|
|
29
|
-
*
|
|
30
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
31
|
-
* @group Events
|
|
32
|
-
*/
|
|
33
|
-
export class RetryAttemptAsyncEvent extends BaseEvent {
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* This event is dispatched when the rety attempt of the <i>LazyPromise</i> has exceeded the given time limit.
|
|
37
|
-
*
|
|
38
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
39
|
-
* @group Events
|
|
40
|
-
*/
|
|
41
|
-
export class RetryTimeoutAsyncEvent extends BaseEvent {
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* This event is dispatched when the <i>LazyPromise</i> has failed all retry attempts.
|
|
45
|
-
*
|
|
46
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
47
|
-
* @group Events
|
|
48
|
-
*/
|
|
49
|
-
export class RetryFailureAsyncEvent extends BaseEvent {
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* This event is dispatched when <i>LazyPromise</i> has exceeded the given total time limit.
|
|
53
|
-
*
|
|
54
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
55
|
-
* @group Events
|
|
56
|
-
*/
|
|
57
|
-
export class TotalTimeoutFailureAsyncEvent extends BaseEvent {
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* This event is dispatched when <i>LazyPromise</i> is aborted.
|
|
61
|
-
*
|
|
62
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
63
|
-
* @group Events
|
|
64
|
-
*/
|
|
65
|
-
export class AbortAsyncEvent extends BaseEvent {
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
70
|
-
* @group Events
|
|
71
|
-
*/
|
|
72
|
-
export const ASYNC_EVENTS = {
|
|
73
|
-
Failure: FailureAsyncEvent,
|
|
74
|
-
Success: SuccessAsyncEvent,
|
|
75
|
-
Finally: FinallyAsyncEvent,
|
|
76
|
-
RetryAttempt: RetryAttemptAsyncEvent,
|
|
77
|
-
RetryTimeout: RetryTimeoutAsyncEvent,
|
|
78
|
-
RetryFailure: RetryFailureAsyncEvent,
|
|
79
|
-
TotalTimeoutFailure: TotalTimeoutFailureAsyncEvent,
|
|
80
|
-
Abort: AbortAsyncEvent,
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=async.events.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async.events.js","sourceRoot":"","sources":["../../src/async/async.events.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,SAErC;CAAG;AAEL;;;;;GAKG;AACH,MAAM,OAAO,iBAA0B,SAAQ,SAE7C;CAAG;AAEL;;;;;GAKG;AACH,mEAAmE;AACnE,MAAM,OAAO,iBAAkB,SAAQ,SAAa;CAAG;AAEvD;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAG1C;CAAG;AAEL;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAE1C;CAAG;AAEL;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAE1C;CAAG;AAEL;;;;;GAKG;AACH,MAAM,OAAO,6BAA8B,SAAQ,SAEjD;CAAG;AAEL;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAEnC;CAAG;AAEL;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,OAAO,EAAE,iBAAiB;IAC1B,OAAO,EAAE,iBAAiB;IAC1B,OAAO,EAAE,iBAAiB;IAC1B,YAAY,EAAE,sBAAsB;IACpC,YAAY,EAAE,sBAAsB;IACpC,YAAY,EAAE,sBAAsB;IACpC,mBAAmB,EAAE,6BAA6B;IAClD,KAAK,EAAE,eAAe;CAChB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/utilities/abort/_module.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kCAAkC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abort-and-fail.js","sourceRoot":"","sources":["../../../../src/async/utilities/abort/abort-and-fail.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;GAEG;AACH,SAAS,oBAAoB,CACzB,WAAwB;IAKxB,IAAI,OAAO,GAAsC,IAAI,CAAC;IACtD,SAAS,KAAK;QACV,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QACD,OAAO,CACH,IAAI,eAAe,CACf,uCAAuC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EACpE,WAAW,CAAC,MAAM,CACrB,CACJ,CAAC;IACN,CAAC;IAED,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO;YACH,OAAO,EAAE,OAAO,CAAC,MAAM,CACnB,IAAI,eAAe,CACf,uCAAuC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,EACrE,WAAW,CAAC,MAAM,CACrB,CACJ;YACD,KAAK;SACR,CAAC;IACN,CAAC;IAED,OAAO;QACH,OAAO,EAAE,IAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;YACtC,OAAO,GAAG,MAAM,CAAC;YACjB,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACtB,KAAK,EAAE,CAAC;gBACR,OAAO;YACX,CAAC;YACD,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE;gBACzC,IAAI,EAAE,IAAI;aACb,CAAC,CAAC;QACP,CAAC,CAAC;QACF,KAAK;KACR,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAC9B,OAAkC,EAClC,WAAwB;IAExB,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,eAAe,CACrB,uCAAuC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EACpE,WAAW,CAAC,MAAM,CACrB,CAAC;IACN,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,GACxC,oBAAoB,CAAS,WAAW,CAAC,CAAC;IAC9C,IAAI,CAAC;QACD,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC/D,CAAC;YAAS,CAAC;QACP,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;AACL,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Async
|
|
3
|
-
*/
|
|
4
|
-
import type { Result } from "../../../utilities/_module-exports.js";
|
|
5
|
-
import { AbortAsyncError } from "../../../async/async.errors.js";
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export declare function abort<TValue>(asyncFn: () => PromiseLike<TValue>, abortSignal: AbortSignal): Promise<Result<TValue, AbortAsyncError>>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AbortAsyncError } from "../../../async/async.errors.js";
|
|
2
|
-
import { abortAndFail } from "../../../async/utilities/abort/abort-and-fail.js";
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export async function abort(asyncFn, abortSignal) {
|
|
7
|
-
try {
|
|
8
|
-
const value = await abortAndFail(asyncFn, abortSignal);
|
|
9
|
-
return [value, null];
|
|
10
|
-
}
|
|
11
|
-
catch (error) {
|
|
12
|
-
if (error instanceof AbortAsyncError) {
|
|
13
|
-
return [null, error];
|
|
14
|
-
}
|
|
15
|
-
throw error;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=abort.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abort.js","sourceRoot":"","sources":["../../../../src/async/utilities/abort/abort.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACvB,OAAkC,EAClC,WAAwB;IAExB,IAAI,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACvD,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACtB,IAAI,KAAK,YAAY,eAAe,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACzB,CAAC;QACD,MAAM,KAAK,CAAC;IAChB,CAAC;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../async/utilities/delay/delay.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/utilities/delay/_module.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Async
|
|
3
|
-
*/
|
|
4
|
-
import { type TimeSpan } from "../../../utilities/_module-exports.js";
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* @throws {AsyncError} {@link AsyncError}
|
|
8
|
-
* @throws {AbortAsyncError} {@link AbortAsyncError}
|
|
9
|
-
*/
|
|
10
|
-
export declare function delay(time: TimeSpan, abortSignal?: AbortSignal): Promise<void>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Async
|
|
3
|
-
*/
|
|
4
|
-
import {} from "../../../utilities/_module-exports.js";
|
|
5
|
-
import {
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7
|
-
AsyncError,
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
-
AbortAsyncError, } from "../../../async/async.errors.js";
|
|
10
|
-
import { abortAndFail } from "../../../async/utilities/abort/_module.js";
|
|
11
|
-
/**
|
|
12
|
-
* @internal
|
|
13
|
-
* @throws {AsyncError} {@link AsyncError}
|
|
14
|
-
* @throws {AbortAsyncError} {@link AbortAsyncError}
|
|
15
|
-
*/
|
|
16
|
-
export async function delay(time, abortSignal = new AbortController().signal) {
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
let timeoutId = null;
|
|
19
|
-
try {
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/return-await
|
|
21
|
-
return abortAndFail(() => new Promise((resolve) => {
|
|
22
|
-
timeoutId = setTimeout(() => {
|
|
23
|
-
resolve();
|
|
24
|
-
}, time.toMilliseconds());
|
|
25
|
-
}), abortSignal);
|
|
26
|
-
}
|
|
27
|
-
finally {
|
|
28
|
-
if (timeoutId === null) {
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
30
|
-
clearTimeout(timeoutId);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=delay.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delay.js","sourceRoot":"","sources":["../../../../src/async/utilities/delay/delay.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAO;AACH,6DAA6D;AAC7D,UAAU;AACV,6DAA6D;AAC7D,eAAe,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACvB,IAAc,EACd,cAA2B,IAAI,eAAe,EAAE,CAAC,MAAM;IAEvD,8DAA8D;IAC9D,IAAI,SAAS,GAAQ,IAAI,CAAC;IAC1B,IAAI,CAAC;QACD,2DAA2D;QAC3D,OAAO,YAAY,CACf,GAAG,EAAE,CACD,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAC1B,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,CAAC;YACd,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,EACN,WAAW,CACd,CAAC;IACN,CAAC;YAAS,CAAC;QACP,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YACrB,iEAAiE;YACjE,YAAY,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/utilities/retry/_module.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,kCAAkC,CAAC"}
|