node-cqrs 1.0.0-rc.2 → 1.0.0-rc.20
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/CHANGELOG.md +244 -83
- package/dist/AbstractAggregate.js +62 -40
- package/dist/AbstractAggregate.js.map +1 -1
- package/dist/AbstractProjection.js +64 -47
- package/dist/AbstractProjection.js.map +1 -1
- package/dist/AbstractSaga.js.map +1 -1
- package/dist/AggregateCommandHandler.js +44 -20
- package/dist/AggregateCommandHandler.js.map +1 -1
- package/dist/CommandBus.js +6 -10
- package/dist/CommandBus.js.map +1 -1
- package/dist/CqrsContainerBuilder.js +12 -3
- package/dist/CqrsContainerBuilder.js.map +1 -1
- package/dist/Event.js +0 -24
- package/dist/Event.js.map +1 -1
- package/dist/EventDispatchPipeline.js +81 -0
- package/dist/EventDispatchPipeline.js.map +1 -0
- package/dist/EventDispatcher.js +94 -0
- package/dist/EventDispatcher.js.map +1 -0
- package/dist/EventStore.js +63 -141
- package/dist/EventStore.js.map +1 -1
- package/dist/SagaEventHandler.js +3 -2
- package/dist/SagaEventHandler.js.map +1 -1
- package/dist/in-memory/InMemoryEventStorage.js +73 -0
- package/dist/in-memory/InMemoryEventStorage.js.map +1 -0
- package/dist/in-memory/InMemoryLock.js +40 -0
- package/dist/in-memory/InMemoryLock.js.map +1 -0
- package/dist/{infrastructure → in-memory}/InMemoryMessageBus.js +28 -27
- package/dist/in-memory/InMemoryMessageBus.js.map +1 -0
- package/dist/in-memory/InMemorySnapshotStorage.js +70 -0
- package/dist/in-memory/InMemorySnapshotStorage.js.map +1 -0
- package/dist/{infrastructure → in-memory}/InMemoryView.js +13 -9
- package/dist/in-memory/InMemoryView.js.map +1 -0
- package/dist/in-memory/index.js +22 -0
- package/dist/in-memory/index.js.map +1 -0
- package/dist/{infrastructure → in-memory}/utils/index.js +0 -1
- package/dist/in-memory/utils/index.js.map +1 -0
- package/dist/{infrastructure → in-memory}/utils/nextCycle.js +1 -1
- package/dist/in-memory/utils/nextCycle.js.map +1 -0
- package/dist/index.js +3 -8
- package/dist/index.js.map +1 -1
- package/dist/{interfaces.js → interfaces/IAggregate.js} +1 -2
- package/dist/interfaces/IAggregate.js.map +1 -0
- package/dist/interfaces/IAggregateSnapshotStorage.js +3 -0
- package/dist/interfaces/IAggregateSnapshotStorage.js.map +1 -0
- package/dist/interfaces/ICommand.js +3 -0
- package/dist/interfaces/ICommand.js.map +1 -0
- package/dist/interfaces/ICommandBus.js +3 -0
- package/dist/interfaces/ICommandBus.js.map +1 -0
- package/dist/interfaces/IContainer.js +3 -0
- package/dist/interfaces/IContainer.js.map +1 -0
- package/dist/interfaces/IDispatchPipelineProcessor.js +9 -0
- package/dist/interfaces/IDispatchPipelineProcessor.js.map +1 -0
- package/dist/interfaces/IEvent.js +10 -0
- package/dist/interfaces/IEvent.js.map +1 -0
- package/dist/interfaces/IEventBus.js +9 -0
- package/dist/interfaces/IEventBus.js.map +1 -0
- package/dist/interfaces/IEventDispatcher.js +3 -0
- package/dist/interfaces/IEventDispatcher.js.map +1 -0
- package/dist/interfaces/IEventLocker.js +10 -0
- package/dist/interfaces/IEventLocker.js.map +1 -0
- package/dist/interfaces/IEventReceptor.js +3 -0
- package/dist/interfaces/IEventReceptor.js.map +1 -0
- package/dist/interfaces/IEventSet.js +8 -0
- package/dist/interfaces/IEventSet.js.map +1 -0
- package/dist/interfaces/IEventStorageReader.js +13 -0
- package/dist/interfaces/IEventStorageReader.js.map +1 -0
- package/dist/interfaces/IEventStorageWriter.js +3 -0
- package/dist/interfaces/IEventStorageWriter.js.map +1 -0
- package/dist/interfaces/IEventStore.js +3 -0
- package/dist/interfaces/IEventStore.js.map +1 -0
- package/dist/interfaces/IEventStream.js +3 -0
- package/dist/interfaces/IEventStream.js.map +1 -0
- package/dist/interfaces/IIdentifierProvider.js +9 -0
- package/dist/interfaces/IIdentifierProvider.js.map +1 -0
- package/dist/interfaces/ILogger.js +3 -0
- package/dist/interfaces/ILogger.js.map +1 -0
- package/dist/interfaces/IMessage.js +9 -0
- package/dist/interfaces/IMessage.js.map +1 -0
- package/dist/interfaces/IMessageBus.js +3 -0
- package/dist/interfaces/IMessageBus.js.map +1 -0
- package/dist/interfaces/IObjectStorage.js +3 -0
- package/dist/interfaces/IObjectStorage.js.map +1 -0
- package/dist/interfaces/IObservable.js +11 -0
- package/dist/interfaces/IObservable.js.map +1 -0
- package/dist/interfaces/IObserver.js +3 -0
- package/dist/interfaces/IObserver.js.map +1 -0
- package/dist/interfaces/IProjection.js +3 -0
- package/dist/interfaces/IProjection.js.map +1 -0
- package/dist/interfaces/ISaga.js +3 -0
- package/dist/interfaces/ISaga.js.map +1 -0
- package/dist/interfaces/IViewLocker.js +17 -0
- package/dist/interfaces/IViewLocker.js.map +1 -0
- package/dist/interfaces/Identifier.js +3 -0
- package/dist/interfaces/Identifier.js.map +1 -0
- package/dist/interfaces/index.js +44 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/isObject.js +9 -0
- package/dist/interfaces/isObject.js.map +1 -0
- package/dist/rabbitmq/IContainer.js +3 -0
- package/dist/rabbitmq/IContainer.js.map +1 -0
- package/dist/rabbitmq/RabbitMqEventBus.js +89 -0
- package/dist/rabbitmq/RabbitMqEventBus.js.map +1 -0
- package/dist/rabbitmq/RabbitMqEventInjector.js +55 -0
- package/dist/rabbitmq/RabbitMqEventInjector.js.map +1 -0
- package/dist/rabbitmq/RabbitMqGateway.js +349 -0
- package/dist/rabbitmq/RabbitMqGateway.js.map +1 -0
- package/dist/rabbitmq/TerminationHandler.js +31 -0
- package/dist/rabbitmq/TerminationHandler.js.map +1 -0
- package/dist/rabbitmq/index.js +20 -0
- package/dist/rabbitmq/index.js.map +1 -0
- package/dist/sqlite/AbstractSqliteAccessor.js +50 -0
- package/dist/sqlite/AbstractSqliteAccessor.js.map +1 -0
- package/dist/sqlite/AbstractSqliteObjectProjection.js +26 -0
- package/dist/sqlite/AbstractSqliteObjectProjection.js.map +1 -0
- package/dist/sqlite/AbstractSqliteView.js +44 -0
- package/dist/sqlite/AbstractSqliteView.js.map +1 -0
- package/dist/sqlite/IContainer.js +3 -0
- package/dist/sqlite/IContainer.js.map +1 -0
- package/dist/sqlite/SqliteEventLocker.js +94 -0
- package/dist/sqlite/SqliteEventLocker.js.map +1 -0
- package/dist/sqlite/SqliteObjectStorage.js +113 -0
- package/dist/sqlite/SqliteObjectStorage.js.map +1 -0
- package/dist/sqlite/SqliteObjectView.js +46 -0
- package/dist/sqlite/SqliteObjectView.js.map +1 -0
- package/dist/sqlite/SqliteProjectionDataParams.js +3 -0
- package/dist/sqlite/SqliteProjectionDataParams.js.map +1 -0
- package/dist/sqlite/SqliteViewLocker.js +121 -0
- package/dist/sqlite/SqliteViewLocker.js.map +1 -0
- package/dist/sqlite/index.js +25 -0
- package/dist/sqlite/index.js.map +1 -0
- package/dist/sqlite/queries/eventLockTableInit.js +15 -0
- package/dist/sqlite/queries/eventLockTableInit.js.map +1 -0
- package/dist/sqlite/queries/index.js +19 -0
- package/dist/sqlite/queries/index.js.map +1 -0
- package/dist/sqlite/queries/viewLockTableInit.js +14 -0
- package/dist/sqlite/queries/viewLockTableInit.js.map +1 -0
- package/dist/sqlite/utils/getEventId.js +11 -0
- package/dist/sqlite/utils/getEventId.js.map +1 -0
- package/dist/sqlite/utils/guid.js +9 -0
- package/dist/sqlite/utils/guid.js.map +1 -0
- package/dist/sqlite/utils/index.js +19 -0
- package/dist/sqlite/utils/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/Deferred.js.map +1 -0
- package/dist/utils/Lock.js +86 -0
- package/dist/utils/Lock.js.map +1 -0
- package/dist/utils/MapAssertable.js +30 -0
- package/dist/utils/MapAssertable.js.map +1 -0
- package/dist/utils/delay.js +13 -0
- package/dist/utils/delay.js.map +1 -0
- package/dist/utils/getHandler.js +2 -3
- package/dist/utils/getHandler.js.map +1 -1
- package/dist/utils/getMessageHandlerNames.js +2 -6
- package/dist/utils/getMessageHandlerNames.js.map +1 -1
- package/dist/utils/index.js +8 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/iteratorToArray.js +10 -0
- package/dist/utils/iteratorToArray.js.map +1 -0
- package/dist/utils/notEmpty.js +6 -0
- package/dist/utils/notEmpty.js.map +1 -0
- package/dist/utils/setupOneTimeEmitterSubscription.js.map +1 -1
- package/dist/utils/subscribe.js +16 -4
- package/dist/utils/subscribe.js.map +1 -1
- package/dist/utils/validateHandlers.js.map +1 -1
- package/eslint.config.mjs +839 -0
- package/package.json +68 -30
- package/src/AbstractAggregate.ts +83 -56
- package/src/AbstractProjection.ts +107 -69
- package/src/AbstractSaga.ts +3 -3
- package/src/AggregateCommandHandler.ts +69 -46
- package/src/CommandBus.ts +14 -13
- package/src/CqrsContainerBuilder.ts +28 -29
- package/src/Event.ts +1 -26
- package/src/EventDispatchPipeline.ts +99 -0
- package/src/EventDispatcher.ts +126 -0
- package/src/EventStore.ts +93 -181
- package/src/SagaEventHandler.ts +7 -8
- package/src/in-memory/InMemoryEventStorage.ts +108 -0
- package/src/in-memory/InMemoryLock.ts +43 -0
- package/src/{infrastructure → in-memory}/InMemoryMessageBus.ts +34 -32
- package/src/in-memory/InMemorySnapshotStorage.ts +89 -0
- package/src/{infrastructure → in-memory}/InMemoryView.ts +23 -24
- package/src/in-memory/index.ts +5 -0
- package/src/{infrastructure → in-memory}/utils/index.ts +0 -1
- package/src/{infrastructure → in-memory}/utils/nextCycle.ts +1 -1
- package/src/index.ts +2 -7
- package/src/interfaces/IAggregate.ts +68 -0
- package/src/interfaces/IAggregateSnapshotStorage.ts +11 -0
- package/src/interfaces/ICommand.ts +3 -0
- package/src/interfaces/ICommandBus.ts +16 -0
- package/src/interfaces/IContainer.ts +33 -0
- package/src/interfaces/IDispatchPipelineProcessor.ts +35 -0
- package/src/interfaces/IEvent.ts +14 -0
- package/src/interfaces/IEventBus.ts +11 -0
- package/src/interfaces/IEventDispatcher.ts +7 -0
- package/src/interfaces/IEventLocker.ts +34 -0
- package/src/interfaces/IEventReceptor.ts +6 -0
- package/src/interfaces/IEventSet.ts +7 -0
- package/src/interfaces/IEventStorageReader.ts +44 -0
- package/src/interfaces/IEventStorageWriter.ts +10 -0
- package/src/interfaces/IEventStore.ts +13 -0
- package/src/interfaces/IEventStream.ts +3 -0
- package/src/interfaces/IIdentifierProvider.ts +17 -0
- package/src/interfaces/ILogger.ts +11 -0
- package/src/interfaces/IMessage.ts +22 -0
- package/src/interfaces/IMessageBus.ts +8 -0
- package/src/interfaces/IObjectStorage.ts +13 -0
- package/src/interfaces/IObservable.ts +31 -0
- package/src/interfaces/IObserver.ts +5 -0
- package/src/interfaces/IProjection.ts +20 -0
- package/src/interfaces/ISaga.ts +38 -0
- package/src/interfaces/IViewLocker.ts +46 -0
- package/src/interfaces/Identifier.ts +1 -0
- package/src/interfaces/index.ts +27 -0
- package/src/interfaces/isObject.ts +5 -0
- package/src/rabbitmq/IContainer.ts +16 -0
- package/src/rabbitmq/RabbitMqEventBus.ts +105 -0
- package/src/rabbitmq/RabbitMqEventInjector.ts +66 -0
- package/src/rabbitmq/RabbitMqGateway.ts +474 -0
- package/src/rabbitmq/TerminationHandler.ts +31 -0
- package/src/rabbitmq/index.ts +3 -0
- package/src/sqlite/AbstractSqliteAccessor.ts +58 -0
- package/src/sqlite/AbstractSqliteObjectProjection.ts +31 -0
- package/src/sqlite/AbstractSqliteView.ts +53 -0
- package/src/sqlite/IContainer.ts +8 -0
- package/src/sqlite/SqliteEventLocker.ts +137 -0
- package/src/sqlite/SqliteObjectStorage.ts +142 -0
- package/src/sqlite/SqliteObjectView.ts +58 -0
- package/src/sqlite/SqliteProjectionDataParams.ts +16 -0
- package/src/sqlite/SqliteViewLocker.ts +171 -0
- package/src/sqlite/index.ts +8 -0
- package/src/sqlite/queries/eventLockTableInit.ts +10 -0
- package/src/sqlite/queries/index.ts +2 -0
- package/src/sqlite/queries/viewLockTableInit.ts +9 -0
- package/src/sqlite/utils/getEventId.ts +8 -0
- package/src/sqlite/utils/guid.ts +4 -0
- package/src/sqlite/utils/index.ts +2 -0
- package/src/utils/Lock.ts +99 -0
- package/src/utils/MapAssertable.ts +30 -0
- package/src/utils/delay.ts +8 -0
- package/src/utils/getHandler.ts +4 -4
- package/src/utils/getMessageHandlerNames.ts +2 -8
- package/src/utils/index.ts +8 -3
- package/src/utils/iteratorToArray.ts +6 -0
- package/src/utils/notEmpty.ts +1 -0
- package/src/utils/setupOneTimeEmitterSubscription.ts +5 -3
- package/src/utils/subscribe.ts +20 -6
- package/src/utils/validateHandlers.ts +2 -1
- package/types/AbstractAggregate.d.ts +61 -0
- package/types/AbstractProjection.d.ts +60 -0
- package/types/AbstractSaga.d.ts +31 -0
- package/types/AggregateCommandHandler.d.ts +20 -0
- package/types/CommandBus.d.ts +27 -0
- package/types/CqrsContainerBuilder.d.ts +21 -0
- package/types/Event.d.ts +9 -0
- package/types/EventDispatchPipeline.d.ts +18 -0
- package/types/EventDispatcher.d.ts +39 -0
- package/types/EventStore.d.ts +34 -0
- package/types/SagaEventHandler.d.ts +21 -0
- package/types/in-memory/InMemoryEventStorage.d.ts +24 -0
- package/types/in-memory/InMemoryLock.d.ts +21 -0
- package/types/in-memory/InMemoryMessageBus.d.ts +36 -0
- package/types/in-memory/InMemorySnapshotStorage.d.ts +37 -0
- package/types/in-memory/InMemoryView.d.ts +53 -0
- package/types/in-memory/index.d.ts +5 -0
- package/types/in-memory/utils/index.d.ts +1 -0
- package/types/in-memory/utils/nextCycle.d.ts +4 -0
- package/types/index.d.ts +13 -0
- package/types/interfaces/IAggregate.d.ts +51 -0
- package/types/interfaces/IAggregateSnapshotStorage.d.ts +7 -0
- package/types/interfaces/ICommand.d.ts +2 -0
- package/types/interfaces/ICommandBus.d.ts +14 -0
- package/types/interfaces/IContainer.d.ts +27 -0
- package/types/interfaces/IDispatchPipelineProcessor.d.ts +25 -0
- package/types/interfaces/IEvent.d.ts +6 -0
- package/types/interfaces/IEventBus.d.ts +6 -0
- package/types/interfaces/IEventDispatcher.d.ts +6 -0
- package/types/interfaces/IEventLocker.d.ts +24 -0
- package/types/interfaces/IEventReceptor.d.ts +5 -0
- package/types/interfaces/IEventSet.d.ts +3 -0
- package/types/interfaces/IEventStorageReader.d.ts +28 -0
- package/types/interfaces/IEventStorageWriter.d.ts +8 -0
- package/types/interfaces/IEventStore.d.ts +9 -0
- package/types/interfaces/IEventStream.d.ts +2 -0
- package/types/interfaces/IIdentifierProvider.d.ts +10 -0
- package/types/interfaces/ILogger.d.ts +22 -0
- package/types/interfaces/IMessage.d.ts +12 -0
- package/types/interfaces/IMessageBus.d.ts +7 -0
- package/types/interfaces/IObjectStorage.d.ts +8 -0
- package/types/interfaces/IObservable.d.ts +19 -0
- package/types/interfaces/IObserver.d.ts +4 -0
- package/types/interfaces/IProjection.d.ts +17 -0
- package/types/interfaces/ISaga.d.ts +30 -0
- package/types/interfaces/IViewLocker.d.ts +34 -0
- package/types/interfaces/Identifier.d.ts +1 -0
- package/types/interfaces/index.d.ts +27 -0
- package/types/interfaces/isObject.d.ts +1 -0
- package/types/rabbitmq/IContainer.d.ts +14 -0
- package/types/rabbitmq/RabbitMqEventBus.d.ts +42 -0
- package/types/rabbitmq/RabbitMqEventInjector.d.ts +13 -0
- package/types/rabbitmq/RabbitMqGateway.d.ts +79 -0
- package/types/rabbitmq/TerminationHandler.d.ts +10 -0
- package/types/rabbitmq/index.d.ts +3 -0
- package/types/sqlite/AbstractSqliteAccessor.d.ts +25 -0
- package/types/sqlite/AbstractSqliteObjectProjection.d.ts +8 -0
- package/types/sqlite/AbstractSqliteView.d.ts +18 -0
- package/types/sqlite/IContainer.d.ts +7 -0
- package/types/sqlite/SqliteEventLocker.d.ts +28 -0
- package/types/sqlite/SqliteObjectStorage.d.ts +16 -0
- package/types/sqlite/SqliteObjectView.d.ts +16 -0
- package/types/sqlite/SqliteProjectionDataParams.d.ts +14 -0
- package/types/sqlite/SqliteViewLocker.d.ts +30 -0
- package/types/sqlite/index.d.ts +8 -0
- package/types/sqlite/queries/eventLockTableInit.d.ts +1 -0
- package/types/sqlite/queries/index.d.ts +2 -0
- package/types/sqlite/queries/viewLockTableInit.d.ts +1 -0
- package/types/sqlite/utils/getEventId.d.ts +5 -0
- package/types/sqlite/utils/guid.d.ts +4 -0
- package/types/sqlite/utils/index.d.ts +2 -0
- package/types/utils/Deferred.d.ts +13 -0
- package/types/utils/Lock.d.ts +22 -0
- package/types/utils/MapAssertable.d.ts +11 -0
- package/types/utils/delay.d.ts +5 -0
- package/types/utils/getClassName.d.ts +4 -0
- package/types/utils/getHandler.d.ts +7 -0
- package/types/utils/getMessageHandlerNames.d.ts +5 -0
- package/types/utils/index.d.ts +13 -0
- package/types/utils/isClass.d.ts +1 -0
- package/types/utils/iteratorToArray.d.ts +1 -0
- package/types/utils/notEmpty.d.ts +1 -0
- package/types/utils/setupOneTimeEmitterSubscription.d.ts +12 -0
- package/types/utils/subscribe.d.ts +13 -0
- package/types/utils/validateHandlers.d.ts +4 -0
- package/dist/infrastructure/InMemoryEventStorage.js +0 -53
- package/dist/infrastructure/InMemoryEventStorage.js.map +0 -1
- package/dist/infrastructure/InMemoryLock.js +0 -68
- package/dist/infrastructure/InMemoryLock.js.map +0 -1
- package/dist/infrastructure/InMemoryMessageBus.js.map +0 -1
- package/dist/infrastructure/InMemorySnapshotStorage.js +0 -26
- package/dist/infrastructure/InMemorySnapshotStorage.js.map +0 -1
- package/dist/infrastructure/InMemoryView.js.map +0 -1
- package/dist/infrastructure/utils/Deferred.js.map +0 -1
- package/dist/infrastructure/utils/index.js.map +0 -1
- package/dist/infrastructure/utils/nextCycle.js.map +0 -1
- package/dist/interfaces.js.map +0 -1
- package/dist/utils/getHandledMessageTypes.js +0 -18
- package/dist/utils/getHandledMessageTypes.js.map +0 -1
- package/src/infrastructure/InMemoryEventStorage.ts +0 -68
- package/src/infrastructure/InMemoryLock.ts +0 -73
- package/src/infrastructure/InMemorySnapshotStorage.ts +0 -27
- package/src/interfaces.ts +0 -328
- package/src/utils/getHandledMessageTypes.ts +0 -20
- /package/dist/{infrastructure/utils → utils}/Deferred.js +0 -0
- /package/src/{infrastructure/utils → utils}/Deferred.ts +0 -0
|
@@ -6,13 +6,13 @@ exports.InMemoryMessageBus = void 0;
|
|
|
6
6
|
* Keeps all subscriptions and messages in memory.
|
|
7
7
|
*/
|
|
8
8
|
class InMemoryMessageBus {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
constructor({
|
|
14
|
-
this
|
|
15
|
-
this
|
|
9
|
+
handlers = new Map();
|
|
10
|
+
uniqueEventHandlers;
|
|
11
|
+
queueName;
|
|
12
|
+
queues = new Map();
|
|
13
|
+
constructor({ queueName, uniqueEventHandlers = !!queueName } = {}) {
|
|
14
|
+
this.queueName = queueName;
|
|
15
|
+
this.uniqueEventHandlers = uniqueEventHandlers;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Subscribe to message type
|
|
@@ -26,23 +26,23 @@ class InMemoryMessageBus {
|
|
|
26
26
|
throw new TypeError(`2 arguments are expected, but ${arguments.length} received`);
|
|
27
27
|
// Events published to a named queue must be consumed only once.
|
|
28
28
|
// For example, for sending a welcome email, NotificationReceptor will subscribe to "notifications:userCreated".
|
|
29
|
-
// Since we use an in-memory bus, there is no need to track message handling by multiple distributed
|
|
30
|
-
// and we only need to make sure that no more than 1 such subscriber will be created
|
|
31
|
-
if (!this
|
|
32
|
-
this
|
|
33
|
-
else if (this
|
|
34
|
-
throw new Error(`"${messageType}" handler is already set up on the "${this
|
|
35
|
-
this
|
|
29
|
+
// Since we use an in-memory bus, there is no need to track message handling by multiple distributed
|
|
30
|
+
// subscribers, and we only need to make sure that no more than 1 such subscriber will be created
|
|
31
|
+
if (!this.handlers.has(messageType))
|
|
32
|
+
this.handlers.set(messageType, new Set());
|
|
33
|
+
else if (this.uniqueEventHandlers)
|
|
34
|
+
throw new Error(`"${messageType}" handler is already set up on the "${this.queueName}" queue`);
|
|
35
|
+
this.handlers.get(messageType)?.add(handler);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Get or create a named queue.
|
|
39
39
|
* Named queues support only one handler per event type.
|
|
40
40
|
*/
|
|
41
|
-
queue(
|
|
42
|
-
let queue = this
|
|
41
|
+
queue(queueName) {
|
|
42
|
+
let queue = this.queues.get(queueName);
|
|
43
43
|
if (!queue) {
|
|
44
|
-
queue = new InMemoryMessageBus({
|
|
45
|
-
this
|
|
44
|
+
queue = new InMemoryMessageBus({ queueName, uniqueEventHandlers: true });
|
|
45
|
+
this.queues.set(queueName, queue);
|
|
46
46
|
}
|
|
47
47
|
return queue;
|
|
48
48
|
}
|
|
@@ -56,9 +56,9 @@ class InMemoryMessageBus {
|
|
|
56
56
|
throw new TypeError('handler argument must be a Function');
|
|
57
57
|
if (arguments.length !== 2)
|
|
58
58
|
throw new TypeError(`2 arguments are expected, but ${arguments.length} received`);
|
|
59
|
-
if (!this
|
|
59
|
+
if (!this.handlers.has(messageType))
|
|
60
60
|
throw new Error(`No ${messageType} subscribers found`);
|
|
61
|
-
this
|
|
61
|
+
this.handlers.get(messageType)?.delete(handler);
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Send command to exactly 1 command handler
|
|
@@ -68,7 +68,7 @@ class InMemoryMessageBus {
|
|
|
68
68
|
throw new TypeError('command argument must be an Object');
|
|
69
69
|
if (typeof command.type !== 'string' || !command.type.length)
|
|
70
70
|
throw new TypeError('command.type argument must be a non-empty String');
|
|
71
|
-
const handlers = this
|
|
71
|
+
const handlers = this.handlers.get(command.type);
|
|
72
72
|
if (!handlers || !handlers.size)
|
|
73
73
|
throw new Error(`No '${command.type}' subscribers found`);
|
|
74
74
|
if (handlers.size > 1)
|
|
@@ -79,16 +79,17 @@ class InMemoryMessageBus {
|
|
|
79
79
|
/**
|
|
80
80
|
* Publish event to all subscribers (if any)
|
|
81
81
|
*/
|
|
82
|
-
async publish(event) {
|
|
82
|
+
async publish(event, meta) {
|
|
83
83
|
if (typeof event !== 'object' || !event)
|
|
84
84
|
throw new TypeError('event argument must be an Object');
|
|
85
85
|
if (typeof event.type !== 'string' || !event.type.length)
|
|
86
86
|
throw new TypeError('event.type argument must be a non-empty String');
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
const promises = [];
|
|
88
|
+
for (const handler of this.handlers.get(event.type) ?? [])
|
|
89
|
+
promises.push(handler(event, meta));
|
|
90
|
+
for (const namedQueue of this.queues.values())
|
|
91
|
+
promises.push(namedQueue.publish(event, meta));
|
|
92
|
+
return Promise.all(promises);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
exports.InMemoryMessageBus = InMemoryMessageBus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InMemoryMessageBus.js","sourceRoot":"","sources":["../../src/in-memory/InMemoryMessageBus.ts"],"names":[],"mappings":";;;AAQA;;;GAGG;AACH,MAAa,kBAAkB;IAEpB,QAAQ,GAAsC,IAAI,GAAG,EAAE,CAAC;IACxD,mBAAmB,CAAU;IAC7B,SAAS,CAAqB;IAC9B,MAAM,GAA6B,IAAI,GAAG,EAAE,CAAC;IAEvD,YAAY,EAAE,SAAS,EAAE,mBAAmB,GAAG,CAAC,CAAC,SAAS,KAGtD,EAAE;QACL,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,EAAE,CAAC,WAAmB,EAAE,OAAwB;QAC/C,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC,MAAM;YACzD,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC,CAAC;QACxE,IAAI,OAAO,OAAO,KAAK,UAAU;YAChC,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAC;QAC5D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YACzB,MAAM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AK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM;YACvD,MAAM,IAAI,SAAS,CAAC,gDAAgD,CAAC,CAAC;QAEvE,MAAM,QAAQ,GAAmB,EAAE,CAAC;QAEpC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;YACxD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAErC,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAC5C,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAEhD,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACD;AA3GD,gDA2GC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemorySnapshotStorage = void 0;
|
|
4
|
+
const Event = require("../Event");
|
|
5
|
+
const SNAPSHOT_EVENT_TYPE = 'snapshot';
|
|
6
|
+
const isSnapshotEvent = (event) => (!!event && event.type === SNAPSHOT_EVENT_TYPE);
|
|
7
|
+
/**
|
|
8
|
+
* In-memory storage for aggregate snapshots.
|
|
9
|
+
* Storage content resets on app restart
|
|
10
|
+
*/
|
|
11
|
+
class InMemorySnapshotStorage {
|
|
12
|
+
#snapshots = new Map();
|
|
13
|
+
#logger;
|
|
14
|
+
constructor(c) {
|
|
15
|
+
this.#logger = c?.logger && 'child' in c?.logger ?
|
|
16
|
+
c?.logger.child({ service: new.target.name }) :
|
|
17
|
+
c?.logger;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get latest aggregate snapshot
|
|
21
|
+
*/
|
|
22
|
+
async getAggregateSnapshot(aggregateId) {
|
|
23
|
+
return this.#snapshots.get(aggregateId);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Save new aggregate snapshot
|
|
27
|
+
*/
|
|
28
|
+
async saveAggregateSnapshot(snapshotEvent) {
|
|
29
|
+
if (!snapshotEvent.aggregateId)
|
|
30
|
+
throw new TypeError('event.aggregateId is required');
|
|
31
|
+
this.#logger?.debug(`Persisting ${Event.describe(snapshotEvent)}`);
|
|
32
|
+
this.#snapshots.set(snapshotEvent.aggregateId, snapshotEvent);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Delete aggregate snapshot
|
|
36
|
+
*/
|
|
37
|
+
deleteAggregateSnapshot(snapshotEvent) {
|
|
38
|
+
if (!snapshotEvent.aggregateId)
|
|
39
|
+
throw new TypeError('snapshotEvent.aggregateId argument required');
|
|
40
|
+
this.#logger?.debug(`Removing ${Event.describe(snapshotEvent)}`);
|
|
41
|
+
this.#snapshots.delete(snapshotEvent.aggregateId);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Processes a batch of events, saves any snapshot events found, and returns the batch
|
|
45
|
+
* without the snapshot events.
|
|
46
|
+
*
|
|
47
|
+
* This method is part of the `IDispatchPipelineProcessor` interface.
|
|
48
|
+
*/
|
|
49
|
+
async process(batch) {
|
|
50
|
+
const snapshotEvents = batch.map(e => e.event).filter(isSnapshotEvent);
|
|
51
|
+
for (const event of snapshotEvents)
|
|
52
|
+
await this.saveAggregateSnapshot(event);
|
|
53
|
+
return batch.filter(e => !isSnapshotEvent(e.event));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reverts the snapshots associated with the events in the given batch.
|
|
57
|
+
* It filters the batch for snapshot events and deletes the corresponding aggregate snapshots.
|
|
58
|
+
*
|
|
59
|
+
* This method is part of the `IDispatchPipelineProcessor` interface.
|
|
60
|
+
*
|
|
61
|
+
* @param batch The batch of events to revert snapshots for.
|
|
62
|
+
*/
|
|
63
|
+
async revert(batch) {
|
|
64
|
+
const snapshotEvents = batch.map(e => e.event).filter(isSnapshotEvent);
|
|
65
|
+
for (const snapshotEvent of snapshotEvents)
|
|
66
|
+
await this.deleteAggregateSnapshot(snapshotEvent);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.InMemorySnapshotStorage = InMemorySnapshotStorage;
|
|
70
|
+
//# sourceMappingURL=InMemorySnapshotStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InMemorySnapshotStorage.js","sourceRoot":"","sources":["../../src/in-memory/InMemorySnapshotStorage.ts"],"names":[],"mappings":";;;AASA,kCAAkC;AAElC,MAAM,mBAAmB,GAAG,UAAU,CAAC;AACvC,MAAM,eAAe,GAAG,CAAC,KAAc,EAA0C,EAAE,CAClF,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC;AAEjD;;;GAGG;AACH,MAAa,uBAAuB;IAEnC,UAAU,GAA4B,IAAI,GAAG,EAAE,CAAC;IAChD,OAAO,CAAsB;IAE7B,YAAY,CAAuC;QAClD,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,MAAM,IAAI,OAAO,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YACjD,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAC/C,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,oBAAoB,CAAC,WAAmB;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,qBAAqB,CAAC,aAAqB;QAChD,IAAI,CAAC,aAAa,CAAC,WAAW;YAC7B,MAAM,IAAI,SAAS,CAAC,+BAA+B,CAAC,CAAC;QAEtD,IAAI,CAAC,OAAO,EAAE,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MemoryView {
|
|
|
22
22
|
}
|
|
23
23
|
_map = new Map();
|
|
24
24
|
#lock;
|
|
25
|
-
#asyncWrites;
|
|
26
25
|
/** Whether the view is restored */
|
|
27
26
|
get ready() {
|
|
28
27
|
return !this.#lock.locked;
|
|
@@ -31,8 +30,7 @@ class InMemoryView {
|
|
|
31
30
|
get size() {
|
|
32
31
|
return this._map.size;
|
|
33
32
|
}
|
|
34
|
-
constructor(
|
|
35
|
-
this.#asyncWrites = options?.asyncWrites ?? false;
|
|
33
|
+
constructor() {
|
|
36
34
|
this.#lock = new InMemoryLock_1.InMemoryLock();
|
|
37
35
|
// explicitly bind the `get` method to this object for easier using in Promises
|
|
38
36
|
Object.defineProperty(this, this.get.name, {
|
|
@@ -72,6 +70,14 @@ class InMemoryView {
|
|
|
72
70
|
await (0, utils_1.nextCycle)();
|
|
73
71
|
return this._map.get(key);
|
|
74
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Get record with a given key synchronously
|
|
75
|
+
*/
|
|
76
|
+
getSync(key) {
|
|
77
|
+
if (!key)
|
|
78
|
+
throw new TypeError('key argument required');
|
|
79
|
+
return this._map.get(key);
|
|
80
|
+
}
|
|
75
81
|
/** Get all records matching an optional filter */
|
|
76
82
|
async getAll(filter) {
|
|
77
83
|
if (filter && typeof filter !== 'function')
|
|
@@ -92,8 +98,6 @@ class InMemoryView {
|
|
|
92
98
|
throw new TypeError('key argument required');
|
|
93
99
|
if (typeof value === 'function')
|
|
94
100
|
throw new TypeError('value argument must be an instance of an Object');
|
|
95
|
-
if (this.#asyncWrites)
|
|
96
|
-
await (0, utils_1.nextCycle)();
|
|
97
101
|
if (this._map.has(key))
|
|
98
102
|
throw new Error(`Key '${key}' already exists`);
|
|
99
103
|
this._map.set(key, value);
|
|
@@ -132,17 +136,17 @@ class InMemoryView {
|
|
|
132
136
|
/** Update existing record */
|
|
133
137
|
async _update(key, update) {
|
|
134
138
|
const value = this._map.get(key);
|
|
139
|
+
if (!value)
|
|
140
|
+
throw new Error(`Key '${key}' does not exist`);
|
|
135
141
|
const updatedValue = applyUpdate(value, update);
|
|
136
|
-
if (
|
|
137
|
-
|
|
142
|
+
if (updatedValue === undefined)
|
|
143
|
+
return;
|
|
138
144
|
this._map.set(key, updatedValue);
|
|
139
145
|
}
|
|
140
146
|
/** Delete record */
|
|
141
147
|
async delete(key) {
|
|
142
148
|
if (!key)
|
|
143
149
|
throw new TypeError('key argument required');
|
|
144
|
-
if (this.#asyncWrites)
|
|
145
|
-
await (0, utils_1.nextCycle)();
|
|
146
150
|
this._map.delete(key);
|
|
147
151
|
}
|
|
148
152
|
/** Delete all records that match filter criteria */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InMemoryView.js","sourceRoot":"","sources":["../../src/in-memory/InMemoryView.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAE9C,mCAAoC;AAEpC;;;GAGG;AACH,SAAS,WAAW,CAAI,IAAO,EAAE,MAAmB;IACnD,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,qBAAqB,KAAK,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC,CAAC;QACN,qBAAqB,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAa,YAAY;IAExB,MAAM,CAAC,OAAO;QACb,OAAQ,IAAI,YAAY,EAAuB,CAAC;IACjD,CAAC;IAES,IAAI,GAA6B,IAAI,GAAG,EAAE,CAAC;IAErD,KAAK,CAAe;IAEpB,mCAAmC;IACnC,IAAI,KAAK;QACR,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,oCAAoC;IACpC,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;QACC,IAAI,CAAC,KAAK,GAAG,IAAI,2BAAY,EAAE,CAAC;QAEhC,+EAA+E;QAC/E,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,IAA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strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./InMemoryEventStorage"), exports);
|
|
18
|
+
__exportStar(require("./InMemoryLock"), exports);
|
|
19
|
+
__exportStar(require("./InMemoryMessageBus"), exports);
|
|
20
|
+
__exportStar(require("./InMemorySnapshotStorage"), exports);
|
|
21
|
+
__exportStar(require("./InMemoryView"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/in-memory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,iDAA+B;AAC/B,uDAAqC;AACrC,4DAA0C;AAC1C,iDAA+B"}
|
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Deferred"), exports);
|
|
18
17
|
__exportStar(require("./nextCycle"), exports);
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/in-memory/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}
|
|
@@ -4,6 +4,6 @@ exports.nextCycle = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* @returns Promise that resolves on next event loop cycle
|
|
6
6
|
*/
|
|
7
|
-
const nextCycle = () => new Promise(rs =>
|
|
7
|
+
const nextCycle = () => new Promise(rs => setImmediate(rs));
|
|
8
8
|
exports.nextCycle = nextCycle;
|
|
9
9
|
//# sourceMappingURL=nextCycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextCycle.js","sourceRoot":"","sources":["../../../src/in-memory/utils/nextCycle.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,SAAS,GAAG,GAAkB,EAAE,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;AAArE,QAAA,SAAS,aAA4D"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.subscribe = exports.
|
|
17
|
+
exports.subscribe = exports.getMessageHandlerNames = exports.Event = exports.ContainerBuilder = void 0;
|
|
18
18
|
var CqrsContainerBuilder_1 = require("./CqrsContainerBuilder");
|
|
19
19
|
Object.defineProperty(exports, "ContainerBuilder", { enumerable: true, get: function () { return CqrsContainerBuilder_1.CqrsContainerBuilder; } });
|
|
20
20
|
__exportStar(require("./CommandBus"), exports);
|
|
@@ -24,16 +24,11 @@ __exportStar(require("./AggregateCommandHandler"), exports);
|
|
|
24
24
|
__exportStar(require("./AbstractSaga"), exports);
|
|
25
25
|
__exportStar(require("./SagaEventHandler"), exports);
|
|
26
26
|
__exportStar(require("./AbstractProjection"), exports);
|
|
27
|
-
__exportStar(require("./
|
|
28
|
-
__exportStar(require("./
|
|
29
|
-
__exportStar(require("./infrastructure/InMemorySnapshotStorage"), exports);
|
|
30
|
-
__exportStar(require("./infrastructure/InMemoryView"), exports);
|
|
31
|
-
__exportStar(require("./infrastructure/InMemoryLock"), exports);
|
|
32
|
-
__exportStar(require("./infrastructure/utils/Deferred"), exports);
|
|
27
|
+
__exportStar(require("./EventDispatcher"), exports);
|
|
28
|
+
__exportStar(require("./in-memory"), exports);
|
|
33
29
|
exports.Event = require("./Event");
|
|
34
30
|
var utils_1 = require("./utils");
|
|
35
31
|
Object.defineProperty(exports, "getMessageHandlerNames", { enumerable: true, get: function () { return utils_1.getMessageHandlerNames; } });
|
|
36
|
-
Object.defineProperty(exports, "getHandledMessageTypes", { enumerable: true, get: function () { return utils_1.getHandledMessageTypes; } });
|
|
37
32
|
Object.defineProperty(exports, "subscribe", { enumerable: true, get: function () { return utils_1.subscribe; } });
|
|
38
33
|
__exportStar(require("./interfaces"), exports);
|
|
39
34
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+DAAkF;AAAzE,wHAAA,oBAAoB,OAAoB;AAEjD,+CAA6B;AAC7B,+CAA6B;AAE7B,sDAAoC;AACpC,4DAA0C;AAC1C,iDAA+B;AAC/B,qDAAmC;AACnC,uDAAqC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+DAAkF;AAAzE,wHAAA,oBAAoB,OAAoB;AAEjD,+CAA6B;AAC7B,+CAA6B;AAE7B,sDAAoC;AACpC,4DAA0C;AAC1C,iDAA+B;AAC/B,qDAAmC;AACnC,uDAAqC;AACrC,oDAAkC;AAElC,8CAA4B;AAE5B,mCAAiC;AACjC,iCAGiB;AAFhB,+GAAA,sBAAsB,OAAA;AACtB,kGAAA,SAAS,OAAA;AAGV,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAggregate.js","sourceRoot":"","sources":["../../src/interfaces/IAggregate.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAggregateSnapshotStorage.js","sourceRoot":"","sources":["../../src/interfaces/IAggregateSnapshotStorage.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICommand.js","sourceRoot":"","sources":["../../src/interfaces/ICommand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICommandBus.js","sourceRoot":"","sources":["../../src/interfaces/ICommandBus.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IContainer.js","sourceRoot":"","sources":["../../src/interfaces/IContainer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDispatchPipelineProcessor = void 0;
|
|
4
|
+
const isObject_1 = require("./isObject");
|
|
5
|
+
const isDispatchPipelineProcessor = (obj) => (0, isObject_1.isObject)(obj)
|
|
6
|
+
&& 'process' in obj
|
|
7
|
+
&& typeof obj.process === 'function';
|
|
8
|
+
exports.isDispatchPipelineProcessor = isDispatchPipelineProcessor;
|
|
9
|
+
//# sourceMappingURL=IDispatchPipelineProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDispatchPipelineProcessor.js","sourceRoot":"","sources":["../../src/interfaces/IDispatchPipelineProcessor.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AA8B/B,MAAM,2BAA2B,GAAG,CAAC,GAAY,EAAqC,EAAE,CAC9F,IAAA,mBAAQ,EAAC,GAAG,CAAC;OACV,SAAS,IAAI,GAAG;OAChB,OAAQ,GAAkC,CAAC,OAAO,KAAK,UAAU,CAAC;AAHzD,QAAA,2BAA2B,+BAG8B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEvent = void 0;
|
|
4
|
+
const isObject_1 = require("./isObject");
|
|
5
|
+
const isEvent = (event) => (0, isObject_1.isObject)(event)
|
|
6
|
+
&& 'type' in event
|
|
7
|
+
&& typeof event.type === 'string'
|
|
8
|
+
&& event.type.length > 0;
|
|
9
|
+
exports.isEvent = isEvent;
|
|
10
|
+
//# sourceMappingURL=IEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEvent.js","sourceRoot":"","sources":["../../src/interfaces/IEvent.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAQ/B,MAAM,OAAO,GAAG,CAAC,KAAc,EAAmB,EAAE,CAC1D,IAAA,mBAAQ,EAAC,KAAK,CAAC;OACZ,MAAM,IAAI,KAAK;OACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;OAC9B,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AAJb,QAAA,OAAO,WAIM"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIEventBus = void 0;
|
|
4
|
+
const IObservable_1 = require("./IObservable");
|
|
5
|
+
const isIEventBus = (obj) => (0, IObservable_1.isIObservable)(obj)
|
|
6
|
+
&& 'publish' in obj
|
|
7
|
+
&& typeof obj.publish === 'function';
|
|
8
|
+
exports.isIEventBus = isIEventBus;
|
|
9
|
+
//# sourceMappingURL=IEventBus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventBus.js","sourceRoot":"","sources":["../../src/interfaces/IEventBus.ts"],"names":[],"mappings":";;;AACA,+CAA2D;AAMpD,MAAM,WAAW,GAAG,CAAC,GAAY,EAAE,EAAE,CAC3C,IAAA,2BAAa,EAAC,GAAG,CAAC;OACf,SAAS,IAAI,GAAG;OAChB,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CAAC;AAHzB,QAAA,WAAW,eAGc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventDispatcher.js","sourceRoot":"","sources":["../../src/interfaces/IEventDispatcher.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEventLocker = void 0;
|
|
4
|
+
const isObject_1 = require("./isObject");
|
|
5
|
+
const isEventLocker = (view) => (0, isObject_1.isObject)(view)
|
|
6
|
+
&& 'getLastEvent' in view
|
|
7
|
+
&& 'tryMarkAsProjecting' in view
|
|
8
|
+
&& 'markAsProjected' in view;
|
|
9
|
+
exports.isEventLocker = isEventLocker;
|
|
10
|
+
//# sourceMappingURL=IEventLocker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventLocker.js","sourceRoot":"","sources":["../../src/interfaces/IEventLocker.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AA4B/B,MAAM,aAAa,GAAG,CAAC,IAAa,EAAwB,EAAE,CACpE,IAAA,mBAAQ,EAAC,IAAI,CAAC;OACX,cAAc,IAAI,IAAI;OACtB,qBAAqB,IAAI,IAAI;OAC7B,iBAAiB,IAAI,IAAI,CAAC;AAJjB,QAAA,aAAa,iBAII"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventReceptor.js","sourceRoot":"","sources":["../../src/interfaces/IEventReceptor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEventSet = void 0;
|
|
4
|
+
const IEvent_1 = require("./IEvent");
|
|
5
|
+
const isEventSet = (arr) => Array.isArray(arr)
|
|
6
|
+
&& arr.every(IEvent_1.isEvent);
|
|
7
|
+
exports.isEventSet = isEventSet;
|
|
8
|
+
//# sourceMappingURL=IEventSet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventSet.js","sourceRoot":"","sources":["../../src/interfaces/IEventSet.ts"],"names":[],"mappings":";;;AAAA,qCAA2C;AAIpC,MAAM,UAAU,GAAG,CAAC,GAAY,EAAoB,EAAE,CAC5D,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;OACf,GAAG,CAAC,KAAK,CAAC,gBAAO,CAAC,CAAC;AAFV,QAAA,UAAU,cAEA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIEventStorageReader = void 0;
|
|
4
|
+
const isObject_1 = require("./isObject");
|
|
5
|
+
const isIEventStorageReader = (storage) => (0, isObject_1.isObject)(storage)
|
|
6
|
+
&& 'getEventsByTypes' in storage
|
|
7
|
+
&& typeof storage.getEventsByTypes === 'function'
|
|
8
|
+
&& 'getAggregateEvents' in storage
|
|
9
|
+
&& typeof storage.getAggregateEvents === 'function'
|
|
10
|
+
&& 'getSagaEvents' in storage
|
|
11
|
+
&& typeof storage.getSagaEvents === 'function';
|
|
12
|
+
exports.isIEventStorageReader = isIEventStorageReader;
|
|
13
|
+
//# sourceMappingURL=IEventStorageReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventStorageReader.js","sourceRoot":"","sources":["../../src/interfaces/IEventStorageReader.ts"],"names":[],"mappings":";;;AAGA,yCAAsC;AAiC/B,MAAM,qBAAqB,GAAG,CAAC,OAAgB,EAAkC,EAAE,CACzF,IAAA,mBAAQ,EAAC,OAAO,CAAC;OACd,kBAAkB,IAAI,OAAO;OAC7B,OAAO,OAAO,CAAC,gBAAgB,KAAK,UAAU;OAC9C,oBAAoB,IAAI,OAAO;OAC/B,OAAO,OAAO,CAAC,kBAAkB,KAAK,UAAU;OAChD,eAAe,IAAI,OAAO;OAC1B,OAAO,OAAO,CAAC,aAAa,KAAK,UAAU,CAAC;AAPnC,QAAA,qBAAqB,yBAOc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventStorageWriter.js","sourceRoot":"","sources":["../../src/interfaces/IEventStorageWriter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventStore.js","sourceRoot":"","sources":["../../src/interfaces/IEventStore.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventStream.js","sourceRoot":"","sources":["../../src/interfaces/IEventStream.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIdentifierProvider = void 0;
|
|
4
|
+
const isObject_1 = require("./isObject");
|
|
5
|
+
const isIdentifierProvider = (obj) => (0, isObject_1.isObject)(obj)
|
|
6
|
+
&& 'getNewId' in obj
|
|
7
|
+
&& typeof obj.getNewId === 'function';
|
|
8
|
+
exports.isIdentifierProvider = isIdentifierProvider;
|
|
9
|
+
//# sourceMappingURL=IIdentifierProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IIdentifierProvider.js","sourceRoot":"","sources":["../../src/interfaces/IIdentifierProvider.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAY/B,MAAM,oBAAoB,GAAG,CAAC,GAAQ,EAA8B,EAAE,CAC5E,IAAA,mBAAQ,EAAC,GAAG,CAAC;OACV,UAAU,IAAI,GAAG;OACjB,OAAO,GAAG,CAAC,QAAQ,KAAK,UAAU,CAAC;AAH1B,QAAA,oBAAoB,wBAGM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILogger.js","sourceRoot":"","sources":["../../src/interfaces/ILogger.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMessage = void 0;
|
|
4
|
+
const isObject_1 = require("./isObject");
|
|
5
|
+
const isMessage = (obj) => (0, isObject_1.isObject)(obj)
|
|
6
|
+
&& 'type' in obj
|
|
7
|
+
&& typeof obj.type === 'string';
|
|
8
|
+
exports.isMessage = isMessage;
|
|
9
|
+
//# sourceMappingURL=IMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMessage.js","sourceRoot":"","sources":["../../src/interfaces/IMessage.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAiB/B,MAAM,SAAS,GAAG,CAAC,GAAY,EAAmB,EAAE,CAC1D,IAAA,mBAAQ,EAAC,GAAG,CAAC;OACV,MAAM,IAAI,GAAG;OACb,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC;AAHpB,QAAA,SAAS,aAGW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMessageBus.js","sourceRoot":"","sources":["../../src/interfaces/IMessageBus.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IObjectStorage.js","sourceRoot":"","sources":["../../src/interfaces/IObjectStorage.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIObservable = void 0;
|
|
4
|
+
const isObject_1 = require("./isObject");
|
|
5
|
+
const isIObservable = (obj) => (0, isObject_1.isObject)(obj)
|
|
6
|
+
&& 'on' in obj
|
|
7
|
+
&& typeof obj.on === 'function'
|
|
8
|
+
&& 'off' in obj
|
|
9
|
+
&& typeof obj.off === 'function';
|
|
10
|
+
exports.isIObservable = isIObservable;
|
|
11
|
+
//# sourceMappingURL=IObservable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IObservable.js","sourceRoot":"","sources":["../../src/interfaces/IObservable.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAwB/B,MAAM,aAAa,GAAG,CAAC,GAAY,EAAsB,EAAE,CACjE,IAAA,mBAAQ,EAAC,GAAG,CAAC;OACV,IAAI,IAAI,GAAG;OACX,OAAO,GAAG,CAAC,EAAE,KAAK,UAAU;OAC5B,KAAK,IAAI,GAAG;OACZ,OAAO,GAAG,CAAC,GAAG,KAAK,UAAU,CAAC;AALrB,QAAA,aAAa,iBAKQ"}
|