@daiso-tech/core 0.48.5 → 0.49.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/backoff-policies/_shared.d.ts +0 -3
- package/dist/backoff-policies/_shared.js.map +1 -1
- package/dist/backoff-policies/constant-backoff/constant-backoff.d.ts +0 -1
- package/dist/backoff-policies/constant-backoff/constant-backoff.js.map +1 -1
- package/dist/backoff-policies/exponential-backoff/exponential-backoff.d.ts +0 -1
- package/dist/backoff-policies/exponential-backoff/exponential-backoff.js.map +1 -1
- package/dist/backoff-policies/linear-backoff/linear-backoff.d.ts +0 -1
- package/dist/backoff-policies/linear-backoff/linear-backoff.js.map +1 -1
- package/dist/backoff-policies/polynomial-backoff/polynomial-backoff.d.ts +0 -1
- package/dist/backoff-policies/polynomial-backoff/polynomial-backoff.js.map +1 -1
- package/dist/cache/contracts/cache-adapter.contract.d.ts +6 -6
- package/dist/cache/contracts/cache.contract.d.ts +16 -9
- package/dist/cache/contracts/cache.errors.d.ts +1 -4
- package/dist/cache/contracts/cache.errors.js +1 -3
- package/dist/cache/contracts/cache.errors.js.map +1 -1
- package/dist/cache/contracts/cache.events.d.ts +11 -3
- package/dist/cache/contracts/cache.events.js +1 -1
- package/dist/cache/contracts/cache.events.js.map +1 -1
- package/dist/cache/contracts/database-cache-adapter.contract.d.ts +0 -1
- package/dist/cache/contracts/types.d.ts +0 -2
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js +1 -2
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +1 -1
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +17 -15
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +0 -2
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +1 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +0 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +2 -5
- package/dist/cache/implementations/derivables/cache/cache.js +10 -2
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.js +1 -1
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +0 -2
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +0 -1
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +6 -2
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +0 -1
- package/dist/cache/implementations/test-utilities/cache.test-suite.js +1772 -1735
- package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +1 -1
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js.map +1 -1
- package/dist/circuit-breaker/contracts/circuit-breaker-provider.contract.d.ts +0 -5
- package/dist/circuit-breaker/contracts/circuit-breaker-provider.contract.js +0 -1
- package/dist/circuit-breaker/contracts/circuit-breaker-provider.contract.js.map +1 -1
- package/dist/circuit-breaker/contracts/circuit-breaker-state.contract.d.ts +0 -2
- package/dist/circuit-breaker/contracts/circuit-breaker-state.contract.js +0 -1
- package/dist/circuit-breaker/contracts/circuit-breaker-state.contract.js.map +1 -1
- package/dist/circuit-breaker/contracts/circuit-breaker.contract.d.ts +3 -4
- package/dist/circuit-breaker/contracts/circuit-breaker.contract.js +2 -3
- package/dist/circuit-breaker/contracts/circuit-breaker.contract.js.map +1 -1
- package/dist/circuit-breaker/contracts/circuit-breaker.errors.d.ts +0 -3
- package/dist/circuit-breaker/contracts/circuit-breaker.errors.js +1 -3
- package/dist/circuit-breaker/contracts/circuit-breaker.errors.js.map +1 -1
- package/dist/circuit-breaker/contracts/circuit-breaker.events.d.ts +0 -2
- package/dist/circuit-breaker/contracts/circuit-breaker.events.js +0 -1
- package/dist/circuit-breaker/contracts/circuit-breaker.events.js.map +1 -1
- package/dist/circuit-breaker/implementations/adapters/kysely-circuit-breaker-storage-adapter/kysely-circuit-breaker-storage-adapter.d.ts +2 -2
- package/dist/circuit-breaker/implementations/adapters/kysely-circuit-breaker-storage-adapter/kysely-circuit-breaker-storage-adapter.js +2 -2
- package/dist/circuit-breaker/implementations/adapters/kysely-circuit-breaker-storage-adapter/kysely-circuit-breaker-storage-adapter.js.map +1 -1
- package/dist/circuit-breaker/implementations/adapters/memory-circuit-breaker-storage-adapter/memory-circuit-breaker-storage-adapter.d.ts +2 -3
- package/dist/circuit-breaker/implementations/adapters/memory-circuit-breaker-storage-adapter/memory-circuit-breaker-storage-adapter.js +8 -10
- package/dist/circuit-breaker/implementations/adapters/memory-circuit-breaker-storage-adapter/memory-circuit-breaker-storage-adapter.js.map +1 -1
- package/dist/circuit-breaker/implementations/adapters/mongodb-circuit-breaker-storage-adapter/mongodb-circuit-breaker-storage-adapter.d.ts +2 -2
- package/dist/circuit-breaker/implementations/adapters/mongodb-circuit-breaker-storage-adapter/mongodb-circuit-breaker-storage-adapter.js +2 -2
- package/dist/circuit-breaker/implementations/adapters/mongodb-circuit-breaker-storage-adapter/mongodb-circuit-breaker-storage-adapter.js.map +1 -1
- package/dist/circuit-breaker/implementations/adapters/no-op-circuit-breaker-adapter/no-op-circuit-breaker-adapter.d.ts +2 -0
- package/dist/circuit-breaker/implementations/adapters/no-op-circuit-breaker-adapter/no-op-circuit-breaker-adapter.js +2 -0
- package/dist/circuit-breaker/implementations/adapters/no-op-circuit-breaker-adapter/no-op-circuit-breaker-adapter.js.map +1 -1
- package/dist/circuit-breaker/implementations/adapters/no-op-circuit-breaker-storage-adapter/no-op-circuit-breaker-storage-adapter.d.ts +2 -0
- package/dist/circuit-breaker/implementations/adapters/no-op-circuit-breaker-storage-adapter/no-op-circuit-breaker-storage-adapter.js +2 -0
- package/dist/circuit-breaker/implementations/adapters/no-op-circuit-breaker-storage-adapter/no-op-circuit-breaker-storage-adapter.js.map +1 -1
- package/dist/circuit-breaker/implementations/derivables/circuit-breaker-provider/circuit-breaker-provider.d.ts +2 -4
- package/dist/circuit-breaker/implementations/derivables/circuit-breaker-provider/circuit-breaker-provider.js.map +1 -1
- package/dist/circuit-breaker/implementations/derivables/circuit-breaker-provider/circuit-breaker.d.ts +1 -1
- package/dist/circuit-breaker/implementations/derivables/circuit-breaker-provider/circuit-breaker.js +2 -2
- package/dist/circuit-breaker/implementations/derivables/circuit-breaker-provider/circuit-breaker.js.map +1 -1
- package/dist/circuit-breaker/implementations/derivables/circuit-breaker-provider-factory/circuit-breaker-provider-factory.d.ts +0 -2
- package/dist/circuit-breaker/implementations/derivables/circuit-breaker-provider-factory/circuit-breaker-provider-factory.js.map +1 -1
- package/dist/circuit-breaker/implementations/derivables/circuit-breaker-provider-factory/database-circuit-breaker-provider-factory.d.ts +0 -2
- package/dist/circuit-breaker/implementations/derivables/circuit-breaker-provider-factory/database-circuit-breaker-provider-factory.js.map +1 -1
- package/dist/circuit-breaker/implementations/test-utilities/circuit-breaker-storage-adapter.test-suite.d.ts +0 -1
- package/dist/circuit-breaker/implementations/test-utilities/circuit-breaker-storage-adapter.test-suite.js +1 -1
- package/dist/circuit-breaker/implementations/test-utilities/circuit-breaker-storage-adapter.test-suite.js.map +1 -1
- package/dist/circuit-breaker/implementations/test-utilities/consecutive-breaker.test-suite.d.ts +0 -1
- package/dist/circuit-breaker/implementations/test-utilities/consecutive-breaker.test-suite.js +1 -1
- package/dist/circuit-breaker/implementations/test-utilities/consecutive-breaker.test-suite.js.map +1 -1
- package/dist/circuit-breaker/implementations/test-utilities/count-breaker.test-suite.d.ts +0 -1
- package/dist/circuit-breaker/implementations/test-utilities/count-breaker.test-suite.js +1 -1
- package/dist/circuit-breaker/implementations/test-utilities/count-breaker.test-suite.js.map +1 -1
- package/dist/circuit-breaker/implementations/test-utilities/sampling-breaker.test-suite.d.ts +0 -1
- package/dist/circuit-breaker/implementations/test-utilities/sampling-breaker.test-suite.js +1 -1
- package/dist/circuit-breaker/implementations/test-utilities/sampling-breaker.test-suite.js.map +1 -1
- package/dist/codec/contracts/_module-exports.d.ts +3 -0
- package/dist/codec/contracts/_module-exports.js +2 -0
- package/dist/codec/contracts/_module-exports.js.map +1 -0
- package/dist/codec/contracts/_module.d.ts +4 -0
- package/dist/codec/contracts/_module.js +2 -0
- package/dist/codec/contracts/_module.js.map +1 -0
- package/dist/codec/contracts/codec.contract.d.ts +12 -0
- package/dist/codec/contracts/codec.contract.js +6 -0
- package/dist/codec/contracts/codec.contract.js.map +1 -0
- package/dist/codec/contracts/codec.errors.d.ts +51 -0
- package/dist/codec/contracts/codec.errors.js +64 -0
- package/dist/codec/contracts/codec.errors.js.map +1 -0
- package/dist/codec/contracts/decoder.contract.d.ts +12 -0
- package/dist/codec/contracts/decoder.contract.js +6 -0
- package/dist/codec/contracts/decoder.contract.js.map +1 -0
- package/dist/codec/contracts/encoder.contract.d.ts +12 -0
- package/dist/codec/contracts/encoder.contract.js +6 -0
- package/dist/codec/contracts/encoder.contract.js.map +1 -0
- package/dist/codec/implementations/base-64-codec/_module-exports.d.ts +1 -0
- package/dist/codec/implementations/base-64-codec/_module-exports.js +2 -0
- package/dist/codec/implementations/base-64-codec/_module-exports.js.map +1 -0
- package/dist/codec/implementations/base-64-codec/_module.d.ts +1 -0
- package/dist/codec/implementations/base-64-codec/_module.js +2 -0
- package/dist/codec/implementations/base-64-codec/_module.js.map +1 -0
- package/dist/codec/implementations/base-64-codec/base-64-codec.d.ts +12 -0
- package/dist/codec/implementations/base-64-codec/base-64-codec.js +27 -0
- package/dist/codec/implementations/base-64-codec/base-64-codec.js.map +1 -0
- package/dist/collection/contracts/_shared/compartor.type.d.ts +0 -1
- package/dist/collection/contracts/_shared/cross-join-result.type.d.ts +0 -1
- package/dist/collection/contracts/_shared/ensure-map.type.d.ts +0 -1
- package/dist/collection/contracts/_shared/ensure-record.type.d.ts +0 -1
- package/dist/collection/contracts/_shared/foreach.type.d.ts +0 -2
- package/dist/collection/contracts/_shared/map.type.d.ts +0 -2
- package/dist/collection/contracts/_shared/modifier.type.d.ts +0 -2
- package/dist/collection/contracts/_shared/predicate.type.d.ts +0 -7
- package/dist/collection/contracts/_shared/reduce.type.d.ts +0 -2
- package/dist/collection/contracts/_shared/tap.type.d.ts +0 -2
- package/dist/collection/contracts/_shared/transform.type.d.ts +0 -2
- package/dist/collection/contracts/async-collection.contract.d.ts +0 -1
- package/dist/collection/contracts/collection.contract.d.ts +0 -2
- package/dist/collection/contracts/collection.errors.d.ts +0 -1
- package/dist/collection/contracts/collection.errors.js +0 -1
- package/dist/collection/contracts/collection.errors.js.map +1 -1
- package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +0 -4
- package/dist/event-bus/contracts/event-bus.contract.d.ts +0 -4
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +1 -1
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +7 -9
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +1 -1
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +0 -1
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +2 -5
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +0 -2
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.d.ts +0 -1
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +0 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/file-size/contracts/_module-exports.d.ts +1 -0
- package/dist/file-size/contracts/_module-exports.js +2 -0
- package/dist/file-size/contracts/_module-exports.js.map +1 -0
- package/dist/file-size/contracts/_module.d.ts +1 -0
- package/dist/file-size/contracts/_module.js +2 -0
- package/dist/file-size/contracts/_module.js.map +1 -0
- package/dist/file-size/contracts/file-size.contract.d.ts +17 -0
- package/dist/file-size/contracts/file-size.contract.js +9 -0
- package/dist/file-size/contracts/file-size.contract.js.map +1 -0
- package/dist/file-size/implementations/_module-exports.d.ts +1 -0
- package/dist/file-size/implementations/_module-exports.js +2 -0
- package/dist/file-size/implementations/_module-exports.js.map +1 -0
- package/dist/file-size/implementations/_module.d.ts +1 -0
- package/dist/file-size/implementations/_module.js +2 -0
- package/dist/file-size/implementations/_module.js.map +1 -0
- package/dist/file-size/implementations/file-size.d.ts +50 -0
- package/dist/file-size/implementations/file-size.js +89 -0
- package/dist/file-size/implementations/file-size.js.map +1 -0
- package/dist/file-storage/contracts/_module-exports.d.ts +7 -0
- package/dist/file-storage/contracts/_module-exports.js +4 -0
- package/dist/file-storage/contracts/_module-exports.js.map +1 -0
- package/dist/file-storage/contracts/_module.d.ts +7 -0
- package/dist/file-storage/contracts/_module.js +4 -0
- package/dist/file-storage/contracts/_module.js.map +1 -0
- package/dist/file-storage/contracts/file-storage-adapter.contract.d.ts +180 -0
- package/dist/file-storage/contracts/file-storage-adapter.contract.js +13 -0
- package/dist/file-storage/contracts/file-storage-adapter.contract.js.map +1 -0
- package/dist/file-storage/contracts/file-storage-factory.contract.d.ts +19 -0
- package/dist/file-storage/contracts/file-storage-factory.contract.js +10 -0
- package/dist/file-storage/contracts/file-storage-factory.contract.js.map +1 -0
- package/dist/file-storage/contracts/file-storage.contract.d.ts +37 -0
- package/dist/file-storage/contracts/file-storage.contract.js +8 -0
- package/dist/file-storage/contracts/file-storage.contract.js.map +1 -0
- package/dist/file-storage/contracts/file.contract.d.ts +224 -0
- package/dist/file-storage/contracts/file.contract.js +10 -0
- package/dist/file-storage/contracts/file.contract.js.map +1 -0
- package/dist/file-storage/contracts/file.errors.d.ts +68 -0
- package/dist/file-storage/contracts/file.errors.js +86 -0
- package/dist/file-storage/contracts/file.errors.js.map +1 -0
- package/dist/file-storage/contracts/file.events.d.ts +135 -0
- package/dist/file-storage/contracts/file.events.js +23 -0
- package/dist/file-storage/contracts/file.events.js.map +1 -0
- package/dist/file-storage/contracts/types.d.ts +9 -0
- package/dist/file-storage/contracts/types.js +5 -0
- package/dist/file-storage/contracts/types.js.map +1 -0
- package/dist/file-storage/implementations/adapters/fs-file-storage-adapter/_module-exports.d.ts +1 -0
- package/dist/file-storage/implementations/adapters/fs-file-storage-adapter/_module-exports.js +2 -0
- package/dist/file-storage/implementations/adapters/fs-file-storage-adapter/_module-exports.js.map +1 -0
- package/dist/file-storage/implementations/adapters/fs-file-storage-adapter/_module.d.ts +1 -0
- package/dist/file-storage/implementations/adapters/fs-file-storage-adapter/_module.js +2 -0
- package/dist/file-storage/implementations/adapters/fs-file-storage-adapter/_module.js.map +1 -0
- package/dist/file-storage/implementations/adapters/fs-file-storage-adapter/fs-file-storage-adapter.d.ts +82 -0
- package/dist/file-storage/implementations/adapters/fs-file-storage-adapter/fs-file-storage-adapter.js +302 -0
- package/dist/file-storage/implementations/adapters/fs-file-storage-adapter/fs-file-storage-adapter.js.map +1 -0
- package/dist/file-storage/implementations/adapters/memory-file-storage-adapter/_module-exports.d.ts +1 -0
- package/dist/file-storage/implementations/adapters/memory-file-storage-adapter/_module-exports.js +2 -0
- package/dist/file-storage/implementations/adapters/memory-file-storage-adapter/_module-exports.js.map +1 -0
- package/dist/file-storage/implementations/adapters/memory-file-storage-adapter/_module.d.ts +1 -0
- package/dist/file-storage/implementations/adapters/memory-file-storage-adapter/_module.js +2 -0
- package/dist/file-storage/implementations/adapters/memory-file-storage-adapter/_module.js.map +1 -0
- package/dist/file-storage/implementations/adapters/memory-file-storage-adapter/memory-file-storage-adapter.d.ts +58 -0
- package/dist/file-storage/implementations/adapters/memory-file-storage-adapter/memory-file-storage-adapter.js +254 -0
- package/dist/file-storage/implementations/adapters/memory-file-storage-adapter/memory-file-storage-adapter.js.map +1 -0
- package/dist/file-storage/implementations/adapters/no-op-file-storage-adapter/_module-exports.d.ts +1 -0
- package/dist/file-storage/implementations/adapters/no-op-file-storage-adapter/_module-exports.js +2 -0
- package/dist/file-storage/implementations/adapters/no-op-file-storage-adapter/_module-exports.js.map +1 -0
- package/dist/file-storage/implementations/adapters/no-op-file-storage-adapter/_module.d.ts +1 -0
- package/dist/file-storage/implementations/adapters/no-op-file-storage-adapter/_module.js +2 -0
- package/dist/file-storage/implementations/adapters/no-op-file-storage-adapter/_module.js.map +1 -0
- package/dist/file-storage/implementations/adapters/no-op-file-storage-adapter/no-op-file-storage-adapter.d.ts +31 -0
- package/dist/file-storage/implementations/adapters/no-op-file-storage-adapter/no-op-file-storage-adapter.js +70 -0
- package/dist/file-storage/implementations/adapters/no-op-file-storage-adapter/no-op-file-storage-adapter.js.map +1 -0
- package/dist/file-storage/implementations/adapters/s3-file-storage-adapter/_module-exports.d.ts +1 -0
- package/dist/file-storage/implementations/adapters/s3-file-storage-adapter/_module-exports.js +2 -0
- package/dist/file-storage/implementations/adapters/s3-file-storage-adapter/_module-exports.js.map +1 -0
- package/dist/file-storage/implementations/adapters/s3-file-storage-adapter/_module.d.ts +1 -0
- package/dist/file-storage/implementations/adapters/s3-file-storage-adapter/_module.js +2 -0
- package/dist/file-storage/implementations/adapters/s3-file-storage-adapter/_module.js.map +1 -0
- package/dist/file-storage/implementations/adapters/s3-file-storage-adapter/s3-file-storage-adapter.d.ts +137 -0
- package/dist/file-storage/implementations/adapters/s3-file-storage-adapter/s3-file-storage-adapter.js +512 -0
- package/dist/file-storage/implementations/adapters/s3-file-storage-adapter/s3-file-storage-adapter.js.map +1 -0
- package/dist/file-storage/implementations/derivables/_module-exports.d.ts +2 -0
- package/dist/file-storage/implementations/derivables/_module-exports.js +3 -0
- package/dist/file-storage/implementations/derivables/_module-exports.js.map +1 -0
- package/dist/file-storage/implementations/derivables/_module.d.ts +2 -0
- package/dist/file-storage/implementations/derivables/_module.js +3 -0
- package/dist/file-storage/implementations/derivables/_module.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/_module.d.ts +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/_module.js +2 -0
- package/dist/file-storage/implementations/derivables/file-storage/_module.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/file-serde-transformer.d.ts +48 -0
- package/dist/file-storage/implementations/derivables/file-storage/file-serde-transformer.js +87 -0
- package/dist/file-storage/implementations/derivables/file-storage/file-serde-transformer.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/file-storage.d.ts +163 -0
- package/dist/file-storage/implementations/derivables/file-storage/file-storage.js +185 -0
- package/dist/file-storage/implementations/derivables/file-storage/file-storage.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/file.d.ts +114 -0
- package/dist/file-storage/implementations/derivables/file-storage/file.js +722 -0
- package/dist/file-storage/implementations/derivables/file-storage/file.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/is-signed-file-storage-adapter.d.ts +8 -0
- package/dist/file-storage/implementations/derivables/file-storage/is-signed-file-storage-adapter.js +62 -0
- package/dist/file-storage/implementations/derivables/file-storage/is-signed-file-storage-adapter.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/merged-file-url-adapter.d.ts +15 -0
- package/dist/file-storage/implementations/derivables/file-storage/merged-file-url-adapter.js +34 -0
- package/dist/file-storage/implementations/derivables/file-storage/merged-file-url-adapter.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/no-op-file-url-adapter.d.ts +12 -0
- package/dist/file-storage/implementations/derivables/file-storage/no-op-file-url-adapter.js +19 -0
- package/dist/file-storage/implementations/derivables/file-storage/no-op-file-url-adapter.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/resolve-file-content.d.ts +8 -0
- package/dist/file-storage/implementations/derivables/file-storage/resolve-file-content.js +18 -0
- package/dist/file-storage/implementations/derivables/file-storage/resolve-file-content.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/resolve-file-storage-adapter.d.ts +8 -0
- package/dist/file-storage/implementations/derivables/file-storage/resolve-file-storage-adapter.js +16 -0
- package/dist/file-storage/implementations/derivables/file-storage/resolve-file-storage-adapter.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/resolve-file-stream.d.ts +12 -0
- package/dist/file-storage/implementations/derivables/file-storage/resolve-file-stream.js +20 -0
- package/dist/file-storage/implementations/derivables/file-storage/resolve-file-stream.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage/signed-file-storage-adapter.d.ts +31 -0
- package/dist/file-storage/implementations/derivables/file-storage/signed-file-storage-adapter.js +74 -0
- package/dist/file-storage/implementations/derivables/file-storage/signed-file-storage-adapter.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage-factory/_module.d.ts +1 -0
- package/dist/file-storage/implementations/derivables/file-storage-factory/_module.js +2 -0
- package/dist/file-storage/implementations/derivables/file-storage-factory/_module.js.map +1 -0
- package/dist/file-storage/implementations/derivables/file-storage-factory/file-storage-factory.d.ts +59 -0
- package/dist/file-storage/implementations/derivables/file-storage-factory/file-storage-factory.js +113 -0
- package/dist/file-storage/implementations/derivables/file-storage-factory/file-storage-factory.js.map +1 -0
- package/dist/file-storage/implementations/test-utilities/_module-exports.d.ts +2 -0
- package/dist/file-storage/implementations/test-utilities/_module-exports.js +3 -0
- package/dist/file-storage/implementations/test-utilities/_module-exports.js.map +1 -0
- package/dist/file-storage/implementations/test-utilities/_module.d.ts +2 -0
- package/dist/file-storage/implementations/test-utilities/_module.js +3 -0
- package/dist/file-storage/implementations/test-utilities/_module.js.map +1 -0
- package/dist/file-storage/implementations/test-utilities/file-storage-adapter.test-suite.d.ts +28 -0
- package/dist/file-storage/implementations/test-utilities/file-storage-adapter.test-suite.js +1637 -0
- package/dist/file-storage/implementations/test-utilities/file-storage-adapter.test-suite.js.map +1 -0
- package/dist/file-storage/implementations/test-utilities/file-storage.test-suite.d.ts +36 -0
- package/dist/file-storage/implementations/test-utilities/file-storage.test-suite.js +3109 -0
- package/dist/file-storage/implementations/test-utilities/file-storage.test-suite.js.map +1 -0
- package/dist/hooks/async-hooks.d.ts +0 -8
- package/dist/hooks/async-hooks.js.map +1 -1
- package/dist/hooks/hooks.d.ts +0 -6
- package/dist/hooks/hooks.js.map +1 -1
- package/dist/hooks/types.d.ts +0 -1
- package/dist/lock/contracts/database-lock-adapter.contract.d.ts +0 -3
- package/dist/lock/contracts/lock-provider.contract.d.ts +0 -2
- package/dist/lock/contracts/lock-state.contract.d.ts +0 -6
- package/dist/lock/contracts/lock-state.contract.js +0 -1
- package/dist/lock/contracts/lock-state.contract.js.map +1 -1
- package/dist/lock/contracts/lock.contract.d.ts +3 -6
- package/dist/lock/contracts/lock.contract.js +2 -1
- package/dist/lock/contracts/lock.contract.js.map +1 -1
- package/dist/lock/contracts/lock.errors.d.ts +0 -3
- package/dist/lock/contracts/lock.errors.js +0 -2
- package/dist/lock/contracts/lock.errors.js.map +1 -1
- package/dist/lock/contracts/lock.events.d.ts +0 -3
- package/dist/lock/contracts/lock.events.js +0 -1
- package/dist/lock/contracts/lock.events.js.map +1 -1
- package/dist/lock/contracts/types.d.ts +0 -1
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +0 -3
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +1 -2
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +19 -24
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +0 -2
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +1 -1
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +1 -1
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js +0 -1
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +2 -4
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +4 -4
- package/dist/lock/implementations/derivables/lock-provider/lock.js +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +0 -2
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +0 -1
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +1 -1
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +0 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +1 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +0 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/namespace/contracts/namespace.contract.d.ts +19 -2
- package/dist/namespace/contracts/namespace.contract.js +1 -1
- package/dist/namespace/contracts/namespace.contract.js.map +1 -1
- package/dist/namespace/implementations/namespace.js +3 -0
- package/dist/namespace/implementations/namespace.js.map +1 -1
- package/dist/namespace/implementations/no-op-namespace.d.ts +1 -1
- package/dist/namespace/implementations/no-op-namespace.js +4 -1
- package/dist/namespace/implementations/no-op-namespace.js.map +1 -1
- package/dist/rate-limiter/contracts/rate-limiter-adapter.contract.d.ts +0 -1
- package/dist/rate-limiter/contracts/rate-limiter-provider.contract.d.ts +0 -1
- package/dist/rate-limiter/contracts/rate-limiter-state.contract.d.ts +0 -6
- package/dist/rate-limiter/contracts/rate-limiter-state.contract.js +0 -1
- package/dist/rate-limiter/contracts/rate-limiter-state.contract.js.map +1 -1
- package/dist/rate-limiter/contracts/rate-limiter-storage-adapter.contract.d.ts +0 -1
- package/dist/rate-limiter/contracts/rate-limiter.contract.d.ts +3 -4
- package/dist/rate-limiter/contracts/rate-limiter.contract.js +2 -1
- package/dist/rate-limiter/contracts/rate-limiter.contract.js.map +1 -1
- package/dist/rate-limiter/contracts/rate-limiter.errors.d.ts +7 -3
- package/dist/rate-limiter/contracts/rate-limiter.errors.js +9 -2
- package/dist/rate-limiter/contracts/rate-limiter.errors.js.map +1 -1
- package/dist/rate-limiter/contracts/rate-limiter.events.d.ts +0 -2
- package/dist/rate-limiter/contracts/rate-limiter.events.js +0 -1
- package/dist/rate-limiter/contracts/rate-limiter.events.js.map +1 -1
- package/dist/rate-limiter/implementations/adapters/memory-rate-limiter-storage-adapter/memory-rate-limiter-storage-adapter.d.ts +2 -1
- package/dist/rate-limiter/implementations/adapters/memory-rate-limiter-storage-adapter/memory-rate-limiter-storage-adapter.js +13 -12
- package/dist/rate-limiter/implementations/adapters/memory-rate-limiter-storage-adapter/memory-rate-limiter-storage-adapter.js.map +1 -1
- package/dist/rate-limiter/implementations/adapters/mongodb-rate-limiter-storage-adapter/mongodb-rate-limiter-storage-adapter.d.ts +1 -1
- package/dist/rate-limiter/implementations/adapters/mongodb-rate-limiter-storage-adapter/mongodb-rate-limiter-storage-adapter.js +1 -1
- package/dist/rate-limiter/implementations/adapters/mongodb-rate-limiter-storage-adapter/mongodb-rate-limiter-storage-adapter.js.map +1 -1
- package/dist/rate-limiter/implementations/adapters/no-op-rate-limiter-adapter/no-op-rate-limiter-adapter.d.ts +2 -0
- package/dist/rate-limiter/implementations/adapters/no-op-rate-limiter-adapter/no-op-rate-limiter-adapter.js +2 -0
- package/dist/rate-limiter/implementations/adapters/no-op-rate-limiter-adapter/no-op-rate-limiter-adapter.js.map +1 -1
- package/dist/rate-limiter/implementations/adapters/no-op-rate-limiter-storage-adapter/no-op-rate-limiter-storage-adapter.d.ts +2 -0
- package/dist/rate-limiter/implementations/adapters/no-op-rate-limiter-storage-adapter/no-op-rate-limiter-storage-adapter.js +2 -0
- package/dist/rate-limiter/implementations/adapters/no-op-rate-limiter-storage-adapter/no-op-rate-limiter-storage-adapter.js.map +1 -1
- package/dist/rate-limiter/implementations/derivables/rate-limiter-provider/rate-limiter-provider.d.ts +2 -4
- package/dist/rate-limiter/implementations/derivables/rate-limiter-provider/rate-limiter-provider.js.map +1 -1
- package/dist/rate-limiter/implementations/derivables/rate-limiter-provider/rate-limiter.d.ts +1 -1
- package/dist/rate-limiter/implementations/derivables/rate-limiter-provider/rate-limiter.js +6 -6
- package/dist/rate-limiter/implementations/derivables/rate-limiter-provider/rate-limiter.js.map +1 -1
- package/dist/rate-limiter/implementations/derivables/rate-limiter-provider-factory/database-rate-limiter-provider-factory.d.ts +0 -2
- package/dist/rate-limiter/implementations/derivables/rate-limiter-provider-factory/database-rate-limiter-provider-factory.js.map +1 -1
- package/dist/rate-limiter/implementations/derivables/rate-limiter-provider-factory/rate-limiter-provider-factory.d.ts +0 -2
- package/dist/rate-limiter/implementations/derivables/rate-limiter-provider-factory/rate-limiter-provider-factory.js.map +1 -1
- package/dist/rate-limiter/implementations/test-utilities/fixed-window-limiter.test-suite.d.ts +0 -1
- package/dist/rate-limiter/implementations/test-utilities/fixed-window-limiter.test-suite.js +1 -1
- package/dist/rate-limiter/implementations/test-utilities/fixed-window-limiter.test-suite.js.map +1 -1
- package/dist/rate-limiter/implementations/test-utilities/rate-limiter-storage-adapter.test-suite.d.ts +0 -1
- package/dist/rate-limiter/implementations/test-utilities/rate-limiter-storage-adapter.test-suite.js +1 -1
- package/dist/rate-limiter/implementations/test-utilities/rate-limiter-storage-adapter.test-suite.js.map +1 -1
- package/dist/rate-limiter/implementations/test-utilities/sliding-window-limiter.test-suite.d.ts +0 -1
- package/dist/rate-limiter/implementations/test-utilities/sliding-window-limiter.test-suite.js +1 -1
- package/dist/rate-limiter/implementations/test-utilities/sliding-window-limiter.test-suite.js.map +1 -1
- package/dist/resilience/middlewares/fallback/fallback.types.d.ts +0 -4
- package/dist/resilience/middlewares/observe/observe.types.d.ts +0 -9
- package/dist/resilience/middlewares/retry/retry.types.d.ts +0 -6
- package/dist/resilience/middlewares/timeout/timeout.type.d.ts +0 -4
- package/dist/resilience/resilience.errors.d.ts +0 -5
- package/dist/resilience/resilience.errors.js +0 -4
- package/dist/resilience/resilience.errors.js.map +1 -1
- package/dist/semaphore/contracts/semaphore-adapter.contract.d.ts +0 -2
- package/dist/semaphore/contracts/semaphore-provider.contract.d.ts +0 -2
- package/dist/semaphore/contracts/semaphore-state.contract.d.ts +0 -7
- package/dist/semaphore/contracts/semaphore-state.contract.js +0 -1
- package/dist/semaphore/contracts/semaphore-state.contract.js.map +1 -1
- package/dist/semaphore/contracts/semaphore.contract.d.ts +3 -6
- package/dist/semaphore/contracts/semaphore.contract.js +2 -1
- package/dist/semaphore/contracts/semaphore.contract.js.map +1 -1
- package/dist/semaphore/contracts/semaphore.errors.d.ts +0 -3
- package/dist/semaphore/contracts/semaphore.errors.js +0 -2
- package/dist/semaphore/contracts/semaphore.errors.js.map +1 -1
- package/dist/semaphore/contracts/semaphore.events.d.ts +0 -3
- package/dist/semaphore/contracts/semaphore.events.js +0 -1
- package/dist/semaphore/contracts/semaphore.events.js.map +1 -1
- package/dist/semaphore/contracts/types.d.ts +0 -1
- package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.d.ts +0 -4
- package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.js.map +1 -1
- package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.d.ts +1 -2
- package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.js +18 -23
- package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.js.map +1 -1
- package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.d.ts +0 -3
- package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.js.map +1 -1
- package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.d.ts +1 -1
- package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.js +1 -1
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.d.ts +2 -4
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.js.map +1 -1
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.js.map +1 -1
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.d.ts +3 -3
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.js +2 -2
- package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.js.map +1 -1
- package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.d.ts +0 -2
- package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.js.map +1 -1
- package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.d.ts +0 -1
- package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.js +1 -1
- package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.js.map +1 -1
- package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.d.ts +0 -1
- package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.js +1 -1
- package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.js.map +1 -1
- package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.d.ts +0 -1
- package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.js +1 -1
- package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.js.map +1 -1
- package/dist/serde/contracts/flexible-serde-adapter.contract.d.ts +0 -1
- package/dist/serde/contracts/flexible-serde.contract.d.ts +0 -2
- package/dist/serde/contracts/serde.errors.d.ts +1 -4
- package/dist/serde/contracts/serde.errors.js +0 -2
- package/dist/serde/contracts/serde.errors.js.map +1 -1
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +1 -1
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +1 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.d.ts +0 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +0 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js.map +1 -1
- package/dist/serde/implementations/derivables/serde-transformers.d.ts +1 -0
- package/dist/serde/implementations/derivables/serde-transformers.js +1 -0
- package/dist/serde/implementations/derivables/serde-transformers.js.map +1 -1
- package/dist/serde/implementations/derivables/serde.d.ts +0 -2
- package/dist/serde/implementations/derivables/serde.js.map +1 -1
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.d.ts +0 -1
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js.map +1 -1
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +0 -1
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +1 -0
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js.map +1 -1
- package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.d.ts +0 -3
- package/dist/shared-lock/contracts/shared-lock-adapter.contract.d.ts +0 -1
- package/dist/shared-lock/contracts/shared-lock-provider.contract.d.ts +0 -2
- package/dist/shared-lock/contracts/shared-lock-state.contract.d.ts +0 -15
- package/dist/shared-lock/contracts/shared-lock-state.contract.js +0 -3
- package/dist/shared-lock/contracts/shared-lock-state.contract.js.map +1 -1
- package/dist/shared-lock/contracts/shared-lock.contract.d.ts +3 -8
- package/dist/shared-lock/contracts/shared-lock.contract.js +2 -1
- package/dist/shared-lock/contracts/shared-lock.contract.js.map +1 -1
- package/dist/shared-lock/contracts/shared-lock.errors.d.ts +0 -9
- package/dist/shared-lock/contracts/shared-lock.errors.js +0 -6
- package/dist/shared-lock/contracts/shared-lock.errors.js.map +1 -1
- package/dist/shared-lock/contracts/shared-lock.events.d.ts +0 -7
- package/dist/shared-lock/contracts/shared-lock.events.js +0 -3
- package/dist/shared-lock/contracts/shared-lock.events.js.map +1 -1
- package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.d.ts +0 -5
- package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.js.map +1 -1
- package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.d.ts +1 -4
- package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.js +42 -52
- package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.js.map +1 -1
- package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.d.ts +0 -5
- package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.js.map +1 -1
- package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.d.ts +1 -1
- package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.js +1 -1
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.d.ts +2 -4
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.js.map +1 -1
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.js.map +1 -1
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.d.ts +5 -5
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.js +12 -12
- package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.js.map +1 -1
- package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.d.ts +0 -2
- package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.js.map +1 -1
- package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.d.ts +0 -1
- package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.js +1 -1
- package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.js.map +1 -1
- package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.d.ts +0 -1
- package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.js +1 -1
- package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.js.map +1 -1
- package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.d.ts +0 -1
- package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.js +1 -1
- package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.js.map +1 -1
- package/dist/task/implementations/task.js +0 -1
- package/dist/task/implementations/task.js.map +1 -1
- package/dist/time-span/contracts/time-span.contract.d.ts +0 -1
- package/dist/time-span/contracts/time-span.contract.js +0 -1
- package/dist/time-span/contracts/time-span.contract.js.map +1 -1
- package/dist/time-span/implementations/time-span.d.ts +1 -3
- package/dist/time-span/implementations/time-span.js +1 -1
- package/dist/time-span/implementations/time-span.js.map +1 -1
- package/dist/utilities/contracts/comparable.contract.d.ts +0 -6
- package/dist/utilities/contracts/deinitizable.contract.d.ts +0 -1
- package/dist/utilities/contracts/initizable.contract.d.ts +0 -1
- package/dist/utilities/contracts/prunable.contract.d.ts +0 -1
- package/dist/utilities/contracts/sqlite-database.contract.d.ts +0 -2
- package/dist/utilities/errors.d.ts +0 -1
- package/dist/utilities/errors.js +0 -1
- package/dist/utilities/errors.js.map +1 -1
- package/dist/utilities/functions/error-policy.d.ts +0 -2
- package/dist/utilities/functions/error-policy.js.map +1 -1
- package/dist/utilities/functions/invokable.d.ts +0 -4
- package/dist/utilities/functions/invokable.js.map +1 -1
- package/dist/utilities/functions/is-positive-nbr.d.ts +0 -1
- package/dist/utilities/functions/is-positive-nbr.js +0 -1
- package/dist/utilities/functions/is-positive-nbr.js.map +1 -1
- package/dist/utilities/functions/iterable-to-async-iterable.js +1 -2
- package/dist/utilities/functions/iterable-to-async-iterable.js.map +1 -1
- package/dist/utilities/functions/lazy.d.ts +0 -5
- package/dist/utilities/functions/lazy.js.map +1 -1
- package/dist/utilities/functions/object.js +2 -6
- package/dist/utilities/functions/object.js.map +1 -1
- package/dist/utilities/functions/resolve-one-or-more.d.ts +0 -1
- package/dist/utilities/functions/resolve-one-or-more.js.map +1 -1
- package/dist/utilities/types/async-iterable-value.type.d.ts +0 -2
- package/dist/utilities/types/none-func.type.d.ts +0 -1
- package/dist/utilities/types/promiseable.type.d.ts +0 -1
- package/package.json +15 -1
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module FileStorage
|
|
3
|
+
*/
|
|
4
|
+
import { Buffer } from "node:buffer";
|
|
5
|
+
import { Readable } from "stream";
|
|
6
|
+
import { lookup } from "mime-types";
|
|
7
|
+
import {} from "../../../../event-bus/contracts/_module.js";
|
|
8
|
+
import { TO_BYTES } from "../../../../file-size/contracts/_module.js";
|
|
9
|
+
import { FileSize } from "../../../../file-size/implementations/_module.js";
|
|
10
|
+
import { KeyExistsFileError, KeyNotFoundFileError, isFileError, FILE_EVENTS, FILE_WRITE_ENUM, InvalidKeyFileError, } from "../../../../file-storage/contracts/_module.js";
|
|
11
|
+
import { resolveFileContent } from "../../../../file-storage/implementations/derivables/file-storage/resolve-file-content.js";
|
|
12
|
+
import { ResolveFileStream } from "../../../../file-storage/implementations/derivables/file-storage/resolve-file-stream.js";
|
|
13
|
+
import {} from "../../../../hooks/_module.js";
|
|
14
|
+
import {} from "../../../../namespace/contracts/_module.js";
|
|
15
|
+
import {} from "../../../../task/contracts/_module.js";
|
|
16
|
+
import { Task } from "../../../../task/implementations/_module.js";
|
|
17
|
+
import { TimeSpan } from "../../../../time-span/implementations/_module.js";
|
|
18
|
+
import {} from "../../../../utilities/_module.js";
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export class File {
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
static _internal_serialize(deserializedValue) {
|
|
27
|
+
return {
|
|
28
|
+
version: "1",
|
|
29
|
+
key: deserializedValue._key.get(),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
originalAdapter;
|
|
33
|
+
adapter;
|
|
34
|
+
_key;
|
|
35
|
+
eventDispatcher;
|
|
36
|
+
serdeTransformerName;
|
|
37
|
+
namespace;
|
|
38
|
+
defaultContentType;
|
|
39
|
+
defaultContentDisposition;
|
|
40
|
+
defaultContentEncoding;
|
|
41
|
+
defaultCacheControl;
|
|
42
|
+
defaultContentLanguage;
|
|
43
|
+
onlyLowercase;
|
|
44
|
+
keyValidator;
|
|
45
|
+
constructor(settings) {
|
|
46
|
+
const { onlyLowercase, keyValidator, adapter, key, eventDispatcher, serdeTransformerName, namespace, defaultContentType, defaultContentDisposition, defaultContentEncoding, defaultCacheControl, defaultContentLanguage, originalAdapter, } = settings;
|
|
47
|
+
this.onlyLowercase = onlyLowercase;
|
|
48
|
+
this.keyValidator = keyValidator;
|
|
49
|
+
this.originalAdapter = originalAdapter;
|
|
50
|
+
this.defaultContentType = defaultContentType;
|
|
51
|
+
this.adapter = adapter;
|
|
52
|
+
this._key = key;
|
|
53
|
+
this.eventDispatcher = eventDispatcher;
|
|
54
|
+
this.serdeTransformerName = serdeTransformerName;
|
|
55
|
+
this.namespace = namespace;
|
|
56
|
+
this.defaultContentDisposition = defaultContentDisposition;
|
|
57
|
+
this.defaultContentEncoding = defaultContentEncoding;
|
|
58
|
+
this.defaultCacheControl = defaultCacheControl;
|
|
59
|
+
this.defaultContentLanguage = defaultContentLanguage;
|
|
60
|
+
this.handleKey(this._key);
|
|
61
|
+
}
|
|
62
|
+
handleKey(key) {
|
|
63
|
+
let rawKey = key.toString();
|
|
64
|
+
if (this.onlyLowercase) {
|
|
65
|
+
rawKey = rawKey.toLowerCase();
|
|
66
|
+
}
|
|
67
|
+
const validationMessage = this.keyValidator(rawKey);
|
|
68
|
+
if (validationMessage !== null) {
|
|
69
|
+
throw InvalidKeyFileError.create(validationMessage);
|
|
70
|
+
}
|
|
71
|
+
return rawKey;
|
|
72
|
+
}
|
|
73
|
+
_internal_getNamespace() {
|
|
74
|
+
return this.namespace;
|
|
75
|
+
}
|
|
76
|
+
_internal_getSerdeTransformerName() {
|
|
77
|
+
return this.serdeTransformerName;
|
|
78
|
+
}
|
|
79
|
+
_internal_getAdapter() {
|
|
80
|
+
return this.originalAdapter;
|
|
81
|
+
}
|
|
82
|
+
get key() {
|
|
83
|
+
return this._key;
|
|
84
|
+
}
|
|
85
|
+
handleUnexpectedErrorEvent = () => {
|
|
86
|
+
return async (args, next) => {
|
|
87
|
+
try {
|
|
88
|
+
return await next(...args);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (isFileError(error)) {
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
this.eventDispatcher
|
|
95
|
+
.dispatch(FILE_EVENTS.UNEXPECTED_ERROR, {
|
|
96
|
+
error,
|
|
97
|
+
file: this,
|
|
98
|
+
})
|
|
99
|
+
.detach();
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
handleNullableFoundEvent() {
|
|
105
|
+
return async (args, next) => {
|
|
106
|
+
const value = await next(...args);
|
|
107
|
+
if (value === null) {
|
|
108
|
+
this.eventDispatcher
|
|
109
|
+
.dispatch(FILE_EVENTS.NOT_FOUND, {
|
|
110
|
+
file: this,
|
|
111
|
+
})
|
|
112
|
+
.detach();
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this.eventDispatcher
|
|
116
|
+
.dispatch(FILE_EVENTS.FOUND, {
|
|
117
|
+
file: this,
|
|
118
|
+
})
|
|
119
|
+
.detach();
|
|
120
|
+
}
|
|
121
|
+
return value;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
handleBooleanFoundEvent() {
|
|
125
|
+
return async (args, next) => {
|
|
126
|
+
const exists = await next(...args);
|
|
127
|
+
if (exists) {
|
|
128
|
+
this.eventDispatcher
|
|
129
|
+
.dispatch(FILE_EVENTS.FOUND, {
|
|
130
|
+
file: this,
|
|
131
|
+
})
|
|
132
|
+
.detach();
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.eventDispatcher
|
|
136
|
+
.dispatch(FILE_EVENTS.NOT_FOUND, {
|
|
137
|
+
file: this,
|
|
138
|
+
})
|
|
139
|
+
.detach();
|
|
140
|
+
}
|
|
141
|
+
return exists;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
getText() {
|
|
145
|
+
return new Task(async () => {
|
|
146
|
+
const bytes = await this.getBytes();
|
|
147
|
+
if (bytes === null) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
return new TextDecoder().decode(bytes);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
getTextOrFail() {
|
|
154
|
+
return new Task(async () => {
|
|
155
|
+
const text = await this.getText();
|
|
156
|
+
if (text === null) {
|
|
157
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
158
|
+
}
|
|
159
|
+
return text;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
getBytes() {
|
|
163
|
+
return new Task(async () => {
|
|
164
|
+
return await this.adapter.getBytes(this._key.toString());
|
|
165
|
+
}).pipe([
|
|
166
|
+
this.handleUnexpectedErrorEvent(),
|
|
167
|
+
this.handleNullableFoundEvent(),
|
|
168
|
+
]);
|
|
169
|
+
}
|
|
170
|
+
getBytesOrFail() {
|
|
171
|
+
return new Task(async () => {
|
|
172
|
+
const bytes = await this.getBytes();
|
|
173
|
+
if (bytes === null) {
|
|
174
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
175
|
+
}
|
|
176
|
+
return bytes;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
getBuffer() {
|
|
180
|
+
return new Task(async () => {
|
|
181
|
+
const bytes = await this.getBytes();
|
|
182
|
+
if (bytes === null) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
return Buffer.from(bytes);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
getBufferOrFail() {
|
|
189
|
+
return new Task(async () => {
|
|
190
|
+
const buffer = await this.getBuffer();
|
|
191
|
+
if (buffer === null) {
|
|
192
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
193
|
+
}
|
|
194
|
+
return buffer;
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
getArrayBuffer() {
|
|
198
|
+
return new Task(async () => {
|
|
199
|
+
const bytes = await this.getBuffer();
|
|
200
|
+
if (bytes === null) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
return new Uint8Array(Buffer.from(bytes)).buffer;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
getArrayBufferOrFail() {
|
|
207
|
+
return new Task(async () => {
|
|
208
|
+
const arrayBuffer = await this.getArrayBuffer();
|
|
209
|
+
if (arrayBuffer === null) {
|
|
210
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
211
|
+
}
|
|
212
|
+
return arrayBuffer;
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
getReadable() {
|
|
216
|
+
return new Task(async () => {
|
|
217
|
+
const stream = await this.adapter.getStream(this._key.toString());
|
|
218
|
+
if (stream === null) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
return Readable.from(stream);
|
|
222
|
+
}).pipe([
|
|
223
|
+
this.handleUnexpectedErrorEvent(),
|
|
224
|
+
this.handleNullableFoundEvent(),
|
|
225
|
+
]);
|
|
226
|
+
}
|
|
227
|
+
getReadableOrFail() {
|
|
228
|
+
return new Task(async () => {
|
|
229
|
+
const stream = await this.getReadable();
|
|
230
|
+
if (stream === null) {
|
|
231
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
232
|
+
}
|
|
233
|
+
return stream;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
getReadableStream() {
|
|
237
|
+
return new Task(async () => {
|
|
238
|
+
const stream = await this.adapter.getStream(this._key.toString());
|
|
239
|
+
if (stream === null) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
return ReadableStream.from(stream);
|
|
243
|
+
}).pipe([
|
|
244
|
+
this.handleUnexpectedErrorEvent(),
|
|
245
|
+
this.handleNullableFoundEvent(),
|
|
246
|
+
]);
|
|
247
|
+
}
|
|
248
|
+
getReadableStreamOrFail() {
|
|
249
|
+
return new Task(async () => {
|
|
250
|
+
const stream = await this.getReadableStream();
|
|
251
|
+
if (stream === null) {
|
|
252
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
253
|
+
}
|
|
254
|
+
return stream;
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
getMetadata() {
|
|
258
|
+
return new Task(async () => {
|
|
259
|
+
const metadata = await this.adapter.getMetaData(this._key.toString());
|
|
260
|
+
if (metadata === null) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
contentType: metadata.contentType,
|
|
265
|
+
etag: metadata.etag,
|
|
266
|
+
updatedAt: metadata.updatedAt,
|
|
267
|
+
fileSize: FileSize.fromBytes(metadata.fileSizeInBytes),
|
|
268
|
+
};
|
|
269
|
+
}).pipe([
|
|
270
|
+
this.handleUnexpectedErrorEvent(),
|
|
271
|
+
this.handleNullableFoundEvent(),
|
|
272
|
+
]);
|
|
273
|
+
}
|
|
274
|
+
getMetadataOrFail() {
|
|
275
|
+
return new Task(async () => {
|
|
276
|
+
const metadata = await this.getMetadata();
|
|
277
|
+
if (metadata === null) {
|
|
278
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
279
|
+
}
|
|
280
|
+
return metadata;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
exists() {
|
|
284
|
+
return new Task(async () => {
|
|
285
|
+
return await this.adapter.exists(this._key.toString());
|
|
286
|
+
}).pipe([
|
|
287
|
+
this.handleUnexpectedErrorEvent(),
|
|
288
|
+
this.handleBooleanFoundEvent(),
|
|
289
|
+
]);
|
|
290
|
+
}
|
|
291
|
+
missing() {
|
|
292
|
+
return new Task(async () => {
|
|
293
|
+
return !(await this.exists());
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
handleAddEvent() {
|
|
297
|
+
return async (args, next) => {
|
|
298
|
+
const hasAdded = await next(...args);
|
|
299
|
+
if (hasAdded) {
|
|
300
|
+
this.eventDispatcher
|
|
301
|
+
.dispatch(FILE_EVENTS.ADDED, {
|
|
302
|
+
file: this,
|
|
303
|
+
})
|
|
304
|
+
.detach();
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
this.eventDispatcher
|
|
308
|
+
.dispatch(FILE_EVENTS.KEY_EXISTS, {
|
|
309
|
+
file: this,
|
|
310
|
+
})
|
|
311
|
+
.detach();
|
|
312
|
+
}
|
|
313
|
+
return hasAdded;
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
add(content) {
|
|
317
|
+
return new Task(async () => {
|
|
318
|
+
const { data, contentType = this.getContentType(this._key.get()) } = content;
|
|
319
|
+
const resolvedData = resolveFileContent(data);
|
|
320
|
+
return await this.adapter.add(this._key.toString(), {
|
|
321
|
+
data: resolvedData,
|
|
322
|
+
contentType,
|
|
323
|
+
contentDisposition: this.defaultContentDisposition,
|
|
324
|
+
contentEncoding: this.defaultContentEncoding,
|
|
325
|
+
cacheControl: this.defaultCacheControl,
|
|
326
|
+
contentLanguage: this.defaultContentLanguage,
|
|
327
|
+
fileSizeInBytes: resolvedData.length,
|
|
328
|
+
});
|
|
329
|
+
}).pipe([this.handleUnexpectedErrorEvent(), this.handleAddEvent()]);
|
|
330
|
+
}
|
|
331
|
+
addOrFail(content) {
|
|
332
|
+
return new Task(async () => {
|
|
333
|
+
const hasAdded = await this.add(content);
|
|
334
|
+
if (!hasAdded) {
|
|
335
|
+
throw KeyExistsFileError.create(this._key);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
getContentType(key) {
|
|
340
|
+
let resolvedContentType = lookup(key);
|
|
341
|
+
if (resolvedContentType === false) {
|
|
342
|
+
resolvedContentType = this.defaultContentType;
|
|
343
|
+
}
|
|
344
|
+
return resolvedContentType;
|
|
345
|
+
}
|
|
346
|
+
addStream(stream) {
|
|
347
|
+
return new Task(async () => {
|
|
348
|
+
const { data, fileSize = null, contentType = this.getContentType(this._key.get()), } = stream;
|
|
349
|
+
return await this.adapter.addStream(this._key.toString(), {
|
|
350
|
+
data: new ResolveFileStream(data),
|
|
351
|
+
fileSizeInBytes: fileSize?.[TO_BYTES]() ?? null,
|
|
352
|
+
contentType,
|
|
353
|
+
contentDisposition: this.defaultContentDisposition,
|
|
354
|
+
contentEncoding: this.defaultContentEncoding,
|
|
355
|
+
cacheControl: this.defaultCacheControl,
|
|
356
|
+
contentLanguage: this.defaultContentLanguage,
|
|
357
|
+
});
|
|
358
|
+
}).pipe([this.handleUnexpectedErrorEvent(), this.handleAddEvent()]);
|
|
359
|
+
}
|
|
360
|
+
addStreamOrFail(stream) {
|
|
361
|
+
return new Task(async () => {
|
|
362
|
+
const hasAdded = await this.addStream(stream);
|
|
363
|
+
if (!hasAdded) {
|
|
364
|
+
throw KeyExistsFileError.create(this._key);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
handleUpdateEvent() {
|
|
369
|
+
return async (args, next) => {
|
|
370
|
+
const hasUpdated = await next(...args);
|
|
371
|
+
if (hasUpdated) {
|
|
372
|
+
this.eventDispatcher
|
|
373
|
+
.dispatch(FILE_EVENTS.UPDATED, {
|
|
374
|
+
file: this,
|
|
375
|
+
})
|
|
376
|
+
.detach();
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
this.eventDispatcher
|
|
380
|
+
.dispatch(FILE_EVENTS.NOT_FOUND, {
|
|
381
|
+
file: this,
|
|
382
|
+
})
|
|
383
|
+
.detach();
|
|
384
|
+
}
|
|
385
|
+
return hasUpdated;
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
update(content) {
|
|
389
|
+
return new Task(async () => {
|
|
390
|
+
const { data, contentType = this.getContentType(this._key.get()) } = content;
|
|
391
|
+
const resolvedData = resolveFileContent(data);
|
|
392
|
+
return await this.adapter.update(this._key.toString(), {
|
|
393
|
+
data: resolvedData,
|
|
394
|
+
contentType,
|
|
395
|
+
contentDisposition: this.defaultContentDisposition,
|
|
396
|
+
contentEncoding: this.defaultContentEncoding,
|
|
397
|
+
cacheControl: this.defaultCacheControl,
|
|
398
|
+
contentLanguage: this.defaultContentLanguage,
|
|
399
|
+
fileSizeInBytes: resolvedData.length,
|
|
400
|
+
});
|
|
401
|
+
}).pipe([this.handleUnexpectedErrorEvent(), this.handleUpdateEvent()]);
|
|
402
|
+
}
|
|
403
|
+
updateOrFail(content) {
|
|
404
|
+
return new Task(async () => {
|
|
405
|
+
const hasUpdated = await this.update(content);
|
|
406
|
+
if (!hasUpdated) {
|
|
407
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
updateStream(stream) {
|
|
412
|
+
return new Task(async () => {
|
|
413
|
+
const { data, fileSize = null, contentType = this.getContentType(this._key.get()), } = stream;
|
|
414
|
+
return await this.adapter.updateStream(this._key.toString(), {
|
|
415
|
+
data: new ResolveFileStream(data),
|
|
416
|
+
fileSizeInBytes: fileSize?.[TO_BYTES]() ?? null,
|
|
417
|
+
contentType,
|
|
418
|
+
contentDisposition: this.defaultContentDisposition,
|
|
419
|
+
contentEncoding: this.defaultContentEncoding,
|
|
420
|
+
cacheControl: this.defaultCacheControl,
|
|
421
|
+
contentLanguage: this.defaultContentLanguage,
|
|
422
|
+
});
|
|
423
|
+
}).pipe([this.handleUnexpectedErrorEvent(), this.handleUpdateEvent()]);
|
|
424
|
+
}
|
|
425
|
+
updateStreamOrFail(stream) {
|
|
426
|
+
return new Task(async () => {
|
|
427
|
+
const hasUpdated = await this.updateStream(stream);
|
|
428
|
+
if (!hasUpdated) {
|
|
429
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
handlePutEvent() {
|
|
434
|
+
return async (args, next) => {
|
|
435
|
+
const hasUpdated = await next(...args);
|
|
436
|
+
if (hasUpdated) {
|
|
437
|
+
this.eventDispatcher
|
|
438
|
+
.dispatch(FILE_EVENTS.UPDATED, {
|
|
439
|
+
file: this,
|
|
440
|
+
})
|
|
441
|
+
.detach();
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
this.eventDispatcher
|
|
445
|
+
.dispatch(FILE_EVENTS.ADDED, {
|
|
446
|
+
file: this,
|
|
447
|
+
})
|
|
448
|
+
.detach();
|
|
449
|
+
}
|
|
450
|
+
return hasUpdated;
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
put(content) {
|
|
454
|
+
return new Task(async () => {
|
|
455
|
+
const { data, contentType = this.getContentType(this._key.get()) } = content;
|
|
456
|
+
const resolvedData = resolveFileContent(data);
|
|
457
|
+
return await this.adapter.put(this._key.toString(), {
|
|
458
|
+
data: resolvedData,
|
|
459
|
+
contentType,
|
|
460
|
+
contentDisposition: this.defaultContentDisposition,
|
|
461
|
+
contentEncoding: this.defaultContentEncoding,
|
|
462
|
+
cacheControl: this.defaultCacheControl,
|
|
463
|
+
contentLanguage: this.defaultContentLanguage,
|
|
464
|
+
fileSizeInBytes: resolvedData.length,
|
|
465
|
+
});
|
|
466
|
+
}).pipe([this.handleUnexpectedErrorEvent(), this.handlePutEvent()]);
|
|
467
|
+
}
|
|
468
|
+
putStream(stream) {
|
|
469
|
+
return new Task(async () => {
|
|
470
|
+
const { data, fileSize = null, contentType = this.getContentType(this._key.get()), } = stream;
|
|
471
|
+
return await this.adapter.putStream(this._key.toString(), {
|
|
472
|
+
data: new ResolveFileStream(data),
|
|
473
|
+
fileSizeInBytes: fileSize?.[TO_BYTES]() ?? null,
|
|
474
|
+
contentType,
|
|
475
|
+
contentDisposition: this.defaultContentDisposition,
|
|
476
|
+
contentEncoding: this.defaultContentEncoding,
|
|
477
|
+
cacheControl: this.defaultCacheControl,
|
|
478
|
+
contentLanguage: this.defaultContentLanguage,
|
|
479
|
+
});
|
|
480
|
+
}).pipe([this.handleUnexpectedErrorEvent(), this.handlePutEvent()]);
|
|
481
|
+
}
|
|
482
|
+
handleRemoveEvent() {
|
|
483
|
+
return async (args, next) => {
|
|
484
|
+
const hasRemoved = await next(...args);
|
|
485
|
+
if (hasRemoved) {
|
|
486
|
+
this.eventDispatcher
|
|
487
|
+
.dispatch(FILE_EVENTS.REMOVED, {
|
|
488
|
+
file: this,
|
|
489
|
+
})
|
|
490
|
+
.detach();
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
this.eventDispatcher
|
|
494
|
+
.dispatch(FILE_EVENTS.NOT_FOUND, {
|
|
495
|
+
file: this,
|
|
496
|
+
})
|
|
497
|
+
.detach();
|
|
498
|
+
}
|
|
499
|
+
return hasRemoved;
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
remove() {
|
|
503
|
+
return new Task(async () => {
|
|
504
|
+
return await this.adapter.removeMany([this.key.toString()]);
|
|
505
|
+
}).pipe(this.handleRemoveEvent());
|
|
506
|
+
}
|
|
507
|
+
removeOrFail() {
|
|
508
|
+
return new Task(async () => {
|
|
509
|
+
const hasFound = await this.remove();
|
|
510
|
+
if (!hasFound) {
|
|
511
|
+
throw KeyNotFoundFileError.create(this.key);
|
|
512
|
+
}
|
|
513
|
+
}).pipe([this.handleUnexpectedErrorEvent()]);
|
|
514
|
+
}
|
|
515
|
+
_copy(destination) {
|
|
516
|
+
return new Task(async () => {
|
|
517
|
+
const destinationKey = this.namespace.create(destination);
|
|
518
|
+
const result = await this.adapter.copy(this._key.toString(), destinationKey.toString());
|
|
519
|
+
if (result === FILE_WRITE_ENUM.KEY_EXISTS) {
|
|
520
|
+
this.eventDispatcher
|
|
521
|
+
.dispatch(FILE_EVENTS.DESTINATION_EXISTS, {
|
|
522
|
+
source: this,
|
|
523
|
+
destination: destinationKey,
|
|
524
|
+
})
|
|
525
|
+
.detach();
|
|
526
|
+
}
|
|
527
|
+
if (result === FILE_WRITE_ENUM.NOT_FOUND) {
|
|
528
|
+
this.eventDispatcher
|
|
529
|
+
.dispatch(FILE_EVENTS.NOT_FOUND, {
|
|
530
|
+
file: this,
|
|
531
|
+
})
|
|
532
|
+
.detach();
|
|
533
|
+
}
|
|
534
|
+
if (result === FILE_WRITE_ENUM.SUCCESS) {
|
|
535
|
+
this.eventDispatcher
|
|
536
|
+
.dispatch(FILE_EVENTS.COPIED, {
|
|
537
|
+
source: this,
|
|
538
|
+
destination: destinationKey,
|
|
539
|
+
replaced: false,
|
|
540
|
+
})
|
|
541
|
+
.detach();
|
|
542
|
+
}
|
|
543
|
+
return result;
|
|
544
|
+
}).pipe([this.handleUnexpectedErrorEvent()]);
|
|
545
|
+
}
|
|
546
|
+
copy(destination) {
|
|
547
|
+
return new Task(async () => {
|
|
548
|
+
const result = await this._copy(destination);
|
|
549
|
+
return result === FILE_WRITE_ENUM.SUCCESS;
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
copyOrFail(destination) {
|
|
553
|
+
return new Task(async () => {
|
|
554
|
+
const result = await this._copy(destination);
|
|
555
|
+
if (result === FILE_WRITE_ENUM.KEY_EXISTS) {
|
|
556
|
+
throw KeyExistsFileError.create(this._key);
|
|
557
|
+
}
|
|
558
|
+
if (result === FILE_WRITE_ENUM.NOT_FOUND) {
|
|
559
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
copyAndReplace(destination) {
|
|
564
|
+
return new Task(async () => {
|
|
565
|
+
const destinationKey = this.namespace.create(destination);
|
|
566
|
+
const hasCopied = await this.adapter.copyAndReplace(this._key.toString(), destinationKey.toString());
|
|
567
|
+
if (hasCopied) {
|
|
568
|
+
this.eventDispatcher
|
|
569
|
+
.dispatch(FILE_EVENTS.COPIED, {
|
|
570
|
+
source: this,
|
|
571
|
+
destination: destinationKey,
|
|
572
|
+
replaced: true,
|
|
573
|
+
})
|
|
574
|
+
.detach();
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
this.eventDispatcher
|
|
578
|
+
.dispatch(FILE_EVENTS.NOT_FOUND, {
|
|
579
|
+
file: this,
|
|
580
|
+
})
|
|
581
|
+
.detach();
|
|
582
|
+
}
|
|
583
|
+
return hasCopied;
|
|
584
|
+
}).pipe([this.handleUnexpectedErrorEvent()]);
|
|
585
|
+
}
|
|
586
|
+
copyAndReplaceOrFail(destination) {
|
|
587
|
+
return new Task(async () => {
|
|
588
|
+
const hasCopied = await this.copyAndReplace(destination);
|
|
589
|
+
if (!hasCopied) {
|
|
590
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
_move(destination) {
|
|
595
|
+
return new Task(async () => {
|
|
596
|
+
const destinationKey = this.namespace.create(destination);
|
|
597
|
+
const result = await this.adapter.move(this._key.toString(), destinationKey.toString());
|
|
598
|
+
if (result === FILE_WRITE_ENUM.KEY_EXISTS) {
|
|
599
|
+
this.eventDispatcher
|
|
600
|
+
.dispatch(FILE_EVENTS.DESTINATION_EXISTS, {
|
|
601
|
+
source: this,
|
|
602
|
+
destination: destinationKey,
|
|
603
|
+
})
|
|
604
|
+
.detach();
|
|
605
|
+
}
|
|
606
|
+
if (result === FILE_WRITE_ENUM.NOT_FOUND) {
|
|
607
|
+
this.eventDispatcher
|
|
608
|
+
.dispatch(FILE_EVENTS.NOT_FOUND, {
|
|
609
|
+
file: this,
|
|
610
|
+
})
|
|
611
|
+
.detach();
|
|
612
|
+
}
|
|
613
|
+
if (result === FILE_WRITE_ENUM.SUCCESS) {
|
|
614
|
+
this.eventDispatcher
|
|
615
|
+
.dispatch(FILE_EVENTS.MOVED, {
|
|
616
|
+
source: this,
|
|
617
|
+
destination: destinationKey,
|
|
618
|
+
replaced: false,
|
|
619
|
+
})
|
|
620
|
+
.detach();
|
|
621
|
+
}
|
|
622
|
+
return result;
|
|
623
|
+
}).pipe([this.handleUnexpectedErrorEvent()]);
|
|
624
|
+
}
|
|
625
|
+
move(destination) {
|
|
626
|
+
return new Task(async () => {
|
|
627
|
+
const result = await this._move(destination);
|
|
628
|
+
return result === FILE_WRITE_ENUM.SUCCESS;
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
moveOrFail(destination) {
|
|
632
|
+
return new Task(async () => {
|
|
633
|
+
const result = await this._move(destination);
|
|
634
|
+
if (result === FILE_WRITE_ENUM.KEY_EXISTS) {
|
|
635
|
+
throw KeyExistsFileError.create(this._key);
|
|
636
|
+
}
|
|
637
|
+
if (result === FILE_WRITE_ENUM.NOT_FOUND) {
|
|
638
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
moveAndReplace(destination) {
|
|
643
|
+
return new Task(async () => {
|
|
644
|
+
const destinationKey = this.namespace.create(destination);
|
|
645
|
+
const hasMoved = await this.adapter.moveAndReplace(this._key.toString(), destinationKey.toString());
|
|
646
|
+
if (hasMoved) {
|
|
647
|
+
this.eventDispatcher
|
|
648
|
+
.dispatch(FILE_EVENTS.MOVED, {
|
|
649
|
+
source: this,
|
|
650
|
+
destination: destinationKey,
|
|
651
|
+
replaced: true,
|
|
652
|
+
})
|
|
653
|
+
.detach();
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
this.eventDispatcher
|
|
657
|
+
.dispatch(FILE_EVENTS.NOT_FOUND, {
|
|
658
|
+
file: this,
|
|
659
|
+
})
|
|
660
|
+
.detach();
|
|
661
|
+
}
|
|
662
|
+
return hasMoved;
|
|
663
|
+
}).pipe([this.handleUnexpectedErrorEvent()]);
|
|
664
|
+
}
|
|
665
|
+
moveAndReplaceOrFail(destination) {
|
|
666
|
+
return new Task(async () => {
|
|
667
|
+
const hasCopied = await this.moveAndReplace(destination);
|
|
668
|
+
if (!hasCopied) {
|
|
669
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
getPublicUrl() {
|
|
674
|
+
return new Task(async () => {
|
|
675
|
+
return await this.adapter.getPublicUrl(this.key.toString());
|
|
676
|
+
}).pipe([
|
|
677
|
+
this.handleUnexpectedErrorEvent(),
|
|
678
|
+
this.handleNullableFoundEvent(),
|
|
679
|
+
]);
|
|
680
|
+
}
|
|
681
|
+
getPublicUrlOrFail() {
|
|
682
|
+
return new Task(async () => {
|
|
683
|
+
const url = await this.getPublicUrl();
|
|
684
|
+
if (url === null) {
|
|
685
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
686
|
+
}
|
|
687
|
+
return url;
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
getSignedUploadUrl(options = {}) {
|
|
691
|
+
return new Task(async () => {
|
|
692
|
+
const { ttl = TimeSpan.fromMinutes(10), contentType = null } = options;
|
|
693
|
+
return await this.adapter.getSignedUploadUrl(this._key.toString(), {
|
|
694
|
+
expirationInSeconds: TimeSpan.fromTimeSpan(ttl).toSeconds(),
|
|
695
|
+
contentType,
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
getSignedDownloadUrl(options = {}) {
|
|
700
|
+
return new Task(async () => {
|
|
701
|
+
const { ttl: expiration = TimeSpan.fromMinutes(10), contentType = null, contentDisposition = null, } = options;
|
|
702
|
+
return await this.adapter.getSignedDownloadUrl(this._key.toString(), {
|
|
703
|
+
expirationInSeconds: TimeSpan.fromTimeSpan(expiration).toSeconds(),
|
|
704
|
+
contentType,
|
|
705
|
+
contentDisposition,
|
|
706
|
+
});
|
|
707
|
+
}).pipe([
|
|
708
|
+
this.handleUnexpectedErrorEvent(),
|
|
709
|
+
this.handleNullableFoundEvent(),
|
|
710
|
+
]);
|
|
711
|
+
}
|
|
712
|
+
getSignedDownloadUrlOrFail(options) {
|
|
713
|
+
return new Task(async () => {
|
|
714
|
+
const url = await this.getSignedDownloadUrl(options);
|
|
715
|
+
if (url === null) {
|
|
716
|
+
throw KeyNotFoundFileError.create(this._key);
|
|
717
|
+
}
|
|
718
|
+
return url;
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
//# sourceMappingURL=file.js.map
|