@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
|
@@ -8,7 +8,7 @@ import type { CacheEvents } from "../../cache/contracts/_module";
|
|
|
8
8
|
import type { TimeSpan } from "../../utilities/_module";
|
|
9
9
|
import type { LazyPromise } from "../../async/_module";
|
|
10
10
|
/**
|
|
11
|
-
* The <i>ICacheListener</i> contract defines a way for listening <i>{@link ICache}</i>
|
|
11
|
+
* The <i>ICacheListener</i> contract defines a way for listening <i>{@link ICache}</i> operations.
|
|
12
12
|
* @group Contracts
|
|
13
13
|
*/
|
|
14
14
|
export type ICacheListener<TType = unknown> = IEventListener<CacheEvents<TType>>;
|
|
@@ -124,6 +124,43 @@ export type ICache<TType = unknown> = ICacheListener & {
|
|
|
124
124
|
* // -1
|
|
125
125
|
* }
|
|
126
126
|
* ```
|
|
127
|
+
* You can pass a function as default value.
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* import type { ICache } from "@daiso-tech/core";
|
|
131
|
+
*
|
|
132
|
+
* // Asume the inputed cache is empty
|
|
133
|
+
* async function main(cache: ICache): Promise<void> {
|
|
134
|
+
* await cache.getOr("a", () => -1);
|
|
135
|
+
* // -1
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
* You can pass an async function as default value.
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* import type { ICache } from "@daiso-tech/core";
|
|
142
|
+
*
|
|
143
|
+
* // Asume the inputed cache is empty
|
|
144
|
+
* async function main(cache: ICache): Promise<void> {
|
|
145
|
+
* await cache.getOr("a", async () => -1);
|
|
146
|
+
* // -1
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
* You can pass an <i>{@link LazyPromise}</i> as default value.
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* import type { ICache, IAsyncCollection } from "@daiso-tech/core";
|
|
153
|
+
*
|
|
154
|
+
* type IPerson = {
|
|
155
|
+
* name: string;
|
|
156
|
+
* age: number;
|
|
157
|
+
* };
|
|
158
|
+
*
|
|
159
|
+
* // Asume the inputed cache is empty
|
|
160
|
+
* async function main(cache: ICache, collection: IAsyncCollection<IPerson>): Promise<void> {
|
|
161
|
+
* await cache.getOr("a", collection.first(person => person.name === "a"));
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
127
164
|
*/
|
|
128
165
|
getOr(key: string, defaultValue: AsyncLazyable<TType>): LazyPromise<TType>;
|
|
129
166
|
/**
|
|
@@ -138,6 +175,43 @@ export type ICache<TType = unknown> = ICacheListener & {
|
|
|
138
175
|
* // { a: -1, b: -2, c: -3 }
|
|
139
176
|
* }
|
|
140
177
|
* ```
|
|
178
|
+
* You can pass a function as default value.
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* import type { ICache } from "@daiso-tech/core";
|
|
182
|
+
*
|
|
183
|
+
* // Asume the inputed cache is empty
|
|
184
|
+
* async function main(cache: ICache): Promise<void> {
|
|
185
|
+
* await cache.getOrMany({ a: () => -1 });
|
|
186
|
+
* // -1
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
* You can pass an async function as default value.
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* import type { ICache } from "@daiso-tech/core";
|
|
193
|
+
*
|
|
194
|
+
* // Asume the inputed cache is empty
|
|
195
|
+
* async function main(cache: ICache): Promise<void> {
|
|
196
|
+
* await cache.getOrMany({ a: async () => -1 });
|
|
197
|
+
* // -1
|
|
198
|
+
* }
|
|
199
|
+
* ```
|
|
200
|
+
* You can pass an <i>{@link LazyPromise}</i> as default value.
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* import type { ICache, IAsyncCollection } from "@daiso-tech/core";
|
|
204
|
+
*
|
|
205
|
+
* type IPerson = {
|
|
206
|
+
* name: string;
|
|
207
|
+
* age: number;
|
|
208
|
+
* };
|
|
209
|
+
*
|
|
210
|
+
* // Asume the inputed cache is empty
|
|
211
|
+
* async function main(cache: ICache, collection: IAsyncCollection<IPerson>): Promise<void> {
|
|
212
|
+
* await cache.getOrMany({ a: collection.first(person => person.name === "a") });
|
|
213
|
+
* }
|
|
214
|
+
* ```
|
|
141
215
|
*/
|
|
142
216
|
getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>): LazyPromise<Record<TKeys, TType>>;
|
|
143
217
|
/**
|
|
@@ -420,9 +494,43 @@ export type ICache<TType = unknown> = ICacheListener & {
|
|
|
420
494
|
* async function main(cache: ICache): Promise<void> {
|
|
421
495
|
* await cache.getOrAdd("a", 1);
|
|
422
496
|
* // 1
|
|
497
|
+
* }
|
|
498
|
+
* ```
|
|
499
|
+
* You can pass a function as default value.
|
|
500
|
+
* @example
|
|
501
|
+
* ```ts
|
|
502
|
+
* import type { ICache } from "@daiso-tech/core";
|
|
423
503
|
*
|
|
504
|
+
* // Asume the inputed cache is empty
|
|
505
|
+
* async function main(cache: ICache): Promise<void> {
|
|
506
|
+
* await cache.getOrAdd("a", () => -1);
|
|
507
|
+
* // -1
|
|
508
|
+
* }
|
|
509
|
+
* ```
|
|
510
|
+
* You can pass an async function as default value.
|
|
511
|
+
* @example
|
|
512
|
+
* ```ts
|
|
513
|
+
* import type { ICache } from "@daiso-tech/core";
|
|
514
|
+
*
|
|
515
|
+
* // Asume the inputed cache is empty
|
|
516
|
+
* async function main(cache: ICache): Promise<void> {
|
|
424
517
|
* await cache.getOrAdd("a", async () => -1);
|
|
425
|
-
* // 1
|
|
518
|
+
* // -1
|
|
519
|
+
* }
|
|
520
|
+
* ```
|
|
521
|
+
* You can pass an <i>{@link LazyPromise}</i> as default value.
|
|
522
|
+
* @example
|
|
523
|
+
* ```ts
|
|
524
|
+
* import type { ICache, IAsyncCollection } from "@daiso-tech/core";
|
|
525
|
+
*
|
|
526
|
+
* type IPerson = {
|
|
527
|
+
* name: string;
|
|
528
|
+
* age: number;
|
|
529
|
+
* };
|
|
530
|
+
*
|
|
531
|
+
* // Asume the inputed cache is empty
|
|
532
|
+
* async function main(cache: ICache, collection: IAsyncCollection<IPerson>): Promise<void> {
|
|
533
|
+
* await cache.getOrAdd("a", collection.first(person => person.name === "a"));
|
|
426
534
|
* }
|
|
427
535
|
* ```
|
|
428
536
|
*/
|
|
@@ -485,10 +593,10 @@ export type ICache<TType = unknown> = ICacheListener & {
|
|
|
485
593
|
* The <i>getGroup</i> method returns the group name.
|
|
486
594
|
* @example
|
|
487
595
|
* ```ts
|
|
488
|
-
* import type {
|
|
596
|
+
* import type { IGroupableCache } from "@daiso-tech/core";
|
|
489
597
|
*
|
|
490
598
|
* // Asume the inputed cache is empty and the default rootGroup is "@global"
|
|
491
|
-
* async function main(cache:
|
|
599
|
+
* async function main(cache: IGroupableCache): Promise<void> {
|
|
492
600
|
* console.log(cache.getGroup())
|
|
493
601
|
*
|
|
494
602
|
* const cacheA = cache.withGroup("a");
|
|
@@ -502,20 +610,20 @@ export type ICache<TType = unknown> = ICacheListener & {
|
|
|
502
610
|
};
|
|
503
611
|
/**
|
|
504
612
|
* The <i>IGroupableCache</i> contract defines a way for storing data as key-value pairs independent of data storage.
|
|
505
|
-
* It commes with one extra method which is useful for multitennat applications compared to <i>ICache</i>.
|
|
613
|
+
* It commes with one extra method which is useful for multitennat applications compared to <i>{@link ICache}</i>.
|
|
506
614
|
* @group Contracts
|
|
507
615
|
*/
|
|
508
616
|
export type IGroupableCache<TType = unknown> = ICache<TType> & {
|
|
509
617
|
/**
|
|
510
618
|
* The <i>withGroup</i> method returns a new <i>{@link ICache}</i> instance that groups keys together.
|
|
511
|
-
* Only keys in the group
|
|
619
|
+
* Only keys in the same group will be updated, removed, or retrieved, leaving keys outside the group unaffected.
|
|
512
620
|
* This useful for multitennat applications.
|
|
513
621
|
* @example
|
|
514
622
|
* ```ts
|
|
515
|
-
* import type {
|
|
623
|
+
* import type { IGroupableCache } from "@daiso-tech/core";
|
|
516
624
|
*
|
|
517
625
|
* // Asume the inputed cache is empty and the default rootGroup is "@global"
|
|
518
|
-
* async function main(cache:
|
|
626
|
+
* async function main(cache: IGroupableCache): Promise<void> {
|
|
519
627
|
* const cacheA = cache.withGroup("a");
|
|
520
628
|
* await cacheA.add("a", 1);
|
|
521
629
|
*
|
|
@@ -76,7 +76,18 @@ export declare class KeysClearedCacheEvent extends BaseEvent<{
|
|
|
76
76
|
/**
|
|
77
77
|
* @group Events
|
|
78
78
|
*/
|
|
79
|
-
export
|
|
79
|
+
export declare class UnexpectedCacheErrorEvent extends BaseEvent<{
|
|
80
|
+
group: string;
|
|
81
|
+
key?: string;
|
|
82
|
+
value?: unknown;
|
|
83
|
+
method: string;
|
|
84
|
+
error: unknown;
|
|
85
|
+
}> {
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @group Events
|
|
89
|
+
*/
|
|
90
|
+
export type CacheEvents<TType = unknown> = KeyFoundCacheEvent<TType> | KeyNotFoundCacheEvent | KeyAddedCacheEvent<TType> | KeyUpdatedCacheEvent<TType> | KeyRemovedCacheEvent | KeyIncrementedCacheEvent | KeyDecrementedCacheEvent | KeysClearedCacheEvent | UnexpectedCacheErrorEvent;
|
|
80
91
|
/**
|
|
81
92
|
* The <i>registerCacheEvents</i> function registers all <i>{@link IGroupableCache}</i> related events with <i>IFlexibleSerde</i>, ensuring they will properly be serialized and deserialized.
|
|
82
93
|
* @group Events
|
|
@@ -12,8 +12,7 @@ export type CacheAdapterTestSuiteSettings = {
|
|
|
12
12
|
test: TestAPI;
|
|
13
13
|
describe: SuiteAPI;
|
|
14
14
|
beforeEach: typeof beforeEach;
|
|
15
|
-
|
|
16
|
-
createAdapterB: () => Promisable<ICacheAdapter>;
|
|
15
|
+
createAdapter: () => Promisable<ICacheAdapter>;
|
|
17
16
|
};
|
|
18
17
|
/**
|
|
19
18
|
* The <i>cacheAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ICacheAdapter}</i> with <i>vitest</i>.
|
|
@@ -39,18 +38,12 @@ export type CacheAdapterTestSuiteSettings = {
|
|
|
39
38
|
* await startedContainer.stop();
|
|
40
39
|
* }, TIMEOUT.toMilliseconds());
|
|
41
40
|
* cacheAdapterTestSuite({
|
|
42
|
-
*
|
|
41
|
+
* createAdapter: () =>
|
|
43
42
|
* new RedisCacheAdapter({
|
|
44
43
|
* database,
|
|
45
44
|
* serde,
|
|
46
45
|
* rootGroup: "@a"
|
|
47
46
|
* }),
|
|
48
|
-
* createAdapterB: () =>
|
|
49
|
-
* new RedisCacheAdapter({
|
|
50
|
-
* database,
|
|
51
|
-
* serde,
|
|
52
|
-
* rootGroup: "@b"
|
|
53
|
-
* }),
|
|
54
47
|
* test,
|
|
55
48
|
* beforeEach,
|
|
56
49
|
* expect,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
4
|
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
|
-
import { type
|
|
5
|
+
import { type IGroupableCache } from "../../../cache/contracts/_module";
|
|
6
6
|
import { type Promisable } from "../../../utilities/_module";
|
|
7
7
|
/**
|
|
8
8
|
* @group Utilities
|
|
@@ -12,8 +12,7 @@ export type CacheTestSuiteSettings = {
|
|
|
12
12
|
test: TestAPI;
|
|
13
13
|
describe: SuiteAPI;
|
|
14
14
|
beforeEach: typeof beforeEach;
|
|
15
|
-
|
|
16
|
-
createCacheB: () => Promisable<ICache>;
|
|
15
|
+
createCache: () => Promisable<IGroupableCache>;
|
|
17
16
|
};
|
|
18
17
|
/**
|
|
19
18
|
* The <i>cacheTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ICache}</i> with <i>vitest</i>.
|
|
@@ -44,7 +43,7 @@ export type CacheTestSuiteSettings = {
|
|
|
44
43
|
* await startedContainer.stop();
|
|
45
44
|
* }, TIMEOUT.toMilliseconds());
|
|
46
45
|
* cacheTestSuite({
|
|
47
|
-
*
|
|
46
|
+
* createCache: () =>
|
|
48
47
|
* new Cache(
|
|
49
48
|
* new RedisCacheAdapter({
|
|
50
49
|
* database,
|
|
@@ -53,15 +52,6 @@ export type CacheTestSuiteSettings = {
|
|
|
53
52
|
* }),
|
|
54
53
|
* { eventBus }
|
|
55
54
|
* ),
|
|
56
|
-
* createCacheB: () =>
|
|
57
|
-
* new Cache(
|
|
58
|
-
* new RedisCacheAdapter({
|
|
59
|
-
* database,
|
|
60
|
-
* serde,
|
|
61
|
-
* rootGroup: "@b",
|
|
62
|
-
* }),
|
|
63
|
-
* { eventBus }
|
|
64
|
-
* ),
|
|
65
55
|
* test,
|
|
66
56
|
* beforeEach,
|
|
67
57
|
* expect,
|
package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts
CHANGED
|
@@ -3,30 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
5
5
|
import type { TimeSpan, IDeinitizable, IInitizable } from "../../../../utilities/_module";
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
6
|
+
import type { ISerde } from "../../../../serde/contracts/_module";
|
|
7
|
+
import type { Client } from "@libsql/client";
|
|
8
|
+
/**
|
|
9
|
+
* @group Adapters
|
|
10
|
+
*/
|
|
11
|
+
export type LibsqlCacheAdapterSettings = {
|
|
12
|
+
database: Client;
|
|
13
|
+
tableName?: string;
|
|
14
|
+
serde: ISerde<string>;
|
|
15
|
+
enableTransactions?: boolean;
|
|
16
|
+
expiredKeysRemovalInterval?: TimeSpan;
|
|
17
|
+
shouldRemoveExpiredKeys?: boolean;
|
|
18
|
+
rootGroup: string;
|
|
19
|
+
};
|
|
8
20
|
/**
|
|
9
21
|
* To utilize the <i>LibsqlCacheAdapter</i>, you must install the <i>"@libsql/client"</i> package and supply a <i>{@link ISerde | ISerde<string> }</i>, such as <i>{@link SuperJsonSerde}</i>.
|
|
10
22
|
* @group Adapters
|
|
11
23
|
*/
|
|
12
24
|
export declare class LibsqlCacheAdapter<TType = unknown> implements ICacheAdapter<TType>, IInitizable, IDeinitizable {
|
|
13
|
-
/**
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* import { LibsqlCacheAdapter, SuperJsonSerde } from "@daiso-tech/core";
|
|
17
|
-
* import { createClient } from "@libsql/client";
|
|
18
|
-
*
|
|
19
|
-
* const cacheAdapter = new LibsqlCacheAdapter(
|
|
20
|
-
* LibsqlCacheAdapter
|
|
21
|
-
* .settings()
|
|
22
|
-
* .setDatabase(createClient({ url: "file:local.db" }))
|
|
23
|
-
* .setSerde(new SuperJsonSerde())
|
|
24
|
-
* .setRootGroup("@global")
|
|
25
|
-
* .build()
|
|
26
|
-
* );
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
static settings<TSettings extends Partial<LibsqlCacheAdapterSettings>>(): LibsqlCacheAdapterSettingsBuilder<TSettings>;
|
|
30
25
|
private readonly cacheAdapter;
|
|
31
26
|
/***
|
|
32
27
|
* @example
|
|
@@ -34,18 +29,15 @@ export declare class LibsqlCacheAdapter<TType = unknown> implements ICacheAdapte
|
|
|
34
29
|
* import { LibsqlCacheAdapter, SuperJsonSerde } from "@daiso-tech/core";
|
|
35
30
|
* import { createClient } from "@libsql/client";
|
|
36
31
|
*
|
|
37
|
-
* const database = createClient({ url: "file:local.db" });
|
|
38
|
-
* const serde = new SuperJsonSerde();
|
|
39
|
-
* const cacheAdapter = new LibsqlCacheAdapter({
|
|
40
|
-
* database,
|
|
41
|
-
* serde,
|
|
42
|
-
* rootGroup: "@global"
|
|
43
|
-
* });
|
|
44
|
-
*
|
|
45
32
|
* (async () => {
|
|
33
|
+
* const database = createClient({ url: "file:local.db" });
|
|
34
|
+
* const serde = new SuperJsonSerde();
|
|
35
|
+
* const cacheAdapter = new LibsqlCacheAdapter({
|
|
36
|
+
* database,
|
|
37
|
+
* serde,
|
|
38
|
+
* rootGroup: "@global"
|
|
39
|
+
* });
|
|
46
40
|
* await cacheAdapter.init();
|
|
47
|
-
* await cacheAdapter.add("a", 1);
|
|
48
|
-
* await cacheAdapter.deInit();
|
|
49
41
|
* })();
|
|
50
42
|
* ```
|
|
51
43
|
*/
|
|
@@ -55,10 +47,12 @@ export declare class LibsqlCacheAdapter<TType = unknown> implements ICacheAdapte
|
|
|
55
47
|
removeExpiredKeys(): Promise<void>;
|
|
56
48
|
/**
|
|
57
49
|
* Removes the table where the cache values are stored and removes the table indexes.
|
|
50
|
+
* Note all cache data will be removed.
|
|
58
51
|
*/
|
|
59
52
|
deInit(): Promise<void>;
|
|
60
53
|
/**
|
|
61
54
|
* Creates the table where the cache values are stored and it's related indexes.
|
|
55
|
+
* Note the <i>init</i> method needs to be called before using the adapter.
|
|
62
56
|
*/
|
|
63
57
|
init(): Promise<void>;
|
|
64
58
|
get(key: string): Promise<TType | null>;
|
package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts
CHANGED
|
@@ -3,28 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
5
5
|
import { type TimeSpan } from "../../../../utilities/_module";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @group Adapters
|
|
8
|
+
*/
|
|
9
|
+
export type MemoryCacheAdapterSettings = {
|
|
10
|
+
rootGroup: string;
|
|
11
|
+
map?: Map<string, unknown>;
|
|
12
|
+
};
|
|
8
13
|
/**
|
|
9
14
|
* To utilize the <i>MemoryCacheAdapter</i>, you must create instance of it.
|
|
10
15
|
* @group Adapters
|
|
11
16
|
*/
|
|
12
17
|
export declare class MemoryCacheAdapter<TType = unknown> implements ICacheAdapter<TType> {
|
|
13
|
-
/**
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* import { MemoryCacheAdapter, SuperJsonSerde } from "@daiso-tech/core";
|
|
17
|
-
*
|
|
18
|
-
* const cacheAdapter = new MemoryCacheAdapter(
|
|
19
|
-
* MemoryCacheAdapter
|
|
20
|
-
* .settings()
|
|
21
|
-
* .setMap(new Map())
|
|
22
|
-
* .setRootGroup("@global")
|
|
23
|
-
* .build()
|
|
24
|
-
* );
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
static settings<TSettings extends Partial<MemoryCacheAdapterSettings>>(): MemoryCacheAdapterSettingsBuilder<TSettings>;
|
|
28
18
|
private readonly group;
|
|
29
19
|
private readonly timeoutMap;
|
|
30
20
|
private readonly map;
|
|
@@ -50,7 +40,7 @@ export declare class MemoryCacheAdapter<TType = unknown> implements ICacheAdapte
|
|
|
50
40
|
* ```
|
|
51
41
|
*/
|
|
52
42
|
constructor(settings: MemoryCacheAdapterSettings);
|
|
53
|
-
private
|
|
43
|
+
private getPrefix;
|
|
54
44
|
private withPrefix;
|
|
55
45
|
get(key: string): Promise<TType | null>;
|
|
56
46
|
add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
|
package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts
CHANGED
|
@@ -4,33 +4,23 @@
|
|
|
4
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
5
5
|
import type { IDeinitizable } from "../../../../utilities/_module";
|
|
6
6
|
import { type TimeSpan, type IInitizable } from "../../../../utilities/_module";
|
|
7
|
-
import type {
|
|
8
|
-
import {
|
|
7
|
+
import type { CollectionOptions, Db } from "mongodb";
|
|
8
|
+
import type { ISerde } from "../../../../serde/contracts/_module";
|
|
9
|
+
/**
|
|
10
|
+
* @group Adapters
|
|
11
|
+
*/
|
|
12
|
+
export type MongodbCacheAdapterSettings = {
|
|
13
|
+
database: Db;
|
|
14
|
+
serde: ISerde<string>;
|
|
15
|
+
rootGroup: string;
|
|
16
|
+
collectionName?: string;
|
|
17
|
+
collectionSettings?: CollectionOptions;
|
|
18
|
+
};
|
|
9
19
|
/**
|
|
10
20
|
* To utilize the <i>MongodbCacheAdapter</i>, you must install the <i>"mongodb"</i> package and supply a <i>{@link ISerde | ISerde<string> }</i>, such as <i>{@link SuperJsonSerde}</i>.
|
|
11
21
|
* @group Adapters
|
|
12
22
|
*/
|
|
13
23
|
export declare class MongodbCacheAdapter<TType = unknown> implements ICacheAdapter<TType>, IInitizable, IDeinitizable {
|
|
14
|
-
/**
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* import { MongodbCacheAdapter, SuperJsonSerde } from "@daiso-tech/core";
|
|
18
|
-
* import { MongoClient } from "mongodb";
|
|
19
|
-
*
|
|
20
|
-
* (async () => {
|
|
21
|
-
* const client = await MongoClient.connect("YOUR_MONGODB_CONNECTION_STRING");
|
|
22
|
-
* const cacheAdapter = new MongodbCacheAdapter(
|
|
23
|
-
* MongodbCacheAdapter
|
|
24
|
-
* .settings()
|
|
25
|
-
* .setDatabase(client.db("database"))
|
|
26
|
-
* .setSerde(new SuperJsonSerde())
|
|
27
|
-
* .setRootGroup("@global")
|
|
28
|
-
* .build()
|
|
29
|
-
* );
|
|
30
|
-
* })();
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
static settings<TSettings extends Partial<MongodbCacheAdapterSettings>>(): MongodbCacheAdapterSettingsBuilder<TSettings>;
|
|
34
24
|
private static isMongodbIncrementError;
|
|
35
25
|
private readonly mongodbSerde;
|
|
36
26
|
private readonly group;
|
|
@@ -38,6 +28,7 @@ export declare class MongodbCacheAdapter<TType = unknown> implements ICacheAdapt
|
|
|
38
28
|
private readonly database;
|
|
39
29
|
private readonly collection;
|
|
40
30
|
private readonly collectionName;
|
|
31
|
+
private readonly collectionSettings?;
|
|
41
32
|
/**
|
|
42
33
|
* @example
|
|
43
34
|
* ```ts
|
|
@@ -53,22 +44,21 @@ export declare class MongodbCacheAdapter<TType = unknown> implements ICacheAdapt
|
|
|
53
44
|
* serde,
|
|
54
45
|
* rootGroup: "@global"
|
|
55
46
|
* });
|
|
56
|
-
*
|
|
57
47
|
* await cacheAdapter.init();
|
|
58
|
-
* await cacheAdapter.add("a", 1);
|
|
59
|
-
* await cacheAdapter.deInit();
|
|
60
48
|
* })();
|
|
61
49
|
* ```
|
|
62
50
|
*/
|
|
63
|
-
constructor(
|
|
51
|
+
constructor(settings: MongodbCacheAdapterSettings);
|
|
64
52
|
getGroup(): string;
|
|
65
53
|
withGroup(group: string): ICacheAdapter<TType>;
|
|
66
54
|
/**
|
|
67
55
|
* Creates all related indexes.
|
|
56
|
+
* Note the <i>init</i> method needs to be called before using the adapter.
|
|
68
57
|
*/
|
|
69
58
|
init(): Promise<void>;
|
|
70
59
|
/**
|
|
71
60
|
* Removes the collection where the cache values are stored and all it's related indexes.
|
|
61
|
+
* Note all cache data will be removed.
|
|
72
62
|
*/
|
|
73
63
|
deInit(): Promise<void>;
|
|
74
64
|
get(key: string): Promise<TType | null>;
|
package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts
CHANGED
|
@@ -3,36 +3,26 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
5
5
|
import { type TimeSpan } from "../../../../utilities/_module";
|
|
6
|
-
import { type Result } from "ioredis";
|
|
7
|
-
import type {
|
|
8
|
-
import { RedisCacheAdapterSettingsBuilder } from "../../../../cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings";
|
|
6
|
+
import { type Redis, type Result } from "ioredis";
|
|
7
|
+
import type { ISerde } from "../../../../serde/contracts/_module";
|
|
9
8
|
declare module "ioredis" {
|
|
10
9
|
interface RedisCommander<Context> {
|
|
11
10
|
daiso_cache_increment(key: string, number: string): Result<number, Context>;
|
|
12
11
|
}
|
|
13
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* @group Adapters
|
|
15
|
+
*/
|
|
16
|
+
export type RedisCacheAdapterSettings = {
|
|
17
|
+
database: Redis;
|
|
18
|
+
serde: ISerde<string>;
|
|
19
|
+
rootGroup: string;
|
|
20
|
+
};
|
|
14
21
|
/**
|
|
15
22
|
* To utilize the <i>RedisCacheAdapter</i>, you must install the <i>"ioredis"</i> package and supply a <i>{@link ISerde | ISerde<string> }</i>, such as <i>{@link SuperJsonSerde}</i>.
|
|
16
23
|
* @group Adapters
|
|
17
24
|
*/
|
|
18
25
|
export declare class RedisCacheAdapter<TType = unknown> implements ICacheAdapter<TType> {
|
|
19
|
-
/**
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* import { RedisCacheAdapter, SuperJsonSerde } from "@daiso-tech/core";
|
|
23
|
-
* import Redis from "ioredis";
|
|
24
|
-
*
|
|
25
|
-
* const cacheAdapter = new RedisCacheAdapter(
|
|
26
|
-
* RedisCacheAdapter
|
|
27
|
-
* .settings()
|
|
28
|
-
* .setDatabase(new Redis("YOUR_REDIS_CONNECTION_STRING"))
|
|
29
|
-
* .setSerde(new SuperJsonSerde())
|
|
30
|
-
* .setRootGroup("@global")
|
|
31
|
-
* .build()
|
|
32
|
-
* );
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
static settings<TSettings extends Partial<RedisCacheAdapterSettings>>(): RedisCacheAdapterSettingsBuilder<TSettings>;
|
|
36
26
|
private static isRedisTypeError;
|
|
37
27
|
private readonly baseSerde;
|
|
38
28
|
private readonly redisSerde;
|
|
@@ -53,8 +43,8 @@ export declare class RedisCacheAdapter<TType = unknown> implements ICacheAdapter
|
|
|
53
43
|
* });
|
|
54
44
|
* ```
|
|
55
45
|
*/
|
|
56
|
-
constructor(
|
|
57
|
-
private
|
|
46
|
+
constructor(settings: RedisCacheAdapterSettings);
|
|
47
|
+
private getPrefix;
|
|
58
48
|
private withPrefix;
|
|
59
49
|
get(key: string): Promise<TType | null>;
|
|
60
50
|
add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
|
package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts
CHANGED
|
@@ -3,30 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
5
5
|
import type { TimeSpan, IInitizable, IDeinitizable } from "../../../../utilities/_module";
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
6
|
+
import type { SqliteDatabase } from "kysely";
|
|
7
|
+
import type { ISerde } from "../../../../serde/contracts/_module";
|
|
8
|
+
/**
|
|
9
|
+
* @group Adapters
|
|
10
|
+
*/
|
|
11
|
+
export type SqliteCacheAdapterSettings = {
|
|
12
|
+
database: SqliteDatabase;
|
|
13
|
+
tableName?: string;
|
|
14
|
+
serde: ISerde<string>;
|
|
15
|
+
enableTransactions?: boolean;
|
|
16
|
+
expiredKeysRemovalInterval?: TimeSpan;
|
|
17
|
+
shouldRemoveExpiredKeys?: boolean;
|
|
18
|
+
rootGroup: string;
|
|
19
|
+
};
|
|
8
20
|
/**
|
|
9
21
|
* To utilize the <i>SqliteCacheAdapter</i>, you must install the <i>"better-sqlite3"</i> package and supply a <i>{@link ISerde | ISerde<string> }</i>, such as <i>{@link SuperJsonSerde}</i>.
|
|
10
22
|
* @group Adapters
|
|
11
23
|
*/
|
|
12
24
|
export declare class SqliteCacheAdapter<TType = unknown> implements ICacheAdapter<TType>, IInitizable, IDeinitizable {
|
|
13
|
-
/**
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* import { SqliteCacheAdapter, SuperJsonSerde } from "@daiso-tech/core";
|
|
17
|
-
* import Sqlite from "better-sqlite3";
|
|
18
|
-
*
|
|
19
|
-
* const cacheAdapter = new SqliteCacheAdapter(
|
|
20
|
-
* SqliteCacheAdapter
|
|
21
|
-
* .settings()
|
|
22
|
-
* .setDatabase(new Sqlite("local.db"))
|
|
23
|
-
* .setSerde(new SuperJsonSerde())
|
|
24
|
-
* .setRootGroup("@global")
|
|
25
|
-
* .build()
|
|
26
|
-
* );
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
static settings<TSettings extends Partial<SqliteCacheAdapterSettings>>(): SqliteCacheAdapterSettingsBuilder<TSettings>;
|
|
30
25
|
private readonly cacheAdapter;
|
|
31
26
|
/**
|
|
32
27
|
* @example
|
|
@@ -34,18 +29,15 @@ export declare class SqliteCacheAdapter<TType = unknown> implements ICacheAdapte
|
|
|
34
29
|
* import { SqliteCacheAdapter, SuperJsonSerde } from "@daiso-tech/core";
|
|
35
30
|
* import Sqlite from "better-sqlite3";
|
|
36
31
|
*
|
|
37
|
-
* const database = new Sqlite("local.db");
|
|
38
|
-
* const serde = new SuperJsonSerde();
|
|
39
|
-
* const cacheAdapter = new SqliteCacheAdapter({
|
|
40
|
-
* database,
|
|
41
|
-
* serde,
|
|
42
|
-
* rootGroup: "@global"
|
|
43
|
-
* });
|
|
44
|
-
*
|
|
45
32
|
* (async () => {
|
|
33
|
+
* const database = new Sqlite("local.db");
|
|
34
|
+
* const serde = new SuperJsonSerde();
|
|
35
|
+
* const cacheAdapter = new SqliteCacheAdapter({
|
|
36
|
+
* database,
|
|
37
|
+
* serde,
|
|
38
|
+
* rootGroup: "@global"
|
|
39
|
+
* });
|
|
46
40
|
* await cacheAdapter.init();
|
|
47
|
-
* await cacheAdapter.add("a", 1);
|
|
48
|
-
* await cacheAdapter.deInit();
|
|
49
41
|
* })();
|
|
50
42
|
* ```
|
|
51
43
|
*/
|
|
@@ -55,10 +47,12 @@ export declare class SqliteCacheAdapter<TType = unknown> implements ICacheAdapte
|
|
|
55
47
|
removeExpiredKeys(): Promise<void>;
|
|
56
48
|
/**
|
|
57
49
|
* Removes the table where the cache values are stored and removes the table indexes.
|
|
50
|
+
* Note all cache data will be removed.
|
|
58
51
|
*/
|
|
59
52
|
deInit(): Promise<void>;
|
|
60
53
|
/**
|
|
61
54
|
* Creates the table where the cache values are stored and it's related indexes.
|
|
55
|
+
* Note the <i>init</i> method needs to be called before using the adapter.
|
|
62
56
|
*/
|
|
63
57
|
init(): Promise<void>;
|
|
64
58
|
get(key: string): Promise<TType | null>;
|