@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
|
@@ -11,7 +11,8 @@ AbortAsyncError,
|
|
|
11
11
|
TimeoutAsyncError,
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
13
|
RetryAsyncError, } from "../../../async/async.errors.js";
|
|
14
|
-
import { resolveAsyncLazyable, } from "../../../utilities/_module-exports.js";
|
|
14
|
+
import { removeUndefinedProperties, resolveAsyncLazyable, } from "../../../utilities/_module-exports.js";
|
|
15
|
+
import { delay } from "../../../async/utilities/_module.js";
|
|
15
16
|
/**
|
|
16
17
|
* The <i>LazyPromise</i> class is used for creating lazy <i>{@link PromiseLike}<i> object that will only execute when awaited or when then method is called.
|
|
17
18
|
* The class includes helpful methods
|
|
@@ -38,20 +39,38 @@ export class LazyPromise {
|
|
|
38
39
|
* The <i>wrapFn</i> is convience method used for wrapping a async method with a <i>LazyPromise</i>.
|
|
39
40
|
* @example
|
|
40
41
|
* ```ts
|
|
41
|
-
* import { LazyPromise
|
|
42
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
43
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
42
44
|
* import { readFile as readFileNodeJs } from "node:fs/promises";
|
|
43
45
|
*
|
|
44
|
-
* const readFile = LazyPromise.wrapFn(readFileNodeJs
|
|
45
|
-
* retryAttempts: 3
|
|
46
|
-
* });
|
|
46
|
+
* const readFile = LazyPromise.wrapFn(readFileNodeJs);
|
|
47
47
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* const file = await readFile("none_existing_file.txt")
|
|
49
|
+
* .setRetryAttempts(4)
|
|
50
|
+
* .timeout(TimeSpan.fromMinutes(1));
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
static wrapFn(fn) {
|
|
54
|
-
return (...parameters) => new LazyPromise(() => fn(...parameters));
|
|
53
|
+
static wrapFn(fn, settings) {
|
|
54
|
+
return (...parameters) => new LazyPromise(() => fn(...parameters), settings);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The <i>delay</i> method creates a <i>{@link LazyPromise}</i> that will be fulfilled after given <i>time</i>.
|
|
58
|
+
*
|
|
59
|
+
* @throws {AsyncError} {@link AsyncError}
|
|
60
|
+
* @throws {AbortAsyncError} {@link AbortAsyncError}
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
64
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
65
|
+
*
|
|
66
|
+
* console.log("a");
|
|
67
|
+
* await LazyPromise.delay(TimeSpan.fromSeconds(2));
|
|
68
|
+
* console.log("b");
|
|
69
|
+
*/
|
|
70
|
+
static delay(time) {
|
|
71
|
+
return new LazyPromise(async () => {
|
|
72
|
+
await delay(time);
|
|
73
|
+
});
|
|
55
74
|
}
|
|
56
75
|
/**
|
|
57
76
|
* The <i>all<i> method works similarly to <i>{@link Promise.all}</i> with the key distinction that it operates lazily.
|
|
@@ -78,71 +97,95 @@ export class LazyPromise {
|
|
|
78
97
|
return new LazyPromise(async () => Promise.any(promises));
|
|
79
98
|
}
|
|
80
99
|
promise = null;
|
|
81
|
-
attempts = null;
|
|
82
|
-
backoffPolicy_ = null;
|
|
83
|
-
retryPolicy_ = null;
|
|
84
|
-
abortSignal = null;
|
|
85
|
-
time = null;
|
|
86
100
|
asyncFn;
|
|
101
|
+
settings;
|
|
87
102
|
/**
|
|
88
103
|
* @example
|
|
89
104
|
* ```ts
|
|
90
|
-
* import { LazyPromise } from "@daiso-tech/core";
|
|
105
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
91
106
|
*
|
|
92
|
-
* (async () => {
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* })();
|
|
107
|
+
* const promise = new LazyPromise(async () => {
|
|
108
|
+
* console.log("I am lazy");
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* // "I am lazy" will only logged when awaited or then method i called.
|
|
112
|
+
* await promise;
|
|
99
113
|
*/
|
|
100
|
-
constructor(asyncFn) {
|
|
114
|
+
constructor(asyncFn, settings = {}) {
|
|
101
115
|
this.asyncFn = () => resolveAsyncLazyable(asyncFn);
|
|
116
|
+
this.settings = removeUndefinedProperties({
|
|
117
|
+
retryAttempts: null,
|
|
118
|
+
backoffPolicy: null,
|
|
119
|
+
retryPolicy: null,
|
|
120
|
+
retryTimeout: null,
|
|
121
|
+
totalTimeout: null,
|
|
122
|
+
abortSignal: null,
|
|
123
|
+
onFinally: () => { },
|
|
124
|
+
onSuccess: (_value) => { },
|
|
125
|
+
onError: () => { },
|
|
126
|
+
...settings,
|
|
127
|
+
});
|
|
102
128
|
}
|
|
103
|
-
|
|
104
|
-
if (this.
|
|
105
|
-
|
|
106
|
-
const newAsyncFn = () => {
|
|
107
|
-
if (this.time === null) {
|
|
108
|
-
throw new Error(`LazyPromise["time"] field is null`);
|
|
109
|
-
}
|
|
110
|
-
return timeoutAndFail(oldAsyncFn, this.time);
|
|
111
|
-
};
|
|
112
|
-
this.asyncFn = newAsyncFn;
|
|
129
|
+
applyRetryTimeout() {
|
|
130
|
+
if (this.settings.retryTimeout === null) {
|
|
131
|
+
return;
|
|
113
132
|
}
|
|
133
|
+
const oldAsyncFn = this.asyncFn;
|
|
134
|
+
const newAsyncFn = () => {
|
|
135
|
+
if (this.settings.retryTimeout === null) {
|
|
136
|
+
throw new Error(`LazyPromise["time"] field is null`);
|
|
137
|
+
}
|
|
138
|
+
return timeoutAndFail(oldAsyncFn, this.settings.retryTimeout);
|
|
139
|
+
};
|
|
140
|
+
this.asyncFn = newAsyncFn;
|
|
114
141
|
}
|
|
115
142
|
applyRetry() {
|
|
116
|
-
if (this.
|
|
117
|
-
|
|
118
|
-
const newAsyncFn = () => {
|
|
119
|
-
if (this.attempts === null) {
|
|
120
|
-
throw new Error(`LazyPromise["attempts"] field is null`);
|
|
121
|
-
}
|
|
122
|
-
return retryOrFail(oldAsyncFn, {
|
|
123
|
-
backoffPolicy: this.backoffPolicy_ ?? undefined,
|
|
124
|
-
retryPolicy: this.retryPolicy_ ?? undefined,
|
|
125
|
-
maxAttempts: this.attempts,
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
this.asyncFn = newAsyncFn;
|
|
143
|
+
if (this.settings.retryAttempts === null) {
|
|
144
|
+
return;
|
|
129
145
|
}
|
|
146
|
+
this.applyRetryTimeout();
|
|
147
|
+
const oldAsyncFn = this.asyncFn;
|
|
148
|
+
const newAsyncFn = () => {
|
|
149
|
+
if (this.settings.retryAttempts === null) {
|
|
150
|
+
throw new Error(`LazyPromise["attempts"] field is null`);
|
|
151
|
+
}
|
|
152
|
+
return retryOrFail(oldAsyncFn, {
|
|
153
|
+
backoffPolicy: this.settings.backoffPolicy ?? undefined,
|
|
154
|
+
retryPolicy: this.settings.retryPolicy ?? undefined,
|
|
155
|
+
maxAttempts: this.settings.retryAttempts,
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
this.asyncFn = newAsyncFn;
|
|
159
|
+
}
|
|
160
|
+
applyTotalTimeout() {
|
|
161
|
+
if (this.settings.totalTimeout === null) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const oldAsyncFn = this.asyncFn;
|
|
165
|
+
const newAsyncFn = () => {
|
|
166
|
+
if (this.settings.totalTimeout === null) {
|
|
167
|
+
throw new Error(`LazyPromise["time"] field is null`);
|
|
168
|
+
}
|
|
169
|
+
return timeoutAndFail(oldAsyncFn, this.settings.totalTimeout);
|
|
170
|
+
};
|
|
171
|
+
this.asyncFn = newAsyncFn;
|
|
130
172
|
}
|
|
131
173
|
applyAbort() {
|
|
132
|
-
if (this.abortSignal
|
|
133
|
-
|
|
134
|
-
const newAsyncFn = () => {
|
|
135
|
-
if (this.abortSignal === null) {
|
|
136
|
-
throw new Error(`LazyPromise["abortSignal"] field is null`);
|
|
137
|
-
}
|
|
138
|
-
return abortAndFail(oldAsyncFn, this.abortSignal);
|
|
139
|
-
};
|
|
140
|
-
this.asyncFn = newAsyncFn;
|
|
174
|
+
if (this.settings.abortSignal === null) {
|
|
175
|
+
return;
|
|
141
176
|
}
|
|
177
|
+
const oldAsyncFn = this.asyncFn;
|
|
178
|
+
const newAsyncFn = () => {
|
|
179
|
+
if (this.settings.abortSignal === null) {
|
|
180
|
+
throw new Error(`LazyPromise["abortSignal"] field is null`);
|
|
181
|
+
}
|
|
182
|
+
return abortAndFail(oldAsyncFn, this.settings.abortSignal);
|
|
183
|
+
};
|
|
184
|
+
this.asyncFn = newAsyncFn;
|
|
142
185
|
}
|
|
143
186
|
applySettings() {
|
|
144
|
-
this.applyTimeout();
|
|
145
187
|
this.applyRetry();
|
|
188
|
+
this.applyTotalTimeout();
|
|
146
189
|
this.applyAbort();
|
|
147
190
|
}
|
|
148
191
|
/**
|
|
@@ -161,10 +204,10 @@ export class LazyPromise {
|
|
|
161
204
|
return this.promise.then(onfulfilled, onrejected);
|
|
162
205
|
}
|
|
163
206
|
/**
|
|
164
|
-
* The <i>
|
|
165
|
-
* @example
|
|
207
|
+
* The <i>setBackoffPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
|
|
166
208
|
* ```ts
|
|
167
|
-
* import { LazyPromise } from "@daiso-tech/core";
|
|
209
|
+
* import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core/async";
|
|
210
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
168
211
|
*
|
|
169
212
|
* const promise =
|
|
170
213
|
* new LazyPromise(async () => {
|
|
@@ -172,21 +215,23 @@ export class LazyPromise {
|
|
|
172
215
|
* throw new Error("Error occured!");
|
|
173
216
|
* })
|
|
174
217
|
* .setRetryAttempts(3)
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
218
|
+
* .setBackoffPolicy(linearBackoffPolicy())
|
|
219
|
+
*
|
|
220
|
+
* // Will log "A" 3 times and then retry error will be thrown.
|
|
221
|
+
* await promise;
|
|
179
222
|
* ```
|
|
180
223
|
*/
|
|
181
|
-
|
|
182
|
-
this.
|
|
183
|
-
|
|
224
|
+
setBackoffPolicy(policy) {
|
|
225
|
+
return new LazyPromise(this.asyncFn, {
|
|
226
|
+
...this.settings,
|
|
227
|
+
backoffPolicy: policy,
|
|
228
|
+
});
|
|
184
229
|
}
|
|
185
230
|
/**
|
|
186
|
-
* The <i>
|
|
231
|
+
* The <i>setRetryAttempts</i> method is used for setting max retry attempts.
|
|
187
232
|
* @example
|
|
188
233
|
* ```ts
|
|
189
|
-
* import { LazyPromise
|
|
234
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
190
235
|
*
|
|
191
236
|
* const promise =
|
|
192
237
|
* new LazyPromise(async () => {
|
|
@@ -194,22 +239,22 @@ export class LazyPromise {
|
|
|
194
239
|
* throw new Error("Error occured!");
|
|
195
240
|
* })
|
|
196
241
|
* .setRetryAttempts(3)
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* await promise;
|
|
201
|
-
* })();
|
|
242
|
+
*
|
|
243
|
+
* // Will log "A" 3 times and then retry error will be thrown.
|
|
244
|
+
* await promise;
|
|
202
245
|
* ```
|
|
203
246
|
*/
|
|
204
|
-
|
|
205
|
-
this.
|
|
206
|
-
|
|
247
|
+
setRetryAttempts(attempts) {
|
|
248
|
+
return new LazyPromise(this.asyncFn, {
|
|
249
|
+
...this.settings,
|
|
250
|
+
retryAttempts: attempts,
|
|
251
|
+
});
|
|
207
252
|
}
|
|
208
253
|
/**
|
|
209
254
|
* The <i>setRetryPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
|
|
210
255
|
* @example
|
|
211
256
|
* ```ts
|
|
212
|
-
* import { LazyPromise } from "@daiso-tech/core";
|
|
257
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
213
258
|
*
|
|
214
259
|
* class ErrorA extends Error {}
|
|
215
260
|
*
|
|
@@ -221,113 +266,149 @@ export class LazyPromise {
|
|
|
221
266
|
* .setRetryAttempts(3)
|
|
222
267
|
* // Will only retry an error that is instance ErrorA
|
|
223
268
|
* .setRetryPolicy(error => error instanceof ErrorA)
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* })();
|
|
269
|
+
*
|
|
270
|
+
* // Will log "A" 1 time and then error will be thrown.
|
|
271
|
+
* await promise;
|
|
228
272
|
* ```
|
|
229
273
|
*/
|
|
230
274
|
setRetryPolicy(policy) {
|
|
231
|
-
this.
|
|
232
|
-
|
|
275
|
+
return new LazyPromise(this.asyncFn, {
|
|
276
|
+
...this.settings,
|
|
277
|
+
retryPolicy: policy,
|
|
278
|
+
});
|
|
233
279
|
}
|
|
234
280
|
/**
|
|
235
|
-
* The <i>
|
|
281
|
+
* The <i>setRetryTimeout</i> method aborts the each retry if it exceeds the given <i>time</i>.
|
|
236
282
|
* @example
|
|
237
283
|
* ```ts
|
|
238
|
-
* import { LazyPromise
|
|
284
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
285
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
239
286
|
*
|
|
240
287
|
* const promise =
|
|
241
288
|
* new LazyPromise(async () => {
|
|
242
|
-
* await delay(TimeSpan.fromMinutes(1));
|
|
289
|
+
* await LazyPromise.delay(TimeSpan.fromMinutes(1));
|
|
243
290
|
* })
|
|
244
|
-
* .
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* })();
|
|
291
|
+
* .setRetryTimeout(TimeSpan.fromSeconds(1));
|
|
292
|
+
*
|
|
293
|
+
* // An timeout error will be thrown.
|
|
294
|
+
* await promise;
|
|
249
295
|
* ```
|
|
250
296
|
*/
|
|
251
|
-
|
|
252
|
-
this.
|
|
253
|
-
|
|
297
|
+
setRetryTimeout(time) {
|
|
298
|
+
return new LazyPromise(this.asyncFn, {
|
|
299
|
+
...this.settings,
|
|
300
|
+
retryTimeout: time,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* The <i>setTotalTimeout</i> method aborts the <i>LazyPromise</i> if it exceeds the given <i>time</i> by throwning an error.
|
|
305
|
+
* @example
|
|
306
|
+
* ```ts
|
|
307
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
308
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
309
|
+
*
|
|
310
|
+
* const promise =
|
|
311
|
+
* new LazyPromise(async () => {
|
|
312
|
+
* await LazyPromise.delay(TimeSpan.fromMinutes(1));
|
|
313
|
+
* })
|
|
314
|
+
* .setRetryTimeout(TimeSpan.fromSeconds(1));
|
|
315
|
+
*
|
|
316
|
+
* // An timeout error will be thrown.
|
|
317
|
+
* await promise;
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
setTotalTimeout(time) {
|
|
321
|
+
return new LazyPromise(this.asyncFn, {
|
|
322
|
+
...this.settings,
|
|
323
|
+
totalTimeout: time,
|
|
324
|
+
});
|
|
254
325
|
}
|
|
255
326
|
/**
|
|
256
327
|
* The <i>setAbortSignal</i> method aborts the <i>LazyPromise</i> by the passed in <i>abortSignal</i>.
|
|
257
328
|
* @example
|
|
258
329
|
* ```ts
|
|
259
|
-
* import { LazyPromise
|
|
330
|
+
* import { LazyPromise } from "@daiso-tech/core";
|
|
331
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
260
332
|
*
|
|
261
333
|
* const abortController = new AbortController();
|
|
262
334
|
* const promise =
|
|
263
335
|
* new LazyPromise(async () => {
|
|
264
|
-
* await delay(TimeSpan.fromMinutes(1));
|
|
336
|
+
* await LazyPromise.delay(TimeSpan.fromMinutes(1));
|
|
265
337
|
* })
|
|
266
338
|
* .setAbortSignal(abortController.signal);
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
339
|
+
*
|
|
340
|
+
* setTimeout(() => {
|
|
341
|
+
* abortController.abort();
|
|
342
|
+
* }, 1000);
|
|
343
|
+
*
|
|
344
|
+
* // An timeout error will be thrown.
|
|
345
|
+
* await promise;
|
|
274
346
|
* ```
|
|
275
347
|
*/
|
|
276
348
|
setAbortSignal(abortSignal) {
|
|
277
|
-
this.
|
|
278
|
-
|
|
349
|
+
return new LazyPromise(this.asyncFn, {
|
|
350
|
+
...this.settings,
|
|
351
|
+
abortSignal,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
onFinally(cb) {
|
|
355
|
+
return new LazyPromise(this.asyncFn, {
|
|
356
|
+
...this.settings,
|
|
357
|
+
onFinally: cb,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
onSuccess(cb) {
|
|
361
|
+
return new LazyPromise(this.asyncFn, {
|
|
362
|
+
...this.settings,
|
|
363
|
+
onSuccess: cb,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
onError(cb) {
|
|
367
|
+
return new LazyPromise(this.asyncFn, {
|
|
368
|
+
...this.settings,
|
|
369
|
+
onError: cb,
|
|
370
|
+
});
|
|
279
371
|
}
|
|
280
372
|
/**
|
|
281
373
|
* The <i>defer</i> method executes the <i>LazyPromise</i> without awaiting it.
|
|
282
374
|
* @example
|
|
283
375
|
* ```ts
|
|
284
|
-
* import { LazyPromise
|
|
376
|
+
* import { LazyPromise } from "@daiso-tech/core";
|
|
377
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
285
378
|
*
|
|
286
379
|
* const promise =
|
|
287
380
|
* new LazyPromise(async () => {
|
|
288
|
-
* await delay(TimeSpan.fromSeconds(1));
|
|
381
|
+
* await LazyPromise.delay(TimeSpan.fromSeconds(1));
|
|
289
382
|
* // Will be loged after one second
|
|
290
383
|
* console.log("Done !");
|
|
291
384
|
* });
|
|
385
|
+
*
|
|
292
386
|
* promise.defer();
|
|
387
|
+
*
|
|
293
388
|
* // Will be logged immediately
|
|
294
389
|
* console.log("Hello");
|
|
390
|
+
* await LazyPromise.delay(TimeSpan.fromSeconds(2));
|
|
295
391
|
* ```
|
|
296
392
|
*/
|
|
297
|
-
defer(
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (onError || onFinally) {
|
|
317
|
-
onErrorHandler = async (error) => {
|
|
318
|
-
try {
|
|
319
|
-
if (onError !== undefined) {
|
|
320
|
-
await onError(error);
|
|
321
|
-
}
|
|
322
|
-
return error;
|
|
323
|
-
}
|
|
324
|
-
finally {
|
|
325
|
-
if (onFinally !== undefined) {
|
|
326
|
-
await onFinally();
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
}
|
|
393
|
+
defer() {
|
|
394
|
+
const onSuccesHandler = async (value) => {
|
|
395
|
+
try {
|
|
396
|
+
await this.settings.onSuccess(value);
|
|
397
|
+
return value;
|
|
398
|
+
}
|
|
399
|
+
finally {
|
|
400
|
+
await this.settings.onFinally();
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
const onErrorHandler = async (error) => {
|
|
404
|
+
try {
|
|
405
|
+
await this.settings.onError(error);
|
|
406
|
+
return error;
|
|
407
|
+
}
|
|
408
|
+
finally {
|
|
409
|
+
await this.settings.onFinally();
|
|
410
|
+
}
|
|
411
|
+
};
|
|
331
412
|
this.then(onSuccesHandler, onErrorHandler);
|
|
332
413
|
}
|
|
333
414
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-promise.js","sourceRoot":"","sources":["../../../../src/async/utilities/lazy-promise/lazy-promise.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO;AACH,6DAA6D;AAC7D,eAAe;AACf,6DAA6D;AAC7D,iBAAiB;AACjB,6DAA6D;AAC7D,eAAe,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,oBAAoB,GAEvB,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"lazy-promise.js","sourceRoot":"","sources":["../../../../src/async/utilities/lazy-promise/lazy-prom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C;IACP,CAAC;IAED,OAAO,CAAC,EAAsB;QAC1B,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE;YACjC,GAAG,IAAI,CAAC,QAAQ;YAChB,OAAO,EAAE,EAAE;SACd,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK;QACD,MAAM,eAAe,GAAG,KAAK,EAAE,KAAa,EAAmB,EAAE;YAC7D,IAAI,CAAC;gBACD,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACrC,OAAO,KAAK,CAAC;YACjB,CAAC;oBAAS,CAAC;gBACP,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACpC,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,cAAc,GAAG,KAAK,EAAE,KAAc,EAAoB,EAAE;YAC9D,IAAI,CAAC;gBACD,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACnC,OAAO,KAAK,CAAC;YACjB,CAAC;oBAAS,CAAC;gBACP,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACpC,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;CACJ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Async
|
|
3
3
|
*/
|
|
4
|
+
import { TimeSpan } from "../../../utilities/_module-exports.js";
|
|
4
5
|
import type { BackoffPolicy } from "../../../async/backof-policies/_module.js";
|
|
5
6
|
/**
|
|
6
7
|
*
|
|
@@ -20,6 +21,7 @@ export type RetrySettings = {
|
|
|
20
21
|
maxAttempts?: number;
|
|
21
22
|
backoffPolicy?: BackoffPolicy;
|
|
22
23
|
retryPolicy?: RetryPolicy;
|
|
24
|
+
timeout?: TimeSpan | null;
|
|
23
25
|
};
|
|
24
26
|
/**
|
|
25
27
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-or-fail.js","sourceRoot":"","sources":["../../../../src/async/utilities/retry/retry-or-fail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"retry-or-fail.js","sourceRoot":"","sources":["../../../../src/async/utilities/retry/retry-or-fail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAyB1D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC7B,OAAkC,EAClC,WAA0B,EAAE;IAE5B,MAAM,EACF,WAAW,GAAG,CAAC,EACf,aAAa,GAAG,wBAAwB,EAAE,EAC1C,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,GAC3B,GAAG,QAAQ,CAAC;IACb,IAAI,MAAe,CAAC;IACpB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;QACtD,IAAI,CAAC;YACD,OAAO,MAAM,OAAO,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,MAAM,GAAG,KAAK,CAAC;YACf,IAAI,KAAK,YAAY,eAAe,EAAE,CAAC;gBACnC,MAAM,KAAK,CAAC;YAChB,CAAC;YACD,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtB,MAAM,KAAK,CAAC;YAChB,CAAC;YACD,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC3C,MAAM,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;IAED,IAAI,YAAY,GAAG,oCAAoC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;IACnF,IAAI,MAAM,EAAE,CAAC;QACT,YAAY,GAAG,GAAG,YAAY,+BAA+B,MAAM,CAAC,MAAiB,CAAC,GAAG,CAAC;IAC9F,CAAC;IACD,MAAM,IAAI,eAAe,CAAC,YAAY,EAAE;QACpC,KAAK,EAAE,MAAM;QACb,WAAW;KACd,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -3,3 +3,4 @@ export * from "../../cache/contracts/cache-factory.contract.js";
|
|
|
3
3
|
export * from "../../cache/contracts/cache.contract.js";
|
|
4
4
|
export * from "../../cache/contracts/cache.errors.js";
|
|
5
5
|
export * from "../../cache/contracts/cache.events.js";
|
|
6
|
+
export * from "../../cache/contracts/database-cache-adapter.contract.js";
|
|
@@ -3,4 +3,5 @@ export * from "../../cache/contracts/cache-factory.contract.js";
|
|
|
3
3
|
export * from "../../cache/contracts/cache.contract.js";
|
|
4
4
|
export * from "../../cache/contracts/cache.errors.js";
|
|
5
5
|
export * from "../../cache/contracts/cache.events.js";
|
|
6
|
+
export * from "../../cache/contracts/database-cache-adapter.contract.js";
|
|
6
7
|
//# sourceMappingURL=_module-exports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../../src/cache/contracts/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../../src/cache/contracts/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sDAAsD,CAAC"}
|
|
@@ -3,54 +3,52 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { TimeSpan } from "../../utilities/_module-exports.js";
|
|
5
5
|
/**
|
|
6
|
-
* The <i>ICacheAdapter</i> contract defines a way for
|
|
7
|
-
* This contract is not meant to be used directly, instead you should use <i>{@link ICache}</i> contract.
|
|
6
|
+
* The <i>ICacheAdapter</i> contract defines a way for key-value pairs independent of data storage.
|
|
8
7
|
*
|
|
9
8
|
* IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
|
|
10
9
|
* @group Contracts
|
|
11
10
|
*/
|
|
12
11
|
export type ICacheAdapter<TType = unknown> = {
|
|
13
12
|
/**
|
|
14
|
-
* The <i>get</i> returns the <i>key</i>
|
|
13
|
+
* The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
15
14
|
*/
|
|
16
15
|
get(key: string): PromiseLike<TType | null>;
|
|
17
16
|
/**
|
|
18
|
-
* The <i>
|
|
19
|
-
*
|
|
17
|
+
* The <i>getAndRemove</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
18
|
+
* The key will be removed after it is returned.
|
|
20
19
|
*/
|
|
21
|
-
|
|
20
|
+
getAndRemove(key: string): PromiseLike<TType | null>;
|
|
22
21
|
/**
|
|
23
|
-
* The <i>
|
|
22
|
+
* 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.
|
|
23
|
+
* You can provide a <i>ttl</i> value. If null is passed, the item will not expire.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
add(key: string, value: TType, ttl: TimeSpan | null): PromiseLike<boolean>;
|
|
26
26
|
/**
|
|
27
|
-
* The <i>put</i> method replaces
|
|
27
|
+
* 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 othwerwise it will add the given <i>value</i> and <i>ttl</i>.
|
|
28
28
|
* Returns true if the <i>key</i> where replaced otherwise false is returned.
|
|
29
|
-
* You must provide a <i>ttl</i> value. If null is passed, the item will not expire.
|
|
30
29
|
*/
|
|
31
30
|
put(key: string, value: TType, ttl: TimeSpan | null): PromiseLike<boolean>;
|
|
32
31
|
/**
|
|
33
|
-
* The <i>
|
|
32
|
+
* The <i>update</i> method updates the given <i>key</i> with given <i>value</i>. Returns true if the <i>key</i> where updated otherwise false will be returned.
|
|
34
33
|
*/
|
|
35
|
-
|
|
34
|
+
update(key: string, value: TType): PromiseLike<boolean>;
|
|
36
35
|
/**
|
|
37
|
-
* The <i>increment</i> method
|
|
38
|
-
*
|
|
36
|
+
* The <i>increment</i> method increments the given <i>key</i> with given <i>value</i>. Returns true if the <i>key</i> where incremented otherwise false will be returned.
|
|
37
|
+
* If <i>values</i> is not defined then it will increment the key with 1.
|
|
39
38
|
* An error will thrown if the key is not a number.
|
|
40
39
|
* @throws {TypeCacheError} {@link TypeCacheError}
|
|
41
40
|
*/
|
|
42
41
|
increment(key: string, value: number): PromiseLike<boolean>;
|
|
43
42
|
/**
|
|
44
|
-
* The <i>
|
|
43
|
+
* The <i>removeMany</i> method removes many keys. Returns true if one of the keys where deleted otherwise false is returned.
|
|
45
44
|
*/
|
|
46
|
-
|
|
45
|
+
removeMany(keys: string[]): PromiseLike<boolean>;
|
|
47
46
|
/**
|
|
48
|
-
* The <i>
|
|
47
|
+
* The <i>removeAll</i> method removes all keys from the cache.
|
|
49
48
|
*/
|
|
50
|
-
|
|
49
|
+
removeAll(): PromiseLike<void>;
|
|
51
50
|
/**
|
|
52
|
-
* The <i>
|
|
53
|
-
* Only keys in the same group will be updated, removed, or retrieved, leaving keys outside the group unaffected.
|
|
51
|
+
* The <i>removeByKeyPrefix</i> method removes all the keys in the cache that starts with the given <i>prefix</i>.
|
|
54
52
|
*/
|
|
55
|
-
|
|
53
|
+
removeByKeyPrefix(prefix: string): PromiseLike<void>;
|
|
56
54
|
};
|