ddd-node 35.0.0 → 35.1.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/core/model/aggregate/aggregate.d.ts +1 -2
- package/core/model/aggregate/es-aggregate.d.ts +1 -2
- package/core/model/aggregate/es-aggregate.js +2 -2
- package/core/model/aggregate/index.d.ts +0 -1
- package/core/model/aggregate/index.js +0 -1
- package/core/model/aggregate/state-aggregate.d.ts +1 -2
- package/core/model/aggregate/state-aggregate.js +2 -2
- package/package.json +1 -1
- package/core/model/aggregate/event-releaser.d.ts +0 -4
- package/core/model/aggregate/event-releaser.js +0 -2
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Id, IdentifiedModel } from "../identified-model";
|
|
2
2
|
import { AnyEvent, EventClassWithTypedConstructor, EventSource, NewEventOptions } from "../message";
|
|
3
3
|
import { InferredProps, Props } from "./../../../base";
|
|
4
|
-
import { IEventReleaser } from "./event-releaser";
|
|
5
4
|
export declare abstract class Aggregate<P extends Props> extends IdentifiedModel<P> {
|
|
6
5
|
protected readonly _version: number;
|
|
7
6
|
constructor(id: Id, version: number, props?: P);
|
|
8
7
|
abstract get version(): number;
|
|
9
8
|
protected asEventSource(): EventSource;
|
|
10
9
|
protected newEvent<E extends AnyEvent>(eventClass: EventClassWithTypedConstructor<E>, props: InferredProps<E>, options?: NewEventOptions): E;
|
|
11
|
-
abstract releaseEvents
|
|
10
|
+
abstract releaseEvents(): AnyEvent[];
|
|
12
11
|
}
|
|
13
12
|
export type AnyAggregate = Aggregate<Props>;
|
|
@@ -4,7 +4,6 @@ import { InferredProps, Props } from "../../../base";
|
|
|
4
4
|
import { ClassStatic } from "../../../types";
|
|
5
5
|
import { AnyCommand, AnyEvent, EventClassWithTypedConstructor, NewEventOptions } from "../message";
|
|
6
6
|
import { Aggregate } from "./aggregate";
|
|
7
|
-
import { IEventReleaser } from "./event-releaser";
|
|
8
7
|
export declare class ESAggregate<P extends Props> extends Aggregate<P> {
|
|
9
8
|
static fromStream<T extends AnyESAggregate>(this: ESAggregateClassWithTypedConstructor<T>, id: Id, allPastEvents: AnyEvent[]): T;
|
|
10
9
|
static newStream<T extends AnyESAggregate>(this: ESAggregateClassWithTypedConstructor<T>, id?: Id): T;
|
|
@@ -35,7 +34,7 @@ export declare class ESAggregate<P extends Props> extends Aggregate<P> {
|
|
|
35
34
|
handleCommand<C extends AnyCommand>(command: C): AnyEvent[];
|
|
36
35
|
takeSnapshot(): Snapshot<typeof this>;
|
|
37
36
|
protected commitEvents(): void;
|
|
38
|
-
releaseEvents
|
|
37
|
+
releaseEvents(): AnyEvent[];
|
|
39
38
|
}
|
|
40
39
|
export type AnyESAggregate = ESAggregate<Props>;
|
|
41
40
|
export interface ESAggregateClass<T extends AnyESAggregate = AnyESAggregate, Arguments extends unknown[] = any[]> extends Class<T, Arguments>, ClassStatic<typeof ESAggregate<InferredProps<T>>> {
|
|
@@ -135,10 +135,10 @@ class ESAggregate extends aggregate_1.Aggregate {
|
|
|
135
135
|
this._pastEvents.push(...this.events());
|
|
136
136
|
this._events = [];
|
|
137
137
|
}
|
|
138
|
-
releaseEvents(
|
|
138
|
+
releaseEvents() {
|
|
139
139
|
const events = this.events();
|
|
140
140
|
this.commitEvents();
|
|
141
|
-
return
|
|
141
|
+
return events;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
exports.ESAggregate = ESAggregate;
|
|
@@ -17,5 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./aggregate"), exports);
|
|
18
18
|
__exportStar(require("./state-aggregate"), exports);
|
|
19
19
|
__exportStar(require("./es-aggregate"), exports);
|
|
20
|
-
__exportStar(require("./event-releaser"), exports);
|
|
21
20
|
__exportStar(require("./types"), exports);
|
|
@@ -4,7 +4,6 @@ import { ClassStatic } from "../../../types";
|
|
|
4
4
|
import { Id } from "../identified-model";
|
|
5
5
|
import { AnyEvent, EventClassWithTypedConstructor, NewEventOptions } from "../message";
|
|
6
6
|
import { Aggregate } from "./aggregate";
|
|
7
|
-
import { IEventReleaser } from "./event-releaser";
|
|
8
7
|
export declare class StateAggregate<P extends Props> extends Aggregate<P> {
|
|
9
8
|
static new<T extends AnyStateAggregate>(this: StateAggregateClassWithTypedConstructor<T>, props: InferredProps<T>, id?: Id): T;
|
|
10
9
|
private _events;
|
|
@@ -16,7 +15,7 @@ export declare class StateAggregate<P extends Props> extends Aggregate<P> {
|
|
|
16
15
|
protected recordEvent<E extends AnyEvent>(event: E): void;
|
|
17
16
|
protected recordEvent<E extends AnyEvent>(eventClass: EventClassWithTypedConstructor<E>, props: InferredProps<E>, options?: NewEventOptions): void;
|
|
18
17
|
clearEvents(): void;
|
|
19
|
-
releaseEvents
|
|
18
|
+
releaseEvents(): AnyEvent[];
|
|
20
19
|
}
|
|
21
20
|
export type AnyStateAggregate = StateAggregate<Props>;
|
|
22
21
|
export interface StateAggregateClass<T extends AnyStateAggregate = AnyStateAggregate, Arguments extends unknown[] = any[]> extends Class<T, Arguments>, ClassStatic<typeof StateAggregate<InferredProps<T>>> {
|
|
@@ -36,10 +36,10 @@ class StateAggregate extends aggregate_1.Aggregate {
|
|
|
36
36
|
clearEvents() {
|
|
37
37
|
this._events = [];
|
|
38
38
|
}
|
|
39
|
-
releaseEvents(
|
|
39
|
+
releaseEvents() {
|
|
40
40
|
const events = this.events();
|
|
41
41
|
this.clearEvents();
|
|
42
|
-
return
|
|
42
|
+
return events;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
exports.StateAggregate = StateAggregate;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ddd-node","version":"35.
|
|
1
|
+
{"name":"ddd-node","version":"35.1.0","description":"Domain Driven Design base for NodeJs","type":"commonjs","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"https://github.com/nqd881/ddd-node"},"keywords":["ddd","ddd-node","ddd-base","ddd-ts","ddd-js"],"author":"Quoc Dai","license":"ISC","devDependencies":{"@types/chai":"^4.3.16","@types/lodash":"^4.14.200","@types/mocha":"^10.0.6","@types/uuid":"^9.0.6","chai":"^5.1.1","chai-deep-match":"^1.2.1","ddd-node":"file:dist","mocha":"^10.4.0","tsconfig-paths":"^4.2.0","typescript":"^5.9.3"},"dependencies":{"class-transformer":"^0.5.1","is-class":"^0.0.9","lodash":"^4.17.21","reflect-metadata":"^0.1.13","ts-node":"^10.9.2","tsc-alias":"^1.8.8","type-fest":"^4.20.1","uuid":"^9.0.1"},"peerDependencies":{"class-validator":"^0.14.2"}}
|