@daiso-tech/core 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -45
- package/dist/async/_module-exports.d.ts +1 -1
- package/dist/async/_module-exports.js +1 -1
- package/dist/async/_module-exports.js.map +1 -1
- package/dist/async/async.errors.d.ts +27 -19
- package/dist/async/async.errors.js +33 -20
- package/dist/async/async.errors.js.map +1 -1
- package/dist/async/backof-policies/_shared.d.ts +6 -2
- package/dist/async/backof-policies/_shared.js +1 -0
- package/dist/async/backof-policies/_shared.js.map +1 -1
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +1 -1
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +1 -1
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +1 -1
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +1 -1
- package/dist/async/middlewares/_module.d.ts +8 -0
- package/dist/async/middlewares/_module.js +9 -0
- package/dist/async/middlewares/_module.js.map +1 -0
- package/dist/async/middlewares/_shared.d.ts +10 -0
- package/dist/async/middlewares/_shared.js +5 -0
- package/dist/async/middlewares/_shared.js.map +1 -0
- package/dist/async/middlewares/bulkhead/_module.d.ts +1 -0
- package/dist/async/middlewares/bulkhead/_module.js +2 -0
- package/dist/async/middlewares/bulkhead/_module.js.map +1 -0
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.d.ts +80 -0
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.js +46 -0
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.js.map +1 -0
- package/dist/async/middlewares/dynamic/_module.d.ts +1 -0
- package/dist/async/middlewares/dynamic/_module.js +2 -0
- package/dist/async/middlewares/dynamic/_module.js.map +1 -0
- package/dist/async/middlewares/dynamic/dynamic.middleware.d.ts +34 -0
- package/dist/async/middlewares/dynamic/dynamic.middleware.js +36 -0
- package/dist/async/middlewares/dynamic/dynamic.middleware.js.map +1 -0
- package/dist/async/middlewares/fallback/_module.d.ts +1 -0
- package/dist/async/middlewares/fallback/_module.js +2 -0
- package/dist/async/middlewares/fallback/_module.js.map +1 -0
- package/dist/async/middlewares/fallback/fallback.middleware.d.ts +78 -0
- package/dist/async/middlewares/fallback/fallback.middleware.js +52 -0
- package/dist/async/middlewares/fallback/fallback.middleware.js.map +1 -0
- package/dist/async/middlewares/hedging/_module.d.ts +2 -0
- package/dist/async/middlewares/hedging/_module.js +3 -0
- package/dist/async/middlewares/hedging/_module.js.map +1 -0
- package/dist/async/middlewares/hedging/_shared.d.ts +93 -0
- package/dist/async/middlewares/hedging/_shared.js +5 -0
- package/dist/async/middlewares/hedging/_shared.js.map +1 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/_module.d.ts +1 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/_module.js +2 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/_module.js.map +1 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.d.ts +51 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js +138 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js.map +1 -0
- package/dist/async/middlewares/hedging/sequential-hedging/_module.d.ts +1 -0
- package/dist/async/middlewares/hedging/sequential-hedging/_module.js +2 -0
- package/dist/async/middlewares/hedging/sequential-hedging/_module.js.map +1 -0
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.d.ts +51 -0
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js +104 -0
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js.map +1 -0
- package/dist/async/middlewares/observe/_module.d.ts +1 -0
- package/dist/async/middlewares/observe/_module.js +2 -0
- package/dist/async/middlewares/observe/_module.js.map +1 -0
- package/dist/async/middlewares/observe/observe.middleware.d.ts +130 -0
- package/dist/async/middlewares/observe/observe.middleware.js +80 -0
- package/dist/async/middlewares/observe/observe.middleware.js.map +1 -0
- package/dist/async/middlewares/retry/_module.d.ts +1 -0
- package/dist/async/middlewares/retry/_module.js +2 -0
- package/dist/async/middlewares/retry/_module.js.map +1 -0
- package/dist/async/middlewares/retry/retry.middleware.d.ts +117 -0
- package/dist/async/middlewares/retry/retry.middleware.js +82 -0
- package/dist/async/middlewares/retry/retry.middleware.js.map +1 -0
- package/dist/async/middlewares/timeout/_module.d.ts +1 -0
- package/dist/async/middlewares/timeout/_module.js +2 -0
- package/dist/async/middlewares/timeout/_module.js.map +1 -0
- package/dist/async/middlewares/timeout/timeout.middleware.d.ts +83 -0
- package/dist/async/middlewares/timeout/timeout.middleware.js +60 -0
- package/dist/async/middlewares/timeout/timeout.middleware.js.map +1 -0
- package/dist/async/utilities/_module.d.ts +3 -4
- package/dist/async/utilities/_module.js +3 -4
- package/dist/async/utilities/_module.js.map +1 -1
- package/dist/async/utilities/abort-and-fail/_module.d.ts +1 -0
- package/dist/async/utilities/abort-and-fail/_module.js +2 -0
- package/dist/async/utilities/abort-and-fail/_module.js.map +1 -0
- package/dist/async/utilities/abort-and-fail/abort-and-fail.d.ts +7 -0
- package/dist/async/utilities/{abort → abort-and-fail}/abort-and-fail.js +6 -6
- package/dist/async/utilities/abort-and-fail/abort-and-fail.js.map +1 -0
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +37 -194
- package/dist/async/utilities/lazy-promise/lazy-promise.js +62 -359
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/async/utilities/promise-queue/_module.d.ts +1 -0
- package/dist/async/utilities/promise-queue/_module.js +2 -0
- package/dist/async/utilities/promise-queue/_module.js.map +1 -0
- package/dist/async/utilities/promise-queue/promise-queue.d.ts +32 -0
- package/dist/async/utilities/promise-queue/promise-queue.js +107 -0
- package/dist/async/utilities/promise-queue/promise-queue.js.map +1 -0
- package/dist/async/utilities/timeout-and-fail/_module.d.ts +1 -0
- package/dist/async/utilities/timeout-and-fail/_module.js +2 -0
- package/dist/async/utilities/timeout-and-fail/_module.js.map +1 -0
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.d.ts +7 -0
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js +19 -0
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js.map +1 -0
- package/dist/cache/contracts/cache-adapter.contract.d.ts +14 -14
- package/dist/cache/contracts/cache-factory.contract.d.ts +3 -3
- package/dist/cache/contracts/cache.contract.d.ts +73 -73
- package/dist/cache/contracts/cache.errors.d.ts +7 -7
- package/dist/cache/contracts/cache.errors.js +7 -7
- package/dist/cache/contracts/cache.events.d.ts +54 -58
- package/dist/cache/contracts/cache.events.js +6 -104
- package/dist/cache/contracts/cache.events.js.map +1 -1
- package/dist/cache/contracts/database-cache-adapter.contract.d.ts +16 -16
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +3 -3
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +3 -9
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +3 -9
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +4 -4
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +3 -3
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +2 -2
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +3 -3
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +3 -3
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +2 -2
- package/dist/cache/implementations/derivables/cache/cache.d.ts +26 -27
- package/dist/cache/implementations/derivables/cache/cache.js +102 -91
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +5 -4
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +2 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +3 -3
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +2 -2
- package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +3 -3
- package/dist/cache/implementations/test-utilities/cache.test-suite.js +140 -149
- package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.d.ts +3 -3
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +2 -2
- package/dist/collection/contracts/_shared/compartor.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/cross-join-result.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/ensure-map.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/ensure-record.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/foreach.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/map.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/modifier.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/predicate.type.d.ts +7 -7
- package/dist/collection/contracts/_shared/reduce.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/tap.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/transform.type.d.ts +2 -2
- package/dist/collection/contracts/async-collection.contract.d.ts +109 -198
- package/dist/collection/contracts/collection.contract.d.ts +103 -103
- package/dist/collection/contracts/collection.errors.d.ts +11 -11
- package/dist/collection/contracts/collection.errors.js +11 -11
- package/dist/collection/implementations/_shared.d.ts +8 -8
- package/dist/collection/implementations/_shared.js +8 -8
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.d.ts +0 -4
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.js +0 -4
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js +21 -19
- package/dist/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +15 -19
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +15 -30
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.d.ts +3 -3
- package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.js +18 -20
- package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +11 -12
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +11 -12
- package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/collection/implementations/list-collection/list-collection.d.ts +11 -11
- package/dist/collection/implementations/list-collection/list-collection.js +24 -30
- package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/event-bus/contracts/_module-exports.d.ts +0 -1
- package/dist/event-bus/contracts/_module-exports.js +0 -1
- package/dist/event-bus/contracts/_module-exports.js.map +1 -1
- package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +13 -8
- package/dist/event-bus/contracts/event-bus-factory.contract.d.ts +6 -7
- package/dist/event-bus/contracts/event-bus-factory.contract.js.map +1 -1
- package/dist/event-bus/contracts/event-bus.contract.d.ts +30 -41
- package/dist/event-bus/contracts/event-bus.errors.d.ts +8 -8
- package/dist/event-bus/contracts/event-bus.errors.js +8 -8
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +3 -3
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +3 -3
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +2 -2
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +2 -2
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +3 -3
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +2 -2
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +15 -15
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +32 -32
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +17 -10
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +13 -6
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.d.ts +3 -5
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +15 -22
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +3 -5
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +189 -209
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/lock/contracts/database-lock-adapter.contract.d.ts +9 -9
- package/dist/lock/contracts/lock-adapter.contract.d.ts +7 -7
- package/dist/lock/contracts/lock-provider-factory.contract.d.ts +4 -4
- package/dist/lock/contracts/lock-provider.contract.d.ts +14 -14
- package/dist/lock/contracts/lock.contract.d.ts +22 -22
- package/dist/lock/contracts/lock.errors.d.ts +10 -10
- package/dist/lock/contracts/lock.errors.js +10 -10
- package/dist/lock/contracts/lock.events.d.ts +45 -54
- package/dist/lock/contracts/lock.events.js +9 -91
- package/dist/lock/contracts/lock.events.js.map +1 -1
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +5 -5
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +4 -4
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +3 -3
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +3 -3
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +5 -5
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +4 -4
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +2 -2
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +2 -2
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +3 -3
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +3 -3
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +5 -5
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +4 -4
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +33 -33
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +30 -30
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +2 -2
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +3 -3
- package/dist/lock/implementations/derivables/lock-provider/lock.js +77 -58
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +5 -4
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +2 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +3 -3
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +2 -2
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +3 -3
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +2 -2
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +3 -3
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +214 -214
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/serde/contracts/deserializer.contract.d.ts +2 -2
- package/dist/serde/contracts/flexible-serde-adapter.contract.d.ts +4 -4
- package/dist/serde/contracts/flexible-serde.contract.d.ts +8 -19
- package/dist/serde/contracts/serde.contract.d.ts +2 -2
- package/dist/serde/contracts/serde.errors.d.ts +4 -4
- package/dist/serde/contracts/serde.errors.js +4 -4
- package/dist/serde/contracts/serializable.contract.d.ts +2 -2
- package/dist/serde/contracts/serializer.contract.d.ts +2 -2
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +2 -2
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +2 -2
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.d.ts +1 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +1 -1
- package/dist/serde/implementations/derivables/serde.d.ts +4 -35
- package/dist/serde/implementations/derivables/serde.js +2 -47
- package/dist/serde/implementations/derivables/serde.js.map +1 -1
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.d.ts +3 -3
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +2 -2
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +3 -3
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +2 -2
- package/dist/utilities/classes/_module.d.ts +1 -1
- package/dist/utilities/classes/_module.js +1 -1
- package/dist/utilities/classes/_module.js.map +1 -1
- package/dist/utilities/classes/hooks/_module.d.ts +3 -0
- package/dist/utilities/classes/hooks/_module.js +4 -0
- package/dist/utilities/classes/hooks/_module.js.map +1 -0
- package/dist/utilities/classes/hooks/async-hooks.d.ts +209 -0
- package/dist/utilities/classes/hooks/async-hooks.js +145 -0
- package/dist/utilities/classes/hooks/async-hooks.js.map +1 -0
- package/dist/utilities/classes/hooks/hooks.d.ts +139 -0
- package/dist/utilities/classes/hooks/hooks.js +116 -0
- package/dist/utilities/classes/hooks/hooks.js.map +1 -0
- package/dist/utilities/classes/hooks/types.d.ts +9 -0
- package/dist/utilities/classes/hooks/types.js +5 -0
- package/dist/utilities/classes/hooks/types.js.map +1 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +3 -3
- package/dist/utilities/classes/key-prefixer/key-prefixer.js +4 -4
- package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
- package/dist/utilities/classes/time-span/time-span.d.ts +5 -5
- package/dist/utilities/classes/time-span/time-span.js +5 -5
- package/dist/utilities/contracts/_module.d.ts +0 -1
- package/dist/utilities/contracts/_module.js +0 -1
- package/dist/utilities/contracts/_module.js.map +1 -1
- package/dist/utilities/contracts/deinitizable.contract.d.ts +1 -1
- package/dist/utilities/contracts/initizable.contract.d.ts +1 -1
- package/dist/utilities/contracts/prunable.contract.d.ts +1 -1
- package/dist/utilities/contracts/serialized-error.contract.d.ts +1 -1
- package/dist/utilities/contracts/sqlite-database.contract.d.ts +2 -2
- package/dist/utilities/errors.d.ts +5 -5
- package/dist/utilities/errors.js +5 -5
- package/dist/utilities/functions/factory.js +3 -3
- package/dist/utilities/functions/factory.js.map +1 -1
- package/dist/utilities/functions/invokable.d.ts +9 -5
- package/dist/utilities/functions/invokable.js +12 -2
- package/dist/utilities/functions/invokable.js.map +1 -1
- package/dist/utilities/functions/lazy.d.ts +5 -0
- package/dist/utilities/functions/lazy.js +12 -3
- package/dist/utilities/functions/lazy.js.map +1 -1
- package/dist/utilities/types/async-iterable-value.type.d.ts +1 -1
- package/dist/utilities/types/at-least-one.type.d.ts +1 -1
- package/dist/utilities/types/factory.type.d.ts +8 -8
- package/dist/utilities/types/invokable.type.d.ts +3 -3
- package/dist/utilities/types/items.type.d.ts +1 -1
- package/dist/utilities/types/lazy.type.d.ts +5 -5
- package/dist/utilities/types/none-func.type.d.ts +1 -1
- package/dist/utilities/types/one-or-more.type.d.ts +1 -1
- package/dist/utilities/types/promiseable.type.d.ts +1 -1
- package/dist/utilities/types/result.type.d.ts +1 -1
- package/package.json +22 -2
- package/dist/async/async.events.d.ts +0 -105
- package/dist/async/async.events.js +0 -82
- package/dist/async/async.events.js.map +0 -1
- package/dist/async/utilities/abort/_module.d.ts +0 -2
- package/dist/async/utilities/abort/_module.js +0 -3
- package/dist/async/utilities/abort/_module.js.map +0 -1
- package/dist/async/utilities/abort/abort-and-fail.d.ts +0 -4
- package/dist/async/utilities/abort/abort-and-fail.js.map +0 -1
- package/dist/async/utilities/abort/abort.d.ts +0 -9
- package/dist/async/utilities/abort/abort.js +0 -18
- package/dist/async/utilities/abort/abort.js.map +0 -1
- package/dist/async/utilities/delay/_module.d.ts +0 -1
- package/dist/async/utilities/delay/_module.js +0 -2
- package/dist/async/utilities/delay/_module.js.map +0 -1
- package/dist/async/utilities/delay/delay.d.ts +0 -10
- package/dist/async/utilities/delay/delay.js +0 -34
- package/dist/async/utilities/delay/delay.js.map +0 -1
- package/dist/async/utilities/retry/_module.d.ts +0 -2
- package/dist/async/utilities/retry/_module.js +0 -3
- package/dist/async/utilities/retry/_module.js.map +0 -1
- package/dist/async/utilities/retry/retry-or-fail.d.ts +0 -29
- package/dist/async/utilities/retry/retry-or-fail.js +0 -39
- package/dist/async/utilities/retry/retry-or-fail.js.map +0 -1
- package/dist/async/utilities/retry/retry.d.ts +0 -10
- package/dist/async/utilities/retry/retry.js +0 -21
- package/dist/async/utilities/retry/retry.js.map +0 -1
- package/dist/async/utilities/timeout/_module.d.ts +0 -2
- package/dist/async/utilities/timeout/_module.js +0 -3
- package/dist/async/utilities/timeout/_module.js.map +0 -1
- package/dist/async/utilities/timeout/timeout-and-fail.d.ts +0 -5
- package/dist/async/utilities/timeout/timeout-and-fail.js +0 -28
- package/dist/async/utilities/timeout/timeout-and-fail.js.map +0 -1
- package/dist/async/utilities/timeout/timeout.d.ts +0 -10
- package/dist/async/utilities/timeout/timeout.js +0 -21
- package/dist/async/utilities/timeout/timeout.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.d.ts +0 -13
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +0 -30
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.d.ts +0 -13
- package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +0 -36
- package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.d.ts +0 -9
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +0 -39
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.d.ts +0 -13
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +0 -52
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +0 -1
- package/dist/event-bus/contracts/_shared.d.ts +0 -12
- package/dist/event-bus/contracts/_shared.js +0 -15
- package/dist/event-bus/contracts/_shared.js.map +0 -1
- package/dist/utilities/classes/sync-event-bus/_module.d.ts +0 -1
- package/dist/utilities/classes/sync-event-bus/_module.js +0 -2
- package/dist/utilities/classes/sync-event-bus/_module.js.map +0 -1
- package/dist/utilities/classes/sync-event-bus/sync-event-bus.d.ts +0 -16
- package/dist/utilities/classes/sync-event-bus/sync-event-bus.js +0 -53
- package/dist/utilities/classes/sync-event-bus/sync-event-bus.js.map +0 -1
- package/dist/utilities/contracts/sync-event-bus-listenable.d.ts +0 -13
- package/dist/utilities/contracts/sync-event-bus-listenable.js +0 -5
- package/dist/utilities/contracts/sync-event-bus-listenable.js.map +0 -1
|
@@ -1,125 +1,116 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Lock
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import type { IFlexibleSerde } from "../../serde/contracts/_module-exports.js";
|
|
6
|
-
import type { OneOrMore } from "../../utilities/_module-exports.js";
|
|
7
|
-
import { type TimeSpan } from "../../utilities/_module-exports.js";
|
|
4
|
+
import type { TimeSpan } from "../../utilities/_module-exports.js";
|
|
8
5
|
/**
|
|
9
6
|
* The event is dispatched when a lock is aquired.
|
|
10
7
|
*
|
|
11
|
-
* IMPORT_PATH:
|
|
8
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
12
9
|
* @group Events
|
|
13
10
|
*/
|
|
14
|
-
export
|
|
11
|
+
export type AcquiredLockEvent = {
|
|
15
12
|
key: string;
|
|
16
13
|
owner: string;
|
|
17
14
|
ttl: TimeSpan | null;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
15
|
+
};
|
|
20
16
|
/**
|
|
21
17
|
* The event is dispatched when a lock is released.
|
|
22
18
|
*
|
|
23
|
-
* IMPORT_PATH:
|
|
19
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
24
20
|
* @group Events
|
|
25
21
|
*/
|
|
26
|
-
export
|
|
22
|
+
export type ReleasedLockEvent = {
|
|
27
23
|
key: string;
|
|
28
24
|
owner: string;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
25
|
+
};
|
|
31
26
|
/**
|
|
32
27
|
* The event is dispatched when a lock is forcefully released.
|
|
33
28
|
*
|
|
34
|
-
* IMPORT_PATH:
|
|
29
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
35
30
|
* @group Events
|
|
36
31
|
*/
|
|
37
|
-
export
|
|
32
|
+
export type ForceReleasedLockEvent = {
|
|
38
33
|
key: string;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
34
|
+
};
|
|
41
35
|
/**
|
|
42
36
|
* The event is dispatched when trying to release a lock that is owned by a different owner.
|
|
43
37
|
*
|
|
44
|
-
* IMPORT_PATH:
|
|
38
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
45
39
|
* @group Events
|
|
46
40
|
*/
|
|
47
|
-
export
|
|
41
|
+
export type UnownedReleaseTryLockEvent = {
|
|
48
42
|
key: string;
|
|
49
43
|
owner: string;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
44
|
+
};
|
|
52
45
|
/**
|
|
53
46
|
* The event is dispatched when trying to refefresh a lock that is owned by a different owner.
|
|
54
47
|
*
|
|
55
|
-
* IMPORT_PATH:
|
|
48
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
56
49
|
* @group Events
|
|
57
50
|
*/
|
|
58
|
-
export
|
|
51
|
+
export type UnownedRefreshTryLockEvent = {
|
|
59
52
|
key: string;
|
|
60
53
|
owner: string;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
54
|
+
};
|
|
63
55
|
/**
|
|
64
56
|
* The event is dispatched when trying to acquire a lock that is owned by a different owner.
|
|
65
57
|
*
|
|
66
|
-
* IMPORT_PATH:
|
|
58
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
67
59
|
* @group Events
|
|
68
60
|
*/
|
|
69
|
-
export
|
|
61
|
+
export type NotAvailableLockEvent = {
|
|
70
62
|
key: string;
|
|
71
63
|
owner: string;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
64
|
+
};
|
|
74
65
|
/**
|
|
75
66
|
* The event is dispatched when a lock is refreshed.
|
|
76
67
|
*
|
|
77
|
-
* IMPORT_PATH:
|
|
68
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
78
69
|
* @group Events
|
|
79
70
|
*/
|
|
80
|
-
export
|
|
71
|
+
export type RefreshedLockEvent = {
|
|
81
72
|
key: string;
|
|
82
73
|
owner: string;
|
|
83
74
|
ttl: TimeSpan;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
75
|
+
};
|
|
86
76
|
/**
|
|
87
77
|
*
|
|
88
|
-
* IMPORT_PATH:
|
|
78
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
89
79
|
* @group Events
|
|
90
80
|
*/
|
|
91
|
-
export
|
|
81
|
+
export type UnexpectedErrorLockEvent = {
|
|
92
82
|
key: string;
|
|
93
83
|
owner: string;
|
|
94
84
|
ttl: TimeSpan | null;
|
|
95
85
|
error: unknown;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
86
|
+
};
|
|
98
87
|
/**
|
|
99
88
|
*
|
|
100
|
-
* IMPORT_PATH:
|
|
89
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
101
90
|
* @group Events
|
|
102
91
|
*/
|
|
103
92
|
export declare const LOCK_EVENTS: {
|
|
104
|
-
readonly
|
|
105
|
-
readonly
|
|
106
|
-
readonly
|
|
107
|
-
readonly
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
111
|
-
readonly
|
|
93
|
+
readonly ACQUIRED: "ACQUIRED";
|
|
94
|
+
readonly RELEASED: "RELEASED";
|
|
95
|
+
readonly UNOWNED_RELEASE_TRY: "UNOWNED_RELEASE_TRY";
|
|
96
|
+
readonly UNOWNED_REFRESH_TRY: "UNOWNED_REFRESH_TRY";
|
|
97
|
+
readonly NOT_AVAILABLE: "NOT_AVAILABLE";
|
|
98
|
+
readonly FORCE_RELEASED: "FORCE_RELEASED";
|
|
99
|
+
readonly REFRESHED: "REFRESHED";
|
|
100
|
+
readonly UNEXPECTED_ERROR: "UNEXPECTED_ERROR";
|
|
112
101
|
};
|
|
113
102
|
/**
|
|
114
103
|
*
|
|
115
|
-
* IMPORT_PATH:
|
|
116
|
-
* @group Events
|
|
117
|
-
*/
|
|
118
|
-
export type LockEvents = KeyAcquiredLockEvent | KeyReleasedLockEvent | UnownedReleaseLockEvent | UnownedRefreshLockEvent | KeyAlreadyAcquiredLockEvent | KeyForceReleasedLockEvent | KeyRefreshedLockEvent | UnexpectedErrorLockEvent;
|
|
119
|
-
/**
|
|
120
|
-
* The <i>registerLockEventsToSerde</i> function registers all <i>{@link ILock}</i> related events with <i>IFlexibleSerde</i>, ensuring they will properly be serialized and deserialized.
|
|
121
|
-
*
|
|
122
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
104
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
123
105
|
* @group Events
|
|
124
106
|
*/
|
|
125
|
-
export
|
|
107
|
+
export type LockEventMap = {
|
|
108
|
+
[LOCK_EVENTS.ACQUIRED]: AcquiredLockEvent;
|
|
109
|
+
[LOCK_EVENTS.RELEASED]: ReleasedLockEvent;
|
|
110
|
+
[LOCK_EVENTS.UNOWNED_RELEASE_TRY]: UnownedReleaseTryLockEvent;
|
|
111
|
+
[LOCK_EVENTS.UNOWNED_REFRESH_TRY]: UnownedRefreshTryLockEvent;
|
|
112
|
+
[LOCK_EVENTS.NOT_AVAILABLE]: NotAvailableLockEvent;
|
|
113
|
+
[LOCK_EVENTS.FORCE_RELEASED]: ForceReleasedLockEvent;
|
|
114
|
+
[LOCK_EVENTS.REFRESHED]: RefreshedLockEvent;
|
|
115
|
+
[LOCK_EVENTS.UNEXPECTED_ERROR]: UnexpectedErrorLockEvent;
|
|
116
|
+
};
|
|
@@ -1,101 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Lock
|
|
3
3
|
*/
|
|
4
|
-
import { BaseEvent } from "../../event-bus/contracts/_module-exports.js";
|
|
5
|
-
import { CORE, resolveOneOrMore, } from "../../utilities/_module-exports.js";
|
|
6
4
|
/**
|
|
7
|
-
* The event is dispatched when a lock is aquired.
|
|
8
5
|
*
|
|
9
|
-
* IMPORT_PATH:
|
|
10
|
-
* @group Events
|
|
11
|
-
*/
|
|
12
|
-
export class KeyAcquiredLockEvent extends BaseEvent {
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* The event is dispatched when a lock is released.
|
|
16
|
-
*
|
|
17
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
18
|
-
* @group Events
|
|
19
|
-
*/
|
|
20
|
-
export class KeyReleasedLockEvent extends BaseEvent {
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* The event is dispatched when a lock is forcefully released.
|
|
24
|
-
*
|
|
25
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
26
|
-
* @group Events
|
|
27
|
-
*/
|
|
28
|
-
export class KeyForceReleasedLockEvent extends BaseEvent {
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The event is dispatched when trying to release a lock that is owned by a different owner.
|
|
32
|
-
*
|
|
33
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
34
|
-
* @group Events
|
|
35
|
-
*/
|
|
36
|
-
export class UnownedReleaseLockEvent extends BaseEvent {
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The event is dispatched when trying to refefresh a lock that is owned by a different owner.
|
|
40
|
-
*
|
|
41
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
42
|
-
* @group Events
|
|
43
|
-
*/
|
|
44
|
-
export class UnownedRefreshLockEvent extends BaseEvent {
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* The event is dispatched when trying to acquire a lock that is owned by a different owner.
|
|
48
|
-
*
|
|
49
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
50
|
-
* @group Events
|
|
51
|
-
*/
|
|
52
|
-
export class KeyAlreadyAcquiredLockEvent extends BaseEvent {
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* The event is dispatched when a lock is refreshed.
|
|
56
|
-
*
|
|
57
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
58
|
-
* @group Events
|
|
59
|
-
*/
|
|
60
|
-
export class KeyRefreshedLockEvent extends BaseEvent {
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
65
|
-
* @group Events
|
|
66
|
-
*/
|
|
67
|
-
export class UnexpectedErrorLockEvent extends BaseEvent {
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
6
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
|
|
72
7
|
* @group Events
|
|
73
8
|
*/
|
|
74
9
|
export const LOCK_EVENTS = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
10
|
+
ACQUIRED: "ACQUIRED",
|
|
11
|
+
RELEASED: "RELEASED",
|
|
12
|
+
UNOWNED_RELEASE_TRY: "UNOWNED_RELEASE_TRY",
|
|
13
|
+
UNOWNED_REFRESH_TRY: "UNOWNED_REFRESH_TRY",
|
|
14
|
+
NOT_AVAILABLE: "NOT_AVAILABLE",
|
|
15
|
+
FORCE_RELEASED: "FORCE_RELEASED",
|
|
16
|
+
REFRESHED: "REFRESHED",
|
|
17
|
+
UNEXPECTED_ERROR: "UNEXPECTED_ERROR",
|
|
83
18
|
};
|
|
84
|
-
/**
|
|
85
|
-
* The <i>registerLockEventsToSerde</i> function registers all <i>{@link ILock}</i> related events with <i>IFlexibleSerde</i>, ensuring they will properly be serialized and deserialized.
|
|
86
|
-
*
|
|
87
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/contracts"```
|
|
88
|
-
* @group Events
|
|
89
|
-
*/
|
|
90
|
-
export function registerLockEventsToSerde(serde) {
|
|
91
|
-
for (const serde_ of resolveOneOrMore(serde)) {
|
|
92
|
-
serde_
|
|
93
|
-
.registerEvent(KeyAcquiredLockEvent, CORE)
|
|
94
|
-
.registerEvent(KeyReleasedLockEvent, CORE)
|
|
95
|
-
.registerEvent(UnownedReleaseLockEvent, CORE)
|
|
96
|
-
.registerEvent(KeyAlreadyAcquiredLockEvent, CORE)
|
|
97
|
-
.registerEvent(UnownedRefreshLockEvent, CORE)
|
|
98
|
-
.registerEvent(UnexpectedErrorLockEvent, CORE);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
19
|
//# sourceMappingURL=lock.events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock.events.js","sourceRoot":"","sources":["../../../src/lock/contracts/lock.events.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"lock.events.js","sourceRoot":"","sources":["../../../src/lock/contracts/lock.events.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,aAAa,EAAE,eAAe;IAC9B,cAAc,EAAE,gBAAgB;IAChC,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,kBAAkB;CAC9B,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { type IDeinitizable, type IInitizable, TimeSpan } from "../../../../util
|
|
|
6
6
|
import type { Client } from "@libsql/client";
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
|
-
* IMPORT_PATH:
|
|
9
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
10
10
|
* @group Adapters
|
|
11
11
|
*/
|
|
12
12
|
export type LibsqlLockAdapterSettings = {
|
|
@@ -16,12 +16,12 @@ export type LibsqlLockAdapterSettings = {
|
|
|
16
16
|
shouldRemoveExpiredKeys?: boolean;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* To utilize the
|
|
19
|
+
* To utilize the `LibsqlLockAdapter`, you must install the `"@libsql/client"` package.
|
|
20
20
|
*
|
|
21
|
-
* Note in order to use
|
|
21
|
+
* Note in order to use `LibsqlLockAdapter` correctly, ensure you use a single, consistent database across all server instances.
|
|
22
22
|
* This means you can't use libsql embedded replicas.
|
|
23
23
|
*
|
|
24
|
-
* IMPORT_PATH:
|
|
24
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
25
25
|
* @group Adapters
|
|
26
26
|
*/
|
|
27
27
|
export declare class LibsqlLockAdapter implements IDatabaseLockAdapter, IDeinitizable, IInitizable {
|
|
@@ -49,7 +49,7 @@ export declare class LibsqlLockAdapter implements IDatabaseLockAdapter, IDeiniti
|
|
|
49
49
|
deInit(): Promise<void>;
|
|
50
50
|
/**
|
|
51
51
|
* Creates the table where the lock keys are stored and it's related indexes.
|
|
52
|
-
* Note the
|
|
52
|
+
* Note the `init` method needs to be called before using the adapter.
|
|
53
53
|
*/
|
|
54
54
|
init(): Promise<void>;
|
|
55
55
|
insert(key: string, owner: string, expiration: Date | null): Promise<void>;
|
|
@@ -7,12 +7,12 @@ import { KyselyTableNameTransformerPlugin } from "../../../../utilities/_module-
|
|
|
7
7
|
import { LibsqlDialect } from "@libsql/kysely-libsql";
|
|
8
8
|
import { KyselyLockAdapter } from "../../../../lock/implementations/adapters/kysely-lock-adapter/_module.js";
|
|
9
9
|
/**
|
|
10
|
-
* To utilize the
|
|
10
|
+
* To utilize the `LibsqlLockAdapter`, you must install the `"@libsql/client"` package.
|
|
11
11
|
*
|
|
12
|
-
* Note in order to use
|
|
12
|
+
* Note in order to use `LibsqlLockAdapter` correctly, ensure you use a single, consistent database across all server instances.
|
|
13
13
|
* This means you can't use libsql embedded replicas.
|
|
14
14
|
*
|
|
15
|
-
* IMPORT_PATH:
|
|
15
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
16
16
|
* @group Adapters
|
|
17
17
|
*/
|
|
18
18
|
export class LibsqlLockAdapter {
|
|
@@ -60,7 +60,7 @@ export class LibsqlLockAdapter {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Creates the table where the lock keys are stored and it's related indexes.
|
|
63
|
-
* Note the
|
|
63
|
+
* Note the `init` method needs to be called before using the adapter.
|
|
64
64
|
*/
|
|
65
65
|
async init() {
|
|
66
66
|
await this.databaseLockAdapter.init();
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
import type { TimeSpan } from "../../../../utilities/_module-exports.js";
|
|
5
5
|
import type { ILockAdapter, ILockData } from "../../../../lock/contracts/_module-exports.js";
|
|
6
6
|
/**
|
|
7
|
-
* Note the
|
|
7
|
+
* Note the `MemoryLockAdapter` is limited to single process usage and cannot be shared across multiple servers or different processes.
|
|
8
8
|
* This adapter is meant to be used for testing.
|
|
9
9
|
*
|
|
10
|
-
* IMPORT_PATH:
|
|
10
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
11
11
|
* @group Adapters
|
|
12
12
|
*/
|
|
13
13
|
export declare class MemoryLockAdapter implements ILockAdapter {
|
|
@@ -20,7 +20,7 @@ export declare class MemoryLockAdapter implements ILockAdapter {
|
|
|
20
20
|
*
|
|
21
21
|
* const lockAdapter = new MemoryLockAdapter();
|
|
22
22
|
* ```
|
|
23
|
-
* You can also provide an
|
|
23
|
+
* You can also provide an `Map`.
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
26
26
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @module Lock
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Note the
|
|
5
|
+
* Note the `MemoryLockAdapter` is limited to single process usage and cannot be shared across multiple servers or different processes.
|
|
6
6
|
* This adapter is meant to be used for testing.
|
|
7
7
|
*
|
|
8
|
-
* IMPORT_PATH:
|
|
8
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
9
9
|
* @group Adapters
|
|
10
10
|
*/
|
|
11
11
|
export class MemoryLockAdapter {
|
|
@@ -18,7 +18,7 @@ export class MemoryLockAdapter {
|
|
|
18
18
|
*
|
|
19
19
|
* const lockAdapter = new MemoryLockAdapter();
|
|
20
20
|
* ```
|
|
21
|
-
* You can also provide an
|
|
21
|
+
* You can also provide an `Map`.
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
24
24
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
|
|
@@ -6,7 +6,7 @@ import type { IDatabaseLockAdapter, ILockData } from "../../../../lock/contracts
|
|
|
6
6
|
import type { CollectionOptions, Db } from "mongodb";
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
|
-
* IMPORT_PATH:
|
|
9
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
10
10
|
* @group Adapters
|
|
11
11
|
*/
|
|
12
12
|
export type MongodbLockAdapterSettings = {
|
|
@@ -15,11 +15,11 @@ export type MongodbLockAdapterSettings = {
|
|
|
15
15
|
collectionSettings?: CollectionOptions;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
* To utilize the
|
|
18
|
+
* To utilize the `MongodbLockAdapter`, you must install the `"mongodb"` package.
|
|
19
19
|
*
|
|
20
|
-
* Note in order to use
|
|
20
|
+
* Note in order to use `MongodbLockAdapter` correctly, ensure you use a single, consistent database across all server instances.
|
|
21
21
|
*
|
|
22
|
-
* IMPORT_PATH:
|
|
22
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
23
23
|
* @group Adapters
|
|
24
24
|
*/
|
|
25
25
|
export declare class MongodbLockAdapter implements IDatabaseLockAdapter, IDeinitizable, IInitizable {
|
|
@@ -45,7 +45,7 @@ export declare class MongodbLockAdapter implements IDatabaseLockAdapter, IDeinit
|
|
|
45
45
|
removeExpiredKeys(): Promise<void>;
|
|
46
46
|
/**
|
|
47
47
|
* Creates all related indexes.
|
|
48
|
-
* Note the
|
|
48
|
+
* Note the `init` method needs to be called before using the adapter.
|
|
49
49
|
*/
|
|
50
50
|
init(): Promise<void>;
|
|
51
51
|
/**
|
|
@@ -5,11 +5,11 @@ import {} from "../../../../utilities/_module-exports.js";
|
|
|
5
5
|
import { UnexpectedLockError } from "../../../../lock/contracts/_module-exports.js";
|
|
6
6
|
import { ObjectId } from "mongodb";
|
|
7
7
|
/**
|
|
8
|
-
* To utilize the
|
|
8
|
+
* To utilize the `MongodbLockAdapter`, you must install the `"mongodb"` package.
|
|
9
9
|
*
|
|
10
|
-
* Note in order to use
|
|
10
|
+
* Note in order to use `MongodbLockAdapter` correctly, ensure you use a single, consistent database across all server instances.
|
|
11
11
|
*
|
|
12
|
-
* IMPORT_PATH:
|
|
12
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
13
13
|
* @group Adapters
|
|
14
14
|
*/
|
|
15
15
|
export class MongodbLockAdapter {
|
|
@@ -45,7 +45,7 @@ export class MongodbLockAdapter {
|
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Creates all related indexes.
|
|
48
|
-
* Note the
|
|
48
|
+
* Note the `init` method needs to be called before using the adapter.
|
|
49
49
|
*/
|
|
50
50
|
async init() {
|
|
51
51
|
await this.collection.createIndex({
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import type { TimeSpan } from "../../../../utilities/_module-exports.js";
|
|
5
5
|
import type { ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
|
|
6
6
|
/**
|
|
7
|
-
* This
|
|
7
|
+
* This `NoOpLockAdapter` will do nothing and is used for easily mocking {@link ILockProvider | `ILockProvider`} for testing.
|
|
8
8
|
*
|
|
9
|
-
* IMPORT_PATH:
|
|
9
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
10
10
|
* @group Adapters
|
|
11
11
|
*/
|
|
12
12
|
export declare class NoOpLockAdapter implements ILockAdapter {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @module Lock
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* This
|
|
5
|
+
* This `NoOpLockAdapter` will do nothing and is used for easily mocking {@link ILockProvider | `ILockProvider`} for testing.
|
|
6
6
|
*
|
|
7
|
-
* IMPORT_PATH:
|
|
7
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
8
8
|
* @group Adapters
|
|
9
9
|
*/
|
|
10
10
|
export class NoOpLockAdapter {
|
|
@@ -13,11 +13,11 @@ declare module "ioredis" {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* To utilize the
|
|
16
|
+
* To utilize the `RedisLockAdapter`, you must install the `"ioredis"` package.
|
|
17
17
|
*
|
|
18
|
-
* Note in order to use
|
|
18
|
+
* Note in order to use `RedisLockAdapter` correctly, ensure you use a single, consistent database across all server instances.
|
|
19
19
|
*
|
|
20
|
-
* IMPORT_PATH:
|
|
20
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
21
21
|
* @group Adapters
|
|
22
22
|
*/
|
|
23
23
|
export declare class RedisLockAdapter implements ILockAdapter {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @module Lock
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* To utilize the
|
|
5
|
+
* To utilize the `RedisLockAdapter`, you must install the `"ioredis"` package.
|
|
6
6
|
*
|
|
7
|
-
* Note in order to use
|
|
7
|
+
* Note in order to use `RedisLockAdapter` correctly, ensure you use a single, consistent database across all server instances.
|
|
8
8
|
*
|
|
9
|
-
* IMPORT_PATH:
|
|
9
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
10
10
|
* @group Adapters
|
|
11
11
|
*/
|
|
12
12
|
export class RedisLockAdapter {
|
|
@@ -5,7 +5,7 @@ import type { IDatabaseLockAdapter, ILockData } from "../../../../lock/contracts
|
|
|
5
5
|
import { type IDeinitizable, type IInitizable, type ISqliteDatabase, TimeSpan } from "../../../../utilities/_module-exports.js";
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
|
-
* IMPORT_PATH:
|
|
8
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
9
9
|
* @group Adapters
|
|
10
10
|
*/
|
|
11
11
|
export type SqliteLockAdapterSettings = {
|
|
@@ -15,12 +15,12 @@ export type SqliteLockAdapterSettings = {
|
|
|
15
15
|
shouldRemoveExpiredKeys?: boolean;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
* To utilize the
|
|
18
|
+
* To utilize the `SqliteLockAdapter`, you must install the `"better-sqlite3"` and `"@types/better-sqlite3"` packages.
|
|
19
19
|
*
|
|
20
|
-
* Note the
|
|
20
|
+
* Note the `SqliteLockAdapter` is limited to single server usage and cannot be shared across multiple servers but it can be shared between different processes.
|
|
21
21
|
* To use it correctly, ensure all process instances access the same consistent, persisted database.
|
|
22
22
|
*
|
|
23
|
-
* IMPORT_PATH:
|
|
23
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
24
24
|
* @group Adapters
|
|
25
25
|
*/
|
|
26
26
|
export declare class SqliteLockAdapter implements IDatabaseLockAdapter, IDeinitizable, IInitizable {
|
|
@@ -48,7 +48,7 @@ export declare class SqliteLockAdapter implements IDatabaseLockAdapter, IDeiniti
|
|
|
48
48
|
deInit(): Promise<void>;
|
|
49
49
|
/**
|
|
50
50
|
* Creates the table where the lock keys are stored and it's related indexes.
|
|
51
|
-
* Note the
|
|
51
|
+
* Note the `init` method needs to be called before using the adapter.
|
|
52
52
|
*/
|
|
53
53
|
init(): Promise<void>;
|
|
54
54
|
insert(key: string, owner: string, expiration: Date | null): Promise<void>;
|
|
@@ -6,12 +6,12 @@ import { KyselyLockAdapter } from "../../../../lock/implementations/adapters/kys
|
|
|
6
6
|
import { Kysely, SqliteDialect } from "kysely";
|
|
7
7
|
import { KyselyTableNameTransformerPlugin } from "../../../../utilities/_module-exports.js";
|
|
8
8
|
/**
|
|
9
|
-
* To utilize the
|
|
9
|
+
* To utilize the `SqliteLockAdapter`, you must install the `"better-sqlite3"` and `"@types/better-sqlite3"` packages.
|
|
10
10
|
*
|
|
11
|
-
* Note the
|
|
11
|
+
* Note the `SqliteLockAdapter` is limited to single server usage and cannot be shared across multiple servers but it can be shared between different processes.
|
|
12
12
|
* To use it correctly, ensure all process instances access the same consistent, persisted database.
|
|
13
13
|
*
|
|
14
|
-
* IMPORT_PATH:
|
|
14
|
+
* IMPORT_PATH: `"@daiso-tech/core/lock/adapters"`
|
|
15
15
|
* @group Adapters
|
|
16
16
|
*/
|
|
17
17
|
export class SqliteLockAdapter {
|
|
@@ -59,7 +59,7 @@ export class SqliteLockAdapter {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Creates the table where the lock keys are stored and it's related indexes.
|
|
62
|
-
* Note the
|
|
62
|
+
* Note the `init` method needs to be called before using the adapter.
|
|
63
63
|
*/
|
|
64
64
|
async init() {
|
|
65
65
|
await this.databaseLockAdapter.init();
|