@daiso-tech/core 0.2.1 → 0.4.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 +5 -1
- package/dist/cjs/_module.js.map +1 -1
- package/dist/cjs/_shared/kysely/_module.js +18 -0
- package/dist/cjs/_shared/kysely/_module.js.map +1 -0
- package/dist/cjs/_shared/kysely/kysely-table-name-transformer-plugin.js +45 -0
- package/dist/cjs/_shared/kysely/kysely-table-name-transformer-plugin.js.map +1 -0
- package/dist/cjs/_shared/redis/_module.js +20 -0
- package/dist/cjs/_shared/redis/_module.js.map +1 -0
- package/dist/cjs/_shared/redis/clear-iterable.js +25 -0
- package/dist/cjs/_shared/redis/clear-iterable.js.map +1 -0
- package/dist/cjs/_shared/redis/escape-redis-chars.js +41 -0
- package/dist/cjs/_shared/redis/escape-redis-chars.js.map +1 -0
- package/dist/cjs/_shared/redis/is-redis-type-error.js +9 -0
- package/dist/cjs/_shared/redis/is-redis-type-error.js.map +1 -0
- package/dist/cjs/_shared/utilities.js.map +1 -1
- package/dist/cjs/async/_module.js +29 -0
- package/dist/cjs/async/_module.js.map +1 -0
- package/dist/cjs/async/_shared.js +34 -0
- package/dist/cjs/async/_shared.js.map +1 -0
- package/dist/cjs/async/abortable/_module.js +18 -0
- package/dist/cjs/async/abortable/_module.js.map +1 -0
- package/dist/cjs/async/abortable/abortable.js +48 -0
- package/dist/cjs/async/abortable/abortable.js.map +1 -0
- package/dist/cjs/async/abortable-iterable/_module.js +18 -0
- package/dist/cjs/async/abortable-iterable/_module.js.map +1 -0
- package/dist/cjs/async/abortable-iterable/abortable-iterable.js +32 -0
- package/dist/cjs/async/abortable-iterable/abortable-iterable.js.map +1 -0
- package/dist/cjs/async/backof-policies/_module.js +21 -0
- package/dist/cjs/async/backof-policies/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/_shared.js +7 -0
- package/dist/cjs/async/backof-policies/_shared.js.map +1 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +19 -0
- 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/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +23 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +23 -0
- 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/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +23 -0
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/cjs/async/delay/_module.js +18 -0
- package/dist/cjs/async/delay/_module.js.map +1 -0
- package/dist/cjs/async/delay/delay.js +24 -0
- package/dist/cjs/async/delay/delay.js.map +1 -0
- package/dist/cjs/async/delay-iterable/_module.js +18 -0
- package/dist/cjs/async/delay-iterable/_module.js.map +1 -0
- package/dist/cjs/async/delay-iterable/delay-iterable.js +36 -0
- package/dist/cjs/async/delay-iterable/delay-iterable.js.map +1 -0
- package/dist/cjs/async/lazy-promise/_module.js +18 -0
- package/dist/cjs/async/lazy-promise/_module.js.map +1 -0
- package/dist/cjs/async/lazy-promise/lazy-promise.js +22 -0
- package/dist/cjs/async/lazy-promise/lazy-promise.js.map +1 -0
- package/dist/cjs/async/retry/_module.js +18 -0
- package/dist/cjs/async/retry/_module.js.map +1 -0
- package/dist/cjs/async/retry/retry.js +43 -0
- package/dist/cjs/async/retry/retry.js.map +1 -0
- package/dist/cjs/async/retry-iterable/_module.js +18 -0
- package/dist/cjs/async/retry-iterable/_module.js.map +1 -0
- package/dist/cjs/async/retry-iterable/retry-iterable.js +32 -0
- package/dist/cjs/async/retry-iterable/retry-iterable.js.map +1 -0
- package/dist/cjs/async/timeout/_module.js +18 -0
- package/dist/cjs/async/timeout/_module.js.map +1 -0
- package/dist/cjs/async/timeout/timeout.js +28 -0
- package/dist/cjs/async/timeout/timeout.js.map +1 -0
- package/dist/cjs/async/timeout-iterable/_module.js +18 -0
- package/dist/cjs/async/timeout-iterable/_module.js.map +1 -0
- package/dist/cjs/async/timeout-iterable/timeout-iterable.js +11 -0
- package/dist/cjs/async/timeout-iterable/timeout-iterable.js.map +1 -0
- package/dist/cjs/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/cjs/contracts/_module.js +2 -0
- package/dist/cjs/contracts/_module.js.map +1 -1
- package/dist/cjs/contracts/collection/_module.js.map +1 -1
- package/dist/cjs/contracts/serializer/_module.js +18 -0
- package/dist/cjs/contracts/serializer/_module.js.map +1 -0
- package/dist/cjs/contracts/serializer/serializer.contract.js +25 -0
- package/dist/cjs/contracts/serializer/serializer.contract.js.map +1 -0
- package/dist/cjs/contracts/storage/_module.js +20 -0
- package/dist/cjs/contracts/storage/_module.js.map +1 -0
- package/dist/cjs/contracts/storage/_shared.js +32 -0
- package/dist/cjs/contracts/storage/_shared.js.map +1 -0
- package/dist/cjs/contracts/storage/storage-adapter.contract.js +3 -0
- package/dist/cjs/contracts/storage/storage-adapter.contract.js.map +1 -0
- package/dist/cjs/contracts/storage/storage.contract.js +3 -0
- package/dist/cjs/contracts/storage/storage.contract.js.map +1 -0
- package/dist/cjs/serializer/_module.js +22 -0
- package/dist/cjs/serializer/_module.js.map +1 -0
- package/dist/cjs/serializer/_shared/test-utilities/_module.js +18 -0
- package/dist/cjs/serializer/_shared/test-utilities/_module.js.map +1 -0
- package/dist/cjs/serializer/_shared/test-utilities/serializer.test-suite.js +361 -0
- package/dist/cjs/serializer/_shared/test-utilities/serializer.test-suite.js.map +1 -0
- package/dist/cjs/serializer/mongodb-serializer/_module.js +18 -0
- package/dist/cjs/serializer/mongodb-serializer/_module.js.map +1 -0
- package/dist/cjs/serializer/mongodb-serializer/mongodb-serializer.js +36 -0
- package/dist/cjs/serializer/mongodb-serializer/mongodb-serializer.js.map +1 -0
- package/dist/cjs/serializer/redis-serializer/_module.js +18 -0
- package/dist/cjs/serializer/redis-serializer/_module.js.map +1 -0
- package/dist/cjs/serializer/redis-serializer/redis-serializer.js +37 -0
- package/dist/cjs/serializer/redis-serializer/redis-serializer.js.map +1 -0
- package/dist/cjs/serializer/sql-serializer/_module.js +18 -0
- package/dist/cjs/serializer/sql-serializer/_module.js.map +1 -0
- package/dist/cjs/serializer/sql-serializer/sql-serializer.js +37 -0
- package/dist/cjs/serializer/sql-serializer/sql-serializer.js.map +1 -0
- package/dist/cjs/serializer/super-json-serializer/_module.js +18 -0
- package/dist/cjs/serializer/super-json-serializer/_module.js.map +1 -0
- package/dist/cjs/serializer/super-json-serializer/super-json-serializer.js +304 -0
- package/dist/cjs/serializer/super-json-serializer/super-json-serializer.js.map +1 -0
- package/dist/cjs/storage/_module.js +23 -0
- package/dist/cjs/storage/_module.js.map +1 -0
- package/dist/cjs/storage/_shared/test-utilities/_module.js +18 -0
- package/dist/cjs/storage/_shared/test-utilities/_module.js.map +1 -0
- package/dist/cjs/storage/_shared/test-utilities/storage-api.test-suite.js +572 -0
- package/dist/cjs/storage/_shared/test-utilities/storage-api.test-suite.js.map +1 -0
- package/dist/cjs/storage/_shared/test-utilities/storage-namespace.test-suite.js +241 -0
- package/dist/cjs/storage/_shared/test-utilities/storage-namespace.test-suite.js.map +1 -0
- package/dist/cjs/storage/_shared/test-utilities/storage-value.test-suite.js +4172 -0
- package/dist/cjs/storage/_shared/test-utilities/storage-value.test-suite.js.map +1 -0
- package/dist/cjs/storage/_shared/test-utilities/storage.test-suite.js +12 -0
- package/dist/cjs/storage/_shared/test-utilities/storage.test-suite.js.map +1 -0
- package/dist/cjs/storage/memory-storage-adapter/_module.js +18 -0
- package/dist/cjs/storage/memory-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/memory-storage-adapter/memory-storage-adapter.js +62 -0
- package/dist/cjs/storage/memory-storage-adapter/memory-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/mongodb-storage-adapter/_module.js +6 -0
- package/dist/cjs/storage/mongodb-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/mongodb-storage-adapter/mongodb-storage-adapter.js +273 -0
- package/dist/cjs/storage/mongodb-storage-adapter/mongodb-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/namespace-storage-adapter.js +66 -0
- package/dist/cjs/storage/namespace-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/redis-storage-adapter/_module.js +18 -0
- package/dist/cjs/storage/redis-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/redis-storage-adapter/redis-storage-adapter.js +248 -0
- package/dist/cjs/storage/redis-storage-adapter/redis-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/sqlite/_module.js +19 -0
- package/dist/cjs/storage/sqlite/_module.js.map +1 -0
- package/dist/cjs/storage/sqlite/_shared/_module.js +18 -0
- package/dist/cjs/storage/sqlite/_shared/_module.js.map +1 -0
- package/dist/cjs/storage/sqlite/_shared/base-sqlite-storage-adapter.js +224 -0
- package/dist/cjs/storage/sqlite/_shared/base-sqlite-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/sqlite/libsql-storage-adapter/_module.js +18 -0
- package/dist/cjs/storage/sqlite/libsql-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.js +53 -0
- package/dist/cjs/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/sqlite/sqlite-storage-adapter/_module.js +18 -0
- package/dist/cjs/storage/sqlite/sqlite-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js +52 -0
- package/dist/cjs/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/storage.js +301 -0
- package/dist/cjs/storage/storage.js.map +1 -0
- package/dist/cjs/storage/usable-storage-adapter.js +102 -0
- package/dist/cjs/storage/usable-storage-adapter.js.map +1 -0
- package/dist/cjs/utilities/_module.js +18 -0
- package/dist/cjs/utilities/_module.js.map +1 -0
- package/dist/cjs/utilities/time-span/_module.js +18 -0
- package/dist/cjs/utilities/time-span/_module.js.map +1 -0
- package/dist/cjs/utilities/time-span/time-span.js +103 -0
- package/dist/cjs/utilities/time-span/time-span.js.map +1 -0
- package/dist/esm/_module.js +5 -1
- package/dist/esm/_module.js.map +1 -1
- package/dist/esm/_shared/kysely/_module.js +2 -0
- package/dist/esm/_shared/kysely/_module.js.map +1 -0
- package/dist/esm/_shared/kysely/kysely-table-name-transformer-plugin.js +41 -0
- package/dist/esm/_shared/kysely/kysely-table-name-transformer-plugin.js.map +1 -0
- package/dist/esm/_shared/redis/_module.js +4 -0
- package/dist/esm/_shared/redis/_module.js.map +1 -0
- package/dist/esm/_shared/redis/clear-iterable.js +21 -0
- package/dist/esm/_shared/redis/clear-iterable.js.map +1 -0
- package/dist/esm/_shared/redis/escape-redis-chars.js +38 -0
- package/dist/esm/_shared/redis/escape-redis-chars.js.map +1 -0
- package/dist/esm/_shared/redis/is-redis-type-error.js +6 -0
- package/dist/esm/_shared/redis/is-redis-type-error.js.map +1 -0
- package/dist/esm/_shared/utilities.js.map +1 -1
- package/dist/esm/async/_module.js +11 -0
- package/dist/esm/async/_module.js.map +1 -0
- package/dist/esm/async/_shared.js +27 -0
- package/dist/esm/async/_shared.js.map +1 -0
- package/dist/esm/async/abortable/_module.js +2 -0
- package/dist/esm/async/abortable/_module.js.map +1 -0
- package/dist/esm/async/abortable/abortable.js +45 -0
- package/dist/esm/async/abortable/abortable.js.map +1 -0
- package/dist/esm/async/abortable-iterable/_module.js +2 -0
- package/dist/esm/async/abortable-iterable/_module.js.map +1 -0
- package/dist/esm/async/abortable-iterable/abortable-iterable.js +29 -0
- package/dist/esm/async/abortable-iterable/abortable-iterable.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 +4 -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/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +16 -0
- 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/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +20 -0
- 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/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +20 -0
- 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/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +20 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/esm/async/delay/_module.js +2 -0
- package/dist/esm/async/delay/_module.js.map +1 -0
- package/dist/esm/async/delay/delay.js +21 -0
- package/dist/esm/async/delay/delay.js.map +1 -0
- package/dist/esm/async/delay-iterable/_module.js +2 -0
- package/dist/esm/async/delay-iterable/_module.js.map +1 -0
- package/dist/esm/async/delay-iterable/delay-iterable.js +33 -0
- package/dist/esm/async/delay-iterable/delay-iterable.js.map +1 -0
- package/dist/esm/async/lazy-promise/_module.js +2 -0
- package/dist/esm/async/lazy-promise/_module.js.map +1 -0
- package/dist/esm/async/lazy-promise/lazy-promise.js +17 -0
- package/dist/esm/async/lazy-promise/lazy-promise.js.map +1 -0
- package/dist/esm/async/retry/_module.js +2 -0
- package/dist/esm/async/retry/_module.js.map +1 -0
- package/dist/esm/async/retry/retry.js +40 -0
- package/dist/esm/async/retry/retry.js.map +1 -0
- package/dist/esm/async/retry-iterable/_module.js +2 -0
- package/dist/esm/async/retry-iterable/_module.js.map +1 -0
- package/dist/esm/async/retry-iterable/retry-iterable.js +29 -0
- package/dist/esm/async/retry-iterable/retry-iterable.js.map +1 -0
- package/dist/esm/async/timeout/_module.js +2 -0
- package/dist/esm/async/timeout/_module.js.map +1 -0
- package/dist/esm/async/timeout/timeout.js +25 -0
- package/dist/esm/async/timeout/timeout.js.map +1 -0
- package/dist/esm/async/timeout-iterable/_module.js +2 -0
- package/dist/esm/async/timeout-iterable/_module.js.map +1 -0
- package/dist/esm/async/timeout-iterable/timeout-iterable.js +8 -0
- package/dist/esm/async/timeout-iterable/timeout-iterable.js.map +1 -0
- package/dist/esm/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/esm/contracts/_module.js +2 -0
- package/dist/esm/contracts/_module.js.map +1 -1
- package/dist/esm/contracts/collection/_module.js.map +1 -1
- package/dist/esm/contracts/serializer/_module.js +2 -0
- package/dist/esm/contracts/serializer/_module.js.map +1 -0
- package/dist/esm/contracts/serializer/serializer.contract.js +19 -0
- package/dist/esm/contracts/serializer/serializer.contract.js.map +1 -0
- package/dist/esm/contracts/storage/_module.js +4 -0
- package/dist/esm/contracts/storage/_module.js.map +1 -0
- package/dist/esm/contracts/storage/_shared.js +25 -0
- package/dist/esm/contracts/storage/_shared.js.map +1 -0
- package/dist/esm/contracts/storage/storage-adapter.contract.js +1 -0
- package/dist/esm/contracts/storage/storage-adapter.contract.js.map +1 -0
- package/dist/esm/contracts/storage/storage.contract.js +1 -0
- package/dist/esm/contracts/storage/storage.contract.js.map +1 -0
- package/dist/esm/serializer/_module.js +6 -0
- package/dist/esm/serializer/_module.js.map +1 -0
- package/dist/esm/serializer/_shared/test-utilities/_module.js +2 -0
- package/dist/esm/serializer/_shared/test-utilities/_module.js.map +1 -0
- package/dist/esm/serializer/_shared/test-utilities/serializer.test-suite.js +358 -0
- package/dist/esm/serializer/_shared/test-utilities/serializer.test-suite.js.map +1 -0
- package/dist/esm/serializer/mongodb-serializer/_module.js +2 -0
- package/dist/esm/serializer/mongodb-serializer/_module.js.map +1 -0
- package/dist/esm/serializer/mongodb-serializer/mongodb-serializer.js +32 -0
- package/dist/esm/serializer/mongodb-serializer/mongodb-serializer.js.map +1 -0
- package/dist/esm/serializer/redis-serializer/_module.js +2 -0
- package/dist/esm/serializer/redis-serializer/_module.js.map +1 -0
- package/dist/esm/serializer/redis-serializer/redis-serializer.js +33 -0
- package/dist/esm/serializer/redis-serializer/redis-serializer.js.map +1 -0
- package/dist/esm/serializer/sql-serializer/_module.js +2 -0
- package/dist/esm/serializer/sql-serializer/_module.js.map +1 -0
- package/dist/esm/serializer/sql-serializer/sql-serializer.js +33 -0
- package/dist/esm/serializer/sql-serializer/sql-serializer.js.map +1 -0
- package/dist/esm/serializer/super-json-serializer/_module.js +2 -0
- package/dist/esm/serializer/super-json-serializer/_module.js.map +1 -0
- package/dist/esm/serializer/super-json-serializer/super-json-serializer.js +277 -0
- package/dist/esm/serializer/super-json-serializer/super-json-serializer.js.map +1 -0
- package/dist/esm/storage/_module.js +7 -0
- package/dist/esm/storage/_module.js.map +1 -0
- package/dist/esm/storage/_shared/test-utilities/_module.js +2 -0
- package/dist/esm/storage/_shared/test-utilities/_module.js.map +1 -0
- package/dist/esm/storage/_shared/test-utilities/storage-api.test-suite.js +569 -0
- package/dist/esm/storage/_shared/test-utilities/storage-api.test-suite.js.map +1 -0
- package/dist/esm/storage/_shared/test-utilities/storage-namespace.test-suite.js +238 -0
- package/dist/esm/storage/_shared/test-utilities/storage-namespace.test-suite.js.map +1 -0
- package/dist/esm/storage/_shared/test-utilities/storage-value.test-suite.js +4169 -0
- package/dist/esm/storage/_shared/test-utilities/storage-value.test-suite.js.map +1 -0
- package/dist/esm/storage/_shared/test-utilities/storage.test-suite.js +9 -0
- package/dist/esm/storage/_shared/test-utilities/storage.test-suite.js.map +1 -0
- package/dist/esm/storage/memory-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/memory-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/memory-storage-adapter/memory-storage-adapter.js +58 -0
- package/dist/esm/storage/memory-storage-adapter/memory-storage-adapter.js.map +1 -0
- package/dist/esm/storage/mongodb-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/mongodb-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/mongodb-storage-adapter/mongodb-storage-adapter.js +266 -0
- package/dist/esm/storage/mongodb-storage-adapter/mongodb-storage-adapter.js.map +1 -0
- package/dist/esm/storage/namespace-storage-adapter.js +62 -0
- package/dist/esm/storage/namespace-storage-adapter.js.map +1 -0
- package/dist/esm/storage/redis-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/redis-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/redis-storage-adapter/redis-storage-adapter.js +244 -0
- package/dist/esm/storage/redis-storage-adapter/redis-storage-adapter.js.map +1 -0
- package/dist/esm/storage/sqlite/_module.js +3 -0
- package/dist/esm/storage/sqlite/_module.js.map +1 -0
- package/dist/esm/storage/sqlite/_shared/_module.js +2 -0
- package/dist/esm/storage/sqlite/_shared/_module.js.map +1 -0
- package/dist/esm/storage/sqlite/_shared/base-sqlite-storage-adapter.js +220 -0
- package/dist/esm/storage/sqlite/_shared/base-sqlite-storage-adapter.js.map +1 -0
- package/dist/esm/storage/sqlite/libsql-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/sqlite/libsql-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.js +49 -0
- package/dist/esm/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +1 -0
- package/dist/esm/storage/sqlite/sqlite-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/sqlite/sqlite-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js +48 -0
- package/dist/esm/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +1 -0
- package/dist/esm/storage/storage.js +297 -0
- package/dist/esm/storage/storage.js.map +1 -0
- package/dist/esm/storage/usable-storage-adapter.js +98 -0
- package/dist/esm/storage/usable-storage-adapter.js.map +1 -0
- package/dist/esm/utilities/_module.js +2 -0
- package/dist/esm/utilities/_module.js.map +1 -0
- package/dist/esm/utilities/time-span/_module.js +2 -0
- package/dist/esm/utilities/time-span/_module.js.map +1 -0
- package/dist/esm/utilities/time-span/time-span.js +99 -0
- package/dist/esm/utilities/time-span/time-span.js.map +1 -0
- package/dist/types/_module.d.ts +5 -1
- package/dist/types/_shared/kysely/_module.d.ts +1 -0
- package/dist/types/_shared/kysely/kysely-table-name-transformer-plugin.d.ts +13 -0
- package/dist/types/_shared/redis/_module.d.ts +3 -0
- package/dist/types/_shared/redis/clear-iterable.d.ts +13 -0
- package/dist/types/_shared/redis/escape-redis-chars.d.ts +7 -0
- package/dist/types/_shared/redis/is-redis-type-error.d.ts +7 -0
- package/dist/types/_shared/types.d.ts +15 -2
- package/dist/types/_shared/utilities.d.ts +5 -1
- package/dist/types/async/_module.d.ts +10 -0
- package/dist/types/async/_shared.d.ts +35 -0
- package/dist/types/async/abortable/_module.d.ts +1 -0
- package/dist/types/async/abortable/abortable.d.ts +39 -0
- package/dist/types/async/abortable-iterable/_module.d.ts +1 -0
- package/dist/types/async/abortable-iterable/abortable-iterable.d.ts +36 -0
- package/dist/types/async/backof-policies/_module.d.ts +5 -0
- package/dist/types/async/backof-policies/_shared.d.ts +12 -0
- package/dist/types/async/backof-policies/constant-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +28 -0
- package/dist/types/async/backof-policies/exponential-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +36 -0
- package/dist/types/async/backof-policies/linear-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +32 -0
- package/dist/types/async/backof-policies/polynomial-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +36 -0
- package/dist/types/async/delay/_module.d.ts +1 -0
- package/dist/types/async/delay/delay.d.ts +38 -0
- package/dist/types/async/delay-iterable/_module.d.ts +1 -0
- package/dist/types/async/delay-iterable/delay-iterable.d.ts +57 -0
- package/dist/types/async/lazy-promise/_module.d.ts +1 -0
- package/dist/types/async/lazy-promise/lazy-promise.d.ts +28 -0
- package/dist/types/async/retry/_module.d.ts +1 -0
- package/dist/types/async/retry/retry.d.ts +86 -0
- package/dist/types/async/retry-iterable/_module.d.ts +1 -0
- package/dist/types/async/retry-iterable/retry-iterable.d.ts +86 -0
- package/dist/types/async/timeout/_module.d.ts +1 -0
- package/dist/types/async/timeout/timeout.d.ts +40 -0
- package/dist/types/async/timeout-iterable/_module.d.ts +1 -0
- package/dist/types/async/timeout-iterable/timeout-iterable.d.ts +64 -0
- package/dist/types/collection/_shared.d.ts +1 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-cross-join-iterable.d.ts +2 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-group-by-iterable.d.ts +1 -1
- package/dist/types/collection/async-iterable-collection/async-iterable-collection.d.ts +2 -2
- package/dist/types/collection/iterable-collection/_shared/cross-join-iterable.d.ts +1 -1
- package/dist/types/collection/iterable-collection/_shared/group-by-iterable.d.ts +1 -1
- package/dist/types/collection/iterable-collection/iterable-collection.d.ts +1 -1
- package/dist/types/collection/list-collection/list-collection.d.ts +1 -1
- package/dist/types/contracts/_module.d.ts +2 -0
- package/dist/types/contracts/collection/_module.d.ts +0 -3
- package/dist/types/contracts/collection/_shared.d.ts +1 -1
- package/dist/types/contracts/collection/async-collection.contract.d.ts +3 -3
- package/dist/types/contracts/collection/collection.contract.d.ts +3 -3
- package/dist/types/contracts/serializer/_module.d.ts +1 -0
- package/dist/types/contracts/serializer/serializer.contract.d.ts +37 -0
- package/dist/types/contracts/storage/_module.d.ts +3 -0
- package/dist/types/contracts/storage/_shared.d.ts +27 -0
- package/dist/types/contracts/storage/storage-adapter.contract.d.ts +72 -0
- package/dist/types/contracts/storage/storage.contract.d.ts +148 -0
- package/dist/types/serializer/_module.d.ts +5 -0
- package/dist/types/serializer/_shared/test-utilities/_module.d.ts +1 -0
- package/dist/types/serializer/_shared/test-utilities/serializer.test-suite.d.ts +18 -0
- package/dist/types/serializer/mongodb-serializer/_module.d.ts +1 -0
- package/dist/types/serializer/mongodb-serializer/mongodb-serializer.d.ts +13 -0
- package/dist/types/serializer/redis-serializer/_module.d.ts +1 -0
- package/dist/types/serializer/redis-serializer/redis-serializer.d.ts +13 -0
- package/dist/types/serializer/sql-serializer/_module.d.ts +1 -0
- package/dist/types/serializer/sql-serializer/sql-serializer.d.ts +13 -0
- package/dist/types/serializer/super-json-serializer/_module.d.ts +1 -0
- package/dist/types/serializer/super-json-serializer/super-json-serializer.d.ts +37 -0
- package/dist/types/storage/_module.d.ts +6 -0
- package/dist/types/storage/_shared/test-utilities/_module.d.ts +1 -0
- package/dist/types/storage/_shared/test-utilities/storage-api.test-suite.d.ts +20 -0
- package/dist/types/storage/_shared/test-utilities/storage-namespace.test-suite.d.ts +20 -0
- package/dist/types/storage/_shared/test-utilities/storage-value.test-suite.d.ts +20 -0
- package/dist/types/storage/_shared/test-utilities/storage.test-suite.d.ts +20 -0
- package/dist/types/storage/memory-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/memory-storage-adapter/memory-storage-adapter.d.ts +16 -0
- package/dist/types/storage/mongodb-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/mongodb-storage-adapter/mongodb-storage-adapter.d.ts +46 -0
- package/dist/types/storage/namespace-storage-adapter.d.ts +30 -0
- package/dist/types/storage/redis-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/redis-storage-adapter/redis-storage-adapter.d.ts +41 -0
- package/dist/types/storage/sqlite/_module.d.ts +2 -0
- package/dist/types/storage/sqlite/_shared/_module.d.ts +1 -0
- package/dist/types/storage/sqlite/_shared/base-sqlite-storage-adapter.d.ts +42 -0
- package/dist/types/storage/sqlite/libsql-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.d.ts +30 -0
- package/dist/types/storage/sqlite/sqlite-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.d.ts +30 -0
- package/dist/types/storage/storage.d.ts +38 -0
- package/dist/types/storage/usable-storage-adapter.d.ts +22 -0
- package/dist/types/utilities/_module.d.ts +1 -0
- package/dist/types/utilities/time-span/_module.d.ts +1 -0
- package/dist/types/utilities/time-span/time-span.d.ts +50 -0
- package/package.json +41 -6
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import type { GetOrAddResult } from "../../_shared/types";
|
|
5
|
+
/**
|
|
6
|
+
* @throws {StorageError} {@link StorageError}
|
|
7
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
8
|
+
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
9
|
+
* @group Contracts
|
|
10
|
+
*/
|
|
11
|
+
export type IStorageAdapter<TType> = {
|
|
12
|
+
/**
|
|
13
|
+
* Returns true for the keys that are found otherwise false will be returned.
|
|
14
|
+
* @throws {StorageError} {@link StorageError}
|
|
15
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
16
|
+
*/
|
|
17
|
+
existsMany?<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the value for the keys that are found otherwise null will be returned.
|
|
20
|
+
* @throws {StorageError} {@link StorageError}
|
|
21
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
22
|
+
*/
|
|
23
|
+
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TValues | null>>;
|
|
24
|
+
/**
|
|
25
|
+
* Adds the keys that doesn't exists. Returns true for the keys that doesn't exists otherwise false will be returned.
|
|
26
|
+
* @throws {StorageError} {@link StorageError}
|
|
27
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
28
|
+
*/
|
|
29
|
+
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
30
|
+
/**
|
|
31
|
+
* Updates the keys that exists. Returns true for the keys that exists otherwise false will be returned.
|
|
32
|
+
* @throws {StorageError} {@link StorageError}
|
|
33
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
34
|
+
*/
|
|
35
|
+
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
36
|
+
/**
|
|
37
|
+
* Replaces the keys that are found. Adds keys that are not found. Returns true for all the keys that are found otherwise false is returned.
|
|
38
|
+
* @throws {StorageError} {@link StorageError}
|
|
39
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
40
|
+
*/
|
|
41
|
+
putMany?<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
42
|
+
/**
|
|
43
|
+
* Removes the keys that are found. Returns true for the keys that are found otherwise false is returned.
|
|
44
|
+
* @throws {StorageError} {@link StorageError}
|
|
45
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
46
|
+
*/
|
|
47
|
+
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
48
|
+
/**
|
|
49
|
+
* If the key is found the value be returned and key will be removed otherwise null will be returned.
|
|
50
|
+
* @throws {StorageError} {@link StorageError}
|
|
51
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
52
|
+
*/
|
|
53
|
+
getAndRemove?<TValue extends TType>(key: string): Promise<TValue | null>;
|
|
54
|
+
/**
|
|
55
|
+
* If the key is found the value be returned otherwise valueToAdd will be added and returned.
|
|
56
|
+
* @throws {StorageError} {@link StorageError}
|
|
57
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
58
|
+
*/
|
|
59
|
+
getOrAdd?<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: TExtended): Promise<GetOrAddResult<TValue | TExtended>>;
|
|
60
|
+
/**
|
|
61
|
+
* Will increment the existing key with value if found otherwise nonthing occurs. Returns true if key exists otherwise false will be returned.
|
|
62
|
+
* @throws {StorageError} {@link StorageError}
|
|
63
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
64
|
+
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
65
|
+
*/
|
|
66
|
+
increment?(key: string, value: number): Promise<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* @throws {StorageError} {@link StorageError}
|
|
69
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
70
|
+
*/
|
|
71
|
+
clear(prefix: string): Promise<void>;
|
|
72
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import { type AnyFunction, type AsyncLazyable, type GetOrAddValue } from "../../_shared/types";
|
|
5
|
+
export type StorageValue<T> = Exclude<T, AnyFunction | undefined | null>;
|
|
6
|
+
/**
|
|
7
|
+
* @throws {StorageError} {@link StorageError}
|
|
8
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
9
|
+
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
10
|
+
* @group Contracts
|
|
11
|
+
*/
|
|
12
|
+
export type IStorage<TType = unknown> = {
|
|
13
|
+
namespace<TNamespaceType extends TType>(name: string): IStorage<TNamespaceType>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns true when key is found otherwise false will be returned.
|
|
16
|
+
* @throws {StorageError} {@link StorageError}
|
|
17
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
18
|
+
*/
|
|
19
|
+
exists(key: string): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true for the keys that are found otherwise false will be returned.
|
|
22
|
+
* @throws {StorageError} {@link StorageError}
|
|
23
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
24
|
+
*/
|
|
25
|
+
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
26
|
+
/**
|
|
27
|
+
* Returns true when key is not found otherwise false will be returned.
|
|
28
|
+
* @throws {StorageError} {@link StorageError}
|
|
29
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
30
|
+
*/
|
|
31
|
+
missing(key: string): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns true for the keys that are not found otherwise false will be returned.
|
|
34
|
+
* @throws {StorageError} {@link StorageError}
|
|
35
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
36
|
+
*/
|
|
37
|
+
missingMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the value when key is found otherwise null will be returned.
|
|
40
|
+
* @throws {StorageError} {@link StorageError}
|
|
41
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
42
|
+
*/
|
|
43
|
+
get<TValue extends TType>(key: string): Promise<TValue | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the value for the keys that are found otherwise null will be returned.
|
|
46
|
+
* @throws {StorageError} {@link StorageError}
|
|
47
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
48
|
+
*/
|
|
49
|
+
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TValues | null>>;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the value when key is found otherwise defaultValue will be returned.
|
|
52
|
+
* @throws {StorageError} {@link StorageError}
|
|
53
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
54
|
+
*/
|
|
55
|
+
getOr<TValue extends TType, TExtended extends TType>(key: string, defaultValue: AsyncLazyable<TExtended>): Promise<TValue | TExtended>;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the value for the keys that are found otherwise defaultValue will be returned.
|
|
58
|
+
* @throws {StorageError} {@link StorageError}
|
|
59
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
60
|
+
*/
|
|
61
|
+
getOrMany<TValues extends TType, TExtended extends TType, TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TExtended>>): Promise<Record<TKeys, TValues | TExtended>>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the value when key is found otherwise an error will be thrown.
|
|
64
|
+
* @throws {StorageError} {@link StorageError}
|
|
65
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
66
|
+
* @throws {KeyNotFoundStorageError} {@link KeyNotFoundStorageError}
|
|
67
|
+
*/
|
|
68
|
+
getOrFail<TValue extends TType>(key: string): Promise<TValue>;
|
|
69
|
+
/**
|
|
70
|
+
* Adds a key when key doesn't exists. Returns true when key doesn't exists otherwise false will be returned.
|
|
71
|
+
* @throws {StorageError} {@link StorageError}
|
|
72
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
73
|
+
*/
|
|
74
|
+
add<TValue extends TType>(key: string, value: StorageValue<TValue>): Promise<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* Adds the keys that doesn't exists. Returns true for the keys that doesn't exists otherwise false will be returned.
|
|
77
|
+
* @throws {StorageError} {@link StorageError}
|
|
78
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
79
|
+
*/
|
|
80
|
+
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, StorageValue<TValues>>): Promise<Record<TKeys, boolean>>;
|
|
81
|
+
/**
|
|
82
|
+
* Updates a keys that exists. Returns true when key otherwise false will be returned.
|
|
83
|
+
* @throws {StorageError} {@link StorageError}
|
|
84
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
85
|
+
*/
|
|
86
|
+
update<TValue extends TType>(key: string, value: TValue): Promise<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* Updates the keys that exists. Returns true for the keys that exists otherwise false will be returned.
|
|
89
|
+
* @throws {StorageError} {@link StorageError}
|
|
90
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
91
|
+
*/
|
|
92
|
+
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
93
|
+
/**
|
|
94
|
+
* If the key is found it will replaced. If the key is not found it will just be added. True is returned if the key is found otherwise false will be returned.
|
|
95
|
+
* @throws {StorageError} {@link StorageError}
|
|
96
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
97
|
+
*/
|
|
98
|
+
put<TValue extends TType>(key: string, value: StorageValue<TValue>): Promise<boolean>;
|
|
99
|
+
/**
|
|
100
|
+
* Replaces the keys that are found. Adds keys that are not found. Returns true for all the keys that are found otherwise false is returned.
|
|
101
|
+
* @throws {StorageError} {@link StorageError}
|
|
102
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
103
|
+
*/
|
|
104
|
+
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, StorageValue<TValues>>): Promise<Record<TKeys, boolean>>;
|
|
105
|
+
/**
|
|
106
|
+
* Removes the key when found. Returns true if the key is found otherwise false is returned.
|
|
107
|
+
* @throws {StorageError} {@link StorageError}
|
|
108
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
109
|
+
*/
|
|
110
|
+
remove(key: string): Promise<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* Removes the keys that are found. Returns true for the keys that are found otherwise false is returned.
|
|
113
|
+
* @throws {StorageError} {@link StorageError}
|
|
114
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
115
|
+
*/
|
|
116
|
+
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
117
|
+
/**
|
|
118
|
+
* If the key is found the value be returned and key will be removed otherwise null will be returned.
|
|
119
|
+
* @throws {StorageError} {@link StorageError}
|
|
120
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
121
|
+
*/
|
|
122
|
+
getAndRemove<TValue extends TType>(key: string): Promise<TValue | null>;
|
|
123
|
+
/**
|
|
124
|
+
* If the key is found the value be returned otherwise valueToAdd will be added and returned.
|
|
125
|
+
* @throws {StorageError} {@link StorageError}
|
|
126
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
127
|
+
*/
|
|
128
|
+
getOrAdd<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: AsyncLazyable<StorageValue<GetOrAddValue<TExtended>>>): Promise<TValue | TExtended>;
|
|
129
|
+
/**
|
|
130
|
+
* Will increment the existing key with value if found otherwise nonthing will occur. Returns true if key exists otherwise false will be returned.
|
|
131
|
+
* @throws {StorageError} {@link StorageError}
|
|
132
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
133
|
+
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
134
|
+
*/
|
|
135
|
+
increment(key: string, value?: number): Promise<boolean>;
|
|
136
|
+
/**
|
|
137
|
+
* Will decrement the existing key with value if found otherwise nonthing will occur. Returns true if key exists otherwise false will be returned.
|
|
138
|
+
* @throws {StorageError} {@link StorageError}
|
|
139
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
140
|
+
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
141
|
+
*/
|
|
142
|
+
decrement(key: string, value?: number): Promise<boolean>;
|
|
143
|
+
/**
|
|
144
|
+
* @throws {StorageError} {@link StorageError}
|
|
145
|
+
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
146
|
+
*/
|
|
147
|
+
clear(): Promise<void>;
|
|
148
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from "../serializer/_shared/test-utilities/_module";
|
|
2
|
+
export * from "../serializer/mongodb-serializer/_module";
|
|
3
|
+
export * from "../serializer/redis-serializer/_module";
|
|
4
|
+
export * from "../serializer/sql-serializer/_module";
|
|
5
|
+
export * from "../serializer/super-json-serializer/_module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../serializer/_shared/test-utilities/serializer.test-suite";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Serializer
|
|
3
|
+
*/
|
|
4
|
+
import { type TestAPI, type ExpectStatic } from "vitest";
|
|
5
|
+
import { type ISerializer } from "../../../contracts/serializer/_module";
|
|
6
|
+
import { type Promisable } from "../../../_shared/types";
|
|
7
|
+
/**
|
|
8
|
+
* @group Utilities
|
|
9
|
+
*/
|
|
10
|
+
export type SerializerSuiteSettings = {
|
|
11
|
+
expect: ExpectStatic;
|
|
12
|
+
test: TestAPI;
|
|
13
|
+
createAdapter: () => Promisable<ISerializer>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @group Utilities
|
|
17
|
+
*/
|
|
18
|
+
export declare function serializerTestSuite(settings: SerializerSuiteSettings): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../serializer/mongodb-serializer/mongodb-serializer";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Serializer
|
|
3
|
+
*/
|
|
4
|
+
import { type ISerializer } from "../../contracts/serializer/_module";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare class MongodbSerializer implements ISerializer<string | number> {
|
|
9
|
+
private readonly serializer;
|
|
10
|
+
constructor(serializer: ISerializer<string>);
|
|
11
|
+
serialize<TValue>(value: TValue): Promise<string | number>;
|
|
12
|
+
deserialize<TValue>(value: string | number): Promise<TValue>;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../serializer/redis-serializer/redis-serializer";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Serializer
|
|
3
|
+
*/
|
|
4
|
+
import { type ISerializer } from "../../contracts/serializer/_module";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare class RedisSerializer implements ISerializer<string> {
|
|
9
|
+
private readonly serializer;
|
|
10
|
+
constructor(serializer: ISerializer<string>);
|
|
11
|
+
serialize<TValue>(value: TValue): Promise<string>;
|
|
12
|
+
deserialize<TValue>(value: string): Promise<TValue>;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../serializer/sql-serializer/sql-serializer";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Serializer
|
|
3
|
+
*/
|
|
4
|
+
import { type ISerializer } from "../../contracts/serializer/_module";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare class SqlSerializer implements ISerializer<string> {
|
|
9
|
+
private readonly serializer;
|
|
10
|
+
constructor(serializer: ISerializer<string>);
|
|
11
|
+
serialize<TValue>(value: TValue): Promise<string>;
|
|
12
|
+
deserialize<TValue>(value: string): Promise<TValue>;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../serializer/super-json-serializer/super-json-serializer";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Serializer
|
|
3
|
+
*/
|
|
4
|
+
import { type ISerializer } from "../../contracts/serializer/_module";
|
|
5
|
+
import type { SuperJSON } from "superjson";
|
|
6
|
+
/**
|
|
7
|
+
* @group Adapters
|
|
8
|
+
*/
|
|
9
|
+
export type SuperJsonSerializerSettings = {
|
|
10
|
+
dedupe?: boolean;
|
|
11
|
+
registerClass?: (registerClass: SuperJSON["registerClass"]) => void;
|
|
12
|
+
registerSymbol?: (registerClass: SuperJSON["registerSymbol"]) => void;
|
|
13
|
+
registerCustom?: (registerClass: SuperJSON["registerCustom"]) => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @group Adapters
|
|
17
|
+
*/
|
|
18
|
+
export declare class SuperJsonSerializer implements ISerializer<string> {
|
|
19
|
+
private superJson;
|
|
20
|
+
private dedupe;
|
|
21
|
+
private registerClass;
|
|
22
|
+
private registerSymbol;
|
|
23
|
+
private registerCustom;
|
|
24
|
+
constructor({ dedupe, registerClass, registerSymbol, registerCustom, }?: SuperJsonSerializerSettings);
|
|
25
|
+
private static registerBuffer;
|
|
26
|
+
private static registerUint8Array;
|
|
27
|
+
private static registerInt8Array;
|
|
28
|
+
private static registerUint16Array;
|
|
29
|
+
private static registerInt16Array;
|
|
30
|
+
private static registerUint32Array;
|
|
31
|
+
private static registerInt32Array;
|
|
32
|
+
private static registerFloat32Array;
|
|
33
|
+
private static registerFloat64Array;
|
|
34
|
+
private init;
|
|
35
|
+
serialize<TValue>(value: TValue): Promise<string>;
|
|
36
|
+
deserialize<TValue>(value: string): Promise<TValue>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "../storage/storage";
|
|
2
|
+
export * from "../storage/_shared/test-utilities/_module";
|
|
3
|
+
export * from "../storage/memory-storage-adapter/_module";
|
|
4
|
+
export * from "../storage/mongodb-storage-adapter/_module";
|
|
5
|
+
export * from "../storage/redis-storage-adapter/_module";
|
|
6
|
+
export * from "../storage/sqlite/_module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../storage/_shared/test-utilities/storage.test-suite";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
|
+
import { type IStorageAdapter } from "../../../contracts/storage/_module";
|
|
6
|
+
import { type Promisable } from "../../../_shared/types";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export type StorageApiTestSuiteSettings = {
|
|
11
|
+
expect: ExpectStatic;
|
|
12
|
+
test: TestAPI;
|
|
13
|
+
describe: SuiteAPI;
|
|
14
|
+
beforeEach: typeof beforeEach;
|
|
15
|
+
createAdapter: () => Promisable<IStorageAdapter<unknown>>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function storageApiTestSuite(settings: StorageApiTestSuiteSettings): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import { type TestAPI, type ExpectStatic, type beforeEach, type SuiteAPI } from "vitest";
|
|
5
|
+
import { type IStorageAdapter } from "../../../contracts/storage/_module";
|
|
6
|
+
import { type Promisable } from "../../../_shared/types";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export type StorageNamespaceTestSuiteSettings = {
|
|
11
|
+
expect: ExpectStatic;
|
|
12
|
+
test: TestAPI;
|
|
13
|
+
describe: SuiteAPI;
|
|
14
|
+
beforeEach: typeof beforeEach;
|
|
15
|
+
createAdapter: () => Promisable<IStorageAdapter<unknown>>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function storageNamespaceTestSuite(settings: StorageNamespaceTestSuiteSettings): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
|
+
import { type IStorageAdapter } from "../../../contracts/storage/_module";
|
|
6
|
+
import { type Promisable } from "../../../_shared/types";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export type StorageValueTestSuiteSettings = {
|
|
11
|
+
expect: ExpectStatic;
|
|
12
|
+
test: TestAPI;
|
|
13
|
+
describe: SuiteAPI;
|
|
14
|
+
beforeEach: typeof beforeEach;
|
|
15
|
+
createAdapter: () => Promisable<IStorageAdapter<unknown>>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function storageValueTestSuite(settings: StorageValueTestSuiteSettings): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
|
+
import { type IStorageAdapter } from "../../../contracts/storage/_module";
|
|
6
|
+
import { type Promisable } from "../../../_shared/types";
|
|
7
|
+
/**
|
|
8
|
+
* @group Utilities
|
|
9
|
+
*/
|
|
10
|
+
export type StorageTestSuiteSettings = {
|
|
11
|
+
expect: ExpectStatic;
|
|
12
|
+
test: TestAPI;
|
|
13
|
+
describe: SuiteAPI;
|
|
14
|
+
beforeEach: typeof beforeEach;
|
|
15
|
+
createAdapter: () => Promisable<IStorageAdapter<unknown>>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @group Utilities
|
|
19
|
+
*/
|
|
20
|
+
export declare function storageTestSuite(settings: StorageTestSuiteSettings): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../storage/memory-storage-adapter/memory-storage-adapter";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import { type IStorageAdapter } from "../../contracts/storage/storage-adapter.contract";
|
|
5
|
+
/**
|
|
6
|
+
* @group Adapters
|
|
7
|
+
*/
|
|
8
|
+
export declare class MemoryStorageAdapter<TType> implements IStorageAdapter<TType> {
|
|
9
|
+
private readonly map;
|
|
10
|
+
constructor(map?: Map<string, TType>);
|
|
11
|
+
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TValues | null>>;
|
|
12
|
+
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
13
|
+
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
14
|
+
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
15
|
+
clear(prefix: string): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MongodbStorageAdapter, type MongodbStorageAdapterSettings, } from "../../storage/mongodb-storage-adapter/mongodb-storage-adapter";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import { type ISerializer } from "../../contracts/serializer/_module";
|
|
5
|
+
import type { GetOrAddResult } from "../../_shared/types";
|
|
6
|
+
import { type IInitizable } from "../../_shared/types";
|
|
7
|
+
import { type IStorageAdapter } from "../../contracts/storage/_module";
|
|
8
|
+
import { type Collection, ObjectId } from "mongodb";
|
|
9
|
+
/**
|
|
10
|
+
* @group Adapters
|
|
11
|
+
*/
|
|
12
|
+
export type MongodbStorageDocument = {
|
|
13
|
+
_id: ObjectId;
|
|
14
|
+
key: string;
|
|
15
|
+
value: number | string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @group Adapters
|
|
19
|
+
*/
|
|
20
|
+
export type MongodbStorageAdapterSettings = {
|
|
21
|
+
serializer?: ISerializer<string>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @group Adapters
|
|
25
|
+
*/
|
|
26
|
+
export declare class MongodbStorageAdapter<TType> implements IStorageAdapter<TType>, IInitizable {
|
|
27
|
+
private readonly collection;
|
|
28
|
+
private static isMongodbIncrementError;
|
|
29
|
+
private static isMongoDuplicateError;
|
|
30
|
+
private serializer;
|
|
31
|
+
constructor(collection: Collection<MongodbStorageDocument>, { serializer, }?: MongodbStorageAdapterSettings);
|
|
32
|
+
init(): Promise<void>;
|
|
33
|
+
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
34
|
+
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TValues | null>>;
|
|
35
|
+
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
36
|
+
private updateOne;
|
|
37
|
+
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
38
|
+
private putOne;
|
|
39
|
+
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
40
|
+
private removeOne;
|
|
41
|
+
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
42
|
+
getAndRemove<TValue extends TType>(key: string): Promise<TValue | null>;
|
|
43
|
+
getOrAdd<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: TExtended): Promise<GetOrAddResult<TValue | TExtended>>;
|
|
44
|
+
increment(key: string, value: number): Promise<boolean>;
|
|
45
|
+
clear(prefix: string): Promise<void>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import type { AsyncLazyable } from "../_shared/types";
|
|
5
|
+
import { type IStorageAdapter } from "../contracts/storage/_module";
|
|
6
|
+
import type { UsableStorageAdapter } from "../storage/usable-storage-adapter";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare class NamespaceStorageAdapter<TType> implements Required<Omit<IStorageAdapter<TType>, "clear" | "getOrAdd">> {
|
|
11
|
+
private readonly usableStorageAdapter;
|
|
12
|
+
private readonly namespace;
|
|
13
|
+
constructor(usableStorageAdapter: UsableStorageAdapter<TType>, namespace: string);
|
|
14
|
+
private withNamespace;
|
|
15
|
+
private withNamespaceArray;
|
|
16
|
+
private withNamespaceObject;
|
|
17
|
+
private withoutNamespace;
|
|
18
|
+
private withoutNamespaceObject;
|
|
19
|
+
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
20
|
+
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TValues | null>>;
|
|
21
|
+
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
22
|
+
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
23
|
+
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
24
|
+
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
25
|
+
getAndRemove<TValue extends TType>(key: string): Promise<TValue | null>;
|
|
26
|
+
getOrAdd<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: AsyncLazyable<TExtended>): Promise<TValue | TExtended>;
|
|
27
|
+
increment(key: string, value: number): Promise<boolean>;
|
|
28
|
+
decrement(key: string, value: number): Promise<boolean>;
|
|
29
|
+
clear(): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../storage/redis-storage-adapter/redis-storage-adapter";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import { type ISerializer } from "../../contracts/serializer/_module";
|
|
5
|
+
import { type IStorageAdapter } from "../../contracts/storage/_module";
|
|
6
|
+
import type Redis from "ioredis";
|
|
7
|
+
import { type Result } from "ioredis";
|
|
8
|
+
import type { GetOrAddResult } from "../../_shared/types";
|
|
9
|
+
declare module "ioredis" {
|
|
10
|
+
interface RedisCommander<Context> {
|
|
11
|
+
daiso_storage_increment(key: string, number: string): Result<number, Context>;
|
|
12
|
+
daiso_storage_put(key: string, value: string): Result<string, Context>;
|
|
13
|
+
daiso_storage_getOrAdd(key: string, valueToAdd: string): Result<string, Context>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @group Adapters
|
|
18
|
+
*/
|
|
19
|
+
export type RedisStorageAdapterSettings = {
|
|
20
|
+
serializer?: ISerializer<string>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @group Adapters
|
|
24
|
+
*/
|
|
25
|
+
export declare class RedisStorageAdapter<TType> implements IStorageAdapter<TType> {
|
|
26
|
+
private readonly client;
|
|
27
|
+
private serializer;
|
|
28
|
+
constructor(client: Redis, { serializer, }?: RedisStorageAdapterSettings);
|
|
29
|
+
private initIncrementCommand;
|
|
30
|
+
private initPutCommand;
|
|
31
|
+
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
32
|
+
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TValues | null>>;
|
|
33
|
+
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
34
|
+
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
35
|
+
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
36
|
+
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
37
|
+
getAndRemove<TValue extends TType>(key: string): Promise<TValue | null>;
|
|
38
|
+
getOrAdd<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: TExtended): Promise<GetOrAddResult<TValue | TExtended>>;
|
|
39
|
+
increment(key: string, value: number): Promise<boolean>;
|
|
40
|
+
clear(prefix: string): Promise<void>;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../storage/sqlite/_shared/base-sqlite-storage-adapter";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Storage
|
|
3
|
+
*/
|
|
4
|
+
import { type IStorageAdapter } from "../../../contracts/storage/storage-adapter.contract";
|
|
5
|
+
import { type Generated, type Kysely } from "kysely";
|
|
6
|
+
import { type ISerializer } from "../../../contracts/serializer/_module";
|
|
7
|
+
import type { GetOrAddResult } from "../../../_shared/types";
|
|
8
|
+
import { type IInitizable } from "../../../_shared/types";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
type BaseSqliteStorageTable = {
|
|
13
|
+
key: string;
|
|
14
|
+
value: string;
|
|
15
|
+
hasBeenUpdated: Generated<1 | 0>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
type BaseSqliteTables = {
|
|
21
|
+
storage: BaseSqliteStorageTable;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare class BaseSqliteStorageAdapter<TType> implements IStorageAdapter<TType>, IInitizable {
|
|
27
|
+
private readonly db;
|
|
28
|
+
private readonly serializer;
|
|
29
|
+
constructor(db: Kysely<BaseSqliteTables>, serializer: ISerializer<string>);
|
|
30
|
+
init(): Promise<void>;
|
|
31
|
+
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
32
|
+
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TValues | null>>;
|
|
33
|
+
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
34
|
+
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
35
|
+
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
36
|
+
getAndRemove<TValue extends TType>(key: string): Promise<TValue | null>;
|
|
37
|
+
getOrAdd<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: TExtended): Promise<GetOrAddResult<TValue | TExtended>>;
|
|
38
|
+
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
39
|
+
increment(key: string, value: number): Promise<boolean>;
|
|
40
|
+
clear(prefix: string): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../storage/sqlite/libsql-storage-adapter/libsql-storage-adapter";
|