@daiso-tech/core 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backoff-policies/_module-exports.d.ts +5 -0
- package/dist/backoff-policies/_module-exports.js +6 -0
- package/dist/backoff-policies/_module-exports.js.map +1 -0
- package/dist/{async/backof-policies → backoff-policies}/_shared.d.ts +6 -7
- package/dist/{async/backof-policies → backoff-policies}/_shared.js +1 -1
- package/dist/backoff-policies/_shared.js.map +1 -0
- package/dist/backoff-policies/constant-backoff-policy/_module.d.ts +1 -0
- package/dist/backoff-policies/constant-backoff-policy/_module.js +2 -0
- package/dist/backoff-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/{async/backof-policies → backoff-policies}/constant-backoff-policy/constant-backoff-policy.d.ts +6 -8
- package/dist/{async/backof-policies → backoff-policies}/constant-backoff-policy/constant-backoff-policy.js +8 -10
- package/dist/backoff-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
- package/dist/backoff-policies/exponential-backoff-policy/_module.d.ts +1 -0
- package/dist/backoff-policies/exponential-backoff-policy/_module.js +2 -0
- package/dist/backoff-policies/exponential-backoff-policy/_module.js.map +1 -0
- package/dist/{async/backof-policies → backoff-policies}/exponential-backoff-policy/exponential-backoff-policy.d.ts +7 -9
- package/dist/backoff-policies/exponential-backoff-policy/exponential-backoff-policy.js +30 -0
- package/dist/backoff-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/backoff-policies/linear-backoff-policy/_module.d.ts +1 -0
- package/dist/backoff-policies/linear-backoff-policy/_module.js +2 -0
- package/dist/backoff-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/{async/backof-policies → backoff-policies}/linear-backoff-policy/linear-backoff-policy.d.ts +7 -9
- package/dist/backoff-policies/linear-backoff-policy/linear-backoff-policy.js +30 -0
- package/dist/backoff-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
- package/dist/backoff-policies/polynomial-backoff-policy/_module.d.ts +1 -0
- package/dist/backoff-policies/polynomial-backoff-policy/_module.js +2 -0
- package/dist/backoff-policies/polynomial-backoff-policy/_module.js.map +1 -0
- package/dist/{async/backof-policies → backoff-policies}/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +7 -9
- package/dist/backoff-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +30 -0
- package/dist/backoff-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/cache/contracts/cache-adapter.contract.d.ts +12 -12
- package/dist/cache/contracts/cache.contract.d.ts +22 -22
- package/dist/cache/contracts/cache.errors.d.ts +7 -14
- package/dist/cache/contracts/cache.errors.js +12 -24
- package/dist/cache/contracts/cache.errors.js.map +1 -1
- package/dist/cache/contracts/cache.events.d.ts +1 -1
- package/dist/cache/contracts/database-cache-adapter.contract.d.ts +10 -10
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.d.ts +1 -1
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js +4 -4
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +1 -1
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +2 -2
- 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 +3 -2
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +3 -3
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +10 -10
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +38 -43
- package/dist/cache/implementations/derivables/cache/cache.js +106 -101
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.d.ts +1 -1
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.js +3 -3
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +6 -8
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +5 -15
- 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 +1 -1
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +48 -48
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache.test-suite.js +107 -107
- package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +2 -1
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js.map +1 -1
- package/dist/collection/contracts/async-collection.contract.d.ts +43 -43
- package/dist/collection/contracts/collection.contract.d.ts +15 -1
- package/dist/collection/contracts/collection.contract.js +1 -3
- package/dist/collection/contracts/collection.contract.js.map +1 -1
- package/dist/collection/contracts/collection.errors.d.ts +4 -13
- package/dist/collection/contracts/collection.errors.js +4 -16
- package/dist/collection/contracts/collection.errors.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.d.ts +6 -0
- package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.js +3 -0
- package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +40 -51
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +31 -37
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.d.ts +3 -0
- package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.js +6 -0
- package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +3 -3
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +5 -2
- package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/collection/implementations/list-collection/list-collection.d.ts +3 -3
- package/dist/collection/implementations/list-collection/list-collection.js +5 -2
- package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +3 -3
- package/dist/event-bus/contracts/event-bus.contract.d.ts +10 -10
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-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.d.ts +3 -6
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +7 -9
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +18 -24
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +51 -51
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.d.ts +11 -4
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.js +17 -12
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +1 -3
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +4 -8
- 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.js +36 -37
- 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.js +86 -674
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/hooks/_module-exports.d.ts +3 -0
- package/dist/hooks/_module-exports.js +4 -0
- package/dist/hooks/_module-exports.js.map +1 -0
- package/dist/{utilities/classes/hooks → hooks}/async-hooks.d.ts +15 -26
- package/dist/{utilities/classes/hooks → hooks}/async-hooks.js +4 -6
- package/dist/hooks/async-hooks.js.map +1 -0
- package/dist/{utilities/classes/hooks → hooks}/hooks.d.ts +11 -18
- package/dist/{utilities/classes/hooks → hooks}/hooks.js +4 -5
- package/dist/hooks/hooks.js.map +1 -0
- package/dist/{utilities/classes/hooks → hooks}/types.d.ts +2 -3
- package/dist/hooks/types.js +5 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/lock/contracts/_module-exports.d.ts +4 -2
- package/dist/lock/contracts/_module-exports.js +4 -2
- package/dist/lock/contracts/_module-exports.js.map +1 -1
- package/dist/lock/contracts/database-lock-adapter.contract.d.ts +59 -14
- package/dist/lock/contracts/lock-adapter.contract.d.ts +22 -10
- package/dist/lock/contracts/lock-provider.contract.d.ts +5 -5
- package/dist/lock/contracts/lock-state.contract.d.ts +52 -0
- package/dist/lock/contracts/lock-state.contract.js +14 -0
- package/dist/lock/contracts/lock-state.contract.js.map +1 -0
- package/dist/lock/contracts/lock.contract.d.ts +72 -58
- package/dist/lock/contracts/lock.errors.d.ts +18 -15
- package/dist/lock/contracts/lock.errors.js +22 -17
- package/dist/lock/contracts/lock.errors.js.map +1 -1
- package/dist/lock/contracts/lock.events.d.ts +21 -37
- package/dist/lock/contracts/lock.events.js +2 -2
- package/dist/lock/contracts/lock.events.js.map +1 -1
- package/dist/lock/contracts/types.d.ts +11 -0
- package/dist/lock/contracts/types.js +5 -0
- package/dist/lock/contracts/types.js.map +1 -0
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +33 -13
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +182 -56
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +25 -9
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +80 -36
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +11 -12
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +164 -79
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +7 -6
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +7 -4
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +27 -9
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +87 -32
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.d.ts +7 -6
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js +56 -24
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.d.ts +2 -2
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js +7 -7
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +29 -39
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +31 -35
- 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 +5 -8
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +27 -23
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +38 -33
- package/dist/lock/implementations/derivables/lock-provider/lock.js +178 -234
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/resolve-database-lock-adapter.d.ts +9 -0
- package/dist/lock/implementations/derivables/lock-provider/resolve-database-lock-adapter.js +12 -0
- package/dist/lock/implementations/derivables/lock-provider/resolve-database-lock-adapter.js.map +1 -0
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +12 -13
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +7 -16
- 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.js +312 -191
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +1 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +378 -95
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +15 -5
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +3110 -1611
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/namespace/_module-exports.d.ts +1 -0
- package/dist/namespace/_module-exports.js +2 -0
- package/dist/namespace/_module-exports.js.map +1 -0
- package/dist/namespace/namespace.d.ts +87 -0
- package/dist/namespace/namespace.js +117 -0
- package/dist/namespace/namespace.js.map +1 -0
- package/dist/resilience/_module-exports.d.ts +2 -0
- package/dist/resilience/_module-exports.js +3 -0
- package/dist/resilience/_module-exports.js.map +1 -0
- package/dist/resilience/middlewares/_module.d.ts +5 -0
- package/dist/resilience/middlewares/_module.js +6 -0
- package/dist/resilience/middlewares/_module.js.map +1 -0
- package/dist/resilience/middlewares/dynamic/_module.d.ts +1 -0
- package/dist/resilience/middlewares/dynamic/_module.js +2 -0
- package/dist/resilience/middlewares/dynamic/_module.js.map +1 -0
- package/dist/{async → resilience}/middlewares/dynamic/dynamic.middleware.d.ts +6 -6
- package/dist/{async → resilience}/middlewares/dynamic/dynamic.middleware.js +5 -5
- package/dist/resilience/middlewares/dynamic/dynamic.middleware.js.map +1 -0
- package/dist/resilience/middlewares/fallback/_module.d.ts +2 -0
- package/dist/resilience/middlewares/fallback/_module.js +3 -0
- package/dist/resilience/middlewares/fallback/_module.js.map +1 -0
- package/dist/{async → resilience}/middlewares/fallback/fallback.middleware.d.ts +9 -9
- package/dist/{async → resilience}/middlewares/fallback/fallback.middleware.js +7 -6
- package/dist/resilience/middlewares/fallback/fallback.middleware.js.map +1 -0
- package/dist/{async → resilience}/middlewares/fallback/fallback.types.d.ts +7 -6
- package/dist/{async → resilience}/middlewares/fallback/fallback.types.js +1 -1
- package/dist/resilience/middlewares/fallback/fallback.types.js.map +1 -0
- package/dist/resilience/middlewares/observe/_module.d.ts +2 -0
- package/dist/resilience/middlewares/observe/_module.js +3 -0
- package/dist/resilience/middlewares/observe/_module.js.map +1 -0
- package/dist/{async → resilience}/middlewares/observe/observe.middleware.d.ts +13 -11
- package/dist/{async → resilience}/middlewares/observe/observe.middleware.js +14 -10
- package/dist/resilience/middlewares/observe/observe.middleware.js.map +1 -0
- package/dist/{async → resilience}/middlewares/observe/observe.types.d.ts +13 -12
- package/dist/resilience/middlewares/observe/observe.types.js +5 -0
- package/dist/resilience/middlewares/observe/observe.types.js.map +1 -0
- package/dist/resilience/middlewares/retry/_module.d.ts +2 -0
- package/dist/resilience/middlewares/retry/_module.js +3 -0
- package/dist/resilience/middlewares/retry/_module.js.map +1 -0
- package/dist/{async → resilience}/middlewares/retry/retry.middleware.d.ts +12 -9
- package/dist/{async → resilience}/middlewares/retry/retry.middleware.js +19 -15
- package/dist/resilience/middlewares/retry/retry.middleware.js.map +1 -0
- package/dist/{async → resilience}/middlewares/retry/retry.types.d.ts +14 -12
- package/dist/resilience/middlewares/retry/retry.types.js +7 -0
- package/dist/resilience/middlewares/retry/retry.types.js.map +1 -0
- package/dist/resilience/middlewares/timeout/_module.d.ts +2 -0
- package/dist/resilience/middlewares/timeout/_module.js +3 -0
- package/dist/resilience/middlewares/timeout/_module.js.map +1 -0
- package/dist/{async → resilience}/middlewares/timeout/timeout.middleware.d.ts +9 -7
- package/dist/{async → resilience}/middlewares/timeout/timeout.middleware.js +12 -11
- package/dist/resilience/middlewares/timeout/timeout.middleware.js.map +1 -0
- package/dist/{async → resilience}/middlewares/timeout/timeout.type.d.ts +10 -9
- package/dist/resilience/middlewares/timeout/timeout.type.js +5 -0
- package/dist/resilience/middlewares/timeout/timeout.type.js.map +1 -0
- package/dist/resilience/resilience.errors.d.ts +40 -0
- package/dist/resilience/resilience.errors.js +48 -0
- package/dist/resilience/resilience.errors.js.map +1 -0
- package/dist/resilience/utilities/_module.d.ts +2 -0
- package/dist/resilience/utilities/_module.js +3 -0
- package/dist/resilience/utilities/_module.js.map +1 -0
- package/dist/resilience/utilities/abort-and-fail/_module.d.ts +1 -0
- package/dist/resilience/utilities/abort-and-fail/_module.js +2 -0
- package/dist/resilience/utilities/abort-and-fail/_module.js.map +1 -0
- package/dist/resilience/utilities/abort-and-fail/abort-and-fail.d.ts +7 -0
- package/dist/resilience/utilities/abort-and-fail/abort-and-fail.js +51 -0
- package/dist/resilience/utilities/abort-and-fail/abort-and-fail.js.map +1 -0
- package/dist/resilience/utilities/timeout-and-fail/_module.d.ts +1 -0
- package/dist/resilience/utilities/timeout-and-fail/_module.js +2 -0
- package/dist/resilience/utilities/timeout-and-fail/_module.js.map +1 -0
- package/dist/resilience/utilities/timeout-and-fail/timeout-and-fail.d.ts +7 -0
- package/dist/resilience/utilities/timeout-and-fail/timeout-and-fail.js +23 -0
- package/dist/resilience/utilities/timeout-and-fail/timeout-and-fail.js.map +1 -0
- package/dist/semaphore/contracts/_module-exports.d.ts +9 -0
- package/dist/semaphore/contracts/_module-exports.js +10 -0
- package/dist/semaphore/contracts/_module-exports.js.map +1 -0
- package/dist/semaphore/contracts/database-semaphore-adapter.contract.d.ts +90 -0
- package/dist/semaphore/contracts/database-semaphore-adapter.contract.js +5 -0
- package/dist/semaphore/contracts/database-semaphore-adapter.contract.js.map +1 -0
- package/dist/semaphore/contracts/semaphore-adapter.contract.d.ts +61 -0
- package/dist/semaphore/contracts/semaphore-adapter.contract.js +5 -0
- package/dist/semaphore/contracts/semaphore-adapter.contract.js.map +1 -0
- package/dist/semaphore/contracts/semaphore-provider-factory.contract.d.ts +19 -0
- package/dist/semaphore/contracts/semaphore-provider-factory.contract.js +9 -0
- package/dist/semaphore/contracts/semaphore-provider-factory.contract.js.map +1 -0
- package/dist/semaphore/contracts/semaphore-provider.contract.d.ts +50 -0
- package/dist/semaphore/contracts/semaphore-provider.contract.js +5 -0
- package/dist/semaphore/contracts/semaphore-provider.contract.js.map +1 -0
- package/dist/semaphore/contracts/semaphore-state.contract.d.ts +70 -0
- package/dist/semaphore/contracts/semaphore-state.contract.js +15 -0
- package/dist/semaphore/contracts/semaphore-state.contract.js.map +1 -0
- package/dist/semaphore/contracts/semaphore.contract.d.ts +127 -0
- package/dist/semaphore/contracts/semaphore.contract.js +5 -0
- package/dist/semaphore/contracts/semaphore.contract.js.map +1 -0
- package/dist/semaphore/contracts/semaphore.errors.d.ts +52 -0
- package/dist/semaphore/contracts/semaphore.errors.js +63 -0
- package/dist/semaphore/contracts/semaphore.errors.js.map +1 -0
- package/dist/semaphore/contracts/semaphore.events.d.ts +101 -0
- package/dist/semaphore/contracts/semaphore.events.js +19 -0
- package/dist/semaphore/contracts/semaphore.events.js.map +1 -0
- package/dist/semaphore/contracts/types.d.ts +11 -0
- package/dist/semaphore/contracts/types.js +5 -0
- package/dist/semaphore/contracts/types.js.map +1 -0
- package/dist/semaphore/implementations/adapters/_module-exports.d.ts +5 -0
- package/dist/semaphore/implementations/adapters/_module-exports.js +6 -0
- package/dist/semaphore/implementations/adapters/_module-exports.js.map +1 -0
- package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/_module.d.ts +1 -0
- package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/_module.js +2 -0
- package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/_module.js.map +1 -0
- package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.d.ts +97 -0
- package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.js +313 -0
- package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.js.map +1 -0
- package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/_module.d.ts +1 -0
- package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/_module.js +2 -0
- package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/_module.js.map +1 -0
- package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.d.ts +49 -0
- package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.js +141 -0
- package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.js.map +1 -0
- package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/_module.d.ts +1 -0
- package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/_module.js +2 -0
- package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/_module.js.map +1 -0
- package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.d.ts +80 -0
- package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.js +390 -0
- package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.js.map +1 -0
- package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/_module.d.ts +1 -0
- package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/_module.js +2 -0
- package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/_module.js.map +1 -0
- package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.d.ts +18 -0
- package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.js +30 -0
- package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.js.map +1 -0
- package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/_module.d.ts +1 -0
- package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/_module.js +2 -0
- package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/_module.js.map +1 -0
- package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/redis-semaphore-adapter.d.ts +48 -0
- package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/redis-semaphore-adapter.js +338 -0
- package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/redis-semaphore-adapter.js.map +1 -0
- package/dist/semaphore/implementations/derivables/_module-exports.d.ts +2 -0
- package/dist/semaphore/implementations/derivables/_module-exports.js +3 -0
- package/dist/semaphore/implementations/derivables/_module-exports.js.map +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/_module.d.ts +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/_module.js +2 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/_module.js.map +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/database-semaphore-adapter.d.ts +17 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/database-semaphore-adapter.js +74 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/database-semaphore-adapter.js.map +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/is-database-semaphore-adapter.d.ts +8 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/is-database-semaphore-adapter.js +15 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/is-database-semaphore-adapter.js.map +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/resolve-database-semaphore-adapter.d.ts +8 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/resolve-database-semaphore-adapter.js +15 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/resolve-database-semaphore-adapter.js.map +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.d.ts +149 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.js +135 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.js.map +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.d.ts +41 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.js +77 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.js.map +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.d.ts +83 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.js +336 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.js.map +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider-factory/_module.d.ts +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider-factory/_module.js +2 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider-factory/_module.js.map +1 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.d.ts +40 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.js +67 -0
- package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.js.map +1 -0
- package/dist/semaphore/implementations/test-utilities/_module-exports.d.ts +3 -0
- package/dist/semaphore/implementations/test-utilities/_module-exports.js +4 -0
- package/dist/semaphore/implementations/test-utilities/_module-exports.js.map +1 -0
- package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.d.ts +59 -0
- package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.js +536 -0
- package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.js.map +1 -0
- package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.d.ts +59 -0
- package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.js +961 -0
- package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.js.map +1 -0
- package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.d.ts +67 -0
- package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.js +4981 -0
- package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.js.map +1 -0
- package/dist/serde/contracts/_module-exports.d.ts +0 -1
- package/dist/serde/contracts/_module-exports.js +0 -1
- package/dist/serde/contracts/_module-exports.js.map +1 -1
- package/dist/serde/contracts/flexible-serde.contract.d.ts +21 -5
- package/dist/serde/contracts/serde.errors.d.ts +14 -11
- package/dist/serde/contracts/serde.errors.js +15 -14
- package/dist/serde/contracts/serde.errors.js.map +1 -1
- package/dist/serde/implementations/adapters/_module-exports.d.ts +0 -3
- package/dist/serde/implementations/adapters/_module-exports.js +0 -3
- package/dist/serde/implementations/adapters/_module-exports.js.map +1 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +6 -0
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js.map +1 -1
- package/dist/serde/implementations/derivables/serde-transformers.d.ts +38 -30
- package/dist/serde/implementations/derivables/serde-transformers.js +62 -20
- package/dist/serde/implementations/derivables/serde-transformers.js.map +1 -1
- package/dist/serde/implementations/derivables/serde.d.ts +12 -3
- package/dist/serde/implementations/derivables/serde.js +5 -2
- package/dist/serde/implementations/derivables/serde.js.map +1 -1
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +85 -1
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js.map +1 -1
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +85 -1
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js.map +1 -1
- package/dist/shared-lock/contracts/_module-exports.d.ts +10 -0
- package/dist/shared-lock/contracts/_module-exports.js +11 -0
- package/dist/shared-lock/contracts/_module-exports.js.map +1 -0
- package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.d.ts +145 -0
- package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.js +5 -0
- package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.js.map +1 -0
- package/dist/shared-lock/contracts/shared-lock-adapter.contract.d.ts +96 -0
- package/dist/shared-lock/contracts/shared-lock-adapter.contract.js +5 -0
- package/dist/shared-lock/contracts/shared-lock-adapter.contract.js.map +1 -0
- package/dist/shared-lock/contracts/shared-lock-provider-factory.contract.d.ts +19 -0
- package/dist/shared-lock/contracts/shared-lock-provider-factory.contract.js +9 -0
- package/dist/shared-lock/contracts/shared-lock-provider-factory.contract.js.map +1 -0
- package/dist/shared-lock/contracts/shared-lock-provider.contract.d.ts +53 -0
- package/dist/shared-lock/contracts/shared-lock-provider.contract.js +5 -0
- package/dist/shared-lock/contracts/shared-lock-provider.contract.js.map +1 -0
- package/dist/shared-lock/contracts/shared-lock-state.contract.d.ts +133 -0
- package/dist/shared-lock/contracts/shared-lock-state.contract.js +33 -0
- package/dist/shared-lock/contracts/shared-lock-state.contract.js.map +1 -0
- package/dist/shared-lock/contracts/shared-lock.contract.d.ts +222 -0
- package/dist/shared-lock/contracts/shared-lock.contract.js +13 -0
- package/dist/shared-lock/contracts/shared-lock.contract.js.map +1 -0
- package/dist/shared-lock/contracts/shared-lock.errors.d.ts +124 -0
- package/dist/shared-lock/contracts/shared-lock.errors.js +136 -0
- package/dist/shared-lock/contracts/shared-lock.errors.js.map +1 -0
- package/dist/shared-lock/contracts/shared-lock.events.d.ts +205 -0
- package/dist/shared-lock/contracts/shared-lock.events.js +43 -0
- package/dist/shared-lock/contracts/shared-lock.events.js.map +1 -0
- package/dist/shared-lock/contracts/types.d.ts +10 -0
- package/dist/shared-lock/contracts/types.js +5 -0
- package/dist/shared-lock/contracts/types.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/_module-exports.d.ts +5 -0
- package/dist/shared-lock/implementations/adapters/_module-exports.js +6 -0
- package/dist/shared-lock/implementations/adapters/_module-exports.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/_module.d.ts +1 -0
- package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/_module.js +2 -0
- package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/_module.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.d.ts +114 -0
- package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.js +496 -0
- package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/_module.d.ts +1 -0
- package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/_module.js +2 -0
- package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/_module.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.d.ts +79 -0
- package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.js +347 -0
- package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/_module.d.ts +1 -0
- package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/_module.js +2 -0
- package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/_module.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.d.ts +112 -0
- package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.js +805 -0
- package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/_module.d.ts +1 -0
- package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/_module.js +2 -0
- package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/_module.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.d.ts +23 -0
- package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.js +42 -0
- package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/_module.d.ts +1 -0
- package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/_module.js +2 -0
- package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/_module.js.map +1 -0
- package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/redis-shared-lock-adapter.d.ts +79 -0
- package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/redis-shared-lock-adapter.js +630 -0
- package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/redis-shared-lock-adapter.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/_module-exports.d.ts +2 -0
- package/dist/shared-lock/implementations/derivables/_module-exports.js +3 -0
- package/dist/shared-lock/implementations/derivables/_module-exports.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/_module.d.ts +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/_module.js +2 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/_module.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/database-shared-lock-adapter.d.ts +27 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/database-shared-lock-adapter.js +208 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/database-shared-lock-adapter.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/is-database-shared-lock-adapter.d.ts +8 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/is-database-shared-lock-adapter.js +12 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/is-database-shared-lock-adapter.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/resolve-database-shared-lock-adapter.d.ts +8 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/resolve-database-shared-lock-adapter.js +15 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/resolve-database-shared-lock-adapter.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.d.ts +190 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.js +177 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.d.ts +41 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.js +77 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.d.ts +95 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.js +542 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/_module.d.ts +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/_module.js +2 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/_module.js.map +1 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.d.ts +97 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.js +128 -0
- package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.js.map +1 -0
- package/dist/shared-lock/implementations/test-utilities/_module-exports.d.ts +3 -0
- package/dist/shared-lock/implementations/test-utilities/_module-exports.js +4 -0
- package/dist/shared-lock/implementations/test-utilities/_module-exports.js.map +1 -0
- package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.d.ts +59 -0
- package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.js +944 -0
- package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.js.map +1 -0
- package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.d.ts +59 -0
- package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.js +1921 -0
- package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.js.map +1 -0
- package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.d.ts +67 -0
- package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.js +9833 -0
- package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.js.map +1 -0
- package/dist/task/_module-exports.d.ts +1 -0
- package/dist/task/_module-exports.js +2 -0
- package/dist/task/_module-exports.js.map +1 -0
- package/dist/{async/utilities/abort-and-fail → task}/abort-and-fail.d.ts +1 -1
- package/dist/{async/utilities/abort-and-fail → task}/abort-and-fail.js +1 -1
- package/dist/task/abort-and-fail.js.map +1 -0
- package/dist/task/task.d.ts +194 -0
- package/dist/task/task.js +212 -0
- package/dist/task/task.js.map +1 -0
- package/dist/time-span/contracts/_module-exports.d.ts +1 -0
- package/dist/time-span/contracts/_module-exports.js +2 -0
- package/dist/time-span/contracts/_module-exports.js.map +1 -0
- package/dist/time-span/contracts/time-span.contract.d.ts +19 -0
- package/dist/time-span/contracts/time-span.contract.js +10 -0
- package/dist/time-span/contracts/time-span.contract.js.map +1 -0
- package/dist/time-span/implementations/_module-exports.d.ts +1 -0
- package/dist/time-span/implementations/_module-exports.js +2 -0
- package/dist/time-span/implementations/_module-exports.js.map +1 -0
- package/dist/{utilities/classes/time-span → time-span/implementations}/time-span.d.ts +49 -11
- package/dist/{utilities/classes/time-span → time-span/implementations}/time-span.js +33 -11
- package/dist/time-span/implementations/time-span.js.map +1 -0
- package/dist/utilities/classes/_module.d.ts +0 -3
- package/dist/utilities/classes/_module.js +0 -3
- package/dist/utilities/classes/_module.js.map +1 -1
- package/dist/utilities/contracts/_module.d.ts +1 -1
- package/dist/utilities/contracts/_module.js +1 -1
- package/dist/utilities/contracts/_module.js.map +1 -1
- package/dist/utilities/contracts/comparable.contract.d.ts +49 -0
- package/dist/utilities/contracts/comparable.contract.js +5 -0
- package/dist/utilities/contracts/comparable.contract.js.map +1 -0
- 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/functions/is-standard-schema.d.ts +6 -0
- package/dist/utilities/functions/is-standard-schema.js +6 -0
- package/dist/utilities/functions/is-standard-schema.js.map +1 -1
- package/dist/utilities/functions/lazy.d.ts +3 -3
- package/dist/utilities/functions/lazy.js +3 -3
- package/dist/utilities/functions/lazy.js.map +1 -1
- package/dist/utilities/functions/option.d.ts +3 -0
- package/dist/utilities/functions/option.js +3 -0
- package/dist/utilities/functions/option.js.map +1 -1
- package/dist/utilities/functions/validate.d.ts +5 -0
- package/dist/utilities/functions/validate.js +5 -0
- package/dist/utilities/functions/validate.js.map +1 -1
- package/dist/utilities/types/any-class.type.d.ts +6 -0
- package/dist/utilities/types/any-class.type.js +3 -0
- package/dist/utilities/types/any-class.type.js.map +1 -1
- package/package.json +67 -5
- package/dist/async/_module-exports.d.ts +0 -4
- package/dist/async/_module-exports.js +0 -5
- package/dist/async/_module-exports.js.map +0 -1
- package/dist/async/async.errors.d.ts +0 -47
- package/dist/async/async.errors.js +0 -61
- package/dist/async/async.errors.js.map +0 -1
- package/dist/async/backof-policies/_module.d.ts +0 -5
- package/dist/async/backof-policies/_module.js +0 -6
- package/dist/async/backof-policies/_module.js.map +0 -1
- package/dist/async/backof-policies/_shared.js.map +0 -1
- package/dist/async/backof-policies/constant-backoff-policy/_module.d.ts +0 -1
- package/dist/async/backof-policies/constant-backoff-policy/_module.js +0 -2
- package/dist/async/backof-policies/constant-backoff-policy/_module.js.map +0 -1
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +0 -1
- package/dist/async/backof-policies/exponential-backoff-policy/_module.d.ts +0 -1
- package/dist/async/backof-policies/exponential-backoff-policy/_module.js +0 -2
- package/dist/async/backof-policies/exponential-backoff-policy/_module.js.map +0 -1
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +0 -35
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +0 -1
- package/dist/async/backof-policies/linear-backoff-policy/_module.d.ts +0 -1
- package/dist/async/backof-policies/linear-backoff-policy/_module.js +0 -2
- package/dist/async/backof-policies/linear-backoff-policy/_module.js.map +0 -1
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +0 -35
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +0 -1
- package/dist/async/backof-policies/polynomial-backoff-policy/_module.d.ts +0 -1
- package/dist/async/backof-policies/polynomial-backoff-policy/_module.js +0 -2
- package/dist/async/backof-policies/polynomial-backoff-policy/_module.js.map +0 -1
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +0 -35
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +0 -1
- package/dist/async/middlewares/_module.d.ts +0 -7
- package/dist/async/middlewares/_module.js +0 -8
- package/dist/async/middlewares/_module.js.map +0 -1
- package/dist/async/middlewares/bulkhead/_module.d.ts +0 -1
- package/dist/async/middlewares/bulkhead/_module.js +0 -2
- package/dist/async/middlewares/bulkhead/_module.js.map +0 -1
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.d.ts +0 -80
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.js +0 -46
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.js.map +0 -1
- package/dist/async/middlewares/dynamic/_module.d.ts +0 -1
- package/dist/async/middlewares/dynamic/_module.js +0 -2
- package/dist/async/middlewares/dynamic/_module.js.map +0 -1
- package/dist/async/middlewares/dynamic/dynamic.middleware.js.map +0 -1
- package/dist/async/middlewares/fallback/_module.d.ts +0 -2
- package/dist/async/middlewares/fallback/_module.js +0 -3
- package/dist/async/middlewares/fallback/_module.js.map +0 -1
- package/dist/async/middlewares/fallback/fallback.middleware.js.map +0 -1
- package/dist/async/middlewares/fallback/fallback.types.js.map +0 -1
- package/dist/async/middlewares/hedging/_module.d.ts +0 -2
- package/dist/async/middlewares/hedging/_module.js +0 -3
- package/dist/async/middlewares/hedging/_module.js.map +0 -1
- package/dist/async/middlewares/hedging/hedging.types.d.ts +0 -121
- package/dist/async/middlewares/hedging/hedging.types.js +0 -6
- package/dist/async/middlewares/hedging/hedging.types.js.map +0 -1
- package/dist/async/middlewares/hedging/sequential-hedging.middleware.d.ts +0 -51
- package/dist/async/middlewares/hedging/sequential-hedging.middleware.js +0 -133
- package/dist/async/middlewares/hedging/sequential-hedging.middleware.js.map +0 -1
- package/dist/async/middlewares/observe/_module.d.ts +0 -2
- package/dist/async/middlewares/observe/_module.js +0 -3
- package/dist/async/middlewares/observe/_module.js.map +0 -1
- package/dist/async/middlewares/observe/observe.middleware.js.map +0 -1
- package/dist/async/middlewares/observe/observe.types.js +0 -6
- package/dist/async/middlewares/observe/observe.types.js.map +0 -1
- package/dist/async/middlewares/retry/_module.d.ts +0 -2
- package/dist/async/middlewares/retry/_module.js +0 -3
- package/dist/async/middlewares/retry/_module.js.map +0 -1
- package/dist/async/middlewares/retry/retry.middleware.js.map +0 -1
- package/dist/async/middlewares/retry/retry.types.js +0 -7
- package/dist/async/middlewares/retry/retry.types.js.map +0 -1
- package/dist/async/middlewares/timeout/_module.d.ts +0 -2
- package/dist/async/middlewares/timeout/_module.js +0 -3
- package/dist/async/middlewares/timeout/_module.js.map +0 -1
- package/dist/async/middlewares/timeout/timeout.middleware.js.map +0 -1
- package/dist/async/middlewares/timeout/timeout.type.js +0 -6
- package/dist/async/middlewares/timeout/timeout.type.js.map +0 -1
- package/dist/async/utilities/_module.d.ts +0 -4
- package/dist/async/utilities/_module.js +0 -5
- package/dist/async/utilities/_module.js.map +0 -1
- package/dist/async/utilities/abort-and-fail/_module.d.ts +0 -1
- package/dist/async/utilities/abort-and-fail/_module.js +0 -2
- package/dist/async/utilities/abort-and-fail/_module.js.map +0 -1
- package/dist/async/utilities/abort-and-fail/abort-and-fail.js.map +0 -1
- package/dist/async/utilities/lazy-promise/_module.d.ts +0 -1
- package/dist/async/utilities/lazy-promise/_module.js +0 -2
- package/dist/async/utilities/lazy-promise/_module.js.map +0 -1
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +0 -153
- package/dist/async/utilities/lazy-promise/lazy-promise.js +0 -176
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +0 -1
- package/dist/async/utilities/promise-queue/_module.d.ts +0 -1
- package/dist/async/utilities/promise-queue/_module.js +0 -2
- package/dist/async/utilities/promise-queue/_module.js.map +0 -1
- package/dist/async/utilities/promise-queue/promise-queue.d.ts +0 -32
- package/dist/async/utilities/promise-queue/promise-queue.js +0 -118
- package/dist/async/utilities/promise-queue/promise-queue.js.map +0 -1
- package/dist/async/utilities/timeout-and-fail/_module.d.ts +0 -1
- package/dist/async/utilities/timeout-and-fail/_module.js +0 -2
- package/dist/async/utilities/timeout-and-fail/_module.js.map +0 -1
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.d.ts +0 -7
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js +0 -22
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js.map +0 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-state.d.ts +0 -40
- package/dist/lock/implementations/derivables/lock-provider/lock-state.js +0 -60
- package/dist/lock/implementations/derivables/lock-provider/lock-state.js.map +0 -1
- package/dist/serde/contracts/serializable.contract.d.ts +0 -12
- package/dist/serde/contracts/serializable.contract.js +0 -5
- package/dist/serde/contracts/serializable.contract.js.map +0 -1
- package/dist/serde/implementations/adapters/mongodb-serde/_module.d.ts +0 -1
- package/dist/serde/implementations/adapters/mongodb-serde/_module.js +0 -2
- package/dist/serde/implementations/adapters/mongodb-serde/_module.js.map +0 -1
- package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.d.ts +0 -13
- package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js +0 -38
- package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js.map +0 -1
- package/dist/serde/implementations/adapters/redis-serde/_module.d.ts +0 -1
- package/dist/serde/implementations/adapters/redis-serde/_module.js +0 -2
- package/dist/serde/implementations/adapters/redis-serde/_module.js.map +0 -1
- package/dist/serde/implementations/adapters/redis-serde/redis-serde.d.ts +0 -13
- package/dist/serde/implementations/adapters/redis-serde/redis-serde.js +0 -39
- package/dist/serde/implementations/adapters/redis-serde/redis-serde.js.map +0 -1
- package/dist/serde/implementations/adapters/sql-serde/_module.d.ts +0 -1
- package/dist/serde/implementations/adapters/sql-serde/_module.js +0 -2
- package/dist/serde/implementations/adapters/sql-serde/_module.js.map +0 -1
- package/dist/serde/implementations/adapters/sql-serde/sql-serde.d.ts +0 -13
- package/dist/serde/implementations/adapters/sql-serde/sql-serde.js +0 -39
- package/dist/serde/implementations/adapters/sql-serde/sql-serde.js.map +0 -1
- package/dist/utilities/classes/hooks/_module.d.ts +0 -3
- package/dist/utilities/classes/hooks/_module.js +0 -4
- package/dist/utilities/classes/hooks/_module.js.map +0 -1
- package/dist/utilities/classes/hooks/async-hooks.js.map +0 -1
- package/dist/utilities/classes/hooks/hooks.js.map +0 -1
- package/dist/utilities/classes/hooks/types.js +0 -5
- package/dist/utilities/classes/hooks/types.js.map +0 -1
- package/dist/utilities/classes/namespace/_module.d.ts +0 -1
- package/dist/utilities/classes/namespace/_module.js +0 -2
- package/dist/utilities/classes/namespace/_module.js.map +0 -1
- package/dist/utilities/classes/namespace/namespace.d.ts +0 -85
- package/dist/utilities/classes/namespace/namespace.js +0 -125
- package/dist/utilities/classes/namespace/namespace.js.map +0 -1
- package/dist/utilities/classes/time-span/_module.d.ts +0 -1
- package/dist/utilities/classes/time-span/_module.js +0 -2
- package/dist/utilities/classes/time-span/_module.js.map +0 -1
- package/dist/utilities/classes/time-span/time-span.js.map +0 -1
- package/dist/utilities/contracts/serialized-error.contract.d.ts +0 -13
- package/dist/utilities/contracts/serialized-error.contract.js +0 -5
- package/dist/utilities/contracts/serialized-error.contract.js.map +0 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module
|
|
2
|
+
* @module Resilience
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import type {
|
|
4
|
+
import type { RetrySettings } from "../../../resilience/middlewares/retry/retry.types.js";
|
|
5
|
+
import type { AsyncMiddlewareFn, HookContext } from "../../../hooks/_module-exports.js";
|
|
6
6
|
/**
|
|
7
7
|
* The `retry` middleware enables automatic retries for all errors or specific errors, with configurable backoff policies.
|
|
8
8
|
* An error will be thrown when all retry attempts fail.
|
|
9
9
|
*
|
|
10
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
11
|
-
* @group
|
|
10
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
11
|
+
* @group Middlewares
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
|
-
* import { retry } from "@daiso-tech/core/
|
|
16
|
-
* import { AsyncHooks
|
|
15
|
+
* import { retry } from "@daiso-tech/core/resilience";
|
|
16
|
+
* import { AsyncHooks } from "@daiso-tech/core/hooks";
|
|
17
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span";
|
|
17
18
|
*
|
|
18
19
|
* const data = await new AsyncHooks(
|
|
19
20
|
* async (url: string, signal?: AbortSignal): Promise<unknown> => {
|
|
@@ -40,8 +41,10 @@ import type { RetrySettings } from "../../../async/middlewares/retry/retry.types
|
|
|
40
41
|
* The middleware works also when the function returns a {@link Result | `Result`} type.
|
|
41
42
|
* @example
|
|
42
43
|
* ```ts
|
|
43
|
-
* import { retry } from "@daiso-tech/core/
|
|
44
|
-
* import {
|
|
44
|
+
* import { retry } from "@daiso-tech/core/resilience";
|
|
45
|
+
* import { Result, resultFailure, resultSuccess } from "@daiso-tech/core/utilities";
|
|
46
|
+
* import { AsyncHooks } from "@daiso-tech/core/hooks";
|
|
47
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span";
|
|
45
48
|
*
|
|
46
49
|
* const data = await new AsyncHooks(
|
|
47
50
|
* async (url: string, signal?: AbortSignal): Promise<Result> => {
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module
|
|
2
|
+
* @module Resilience
|
|
3
3
|
*/
|
|
4
4
|
import { callInvokable, optionNone, optionSome, OPTION, UnexpectedError, } from "../../../utilities/_module-exports.js";
|
|
5
|
-
import { exponentialBackoffPolicy } from "../../../
|
|
5
|
+
import { exponentialBackoffPolicy } from "../../../backoff-policies/_module-exports.js";
|
|
6
6
|
import { callErrorPolicyOnThrow, callErrorPolicyOnValue, } from "../../../utilities/_module-exports.js";
|
|
7
|
-
import {
|
|
7
|
+
import { Task } from "../../../task/_module-exports.js";
|
|
8
|
+
import { RetryResilienceError } from "../../../resilience/resilience.errors.js";
|
|
8
9
|
/**
|
|
9
10
|
* The `retry` middleware enables automatic retries for all errors or specific errors, with configurable backoff policies.
|
|
10
11
|
* An error will be thrown when all retry attempts fail.
|
|
11
12
|
*
|
|
12
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
13
|
-
* @group
|
|
13
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
14
|
+
* @group Middlewares
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
16
17
|
* ```ts
|
|
17
|
-
* import { retry } from "@daiso-tech/core/
|
|
18
|
-
* import { AsyncHooks
|
|
18
|
+
* import { retry } from "@daiso-tech/core/resilience";
|
|
19
|
+
* import { AsyncHooks } from "@daiso-tech/core/hooks";
|
|
20
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span";
|
|
19
21
|
*
|
|
20
22
|
* const data = await new AsyncHooks(
|
|
21
23
|
* async (url: string, signal?: AbortSignal): Promise<unknown> => {
|
|
@@ -42,8 +44,10 @@ import { LazyPromise } from "../../../async/utilities/lazy-promise/_module.js";
|
|
|
42
44
|
* The middleware works also when the function returns a {@link Result | `Result`} type.
|
|
43
45
|
* @example
|
|
44
46
|
* ```ts
|
|
45
|
-
* import { retry } from "@daiso-tech/core/
|
|
46
|
-
* import {
|
|
47
|
+
* import { retry } from "@daiso-tech/core/resilience";
|
|
48
|
+
* import { Result, resultFailure, resultSuccess } from "@daiso-tech/core/utilities";
|
|
49
|
+
* import { AsyncHooks } from "@daiso-tech/core/hooks";
|
|
50
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span";
|
|
47
51
|
*
|
|
48
52
|
* const data = await new AsyncHooks(
|
|
49
53
|
* async (url: string, signal?: AbortSignal): Promise<Result> => {
|
|
@@ -71,7 +75,7 @@ export function retry(settings = {}) {
|
|
|
71
75
|
const { maxAttempts = 4, backoffPolicy = exponentialBackoffPolicy(), errorPolicy, onRetryDelay = () => { }, onExecutionAttempt = () => { }, } = settings;
|
|
72
76
|
return async (args, next, { context, signal }) => {
|
|
73
77
|
let result = optionNone();
|
|
74
|
-
|
|
78
|
+
const allErrors = [];
|
|
75
79
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
76
80
|
try {
|
|
77
81
|
callInvokable(onExecutionAttempt, { attempt, args, context });
|
|
@@ -94,7 +98,7 @@ export function retry(settings = {}) {
|
|
|
94
98
|
args,
|
|
95
99
|
context,
|
|
96
100
|
});
|
|
97
|
-
await
|
|
101
|
+
await Task.delay(waitTime, signal);
|
|
98
102
|
// Handle retrying if an error is thrown
|
|
99
103
|
}
|
|
100
104
|
catch (error) {
|
|
@@ -102,7 +106,7 @@ export function retry(settings = {}) {
|
|
|
102
106
|
break;
|
|
103
107
|
}
|
|
104
108
|
if (await callErrorPolicyOnThrow(errorPolicy, error)) {
|
|
105
|
-
|
|
109
|
+
allErrors.push(error);
|
|
106
110
|
}
|
|
107
111
|
else {
|
|
108
112
|
throw error;
|
|
@@ -115,11 +119,11 @@ export function retry(settings = {}) {
|
|
|
115
119
|
args,
|
|
116
120
|
context,
|
|
117
121
|
});
|
|
118
|
-
await
|
|
122
|
+
await Task.delay(waitTime, signal);
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
|
-
if (
|
|
122
|
-
throw
|
|
125
|
+
if (allErrors.length !== 0) {
|
|
126
|
+
throw new RetryResilienceError(allErrors, "!!__MESSAGE__!!");
|
|
123
127
|
}
|
|
124
128
|
if (result.type === OPTION.SOME) {
|
|
125
129
|
return result.value;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.middleware.js","sourceRoot":"","sources":["../../../../src/resilience/middlewares/retry/retry.middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACH,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,eAAe,GAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,OAAO,EACH,sBAAsB,EACtB,sBAAsB,GACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAKjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,MAAM,UAAU,KAAK,CAKjB,WAAmE,EAAE;IAErE,MAAM,EACF,WAAW,GAAG,CAAC,EACf,aAAa,GAAG,wBAAwB,EAAE,EAC1C,WAAW,EACX,YAAY,GAAG,GAAG,EAAE,GAAE,CAAC,EACvB,kBAAkB,GAAG,GAAG,EAAE,GAAE,CAAC,GAChC,GAAG,QAAQ,CAAC;IACb,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC7C,IAAI,MAAM,GAAoB,UAAU,EAAE,CAAC;QAC3C,MAAM,SAAS,GAAc,EAAE,CAAC;QAChC,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;YACtD,IAAI,CAAC;gBACD,aAAa,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;gBAC9D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;gBAElC,gDAAgD;gBAChD,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;gBAC3B,IAAI,CAAC,CAAC,MAAM,sBAAsB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;oBACtD,OAAO,KAAK,CAAC;gBACjB,CAAC;gBACD,4FAA4F;gBAC5F,MAAM,aAAa,GAAG,KAAsB,CAAC;gBAE7C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;oBACjB,MAAM;gBACV,CAAC;gBAED,MAAM,QAAQ,GAAG,aAAa,CAC1B,aAAa,EACb,OAAO,EACP,aAAa,CAAC,KAAK,CACtB,CAAC;gBAEF,aAAa,CAAC,YAAY,EAAE;oBACxB,KAAK,EAAE,aAAa,CAAC,KAAK;oBAC1B,QAAQ;oBACR,OAAO;oBACP,IAAI;oBACJ,OAAO;iBACV,CAAC,CAAC;gBACH,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAEnC,wCAAwC;YAC5C,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACtB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;oBACjB,MAAM;gBACV,CAAC;gBAED,IAAI,MAAM,sBAAsB,CAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC;oBACxD,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC1B,CAAC;qBAAM,CAAC;oBACJ,MAAM,KAAK,CAAC;gBAChB,CAAC;gBAED,MAAM,QAAQ,GAAG,aAAa,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;gBAE9D,aAAa,CAAC,YAAY,EAAE;oBACxB,KAAK,EAAE,KAAK;oBACZ,QAAQ;oBACR,OAAO;oBACP,IAAI;oBACJ,OAAO;iBACV,CAAC,CAAC;gBACH,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACvC,CAAC;QACL,CAAC;QAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,oBAAoB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;YAC9B,OAAO,MAAM,CAAC,KAAK,CAAC;QACxB,CAAC;QACD,MAAM,IAAI,eAAe,CAAC,iBAAiB,CAAC,CAAC;IACjD,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module
|
|
2
|
+
* @module Resilience
|
|
3
3
|
*/
|
|
4
|
-
import type { InferResultError
|
|
5
|
-
import { type Invokable
|
|
6
|
-
import { type BackoffPolicy } from "../../../
|
|
4
|
+
import type { InferResultError } from "../../../utilities/_module-exports.js";
|
|
5
|
+
import { type Invokable } from "../../../utilities/_module-exports.js";
|
|
6
|
+
import { type BackoffPolicy } from "../../../backoff-policies/_module-exports.js";
|
|
7
7
|
import { type ErrorPolicySettings } from "../../../utilities/_module-exports.js";
|
|
8
|
+
import type { ITimeSpan } from "../../../time-span/contracts/_module-exports.js";
|
|
9
|
+
import type { HookContext } from "../../../hooks/_module-exports.js";
|
|
8
10
|
/**
|
|
9
11
|
*
|
|
10
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
12
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
11
13
|
* @group Middlewares
|
|
12
14
|
*/
|
|
13
15
|
export type OnRetryAttemptData<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
@@ -17,31 +19,31 @@ export type OnRetryAttemptData<TParameters extends unknown[] = unknown[], TConte
|
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
*
|
|
20
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
22
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
21
23
|
* @group Middlewares
|
|
22
24
|
*/
|
|
23
25
|
export type OnExecutionAttempt<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = Invokable<[data: OnRetryAttemptData<TParameters, TContext>]>;
|
|
24
26
|
/**
|
|
25
27
|
*
|
|
26
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
28
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
27
29
|
* @group Middlewares
|
|
28
30
|
*/
|
|
29
31
|
export type OnRetryDelayData<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
30
32
|
error: unknown;
|
|
31
33
|
attempt: number;
|
|
32
|
-
waitTime:
|
|
34
|
+
waitTime: ITimeSpan;
|
|
33
35
|
args: TParameters;
|
|
34
36
|
context: TContext;
|
|
35
37
|
};
|
|
36
38
|
/**
|
|
37
39
|
*
|
|
38
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
40
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
39
41
|
* @group Middlewares
|
|
40
42
|
*/
|
|
41
43
|
export type OnRetryDelay<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = Invokable<[data: OnRetryDelayData<TParameters, TContext>]>;
|
|
42
44
|
/**
|
|
43
45
|
*
|
|
44
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
46
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
45
47
|
* @group Middlewares
|
|
46
48
|
*/
|
|
47
49
|
export type RetryCallbacks<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
@@ -56,7 +58,7 @@ export type RetryCallbacks<TParameters extends unknown[] = unknown[], TContext e
|
|
|
56
58
|
};
|
|
57
59
|
/**
|
|
58
60
|
*
|
|
59
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
61
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
60
62
|
* @group Middlewares
|
|
61
63
|
*/
|
|
62
64
|
export type RetrySettings<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext, TReturn = unknown> = RetryCallbacks<TParameters, TContext> & ErrorPolicySettings<InferResultError<TReturn>> & {
|
|
@@ -68,7 +70,7 @@ export type RetrySettings<TParameters extends unknown[] = unknown[], TContext ex
|
|
|
68
70
|
/**
|
|
69
71
|
* @default
|
|
70
72
|
* ```ts
|
|
71
|
-
* import { exponentialBackoffPolicy } from "@daiso-tech/core/
|
|
73
|
+
* import { exponentialBackoffPolicy } from "@daiso-tech/core/resilience";
|
|
72
74
|
*
|
|
73
75
|
* exponentialBackoffPolicy();
|
|
74
76
|
* ```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.types.js","sourceRoot":"","sources":["../../../../src/resilience/middlewares/retry/retry.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAkB,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAA4B,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/resilience/middlewares/timeout/_module.ts"],"names":[],"mappings":"AAAA,cAAc,wDAAwD,CAAC;AACvE,cAAc,kDAAkD,CAAC"}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module
|
|
2
|
+
* @module Resilience
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import type {
|
|
4
|
+
import type { TimeoutSettings } from "../../../resilience/middlewares/timeout/timeout.type.js";
|
|
5
|
+
import type { AsyncMiddlewareFn, HookContext } from "../../../hooks/_module-exports.js";
|
|
6
6
|
/**
|
|
7
7
|
* The `timeout` middleware automatically cancels functions after a specified time period, throwing an error when aborted.
|
|
8
8
|
*
|
|
9
9
|
* Note when a timeout occurs, the function call continues executing in the background and only the `Promise` will be aborted.
|
|
10
10
|
* To ensure correct abortion behavior, provide an {@link AbortSignalBinder | `AbortSignalBinder`} to {@link AsyncHooks | `AsyncHooks`}.
|
|
11
11
|
*
|
|
12
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
12
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
13
13
|
* @group Middlewares
|
|
14
|
-
* @throws {
|
|
14
|
+
* @throws {TimeoutResilienceError} {@link TimeoutResilienceError}
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```ts
|
|
18
|
-
* import { timeout } from "@daiso-tech/core/
|
|
19
|
-
* import {
|
|
18
|
+
* import { timeout } from "@daiso-tech/core/resilience";
|
|
19
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span";
|
|
20
|
+
* import { AsyncHooks } from "@daiso-tech/core/hooks";
|
|
21
|
+
*
|
|
20
22
|
*
|
|
21
23
|
* const data = await new AsyncHooks(
|
|
22
24
|
* async (url: string, signal?: AbortSignal): Promise<unknown> => {
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module
|
|
2
|
+
* @module Resilience
|
|
3
3
|
*/
|
|
4
|
-
import { TimeSpan } from "../../../utilities/_module-exports.js";
|
|
5
|
-
import {} from "../../../utilities/_module-exports.js";
|
|
6
4
|
import { callInvokable } from "../../../utilities/_module-exports.js";
|
|
7
|
-
import {
|
|
8
|
-
import { timeoutAndFail } from "../../../
|
|
5
|
+
import { TimeoutResilienceError } from "../../../resilience/resilience.errors.js";
|
|
6
|
+
import { timeoutAndFail } from "../../../resilience/utilities/timeout-and-fail/_module.js";
|
|
7
|
+
import { TimeSpan } from "../../../time-span/implementations/_module-exports.js";
|
|
9
8
|
/**
|
|
10
9
|
* The `timeout` middleware automatically cancels functions after a specified time period, throwing an error when aborted.
|
|
11
10
|
*
|
|
12
11
|
* Note when a timeout occurs, the function call continues executing in the background and only the `Promise` will be aborted.
|
|
13
12
|
* To ensure correct abortion behavior, provide an {@link AbortSignalBinder | `AbortSignalBinder`} to {@link AsyncHooks | `AsyncHooks`}.
|
|
14
13
|
*
|
|
15
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
14
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
16
15
|
* @group Middlewares
|
|
17
|
-
* @throws {
|
|
16
|
+
* @throws {TimeoutResilienceError} {@link TimeoutResilienceError}
|
|
18
17
|
*
|
|
19
18
|
* @example
|
|
20
19
|
* ```ts
|
|
21
|
-
* import { timeout } from "@daiso-tech/core/
|
|
22
|
-
* import {
|
|
20
|
+
* import { timeout } from "@daiso-tech/core/resilience";
|
|
21
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span";
|
|
22
|
+
* import { AsyncHooks } from "@daiso-tech/core/hooks";
|
|
23
|
+
*
|
|
23
24
|
*
|
|
24
25
|
* const data = await new AsyncHooks(
|
|
25
26
|
* async (url: string, signal?: AbortSignal): Promise<unknown> => {
|
|
@@ -48,11 +49,11 @@ export function timeout(settings = {}) {
|
|
|
48
49
|
}, signal);
|
|
49
50
|
}
|
|
50
51
|
catch (error) {
|
|
51
|
-
if (error instanceof
|
|
52
|
+
if (error instanceof TimeoutResilienceError) {
|
|
52
53
|
callInvokable(onTimeout, {
|
|
53
54
|
args,
|
|
54
55
|
context,
|
|
55
|
-
waitTime,
|
|
56
|
+
waitTime: TimeSpan.fromTimeSpan(waitTime),
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
throw error;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout.middleware.js","sourceRoot":"","sources":["../../../../src/resilience/middlewares/timeout/timeout.middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAEpF,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAM1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,OAAO,CAKnB,WAA4D,EAAE;IAE9D,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE,GAAE,CAAC,EAAE,GAC9D,QAAQ,CAAC;IACb,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;QACpD,IAAI,CAAC;YACD,OAAO,MAAM,cAAc,CACvB,IAAI,CAAC,GAAG,IAAI,CAAC,EACb,QAAQ,EACR,CAAC,KAAc,EAAE,EAAE;gBACf,KAAK,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC,EACD,MAAM,CACT,CAAC;QACN,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,IAAI,KAAK,YAAY,sBAAsB,EAAE,CAAC;gBAC1C,aAAa,CAAC,SAAS,EAAE;oBACrB,IAAI;oBACJ,OAAO;oBACP,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;iBAC5C,CAAC,CAAC;YACP,CAAC;YACD,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module
|
|
2
|
+
* @module Resilience
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
4
|
+
import type { HookContext } from "../../../hooks/_module-exports.js";
|
|
5
|
+
import type { ITimeSpan } from "../../../time-span/contracts/_module-exports.js";
|
|
6
|
+
import type { TimeSpan } from "../../../time-span/implementations/_module-exports.js";
|
|
6
7
|
import { type Invokable } from "../../../utilities/_module-exports.js";
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
9
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
10
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
10
11
|
* @group Middlewares
|
|
11
12
|
*/
|
|
12
13
|
export type OnTimeoutData<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
@@ -16,13 +17,13 @@ export type OnTimeoutData<TParameters extends unknown[] = unknown[], TContext ex
|
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
*
|
|
19
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
20
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
20
21
|
* @group Middlewares
|
|
21
22
|
*/
|
|
22
23
|
export type OnTimeout<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = Invokable<[data: OnTimeoutData<TParameters, TContext>]>;
|
|
23
24
|
/**
|
|
24
25
|
*
|
|
25
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
26
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
26
27
|
* @group Middlewares
|
|
27
28
|
*/
|
|
28
29
|
export type TimeoutCallbacks<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
@@ -33,7 +34,7 @@ export type TimeoutCallbacks<TParameters extends unknown[] = unknown[], TContext
|
|
|
33
34
|
};
|
|
34
35
|
/**
|
|
35
36
|
*
|
|
36
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
37
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
37
38
|
* @group Middlewares
|
|
38
39
|
*/
|
|
39
40
|
export type TimeoutSettings<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = TimeoutCallbacks<TParameters, TContext> & {
|
|
@@ -42,10 +43,10 @@ export type TimeoutSettings<TParameters extends unknown[] = unknown[], TContext
|
|
|
42
43
|
*
|
|
43
44
|
* @default
|
|
44
45
|
* ```ts
|
|
45
|
-
* import { TimeSpan } from "@daiso-tech/core/
|
|
46
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span" from "@daiso-tech/core/time-span";
|
|
46
47
|
*
|
|
47
48
|
* TimeSpan.fromSeconds(2)
|
|
48
49
|
* ```
|
|
49
50
|
*/
|
|
50
|
-
waitTime?:
|
|
51
|
+
waitTime?: ITimeSpan;
|
|
51
52
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout.type.js","sourceRoot":"","sources":["../../../../src/resilience/middlewares/timeout/timeout.type.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAkB,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Resilience
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
7
|
+
* @group Errors
|
|
8
|
+
*/
|
|
9
|
+
export declare class TimeoutResilienceError extends Error {
|
|
10
|
+
constructor(message: string, cause?: unknown);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
15
|
+
* @group Errors
|
|
16
|
+
*/
|
|
17
|
+
export declare class RetryResilienceError extends AggregateError {
|
|
18
|
+
constructor(errors: unknown[], message: string);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
23
|
+
* @group Errors
|
|
24
|
+
*/
|
|
25
|
+
export declare const RESILIENCE_ERRORS: {
|
|
26
|
+
readonly Retry: typeof RetryResilienceError;
|
|
27
|
+
readonly Timeout: typeof TimeoutResilienceError;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
32
|
+
* @group Errors
|
|
33
|
+
*/
|
|
34
|
+
export type AllResilienceErrors = RetryResilienceError | TimeoutResilienceError;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
38
|
+
* @group Errors
|
|
39
|
+
*/
|
|
40
|
+
export declare function isResilienceError(value: unknown): value is AllResilienceErrors;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Resilience
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
7
|
+
* @group Errors
|
|
8
|
+
*/
|
|
9
|
+
export class TimeoutResilienceError extends Error {
|
|
10
|
+
constructor(message, cause) {
|
|
11
|
+
super(message, { cause });
|
|
12
|
+
this.name = TimeoutResilienceError.name;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
18
|
+
* @group Errors
|
|
19
|
+
*/
|
|
20
|
+
export class RetryResilienceError extends AggregateError {
|
|
21
|
+
constructor(errors, message) {
|
|
22
|
+
super(errors, message);
|
|
23
|
+
this.name = RetryResilienceError.name;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
29
|
+
* @group Errors
|
|
30
|
+
*/
|
|
31
|
+
export const RESILIENCE_ERRORS = {
|
|
32
|
+
Retry: RetryResilienceError,
|
|
33
|
+
Timeout: TimeoutResilienceError,
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* IMPORT_PATH: `"@daiso-tech/core/resilience"`
|
|
38
|
+
* @group Errors
|
|
39
|
+
*/
|
|
40
|
+
export function isResilienceError(value) {
|
|
41
|
+
for (const ErrorClass of Object.values(RESILIENCE_ERRORS)) {
|
|
42
|
+
if (!(value instanceof ErrorClass)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=resilience.errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resilience.errors.js","sourceRoot":"","sources":["../../src/resilience/resilience.errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAC;IAC5C,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IACpD,YAAY,MAAiB,EAAE,OAAe;QAC1C,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC;IAC1C,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,KAAK,EAAE,oBAAoB;IAC3B,OAAO,EAAE,sBAAsB;CACzB,CAAC;AASX;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC7B,KAAc;IAEd,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACxD,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;YACjC,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../src/resilience/utilities/_module.ts"],"names":[],"mappings":"AAAA,cAAc,kDAAkD,CAAC;AACjE,cAAc,oDAAoD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../resilience/utilities/abort-and-fail/abort-and-fail.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/resilience/utilities/abort-and-fail/_module.ts"],"names":[],"mappings":"AAAA,cAAc,yDAAyD,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Resilience
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
function abortSignalToPromise(abortSignal) {
|
|
8
|
+
let reject_ = null;
|
|
9
|
+
function abort() {
|
|
10
|
+
if (reject_ === null) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
reject_(abortSignal.reason);
|
|
14
|
+
}
|
|
15
|
+
if (abortSignal.aborted) {
|
|
16
|
+
return {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
18
|
+
promise: Promise.reject(abortSignal.reason),
|
|
19
|
+
abort,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
promise: new Promise((_resolve, reject) => {
|
|
24
|
+
reject_ = reject;
|
|
25
|
+
if (abortSignal.aborted) {
|
|
26
|
+
abort();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
abortSignal.addEventListener("abort", abort, {
|
|
30
|
+
once: true,
|
|
31
|
+
});
|
|
32
|
+
}),
|
|
33
|
+
abort,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export async function abortAndFail(promise, abortSignal) {
|
|
40
|
+
if (abortSignal.aborted) {
|
|
41
|
+
throw abortSignal.reason;
|
|
42
|
+
}
|
|
43
|
+
const { promise: abortSignalPromise, abort } = abortSignalToPromise(abortSignal);
|
|
44
|
+
try {
|
|
45
|
+
return await Promise.race([promise, abortSignalPromise]);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
abortSignal.removeEventListener("abort", abort);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=abort-and-fail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort-and-fail.js","sourceRoot":"","sources":["../../../../src/resilience/utilities/abort-and-fail/abort-and-fail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;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,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO;YACH,2EAA2E;YAC3E,OAAO,EAAE,OAAO,CAAC,MAAM,CAAS,WAAW,CAAC,MAAM,CAAC;YACnD,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,OAA4B,EAC5B,WAAwB;IAExB,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,WAAW,CAAC,MAAM,CAAC;IAC7B,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,kBAAkB,CAAC,CAAC,CAAC;IAC7D,CAAC;YAAS,CAAC;QACP,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../resilience/utilities/timeout-and-fail/timeout-and-fail.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/resilience/utilities/timeout-and-fail/_module.ts"],"names":[],"mappings":"AAAA,cAAc,6DAA6D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ITimeSpan } from "../../../time-span/contracts/_module-exports.js";
|
|
2
|
+
/**
|
|
3
|
+
* @throws {TimeoutResilienceError} {@link TimeoutResilienceError}
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function timeoutAndFail<TValue>(promise: PromiseLike<TValue>, time: ITimeSpan, abort: (rejection: unknown) => void, signal: AbortSignal): Promise<TValue>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Resilience
|
|
3
|
+
*/
|
|
4
|
+
import { TimeoutResilienceError } from "../../../resilience/resilience.errors.js";
|
|
5
|
+
import { abortAndFail } from "../../../resilience/utilities/abort-and-fail/_module.js";
|
|
6
|
+
import { TO_MILLISECONDS, } from "../../../time-span/contracts/_module-exports.js";
|
|
7
|
+
/**
|
|
8
|
+
* @throws {TimeoutResilienceError} {@link TimeoutResilienceError}
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export async function timeoutAndFail(promise, time, abort, signal) {
|
|
13
|
+
const timeoutId = setTimeout(() => {
|
|
14
|
+
abort(new TimeoutResilienceError("The promise exceded time"));
|
|
15
|
+
}, time[TO_MILLISECONDS]());
|
|
16
|
+
try {
|
|
17
|
+
return await abortAndFail(promise, signal);
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=timeout-and-fail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout-and-fail.js","sourceRoot":"","sources":["../../../../src/resilience/utilities/timeout-and-fail/timeout-and-fail.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAChF,OAAO,EACH,eAAe,GAElB,MAAM,0CAA0C,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAChC,OAA4B,EAC5B,IAAe,EACf,KAAmC,EACnC,MAAmB;IAEnB,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;QAC9B,KAAK,CAAC,IAAI,sBAAsB,CAAC,0BAA0B,CAAC,CAAC,CAAC;IAClE,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC5B,IAAI,CAAC;QACD,OAAO,MAAM,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;YAAS,CAAC;QACP,YAAY,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "../../semaphore/contracts/database-semaphore-adapter.contract.js";
|
|
2
|
+
export * from "../../semaphore/contracts/semaphore-adapter.contract.js";
|
|
3
|
+
export * from "../../semaphore/contracts/semaphore-provider-factory.contract.js";
|
|
4
|
+
export * from "../../semaphore/contracts/semaphore-provider.contract.js";
|
|
5
|
+
export * from "../../semaphore/contracts/semaphore-state.contract.js";
|
|
6
|
+
export * from "../../semaphore/contracts/semaphore.contract.js";
|
|
7
|
+
export * from "../../semaphore/contracts/semaphore.errors.js";
|
|
8
|
+
export * from "../../semaphore/contracts/semaphore.events.js";
|
|
9
|
+
export * from "../../semaphore/contracts/types.js";
|