@daiso-tech/core 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/async/utilities/delay/delay.d.ts +1 -12
- package/dist/async/utilities/delay/delay.js +1 -12
- package/dist/async/utilities/delay/delay.js.map +1 -1
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +99 -65
- package/dist/async/utilities/lazy-promise/lazy-promise.js +151 -111
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/cache/contracts/_module-exports.d.ts +1 -0
- package/dist/cache/contracts/_module-exports.js +1 -0
- package/dist/cache/contracts/_module-exports.js.map +1 -1
- package/dist/cache/contracts/cache-adapter.contract.d.ts +19 -21
- package/dist/cache/contracts/cache-adapter.contract.js +1 -4
- package/dist/cache/contracts/cache-adapter.contract.js.map +1 -1
- package/dist/cache/contracts/cache-factory.contract.d.ts +1 -1
- package/dist/cache/contracts/cache.contract.d.ts +52 -88
- package/dist/cache/contracts/cache.contract.js +1 -2
- package/dist/cache/contracts/cache.contract.js.map +1 -1
- package/dist/cache/contracts/cache.errors.js +2 -5
- package/dist/cache/contracts/cache.errors.js.map +1 -1
- package/dist/cache/contracts/cache.events.d.ts +10 -10
- package/dist/cache/contracts/cache.events.js +2 -5
- package/dist/cache/contracts/cache.events.js.map +1 -1
- package/dist/cache/contracts/database-cache-adapter.contract.d.ts +89 -0
- package/dist/cache/contracts/database-cache-adapter.contract.js +5 -0
- package/dist/cache/contracts/database-cache-adapter.contract.js.map +1 -0
- package/dist/cache/implementations/adapters/_module-exports.d.ts +0 -1
- package/dist/cache/implementations/adapters/_module-exports.js +0 -1
- package/dist/cache/implementations/adapters/_module-exports.js.map +1 -1
- package/dist/cache/implementations/adapters/{kysely-sqlite-cache-adapter → kysely-cache-adapter}/_module.d.ts +1 -1
- package/dist/cache/implementations/adapters/kysely-cache-adapter/_module.js +2 -0
- package/dist/cache/implementations/adapters/kysely-cache-adapter/_module.js.map +1 -0
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.d.ts +73 -0
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js +224 -0
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js.map +1 -0
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +29 -39
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +45 -54
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +17 -33
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +43 -52
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.d.ts +13 -0
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.js +38 -0
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.js.map +1 -0
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +27 -33
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +145 -197
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.d.ts +13 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.js +39 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.js.map +1 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +16 -22
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +51 -132
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.d.ts +13 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.js +69 -0
- package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.js.map +1 -0
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +29 -40
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +46 -55
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/_module-exports.d.ts +1 -1
- package/dist/cache/implementations/derivables/_module-exports.js +1 -1
- package/dist/cache/implementations/derivables/_module-exports.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/_module.d.ts +1 -0
- package/dist/cache/implementations/derivables/cache/_module.js +1 -0
- package/dist/cache/implementations/derivables/cache/_module.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +122 -565
- package/dist/cache/implementations/derivables/cache/cache.js +342 -854
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.d.ts +21 -0
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.js +110 -0
- package/dist/cache/implementations/derivables/cache/database-cache-adapter.js.map +1 -0
- package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.d.ts +9 -0
- package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js +20 -0
- package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js.map +1 -0
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +65 -104
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +101 -85
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cache/implementations/test-utilities/_module-exports.d.ts +1 -0
- package/dist/cache/implementations/test-utilities/_module-exports.js +1 -0
- package/dist/cache/implementations/test-utilities/_module-exports.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +9 -11
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +246 -247
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +16 -30
- package/dist/cache/implementations/test-utilities/cache.test-suite.js +271 -996
- package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.d.ts +60 -0
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +698 -0
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js.map +1 -0
- package/dist/collection/contracts/async-collection.contract.d.ts +2 -3
- package/dist/collection/contracts/async-collection.contract.js +1 -12
- package/dist/collection/contracts/async-collection.contract.js.map +1 -1
- package/dist/collection/contracts/collection.contract.d.ts +1 -1
- package/dist/collection/contracts/collection.errors.d.ts +1 -1
- package/dist/collection/contracts/collection.errors.js +3 -6
- package/dist/collection/contracts/collection.errors.js.map +1 -1
- package/dist/collection/implementations/_shared.d.ts +4 -4
- package/dist/collection/implementations/_shared.js +6 -9
- package/dist/collection/implementations/_shared.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +2 -2
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +6 -5
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +1 -1
- package/dist/collection/implementations/list-collection/list-collection.d.ts +1 -1
- package/dist/collection/implementations/list-collection/list-collection.js +1 -1
- package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +0 -9
- package/dist/event-bus/contracts/event-bus.contract.d.ts +5 -5
- package/dist/event-bus/contracts/event-bus.contract.js.map +1 -1
- package/dist/event-bus/contracts/event-bus.errors.js +2 -5
- package/dist/event-bus/contracts/event-bus.errors.js.map +1 -1
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +9 -29
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +14 -35
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +1 -3
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +1 -7
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +8 -15
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +15 -34
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +78 -267
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +119 -323
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.d.ts +13 -0
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.js +42 -0
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.js.map +1 -0
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +70 -96
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +100 -90
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.d.ts +2 -48
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +31 -122
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +2 -50
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +41 -89
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/lock/contracts/database-lock-adapter.contract.d.ts +0 -9
- package/dist/lock/contracts/lock-adapter.contract.d.ts +0 -9
- package/dist/lock/contracts/lock-provider.contract.d.ts +1 -1
- package/dist/lock/contracts/lock.errors.js +2 -5
- package/dist/lock/contracts/lock.errors.js.map +1 -1
- package/dist/lock/contracts/lock.events.js +2 -5
- package/dist/lock/contracts/lock.events.js.map +1 -1
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +0 -5
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +2 -21
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +11 -16
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +11 -20
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +7 -26
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +7 -35
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +13 -20
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +13 -37
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +4 -22
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +4 -31
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +12 -17
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +12 -21
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.d.ts +0 -2
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js +2 -8
- package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.d.ts +9 -0
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js +17 -0
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js.map +1 -0
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +115 -372
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +197 -455
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +15 -17
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +42 -40
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-state.d.ts +3 -3
- package/dist/lock/implementations/derivables/lock-provider/lock-state.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +30 -754
- package/dist/lock/implementations/derivables/lock-provider/lock.js +94 -812
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +58 -161
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +116 -122
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +4 -5
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +172 -247
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +5 -8
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +93 -98
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +15 -20
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +133 -137
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js +1 -2
- package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js.map +1 -1
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +2 -2
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +1 -1
- package/dist/serde/implementations/adapters/redis-serde/redis-serde.js +1 -2
- package/dist/serde/implementations/adapters/redis-serde/redis-serde.js.map +1 -1
- package/dist/serde/implementations/adapters/sql-serde/sql-serde.js +1 -2
- package/dist/serde/implementations/adapters/sql-serde/sql-serde.js.map +1 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.d.ts +2 -2
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +2 -2
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js.map +1 -1
- package/dist/serde/implementations/derivables/serde.d.ts +14 -14
- package/dist/serde/implementations/derivables/serde.js +14 -15
- package/dist/serde/implementations/derivables/serde.js.map +1 -1
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.d.ts +4 -4
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +3 -3
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +5 -5
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +4 -4
- package/dist/utilities/_module-exports.d.ts +1 -2
- package/dist/utilities/_module-exports.js +1 -2
- package/dist/utilities/_module-exports.js.map +1 -1
- package/dist/utilities/classes/_module.d.ts +4 -0
- package/dist/utilities/classes/_module.js +5 -0
- package/dist/utilities/classes/_module.js.map +1 -0
- package/dist/utilities/classes/key-prefixer/_module.d.ts +2 -0
- package/dist/utilities/classes/key-prefixer/_module.js +3 -0
- package/dist/utilities/classes/key-prefixer/_module.js.map +1 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.contract.d.ts +28 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js +5 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js.map +1 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +73 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.js +135 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -0
- package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.d.ts +1 -0
- package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.js +2 -0
- package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.js.map +1 -0
- package/dist/utilities/classes/kysely-table-name-transformer-plugin/kysely-table-name-transformer-plugin.js.map +1 -0
- package/dist/utilities/classes/pipeline/_module.d.ts +1 -0
- package/dist/utilities/classes/pipeline/_module.js +2 -0
- package/dist/utilities/classes/pipeline/_module.js.map +1 -0
- package/dist/utilities/{pipeline → classes/pipeline}/pipeline.d.ts +3 -2
- package/dist/utilities/{pipeline → classes/pipeline}/pipeline.js +3 -2
- package/dist/utilities/classes/pipeline/pipeline.js.map +1 -0
- package/dist/utilities/classes/time-span/_module.d.ts +1 -0
- package/dist/utilities/classes/time-span/_module.js +2 -0
- package/dist/utilities/classes/time-span/_module.js.map +1 -0
- package/dist/utilities/{time-span → classes/time-span}/time-span.d.ts +2 -1
- package/dist/utilities/{time-span → classes/time-span}/time-span.js +1 -0
- package/dist/utilities/classes/time-span/time-span.js.map +1 -0
- package/dist/utilities/contracts/_module.d.ts +2 -1
- package/dist/utilities/contracts/_module.js +2 -1
- package/dist/utilities/contracts/_module.js.map +1 -1
- package/dist/utilities/contracts/prunable.contract.d.ts +11 -0
- package/dist/utilities/contracts/prunable.contract.js +5 -0
- package/dist/utilities/contracts/prunable.contract.js.map +1 -0
- package/dist/utilities/functions.d.ts +30 -2
- package/dist/utilities/functions.js +66 -4
- package/dist/utilities/functions.js.map +1 -1
- package/dist/utilities/types.d.ts +47 -14
- package/package.json +14 -13
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js +0 -2
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js.map +0 -1
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +0 -61
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +0 -318
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +0 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.d.ts +0 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js +0 -2
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js.map +0 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +0 -22
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +0 -39
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +0 -1
- package/dist/utilities/kysely/_module.d.ts +0 -1
- package/dist/utilities/kysely/_module.js +0 -2
- package/dist/utilities/kysely/_module.js.map +0 -1
- package/dist/utilities/kysely/kysely-table-name-transformer-plugin.js.map +0 -1
- package/dist/utilities/pipeline/_module.d.ts +0 -1
- package/dist/utilities/pipeline/_module.js +0 -2
- package/dist/utilities/pipeline/_module.js.map +0 -1
- package/dist/utilities/pipeline/pipeline.js.map +0 -1
- package/dist/utilities/time-span/_module.d.ts +0 -1
- package/dist/utilities/time-span/_module.js +0 -2
- package/dist/utilities/time-span/_module.js.map +0 -1
- package/dist/utilities/time-span/time-span.js.map +0 -1
- /package/dist/utilities/{kysely → classes/kysely-table-name-transformer-plugin}/kysely-table-name-transformer-plugin.d.ts +0 -0
- /package/dist/utilities/{kysely → classes/kysely-table-name-transformer-plugin}/kysely-table-name-transformer-plugin.js +0 -0
|
@@ -3,136 +3,110 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { BackoffPolicy, RetryPolicy } from "../../../../async/_module-exports.js";
|
|
5
5
|
import { type IEventBusAdapter, type IGroupableEventBus, type IEventBusFactory, type BaseEvent } from "../../../../event-bus/contracts/_module-exports.js";
|
|
6
|
-
import
|
|
7
|
-
import type {
|
|
6
|
+
import { type EventBusSettingsBase } from "../../../../event-bus/implementations/derivables/event-bus/event-bus.js";
|
|
7
|
+
import type { KeyPrefixer, TimeSpan } from "../../../../utilities/_module-exports.js";
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
|
-
* IMPORT_PATH: ```"@daiso-tech/core/event-bus
|
|
10
|
+
* IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
|
|
11
11
|
* @group Derivables
|
|
12
12
|
*/
|
|
13
13
|
export type EventBusAdapters<TAdapters extends string = string> = Partial<Record<TAdapters, IEventBusAdapter>>;
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
16
|
-
* IMPORT_PATH: ```"@daiso-tech/core/event-bus
|
|
16
|
+
* IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
|
|
17
17
|
* @group Derivables
|
|
18
18
|
*/
|
|
19
|
-
export type EventBusFactorySettings<TAdapters extends string = string> = {
|
|
20
|
-
/**
|
|
21
|
-
* You can pass one or more <i>{@link IFlexibleSerde}</i> that will be used to register all <i>{@link IGroupableEventBus}</i> related errors.
|
|
22
|
-
* @default {true}
|
|
23
|
-
*/
|
|
24
|
-
serde: OneOrMore<IFlexibleSerde>;
|
|
25
|
-
/**
|
|
26
|
-
* If set to true, all <i>{@link IGroupableEventBus}</i> related errors will be registered with the specified <i>IFlexibleSerde</i> during constructor initialization.
|
|
27
|
-
* This ensures that all <i>{@link IGroupableEventBus}</i> related errors will be serialized correctly.
|
|
28
|
-
* @default {true}
|
|
29
|
-
*/
|
|
30
|
-
shouldRegisterErrors?: boolean;
|
|
19
|
+
export type EventBusFactorySettings<TAdapters extends string = string> = EventBusSettingsBase & {
|
|
31
20
|
adapters: EventBusAdapters<TAdapters>;
|
|
32
21
|
defaultAdapter?: NoInfer<TAdapters>;
|
|
33
|
-
/**
|
|
34
|
-
* In order to listen to events of <i>{@link Cache}</i> class you must pass in <i>{@link IGroupableEventBus}</i>.
|
|
35
|
-
*/
|
|
36
|
-
eventBus?: IGroupableEventBus<any>;
|
|
37
|
-
/**
|
|
38
|
-
* The default retry attempt to use in the returned <i>LazyPromise</i>.
|
|
39
|
-
* @default {null}
|
|
40
|
-
*/
|
|
41
|
-
retryAttempts?: number | null;
|
|
42
|
-
/**
|
|
43
|
-
* The default backof policy to use in the returned <i>LazyPromise</i>.
|
|
44
|
-
* @default {null}
|
|
45
|
-
*/
|
|
46
|
-
backoffPolicy?: BackoffPolicy | null;
|
|
47
|
-
/**
|
|
48
|
-
* The default retry policy to use in the returned <i>LazyPromise</i>.
|
|
49
|
-
* @default {null}
|
|
50
|
-
*/
|
|
51
|
-
retryPolicy?: RetryPolicy | null;
|
|
52
|
-
/**
|
|
53
|
-
* The default timeout to use in the returned <i>LazyPromise</i>.
|
|
54
|
-
* @default {null}
|
|
55
|
-
*/
|
|
56
|
-
timeout?: TimeSpan | null;
|
|
57
22
|
};
|
|
58
23
|
/**
|
|
59
24
|
*
|
|
60
|
-
* IMPORT_PATH: ```"@daiso-tech/core/event-bus
|
|
25
|
+
* IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
|
|
61
26
|
* @group Derivables
|
|
62
27
|
*/
|
|
63
28
|
export declare class EventBusFactory<TAdapters extends string = string> implements IEventBusFactory<TAdapters> {
|
|
64
|
-
private readonly
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
private readonly shouldRegisterErrors?;
|
|
29
|
+
private readonly settings;
|
|
30
|
+
constructor(settings: EventBusFactorySettings<TAdapters>);
|
|
31
|
+
setKeyPrefixer(keyPrefixer: KeyPrefixer): EventBusFactory<TAdapters>;
|
|
32
|
+
setRetryAttempts(attempts: number): EventBusFactory<TAdapters>;
|
|
33
|
+
setBackoffPolicy(policy: BackoffPolicy): EventBusFactory<TAdapters>;
|
|
34
|
+
setRetryPolicy(policy: RetryPolicy): EventBusFactory<TAdapters>;
|
|
35
|
+
setTimeout(timeout: TimeSpan): EventBusFactory<TAdapters>;
|
|
72
36
|
/**
|
|
73
37
|
* @example
|
|
74
38
|
* ```ts
|
|
75
|
-
* import {
|
|
76
|
-
* import {
|
|
77
|
-
* import {
|
|
78
|
-
* import {
|
|
39
|
+
* import { type IEventBusAdapter, BaseEvent } from "@daiso-tech/core/event-bus/contracts";
|
|
40
|
+
* import { EventBusFactory } from "@daiso-tech/core/event-bus";
|
|
41
|
+
* import { MemoryEventBusAdapter, RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
42
|
+
* import { KeyPrefixer, type IFactoryObject, type Promiseable } from "@daiso-tech/utilities";
|
|
43
|
+
* import { Serde } from "@daiso-tech/core/serde";
|
|
44
|
+
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters"
|
|
79
45
|
* import Redis from "ioredis";
|
|
80
46
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* serde,
|
|
92
|
-
* rootGroup: "@global"
|
|
93
|
-
* }),
|
|
94
|
-
* defaultAdapter: "memory"
|
|
47
|
+
* class EventBusAdapterFactory implements IFactoryObject<string, IEventBusAdapter> {
|
|
48
|
+
* private store: Partial<Record<string, IEventBusAdapter>> = {};
|
|
49
|
+
*
|
|
50
|
+
* async use(prefix: string): Promiseable<IEventBusAdapter> {
|
|
51
|
+
* let adapter = this.store[prefix];
|
|
52
|
+
* if (adapter === undefined) {
|
|
53
|
+
* adapter = new MemoryEventBusAdapter();
|
|
54
|
+
* store[prefix] = adapter;
|
|
55
|
+
* }
|
|
56
|
+
* return adapter;
|
|
95
57
|
* }
|
|
96
|
-
* }
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
constructor(settings: EventBusFactorySettings<TAdapters>);
|
|
100
|
-
private init;
|
|
101
|
-
/**
|
|
102
|
-
* @example
|
|
103
|
-
* ```ts
|
|
104
|
-
* import { BaseEvent } from "@daiso-tech/core/event-bus/contracts";
|
|
105
|
-
* import { EventBusFactory } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
106
|
-
* import { MemoryEventBusAdapter, RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
107
|
-
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
108
|
-
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/implementations/adapters";
|
|
109
|
-
* import Redis from "ioredis";
|
|
58
|
+
* }
|
|
110
59
|
*
|
|
60
|
+
* const dispatcherClient = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
61
|
+
* const listenerClient = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
111
62
|
* const serde = new Serde(new SuperJsonSerdeAdapter());
|
|
112
|
-
* const
|
|
113
|
-
*
|
|
63
|
+
* const eventBusFactory = new EventBusFactory({
|
|
64
|
+
* keyPrefixer: new KeyPrefixer("event-bus"),
|
|
114
65
|
* adapters: {
|
|
115
|
-
* memory:new MemoryEventBusAdapter(
|
|
116
|
-
*
|
|
117
|
-
* }),
|
|
66
|
+
* memory: new MemoryEventBusAdapter(),
|
|
67
|
+
* memorFactory: new EventBusAdapterFactory(),
|
|
118
68
|
* redis: new RedisPubSubEventBusAdapter({
|
|
119
|
-
* dispatcherClient: new Redis("YOUR_REDIS_CONNECTION"),
|
|
120
|
-
* listenerClient: new Redis("YOUR_REDIS_CONNECTION")
|
|
121
69
|
* serde,
|
|
122
|
-
*
|
|
70
|
+
* dispatcherClient,
|
|
71
|
+
* listenerClient,
|
|
123
72
|
* }),
|
|
124
|
-
*
|
|
125
|
-
*
|
|
73
|
+
* },
|
|
74
|
+
* defaultAdapter: "memory"
|
|
126
75
|
* });
|
|
127
76
|
*
|
|
128
77
|
* class AddEvent extends BaseEvent<{ a: number, b: number }> {}
|
|
129
|
-
* serde.registerEvent(AddEvent);
|
|
130
78
|
*
|
|
131
|
-
* // Will
|
|
132
|
-
* await
|
|
79
|
+
* // Will dispatch AddEvent using the default adapter which is MemoryEventBusAdapter
|
|
80
|
+
* await eventBusFactory
|
|
81
|
+
* .use()
|
|
82
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
83
|
+
*
|
|
84
|
+
* // Will dispatch AddEvent using the redis adapter which is RedisPubSubEventBusAdapter
|
|
85
|
+
* await eventBusFactory
|
|
86
|
+
* .use("redis")
|
|
87
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
88
|
+
*
|
|
89
|
+
* // You can change the default settings of the returned EventBus instance.
|
|
90
|
+
* await eventBusFactory
|
|
91
|
+
* .setRetryAttempts(4)
|
|
92
|
+
* .use("sqlite")
|
|
93
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
94
|
+
*
|
|
95
|
+
* // You can reuse the settings
|
|
96
|
+
* const retryableEventBusFactory = eventBusFactory
|
|
97
|
+
* .setRetryAttempts(4);
|
|
98
|
+
*
|
|
99
|
+
* await retryableEventBusFactory
|
|
100
|
+
* .use()
|
|
101
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
102
|
+
*
|
|
103
|
+
* // You can extend the settings
|
|
104
|
+
* const extendedEventBusFactory = retryableEventBusFactory
|
|
105
|
+
* .setTimeout(TimeSpan.fromSeconds(1));
|
|
133
106
|
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
107
|
+
* await extendedEventBusFactory
|
|
108
|
+
* .use()
|
|
109
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
136
110
|
* ```
|
|
137
111
|
*/
|
|
138
112
|
use<TEvents extends BaseEvent = BaseEvent>(adapterName?: TAdapters | undefined): IGroupableEventBus<TEvents>;
|
|
@@ -1,127 +1,137 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module EventBus
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { EventBus } from "../../../../event-bus/implementations/derivables/event-bus/event-bus.js";
|
|
4
|
+
import {} from "../../../../event-bus/contracts/_module-exports.js";
|
|
5
|
+
import { EventBus, } from "../../../../event-bus/implementations/derivables/event-bus/event-bus.js";
|
|
6
6
|
import { DefaultAdapterNotDefinedError, UnregisteredAdapterError, } from "../../../../utilities/_module-exports.js";
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
|
-
* IMPORT_PATH: ```"@daiso-tech/core/event-bus
|
|
9
|
+
* IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
|
|
10
10
|
* @group Derivables
|
|
11
11
|
*/
|
|
12
12
|
export class EventBusFactory {
|
|
13
|
-
|
|
14
|
-
serde;
|
|
15
|
-
defaultAdapter;
|
|
16
|
-
retryAttempts;
|
|
17
|
-
backoffPolicy;
|
|
18
|
-
retryPolicy;
|
|
19
|
-
timeout;
|
|
20
|
-
shouldRegisterErrors;
|
|
21
|
-
/**
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* import { EventBusFactory } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
25
|
-
* import { MemoryEventBusAdapter, RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
26
|
-
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
27
|
-
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/implementations/adapters";
|
|
28
|
-
* import Redis from "ioredis";
|
|
29
|
-
*
|
|
30
|
-
* const serde = new Serde(new SuperJsonSerdeAdapter());
|
|
31
|
-
* const cacheFactory = new EventBusFactory({
|
|
32
|
-
* serde,
|
|
33
|
-
* adapters: {
|
|
34
|
-
* memory:new MemoryEventBusAdapter({
|
|
35
|
-
* rootGroup: "@global"
|
|
36
|
-
* }),
|
|
37
|
-
* redis: new RedisPubSubEventBusAdapter({
|
|
38
|
-
* dispatcherClient: new Redis("YOUR_REDIS_CONNECTION"),
|
|
39
|
-
* listenerClient: new Redis("YOUR_REDIS_CONNECTION")
|
|
40
|
-
* serde,
|
|
41
|
-
* rootGroup: "@global"
|
|
42
|
-
* }),
|
|
43
|
-
* defaultAdapter: "memory"
|
|
44
|
-
* }
|
|
45
|
-
* });
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
13
|
+
settings;
|
|
48
14
|
constructor(settings) {
|
|
49
|
-
|
|
50
|
-
this.shouldRegisterErrors = shouldRegisterErrors;
|
|
51
|
-
this.serde = serde;
|
|
52
|
-
this.retryAttempts = retryAttempts;
|
|
53
|
-
this.backoffPolicy = backoffPolicy;
|
|
54
|
-
this.retryPolicy = retryPolicy;
|
|
55
|
-
this.timeout = timeout;
|
|
56
|
-
this.defaultAdapter = defaultAdapter;
|
|
57
|
-
this.eventBusRecord = this.init(adapters);
|
|
15
|
+
this.settings = settings;
|
|
58
16
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
17
|
+
setKeyPrefixer(keyPrefixer) {
|
|
18
|
+
return new EventBusFactory({
|
|
19
|
+
...this.settings,
|
|
20
|
+
keyPrefixer,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
setRetryAttempts(attempts) {
|
|
24
|
+
return new EventBusFactory({
|
|
25
|
+
...this.settings,
|
|
26
|
+
retryAttempts: attempts,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
setBackoffPolicy(policy) {
|
|
30
|
+
return new EventBusFactory({
|
|
31
|
+
...this.settings,
|
|
32
|
+
backoffPolicy: policy,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
setRetryPolicy(policy) {
|
|
36
|
+
return new EventBusFactory({
|
|
37
|
+
...this.settings,
|
|
38
|
+
retryPolicy: policy,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
setTimeout(timeout) {
|
|
42
|
+
return new EventBusFactory({
|
|
43
|
+
...this.settings,
|
|
44
|
+
timeout,
|
|
45
|
+
});
|
|
78
46
|
}
|
|
79
47
|
/**
|
|
80
48
|
* @example
|
|
81
49
|
* ```ts
|
|
82
|
-
* import { BaseEvent } from "@daiso-tech/core/event-bus/contracts";
|
|
83
|
-
* import { EventBusFactory } from "@daiso-tech/core/event-bus
|
|
84
|
-
* import { MemoryEventBusAdapter, RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/
|
|
85
|
-
* import {
|
|
86
|
-
* import {
|
|
50
|
+
* import { type IEventBusAdapter, BaseEvent } from "@daiso-tech/core/event-bus/contracts";
|
|
51
|
+
* import { EventBusFactory } from "@daiso-tech/core/event-bus";
|
|
52
|
+
* import { MemoryEventBusAdapter, RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
53
|
+
* import { KeyPrefixer, type IFactoryObject, type Promiseable } from "@daiso-tech/utilities";
|
|
54
|
+
* import { Serde } from "@daiso-tech/core/serde";
|
|
55
|
+
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters"
|
|
87
56
|
* import Redis from "ioredis";
|
|
88
57
|
*
|
|
58
|
+
* class EventBusAdapterFactory implements IFactoryObject<string, IEventBusAdapter> {
|
|
59
|
+
* private store: Partial<Record<string, IEventBusAdapter>> = {};
|
|
60
|
+
*
|
|
61
|
+
* async use(prefix: string): Promiseable<IEventBusAdapter> {
|
|
62
|
+
* let adapter = this.store[prefix];
|
|
63
|
+
* if (adapter === undefined) {
|
|
64
|
+
* adapter = new MemoryEventBusAdapter();
|
|
65
|
+
* store[prefix] = adapter;
|
|
66
|
+
* }
|
|
67
|
+
* return adapter;
|
|
68
|
+
* }
|
|
69
|
+
* }
|
|
70
|
+
*
|
|
71
|
+
* const dispatcherClient = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
72
|
+
* const listenerClient = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
89
73
|
* const serde = new Serde(new SuperJsonSerdeAdapter());
|
|
90
|
-
* const
|
|
91
|
-
*
|
|
74
|
+
* const eventBusFactory = new EventBusFactory({
|
|
75
|
+
* keyPrefixer: new KeyPrefixer("event-bus"),
|
|
92
76
|
* adapters: {
|
|
93
|
-
* memory:new MemoryEventBusAdapter(
|
|
94
|
-
*
|
|
95
|
-
* }),
|
|
77
|
+
* memory: new MemoryEventBusAdapter(),
|
|
78
|
+
* memorFactory: new EventBusAdapterFactory(),
|
|
96
79
|
* redis: new RedisPubSubEventBusAdapter({
|
|
97
|
-
* dispatcherClient: new Redis("YOUR_REDIS_CONNECTION"),
|
|
98
|
-
* listenerClient: new Redis("YOUR_REDIS_CONNECTION")
|
|
99
80
|
* serde,
|
|
100
|
-
*
|
|
81
|
+
* dispatcherClient,
|
|
82
|
+
* listenerClient,
|
|
101
83
|
* }),
|
|
102
|
-
*
|
|
103
|
-
*
|
|
84
|
+
* },
|
|
85
|
+
* defaultAdapter: "memory"
|
|
104
86
|
* });
|
|
105
87
|
*
|
|
106
88
|
* class AddEvent extends BaseEvent<{ a: number, b: number }> {}
|
|
107
|
-
* serde.registerEvent(AddEvent);
|
|
108
89
|
*
|
|
109
|
-
* // Will
|
|
110
|
-
* await
|
|
90
|
+
* // Will dispatch AddEvent using the default adapter which is MemoryEventBusAdapter
|
|
91
|
+
* await eventBusFactory
|
|
92
|
+
* .use()
|
|
93
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
94
|
+
*
|
|
95
|
+
* // Will dispatch AddEvent using the redis adapter which is RedisPubSubEventBusAdapter
|
|
96
|
+
* await eventBusFactory
|
|
97
|
+
* .use("redis")
|
|
98
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
99
|
+
*
|
|
100
|
+
* // You can change the default settings of the returned EventBus instance.
|
|
101
|
+
* await eventBusFactory
|
|
102
|
+
* .setRetryAttempts(4)
|
|
103
|
+
* .use("sqlite")
|
|
104
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
105
|
+
*
|
|
106
|
+
* // You can reuse the settings
|
|
107
|
+
* const retryableEventBusFactory = eventBusFactory
|
|
108
|
+
* .setRetryAttempts(4);
|
|
109
|
+
*
|
|
110
|
+
* await retryableEventBusFactory
|
|
111
|
+
* .use()
|
|
112
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
113
|
+
*
|
|
114
|
+
* // You can extend the settings
|
|
115
|
+
* const extendedEventBusFactory = retryableEventBusFactory
|
|
116
|
+
* .setTimeout(TimeSpan.fromSeconds(1));
|
|
111
117
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
118
|
+
* await extendedEventBusFactory
|
|
119
|
+
* .use()
|
|
120
|
+
* .dispatch(new AddEvent({ a: 1, b: 2 }));
|
|
114
121
|
* ```
|
|
115
122
|
*/
|
|
116
|
-
use(adapterName = this.defaultAdapter) {
|
|
123
|
+
use(adapterName = this.settings.defaultAdapter) {
|
|
117
124
|
if (adapterName === undefined) {
|
|
118
125
|
throw new DefaultAdapterNotDefinedError(EventBusFactory.name);
|
|
119
126
|
}
|
|
120
|
-
const
|
|
121
|
-
if (
|
|
127
|
+
const adapter = this.settings.adapters[adapterName];
|
|
128
|
+
if (adapter === undefined) {
|
|
122
129
|
throw new UnregisteredAdapterError(adapterName);
|
|
123
130
|
}
|
|
124
|
-
return
|
|
131
|
+
return new EventBus({
|
|
132
|
+
adapter,
|
|
133
|
+
...this.settings,
|
|
134
|
+
});
|
|
125
135
|
}
|
|
126
136
|
}
|
|
127
137
|
//# sourceMappingURL=event-bus-factory.js.map
|
package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus-factory.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"event-bus-factory.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAKN,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACH,QAAQ,GAEX,MAAM,+DAA+D,CAAC;AAEvE,OAAO,EACH,6BAA6B,EAC7B,wBAAwB,GAC3B,MAAM,gCAAgC,CAAC;AAuBxC;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAIH;IADrB,YACqB,QAA4C;QAA5C,aAAQ,GAAR,QAAQ,CAAoC;IAC9D,CAAC;IAEJ,cAAc,CAAC,WAAwB;QACnC,OAAO,IAAI,eAAe,CAAC;YACvB,GAAG,IAAI,CAAC,QAAQ;YAChB,WAAW;SACd,CAAC,CAAC;IACP,CAAC;IAED,gBAAgB,CAAC,QAAgB;QAC7B,OAAO,IAAI,eAAe,CAAC;YACvB,GAAG,IAAI,CAAC,QAAQ;YAChB,aAAa,EAAE,QAAQ;SAC1B,CAAC,CAAC;IACP,CAAC;IAED,gBAAgB,CAAC,MAAqB;QAClC,OAAO,IAAI,eAAe,CAAC;YACvB,GAAG,IAAI,CAAC,QAAQ;YAChB,aAAa,EAAE,MAAM;SACxB,CAAC,CAAC;IACP,CAAC;IAED,cAAc,CAAC,MAAmB;QAC9B,OAAO,IAAI,eAAe,CAAC;YACvB,GAAG,IAAI,CAAC,QAAQ;YAChB,WAAW,EAAE,MAAM;SACtB,CAAC,CAAC;IACP,CAAC;IAED,UAAU,CAAC,OAAiB;QACxB,OAAO,IAAI,eAAe,CAAC;YACvB,GAAG,IAAI,CAAC,QAAQ;YAChB,OAAO;SACV,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2EG;IACH,GAAG,CACC,cAAqC,IAAI,CAAC,QAAQ,CAAC,cAAc;QAEjE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,IAAI,6BAA6B,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,wBAAwB,CAAC,WAAW,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,QAAQ,CAAC;YAChB,OAAO;YACP,GAAG,IAAI,CAAC,QAAQ;SACnB,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -7,7 +7,7 @@ import { type Promisable } from "../../../utilities/_module-exports.js";
|
|
|
7
7
|
import type { IFlexibleSerde } from "../../../serde/contracts/_module-exports.js";
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
|
-
* IMPORT_PATH: ```"@daiso-tech/core/event-bus/
|
|
10
|
+
* IMPORT_PATH: ```"@daiso-tech/core/event-bus/test-utilities"```
|
|
11
11
|
* @group Test utilities
|
|
12
12
|
*/
|
|
13
13
|
export type EventBusAdapterTestSuiteSettings = {
|
|
@@ -21,53 +21,7 @@ export type EventBusAdapterTestSuiteSettings = {
|
|
|
21
21
|
/**
|
|
22
22
|
* The <i>eventBusAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link IEventBusAdapter}</i> with vitest.
|
|
23
23
|
*
|
|
24
|
-
* IMPORT_PATH: ```"@daiso-tech/core/event-bus/
|
|
24
|
+
* IMPORT_PATH: ```"@daiso-tech/core/event-bus/test-utilities"```
|
|
25
25
|
* @group Test utilities
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* import { describe, test, beforeEach, expect, afterEach } from "vitest";
|
|
29
|
-
* import type { StartedRedisContainer } from "@testcontainers/redis";
|
|
30
|
-
* import { RedisContainer } from "@testcontainers/redis";
|
|
31
|
-
* import Redis from "ioredis";
|
|
32
|
-
* import { RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
33
|
-
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
34
|
-
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/implementations/adapters";
|
|
35
|
-
* import { eventBusAdapterTestSuite } from "@daiso-tech/core/event-bus/implementations/test-utilities";
|
|
36
|
-
*
|
|
37
|
-
* const TIMEOUT = TimeSpan.fromMinutes(2);
|
|
38
|
-
* describe("class: RedisPubSubEventBusAdapter", () => {
|
|
39
|
-
* let dispatcherClient: Redis;
|
|
40
|
-
* let listenerClient: Redis;
|
|
41
|
-
* let startedContainer: StartedRedisContainer;
|
|
42
|
-
* const serde = new Serde(new SuperJsonSerdeAdapter());
|
|
43
|
-
*
|
|
44
|
-
* beforeEach(async () => {
|
|
45
|
-
* startedContainer = await new RedisContainer().start();
|
|
46
|
-
* dispatcherClient = new Redis(startedContainer.getConnectionUrl());
|
|
47
|
-
* listenerClient = new Redis(startedContainer.getConnectionUrl());
|
|
48
|
-
* }, TIMEOUT.toMilliseconds());
|
|
49
|
-
*
|
|
50
|
-
* afterEach(async () => {
|
|
51
|
-
* await dispatcherClient.quit();
|
|
52
|
-
* await listenerClient.quit();
|
|
53
|
-
* await startedContainer.stop();
|
|
54
|
-
* }, TIMEOUT.toMilliseconds());
|
|
55
|
-
*
|
|
56
|
-
* eventBusAdapterTestSuite({
|
|
57
|
-
* createAdapter: () =>
|
|
58
|
-
* new RedisPubSubEventBusAdapter({
|
|
59
|
-
* dispatcherClient,
|
|
60
|
-
* listenerClient,
|
|
61
|
-
* serde,
|
|
62
|
-
* rootGroup: "@global"
|
|
63
|
-
* }),
|
|
64
|
-
* serde,
|
|
65
|
-
* test,
|
|
66
|
-
* beforeEach,
|
|
67
|
-
* expect,
|
|
68
|
-
* describe,
|
|
69
|
-
* });
|
|
70
|
-
* });
|
|
71
|
-
* ```
|
|
72
26
|
*/
|
|
73
27
|
export declare function eventBusAdapterTestSuite(settings: EventBusAdapterTestSuiteSettings): void;
|