@daiso-tech/core 0.15.0 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_module.js +2 -2
- package/dist/cjs/_module.js.map +1 -1
- package/dist/cjs/async/_module.js +1 -1
- package/dist/cjs/async/_module.js.map +1 -1
- package/dist/cjs/async/backof-policies/_module.js +1 -0
- package/dist/cjs/async/backof-policies/_module.js.map +1 -1
- package/dist/cjs/async/utilities/_module.js +3 -0
- package/dist/cjs/async/utilities/_module.js.map +1 -1
- package/dist/cjs/async/utilities/lazy-promise/lazy-promise.js +21 -12
- package/dist/cjs/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/cjs/cache/contracts/cache.events.js +168 -0
- package/dist/cjs/cache/contracts/cache.events.js.map +1 -1
- package/dist/cjs/cache/implementations/_shared/_module.js +1 -0
- package/dist/cjs/cache/implementations/_shared/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js +256 -177
- package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js +23 -2
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +63 -20
- package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/_module.js +2 -1
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js +56 -0
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +30 -16
- package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js +1 -0
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js +26 -0
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +66 -39
- package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js +2 -1
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js +44 -0
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +78 -28
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +10 -1
- package/dist/cjs/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/_module.js +1 -0
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js +32 -0
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +55 -23
- package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js +1 -0
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js +56 -0
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js.map +1 -0
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +31 -17
- package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/_module.js +3 -2
- package/dist/cjs/cache/implementations/derivables/_module.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory-settings.js +65 -0
- package/dist/cjs/cache/implementations/derivables/cache-factory-settings.js.map +1 -0
- package/dist/cjs/cache/implementations/derivables/cache-factory.js +29 -18
- package/dist/cjs/cache/implementations/derivables/cache-factory.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-settings.js +56 -0
- package/dist/cjs/cache/implementations/derivables/cache-settings.js.map +1 -0
- package/dist/cjs/cache/implementations/derivables/cache.js +334 -79
- package/dist/cjs/cache/implementations/derivables/cache.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js +14 -7
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js +62 -41
- package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/merge-iterable.js +6 -7
- package/dist/cjs/collection/implementations/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js +11 -2
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/list-collection/list-collection.js +13 -0
- package/dist/cjs/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/cjs/event-bus/contracts/_module.js +2 -2
- package/dist/cjs/event-bus/contracts/_module.js.map +1 -1
- package/dist/cjs/event-bus/contracts/_shared.js +7 -0
- package/dist/cjs/event-bus/contracts/_shared.js.map +1 -1
- package/dist/cjs/event-bus/implementations/_shared/event-bus-adapter.test-suite.js +98 -38
- package/dist/cjs/event-bus/implementations/_shared/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.js +197 -125
- package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/_module.js +1 -1
- package/dist/cjs/event-bus/implementations/adapters/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js +2 -1
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js +26 -0
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js.map +1 -0
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +29 -11
- package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/cjs/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +9 -3
- package/dist/cjs/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
- package/dist/cjs/{serializer/implementations/_shared/test-utilities → event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter}/_module.js +2 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js.map +1 -0
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js +38 -0
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js.map +1 -0
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +56 -0
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -0
- package/dist/cjs/event-bus/implementations/derivables/_module.js +3 -1
- package/dist/cjs/event-bus/implementations/derivables/_module.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory-settings.js +59 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory-settings.js.map +1 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js +28 -17
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-settings.js +56 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus-settings.js.map +1 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js +106 -37
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/cjs/serde/contracts/_module.js +23 -0
- package/dist/cjs/serde/contracts/_module.js.map +1 -0
- package/dist/cjs/serde/contracts/deserializer.contract.js +3 -0
- package/dist/cjs/serde/contracts/deserializer.contract.js.map +1 -0
- package/dist/cjs/serde/contracts/flexible-serde.contract.js +3 -0
- package/dist/cjs/serde/contracts/flexible-serde.contract.js.map +1 -0
- package/dist/cjs/serde/contracts/serde.contract.js +3 -0
- package/dist/cjs/serde/contracts/serde.contract.js.map +1 -0
- package/dist/cjs/{serializer/contracts/serializer.errors.js → serde/contracts/serde.errors.js} +7 -7
- package/dist/cjs/serde/contracts/serde.errors.js.map +1 -0
- package/dist/cjs/serde/contracts/serializable.contract.js +3 -0
- package/dist/cjs/serde/contracts/serializable.contract.js.map +1 -0
- package/dist/cjs/serde/contracts/serializer.contract.js.map +1 -0
- package/dist/cjs/{serializer → serde}/implementations/_module.js +6 -5
- package/dist/cjs/serde/implementations/_module.js.map +1 -0
- package/dist/cjs/{serializer/contracts → serde/implementations/_shared/test-utilities}/_module.js +2 -2
- package/dist/cjs/serde/implementations/_shared/test-utilities/_module.js.map +1 -0
- package/dist/cjs/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js +53 -0
- package/dist/cjs/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js.map +1 -0
- package/dist/cjs/{serializer/implementations/_shared/test-utilities/serializer.test-suite.js → serde/implementations/_shared/test-utilities/serde.test-suite.js} +68 -93
- package/dist/cjs/serde/implementations/_shared/test-utilities/serde.test-suite.js.map +1 -0
- package/dist/cjs/{serializer/implementations/sql-serializer → serde/implementations/mongodb-serde}/_module.js +1 -1
- package/dist/cjs/serde/implementations/mongodb-serde/_module.js.map +1 -0
- package/dist/cjs/serde/implementations/mongodb-serde/mongodb-serde.js +36 -0
- package/dist/cjs/serde/implementations/mongodb-serde/mongodb-serde.js.map +1 -0
- package/dist/cjs/{serializer/implementations/redis-serializer → serde/implementations/no-op-serde}/_module.js +1 -1
- package/dist/cjs/serde/implementations/no-op-serde/_module.js.map +1 -0
- package/dist/cjs/serde/implementations/no-op-serde/no-op-serde.js +16 -0
- package/dist/cjs/serde/implementations/no-op-serde/no-op-serde.js.map +1 -0
- package/dist/cjs/{serializer/implementations/mongodb-serializer → serde/implementations/redis-serde}/_module.js +1 -1
- package/dist/cjs/serde/implementations/redis-serde/_module.js.map +1 -0
- package/dist/cjs/serde/implementations/redis-serde/redis-serde.js +37 -0
- package/dist/cjs/serde/implementations/redis-serde/redis-serde.js.map +1 -0
- package/dist/cjs/{event-bus/implementations/adapters/redis-event-bus-adapter → serde/implementations/sql-serde}/_module.js +1 -1
- package/dist/cjs/serde/implementations/sql-serde/_module.js.map +1 -0
- package/dist/cjs/serde/implementations/sql-serde/sql-serde.js +37 -0
- package/dist/cjs/serde/implementations/sql-serde/sql-serde.js.map +1 -0
- package/dist/cjs/serde/implementations/super-json-serde/_module.js +18 -0
- package/dist/cjs/serde/implementations/super-json-serde/_module.js.map +1 -0
- package/dist/cjs/{serializer/implementations/super-json-serializer/super-json-serializer.js → serde/implementations/super-json-serde/super-json-serde.js} +77 -100
- package/dist/cjs/serde/implementations/super-json-serde/super-json-serde.js.map +1 -0
- package/dist/cjs/utilities/contracts/_module.js +1 -0
- package/dist/cjs/utilities/contracts/_module.js.map +1 -1
- package/dist/cjs/utilities/contracts/buildable.contract.js +3 -0
- package/dist/cjs/utilities/contracts/buildable.contract.js.map +1 -0
- package/dist/cjs/utilities/errors.js +10 -10
- package/dist/cjs/utilities/errors.js.map +1 -1
- package/dist/cjs/utilities/functions.js +9 -5
- package/dist/cjs/utilities/functions.js.map +1 -1
- package/dist/cjs/utilities/time-span/time-span.js +8 -0
- package/dist/cjs/utilities/time-span/time-span.js.map +1 -1
- package/dist/esm/_module.js +2 -2
- package/dist/esm/_module.js.map +1 -1
- package/dist/esm/async/_module.js +1 -1
- package/dist/esm/async/_module.js.map +1 -1
- package/dist/esm/async/backof-policies/_module.js +1 -0
- package/dist/esm/async/backof-policies/_module.js.map +1 -1
- package/dist/esm/async/utilities/_module.js +3 -0
- package/dist/esm/async/utilities/_module.js.map +1 -1
- package/dist/esm/async/utilities/lazy-promise/lazy-promise.js +21 -12
- package/dist/esm/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/esm/cache/contracts/cache.events.js +158 -0
- package/dist/esm/cache/contracts/cache.events.js.map +1 -1
- package/dist/esm/cache/implementations/_shared/_module.js +1 -0
- package/dist/esm/cache/implementations/_shared/_module.js.map +1 -1
- package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js +256 -177
- package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js +23 -2
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +64 -21
- package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js +2 -1
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js +52 -0
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +29 -15
- package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js +1 -0
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js +22 -0
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +66 -39
- package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js +2 -1
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js +40 -0
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +78 -25
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +10 -1
- package/dist/esm/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js +1 -0
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js +28 -0
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +55 -23
- package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js +1 -0
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -1
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js +52 -0
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js.map +1 -0
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +29 -15
- package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/_module.js +3 -2
- package/dist/esm/cache/implementations/derivables/_module.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-factory-settings.js +61 -0
- package/dist/esm/cache/implementations/derivables/cache-factory-settings.js.map +1 -0
- package/dist/esm/cache/implementations/derivables/cache-factory.js +30 -19
- package/dist/esm/cache/implementations/derivables/cache-factory.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-settings.js +52 -0
- package/dist/esm/cache/implementations/derivables/cache-settings.js.map +1 -0
- package/dist/esm/cache/implementations/derivables/cache.js +333 -78
- package/dist/esm/cache/implementations/derivables/cache.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js +14 -7
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js +62 -41
- package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/merge-iterable.js +6 -7
- package/dist/esm/collection/implementations/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js +11 -2
- package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/list-collection/list-collection.js +13 -0
- package/dist/esm/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/esm/event-bus/contracts/_module.js +2 -2
- package/dist/esm/event-bus/contracts/_module.js.map +1 -1
- package/dist/esm/event-bus/contracts/_shared.js +5 -0
- package/dist/esm/event-bus/contracts/_shared.js.map +1 -1
- package/dist/esm/event-bus/implementations/_shared/event-bus-adapter.test-suite.js +96 -36
- package/dist/esm/event-bus/implementations/_shared/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.js +195 -123
- package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/_module.js +1 -1
- package/dist/esm/event-bus/implementations/adapters/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js +2 -1
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js +22 -0
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +29 -11
- package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +9 -3
- package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js +3 -0
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js +34 -0
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js.map +1 -0
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +52 -0
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -0
- package/dist/esm/event-bus/implementations/derivables/_module.js +3 -1
- package/dist/esm/event-bus/implementations/derivables/_module.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory-settings.js +55 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory-settings.js.map +1 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js +29 -18
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-settings.js +52 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus-settings.js.map +1 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus.js +108 -39
- package/dist/esm/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/esm/serde/contracts/_module.js +7 -0
- package/dist/esm/serde/contracts/_module.js.map +1 -0
- package/dist/esm/serde/contracts/deserializer.contract.js +1 -0
- package/dist/esm/serde/contracts/deserializer.contract.js.map +1 -0
- package/dist/esm/serde/contracts/flexible-serde.contract.js +1 -0
- package/dist/esm/serde/contracts/flexible-serde.contract.js.map +1 -0
- package/dist/esm/serde/contracts/serde.contract.js +1 -0
- package/dist/esm/serde/contracts/serde.contract.js.map +1 -0
- package/dist/esm/{serializer/contracts/serializer.errors.js → serde/contracts/serde.errors.js} +5 -5
- package/dist/esm/serde/contracts/serde.errors.js.map +1 -0
- package/dist/esm/serde/contracts/serializable.contract.js +1 -0
- package/dist/esm/serde/contracts/serializable.contract.js.map +1 -0
- package/dist/esm/serde/contracts/serializer.contract.js.map +1 -0
- package/dist/esm/serde/implementations/_module.js +7 -0
- package/dist/esm/serde/implementations/_module.js.map +1 -0
- package/dist/esm/serde/implementations/_shared/test-utilities/_module.js +3 -0
- package/dist/esm/serde/implementations/_shared/test-utilities/_module.js.map +1 -0
- package/dist/esm/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js +50 -0
- package/dist/esm/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js.map +1 -0
- package/dist/esm/{serializer/implementations/_shared/test-utilities/serializer.test-suite.js → serde/implementations/_shared/test-utilities/serde.test-suite.js} +67 -92
- package/dist/esm/serde/implementations/_shared/test-utilities/serde.test-suite.js.map +1 -0
- package/dist/esm/serde/implementations/mongodb-serde/_module.js +2 -0
- package/dist/esm/serde/implementations/mongodb-serde/_module.js.map +1 -0
- package/dist/esm/{serializer/implementations/mongodb-serializer/mongodb-serializer.js → serde/implementations/mongodb-serde/mongodb-serde.js} +10 -10
- package/dist/esm/serde/implementations/mongodb-serde/mongodb-serde.js.map +1 -0
- package/dist/esm/serde/implementations/no-op-serde/_module.js +2 -0
- package/dist/esm/serde/implementations/no-op-serde/_module.js.map +1 -0
- package/dist/esm/serde/implementations/no-op-serde/no-op-serde.js +12 -0
- package/dist/esm/serde/implementations/no-op-serde/no-op-serde.js.map +1 -0
- package/dist/esm/serde/implementations/redis-serde/_module.js +2 -0
- package/dist/esm/serde/implementations/redis-serde/_module.js.map +1 -0
- package/dist/esm/{serializer/implementations/sql-serializer/sql-serializer.js → serde/implementations/redis-serde/redis-serde.js} +10 -10
- package/dist/esm/serde/implementations/redis-serde/redis-serde.js.map +1 -0
- package/dist/esm/serde/implementations/sql-serde/_module.js +2 -0
- package/dist/esm/serde/implementations/sql-serde/_module.js.map +1 -0
- package/dist/esm/{serializer/implementations/redis-serializer/redis-serializer.js → serde/implementations/sql-serde/sql-serde.js} +10 -10
- package/dist/esm/serde/implementations/sql-serde/sql-serde.js.map +1 -0
- package/dist/esm/serde/implementations/super-json-serde/_module.js +2 -0
- package/dist/esm/serde/implementations/super-json-serde/_module.js.map +1 -0
- package/dist/esm/{serializer/implementations/super-json-serializer/super-json-serializer.js → serde/implementations/super-json-serde/super-json-serde.js} +55 -55
- package/dist/esm/serde/implementations/super-json-serde/super-json-serde.js.map +1 -0
- package/dist/esm/utilities/contracts/_module.js +1 -0
- package/dist/esm/utilities/contracts/_module.js.map +1 -1
- package/dist/esm/utilities/contracts/buildable.contract.js +1 -0
- package/dist/esm/utilities/contracts/buildable.contract.js.map +1 -0
- package/dist/esm/utilities/errors.js +7 -7
- package/dist/esm/utilities/errors.js.map +1 -1
- package/dist/esm/utilities/functions.js +7 -4
- package/dist/esm/utilities/functions.js.map +1 -1
- package/dist/esm/utilities/time-span/time-span.js +8 -0
- package/dist/esm/utilities/time-span/time-span.js.map +1 -1
- package/dist/types/_module.d.ts +2 -2
- package/dist/types/async/_module.d.ts +1 -1
- package/dist/types/async/backof-policies/_module.d.ts +1 -1
- package/dist/types/async/utilities/_module.d.ts +3 -0
- package/dist/types/async/utilities/lazy-promise/lazy-promise.d.ts +66 -39
- package/dist/types/cache/contracts/cache-adapter.contract.d.ts +20 -6
- package/dist/types/cache/contracts/cache-factory.contract.d.ts +12 -25
- package/dist/types/cache/contracts/cache.contract.d.ts +382 -22
- package/dist/types/cache/contracts/cache.events.d.ts +156 -42
- package/dist/types/cache/implementations/_shared/_module.d.ts +1 -0
- package/dist/types/cache/implementations/_shared/cache-adapter.test-suite.d.ts +21 -12
- package/dist/types/cache/implementations/_shared/cache.test-suite.d.ts +21 -15
- package/dist/types/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +15 -8
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/_module.d.ts +2 -1
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.d.ts +48 -0
- package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +54 -36
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.d.ts +27 -0
- package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +50 -20
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/_module.d.ts +2 -1
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.d.ts +51 -0
- package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +66 -41
- package/dist/types/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +6 -3
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.d.ts +32 -0
- package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +51 -29
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/_module.d.ts +1 -0
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.d.ts +48 -0
- package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +54 -34
- package/dist/types/cache/implementations/derivables/_module.d.ts +3 -2
- package/dist/types/cache/implementations/derivables/cache-factory-settings.d.ts +77 -0
- package/dist/types/cache/implementations/derivables/cache-factory.d.ts +59 -45
- package/dist/types/cache/implementations/derivables/cache-settings.d.ts +68 -0
- package/dist/types/cache/implementations/derivables/cache.d.ts +83 -62
- package/dist/types/collection/contracts/async-collection.contract.d.ts +1247 -666
- package/dist/types/collection/contracts/collection.contract.d.ts +1195 -638
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.d.ts +4 -5
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +194 -3
- package/dist/types/collection/implementations/iterable-collection/_shared/merge-iterable.d.ts +4 -5
- package/dist/types/collection/implementations/iterable-collection/iterable-collection.d.ts +141 -1
- package/dist/types/collection/implementations/list-collection/list-collection.d.ts +141 -1
- package/dist/types/event-bus/contracts/_module.d.ts +2 -2
- package/dist/types/event-bus/contracts/_shared.d.ts +11 -0
- package/dist/types/event-bus/contracts/event-bus-adapter.contract.d.ts +9 -8
- package/dist/types/event-bus/contracts/event-bus-factory.contract.d.ts +38 -32
- package/dist/types/event-bus/contracts/event-bus.contract.d.ts +52 -37
- package/dist/types/event-bus/implementations/_shared/event-bus-adapter.test-suite.d.ts +22 -10
- package/dist/types/event-bus/implementations/_shared/event-bus.test-suite.d.ts +16 -13
- package/dist/types/event-bus/implementations/adapters/_module.d.ts +1 -1
- package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/_module.d.ts +2 -1
- package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.d.ts +28 -0
- package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +53 -22
- package/dist/types/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +7 -4
- package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.d.ts +2 -0
- package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.d.ts +36 -0
- package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +62 -0
- package/dist/types/event-bus/implementations/derivables/_module.d.ts +3 -1
- package/dist/types/event-bus/implementations/derivables/event-bus-factory-settings.d.ts +70 -0
- package/dist/types/event-bus/implementations/derivables/event-bus-factory.d.ts +40 -24
- package/dist/types/event-bus/implementations/derivables/event-bus-settings.d.ts +58 -0
- package/dist/types/event-bus/implementations/derivables/event-bus.d.ts +31 -45
- package/dist/types/serde/contracts/_module.d.ts +6 -0
- package/dist/types/serde/contracts/deserializer.contract.d.ts +13 -0
- package/dist/types/serde/contracts/flexible-serde.contract.d.ts +56 -0
- package/dist/types/serde/contracts/serde.contract.d.ts +10 -0
- package/dist/types/{serializer/contracts/serializer.errors.d.ts → serde/contracts/serde.errors.d.ts} +4 -4
- package/dist/types/serde/contracts/serializable.contract.d.ts +10 -0
- package/dist/types/serde/contracts/serializer.contract.d.ts +10 -0
- package/dist/types/serde/implementations/_module.d.ts +6 -0
- package/dist/types/serde/implementations/_shared/test-utilities/_module.d.ts +2 -0
- package/dist/types/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.d.ts +17 -0
- package/dist/types/serde/implementations/_shared/test-utilities/serde.test-suite.d.ts +17 -0
- package/dist/types/serde/implementations/mongodb-serde/_module.d.ts +1 -0
- package/dist/types/serde/implementations/mongodb-serde/mongodb-serde.d.ts +13 -0
- package/dist/types/serde/implementations/no-op-serde/_module.d.ts +1 -0
- package/dist/types/serde/implementations/no-op-serde/no-op-serde.d.ts +13 -0
- package/dist/types/serde/implementations/redis-serde/_module.d.ts +1 -0
- package/dist/types/serde/implementations/redis-serde/redis-serde.d.ts +13 -0
- package/dist/types/serde/implementations/sql-serde/_module.d.ts +1 -0
- package/dist/types/serde/implementations/sql-serde/sql-serde.d.ts +13 -0
- package/dist/types/serde/implementations/super-json-serde/_module.d.ts +1 -0
- package/dist/types/serde/implementations/super-json-serde/super-json-serde.d.ts +25 -0
- package/dist/types/utilities/contracts/_module.d.ts +1 -0
- package/dist/types/utilities/contracts/buildable.contract.d.ts +9 -0
- package/dist/types/utilities/errors.d.ts +3 -3
- package/dist/types/utilities/functions.d.ts +5 -1
- package/dist/types/utilities/time-span/time-span.d.ts +10 -1
- package/dist/types/utilities/types.d.ts +0 -1
- package/package.json +3 -9
- package/dist/cjs/cache/implementations/derivables/base-cache.js +0 -270
- package/dist/cjs/cache/implementations/derivables/base-cache.js.map +0 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +0 -1
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js +0 -44
- package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
- package/dist/cjs/event-bus/implementations/derivables/base-event-bus.js +0 -47
- package/dist/cjs/event-bus/implementations/derivables/base-event-bus.js.map +0 -1
- package/dist/cjs/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js +0 -42
- package/dist/cjs/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +0 -1
- package/dist/cjs/serializer/contracts/_module.js.map +0 -1
- package/dist/cjs/serializer/contracts/serializer.contract.js.map +0 -1
- package/dist/cjs/serializer/contracts/serializer.errors.js.map +0 -1
- package/dist/cjs/serializer/implementations/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/_shared/test-utilities/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/_shared/test-utilities/serializer.test-suite.js.map +0 -1
- package/dist/cjs/serializer/implementations/mongodb-serializer/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js +0 -36
- package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +0 -1
- package/dist/cjs/serializer/implementations/redis-serializer/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js +0 -37
- package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js.map +0 -1
- package/dist/cjs/serializer/implementations/sql-serializer/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js +0 -37
- package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js.map +0 -1
- package/dist/cjs/serializer/implementations/super-json-serializer/_module.js +0 -18
- package/dist/cjs/serializer/implementations/super-json-serializer/_module.js.map +0 -1
- package/dist/cjs/serializer/implementations/super-json-serializer/super-json-serializer.js.map +0 -1
- package/dist/esm/cache/implementations/derivables/base-cache.js +0 -266
- package/dist/esm/cache/implementations/derivables/base-cache.js.map +0 -1
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js +0 -2
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +0 -1
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js +0 -40
- package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
- package/dist/esm/event-bus/implementations/derivables/base-event-bus.js +0 -43
- package/dist/esm/event-bus/implementations/derivables/base-event-bus.js.map +0 -1
- package/dist/esm/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js +0 -38
- package/dist/esm/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +0 -1
- package/dist/esm/serializer/contracts/_module.js +0 -3
- package/dist/esm/serializer/contracts/_module.js.map +0 -1
- package/dist/esm/serializer/contracts/serializer.contract.js.map +0 -1
- package/dist/esm/serializer/contracts/serializer.errors.js.map +0 -1
- package/dist/esm/serializer/implementations/_module.js +0 -6
- package/dist/esm/serializer/implementations/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/_shared/test-utilities/_module.js +0 -2
- package/dist/esm/serializer/implementations/_shared/test-utilities/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/_shared/test-utilities/serializer.test-suite.js.map +0 -1
- package/dist/esm/serializer/implementations/mongodb-serializer/_module.js +0 -2
- package/dist/esm/serializer/implementations/mongodb-serializer/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +0 -1
- package/dist/esm/serializer/implementations/redis-serializer/_module.js +0 -2
- package/dist/esm/serializer/implementations/redis-serializer/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/redis-serializer/redis-serializer.js.map +0 -1
- package/dist/esm/serializer/implementations/sql-serializer/_module.js +0 -2
- package/dist/esm/serializer/implementations/sql-serializer/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/sql-serializer/sql-serializer.js.map +0 -1
- package/dist/esm/serializer/implementations/super-json-serializer/_module.js +0 -2
- package/dist/esm/serializer/implementations/super-json-serializer/_module.js.map +0 -1
- package/dist/esm/serializer/implementations/super-json-serializer/super-json-serializer.js.map +0 -1
- package/dist/types/cache/implementations/derivables/base-cache.d.ts +0 -58
- package/dist/types/event-bus/implementations/adapters/redis-event-bus-adapter/_module.d.ts +0 -1
- package/dist/types/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.d.ts +0 -43
- package/dist/types/event-bus/implementations/derivables/base-event-bus.d.ts +0 -23
- package/dist/types/event-bus/implementations/derivables/with-namespace-event-bus-adapter.d.ts +0 -16
- package/dist/types/serializer/contracts/_module.d.ts +0 -2
- package/dist/types/serializer/contracts/serializer.contract.d.ts +0 -16
- package/dist/types/serializer/implementations/_module.d.ts +0 -5
- package/dist/types/serializer/implementations/_shared/test-utilities/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/_shared/test-utilities/serializer.test-suite.d.ts +0 -18
- package/dist/types/serializer/implementations/mongodb-serializer/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/mongodb-serializer/mongodb-serializer.d.ts +0 -13
- package/dist/types/serializer/implementations/redis-serializer/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/redis-serializer/redis-serializer.d.ts +0 -13
- package/dist/types/serializer/implementations/sql-serializer/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/sql-serializer/sql-serializer.d.ts +0 -13
- package/dist/types/serializer/implementations/super-json-serializer/_module.d.ts +0 -1
- package/dist/types/serializer/implementations/super-json-serializer/super-json-serializer.d.ts +0 -37
- /package/dist/cjs/{serializer → serde}/contracts/serializer.contract.js +0 -0
- /package/dist/esm/{serializer → serde}/contracts/serializer.contract.js +0 -0
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
constructor({ dedupe = false, registerClass = () => { }, registerSymbol = () => { }, registerCustom = () => { }, } = {}) {
|
|
9
|
-
this.registerClass = registerClass;
|
|
10
|
-
this.registerSymbol = registerSymbol;
|
|
11
|
-
this.registerCustom = registerCustom;
|
|
12
|
-
this.dedupe = dedupe;
|
|
1
|
+
import { getConstructorName } from "../../../utilities/_module";
|
|
2
|
+
import { DeserializationError, SerializationError, } from "../../../serde/contracts/serde.errors";
|
|
3
|
+
import { SuperJSON } from "superjson-cjs";
|
|
4
|
+
export class SuperJsonSerde {
|
|
5
|
+
superJson = new SuperJSON();
|
|
6
|
+
constructor() {
|
|
7
|
+
this.registerAll();
|
|
13
8
|
}
|
|
14
|
-
|
|
15
|
-
superJson.registerCustom({
|
|
9
|
+
registerBuffer() {
|
|
10
|
+
this.superJson.registerCustom({
|
|
16
11
|
isApplicable(value) {
|
|
17
12
|
return value instanceof Buffer;
|
|
18
13
|
},
|
|
@@ -36,8 +31,8 @@ export class SuperJsonSerializer {
|
|
|
36
31
|
},
|
|
37
32
|
}, Buffer.name);
|
|
38
33
|
}
|
|
39
|
-
|
|
40
|
-
superJson.registerCustom({
|
|
34
|
+
registerUint8Array() {
|
|
35
|
+
this.superJson.registerCustom({
|
|
41
36
|
isApplicable(value) {
|
|
42
37
|
return value instanceof Uint8Array;
|
|
43
38
|
},
|
|
@@ -61,8 +56,8 @@ export class SuperJsonSerializer {
|
|
|
61
56
|
},
|
|
62
57
|
}, Uint8Array.name);
|
|
63
58
|
}
|
|
64
|
-
|
|
65
|
-
superJson.registerCustom({
|
|
59
|
+
registerInt8Array() {
|
|
60
|
+
this.superJson.registerCustom({
|
|
66
61
|
isApplicable(value) {
|
|
67
62
|
return value instanceof Int8Array;
|
|
68
63
|
},
|
|
@@ -86,8 +81,8 @@ export class SuperJsonSerializer {
|
|
|
86
81
|
},
|
|
87
82
|
}, Int8Array.name);
|
|
88
83
|
}
|
|
89
|
-
|
|
90
|
-
superJson.registerCustom({
|
|
84
|
+
registerUint16Array() {
|
|
85
|
+
this.superJson.registerCustom({
|
|
91
86
|
isApplicable(value) {
|
|
92
87
|
return value instanceof Uint16Array;
|
|
93
88
|
},
|
|
@@ -111,8 +106,8 @@ export class SuperJsonSerializer {
|
|
|
111
106
|
},
|
|
112
107
|
}, Uint16Array.name);
|
|
113
108
|
}
|
|
114
|
-
|
|
115
|
-
superJson.registerCustom({
|
|
109
|
+
registerInt16Array() {
|
|
110
|
+
this.superJson.registerCustom({
|
|
116
111
|
isApplicable(value) {
|
|
117
112
|
return value instanceof Int16Array;
|
|
118
113
|
},
|
|
@@ -136,8 +131,8 @@ export class SuperJsonSerializer {
|
|
|
136
131
|
},
|
|
137
132
|
}, Int16Array.name);
|
|
138
133
|
}
|
|
139
|
-
|
|
140
|
-
superJson.registerCustom({
|
|
134
|
+
registerUint32Array() {
|
|
135
|
+
this.superJson.registerCustom({
|
|
141
136
|
isApplicable(value) {
|
|
142
137
|
return value instanceof Uint32Array;
|
|
143
138
|
},
|
|
@@ -161,8 +156,8 @@ export class SuperJsonSerializer {
|
|
|
161
156
|
},
|
|
162
157
|
}, Uint32Array.name);
|
|
163
158
|
}
|
|
164
|
-
|
|
165
|
-
superJson.registerCustom({
|
|
159
|
+
registerInt32Array() {
|
|
160
|
+
this.superJson.registerCustom({
|
|
166
161
|
isApplicable(value) {
|
|
167
162
|
return value instanceof Int32Array;
|
|
168
163
|
},
|
|
@@ -186,8 +181,8 @@ export class SuperJsonSerializer {
|
|
|
186
181
|
},
|
|
187
182
|
}, Int32Array.name);
|
|
188
183
|
}
|
|
189
|
-
|
|
190
|
-
superJson.registerCustom({
|
|
184
|
+
registerFloat32Array() {
|
|
185
|
+
this.superJson.registerCustom({
|
|
191
186
|
isApplicable(value) {
|
|
192
187
|
return value instanceof Float32Array;
|
|
193
188
|
},
|
|
@@ -211,8 +206,8 @@ export class SuperJsonSerializer {
|
|
|
211
206
|
},
|
|
212
207
|
}, Float32Array.name);
|
|
213
208
|
}
|
|
214
|
-
|
|
215
|
-
superJson.registerCustom({
|
|
209
|
+
registerFloat64Array() {
|
|
210
|
+
this.superJson.registerCustom({
|
|
216
211
|
isApplicable(value) {
|
|
217
212
|
return value instanceof Float64Array;
|
|
218
213
|
},
|
|
@@ -236,42 +231,47 @@ export class SuperJsonSerializer {
|
|
|
236
231
|
},
|
|
237
232
|
}, Float64Array.name);
|
|
238
233
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
234
|
+
registerAll() {
|
|
235
|
+
this.registerBuffer();
|
|
236
|
+
this.registerUint8Array();
|
|
237
|
+
this.registerInt8Array();
|
|
238
|
+
this.registerUint16Array();
|
|
239
|
+
this.registerInt16Array();
|
|
240
|
+
this.registerUint32Array();
|
|
241
|
+
this.registerInt32Array();
|
|
242
|
+
this.registerFloat32Array();
|
|
243
|
+
this.registerFloat64Array();
|
|
244
|
+
}
|
|
245
|
+
registerClass(class_) {
|
|
246
|
+
this.superJson.registerCustom({
|
|
247
|
+
isApplicable(value) {
|
|
248
|
+
return (value instanceof class_ &&
|
|
249
|
+
getConstructorName(value) === class_.name);
|
|
250
|
+
},
|
|
251
|
+
deserialize(serializedValue) {
|
|
252
|
+
return class_.deserialize(serializedValue);
|
|
253
|
+
},
|
|
254
|
+
serialize(value) {
|
|
255
|
+
return value.serialize();
|
|
256
|
+
},
|
|
257
|
+
}, class_.name);
|
|
258
|
+
return this;
|
|
257
259
|
}
|
|
258
|
-
|
|
260
|
+
serialize(value) {
|
|
259
261
|
try {
|
|
260
|
-
|
|
261
|
-
return superJson.stringify(value);
|
|
262
|
+
return this.superJson.stringify(value);
|
|
262
263
|
}
|
|
263
264
|
catch (error) {
|
|
264
265
|
throw new SerializationError(`Serialization error "${String(error)}" occured`, error);
|
|
265
266
|
}
|
|
266
267
|
}
|
|
267
|
-
|
|
268
|
+
deserialize(value) {
|
|
268
269
|
try {
|
|
269
|
-
|
|
270
|
-
return (await superJson.parse(value));
|
|
270
|
+
return this.superJson.parse(value);
|
|
271
271
|
}
|
|
272
272
|
catch (error) {
|
|
273
273
|
throw new DeserializationError(`Deserialization error "${String(error)}" occured`, error);
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
//# sourceMappingURL=super-json-
|
|
277
|
+
//# sourceMappingURL=super-json-serde.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"super-json-serde.js","sourceRoot":"","sources":["../../../../../src/serde/implementations/super-json-serde/super-json-serde.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAMzD,OAAO,EACH,oBAAoB,EACpB,kBAAkB,GACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM1C,MAAM,OAAO,cAAc;IACN,SAAS,GAAc,IAAI,SAAS,EAAE,CAAC;IAExD;QACI,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAEO,cAAc;QAClB,IAAI,CAAC,SAAS,CAAC,cAAc,CACzB;YACI,YAAY,CAAC,KAAU;gBACnB,OAAO,KAAK,YAAY,MAAM,CAAC;YACnC,CAAC;YACD,WAAW,CAAC,eAAe;gBACvB,MAAM,QAAQ,GACV,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;oBAC/B,OAAO,eAAe,KAAK,QAAQ;oBACnC,eAAe,KAAK,IAAI,CAAC;gBAC7B,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACZ,MAAM,IAAI,oBAAoB,CAC1B,gCAAgC,CACnC,CAAC;gBACN,CAAC;gBACD,MAAM,EAAE,MAAM,EAAE,GAAG,eAGlB,CAAC;gBACF,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;oBAC7B,MAAM,IAAI,oBAAoB,CAC1B,kCAAkC,CACrC,CAAC;gBACN,CAAC;gBACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACzC,CAAC;YACD,SAAS,CAAC,iBAAiB;gBACvB,OAAO;oBACH,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC;iBAC/C,CAAC;YACN,CAAC;SACJ,EACD,MAAM,C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I,YAAY,CACR,KAAK;gBAEL,OAAO,CACH,KAAK,YAAY,MAAM;oBACvB,kBAAkB,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,IAAI,CAC5C,CAAC;YACN,CAAC;YACD,WAAW,CAAC,eAAe;gBACvB,OAAO,MAAM,CAAC,WAAW,CACrB,eAA2C,CAC9C,CAAC;YACN,CAAC;YACD,SAAS,CAAC,KAAK;gBACX,OAAO,KAAK,CAAC,SAAS,EAA6B,CAAC;YACxD,CAAC;SACJ,EACD,MAAM,CAAC,IAAI,CACd,CAAC;QACF,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,SAAS,CAAS,KAAa;QAC3B,IAAI,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,MAAM,IAAI,kBAAkB,CACxB,wBAAwB,MAAM,CAAC,KAAK,CAAC,WAAW,EAChD,KAAK,CACR,CAAC;QACN,CAAC;IACL,CAAC;IAED,WAAW,CAAS,KAAa;QAC7B,IAAI,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,MAAM,IAAI,oBAAoB,CAC1B,0BAA0B,MAAM,CAAC,KAAK,CAAC,WAAW,EAClD,KAAK,CACR,CAAC;QACN,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/utilities/contracts/_module.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC"}
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/utilities/contracts/_module.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=buildable.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildable.contract.js","sourceRoot":"","sources":["../../../../src/utilities/contracts/buildable.contract.ts"],"names":[],"mappings":""}
|
|
@@ -4,16 +4,16 @@ export class FactoryError extends Error {
|
|
|
4
4
|
this.name = FactoryError.name;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
export class
|
|
7
|
+
export class DefaultAdapterNotDefinedError extends FactoryError {
|
|
8
8
|
constructor(factoryName) {
|
|
9
|
-
super(`Default
|
|
10
|
-
this.name =
|
|
9
|
+
super(`Default adapter not set for factory "${factoryName}"`);
|
|
10
|
+
this.name = DefaultAdapterNotDefinedError.name;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
export class
|
|
14
|
-
constructor(
|
|
15
|
-
super(`Unregistered
|
|
16
|
-
this.name =
|
|
13
|
+
export class UnregisteredAdapterError extends FactoryError {
|
|
14
|
+
constructor(adapterName) {
|
|
15
|
+
super(`Unregistered adapter "${adapterName}"`);
|
|
16
|
+
this.name = UnregisteredAdapterError.name;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/utilities/errors.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,YAAa,SAAQ,KAAK;IACnC,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IAClC,CAAC;CACJ;AAKD,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/utilities/errors.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,YAAa,SAAQ,KAAK;IACnC,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IAClC,CAAC;CACJ;AAKD,MAAM,OAAO,6BAA8B,SAAQ,YAAY;IAC3D,YAAY,WAAmB;QAC3B,KAAK,CAAC,wCAAwC,WAAW,GAAG,CAAC,CAAC;QAC9D,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC,IAAI,CAAC;IACnD,CAAC;CACJ;AAKD,MAAM,OAAO,wBAAyB,SAAQ,YAAY;IACtD,YAAY,WAAmB;QAC3B,KAAK,CAAC,yBAAyB,WAAW,GAAG,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC,IAAI,CAAC;IAC9C,CAAC;CACJ"}
|
|
@@ -19,10 +19,13 @@ export function isObjectEmpty(object) {
|
|
|
19
19
|
return ([...Object.values(object)].filter((value) => value !== undefined)
|
|
20
20
|
.length === 0);
|
|
21
21
|
}
|
|
22
|
-
export function
|
|
23
|
-
if (Array.isArray(
|
|
24
|
-
|
|
22
|
+
export function simplifyGroupName(name) {
|
|
23
|
+
if (Array.isArray(name)) {
|
|
24
|
+
name = name.filter((str) => str.length > 0).join("/");
|
|
25
25
|
}
|
|
26
|
-
return
|
|
26
|
+
return name;
|
|
27
|
+
}
|
|
28
|
+
export function getConstructorName(instance) {
|
|
29
|
+
return instance.constructor.name;
|
|
27
30
|
}
|
|
28
31
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/utilities/functions.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,gBAAgB,CAAS,QAA0B;IAC/D,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,QAAwB,CAAC;QAC1C,OAAO,QAAQ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C;AAC9B,CAAC;AAID,MAAM,UAAU,aAAa,CAEzB,MAA6C;IAE7C,OAAO,CAEH,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC;SAC5D,MAAM,KAAK,CAAC,CACpB,CAAC;AACN,CAAC;AAKD,MAAM,UAAU,iBAAiB,CAAC,IAAuB;IACrD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAKD,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IAC/C,OAAO,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC;AACrC,CAAC"}
|
|
@@ -4,10 +4,18 @@ export class TimeSpan {
|
|
|
4
4
|
static minuteInMilliseconds = 60 * TimeSpan.secondInMilliseconds;
|
|
5
5
|
static hourInMilliseconds = 60 * TimeSpan.minuteInMilliseconds;
|
|
6
6
|
static dayInMilliseconds = 24 * TimeSpan.hourInMilliseconds;
|
|
7
|
+
static deserialize(serializedValue) {
|
|
8
|
+
return new TimeSpan(serializedValue.timeInMs);
|
|
9
|
+
}
|
|
7
10
|
constructor(milliseconds = 0) {
|
|
8
11
|
this.milliseconds = milliseconds;
|
|
9
12
|
this.milliseconds = Math.max(0, this.milliseconds);
|
|
10
13
|
}
|
|
14
|
+
serialize() {
|
|
15
|
+
return {
|
|
16
|
+
timeInMs: this.toMilliseconds(),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
11
19
|
static fromMilliseconds(milliseconds) {
|
|
12
20
|
return new TimeSpan().addMilliseconds(milliseconds);
|
|
13
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-span.js","sourceRoot":"","sources":["../../../../src/utilities/time-span/time-span.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"time-span.js","sourceRoot":"","sources":["../../../../src/utilities/time-span/time-span.ts"],"names":[],"mappings":"AAkBA,MAAM,OAAO,QAAQ;IAUoB;IAT7B,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,oBAAoB,GAAG,EAAE,GAAG,QAAQ,CAAC,oBAAoB,CAAC;IACjE,MAAM,CAAC,kBAAkB,GAAG,EAAE,GAAG,QAAQ,CAAC,oBAAoB,CAAC;IAC/D,MAAM,CAAC,iBAAiB,GAAG,EAAE,GAAG,QAAQ,CAAC,kBAAkB,CAAC;IAEpE,MAAM,CAAC,WAAW,CAAC,eAAoC;QACnD,OAAO,IAAI,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,YAAqC,eAAuB,CAAC;QAAxB,iBAAY,GAAZ,YAAY,CAAY;QACzD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;IAED,SAAS;QACL,OAAO;YACH,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE;SAClC,CAAC;IACN,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,YAAoB;QACxC,OAAO,IAAI,QAAQ,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,OAAe;QAC9B,OAAO,IAAI,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,OAAe;QAC9B,OAAO,IAAI,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,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B,CAAC,CAAC;IACzE,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IACvE,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACtE,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAAC;IACpD,CAAC;IAMD,SAAS,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE;QAC5B,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IACjE,CAAC;IAMD,WAAW,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE;QAC5B,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/D,CAAC"}
|
package/dist/types/_module.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export * from "./collection/implementations/_module";
|
|
|
5
5
|
export * from "./collection/contracts/_module";
|
|
6
6
|
export * from "./event-bus/implementations/_module";
|
|
7
7
|
export * from "./event-bus/contracts/_module";
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
8
|
+
export * from "./serde/implementations/_module";
|
|
9
|
+
export * from "./serde/contracts/_module";
|
|
10
10
|
export * from "./utilities/_module";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "../../async/backof-policies/_shared";
|
|
2
2
|
export * from "../../async/backof-policies/constant-backoff-policy/_module";
|
|
3
3
|
export * from "../../async/backof-policies/exponential-backoff-policy/_module";
|
|
4
4
|
export * from "../../async/backof-policies/linear-backoff-policy/_module";
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
export * from "../../async/utilities/abort/_module";
|
|
1
2
|
export * from "../../async/utilities/delay/_module";
|
|
2
3
|
export * from "../../async/utilities/lazy-promise/_module";
|
|
4
|
+
export * from "../../async/utilities/retry/_module";
|
|
5
|
+
export * from "../../async/utilities/timeout/_module";
|
|
@@ -4,16 +4,7 @@
|
|
|
4
4
|
import type { BackoffPolicy } from "../../../async/backof-policies/_module";
|
|
5
5
|
import type { TimeSpan } from "../../../utilities/time-span/_module";
|
|
6
6
|
import type { RetryPolicy } from "../../../async/utilities/retry/_module";
|
|
7
|
-
|
|
8
|
-
* @group Utilities
|
|
9
|
-
*/
|
|
10
|
-
export type LazyPromiseSettings = {
|
|
11
|
-
retryAttempts?: number | null;
|
|
12
|
-
backoffPolicy?: BackoffPolicy | null;
|
|
13
|
-
retryPolicy?: RetryPolicy | null;
|
|
14
|
-
abortSignal?: AbortSignal | null;
|
|
15
|
-
time?: TimeSpan | null;
|
|
16
|
-
};
|
|
7
|
+
import type { Func } from "../../../utilities/_module";
|
|
17
8
|
/**
|
|
18
9
|
* The <i>LazyPromise</i> class is used for creating lazy <i>{@link PromiseLike}<i> object that will only execute when awaited or when then method is called.
|
|
19
10
|
* The class includes helpful methods
|
|
@@ -24,7 +15,7 @@ export type LazyPromiseSettings = {
|
|
|
24
15
|
* - <i>abort</i>
|
|
25
16
|
* - <i>timeout</i>
|
|
26
17
|
*
|
|
27
|
-
* The order in which these methods are called does not affect their
|
|
18
|
+
* The order in which these methods are called does not affect their methodality. Internally, the following execution order is applied:
|
|
28
19
|
* 1. <i>timeout</i>
|
|
29
20
|
* 2. <i>retryAttempts</i>
|
|
30
21
|
* 3. <i>abort</i>
|
|
@@ -32,26 +23,62 @@ export type LazyPromiseSettings = {
|
|
|
32
23
|
* This means that combining all methods ensures the <i>retryAttempts</i> method will continue retrying even if the timeout is triggered,
|
|
33
24
|
* while the <i>abort</i> method takes priority to cancel all operations if activated.
|
|
34
25
|
* @group Utilities
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* (async () => {
|
|
38
|
-
* const promise = new LazyPromise(async () => {
|
|
39
|
-
* console.log("I am lazy");
|
|
40
|
-
* });
|
|
41
|
-
* // "I am lazy" will only logged when awaited or then method i called.
|
|
42
|
-
* await promise;
|
|
43
|
-
* })();
|
|
44
|
-
* ```
|
|
45
26
|
*/
|
|
46
27
|
export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
47
28
|
private asyncFn;
|
|
29
|
+
/**
|
|
30
|
+
* The <i>wrapFn</i> is convience method used for wrapping a async method with a <i>LazyPromise</i>.
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { LazyPromise, TimeSpan } from "@daiso-tech/core";
|
|
34
|
+
* import { readFile as readFileNodeJs } from "node:fs/promises";
|
|
35
|
+
*
|
|
36
|
+
* const readFile = LazyPromise.wrapFn(readFileNodeJs, {
|
|
37
|
+
* retryAttempts: 3
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* (async () => {
|
|
41
|
+
* await readFile("none_existing_file.txt").timeout(TimeSpan.fromMinutes(1));
|
|
42
|
+
* })();
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
static wrapFn<TParameters extends unknown[], TReturn>(fn: Func<TParameters, PromiseLike<TReturn>>): Func<TParameters, LazyPromise<TReturn>>;
|
|
46
|
+
/**
|
|
47
|
+
* The <i>all<i> method works similarly to <i>{@link Promise.all}</i> with the key distinction that it operates lazily.
|
|
48
|
+
*/
|
|
49
|
+
static all<TValue>(promises: LazyPromise<TValue>[]): LazyPromise<TValue[]>;
|
|
50
|
+
/**
|
|
51
|
+
* The <i>allSettled<i> method works similarly to <i>{@link Promise.allSettled}</i> with the key distinction that it operates lazily.
|
|
52
|
+
*/
|
|
53
|
+
static allSettled<TValue>(promises: LazyPromise<TValue>[]): LazyPromise<PromiseSettledResult<TValue>[]>;
|
|
54
|
+
/**
|
|
55
|
+
* The <i>race<i> method works similarly to <i>{@link Promise.race}</i> with the key distinction that it operates lazily.
|
|
56
|
+
*/
|
|
57
|
+
static race<TValue>(promises: LazyPromise<TValue>[]): LazyPromise<TValue>;
|
|
58
|
+
/**
|
|
59
|
+
* The <i>any<i> method works similarly to <i>{@link Promise.any}</i> with the key distinction that it operates lazily.
|
|
60
|
+
*/
|
|
61
|
+
static any<TValue>(promises: LazyPromise<TValue>[]): LazyPromise<TValue>;
|
|
48
62
|
private promise;
|
|
49
63
|
private attempts;
|
|
50
64
|
private backoffPolicy_;
|
|
51
65
|
private retryPolicy_;
|
|
52
66
|
private abortSignal;
|
|
53
67
|
private time;
|
|
54
|
-
|
|
68
|
+
/**
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { LazyPromise } from "@daiso-tech/core";
|
|
72
|
+
*
|
|
73
|
+
* (async () => {
|
|
74
|
+
* const promise = new LazyPromise(async () => {
|
|
75
|
+
* console.log("I am lazy");
|
|
76
|
+
* });
|
|
77
|
+
* // "I am lazy" will only logged when awaited or then method i called.
|
|
78
|
+
* await promise;
|
|
79
|
+
* })();
|
|
80
|
+
*/
|
|
81
|
+
constructor(asyncFn: () => PromiseLike<TValue>);
|
|
55
82
|
private applyTimeout;
|
|
56
83
|
private applyRetry;
|
|
57
84
|
private applyAbort;
|
|
@@ -63,7 +90,7 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
63
90
|
*/
|
|
64
91
|
then<TResult1 = TValue, TResult2 = never>(onfulfilled?: ((value: TValue) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
65
92
|
/**
|
|
66
|
-
* The <i>
|
|
93
|
+
* The <i>setRetryAttempts</i> method is used for setting max retry attempts.
|
|
67
94
|
* @example
|
|
68
95
|
* ```ts
|
|
69
96
|
* import { LazyPromise } from "@daiso-tech/core";
|
|
@@ -73,16 +100,16 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
73
100
|
* console.log("A");
|
|
74
101
|
* throw new Error("Error occured!");
|
|
75
102
|
* })
|
|
76
|
-
* .
|
|
103
|
+
* .setRetryAttempts(3)
|
|
77
104
|
* (async () => {
|
|
78
105
|
* // Will log "A" 3 times and then retry error will be thrown.
|
|
79
106
|
* await promise;
|
|
80
107
|
* })();
|
|
81
108
|
* ```
|
|
82
109
|
*/
|
|
83
|
-
|
|
110
|
+
setRetryAttempts(attempts: number | null): this;
|
|
84
111
|
/**
|
|
85
|
-
* The <i>
|
|
112
|
+
* The <i>setBackoffPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
|
|
86
113
|
* @example
|
|
87
114
|
* ```ts
|
|
88
115
|
* import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core";
|
|
@@ -92,17 +119,17 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
92
119
|
* console.log("A");
|
|
93
120
|
* throw new Error("Error occured!");
|
|
94
121
|
* })
|
|
95
|
-
* .
|
|
96
|
-
* .
|
|
122
|
+
* .setRetryAttempts(3)
|
|
123
|
+
* .setBackoffPolicy(linearBackoffPolicy())
|
|
97
124
|
* (async () => {
|
|
98
125
|
* // Will log "A" 3 times and then retry error will be thrown.
|
|
99
126
|
* await promise;
|
|
100
127
|
* })();
|
|
101
128
|
* ```
|
|
102
129
|
*/
|
|
103
|
-
|
|
130
|
+
setBackoffPolicy(policy: BackoffPolicy | null): this;
|
|
104
131
|
/**
|
|
105
|
-
* The <i>
|
|
132
|
+
* The <i>setRetryPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
|
|
106
133
|
* @example
|
|
107
134
|
* ```ts
|
|
108
135
|
* import { LazyPromise } from "@daiso-tech/core";
|
|
@@ -114,18 +141,18 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
114
141
|
* console.log("A");
|
|
115
142
|
* throw new Error("Error occured!");
|
|
116
143
|
* })
|
|
117
|
-
* .
|
|
144
|
+
* .setRetryAttempts(3)
|
|
118
145
|
* // Will only retry an error that is instance ErrorA
|
|
119
|
-
* .
|
|
146
|
+
* .setRetryPolicy(error => error instanceof ErrorA)
|
|
120
147
|
* (async () => {
|
|
121
148
|
* // Will log "A" 1 time and then error will be thrown.
|
|
122
149
|
* await promise;
|
|
123
150
|
* })();
|
|
124
151
|
* ```
|
|
125
152
|
*/
|
|
126
|
-
|
|
153
|
+
setRetryPolicy(policy: RetryPolicy | null): this;
|
|
127
154
|
/**
|
|
128
|
-
* The <i>
|
|
155
|
+
* The <i>setTimeout</i> method aborts the <i>LazyPromise</i> if it exceeds the given <i>time</i> by throwning an error.
|
|
129
156
|
* @example
|
|
130
157
|
* ```ts
|
|
131
158
|
* import { LazyPromise, delay, TimeSpan } from "@daiso-tech/core";
|
|
@@ -134,16 +161,16 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
134
161
|
* new LazyPromise(async () => {
|
|
135
162
|
* await delay(TimeSpan.fromMinutes(1));
|
|
136
163
|
* })
|
|
137
|
-
* .
|
|
164
|
+
* .setTimeout(TimeSpan.fromSeconds(1));
|
|
138
165
|
* (async () => {
|
|
139
166
|
* // An timeout error will be thrown.
|
|
140
167
|
* await promise;
|
|
141
168
|
* })();
|
|
142
169
|
* ```
|
|
143
170
|
*/
|
|
144
|
-
|
|
171
|
+
setTimeout(time: TimeSpan | null): this;
|
|
145
172
|
/**
|
|
146
|
-
* The <i>
|
|
173
|
+
* The <i>setAbortSignal</i> method aborts the <i>LazyPromise</i> by the passed in <i>abortSignal</i>.
|
|
147
174
|
* @example
|
|
148
175
|
* ```ts
|
|
149
176
|
* import { LazyPromise, delay, TimeSpan } from "@daiso-tech/core";
|
|
@@ -153,7 +180,7 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
153
180
|
* new LazyPromise(async () => {
|
|
154
181
|
* await delay(TimeSpan.fromMinutes(1));
|
|
155
182
|
* })
|
|
156
|
-
* .
|
|
183
|
+
* .setAbortSignal(abortController.signal);
|
|
157
184
|
* (async () => {
|
|
158
185
|
* setTimeout(() => {
|
|
159
186
|
* abortController.abort();
|
|
@@ -163,7 +190,7 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
163
190
|
* })();
|
|
164
191
|
* ```
|
|
165
192
|
*/
|
|
166
|
-
|
|
193
|
+
setAbortSignal(abortSignal: AbortSignal | null): this;
|
|
167
194
|
/**
|
|
168
195
|
* The <i>defer</i> method executes the <i>LazyPromise</i> without awaiting it.
|
|
169
196
|
* @example
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
|
-
import type { TimeSpan } from "../../utilities/_module";
|
|
4
|
+
import type { OneOrMore, TimeSpan } from "../../utilities/_module";
|
|
5
5
|
/**
|
|
6
6
|
* The <i>ICacheAdapter</i> contract defines a way for storing data as key-value pairs independent of data storage.
|
|
7
7
|
* This interface is not meant to be used directly, instead you should use <i>ICache</i>
|
|
@@ -9,12 +9,16 @@ import type { TimeSpan } from "../../utilities/_module";
|
|
|
9
9
|
*/
|
|
10
10
|
export type ICacheAdapter<TType = unknown> = {
|
|
11
11
|
/**
|
|
12
|
-
* The <i>
|
|
12
|
+
* The <i>exists</i> returns true if the <i>key</i> if exists otherwise false will be returned.
|
|
13
|
+
*/
|
|
14
|
+
exists(key: string): PromiseLike<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* The <i>get</i> returns the <i>key</i> value if found otherwise null will be returned.
|
|
13
17
|
*/
|
|
14
18
|
get(key: string): PromiseLike<TType | null>;
|
|
15
19
|
/**
|
|
16
20
|
* 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.
|
|
17
|
-
* You
|
|
21
|
+
* You must provide a <i>ttl</i> value. If null is passed, the item will not expire.
|
|
18
22
|
*/
|
|
19
23
|
add(key: string, value: TType, ttl: TimeSpan | null): PromiseLike<boolean>;
|
|
20
24
|
/**
|
|
@@ -22,8 +26,9 @@ export type ICacheAdapter<TType = unknown> = {
|
|
|
22
26
|
*/
|
|
23
27
|
update(key: string, value: TType): PromiseLike<boolean>;
|
|
24
28
|
/**
|
|
25
|
-
* The <i>put</i> method replaces a <i>key</i>
|
|
26
|
-
*
|
|
29
|
+
* The <i>put</i> method replaces a <i>key</i> if the <i>key</i> exists including the ttl value or adds <i>key</i> that do not exists with a given <i>ttl</i>.
|
|
30
|
+
* Returns true if the <i>key</i> where replaced otherwise false is returned.
|
|
31
|
+
* You must provide a <i>ttl</i> value. If null is passed, the item will not expire.
|
|
27
32
|
*/
|
|
28
33
|
put(key: string, value: TType, ttl: TimeSpan | null): PromiseLike<boolean>;
|
|
29
34
|
/**
|
|
@@ -40,5 +45,14 @@ export type ICacheAdapter<TType = unknown> = {
|
|
|
40
45
|
/**
|
|
41
46
|
* The <i>clear</i> method removes all keys that starts <i>prefix</i>.
|
|
42
47
|
*/
|
|
43
|
-
clear(
|
|
48
|
+
clear(): PromiseLike<void>;
|
|
49
|
+
/**
|
|
50
|
+
* The <i>getGroup</i> method returns the group name.
|
|
51
|
+
*/
|
|
52
|
+
getGroup(): string;
|
|
53
|
+
/**
|
|
54
|
+
* The <i>withGroup</i> method returns a new <i>{@link ICacheAdapter}</i> instance that groups keys together.
|
|
55
|
+
* Only keys in the group can be updated, removed, or retrieved, leaving keys outside the group unaffected.
|
|
56
|
+
*/
|
|
57
|
+
withGroup(group: OneOrMore<string>): ICacheAdapter<TType>;
|
|
44
58
|
};
|