@event-nest/core 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event-nest/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Nick Tsitlakidis",
|
|
6
6
|
"description": "Event sourcing module for NestJS. It provides a set of decorators and classes to build an application based on event sourcing.",
|
|
@@ -7,6 +7,7 @@ export declare abstract class AbstractEventStore implements EventStore {
|
|
|
7
7
|
private _eventBus;
|
|
8
8
|
protected constructor(_eventBus: DomainEventEmitter);
|
|
9
9
|
abstract findByAggregateRootId<T extends AggregateRoot>(aggregateRootClass: AggregateRootClass<T>, id: string): Promise<Array<StoredEvent>>;
|
|
10
|
+
abstract findAggregateRootVersion(id: string): Promise<number>;
|
|
10
11
|
abstract save(events: Array<StoredEvent>, aggregate: StoredAggregateRoot): Promise<Array<StoredEvent>>;
|
|
11
12
|
abstract generateEntityId(): Promise<string>;
|
|
12
13
|
addPublisher<T extends AggregateRoot>(aggregateRoot: T): T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-event-store.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/storage/abstract-event-store.ts"],"names":[],"mappings":";;;AACA,iDAA6C;AAE7C,mEAA8D;AAC9D,mFAA8E;AAE9E,oDAA0D;AAE1D,gEAA8D;AAC9D,+GAAwG;AAExG,MAAsB,kBAAkB;IACpC,gEAAgE;IAChE,YAA8B,SAA6B;QAA7B,cAAS,GAAT,SAAS,CAAoB;IAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"abstract-event-store.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/storage/abstract-event-store.ts"],"names":[],"mappings":";;;AACA,iDAA6C;AAE7C,mEAA8D;AAC9D,mFAA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,EAAE,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;YACjF,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;gBACzD,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;gBACpC,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QACF,OAAO,aAAa,CAAC;IACzB,CAAC;CACJ;AA3CD,gDA2CC"}
|
|
@@ -26,6 +26,12 @@ export interface EventStore {
|
|
|
26
26
|
* @param id The unique id of the aggregate root object
|
|
27
27
|
*/
|
|
28
28
|
findByAggregateRootId<T extends AggregateRoot>(aggregateRootClass: AggregateRootClass<T>, id: string): Promise<Array<StoredEvent>>;
|
|
29
|
+
/**
|
|
30
|
+
* Finds the version of the aggregate root object that is associated with the provided id. If the aggregate root is not found
|
|
31
|
+
* or there's no version information, the method will return -1
|
|
32
|
+
* @param id The id of the aggregate root object
|
|
33
|
+
*/
|
|
34
|
+
findAggregateRootVersion(id: string): Promise<number>;
|
|
29
35
|
/**
|
|
30
36
|
* Saves the provided event and aggregate root object. Before saving the aggregate root object, the method will check
|
|
31
37
|
* if the version of the aggregate root object is the same as the version of the aggregate root object in the database.
|