@daiso-tech/core 0.21.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_module.js +2 -0
- package/dist/cjs/_module.js.map +1 -1
- package/dist/cjs/async/utilities/lazy-promise/lazy-promise.js +3 -2
- package/dist/cjs/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/cjs/cache/contracts/cache.events.js +6 -2
- package/dist/cjs/cache/contracts/cache.events.js.map +1 -1
- package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js +5 -5
- package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js +58 -21
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +1 -1
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/_module.js +0 -1
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +0 -4
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js +0 -1
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +3 -7
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js +0 -1
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +6 -5
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/_module.js +0 -1
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +5 -8
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js +0 -1
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +0 -4
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache/_module.js +0 -1
- package/dist/cjs/cache/implementations/derivables/cache/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache/cache.js +213 -102
- package/dist/cjs/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory/_module.js +0 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory/cache-factory.js +0 -4
- package/dist/cjs/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cjs/event-bus/implementations/_shared/event-bus-adapter.test-suite.js +3 -3
- package/dist/cjs/event-bus/implementations/_shared/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.js +4 -3
- package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js +0 -1
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +0 -4
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js +0 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +0 -4
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus/_module.js +0 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus/event-bus.js +0 -4
- package/dist/cjs/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory/_module.js +0 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +0 -4
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/cjs/lock/contracts/_module.js +24 -0
- package/dist/cjs/lock/contracts/_module.js.map +1 -0
- package/dist/cjs/lock/contracts/database-lock-adapter.contract.js +3 -0
- package/dist/cjs/lock/contracts/database-lock-adapter.contract.js.map +1 -0
- package/dist/cjs/lock/contracts/lock-adapter.contract.js +3 -0
- package/dist/cjs/lock/contracts/lock-adapter.contract.js.map +1 -0
- package/dist/cjs/lock/contracts/lock-provider-factory.contract.js +3 -0
- package/dist/cjs/lock/contracts/lock-provider-factory.contract.js.map +1 -0
- package/dist/cjs/lock/contracts/lock-provider.contract.js +3 -0
- package/dist/cjs/lock/contracts/lock-provider.contract.js.map +1 -0
- package/dist/cjs/lock/contracts/lock.contract.js +3 -0
- package/dist/cjs/lock/contracts/lock.contract.js.map +1 -0
- package/dist/cjs/lock/contracts/lock.errors.js +131 -0
- package/dist/cjs/lock/contracts/lock.errors.js.map +1 -0
- package/dist/cjs/lock/contracts/lock.events.js +44 -0
- package/dist/cjs/lock/contracts/lock.events.js.map +1 -0
- package/dist/cjs/lock/implementations/_module.js +20 -0
- package/dist/cjs/lock/implementations/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/_shared/_module.js +20 -0
- package/dist/cjs/lock/implementations/_shared/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/_shared/database-lock-adapter.test-suite.js +285 -0
- package/dist/cjs/lock/implementations/_shared/database-lock-adapter.test-suite.js.map +1 -0
- package/dist/cjs/lock/implementations/_shared/lock-adapter.test-suite.js +238 -0
- package/dist/cjs/lock/implementations/_shared/lock-adapter.test-suite.js.map +1 -0
- package/dist/cjs/lock/implementations/_shared/lock-provider.test-suite.js +1841 -0
- package/dist/cjs/lock/implementations/_shared/lock-provider.test-suite.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/_module.js +22 -0
- package/dist/cjs/lock/implementations/adapters/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/kysely-lock-adapter/_module.js +18 -0
- package/dist/cjs/lock/implementations/adapters/kysely-lock-adapter/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +126 -0
- package/dist/cjs/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/libsql-lock-adapter/_module.js +18 -0
- package/dist/cjs/lock/implementations/adapters/libsql-lock-adapter/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +61 -0
- package/dist/cjs/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/memory-lock-adapter/_module.js +18 -0
- package/dist/cjs/lock/implementations/adapters/memory-lock-adapter/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +107 -0
- package/dist/cjs/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/mongodb-lock-adapter/_module.js +18 -0
- package/dist/cjs/lock/implementations/adapters/mongodb-lock-adapter/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +148 -0
- package/dist/cjs/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/redis-lock-adapter/_module.js +18 -0
- package/dist/cjs/lock/implementations/adapters/redis-lock-adapter/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +131 -0
- package/dist/cjs/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/sqlite-lock-adapter/_module.js +18 -0
- package/dist/cjs/lock/implementations/adapters/sqlite-lock-adapter/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +60 -0
- package/dist/cjs/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +1 -0
- package/dist/cjs/lock/implementations/derivables/_module.js +19 -0
- package/dist/cjs/lock/implementations/derivables/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider/_module.js +18 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider/database-lock-adapter.js +80 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider/lock-provider.js +162 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider/lock.js +306 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider/lock.js.map +1 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider-factory/_module.js +18 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider-factory/_module.js.map +1 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +78 -0
- package/dist/cjs/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -0
- package/dist/cjs/utilities/contracts/_module.js +1 -0
- package/dist/cjs/utilities/contracts/_module.js.map +1 -1
- package/dist/cjs/utilities/contracts/serde-registrable.contract.js +3 -0
- package/dist/cjs/utilities/contracts/serde-registrable.contract.js.map +1 -0
- package/dist/cjs/utilities/functions.js +4 -0
- package/dist/cjs/utilities/functions.js.map +1 -1
- package/dist/esm/_module.js +2 -0
- package/dist/esm/_module.js.map +1 -1
- package/dist/esm/async/utilities/lazy-promise/lazy-promise.js +3 -2
- package/dist/esm/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/esm/cache/contracts/cache.events.js +4 -1
- package/dist/esm/cache/contracts/cache.events.js.map +1 -1
- package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js +5 -5
- package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js +59 -22
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +1 -1
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js +0 -1
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +0 -4
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js +0 -1
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +3 -7
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js +0 -1
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +6 -5
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js +0 -1
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +5 -8
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js +0 -1
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +0 -4
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache/_module.js +0 -1
- package/dist/esm/cache/implementations/derivables/cache/_module.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache/cache.js +214 -103
- package/dist/esm/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-factory/_module.js +0 -1
- package/dist/esm/cache/implementations/derivables/cache-factory/_module.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-factory/cache-factory.js +0 -4
- package/dist/esm/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/esm/event-bus/implementations/_shared/event-bus-adapter.test-suite.js +3 -3
- package/dist/esm/event-bus/implementations/_shared/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.js +5 -4
- package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js +0 -1
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +0 -4
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js +0 -1
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +0 -4
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus/_module.js +0 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus/event-bus.js +0 -4
- package/dist/esm/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory/_module.js +0 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +0 -4
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/esm/lock/contracts/_module.js +8 -0
- package/dist/esm/lock/contracts/_module.js.map +1 -0
- package/dist/esm/lock/contracts/database-lock-adapter.contract.js +1 -0
- package/dist/esm/lock/contracts/database-lock-adapter.contract.js.map +1 -0
- package/dist/esm/lock/contracts/lock-adapter.contract.js +1 -0
- package/dist/esm/lock/contracts/lock-adapter.contract.js.map +1 -0
- package/dist/esm/lock/contracts/lock-provider-factory.contract.js +1 -0
- package/dist/esm/lock/contracts/lock-provider-factory.contract.js.map +1 -0
- package/dist/esm/lock/contracts/lock-provider.contract.js +1 -0
- package/dist/esm/lock/contracts/lock-provider.contract.js.map +1 -0
- package/dist/esm/lock/contracts/lock.contract.js +1 -0
- package/dist/esm/lock/contracts/lock.contract.js.map +1 -0
- package/dist/esm/lock/contracts/lock.errors.js +120 -0
- package/dist/esm/lock/contracts/lock.errors.js.map +1 -0
- package/dist/esm/lock/contracts/lock.events.js +32 -0
- package/dist/esm/lock/contracts/lock.events.js.map +1 -0
- package/dist/esm/lock/implementations/_module.js +4 -0
- package/dist/esm/lock/implementations/_module.js.map +1 -0
- package/dist/esm/lock/implementations/_shared/_module.js +4 -0
- package/dist/esm/lock/implementations/_shared/_module.js.map +1 -0
- package/dist/esm/lock/implementations/_shared/database-lock-adapter.test-suite.js +282 -0
- package/dist/esm/lock/implementations/_shared/database-lock-adapter.test-suite.js.map +1 -0
- package/dist/esm/lock/implementations/_shared/lock-adapter.test-suite.js +235 -0
- package/dist/esm/lock/implementations/_shared/lock-adapter.test-suite.js.map +1 -0
- package/dist/esm/lock/implementations/_shared/lock-provider.test-suite.js +1838 -0
- package/dist/esm/lock/implementations/_shared/lock-provider.test-suite.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/_module.js +6 -0
- package/dist/esm/lock/implementations/adapters/_module.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/kysely-lock-adapter/_module.js +2 -0
- package/dist/esm/lock/implementations/adapters/kysely-lock-adapter/_module.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +122 -0
- package/dist/esm/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/libsql-lock-adapter/_module.js +2 -0
- package/dist/esm/lock/implementations/adapters/libsql-lock-adapter/_module.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +57 -0
- package/dist/esm/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/memory-lock-adapter/_module.js +2 -0
- package/dist/esm/lock/implementations/adapters/memory-lock-adapter/_module.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +103 -0
- package/dist/esm/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/mongodb-lock-adapter/_module.js +2 -0
- package/dist/esm/lock/implementations/adapters/mongodb-lock-adapter/_module.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +144 -0
- package/dist/esm/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/redis-lock-adapter/_module.js +2 -0
- package/dist/esm/lock/implementations/adapters/redis-lock-adapter/_module.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +127 -0
- package/dist/esm/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/sqlite-lock-adapter/_module.js +2 -0
- package/dist/esm/lock/implementations/adapters/sqlite-lock-adapter/_module.js.map +1 -0
- package/dist/esm/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +56 -0
- package/dist/esm/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +1 -0
- package/dist/esm/lock/implementations/derivables/_module.js +3 -0
- package/dist/esm/lock/implementations/derivables/_module.js.map +1 -0
- package/dist/esm/lock/implementations/derivables/lock-provider/_module.js +2 -0
- package/dist/esm/lock/implementations/derivables/lock-provider/_module.js.map +1 -0
- package/dist/esm/lock/implementations/derivables/lock-provider/database-lock-adapter.js +76 -0
- package/dist/esm/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -0
- package/dist/esm/lock/implementations/derivables/lock-provider/lock-provider.js +158 -0
- package/dist/esm/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -0
- package/dist/esm/lock/implementations/derivables/lock-provider/lock.js +302 -0
- package/dist/esm/lock/implementations/derivables/lock-provider/lock.js.map +1 -0
- package/dist/esm/lock/implementations/derivables/lock-provider-factory/_module.js +2 -0
- package/dist/esm/lock/implementations/derivables/lock-provider-factory/_module.js.map +1 -0
- package/dist/esm/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +74 -0
- package/dist/esm/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -0
- package/dist/esm/utilities/contracts/_module.js +1 -0
- package/dist/esm/utilities/contracts/_module.js.map +1 -1
- package/dist/esm/utilities/contracts/serde-registrable.contract.js +1 -0
- package/dist/esm/utilities/contracts/serde-registrable.contract.js.map +1 -0
- package/dist/esm/utilities/functions.js +4 -0
- package/dist/esm/utilities/functions.js.map +1 -1
- package/dist/types/_module.d.ts +2 -0
- package/dist/types/async/utilities/lazy-promise/lazy-promise.d.ts +2 -2
- package/dist/types/cache/contracts/cache-adapter.contract.d.ts +2 -2
- package/dist/types/cache/contracts/cache-factory.contract.d.ts +1 -2
- package/dist/types/cache/contracts/cache.contract.d.ts +116 -8
- package/dist/types/cache/contracts/cache.events.d.ts +12 -1
- package/dist/types/cache/implementations/_shared/cache-adapter.test-suite.d.ts +2 -9
- package/dist/types/cache/implementations/_shared/cache.test-suite.d.ts +3 -13
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/_module.d.ts +0 -1
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +23 -29
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/_module.d.ts +0 -1
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +8 -18
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/_module.d.ts +0 -1
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +16 -26
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/_module.d.ts +0 -1
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +12 -22
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/_module.d.ts +0 -1
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +23 -29
- package/dist/types/cache/implementations/derivables/cache/_module.d.ts +0 -1
- package/dist/types/cache/implementations/derivables/cache/cache.d.ts +38 -27
- package/dist/types/cache/implementations/derivables/cache-factory/_module.d.ts +0 -1
- package/dist/types/cache/implementations/derivables/cache-factory/cache-factory.d.ts +60 -26
- package/dist/types/collection/contracts/async-collection.contract.d.ts +68 -8
- package/dist/types/event-bus/contracts/event-bus-adapter.contract.d.ts +1 -1
- package/dist/types/event-bus/contracts/event-bus-factory.contract.d.ts +1 -1
- package/dist/types/event-bus/implementations/_shared/event-bus-adapter.test-suite.d.ts +2 -10
- package/dist/types/event-bus/implementations/_shared/event-bus.test-suite.d.ts +3 -13
- package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/_module.d.ts +0 -1
- package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +8 -18
- package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.d.ts +0 -1
- package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +11 -20
- package/dist/types/event-bus/implementations/derivables/event-bus/_module.d.ts +0 -1
- package/dist/types/event-bus/implementations/derivables/event-bus/event-bus.d.ts +29 -20
- package/dist/types/event-bus/implementations/derivables/event-bus-factory/_module.d.ts +0 -1
- package/dist/types/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +49 -46
- package/dist/types/lock/contracts/_module.d.ts +7 -0
- package/dist/types/lock/contracts/database-lock-adapter.contract.d.ts +49 -0
- package/dist/types/lock/contracts/lock-adapter.contract.d.ts +48 -0
- package/dist/types/lock/contracts/lock-provider-factory.contract.d.ts +36 -0
- package/dist/types/lock/contracts/lock-provider.contract.d.ts +92 -0
- package/dist/types/lock/contracts/lock.contract.d.ts +219 -0
- package/dist/types/lock/contracts/lock.errors.d.ts +66 -0
- package/dist/types/lock/contracts/lock.events.d.ts +83 -0
- package/dist/types/lock/implementations/_module.d.ts +3 -0
- package/dist/types/lock/implementations/_shared/_module.d.ts +3 -0
- package/dist/types/lock/implementations/_shared/database-lock-adapter.test-suite.d.ts +21 -0
- package/dist/types/lock/implementations/_shared/lock-adapter.test-suite.d.ts +21 -0
- package/dist/types/lock/implementations/_shared/lock-provider.test-suite.d.ts +23 -0
- package/dist/types/lock/implementations/adapters/_module.d.ts +5 -0
- package/dist/types/lock/implementations/adapters/kysely-lock-adapter/_module.d.ts +1 -0
- package/dist/types/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +52 -0
- package/dist/types/lock/implementations/adapters/libsql-lock-adapter/_module.d.ts +1 -0
- package/dist/types/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +58 -0
- package/dist/types/lock/implementations/adapters/memory-lock-adapter/_module.d.ts +1 -0
- package/dist/types/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +52 -0
- package/dist/types/lock/implementations/adapters/mongodb-lock-adapter/_module.d.ts +1 -0
- package/dist/types/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +60 -0
- package/dist/types/lock/implementations/adapters/redis-lock-adapter/_module.d.ts +1 -0
- package/dist/types/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +57 -0
- package/dist/types/lock/implementations/adapters/sqlite-lock-adapter/_module.d.ts +1 -0
- package/dist/types/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +57 -0
- package/dist/types/lock/implementations/derivables/_module.d.ts +2 -0
- package/dist/types/lock/implementations/derivables/lock-provider/_module.d.ts +1 -0
- package/dist/types/lock/implementations/derivables/lock-provider/database-lock-adapter.d.ts +23 -0
- package/dist/types/lock/implementations/derivables/lock-provider/lock-provider.d.ts +89 -0
- package/dist/types/lock/implementations/derivables/lock-provider/lock.d.ts +73 -0
- package/dist/types/lock/implementations/derivables/lock-provider-factory/_module.d.ts +1 -0
- package/dist/types/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +98 -0
- package/dist/types/utilities/contracts/_module.d.ts +1 -0
- package/dist/types/utilities/contracts/serde-registrable.contract.d.ts +11 -0
- package/dist/types/utilities/types.d.ts +3 -1
- package/package.json +5 -3
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js +0 -56
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js.map +0 -1
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js +0 -26
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js.map +0 -1
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js +0 -44
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js.map +0 -1
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js +0 -32
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js.map +0 -1
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js +0 -56
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js.map +0 -1
- package/dist/cjs/cache/implementations/derivables/cache/cache-settings.js +0 -56
- package/dist/cjs/cache/implementations/derivables/cache/cache-settings.js.map +0 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory/cache-factory-settings.js +0 -83
- package/dist/cjs/cache/implementations/derivables/cache-factory/cache-factory-settings.js.map +0 -1
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js +0 -26
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js.map +0 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js +0 -38
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js.map +0 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus/event-bus-settings.js +0 -56
- package/dist/cjs/event-bus/implementations/derivables/event-bus/event-bus-settings.js.map +0 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory/event-bus-factory-settings.js +0 -71
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory/event-bus-factory-settings.js.map +0 -1
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js +0 -52
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js.map +0 -1
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js +0 -22
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js.map +0 -1
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js +0 -40
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js.map +0 -1
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js +0 -28
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js.map +0 -1
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js +0 -52
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js.map +0 -1
- package/dist/esm/cache/implementations/derivables/cache/cache-settings.js +0 -52
- package/dist/esm/cache/implementations/derivables/cache/cache-settings.js.map +0 -1
- package/dist/esm/cache/implementations/derivables/cache-factory/cache-factory-settings.js +0 -79
- package/dist/esm/cache/implementations/derivables/cache-factory/cache-factory-settings.js.map +0 -1
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js +0 -22
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js.map +0 -1
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js +0 -34
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js.map +0 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus/event-bus-settings.js +0 -52
- package/dist/esm/event-bus/implementations/derivables/event-bus/event-bus-settings.js.map +0 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory/event-bus-factory-settings.js +0 -67
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory/event-bus-factory-settings.js.map +0 -1
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.d.ts +0 -48
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.d.ts +0 -26
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.d.ts +0 -50
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.d.ts +0 -32
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.d.ts +0 -48
- package/dist/types/cache/implementations/derivables/cache/cache-settings.d.ts +0 -73
- package/dist/types/cache/implementations/derivables/cache-factory/cache-factory-settings.d.ts +0 -108
- package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.d.ts +0 -27
- package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.d.ts +0 -36
- package/dist/types/event-bus/implementations/derivables/event-bus/event-bus-settings.d.ts +0 -62
- package/dist/types/event-bus/implementations/derivables/event-bus-factory/event-bus-factory-settings.d.ts +0 -92
package/dist/types/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts
CHANGED
|
@@ -1,57 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module EventBus
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import { type
|
|
4
|
+
import type { BackoffPolicy, RetryPolicy } from "../../../../async/_module";
|
|
5
|
+
import { type IEventBusAdapter, type IGroupableEventBus, type IEventBusFactory, type BaseEvent } from "../../../../event-bus/contracts/_module";
|
|
6
|
+
import type { OneOrMore, TimeSpan } from "../../../../utilities/_module";
|
|
7
|
+
import type { IFlexibleSerde } from "../../../../serde/contracts/_module";
|
|
6
8
|
/**
|
|
7
9
|
* @group Derivables
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* import { EventBusFactory } from "@daiso-tech/core";
|
|
11
|
-
* import Redis from "ioredis"
|
|
12
|
-
*
|
|
13
|
-
* const eventBusFactory = new EventBusFactory({
|
|
14
|
-
* adapters: {
|
|
15
|
-
* memory: new MemoryEventBusAdapter({ rootGroup: "@global" }),
|
|
16
|
-
* redis: new RedisPubSubEventBusAdapter({
|
|
17
|
-
* dispatcherClient: new Redis(),
|
|
18
|
-
* listenerClient: new Redis(),
|
|
19
|
-
* serde: new SuperJsonSerde(),
|
|
20
|
-
* rootGroup: "@global"
|
|
21
|
-
* }),
|
|
22
|
-
* },
|
|
23
|
-
* defaultAdapter: "memory",
|
|
24
|
-
* serde: new SuperJsonSerde()
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
27
10
|
*/
|
|
28
|
-
export
|
|
11
|
+
export type EventBusAdapters<TAdapters extends string = string> = Partial<Record<TAdapters, IEventBusAdapter>>;
|
|
12
|
+
/**
|
|
13
|
+
* @group Derivables
|
|
14
|
+
*/
|
|
15
|
+
export type EventBusFactorySettings<TAdapters extends string = string> = {
|
|
29
16
|
/**
|
|
30
|
-
* @
|
|
31
|
-
*
|
|
32
|
-
* import { EventBusFactory, SuperJsonSerde. MemoryEventBusAdapter, RedisPubSubEventBusAdapter, EventBus, MemoryEventBusAdapter } from "@daiso-tech/core";
|
|
33
|
-
* import Redis from "ioredis";
|
|
34
|
-
*
|
|
35
|
-
* const serde = new SuperJsonSerde();
|
|
36
|
-
* const cacheFactory = new EventBusFactory(
|
|
37
|
-
* EventBusFactory
|
|
38
|
-
* .settings()
|
|
39
|
-
* .setSerde(serde)
|
|
40
|
-
* .setAdapter("memory", new MemoryEventBusAdapter({
|
|
41
|
-
* rootGroup: "@global"
|
|
42
|
-
* }))
|
|
43
|
-
* .setAdapter("redis", new RedisPubSubEventBusAdapter({
|
|
44
|
-
* dispatcherClient: new Redis("YOUR_REDIS_CONNECTION"),
|
|
45
|
-
* listenerClient: new Redis("YOUR_REDIS_CONNECTION")
|
|
46
|
-
* serde,
|
|
47
|
-
* rootGroup: "@global"
|
|
48
|
-
* }))
|
|
49
|
-
* .setDefaultAdapter("memory")
|
|
50
|
-
* .build()
|
|
51
|
-
* );
|
|
52
|
-
* ```
|
|
17
|
+
* You can pass one or more <i>{@link IFlexibleSerde}</i> that will be used to register all <i>{@link IGroupableEventBus}</i> related errors.
|
|
18
|
+
* @default {true}
|
|
53
19
|
*/
|
|
54
|
-
|
|
20
|
+
serde: OneOrMore<IFlexibleSerde>;
|
|
21
|
+
/**
|
|
22
|
+
* If set to true, all <i>{@link IGroupableEventBus}</i> related errors will be registered with the specified <i>IFlexibleSerde</i> during constructor initialization.
|
|
23
|
+
* This ensures that all <i>{@link IGroupableEventBus}</i> related errors will be serialized correctly.
|
|
24
|
+
* @default {true}
|
|
25
|
+
*/
|
|
26
|
+
shouldRegisterErrors?: boolean;
|
|
27
|
+
adapters: EventBusAdapters<TAdapters>;
|
|
28
|
+
defaultAdapter?: NoInfer<TAdapters>;
|
|
29
|
+
/**
|
|
30
|
+
* In order to listen to events of <i>{@link Cache}</i> class you must pass in <i>{@link IGroupableEventBus}</i>.
|
|
31
|
+
*/
|
|
32
|
+
eventBus?: IGroupableEventBus<any>;
|
|
33
|
+
/**
|
|
34
|
+
* The default retry attempt to use in the returned <i>LazyPromise</i>.
|
|
35
|
+
* @default {null}
|
|
36
|
+
*/
|
|
37
|
+
retryAttempts?: number | null;
|
|
38
|
+
/**
|
|
39
|
+
* The default backof policy to use in the returned <i>LazyPromise</i>.
|
|
40
|
+
* @default {null}
|
|
41
|
+
*/
|
|
42
|
+
backoffPolicy?: BackoffPolicy | null;
|
|
43
|
+
/**
|
|
44
|
+
* The default retry policy to use in the returned <i>LazyPromise</i>.
|
|
45
|
+
* @default {null}
|
|
46
|
+
*/
|
|
47
|
+
retryPolicy?: RetryPolicy | null;
|
|
48
|
+
/**
|
|
49
|
+
* The default timeout to use in the returned <i>LazyPromise</i>.
|
|
50
|
+
* @default {null}
|
|
51
|
+
*/
|
|
52
|
+
timeout?: TimeSpan | null;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* @group Derivables
|
|
56
|
+
*/
|
|
57
|
+
export declare class EventBusFactory<TAdapters extends string = string> implements IEventBusFactory<TAdapters> {
|
|
55
58
|
private readonly eventBusRecord;
|
|
56
59
|
private readonly serde;
|
|
57
60
|
private readonly defaultAdapter?;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "../../lock/contracts/lock-adapter.contract";
|
|
2
|
+
export * from "../../lock/contracts/database-lock-adapter.contract";
|
|
3
|
+
export * from "../../lock/contracts/lock-provider.contract";
|
|
4
|
+
export * from "../../lock/contracts/lock-provider-factory.contract";
|
|
5
|
+
export * from "../../lock/contracts/lock.contract";
|
|
6
|
+
export * from "../../lock/contracts/lock.errors";
|
|
7
|
+
export * from "../../lock/contracts/lock.events";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { IDeinitizable, IInitizable } from "../../utilities/_module";
|
|
5
|
+
/**
|
|
6
|
+
* @group Contracts
|
|
7
|
+
*/
|
|
8
|
+
export type ILockData = {
|
|
9
|
+
owner: string;
|
|
10
|
+
expiration: Date | null;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The <i>ILockAdapter</i> contract defines a way for managing locks independent of data storage.
|
|
14
|
+
* This contract is not meant to be used directly, instead you should use <i>{@link ILockProvider}</i> contract.
|
|
15
|
+
* @group Contracts
|
|
16
|
+
*/
|
|
17
|
+
export type IDatabaseLockAdapter = IDeinitizable & IInitizable & {
|
|
18
|
+
/**
|
|
19
|
+
* The <i>insert</i> method will create a lock if one does not already exist.
|
|
20
|
+
*/
|
|
21
|
+
insert(key: string, owner: string, expiration: Date | null): PromiseLike<void>;
|
|
22
|
+
/**
|
|
23
|
+
* The <i>update</i> method will update a lock if it has expired, matches the given <i>key</i> and matches the given <i>owner</i>.
|
|
24
|
+
* Returns number of updated rows or documents.
|
|
25
|
+
*/
|
|
26
|
+
update(key: string, owner: string, expiration: Date | null): PromiseLike<number>;
|
|
27
|
+
/**
|
|
28
|
+
* The <i>remove</i> method will remove a lock if it matches the given <i>key</i> and matches the given <i>owner</i>.
|
|
29
|
+
*/
|
|
30
|
+
remove(key: string, owner: string | null): PromiseLike<void>;
|
|
31
|
+
/**
|
|
32
|
+
* The <i>refresh</i> method will upadte expiration of lock if it matches the given <i>key</i> and matches the given <i>owner</i>.
|
|
33
|
+
* Returns number of updated rows or documents.
|
|
34
|
+
*/
|
|
35
|
+
refresh(key: string, owner: string, expiration: Date): PromiseLike<number>;
|
|
36
|
+
/**
|
|
37
|
+
* The <i>find</i> method will return a lock by the given <i>key</i>.
|
|
38
|
+
*/
|
|
39
|
+
find(key: string): PromiseLike<ILockData | null>;
|
|
40
|
+
/**
|
|
41
|
+
* The <i>getGroup</i> method returns the group name.
|
|
42
|
+
*/
|
|
43
|
+
getGroup(): string;
|
|
44
|
+
/**
|
|
45
|
+
* The <i>withGroup</i> method returns a new <i>{@link IDatabaseLockAdapter}</i> instance that groups locks together.
|
|
46
|
+
* Only locks in the same group will be acquired and released, leaving locks outside the group unaffected.
|
|
47
|
+
*/
|
|
48
|
+
withGroup(group: string): IDatabaseLockAdapter;
|
|
49
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { TimeSpan } from "../../utilities/_module";
|
|
5
|
+
/**
|
|
6
|
+
* The <i>ILockAdapter</i> contract defines a way for managing locks independent of the underlying technology.
|
|
7
|
+
* This contract is not meant to be used directly, instead you should use <i>{@link ILockProvider}</i> contract.
|
|
8
|
+
* @group Contracts
|
|
9
|
+
*/
|
|
10
|
+
export type ILockAdapter = {
|
|
11
|
+
/**
|
|
12
|
+
* The <i>acquire</i> method acquires a lock only if the lock is not already acquired.
|
|
13
|
+
* Returns true if not already acquired othewise false is returned.
|
|
14
|
+
*/
|
|
15
|
+
acquire(key: string, owner: string, ttl: TimeSpan | null): PromiseLike<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* The <i>release</i> method releases a lock if the owner matches.
|
|
18
|
+
* Returns true if released otherwise false is returned.
|
|
19
|
+
*/
|
|
20
|
+
release(key: string, owner: string): PromiseLike<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* The <i>forceRelease</i> method releases a lock regardless of the owner.
|
|
23
|
+
*/
|
|
24
|
+
forceRelease(key: string): PromiseLike<void>;
|
|
25
|
+
/**
|
|
26
|
+
* The <i>isLocked</i> method return true if locked otherwise false is returned.
|
|
27
|
+
*/
|
|
28
|
+
isLocked(key: string): PromiseLike<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* The <i>getRemainingTime</i> return the reaming time as <i>{@link TimeSpan}</i>.
|
|
31
|
+
* Returns null if the key doesnt exist, key has no expiration and key has expired.
|
|
32
|
+
*/
|
|
33
|
+
getRemainingTime(key: string): PromiseLike<TimeSpan | null>;
|
|
34
|
+
/**
|
|
35
|
+
* The <i>refresh</i> method will upadte ttl of lock if it matches the given <i>key</i> and matches the given <i>owner</i>.
|
|
36
|
+
* Returns true if the update occured otherwise false is returned.
|
|
37
|
+
*/
|
|
38
|
+
refresh(key: string, owner: string, ttl: TimeSpan): PromiseLike<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* The <i>getGroup</i> method returns the group name.
|
|
41
|
+
*/
|
|
42
|
+
getGroup(): string;
|
|
43
|
+
/**
|
|
44
|
+
* The <i>withGroup</i> method returns a new <i>{@link IDatabaseLockAdapter}</i> instance that groups locks together.
|
|
45
|
+
* Only locks in the same group will be acquired and released, leaving locks outside the group unaffected.
|
|
46
|
+
*/
|
|
47
|
+
withGroup(group: string): ILockAdapter;
|
|
48
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { IGroupableLockProvider } from "../../lock/contracts/lock-provider.contract";
|
|
5
|
+
/**
|
|
6
|
+
* The <i>ILockProviderFactory</i> contract makes it easy to configure and switch between different <i>{@link IGroupableLockProvider}</i> dynamically.
|
|
7
|
+
* @group Contracts
|
|
8
|
+
*/
|
|
9
|
+
export type ILockProviderFactory<TAdapters extends string = string> = {
|
|
10
|
+
/**
|
|
11
|
+
* The <i>use</i> method will throw an error if you provide it unregisted adapter.
|
|
12
|
+
* If no default adapter is defined an error will be thrown by <i>use</i> method.
|
|
13
|
+
* @throws {UnregisteredAdapterError} {@link UnregisteredAdapterError}
|
|
14
|
+
* @throws {DefaultAdapterNotDefinedError} {@link DefaultAdapterNotDefinedError}
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import type { ILockProviderFactory } from "@daiso-tech/core";
|
|
18
|
+
*
|
|
19
|
+
* // Asume the inputed lockProviderFactory has registered both a memory and Redis ILockAdapter.
|
|
20
|
+
* // The memory ILockAdapter adapter is the default.
|
|
21
|
+
* async function main(lockProviderFactory: ILockProviderFactory): Promise<void> {
|
|
22
|
+
* // Will create and acquire the lock with default adapter
|
|
23
|
+
* await lockProviderFactory
|
|
24
|
+
* .use()
|
|
25
|
+
* .create("a")
|
|
26
|
+
* .acquireOrFail();
|
|
27
|
+
* // Will create and acquire the lock with redis addapter
|
|
28
|
+
* await lockProviderFactory
|
|
29
|
+
* .use("redis")
|
|
30
|
+
* .create("a")
|
|
31
|
+
* .acquireOrFail();
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
use(adapterName?: TAdapters): IGroupableLockProvider;
|
|
36
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { OneOrMore, TimeSpan } from "../../utilities/_module";
|
|
5
|
+
import type { ILock, ILockListener } from "../../lock/contracts/lock.contract";
|
|
6
|
+
/**
|
|
7
|
+
* @group Contracts
|
|
8
|
+
*/
|
|
9
|
+
export type LockProviderCreateSettings = {
|
|
10
|
+
ttl?: TimeSpan | null;
|
|
11
|
+
owner?: OneOrMore<string>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The <i>ILockProvider</i> contract defines a way for managing locks independent of the underlying technology.
|
|
15
|
+
* It commes with more convient methods compared to <i>ILockAdapter</i>.
|
|
16
|
+
* @group Contracts
|
|
17
|
+
*/
|
|
18
|
+
export type ILockProvider = ILockListener & {
|
|
19
|
+
/**
|
|
20
|
+
* The <i>create</i> method is used to create an instance of <i>{@link ILock}</i>.
|
|
21
|
+
* You can provide a custom owner using the <i>settings.owner</i> field. If not specified a unique owner will be generated by default.
|
|
22
|
+
* You can also provide a TTL value using the <i>settings.ttl</i> field. If not specified it defaults to null, meaning no TTL is applied.
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { type ILockProvider, delay, TimeSpan } from "@daiso-tech/core";
|
|
26
|
+
*
|
|
27
|
+
* // Asume the inputed lockProvider is empty.
|
|
28
|
+
* async function main(lockProvider: ILockProvider): Promise<void> {
|
|
29
|
+
* const lock = await lockProvider.create("a");
|
|
30
|
+
*
|
|
31
|
+
* // You can now use the lock as you want.
|
|
32
|
+
* await lock.acquire();
|
|
33
|
+
* console.log("Hello world");
|
|
34
|
+
* await lock.release();
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
create(key: OneOrMore<string>, settings?: LockProviderCreateSettings): ILock;
|
|
39
|
+
/**
|
|
40
|
+
* The <i>getGroup</i> method returns the group name.
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import type { ILockProvider } from "@daiso-tech/core";
|
|
44
|
+
*
|
|
45
|
+
* // Asume the inputed lockProvider is empty and the default rootGroup is "@global"
|
|
46
|
+
* async function main(lockProvider: ILockProvider): Promise<void> {
|
|
47
|
+
* console.log(lockProvider.getGroup())
|
|
48
|
+
*
|
|
49
|
+
* const lockProviderA = lockProvider.withGroup("a");
|
|
50
|
+
*
|
|
51
|
+
* // Will be "@global/a"
|
|
52
|
+
* console.log(lockProviderA.getGroup())
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
getGroup(): string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The <i>IGroupableLockProvider</i> contract defines a way for managing locks independent of the underlying technology.
|
|
60
|
+
* It commes with one extra method which is useful for multitennat applications compared to <i>{@link ILockProvider}</i>.
|
|
61
|
+
* @group Contracts
|
|
62
|
+
*/
|
|
63
|
+
export type IGroupableLockProvider = ILockProvider & {
|
|
64
|
+
/**
|
|
65
|
+
* The <i>withGroup</i> method returns a new <i>{@link ILockProvider}</i> instance that groups locks together.
|
|
66
|
+
* Only locks in the same group will be acquired and released, leaving locks outside the group unaffected.
|
|
67
|
+
* This useful for multitennat applications.
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import type { IGroupableLockProvider } from "@daiso-tech/core";
|
|
71
|
+
*
|
|
72
|
+
* // Asume the inputed lockProvider is empty and the default rootGroup is "@global"
|
|
73
|
+
* async function main(lockProvider: IGroupableLockProvider): Promise<void> {
|
|
74
|
+
* const key = "a";
|
|
75
|
+
*
|
|
76
|
+
* const lockProviderA = lockProvider.withGroup("a");
|
|
77
|
+
* const lockA = lockProviderA.create(key);
|
|
78
|
+
*
|
|
79
|
+
* const lockProviderB = lockProvider.withGroup("b");
|
|
80
|
+
* const lockB = lockProviderB.create(key);
|
|
81
|
+
*
|
|
82
|
+
* const resultA = await lockA.acquire();
|
|
83
|
+
* const resultB = await lockB.acquire();
|
|
84
|
+
*
|
|
85
|
+
* // Will print out true for both lockA.acquire() and lockB.acquire()
|
|
86
|
+
* console.log("resultA:", resultA);
|
|
87
|
+
* console.log("resultB", resultB);
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
withGroup(group: OneOrMore<string>): ILockProvider;
|
|
92
|
+
};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { LazyPromiseable, Result, TimeSpan } from "../../utilities/_module";
|
|
5
|
+
import type { LazyPromise } from "../../async/_module";
|
|
6
|
+
import type { KeyAlreadyAcquiredLockError } from "../../lock/contracts/lock.errors";
|
|
7
|
+
import type { IEventListener } from "../../event-bus/contracts/_module";
|
|
8
|
+
import type { LockEvents } from "../../lock/contracts/lock.events";
|
|
9
|
+
/**
|
|
10
|
+
* The <i>ILockListener</i> contract defines a way for listening <i>{@link ILock}</i> operations.
|
|
11
|
+
* @group Contracts
|
|
12
|
+
*/
|
|
13
|
+
export type ILockListener = IEventListener<LockEvents>;
|
|
14
|
+
/**
|
|
15
|
+
* @group Contracts
|
|
16
|
+
*/
|
|
17
|
+
export type ILock = ILockListener & {
|
|
18
|
+
/**
|
|
19
|
+
* @throws {UnableToAquireLockError} {@link UnableToAquireLockError}
|
|
20
|
+
* @throws {UnableToReleaseLockError} {@link UnableToReleaseLockError}
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { type ILock, TimeSpan } from "@daiso-tech/core";
|
|
24
|
+
*
|
|
25
|
+
* // The function will execute sequentially when called concurrently as long you use the same lock.
|
|
26
|
+
* async function main(lock: ILock): Promise<void> {
|
|
27
|
+
* await lock.run(async () => {
|
|
28
|
+
* console.log("1.");
|
|
29
|
+
* await delay(TimeSpan.fromMilliseconds(1));
|
|
30
|
+
* console.log("2.");
|
|
31
|
+
* });
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
* You can also pass in a <i>{@link LazyPromise}</i>.
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { type ILock, TimeSpan } from "@daiso-tech/core";
|
|
38
|
+
*
|
|
39
|
+
* function fn(): LazyPromise<void> {
|
|
40
|
+
* return new LazyPromise(async () => {
|
|
41
|
+
* console.log("1.");
|
|
42
|
+
* await delay(TimeSpan.fromMilliseconds(1));
|
|
43
|
+
* console.log("2.");
|
|
44
|
+
* });
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* // The function will execute sequentially when called concurrently as long you use the same lock.
|
|
48
|
+
* async function main(lock: ILock): Promise<void> {
|
|
49
|
+
* await lock.run(fn());
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
run<TValue = void>(asyncFn: LazyPromiseable<TValue>): LazyPromise<Result<TValue, KeyAlreadyAcquiredLockError>>;
|
|
54
|
+
/**
|
|
55
|
+
* @throws {UnableToAquireLockError} {@link UnableToAquireLockError}
|
|
56
|
+
* @throws {UnableToReleaseLockError} {@link UnableToReleaseLockError}
|
|
57
|
+
* @throws {KeyAlreadyAcquiredLockError} {@link KeyAlreadyAcquiredLockError}
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import { type ILock, TimeSpan } from "@daiso-tech/core";
|
|
61
|
+
*
|
|
62
|
+
* // The function will execute sequentially when called concurrently as long you use the same lock.
|
|
63
|
+
* async function main(lock: ILock): Promise<void> {
|
|
64
|
+
* await lock.runOrFail(async () => {
|
|
65
|
+
* console.log("1.");
|
|
66
|
+
* await delay(TimeSpan.fromMilliseconds(1));
|
|
67
|
+
* console.log("2.");
|
|
68
|
+
* });
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
* You can also pass in a <i>{@link LazyPromise}</i>.
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* import { type ILock, TimeSpan } from "@daiso-tech/core";
|
|
75
|
+
*
|
|
76
|
+
* function fn(): LazyPromise<void> {
|
|
77
|
+
* return new LazyPromise(async () => {
|
|
78
|
+
* console.log("1.");
|
|
79
|
+
* await delay(TimeSpan.fromMilliseconds(1));
|
|
80
|
+
* console.log("2.");
|
|
81
|
+
* });
|
|
82
|
+
* }
|
|
83
|
+
*
|
|
84
|
+
* // The function will execute sequentially when called concurrently as long you use the same lock.
|
|
85
|
+
* async function main(lock: ILock): Promise<void> {
|
|
86
|
+
* await lock.runOrFail(fn());
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
runOrFail<TValue = void>(asyncFn: LazyPromiseable<TValue>): LazyPromise<TValue>;
|
|
91
|
+
/**
|
|
92
|
+
* The <i>acquire</i> method acquires a lock only if the lock is not already acquired.
|
|
93
|
+
* Throws an error if a different owner attempts to release the lock.
|
|
94
|
+
* Returns true if the lock is acquired otherwise true is returned.
|
|
95
|
+
* @throws {UnableToAquireLockError} {@link UnableToAquireLockError}
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { type ILock, TimeSpan } from "@daiso-tech/core";
|
|
99
|
+
*
|
|
100
|
+
* // The function will execute sequentially when called concurrently as long you use the same lock.
|
|
101
|
+
* async function main(lock: ILock): Promise<void> {
|
|
102
|
+
* try {
|
|
103
|
+
* await lock.acquire();
|
|
104
|
+
* console.log("1.");
|
|
105
|
+
* await delay(TimeSpan.fromMilliseconds(1));
|
|
106
|
+
* console.log("2.");
|
|
107
|
+
* }
|
|
108
|
+
* finally {
|
|
109
|
+
* await lock.release();
|
|
110
|
+
* }
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
acquire(): LazyPromise<boolean>;
|
|
115
|
+
/**
|
|
116
|
+
* The <i>acquireOrFail</i> method acquires a lock only if the lock is not already acquired.
|
|
117
|
+
* Throws an error if already acquired.
|
|
118
|
+
* @throws {UnableToAquireLockError} {@link UnableToAquireLockError}
|
|
119
|
+
* @throws {KeyAlreadyAcquiredLockError} {@link KeyAlreadyAcquiredLockError}
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* import type { ILock, TimeSpan } from "@daiso-tech/core";
|
|
123
|
+
*
|
|
124
|
+
* // The function will execute sequentially when called concurrently as long you use the same lock.
|
|
125
|
+
* async function main(lock: ILock): Promise<void> {
|
|
126
|
+
* try {
|
|
127
|
+
* await lock.acquireOrFail();
|
|
128
|
+
* console.log("1.");
|
|
129
|
+
* await delay(TimeSpan.fromMilliseconds(1));
|
|
130
|
+
* console.log("2.");
|
|
131
|
+
* }
|
|
132
|
+
* finally {
|
|
133
|
+
* await lock.releaseOrFail();
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
acquireOrFail(): LazyPromise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* The <i>release</i> method releases a lock if owned by the same owner.
|
|
141
|
+
* Returns true if the lock is released otherwise false is returned.
|
|
142
|
+
* @throws {UnableToReleaseLockError} {@link UnableToReleaseLockError}
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* import type { ILock, TimeSpan } from "@daiso-tech/core";
|
|
146
|
+
*
|
|
147
|
+
* // The function will execute sequentially when called concurrently as long you use the same lock.
|
|
148
|
+
* async function main(lock: ILock): Promise<void> {
|
|
149
|
+
* try {
|
|
150
|
+
* await lock.acquire();
|
|
151
|
+
* console.log("1.");
|
|
152
|
+
* await delay(TimeSpan.fromMilliseconds(1));
|
|
153
|
+
* console.log("2.");
|
|
154
|
+
* }
|
|
155
|
+
* finally {
|
|
156
|
+
* await lock.release();
|
|
157
|
+
* }
|
|
158
|
+
* }
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
release(): LazyPromise<boolean>;
|
|
162
|
+
/**
|
|
163
|
+
* The <i>releaseOrFail</i> method releases a lock if owned by the same owner.
|
|
164
|
+
* Throws an error if a different owner attempts to release the lock.
|
|
165
|
+
* @throws {UnableToReleaseLockError} {@link UnableToReleaseLockError}
|
|
166
|
+
* @throws {UnownedReleaseLockError} {@link UnownedReleaseLockError}
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* import type { ILock, TimeSpan } from "@daiso-tech/core";
|
|
170
|
+
*
|
|
171
|
+
* // The function will execute sequentially when called concurrently as long you use the same lock.
|
|
172
|
+
* async function main(lock: ILock): Promise<void> {
|
|
173
|
+
* try {
|
|
174
|
+
* await lock.acquireOrFail();
|
|
175
|
+
* console.log("1.");
|
|
176
|
+
* await delay(TimeSpan.fromMilliseconds(1));
|
|
177
|
+
* console.log("2.");
|
|
178
|
+
* }
|
|
179
|
+
* finally {
|
|
180
|
+
* await lock.releaseOrFail();
|
|
181
|
+
* }
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
releaseOrFail(): LazyPromise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* The <i>forceRelease</i> method releases a lock regardless of the owner.
|
|
188
|
+
* @throws {UnableToReleaseLockError} {@link UnableToReleaseLockError}
|
|
189
|
+
*/
|
|
190
|
+
forceRelease(): LazyPromise<void>;
|
|
191
|
+
/**
|
|
192
|
+
* The <i>isExpired</i> method returns true if the expired otherwise false is returned.
|
|
193
|
+
*/
|
|
194
|
+
isExpired(): LazyPromise<boolean>;
|
|
195
|
+
/**
|
|
196
|
+
* The <i>isLocked</i> method returns true if the locked otherwise false is returned.
|
|
197
|
+
*/
|
|
198
|
+
isLocked(): LazyPromise<boolean>;
|
|
199
|
+
/**
|
|
200
|
+
* The <i>refresh</i> method updates the TTL of the lock if owned by the same owner.
|
|
201
|
+
* Returns true if the lock is refreshed occurs otherwise false is returned.
|
|
202
|
+
*/
|
|
203
|
+
refresh(ttl?: TimeSpan): LazyPromise<boolean>;
|
|
204
|
+
/**
|
|
205
|
+
* The <i>refreshOrFail</i> method updates the TTL of the lock if owned by the same owner.
|
|
206
|
+
* Throws an error if a different owner attempts to refresh the lock.
|
|
207
|
+
* @throws {UnownedExtendLockError} {@link UnownedExtendLockError}
|
|
208
|
+
*/
|
|
209
|
+
refreshOrFail(ttl?: TimeSpan): LazyPromise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* The <i>getRemainingTime</i> return the reaming time as <i>{@link TimeSpan}</i>.
|
|
212
|
+
* Returns null if the key doesnt exist, key has no expiration and key has expired.
|
|
213
|
+
*/
|
|
214
|
+
getRemainingTime(): LazyPromise<TimeSpan | null>;
|
|
215
|
+
/**
|
|
216
|
+
* The <i>getOwner</i> method return the current owner.
|
|
217
|
+
*/
|
|
218
|
+
getOwner(): LazyPromise<string>;
|
|
219
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { ISerializedError, OneOrMore } from "../../utilities/_module";
|
|
5
|
+
import type { IFlexibleSerde, ISerializable } from "../../serde/contracts/_module";
|
|
6
|
+
/**
|
|
7
|
+
* @group Errors
|
|
8
|
+
*/
|
|
9
|
+
export declare class LockError extends Error implements ISerializable<ISerializedError> {
|
|
10
|
+
static deserialize(serializedError: ISerializedError): LockError;
|
|
11
|
+
constructor(message: string, cause?: unknown);
|
|
12
|
+
serialize(): ISerializedError;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @group Errors
|
|
16
|
+
*/
|
|
17
|
+
export declare class UnexpectedLockError extends LockError implements ISerializable<ISerializedError> {
|
|
18
|
+
static deserialize(serializedError: ISerializedError): UnexpectedLockError;
|
|
19
|
+
constructor(message: string, cause?: unknown);
|
|
20
|
+
serialize(): ISerializedError;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @group Errors
|
|
24
|
+
*/
|
|
25
|
+
export declare class UnableToAquireLockError extends UnexpectedLockError implements ISerializable<ISerializedError> {
|
|
26
|
+
static deserialize(serializedError: ISerializedError): UnableToAquireLockError;
|
|
27
|
+
constructor(message: string, cause?: unknown);
|
|
28
|
+
serialize(): ISerializedError;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @group Errors
|
|
32
|
+
*/
|
|
33
|
+
export declare class UnableToReleaseLockError extends UnexpectedLockError implements ISerializable<ISerializedError> {
|
|
34
|
+
static deserialize(serializedError: ISerializedError): UnableToReleaseLockError;
|
|
35
|
+
constructor(message: string, cause?: unknown);
|
|
36
|
+
serialize(): ISerializedError;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @group Errors
|
|
40
|
+
*/
|
|
41
|
+
export declare class KeyAlreadyAcquiredLockError extends LockError implements ISerializable<ISerializedError> {
|
|
42
|
+
static deserialize(serializedError: ISerializedError): KeyAlreadyAcquiredLockError;
|
|
43
|
+
constructor(message: string, cause?: unknown);
|
|
44
|
+
serialize(): ISerializedError;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @group Errors
|
|
48
|
+
*/
|
|
49
|
+
export declare class UnownedReleaseLockError extends LockError implements ISerializable<ISerializedError> {
|
|
50
|
+
static deserialize(serializedError: ISerializedError): UnownedReleaseLockError;
|
|
51
|
+
constructor(message: string, cause?: unknown);
|
|
52
|
+
serialize(): ISerializedError;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @group Errors
|
|
56
|
+
*/
|
|
57
|
+
export declare class UnownedExtendLockError extends LockError implements ISerializable<ISerializedError> {
|
|
58
|
+
static deserialize(serializedError: ISerializedError): UnownedExtendLockError;
|
|
59
|
+
constructor(message: string, cause?: unknown);
|
|
60
|
+
serialize(): ISerializedError;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The <i>registerLockErrorsToSerde</i> function registers all <i>{@link ILock}</i> related errors with <i>IFlexibleSerde</i>, ensuring they will properly be serialized and deserialized.
|
|
64
|
+
* @group Errors
|
|
65
|
+
*/
|
|
66
|
+
export declare function registerLockErrorsToSerde(serde: OneOrMore<IFlexibleSerde>): void;
|