@daiso-tech/core 0.40.0 → 0.41.1
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 +8 -1
- 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 +3 -3
- 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/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 +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.contract.d.ts +10 -10
- 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 +17 -24
- 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 +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 +34 -32
- 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 +195 -190
- 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 +24 -17
- package/dist/lock/contracts/lock-adapter.contract.d.ts +15 -24
- package/dist/lock/contracts/lock-adapter.contract.js +1 -10
- package/dist/lock/contracts/lock-adapter.contract.js.map +1 -1
- 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 +64 -55
- package/dist/lock/contracts/lock.errors.d.ts +13 -20
- package/dist/lock/contracts/lock.errors.js +19 -26
- package/dist/lock/contracts/lock.errors.js.map +1 -1
- package/dist/lock/contracts/lock.events.d.ts +21 -49
- package/dist/lock/contracts/lock.events.js +2 -3
- 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 +21 -19
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +92 -61
- 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 +8 -5
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +33 -13
- 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 +7 -8
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +33 -20
- 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 +6 -5
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +7 -5
- 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 +26 -8
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +61 -28
- 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 +6 -5
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js +33 -33
- 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 +4 -6
- 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 -34
- package/dist/lock/implementations/derivables/lock-provider/lock.js +182 -257
- 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 +310 -207
- 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 +376 -292
- 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 +3285 -2976
- 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/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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../task/task.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../src/task/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort-and-fail.js","sourceRoot":"","sources":["../../src/task/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,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Task
|
|
3
|
+
*/
|
|
4
|
+
import { type AsyncLazy, type Invokable, type InvokableFn, type OneOrMore, type Promisable } from "../utilities/_module-exports.js";
|
|
5
|
+
import type { ITimeSpan } from "../time-span/contracts/_module-exports.js";
|
|
6
|
+
import { type AsyncMiddleware } from "../hooks/_module-exports.js";
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* IMPORT_PATH: `"@daiso-tech/core/task"`
|
|
10
|
+
*/
|
|
11
|
+
export type TaskResolve<TValue> = InvokableFn<[
|
|
12
|
+
value: Promisable<TValue>
|
|
13
|
+
], void>;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* IMPORT_PATH: `"@daiso-tech/core/task"`
|
|
17
|
+
*/
|
|
18
|
+
export type TaskReject = InvokableFn<[error: unknown], void>;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* IMPORT_PATH: `"@daiso-tech/core/task"`
|
|
22
|
+
*/
|
|
23
|
+
export type TaskCallback<TValue> = InvokableFn<[
|
|
24
|
+
resolve: TaskResolve<TValue>,
|
|
25
|
+
reject: TaskReject
|
|
26
|
+
], Promisable<void>>;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* IMPORT_PATH: `"@daiso-tech/core/task"`
|
|
30
|
+
*/
|
|
31
|
+
export type TaskAllResult<T extends readonly unknown[]> = {
|
|
32
|
+
-readonly [P in keyof T]: Awaited<T[P]>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* IMPORT_PATH: `"@daiso-tech/core/task"`
|
|
37
|
+
*/
|
|
38
|
+
export type TaskAllSettledResult<T extends readonly unknown[]> = {
|
|
39
|
+
-readonly [P in keyof T]: PromiseSettledResult<Awaited<T[P]>>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The `Task` class is used for creating lazy {@link PromiseLike | `PromiseLike`} object that will only execute when awaited or when `then` method is called.
|
|
43
|
+
* Note the class is immutable.
|
|
44
|
+
*
|
|
45
|
+
* IMPORT_PATH: `"@daiso-tech/core/task"`
|
|
46
|
+
*/
|
|
47
|
+
export declare class Task<TValue> implements PromiseLike<TValue> {
|
|
48
|
+
/**
|
|
49
|
+
* The `wrapFn` is convience method used for wrapping async {@link Invokable | `Invokable`} with a `Task`.
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { Task, retry } from "@daiso-tech/core/task";
|
|
53
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span" from "@daiso-tech/core/time-span";
|
|
54
|
+
* import { readFile as readFileNodeJs } from "node:fs/promises";
|
|
55
|
+
*
|
|
56
|
+
* const readFile = Task.wrapFn(readFileNodeJs);
|
|
57
|
+
*
|
|
58
|
+
* const file = await readFile("none_existing_file.txt");
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
static wrapFn<TArgs extends unknown[], TReturn>(fn: Invokable<TArgs, Promisable<TReturn>>): InvokableFn<TArgs, Task<TReturn>>;
|
|
62
|
+
/**
|
|
63
|
+
* The `delay` method creates a {@link Task | `Task`} that will be fulfilled after given `time`.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { Task } from "@daiso-tech/core/task";
|
|
68
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span" from "@daiso-tech/core/time-span";
|
|
69
|
+
*
|
|
70
|
+
* console.log("a");
|
|
71
|
+
* await Task.delay(TimeSpan.fromSeconds(2));
|
|
72
|
+
* console.log("b");
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
static delay(time: ITimeSpan, abortSignal?: AbortSignal): Task<void>;
|
|
76
|
+
/**
|
|
77
|
+
* The `resolve` method works similarly to {@link Promise.resolve | `Promise.resolve`} with the key distinction that it operates lazily.
|
|
78
|
+
*/
|
|
79
|
+
static resolve<TValue>(value: TValue | Task<TValue>): Task<TValue>;
|
|
80
|
+
/**
|
|
81
|
+
* The `resolve` method works similarly to {@link Promise.resolve | `Promise.resolve`} with the key distinction that it operates lazily.
|
|
82
|
+
*/
|
|
83
|
+
static resolve(): Task<void>;
|
|
84
|
+
/**
|
|
85
|
+
* The `reject` method works similarly to {@link Promise.reject | `Promise.reject`} with the key distinction that it operates lazily.
|
|
86
|
+
*/
|
|
87
|
+
static reject<TValue = never, TError = unknown>(reason?: TError): Task<TValue>;
|
|
88
|
+
private static toTasks;
|
|
89
|
+
/**
|
|
90
|
+
* The `all` method works similarly to {@link Promise.all | `Promise.all`} with the key distinction that it operates lazily.
|
|
91
|
+
*/
|
|
92
|
+
static all<TValue extends readonly unknown[] | []>(tasks: TValue): Task<TaskAllResult<TValue>>;
|
|
93
|
+
/**
|
|
94
|
+
* The `all` method works similarly to {@link Promise.all | `Promise.all`} with the key distinction that it operates lazily.
|
|
95
|
+
*/
|
|
96
|
+
static all<TValue>(tasks: Iterable<TValue | Task<TValue>>): Task<Awaited<TValue>[]>;
|
|
97
|
+
/**
|
|
98
|
+
* The `allSettled` method works similarly to {@link Promise.allSettled | `Promise.allSettled`} with the key distinction that it operates lazily.
|
|
99
|
+
*/
|
|
100
|
+
static allSettled<TValues extends readonly unknown[] | []>(tasks: TValues): Task<TaskAllSettledResult<TValues>>;
|
|
101
|
+
/**
|
|
102
|
+
* The `allSettled` method works similarly to {@link Promise.allSettled | `Promise.allSettled`} with the key distinction that it operates lazily.
|
|
103
|
+
*/
|
|
104
|
+
static allSettled<TValue>(tasks: Iterable<Task<TValue>>): Task<PromiseSettledResult<TValue>[]>;
|
|
105
|
+
/**
|
|
106
|
+
* The `race` method works similarly to {@link Promise.race | `Promise.race`} with the key distinction that it operates lazily.
|
|
107
|
+
*/
|
|
108
|
+
static race<T extends readonly unknown[] | []>(tasks: T): Task<Awaited<T[number]>>;
|
|
109
|
+
/**
|
|
110
|
+
* The `race` method works similarly to {@link Promise.race | `Promise.race`} with the key distinction that it operates lazily.
|
|
111
|
+
*/
|
|
112
|
+
static race<TValue>(tasks: Iterable<TValue | Task<TValue>>): Task<TValue>;
|
|
113
|
+
/**
|
|
114
|
+
* The `any` method works similarly to {@link Promise.any | `Promise.any`} with the key distinction that it operates lazily.
|
|
115
|
+
*/
|
|
116
|
+
static any<T extends readonly unknown[] | []>(tasks: T): Task<Awaited<T[number]>>;
|
|
117
|
+
/**
|
|
118
|
+
* The `any` method works similarly to {@link Promise.any | `Promise.any`} with the key distinction that it operates lazily.
|
|
119
|
+
*/
|
|
120
|
+
static any<TValue>(tasks: Iterable<TValue | Task<TValue>>): Task<TValue>;
|
|
121
|
+
/**
|
|
122
|
+
* The `fromCallback` is convience method used for wrapping Node js callback functions with a `Task`.
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* import { Task } from "@daiso-tech/core/task";
|
|
126
|
+
* import { readFile } from "node:fs";
|
|
127
|
+
*
|
|
128
|
+
* const task = Task.fromCallback<Buffer | string>((resolve, reject) => {
|
|
129
|
+
* readFile("FILE_PATH", (err, data) => {
|
|
130
|
+
* if (err !== null) {
|
|
131
|
+
* reject(err);
|
|
132
|
+
* return;
|
|
133
|
+
* }
|
|
134
|
+
* resolve(data);
|
|
135
|
+
* });
|
|
136
|
+
* });
|
|
137
|
+
* const file = await task;
|
|
138
|
+
* console.log(file);
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
static fromCallback<TValue>(callback: TaskCallback<TValue>): Task<TValue>;
|
|
142
|
+
private promise;
|
|
143
|
+
private readonly invokable;
|
|
144
|
+
/**
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* import { Task, retry } from "@daiso-tech/core/task";
|
|
148
|
+
*
|
|
149
|
+
* const promise = new Task(async () => {
|
|
150
|
+
* console.log("I am lazy");
|
|
151
|
+
* },
|
|
152
|
+
* // You can also pass in one AsyncMiddleware or multiple (as an Array).
|
|
153
|
+
* retry()
|
|
154
|
+
* );
|
|
155
|
+
*
|
|
156
|
+
* // "I am lazy" will only logged when awaited or then method i called.
|
|
157
|
+
* await promise;
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* You can pass sync or async {@link Invokable | `Invokable`}.
|
|
161
|
+
*/
|
|
162
|
+
constructor(invokable: AsyncLazy<TValue>, middlewares?: OneOrMore<AsyncMiddleware<[], TValue>>);
|
|
163
|
+
/**
|
|
164
|
+
* The `pipe` method returns a new `Task` instance with the additional `middlewares` applied.
|
|
165
|
+
*/
|
|
166
|
+
pipe(middlewares: OneOrMore<AsyncMiddleware<[], TValue>>): Task<TValue>;
|
|
167
|
+
/**
|
|
168
|
+
* The `pipeWhen` method conditionally applies additional `middlewares`, returning a new `Task` instance only if the specified condition is met.
|
|
169
|
+
*/
|
|
170
|
+
pipeWhen(condition: boolean, middlewares: OneOrMore<AsyncMiddleware<[], TValue>>): Task<TValue>;
|
|
171
|
+
then<TResult1 = TValue, TResult2 = never>(onfulfilled?: ((value: TValue) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
172
|
+
/**
|
|
173
|
+
* The `detach` method executes the `Task` without awaiting it.
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* import { Task } from "@daiso-tech/core/task";
|
|
177
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span" from "@daiso-tech/core/time-span";
|
|
178
|
+
*
|
|
179
|
+
* const promise =
|
|
180
|
+
* new Task(async () => {
|
|
181
|
+
* await Task.delay(TimeSpan.fromSeconds(1));
|
|
182
|
+
* // Will be loged after one second
|
|
183
|
+
* console.log("Done !");
|
|
184
|
+
* });
|
|
185
|
+
*
|
|
186
|
+
* promise.detach();
|
|
187
|
+
*
|
|
188
|
+
* // Will be logged immediately
|
|
189
|
+
* console.log("Hello");
|
|
190
|
+
* await Task.delay(TimeSpan.fromSeconds(2));
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
detach(): void;
|
|
194
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Task
|
|
3
|
+
*/
|
|
4
|
+
import { callInvokable, isPromiseLike, resolveAsyncLazyable, } from "../utilities/_module-exports.js";
|
|
5
|
+
import { abortAndFail } from "../task/abort-and-fail.js";
|
|
6
|
+
import { TimeSpan } from "../time-span/implementations/_module-exports.js";
|
|
7
|
+
import { AsyncHooks } from "../hooks/_module-exports.js";
|
|
8
|
+
/**
|
|
9
|
+
* The `Task` class is used for creating lazy {@link PromiseLike | `PromiseLike`} object that will only execute when awaited or when `then` method is called.
|
|
10
|
+
* Note the class is immutable.
|
|
11
|
+
*
|
|
12
|
+
* IMPORT_PATH: `"@daiso-tech/core/task"`
|
|
13
|
+
*/
|
|
14
|
+
export class Task {
|
|
15
|
+
/**
|
|
16
|
+
* The `wrapFn` is convience method used for wrapping async {@link Invokable | `Invokable`} with a `Task`.
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { Task, retry } from "@daiso-tech/core/task";
|
|
20
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span" from "@daiso-tech/core/time-span";
|
|
21
|
+
* import { readFile as readFileNodeJs } from "node:fs/promises";
|
|
22
|
+
*
|
|
23
|
+
* const readFile = Task.wrapFn(readFileNodeJs);
|
|
24
|
+
*
|
|
25
|
+
* const file = await readFile("none_existing_file.txt");
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
static wrapFn(fn) {
|
|
29
|
+
return (...parameters) => new Task(() => callInvokable(fn, ...parameters));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The `delay` method creates a {@link Task | `Task`} that will be fulfilled after given `time`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { Task } from "@daiso-tech/core/task";
|
|
37
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span" from "@daiso-tech/core/time-span";
|
|
38
|
+
*
|
|
39
|
+
* console.log("a");
|
|
40
|
+
* await Task.delay(TimeSpan.fromSeconds(2));
|
|
41
|
+
* console.log("b");
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
static delay(time, abortSignal = new AbortController().signal) {
|
|
45
|
+
return new Task(async () => {
|
|
46
|
+
let timeoutId = null;
|
|
47
|
+
try {
|
|
48
|
+
await abortAndFail(new Promise((resolve) => {
|
|
49
|
+
timeoutId = setTimeout(() => {
|
|
50
|
+
resolve();
|
|
51
|
+
}, TimeSpan.fromTimeSpan(time).toMilliseconds());
|
|
52
|
+
}), abortSignal);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
if (timeoutId !== null) {
|
|
56
|
+
clearTimeout(timeoutId);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The `resolve` method works similarly to {@link Promise.resolve | `Promise.resolve`} with the key distinction that it operates lazily.
|
|
63
|
+
*/
|
|
64
|
+
static resolve(value) {
|
|
65
|
+
return new Task(async () => {
|
|
66
|
+
if (value === undefined) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
return await value;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The `reject` method works similarly to {@link Promise.reject | `Promise.reject`} with the key distinction that it operates lazily.
|
|
74
|
+
*/
|
|
75
|
+
static reject(reason) {
|
|
76
|
+
return new Task(async () => {
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
78
|
+
return Promise.reject(reason);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
static toTasks(promises) {
|
|
82
|
+
const tasks = [];
|
|
83
|
+
for (const promise of promises) {
|
|
84
|
+
if (promise instanceof Task) {
|
|
85
|
+
tasks.push(promise);
|
|
86
|
+
}
|
|
87
|
+
if (!isPromiseLike(promise)) {
|
|
88
|
+
tasks.push(Task.resolve(promise));
|
|
89
|
+
}
|
|
90
|
+
throw new TypeError("!!__MESSAGE__!!");
|
|
91
|
+
}
|
|
92
|
+
return tasks;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The `all` method works similarly to {@link Promise.all | `Promise.all`} with the key distinction that it operates lazily.
|
|
96
|
+
*/
|
|
97
|
+
static all(tasks) {
|
|
98
|
+
return new Task(async () => Promise.all(Task.toTasks(tasks)));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The `allSettled` method works similarly to {@link Promise.allSettled | `Promise.allSettled`} with the key distinction that it operates lazily.
|
|
102
|
+
*/
|
|
103
|
+
static allSettled(tasks) {
|
|
104
|
+
return new Task(async () => Promise.allSettled(Task.toTasks(tasks)));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The `race` method works similarly to {@link Promise.race | `Promise.race`} with the key distinction that it operates lazily.
|
|
108
|
+
*/
|
|
109
|
+
static race(tasks) {
|
|
110
|
+
return new Task(async () => Promise.race(Task.toTasks(tasks)));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The `any` method works similarly to {@link Promise.any | `Promise.any`} with the key distinction that it operates lazily.
|
|
114
|
+
*/
|
|
115
|
+
static any(tasks) {
|
|
116
|
+
return new Task(async () => Promise.any(Task.toTasks(tasks)));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The `fromCallback` is convience method used for wrapping Node js callback functions with a `Task`.
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* import { Task } from "@daiso-tech/core/task";
|
|
123
|
+
* import { readFile } from "node:fs";
|
|
124
|
+
*
|
|
125
|
+
* const task = Task.fromCallback<Buffer | string>((resolve, reject) => {
|
|
126
|
+
* readFile("FILE_PATH", (err, data) => {
|
|
127
|
+
* if (err !== null) {
|
|
128
|
+
* reject(err);
|
|
129
|
+
* return;
|
|
130
|
+
* }
|
|
131
|
+
* resolve(data);
|
|
132
|
+
* });
|
|
133
|
+
* });
|
|
134
|
+
* const file = await task;
|
|
135
|
+
* console.log(file);
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
static fromCallback(callback) {
|
|
139
|
+
return new Task(() => new Promise((resolve, reject) => {
|
|
140
|
+
callback(resolve, reject);
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
promise = null;
|
|
144
|
+
invokable;
|
|
145
|
+
/**
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* import { Task, retry } from "@daiso-tech/core/task";
|
|
149
|
+
*
|
|
150
|
+
* const promise = new Task(async () => {
|
|
151
|
+
* console.log("I am lazy");
|
|
152
|
+
* },
|
|
153
|
+
* // You can also pass in one AsyncMiddleware or multiple (as an Array).
|
|
154
|
+
* retry()
|
|
155
|
+
* );
|
|
156
|
+
*
|
|
157
|
+
* // "I am lazy" will only logged when awaited or then method i called.
|
|
158
|
+
* await promise;
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* You can pass sync or async {@link Invokable | `Invokable`}.
|
|
162
|
+
*/
|
|
163
|
+
constructor(invokable, middlewares = []) {
|
|
164
|
+
this.invokable = new AsyncHooks(async () => {
|
|
165
|
+
return await resolveAsyncLazyable(invokable);
|
|
166
|
+
}, middlewares);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The `pipe` method returns a new `Task` instance with the additional `middlewares` applied.
|
|
170
|
+
*/
|
|
171
|
+
pipe(middlewares) {
|
|
172
|
+
return new Task(this.invokable.pipe(middlewares));
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The `pipeWhen` method conditionally applies additional `middlewares`, returning a new `Task` instance only if the specified condition is met.
|
|
176
|
+
*/
|
|
177
|
+
pipeWhen(condition, middlewares) {
|
|
178
|
+
return new Task(this.invokable.pipeWhen(condition, middlewares));
|
|
179
|
+
}
|
|
180
|
+
then(onfulfilled, onrejected) {
|
|
181
|
+
if (this.promise === null) {
|
|
182
|
+
this.promise = this.invokable.invoke();
|
|
183
|
+
}
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable
|
|
185
|
+
return this.promise.then(onfulfilled, onrejected);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The `detach` method executes the `Task` without awaiting it.
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* import { Task } from "@daiso-tech/core/task";
|
|
192
|
+
* import { TimeSpan } from "@daiso-tech/core/time-span" from "@daiso-tech/core/time-span";
|
|
193
|
+
*
|
|
194
|
+
* const promise =
|
|
195
|
+
* new Task(async () => {
|
|
196
|
+
* await Task.delay(TimeSpan.fromSeconds(1));
|
|
197
|
+
* // Will be loged after one second
|
|
198
|
+
* console.log("Done !");
|
|
199
|
+
* });
|
|
200
|
+
*
|
|
201
|
+
* promise.detach();
|
|
202
|
+
*
|
|
203
|
+
* // Will be logged immediately
|
|
204
|
+
* console.log("Hello");
|
|
205
|
+
* await Task.delay(TimeSpan.fromSeconds(2));
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
detach() {
|
|
209
|
+
this.then(() => { });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/task/task.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../time-span/contracts/time-span.contract.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../../src/time-span/contracts/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module TimeSpan
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* IMPORT_PATH: `"@daiso-tech/core/time-span/contracts"`
|
|
7
|
+
* @group Contracts
|
|
8
|
+
*/
|
|
9
|
+
export declare const TO_MILLISECONDS: unique symbol;
|
|
10
|
+
/**
|
|
11
|
+
* The `ITimeSpan` contract enables interoperability with external time libraries (e.g., `Luxon`, `Dayjs`).
|
|
12
|
+
* To integrate, simply implement `ITimeSpan` on the duration objects of those libraries.
|
|
13
|
+
*
|
|
14
|
+
* IMPORT_PATH: `"@daiso-tech/core/time-span/contracts"`
|
|
15
|
+
* @group Contracts
|
|
16
|
+
*/
|
|
17
|
+
export type ITimeSpan = {
|
|
18
|
+
[TO_MILLISECONDS](): number;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-span.contract.js","sourceRoot":"","sources":["../../../src/time-span/contracts/time-span.contract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../time-span/implementations/time-span.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../../src/time-span/implementations/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC"}
|
|
@@ -1,44 +1,82 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module
|
|
2
|
+
* @module TimeSpan
|
|
3
3
|
*/
|
|
4
|
-
import type { ISerializable } from "
|
|
4
|
+
import type { ISerializable } from "../../serde/contracts/_module-exports.js";
|
|
5
|
+
import { TO_MILLISECONDS, type ITimeSpan } from "../../time-span/contracts/_module-exports.js";
|
|
6
|
+
import type { IComparable } from "../../utilities/_module-exports.js";
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* IMPORT_PATH: `"@daiso-tech/core/time-span"`
|
|
10
|
+
* @group Implementations
|
|
11
|
+
*/
|
|
12
|
+
export type SerializedTimeSpan = {
|
|
13
|
+
version: "1";
|
|
14
|
+
timeInMs: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* IMPORT_PATH: `"@daiso-tech/core/time-span"`
|
|
19
|
+
* @group Implementations
|
|
20
|
+
*/
|
|
21
|
+
export type TimeSpanFromDateRangeSettings = {
|
|
22
|
+
/**
|
|
23
|
+
* @default
|
|
24
|
+
* ```ts
|
|
25
|
+
* new Date()
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
start?: Date;
|
|
29
|
+
/**
|
|
30
|
+
* @default
|
|
31
|
+
* ```ts
|
|
32
|
+
* new Date()
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
end?: Date;
|
|
36
|
+
};
|
|
5
37
|
/**
|
|
6
38
|
* The `TimeSpan` class is used for representing time interval.
|
|
7
39
|
* `TimeSpan` cannot be negative.
|
|
8
40
|
*
|
|
9
|
-
* IMPORT_PATH: `"@daiso-tech/core/
|
|
10
|
-
* @group
|
|
41
|
+
* IMPORT_PATH: `"@daiso-tech/core/time-span"`
|
|
42
|
+
* @group Implementations
|
|
11
43
|
*/
|
|
12
|
-
export declare class TimeSpan implements ISerializable<
|
|
44
|
+
export declare class TimeSpan implements ITimeSpan, ISerializable<SerializedTimeSpan>, IComparable<ITimeSpan> {
|
|
13
45
|
private readonly milliseconds;
|
|
14
46
|
private static secondInMilliseconds;
|
|
15
47
|
private static minuteInMilliseconds;
|
|
16
48
|
private static hourInMilliseconds;
|
|
17
49
|
private static dayInMilliseconds;
|
|
18
|
-
static deserialize(
|
|
50
|
+
static deserialize(serializedValue: SerializedTimeSpan): TimeSpan;
|
|
19
51
|
private constructor();
|
|
20
|
-
|
|
52
|
+
equals(value: ITimeSpan): boolean;
|
|
53
|
+
gt(value: ITimeSpan): boolean;
|
|
54
|
+
gte(value: ITimeSpan): boolean;
|
|
55
|
+
lt(value: ITimeSpan): boolean;
|
|
56
|
+
lte(value: ITimeSpan): boolean;
|
|
57
|
+
serialize(): SerializedTimeSpan;
|
|
21
58
|
static fromMilliseconds(milliseconds: number): TimeSpan;
|
|
22
59
|
static fromSeconds(seconds: number): TimeSpan;
|
|
23
60
|
static fromMinutes(minutes: number): TimeSpan;
|
|
24
61
|
static fromHours(hours: number): TimeSpan;
|
|
25
62
|
static fromDays(days: number): TimeSpan;
|
|
26
|
-
static fromTimeSpan(timeSpan:
|
|
27
|
-
static fromDateRange(
|
|
63
|
+
static fromTimeSpan(timeSpan: ITimeSpan): TimeSpan;
|
|
64
|
+
static fromDateRange({ start, end, }: TimeSpanFromDateRangeSettings): TimeSpan;
|
|
28
65
|
addMilliseconds(milliseconds: number): TimeSpan;
|
|
29
66
|
addSeconds(seconds: number): TimeSpan;
|
|
30
67
|
addMinutes(minutes: number): TimeSpan;
|
|
31
68
|
addHours(hours: number): TimeSpan;
|
|
32
69
|
addDays(days: number): TimeSpan;
|
|
33
|
-
addTimeSpan(timeSpan:
|
|
70
|
+
addTimeSpan(timeSpan: ITimeSpan): TimeSpan;
|
|
34
71
|
subtractMilliseconds(milliseconds: number): TimeSpan;
|
|
35
72
|
subtractSeconds(seconds: number): TimeSpan;
|
|
36
73
|
subtractMinutes(minutes: number): TimeSpan;
|
|
37
74
|
subtractHours(hours: number): TimeSpan;
|
|
38
75
|
subtractDays(days: number): TimeSpan;
|
|
39
|
-
subtractTimeSpan(timeSpan:
|
|
76
|
+
subtractTimeSpan(timeSpan: ITimeSpan): TimeSpan;
|
|
40
77
|
multiply(value: number): TimeSpan;
|
|
41
78
|
divide(value: number): TimeSpan;
|
|
79
|
+
[TO_MILLISECONDS](): number;
|
|
42
80
|
toMilliseconds(): number;
|
|
43
81
|
toSeconds(): number;
|
|
44
82
|
toMinutes(): number;
|