@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
|
@@ -12,51 +12,33 @@ declare module "ioredis" {
|
|
|
12
12
|
daiso_lock_refresh(key: string, owner: string, ttl: string): Result<number, Context>;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/implementations/adapters"```
|
|
18
|
-
* @group Adapters
|
|
19
|
-
*/
|
|
20
|
-
export type RedisLockAdapterSettings = {
|
|
21
|
-
database: Redis;
|
|
22
|
-
rootGroup: string;
|
|
23
|
-
};
|
|
24
15
|
/**
|
|
25
16
|
* To utilize the <i>RedisLockAdapter</i>, you must install the <i>"ioredis"</i> package.
|
|
26
17
|
*
|
|
27
18
|
* Note in order to use <i>RedisLockAdapter</i> correctly, ensure you use a single, consistent database across all server instances.
|
|
28
19
|
*
|
|
29
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/
|
|
20
|
+
* IMPORT_PATH: ```"@daiso-tech/core/lock/adapters"```
|
|
30
21
|
* @group Adapters
|
|
31
22
|
*/
|
|
32
23
|
export declare class RedisLockAdapter implements ILockAdapter {
|
|
33
|
-
private readonly group;
|
|
34
24
|
private readonly database;
|
|
35
25
|
/**
|
|
36
26
|
* @example
|
|
37
27
|
* ```ts
|
|
38
|
-
* import { RedisLockAdapter, SuperJsonSerde } from "@daiso-tech/core/lock/
|
|
28
|
+
* import { RedisLockAdapter, SuperJsonSerde } from "@daiso-tech/core/lock/adapters";
|
|
39
29
|
* import Redis from "ioredis";
|
|
40
30
|
*
|
|
41
31
|
* const database = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
42
32
|
* const serde = new SuperJsonSerde();
|
|
43
|
-
* const lockAdapter = new RedisLockAdapter(
|
|
44
|
-
* database,
|
|
45
|
-
* serde,
|
|
46
|
-
* rootGroup: "@global"
|
|
47
|
-
* });
|
|
33
|
+
* const lockAdapter = new RedisLockAdapter(database);
|
|
48
34
|
* ```
|
|
49
35
|
*/
|
|
50
|
-
constructor(
|
|
36
|
+
constructor(database: Redis);
|
|
51
37
|
private initAquireCommand;
|
|
52
38
|
private initReleaseCommand;
|
|
53
39
|
private initRefreshComand;
|
|
54
|
-
private getPrefix;
|
|
55
|
-
private withPrefix;
|
|
56
40
|
acquire(key: string, owner: string, ttl: TimeSpan | null): Promise<boolean>;
|
|
57
41
|
release(key: string, owner: string): Promise<boolean>;
|
|
58
42
|
forceRelease(key: string): Promise<void>;
|
|
59
43
|
refresh(key: string, owner: string, ttl: TimeSpan): Promise<boolean>;
|
|
60
|
-
getGroup(): string;
|
|
61
|
-
withGroup(group: string): ILockAdapter;
|
|
62
44
|
}
|
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Lock
|
|
3
3
|
*/
|
|
4
|
-
import { resolveOneOrMoreStr } from "../../../../utilities/_module-exports.js";
|
|
5
4
|
/**
|
|
6
5
|
* To utilize the <i>RedisLockAdapter</i>, you must install the <i>"ioredis"</i> package.
|
|
7
6
|
*
|
|
8
7
|
* Note in order to use <i>RedisLockAdapter</i> correctly, ensure you use a single, consistent database across all server instances.
|
|
9
8
|
*
|
|
10
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/
|
|
9
|
+
* IMPORT_PATH: ```"@daiso-tech/core/lock/adapters"```
|
|
11
10
|
* @group Adapters
|
|
12
11
|
*/
|
|
13
12
|
export class RedisLockAdapter {
|
|
14
|
-
group;
|
|
15
13
|
database;
|
|
16
14
|
/**
|
|
17
15
|
* @example
|
|
18
16
|
* ```ts
|
|
19
|
-
* import { RedisLockAdapter, SuperJsonSerde } from "@daiso-tech/core/lock/
|
|
17
|
+
* import { RedisLockAdapter, SuperJsonSerde } from "@daiso-tech/core/lock/adapters";
|
|
20
18
|
* import Redis from "ioredis";
|
|
21
19
|
*
|
|
22
20
|
* const database = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
23
21
|
* const serde = new SuperJsonSerde();
|
|
24
|
-
* const lockAdapter = new RedisLockAdapter(
|
|
25
|
-
* database,
|
|
26
|
-
* serde,
|
|
27
|
-
* rootGroup: "@global"
|
|
28
|
-
* });
|
|
22
|
+
* const lockAdapter = new RedisLockAdapter(database);
|
|
29
23
|
* ```
|
|
30
24
|
*/
|
|
31
|
-
constructor(
|
|
32
|
-
const { database, rootGroup } = settings;
|
|
25
|
+
constructor(database) {
|
|
33
26
|
this.database = database;
|
|
34
|
-
this.group = rootGroup;
|
|
35
27
|
this.initAquireCommand();
|
|
36
28
|
this.initReleaseCommand();
|
|
37
29
|
this.initRefreshComand();
|
|
@@ -102,39 +94,20 @@ export class RedisLockAdapter {
|
|
|
102
94
|
`,
|
|
103
95
|
});
|
|
104
96
|
}
|
|
105
|
-
getPrefix() {
|
|
106
|
-
return resolveOneOrMoreStr([this.group, "__KEY__"]);
|
|
107
|
-
}
|
|
108
|
-
withPrefix(key) {
|
|
109
|
-
return resolveOneOrMoreStr([this.getPrefix(), key]);
|
|
110
|
-
}
|
|
111
97
|
async acquire(key, owner, ttl) {
|
|
112
|
-
key = this.withPrefix(key);
|
|
113
98
|
const result = await this.database.daiso_lock_acquire(key, owner, String(ttl?.toMilliseconds() ?? null));
|
|
114
99
|
return result > 0;
|
|
115
100
|
}
|
|
116
101
|
async release(key, owner) {
|
|
117
|
-
key = this.withPrefix(key);
|
|
118
102
|
const result = await this.database.daiso_lock_release(key, owner);
|
|
119
103
|
return result === 1;
|
|
120
104
|
}
|
|
121
105
|
async forceRelease(key) {
|
|
122
|
-
key = this.withPrefix(key);
|
|
123
106
|
await this.database.del(key);
|
|
124
107
|
}
|
|
125
108
|
async refresh(key, owner, ttl) {
|
|
126
|
-
key = this.withPrefix(key);
|
|
127
109
|
const result = await this.database.daiso_lock_refresh(key, owner, ttl.toMilliseconds().toString());
|
|
128
110
|
return Boolean(result);
|
|
129
111
|
}
|
|
130
|
-
getGroup() {
|
|
131
|
-
return this.group;
|
|
132
|
-
}
|
|
133
|
-
withGroup(group) {
|
|
134
|
-
return new RedisLockAdapter({
|
|
135
|
-
database: this.database,
|
|
136
|
-
rootGroup: resolveOneOrMoreStr([this.group, group]),
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
112
|
}
|
|
140
113
|
//# sourceMappingURL=redis-lock-adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"redis-lock-adapter.js","sourceRoot":"","sources":["../../../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AkB,CACjD,GAAG,EACH,KAAK,EACL,MAAM,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,IAAI,CAAC,CACxC,CAAC;QACF,OAAO,MAAM,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAa;QACpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClE,OAAO,MAAM,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW;QAC1B,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAa,EAAE,GAAa;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CACjD,GAAG,EACH,KAAK,EACL,GAAG,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,CAClC,CAAC;QACF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;CACJ"}
|
|
@@ -2,19 +2,17 @@
|
|
|
2
2
|
* @module Lock
|
|
3
3
|
*/
|
|
4
4
|
import type { IDatabaseLockAdapter, ILockData } from "../../../../lock/contracts/_module-exports.js";
|
|
5
|
-
import { type IDeinitizable, type IInitizable, TimeSpan } from "../../../../utilities/_module-exports.js";
|
|
6
|
-
import type { SqliteDatabase } from "kysely";
|
|
5
|
+
import { type IDeinitizable, type IInitizable, type ISqliteDatabase, TimeSpan } from "../../../../utilities/_module-exports.js";
|
|
7
6
|
/**
|
|
8
7
|
*
|
|
9
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/
|
|
8
|
+
* IMPORT_PATH: ```"@daiso-tech/core/lock/adapters"```
|
|
10
9
|
* @group Adapters
|
|
11
10
|
*/
|
|
12
11
|
export type SqliteLockAdapterSettings = {
|
|
13
|
-
database:
|
|
12
|
+
database: ISqliteDatabase;
|
|
14
13
|
tableName?: string;
|
|
15
14
|
expiredKeysRemovalInterval?: TimeSpan;
|
|
16
15
|
shouldRemoveExpiredKeys?: boolean;
|
|
17
|
-
rootGroup: string;
|
|
18
16
|
};
|
|
19
17
|
/**
|
|
20
18
|
* To utilize the <i>SqliteLockAdapter</i>, you must install the <i>"better-sqlite3"</i> and <i>"@types/better-sqlite3"</i> packages.
|
|
@@ -22,7 +20,7 @@ export type SqliteLockAdapterSettings = {
|
|
|
22
20
|
* Note the <i>SqliteLockAdapter</i> is limited to single server usage and cannot be shared across multiple servers but it can be shared between different processes.
|
|
23
21
|
* To use it correctly, ensure all process instances access the same consistent, persisted database.
|
|
24
22
|
*
|
|
25
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/
|
|
23
|
+
* IMPORT_PATH: ```"@daiso-tech/core/lock/adapters"```
|
|
26
24
|
* @group Adapters
|
|
27
25
|
*/
|
|
28
26
|
export declare class SqliteLockAdapter implements IDatabaseLockAdapter, IDeinitizable, IInitizable {
|
|
@@ -30,28 +28,26 @@ export declare class SqliteLockAdapter implements IDatabaseLockAdapter, IDeiniti
|
|
|
30
28
|
/**
|
|
31
29
|
* @example
|
|
32
30
|
* ```ts
|
|
33
|
-
* import { SqliteLockAdapter } from "@daiso-tech/core/lock/
|
|
31
|
+
* import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
|
|
34
32
|
* import Sqlite from "better-sqlite3";
|
|
35
33
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* await lockAdapter.init();
|
|
43
|
-
* })();
|
|
34
|
+
* const database = new Sqlite("local.db");
|
|
35
|
+
* const lockAdapter = new SqliteLockAdapter({
|
|
36
|
+
* database,
|
|
37
|
+
* });
|
|
38
|
+
* // You need initialize the adapter once before using it.
|
|
39
|
+
* await lockAdapter.init();
|
|
44
40
|
* ```
|
|
45
41
|
*/
|
|
46
42
|
constructor(settings: SqliteLockAdapterSettings);
|
|
47
43
|
removeExpiredKeys(): Promise<void>;
|
|
48
44
|
/**
|
|
49
|
-
* Removes the table where the
|
|
50
|
-
* Note all
|
|
45
|
+
* Removes the table where the lock keys are stored and removes the table indexes.
|
|
46
|
+
* Note all lock data will be removed.
|
|
51
47
|
*/
|
|
52
48
|
deInit(): Promise<void>;
|
|
53
49
|
/**
|
|
54
|
-
* Creates the table where the
|
|
50
|
+
* Creates the table where the lock keys are stored and it's related indexes.
|
|
55
51
|
* Note the <i>init</i> method needs to be called before using the adapter.
|
|
56
52
|
*/
|
|
57
53
|
init(): Promise<void>;
|
|
@@ -60,6 +56,4 @@ export declare class SqliteLockAdapter implements IDatabaseLockAdapter, IDeiniti
|
|
|
60
56
|
remove(key: string, owner: string | null): Promise<void>;
|
|
61
57
|
refresh(key: string, owner: string, expiration: Date): Promise<number>;
|
|
62
58
|
find(key: string): Promise<ILockData | null>;
|
|
63
|
-
getGroup(): string;
|
|
64
|
-
withGroup(group: string): IDatabaseLockAdapter;
|
|
65
59
|
}
|
|
@@ -11,7 +11,7 @@ import { KyselyTableNameTransformerPlugin } from "../../../../utilities/_module-
|
|
|
11
11
|
* Note the <i>SqliteLockAdapter</i> is limited to single server usage and cannot be shared across multiple servers but it can be shared between different processes.
|
|
12
12
|
* To use it correctly, ensure all process instances access the same consistent, persisted database.
|
|
13
13
|
*
|
|
14
|
-
* IMPORT_PATH: ```"@daiso-tech/core/lock/
|
|
14
|
+
* IMPORT_PATH: ```"@daiso-tech/core/lock/adapters"```
|
|
15
15
|
* @group Adapters
|
|
16
16
|
*/
|
|
17
17
|
export class SqliteLockAdapter {
|
|
@@ -19,21 +19,19 @@ export class SqliteLockAdapter {
|
|
|
19
19
|
/**
|
|
20
20
|
* @example
|
|
21
21
|
* ```ts
|
|
22
|
-
* import { SqliteLockAdapter } from "@daiso-tech/core/lock/
|
|
22
|
+
* import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
|
|
23
23
|
* import Sqlite from "better-sqlite3";
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* await lockAdapter.init();
|
|
32
|
-
* })();
|
|
25
|
+
* const database = new Sqlite("local.db");
|
|
26
|
+
* const lockAdapter = new SqliteLockAdapter({
|
|
27
|
+
* database,
|
|
28
|
+
* });
|
|
29
|
+
* // You need initialize the adapter once before using it.
|
|
30
|
+
* await lockAdapter.init();
|
|
33
31
|
* ```
|
|
34
32
|
*/
|
|
35
33
|
constructor(settings) {
|
|
36
|
-
const { database, tableName = "lock", shouldRemoveExpiredKeys = true, expiredKeysRemovalInterval = TimeSpan.fromMinutes(1),
|
|
34
|
+
const { database, tableName = "lock", shouldRemoveExpiredKeys = true, expiredKeysRemovalInterval = TimeSpan.fromMinutes(1), } = settings;
|
|
37
35
|
this.databaseLockAdapter = new KyselyLockAdapter({
|
|
38
36
|
database: new Kysely({
|
|
39
37
|
dialect: new SqliteDialect({
|
|
@@ -45,7 +43,6 @@ export class SqliteLockAdapter {
|
|
|
45
43
|
}),
|
|
46
44
|
],
|
|
47
45
|
}),
|
|
48
|
-
rootGroup,
|
|
49
46
|
expiredKeysRemovalInterval,
|
|
50
47
|
shouldRemoveExpiredKeys,
|
|
51
48
|
});
|
|
@@ -54,14 +51,14 @@ export class SqliteLockAdapter {
|
|
|
54
51
|
await this.databaseLockAdapter.removeExpiredKeys();
|
|
55
52
|
}
|
|
56
53
|
/**
|
|
57
|
-
* Removes the table where the
|
|
58
|
-
* Note all
|
|
54
|
+
* Removes the table where the lock keys are stored and removes the table indexes.
|
|
55
|
+
* Note all lock data will be removed.
|
|
59
56
|
*/
|
|
60
57
|
async deInit() {
|
|
61
58
|
await this.databaseLockAdapter.deInit();
|
|
62
59
|
}
|
|
63
60
|
/**
|
|
64
|
-
* Creates the table where the
|
|
61
|
+
* Creates the table where the lock keys are stored and it's related indexes.
|
|
65
62
|
* Note the <i>init</i> method needs to be called before using the adapter.
|
|
66
63
|
*/
|
|
67
64
|
async init() {
|
|
@@ -82,11 +79,5 @@ export class SqliteLockAdapter {
|
|
|
82
79
|
async find(key) {
|
|
83
80
|
return await this.databaseLockAdapter.find(key);
|
|
84
81
|
}
|
|
85
|
-
getGroup() {
|
|
86
|
-
return this.databaseLockAdapter.getGroup();
|
|
87
|
-
}
|
|
88
|
-
withGroup(group) {
|
|
89
|
-
return this.databaseLockAdapter.withGroup(group);
|
|
90
|
-
}
|
|
91
82
|
}
|
|
92
83
|
//# sourceMappingURL=sqlite-lock-adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,
|
|
1
|
+
{"version":3,"file":"sqlite-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAIH,QAAQ,GACX,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gEAAgE,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAclF;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IAGlB,mBAAmB,CAAoB;IAE/C;;;;;;;;;;;;;OAaG;IACH,YAAY,QAAmC;QAC3C,MAAM,EACF,QAAQ,EACR,SAAS,GAAG,MAAM,EAClB,uBAAuB,GAAG,IAAI,EAC9B,0BAA0B,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,GACvD,GAAG,QAAQ,CAAC;QAE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AAK,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAW;QAClB,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;CACJ"}
|
|
@@ -13,6 +13,4 @@ export declare class DatabaseLockAdapter implements ILockAdapter {
|
|
|
13
13
|
release(key: string, owner: string): Promise<boolean>;
|
|
14
14
|
forceRelease(key: string): Promise<void>;
|
|
15
15
|
refresh(key: string, owner: string, ttl: TimeSpan): Promise<boolean>;
|
|
16
|
-
getGroup(): string;
|
|
17
|
-
withGroup(group: string): ILockAdapter;
|
|
18
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Lock
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { UnexpectedLockError } from "../../../../lock/contracts/_module-exports.js";
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
@@ -17,7 +17,7 @@ export class DatabaseLockAdapter {
|
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
19
19
|
catch (error) {
|
|
20
|
-
if (error instanceof
|
|
20
|
+
if (error instanceof UnexpectedLockError) {
|
|
21
21
|
throw error;
|
|
22
22
|
}
|
|
23
23
|
const result = await this.adapter.update(key, owner, expiration);
|
|
@@ -40,11 +40,5 @@ export class DatabaseLockAdapter {
|
|
|
40
40
|
const result = await this.adapter.refresh(key, owner, ttl.toEndDate());
|
|
41
41
|
return result > 0;
|
|
42
42
|
}
|
|
43
|
-
getGroup() {
|
|
44
|
-
return this.adapter.getGroup();
|
|
45
|
-
}
|
|
46
|
-
withGroup(group) {
|
|
47
|
-
return new DatabaseLockAdapter(this.adapter.withGroup(group));
|
|
48
|
-
}
|
|
49
43
|
}
|
|
50
44
|
//# sourceMappingURL=database-lock-adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/database-lock-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"database-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/database-lock-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAM1E;;GAEG;AACH,MAAM,OAAO,mBAAmB;IACC;IAA7B,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IAE9D,KAAK,CAAC,OAAO,CACT,GAAW,EACX,KAAa,EACb,GAAoB;QAEpB,MAAM,UAAU,GAAG,GAAG,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC;QAE5C,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC;QAChB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;gBACvC,MAAM,KAAK,CAAC;YAChB,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;YACjE,OAAO,MAAM,GAAG,CAAC,CAAC;QACtB,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAa;QACpC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;QACrC,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW;QAC1B,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAa,EAAE,GAAa;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;QACvE,OAAO,MAAM,GAAG,CAAC,CAAC;IACtB,CAAC;CACJ"}
|
|
@@ -12,10 +12,6 @@ export function isDatabaseLockAdapter(adapter) {
|
|
|
12
12
|
typeof adapter_["refresh"] === "function" &&
|
|
13
13
|
adapter_["refresh"].length === 3 &&
|
|
14
14
|
typeof adapter_["find"] === "function" &&
|
|
15
|
-
adapter_["find"].length === 1
|
|
16
|
-
typeof adapter_["getGroup"] === "function" &&
|
|
17
|
-
adapter_["getGroup"].length === 0 &&
|
|
18
|
-
typeof adapter_["withGroup"] === "function" &&
|
|
19
|
-
adapter_["withGroup"].length === 1);
|
|
15
|
+
adapter_["find"].length === 1);
|
|
20
16
|
}
|
|
21
17
|
//# sourceMappingURL=is-database-lock-adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-database-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/is-database-lock-adapter.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACjC,OAA4C;IAE5C,MAAM,QAAQ,GAAG,OAEhB,CAAC;IACF,OAAO,CACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,KAAK,UAAU;QACxC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;QAC/B,OAAO,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