@daiso-tech/core 0.10.0 → 0.12.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 +2 -2
- package/dist/cjs/_module.js.map +1 -1
- package/dist/cjs/_shared/utilities.js +7 -0
- package/dist/cjs/_shared/utilities.js.map +1 -1
- package/dist/cjs/cache/contracts/_module.js +22 -0
- package/dist/cjs/cache/contracts/_module.js.map +1 -0
- package/dist/cjs/{storage/contracts/storage-adapter.contract.js → cache/contracts/cache-adapter.contract.js} +1 -1
- package/dist/cjs/cache/contracts/cache-adapter.contract.js.map +1 -0
- package/dist/cjs/{storage/contracts/storage-manager.contract.js → cache/contracts/cache-factory.contract.js} +1 -1
- package/dist/cjs/cache/contracts/cache-factory.contract.js.map +1 -0
- package/dist/cjs/{storage/contracts/storage.contract.js → cache/contracts/cache.contract.js} +1 -1
- package/dist/cjs/cache/contracts/cache.contract.js.map +1 -0
- package/dist/cjs/cache/contracts/cache.errors.js +32 -0
- package/dist/cjs/cache/contracts/cache.errors.js.map +1 -0
- package/dist/cjs/cache/contracts/cache.events.js +14 -0
- package/dist/cjs/cache/contracts/cache.events.js.map +1 -0
- package/dist/cjs/cache/implementations/_module.js +20 -0
- package/dist/cjs/cache/implementations/_module.js.map +1 -0
- package/dist/cjs/{event-bus/implementations/memory-event-bus-adapter → cache/implementations/_shared}/_module.js +1 -1
- package/dist/cjs/cache/implementations/_shared/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js +192 -0
- package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -0
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js +1009 -0
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/_module.js +22 -0
- package/dist/cjs/cache/implementations/adapters/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js +18 -0
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +291 -0
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -0
- package/dist/cjs/{event-bus/implementations/redis-event-bus-adapter → cache/implementations/adapters/libsql-cache-adapter}/_module.js +1 -1
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +61 -0
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js +18 -0
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +72 -0
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js +18 -0
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +262 -0
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -0
- package/dist/cjs/{event-bus/implementations/no-op-event-bus-adapter → cache/implementations/adapters/redis-cache-adapter}/_module.js +1 -1
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +147 -0
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js +18 -0
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +60 -0
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -0
- package/dist/cjs/cache/implementations/derivables/_module.js +20 -0
- package/dist/cjs/cache/implementations/derivables/_module.js.map +1 -0
- package/dist/cjs/cache/implementations/derivables/base-cache.js +262 -0
- package/dist/cjs/cache/implementations/derivables/base-cache.js.map +1 -0
- package/dist/cjs/cache/implementations/derivables/cache-factory.js +39 -0
- package/dist/cjs/cache/implementations/derivables/cache-factory.js.map +1 -0
- package/dist/cjs/cache/implementations/derivables/cache.js +191 -0
- package/dist/cjs/cache/implementations/derivables/cache.js.map +1 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/cjs/event-bus/contracts/_module.js +2 -1
- package/dist/cjs/event-bus/contracts/_module.js.map +1 -1
- package/dist/cjs/event-bus/contracts/_shared.js +0 -36
- package/dist/cjs/event-bus/contracts/_shared.js.map +1 -1
- package/dist/cjs/event-bus/contracts/{event-bus-manager.contract.js → event-bus-factory.contract.js} +1 -1
- package/dist/cjs/event-bus/contracts/event-bus-factory.contract.js.map +1 -0
- package/dist/cjs/event-bus/contracts/event-bus.errors.js +39 -0
- package/dist/cjs/event-bus/contracts/event-bus.errors.js.map +1 -0
- package/dist/cjs/event-bus/implementations/_module.js +2 -4
- package/dist/cjs/event-bus/implementations/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/_module.js +20 -0
- package/dist/cjs/event-bus/implementations/adapters/_module.js.map +1 -0
- package/dist/cjs/{storage/implementations/redis-storage-adapter → event-bus/implementations/adapters/memory-event-bus-adapter}/_module.js +1 -1
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -0
- package/dist/cjs/{storage/implementations/_shared/test-utilities → event-bus/implementations/adapters/no-op-event-bus-adapter}/_module.js +1 -1
- package/dist/cjs/event-bus/implementations/adapters/no-op-event-bus-adapter/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -0
- package/dist/cjs/{storage/implementations/memory-storage-adapter → event-bus/implementations/adapters/redis-event-bus-adapter}/_module.js +1 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/{redis-event-bus-adapter → adapters/redis-event-bus-adapter}/redis-event-bus-adapter.js +2 -2
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +1 -0
- package/dist/cjs/event-bus/implementations/{event-bus → derivables}/_module.js +2 -2
- package/dist/cjs/event-bus/implementations/derivables/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js +39 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js.map +1 -0
- package/dist/cjs/event-bus/implementations/{event-bus → derivables}/event-bus.js +11 -8
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js.map +1 -0
- package/dist/cjs/event-bus/implementations/{event-bus → derivables}/with-namespace-event-bus-adapter.js +1 -0
- package/dist/cjs/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +1 -0
- package/dist/cjs/event-bus/implementations/derivables/with-validation-event-bus-adapter.js.map +1 -0
- package/dist/cjs/serializer/contracts/_module.js +1 -0
- package/dist/cjs/serializer/contracts/_module.js.map +1 -1
- package/dist/cjs/serializer/contracts/serializer.contract.js +0 -22
- package/dist/cjs/serializer/contracts/serializer.contract.js.map +1 -1
- package/dist/cjs/serializer/contracts/serializer.errors.js +25 -0
- package/dist/cjs/serializer/contracts/serializer.errors.js.map +1 -0
- package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js +3 -3
- package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +1 -1
- package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js +3 -3
- package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js.map +1 -1
- package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js +3 -3
- package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js.map +1 -1
- package/dist/cjs/serializer/implementations/super-json-serializer/super-json-serializer.js +21 -21
- package/dist/cjs/serializer/implementations/super-json-serializer/super-json-serializer.js.map +1 -1
- package/dist/cjs/utilities/_module.js +1 -0
- package/dist/cjs/utilities/_module.js.map +1 -1
- package/dist/cjs/utilities/global-errors.js +25 -0
- package/dist/cjs/utilities/global-errors.js.map +1 -0
- package/dist/cjs/utilities/time-span/time-span.js.map +1 -1
- package/dist/esm/_module.js +2 -2
- package/dist/esm/_module.js.map +1 -1
- package/dist/esm/_shared/utilities.js +6 -0
- package/dist/esm/_shared/utilities.js.map +1 -1
- package/dist/esm/cache/contracts/_module.js +6 -0
- package/dist/esm/cache/contracts/_module.js.map +1 -0
- package/dist/esm/cache/contracts/cache-adapter.contract.js +1 -0
- package/dist/esm/cache/contracts/cache-adapter.contract.js.map +1 -0
- package/dist/esm/cache/contracts/cache-factory.contract.js +1 -0
- package/dist/esm/cache/contracts/cache-factory.contract.js.map +1 -0
- package/dist/esm/cache/contracts/cache.contract.js +1 -0
- package/dist/esm/cache/contracts/cache.contract.js.map +1 -0
- package/dist/esm/cache/contracts/cache.errors.js +25 -0
- package/dist/esm/cache/contracts/cache.errors.js.map +1 -0
- package/dist/esm/cache/contracts/cache.events.js +11 -0
- package/dist/esm/cache/contracts/cache.events.js.map +1 -0
- package/dist/esm/cache/implementations/_module.js +4 -0
- package/dist/esm/cache/implementations/_module.js.map +1 -0
- package/dist/esm/cache/implementations/_shared/_module.js +2 -0
- package/dist/esm/cache/implementations/_shared/_module.js.map +1 -0
- package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js +189 -0
- package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -0
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js +1006 -0
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/_module.js +6 -0
- package/dist/esm/cache/implementations/adapters/_module.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js +2 -0
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +287 -0
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js +2 -0
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +57 -0
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js +2 -0
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +68 -0
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js +2 -0
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +255 -0
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js +2 -0
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +143 -0
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js +2 -0
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +56 -0
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -0
- package/dist/esm/cache/implementations/derivables/_module.js +4 -0
- package/dist/esm/cache/implementations/derivables/_module.js.map +1 -0
- package/dist/esm/cache/implementations/derivables/base-cache.js +258 -0
- package/dist/esm/cache/implementations/derivables/base-cache.js.map +1 -0
- package/dist/esm/cache/implementations/derivables/cache-factory.js +35 -0
- package/dist/esm/cache/implementations/derivables/cache-factory.js.map +1 -0
- package/dist/esm/cache/implementations/derivables/cache.js +187 -0
- package/dist/esm/cache/implementations/derivables/cache.js.map +1 -0
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/esm/event-bus/contracts/_module.js +2 -1
- package/dist/esm/event-bus/contracts/_module.js.map +1 -1
- package/dist/esm/event-bus/contracts/_shared.js +0 -30
- package/dist/esm/event-bus/contracts/_shared.js.map +1 -1
- package/dist/esm/event-bus/contracts/event-bus-factory.contract.js +1 -0
- package/dist/esm/event-bus/contracts/event-bus-factory.contract.js.map +1 -0
- package/dist/esm/event-bus/contracts/event-bus.errors.js +31 -0
- package/dist/esm/event-bus/contracts/event-bus.errors.js.map +1 -0
- package/dist/esm/event-bus/implementations/_module.js +2 -4
- package/dist/esm/event-bus/implementations/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/_module.js +4 -0
- package/dist/esm/event-bus/implementations/adapters/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js +2 -0
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/_module.js +2 -0
- package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js +2 -0
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/{redis-event-bus-adapter → adapters/redis-event-bus-adapter}/redis-event-bus-adapter.js +2 -2
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/derivables/_module.js +3 -0
- package/dist/esm/event-bus/implementations/derivables/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js +35 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js.map +1 -0
- package/dist/esm/event-bus/implementations/{event-bus → derivables}/event-bus.js +12 -9
- package/dist/esm/event-bus/implementations/derivables/event-bus.js.map +1 -0
- package/dist/esm/event-bus/implementations/{event-bus → derivables}/with-namespace-event-bus-adapter.js +1 -0
- package/dist/esm/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/derivables/with-validation-event-bus-adapter.js.map +1 -0
- package/dist/esm/serializer/contracts/_module.js +1 -0
- package/dist/esm/serializer/contracts/_module.js.map +1 -1
- package/dist/esm/serializer/contracts/serializer.contract.js +0 -18
- package/dist/esm/serializer/contracts/serializer.contract.js.map +1 -1
- package/dist/esm/serializer/contracts/serializer.errors.js +19 -0
- package/dist/esm/serializer/contracts/serializer.errors.js.map +1 -0
- package/dist/esm/serializer/implementations/mongodb-serializer/mongodb-serializer.js +1 -1
- package/dist/esm/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +1 -1
- package/dist/esm/serializer/implementations/redis-serializer/redis-serializer.js +1 -1
- package/dist/esm/serializer/implementations/redis-serializer/redis-serializer.js.map +1 -1
- package/dist/esm/serializer/implementations/sql-serializer/sql-serializer.js +1 -1
- package/dist/esm/serializer/implementations/sql-serializer/sql-serializer.js.map +1 -1
- package/dist/esm/serializer/implementations/super-json-serializer/super-json-serializer.js +1 -1
- package/dist/esm/serializer/implementations/super-json-serializer/super-json-serializer.js.map +1 -1
- package/dist/esm/utilities/_module.js +1 -0
- package/dist/esm/utilities/_module.js.map +1 -1
- package/dist/esm/utilities/global-errors.js +19 -0
- package/dist/esm/utilities/global-errors.js.map +1 -0
- package/dist/esm/utilities/time-span/time-span.js.map +1 -1
- package/dist/types/_module.d.ts +2 -2
- package/dist/types/_shared/types.d.ts +4 -0
- package/dist/types/_shared/utilities.d.ts +5 -1
- package/dist/types/cache/contracts/_module.d.ts +5 -0
- package/dist/types/cache/contracts/cache-adapter.contract.d.ts +44 -0
- package/dist/types/cache/contracts/cache-factory.contract.d.ts +48 -0
- package/dist/types/cache/contracts/cache.contract.d.ts +195 -0
- package/dist/types/{storage/contracts/_shared.d.ts → cache/contracts/cache.errors.d.ts} +5 -5
- package/dist/types/cache/contracts/cache.events.d.ts +96 -0
- package/dist/types/cache/implementations/_module.d.ts +3 -0
- package/dist/types/cache/implementations/_shared/_module.d.ts +1 -0
- package/dist/types/cache/implementations/_shared/cache-adapter.test-suite.d.ts +51 -0
- package/dist/types/cache/implementations/_shared/cache.test-suite.d.ts +60 -0
- package/dist/types/cache/implementations/adapters/_module.d.ts +5 -0
- package/dist/types/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +55 -0
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +35 -0
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +20 -0
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +41 -0
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +37 -0
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +35 -0
- package/dist/types/cache/implementations/derivables/_module.d.ts +3 -0
- package/dist/types/cache/implementations/derivables/base-cache.d.ts +57 -0
- package/dist/types/cache/implementations/derivables/cache-factory.d.ts +56 -0
- package/dist/types/cache/implementations/derivables/cache.d.ts +88 -0
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.d.ts +3 -0
- package/dist/types/collection/implementations/iterable-collection/_shared/cross-join-iterable.d.ts +3 -0
- package/dist/types/event-bus/contracts/_module.d.ts +2 -1
- package/dist/types/event-bus/contracts/_shared.d.ts +0 -30
- package/dist/types/event-bus/contracts/event-bus-factory.contract.d.ts +78 -0
- package/dist/types/event-bus/contracts/event-bus.contract.d.ts +21 -18
- package/dist/types/event-bus/contracts/event-bus.errors.d.ts +33 -0
- package/dist/types/event-bus/implementations/_module.d.ts +2 -4
- package/dist/types/event-bus/implementations/adapters/_module.d.ts +3 -0
- package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/_module.d.ts +1 -0
- package/dist/types/event-bus/implementations/{memory-event-bus-adapter → adapters/memory-event-bus-adapter}/memory-event-bus-adapter.d.ts +1 -1
- package/dist/types/event-bus/implementations/adapters/no-op-event-bus-adapter/_module.d.ts +1 -0
- package/dist/types/event-bus/implementations/{no-op-event-bus-adapter → adapters/no-op-event-bus-adapter}/no-op-event-bus-adapter.d.ts +3 -3
- package/dist/types/event-bus/implementations/adapters/redis-event-bus-adapter/_module.d.ts +1 -0
- package/dist/types/event-bus/implementations/{redis-event-bus-adapter → adapters/redis-event-bus-adapter}/redis-event-bus-adapter.d.ts +2 -2
- package/dist/types/event-bus/implementations/derivables/_module.d.ts +2 -0
- package/dist/types/event-bus/implementations/derivables/event-bus-factory.d.ts +47 -0
- package/dist/types/event-bus/implementations/{event-bus → derivables}/event-bus.d.ts +8 -7
- package/dist/types/serializer/contracts/_module.d.ts +1 -0
- package/dist/types/serializer/contracts/serializer.contract.d.ts +0 -18
- package/dist/types/serializer/contracts/serializer.errors.d.ts +21 -0
- package/dist/types/utilities/_module.d.ts +1 -0
- package/dist/types/utilities/global-errors.d.ts +12 -0
- package/dist/types/utilities/time-span/time-span.d.ts +2 -0
- package/package.json +12 -2
- package/dist/cjs/event-bus/contracts/event-bus-manager.contract.js.map +0 -1
- package/dist/cjs/event-bus/implementations/event-bus/_module.js.map +0 -1
- package/dist/cjs/event-bus/implementations/event-bus/event-bus-manager.js +0 -31
- package/dist/cjs/event-bus/implementations/event-bus/event-bus-manager.js.map +0 -1
- package/dist/cjs/event-bus/implementations/event-bus/event-bus.js.map +0 -1
- package/dist/cjs/event-bus/implementations/event-bus/with-namespace-event-bus-adapter.js.map +0 -1
- package/dist/cjs/event-bus/implementations/event-bus/with-validation-event-bus-adapter.js.map +0 -1
- package/dist/cjs/event-bus/implementations/memory-event-bus-adapter/_module.js.map +0 -1
- package/dist/cjs/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js.map +0 -1
- package/dist/cjs/event-bus/implementations/no-op-event-bus-adapter/_module.js.map +0 -1
- package/dist/cjs/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +0 -1
- package/dist/cjs/event-bus/implementations/redis-event-bus-adapter/_module.js.map +0 -1
- package/dist/cjs/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
- package/dist/cjs/storage/contracts/_module.js +0 -22
- package/dist/cjs/storage/contracts/_module.js.map +0 -1
- package/dist/cjs/storage/contracts/_shared.js +0 -32
- package/dist/cjs/storage/contracts/_shared.js.map +0 -1
- package/dist/cjs/storage/contracts/storage-adapter.contract.js.map +0 -1
- package/dist/cjs/storage/contracts/storage-events.contract.js +0 -14
- package/dist/cjs/storage/contracts/storage-events.contract.js.map +0 -1
- package/dist/cjs/storage/contracts/storage-manager.contract.js.map +0 -1
- package/dist/cjs/storage/contracts/storage.contract.js.map +0 -1
- package/dist/cjs/storage/implementations/_module.js +0 -23
- package/dist/cjs/storage/implementations/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/_shared/test-utilities/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +0 -298
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +0 -1
- package/dist/cjs/storage/implementations/memory-storage-adapter/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/memory-storage-adapter/memory-storage-adapter.js +0 -85
- package/dist/cjs/storage/implementations/memory-storage-adapter/memory-storage-adapter.js.map +0 -1
- package/dist/cjs/storage/implementations/mongodb-storage-adapter/_module.js +0 -6
- package/dist/cjs/storage/implementations/mongodb-storage-adapter/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.js +0 -203
- package/dist/cjs/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.js.map +0 -1
- package/dist/cjs/storage/implementations/redis-storage-adapter/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/redis-storage-adapter/redis-storage-adapter.js +0 -228
- package/dist/cjs/storage/implementations/redis-storage-adapter/redis-storage-adapter.js.map +0 -1
- package/dist/cjs/storage/implementations/sqlite/_module.js +0 -19
- package/dist/cjs/storage/implementations/sqlite/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/sqlite/_shared/_module.js +0 -18
- package/dist/cjs/storage/implementations/sqlite/_shared/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.js +0 -190
- package/dist/cjs/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.js.map +0 -1
- package/dist/cjs/storage/implementations/sqlite/libsql-storage-adapter/_module.js +0 -18
- package/dist/cjs/storage/implementations/sqlite/libsql-storage-adapter/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.js +0 -53
- package/dist/cjs/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +0 -1
- package/dist/cjs/storage/implementations/sqlite/sqlite-storage-adapter/_module.js +0 -18
- package/dist/cjs/storage/implementations/sqlite/sqlite-storage-adapter/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js +0 -52
- package/dist/cjs/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +0 -1
- package/dist/cjs/storage/implementations/storage/_module.js +0 -19
- package/dist/cjs/storage/implementations/storage/_module.js.map +0 -1
- package/dist/cjs/storage/implementations/storage/storage-manager.js +0 -34
- package/dist/cjs/storage/implementations/storage/storage-manager.js.map +0 -1
- package/dist/cjs/storage/implementations/storage/storage.js +0 -265
- package/dist/cjs/storage/implementations/storage/storage.js.map +0 -1
- package/dist/cjs/storage/implementations/storage/with-event-storage-adapter.js +0 -255
- package/dist/cjs/storage/implementations/storage/with-event-storage-adapter.js.map +0 -1
- package/dist/cjs/storage/implementations/storage/with-namespace-storage-adapter.js +0 -53
- package/dist/cjs/storage/implementations/storage/with-namespace-storage-adapter.js.map +0 -1
- package/dist/cjs/storage/implementations/storage/with-validation-storage-adapter.js +0 -48
- package/dist/cjs/storage/implementations/storage/with-validation-storage-adapter.js.map +0 -1
- package/dist/esm/event-bus/contracts/event-bus-manager.contract.js +0 -1
- package/dist/esm/event-bus/contracts/event-bus-manager.contract.js.map +0 -1
- package/dist/esm/event-bus/implementations/event-bus/_module.js +0 -3
- package/dist/esm/event-bus/implementations/event-bus/_module.js.map +0 -1
- package/dist/esm/event-bus/implementations/event-bus/event-bus-manager.js +0 -27
- package/dist/esm/event-bus/implementations/event-bus/event-bus-manager.js.map +0 -1
- package/dist/esm/event-bus/implementations/event-bus/event-bus.js.map +0 -1
- package/dist/esm/event-bus/implementations/event-bus/with-namespace-event-bus-adapter.js.map +0 -1
- package/dist/esm/event-bus/implementations/event-bus/with-validation-event-bus-adapter.js.map +0 -1
- package/dist/esm/event-bus/implementations/memory-event-bus-adapter/_module.js +0 -2
- package/dist/esm/event-bus/implementations/memory-event-bus-adapter/_module.js.map +0 -1
- package/dist/esm/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js.map +0 -1
- package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/_module.js +0 -2
- package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/_module.js.map +0 -1
- package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +0 -1
- package/dist/esm/event-bus/implementations/redis-event-bus-adapter/_module.js +0 -2
- package/dist/esm/event-bus/implementations/redis-event-bus-adapter/_module.js.map +0 -1
- package/dist/esm/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
- package/dist/esm/storage/contracts/_module.js +0 -6
- package/dist/esm/storage/contracts/_module.js.map +0 -1
- package/dist/esm/storage/contracts/_shared.js +0 -25
- package/dist/esm/storage/contracts/_shared.js.map +0 -1
- package/dist/esm/storage/contracts/storage-adapter.contract.js +0 -1
- package/dist/esm/storage/contracts/storage-adapter.contract.js.map +0 -1
- package/dist/esm/storage/contracts/storage-events.contract.js +0 -11
- package/dist/esm/storage/contracts/storage-events.contract.js.map +0 -1
- package/dist/esm/storage/contracts/storage-manager.contract.js +0 -1
- package/dist/esm/storage/contracts/storage-manager.contract.js.map +0 -1
- package/dist/esm/storage/contracts/storage.contract.js +0 -1
- package/dist/esm/storage/contracts/storage.contract.js.map +0 -1
- package/dist/esm/storage/implementations/_module.js +0 -7
- package/dist/esm/storage/implementations/_module.js.map +0 -1
- package/dist/esm/storage/implementations/_shared/test-utilities/_module.js +0 -2
- package/dist/esm/storage/implementations/_shared/test-utilities/_module.js.map +0 -1
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +0 -295
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +0 -1
- package/dist/esm/storage/implementations/memory-storage-adapter/_module.js +0 -2
- package/dist/esm/storage/implementations/memory-storage-adapter/_module.js.map +0 -1
- package/dist/esm/storage/implementations/memory-storage-adapter/memory-storage-adapter.js +0 -81
- package/dist/esm/storage/implementations/memory-storage-adapter/memory-storage-adapter.js.map +0 -1
- package/dist/esm/storage/implementations/mongodb-storage-adapter/_module.js +0 -2
- package/dist/esm/storage/implementations/mongodb-storage-adapter/_module.js.map +0 -1
- package/dist/esm/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.js +0 -196
- package/dist/esm/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.js.map +0 -1
- package/dist/esm/storage/implementations/redis-storage-adapter/_module.js +0 -2
- package/dist/esm/storage/implementations/redis-storage-adapter/_module.js.map +0 -1
- package/dist/esm/storage/implementations/redis-storage-adapter/redis-storage-adapter.js +0 -224
- package/dist/esm/storage/implementations/redis-storage-adapter/redis-storage-adapter.js.map +0 -1
- package/dist/esm/storage/implementations/sqlite/_module.js +0 -3
- package/dist/esm/storage/implementations/sqlite/_module.js.map +0 -1
- package/dist/esm/storage/implementations/sqlite/_shared/_module.js +0 -2
- package/dist/esm/storage/implementations/sqlite/_shared/_module.js.map +0 -1
- package/dist/esm/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.js +0 -186
- package/dist/esm/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.js.map +0 -1
- package/dist/esm/storage/implementations/sqlite/libsql-storage-adapter/_module.js +0 -2
- package/dist/esm/storage/implementations/sqlite/libsql-storage-adapter/_module.js.map +0 -1
- package/dist/esm/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.js +0 -49
- package/dist/esm/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +0 -1
- package/dist/esm/storage/implementations/sqlite/sqlite-storage-adapter/_module.js +0 -2
- package/dist/esm/storage/implementations/sqlite/sqlite-storage-adapter/_module.js.map +0 -1
- package/dist/esm/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js +0 -48
- package/dist/esm/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +0 -1
- package/dist/esm/storage/implementations/storage/_module.js +0 -3
- package/dist/esm/storage/implementations/storage/_module.js.map +0 -1
- package/dist/esm/storage/implementations/storage/storage-manager.js +0 -30
- package/dist/esm/storage/implementations/storage/storage-manager.js.map +0 -1
- package/dist/esm/storage/implementations/storage/storage.js +0 -261
- package/dist/esm/storage/implementations/storage/storage.js.map +0 -1
- package/dist/esm/storage/implementations/storage/with-event-storage-adapter.js +0 -251
- package/dist/esm/storage/implementations/storage/with-event-storage-adapter.js.map +0 -1
- package/dist/esm/storage/implementations/storage/with-namespace-storage-adapter.js +0 -49
- package/dist/esm/storage/implementations/storage/with-namespace-storage-adapter.js.map +0 -1
- package/dist/esm/storage/implementations/storage/with-validation-storage-adapter.js +0 -44
- package/dist/esm/storage/implementations/storage/with-validation-storage-adapter.js.map +0 -1
- package/dist/types/event-bus/contracts/event-bus-manager.contract.d.ts +0 -120
- package/dist/types/event-bus/implementations/event-bus/_module.d.ts +0 -2
- package/dist/types/event-bus/implementations/event-bus/event-bus-manager.d.ts +0 -26
- package/dist/types/event-bus/implementations/memory-event-bus-adapter/_module.d.ts +0 -1
- package/dist/types/event-bus/implementations/no-op-event-bus-adapter/_module.d.ts +0 -1
- package/dist/types/event-bus/implementations/redis-event-bus-adapter/_module.d.ts +0 -1
- package/dist/types/storage/contracts/_module.d.ts +0 -5
- package/dist/types/storage/contracts/storage-adapter.contract.d.ts +0 -41
- package/dist/types/storage/contracts/storage-events.contract.d.ts +0 -91
- package/dist/types/storage/contracts/storage-manager.contract.d.ts +0 -100
- package/dist/types/storage/contracts/storage.contract.d.ts +0 -185
- package/dist/types/storage/implementations/_module.d.ts +0 -6
- package/dist/types/storage/implementations/_shared/test-utilities/_module.d.ts +0 -1
- package/dist/types/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.d.ts +0 -36
- package/dist/types/storage/implementations/memory-storage-adapter/_module.d.ts +0 -1
- package/dist/types/storage/implementations/memory-storage-adapter/memory-storage-adapter.d.ts +0 -18
- package/dist/types/storage/implementations/mongodb-storage-adapter/_module.d.ts +0 -1
- package/dist/types/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.d.ts +0 -43
- package/dist/types/storage/implementations/redis-storage-adapter/_module.d.ts +0 -1
- package/dist/types/storage/implementations/redis-storage-adapter/redis-storage-adapter.d.ts +0 -38
- package/dist/types/storage/implementations/sqlite/_module.d.ts +0 -2
- package/dist/types/storage/implementations/sqlite/_shared/_module.d.ts +0 -1
- package/dist/types/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.d.ts +0 -39
- package/dist/types/storage/implementations/sqlite/libsql-storage-adapter/_module.d.ts +0 -1
- package/dist/types/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.d.ts +0 -30
- package/dist/types/storage/implementations/sqlite/sqlite-storage-adapter/_module.d.ts +0 -1
- package/dist/types/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.d.ts +0 -30
- package/dist/types/storage/implementations/storage/_module.d.ts +0 -2
- package/dist/types/storage/implementations/storage/storage-manager.d.ts +0 -29
- package/dist/types/storage/implementations/storage/storage.d.ts +0 -114
- package/dist/types/storage/implementations/storage/with-event-storage-adapter.d.ts +0 -31
- package/dist/types/storage/implementations/storage/with-namespace-storage-adapter.d.ts +0 -24
- package/dist/types/storage/implementations/storage/with-validation-storage-adapter.d.ts +0 -22
- /package/dist/cjs/event-bus/implementations/{memory-event-bus-adapter → adapters/memory-event-bus-adapter}/memory-event-bus-adapter.js +0 -0
- /package/dist/cjs/event-bus/implementations/{no-op-event-bus-adapter → adapters/no-op-event-bus-adapter}/no-op-event-bus-adapter.js +0 -0
- /package/dist/cjs/event-bus/implementations/{event-bus → derivables}/with-validation-event-bus-adapter.js +0 -0
- /package/dist/esm/event-bus/implementations/{memory-event-bus-adapter → adapters/memory-event-bus-adapter}/memory-event-bus-adapter.js +0 -0
- /package/dist/esm/event-bus/implementations/{no-op-event-bus-adapter → adapters/no-op-event-bus-adapter}/no-op-event-bus-adapter.js +0 -0
- /package/dist/esm/event-bus/implementations/{event-bus → derivables}/with-validation-event-bus-adapter.js +0 -0
- /package/dist/types/event-bus/implementations/{event-bus → derivables}/with-namespace-event-bus-adapter.d.ts +0 -0
- /package/dist/types/event-bus/implementations/{event-bus → derivables}/with-validation-event-bus-adapter.d.ts +0 -0
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import type { Validator } from "../../utilities/_module";
|
|
5
|
-
import type { INamespacedStorage } from "../../storage/contracts/storage.contract";
|
|
6
|
-
/**
|
|
7
|
-
* The <i>IStorageFactory</i> contract makes it easy to switch between different <i>{@link IStorageAdapter | storage adapters}</i> dynamically.
|
|
8
|
-
* @group Contracts
|
|
9
|
-
*/
|
|
10
|
-
export type IStorageFactory<TAdapters extends string = string, TType = unknown> = {
|
|
11
|
-
/**
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { StorageManager, MemoryStorageAdapter, RedisStorageAdapter } from "@daiso-tech/core";
|
|
15
|
-
* import Redis from "ioredis";
|
|
16
|
-
*
|
|
17
|
-
* const storageManager = new StorageManager({
|
|
18
|
-
* adapters: {
|
|
19
|
-
* memory: new MemoryStorageAdapter(),
|
|
20
|
-
* redis: new RedisStorageAdapter(new Redis()),
|
|
21
|
-
* },
|
|
22
|
-
* defaultAdapter: "memory",
|
|
23
|
-
* rootNamespace: "@storage/"
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* (async () => {
|
|
27
|
-
* // Will add key using the default adapter which is the memory addapter
|
|
28
|
-
* await storageManager
|
|
29
|
-
* .use()
|
|
30
|
-
* .add("a", 1);
|
|
31
|
-
* // Will add key using the redis addapter
|
|
32
|
-
* await storageManager
|
|
33
|
-
* .use("redis")
|
|
34
|
-
* .add("a", 1);
|
|
35
|
-
* })();
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
use(adapter?: TAdapters): INamespacedStorage<TType>;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* The <i>IStorageManager</i> contract makes it easy to configure and switch between different <i>{@link IStorageAdapter | storage adapters}</i> dynamically.
|
|
42
|
-
* @group Contracts
|
|
43
|
-
*/
|
|
44
|
-
export type IStorageManager<TAdapters extends string = string, TType = unknown> = IStorageFactory<TAdapters, TType> & {
|
|
45
|
-
/**
|
|
46
|
-
* The <i>withValidation</i> method is used to set a <i>validator</i>, which validates the storage values during runtime.
|
|
47
|
-
* The type is inferred from the provided <i>validator</i>.
|
|
48
|
-
* @example
|
|
49
|
-
* ```ts
|
|
50
|
-
* import { StorageManager, MemoryStorageAdapter, RedisStorageAdapter, zodValidator } from "@daiso-tech/core";
|
|
51
|
-
* import Redis from "ioredis";
|
|
52
|
-
* import { z } from "zod"
|
|
53
|
-
*
|
|
54
|
-
* const storageManager = new StorageManager({
|
|
55
|
-
* adapters: {
|
|
56
|
-
* memory: new MemoryStorageAdapter(),
|
|
57
|
-
* redis: new RedisStorageAdapter(new Redis()),
|
|
58
|
-
* },
|
|
59
|
-
* defaultAdapter: "memory",
|
|
60
|
-
* rootNamespace: "@storage/"
|
|
61
|
-
* });
|
|
62
|
-
*
|
|
63
|
-
* (async () => {
|
|
64
|
-
* await storageManager
|
|
65
|
-
* .withValidation(zodValidator(z.string()))
|
|
66
|
-
* .use()
|
|
67
|
-
* // You will se an typescript error and get runtime erorr
|
|
68
|
-
* .add("a", 1);
|
|
69
|
-
* })();
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
withValidation<TOutput extends TType = TType>(validator: Validator<TOutput>): IStorageFactory<TAdapters, TOutput>;
|
|
73
|
-
/**
|
|
74
|
-
* The <i>withTypes</i> method is used to set the value types of the storage.
|
|
75
|
-
* @example
|
|
76
|
-
* ```ts
|
|
77
|
-
* import { StorageManager, MemoryStorageAdapter, RedisStorageAdapter, zodValidator } from "@daiso-tech/core";
|
|
78
|
-
* import Redis from "ioredis";
|
|
79
|
-
* import { z } from "zod"
|
|
80
|
-
*
|
|
81
|
-
* const storageManager = new StorageManager({
|
|
82
|
-
* adapters: {
|
|
83
|
-
* memory: new MemoryStorageAdapter(),
|
|
84
|
-
* redis: new RedisStorageAdapter(new Redis()),
|
|
85
|
-
* },
|
|
86
|
-
* defaultAdapter: "memory",
|
|
87
|
-
* rootNamespace: "@storage/"
|
|
88
|
-
* });
|
|
89
|
-
*
|
|
90
|
-
* (async () => {
|
|
91
|
-
* await storageManager
|
|
92
|
-
* .withTypes<string>()
|
|
93
|
-
* .use()
|
|
94
|
-
* // You will se an typescript error
|
|
95
|
-
* .add("a", 1)
|
|
96
|
-
* })();
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
withType<TOutput extends TType = TType>(): IStorageFactory<TAdapters, TOutput>;
|
|
100
|
-
};
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import type { IListenable } from "../../event-bus/contracts/_module";
|
|
5
|
-
import { type AnyFunction, type AsyncLazyable, type GetOrAddValue } from "../../_shared/types";
|
|
6
|
-
import type { AllStorageEvents } from "../../storage/contracts/_module";
|
|
7
|
-
import type { LazyPromise } from "../../_module";
|
|
8
|
-
export type StorageValue<T> = Exclude<T, AnyFunction | undefined | null>;
|
|
9
|
-
/**
|
|
10
|
-
* The <i>IStorageListenable</i> contract defines a way for listening <i>{@link IStorage}</i> crud operations.
|
|
11
|
-
*/
|
|
12
|
-
export type IStorageListenable<TType = unknown> = IListenable<AllStorageEvents<TType>>;
|
|
13
|
-
/**
|
|
14
|
-
* The <i>IStorage</i> contract defines a way for storing data as key-value pairs independent of storage.
|
|
15
|
-
* It commes with more convient methods compared to <i>IStorageAdapter</i>.
|
|
16
|
-
* @group Contracts
|
|
17
|
-
*/
|
|
18
|
-
export type IStorage<TType = unknown> = IStorageListenable & {
|
|
19
|
-
/**
|
|
20
|
-
* The <i>exists</i> method returns true when <i>key</i> is found otherwise false will be returned.
|
|
21
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
22
|
-
*/
|
|
23
|
-
exists(key: string): LazyPromise<boolean>;
|
|
24
|
-
/**
|
|
25
|
-
* The <i>existsMany</i> method returns true for the <i>keys</i> that are found otherwise false will be returned.
|
|
26
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
27
|
-
*/
|
|
28
|
-
existsMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
29
|
-
/**
|
|
30
|
-
* The <i>missing</i> method returns true when <i>key</i> is not found otherwise false will be returned.
|
|
31
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
32
|
-
*/
|
|
33
|
-
missing(key: string): LazyPromise<boolean>;
|
|
34
|
-
/**
|
|
35
|
-
* The <i>missingMany</i> method returns true for the <i>keys</i> that are not found otherwise false will be returned.
|
|
36
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
37
|
-
*/
|
|
38
|
-
missingMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
39
|
-
/**
|
|
40
|
-
* The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
41
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
42
|
-
*/
|
|
43
|
-
get(key: string): LazyPromise<TType | null>;
|
|
44
|
-
/**
|
|
45
|
-
* The <i>getMany</i> returns the value for the <i>keys</i> that are found otherwise null will be returned.
|
|
46
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
47
|
-
*/
|
|
48
|
-
getMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, TType | null>>;
|
|
49
|
-
/**
|
|
50
|
-
* The <i>getOr</i> method returns the value when <i>key</i> is found otherwise <i>defaultValue</i> will be returned.
|
|
51
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
52
|
-
*/
|
|
53
|
-
getOr(key: string, defaultValue: AsyncLazyable<TType>): LazyPromise<TType>;
|
|
54
|
-
/**
|
|
55
|
-
* The <i>getOrMany</i> method returns the value for the keys that are found otherwise defaultValue will be returned.
|
|
56
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
57
|
-
*/
|
|
58
|
-
getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>): LazyPromise<Record<TKeys, TType>>;
|
|
59
|
-
/**
|
|
60
|
-
* The <i>getOrFail</i> method returns the value when <i>key</i> is found otherwise an error will be thrown.
|
|
61
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
62
|
-
* @throws {KeyNotFoundStorageError} {@link KeyNotFoundStorageError}
|
|
63
|
-
*/
|
|
64
|
-
getOrFail(key: string): LazyPromise<TType>;
|
|
65
|
-
/**
|
|
66
|
-
* 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.
|
|
67
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
68
|
-
*/
|
|
69
|
-
add(key: string, value: StorageValue<TType>): LazyPromise<boolean>;
|
|
70
|
-
/**
|
|
71
|
-
* The <i>addMany</i> method adds the keys that doesn't exists. Returns true for the keys that doesn't exists otherwise false will be returned.
|
|
72
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
73
|
-
*/
|
|
74
|
-
addMany<TKeys extends string>(values: Record<TKeys, StorageValue<TType>>): LazyPromise<Record<TKeys, boolean>>;
|
|
75
|
-
/**
|
|
76
|
-
* 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.
|
|
77
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
78
|
-
*/
|
|
79
|
-
update(key: string, value: TType): LazyPromise<boolean>;
|
|
80
|
-
/**
|
|
81
|
-
* The <i>updateMany</i> method updates the given keys. Returns true for the keys that exists otherwise false will be returned.
|
|
82
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
83
|
-
*/
|
|
84
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>): LazyPromise<Record<TKeys, boolean>>;
|
|
85
|
-
/**
|
|
86
|
-
* The <i>put</i> method replaces the key with given <i>value</i> if found. If the <i>key</i> is not found it will just be added. True is returned if the key is found otherwise false will be returned.
|
|
87
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
88
|
-
*/
|
|
89
|
-
put(key: string, value: StorageValue<TType>): LazyPromise<boolean>;
|
|
90
|
-
/**
|
|
91
|
-
* The <i>putMany</i> method 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.
|
|
92
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
93
|
-
*/
|
|
94
|
-
putMany<TKeys extends string>(values: Record<TKeys, StorageValue<TType>>): LazyPromise<Record<TKeys, boolean>>;
|
|
95
|
-
/**
|
|
96
|
-
* The <i>remove</i> method removes the given <i>key</i> when found. Returns true if the key is found otherwise false is returned.
|
|
97
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
98
|
-
*/
|
|
99
|
-
remove(key: string): LazyPromise<boolean>;
|
|
100
|
-
/**
|
|
101
|
-
* The <i>removesMany</i> method removes the keys that are found. Returns true for the keys that are found otherwise false is returned.
|
|
102
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
103
|
-
*/
|
|
104
|
-
removeMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
105
|
-
/**
|
|
106
|
-
* The <i>getAndRemove</i> method removes the given <i>key</i> and returns it when found otherwise null will be returned.
|
|
107
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
108
|
-
*/
|
|
109
|
-
getAndRemove(key: string): LazyPromise<TType | null>;
|
|
110
|
-
/**
|
|
111
|
-
* The <i>getOrAdd</i> method will retrieve the given <i>key</i> if found otherwise <i>valueToAdd</i> will be added and returned.
|
|
112
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
113
|
-
*/
|
|
114
|
-
getOrAdd(key: string, valueToAdd: AsyncLazyable<StorageValue<GetOrAddValue<TType>>>): LazyPromise<TType>;
|
|
115
|
-
/**
|
|
116
|
-
* The <i>increment</i> method will increment the given <i>key</i> if found otherwise nonthing will occur.
|
|
117
|
-
* Returns true if key exists otherwise false will be returned.
|
|
118
|
-
* An error will thrown if the key is not a number.
|
|
119
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
120
|
-
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
121
|
-
*/
|
|
122
|
-
increment(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
123
|
-
/**
|
|
124
|
-
* The <i>decrement</i> method will decrement the given <i>key</i> if found otherwise nonthing will occur.
|
|
125
|
-
* Returns true if key exists otherwise false will be returned.
|
|
126
|
-
* An error will thrown if the key is not a number.
|
|
127
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
128
|
-
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
129
|
-
* An error will thrown if the key is not a number.
|
|
130
|
-
*/
|
|
131
|
-
decrement(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
132
|
-
/**
|
|
133
|
-
* The <i>clear</i> method removes all the keys in the storage.
|
|
134
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
135
|
-
*/
|
|
136
|
-
clear(): LazyPromise<void>;
|
|
137
|
-
/**
|
|
138
|
-
* The <i>getNamespace</i> method return the complete namespace.
|
|
139
|
-
* @example
|
|
140
|
-
* ```ts
|
|
141
|
-
* const storage = new Storage(new MemoryStorageAdapter(), {
|
|
142
|
-
* rootNamespace: "@root/"
|
|
143
|
-
* });
|
|
144
|
-
*
|
|
145
|
-
* // Will be "@root/"
|
|
146
|
-
* console.log(storage.getNamespace())
|
|
147
|
-
*
|
|
148
|
-
* const storageA = storage.withNamespace("a/");
|
|
149
|
-
*
|
|
150
|
-
* // Will be "@root/a/"
|
|
151
|
-
* console.log(storageA.getNamespace())
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
getNamespace(): string;
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* The <i>INamespacedStorage</i> contract defines a way for storing data as key-value pairs independent of storage.
|
|
158
|
-
* It commes with one extra method which is useful for multitennat applications compared to <i>IStorage</i>.
|
|
159
|
-
* @group Contracts
|
|
160
|
-
*/
|
|
161
|
-
export type INamespacedStorage<TType = unknown> = IStorage<TType> & {
|
|
162
|
-
/**
|
|
163
|
-
* The <i>withNamespace</i> method returns new instance of <i>{@link IStorage}</i> where all the keys will be prefixed with a given <i>namespace</i>.
|
|
164
|
-
* This useful for multitennat applications.
|
|
165
|
-
* @example
|
|
166
|
-
* ```ts
|
|
167
|
-
* import { Storage, MemoryStorageAdapter } from "@daiso-tech/core";
|
|
168
|
-
*
|
|
169
|
-
* (async () => {
|
|
170
|
-
* const storage = new Storage(new MemoryStorageAdapter());
|
|
171
|
-
*
|
|
172
|
-
* const storageA = storage.withNamespace("a");
|
|
173
|
-
* await storageA.add("a", 1);
|
|
174
|
-
*
|
|
175
|
-
* const storageB = storage.withNamespace("b");
|
|
176
|
-
* await storageB.add("b", 2);
|
|
177
|
-
*
|
|
178
|
-
* // Will print { a: 1, b: null }
|
|
179
|
-
* console.log(await storageA.getMany(["a", "b"]));
|
|
180
|
-
* })();
|
|
181
|
-
*
|
|
182
|
-
* ```
|
|
183
|
-
*/
|
|
184
|
-
withNamespace(namespace: string): IStorage<TType>;
|
|
185
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from "../../storage/implementations/storage/_module";
|
|
2
|
-
export * from "../../storage/implementations/_shared/test-utilities/_module";
|
|
3
|
-
export * from "../../storage/implementations/memory-storage-adapter/_module";
|
|
4
|
-
export * from "../../storage/implementations/mongodb-storage-adapter/_module";
|
|
5
|
-
export * from "../../storage/implementations/redis-storage-adapter/_module";
|
|
6
|
-
export * from "../../storage/implementations/sqlite/_module";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../storage/implementations/_shared/test-utilities/storage-adapter.test-suite";
|
package/dist/types/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
|
|
5
|
-
import { type IStorageAdapter } from "../../../../storage/contracts/_module";
|
|
6
|
-
import { type Promisable } from "../../../../_shared/types";
|
|
7
|
-
/**
|
|
8
|
-
* @group Utilities
|
|
9
|
-
*/
|
|
10
|
-
export type StorageAdapterTestSuiteSettings = {
|
|
11
|
-
expect: ExpectStatic;
|
|
12
|
-
test: TestAPI;
|
|
13
|
-
describe: SuiteAPI;
|
|
14
|
-
beforeEach: typeof beforeEach;
|
|
15
|
-
createAdapter: () => Promisable<IStorageAdapter>;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* The <i>storageAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link IStorageAdapter}</i>.
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* import { storageAdapterTestSuite, MemoryStorageAdapter } from "@daiso-tech/core";
|
|
22
|
-
* import { expext, test, describe, beforeEach } from "vitest";
|
|
23
|
-
*
|
|
24
|
-
* describe("class: MemoryStorageAdapter", () => {
|
|
25
|
-
* storageAdapterTestSuite({
|
|
26
|
-
* createAdapter: () => new MemoryStorageAdapter(),
|
|
27
|
-
* test,
|
|
28
|
-
* beforeEach,
|
|
29
|
-
* expect,
|
|
30
|
-
* describe,
|
|
31
|
-
* });
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
* @group Utilities
|
|
35
|
-
*/
|
|
36
|
-
export declare function storageAdapterTestSuite(settings: StorageAdapterTestSuiteSettings): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../storage/implementations/memory-storage-adapter/memory-storage-adapter";
|
package/dist/types/storage/implementations/memory-storage-adapter/memory-storage-adapter.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import { type IStorageAdapter } from "../../../storage/contracts/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
|
-
putMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
12
|
-
increment(key: string, value: number): Promise<boolean>;
|
|
13
|
-
getMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TType | null>>;
|
|
14
|
-
addMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
15
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
16
|
-
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
17
|
-
clear(prefix: string): Promise<void>;
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MongodbStorageAdapter, type MongodbStorageAdapterSettings, } from "../../../storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter";
|
package/dist/types/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import { type ISerializer } from "../../../serializer/contracts/_module";
|
|
5
|
-
import { type IInitizable } from "../../../_shared/types";
|
|
6
|
-
import { type IStorageAdapter } from "../../../storage/contracts/_module";
|
|
7
|
-
import { type Collection, ObjectId } from "mongodb";
|
|
8
|
-
/**
|
|
9
|
-
* @group Adapters
|
|
10
|
-
*/
|
|
11
|
-
export type MongodbStorageDocument = {
|
|
12
|
-
_id: ObjectId;
|
|
13
|
-
key: string;
|
|
14
|
-
value: number | string;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @group Adapters
|
|
18
|
-
*/
|
|
19
|
-
export type MongodbStorageAdapterSettings = {
|
|
20
|
-
serializer?: ISerializer<string>;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* @group Adapters
|
|
24
|
-
*/
|
|
25
|
-
export declare class MongodbStorageAdapter<TType> implements IStorageAdapter<TType>, IInitizable {
|
|
26
|
-
private readonly collection;
|
|
27
|
-
private static isMongodbIncrementError;
|
|
28
|
-
private static isMongoDuplicateError;
|
|
29
|
-
private serializer;
|
|
30
|
-
constructor(collection: Collection<MongodbStorageDocument>, { serializer, }?: MongodbStorageAdapterSettings);
|
|
31
|
-
init(): Promise<void>;
|
|
32
|
-
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
33
|
-
getMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TType | null>>;
|
|
34
|
-
addMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
35
|
-
private updateOne;
|
|
36
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
37
|
-
private putOne;
|
|
38
|
-
putMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
39
|
-
private removeOne;
|
|
40
|
-
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
41
|
-
increment(key: string, value: number): Promise<boolean>;
|
|
42
|
-
clear(prefix: string): Promise<void>;
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../storage/implementations/redis-storage-adapter/redis-storage-adapter";
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import { type ISerializer } from "../../../serializer/contracts/_module";
|
|
5
|
-
import { type IStorageAdapter } from "../../../storage/contracts/_module";
|
|
6
|
-
import type Redis from "ioredis";
|
|
7
|
-
import { type Result } from "ioredis";
|
|
8
|
-
declare module "ioredis" {
|
|
9
|
-
interface RedisCommander<Context> {
|
|
10
|
-
daiso_storage_increment(key: string, number: string): Result<number, Context>;
|
|
11
|
-
daiso_storage_put(key: string, value: string): Result<string, Context>;
|
|
12
|
-
daiso_storage_getOrAdd(key: string, valueToAdd: string): Result<string, Context>;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @group Adapters
|
|
17
|
-
*/
|
|
18
|
-
export type RedisStorageAdapterSettings = {
|
|
19
|
-
serializer?: ISerializer<string>;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* @group Adapters
|
|
23
|
-
*/
|
|
24
|
-
export declare class RedisStorageAdapter<TType> implements IStorageAdapter<TType> {
|
|
25
|
-
private readonly client;
|
|
26
|
-
private serializer;
|
|
27
|
-
constructor(client: Redis, { serializer, }?: RedisStorageAdapterSettings);
|
|
28
|
-
private initIncrementCommand;
|
|
29
|
-
private initPutCommand;
|
|
30
|
-
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
31
|
-
getMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TType | null>>;
|
|
32
|
-
addMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
33
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
34
|
-
putMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
35
|
-
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
36
|
-
increment(key: string, value: number): Promise<boolean>;
|
|
37
|
-
clear(prefix: string): Promise<void>;
|
|
38
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../storage/implementations/sqlite/_shared/base-sqlite-storage-adapter";
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import { type IStorageAdapter } from "../../../../storage/contracts/storage-adapter.contract";
|
|
5
|
-
import { type Generated, type Kysely } from "kysely";
|
|
6
|
-
import { type ISerializer } from "../../../../serializer/contracts/_module";
|
|
7
|
-
import { type IInitizable } from "../../../../_shared/types";
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
type BaseSqliteStorageTable = {
|
|
12
|
-
key: string;
|
|
13
|
-
value: string;
|
|
14
|
-
hasBeenUpdated: Generated<1 | 0>;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
type BaseSqliteTables = {
|
|
20
|
-
storage: BaseSqliteStorageTable;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
export declare class BaseSqliteStorageAdapter<TType> implements IStorageAdapter<TType>, IInitizable {
|
|
26
|
-
private readonly db;
|
|
27
|
-
private readonly serializer;
|
|
28
|
-
constructor(db: Kysely<BaseSqliteTables>, serializer: ISerializer<string>);
|
|
29
|
-
init(): Promise<void>;
|
|
30
|
-
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
31
|
-
getMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TType | null>>;
|
|
32
|
-
addMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
33
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
34
|
-
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
35
|
-
putMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
36
|
-
increment(key: string, value: number): Promise<boolean>;
|
|
37
|
-
clear(prefix: string): Promise<void>;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter";
|
package/dist/types/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import type { ISerializer } from "../../../../serializer/contracts/_module";
|
|
5
|
-
import { type IStorageAdapter } from "../../../../storage/contracts/_module";
|
|
6
|
-
import { type IInitizable } from "../../../../_shared/types";
|
|
7
|
-
import type { Client } from "@libsql/client";
|
|
8
|
-
/**
|
|
9
|
-
* @group Adapters
|
|
10
|
-
*/
|
|
11
|
-
export type LibsqlStorageAdapterSettings = {
|
|
12
|
-
tableName?: string;
|
|
13
|
-
serializer?: ISerializer<string>;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* @group Adapters
|
|
17
|
-
*/
|
|
18
|
-
export declare class LibsqlStorageAdapter<TType> implements IStorageAdapter<TType>, IInitizable {
|
|
19
|
-
private readonly storageAdapter;
|
|
20
|
-
constructor(client: Client, { tableName, serializer, }?: LibsqlStorageAdapterSettings);
|
|
21
|
-
init(): Promise<void>;
|
|
22
|
-
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
23
|
-
getMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TType | null>>;
|
|
24
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
25
|
-
addMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
26
|
-
putMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
27
|
-
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
28
|
-
increment(key: string, value: number): Promise<boolean>;
|
|
29
|
-
clear(prefix: string): Promise<void>;
|
|
30
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter";
|
package/dist/types/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import type { ISerializer } from "../../../../serializer/contracts/_module";
|
|
5
|
-
import { type IStorageAdapter } from "../../../../storage/contracts/_module";
|
|
6
|
-
import { type Database } from "better-sqlite3";
|
|
7
|
-
import { type IInitizable } from "../../../../_shared/types";
|
|
8
|
-
/**
|
|
9
|
-
* @group Adapters
|
|
10
|
-
*/
|
|
11
|
-
export type SqliteStorageAdapterSettings = {
|
|
12
|
-
tableName?: string;
|
|
13
|
-
serializer?: ISerializer<string>;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* @group Adapters
|
|
17
|
-
*/
|
|
18
|
-
export declare class SqliteStorageAdapter<TType> implements IStorageAdapter<TType>, IInitizable {
|
|
19
|
-
private readonly storageAdapter;
|
|
20
|
-
constructor(database: Database, { tableName, serializer, }?: SqliteStorageAdapterSettings);
|
|
21
|
-
init(): Promise<void>;
|
|
22
|
-
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
23
|
-
getMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TType | null>>;
|
|
24
|
-
addMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
25
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
26
|
-
putMany<TKeys extends string>(values: Record<TKeys, TType>): Promise<Record<TKeys, boolean>>;
|
|
27
|
-
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
28
|
-
increment(key: string, value: number): Promise<boolean>;
|
|
29
|
-
clear(prefix: string): Promise<void>;
|
|
30
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Storage
|
|
3
|
-
*/
|
|
4
|
-
import type { INamespacedEventBus } from "../../../event-bus/contracts/_module";
|
|
5
|
-
import type { IStorageFactory, INamespacedStorage, IStorageAdapter, IStorageManager } from "../../../storage/contracts/_module";
|
|
6
|
-
import type { Validator } from "../../../utilities/_module";
|
|
7
|
-
/**
|
|
8
|
-
* @group Derivables
|
|
9
|
-
*/
|
|
10
|
-
export type StorageManagerSettings<TAdapters extends string = string> = {
|
|
11
|
-
adapters: Record<TAdapters, IStorageAdapter<any>>;
|
|
12
|
-
defaultAdapter: NoInfer<TAdapters>;
|
|
13
|
-
rootNamespace: string;
|
|
14
|
-
eventBus?: INamespacedEventBus<any>;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @group Derivables
|
|
18
|
-
*/
|
|
19
|
-
export declare class StorageManager<TAdapters extends string = string, TType = unknown> implements IStorageManager<TAdapters, TType> {
|
|
20
|
-
private readonly adapters;
|
|
21
|
-
private readonly defaultAdapter;
|
|
22
|
-
private readonly rootNamespace;
|
|
23
|
-
private readonly eventBus?;
|
|
24
|
-
private validator;
|
|
25
|
-
constructor(settings: StorageManagerSettings<TAdapters>);
|
|
26
|
-
use(adapter?: TAdapters): INamespacedStorage<TType>;
|
|
27
|
-
withValidation<TOutput extends TType = TType>(validator: Validator<TOutput>): IStorageFactory<TAdapters, TOutput>;
|
|
28
|
-
withType<TOutput extends TType = TType>(): IStorageFactory<TAdapters, TOutput>;
|
|
29
|
-
}
|