@daiso-tech/core 0.14.0 → 0.16.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 +3 -2
- 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/{serializer/implementations/sql-serializer → 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/{serializer/implementations/_shared/test-utilities → async/backof-policies/exponential-backoff-policy}/_module.js +1 -1
- 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/{serializer/implementations/mongodb-serializer → 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/async/backof-policies/polynomial-backoff-policy/_module.js +18 -0
- 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 → 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 +110 -0
- package/dist/cjs/async/utilities/lazy-promise/lazy-promise.js.map +1 -0
- package/dist/cjs/async/utilities/retry/_module.js +19 -0
- 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 +257 -177
- package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js +59 -37
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +59 -18
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +16 -6
- 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 +58 -39
- 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 +63 -26
- 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/no-op-cache-adapter.js +10 -1
- package/dist/cjs/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +44 -19
- 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 +17 -7
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/_module.js +0 -1
- package/dist/cjs/cache/implementations/derivables/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory.js +4 -7
- package/dist/cjs/cache/implementations/derivables/cache-factory.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache.js +303 -61
- 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-merge-iterable.js +14 -7
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- 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 +63 -42
- package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/merge-iterable.js +6 -7
- package/dist/cjs/collection/implementations/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js +16 -7
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/list-collection/list-collection.js +18 -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/event-bus-adapter.test-suite.js +96 -0
- 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 +335 -0
- package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -0
- package/dist/cjs/event-bus/implementations/adapters/_module.js +1 -1
- package/dist/cjs/event-bus/implementations/adapters/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +19 -9
- 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/no-op-event-bus-adapter/no-op-event-bus-adapter.js +7 -1
- package/dist/cjs/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +52 -0
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js +6 -7
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js +96 -33
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/cjs/{utilities/async/retry → serde/contracts}/_module.js +2 -1
- package/dist/cjs/serde/contracts/_module.js.map +1 -0
- package/dist/cjs/{serializer/contracts/serializer.contract.js → serde/contracts/serde.contract.js} +1 -1
- package/dist/cjs/serde/contracts/serde.contract.js.map +1 -0
- package/dist/cjs/{serializer/contracts/serializer.errors.js → serde/contracts/serde.errors.js} +7 -7
- package/dist/cjs/serde/contracts/serde.errors.js.map +1 -0
- package/dist/cjs/{_shared/redis → serde/implementations}/_module.js +5 -3
- package/dist/cjs/serde/implementations/_module.js.map +1 -0
- package/dist/cjs/{serializer/implementations/redis-serializer → serde/implementations/_shared/test-utilities}/_module.js +1 -1
- package/dist/cjs/serde/implementations/_shared/test-utilities/_module.js.map +1 -0
- package/dist/{esm/serializer/implementations/_shared/test-utilities/serializer.test-suite.js → cjs/serde/implementations/_shared/test-utilities/serde.test-suite.js} +65 -62
- package/dist/cjs/serde/implementations/_shared/test-utilities/serde.test-suite.js.map +1 -0
- package/dist/cjs/{_shared/kysely → serde/implementations/mongodb-serde}/_module.js +1 -1
- package/dist/cjs/serde/implementations/mongodb-serde/_module.js.map +1 -0
- package/dist/cjs/serde/implementations/mongodb-serde/mongodb-serde.js +36 -0
- package/dist/cjs/serde/implementations/mongodb-serde/mongodb-serde.js.map +1 -0
- package/dist/cjs/{utilities/async/delay-iterable → serde/implementations/redis-serde}/_module.js +1 -1
- package/dist/cjs/serde/implementations/redis-serde/_module.js.map +1 -0
- package/dist/cjs/serde/implementations/redis-serde/redis-serde.js +37 -0
- package/dist/cjs/serde/implementations/redis-serde/redis-serde.js.map +1 -0
- package/dist/cjs/{utilities/async/abortable → serde/implementations/sql-serde}/_module.js +1 -1
- package/dist/cjs/serde/implementations/sql-serde/_module.js.map +1 -0
- package/dist/cjs/serde/implementations/sql-serde/sql-serde.js +37 -0
- package/dist/cjs/serde/implementations/sql-serde/sql-serde.js.map +1 -0
- package/dist/cjs/{utilities/async/abortable-iterable → serde/implementations/super-json-serde}/_module.js +1 -1
- package/dist/cjs/serde/implementations/super-json-serde/_module.js.map +1 -0
- package/dist/cjs/{serializer/implementations/super-json-serializer/super-json-serializer.js → serde/implementations/super-json-serde/super-json-serde.js} +74 -100
- package/dist/cjs/serde/implementations/super-json-serde/super-json-serde.js.map +1 -0
- package/dist/cjs/utilities/_module.js +5 -4
- package/dist/cjs/utilities/_module.js.map +1 -1
- package/dist/cjs/{serializer → utilities}/contracts/_module.js +2 -2
- 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} +6 -6
- package/dist/cjs/utilities/functions.js.map +1 -0
- package/dist/cjs/utilities/kysely/_module.js +18 -0
- 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/utilities/time-span/time-span.js +8 -0
- package/dist/cjs/utilities/time-span/time-span.js.map +1 -1
- package/dist/cjs/{_shared → utilities}/types.js.map +1 -1
- package/dist/esm/_module.js +3 -2
- 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 +106 -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 +258 -178
- package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js +25 -3
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +60 -19
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +16 -6
- 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 +58 -39
- 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 +63 -23
- 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/no-op-cache-adapter.js +10 -1
- package/dist/esm/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +44 -19
- 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 +16 -6
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/_module.js +0 -1
- package/dist/esm/cache/implementations/derivables/_module.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-factory.js +2 -5
- package/dist/esm/cache/implementations/derivables/cache-factory.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache.js +304 -62
- 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-merge-iterable.js +14 -7
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- 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 +61 -40
- package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/merge-iterable.js +6 -7
- package/dist/esm/collection/implementations/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js +12 -3
- package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/list-collection/list-collection.js +14 -1
- package/dist/esm/collection/implementations/list-collection/list-collection.js.map +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/event-bus-adapter.test-suite.js +93 -0
- 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 +332 -0
- package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/_module.js +1 -1
- package/dist/esm/event-bus/implementations/adapters/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +19 -9
- 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/no-op-event-bus-adapter/no-op-event-bus-adapter.js +7 -1
- package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +48 -0
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js +4 -5
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus.js +97 -34
- package/dist/esm/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/esm/serde/contracts/_module.js +3 -0
- package/dist/esm/serde/contracts/_module.js.map +1 -0
- package/dist/esm/serde/contracts/serde.contract.js +1 -0
- package/dist/esm/serde/contracts/serde.contract.js.map +1 -0
- package/dist/esm/{serializer/contracts/serializer.errors.js → serde/contracts/serde.errors.js} +5 -5
- package/dist/esm/serde/contracts/serde.errors.js.map +1 -0
- package/dist/esm/serde/implementations/_module.js +6 -0
- package/dist/esm/serde/implementations/_module.js.map +1 -0
- package/dist/esm/serde/implementations/_shared/test-utilities/_module.js +2 -0
- package/dist/esm/serde/implementations/_shared/test-utilities/_module.js.map +1 -0
- package/dist/{cjs/serializer/implementations/_shared/test-utilities/serializer.test-suite.js → esm/serde/implementations/_shared/test-utilities/serde.test-suite.js} +62 -65
- package/dist/esm/serde/implementations/_shared/test-utilities/serde.test-suite.js.map +1 -0
- package/dist/esm/serde/implementations/mongodb-serde/_module.js +2 -0
- package/dist/esm/serde/implementations/mongodb-serde/_module.js.map +1 -0
- package/dist/esm/{serializer/implementations/mongodb-serializer/mongodb-serializer.js → serde/implementations/mongodb-serde/mongodb-serde.js} +10 -10
- package/dist/esm/serde/implementations/mongodb-serde/mongodb-serde.js.map +1 -0
- package/dist/esm/serde/implementations/redis-serde/_module.js +2 -0
- package/dist/esm/serde/implementations/redis-serde/_module.js.map +1 -0
- package/dist/esm/{serializer/implementations/sql-serializer/sql-serializer.js → serde/implementations/redis-serde/redis-serde.js} +10 -10
- package/dist/esm/serde/implementations/redis-serde/redis-serde.js.map +1 -0
- package/dist/esm/serde/implementations/sql-serde/_module.js +2 -0
- package/dist/esm/serde/implementations/sql-serde/_module.js.map +1 -0
- package/dist/esm/{serializer/implementations/redis-serializer/redis-serializer.js → serde/implementations/sql-serde/sql-serde.js} +10 -10
- package/dist/esm/serde/implementations/sql-serde/sql-serde.js.map +1 -0
- package/dist/esm/serde/implementations/super-json-serde/_module.js +2 -0
- package/dist/esm/serde/implementations/super-json-serde/_module.js.map +1 -0
- package/dist/esm/{serializer/implementations/super-json-serializer/super-json-serializer.js → serde/implementations/super-json-serde/super-json-serde.js} +52 -55
- package/dist/esm/serde/implementations/super-json-serde/super-json-serde.js.map +1 -0
- 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} +5 -5
- 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/utilities/time-span/time-span.js +8 -0
- package/dist/esm/utilities/time-span/time-span.js.map +1 -1
- package/dist/esm/{_shared → utilities}/types.js.map +1 -1
- package/dist/types/_module.d.ts +3 -2
- 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 +222 -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 +20 -6
- package/dist/types/cache/contracts/cache-factory.contract.d.ts +4 -4
- package/dist/types/cache/contracts/cache.contract.d.ts +25 -43
- package/dist/types/cache/contracts/cache.events.d.ts +38 -91
- package/dist/types/cache/implementations/_shared/cache-adapter.test-suite.d.ts +34 -25
- package/dist/types/cache/implementations/_shared/cache.test-suite.d.ts +54 -43
- package/dist/types/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +11 -5
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +22 -9
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +12 -6
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +24 -11
- package/dist/types/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +5 -2
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +20 -13
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +22 -9
- package/dist/types/cache/implementations/derivables/_module.d.ts +0 -1
- package/dist/types/cache/implementations/derivables/cache-factory.d.ts +5 -11
- package/dist/types/cache/implementations/derivables/cache.d.ts +37 -42
- 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 +5 -6
- 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 +10 -4
- package/dist/types/collection/implementations/iterable-collection/_shared/merge-iterable.d.ts +4 -5
- package/dist/types/collection/implementations/iterable-collection/iterable-collection.d.ts +4 -1
- package/dist/types/collection/implementations/list-collection/list-collection.d.ts +4 -1
- package/dist/types/event-bus/contracts/_shared.d.ts +2 -5
- package/dist/types/event-bus/contracts/event-bus-adapter.contract.d.ts +12 -6
- package/dist/types/event-bus/contracts/event-bus-factory.contract.d.ts +4 -5
- package/dist/types/event-bus/contracts/event-bus.contract.d.ts +58 -27
- 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 +68 -0
- package/dist/types/event-bus/implementations/_shared/event-bus.test-suite.d.ts +72 -0
- package/dist/types/event-bus/implementations/adapters/_module.d.ts +1 -1
- package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +10 -5
- package/dist/types/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +4 -1
- package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +50 -0
- package/dist/types/event-bus/implementations/derivables/event-bus-factory.d.ts +7 -8
- package/dist/types/event-bus/implementations/derivables/event-bus.d.ts +20 -46
- package/dist/types/serde/contracts/_module.d.ts +2 -0
- package/dist/types/serde/contracts/serde.contract.d.ts +41 -0
- package/dist/types/{serializer/contracts/serializer.errors.d.ts → serde/contracts/serde.errors.d.ts} +4 -4
- package/dist/types/serde/implementations/_module.d.ts +5 -0
- package/dist/types/serde/implementations/_shared/test-utilities/_module.d.ts +1 -0
- package/dist/types/serde/implementations/_shared/test-utilities/serde.test-suite.d.ts +18 -0
- package/dist/types/serde/implementations/mongodb-serde/_module.d.ts +1 -0
- package/dist/types/serde/implementations/mongodb-serde/mongodb-serde.d.ts +13 -0
- package/dist/types/serde/implementations/redis-serde/_module.d.ts +1 -0
- package/dist/types/serde/implementations/redis-serde/redis-serde.d.ts +13 -0
- package/dist/types/serde/implementations/sql-serde/_module.d.ts +1 -0
- package/dist/types/serde/implementations/sql-serde/sql-serde.d.ts +13 -0
- package/dist/types/serde/implementations/super-json-serde/_module.d.ts +1 -0
- package/dist/types/serde/implementations/super-json-serde/super-json-serde.d.ts +25 -0
- 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} +4 -4
- 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/utilities/time-span/time-span.d.ts +11 -2
- package/dist/types/{_shared → utilities}/types.d.ts +3 -8
- package/package.json +3 -9
- 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.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/cache/implementations/derivables/base-cache.js +0 -262
- package/dist/cjs/cache/implementations/derivables/base-cache.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 +0 -51
- package/dist/cjs/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js.map +0 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +0 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js +0 -45
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
- package/dist/cjs/event-bus/implementations/derivables/base-event-bus.js +0 -47
- package/dist/cjs/event-bus/implementations/derivables/base-event-bus.js.map +0 -1
- package/dist/cjs/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js +0 -42
- package/dist/cjs/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +0 -1
- package/dist/cjs/serializer/contracts/_module.js.map +0 -1
- package/dist/cjs/serializer/contracts/serializer.contract.js.map +0 -1
- package/dist/cjs/serializer/contracts/serializer.errors.js.map +0 -1
- package/dist/cjs/serializer/implementations/_module.js +0 -22
- package/dist/cjs/serializer/implementations/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/_shared/test-utilities/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/_shared/test-utilities/serializer.test-suite.js.map +0 -1
- package/dist/cjs/serializer/implementations/mongodb-serializer/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js +0 -36
- package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +0 -1
- package/dist/cjs/serializer/implementations/redis-serializer/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js +0 -37
- package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js.map +0 -1
- package/dist/cjs/serializer/implementations/sql-serializer/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js +0 -37
- package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js.map +0 -1
- package/dist/cjs/serializer/implementations/super-json-serializer/_module.js +0 -18
- package/dist/cjs/serializer/implementations/super-json-serializer/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/super-json-serializer/super-json-serializer.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/cache/implementations/derivables/base-cache.js +0 -258
- package/dist/esm/cache/implementations/derivables/base-cache.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 +0 -48
- package/dist/esm/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js.map +0 -1
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +0 -1
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js +0 -41
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
- package/dist/esm/event-bus/implementations/derivables/base-event-bus.js +0 -43
- package/dist/esm/event-bus/implementations/derivables/base-event-bus.js.map +0 -1
- package/dist/esm/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js +0 -38
- package/dist/esm/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +0 -1
- package/dist/esm/serializer/contracts/_module.js +0 -3
- package/dist/esm/serializer/contracts/_module.js.map +0 -1
- package/dist/esm/serializer/contracts/serializer.contract.js +0 -1
- package/dist/esm/serializer/contracts/serializer.contract.js.map +0 -1
- package/dist/esm/serializer/contracts/serializer.errors.js.map +0 -1
- package/dist/esm/serializer/implementations/_module.js +0 -6
- package/dist/esm/serializer/implementations/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/_shared/test-utilities/_module.js +0 -2
- package/dist/esm/serializer/implementations/_shared/test-utilities/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/_shared/test-utilities/serializer.test-suite.js.map +0 -1
- package/dist/esm/serializer/implementations/mongodb-serializer/_module.js +0 -2
- package/dist/esm/serializer/implementations/mongodb-serializer/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +0 -1
- package/dist/esm/serializer/implementations/redis-serializer/_module.js +0 -2
- package/dist/esm/serializer/implementations/redis-serializer/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/redis-serializer/redis-serializer.js.map +0 -1
- package/dist/esm/serializer/implementations/sql-serializer/_module.js +0 -2
- package/dist/esm/serializer/implementations/sql-serializer/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/sql-serializer/sql-serializer.js.map +0 -1
- package/dist/esm/serializer/implementations/super-json-serializer/_module.js +0 -2
- package/dist/esm/serializer/implementations/super-json-serializer/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/super-json-serializer/super-json-serializer.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/cache/implementations/derivables/base-cache.d.ts +0 -57
- 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/adapters/redis-event-bus-adapter/redis-event-bus-adapter.d.ts +0 -43
- package/dist/types/event-bus/implementations/derivables/base-event-bus.d.ts +0 -23
- package/dist/types/event-bus/implementations/derivables/with-namespace-event-bus-adapter.d.ts +0 -16
- package/dist/types/serializer/contracts/_module.d.ts +0 -2
- package/dist/types/serializer/contracts/serializer.contract.d.ts +0 -16
- package/dist/types/serializer/implementations/_module.d.ts +0 -5
- package/dist/types/serializer/implementations/_shared/test-utilities/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/_shared/test-utilities/serializer.test-suite.d.ts +0 -18
- package/dist/types/serializer/implementations/mongodb-serializer/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/mongodb-serializer/mongodb-serializer.d.ts +0 -13
- package/dist/types/serializer/implementations/redis-serializer/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/redis-serializer/redis-serializer.d.ts +0 -13
- package/dist/types/serializer/implementations/sql-serializer/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/sql-serializer/sql-serializer.d.ts +0 -13
- package/dist/types/serializer/implementations/super-json-serializer/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/super-json-serializer/super-json-serializer.d.ts +0 -37
- 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/event-bus/implementations/adapters/{redis-event-bus-adapter → redis-pub-sub-event-bus-adapter}/_module.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/event-bus/implementations/adapters/{redis-event-bus-adapter → redis-pub-sub-event-bus-adapter}/_module.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
- /package/dist/types/event-bus/implementations/adapters/{redis-event-bus-adapter → redis-pub-sub-event-bus-adapter}/_module.d.ts +0 -0
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
4
|
import type { IListenable } from "../../event-bus/contracts/_module";
|
|
5
|
-
import type { OneOrMore } from "../../
|
|
6
|
-
import { type AsyncLazyable, type GetOrAddValue } from "../../
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
5
|
+
import type { OneOrMore } from "../../utilities/_module";
|
|
6
|
+
import { type AsyncLazyable, type GetOrAddValue } from "../../utilities/_module";
|
|
7
|
+
import type { CacheEvents } from "../../cache/contracts/_module";
|
|
8
|
+
import type { TimeSpan } from "../../utilities/_module";
|
|
9
|
+
import type { LazyPromise } from "../../async/_module";
|
|
9
10
|
/**
|
|
10
11
|
* The <i>ICacheListenable</i> contract defines a way for listening <i>{@link ICache}</i> crud operations.
|
|
11
12
|
* @group Contracts
|
|
12
13
|
*/
|
|
13
|
-
export type ICacheListenable<TType = unknown> = IListenable<
|
|
14
|
+
export type ICacheListenable<TType = unknown> = IListenable<CacheEvents<TType>>;
|
|
14
15
|
/**
|
|
15
16
|
* @group Contracts
|
|
16
17
|
*/
|
|
@@ -29,107 +30,89 @@ export type WithTtlValue<TType> = {
|
|
|
29
30
|
export type ICache<TType = unknown> = ICacheListenable & {
|
|
30
31
|
/**
|
|
31
32
|
* The <i>exists</i> method returns true when <i>key</i> is found otherwise false will be returned.
|
|
32
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
33
33
|
*/
|
|
34
34
|
exists(key: string): LazyPromise<boolean>;
|
|
35
35
|
/**
|
|
36
36
|
* The <i>existsMany</i> method returns true for the <i>keys</i> that are found otherwise false will be returned.
|
|
37
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
38
37
|
*/
|
|
39
38
|
existsMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
40
39
|
/**
|
|
41
40
|
* The <i>missing</i> method returns true when <i>key</i> is not found otherwise false will be returned.
|
|
42
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
43
41
|
*/
|
|
44
42
|
missing(key: string): LazyPromise<boolean>;
|
|
45
43
|
/**
|
|
46
44
|
* The <i>missingMany</i> method returns true for the <i>keys</i> that are not found otherwise false will be returned.
|
|
47
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
48
45
|
*/
|
|
49
46
|
missingMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
50
47
|
/**
|
|
51
48
|
* The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
52
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
53
49
|
*/
|
|
54
50
|
get(key: string): LazyPromise<TType | null>;
|
|
55
51
|
/**
|
|
56
52
|
* The <i>getMany</i> returns the value for the <i>keys</i> that are found otherwise null will be returned.
|
|
57
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
58
53
|
*/
|
|
59
54
|
getMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, TType | null>>;
|
|
60
55
|
/**
|
|
61
56
|
* The <i>getOr</i> method returns the value when <i>key</i> is found otherwise <i>defaultValue</i> will be returned.
|
|
62
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
63
57
|
*/
|
|
64
58
|
getOr(key: string, defaultValue: AsyncLazyable<TType>): LazyPromise<TType>;
|
|
65
59
|
/**
|
|
66
60
|
* The <i>getOrMany</i> method returns the value for the keys that are found otherwise defaultValue will be returned.
|
|
67
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
68
61
|
*/
|
|
69
62
|
getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>): LazyPromise<Record<TKeys, TType>>;
|
|
70
63
|
/**
|
|
71
64
|
* The <i>getOrFail</i> method returns the value when <i>key</i> is found otherwise an error will be thrown.
|
|
72
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
73
65
|
* @throws {KeyNotFoundCacheError} {@link KeyNotFoundCacheError}
|
|
74
66
|
*/
|
|
75
67
|
getOrFail(key: string): LazyPromise<TType>;
|
|
76
68
|
/**
|
|
77
69
|
* 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.
|
|
78
70
|
* You can provide a <i>ttl</i> value. If null is passed, the item will not expire.
|
|
79
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
80
71
|
*/
|
|
81
72
|
add(key: string, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
|
|
82
73
|
/**
|
|
83
74
|
* The <i>addMany</i> method adds new keys. Returns true for the keys that where added otherwise false will be returned.
|
|
84
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
85
75
|
*/
|
|
86
76
|
addMany<TKeys extends string>(values: Record<TKeys, WithTtlValue<TType>>): LazyPromise<Record<TKeys, boolean>>;
|
|
87
77
|
/**
|
|
88
78
|
* The <i>update</i> method updates the given <i>key</i> with given <i>value</i>. Returns true when key otherwise false will be returned.
|
|
89
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
90
79
|
*/
|
|
91
80
|
update(key: string, value: TType): LazyPromise<boolean>;
|
|
92
81
|
/**
|
|
93
82
|
* The <i>updateMany</i> method updates the given keys. Returns true for the keys that where updated otherwise false will be returned.
|
|
94
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
95
83
|
*/
|
|
96
84
|
updateMany<TKeys extends string>(values: Record<TKeys, TType>): LazyPromise<Record<TKeys, boolean>>;
|
|
97
85
|
/**
|
|
98
|
-
* The <i>put</i> method replaces
|
|
99
|
-
*
|
|
100
|
-
*
|
|
86
|
+
* The <i>put</i> method replaces a <i>key</i> if the <i>key</i> exists including the ttl value or adds <i>key</i> that do not exists with a given <i>ttl</i>.
|
|
87
|
+
* Returns true if the <i>key</i> where replaced otherwise false is returned.
|
|
88
|
+
* You must provide a <i>ttl</i> value. If null is passed, the item will not expire.
|
|
101
89
|
*/
|
|
102
90
|
put(key: string, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
|
|
103
91
|
/**
|
|
104
|
-
* The <i>putMany</i> method replaces the keys that exists
|
|
105
|
-
*
|
|
92
|
+
* The <i>putMany</i> method replaces the keys that exists including their ttl values or adds keys that do not exists.
|
|
93
|
+
* Returns true for all the keys that where replaced otherwise false is returned.
|
|
106
94
|
*/
|
|
107
95
|
putMany<TKeys extends string>(values: Record<TKeys, WithTtlValue<TType>>): LazyPromise<Record<TKeys, boolean>>;
|
|
108
96
|
/**
|
|
109
97
|
* The <i>remove</i> method removes the given <i>key</i> when found. Returns true if the key is found otherwise false is returned.
|
|
110
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
111
98
|
*/
|
|
112
99
|
remove(key: string): LazyPromise<boolean>;
|
|
113
100
|
/**
|
|
114
101
|
* The <i>removeMany</i> method removes keys. Returns true for the keys that are removed otherwise false is returned.
|
|
115
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
116
102
|
*/
|
|
117
103
|
removeMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
118
104
|
/**
|
|
119
105
|
* The <i>getAndRemove</i> method removes the given <i>key</i> and returns it when found otherwise null will be returned.
|
|
120
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
121
106
|
*/
|
|
122
107
|
getAndRemove(key: string): LazyPromise<TType | null>;
|
|
123
108
|
/**
|
|
124
109
|
* The <i>getOrAdd</i> method will retrieve the given <i>key</i> if found otherwise <i>valueToAdd</i> will be added and returned.
|
|
125
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
126
110
|
*/
|
|
127
111
|
getOrAdd(key: string, valueToAdd: AsyncLazyable<GetOrAddValue<TType>>, ttl?: TimeSpan | null): LazyPromise<TType>;
|
|
128
112
|
/**
|
|
129
113
|
* The <i>increment</i> method will increment the given <i>key</i> if found otherwise nonthing will occur.
|
|
130
114
|
* Returns true if key is incremented otherwise false will be returned.
|
|
131
115
|
* An error will thrown if the key is not a number.
|
|
132
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
133
116
|
* @throws {TypeCacheError} {@link TypeCacheError}
|
|
134
117
|
*/
|
|
135
118
|
increment(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
@@ -137,53 +120,52 @@ export type ICache<TType = unknown> = ICacheListenable & {
|
|
|
137
120
|
* The <i>decrement</i> method will decrement the given <i>key</i> if found otherwise nonthing will occur.
|
|
138
121
|
* Returns true if key exists otherwise false will be returned.
|
|
139
122
|
* An error will thrown if the key is not a number.
|
|
140
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
141
123
|
* @throws {TypeCacheError} {@link TypeCacheError}
|
|
142
124
|
* An error will thrown if the key is not a number.
|
|
143
125
|
*/
|
|
144
126
|
decrement(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
145
127
|
/**
|
|
146
128
|
* The <i>clear</i> method removes all the keys in the cache.
|
|
147
|
-
* @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
|
|
148
129
|
*/
|
|
149
130
|
clear(): LazyPromise<void>;
|
|
150
131
|
/**
|
|
151
|
-
* The <i>
|
|
132
|
+
* The <i>getGroup</i> method returns the group name.
|
|
152
133
|
* @example
|
|
153
134
|
* ```ts
|
|
154
135
|
* import type { ICache } from "@daiso-tech/core";
|
|
155
136
|
*
|
|
156
137
|
* async function main(cache: ICache) {
|
|
157
|
-
* // Will be "@
|
|
158
|
-
* console.log(cache.
|
|
138
|
+
* // Will be "@global"
|
|
139
|
+
* console.log(cache.getGroup())
|
|
159
140
|
*
|
|
160
|
-
* const cacheA = cache.
|
|
141
|
+
* const cacheA = cache.withGroup("a");
|
|
161
142
|
*
|
|
162
|
-
* // Will be "@
|
|
163
|
-
* console.log(cacheA.
|
|
143
|
+
* // Will be "@global/a"
|
|
144
|
+
* console.log(cacheA.getGroup())
|
|
164
145
|
* }
|
|
165
146
|
* ```
|
|
166
147
|
*/
|
|
167
|
-
|
|
148
|
+
getGroup(): string;
|
|
168
149
|
};
|
|
169
150
|
/**
|
|
170
|
-
* The <i>
|
|
151
|
+
* The <i>IGroupableCache</i> contract defines a way for storing data as key-value pairs independent of data storage.
|
|
171
152
|
* It commes with one extra method which is useful for multitennat applications compared to <i>ICache</i>.
|
|
172
153
|
* @group Contracts
|
|
173
154
|
*/
|
|
174
|
-
export type
|
|
155
|
+
export type IGroupableCache<TType = unknown> = ICache<TType> & {
|
|
175
156
|
/**
|
|
176
|
-
* The <i>
|
|
157
|
+
* The <i>withGroup</i> method returns a new <i>{@link ICache}</i> instance that groups keys together.
|
|
158
|
+
* Only keys in the group can be updated, removed, or retrieved, leaving keys outside the group unaffected.
|
|
177
159
|
* This useful for multitennat applications.
|
|
178
160
|
* @example
|
|
179
161
|
* ```ts
|
|
180
162
|
* import { type ICache } from "@daiso-tech/core";
|
|
181
163
|
*
|
|
182
164
|
* async function main(cache: ICache): Promise<void> {
|
|
183
|
-
* const cacheA = cache.
|
|
165
|
+
* const cacheA = cache.withGroup("a");
|
|
184
166
|
* await cacheA.add("a", 1);
|
|
185
167
|
*
|
|
186
|
-
* const cacheB = cache.
|
|
168
|
+
* const cacheB = cache.withGroup("b");
|
|
187
169
|
* await cacheB.add("b", 2);
|
|
188
170
|
*
|
|
189
171
|
* // Will print { a: 1, b: null }
|
|
@@ -191,5 +173,5 @@ export type INamespacedCache<TType = unknown> = ICache<TType> & {
|
|
|
191
173
|
* }
|
|
192
174
|
* ```
|
|
193
175
|
*/
|
|
194
|
-
|
|
176
|
+
withGroup(group: OneOrMore<string>): ICache<TType>;
|
|
195
177
|
};
|
|
@@ -2,95 +2,42 @@
|
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
4
|
import type { TimeSpan } from "../../utilities/_module";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
export type CacheEvents<TType = unknown> = {
|
|
6
|
+
key_found: {
|
|
7
|
+
group: string;
|
|
8
|
+
key: string;
|
|
9
|
+
value: TType;
|
|
10
|
+
};
|
|
11
|
+
key_not_found: {
|
|
12
|
+
group: string;
|
|
13
|
+
key: string;
|
|
14
|
+
};
|
|
15
|
+
key_added: {
|
|
16
|
+
group: string;
|
|
17
|
+
key: string;
|
|
18
|
+
value: TType;
|
|
19
|
+
ttl: TimeSpan | null;
|
|
20
|
+
};
|
|
21
|
+
key_updated: {
|
|
22
|
+
group: string;
|
|
23
|
+
key: string;
|
|
24
|
+
value: TType;
|
|
25
|
+
};
|
|
26
|
+
key_removed: {
|
|
27
|
+
group: string;
|
|
28
|
+
key: string;
|
|
29
|
+
};
|
|
30
|
+
key_incremented: {
|
|
31
|
+
group: string;
|
|
32
|
+
key: string;
|
|
33
|
+
value: number;
|
|
34
|
+
};
|
|
35
|
+
key_decremented: {
|
|
36
|
+
group: string;
|
|
37
|
+
key: string;
|
|
38
|
+
value: number;
|
|
39
|
+
};
|
|
40
|
+
keys_cleared: {
|
|
41
|
+
group: string;
|
|
42
|
+
};
|
|
19
43
|
};
|
|
20
|
-
/**
|
|
21
|
-
* @group Events
|
|
22
|
-
*/
|
|
23
|
-
export type CacheEventNames = (typeof CACHE_EVENTS)[keyof typeof CACHE_EVENTS];
|
|
24
|
-
/**
|
|
25
|
-
* @group Events
|
|
26
|
-
*/
|
|
27
|
-
export type CacheEvent = {
|
|
28
|
-
namespace: string;
|
|
29
|
-
adapter: ICacheAdapter<any>;
|
|
30
|
-
};
|
|
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
|
-
/**
|
|
87
|
-
* This event will be triggered when cache is cleared.
|
|
88
|
-
* @group Events
|
|
89
|
-
*/
|
|
90
|
-
export type KeysClearedCacheEvent = CacheEvent & {
|
|
91
|
-
type: (typeof CACHE_EVENTS)["KEYS_CLEARED"];
|
|
92
|
-
};
|
|
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
|
*/
|
|
@@ -12,38 +12,47 @@ export type CacheAdapterTestSuiteSettings = {
|
|
|
12
12
|
test: TestAPI;
|
|
13
13
|
describe: SuiteAPI;
|
|
14
14
|
beforeEach: typeof beforeEach;
|
|
15
|
-
|
|
15
|
+
createAdapterA: () => Promisable<ICacheAdapter>;
|
|
16
|
+
createAdapterB: () => Promisable<ICacheAdapter>;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
|
-
* The <i>cacheAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ICacheAdapter}</i>.
|
|
19
|
+
* The <i>cacheAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ICacheAdapter}</i> with <i>vitest</i>.
|
|
19
20
|
* @group Utilities
|
|
20
21
|
* @example
|
|
21
22
|
* ```ts
|
|
23
|
+
* import Redis from "ioredis";
|
|
22
24
|
* import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
23
|
-
* import {
|
|
24
|
-
* import
|
|
25
|
+
* import { RedisContainer, type StartedRedisContainer } from "@testcontainers/redis";
|
|
26
|
+
* import { SuperJsonSerde, TimeSpan, RedisCacheAdapter, cacheAdapterTestSuite } from "@daiso-tech/core";
|
|
25
27
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
28
|
+
* const timeout = TimeSpan.fromMinutes(2);
|
|
29
|
+
* describe("class: RedisCacheAdapter", () => {
|
|
30
|
+
* let client: Redis;
|
|
31
|
+
* let startedContainer: StartedRedisContainer;
|
|
32
|
+
* const serde = new SuperJsonSerde();
|
|
33
|
+
* beforeEach(async () => {
|
|
34
|
+
* startedContainer = await new RedisContainer("redis:7.4.2").start();
|
|
35
|
+
* client = new Redis(startedContainer.getConnectionUrl());
|
|
36
|
+
* }, timeout.toMilliseconds());
|
|
37
|
+
* afterEach(async () => {
|
|
38
|
+
* await client.quit();
|
|
39
|
+
* await startedContainer.stop();
|
|
40
|
+
* }, timeout.toMilliseconds());
|
|
34
41
|
* cacheAdapterTestSuite({
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
42
|
+
* createAdapterA: () =>
|
|
43
|
+
* new RedisCacheAdapter(client, {
|
|
44
|
+
* serde,
|
|
45
|
+
* rootGroup: "@a"
|
|
46
|
+
* }),
|
|
47
|
+
* createAdapterB: () =>
|
|
48
|
+
* new RedisCacheAdapter(client, {
|
|
49
|
+
* serde,
|
|
50
|
+
* rootGroup: "@b"
|
|
51
|
+
* }),
|
|
52
|
+
* test,
|
|
53
|
+
* beforeEach,
|
|
54
|
+
* expect,
|
|
55
|
+
* describe,
|
|
47
56
|
* });
|
|
48
57
|
* });
|
|
49
58
|
* ```
|
|
@@ -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 { SuperJsonSerde, 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 serde = new SuperJsonSerde();
|
|
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
|
+
* serde,
|
|
47
|
+
* }),
|
|
48
|
+
* {
|
|
49
|
+
* rootGroup: "@a",
|
|
50
|
+
* eventBus,
|
|
51
|
+
* }
|
|
52
|
+
* ),
|
|
53
|
+
* createCacheB: () =>
|
|
54
|
+
* new Cache(
|
|
55
|
+
* new RedisCacheAdapter(client, {
|
|
56
|
+
* serde,
|
|
57
|
+
* }),
|
|
58
|
+
* {
|
|
59
|
+
* rootGroup: "@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;
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type ICacheAdapter } from "../../../../cache/contracts/_module";
|
|
5
5
|
import { type Kysely } from "kysely";
|
|
6
|
-
import { type
|
|
7
|
-
import type { IDeinitizable, IInitizable } from "../../../../
|
|
6
|
+
import { type ISerde } from "../../../../serde/contracts/_module";
|
|
7
|
+
import type { IDeinitizable, IInitizable, OneOrMore } from "../../../../utilities/_module";
|
|
8
8
|
import { TimeSpan } from "../../../../utilities/_module";
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
12
|
type KyselySqliteCacheTable = {
|
|
13
|
+
group: string;
|
|
13
14
|
key: string;
|
|
14
15
|
value: string;
|
|
15
16
|
expiresAt: number | null;
|
|
@@ -24,32 +25,37 @@ type KyselySqliteTables = {
|
|
|
24
25
|
* @internal
|
|
25
26
|
*/
|
|
26
27
|
type KyselySqliteSettings = {
|
|
27
|
-
|
|
28
|
+
serde: ISerde<string>;
|
|
28
29
|
enableTransactions: boolean;
|
|
29
30
|
expiredKeysRemovalInterval?: TimeSpan;
|
|
30
31
|
shouldRemoveExpiredKeys?: boolean;
|
|
32
|
+
rootGroup: OneOrMore<string>;
|
|
31
33
|
};
|
|
32
34
|
/**
|
|
33
35
|
* @internal
|
|
34
36
|
*/
|
|
35
37
|
export declare class KyselySqliteCacheAdapter<TType> implements ICacheAdapter<TType>, IInitizable, IDeinitizable {
|
|
36
38
|
private readonly db;
|
|
37
|
-
private readonly
|
|
39
|
+
private readonly group;
|
|
40
|
+
private readonly serde;
|
|
38
41
|
private readonly enableTransactions;
|
|
39
42
|
private readonly expiredKeysRemovalInterval;
|
|
40
43
|
private readonly shouldRemoveExpiredKeys;
|
|
41
44
|
private timeoutId;
|
|
42
45
|
constructor(db: Kysely<KyselySqliteTables>, settings: KyselySqliteSettings);
|
|
46
|
+
getGroup(): string;
|
|
47
|
+
withGroup(group: OneOrMore<string>): ICacheAdapter<TType>;
|
|
43
48
|
private withTransaction;
|
|
44
49
|
removeExpiredKeys(): Promise<void>;
|
|
45
50
|
init(): Promise<void>;
|
|
46
51
|
deInit(): Promise<void>;
|
|
52
|
+
exists(key: string): Promise<boolean>;
|
|
47
53
|
get(key: string): Promise<TType | null>;
|
|
48
54
|
add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
|
|
49
55
|
update(key: string, value: TType): Promise<boolean>;
|
|
50
56
|
put(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
|
|
51
57
|
remove(key: string): Promise<boolean>;
|
|
52
58
|
increment(key: string, value: number): Promise<boolean>;
|
|
53
|
-
clear(
|
|
59
|
+
clear(): Promise<void>;
|
|
54
60
|
}
|
|
55
61
|
export {};
|
package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts
CHANGED
|
@@ -1,47 +1,60 @@
|
|
|
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
|
-
import type {
|
|
7
|
-
import type { TimeSpan } from "../../../../utilities/_module";
|
|
5
|
+
import type { ISerde } from "../../../../serde/contracts/_module";
|
|
6
|
+
import type { TimeSpan, IDeinitizable, IInitizable, OneOrMore } 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
|
-
|
|
13
|
+
serde: ISerde<string>;
|
|
15
14
|
enableTransactions?: boolean;
|
|
16
15
|
expiredKeysRemovalInterval?: TimeSpan;
|
|
17
16
|
shouldRemoveExpiredKeys?: boolean;
|
|
17
|
+
rootGroup: OneOrMore<string>;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* To utilize the <i>LibsqlCacheAdapter</i>, you must install the <i>"@libsql/client"</i> package and supply a <i>{@link
|
|
20
|
+
* To utilize the <i>LibsqlCacheAdapter</i>, you must install the <i>"@libsql/client"</i> package and supply a <i>{@link ISerde | string serde}</i>, such as <i>{@link SuperJsonSerde}</i>.
|
|
21
21
|
* @group Adapters
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
24
|
-
* import { LibsqlCacheAdapter,
|
|
24
|
+
* import { LibsqlCacheAdapter, SuperJsonSerde } from "@daiso-tech/core";
|
|
25
25
|
* import { createClient } from "@libsql/client";
|
|
26
26
|
*
|
|
27
27
|
* const client = createClient({ url: "file:local.db" });
|
|
28
|
-
* const
|
|
28
|
+
* const serde = new SuperJsonSerde();
|
|
29
29
|
* const cacheAdapter = new LibsqlCacheAdapter(client, {
|
|
30
|
-
*
|
|
30
|
+
* serde,
|
|
31
|
+
* rootGroup: "@global"
|
|
31
32
|
* });
|
|
33
|
+
*
|
|
34
|
+
* (async () => {
|
|
35
|
+
* // You only need to call it once before using the adapter.
|
|
36
|
+
* await cacheAdapter.init();
|
|
37
|
+
* await cacheAdapter.add("a", 1);
|
|
38
|
+
*
|
|
39
|
+
* // Will remove the cache
|
|
40
|
+
* await cacheAdapter.deInit();
|
|
41
|
+
* })();
|
|
32
42
|
* ```
|
|
33
43
|
*/
|
|
34
44
|
export declare class LibsqlCacheAdapter<TType> implements ICacheAdapter<TType>, IInitizable, IDeinitizable {
|
|
35
45
|
private readonly cacheAdapter;
|
|
36
46
|
constructor(client: Client, settings: LibsqlCacheAdapterSettings);
|
|
47
|
+
getGroup(): string;
|
|
48
|
+
withGroup(group: OneOrMore<string>): ICacheAdapter<TType>;
|
|
37
49
|
removeExpiredKeys(): Promise<void>;
|
|
38
50
|
deInit(): Promise<void>;
|
|
39
51
|
init(): Promise<void>;
|
|
52
|
+
exists(key: string): Promise<boolean>;
|
|
40
53
|
get(key: string): Promise<TType | null>;
|
|
41
54
|
add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
|
|
42
55
|
update(key: string, value: TType): Promise<boolean>;
|
|
43
56
|
put(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
|
|
44
57
|
remove(key: string): Promise<boolean>;
|
|
45
58
|
increment(key: string, value: number): Promise<boolean>;
|
|
46
|
-
clear(
|
|
59
|
+
clear(): Promise<void>;
|
|
47
60
|
}
|