@daiso-tech/core 0.21.1 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +114 -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 +124 -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
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import { BaseEvent } from "../../event-bus/contracts/_module";
|
|
5
|
+
import type { IFlexibleSerde } from "../../serde/contracts/_module";
|
|
6
|
+
import type { OneOrMore } from "../../utilities/types";
|
|
7
|
+
import type { TimeSpan } from "../../utilities/_module";
|
|
8
|
+
/**
|
|
9
|
+
* @group Events
|
|
10
|
+
*/
|
|
11
|
+
export declare class KeyAcquiredLockEvent extends BaseEvent<{
|
|
12
|
+
key: string;
|
|
13
|
+
owner: string;
|
|
14
|
+
ttl: TimeSpan | null;
|
|
15
|
+
}> {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @group Events
|
|
19
|
+
*/
|
|
20
|
+
export declare class KeyReleasedLockEvent extends BaseEvent<{
|
|
21
|
+
key: string;
|
|
22
|
+
owner: string;
|
|
23
|
+
}> {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @group Events
|
|
27
|
+
*/
|
|
28
|
+
export declare class KeyForceReleasedLockEvent extends BaseEvent<{
|
|
29
|
+
key: string;
|
|
30
|
+
}> {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @group Events
|
|
34
|
+
*/
|
|
35
|
+
export declare class UnownedReleaseLockEvent extends BaseEvent<{
|
|
36
|
+
key: string;
|
|
37
|
+
owner: string;
|
|
38
|
+
}> {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @group Events
|
|
42
|
+
*/
|
|
43
|
+
export declare class UnownedRefreshLockEvent extends BaseEvent<{
|
|
44
|
+
key: string;
|
|
45
|
+
owner: string;
|
|
46
|
+
}> {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @group Events
|
|
50
|
+
*/
|
|
51
|
+
export declare class KeyAlreadyAcquiredLockEvent extends BaseEvent<{
|
|
52
|
+
key: string;
|
|
53
|
+
owner: string;
|
|
54
|
+
}> {
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @group Events
|
|
58
|
+
*/
|
|
59
|
+
export declare class KeyRefreshedLockEvent extends BaseEvent<{
|
|
60
|
+
key: string;
|
|
61
|
+
owner: string;
|
|
62
|
+
ttl: TimeSpan;
|
|
63
|
+
}> {
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @group Events
|
|
67
|
+
*/
|
|
68
|
+
export declare class UnexpectedErrorLockEvent extends BaseEvent<{
|
|
69
|
+
key: string;
|
|
70
|
+
owner: string;
|
|
71
|
+
ttl: TimeSpan | null;
|
|
72
|
+
error: unknown;
|
|
73
|
+
}> {
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @group Events
|
|
77
|
+
*/
|
|
78
|
+
export type LockEvents = KeyAcquiredLockEvent | KeyReleasedLockEvent | UnownedReleaseLockEvent | UnownedRefreshLockEvent | KeyAlreadyAcquiredLockEvent | KeyForceReleasedLockEvent | KeyRefreshedLockEvent | UnexpectedErrorLockEvent;
|
|
79
|
+
/**
|
|
80
|
+
* 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.
|
|
81
|
+
* @group Events
|
|
82
|
+
*/
|
|
83
|
+
export declare function registerLockEventsToSerde(serde: OneOrMore<IFlexibleSerde>): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
|
+
import { type IDatabaseLockAdapter } from "../../../lock/contracts/_module";
|
|
6
|
+
import { type Promisable } from "../../../utilities/_module";
|
|
7
|
+
/**
|
|
8
|
+
* @group Utilities
|
|
9
|
+
*/
|
|
10
|
+
export type DatabaseLockAdapterTestSuiteSettings = {
|
|
11
|
+
expect: ExpectStatic;
|
|
12
|
+
test: TestAPI;
|
|
13
|
+
describe: SuiteAPI;
|
|
14
|
+
beforeEach: typeof beforeEach;
|
|
15
|
+
createAdapter: () => Promisable<IDatabaseLockAdapter>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The <i>databaseLockAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link IDatabaseLockAdapter}</i> with <i>vitest</i>.
|
|
19
|
+
* @group Utilities
|
|
20
|
+
*/
|
|
21
|
+
export declare function databaseLockAdapterTestSuite(settings: DatabaseLockAdapterTestSuiteSettings): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
|
+
import { type ILockAdapter } from "../../../lock/contracts/_module";
|
|
6
|
+
import { type Promisable } from "../../../utilities/_module";
|
|
7
|
+
/**
|
|
8
|
+
* @group Utilities
|
|
9
|
+
*/
|
|
10
|
+
export type LockAdapterTestSuiteSettings = {
|
|
11
|
+
expect: ExpectStatic;
|
|
12
|
+
test: TestAPI;
|
|
13
|
+
describe: SuiteAPI;
|
|
14
|
+
beforeEach: typeof beforeEach;
|
|
15
|
+
createAdapter: () => Promisable<ILockAdapter>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The <i>lockAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ILockAdapter}</i> with <i>vitest</i>.
|
|
19
|
+
* @group Utilities
|
|
20
|
+
*/
|
|
21
|
+
export declare function lockAdapterTestSuite(settings: LockAdapterTestSuiteSettings): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
|
+
import type { IGroupableLockProvider } from "../../../lock/contracts/_module";
|
|
6
|
+
import { type Promisable } from "../../../utilities/_module";
|
|
7
|
+
import type { ISerde } from "../../../serde/contracts/_module";
|
|
8
|
+
/**
|
|
9
|
+
* @group Utilities
|
|
10
|
+
*/
|
|
11
|
+
export type LockProviderTestSuiteSettings = {
|
|
12
|
+
expect: ExpectStatic;
|
|
13
|
+
test: TestAPI;
|
|
14
|
+
describe: SuiteAPI;
|
|
15
|
+
beforeEach: typeof beforeEach;
|
|
16
|
+
createLockProvider: () => Promisable<IGroupableLockProvider>;
|
|
17
|
+
serde?: ISerde;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The <i>lockProviderTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ILock}</i> with <i>vitest</i>.
|
|
21
|
+
* @group Utilities
|
|
22
|
+
*/
|
|
23
|
+
export declare function lockProviderTestSuite(settings: LockProviderTestSuiteSettings): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from "../../../lock/implementations/adapters/libsql-lock-adapter/_module";
|
|
2
|
+
export * from "../../../lock/implementations/adapters/memory-lock-adapter/_module";
|
|
3
|
+
export * from "../../../lock/implementations/adapters/mongodb-lock-adapter/_module";
|
|
4
|
+
export * from "../../../lock/implementations/adapters/redis-lock-adapter/_module";
|
|
5
|
+
export * from "../../../lock/implementations/adapters/sqlite-lock-adapter/_module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { IDatabaseLockAdapter, ILockData } from "../../../../lock/contracts/_module";
|
|
5
|
+
import type { Kysely } from "kysely";
|
|
6
|
+
import { TimeSpan } from "../../../../utilities/_module";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
type KyselyLockTable = {
|
|
11
|
+
group: string;
|
|
12
|
+
key: string;
|
|
13
|
+
owner: string;
|
|
14
|
+
expiresAt: number | null;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
type KyselyTables = {
|
|
20
|
+
lock: KyselyLockTable;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
type KyselySettings = {
|
|
26
|
+
database: Kysely<KyselyTables>;
|
|
27
|
+
rootGroup: string;
|
|
28
|
+
expiredKeysRemovalInterval?: TimeSpan;
|
|
29
|
+
shouldRemoveExpiredKeys?: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export declare class KyselyLockAdapter implements IDatabaseLockAdapter {
|
|
35
|
+
private readonly group;
|
|
36
|
+
private readonly database;
|
|
37
|
+
private readonly expiredKeysRemovalInterval;
|
|
38
|
+
private readonly shouldRemoveExpiredKeys;
|
|
39
|
+
private timeoutId;
|
|
40
|
+
constructor(settings: KyselySettings);
|
|
41
|
+
deInit(): Promise<void>;
|
|
42
|
+
init(): Promise<void>;
|
|
43
|
+
removeExpiredKeys(): Promise<void>;
|
|
44
|
+
insert(key: string, owner: string, expiration: Date | null): Promise<void>;
|
|
45
|
+
update(key: string, owner: string, expiration: Date | null): Promise<number>;
|
|
46
|
+
remove(key: string, owner: string | null): Promise<void>;
|
|
47
|
+
refresh(key: string, owner: string, expiration: Date): Promise<number>;
|
|
48
|
+
find(key: string): Promise<ILockData | null>;
|
|
49
|
+
getGroup(): string;
|
|
50
|
+
withGroup(group: string): IDatabaseLockAdapter;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { IDatabaseLockAdapter, ILockData } from "../../../../lock/contracts/_module";
|
|
5
|
+
import { TimeSpan } from "../../../../utilities/_module";
|
|
6
|
+
import type { Client } from "@libsql/client/.";
|
|
7
|
+
/**
|
|
8
|
+
* @group Adapters
|
|
9
|
+
*/
|
|
10
|
+
export type LibsqlLockAdapterSettings = {
|
|
11
|
+
database: Client;
|
|
12
|
+
tableName?: string;
|
|
13
|
+
expiredKeysRemovalInterval?: TimeSpan;
|
|
14
|
+
shouldRemoveExpiredKeys?: boolean;
|
|
15
|
+
rootGroup: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* To utilize the <i>LibsqlLockAdapter</i>, you must install the <i>"@libsql/client"</i> package.
|
|
19
|
+
* @group Adapters
|
|
20
|
+
*/
|
|
21
|
+
export declare class LibsqlLockAdapter implements IDatabaseLockAdapter {
|
|
22
|
+
private databaseLockAdapter;
|
|
23
|
+
/***
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { LibsqlCacheAdapter } from "@daiso-tech/core";
|
|
27
|
+
* import { createClient } from "@libsql/client";
|
|
28
|
+
*
|
|
29
|
+
* (async () => {
|
|
30
|
+
* const database = createClient({ url: "file:local.db" });
|
|
31
|
+
* const lockAdapter = new LibsqlCacheAdapter({
|
|
32
|
+
* database,
|
|
33
|
+
* rootGroup: "@global"
|
|
34
|
+
* });
|
|
35
|
+
* await lockAdapter.init();
|
|
36
|
+
* })();
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
constructor(settings: LibsqlLockAdapterSettings);
|
|
40
|
+
removeExpiredKeys(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Removes the table where the cache values are stored and removes the table indexes.
|
|
43
|
+
* Note all cache data will be removed.
|
|
44
|
+
*/
|
|
45
|
+
deInit(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates the table where the cache values are stored and it's related indexes.
|
|
48
|
+
* Note the <i>init</i> method needs to be called before using the adapter.
|
|
49
|
+
*/
|
|
50
|
+
init(): Promise<void>;
|
|
51
|
+
insert(key: string, owner: string, expiration: Date | null): Promise<void>;
|
|
52
|
+
update(key: string, owner: string, expiration: Date | null): Promise<number>;
|
|
53
|
+
remove(key: string, owner: string | null): Promise<void>;
|
|
54
|
+
refresh(key: string, owner: string, expiration: Date): Promise<number>;
|
|
55
|
+
find(key: string): Promise<ILockData | null>;
|
|
56
|
+
getGroup(): string;
|
|
57
|
+
withGroup(group: string): IDatabaseLockAdapter;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import { TimeSpan } from "../../../../utilities/_module";
|
|
5
|
+
import type { ILockAdapter, ILockData } from "../../../../lock/contracts/_module";
|
|
6
|
+
/**
|
|
7
|
+
* @group Adapters
|
|
8
|
+
*/
|
|
9
|
+
export type MemoryLockAdapterSettings = {
|
|
10
|
+
rootGroup: string;
|
|
11
|
+
map?: Map<string, ILockData>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @group Adapters
|
|
15
|
+
*/
|
|
16
|
+
export declare class MemoryLockAdapter implements ILockAdapter {
|
|
17
|
+
private readonly group;
|
|
18
|
+
private readonly timeoutMap;
|
|
19
|
+
private readonly map;
|
|
20
|
+
/**
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { MemoryLockAdapter } from "@daiso-tech/core";
|
|
24
|
+
*
|
|
25
|
+
* const lockAdapter = new MemoryLockAdapter({
|
|
26
|
+
* rootGroup: "@cache"
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
* You can also provide an <i>Map</i>.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { MemoryLockAdapter } from "@daiso-tech/core";
|
|
33
|
+
*
|
|
34
|
+
* const map = new Map<any, any>();
|
|
35
|
+
* const lockAdapter = new MemoryLockAdapter({
|
|
36
|
+
* rootGroup: "@cache",
|
|
37
|
+
* map
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
constructor(settings: MemoryLockAdapterSettings);
|
|
42
|
+
private getPrefix;
|
|
43
|
+
private withPrefix;
|
|
44
|
+
acquire(key: string, owner: string, ttl: TimeSpan | null): Promise<boolean>;
|
|
45
|
+
release(key: string, owner: string): Promise<boolean>;
|
|
46
|
+
forceRelease(key: string): Promise<void>;
|
|
47
|
+
isLocked(key: string): Promise<boolean>;
|
|
48
|
+
getRemainingTime(key: string): Promise<TimeSpan | null>;
|
|
49
|
+
refresh(key: string, owner: string, time: TimeSpan): Promise<boolean>;
|
|
50
|
+
getGroup(): string;
|
|
51
|
+
withGroup(group: string): ILockAdapter;
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter";
|
package/dist/types/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { IDatabaseLockAdapter, ILockData } from "../../../../lock/contracts/_module";
|
|
5
|
+
import type { CollectionOptions, Db } from "mongodb";
|
|
6
|
+
/**
|
|
7
|
+
* @group Adapters
|
|
8
|
+
*/
|
|
9
|
+
export type MongodbLockAdapterSettings = {
|
|
10
|
+
database: Db;
|
|
11
|
+
rootGroup: string;
|
|
12
|
+
collectionName?: string;
|
|
13
|
+
collectionSettings?: CollectionOptions;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @group Adapters
|
|
17
|
+
*/
|
|
18
|
+
export declare class MongodbLockAdapter implements IDatabaseLockAdapter {
|
|
19
|
+
private readonly group;
|
|
20
|
+
private readonly database;
|
|
21
|
+
private readonly collection;
|
|
22
|
+
private readonly collectionName;
|
|
23
|
+
private readonly collectionSettings?;
|
|
24
|
+
/**
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { MongodbLockAdapter } from "@daiso-tech/core";
|
|
28
|
+
* import { MongoClient } from "mongodb";
|
|
29
|
+
*
|
|
30
|
+
* (async () => {
|
|
31
|
+
* const client = await MongoClient.connect("YOUR_MONGODB_CONNECTION_STRING");
|
|
32
|
+
* const database = client.db("database");
|
|
33
|
+
* const lockAdapter = new MongodbLockAdapter({
|
|
34
|
+
* database,
|
|
35
|
+
* rootGroup: "@global"
|
|
36
|
+
* });
|
|
37
|
+
* await lockAdapter.init();
|
|
38
|
+
* })();
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
constructor({ collectionName, collectionSettings, database, rootGroup, }: MongodbLockAdapterSettings);
|
|
42
|
+
removeExpiredKeys(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Creates all related indexes.
|
|
45
|
+
* Note the <i>init</i> method needs to be called before using the adapter.
|
|
46
|
+
*/
|
|
47
|
+
init(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Removes the collection where the cache values are stored and all it's related indexes.
|
|
50
|
+
* Note all cache data will be removed.
|
|
51
|
+
*/
|
|
52
|
+
deInit(): Promise<void>;
|
|
53
|
+
insert(key: string, owner: string, expiration: Date | null): Promise<void>;
|
|
54
|
+
update(key: string, owner: string, expiration: Date | null): Promise<number>;
|
|
55
|
+
remove(key: string, owner: string | null): Promise<void>;
|
|
56
|
+
refresh(key: string, owner: string, expiration: Date): Promise<number>;
|
|
57
|
+
find(key: string): Promise<ILockData | null>;
|
|
58
|
+
getGroup(): string;
|
|
59
|
+
withGroup(group: string): IDatabaseLockAdapter;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import { TimeSpan } from "../../../../utilities/_module";
|
|
5
|
+
import type { ILockAdapter } from "../../../../lock/contracts/_module";
|
|
6
|
+
import type Redis from "ioredis";
|
|
7
|
+
import type { Result } from "ioredis";
|
|
8
|
+
declare module "ioredis" {
|
|
9
|
+
interface RedisCommander<Context> {
|
|
10
|
+
daiso_lock_acquire(key: string, owner: string, ttl: string): Result<number, Context>;
|
|
11
|
+
daiso_lock_release(key: string, owner: string): Result<number, Context>;
|
|
12
|
+
daiso_lock_refresh(key: string, owner: string, ttl: string): Result<number, Context>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @group Adapters
|
|
17
|
+
*/
|
|
18
|
+
export type RedisLockAdapterSettings = {
|
|
19
|
+
database: Redis;
|
|
20
|
+
rootGroup: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @group Adapters
|
|
24
|
+
*/
|
|
25
|
+
export declare class RedisLockAdapter implements ILockAdapter {
|
|
26
|
+
private readonly group;
|
|
27
|
+
private readonly database;
|
|
28
|
+
/**
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { RedisLockAdapter, SuperJsonSerde } from "@daiso-tech/core";
|
|
32
|
+
* import Redis from "ioredis";
|
|
33
|
+
*
|
|
34
|
+
* const database = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
35
|
+
* const serde = new SuperJsonSerde();
|
|
36
|
+
* const lockAdapter = new RedisLockAdapter({
|
|
37
|
+
* database,
|
|
38
|
+
* serde,
|
|
39
|
+
* rootGroup: "@global"
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
constructor(settings: RedisLockAdapterSettings);
|
|
44
|
+
private initAquireCommand;
|
|
45
|
+
private initReleaseCommand;
|
|
46
|
+
private initRefreshComand;
|
|
47
|
+
private getPrefix;
|
|
48
|
+
private withPrefix;
|
|
49
|
+
acquire(key: string, owner: string, ttl: TimeSpan | null): Promise<boolean>;
|
|
50
|
+
release(key: string, owner: string): Promise<boolean>;
|
|
51
|
+
forceRelease(key: string): Promise<void>;
|
|
52
|
+
isLocked(key: string): Promise<boolean>;
|
|
53
|
+
getRemainingTime(key: string): Promise<TimeSpan | null>;
|
|
54
|
+
refresh(key: string, owner: string, ttl: TimeSpan): Promise<boolean>;
|
|
55
|
+
getGroup(): string;
|
|
56
|
+
withGroup(group: string): ILockAdapter;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { IDatabaseLockAdapter, ILockData } from "../../../../lock/contracts/_module";
|
|
5
|
+
import { TimeSpan } from "../../../../utilities/_module";
|
|
6
|
+
import type { SqliteDatabase } from "kysely";
|
|
7
|
+
/**
|
|
8
|
+
* @group Adapters
|
|
9
|
+
*/
|
|
10
|
+
export type SqliteLockAdapterSettings = {
|
|
11
|
+
database: SqliteDatabase;
|
|
12
|
+
tableName?: string;
|
|
13
|
+
expiredKeysRemovalInterval?: TimeSpan;
|
|
14
|
+
shouldRemoveExpiredKeys?: boolean;
|
|
15
|
+
rootGroup: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @group Adapters
|
|
19
|
+
*/
|
|
20
|
+
export declare class SqliteLockAdapter implements IDatabaseLockAdapter {
|
|
21
|
+
private databaseLockAdapter;
|
|
22
|
+
/**
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { SqliteLockAdapter } from "@daiso-tech/core";
|
|
26
|
+
* import Sqlite from "better-sqlite3";
|
|
27
|
+
*
|
|
28
|
+
* (async () => {
|
|
29
|
+
* const database = new Sqlite("local.db");
|
|
30
|
+
* const lockAdapter = new SqliteLockAdapter({
|
|
31
|
+
* database,
|
|
32
|
+
* rootGroup: "@global"
|
|
33
|
+
* });
|
|
34
|
+
* await lockAdapter.init();
|
|
35
|
+
* })();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
constructor(settings: SqliteLockAdapterSettings);
|
|
39
|
+
removeExpiredKeys(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Removes the table where the cache values are stored and removes the table indexes.
|
|
42
|
+
* Note all cache data will be removed.
|
|
43
|
+
*/
|
|
44
|
+
deInit(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Creates the table where the cache values are stored and it's related indexes.
|
|
47
|
+
* Note the <i>init</i> method needs to be called before using the adapter.
|
|
48
|
+
*/
|
|
49
|
+
init(): Promise<void>;
|
|
50
|
+
insert(key: string, owner: string, expiration: Date | null): Promise<void>;
|
|
51
|
+
update(key: string, owner: string, expiration: Date | null): Promise<number>;
|
|
52
|
+
remove(key: string, owner: string | null): Promise<void>;
|
|
53
|
+
refresh(key: string, owner: string, expiration: Date): Promise<number>;
|
|
54
|
+
find(key: string): Promise<ILockData | null>;
|
|
55
|
+
getGroup(): string;
|
|
56
|
+
withGroup(group: string): IDatabaseLockAdapter;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../lock/implementations/derivables/lock-provider/lock-provider";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Lock
|
|
3
|
+
*/
|
|
4
|
+
import type { IDeinitizable, IInitizable } from "../../../../_module";
|
|
5
|
+
import { TimeSpan } from "../../../../_module";
|
|
6
|
+
import type { IDatabaseLockAdapter, ILockAdapter } from "../../../../lock/contracts/_module";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare class DatabaseLockAdapter implements ILockAdapter, IDeinitizable, IInitizable {
|
|
11
|
+
private readonly adapter;
|
|
12
|
+
constructor(adapter: IDatabaseLockAdapter);
|
|
13
|
+
init(): Promise<void>;
|
|
14
|
+
deInit(): Promise<void>;
|
|
15
|
+
acquire(key: string, owner: string, ttl: TimeSpan | null): Promise<boolean>;
|
|
16
|
+
release(key: string, owner: string): Promise<boolean>;
|
|
17
|
+
forceRelease(key: string): Promise<void>;
|
|
18
|
+
isLocked(key: string): Promise<boolean>;
|
|
19
|
+
getRemainingTime(key: string): Promise<TimeSpan | null>;
|
|
20
|
+
refresh(key: string, owner: string, ttl: TimeSpan): Promise<boolean>;
|
|
21
|
+
getGroup(): string;
|
|
22
|
+
withGroup(group: string): ILockAdapter;
|
|
23
|
+
}
|