@daiso-tech/core 0.9.0 → 0.11.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/_shared/utilities.js +7 -0
- package/dist/cjs/_shared/utilities.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/event-bus/implementations/adapters/no-op-event-bus-adapter/_module.js +18 -0
- 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/event-bus/implementations/{memory-event-bus-adapter → 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/storage/contracts/_module.js +4 -4
- package/dist/cjs/storage/contracts/_module.js.map +1 -1
- package/dist/cjs/storage/contracts/{storage-manager.contract.js → storage-factory.contract.js} +1 -1
- package/dist/cjs/storage/contracts/storage-factory.contract.js.map +1 -0
- package/dist/cjs/storage/contracts/{_shared.js → storage.errors.js} +1 -1
- package/dist/cjs/storage/contracts/storage.errors.js.map +1 -0
- package/dist/cjs/storage/contracts/{storage-events.contract.js → storage.events.js} +6 -6
- package/dist/cjs/storage/contracts/storage.events.js.map +1 -0
- package/dist/cjs/storage/implementations/_module.js +2 -5
- package/dist/cjs/storage/implementations/_module.js.map +1 -1
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +74 -242
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +1 -1
- package/dist/cjs/storage/implementations/adapters/_module.js +21 -0
- package/dist/cjs/storage/implementations/adapters/_module.js.map +1 -0
- package/dist/cjs/storage/implementations/{memory-storage-adapter → adapters/memory-storage-adapter}/_module.js +1 -1
- package/dist/cjs/storage/implementations/adapters/memory-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/implementations/adapters/memory-storage-adapter/memory-storage-adapter.js +58 -0
- package/dist/cjs/storage/implementations/adapters/memory-storage-adapter/memory-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/implementations/{mongodb-storage-adapter → adapters/mongodb-storage-adapter}/_module.js +1 -1
- package/dist/cjs/storage/implementations/adapters/mongodb-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/implementations/{mongodb-storage-adapter → adapters/mongodb-storage-adapter}/mongodb-storage-adapter.js +22 -93
- package/dist/cjs/storage/implementations/adapters/mongodb-storage-adapter/mongodb-storage-adapter.js.map +1 -0
- package/dist/cjs/{event-bus/implementations/no-op-event-bus-adapter → storage/implementations/adapters/redis-storage-adapter}/_module.js +1 -1
- package/dist/cjs/storage/implementations/adapters/redis-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/implementations/adapters/redis-storage-adapter/redis-storage-adapter.js +89 -0
- package/dist/cjs/storage/implementations/adapters/redis-storage-adapter/redis-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/implementations/adapters/sqlite/_module.js +19 -0
- package/dist/cjs/storage/implementations/adapters/sqlite/_module.js.map +1 -0
- package/dist/cjs/{event-bus/implementations/redis-event-bus-adapter → storage/implementations/adapters/sqlite/_shared}/_module.js +1 -1
- package/dist/cjs/storage/implementations/adapters/sqlite/_shared/_module.js.map +1 -0
- package/dist/cjs/storage/implementations/adapters/sqlite/_shared/base-sqlite-storage-adapter.js +119 -0
- package/dist/cjs/storage/implementations/adapters/sqlite/_shared/base-sqlite-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/implementations/adapters/sqlite/libsql-storage-adapter/_module.js +18 -0
- package/dist/cjs/storage/implementations/adapters/sqlite/libsql-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/implementations/{sqlite → adapters/sqlite}/libsql-storage-adapter/libsql-storage-adapter.js +16 -16
- package/dist/cjs/storage/implementations/adapters/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/implementations/adapters/sqlite/sqlite-storage-adapter/_module.js +18 -0
- package/dist/cjs/storage/implementations/adapters/sqlite/sqlite-storage-adapter/_module.js.map +1 -0
- package/dist/cjs/storage/implementations/{sqlite → adapters/sqlite}/sqlite-storage-adapter/sqlite-storage-adapter.js +16 -16
- package/dist/cjs/storage/implementations/adapters/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +1 -0
- package/dist/cjs/storage/implementations/derivables/_module.js +19 -0
- package/dist/cjs/storage/implementations/derivables/_module.js.map +1 -0
- package/dist/cjs/storage/implementations/derivables/storage-factory.js +42 -0
- package/dist/cjs/storage/implementations/derivables/storage-factory.js.map +1 -0
- package/dist/cjs/storage/implementations/derivables/storage.js +429 -0
- package/dist/cjs/storage/implementations/derivables/storage.js.map +1 -0
- 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/_shared/utilities.js +6 -0
- package/dist/esm/_shared/utilities.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/storage/contracts/_module.js +4 -4
- package/dist/esm/storage/contracts/_module.js.map +1 -1
- package/dist/esm/storage/contracts/storage-factory.contract.js +1 -0
- package/dist/esm/storage/contracts/storage-factory.contract.js.map +1 -0
- package/dist/esm/storage/contracts/{_shared.js → storage.errors.js} +1 -1
- package/dist/esm/storage/contracts/storage.errors.js.map +1 -0
- package/dist/esm/storage/contracts/storage.events.js +11 -0
- package/dist/esm/storage/contracts/storage.events.js.map +1 -0
- package/dist/esm/storage/implementations/_module.js +2 -5
- package/dist/esm/storage/implementations/_module.js.map +1 -1
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +74 -242
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +1 -1
- package/dist/esm/storage/implementations/adapters/_module.js +5 -0
- package/dist/esm/storage/implementations/adapters/_module.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/memory-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/implementations/adapters/memory-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/memory-storage-adapter/memory-storage-adapter.js +54 -0
- package/dist/esm/storage/implementations/adapters/memory-storage-adapter/memory-storage-adapter.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/mongodb-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/implementations/adapters/mongodb-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/implementations/{mongodb-storage-adapter → adapters/mongodb-storage-adapter}/mongodb-storage-adapter.js +21 -92
- package/dist/esm/storage/implementations/adapters/mongodb-storage-adapter/mongodb-storage-adapter.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/redis-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/implementations/adapters/redis-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/redis-storage-adapter/redis-storage-adapter.js +85 -0
- package/dist/esm/storage/implementations/adapters/redis-storage-adapter/redis-storage-adapter.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/sqlite/_module.js +3 -0
- package/dist/esm/storage/implementations/adapters/sqlite/_module.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/sqlite/_shared/_module.js +2 -0
- package/dist/esm/storage/implementations/adapters/sqlite/_shared/_module.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/sqlite/_shared/base-sqlite-storage-adapter.js +115 -0
- package/dist/esm/storage/implementations/adapters/sqlite/_shared/base-sqlite-storage-adapter.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/sqlite/libsql-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/implementations/adapters/sqlite/libsql-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/sqlite/libsql-storage-adapter/libsql-storage-adapter.js +49 -0
- package/dist/esm/storage/implementations/adapters/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/sqlite/sqlite-storage-adapter/_module.js +2 -0
- package/dist/esm/storage/implementations/adapters/sqlite/sqlite-storage-adapter/_module.js.map +1 -0
- package/dist/esm/storage/implementations/adapters/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js +48 -0
- package/dist/esm/storage/implementations/adapters/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +1 -0
- package/dist/esm/storage/implementations/derivables/_module.js +3 -0
- package/dist/esm/storage/implementations/derivables/_module.js.map +1 -0
- package/dist/esm/storage/implementations/derivables/storage-factory.js +38 -0
- package/dist/esm/storage/implementations/derivables/storage-factory.js.map +1 -0
- package/dist/esm/storage/implementations/derivables/storage.js +425 -0
- package/dist/esm/storage/implementations/derivables/storage.js.map +1 -0
- 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/_shared/types.d.ts +4 -0
- package/dist/types/_shared/utilities.d.ts +5 -1
- package/dist/types/collection/contracts/async-collection.contract.d.ts +37 -37
- 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 +29 -25
- 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 +10 -9
- package/dist/types/serializer/contracts/_module.d.ts +1 -0
- package/dist/types/serializer/contracts/serializer.contract.d.ts +2 -20
- package/dist/types/serializer/contracts/serializer.errors.d.ts +21 -0
- package/dist/types/storage/contracts/_module.d.ts +4 -4
- package/dist/types/storage/contracts/storage-adapter.contract.d.ts +11 -11
- package/dist/types/storage/contracts/storage-factory.contract.d.ts +67 -0
- package/dist/types/storage/contracts/storage.contract.d.ts +41 -43
- package/dist/types/storage/contracts/{storage-events.contract.d.ts → storage.events.d.ts} +24 -21
- package/dist/types/storage/implementations/_module.d.ts +2 -5
- package/dist/types/storage/implementations/adapters/_module.d.ts +4 -0
- package/dist/types/storage/implementations/adapters/memory-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/implementations/adapters/memory-storage-adapter/memory-storage-adapter.d.ts +18 -0
- package/dist/types/storage/implementations/adapters/mongodb-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/implementations/adapters/mongodb-storage-adapter/mongodb-storage-adapter.d.ts +40 -0
- package/dist/types/storage/implementations/adapters/redis-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/implementations/{redis-storage-adapter → adapters/redis-storage-adapter}/redis-storage-adapter.d.ts +8 -9
- package/dist/types/storage/implementations/adapters/sqlite/_module.d.ts +2 -0
- package/dist/types/storage/implementations/adapters/sqlite/_shared/_module.d.ts +1 -0
- package/dist/types/storage/implementations/adapters/sqlite/_shared/base-sqlite-storage-adapter.d.ts +45 -0
- package/dist/types/storage/implementations/adapters/sqlite/libsql-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/implementations/adapters/sqlite/libsql-storage-adapter/libsql-storage-adapter.d.ts +37 -0
- package/dist/types/storage/implementations/adapters/sqlite/sqlite-storage-adapter/_module.d.ts +1 -0
- package/dist/types/storage/implementations/adapters/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.d.ts +37 -0
- package/dist/types/storage/implementations/derivables/_module.d.ts +2 -0
- package/dist/types/storage/implementations/derivables/storage-factory.d.ts +47 -0
- package/dist/types/storage/implementations/{storage → derivables}/storage.d.ts +36 -31
- 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/_shared.js.map +0 -1
- 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/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.map +0 -1
- 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.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.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/_shared.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/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.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/storage-manager.contract.d.ts +0 -100
- 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/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/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
- /package/dist/types/storage/contracts/{_shared.d.ts → storage.errors.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module EventBus
|
|
3
3
|
*/
|
|
4
|
-
import { type ISerializer } from "
|
|
5
|
-
import type { IBaseEvent, IEventBusAdapter, Listener } from "
|
|
4
|
+
import { type ISerializer } from "../../../../serializer/contracts/_module";
|
|
5
|
+
import type { IBaseEvent, IEventBusAdapter, Listener } from "../../../../event-bus/contracts/_module";
|
|
6
6
|
import type Redis from "ioredis";
|
|
7
7
|
/**
|
|
8
8
|
* @group Adapters
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module EventBus
|
|
3
|
+
*/
|
|
4
|
+
import type { Validator } from "../../../utilities/_module";
|
|
5
|
+
import type { INamespacedEventBus, IEventBusAdapter, IBaseEvent, IEventBusFactory } from "../../../event-bus/contracts/_module";
|
|
6
|
+
/**
|
|
7
|
+
* @group Derivables
|
|
8
|
+
*/
|
|
9
|
+
export type EventBusDrivers<TAdapters extends string = string> = Partial<Record<TAdapters, IEventBusAdapter>>;
|
|
10
|
+
/**
|
|
11
|
+
* @group Derivables
|
|
12
|
+
*/
|
|
13
|
+
export type EventBusFactorySettings<TAdapters extends string = string> = {
|
|
14
|
+
drivers: EventBusDrivers<TAdapters>;
|
|
15
|
+
defaultDriver?: NoInfer<TAdapters>;
|
|
16
|
+
rootNamespace?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @group Derivables
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { EventBusFactory } from "@daiso-tech/core";
|
|
23
|
+
* import Redis from "ioredis"
|
|
24
|
+
*
|
|
25
|
+
* const eventBusFactory = new EventBusFactory({
|
|
26
|
+
* drivers: {
|
|
27
|
+
* memory: new MemoryEventBusAdapter(),
|
|
28
|
+
* redis: new RedisEventBusAdapter({
|
|
29
|
+
* dispatcherClient: new Redis(),
|
|
30
|
+
* listenerClient: new Redis(),
|
|
31
|
+
* }),
|
|
32
|
+
* },
|
|
33
|
+
* defaultDriver: "memory",
|
|
34
|
+
* rootNamespace: "@events"
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare class EventBusFactory<TAdapters extends string = string, TEvent extends IBaseEvent = IBaseEvent> implements IEventBusFactory<TAdapters> {
|
|
39
|
+
private readonly drivers;
|
|
40
|
+
private readonly defaultDriver?;
|
|
41
|
+
private readonly rootNamespace?;
|
|
42
|
+
private validator;
|
|
43
|
+
constructor(settings: EventBusFactorySettings<TAdapters>);
|
|
44
|
+
use(driverName?: TAdapters | undefined): INamespacedEventBus<TEvent>;
|
|
45
|
+
withValidation<TOutput extends IBaseEvent = IBaseEvent>(validator: Validator<TOutput>): IEventBusFactory<TAdapters, TOutput>;
|
|
46
|
+
withType<TOutput extends IBaseEvent = IBaseEvent>(): IEventBusFactory<TAdapters, TOutput>;
|
|
47
|
+
}
|
|
@@ -18,11 +18,12 @@ export type EventBusSettings<TEvents extends IBaseEvent> = {
|
|
|
18
18
|
* ```ts
|
|
19
19
|
* import { EventBus, MemoryEventBusAdapter } from "@daiso-tech/core";
|
|
20
20
|
*
|
|
21
|
-
* const
|
|
22
|
-
*
|
|
21
|
+
* const memoryEventBusAdapter = new MemoryEventBusAdapter();
|
|
22
|
+
* const eventBusA = new EventBus(memoryEventBusAdapter, {
|
|
23
|
+
* rootNamespace: "@a"
|
|
23
24
|
* });
|
|
24
|
-
* const eventBusB = new EventBus(
|
|
25
|
-
* rootNamespace: "@b
|
|
25
|
+
* const eventBusB = new EventBus(memoryEventBusAdapter, {
|
|
26
|
+
* rootNamespace: "@b"
|
|
26
27
|
* });
|
|
27
28
|
*
|
|
28
29
|
* (async () => {
|
|
@@ -42,7 +43,7 @@ export type EventBusSettings<TEvents extends IBaseEvent> = {
|
|
|
42
43
|
* })();
|
|
43
44
|
* ```
|
|
44
45
|
*/
|
|
45
|
-
rootNamespace?: string
|
|
46
|
+
rootNamespace?: OneOrMore<string>;
|
|
46
47
|
/**
|
|
47
48
|
* You can pass a custom <i>{@link Validator}</i> to validate, transform and sanitize your data.
|
|
48
49
|
* You could also use <i>{@link zodValidator}</i> which enables you to use zod for validating, transforming, and sanitizing.
|
|
@@ -87,16 +88,16 @@ export type EventBusSettings<TEvents extends IBaseEvent> = {
|
|
|
87
88
|
*/
|
|
88
89
|
export declare class EventBus<TEvents extends IBaseEvent = IBaseEvent> implements INamespacedEventBus<TEvents> {
|
|
89
90
|
private readonly eventBusAdapter;
|
|
90
|
-
private readonly
|
|
91
|
+
private readonly namespace;
|
|
91
92
|
private readonly validator;
|
|
92
93
|
constructor(eventBusAdapter: IEventBusAdapter, settings?: EventBusSettings<TEvents>);
|
|
93
|
-
withNamespace(namespace: string): IEventBus<TEvents>;
|
|
94
|
+
withNamespace(namespace: OneOrMore<string>): IEventBus<TEvents>;
|
|
94
95
|
getNamespace(): string;
|
|
95
96
|
addListener<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
96
97
|
addListenerMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
97
98
|
removeListener<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
98
99
|
removeListenerMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
99
|
-
subscribe<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
100
|
-
subscribeMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
100
|
+
subscribe<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<Unsubscribe>;
|
|
101
|
+
subscribeMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<Unsubscribe>;
|
|
101
102
|
dispatch(events: OneOrMore<TEvents>): LazyPromise<void>;
|
|
102
103
|
}
|
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Serializer
|
|
3
3
|
*/
|
|
4
|
-
/**
|
|
5
|
-
* @group Errors
|
|
6
|
-
*/
|
|
7
|
-
export declare class SerializerError extends Error {
|
|
8
|
-
constructor(message: string, cause?: unknown);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @group Errors
|
|
12
|
-
*/
|
|
13
|
-
export declare class SerializationError extends SerializerError {
|
|
14
|
-
constructor(message: string, cause?: unknown);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @group Errors
|
|
18
|
-
*/
|
|
19
|
-
export declare class DeserializationError extends SerializerError {
|
|
20
|
-
constructor(message: string, cause?: unknown);
|
|
21
|
-
}
|
|
22
4
|
/**
|
|
23
5
|
* @group Contracts
|
|
24
6
|
*/
|
|
@@ -26,9 +8,9 @@ export type ISerializer<TSerialized = unknown> = {
|
|
|
26
8
|
/**
|
|
27
9
|
* @throws {SerializationError} {@link SerializationError}
|
|
28
10
|
*/
|
|
29
|
-
serialize<TValue>(value: TValue):
|
|
11
|
+
serialize<TValue>(value: TValue): PromiseLike<TSerialized>;
|
|
30
12
|
/**
|
|
31
13
|
* @throws {DeserializationError} {@link DeserializationError}
|
|
32
14
|
*/
|
|
33
|
-
deserialize<TValue>(value: TSerialized):
|
|
15
|
+
deserialize<TValue>(value: TSerialized): PromiseLike<TValue>;
|
|
34
16
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Serializer
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @group Errors
|
|
6
|
+
*/
|
|
7
|
+
export declare class SerializerError extends Error {
|
|
8
|
+
constructor(message: string, cause?: unknown);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @group Errors
|
|
12
|
+
*/
|
|
13
|
+
export declare class SerializationError extends SerializerError {
|
|
14
|
+
constructor(message: string, cause?: unknown);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @group Errors
|
|
18
|
+
*/
|
|
19
|
+
export declare class DeserializationError extends SerializerError {
|
|
20
|
+
constructor(message: string, cause?: unknown);
|
|
21
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "../../storage/contracts/_shared";
|
|
2
|
-
export * from "../../storage/contracts/storage.contract";
|
|
3
1
|
export * from "../../storage/contracts/storage-adapter.contract";
|
|
4
|
-
export * from "../../storage/contracts/storage-
|
|
5
|
-
export * from "../../storage/contracts/storage
|
|
2
|
+
export * from "../../storage/contracts/storage-factory.contract";
|
|
3
|
+
export * from "../../storage/contracts/storage.contract";
|
|
4
|
+
export * from "../../storage/contracts/storage.errors";
|
|
5
|
+
export * from "../../storage/contracts/storage.events";
|
|
@@ -8,28 +8,28 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type IStorageAdapter<TType = unknown> = {
|
|
10
10
|
/**
|
|
11
|
-
* The <i>
|
|
11
|
+
* The <i>get</i> returns the value of <i>keys</i> that are found otherwise null will be returned.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
get(key: string): PromiseLike<TType | null>;
|
|
14
14
|
/**
|
|
15
|
-
* The <i>
|
|
15
|
+
* The <i>add</i> method add a new <i>key</i>. Returns true if the <i>key</i> where added otherwise false will be returned.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
add(key: string, value: TType): PromiseLike<boolean>;
|
|
18
18
|
/**
|
|
19
|
-
* The <i>
|
|
19
|
+
* The <i>update</i> method updates a <i>key</i>. Returns true if the <i>key</i> where updated otherwise false will be returned.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
update(key: string, value: TType): PromiseLike<boolean>;
|
|
22
22
|
/**
|
|
23
|
-
* The <i>
|
|
23
|
+
* The <i>put</i> method replaces a <i>key</i> that exists or adds <i>key</i> that do not exists. Return true if the <i>key</i> where updated otherwise false is returned.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
put(key: string, value: TType): PromiseLike<boolean>;
|
|
26
26
|
/**
|
|
27
|
-
* The <i>
|
|
27
|
+
* The <i>remove</i> method removes a <i>key</i>. Returns true if the <i>key</i> is removed otherwise false is returned.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
remove(key: string): PromiseLike<boolean>;
|
|
30
30
|
/**
|
|
31
31
|
* The <i>increment</i> method will increment the given <i>key</i> if found otherwise nonthing will occur.
|
|
32
|
-
* Returns true if key
|
|
32
|
+
* Returns true if key is incremented otherwise false will be returned.
|
|
33
33
|
* An error will thrown if the key is not a number.
|
|
34
34
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
35
35
|
*/
|
|
@@ -0,0 +1,67 @@
|
|
|
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 configure and switch between different <i>{@link INamespacedStorage}</i> dynamically.
|
|
8
|
+
* @group Contracts
|
|
9
|
+
*/
|
|
10
|
+
export type IStorageFactory<TDrivers extends string = string, TType = unknown> = {
|
|
11
|
+
/**
|
|
12
|
+
* The <i>use</i> method will throw an error if you provide it unregisted driver.
|
|
13
|
+
* If no default driver is defined an error will be thrown by <i>use</i> method.
|
|
14
|
+
* @throws {UnregisteredDriverError} {@link UnregisteredDriverError}
|
|
15
|
+
* @throws {DefaultDriverNotDefinedError} {@link DefaultDriverNotDefinedError}
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { type IStorageFactory } from "@daiso-tech/core";
|
|
19
|
+
*
|
|
20
|
+
* async function main(storageFactory: IStorageFactory): Promise<void> {
|
|
21
|
+
* // Will add key using the default driver which is the memory addapter
|
|
22
|
+
* await storageFactory
|
|
23
|
+
* .use()
|
|
24
|
+
* .add("a", 1);
|
|
25
|
+
* // Will add key using the redis addapter
|
|
26
|
+
* await storageFactory
|
|
27
|
+
* .use("redis")
|
|
28
|
+
* .add("a", 1);
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
use(driverName?: TDrivers): INamespacedStorage<TType>;
|
|
33
|
+
/**
|
|
34
|
+
* The <i>withValidation</i> method is used to set a <i>validator</i>, which validates the storage values during runtime.
|
|
35
|
+
* The type is inferred from the provided <i>validator</i>.
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { type IStorageFactory, zodValidator } from "@daiso-tech/core";
|
|
39
|
+
* import { z } from "zod"
|
|
40
|
+
*
|
|
41
|
+
* async function main(storageFactory: IStorageFactory): Promise<void> {
|
|
42
|
+
* await storageFactory
|
|
43
|
+
* .withValidation(zodValidator(z.string()))
|
|
44
|
+
* .use()
|
|
45
|
+
* // You will se an typescript error and get runtime erorr
|
|
46
|
+
* .add("a", 1);
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
withValidation<TOutput extends TType = TType>(validator: Validator<TOutput>): IStorageFactory<TDrivers, TOutput>;
|
|
51
|
+
/**
|
|
52
|
+
* The <i>withTypes</i> method is used to set the value types of the storage.
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { type IStorageFactory zodValidator } from "@daiso-tech/core";
|
|
56
|
+
*
|
|
57
|
+
* async function main(storageFactory: IStorageFactory): Promise<void> {
|
|
58
|
+
* await storageFactory
|
|
59
|
+
* .withTypes<string>()
|
|
60
|
+
* .use()
|
|
61
|
+
* // You will se an typescript error
|
|
62
|
+
* .add("a", 1)
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
withType<TOutput extends TType = TType>(): IStorageFactory<TDrivers, TOutput>;
|
|
67
|
+
};
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* @module Storage
|
|
3
3
|
*/
|
|
4
4
|
import type { IListenable } from "../../event-bus/contracts/_module";
|
|
5
|
-
import
|
|
5
|
+
import type { OneOrMore } from "../../_shared/types";
|
|
6
|
+
import { type AsyncLazyable, type GetOrAddValue } from "../../_shared/types";
|
|
6
7
|
import type { AllStorageEvents } from "../../storage/contracts/_module";
|
|
7
|
-
|
|
8
|
+
import type { LazyPromise } from "../../utilities/_module";
|
|
8
9
|
/**
|
|
9
10
|
* The <i>IStorageListenable</i> contract defines a way for listening <i>{@link IStorage}</i> crud operations.
|
|
10
11
|
*/
|
|
@@ -19,106 +20,106 @@ 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.
|
|
20
21
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
21
22
|
*/
|
|
22
|
-
exists(key: string):
|
|
23
|
+
exists(key: string): LazyPromise<boolean>;
|
|
23
24
|
/**
|
|
24
25
|
* The <i>existsMany</i> method returns true for the <i>keys</i> that are found otherwise false will be returned.
|
|
25
26
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
26
27
|
*/
|
|
27
|
-
existsMany<TKeys extends string>(keys: TKeys[]):
|
|
28
|
+
existsMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
28
29
|
/**
|
|
29
30
|
* The <i>missing</i> method returns true when <i>key</i> is not found otherwise false will be returned.
|
|
30
31
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
31
32
|
*/
|
|
32
|
-
missing(key: string):
|
|
33
|
+
missing(key: string): LazyPromise<boolean>;
|
|
33
34
|
/**
|
|
34
35
|
* The <i>missingMany</i> method returns true for the <i>keys</i> that are not found otherwise false will be returned.
|
|
35
36
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
36
37
|
*/
|
|
37
|
-
missingMany<TKeys extends string>(keys: TKeys[]):
|
|
38
|
+
missingMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
38
39
|
/**
|
|
39
40
|
* The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
40
41
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
41
42
|
*/
|
|
42
|
-
get(key: string):
|
|
43
|
+
get(key: string): LazyPromise<TType | null>;
|
|
43
44
|
/**
|
|
44
45
|
* The <i>getMany</i> returns the value for the <i>keys</i> that are found otherwise null will be returned.
|
|
45
46
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
46
47
|
*/
|
|
47
|
-
getMany<TKeys extends string>(keys: TKeys[]):
|
|
48
|
+
getMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, TType | null>>;
|
|
48
49
|
/**
|
|
49
50
|
* The <i>getOr</i> method returns the value when <i>key</i> is found otherwise <i>defaultValue</i> will be returned.
|
|
50
51
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
51
52
|
*/
|
|
52
|
-
getOr(key: string, defaultValue: AsyncLazyable<TType>):
|
|
53
|
+
getOr(key: string, defaultValue: AsyncLazyable<TType>): LazyPromise<TType>;
|
|
53
54
|
/**
|
|
54
55
|
* The <i>getOrMany</i> method returns the value for the keys that are found otherwise defaultValue will be returned.
|
|
55
56
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
56
57
|
*/
|
|
57
|
-
getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>):
|
|
58
|
+
getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>): LazyPromise<Record<TKeys, TType>>;
|
|
58
59
|
/**
|
|
59
60
|
* The <i>getOrFail</i> method returns the value when <i>key</i> is found otherwise an error will be thrown.
|
|
60
61
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
61
62
|
* @throws {KeyNotFoundStorageError} {@link KeyNotFoundStorageError}
|
|
62
63
|
*/
|
|
63
|
-
getOrFail(key: string):
|
|
64
|
+
getOrFail(key: string): LazyPromise<TType>;
|
|
64
65
|
/**
|
|
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.
|
|
66
67
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
67
68
|
*/
|
|
68
|
-
add(key: string, value:
|
|
69
|
+
add(key: string, value: TType): LazyPromise<boolean>;
|
|
69
70
|
/**
|
|
70
|
-
* The <i>addMany</i> method adds
|
|
71
|
+
* The <i>addMany</i> method adds new keys. Returns true for the keys that where added otherwise false will be returned.
|
|
71
72
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
72
73
|
*/
|
|
73
|
-
addMany<TKeys extends string>(values: Record<TKeys,
|
|
74
|
+
addMany<TKeys extends string>(values: Record<TKeys, TType>): LazyPromise<Record<TKeys, boolean>>;
|
|
74
75
|
/**
|
|
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.
|
|
76
77
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
77
78
|
*/
|
|
78
|
-
update(key: string, value: TType):
|
|
79
|
+
update(key: string, value: TType): LazyPromise<boolean>;
|
|
79
80
|
/**
|
|
80
|
-
* The <i>updateMany</i> method updates the given keys. Returns true for the keys that
|
|
81
|
+
* The <i>updateMany</i> method updates the given keys. Returns true for the keys that where updated otherwise false will be returned.
|
|
81
82
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
82
83
|
*/
|
|
83
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>):
|
|
84
|
+
updateMany<TKeys extends string>(values: Record<TKeys, TType>): LazyPromise<Record<TKeys, boolean>>;
|
|
84
85
|
/**
|
|
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.
|
|
86
87
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
87
88
|
*/
|
|
88
|
-
put(key: string, value:
|
|
89
|
+
put(key: string, value: TType): LazyPromise<boolean>;
|
|
89
90
|
/**
|
|
90
|
-
* The <i>putMany</i> method replaces the keys that
|
|
91
|
+
* The <i>putMany</i> method replaces the keys that exists. Adds keys that do not exists. Return true for all the keys that where updated otherwise false is returned.
|
|
91
92
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
92
93
|
*/
|
|
93
|
-
putMany<TKeys extends string>(values: Record<TKeys,
|
|
94
|
+
putMany<TKeys extends string>(values: Record<TKeys, TType>): LazyPromise<Record<TKeys, boolean>>;
|
|
94
95
|
/**
|
|
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.
|
|
96
97
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
97
98
|
*/
|
|
98
|
-
remove(key: string):
|
|
99
|
+
remove(key: string): LazyPromise<boolean>;
|
|
99
100
|
/**
|
|
100
|
-
* The <i>
|
|
101
|
+
* The <i>removeMany</i> method removes keys. Returns true for the keys that are removed otherwise false is returned.
|
|
101
102
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
102
103
|
*/
|
|
103
|
-
removeMany<TKeys extends string>(keys: TKeys[]):
|
|
104
|
+
removeMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
104
105
|
/**
|
|
105
106
|
* The <i>getAndRemove</i> method removes the given <i>key</i> and returns it when found otherwise null will be returned.
|
|
106
107
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
107
108
|
*/
|
|
108
|
-
getAndRemove(key: string):
|
|
109
|
+
getAndRemove(key: string): LazyPromise<TType | null>;
|
|
109
110
|
/**
|
|
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.
|
|
111
112
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
112
113
|
*/
|
|
113
|
-
getOrAdd(key: string, valueToAdd: AsyncLazyable<
|
|
114
|
+
getOrAdd(key: string, valueToAdd: AsyncLazyable<GetOrAddValue<TType>>): LazyPromise<TType>;
|
|
114
115
|
/**
|
|
115
116
|
* The <i>increment</i> method will increment the given <i>key</i> if found otherwise nonthing will occur.
|
|
116
|
-
* Returns true if key
|
|
117
|
+
* Returns true if key is incremented otherwise false will be returned.
|
|
117
118
|
* An error will thrown if the key is not a number.
|
|
118
119
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
119
120
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
120
121
|
*/
|
|
121
|
-
increment(key: string, value?: Extract<TType, number>):
|
|
122
|
+
increment(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
122
123
|
/**
|
|
123
124
|
* The <i>decrement</i> method will decrement the given <i>key</i> if found otherwise nonthing will occur.
|
|
124
125
|
* Returns true if key exists otherwise false will be returned.
|
|
@@ -127,27 +128,27 @@ export type IStorage<TType = unknown> = IStorageListenable & {
|
|
|
127
128
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
128
129
|
* An error will thrown if the key is not a number.
|
|
129
130
|
*/
|
|
130
|
-
decrement(key: string, value?: Extract<TType, number>):
|
|
131
|
+
decrement(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
131
132
|
/**
|
|
132
133
|
* The <i>clear</i> method removes all the keys in the storage.
|
|
133
134
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
134
135
|
*/
|
|
135
|
-
clear():
|
|
136
|
+
clear(): LazyPromise<void>;
|
|
136
137
|
/**
|
|
137
|
-
* The <i>getNamespace</i> method
|
|
138
|
+
* The <i>getNamespace</i> method returns the complete namespace.
|
|
138
139
|
* @example
|
|
139
140
|
* ```ts
|
|
140
|
-
*
|
|
141
|
-
* rootNamespace: "@root/"
|
|
142
|
-
* });
|
|
141
|
+
* import type { IStorage } from "@daiso-tech/core";
|
|
143
142
|
*
|
|
144
|
-
*
|
|
143
|
+
* async function main(storage: IStorage) {
|
|
144
|
+
* // Will be "@root"
|
|
145
145
|
* console.log(storage.getNamespace())
|
|
146
146
|
*
|
|
147
|
-
* const storageA = storage.withNamespace("a
|
|
147
|
+
* const storageA = storage.withNamespace("a");
|
|
148
148
|
*
|
|
149
|
-
* // Will be "@root/a
|
|
149
|
+
* // Will be "@root/a"
|
|
150
150
|
* console.log(storageA.getNamespace())
|
|
151
|
+
* }
|
|
151
152
|
* ```
|
|
152
153
|
*/
|
|
153
154
|
getNamespace(): string;
|
|
@@ -163,11 +164,9 @@ export type INamespacedStorage<TType = unknown> = IStorage<TType> & {
|
|
|
163
164
|
* This useful for multitennat applications.
|
|
164
165
|
* @example
|
|
165
166
|
* ```ts
|
|
166
|
-
* import {
|
|
167
|
-
*
|
|
168
|
-
* (async () => {
|
|
169
|
-
* const storage = new Storage(new MemoryStorageAdapter());
|
|
167
|
+
* import { type IStorage } from "@daiso-tech/core";
|
|
170
168
|
*
|
|
169
|
+
* async function main(storage: IStorage): Promise<void> {
|
|
171
170
|
* const storageA = storage.withNamespace("a");
|
|
172
171
|
* await storageA.add("a", 1);
|
|
173
172
|
*
|
|
@@ -176,9 +175,8 @@ export type INamespacedStorage<TType = unknown> = IStorage<TType> & {
|
|
|
176
175
|
*
|
|
177
176
|
* // Will print { a: 1, b: null }
|
|
178
177
|
* console.log(await storageA.getMany(["a", "b"]));
|
|
179
|
-
* }
|
|
180
|
-
*
|
|
178
|
+
* }
|
|
181
179
|
* ```
|
|
182
180
|
*/
|
|
183
|
-
withNamespace(namespace: string): IStorage<TType>;
|
|
181
|
+
withNamespace(namespace: OneOrMore<string>): IStorage<TType>;
|
|
184
182
|
};
|
|
@@ -7,11 +7,11 @@ import type { IStorageAdapter } from "../../storage/contracts/storage-adapter.co
|
|
|
7
7
|
* @group Events
|
|
8
8
|
*/
|
|
9
9
|
export declare const STORAGE_EVENTS: {
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
10
|
+
readonly KEY_FOUND: "key_found";
|
|
11
|
+
readonly KEY_NOT_FOUND: "key_not_found";
|
|
12
|
+
readonly KEY_ADDED: "key_added";
|
|
13
|
+
readonly KEY_UPDATED: "key_updated";
|
|
14
|
+
readonly KEY_REMOVED: "key_removed";
|
|
15
15
|
readonly KEYS_CLEARED: "keys_cleared";
|
|
16
16
|
readonly KEY_INCREMENTED: "key_incremented";
|
|
17
17
|
readonly KEY_DECREMENTED: "key_decremented";
|
|
@@ -30,30 +30,33 @@ export type StorageEvent = {
|
|
|
30
30
|
/**
|
|
31
31
|
* @group Events
|
|
32
32
|
*/
|
|
33
|
-
export type
|
|
34
|
-
type: (typeof STORAGE_EVENTS)["
|
|
35
|
-
|
|
33
|
+
export type KeyFoundStorageEvent<TType = unknown> = StorageEvent & {
|
|
34
|
+
type: (typeof STORAGE_EVENTS)["KEY_FOUND"];
|
|
35
|
+
key: string;
|
|
36
|
+
value: TType;
|
|
36
37
|
};
|
|
37
38
|
/**
|
|
38
39
|
* @group Events
|
|
39
40
|
*/
|
|
40
|
-
export type
|
|
41
|
-
type: (typeof STORAGE_EVENTS)["
|
|
42
|
-
|
|
41
|
+
export type KeyNotFoundStorageEvent = StorageEvent & {
|
|
42
|
+
type: (typeof STORAGE_EVENTS)["KEY_NOT_FOUND"];
|
|
43
|
+
key: string;
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
45
46
|
* @group Events
|
|
46
47
|
*/
|
|
47
|
-
export type
|
|
48
|
-
type: (typeof STORAGE_EVENTS)["
|
|
49
|
-
|
|
48
|
+
export type KeyAddedStorageEvent<TType = unknown> = StorageEvent & {
|
|
49
|
+
type: (typeof STORAGE_EVENTS)["KEY_ADDED"];
|
|
50
|
+
key: string;
|
|
51
|
+
value: TType;
|
|
50
52
|
};
|
|
51
53
|
/**
|
|
52
54
|
* @group Events
|
|
53
55
|
*/
|
|
54
|
-
export type
|
|
55
|
-
type: (typeof STORAGE_EVENTS)["
|
|
56
|
-
|
|
56
|
+
export type KeyUpdatedStorageEvent<TType = unknown> = StorageEvent & {
|
|
57
|
+
type: (typeof STORAGE_EVENTS)["KEY_UPDATED"];
|
|
58
|
+
key: string;
|
|
59
|
+
value: TType;
|
|
57
60
|
};
|
|
58
61
|
/**
|
|
59
62
|
* @group Events
|
|
@@ -74,9 +77,9 @@ export type KeyDecrementedStorageEvent = StorageEvent & {
|
|
|
74
77
|
/**
|
|
75
78
|
* @group Events
|
|
76
79
|
*/
|
|
77
|
-
export type
|
|
78
|
-
type: (typeof STORAGE_EVENTS)["
|
|
79
|
-
|
|
80
|
+
export type KeyRemovedStorageEvent = StorageEvent & {
|
|
81
|
+
type: (typeof STORAGE_EVENTS)["KEY_REMOVED"];
|
|
82
|
+
key: string;
|
|
80
83
|
};
|
|
81
84
|
/**
|
|
82
85
|
* This event will be triggered when storage is cleared.
|
|
@@ -88,4 +91,4 @@ export type KeysClearedStorageEvent = StorageEvent & {
|
|
|
88
91
|
/**
|
|
89
92
|
* @group Events
|
|
90
93
|
*/
|
|
91
|
-
export type AllStorageEvents<TType
|
|
94
|
+
export type AllStorageEvents<TType> = KeyFoundStorageEvent<TType> | KeyNotFoundStorageEvent | KeyAddedStorageEvent<TType> | KeyUpdatedStorageEvent<TType> | KeyRemovedStorageEvent | KeysClearedStorageEvent | KeyIncrementedStorageEvent | KeyDecrementedStorageEvent;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export * from "../../storage/implementations/
|
|
1
|
+
export * from "../../storage/implementations/derivables/_module";
|
|
2
|
+
export * from "../../storage/implementations/adapters/_module";
|
|
2
3
|
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";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from "../../../storage/implementations/adapters/memory-storage-adapter/_module";
|
|
2
|
+
export * from "../../../storage/implementations/adapters/mongodb-storage-adapter/_module";
|
|
3
|
+
export * from "../../../storage/implementations/adapters/redis-storage-adapter/_module";
|
|
4
|
+
export * from "../../../storage/implementations/adapters/sqlite/_module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../storage/implementations/adapters/memory-storage-adapter/memory-storage-adapter";
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
get(key: string): Promise<TType | null>;
|
|
12
|
+
add(key: string, value: TType): Promise<boolean>;
|
|
13
|
+
update(key: string, value: TType): Promise<boolean>;
|
|
14
|
+
put(key: string, value: TType): Promise<boolean>;
|
|
15
|
+
remove(key: string): Promise<boolean>;
|
|
16
|
+
increment(key: string, value: number): Promise<boolean>;
|
|
17
|
+
clear(prefix: string): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MongodbStorageAdapter, type MongodbStorageAdapterSettings, } from "../../../../storage/implementations/adapters/mongodb-storage-adapter/mongodb-storage-adapter";
|