@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
|
@@ -5,17 +5,17 @@ import {} from "vitest";
|
|
|
5
5
|
import {} from "../../../lock/contracts/_module-exports.js";
|
|
6
6
|
import {} from "../../../utilities/_module-exports.js";
|
|
7
7
|
import { TimeSpan } from "../../../utilities/_module-exports.js";
|
|
8
|
-
import {
|
|
8
|
+
import { LazyPromise } from "../../../async/_module-exports.js";
|
|
9
9
|
/**
|
|
10
10
|
* The <i>lockAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ILockAdapter}</i> with <i>vitest</i>.
|
|
11
11
|
*
|
|
12
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/
|
|
12
|
+
* IMPORT_PATH: ```"@daiso-tech/core/lock/test-utilities"```
|
|
13
13
|
* @group Utilities
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
16
16
|
* import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
17
|
-
* import { lockAdapterTestSuite } from "@daiso-tech/core/lock/
|
|
18
|
-
* import { RedisLockAdapter } from "@daiso-tech/core/lock/
|
|
17
|
+
* import { lockAdapterTestSuite } from "@daiso-tech/core/lock/test-utilities";
|
|
18
|
+
* import { RedisLockAdapter } from "@daiso-tech/core/lock/adapters";
|
|
19
19
|
* import { Redis } from "ioredis";
|
|
20
20
|
* import {
|
|
21
21
|
* RedisContainer,
|
|
@@ -37,10 +37,7 @@ import { delay } from "../../../async/_module-exports.js";
|
|
|
37
37
|
* }, timeout.toMilliseconds());
|
|
38
38
|
* lockAdapterTestSuite({
|
|
39
39
|
* createAdapter: () =>
|
|
40
|
-
* new RedisLockAdapter(
|
|
41
|
-
* database: client,
|
|
42
|
-
* rootGroup: "@a",
|
|
43
|
-
* }),
|
|
40
|
+
* new RedisLockAdapter(client),
|
|
44
41
|
* test,
|
|
45
42
|
* beforeEach,
|
|
46
43
|
* expect,
|
|
@@ -57,99 +54,97 @@ export function lockAdapterTestSuite(settings) {
|
|
|
57
54
|
lockAdapterA = await createAdapter();
|
|
58
55
|
});
|
|
59
56
|
const ttl = TimeSpan.fromMilliseconds(50);
|
|
60
|
-
describe("
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
expect(result).toBe(true);
|
|
67
|
-
});
|
|
68
|
-
test("Should return true when key is expired", async () => {
|
|
69
|
-
const key = "a";
|
|
70
|
-
const owner = "b";
|
|
71
|
-
await lockAdapterA.acquire(key, owner, ttl);
|
|
72
|
-
await delay(ttl);
|
|
73
|
-
const result = await lockAdapterA.acquire(key, owner, null);
|
|
74
|
-
expect(result).toBe(true);
|
|
75
|
-
});
|
|
76
|
-
test("Should return false when key is already acquired by same owner", async () => {
|
|
77
|
-
const key = "a";
|
|
78
|
-
const owner = "b";
|
|
79
|
-
await lockAdapterA.acquire(key, owner, null);
|
|
80
|
-
const result = await lockAdapterA.acquire(key, owner, null);
|
|
81
|
-
expect(result).toBe(false);
|
|
82
|
-
});
|
|
83
|
-
test("Should return false when key is already acquired by different owner", async () => {
|
|
84
|
-
const key = "a";
|
|
85
|
-
const owner1 = "b";
|
|
86
|
-
await lockAdapterA.acquire(key, owner1, null);
|
|
87
|
-
const owner2 = "c";
|
|
88
|
-
const result = await lockAdapterA.acquire(key, owner2, null);
|
|
89
|
-
expect(result).toBe(false);
|
|
90
|
-
});
|
|
91
|
-
test("Should return false when key is already acquired and not expired", async () => {
|
|
92
|
-
const key = "a";
|
|
93
|
-
const owner = "b";
|
|
94
|
-
await lockAdapterA.acquire(key, owner, ttl);
|
|
95
|
-
await delay(ttl.divide(2));
|
|
96
|
-
const result = await lockAdapterA.acquire(key, owner, null);
|
|
97
|
-
expect(result).toBe(false);
|
|
98
|
-
});
|
|
57
|
+
describe("method: acquire", () => {
|
|
58
|
+
test("Should return true when key is not acquired", async () => {
|
|
59
|
+
const key = "a";
|
|
60
|
+
const owner = "b";
|
|
61
|
+
const result = await lockAdapterA.acquire(key, owner, null);
|
|
62
|
+
expect(result).toBe(true);
|
|
99
63
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
test("Should return false when key is tried to be released by different owner", async () => {
|
|
109
|
-
const key = "a";
|
|
110
|
-
const owner1 = "b";
|
|
111
|
-
await lockAdapterA.acquire(key, owner1, null);
|
|
112
|
-
const owner2 = "c";
|
|
113
|
-
const result = await lockAdapterA.release(key, owner2);
|
|
114
|
-
expect(result).toBe(false);
|
|
115
|
-
});
|
|
116
|
-
test("Should be reacquirable by new owner after release", async () => {
|
|
117
|
-
const key = "a";
|
|
118
|
-
const owner1 = "b";
|
|
119
|
-
await lockAdapterA.acquire(key, owner1, null);
|
|
120
|
-
await lockAdapterA.release(key, owner1);
|
|
121
|
-
const owner2 = "c";
|
|
122
|
-
const result = await lockAdapterA.acquire(key, owner2, null);
|
|
123
|
-
expect(result).toBe(true);
|
|
124
|
-
});
|
|
64
|
+
test("Should return true when key is expired", async () => {
|
|
65
|
+
const key = "a";
|
|
66
|
+
const owner = "b";
|
|
67
|
+
await lockAdapterA.acquire(key, owner, ttl);
|
|
68
|
+
await LazyPromise.delay(ttl);
|
|
69
|
+
const result = await lockAdapterA.acquire(key, owner, null);
|
|
70
|
+
expect(result).toBe(true);
|
|
125
71
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const owner2 = "c";
|
|
133
|
-
const result = await lockAdapterA.acquire(key, owner2, null);
|
|
134
|
-
expect(result).toBe(true);
|
|
135
|
-
});
|
|
72
|
+
test("Should return false when key is already acquired by same owner", async () => {
|
|
73
|
+
const key = "a";
|
|
74
|
+
const owner = "b";
|
|
75
|
+
await lockAdapterA.acquire(key, owner, null);
|
|
76
|
+
const result = await lockAdapterA.acquire(key, owner, null);
|
|
77
|
+
expect(result).toBe(false);
|
|
136
78
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
79
|
+
test("Should return false when key is already acquired by different owner", async () => {
|
|
80
|
+
const key = "a";
|
|
81
|
+
const owner1 = "b";
|
|
82
|
+
await lockAdapterA.acquire(key, owner1, null);
|
|
83
|
+
const owner2 = "c";
|
|
84
|
+
const result = await lockAdapterA.acquire(key, owner2, null);
|
|
85
|
+
expect(result).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
test("Should return false when key is already acquired and not expired", async () => {
|
|
88
|
+
const key = "a";
|
|
89
|
+
const owner = "b";
|
|
90
|
+
await lockAdapterA.acquire(key, owner, ttl);
|
|
91
|
+
await LazyPromise.delay(ttl.divide(2));
|
|
92
|
+
const result = await lockAdapterA.acquire(key, owner, null);
|
|
93
|
+
expect(result).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
describe("method: release", () => {
|
|
97
|
+
test("Should return true when key is released by same owner", async () => {
|
|
98
|
+
const key = "a";
|
|
99
|
+
const owner = "b";
|
|
100
|
+
await lockAdapterA.acquire(key, owner, null);
|
|
101
|
+
const result = await lockAdapterA.release(key, owner);
|
|
102
|
+
expect(result).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
test("Should return false when key is tried to be released by different owner", async () => {
|
|
105
|
+
const key = "a";
|
|
106
|
+
const owner1 = "b";
|
|
107
|
+
await lockAdapterA.acquire(key, owner1, null);
|
|
108
|
+
const owner2 = "c";
|
|
109
|
+
const result = await lockAdapterA.release(key, owner2);
|
|
110
|
+
expect(result).toBe(false);
|
|
111
|
+
});
|
|
112
|
+
test("Should be reacquirable by new owner after release", async () => {
|
|
113
|
+
const key = "a";
|
|
114
|
+
const owner1 = "b";
|
|
115
|
+
await lockAdapterA.acquire(key, owner1, null);
|
|
116
|
+
await lockAdapterA.release(key, owner1);
|
|
117
|
+
const owner2 = "c";
|
|
118
|
+
const result = await lockAdapterA.acquire(key, owner2, null);
|
|
119
|
+
expect(result).toBe(true);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
describe("method: forceRelease", () => {
|
|
123
|
+
test("Should be reacquirable by new owner after release", async () => {
|
|
124
|
+
const key = "a";
|
|
125
|
+
const owner1 = "b";
|
|
126
|
+
await lockAdapterA.acquire(key, owner1, null);
|
|
127
|
+
await lockAdapterA.forceRelease(key);
|
|
128
|
+
const owner2 = "c";
|
|
129
|
+
const result = await lockAdapterA.acquire(key, owner2, null);
|
|
130
|
+
expect(result).toBe(true);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
describe("method: refresh", () => {
|
|
134
|
+
test("Should return true when extended by same owner", async () => {
|
|
135
|
+
const key = "a";
|
|
136
|
+
const owner = "b";
|
|
137
|
+
await lockAdapterA.acquire(key, owner, ttl);
|
|
138
|
+
const result = await lockAdapterA.refresh(key, owner, ttl.multiply(2));
|
|
139
|
+
expect(result).toBe(true);
|
|
140
|
+
});
|
|
141
|
+
test("Should return false when extended by different owner", async () => {
|
|
142
|
+
const key = "a";
|
|
143
|
+
const owner1 = "b";
|
|
144
|
+
await lockAdapterA.acquire(key, owner1, ttl);
|
|
145
|
+
const owner2 = "c";
|
|
146
|
+
const result = await lockAdapterA.refresh(key, owner2, ttl.multiply(2));
|
|
147
|
+
expect(result).toBe(false);
|
|
153
148
|
});
|
|
154
149
|
});
|
|
155
150
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock-adapter.test-suite.js","sourceRoot":"","sources":["../../../../src/lock/implementations/test-utilities/lock-adapter.test-suite.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAKN,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAqB,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAmB,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"lock-adapter.test-suite.js","sourceRoot":"","sources":["../../../../src/lock/implementations/test-utilities/lock-adapter.test-suite.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAKN,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAqB,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAmB,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE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,EAAE,KAAK,IAAI,EAAE;YACpE,MAAM,GAAG,GAAG,GAAG,CAAC;YAChB,MAAM,MAAM,GAAG,GAAG,CAAC;YAEnB,MAAM,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;YAC7C,MAAM,MAAM,GAAG,GAAG,CAAC;YACnB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CACrC,GAAG,EACH,MAAM,EACN,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAClB,CAAC;YAEF,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { type Promisable } from "../../../utilities/_module-exports.js";
|
|
|
7
7
|
import type { ISerde } from "../../../serde/contracts/_module-exports.js";
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/
|
|
10
|
+
* IMPORT_PATH: ```"@daiso-tech/core/lock/test-utilities"```
|
|
11
11
|
* @group Utilities
|
|
12
12
|
*/
|
|
13
13
|
export type LockProviderTestSuiteSettings = {
|
|
@@ -21,40 +21,35 @@ export type LockProviderTestSuiteSettings = {
|
|
|
21
21
|
/**
|
|
22
22
|
* The <i>lockProviderTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ILock}</i> with <i>vitest</i>.
|
|
23
23
|
*
|
|
24
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/
|
|
24
|
+
* IMPORT_PATH: ```"@daiso-tech/core/lock/test-utilities"```
|
|
25
25
|
* @group Utilities
|
|
26
26
|
* @example
|
|
27
27
|
* ```ts
|
|
28
|
-
* import {
|
|
29
|
-
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/
|
|
30
|
-
* import { LockProvider } from "@daiso-tech/core/lock
|
|
31
|
-
* import { EventBus } from "@daiso-tech/core/event-bus
|
|
32
|
-
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/
|
|
33
|
-
* import { lockProviderTestSuite } from "@daiso-tech/core/lock/
|
|
34
|
-
* import { Serde } from "@daiso-tech/core/serde
|
|
35
|
-
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/
|
|
28
|
+
* import { describe, expect, test } from "vitest";
|
|
29
|
+
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
|
|
30
|
+
* import { LockProvider } from "@daiso-tech/core/lock";
|
|
31
|
+
* import { EventBus } from "@daiso-tech/core/event-bus";
|
|
32
|
+
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
33
|
+
* import { lockProviderTestSuite } from "@daiso-tech/core/lock/test-utilities";
|
|
34
|
+
* import { Serde } from "@daiso-tech/core/serde";
|
|
35
|
+
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
|
|
36
36
|
* import type { ILockData } from "@daiso-tech/core/lock/contracts";
|
|
37
|
+
* import { KeyPrefixer } from "@daiso-tech/core/utilities";
|
|
37
38
|
*
|
|
38
39
|
* describe("class: LockProvider", () => {
|
|
39
40
|
* const eventBus = new EventBus({
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* }),
|
|
41
|
+
* keyPrefixer: new KeyPrefixer("event-bus"),
|
|
42
|
+
* adapter: new MemoryEventBusAdapter(),
|
|
43
43
|
* });
|
|
44
44
|
* const serde = new Serde(new SuperJsonSerdeAdapter());
|
|
45
45
|
* let map: Map<string, ILockData>;
|
|
46
|
-
* beforeEach(() => {
|
|
47
|
-
* map = new Map();
|
|
48
|
-
* });
|
|
49
46
|
* lockProviderTestSuite({
|
|
50
47
|
* createLockProvider: () => {
|
|
51
48
|
* const lockProvider = new LockProvider({
|
|
52
49
|
* serde,
|
|
53
|
-
* adapter: new MemoryLockAdapter(
|
|
54
|
-
* rootGroup: "@a",
|
|
55
|
-
* map,
|
|
56
|
-
* }),
|
|
50
|
+
* adapter: new MemoryLockAdapter(),
|
|
57
51
|
* eventBus,
|
|
52
|
+
* keyPrefixer: new KeyPrefixer("lock"),
|
|
58
53
|
* });
|
|
59
54
|
* return lockProvider;
|
|
60
55
|
* },
|