@daiso-tech/core 0.16.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/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 +16 -22
- 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.map +1 -1
- 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 +7 -5
- 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 +18 -14
- 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 +11 -3
- 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 +21 -8
- package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-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 +27 -20
- 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 +19 -15
- 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 -1
- 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 -15
- 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 +104 -93
- package/dist/cjs/cache/implementations/derivables/cache.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 +20 -11
- package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- 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 +52 -36
- 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 +156 -120
- package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.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 +17 -9
- 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 +3 -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/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 -1
- 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 +9 -5
- package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- 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 -16
- 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 +74 -62
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/cjs/serde/contracts/_module.js +4 -0
- package/dist/cjs/serde/contracts/_module.js.map +1 -1
- 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/serializable.contract.js +3 -0
- package/dist/cjs/serde/contracts/serializable.contract.js.map +1 -0
- package/dist/cjs/serde/contracts/serializer.contract.js +3 -0
- package/dist/cjs/serde/contracts/serializer.contract.js.map +1 -0
- package/dist/cjs/serde/implementations/_module.js +1 -0
- package/dist/cjs/serde/implementations/_module.js.map +1 -1
- package/dist/cjs/serde/implementations/_shared/test-utilities/_module.js +1 -0
- package/dist/cjs/serde/implementations/_shared/test-utilities/_module.js.map +1 -1
- 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/serde/implementations/_shared/test-utilities/serde.test-suite.js +35 -60
- package/dist/cjs/serde/implementations/_shared/test-utilities/serde.test-suite.js.map +1 -1
- package/dist/cjs/serde/implementations/no-op-serde/_module.js +18 -0
- 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/serde/implementations/super-json-serde/super-json-serde.js +5 -2
- package/dist/cjs/serde/implementations/super-json-serde/super-json-serde.js.map +1 -1
- 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 +4 -0
- package/dist/cjs/utilities/functions.js.map +1 -1
- package/dist/cjs/utilities/time-span/time-span.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 +16 -22
- 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.map +1 -1
- 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 +7 -5
- 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 +17 -13
- 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 +11 -3
- 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 +21 -8
- package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-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 +28 -21
- 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 +17 -13
- 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 -1
- 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 -16
- 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 +82 -71
- package/dist/esm/cache/implementations/derivables/cache.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 +20 -11
- package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- 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 +45 -29
- 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 +143 -107
- package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.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 +17 -9
- 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 +3 -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 +2 -1
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js.map +1 -1
- 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 +10 -6
- package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- 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 -17
- 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 +76 -64
- package/dist/esm/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/esm/serde/contracts/_module.js +4 -0
- package/dist/esm/serde/contracts/_module.js.map +1 -1
- 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/serializable.contract.js +1 -0
- package/dist/esm/serde/contracts/serializable.contract.js.map +1 -0
- package/dist/esm/serde/contracts/serializer.contract.js +1 -0
- package/dist/esm/serde/contracts/serializer.contract.js.map +1 -0
- package/dist/esm/serde/implementations/_module.js +1 -0
- package/dist/esm/serde/implementations/_module.js.map +1 -1
- package/dist/esm/serde/implementations/_shared/test-utilities/_module.js +1 -0
- package/dist/esm/serde/implementations/_shared/test-utilities/_module.js.map +1 -1
- 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/serde/implementations/_shared/test-utilities/serde.test-suite.js +35 -60
- package/dist/esm/serde/implementations/_shared/test-utilities/serde.test-suite.js.map +1 -1
- 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/super-json-serde/super-json-serde.js +5 -2
- package/dist/esm/serde/implementations/super-json-serde/super-json-serde.js.map +1 -1
- 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 +3 -0
- package/dist/esm/utilities/functions.js.map +1 -1
- package/dist/esm/utilities/time-span/time-span.js.map +1 -1
- 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 +36 -46
- package/dist/types/cache/contracts/cache-factory.contract.d.ts +10 -23
- package/dist/types/cache/contracts/cache.contract.d.ts +365 -8
- package/dist/types/cache/contracts/cache.events.d.ts +156 -38
- package/dist/types/cache/implementations/_shared/_module.d.ts +1 -0
- package/dist/types/cache/implementations/_shared/cache-adapter.test-suite.d.ts +10 -8
- package/dist/types/cache/implementations/_shared/cache.test-suite.d.ts +15 -9
- package/dist/types/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +4 -3
- 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 +49 -37
- 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 +41 -17
- 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 +59 -45
- package/dist/types/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +1 -1
- 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 +41 -26
- 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 +49 -37
- package/dist/types/cache/implementations/derivables/_module.d.ts +3 -1
- package/dist/types/cache/implementations/derivables/cache-factory-settings.d.ts +77 -0
- package/dist/types/cache/implementations/derivables/cache-factory.d.ts +59 -39
- package/dist/types/cache/implementations/derivables/cache-settings.d.ts +68 -0
- package/dist/types/cache/implementations/derivables/cache.d.ts +65 -36
- 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-retry-iterable.d.ts +1 -1
- package/dist/types/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +190 -4
- package/dist/types/collection/implementations/iterable-collection/iterable-collection.d.ts +138 -1
- package/dist/types/collection/implementations/list-collection/list-collection.d.ts +138 -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 +4 -6
- package/dist/types/event-bus/contracts/event-bus-factory.contract.d.ts +37 -31
- package/dist/types/event-bus/contracts/event-bus.contract.d.ts +24 -32
- package/dist/types/event-bus/implementations/_shared/event-bus-adapter.test-suite.d.ts +6 -3
- package/dist/types/event-bus/implementations/_shared/event-bus.test-suite.d.ts +10 -7
- 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 +48 -22
- package/dist/types/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +4 -4
- package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.d.ts +2 -1
- 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 +43 -31
- 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 +39 -22
- 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 +34 -22
- package/dist/types/serde/contracts/_module.d.ts +4 -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 +5 -36
- 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 +1 -0
- package/dist/types/serde/implementations/_shared/test-utilities/_module.d.ts +1 -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 +2 -3
- 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/super-json-serde/super-json-serde.d.ts +1 -1
- 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 +4 -0
- package/dist/types/utilities/time-span/time-span.d.ts +2 -2
- package/dist/types/utilities/types.d.ts +0 -1
- package/package.json +1 -1
|
@@ -5,26 +5,212 @@ import type { EnsureMap, EnsureRecord } from "../../../collection/contracts/_mod
|
|
|
5
5
|
import { type AsyncCollapse, type AsyncPredicate, type AsyncForEach, type AsyncMap, type AsyncModifier, type AsyncTap, type AsyncTransform, type Comparator, type IAsyncCollection, type AsyncReduce, type CrossJoinResult } from "../../../collection/contracts/_module";
|
|
6
6
|
import { type AsyncIterableValue, type AsyncLazyable } from "../../../utilities/_module";
|
|
7
7
|
import type { TimeSpan } from "../../../utilities/_module";
|
|
8
|
-
import type {
|
|
8
|
+
import type { BackoffPolicy, RetryPolicy } from "../../../async/_module";
|
|
9
9
|
import { LazyPromise } from "../../../async/_module";
|
|
10
|
+
/**
|
|
11
|
+
* @group Adapters
|
|
12
|
+
*/
|
|
13
|
+
export type AsyncIterableCollectionSettings = {
|
|
14
|
+
/**
|
|
15
|
+
* The default retry attempt to use in the returned <i>LazyPromise</i>.
|
|
16
|
+
*/
|
|
17
|
+
retryAttempts?: number | null;
|
|
18
|
+
/**
|
|
19
|
+
* The default backof policy to use in the returned <i>LazyPromise</i>.
|
|
20
|
+
*/
|
|
21
|
+
backoffPolicy?: BackoffPolicy | null;
|
|
22
|
+
/**
|
|
23
|
+
* The default retry policy to use in the returned <i>LazyPromise</i>.
|
|
24
|
+
*/
|
|
25
|
+
retryPolicy?: RetryPolicy | null;
|
|
26
|
+
/**
|
|
27
|
+
* The default timeout to use in the returned <i>LazyPromise</i>.
|
|
28
|
+
*/
|
|
29
|
+
timeout?: TimeSpan | null;
|
|
30
|
+
};
|
|
10
31
|
/**
|
|
11
32
|
* All methods that return <i>{@link IAsyncCollection}</i> are executed lazly.
|
|
12
33
|
* The methods that return <i>{@link IAsyncCollection}</i> will only be executed when <i>forEach</i> method is called or <i>for await</i> loop.
|
|
13
34
|
* The methods that return <i>{@link PromiseLike}</i> object will execute only when awaited or <i>then</i> method is called.
|
|
14
35
|
* @group Adapters
|
|
15
36
|
*/
|
|
16
|
-
export declare class AsyncIterableCollection<TInput> implements IAsyncCollection<TInput> {
|
|
37
|
+
export declare class AsyncIterableCollection<TInput = unknown> implements IAsyncCollection<TInput> {
|
|
17
38
|
private readonly iterable;
|
|
18
|
-
|
|
39
|
+
/**
|
|
40
|
+
* The <i>concat<i> static method is a convenient utility for easily concatenating multiple <i>{@link Iterable}</i> or <i>{@link AsyncIterable}</i>.
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";
|
|
44
|
+
*
|
|
45
|
+
* class MyAsyncIterable implements AsyncIterable<number> {
|
|
46
|
+
* async *[Symbol.iterator](): Iterator<number> {
|
|
47
|
+
* yield "a";
|
|
48
|
+
* yield "b";
|
|
49
|
+
* yield "c";
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
*
|
|
53
|
+
* class MyIterable implements Iterable<number> {
|
|
54
|
+
* *[Symbol.iterator](): Iterator<number> {
|
|
55
|
+
* yield 1;
|
|
56
|
+
* yield 2;
|
|
57
|
+
* yield 3;
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* const collection = AsyncIterableCollection.concat([
|
|
62
|
+
* new MyAsyncIterable(),
|
|
63
|
+
* new MyIterable(),
|
|
64
|
+
* new Set([1, 2, 3]),
|
|
65
|
+
* new Map([["a", 1], ["b", 2]]),
|
|
66
|
+
* ["a", "b", "c"]
|
|
67
|
+
* ]);
|
|
68
|
+
* await collection.toArray();
|
|
69
|
+
* // ["a", "b", "c", 1, 2, 3, 1, 2, 3, ["a", 1], ["b", 2], "a", "b", "c"]
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
19
72
|
static concat<TValue>(iterables: AsyncIterableValue<AsyncIterableValue<TValue>>): IAsyncCollection<TValue>;
|
|
73
|
+
/**
|
|
74
|
+
* The <i>difference</i> static method is used to compute the difference between two <i>{@link Iterable}</i> instances. By default, the equality check is performed on each item.
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";
|
|
78
|
+
*
|
|
79
|
+
* const collection = AsyncIterableCollection.difference(
|
|
80
|
+
* [1, 2, 2, 3, 4, 5],
|
|
81
|
+
* [2, 4, 6, 8]
|
|
82
|
+
* );
|
|
83
|
+
* await collection.toArray();
|
|
84
|
+
* // [1, 3, 5]
|
|
85
|
+
* ```
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";
|
|
89
|
+
*
|
|
90
|
+
* const collection = AsyncIterableCollection.difference(
|
|
91
|
+
* [
|
|
92
|
+
* { name: "iPhone 6", brand: "Apple", type: "phone" },
|
|
93
|
+
* { name: "iPhone 5", brand: "Apple", type: "phone" },
|
|
94
|
+
* { name: "Apple Watch", brand: "Apple", type: "watch" },
|
|
95
|
+
* { name: "Galaxy S6", brand: "Samsung", type: "phone" },
|
|
96
|
+
* { name: "Galaxy Gear", brand: "Samsung", type: "watch" },
|
|
97
|
+
* ],
|
|
98
|
+
* [
|
|
99
|
+
* { name: "Apple Watch", brand: "Apple", type: "watch" },
|
|
100
|
+
* ],
|
|
101
|
+
* (product) => product.type
|
|
102
|
+
* );
|
|
103
|
+
* await collection.toArray();
|
|
104
|
+
* // [
|
|
105
|
+
* // { name: "iPhone 6", brand: "Apple", type: "phone" },
|
|
106
|
+
* // { name: "iPhone 5", brand: "Apple", type: "phone" },
|
|
107
|
+
* // { name: "Galaxy S6", brand: "Samsung", type: "phone" },
|
|
108
|
+
* // ]
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
20
111
|
static difference<TValue, TSelect>(iterableA: AsyncIterableValue<TValue>, iterableB: AsyncIterableValue<TValue>, selectFn?: AsyncMap<TValue, IAsyncCollection<TValue>, TSelect>): IAsyncCollection<TValue>;
|
|
112
|
+
/**
|
|
113
|
+
* The <i>zip</i> static method merges together the values of <i>iterableA</i> with the values of the <i>iterableB</i> at their corresponding index.
|
|
114
|
+
* The returned collection has size of the shortest collection.
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";;
|
|
118
|
+
*
|
|
119
|
+
* const collection = AsyncIterableCollection.zip(["Chair", "Desk"], [100, 200]);
|
|
120
|
+
* await collection.toArray();
|
|
121
|
+
* // [["Chair", 100], ["Desk", 200]]
|
|
122
|
+
* ```
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";;
|
|
126
|
+
*
|
|
127
|
+
* const collection = AsyncIterableCollection.zip(["Chair", "Desk", "Couch"], [100, 200]);
|
|
128
|
+
* await collection.toArray();
|
|
129
|
+
* // [["Chair", 100], ["Desk", 200]]
|
|
130
|
+
* ```
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";;
|
|
134
|
+
*
|
|
135
|
+
* const collection = AsyncIterableCollection.zip(["Chair", "Desk"], [100, 200, 300]);
|
|
136
|
+
* await collection.toArray();
|
|
137
|
+
* // [["Chair", 100], ["Desk", 200]]
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
21
140
|
static zip<TValueA, TValueB>(iterableA: AsyncIterableValue<TValueA>, iterableB: AsyncIterableValue<TValueB>): IAsyncCollection<[TValueA, TValueB]>;
|
|
22
141
|
private static DEFAULT_CHUNK_SIZE;
|
|
142
|
+
private static defaultRetryPolicy;
|
|
23
143
|
private static makeCollection;
|
|
144
|
+
private readonly retryAttempts;
|
|
145
|
+
private readonly backoffPolicy;
|
|
146
|
+
private readonly retryPolicy;
|
|
147
|
+
private readonly timeout;
|
|
24
148
|
/**
|
|
25
149
|
* The <i>constructor</i> takes an <i>{@link Iterable}</i> or <i>{@link AsyncIterable}</i>.
|
|
150
|
+
*
|
|
151
|
+
* Works with <i>Array</i>.
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";
|
|
155
|
+
*
|
|
156
|
+
* const collection = new AsyncIterableCollection([1, 2, 3, 4]);
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* Works with <i>String</i>.
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";
|
|
163
|
+
*
|
|
164
|
+
* const collection = new AsyncIterableCollection("ABCDE");
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* Works with <i>Set</i>.
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";
|
|
171
|
+
*
|
|
172
|
+
* const collection = new AsyncIterableCollection(new Set([1, 2, 2 4]));
|
|
173
|
+
* ```
|
|
174
|
+
*
|
|
175
|
+
* Works with <i>Map</i>.
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";
|
|
179
|
+
*
|
|
180
|
+
* const collection = new AsyncIterableCollection(new Map([["a", 1], ["b", 2]]));
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* Works with any <i>Iterable</i>.
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";
|
|
187
|
+
*
|
|
188
|
+
* class MyIterable implements Iterable<number> {
|
|
189
|
+
* *[Symbol.iterator](): Iterator<number> {
|
|
190
|
+
* yield 1;
|
|
191
|
+
* yield 2;
|
|
192
|
+
* yield 3;
|
|
193
|
+
* }
|
|
194
|
+
* }
|
|
195
|
+
* const collection = new AsyncIterableCollection(new MyIterable());
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* Works with any <i>AsyncIterable</i>.
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";
|
|
202
|
+
*
|
|
203
|
+
* class MyIterable implements AsyncIterable<number> {
|
|
204
|
+
* async *[Symbol.iterator](): Iterator<number> {
|
|
205
|
+
* yield 1;
|
|
206
|
+
* yield 2;
|
|
207
|
+
* yield 3;
|
|
208
|
+
* }
|
|
209
|
+
* }
|
|
210
|
+
* const collection = new AsyncIterableCollection(new MyIterable());
|
|
211
|
+
* ```
|
|
26
212
|
*/
|
|
27
|
-
constructor(iterable?: AsyncIterableValue<TInput>, settings?:
|
|
213
|
+
constructor(iterable?: AsyncIterableValue<TInput>, settings?: AsyncIterableCollectionSettings);
|
|
28
214
|
private createLazyPromise;
|
|
29
215
|
[Symbol.asyncIterator](): AsyncIterator<TInput>;
|
|
30
216
|
toIterator(): AsyncIterator<TInput, void>;
|
|
@@ -9,15 +9,152 @@ import { type Lazyable } from "../../../utilities/_module";
|
|
|
9
9
|
* The rest of the methods are executed eagerly.
|
|
10
10
|
* @group Adapters
|
|
11
11
|
*/
|
|
12
|
-
export declare class IterableCollection<TInput> implements ICollection<TInput> {
|
|
12
|
+
export declare class IterableCollection<TInput = unknown> implements ICollection<TInput> {
|
|
13
13
|
private readonly iterable;
|
|
14
|
+
/**
|
|
15
|
+
* The <i>concat<i> static method is a convenient utility for easily concatenating multiple <i>{@link Iterable}</i>.
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { IterableCollection } from "@daiso-tech/core";
|
|
19
|
+
*
|
|
20
|
+
* class MyIterable implements Iterable<number> {
|
|
21
|
+
* *[Symbol.iterator](): Iterator<number> {
|
|
22
|
+
* yield 1;
|
|
23
|
+
* yield 2;
|
|
24
|
+
* yield 3;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* const collection = IterableCollection.concat([
|
|
29
|
+
* new MyIterable(),
|
|
30
|
+
* new Set([1, 2, 3]),
|
|
31
|
+
* new Map([["a", 1], ["b", 2]]),
|
|
32
|
+
* ["a", "b", "c"]
|
|
33
|
+
* ]);
|
|
34
|
+
* collection.toArray();
|
|
35
|
+
* // [1, 2, 3, 1, 2, 3, ["a", 1], ["b", 2], "a", "b", "c"]
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
14
38
|
static concat<TValue>(iterables: Iterable<Iterable<TValue>>): ICollection<TValue>;
|
|
39
|
+
/**
|
|
40
|
+
* The <i>difference</i> static method is used to compute the difference between two <i>{@link Iterable}</i> instances. By default, the equality check is performed on each item.
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { IterableCollection } from "@daiso-tech/core";
|
|
44
|
+
*
|
|
45
|
+
* const collection = IterableCollection.difference(
|
|
46
|
+
* [1, 2, 2, 3, 4, 5],
|
|
47
|
+
* [2, 4, 6, 8]
|
|
48
|
+
* );
|
|
49
|
+
* collection.toArray();
|
|
50
|
+
* // [1, 3, 5]
|
|
51
|
+
* ```
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { IterableCollection } from "@daiso-tech/core";
|
|
55
|
+
*
|
|
56
|
+
* const collection = IterableCollection.difference(
|
|
57
|
+
* [
|
|
58
|
+
* { name: "iPhone 6", brand: "Apple", type: "phone" },
|
|
59
|
+
* { name: "iPhone 5", brand: "Apple", type: "phone" },
|
|
60
|
+
* { name: "Apple Watch", brand: "Apple", type: "watch" },
|
|
61
|
+
* { name: "Galaxy S6", brand: "Samsung", type: "phone" },
|
|
62
|
+
* { name: "Galaxy Gear", brand: "Samsung", type: "watch" },
|
|
63
|
+
* ],
|
|
64
|
+
* [
|
|
65
|
+
* { name: "Apple Watch", brand: "Apple", type: "watch" },
|
|
66
|
+
* ],
|
|
67
|
+
* (product) => product.type
|
|
68
|
+
* );
|
|
69
|
+
* collection.toArray();
|
|
70
|
+
* // [
|
|
71
|
+
* // { name: "iPhone 6", brand: "Apple", type: "phone" },
|
|
72
|
+
* // { name: "iPhone 5", brand: "Apple", type: "phone" },
|
|
73
|
+
* // { name: "Galaxy S6", brand: "Samsung", type: "phone" },
|
|
74
|
+
* // ]
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
15
77
|
static difference<TValue, TSelect>(iterableA: Iterable<TValue>, iterableB: Iterable<TValue>, selectFn?: Map<TValue, ICollection<TValue>, TSelect>): ICollection<TValue>;
|
|
78
|
+
/**
|
|
79
|
+
* The <i>zip</i> static method merges together the values of <i>iterableA</i> with the values of the <i>iterableB</i> at their corresponding index.
|
|
80
|
+
* The returned collection has size of the shortest collection.
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { IterableCollection } from "@daiso-tech/core";;
|
|
84
|
+
*
|
|
85
|
+
* const collection = IterableCollection.zip(["Chair", "Desk"], [100, 200]);
|
|
86
|
+
* collection.toArray();
|
|
87
|
+
* // [["Chair", 100], ["Desk", 200]]
|
|
88
|
+
* ```
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import { IterableCollection } from "@daiso-tech/core";;
|
|
92
|
+
*
|
|
93
|
+
* const collection = IterableCollection.zip(["Chair", "Desk", "Couch"], [100, 200]);
|
|
94
|
+
* collection.toArray();
|
|
95
|
+
* // [["Chair", 100], ["Desk", 200]]
|
|
96
|
+
* ```
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* import { IterableCollection } from "@daiso-tech/core";;
|
|
100
|
+
*
|
|
101
|
+
* const collection = IterableCollection.zip(["Chair", "Desk"], [100, 200, 300]);
|
|
102
|
+
* collection.toArray();
|
|
103
|
+
* // [["Chair", 100], ["Desk", 200]]
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
16
106
|
static zip<TValueA, TValueB>(iterableA: Iterable<TValueA>, iterableB: Iterable<TValueB>): ICollection<[TValueA, TValueB]>;
|
|
17
107
|
private static DEFAULT_CHUNK_SIZE;
|
|
18
108
|
private static makeCollection;
|
|
19
109
|
/**
|
|
20
110
|
* The <i>constructor</i> takes an <i>{@link Iterable}</i>.
|
|
111
|
+
*
|
|
112
|
+
* Works with <i>Array</i>.
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* import { IterableCollection } from "@daiso-tech/core";
|
|
116
|
+
*
|
|
117
|
+
* const collection = new IterableCollection([1, 2, 3, 4]);
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* Works with <i>String</i>.
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { IterableCollection } from "@daiso-tech/core";
|
|
124
|
+
*
|
|
125
|
+
* const collection = new IterableCollection("ABCDE");
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* Works with <i>Set</i>.
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* import { IterableCollection } from "@daiso-tech/core";
|
|
132
|
+
*
|
|
133
|
+
* const collection = new IterableCollection(new Set([1, 2, 2 4]));
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* Works with <i>Map</i>.
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* import { IterableCollection } from "@daiso-tech/core";
|
|
140
|
+
*
|
|
141
|
+
* const collection = new IterableCollection(new Map([["a", 1], ["b", 2]]));
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* Works with any <i>Iterable</i>.
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* import { IterableCollection } from "@daiso-tech/core";
|
|
148
|
+
*
|
|
149
|
+
* class MyIterable implements Iterable<number> {
|
|
150
|
+
* *[Symbol.iterator](): Iterator<number> {
|
|
151
|
+
* yield 1;
|
|
152
|
+
* yield 2;
|
|
153
|
+
* yield 3;
|
|
154
|
+
* }
|
|
155
|
+
* }
|
|
156
|
+
* const collection = new IterableCollection(new MyIterable());
|
|
157
|
+
* ```
|
|
21
158
|
*/
|
|
22
159
|
constructor(iterable: Iterable<TInput>);
|
|
23
160
|
[Symbol.iterator](): Iterator<TInput>;
|
|
@@ -8,13 +8,150 @@ import { type Lazyable } from "../../../utilities/_module";
|
|
|
8
8
|
* All methods in <i>ListCollection</i> are executed eagerly.
|
|
9
9
|
* @group Adapters
|
|
10
10
|
*/
|
|
11
|
-
export declare class ListCollection<TInput> implements ICollection<TInput> {
|
|
11
|
+
export declare class ListCollection<TInput = unknown> implements ICollection<TInput> {
|
|
12
|
+
/**
|
|
13
|
+
* The <i>concat<i> static method is a convenient utility for easily concatenating multiple <i>{@link Iterable}</i>.
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { ListCollection } from "@daiso-tech/core";
|
|
17
|
+
*
|
|
18
|
+
* class MyIterable implements Iterable<number> {
|
|
19
|
+
* *[Symbol.iterator](): Iterator<number> {
|
|
20
|
+
* yield 1;
|
|
21
|
+
* yield 2;
|
|
22
|
+
* yield 3;
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* const collection = ListCollection.concat([
|
|
27
|
+
* new MyIterable(),
|
|
28
|
+
* new Set([1, 2, 3]),
|
|
29
|
+
* new Map([["a", 1], ["b", 2]]),
|
|
30
|
+
* ["a", "b", "c"]
|
|
31
|
+
* ]);
|
|
32
|
+
* collection.toArray();
|
|
33
|
+
* // [1, 2, 3, 1, 2, 3, ["a", 1], ["b", 2], "a", "b", "c"]
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
12
36
|
static concat<TValue>(iterables: Iterable<Iterable<TValue>>): ICollection<TValue>;
|
|
37
|
+
/**
|
|
38
|
+
* The <i>difference</i> static method is used to compute the difference between two <i>{@link Iterable}</i> instances. By default, the equality check is performed on each item.
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { ListCollection } from "@daiso-tech/core";
|
|
42
|
+
*
|
|
43
|
+
* const collection = ListCollection.difference(
|
|
44
|
+
* [1, 2, 2, 3, 4, 5],
|
|
45
|
+
* [2, 4, 6, 8]
|
|
46
|
+
* );
|
|
47
|
+
* collection.toArray();
|
|
48
|
+
* // [1, 3, 5]
|
|
49
|
+
* ```
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { ListCollection } from "@daiso-tech/core";
|
|
53
|
+
*
|
|
54
|
+
* const collection = ListCollection.difference(
|
|
55
|
+
* [
|
|
56
|
+
* { name: "iPhone 6", brand: "Apple", type: "phone" },
|
|
57
|
+
* { name: "iPhone 5", brand: "Apple", type: "phone" },
|
|
58
|
+
* { name: "Apple Watch", brand: "Apple", type: "watch" },
|
|
59
|
+
* { name: "Galaxy S6", brand: "Samsung", type: "phone" },
|
|
60
|
+
* { name: "Galaxy Gear", brand: "Samsung", type: "watch" },
|
|
61
|
+
* ],
|
|
62
|
+
* [
|
|
63
|
+
* { name: "Apple Watch", brand: "Apple", type: "watch" },
|
|
64
|
+
* ],
|
|
65
|
+
* (product) => product.type
|
|
66
|
+
* );
|
|
67
|
+
* collection.toArray();
|
|
68
|
+
* // [
|
|
69
|
+
* // { name: "iPhone 6", brand: "Apple", type: "phone" },
|
|
70
|
+
* // { name: "iPhone 5", brand: "Apple", type: "phone" },
|
|
71
|
+
* // { name: "Galaxy S6", brand: "Samsung", type: "phone" },
|
|
72
|
+
* // ]
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
13
75
|
static difference<TValue, TSelect>(iterableA: Iterable<TValue>, iterableB: Iterable<TValue>, selectFn?: Map<TValue, ICollection<TValue>, TSelect>): ICollection<TValue>;
|
|
76
|
+
/**
|
|
77
|
+
* The <i>zip</i> static method merges together the values of <i>iterableA</i> with the values of the <i>iterableB</i> at their corresponding index.
|
|
78
|
+
* The returned collection has size of the shortest collection.
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* import { ListCollection } from "@daiso-tech/core";;
|
|
82
|
+
*
|
|
83
|
+
* const collection = ListCollection.zip(["Chair", "Desk"], [100, 200]);
|
|
84
|
+
* collection.toArray();
|
|
85
|
+
* // [["Chair", 100], ["Desk", 200]]
|
|
86
|
+
* ```
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* import { ListCollection } from "@daiso-tech/core";;
|
|
90
|
+
*
|
|
91
|
+
* const collection = ListCollection.zip(["Chair", "Desk", "Couch"], [100, 200]);
|
|
92
|
+
* collection.toArray();
|
|
93
|
+
* // [["Chair", 100], ["Desk", 200]]
|
|
94
|
+
* ```
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* import { ListCollection } from "@daiso-tech/core";;
|
|
98
|
+
*
|
|
99
|
+
* const collection = ListCollection.zip(["Chair", "Desk"], [100, 200, 300]);
|
|
100
|
+
* collection.toArray();
|
|
101
|
+
* // [["Chair", 100], ["Desk", 200]]
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
14
104
|
static zip<TValueA, TValueB>(iterableA: Iterable<TValueA>, iterableB: Iterable<TValueB>): ICollection<[TValueA, TValueB]>;
|
|
15
105
|
private array;
|
|
16
106
|
/**
|
|
17
107
|
* The <i>constructor</i> takes an <i>{@link Iterable}</i>.
|
|
108
|
+
*
|
|
109
|
+
* Works with <i>Array</i>.
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* import { ListCollection } from "@daiso-tech/core";
|
|
113
|
+
*
|
|
114
|
+
* const collection = new ListCollection([1, 2, 3, 4]);
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* Works with <i>String</i>.
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { ListCollection } from "@daiso-tech/core";
|
|
121
|
+
*
|
|
122
|
+
* const collection = new ListCollection("ABCDE");
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* Works with <i>Set</i>.
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import { ListCollection } from "@daiso-tech/core";
|
|
129
|
+
*
|
|
130
|
+
* const collection = new ListCollection(new Set([1, 2, 2 4]));
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* Works with <i>Map</i>.
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* import { ListCollection } from "@daiso-tech/core";
|
|
137
|
+
*
|
|
138
|
+
* const collection = new ListCollection(new Map([["a", 1], ["b", 2]]));
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* Works with any <i>Iterable</i>.
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* import { ListCollection } from "@daiso-tech/core";
|
|
145
|
+
*
|
|
146
|
+
* class MyIterable implements Iterable<number> {
|
|
147
|
+
* *[Symbol.iterator](): Iterator<number> {
|
|
148
|
+
* yield 1;
|
|
149
|
+
* yield 2;
|
|
150
|
+
* yield 3;
|
|
151
|
+
* }
|
|
152
|
+
* }
|
|
153
|
+
* const collection = new ListCollection(new MyIterable());
|
|
154
|
+
* ```
|
|
18
155
|
*/
|
|
19
156
|
constructor(iterable?: Iterable<TInput>);
|
|
20
157
|
[Symbol.iterator](): Iterator<TInput>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "../../event-bus/contracts/_shared";
|
|
2
|
-
export * from "../../event-bus/contracts/event-bus.errors";
|
|
3
|
-
export * from "../../event-bus/contracts/event-bus.contract";
|
|
4
2
|
export * from "../../event-bus/contracts/event-bus-adapter.contract";
|
|
5
3
|
export * from "../../event-bus/contracts/event-bus-factory.contract";
|
|
4
|
+
export * from "../../event-bus/contracts/event-bus.contract";
|
|
5
|
+
export * from "../../event-bus/contracts/event-bus.errors";
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module EventBus
|
|
3
3
|
*/
|
|
4
|
+
import type { ISerializable } from "../../serde/contracts/_module";
|
|
4
5
|
import type { Promisable } from "../../utilities/_module";
|
|
6
|
+
/**
|
|
7
|
+
* @group Contracts
|
|
8
|
+
*/
|
|
5
9
|
export type Listener<TEvent> = (event: TEvent) => Promisable<void>;
|
|
10
|
+
/**
|
|
11
|
+
* @group Contracts
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class BaseEvent<TData extends Record<string, unknown> = Record<string, unknown>> implements ISerializable<TData> {
|
|
14
|
+
static deserialize(_serializedEvent: any): BaseEvent;
|
|
15
|
+
abstract serialize(): TData;
|
|
16
|
+
}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { Listener } from "../../event-bus/contracts/_shared";
|
|
5
5
|
import type { OneOrMore } from "../../utilities/_module";
|
|
6
|
-
|
|
7
|
-
type: string;
|
|
8
|
-
};
|
|
6
|
+
import type { BaseEvent } from "../../event-bus/contracts/_shared";
|
|
9
7
|
/**
|
|
10
8
|
* The <i>IEventBusAdapter</i> contract defines a way for dispatching and listening to events independent of underlying technology.
|
|
11
9
|
* This interface is not meant to be used directly, instead you should use <i>IEventBus</i>
|
|
@@ -15,15 +13,15 @@ export type IEventBusAdapter = {
|
|
|
15
13
|
/**
|
|
16
14
|
* The <i>addListener</i> method is used for adding <i>{@link Listener | listener}</i> for certain <i>eventName</i>.
|
|
17
15
|
*/
|
|
18
|
-
addListener(eventName: string, listener: Listener<
|
|
16
|
+
addListener(eventName: string, listener: Listener<BaseEvent>): PromiseLike<void>;
|
|
19
17
|
/**
|
|
20
18
|
* The <i>removeListener</i> method is used for removing <i>{@link Listener | listener}</i> for certain <i>eventName</i>.
|
|
21
19
|
*/
|
|
22
|
-
removeListener(eventName: string, listener: Listener<
|
|
20
|
+
removeListener(eventName: string, listener: Listener<BaseEvent>): PromiseLike<void>;
|
|
23
21
|
/**
|
|
24
22
|
* The <i>dispatch</i> method is used for dispatching one or multiple <i>events</i>.
|
|
25
23
|
*/
|
|
26
|
-
dispatch(
|
|
24
|
+
dispatch(eventName: string, eventData: BaseEvent): PromiseLike<void>;
|
|
27
25
|
getGroup(): string;
|
|
28
26
|
withGroup(group: OneOrMore<string>): IEventBusAdapter;
|
|
29
27
|
};
|
|
@@ -1,53 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module EventBus
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { IGroupableEventBus } from "../../event-bus/contracts/event-bus.contract";
|
|
5
|
+
import type { BaseEvent } from "../../event-bus/contracts/_shared";
|
|
5
6
|
/**
|
|
6
7
|
* The <i>IEventBusFactory</i> contract makes it easy to configure and switch between different <i>{@link IGroupableEventBus}</i> dynamically.
|
|
7
8
|
* @group Contracts
|
|
8
9
|
*/
|
|
9
|
-
export type IEventBusFactory<
|
|
10
|
+
export type IEventBusFactory<TAdapters extends string = string> = {
|
|
10
11
|
/**
|
|
11
|
-
* The <i>use</i> method will throw an error if you provide it unregisted
|
|
12
|
-
* If no default
|
|
13
|
-
* @throws {
|
|
14
|
-
* @throws {
|
|
12
|
+
* The <i>use</i> method will throw an error if you provide it unregisted adapter.
|
|
13
|
+
* If no default adapter is defined an error will be thrown by <i>use</i> method.
|
|
14
|
+
* @throws {UnregisteredAdapterError} {@link UnregisteredAdapterError}
|
|
15
|
+
* @throws {DefaultAdapterNotDefinedError} {@link DefaultAdapterNotDefinedError}
|
|
15
16
|
* @example
|
|
16
17
|
* ```ts
|
|
17
18
|
* import { type IEventBusFactory } from "@daiso-tech/core";
|
|
18
19
|
*
|
|
20
|
+
* type SerializedAddEvent = {
|
|
21
|
+
* a: number;
|
|
22
|
+
* b: number;
|
|
23
|
+
* };
|
|
24
|
+
*
|
|
25
|
+
* class AddEvent extends BaseEvent<SerializedAddEvent> {
|
|
26
|
+
* // This needed for adapters that need to deserialize like the redis dapter.
|
|
27
|
+
* static override deserialize({ a, b }: SerializedAddEvent): AddEvent {
|
|
28
|
+
* return new AddEvent(a, b);
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* constructor(public readonly a: number, public readonly b: number) {
|
|
32
|
+
* super();
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // This needed for adapters that need to serialize like the redis adapter.
|
|
36
|
+
* override serialize(): SerializedAddEvent {
|
|
37
|
+
* return {
|
|
38
|
+
* a: this.a,
|
|
39
|
+
* b: this.b
|
|
40
|
+
* };
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* // Asume the inputed eventFactory has registered both a memory and Redis IEventBusAdapter.
|
|
45
|
+
* // The memory IEventBusAdapter adapter is the default.
|
|
19
46
|
* async function main(eventFactory: IEventBusFactory): Promise<void> {
|
|
20
|
-
* // Will dispatch envent using the default
|
|
47
|
+
* // Will dispatch envent using the default adapter
|
|
21
48
|
* await eventBusFactory
|
|
22
49
|
* .use()
|
|
23
|
-
* .dispatch(
|
|
50
|
+
* .dispatch(new AddEvent(1, 2));
|
|
24
51
|
* // Will dispatch envent using the redis addapter
|
|
25
52
|
* await eventBusFactory
|
|
26
53
|
* .use("redis")
|
|
27
|
-
* .dispatch(
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
use(driverName?: TDrivers): IGroupableEventBus<TEvents>;
|
|
32
|
-
/**
|
|
33
|
-
* The <i>withTypes</i> method is used to set the event types of the <i>{@link IEventBus}</i>.
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* import { type IEventBusFactory } from "@daiso-tech/core";
|
|
37
|
-
*
|
|
38
|
-
* async function main(eventBusFactory: IEventBusFactory): Promise<void> {
|
|
39
|
-
* type AddEvent = {
|
|
40
|
-
* type: "add";
|
|
41
|
-
* a: number;
|
|
42
|
-
* b: number;
|
|
43
|
-
* };
|
|
44
|
-
* await eventBusFactory
|
|
45
|
-
* .withTypes<AddEvent>()
|
|
46
|
-
* .use()
|
|
47
|
-
* // You will se an typescript error
|
|
48
|
-
* .dispatch({ type: "add" });
|
|
54
|
+
* .dispatch(new AddEvent(1, 2));
|
|
49
55
|
* }
|
|
50
56
|
* ```
|
|
51
57
|
*/
|
|
52
|
-
|
|
58
|
+
use<TEvents extends BaseEvent = BaseEvent>(adapterName?: TAdapters): IGroupableEventBus<TEvents>;
|
|
53
59
|
};
|