@daiso-tech/core 0.26.0 → 0.27.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 +10 -0
- 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 +99 -65
- package/dist/async/utilities/lazy-promise/lazy-promise.js +151 -111
- package/dist/async/utilities/lazy-promise/lazy-promise.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 +52 -88
- 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/_module-exports.d.ts +0 -1
- package/dist/cache/implementations/adapters/_module-exports.js +0 -1
- package/dist/cache/implementations/adapters/_module-exports.js.map +1 -1
- 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/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 -40
- 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 +122 -565
- package/dist/cache/implementations/derivables/cache/cache.js +342 -854
- 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 +65 -104
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +101 -85
- 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 +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +6 -5
- 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 +1 -3
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +1 -7
- 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 +78 -267
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +119 -323
- 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 +70 -96
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +100 -90
- 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 +1 -1
- 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/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/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 +12 -17
- 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.d.ts +9 -0
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js +17 -0
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js.map +1 -0
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +115 -372
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +197 -455
- 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 +30 -754
- package/dist/lock/implementations/derivables/lock-provider/lock.js +94 -812
- 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 +58 -161
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +116 -122
- 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 +133 -137
- 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 +2 -2
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +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 +1 -2
- package/dist/utilities/_module-exports.js +1 -2
- 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/contracts/_module.d.ts +2 -1
- package/dist/utilities/contracts/_module.js +2 -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/functions.d.ts +30 -2
- package/dist/utilities/functions.js +66 -4
- package/dist/utilities/functions.js.map +1 -1
- package/dist/utilities/types.d.ts +47 -14
- 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/cache/implementations/adapters/no-op-cache-adapter/_module.d.ts +0 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js +0 -2
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js.map +0 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +0 -22
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +0 -39
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.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,6 +12,7 @@ TimeoutAsyncError,
|
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
13
|
RetryAsyncError, } from "../../../async/async.errors.js";
|
|
14
14
|
import { 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,64 +97,70 @@ 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 = {
|
|
117
|
+
retryAttempts: null,
|
|
118
|
+
backoffPolicy: null,
|
|
119
|
+
retryPolicy: null,
|
|
120
|
+
abortSignal: null,
|
|
121
|
+
timeout: null,
|
|
122
|
+
onFinally: () => { },
|
|
123
|
+
onSuccess: (_value) => { },
|
|
124
|
+
onError: () => { },
|
|
125
|
+
...settings,
|
|
126
|
+
};
|
|
102
127
|
}
|
|
103
128
|
applyTimeout() {
|
|
104
|
-
if (this.
|
|
129
|
+
if (this.settings.timeout !== null) {
|
|
105
130
|
const oldAsyncFn = this.asyncFn;
|
|
106
131
|
const newAsyncFn = () => {
|
|
107
|
-
if (this.
|
|
132
|
+
if (this.settings.timeout === null) {
|
|
108
133
|
throw new Error(`LazyPromise["time"] field is null`);
|
|
109
134
|
}
|
|
110
|
-
return timeoutAndFail(oldAsyncFn, this.
|
|
135
|
+
return timeoutAndFail(oldAsyncFn, this.settings.timeout);
|
|
111
136
|
};
|
|
112
137
|
this.asyncFn = newAsyncFn;
|
|
113
138
|
}
|
|
114
139
|
}
|
|
115
140
|
applyRetry() {
|
|
116
|
-
if (this.
|
|
141
|
+
if (this.settings.retryAttempts !== null) {
|
|
117
142
|
const oldAsyncFn = this.asyncFn;
|
|
118
143
|
const newAsyncFn = () => {
|
|
119
|
-
if (this.
|
|
144
|
+
if (this.settings.retryAttempts === null) {
|
|
120
145
|
throw new Error(`LazyPromise["attempts"] field is null`);
|
|
121
146
|
}
|
|
122
147
|
return retryOrFail(oldAsyncFn, {
|
|
123
|
-
backoffPolicy: this.
|
|
124
|
-
retryPolicy: this.
|
|
125
|
-
maxAttempts: this.
|
|
148
|
+
backoffPolicy: this.settings.backoffPolicy ?? undefined,
|
|
149
|
+
retryPolicy: this.settings.retryPolicy ?? undefined,
|
|
150
|
+
maxAttempts: this.settings.retryAttempts,
|
|
126
151
|
});
|
|
127
152
|
};
|
|
128
153
|
this.asyncFn = newAsyncFn;
|
|
129
154
|
}
|
|
130
155
|
}
|
|
131
156
|
applyAbort() {
|
|
132
|
-
if (this.abortSignal !== null) {
|
|
157
|
+
if (this.settings.abortSignal !== null) {
|
|
133
158
|
const oldAsyncFn = this.asyncFn;
|
|
134
159
|
const newAsyncFn = () => {
|
|
135
|
-
if (this.abortSignal === null) {
|
|
160
|
+
if (this.settings.abortSignal === null) {
|
|
136
161
|
throw new Error(`LazyPromise["abortSignal"] field is null`);
|
|
137
162
|
}
|
|
138
|
-
return abortAndFail(oldAsyncFn, this.abortSignal);
|
|
163
|
+
return abortAndFail(oldAsyncFn, this.settings.abortSignal);
|
|
139
164
|
};
|
|
140
165
|
this.asyncFn = newAsyncFn;
|
|
141
166
|
}
|
|
@@ -164,7 +189,7 @@ export class LazyPromise {
|
|
|
164
189
|
* The <i>setRetryAttempts</i> method is used for setting max retry attempts.
|
|
165
190
|
* @example
|
|
166
191
|
* ```ts
|
|
167
|
-
* import { LazyPromise } from "@daiso-tech/core";
|
|
192
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
168
193
|
*
|
|
169
194
|
* const promise =
|
|
170
195
|
* new LazyPromise(async () => {
|
|
@@ -172,21 +197,22 @@ export class LazyPromise {
|
|
|
172
197
|
* throw new Error("Error occured!");
|
|
173
198
|
* })
|
|
174
199
|
* .setRetryAttempts(3)
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* })();
|
|
200
|
+
*
|
|
201
|
+
* // Will log "A" 3 times and then retry error will be thrown.
|
|
202
|
+
* await promise;
|
|
179
203
|
* ```
|
|
180
204
|
*/
|
|
181
205
|
setRetryAttempts(attempts) {
|
|
182
|
-
this.
|
|
183
|
-
|
|
206
|
+
return new LazyPromise(this.asyncFn, {
|
|
207
|
+
...this.settings,
|
|
208
|
+
retryAttempts: attempts,
|
|
209
|
+
});
|
|
184
210
|
}
|
|
185
211
|
/**
|
|
186
212
|
* The <i>setBackoffPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
|
|
187
|
-
* @example
|
|
188
213
|
* ```ts
|
|
189
|
-
* import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core";
|
|
214
|
+
* import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core/async";
|
|
215
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
190
216
|
*
|
|
191
217
|
* const promise =
|
|
192
218
|
* new LazyPromise(async () => {
|
|
@@ -195,21 +221,22 @@ export class LazyPromise {
|
|
|
195
221
|
* })
|
|
196
222
|
* .setRetryAttempts(3)
|
|
197
223
|
* .setBackoffPolicy(linearBackoffPolicy())
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* })();
|
|
224
|
+
*
|
|
225
|
+
* // Will log "A" 3 times and then retry error will be thrown.
|
|
226
|
+
* await promise;
|
|
202
227
|
* ```
|
|
203
228
|
*/
|
|
204
229
|
setBackoffPolicy(policy) {
|
|
205
|
-
this.
|
|
206
|
-
|
|
230
|
+
return new LazyPromise(this.asyncFn, {
|
|
231
|
+
...this.settings,
|
|
232
|
+
backoffPolicy: policy,
|
|
233
|
+
});
|
|
207
234
|
}
|
|
208
235
|
/**
|
|
209
236
|
* The <i>setRetryPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
|
|
210
237
|
* @example
|
|
211
238
|
* ```ts
|
|
212
|
-
* import { LazyPromise } from "@daiso-tech/core";
|
|
239
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
213
240
|
*
|
|
214
241
|
* class ErrorA extends Error {}
|
|
215
242
|
*
|
|
@@ -221,113 +248,126 @@ export class LazyPromise {
|
|
|
221
248
|
* .setRetryAttempts(3)
|
|
222
249
|
* // Will only retry an error that is instance ErrorA
|
|
223
250
|
* .setRetryPolicy(error => error instanceof ErrorA)
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* })();
|
|
251
|
+
*
|
|
252
|
+
* // Will log "A" 1 time and then error will be thrown.
|
|
253
|
+
* await promise;
|
|
228
254
|
* ```
|
|
229
255
|
*/
|
|
230
256
|
setRetryPolicy(policy) {
|
|
231
|
-
this.
|
|
232
|
-
|
|
257
|
+
return new LazyPromise(this.asyncFn, {
|
|
258
|
+
...this.settings,
|
|
259
|
+
retryPolicy: policy,
|
|
260
|
+
});
|
|
233
261
|
}
|
|
234
262
|
/**
|
|
235
263
|
* The <i>setTimeout</i> method aborts the <i>LazyPromise</i> if it exceeds the given <i>time</i> by throwning an error.
|
|
236
264
|
* @example
|
|
237
265
|
* ```ts
|
|
238
|
-
* import { LazyPromise
|
|
266
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
267
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
239
268
|
*
|
|
240
269
|
* const promise =
|
|
241
270
|
* new LazyPromise(async () => {
|
|
242
|
-
* await delay(TimeSpan.fromMinutes(1));
|
|
271
|
+
* await LazyPromise.delay(TimeSpan.fromMinutes(1));
|
|
243
272
|
* })
|
|
244
273
|
* .setTimeout(TimeSpan.fromSeconds(1));
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* })();
|
|
274
|
+
*
|
|
275
|
+
* // An timeout error will be thrown.
|
|
276
|
+
* await promise;
|
|
249
277
|
* ```
|
|
250
278
|
*/
|
|
251
279
|
setTimeout(time) {
|
|
252
|
-
this.
|
|
253
|
-
|
|
280
|
+
return new LazyPromise(this.asyncFn, {
|
|
281
|
+
...this.settings,
|
|
282
|
+
timeout: time,
|
|
283
|
+
});
|
|
254
284
|
}
|
|
255
285
|
/**
|
|
256
286
|
* The <i>setAbortSignal</i> method aborts the <i>LazyPromise</i> by the passed in <i>abortSignal</i>.
|
|
257
287
|
* @example
|
|
258
288
|
* ```ts
|
|
259
|
-
* import { LazyPromise
|
|
289
|
+
* import { LazyPromise } from "@daiso-tech/core";
|
|
290
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
260
291
|
*
|
|
261
292
|
* const abortController = new AbortController();
|
|
262
293
|
* const promise =
|
|
263
294
|
* new LazyPromise(async () => {
|
|
264
|
-
* await delay(TimeSpan.fromMinutes(1));
|
|
295
|
+
* await LazyPromise.delay(TimeSpan.fromMinutes(1));
|
|
265
296
|
* })
|
|
266
297
|
* .setAbortSignal(abortController.signal);
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
298
|
+
*
|
|
299
|
+
* setTimeout(() => {
|
|
300
|
+
* abortController.abort();
|
|
301
|
+
* }, 1000);
|
|
302
|
+
*
|
|
303
|
+
* // An timeout error will be thrown.
|
|
304
|
+
* await promise;
|
|
274
305
|
* ```
|
|
275
306
|
*/
|
|
276
307
|
setAbortSignal(abortSignal) {
|
|
277
|
-
this.
|
|
278
|
-
|
|
308
|
+
return new LazyPromise(this.asyncFn, {
|
|
309
|
+
...this.settings,
|
|
310
|
+
abortSignal,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
onFinally(cb) {
|
|
314
|
+
return new LazyPromise(this.asyncFn, {
|
|
315
|
+
...this.settings,
|
|
316
|
+
onFinally: cb,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
onSuccess(cb) {
|
|
320
|
+
return new LazyPromise(this.asyncFn, {
|
|
321
|
+
...this.settings,
|
|
322
|
+
onSuccess: cb,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
onError(cb) {
|
|
326
|
+
return new LazyPromise(this.asyncFn, {
|
|
327
|
+
...this.settings,
|
|
328
|
+
onError: cb,
|
|
329
|
+
});
|
|
279
330
|
}
|
|
280
331
|
/**
|
|
281
332
|
* The <i>defer</i> method executes the <i>LazyPromise</i> without awaiting it.
|
|
282
333
|
* @example
|
|
283
334
|
* ```ts
|
|
284
|
-
* import { LazyPromise
|
|
335
|
+
* import { LazyPromise } from "@daiso-tech/core";
|
|
336
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
285
337
|
*
|
|
286
338
|
* const promise =
|
|
287
339
|
* new LazyPromise(async () => {
|
|
288
|
-
* await delay(TimeSpan.fromSeconds(1));
|
|
340
|
+
* await LazyPromise.delay(TimeSpan.fromSeconds(1));
|
|
289
341
|
* // Will be loged after one second
|
|
290
342
|
* console.log("Done !");
|
|
291
343
|
* });
|
|
344
|
+
*
|
|
292
345
|
* promise.defer();
|
|
346
|
+
*
|
|
293
347
|
* // Will be logged immediately
|
|
294
348
|
* console.log("Hello");
|
|
349
|
+
* await LazyPromise.delay(TimeSpan.fromSeconds(2));
|
|
295
350
|
* ```
|
|
296
351
|
*/
|
|
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
|
-
}
|
|
352
|
+
defer() {
|
|
353
|
+
const onSuccesHandler = async (value) => {
|
|
354
|
+
try {
|
|
355
|
+
await this.settings.onSuccess(value);
|
|
356
|
+
return value;
|
|
357
|
+
}
|
|
358
|
+
finally {
|
|
359
|
+
await this.settings.onFinally();
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
const onErrorHandler = async (error) => {
|
|
363
|
+
try {
|
|
364
|
+
await this.settings.onError(error);
|
|
365
|
+
return error;
|
|
366
|
+
}
|
|
367
|
+
finally {
|
|
368
|
+
await this.settings.onFinally();
|
|
369
|
+
}
|
|
370
|
+
};
|
|
331
371
|
this.then(onSuccesHandler, onErrorHandler);
|
|
332
372
|
}
|
|
333
373
|
}
|
|
@@ -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-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,o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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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-adapter.contract.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache-adapter.contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache-adapter.contract.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache-adapter.contract.ts"],"names":[],"mappings":""}
|
|
@@ -11,7 +11,7 @@ import type { IGroupableCache } from "../../cache/contracts/cache.contract.js";
|
|
|
11
11
|
export type ICacheFactory<TAdapters extends string = string> = {
|
|
12
12
|
/**
|
|
13
13
|
* The <i>use</i> method will throw an error if you provide it unregisted adapter.
|
|
14
|
-
* If no default adapter is defined an error will be thrown
|
|
14
|
+
* If no default adapter is defined an error will be thrown.
|
|
15
15
|
* @throws {UnregisteredAdapterError} {@link UnregisteredAdapterError}
|
|
16
16
|
* @throws {DefaultAdapterNotDefinedError} {@link DefaultAdapterNotDefinedError}
|
|
17
17
|
*/
|