@daiso-tech/core 0.26.1 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -3
- package/dist/async/utilities/delay/delay.d.ts +1 -12
- package/dist/async/utilities/delay/delay.js +1 -12
- package/dist/async/utilities/delay/delay.js.map +1 -1
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +143 -71
- package/dist/async/utilities/lazy-promise/lazy-promise.js +223 -142
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/async/utilities/retry/retry-or-fail.d.ts +2 -0
- package/dist/async/utilities/retry/retry-or-fail.js.map +1 -1
- package/dist/cache/contracts/_module-exports.d.ts +1 -0
- package/dist/cache/contracts/_module-exports.js +1 -0
- package/dist/cache/contracts/_module-exports.js.map +1 -1
- package/dist/cache/contracts/cache-adapter.contract.d.ts +19 -21
- package/dist/cache/contracts/cache-adapter.contract.js +1 -4
- package/dist/cache/contracts/cache-adapter.contract.js.map +1 -1
- package/dist/cache/contracts/cache-factory.contract.d.ts +1 -1
- package/dist/cache/contracts/cache.contract.d.ts +144 -96
- package/dist/cache/contracts/cache.contract.js +1 -2
- package/dist/cache/contracts/cache.contract.js.map +1 -1
- package/dist/cache/contracts/cache.errors.js +2 -5
- package/dist/cache/contracts/cache.errors.js.map +1 -1
- package/dist/cache/contracts/cache.events.d.ts +10 -10
- package/dist/cache/contracts/cache.events.js +2 -5
- package/dist/cache/contracts/cache.events.js.map +1 -1
- package/dist/cache/contracts/database-cache-adapter.contract.d.ts +89 -0
- package/dist/cache/contracts/database-cache-adapter.contract.js +5 -0
- package/dist/cache/contracts/database-cache-adapter.contract.js.map +1 -0
- package/dist/cache/implementations/adapters/{kysely-sqlite-cache-adapter → kysely-cache-adapter}/_module.d.ts +1 -1
- package/dist/cache/implementations/adapters/kysely-cache-adapter/_module.js +2 -0
- package/dist/cache/implementations/adapters/kysely-cache-adapter/_module.js.map +1 -0
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.d.ts +73 -0
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js +224 -0
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js.map +1 -0
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +29 -39
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +45 -54
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +17 -33
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +43 -52
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.d.ts +13 -0
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.js +38 -0
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.js.map +1 -0
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +27 -33
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +145 -197
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +14 -13
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +19 -17
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.d.ts +13 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.js +39 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.js.map +1 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +16 -22
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +51 -132
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.d.ts +13 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.js +69 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.js.map +1 -0
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +29 -41
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +46 -55
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/_module-exports.d.ts +1 -1
- package/dist/cache/implementations/derivables/_module-exports.js +1 -1
- package/dist/cache/implementations/derivables/_module-exports.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/_module.d.ts +1 -0
- package/dist/cache/implementations/derivables/cache/_module.js +1 -0
- package/dist/cache/implementations/derivables/cache/_module.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +269 -507
- package/dist/cache/implementations/derivables/cache/cache.js +538 -822
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.d.ts +21 -0
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.js +110 -0
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.js.map +1 -0
- package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.d.ts +9 -0
- package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js +20 -0
- package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js.map +1 -0
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +69 -105
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +117 -87
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cache/implementations/test-utilities/_module-exports.d.ts +1 -0
- package/dist/cache/implementations/test-utilities/_module-exports.js +1 -0
- package/dist/cache/implementations/test-utilities/_module-exports.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +9 -11
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +246 -247
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +16 -30
- package/dist/cache/implementations/test-utilities/cache.test-suite.js +271 -996
- package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.d.ts +60 -0
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +698 -0
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js.map +1 -0
- package/dist/collection/contracts/async-collection.contract.d.ts +2 -3
- package/dist/collection/contracts/async-collection.contract.js +1 -12
- package/dist/collection/contracts/async-collection.contract.js.map +1 -1
- package/dist/collection/contracts/collection.contract.d.ts +1 -1
- package/dist/collection/contracts/collection.errors.d.ts +1 -1
- package/dist/collection/contracts/collection.errors.js +3 -6
- package/dist/collection/contracts/collection.errors.js.map +1 -1
- package/dist/collection/implementations/_shared.d.ts +4 -4
- package/dist/collection/implementations/_shared.js +6 -9
- package/dist/collection/implementations/_shared.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +2 -2
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +5 -21
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +12 -8
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +1 -1
- package/dist/collection/implementations/list-collection/list-collection.d.ts +1 -1
- package/dist/collection/implementations/list-collection/list-collection.js +1 -1
- package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +0 -9
- package/dist/event-bus/contracts/event-bus.contract.d.ts +5 -5
- package/dist/event-bus/contracts/event-bus.contract.js.map +1 -1
- package/dist/event-bus/contracts/event-bus.errors.js +2 -5
- package/dist/event-bus/contracts/event-bus.errors.js.map +1 -1
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +9 -29
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +14 -35
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +2 -4
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +2 -8
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +8 -15
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +15 -34
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +85 -289
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +128 -325
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.d.ts +13 -0
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.js +42 -0
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.js.map +1 -0
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +103 -86
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +135 -77
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.d.ts +2 -48
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +31 -122
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +2 -50
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +41 -89
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/lock/contracts/database-lock-adapter.contract.d.ts +0 -9
- package/dist/lock/contracts/lock-adapter.contract.d.ts +0 -9
- package/dist/lock/contracts/lock-provider.contract.d.ts +20 -6
- package/dist/lock/contracts/lock.contract.d.ts +37 -8
- package/dist/lock/contracts/lock.errors.js +2 -5
- package/dist/lock/contracts/lock.errors.js.map +1 -1
- package/dist/lock/contracts/lock.events.js +2 -5
- package/dist/lock/contracts/lock.events.js.map +1 -1
- package/dist/lock/implementations/adapters/_module-exports.d.ts +1 -0
- package/dist/lock/implementations/adapters/_module-exports.js +1 -0
- package/dist/lock/implementations/adapters/_module-exports.js.map +1 -1
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +0 -5
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +2 -21
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +11 -16
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +11 -20
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +7 -26
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +7 -35
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +13 -20
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +13 -37
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.d.ts +1 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js +2 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js.map +1 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +17 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +24 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js.map +1 -0
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +4 -22
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +4 -31
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +14 -20
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +12 -21
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.d.ts +0 -2
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js +2 -8
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js +1 -5
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +181 -369
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +259 -407
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +15 -17
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +42 -40
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-state.d.ts +3 -3
- package/dist/lock/implementations/derivables/lock-provider/lock-state.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +194 -680
- package/dist/lock/implementations/derivables/lock-provider/lock.js +284 -744
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +106 -143
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +173 -101
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +4 -5
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +172 -247
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +5 -8
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +93 -98
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +15 -20
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +295 -145
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js +1 -2
- package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js.map +1 -1
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +3 -2
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +2 -1
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js.map +1 -1
- package/dist/serde/implementations/adapters/redis-serde/redis-serde.js +1 -2
- package/dist/serde/implementations/adapters/redis-serde/redis-serde.js.map +1 -1
- package/dist/serde/implementations/adapters/sql-serde/sql-serde.js +1 -2
- package/dist/serde/implementations/adapters/sql-serde/sql-serde.js.map +1 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.d.ts +2 -2
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +2 -2
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js.map +1 -1
- package/dist/serde/implementations/derivables/serde.d.ts +14 -14
- package/dist/serde/implementations/derivables/serde.js +14 -15
- package/dist/serde/implementations/derivables/serde.js.map +1 -1
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.d.ts +4 -4
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +3 -3
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +5 -5
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +4 -4
- package/dist/utilities/_module-exports.d.ts +2 -3
- package/dist/utilities/_module-exports.js +2 -3
- package/dist/utilities/_module-exports.js.map +1 -1
- package/dist/utilities/classes/_module.d.ts +4 -0
- package/dist/utilities/classes/_module.js +5 -0
- package/dist/utilities/classes/_module.js.map +1 -0
- package/dist/utilities/classes/key-prefixer/_module.d.ts +2 -0
- package/dist/utilities/classes/key-prefixer/_module.js +3 -0
- package/dist/utilities/classes/key-prefixer/_module.js.map +1 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.contract.d.ts +28 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js +5 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js.map +1 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +73 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.js +135 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -0
- package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.d.ts +1 -0
- package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.js +2 -0
- package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.js.map +1 -0
- package/dist/utilities/classes/kysely-table-name-transformer-plugin/kysely-table-name-transformer-plugin.js.map +1 -0
- package/dist/utilities/classes/pipeline/_module.d.ts +1 -0
- package/dist/utilities/classes/pipeline/_module.js +2 -0
- package/dist/utilities/classes/pipeline/_module.js.map +1 -0
- package/dist/utilities/{pipeline → classes/pipeline}/pipeline.d.ts +3 -2
- package/dist/utilities/{pipeline → classes/pipeline}/pipeline.js +3 -2
- package/dist/utilities/classes/pipeline/pipeline.js.map +1 -0
- package/dist/utilities/classes/time-span/_module.d.ts +1 -0
- package/dist/utilities/classes/time-span/_module.js +2 -0
- package/dist/utilities/classes/time-span/_module.js.map +1 -0
- package/dist/utilities/{time-span → classes/time-span}/time-span.d.ts +2 -1
- package/dist/utilities/{time-span → classes/time-span}/time-span.js +1 -0
- package/dist/utilities/classes/time-span/time-span.js.map +1 -0
- package/dist/utilities/{_constants.d.ts → constants.d.ts} +0 -3
- package/dist/utilities/constants.js +5 -0
- package/dist/utilities/constants.js.map +1 -0
- package/dist/utilities/contracts/_module.d.ts +3 -1
- package/dist/utilities/contracts/_module.js +3 -1
- package/dist/utilities/contracts/_module.js.map +1 -1
- package/dist/utilities/contracts/prunable.contract.d.ts +11 -0
- package/dist/utilities/contracts/prunable.contract.js +5 -0
- package/dist/utilities/contracts/prunable.contract.js.map +1 -0
- package/dist/utilities/contracts/sqlite-database.contract.d.ts +26 -0
- package/dist/utilities/contracts/sqlite-database.contract.js +5 -0
- package/dist/utilities/contracts/sqlite-database.contract.js.map +1 -0
- package/dist/utilities/functions.d.ts +34 -2
- package/dist/utilities/functions.js +72 -4
- package/dist/utilities/functions.js.map +1 -1
- package/dist/utilities/types.d.ts +49 -16
- package/package.json +14 -13
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js +0 -2
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js.map +0 -1
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +0 -61
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +0 -318
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +0 -1
- package/dist/utilities/_constants.js +0 -8
- package/dist/utilities/_constants.js.map +0 -1
- package/dist/utilities/kysely/_module.d.ts +0 -1
- package/dist/utilities/kysely/_module.js +0 -2
- package/dist/utilities/kysely/_module.js.map +0 -1
- package/dist/utilities/kysely/kysely-table-name-transformer-plugin.js.map +0 -1
- package/dist/utilities/pipeline/_module.d.ts +0 -1
- package/dist/utilities/pipeline/_module.js +0 -2
- package/dist/utilities/pipeline/_module.js.map +0 -1
- package/dist/utilities/pipeline/pipeline.js.map +0 -1
- package/dist/utilities/time-span/_module.d.ts +0 -1
- package/dist/utilities/time-span/_module.js +0 -2
- package/dist/utilities/time-span/_module.js.map +0 -1
- package/dist/utilities/time-span/time-span.js.map +0 -1
- /package/dist/utilities/{kysely → classes/kysely-table-name-transformer-plugin}/kysely-table-name-transformer-plugin.d.ts +0 -0
- /package/dist/utilities/{kysely → classes/kysely-table-name-transformer-plugin}/kysely-table-name-transformer-plugin.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-adapter.contract.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache-adapter.contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache-adapter.contract.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache-adapter.contract.ts"],"names":[],"mappings":""}
|
|
@@ -11,7 +11,7 @@ import type { IGroupableCache } from "../../cache/contracts/cache.contract.js";
|
|
|
11
11
|
export type ICacheFactory<TAdapters extends string = string> = {
|
|
12
12
|
/**
|
|
13
13
|
* The <i>use</i> method will throw an error if you provide it unregisted adapter.
|
|
14
|
-
* If no default adapter is defined an error will be thrown
|
|
14
|
+
* If no default adapter is defined an error will be thrown.
|
|
15
15
|
* @throws {UnregisteredAdapterError} {@link UnregisteredAdapterError}
|
|
16
16
|
* @throws {DefaultAdapterNotDefinedError} {@link DefaultAdapterNotDefinedError}
|
|
17
17
|
*/
|
|
@@ -1,147 +1,191 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
|
-
import type { IEventListenable } from "../../event-bus/contracts/_module-exports.js";
|
|
5
|
-
import type { OneOrMore } from "../../utilities/_module-exports.js";
|
|
6
|
-
import { type AsyncLazyable, type GetOrAddValue } from "../../utilities/_module-exports.js";
|
|
7
|
-
import type { CacheEvents } from "../../cache/contracts/_module-exports.js";
|
|
8
|
-
import type { TimeSpan } from "../../utilities/_module-exports.js";
|
|
9
4
|
import type { LazyPromise } from "../../async/_module-exports.js";
|
|
5
|
+
import type { TimeSpan } from "../../utilities/_module-exports.js";
|
|
6
|
+
import type { AsyncLazyable, NoneFunction, OneOrMore } from "../../utilities/types.js";
|
|
7
|
+
import type { CacheEvents } from "../../cache/contracts/cache.events.js";
|
|
8
|
+
import type { IEventListenable } from "../../event-bus/contracts/_module-exports.js";
|
|
10
9
|
/**
|
|
11
|
-
* The <i>ICacheListenable</i> contract defines a way for listening <i>{@link ICache}</i>
|
|
10
|
+
* The <i>ICacheListenable</i> contract defines a way for listening <i>{@link ICache}</i> operation events.
|
|
12
11
|
*
|
|
13
12
|
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
14
13
|
* @group Contracts
|
|
15
14
|
*/
|
|
16
15
|
export type ICacheListenable<TType = unknown> = IEventListenable<CacheEvents<TType>>;
|
|
17
16
|
/**
|
|
17
|
+
* The <i>ICacheBase</i> contract defines a way for as key-value pairs independent of data storage.
|
|
18
18
|
*
|
|
19
19
|
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
20
20
|
* @group Contracts
|
|
21
21
|
*/
|
|
22
|
-
export type
|
|
23
|
-
value: TType;
|
|
24
|
-
/**
|
|
25
|
-
* You can provide a <i>ttl</i> value. If null is passed, the item will not expire.
|
|
26
|
-
*/
|
|
27
|
-
ttl?: TimeSpan | null;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* The <i>ICache</i> contract defines a way for storing data as key-value pairs independent of data storage.
|
|
31
|
-
* It commes with more convient methods compared to <i>ICacheAdapter</i>.
|
|
32
|
-
*
|
|
33
|
-
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
34
|
-
* @group Contracts
|
|
35
|
-
*/
|
|
36
|
-
export type ICache<TType = unknown> = ICacheListenable & {
|
|
22
|
+
export type ICacheBase<TType = unknown> = {
|
|
37
23
|
/**
|
|
38
24
|
* The <i>exists</i> method returns true when <i>key</i> is found otherwise false will be returned.
|
|
25
|
+
*
|
|
26
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
27
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
28
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
39
29
|
*/
|
|
40
|
-
exists(key: string): LazyPromise<boolean>;
|
|
41
|
-
/**
|
|
42
|
-
* The <i>existsMany</i> method returns true for the <i>keys</i> that are found otherwise false will be returned.
|
|
43
|
-
*/
|
|
44
|
-
existsMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
30
|
+
exists(key: OneOrMore<string>): LazyPromise<boolean>;
|
|
45
31
|
/**
|
|
46
32
|
* The <i>missing</i> method returns true when <i>key</i> is not found otherwise false will be returned.
|
|
33
|
+
*
|
|
34
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
35
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
36
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
47
37
|
*/
|
|
48
|
-
missing(key: string): LazyPromise<boolean>;
|
|
49
|
-
/**
|
|
50
|
-
* The <i>missingMany</i> method returns true for the <i>keys</i> that are not found otherwise false will be returned.
|
|
51
|
-
*/
|
|
52
|
-
missingMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
38
|
+
missing(key: OneOrMore<string>): LazyPromise<boolean>;
|
|
53
39
|
/**
|
|
54
40
|
* The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
41
|
+
*
|
|
42
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
43
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
44
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
55
45
|
*/
|
|
56
|
-
get(key: string): LazyPromise<TType | null>;
|
|
57
|
-
/**
|
|
58
|
-
* The <i>getMany</i> returns the value for the <i>keys</i> that are found otherwise null will be returned.
|
|
59
|
-
*/
|
|
60
|
-
getMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, TType | null>>;
|
|
61
|
-
/**
|
|
62
|
-
* The <i>getOr</i> method returns the value when <i>key</i> is found otherwise <i>defaultValue</i> will be returned.
|
|
63
|
-
*/
|
|
64
|
-
getOr(key: string, defaultValue: AsyncLazyable<TType>): LazyPromise<TType>;
|
|
65
|
-
/**
|
|
66
|
-
* The <i>getOrMany</i> method returns the value for the keys that are found otherwise defaultValue will be returned.
|
|
67
|
-
*/
|
|
68
|
-
getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>): LazyPromise<Record<TKeys, TType>>;
|
|
46
|
+
get(key: OneOrMore<string>): LazyPromise<TType | null>;
|
|
69
47
|
/**
|
|
70
48
|
* The <i>getOrFail</i> method returns the value when <i>key</i> is found otherwise an error will be thrown.
|
|
49
|
+
*
|
|
50
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
51
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
52
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
53
|
+
*
|
|
71
54
|
* @throws {KeyNotFoundCacheError} {@link KeyNotFoundCacheError}
|
|
72
55
|
*/
|
|
73
|
-
getOrFail(key: string): LazyPromise<TType>;
|
|
74
|
-
/**
|
|
75
|
-
* The <i>add</i> method adds a <i>key</i> with given <i>value</i> when key doesn't exists. Returns true when key doesn't exists otherwise false will be returned.
|
|
76
|
-
* You can provide a <i>ttl</i> value. If null is passed, the item will not expire.
|
|
77
|
-
*/
|
|
78
|
-
add(key: string, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
|
|
56
|
+
getOrFail(key: OneOrMore<string>): LazyPromise<TType>;
|
|
79
57
|
/**
|
|
80
|
-
* The <i>
|
|
58
|
+
* The <i>getAndRemove</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
59
|
+
* The key will be removed after it is returned.
|
|
60
|
+
*
|
|
61
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
62
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
63
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
81
64
|
*/
|
|
82
|
-
|
|
65
|
+
getAndRemove(key: OneOrMore<string>): LazyPromise<TType | null>;
|
|
83
66
|
/**
|
|
84
|
-
* The <i>
|
|
67
|
+
* The <i>getOr</i> method will retrieve the given <i>key</i> if found otherwise <i>defaultValue</i> will be returned.
|
|
68
|
+
*
|
|
69
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
70
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
71
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
72
|
+
*
|
|
73
|
+
* @param defaultValue - can be sync function, async function or <i>{@link LazyPromise}</i>.
|
|
85
74
|
*/
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The <i>updateMany</i> method updates the given keys. Returns true for the keys that where updated otherwise false will be returned.
|
|
89
|
-
*/
|
|
90
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>): LazyPromise<Record<TKeys, boolean>>;
|
|
91
|
-
/**
|
|
92
|
-
* The <i>put</i> method replaces a <i>key</i> if the <i>key</i> exists including the ttl value or adds <i>key</i> that do not exists with a given <i>ttl</i>.
|
|
93
|
-
* Returns true if the <i>key</i> where replaced otherwise false is returned.
|
|
94
|
-
* You can provide a <i>ttl</i> value for the replaced key. If <i>null</i> is passed, the item will not expires and <i>null</i> is the default value.
|
|
95
|
-
*/
|
|
96
|
-
put(key: string, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
|
|
97
|
-
/**
|
|
98
|
-
* The <i>putMany</i> method replaces the keys that exists including their ttl values or adds keys that do not exists.
|
|
99
|
-
* Returns true for all the keys that where replaced otherwise false is returned.
|
|
100
|
-
*/
|
|
101
|
-
putMany<TKeys extends string>(values: Record<TKeys, WithTtlValue<TType>>): LazyPromise<Record<TKeys, boolean>>;
|
|
102
|
-
/**
|
|
103
|
-
* The <i>remove</i> method removes the given <i>key</i> when found. Returns true if the key is found otherwise false is returned.
|
|
104
|
-
*/
|
|
105
|
-
remove(key: string): LazyPromise<boolean>;
|
|
106
|
-
/**
|
|
107
|
-
* The <i>removeMany</i> method removes keys. Returns true for the keys that are removed otherwise false is returned.
|
|
108
|
-
*/
|
|
109
|
-
removeMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
110
|
-
/**
|
|
111
|
-
* The <i>getAndRemove</i> method removes the given <i>key</i> and returns it when found otherwise null will be returned.
|
|
112
|
-
*/
|
|
113
|
-
getAndRemove(key: string): LazyPromise<TType | null>;
|
|
75
|
+
getOr(key: OneOrMore<string>, defaultValue: AsyncLazyable<NoneFunction<TType>>): LazyPromise<TType>;
|
|
114
76
|
/**
|
|
115
77
|
* The <i>getOrAdd</i> method will retrieve the given <i>key</i> if found otherwise <i>valueToAdd</i> will be added and returned.
|
|
116
|
-
*
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
*
|
|
121
|
-
*
|
|
78
|
+
*
|
|
79
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
80
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
81
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
82
|
+
*
|
|
83
|
+
* @param valueToAdd - can be sync function, async function or <i>{@link LazyPromise}</i>.
|
|
84
|
+
*/
|
|
85
|
+
getOrAdd(key: OneOrMore<string>, valueToAdd: AsyncLazyable<NoneFunction<TType>>, ttl?: TimeSpan | null): LazyPromise<TType>;
|
|
86
|
+
/**
|
|
87
|
+
* The <i>add</i> method adds a <i>key</i> with given <i>value</i> when key doesn't exists.
|
|
88
|
+
*
|
|
89
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
90
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
91
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
92
|
+
*
|
|
93
|
+
* @param ttl - If null is passed, the item will not expire.
|
|
94
|
+
*
|
|
95
|
+
* @returns true when key doesn't exists otherwise false will be returned.
|
|
96
|
+
*/
|
|
97
|
+
add(key: OneOrMore<string>, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
|
|
98
|
+
/**
|
|
99
|
+
* The <i>put</i> method replaces th given <i>key</i> with the given <i>value</i> and <i>ttl</i> if the <i>key</i> exists
|
|
100
|
+
* othwerwise it will add the given <i>value</i> with the given <i>ttl</i>.
|
|
101
|
+
*
|
|
102
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
103
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
104
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
105
|
+
*
|
|
106
|
+
* @param ttl - If null is passed, the item will not expire.
|
|
107
|
+
*
|
|
108
|
+
* @returns true if the <i>key</i> where replaced otherwise false is returned.
|
|
109
|
+
*/
|
|
110
|
+
put(key: OneOrMore<string>, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* The <i>update</i> method updates the given <i>key</i> with given <i>value</i>.
|
|
113
|
+
*
|
|
114
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
115
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
116
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
117
|
+
*
|
|
118
|
+
* @returns true if the <i>key</i> where updated otherwise false will be returned.
|
|
119
|
+
*/
|
|
120
|
+
update(key: OneOrMore<string>, value: TType): LazyPromise<boolean>;
|
|
121
|
+
/**
|
|
122
|
+
* The <i>increment</i> method increments the given <i>key</i> with given <i>value</i>.
|
|
122
123
|
* An error will thrown if the key is not a number.
|
|
124
|
+
*
|
|
125
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
126
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
127
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
128
|
+
*
|
|
129
|
+
* @param value - If not defined then it will be defaulted to 1.
|
|
130
|
+
*
|
|
131
|
+
* @returns true if the <i>key</i> where incremented otherwise false will be returned.
|
|
132
|
+
*
|
|
123
133
|
* @throws {TypeCacheError} {@link TypeCacheError}
|
|
124
134
|
*/
|
|
125
|
-
increment(key: string
|
|
135
|
+
increment(key: OneOrMore<string>, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
126
136
|
/**
|
|
127
|
-
* The <i>decrement</i> method
|
|
128
|
-
* Returns true if key exists otherwise false will be returned.
|
|
137
|
+
* The <i>decrement</i> method decrements the given <i>key</i> with given <i>value</i>.
|
|
129
138
|
* An error will thrown if the key is not a number.
|
|
139
|
+
*
|
|
140
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
141
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
142
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
143
|
+
*
|
|
144
|
+
* @param value - If not defined then it will be defaulted to 1.
|
|
145
|
+
*
|
|
146
|
+
* @returns true if the <i>key</i> where decremented otherwise false will be returned.
|
|
147
|
+
*
|
|
130
148
|
* @throws {TypeCacheError} {@link TypeCacheError}
|
|
131
149
|
*/
|
|
132
|
-
decrement(key: string
|
|
150
|
+
decrement(key: OneOrMore<string>, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
151
|
+
/**
|
|
152
|
+
* The <i>remove</i> method removes the given <i>key</i>.
|
|
153
|
+
*
|
|
154
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
155
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
156
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
157
|
+
*
|
|
158
|
+
* @returns true if the key is found otherwise false is returned.
|
|
159
|
+
*/
|
|
160
|
+
remove(key: OneOrMore<string>): LazyPromise<boolean>;
|
|
161
|
+
/**
|
|
162
|
+
* The <i>removeMany</i> method removes many keys.
|
|
163
|
+
*
|
|
164
|
+
* @param keys - The param items can be a string or an <i>Iterable</i> of strings.
|
|
165
|
+
* If the param items are an <i>Iterable</i>, it will be joined into a single string.
|
|
166
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
167
|
+
*
|
|
168
|
+
* @returns true if one of the keys where deleted otherwise false is returned.
|
|
169
|
+
*/
|
|
170
|
+
removeMany(keys: Iterable<OneOrMore<string>>): PromiseLike<boolean>;
|
|
133
171
|
/**
|
|
134
|
-
* The <i>clear</i> method removes all the keys in the cache.
|
|
172
|
+
* The <i>clear</i> method removes all the keys in the cache. If a cache is in a group then only the keys part of the group will be removed.
|
|
135
173
|
*/
|
|
136
174
|
clear(): LazyPromise<void>;
|
|
137
175
|
/**
|
|
138
|
-
* The <i>getGroup</i> method returns the group name.
|
|
176
|
+
* The <i>getGroup</i> method returns the group name of the cache. If the cache is not part of a group then null is returned.
|
|
139
177
|
*/
|
|
140
|
-
getGroup(): string;
|
|
178
|
+
getGroup(): string | null;
|
|
141
179
|
};
|
|
142
180
|
/**
|
|
143
|
-
* The <i>
|
|
144
|
-
*
|
|
181
|
+
* The <i>ICache</i> contract defines a way for as key-value pairs independent of data storage and listening to operation events.
|
|
182
|
+
*
|
|
183
|
+
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
184
|
+
* @group Contracts
|
|
185
|
+
*/
|
|
186
|
+
export type ICache<TType = unknown> = ICacheListenable<TType> & ICacheBase<TType>;
|
|
187
|
+
/**
|
|
188
|
+
* The <i>IGroupableCache</i> contract defines a way for storing and grouping data as key-value pairs independent of data storage.
|
|
145
189
|
*
|
|
146
190
|
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
147
191
|
* @group Contracts
|
|
@@ -151,6 +195,10 @@ export type IGroupableCache<TType = unknown> = ICache<TType> & {
|
|
|
151
195
|
* The <i>withGroup</i> method returns a new <i>{@link ICache}</i> instance that groups keys together.
|
|
152
196
|
* Only keys in the same group will be updated, removed, or retrieved, leaving keys outside the group unaffected.
|
|
153
197
|
* This useful for multitennat applications.
|
|
198
|
+
*
|
|
199
|
+
* @param group - can be a string or an <i>Iterable</i> of strings.
|
|
200
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
201
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
154
202
|
*/
|
|
155
203
|
withGroup(group: OneOrMore<string>): ICache<TType>;
|
|
156
204
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.contract.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache.contract.ts"],"names":[],"mappings":"AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"cache.contract.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache.contract.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
|
-
import { CORE, } from "../../utilities/_module-exports.js";
|
|
4
|
+
import { CORE, resolveOneOrMore, } from "../../utilities/_module-exports.js";
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
@@ -72,10 +72,7 @@ export class KeyNotFoundCacheError extends CacheError {
|
|
|
72
72
|
* @group Errors
|
|
73
73
|
*/
|
|
74
74
|
export function registerCacheErrorsToSerde(serde) {
|
|
75
|
-
|
|
76
|
-
serde = [serde];
|
|
77
|
-
}
|
|
78
|
-
for (const serde_ of serde) {
|
|
75
|
+
for (const serde_ of resolveOneOrMore(serde)) {
|
|
79
76
|
serde_
|
|
80
77
|
.registerClass(CacheError, CORE)
|
|
81
78
|
.registerClass(UnexpectedCacheError, CORE)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.errors.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache.errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EACH,IAAI,
|
|
1
|
+
{"version":3,"file":"cache.errors.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache.errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EACH,IAAI,EACJ,gBAAgB,GAGnB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,MAAM,OAAO,UACT,SAAQ,KAAK;IAGb,MAAM,CAAC,WAAW,CAAC,iBAAmC;QAClD,OAAO,IAAI,UAAU,CACjB,iBAAiB,CAAC,OAAO,EACzB,iBAAiB,CAAC,KAAK,CAC1B,CAAC;IACN,CAAC;IAED,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAChC,CAAC;IAED,SAAS;QACL,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;SACpB,CAAC;IACN,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,oBACT,SAAQ,UAAU;IAGlB,MAAM,CAAU,WAAW,CACvB,iBAAmC;QAEnC,OAAO,IAAI,oBAAoB,CAC3B,iBAAiB,CAAC,OAAO,EACzB,iBAAiB,CAAC,KAAK,CAC1B,CAAC;IACN,CAAC;IAED,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC;IAC1C,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,cACT,SAAQ,UAAU;IAGlB,MAAM,CAAU,WAAW,CACvB,iBAAmC;QAEnC,OAAO,IAAI,cAAc,CACrB,iBAAiB,CAAC,OAAO,EACzB,iBAAiB,CAAC,KAAK,CAC1B,CAAC;IACN,CAAC;IAED,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;IACpC,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,qBACT,SAAQ,UAAU;IAGlB,MAAM,CAAU,WAAW,CACvB,iBAAmC;QAEnC,OAAO,IAAI,qBAAqB,CAC5B,iBAAiB,CAAC,OAAO,EACzB,iBAAiB,CAAC,KAAK,CAC1B,CAAC;IACN,CAAC;IAED,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC;IAC3C,CAAC;CACJ;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACtC,KAAgC;IAEhC,KAAK,MAAM,MAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3C,MAAM;aACD,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC;aAC/B,aAAa,CAAC,oBAAoB,EAAE,IAAI,CAAC;aACzC,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC;aACnC,aAAa,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;AACL,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { type OneOrMore, type TimeSpan } from "../../utilities/_module-exports.j
|
|
|
10
10
|
* @group Events
|
|
11
11
|
*/
|
|
12
12
|
export declare class KeyFoundCacheEvent<TType = unknown> extends BaseEvent<{
|
|
13
|
-
group: string;
|
|
13
|
+
group: string | null;
|
|
14
14
|
key: string;
|
|
15
15
|
value: TType;
|
|
16
16
|
}> {
|
|
@@ -21,7 +21,7 @@ export declare class KeyFoundCacheEvent<TType = unknown> extends BaseEvent<{
|
|
|
21
21
|
* @group Events
|
|
22
22
|
*/
|
|
23
23
|
export declare class KeyNotFoundCacheEvent extends BaseEvent<{
|
|
24
|
-
group: string;
|
|
24
|
+
group: string | null;
|
|
25
25
|
key: string;
|
|
26
26
|
}> {
|
|
27
27
|
}
|
|
@@ -31,7 +31,7 @@ export declare class KeyNotFoundCacheEvent extends BaseEvent<{
|
|
|
31
31
|
* @group Events
|
|
32
32
|
*/
|
|
33
33
|
export declare class KeyAddedCacheEvent<TType = unknown> extends BaseEvent<{
|
|
34
|
-
group: string;
|
|
34
|
+
group: string | null;
|
|
35
35
|
key: string;
|
|
36
36
|
value: TType;
|
|
37
37
|
ttl: TimeSpan | null;
|
|
@@ -43,7 +43,7 @@ export declare class KeyAddedCacheEvent<TType = unknown> extends BaseEvent<{
|
|
|
43
43
|
* @group Events
|
|
44
44
|
*/
|
|
45
45
|
export declare class KeyUpdatedCacheEvent<TType = unknown> extends BaseEvent<{
|
|
46
|
-
group: string;
|
|
46
|
+
group: string | null;
|
|
47
47
|
key: string;
|
|
48
48
|
value: TType;
|
|
49
49
|
}> {
|
|
@@ -54,7 +54,7 @@ export declare class KeyUpdatedCacheEvent<TType = unknown> extends BaseEvent<{
|
|
|
54
54
|
* @group Events
|
|
55
55
|
*/
|
|
56
56
|
export declare class KeyRemovedCacheEvent extends BaseEvent<{
|
|
57
|
-
group: string;
|
|
57
|
+
group: string | null;
|
|
58
58
|
key: string;
|
|
59
59
|
}> {
|
|
60
60
|
}
|
|
@@ -64,7 +64,7 @@ export declare class KeyRemovedCacheEvent extends BaseEvent<{
|
|
|
64
64
|
* @group Events
|
|
65
65
|
*/
|
|
66
66
|
export declare class KeyIncrementedCacheEvent extends BaseEvent<{
|
|
67
|
-
group: string;
|
|
67
|
+
group: string | null;
|
|
68
68
|
key: string;
|
|
69
69
|
value: number;
|
|
70
70
|
}> {
|
|
@@ -75,7 +75,7 @@ export declare class KeyIncrementedCacheEvent extends BaseEvent<{
|
|
|
75
75
|
* @group Events
|
|
76
76
|
*/
|
|
77
77
|
export declare class KeyDecrementedCacheEvent extends BaseEvent<{
|
|
78
|
-
group: string;
|
|
78
|
+
group: string | null;
|
|
79
79
|
key: string;
|
|
80
80
|
value: number;
|
|
81
81
|
}> {
|
|
@@ -86,7 +86,7 @@ export declare class KeyDecrementedCacheEvent extends BaseEvent<{
|
|
|
86
86
|
* @group Events
|
|
87
87
|
*/
|
|
88
88
|
export declare class KeysClearedCacheEvent extends BaseEvent<{
|
|
89
|
-
group: string;
|
|
89
|
+
group: string | null;
|
|
90
90
|
}> {
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
@@ -95,8 +95,8 @@ export declare class KeysClearedCacheEvent extends BaseEvent<{
|
|
|
95
95
|
* @group Events
|
|
96
96
|
*/
|
|
97
97
|
export declare class UnexpectedCacheErrorEvent extends BaseEvent<{
|
|
98
|
-
group: string;
|
|
99
|
-
|
|
98
|
+
group: string | null;
|
|
99
|
+
keys?: string[];
|
|
100
100
|
value?: unknown;
|
|
101
101
|
method: string;
|
|
102
102
|
error: unknown;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
4
|
import { BaseEvent } from "../../event-bus/contracts/_module-exports.js";
|
|
5
|
-
import { CORE, } from "../../utilities/_module-exports.js";
|
|
5
|
+
import { CORE, resolveOneOrMore, } from "../../utilities/_module-exports.js";
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
@@ -73,10 +73,7 @@ export class UnexpectedCacheErrorEvent extends BaseEvent {
|
|
|
73
73
|
* @group Events
|
|
74
74
|
*/
|
|
75
75
|
export function registerCacheEventsToSerde(serde) {
|
|
76
|
-
|
|
77
|
-
serde = [serde];
|
|
78
|
-
}
|
|
79
|
-
for (const serde_ of serde) {
|
|
76
|
+
for (const serde_ of resolveOneOrMore(serde)) {
|
|
80
77
|
serde_
|
|
81
78
|
.registerEvent(KeyFoundCacheEvent, CORE)
|
|
82
79
|
.registerEvent(KeyNotFoundCacheEvent, CORE)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.events.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache.events.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAErE,OAAO,EACH,IAAI,
|
|
1
|
+
{"version":3,"file":"cache.events.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache.events.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAErE,OAAO,EACH,IAAI,EACJ,gBAAgB,GAGnB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,MAAM,OAAO,kBAAoC,SAAQ,SAIvD;CAAG;AAEL;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,SAGzC;CAAG;AAEL;;;;GAIG;AACH,MAAM,OAAO,kBAAoC,SAAQ,SAKvD;CAAG;AAEL;;;;GAIG;AACH,MAAM,OAAO,oBAAsC,SAAQ,SAIzD;CAAG;AAEL;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAGxC;CAAG;AAEL;;;;GAIG;AACH,MAAM,OAAO,wBAAyB,SAAQ,SAI5C;CAAG;AAEL;;;;GAIG;AACH,MAAM,OAAO,wBAAyB,SAAQ,SAI5C;CAAG;AAEL;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,SAEzC;CAAG;AAEL;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAM7C;CAAG;AAkBL;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACtC,KAAgC;IAEhC,KAAK,MAAM,MAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3C,MAAM;aACD,aAAa,CAAC,kBAAkB,EAAE,IAAI,CAAC;aACvC,aAAa,CAAC,qBAAqB,EAAE,IAAI,CAAC;aAC1C,aAAa,CAAC,kBAAkB,EAAE,IAAI,CAAC;aACvC,aAAa,CAAC,oBAAoB,EAAE,IAAI,CAAC;aACzC,aAAa,CAAC,oBAAoB,EAAE,IAAI,CAAC;aACzC,aAAa,CAAC,wBAAwB,EAAE,IAAI,CAAC;aAC7C,aAAa,CAAC,wBAAwB,EAAE,IAAI,CAAC;aAC7C,aAAa,CAAC,qBAAqB,EAAE,IAAI,CAAC;aAC1C,aAAa,CAAC,yBAAyB,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Cache
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
7
|
+
* @group Contracts
|
|
8
|
+
*/
|
|
9
|
+
export type ICacheData<TType = unknown> = {
|
|
10
|
+
value: TType;
|
|
11
|
+
expiration: Date | null;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
16
|
+
* @group Contracts
|
|
17
|
+
*/
|
|
18
|
+
export type ICacheDataExpiration = {
|
|
19
|
+
expiration: Date | null;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
24
|
+
* @group Contracts
|
|
25
|
+
*/
|
|
26
|
+
export type ICacheInsert<TType = unknown> = {
|
|
27
|
+
key: string;
|
|
28
|
+
value: TType;
|
|
29
|
+
expiration: Date | null;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
34
|
+
* @group Contracts
|
|
35
|
+
*/
|
|
36
|
+
export type ICacheUpdate<TType = unknown> = {
|
|
37
|
+
key: string;
|
|
38
|
+
value: TType;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The <i>IDatabaseCacheAdapter</i> contract defines a way for as key-value pairs independent of data storage.
|
|
42
|
+
* This contract simplifies the implementation of cache adapters with CRUD-based databases, such as SQL databases and ORMs like TypeOrm and MikroOrm.
|
|
43
|
+
*
|
|
44
|
+
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
45
|
+
* @group Contracts
|
|
46
|
+
*/
|
|
47
|
+
export type IDatabaseCacheAdapter<TType = unknown> = {
|
|
48
|
+
/**
|
|
49
|
+
* The <i>find</i> method returns the the <i>key</i> data which includs <i>{@link ICacheData}.value</i> and <i>{@link ICacheData}.expiration</i>.
|
|
50
|
+
*/
|
|
51
|
+
find(key: string): PromiseLike<ICacheData<TType> | null>;
|
|
52
|
+
/**
|
|
53
|
+
* The <i>insert</i> method inserts the given cache <i>data</i>.
|
|
54
|
+
*/
|
|
55
|
+
insert(data: ICacheInsert<TType>): PromiseLike<void>;
|
|
56
|
+
/**
|
|
57
|
+
* The <i>upsert</i> method inserts a key and if the key already exists then key will be updated with new <i>data.value</i> and <i>data.expiration</i>.
|
|
58
|
+
* The method always returns the old cache data if it exists otherwise null will be returned.
|
|
59
|
+
*/
|
|
60
|
+
upsert(data: ICacheInsert<TType>): PromiseLike<ICacheDataExpiration | null>;
|
|
61
|
+
/**
|
|
62
|
+
* The <i>removeExpiredMany</i> method updates a expired <i>key</i>.
|
|
63
|
+
*/
|
|
64
|
+
updateExpired(data: ICacheInsert<TType>): PromiseLike<number>;
|
|
65
|
+
/**
|
|
66
|
+
* The <i>removeExpiredMany</i> method updates a unexpired <i>key</i>.
|
|
67
|
+
*/
|
|
68
|
+
updateUnexpired(data: ICacheUpdate<TType>): PromiseLike<number>;
|
|
69
|
+
/**
|
|
70
|
+
* The <i>incrementUnexpired</i> should always throw an error if the existing item is not a number type.
|
|
71
|
+
*/
|
|
72
|
+
incrementUnexpired(data: ICacheUpdate<number>): PromiseLike<number>;
|
|
73
|
+
/**
|
|
74
|
+
* The <i>removeExpiredMany</i> method removes multiple expired <i>keys</i>.
|
|
75
|
+
*/
|
|
76
|
+
removeExpiredMany(keys: string[]): PromiseLike<number>;
|
|
77
|
+
/**
|
|
78
|
+
* The <i>removeExpiredMany</i> method removes multiple unexpired <i>keys</i>.
|
|
79
|
+
*/
|
|
80
|
+
removeUnexpiredMany(keys: string[]): PromiseLike<number>;
|
|
81
|
+
/**
|
|
82
|
+
* The <i>removeAll</i> method removes all keys from the cache.
|
|
83
|
+
*/
|
|
84
|
+
removeAll(): PromiseLike<void>;
|
|
85
|
+
/**
|
|
86
|
+
* The <i>removeByKeyPrefix</i> method removes all the keys in the cache that starts with the given <i>prefix</i>.
|
|
87
|
+
*/
|
|
88
|
+
removeByKeyPrefix(prefix: string): PromiseLike<void>;
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-cache-adapter.contract.js","sourceRoot":"","sources":["../../../src/cache/contracts/database-cache-adapter.contract.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "../../../../cache/implementations/adapters/kysely-
|
|
1
|
+
export * from "../../../../cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/cache/implementations/adapters/kysely-cache-adapter/_module.ts"],"names":[],"mappings":"AAAA,cAAc,+EAA+E,CAAC"}
|