node-cqrs 0.16.4 → 0.17.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/CHANGELOG.md +45 -0
- package/README.md +2 -1
- package/dist/AbstractAggregate.js +178 -0
- package/dist/AbstractAggregate.js.map +1 -0
- package/dist/AbstractProjection.js +121 -0
- package/dist/AbstractProjection.js.map +1 -0
- package/dist/AbstractSaga.js +99 -0
- package/dist/AbstractSaga.js.map +1 -0
- package/dist/AggregateCommandHandler.js +85 -0
- package/dist/AggregateCommandHandler.js.map +1 -0
- package/dist/CommandBus.js +77 -0
- package/dist/CommandBus.js.map +1 -0
- package/dist/CqrsContainerBuilder.js +77 -0
- package/dist/CqrsContainerBuilder.js.map +1 -0
- package/dist/Event.js +43 -0
- package/dist/Event.js.map +1 -0
- package/dist/EventStore.js +229 -0
- package/dist/EventStore.js.map +1 -0
- package/dist/SagaEventHandler.js +117 -0
- package/dist/SagaEventHandler.js.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/InMemoryEventStorage.js +53 -0
- package/dist/infrastructure/InMemoryEventStorage.js.map +1 -0
- package/dist/infrastructure/InMemoryLock.js +68 -0
- package/dist/infrastructure/InMemoryLock.js.map +1 -0
- package/dist/infrastructure/InMemoryMessageBus.js +95 -0
- package/dist/infrastructure/InMemoryMessageBus.js.map +1 -0
- package/dist/infrastructure/InMemorySnapshotStorage.js +26 -0
- package/dist/infrastructure/InMemorySnapshotStorage.js.map +1 -0
- package/dist/infrastructure/InMemoryView.js +173 -0
- package/dist/infrastructure/InMemoryView.js.map +1 -0
- package/dist/infrastructure/utils/Deferred.js +38 -0
- package/dist/infrastructure/utils/Deferred.js.map +1 -0
- package/dist/infrastructure/utils/index.js +19 -0
- package/dist/infrastructure/utils/index.js.map +1 -0
- package/dist/infrastructure/utils/nextCycle.js +9 -0
- package/dist/infrastructure/utils/nextCycle.js.map +1 -0
- package/dist/interfaces.js +4 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/utils/getClassName.js +10 -0
- package/dist/utils/getClassName.js.map +1 -0
- package/dist/utils/getHandledMessageTypes.js +18 -0
- package/dist/utils/getHandledMessageTypes.js.map +1 -0
- package/dist/utils/getHandler.js +20 -0
- package/dist/utils/getHandler.js.map +1 -0
- package/dist/utils/getMessageHandlerNames.js +38 -0
- package/dist/utils/getMessageHandlerNames.js.map +1 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/isClass.js +8 -0
- package/dist/utils/isClass.js.map +1 -0
- package/dist/utils/setupOneTimeEmitterSubscription.js +46 -0
- package/dist/utils/setupOneTimeEmitterSubscription.js.map +1 -0
- package/dist/utils/subscribe.js +39 -0
- package/dist/utils/subscribe.js.map +1 -0
- package/dist/utils/validateHandlers.js +21 -0
- package/dist/utils/validateHandlers.js.map +1 -0
- package/package.json +23 -12
- package/src/AbstractAggregate.ts +223 -0
- package/src/AbstractProjection.ts +172 -0
- package/src/AbstractSaga.ts +118 -0
- package/src/AggregateCommandHandler.ts +129 -0
- package/src/CommandBus.ts +98 -0
- package/src/CqrsContainerBuilder.ts +120 -0
- package/src/Event.ts +43 -0
- package/src/EventStore.ts +315 -0
- package/src/SagaEventHandler.ts +161 -0
- package/src/index.ts +26 -0
- package/src/infrastructure/InMemoryEventStorage.ts +68 -0
- package/src/infrastructure/InMemoryLock.ts +73 -0
- package/src/infrastructure/InMemoryMessageBus.ts +118 -0
- package/src/infrastructure/InMemorySnapshotStorage.ts +27 -0
- package/src/infrastructure/InMemoryView.ts +221 -0
- package/src/infrastructure/utils/Deferred.ts +41 -0
- package/src/infrastructure/utils/index.ts +2 -0
- package/src/infrastructure/utils/nextCycle.ts +4 -0
- package/src/interfaces.ts +328 -0
- package/src/utils/getClassName.ts +6 -0
- package/src/utils/{getHandledMessageTypes.js → getHandledMessageTypes.ts} +4 -8
- package/src/utils/{getHandler.js → getHandler.ts} +6 -7
- package/src/utils/{getMessageHandlerNames.js → getMessageHandlerNames.ts} +2 -9
- package/src/utils/index.ts +8 -0
- package/src/utils/{isClass.js → isClass.ts} +2 -4
- package/src/utils/setupOneTimeEmitterSubscription.ts +57 -0
- package/src/{subscribe.js → utils/subscribe.ts} +21 -18
- package/src/utils/{validateHandlers.js → validateHandlers.ts} +2 -8
- package/jsconfig.json +0 -15
- package/src/AbstractAggregate.js +0 -277
- package/src/AbstractProjection.js +0 -192
- package/src/AbstractSaga.js +0 -171
- package/src/AggregateCommandHandler.js +0 -126
- package/src/CommandBus.js +0 -91
- package/src/CqrsContainerBuilder.js +0 -131
- package/src/EventStore.js +0 -457
- package/src/EventStream.js +0 -63
- package/src/SagaEventHandler.js +0 -141
- package/src/index.js +0 -21
- package/src/infrastructure/InMemoryEventStorage.js +0 -76
- package/src/infrastructure/InMemoryMessageBus.js +0 -132
- package/src/infrastructure/InMemorySnapshotStorage.js +0 -40
- package/src/infrastructure/InMemoryView.js +0 -265
- package/src/utils/getClassName.js +0 -11
- package/src/utils/index.js +0 -6
- package/src/utils/nullLogger.js +0 -8
- package/types/index.d.ts +0 -16
- package/types/interfaces/IAggregate.d.ts +0 -30
- package/types/interfaces/IAggregateSnapshotStorage.d.ts +0 -4
- package/types/interfaces/ICommandBus.d.ts +0 -6
- package/types/interfaces/ICommandHandler.d.ts +0 -3
- package/types/interfaces/IConcurrentView.d.ts +0 -22
- package/types/interfaces/IEventReceptor.d.ts +0 -3
- package/types/interfaces/IEventStorage.d.ts +0 -20
- package/types/interfaces/IEventStore.d.ts +0 -18
- package/types/interfaces/IEventStream.d.ts +0 -13
- package/types/interfaces/ILogger.d.ts +0 -3
- package/types/interfaces/IMessageBus.d.ts +0 -5
- package/types/interfaces/IObserver.d.ts +0 -11
- package/types/interfaces/IProjection.d.ts +0 -10
- package/types/interfaces/ISaga.d.ts +0 -27
- package/types/interfaces/Identifier.d.ts +0 -1
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare type IMessageHandler = (message: IMessage) => void;
|
|
2
|
-
|
|
3
|
-
declare interface IObservable {
|
|
4
|
-
on(type: string, handler: IMessageHandler): void;
|
|
5
|
-
|
|
6
|
-
queue?(name: string): IObservable;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
declare interface IObserver {
|
|
10
|
-
subscribe(observable: IObservable): void;
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare interface IProjection extends IObserver {
|
|
2
|
-
readonly view: object;
|
|
3
|
-
subscribe(eventStore: IEventStore): void;
|
|
4
|
-
project(event: IEvent, options?: { nowait: boolean }): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
declare interface IProjectionConstructor {
|
|
8
|
-
new(c?: any): IProjection;
|
|
9
|
-
readonly handles?: string[];
|
|
10
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare interface ISaga {
|
|
2
|
-
/** List of commands emitted by Saga */
|
|
3
|
-
readonly uncommittedMessages: ICommand[];
|
|
4
|
-
|
|
5
|
-
/** Main entry point for Saga events */
|
|
6
|
-
apply(event: IEvent): void | Promise<void>;
|
|
7
|
-
|
|
8
|
-
/** Reset emitted commands when they are not longer needed */
|
|
9
|
-
resetUncommittedMessages(): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare type TSagaConstructorParams = {
|
|
13
|
-
id: Identifier,
|
|
14
|
-
events?: IEventStream
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
declare type ISagaFactory = (options: TSagaConstructorParams) => ISaga;
|
|
18
|
-
|
|
19
|
-
declare interface ISagaConstructor {
|
|
20
|
-
new(options: TSagaConstructorParams): ISaga;
|
|
21
|
-
|
|
22
|
-
/** List of event types that trigger new saga start */
|
|
23
|
-
readonly startsWith: string[];
|
|
24
|
-
|
|
25
|
-
/** List of events being handled by Saga */
|
|
26
|
-
readonly handles: string[];
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare type Identifier = string | number;
|