@daiso-tech/core 0.13.0 → 0.15.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/dist/cjs/_module.js +1 -0
- package/dist/cjs/_module.js.map +1 -1
- package/dist/cjs/async/_module.js +20 -0
- package/dist/cjs/async/_module.js.map +1 -0
- package/dist/cjs/{utilities/async/_shared.js → async/async.errors.js} +1 -1
- package/dist/cjs/async/async.errors.js.map +1 -0
- package/dist/cjs/{utilities → async}/backof-policies/_module.js +4 -4
- package/dist/cjs/async/backof-policies/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/_shared.js.map +1 -0
- package/dist/cjs/{utilities/async/delay-iterable → async/backof-policies/constant-backoff-policy}/_module.js +1 -1
- package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/{utilities → async}/backof-policies/constant-backoff-policy/constant-backoff-policy.js +1 -1
- package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/{utilities → async}/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +1 -1
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/cjs/{utilities/async/abortable → async/backof-policies/linear-backoff-policy}/_module.js +1 -1
- package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/{utilities → async}/backof-policies/linear-backoff-policy/linear-backoff-policy.js +1 -1
- package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
- package/dist/cjs/{utilities/async/abortable-iterable → async/backof-policies/polynomial-backoff-policy}/_module.js +1 -1
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/{utilities → async}/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +1 -1
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/cjs/{event-bus/implementations/_shared/test-utilities → async/utilities}/_module.js +2 -1
- package/dist/cjs/async/utilities/_module.js.map +1 -0
- package/dist/cjs/async/utilities/abort/_module.js +19 -0
- package/dist/cjs/async/utilities/abort/_module.js.map +1 -0
- package/dist/cjs/async/utilities/abort/abort-and-fail.js +45 -0
- package/dist/cjs/async/utilities/abort/abort-and-fail.js.map +1 -0
- package/dist/cjs/async/utilities/abort/abort.js +18 -0
- package/dist/cjs/async/utilities/abort/abort.js.map +1 -0
- package/dist/cjs/{utilities/async/retry → async/utilities/delay}/_module.js +1 -1
- package/dist/cjs/async/utilities/delay/_module.js.map +1 -0
- package/dist/cjs/async/utilities/delay/delay.js +20 -0
- package/dist/cjs/async/utilities/delay/delay.js.map +1 -0
- package/dist/cjs/{utilities/async → async/utilities}/lazy-promise/_module.js +1 -1
- package/dist/cjs/async/utilities/lazy-promise/_module.js.map +1 -0
- package/dist/cjs/async/utilities/lazy-promise/lazy-promise.js +95 -0
- package/dist/cjs/async/utilities/lazy-promise/lazy-promise.js.map +1 -0
- package/dist/cjs/{utilities/async/delay → async/utilities/retry}/_module.js +2 -1
- package/dist/cjs/async/utilities/retry/_module.js.map +1 -0
- package/dist/cjs/async/utilities/retry/retry-or-fail.js +36 -0
- package/dist/cjs/async/utilities/retry/retry-or-fail.js.map +1 -0
- package/dist/cjs/async/utilities/retry/retry.js +18 -0
- package/dist/cjs/async/utilities/retry/retry.js.map +1 -0
- package/dist/cjs/{utilities/async → async/utilities}/timeout/_module.js +2 -1
- package/dist/cjs/async/utilities/timeout/_module.js.map +1 -0
- package/dist/cjs/async/utilities/timeout/timeout-and-fail.js +25 -0
- package/dist/cjs/async/utilities/timeout/timeout-and-fail.js.map +1 -0
- package/dist/cjs/async/utilities/timeout/timeout.js +18 -0
- package/dist/cjs/async/utilities/timeout/timeout.js.map +1 -0
- package/dist/cjs/cache/contracts/cache.events.js +0 -11
- package/dist/cjs/cache/contracts/cache.events.js.map +1 -1
- package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js +12 -11
- package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js +36 -35
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/_module.js +1 -0
- package/dist/cjs/cache/implementations/adapters/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +3 -3
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +1 -1
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/no-op-cache-adapter/_module.js +18 -0
- package/dist/cjs/cache/implementations/adapters/no-op-cache-adapter/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +28 -0
- package/dist/cjs/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +1 -1
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +3 -3
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/base-cache.js +46 -38
- package/dist/cjs/cache/implementations/derivables/base-cache.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory.js +3 -3
- package/dist/cjs/cache/implementations/derivables/cache-factory.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache.js +21 -23
- package/dist/cjs/cache/implementations/derivables/cache.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/_module.js +4 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +27 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +1 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +33 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +1 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +36 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +1 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +48 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +1 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js +48 -39
- package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js +5 -5
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/list-collection/list-collection.js +5 -5
- package/dist/cjs/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/cjs/event-bus/contracts/event-bus.errors.js +3 -3
- package/dist/cjs/event-bus/contracts/event-bus.errors.js.map +1 -1
- package/dist/cjs/event-bus/implementations/_module.js +1 -1
- package/dist/cjs/event-bus/implementations/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/_shared/_module.js +19 -0
- package/dist/cjs/event-bus/implementations/_shared/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/_shared/{test-utilities/event-bus-adapter.test-suite.js → event-bus-adapter.test-suite.js} +4 -3
- package/dist/cjs/event-bus/implementations/_shared/event-bus-adapter.test-suite.js.map +1 -0
- package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.js +299 -0
- package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -0
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js +2 -3
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/base-event-bus.js +47 -0
- package/dist/cjs/event-bus/implementations/derivables/base-event-bus.js.map +1 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js +3 -9
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js +20 -55
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/cjs/utilities/_module.js +5 -4
- package/dist/cjs/utilities/_module.js.map +1 -1
- package/dist/cjs/utilities/contracts/_module.js +19 -0
- package/dist/cjs/utilities/contracts/_module.js.map +1 -0
- package/dist/cjs/utilities/contracts/deinitizable.contract.js +3 -0
- package/dist/cjs/utilities/contracts/deinitizable.contract.js.map +1 -0
- package/dist/cjs/utilities/contracts/initizable.contract.js +3 -0
- package/dist/cjs/utilities/contracts/initizable.contract.js.map +1 -0
- package/dist/cjs/utilities/{global-errors.js → errors.js} +1 -1
- package/dist/cjs/utilities/errors.js.map +1 -0
- package/dist/cjs/{_shared/utilities.js → utilities/functions.js} +1 -1
- package/dist/cjs/utilities/functions.js.map +1 -0
- package/dist/cjs/{_shared → utilities}/kysely/_module.js +1 -1
- package/dist/cjs/utilities/kysely/_module.js.map +1 -0
- package/dist/cjs/utilities/kysely/kysely-table-name-transformer-plugin.js.map +1 -0
- package/dist/cjs/{_shared → utilities}/types.js.map +1 -1
- package/dist/esm/_module.js +1 -0
- package/dist/esm/_module.js.map +1 -1
- package/dist/esm/async/_module.js +4 -0
- package/dist/esm/async/_module.js.map +1 -0
- package/dist/esm/{utilities/async/_shared.js → async/async.errors.js} +1 -1
- package/dist/esm/async/async.errors.js.map +1 -0
- package/dist/esm/async/backof-policies/_module.js +5 -0
- package/dist/esm/async/backof-policies/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/_shared.js.map +1 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/esm/{utilities → async}/backof-policies/constant-backoff-policy/constant-backoff-policy.js +1 -1
- package/dist/esm/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
- package/dist/esm/{utilities → async}/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +1 -1
- package/dist/esm/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/esm/{utilities → async}/backof-policies/linear-backoff-policy/linear-backoff-policy.js +1 -1
- package/dist/esm/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
- package/dist/esm/{utilities → async}/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +1 -1
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/esm/async/utilities/_module.js +3 -0
- package/dist/esm/async/utilities/_module.js.map +1 -0
- package/dist/esm/async/utilities/abort/_module.js +3 -0
- package/dist/esm/async/utilities/abort/_module.js.map +1 -0
- package/dist/esm/{utilities/async/abortable/abortable.js → async/utilities/abort/abort-and-fail.js} +13 -16
- package/dist/esm/async/utilities/abort/abort-and-fail.js.map +1 -0
- package/dist/esm/async/utilities/abort/abort.js +15 -0
- package/dist/esm/async/utilities/abort/abort.js.map +1 -0
- package/dist/esm/async/utilities/delay/_module.js +2 -0
- package/dist/esm/async/utilities/delay/_module.js.map +1 -0
- package/dist/esm/async/utilities/delay/delay.js +17 -0
- package/dist/esm/async/utilities/delay/delay.js.map +1 -0
- package/dist/esm/async/utilities/lazy-promise/_module.js +2 -0
- package/dist/esm/async/utilities/lazy-promise/_module.js.map +1 -0
- package/dist/esm/async/utilities/lazy-promise/lazy-promise.js +91 -0
- package/dist/esm/async/utilities/lazy-promise/lazy-promise.js.map +1 -0
- package/dist/esm/async/utilities/retry/_module.js +3 -0
- package/dist/esm/async/utilities/retry/_module.js.map +1 -0
- package/dist/esm/async/utilities/retry/retry-or-fail.js +33 -0
- package/dist/esm/async/utilities/retry/retry-or-fail.js.map +1 -0
- package/dist/esm/async/utilities/retry/retry.js +15 -0
- package/dist/esm/async/utilities/retry/retry.js.map +1 -0
- package/dist/esm/async/utilities/timeout/_module.js +3 -0
- package/dist/esm/async/utilities/timeout/_module.js.map +1 -0
- package/dist/esm/async/utilities/timeout/timeout-and-fail.js +22 -0
- package/dist/esm/async/utilities/timeout/timeout-and-fail.js.map +1 -0
- package/dist/esm/async/utilities/timeout/timeout.js +15 -0
- package/dist/esm/async/utilities/timeout/timeout.js.map +1 -0
- package/dist/esm/cache/contracts/cache.events.js +0 -10
- package/dist/esm/cache/contracts/cache.events.js.map +1 -1
- package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js +2 -1
- package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js +2 -1
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/_module.js +1 -0
- package/dist/esm/cache/implementations/adapters/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +4 -4
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +2 -2
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/no-op-cache-adapter/_module.js +2 -0
- package/dist/esm/cache/implementations/adapters/no-op-cache-adapter/_module.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +24 -0
- package/dist/esm/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +2 -2
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +3 -3
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/base-cache.js +37 -29
- package/dist/esm/cache/implementations/derivables/base-cache.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-factory.js +1 -1
- package/dist/esm/cache/implementations/derivables/cache-factory.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache.js +16 -18
- package/dist/esm/cache/implementations/derivables/cache.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/_module.js +4 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +23 -0
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +1 -0
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +29 -0
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +1 -0
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +32 -0
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +1 -0
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +44 -0
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +1 -0
- package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js +46 -37
- package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js +1 -1
- package/dist/esm/collection/implementations/list-collection/list-collection.js +1 -1
- package/dist/esm/event-bus/contracts/event-bus.errors.js +3 -3
- package/dist/esm/event-bus/contracts/event-bus.errors.js.map +1 -1
- package/dist/esm/event-bus/implementations/_module.js +1 -1
- package/dist/esm/event-bus/implementations/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/_shared/_module.js +3 -0
- package/dist/esm/event-bus/implementations/_shared/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/_shared/{test-utilities/event-bus-adapter.test-suite.js → event-bus-adapter.test-suite.js} +2 -1
- package/dist/esm/event-bus/implementations/_shared/event-bus-adapter.test-suite.js.map +1 -0
- package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.js +296 -0
- package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js +3 -4
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/base-event-bus.js +43 -0
- package/dist/esm/event-bus/implementations/derivables/base-event-bus.js.map +1 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js +1 -7
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus.js +18 -53
- package/dist/esm/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/esm/utilities/_module.js +5 -4
- package/dist/esm/utilities/_module.js.map +1 -1
- package/dist/esm/utilities/contracts/_module.js +3 -0
- package/dist/esm/utilities/contracts/_module.js.map +1 -0
- package/dist/esm/utilities/contracts/deinitizable.contract.js +1 -0
- package/dist/esm/utilities/contracts/deinitizable.contract.js.map +1 -0
- package/dist/esm/utilities/contracts/initizable.contract.js +1 -0
- package/dist/esm/utilities/contracts/initizable.contract.js.map +1 -0
- package/dist/esm/utilities/{global-errors.js → errors.js} +1 -1
- package/dist/esm/utilities/errors.js.map +1 -0
- package/dist/esm/{_shared/utilities.js → utilities/functions.js} +1 -1
- package/dist/esm/utilities/functions.js.map +1 -0
- package/dist/esm/utilities/kysely/_module.js +2 -0
- package/dist/esm/utilities/kysely/_module.js.map +1 -0
- package/dist/esm/utilities/kysely/kysely-table-name-transformer-plugin.js.map +1 -0
- package/dist/esm/{_shared → utilities}/types.js.map +1 -1
- package/dist/types/_module.d.ts +1 -0
- package/dist/types/async/_module.d.ts +3 -0
- package/dist/types/{utilities/async/_shared.d.ts → async/async.errors.d.ts} +6 -6
- package/dist/types/async/backof-policies/_module.d.ts +5 -0
- package/dist/types/{utilities → async}/backof-policies/_shared.d.ts +1 -1
- package/dist/types/async/backof-policies/constant-backoff-policy/_module.d.ts +1 -0
- package/dist/types/{utilities → async}/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +2 -2
- package/dist/types/async/backof-policies/exponential-backoff-policy/_module.d.ts +1 -0
- package/dist/types/{utilities → async}/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +2 -2
- package/dist/types/async/backof-policies/linear-backoff-policy/_module.d.ts +1 -0
- package/dist/types/{utilities → async}/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +2 -2
- package/dist/types/async/backof-policies/polynomial-backoff-policy/_module.d.ts +1 -0
- package/dist/types/{utilities → async}/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +2 -2
- package/dist/types/async/utilities/_module.d.ts +2 -0
- package/dist/types/async/utilities/abort/_module.d.ts +2 -0
- package/dist/types/async/utilities/abort/abort-and-fail.d.ts +4 -0
- package/dist/types/async/utilities/abort/abort.d.ts +9 -0
- package/dist/types/async/utilities/delay/_module.d.ts +1 -0
- package/dist/types/async/utilities/delay/delay.d.ts +19 -0
- package/dist/types/async/utilities/lazy-promise/_module.d.ts +1 -0
- package/dist/types/async/utilities/lazy-promise/lazy-promise.d.ts +185 -0
- package/dist/types/async/utilities/retry/_module.d.ts +2 -0
- package/dist/types/async/utilities/retry/retry-or-fail.d.ts +23 -0
- package/dist/types/async/utilities/retry/retry.d.ts +10 -0
- package/dist/types/async/utilities/timeout/_module.d.ts +2 -0
- package/dist/types/async/utilities/timeout/timeout-and-fail.d.ts +5 -0
- package/dist/types/async/utilities/timeout/timeout.d.ts +10 -0
- package/dist/types/cache/contracts/cache-adapter.contract.d.ts +1 -1
- package/dist/types/cache/contracts/cache.contract.d.ts +7 -28
- package/dist/types/cache/contracts/cache.events.d.ts +30 -79
- package/dist/types/cache/implementations/_shared/cache-adapter.test-suite.d.ts +26 -24
- package/dist/types/cache/implementations/_shared/cache.test-suite.d.ts +54 -43
- package/dist/types/cache/implementations/adapters/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +1 -1
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +23 -4
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +15 -0
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +20 -4
- package/dist/types/cache/implementations/adapters/no-op-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +18 -0
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +14 -2
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +20 -3
- package/dist/types/cache/implementations/derivables/base-cache.d.ts +15 -14
- package/dist/types/cache/implementations/derivables/cache.d.ts +7 -4
- package/dist/types/collection/contracts/async-collection.contract.d.ts +10 -6
- package/dist/types/collection/contracts/collection.contract.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/_module.d.ts +4 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-chunk-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.d.ts +13 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-entries-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-group-by-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-insert-after-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-insert-before-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-pad-end-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-pad-start-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-partion-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-repeat-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.d.ts +13 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-reverse-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-split-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.d.ts +9 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.d.ts +13 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-zip-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +4 -3
- package/dist/types/collection/implementations/iterable-collection/iterable-collection.d.ts +1 -1
- package/dist/types/collection/implementations/list-collection/list-collection.d.ts +1 -1
- package/dist/types/event-bus/contracts/_shared.d.ts +2 -5
- package/dist/types/event-bus/contracts/event-bus-adapter.contract.d.ts +4 -1
- package/dist/types/event-bus/contracts/event-bus-factory.contract.d.ts +3 -28
- package/dist/types/event-bus/contracts/event-bus.contract.d.ts +24 -16
- package/dist/types/event-bus/contracts/event-bus.errors.d.ts +3 -3
- package/dist/types/event-bus/implementations/_module.d.ts +1 -1
- package/dist/types/event-bus/implementations/_shared/_module.d.ts +2 -0
- package/dist/types/event-bus/implementations/_shared/event-bus-adapter.test-suite.d.ts +59 -0
- package/dist/types/event-bus/implementations/_shared/event-bus.test-suite.d.ts +72 -0
- package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +16 -0
- package/dist/types/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.d.ts +16 -1
- package/dist/types/event-bus/implementations/derivables/base-event-bus.d.ts +23 -0
- package/dist/types/event-bus/implementations/derivables/event-bus-factory.d.ts +4 -7
- package/dist/types/event-bus/implementations/derivables/event-bus.d.ts +11 -53
- package/dist/types/serializer/implementations/_shared/test-utilities/serializer.test-suite.d.ts +1 -1
- package/dist/types/utilities/_module.d.ts +5 -4
- package/dist/types/utilities/contracts/_module.d.ts +2 -0
- package/dist/types/utilities/contracts/deinitizable.contract.d.ts +9 -0
- package/dist/types/utilities/contracts/initizable.contract.d.ts +9 -0
- package/dist/types/utilities/{global-errors.d.ts → errors.d.ts} +10 -1
- package/dist/types/{_shared/utilities.d.ts → utilities/functions.d.ts} +3 -3
- package/dist/types/utilities/kysely/_module.d.ts +1 -0
- package/dist/types/{_shared → utilities}/kysely/kysely-table-name-transformer-plugin.d.ts +1 -1
- package/dist/types/{_shared → utilities}/types.d.ts +3 -8
- package/package.json +1 -1
- package/dist/cjs/_shared/kysely/_module.js.map +0 -1
- package/dist/cjs/_shared/kysely/kysely-table-name-transformer-plugin.js.map +0 -1
- package/dist/cjs/_shared/redis/_module.js +0 -20
- package/dist/cjs/_shared/redis/_module.js.map +0 -1
- package/dist/cjs/_shared/redis/clear-iterable.js +0 -25
- package/dist/cjs/_shared/redis/clear-iterable.js.map +0 -1
- package/dist/cjs/_shared/redis/escape-redis-chars.js +0 -41
- package/dist/cjs/_shared/redis/escape-redis-chars.js.map +0 -1
- package/dist/cjs/_shared/redis/is-redis-type-error.js +0 -9
- package/dist/cjs/_shared/redis/is-redis-type-error.js.map +0 -1
- package/dist/cjs/_shared/utilities.js.map +0 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js +0 -31
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js.map +0 -1
- package/dist/cjs/event-bus/implementations/_shared/test-utilities/_module.js.map +0 -1
- package/dist/cjs/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js.map +0 -1
- package/dist/cjs/event-bus/implementations/derivables/with-validation-event-bus-adapter.js +0 -35
- package/dist/cjs/event-bus/implementations/derivables/with-validation-event-bus-adapter.js.map +0 -1
- package/dist/cjs/utilities/async/_module.js +0 -29
- package/dist/cjs/utilities/async/_module.js.map +0 -1
- package/dist/cjs/utilities/async/_shared.js.map +0 -1
- package/dist/cjs/utilities/async/abortable/_module.js.map +0 -1
- package/dist/cjs/utilities/async/abortable/abortable.js +0 -48
- package/dist/cjs/utilities/async/abortable/abortable.js.map +0 -1
- package/dist/cjs/utilities/async/abortable-iterable/_module.js.map +0 -1
- package/dist/cjs/utilities/async/abortable-iterable/abortable-iterable.js +0 -32
- package/dist/cjs/utilities/async/abortable-iterable/abortable-iterable.js.map +0 -1
- package/dist/cjs/utilities/async/delay/_module.js.map +0 -1
- package/dist/cjs/utilities/async/delay/delay.js +0 -24
- package/dist/cjs/utilities/async/delay/delay.js.map +0 -1
- package/dist/cjs/utilities/async/delay-iterable/_module.js.map +0 -1
- package/dist/cjs/utilities/async/delay-iterable/delay-iterable.js +0 -36
- package/dist/cjs/utilities/async/delay-iterable/delay-iterable.js.map +0 -1
- package/dist/cjs/utilities/async/lazy-promise/_module.js.map +0 -1
- package/dist/cjs/utilities/async/lazy-promise/lazy-promise.js +0 -22
- package/dist/cjs/utilities/async/lazy-promise/lazy-promise.js.map +0 -1
- package/dist/cjs/utilities/async/retry/_module.js.map +0 -1
- package/dist/cjs/utilities/async/retry/retry.js +0 -43
- package/dist/cjs/utilities/async/retry/retry.js.map +0 -1
- package/dist/cjs/utilities/async/retry-iterable/_module.js +0 -18
- package/dist/cjs/utilities/async/retry-iterable/_module.js.map +0 -1
- package/dist/cjs/utilities/async/retry-iterable/retry-iterable.js +0 -32
- package/dist/cjs/utilities/async/retry-iterable/retry-iterable.js.map +0 -1
- package/dist/cjs/utilities/async/timeout/_module.js.map +0 -1
- package/dist/cjs/utilities/async/timeout/timeout.js +0 -28
- package/dist/cjs/utilities/async/timeout/timeout.js.map +0 -1
- package/dist/cjs/utilities/async/timeout-iterable/_module.js +0 -18
- package/dist/cjs/utilities/async/timeout-iterable/_module.js.map +0 -1
- package/dist/cjs/utilities/async/timeout-iterable/timeout-iterable.js +0 -11
- package/dist/cjs/utilities/async/timeout-iterable/timeout-iterable.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/_module.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/_shared.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/constant-backoff-policy/_module.js +0 -18
- package/dist/cjs/utilities/backof-policies/constant-backoff-policy/_module.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/exponential-backoff-policy/_module.js +0 -18
- package/dist/cjs/utilities/backof-policies/exponential-backoff-policy/_module.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/linear-backoff-policy/_module.js +0 -18
- package/dist/cjs/utilities/backof-policies/linear-backoff-policy/_module.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/polynomial-backoff-policy/_module.js +0 -18
- package/dist/cjs/utilities/backof-policies/polynomial-backoff-policy/_module.js.map +0 -1
- package/dist/cjs/utilities/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +0 -1
- package/dist/cjs/utilities/global-errors.js.map +0 -1
- package/dist/cjs/utilities/validation/_module.js +0 -22
- package/dist/cjs/utilities/validation/_module.js.map +0 -1
- package/dist/esm/_shared/kysely/_module.js +0 -2
- package/dist/esm/_shared/kysely/_module.js.map +0 -1
- package/dist/esm/_shared/kysely/kysely-table-name-transformer-plugin.js.map +0 -1
- package/dist/esm/_shared/redis/_module.js +0 -4
- package/dist/esm/_shared/redis/_module.js.map +0 -1
- package/dist/esm/_shared/redis/clear-iterable.js +0 -21
- package/dist/esm/_shared/redis/clear-iterable.js.map +0 -1
- package/dist/esm/_shared/redis/escape-redis-chars.js +0 -38
- package/dist/esm/_shared/redis/escape-redis-chars.js.map +0 -1
- package/dist/esm/_shared/redis/is-redis-type-error.js +0 -6
- package/dist/esm/_shared/redis/is-redis-type-error.js.map +0 -1
- package/dist/esm/_shared/utilities.js.map +0 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js +0 -27
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js.map +0 -1
- package/dist/esm/event-bus/implementations/_shared/test-utilities/_module.js +0 -2
- package/dist/esm/event-bus/implementations/_shared/test-utilities/_module.js.map +0 -1
- package/dist/esm/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js.map +0 -1
- package/dist/esm/event-bus/implementations/derivables/with-validation-event-bus-adapter.js +0 -31
- package/dist/esm/event-bus/implementations/derivables/with-validation-event-bus-adapter.js.map +0 -1
- package/dist/esm/utilities/async/_module.js +0 -11
- package/dist/esm/utilities/async/_module.js.map +0 -1
- package/dist/esm/utilities/async/_shared.js.map +0 -1
- package/dist/esm/utilities/async/abortable/_module.js +0 -2
- package/dist/esm/utilities/async/abortable/_module.js.map +0 -1
- package/dist/esm/utilities/async/abortable/abortable.js.map +0 -1
- package/dist/esm/utilities/async/abortable-iterable/_module.js +0 -2
- package/dist/esm/utilities/async/abortable-iterable/_module.js.map +0 -1
- package/dist/esm/utilities/async/abortable-iterable/abortable-iterable.js +0 -29
- package/dist/esm/utilities/async/abortable-iterable/abortable-iterable.js.map +0 -1
- package/dist/esm/utilities/async/delay/_module.js +0 -2
- package/dist/esm/utilities/async/delay/_module.js.map +0 -1
- package/dist/esm/utilities/async/delay/delay.js +0 -21
- package/dist/esm/utilities/async/delay/delay.js.map +0 -1
- package/dist/esm/utilities/async/delay-iterable/_module.js +0 -2
- package/dist/esm/utilities/async/delay-iterable/_module.js.map +0 -1
- package/dist/esm/utilities/async/delay-iterable/delay-iterable.js +0 -33
- package/dist/esm/utilities/async/delay-iterable/delay-iterable.js.map +0 -1
- package/dist/esm/utilities/async/lazy-promise/_module.js +0 -2
- package/dist/esm/utilities/async/lazy-promise/_module.js.map +0 -1
- package/dist/esm/utilities/async/lazy-promise/lazy-promise.js +0 -17
- package/dist/esm/utilities/async/lazy-promise/lazy-promise.js.map +0 -1
- package/dist/esm/utilities/async/retry/_module.js +0 -2
- package/dist/esm/utilities/async/retry/_module.js.map +0 -1
- package/dist/esm/utilities/async/retry/retry.js +0 -40
- package/dist/esm/utilities/async/retry/retry.js.map +0 -1
- package/dist/esm/utilities/async/retry-iterable/_module.js +0 -2
- package/dist/esm/utilities/async/retry-iterable/_module.js.map +0 -1
- package/dist/esm/utilities/async/retry-iterable/retry-iterable.js +0 -29
- package/dist/esm/utilities/async/retry-iterable/retry-iterable.js.map +0 -1
- package/dist/esm/utilities/async/timeout/_module.js +0 -2
- package/dist/esm/utilities/async/timeout/_module.js.map +0 -1
- package/dist/esm/utilities/async/timeout/timeout.js +0 -25
- package/dist/esm/utilities/async/timeout/timeout.js.map +0 -1
- package/dist/esm/utilities/async/timeout-iterable/_module.js +0 -2
- package/dist/esm/utilities/async/timeout-iterable/_module.js.map +0 -1
- package/dist/esm/utilities/async/timeout-iterable/timeout-iterable.js +0 -8
- package/dist/esm/utilities/async/timeout-iterable/timeout-iterable.js.map +0 -1
- package/dist/esm/utilities/backof-policies/_module.js +0 -5
- package/dist/esm/utilities/backof-policies/_module.js.map +0 -1
- package/dist/esm/utilities/backof-policies/_shared.js.map +0 -1
- package/dist/esm/utilities/backof-policies/constant-backoff-policy/_module.js +0 -2
- package/dist/esm/utilities/backof-policies/constant-backoff-policy/_module.js.map +0 -1
- package/dist/esm/utilities/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +0 -1
- package/dist/esm/utilities/backof-policies/exponential-backoff-policy/_module.js +0 -2
- package/dist/esm/utilities/backof-policies/exponential-backoff-policy/_module.js.map +0 -1
- package/dist/esm/utilities/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +0 -1
- package/dist/esm/utilities/backof-policies/linear-backoff-policy/_module.js +0 -2
- package/dist/esm/utilities/backof-policies/linear-backoff-policy/_module.js.map +0 -1
- package/dist/esm/utilities/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +0 -1
- package/dist/esm/utilities/backof-policies/polynomial-backoff-policy/_module.js +0 -2
- package/dist/esm/utilities/backof-policies/polynomial-backoff-policy/_module.js.map +0 -1
- package/dist/esm/utilities/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +0 -1
- package/dist/esm/utilities/global-errors.js.map +0 -1
- package/dist/esm/utilities/validation/_module.js +0 -17
- package/dist/esm/utilities/validation/_module.js.map +0 -1
- package/dist/types/_shared/kysely/_module.d.ts +0 -1
- package/dist/types/_shared/redis/_module.d.ts +0 -3
- package/dist/types/_shared/redis/clear-iterable.d.ts +0 -13
- package/dist/types/_shared/redis/escape-redis-chars.d.ts +0 -7
- package/dist/types/_shared/redis/is-redis-type-error.d.ts +0 -7
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.d.ts +0 -12
- package/dist/types/event-bus/implementations/_shared/test-utilities/_module.d.ts +0 -1
- package/dist/types/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.d.ts +0 -36
- package/dist/types/event-bus/implementations/derivables/with-validation-event-bus-adapter.d.ts +0 -17
- package/dist/types/utilities/async/_module.d.ts +0 -10
- package/dist/types/utilities/async/abortable/_module.d.ts +0 -1
- package/dist/types/utilities/async/abortable/abortable.d.ts +0 -39
- package/dist/types/utilities/async/abortable-iterable/_module.d.ts +0 -1
- package/dist/types/utilities/async/abortable-iterable/abortable-iterable.d.ts +0 -36
- package/dist/types/utilities/async/delay/_module.d.ts +0 -1
- package/dist/types/utilities/async/delay/delay.d.ts +0 -38
- package/dist/types/utilities/async/delay-iterable/_module.d.ts +0 -1
- package/dist/types/utilities/async/delay-iterable/delay-iterable.d.ts +0 -57
- package/dist/types/utilities/async/lazy-promise/_module.d.ts +0 -1
- package/dist/types/utilities/async/lazy-promise/lazy-promise.d.ts +0 -28
- package/dist/types/utilities/async/retry/_module.d.ts +0 -1
- package/dist/types/utilities/async/retry/retry.d.ts +0 -89
- package/dist/types/utilities/async/retry-iterable/_module.d.ts +0 -1
- package/dist/types/utilities/async/retry-iterable/retry-iterable.d.ts +0 -86
- package/dist/types/utilities/async/timeout/_module.d.ts +0 -1
- package/dist/types/utilities/async/timeout/timeout.d.ts +0 -40
- package/dist/types/utilities/async/timeout-iterable/_module.d.ts +0 -1
- package/dist/types/utilities/async/timeout-iterable/timeout-iterable.d.ts +0 -64
- package/dist/types/utilities/backof-policies/_module.d.ts +0 -5
- package/dist/types/utilities/backof-policies/constant-backoff-policy/_module.d.ts +0 -1
- package/dist/types/utilities/backof-policies/exponential-backoff-policy/_module.d.ts +0 -1
- package/dist/types/utilities/backof-policies/linear-backoff-policy/_module.d.ts +0 -1
- package/dist/types/utilities/backof-policies/polynomial-backoff-policy/_module.d.ts +0 -1
- package/dist/types/utilities/validation/_module.d.ts +0 -32
- /package/dist/cjs/{utilities → async}/backof-policies/_shared.js +0 -0
- /package/dist/cjs/{_shared → utilities}/kysely/kysely-table-name-transformer-plugin.js +0 -0
- /package/dist/cjs/{_shared → utilities}/types.js +0 -0
- /package/dist/esm/{utilities → async}/backof-policies/_shared.js +0 -0
- /package/dist/esm/{_shared → utilities}/kysely/kysely-table-name-transformer-plugin.js +0 -0
- /package/dist/esm/{_shared → utilities}/types.js +0 -0
|
@@ -3,24 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { TimeSpan } from "../../utilities/_module";
|
|
5
5
|
import type { ICacheAdapter } from "../../cache/contracts/cache-adapter.contract";
|
|
6
|
-
/**
|
|
7
|
-
* Name of all the events of <i>{@link ICache}</i>.
|
|
8
|
-
* @group Events
|
|
9
|
-
*/
|
|
10
|
-
export declare const CACHE_EVENTS: {
|
|
11
|
-
readonly KEY_FOUND: "key_found";
|
|
12
|
-
readonly KEY_NOT_FOUND: "key_not_found";
|
|
13
|
-
readonly KEY_ADDED: "key_added";
|
|
14
|
-
readonly KEY_UPDATED: "key_updated";
|
|
15
|
-
readonly KEY_REMOVED: "key_removed";
|
|
16
|
-
readonly KEYS_CLEARED: "keys_cleared";
|
|
17
|
-
readonly KEY_INCREMENTED: "key_incremented";
|
|
18
|
-
readonly KEY_DECREMENTED: "key_decremented";
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* @group Events
|
|
22
|
-
*/
|
|
23
|
-
export type CacheEventNames = (typeof CACHE_EVENTS)[keyof typeof CACHE_EVENTS];
|
|
24
6
|
/**
|
|
25
7
|
* @group Events
|
|
26
8
|
*/
|
|
@@ -28,69 +10,38 @@ export type CacheEvent = {
|
|
|
28
10
|
namespace: string;
|
|
29
11
|
adapter: ICacheAdapter<any>;
|
|
30
12
|
};
|
|
31
|
-
/**
|
|
32
|
-
* @group Events
|
|
33
|
-
*/
|
|
34
|
-
export type KeyFoundCacheEvent<TType = unknown> = CacheEvent & {
|
|
35
|
-
type: (typeof CACHE_EVENTS)["KEY_FOUND"];
|
|
36
|
-
key: string;
|
|
37
|
-
value: TType;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* @group Events
|
|
41
|
-
*/
|
|
42
|
-
export type KeyNotFoundCacheEvent = CacheEvent & {
|
|
43
|
-
type: (typeof CACHE_EVENTS)["KEY_NOT_FOUND"];
|
|
44
|
-
key: string;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* @group Events
|
|
48
|
-
*/
|
|
49
|
-
export type KeyAddedCacheEvent<TType = unknown> = CacheEvent & {
|
|
50
|
-
type: (typeof CACHE_EVENTS)["KEY_ADDED"];
|
|
51
|
-
key: string;
|
|
52
|
-
value: TType;
|
|
53
|
-
ttl: TimeSpan | null;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* @group Events
|
|
57
|
-
*/
|
|
58
|
-
export type KeyUpdatedCacheEvent<TType = unknown> = CacheEvent & {
|
|
59
|
-
type: (typeof CACHE_EVENTS)["KEY_UPDATED"];
|
|
60
|
-
key: string;
|
|
61
|
-
value: TType;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* @group Events
|
|
65
|
-
*/
|
|
66
|
-
export type KeyIncrementedCacheEvent = CacheEvent & {
|
|
67
|
-
type: (typeof CACHE_EVENTS)["KEY_INCREMENTED"];
|
|
68
|
-
key: string;
|
|
69
|
-
value: number;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* @group Events
|
|
73
|
-
*/
|
|
74
|
-
export type KeyDecrementedCacheEvent = CacheEvent & {
|
|
75
|
-
type: (typeof CACHE_EVENTS)["KEY_DECREMENTED"];
|
|
76
|
-
key: string;
|
|
77
|
-
value: number;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* @group Events
|
|
81
|
-
*/
|
|
82
|
-
export type KeyRemovedCacheEvent = CacheEvent & {
|
|
83
|
-
type: (typeof CACHE_EVENTS)["KEY_REMOVED"];
|
|
84
|
-
key: string;
|
|
85
|
-
};
|
|
86
13
|
/**
|
|
87
14
|
* This event will be triggered when cache is cleared.
|
|
88
15
|
* @group Events
|
|
89
16
|
*/
|
|
90
|
-
export type KeysClearedCacheEvent = CacheEvent & {
|
|
91
|
-
|
|
17
|
+
export type KeysClearedCacheEvent = CacheEvent & {};
|
|
18
|
+
export type CacheEvents<TType = unknown> = {
|
|
19
|
+
key_found: CacheEvent & {
|
|
20
|
+
key: string;
|
|
21
|
+
value: TType;
|
|
22
|
+
};
|
|
23
|
+
key_not_found: CacheEvent & {
|
|
24
|
+
key: string;
|
|
25
|
+
};
|
|
26
|
+
key_added: CacheEvent & {
|
|
27
|
+
key: string;
|
|
28
|
+
value: TType;
|
|
29
|
+
ttl: TimeSpan | null;
|
|
30
|
+
};
|
|
31
|
+
key_updated: CacheEvent & {
|
|
32
|
+
key: string;
|
|
33
|
+
value: TType;
|
|
34
|
+
};
|
|
35
|
+
key_removed: CacheEvent & {
|
|
36
|
+
key: string;
|
|
37
|
+
};
|
|
38
|
+
key_incremented: CacheEvent & {
|
|
39
|
+
key: string;
|
|
40
|
+
value: number;
|
|
41
|
+
};
|
|
42
|
+
key_decremented: CacheEvent & {
|
|
43
|
+
key: string;
|
|
44
|
+
value: number;
|
|
45
|
+
};
|
|
46
|
+
keys_cleared: CacheEvent;
|
|
92
47
|
};
|
|
93
|
-
/**
|
|
94
|
-
* @group Events
|
|
95
|
-
*/
|
|
96
|
-
export type AllCacheEvents<TType> = KeyFoundCacheEvent<TType> | KeyNotFoundCacheEvent | KeyAddedCacheEvent<TType> | KeyUpdatedCacheEvent<TType> | KeyRemovedCacheEvent | KeysClearedCacheEvent | KeyIncrementedCacheEvent | KeyDecrementedCacheEvent;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
5
|
import { type ICacheAdapter } from "../../../cache/contracts/_module";
|
|
6
|
-
import { type Promisable } from "../../../
|
|
6
|
+
import { type Promisable } from "../../../utilities/_module";
|
|
7
7
|
/**
|
|
8
8
|
* @group Utilities
|
|
9
9
|
*/
|
|
@@ -15,35 +15,37 @@ export type CacheAdapterTestSuiteSettings = {
|
|
|
15
15
|
createAdapter: () => Promisable<ICacheAdapter>;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
* The <i>cacheAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ICacheAdapter}</i>.
|
|
18
|
+
* The <i>cacheAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ICacheAdapter}</i> with <i>vitest</i>.
|
|
19
19
|
* @group Utilities
|
|
20
20
|
* @example
|
|
21
21
|
* ```ts
|
|
22
|
+
* import Redis from "ioredis";
|
|
22
23
|
* import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
23
|
-
* import {
|
|
24
|
-
* import
|
|
24
|
+
* import { RedisContainer, type StartedRedisContainer } from "@testcontainers/redis";
|
|
25
|
+
* import { SuperJsonSerializer, TimeSpan, RedisCacheAdapter, cacheAdapterTestSuite } from "@daiso-tech/core";
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
27
|
+
* const timeout = TimeSpan.fromMinutes(2);
|
|
28
|
+
* describe("class: RedisCacheAdapter", () => {
|
|
29
|
+
* let client: Redis;
|
|
30
|
+
* let startedContainer: StartedRedisContainer;
|
|
31
|
+
* const serializer = new SuperJsonSerializer();
|
|
32
|
+
* beforeEach(async () => {
|
|
33
|
+
* startedContainer = await new RedisContainer("redis:7.4.2").start();
|
|
34
|
+
* client = new Redis(startedContainer.getConnectionUrl());
|
|
35
|
+
* }, timeout.toMilliseconds());
|
|
36
|
+
* afterEach(async () => {
|
|
37
|
+
* await client.quit();
|
|
38
|
+
* await startedContainer.stop();
|
|
39
|
+
* }, timeout.toMilliseconds());
|
|
34
40
|
* cacheAdapterTestSuite({
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* test,
|
|
44
|
-
* beforeEach,
|
|
45
|
-
* expect,
|
|
46
|
-
* describe,
|
|
41
|
+
* createAdapter: () =>
|
|
42
|
+
* new RedisCacheAdapter(client, {
|
|
43
|
+
* serializer,
|
|
44
|
+
* }),
|
|
45
|
+
* test,
|
|
46
|
+
* beforeEach,
|
|
47
|
+
* expect,
|
|
48
|
+
* describe,
|
|
47
49
|
* });
|
|
48
50
|
* });
|
|
49
51
|
* ```
|
|
@@ -3,51 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
5
|
import { type ICache } from "../../../cache/contracts/_module";
|
|
6
|
-
import { type Promisable } from "../../../
|
|
6
|
+
import { type Promisable } from "../../../utilities/_module";
|
|
7
7
|
/**
|
|
8
8
|
* @group Utilities
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
12
|
-
* import { cacheAdapterTestSuite, SqliteCacheAdapter } from "@daiso-tech/core";
|
|
13
|
-
* import Sqlite, { type Database } from "better-sqlite3";
|
|
14
|
-
*
|
|
15
|
-
* describe("class: Cache", () => {
|
|
16
|
-
* let database: Database;
|
|
17
|
-
* beforeEach(() => {
|
|
18
|
-
* database = new Sqlite(":memory:");
|
|
19
|
-
* });
|
|
20
|
-
* afterEach(() => {
|
|
21
|
-
* database.close();
|
|
22
|
-
* });
|
|
23
|
-
* cacheAdapterTestSuite({
|
|
24
|
-
* createCacheA: async () => {
|
|
25
|
-
* const cacheAdapterA = new SqliteCacheAdapter(database, {
|
|
26
|
-
* tableName: "custom_table",
|
|
27
|
-
* enableTransactions: true,
|
|
28
|
-
* });
|
|
29
|
-
* await cacheAdapterA.init();
|
|
30
|
-
* return new Cache(cacheAdapterA, {
|
|
31
|
-
* rootNamespace: "@a"
|
|
32
|
-
* });
|
|
33
|
-
* },
|
|
34
|
-
* createCacheB: async () => {
|
|
35
|
-
* const cacheAdapterB = new SqliteCacheAdapter(database, {
|
|
36
|
-
* tableName: "custom_table",
|
|
37
|
-
* enableTransactions: true,
|
|
38
|
-
* });
|
|
39
|
-
* await cacheAdapterB.init();
|
|
40
|
-
* return new Cache(cacheAdapterB, {
|
|
41
|
-
* rootNamespace: "@b"
|
|
42
|
-
* });
|
|
43
|
-
* },
|
|
44
|
-
* test,
|
|
45
|
-
* beforeEach,
|
|
46
|
-
* expect,
|
|
47
|
-
* describe,
|
|
48
|
-
* });
|
|
49
|
-
* });
|
|
50
|
-
* ```
|
|
51
9
|
*/
|
|
52
10
|
export type CacheTestSuiteSettings = {
|
|
53
11
|
expect: ExpectStatic;
|
|
@@ -57,4 +15,57 @@ export type CacheTestSuiteSettings = {
|
|
|
57
15
|
createCacheA: () => Promisable<ICache>;
|
|
58
16
|
createCacheB: () => Promisable<ICache>;
|
|
59
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* The <i>cacheTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ICache}</i> with <i>vitest</i>.
|
|
20
|
+
* @group Utilities
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import Redis from "ioredis";
|
|
24
|
+
* import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
25
|
+
* import { RedisContainer, type StartedRedisContainer } from "@testcontainers/redis";
|
|
26
|
+
* import { SuperJsonSerializer, TimeSpan, RedisCacheAdapter, cacheTestSuite, MemoryEventBusAdapter } from "@daiso-tech/core";
|
|
27
|
+
*
|
|
28
|
+
* const timeout = TimeSpan.fromMinutes(2);
|
|
29
|
+
* describe("class: Cache", () => {
|
|
30
|
+
* let client: Redis;
|
|
31
|
+
* let startedContainer: StartedRedisContainer;
|
|
32
|
+
* const eventBus = new EventBus(new MemoryEventBusAdapter()):
|
|
33
|
+
* const serializer = new SuperJsonSerializer();
|
|
34
|
+
* beforeEach(async () => {
|
|
35
|
+
* startedContainer = await new RedisContainer("redis:7.4.2").start();
|
|
36
|
+
* client = new Redis(startedContainer.getConnectionUrl());
|
|
37
|
+
* }, timeout.toMilliseconds());
|
|
38
|
+
* afterEach(async () => {
|
|
39
|
+
* await client.quit();
|
|
40
|
+
* await startedContainer.stop();
|
|
41
|
+
* }, timeout.toMilliseconds());
|
|
42
|
+
* cacheTestSuite({
|
|
43
|
+
* createCacheA: () =>
|
|
44
|
+
* new Cache(
|
|
45
|
+
* new RedisCacheAdapter(client, {
|
|
46
|
+
* serializer,
|
|
47
|
+
* }),
|
|
48
|
+
* {
|
|
49
|
+
* rootNamespace: "@a",
|
|
50
|
+
* eventBus,
|
|
51
|
+
* }
|
|
52
|
+
* ),
|
|
53
|
+
* createCacheB: () =>
|
|
54
|
+
* new Cache(
|
|
55
|
+
* new RedisCacheAdapter(client, {
|
|
56
|
+
* serializer,
|
|
57
|
+
* }),
|
|
58
|
+
* {
|
|
59
|
+
* rootNamespace: "@b",
|
|
60
|
+
* eventBus,
|
|
61
|
+
* }
|
|
62
|
+
* ),
|
|
63
|
+
* test,
|
|
64
|
+
* beforeEach,
|
|
65
|
+
* expect,
|
|
66
|
+
* describe,
|
|
67
|
+
* });
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
60
71
|
export declare function cacheTestSuite(settings: CacheTestSuiteSettings): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "../../../cache/implementations/adapters/libsql-cache-adapter/_module";
|
|
2
2
|
export * from "../../../cache/implementations/adapters/memory-cache-adapter/_module";
|
|
3
3
|
export * from "../../../cache/implementations/adapters/mongodb-cache-adapter/_module";
|
|
4
|
+
export * from "../../../cache/implementations/adapters/no-op-cache-adapter/_module";
|
|
4
5
|
export * from "../../../cache/implementations/adapters/redis-cache-adapter/_module";
|
|
5
6
|
export * from "../../../cache/implementations/adapters/sqlite-cache-adapter/_module";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/_module";
|
|
5
5
|
import { type Kysely } from "kysely";
|
|
6
6
|
import { type ISerializer } from "../../../../serializer/contracts/_module";
|
|
7
|
-
import type { IDeinitizable, IInitizable } from "../../../../
|
|
7
|
+
import type { IDeinitizable, IInitizable } from "../../../../utilities/_module";
|
|
8
8
|
import { TimeSpan } from "../../../../utilities/_module";
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts
CHANGED
|
@@ -1,27 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
|
-
import type { IDeinitizable, IInitizable } from "../../../../_shared/types";
|
|
5
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
6
5
|
import type { ISerializer } from "../../../../serializer/contracts/_module";
|
|
7
|
-
import type { TimeSpan } from "../../../../utilities/_module";
|
|
6
|
+
import type { TimeSpan, IDeinitizable, IInitizable } from "../../../../utilities/_module";
|
|
8
7
|
import type { Client } from "@libsql/client";
|
|
9
8
|
/**
|
|
10
9
|
* @group Adapters
|
|
11
10
|
*/
|
|
12
11
|
export type LibsqlCacheAdapterSettings = {
|
|
13
12
|
tableName?: string;
|
|
14
|
-
serializer
|
|
13
|
+
serializer: ISerializer<string>;
|
|
15
14
|
enableTransactions?: boolean;
|
|
16
15
|
expiredKeysRemovalInterval?: TimeSpan;
|
|
17
16
|
shouldRemoveExpiredKeys?: boolean;
|
|
18
17
|
};
|
|
19
18
|
/**
|
|
19
|
+
* To utilize the <i>LibsqlCacheAdapter</i>, you must install the <i>"@libsql/client"</i> package and supply a <i>{@link ISerializer | string serializer}</i>, such as <i>{@link SuperJsonSerializer}</i>.
|
|
20
20
|
* @group Adapters
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { LibsqlCacheAdapter, SuperJsonSerializer } from "@daiso-tech/core";
|
|
24
|
+
* import { createClient } from "@libsql/client";
|
|
25
|
+
*
|
|
26
|
+
* (async () => {
|
|
27
|
+
* const client = createClient({ url: "file:local.db" });
|
|
28
|
+
* const serializer = new SuperJsonSerializer();
|
|
29
|
+
* const cacheAdapter = new LibsqlCacheAdapter(client, {
|
|
30
|
+
* serializer,
|
|
31
|
+
* });
|
|
32
|
+
* // You only need to call it once before using the adapter.
|
|
33
|
+
* await cacheAdapter.init();
|
|
34
|
+
* await cacheAdapter.add("a", 1);
|
|
35
|
+
*
|
|
36
|
+
* // Will remove the cache
|
|
37
|
+
* await cacheAdapter.deInit();
|
|
38
|
+
* })();
|
|
39
|
+
* ```
|
|
21
40
|
*/
|
|
22
41
|
export declare class LibsqlCacheAdapter<TType> implements ICacheAdapter<TType>, IInitizable, IDeinitizable {
|
|
23
42
|
private readonly cacheAdapter;
|
|
24
|
-
constructor(client: Client, settings
|
|
43
|
+
constructor(client: Client, settings: LibsqlCacheAdapterSettings);
|
|
25
44
|
removeExpiredKeys(): Promise<void>;
|
|
26
45
|
deInit(): Promise<void>;
|
|
27
46
|
init(): Promise<void>;
|
package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts
CHANGED
|
@@ -4,7 +4,22 @@
|
|
|
4
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
5
5
|
import type { TimeSpan } from "../../../../utilities/_module";
|
|
6
6
|
/**
|
|
7
|
+
* To utilize the <i>MemoryCacheAdapter</i>, you must create instance of it.
|
|
7
8
|
* @group Adapters
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { MemoryCacheAdapter } from "@daiso-tech/core";
|
|
12
|
+
*
|
|
13
|
+
* const cacheAdapter = new MemoryCacheAdapter(client);
|
|
14
|
+
* ```
|
|
15
|
+
* You can also provide an <i>Map</i>.
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { MemoryCacheAdapter } from "@daiso-tech/core";
|
|
19
|
+
*
|
|
20
|
+
* const map = new Map<any, any>();
|
|
21
|
+
* const cacheAdapter = new MemoryCacheAdapter(map);
|
|
22
|
+
* ```
|
|
8
23
|
*/
|
|
9
24
|
export declare class MemoryCacheAdapter<TType> implements ICacheAdapter<TType> {
|
|
10
25
|
private readonly map;
|
package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
5
|
-
import type { TimeSpan } from "../../../../utilities/_module";
|
|
6
|
-
import type { IInitizable } from "../../../../_shared/types";
|
|
5
|
+
import type { TimeSpan, IInitizable } from "../../../../utilities/_module";
|
|
7
6
|
import type { ObjectId } from "mongodb";
|
|
8
7
|
import { type Collection } from "mongodb";
|
|
9
8
|
import type { ISerializer } from "../../../../serializer/contracts/_module";
|
|
@@ -20,16 +19,33 @@ export type MongodbCacheDocument = {
|
|
|
20
19
|
* @group Adapters
|
|
21
20
|
*/
|
|
22
21
|
export type MongodbCacheAdapterSettings = {
|
|
23
|
-
serializer
|
|
22
|
+
serializer: ISerializer<string>;
|
|
24
23
|
};
|
|
25
24
|
/**
|
|
25
|
+
* To utilize the <i>MongodbCacheAdapter</i>, you must install the <i>"mongodb"</i> package and supply a <i>{@link ISerializer | string serializer}</i>, such as <i>{@link SuperJsonSerializer}</i>.
|
|
26
26
|
* @group Adapters
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { MongodbCacheAdapter, SuperJsonSerializer } from "@daiso-tech/core";
|
|
30
|
+
* import { MongoClient } from "mongodb";
|
|
31
|
+
*
|
|
32
|
+
* const client = new MongoClient("YOUR_MONGODB_CONNECTION_STRING");
|
|
33
|
+
* const database = client.db("database");
|
|
34
|
+
* const cacheCollection = database.collection("cache");
|
|
35
|
+
* const serializer = new SuperJsonSerializer();
|
|
36
|
+
* const cacheAdapter = new MongodbCacheAdapter(cacheCollection, {
|
|
37
|
+
* serializer,
|
|
38
|
+
* });
|
|
39
|
+
* // You only need to call it once before using the adapter.
|
|
40
|
+
* await cacheAdapter.init();
|
|
41
|
+
* await cacheAdapter.add("a", 1);
|
|
42
|
+
* ```
|
|
27
43
|
*/
|
|
28
44
|
export declare class MongodbCacheAdapter<TType> implements ICacheAdapter<TType>, IInitizable {
|
|
29
45
|
private readonly collection;
|
|
30
46
|
private static isMongodbIncrementError;
|
|
31
47
|
private serializer;
|
|
32
|
-
constructor(collection: Collection<MongodbCacheDocument>, { serializer
|
|
48
|
+
constructor(collection: Collection<MongodbCacheDocument>, { serializer }: MongodbCacheAdapterSettings);
|
|
33
49
|
init(): Promise<void>;
|
|
34
50
|
get(key: string): Promise<TType | null>;
|
|
35
51
|
add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter";
|
package/dist/types/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Cache
|
|
3
|
+
*/
|
|
4
|
+
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
5
|
+
import type { TimeSpan } from "../../../../utilities/_module";
|
|
6
|
+
/**
|
|
7
|
+
* This <i>NoOpCacheAdapter</i> will do nothing and is used for easily mocking {@link ICacheAdapter} for testing.
|
|
8
|
+
* @group Adapters
|
|
9
|
+
*/
|
|
10
|
+
export declare class NoOpCacheAdapter<TType> implements ICacheAdapter<TType> {
|
|
11
|
+
get(_key: string): Promise<TType | null>;
|
|
12
|
+
add(_key: string, _value: TType, _ttl: TimeSpan | null): Promise<boolean>;
|
|
13
|
+
update(_key: string, _value: TType): Promise<boolean>;
|
|
14
|
+
put(_key: string, _value: TType, _ttl: TimeSpan | null): Promise<boolean>;
|
|
15
|
+
remove(_key: string): Promise<boolean>;
|
|
16
|
+
increment(_key: string, _value: number): Promise<boolean>;
|
|
17
|
+
clear(_prefix: string): Promise<void>;
|
|
18
|
+
}
|
package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts
CHANGED
|
@@ -16,16 +16,28 @@ declare module "ioredis" {
|
|
|
16
16
|
* @group Adapters
|
|
17
17
|
*/
|
|
18
18
|
export type RedisCacheAdapterSettings = {
|
|
19
|
-
serializer
|
|
19
|
+
serializer: ISerializer<string>;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
|
+
* To utilize the <i>RedisCacheAdapter</i>, you must install the <i>"ioredis"</i> package and supply a <i>{@link ISerializer | string serializer}</i>, such as <i>{@link SuperJsonSerializer}</i>.
|
|
22
23
|
* @group Adapters
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { RedisCacheAdapter, SuperJsonSerializer } from "@daiso-tech/core";
|
|
27
|
+
* import Redis from "ioredis";
|
|
28
|
+
*
|
|
29
|
+
* const client = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
30
|
+
* const serializer = new SuperJsonSerializer();
|
|
31
|
+
* const cacheAdapter = new RedisCacheAdapter(client, {
|
|
32
|
+
* serializer,
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
23
35
|
*/
|
|
24
36
|
export declare class RedisCacheAdapter<TType> implements ICacheAdapter<TType> {
|
|
25
37
|
private readonly client;
|
|
26
38
|
private static isRedisTypeError;
|
|
27
39
|
private serializer;
|
|
28
|
-
constructor(client: Redis, { serializer
|
|
40
|
+
constructor(client: Redis, { serializer }: RedisCacheAdapterSettings);
|
|
29
41
|
get(key: string): Promise<TType | null>;
|
|
30
42
|
add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
|
|
31
43
|
update(key: string, value: TType): Promise<boolean>;
|
package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts
CHANGED
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
|
-
import type { IDeinitizable, IInitizable } from "../../../../_shared/types";
|
|
5
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
|
|
6
5
|
import type { ISerializer } from "../../../../serializer/contracts/_module";
|
|
7
|
-
import type { TimeSpan } from "../../../../utilities/_module";
|
|
6
|
+
import type { TimeSpan, IInitizable, IDeinitizable } from "../../../../utilities/_module";
|
|
8
7
|
import { type Database } from "better-sqlite3";
|
|
9
8
|
/**
|
|
10
9
|
* @group Adapters
|
|
11
10
|
*/
|
|
12
11
|
export type SqliteStorageAdapterSettings = {
|
|
13
12
|
tableName?: string;
|
|
14
|
-
serializer
|
|
13
|
+
serializer: ISerializer<string>;
|
|
15
14
|
enableTransactions?: boolean;
|
|
16
15
|
expiredKeysRemovalInterval?: TimeSpan;
|
|
17
16
|
shouldRemoveExpiredKeys?: boolean;
|
|
18
17
|
};
|
|
19
18
|
/**
|
|
19
|
+
* To utilize the <i>SqliteCacheAdapter</i>, you must install the <i>"better-sqlite3"</i> package and supply a <i>{@link ISerializer | string serializer}</i>, such as <i>{@link SuperJsonSerializer}</i>.
|
|
20
20
|
* @group Adapters
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { SqliteCacheAdapter, SuperJsonSerializer } from "@daiso-tech/core";
|
|
24
|
+
* import Sqlite from "better-sqlite3";
|
|
25
|
+
*
|
|
26
|
+
* const client = new Sqlite("local.db");
|
|
27
|
+
* const serializer = new SuperJsonSerializer();
|
|
28
|
+
* const cacheAdapter = new SqliteCacheAdapter(client, {
|
|
29
|
+
* serializer,
|
|
30
|
+
* });
|
|
31
|
+
* // You only need to call it once before using the adapter.
|
|
32
|
+
* await cacheAdapter.init();
|
|
33
|
+
* await cacheAdapter.add("a", 1);
|
|
34
|
+
*
|
|
35
|
+
* // Will remove the cache
|
|
36
|
+
* await cacheAdapter.deInit();
|
|
37
|
+
* ```
|
|
21
38
|
*/
|
|
22
39
|
export declare class SqliteCacheAdapter<TType> implements ICacheAdapter<TType>, IInitizable, IDeinitizable {
|
|
23
40
|
private readonly cacheAdapter;
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { WithTtlValue } from "../../../cache/contracts/_module";
|
|
5
5
|
import { type ICache } from "../../../cache/contracts/_module";
|
|
6
|
-
import { type INamespacedCache, type
|
|
7
|
-
import type { OneOrMore } from "../../../
|
|
8
|
-
import { type AsyncLazyable, type GetOrAddValue } from "../../../
|
|
6
|
+
import { type INamespacedCache, type CacheEvents } from "../../../cache/contracts/_module";
|
|
7
|
+
import type { OneOrMore } from "../../../utilities/_module";
|
|
8
|
+
import { type AsyncLazyable, type GetOrAddValue } from "../../../utilities/_module";
|
|
9
9
|
import type { TimeSpan } from "../../../utilities/_module";
|
|
10
|
-
import { LazyPromise } from "../../../
|
|
11
|
-
import type { Listener,
|
|
10
|
+
import { LazyPromise } from "../../../async/_module";
|
|
11
|
+
import type { Listener, Unsubscribe, INamespacedEventBus, SelectEvent } from "../../../event-bus/contracts/_module";
|
|
12
12
|
/**
|
|
13
13
|
* @group Derivables
|
|
14
14
|
*/
|
|
15
15
|
export type BaseCacheSettings<TType> = {
|
|
16
16
|
namespace: string;
|
|
17
|
-
eventBus: INamespacedEventBus<
|
|
17
|
+
eventBus: INamespacedEventBus<CacheEvents<TType>>;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* The BaseCache class serves as an abstract base class that provides implementations for redundant methods.
|
|
21
21
|
* It simplifies implementing the {@link INamespacedCache} interface without using an {@link ICacheAdapter}.
|
|
22
22
|
* @group Derivables
|
|
23
23
|
*/
|
|
24
|
-
export declare abstract class BaseCache<TType
|
|
24
|
+
export declare abstract class BaseCache<TType> implements INamespacedCache<TType> {
|
|
25
|
+
protected static createLayPromise<TValue = void>(asyncFn: () => PromiseLike<TValue>): LazyPromise<TValue>;
|
|
25
26
|
private readonly listenable;
|
|
26
27
|
constructor(settings: BaseCacheSettings<TType>);
|
|
27
|
-
addListener<
|
|
28
|
-
addListenerMany<
|
|
29
|
-
removeListener<
|
|
30
|
-
removeListenerMany<
|
|
31
|
-
subscribe<
|
|
32
|
-
subscribeMany<
|
|
28
|
+
addListener<TEventName extends keyof CacheEvents>(eventName: TEventName, listener: Listener<SelectEvent<CacheEvents, TEventName>>): LazyPromise<void>;
|
|
29
|
+
addListenerMany<TEventName extends keyof CacheEvents>(eventNames: TEventName[], listener: Listener<SelectEvent<CacheEvents, TEventName>>): LazyPromise<void>;
|
|
30
|
+
removeListener<TEventName extends keyof CacheEvents>(eventName: TEventName, listener: Listener<SelectEvent<CacheEvents, TEventName>>): LazyPromise<void>;
|
|
31
|
+
removeListenerMany<TEventName extends keyof CacheEvents>(eventNames: TEventName[], listener: Listener<SelectEvent<CacheEvents, TEventName>>): LazyPromise<void>;
|
|
32
|
+
subscribe<TEventName extends keyof CacheEvents>(eventName: TEventName, listener: Listener<SelectEvent<CacheEvents, TEventName>>): LazyPromise<Unsubscribe>;
|
|
33
|
+
subscribeMany<TEventName extends keyof CacheEvents>(eventNames: TEventName[], listener: Listener<SelectEvent<CacheEvents, TEventName>>): LazyPromise<Unsubscribe>;
|
|
33
34
|
abstract withNamespace(namespace: OneOrMore<string>): ICache<TType>;
|
|
34
35
|
abstract getNamespace(): string;
|
|
35
36
|
exists(key: string): LazyPromise<boolean>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
|
+
import type { CacheEvents } from "../../../cache/contracts/_module";
|
|
4
5
|
import { type ICache, type ICacheAdapter } from "../../../cache/contracts/_module";
|
|
5
|
-
import { type INamespacedCache
|
|
6
|
-
import type { OneOrMore } from "../../../
|
|
6
|
+
import { type INamespacedCache } from "../../../cache/contracts/_module";
|
|
7
|
+
import type { OneOrMore } from "../../../utilities/_module";
|
|
7
8
|
import type { TimeSpan } from "../../../utilities/_module";
|
|
8
|
-
import {
|
|
9
|
+
import type { LazyPromiseSettings } from "../../../async/_module";
|
|
10
|
+
import type { LazyPromise } from "../../../async/_module";
|
|
9
11
|
import type { INamespacedEventBus } from "../../../event-bus/contracts/_module";
|
|
10
12
|
import { BaseCache } from "../../../cache/implementations/derivables/base-cache";
|
|
11
13
|
/**
|
|
@@ -43,11 +45,12 @@ export type CacheSettings<TType> = {
|
|
|
43
45
|
/**
|
|
44
46
|
* In order to listen to events of <i>{@link Cache}</i> class you must pass in <i>{@link INamespacedEventBus}</i>.
|
|
45
47
|
*/
|
|
46
|
-
eventBus?: INamespacedEventBus<
|
|
48
|
+
eventBus?: INamespacedEventBus<CacheEvents<TType>>;
|
|
47
49
|
/**
|
|
48
50
|
* You can decide the default ttl value. If null is passed then no ttl will be used by default.
|
|
49
51
|
*/
|
|
50
52
|
defaultTtl?: TimeSpan | null;
|
|
53
|
+
lazyPromiseSettings?: LazyPromiseSettings;
|
|
51
54
|
};
|
|
52
55
|
/**
|
|
53
56
|
* <i>Cache</i> class can be derived from any <i>{@link ICacheAdapter}</i>.
|