@ddd-ts/event-sourcing-inmemory 0.0.12 → 0.0.13
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/dist/event-store/in-memory.event-store.d.ts +4 -29
- package/dist/event-store/in-memory.event-store.d.ts.map +1 -1
- package/dist/event-store/in-memory.event-store.js +8 -68
- package/dist/event-store/in-memory.event-store.js.map +1 -1
- package/dist/event-store/in-memory.event-store.spec.js +11 -1
- package/dist/event-store/in-memory.event-store.spec.js.map +1 -1
- package/dist/event-store/projected-stream.d.ts +5 -12
- package/dist/event-store/projected-stream.d.ts.map +1 -1
- package/dist/event-store/projected-stream.js +7 -15
- package/dist/event-store/projected-stream.js.map +1 -1
- package/dist/event-store/stream.d.ts +6 -10
- package/dist/event-store/stream.d.ts.map +1 -1
- package/dist/event-store/stream.js +8 -9
- package/dist/event-store/stream.js.map +1 -1
- package/dist/in-memory.checkpoint.d.ts +1 -10
- package/dist/in-memory.checkpoint.d.ts.map +1 -1
- package/dist/in-memory.checkpoint.js +25 -28
- package/dist/in-memory.checkpoint.js.map +1 -1
- package/dist/in-memory.es-aggregate-store.d.ts +58 -0
- package/dist/in-memory.es-aggregate-store.d.ts.map +1 -0
- package/dist/in-memory.es-aggregate-store.js +80 -0
- package/dist/in-memory.es-aggregate-store.js.map +1 -0
- package/dist/in-memory.snapshotter.d.ts +6 -9
- package/dist/in-memory.snapshotter.d.ts.map +1 -1
- package/dist/in-memory.snapshotter.js +6 -15
- package/dist/in-memory.snapshotter.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/test/bank.spec.js +9 -8
- package/dist/test/bank.spec.js.map +1 -1
- package/package.json +7 -8
|
@@ -1,34 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Constructor } from "@ddd-ts/types";
|
|
4
|
-
export declare class InMemoryEventStore extends EventStore {
|
|
1
|
+
import { type AggregateStreamId, type IChange } from "@ddd-ts/core";
|
|
2
|
+
export declare class InMemoryEventStore {
|
|
5
3
|
private streams;
|
|
6
|
-
private projectedStreams;
|
|
7
|
-
private newStreamSubscribers;
|
|
8
4
|
close(): Promise<void>;
|
|
9
5
|
clear(): Promise<void>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
id: string;
|
|
13
|
-
type: string;
|
|
14
|
-
payload: import("@ddd-ts/event-sourcing").Serializable;
|
|
15
|
-
revision: bigint;
|
|
16
|
-
}, void, unknown>;
|
|
17
|
-
private getProjectedStream;
|
|
18
|
-
readProjectedStream(config: ProjectedStreamConfiguration, from?: bigint): AsyncGenerator<{
|
|
19
|
-
id: string;
|
|
20
|
-
type: string;
|
|
21
|
-
payload: import("@ddd-ts/event-sourcing").Serializable;
|
|
22
|
-
revision: bigint;
|
|
23
|
-
}, void, unknown>;
|
|
24
|
-
followProjectedStream(config: ProjectedStreamConfiguration, from?: bigint): Promise<import("@ddd-ts/event-sourcing").Queue<import("@ddd-ts/event-sourcing").EsFact>>;
|
|
25
|
-
competeForProjectedStream(config: ProjectedStreamConfiguration, competition: string): Promise<AsyncIterableIterator<{
|
|
26
|
-
fact: import("@ddd-ts/event-sourcing").EsFact;
|
|
27
|
-
retry: () => NodeJS.Immediate;
|
|
28
|
-
succeed: () => void;
|
|
29
|
-
skip: () => void;
|
|
30
|
-
}> & {
|
|
31
|
-
close: () => Promise<void>;
|
|
32
|
-
}>;
|
|
6
|
+
append(streamId: AggregateStreamId, changes: IChange[], expectedRevision: number): Promise<void>;
|
|
7
|
+
read(streamId: AggregateStreamId, from?: number): AsyncGenerator<import("@ddd-ts/core").IFact, void, unknown>;
|
|
33
8
|
}
|
|
34
9
|
//# sourceMappingURL=in-memory.event-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.event-store.d.ts","sourceRoot":"","sources":["../../src/event-store/in-memory.event-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"in-memory.event-store.d.ts","sourceRoot":"","sources":["../../src/event-store/in-memory.event-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACb,MAAM,cAAc,CAAC;AAGtB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAA6B;IAEtC,KAAK;IAIL,KAAK;IAIL,MAAM,CACV,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,OAAO,EAAE,EAClB,gBAAgB,EAAE,MAAM;IAuBnB,IAAI,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,SAAI;CAUlD"}
|
|
@@ -1,98 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InMemoryEventStore = void 0;
|
|
4
|
-
const
|
|
5
|
-
const projected_stream_1 = require("./projected-stream");
|
|
4
|
+
const core_1 = require("@ddd-ts/core");
|
|
6
5
|
const stream_1 = require("./stream");
|
|
7
|
-
class InMemoryEventStore
|
|
6
|
+
class InMemoryEventStore {
|
|
8
7
|
streams = new Map();
|
|
9
|
-
projectedStreams = new Map();
|
|
10
|
-
newStreamSubscribers = new Set();
|
|
11
8
|
async close() {
|
|
12
9
|
this.clear();
|
|
13
10
|
}
|
|
14
11
|
async clear() {
|
|
15
12
|
this.streams.clear();
|
|
16
|
-
for (const [key, value] of this.projectedStreams) {
|
|
17
|
-
value.onCloseCallbacks.forEach((callback) => callback());
|
|
18
|
-
}
|
|
19
|
-
this.projectedStreams.clear();
|
|
20
13
|
}
|
|
21
|
-
async
|
|
22
|
-
const streamName = `${
|
|
14
|
+
async append(streamId, changes, expectedRevision) {
|
|
15
|
+
const streamName = `${streamId.aggregate}-${streamId.id}`;
|
|
23
16
|
if (!this.streams.has(streamName)) {
|
|
24
17
|
const stream = new stream_1.Stream();
|
|
25
18
|
this.streams.set(streamName, stream);
|
|
26
|
-
this.newStreamSubscribers.forEach((subscriber) => subscriber(stream));
|
|
27
19
|
}
|
|
28
20
|
const stream = this.streams.get(streamName);
|
|
29
21
|
const currentRevision = stream.facts.length - 1;
|
|
30
22
|
if (currentRevision !== Number(expectedRevision)) {
|
|
31
|
-
throw new
|
|
23
|
+
throw new core_1.ConcurrencyError(`Expected revision ${expectedRevision}, but got ${currentRevision}`);
|
|
32
24
|
}
|
|
33
25
|
for (const change of changes) {
|
|
34
26
|
stream.append(change);
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
|
-
async *
|
|
38
|
-
const streamName = `${
|
|
29
|
+
async *read(streamId, from = 0) {
|
|
30
|
+
const streamName = `${streamId.aggregate}-${streamId.id}`;
|
|
39
31
|
const stream = this.streams.get(streamName);
|
|
40
32
|
if (!stream) {
|
|
41
33
|
return;
|
|
42
34
|
}
|
|
43
|
-
|
|
44
|
-
yield fact;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
getProjectedStream(config) {
|
|
48
|
-
const streamName = config
|
|
49
|
-
.map((a) => a.name)
|
|
50
|
-
.sort()
|
|
51
|
-
.join("+");
|
|
52
|
-
if (this.projectedStreams.has(streamName)) {
|
|
53
|
-
return this.projectedStreams.get(streamName);
|
|
54
|
-
}
|
|
55
|
-
const streams = [...this.streams.keys()];
|
|
56
|
-
const correspondingStreams = streams
|
|
57
|
-
.filter((name) => config.some((a) => a.name === name.split("-")[0]))
|
|
58
|
-
.map((name) => this.streams.get(name));
|
|
59
|
-
const orderedFacts = correspondingStreams
|
|
60
|
-
.map((stream) => stream.facts)
|
|
61
|
-
.flat()
|
|
62
|
-
.sort((a, b) => a.occuredAt.getTime() - b.occuredAt.getTime());
|
|
63
|
-
const projectedStream = new projected_stream_1.ProjectedStream();
|
|
64
|
-
for (const fact of orderedFacts) {
|
|
65
|
-
projectedStream.append(fact);
|
|
66
|
-
}
|
|
67
|
-
for (const stream of correspondingStreams) {
|
|
68
|
-
const unsubscribe = stream.subscribe((fact) => {
|
|
69
|
-
projectedStream.append(fact);
|
|
70
|
-
projectedStream.onClose(unsubscribe);
|
|
71
|
-
});
|
|
72
|
-
// here we need to unsubscribe
|
|
73
|
-
}
|
|
74
|
-
this.newStreamSubscribers.add((stream) => {
|
|
75
|
-
// handle non corresponding streams
|
|
76
|
-
const unsubscribe = stream.subscribe((fact) => {
|
|
77
|
-
projectedStream.append(fact);
|
|
78
|
-
});
|
|
79
|
-
projectedStream.onClose(unsubscribe);
|
|
80
|
-
// here we need to unsubscribe
|
|
81
|
-
});
|
|
82
|
-
this.projectedStreams.set(streamName, projectedStream);
|
|
83
|
-
return projectedStream;
|
|
84
|
-
}
|
|
85
|
-
async *readProjectedStream(config, from = 0n) {
|
|
86
|
-
const projectedStream = this.getProjectedStream(config);
|
|
87
|
-
yield* projectedStream.read(from);
|
|
88
|
-
}
|
|
89
|
-
async followProjectedStream(config, from = 0n) {
|
|
90
|
-
const projectedStream = this.getProjectedStream(config);
|
|
91
|
-
return projectedStream.follow(from);
|
|
92
|
-
}
|
|
93
|
-
async competeForProjectedStream(config, competition) {
|
|
94
|
-
const projectedStream = this.getProjectedStream(config);
|
|
95
|
-
return projectedStream.compete(competition);
|
|
35
|
+
yield* stream.read(from);
|
|
96
36
|
}
|
|
97
37
|
}
|
|
98
38
|
exports.InMemoryEventStore = InMemoryEventStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.event-store.js","sourceRoot":"","sources":["../../src/event-store/in-memory.event-store.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"in-memory.event-store.js","sourceRoot":"","sources":["../../src/event-store/in-memory.event-store.ts"],"names":[],"mappings":";;;AAAA,uCAIsB;AACtB,qCAAkC;AAElC,MAAa,kBAAkB;IACrB,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5C,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAA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|
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tests_1 = require("@ddd-ts/tests");
|
|
4
4
|
const in_memory_event_store_1 = require("./in-memory.event-store");
|
|
5
|
+
const in_memory_snapshotter_1 = require("../in-memory.snapshotter");
|
|
6
|
+
const store_inmemory_1 = require("@ddd-ts/store-inmemory");
|
|
7
|
+
const in_memory_es_aggregate_store_1 = require("../in-memory.es-aggregate-store");
|
|
5
8
|
describe("InMemoryEventStore", () => {
|
|
6
|
-
|
|
9
|
+
const database = new store_inmemory_1.InMemoryDatabase();
|
|
10
|
+
const eventStore = new in_memory_event_store_1.InMemoryEventStore();
|
|
11
|
+
function makeAggregateStore(AGGREGATE, eventSerializer, serializer) {
|
|
12
|
+
const snapshotter = new in_memory_snapshotter_1.InMemorySnapshotter(database, serializer);
|
|
13
|
+
const Store = (0, in_memory_es_aggregate_store_1.MakeInMemoryEsAggregateStore)(AGGREGATE);
|
|
14
|
+
return new Store(eventStore, eventSerializer, snapshotter);
|
|
15
|
+
}
|
|
16
|
+
(0, tests_1.EsAggregateStoreSuite)(makeAggregateStore);
|
|
7
17
|
});
|
|
8
18
|
//# sourceMappingURL=in-memory.event-store.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.event-store.spec.js","sourceRoot":"","sources":["../../src/event-store/in-memory.event-store.spec.ts"],"names":[],"mappings":";;AAAA,yCAAsD;AACtD,mEAA6D;
|
|
1
|
+
{"version":3,"file":"in-memory.event-store.spec.js","sourceRoot":"","sources":["../../src/event-store/in-memory.event-store.spec.ts"],"names":[],"mappings":";;AAAA,yCAAsD;AACtD,mEAA6D;AAI7D,oEAA+D;AAC/D,2DAA0D;AAC1D,kFAA+E;AAE/E,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,MAAM,QAAQ,GAAG,IAAI,iCAAgB,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,IAAI,0CAAkB,EAAE,CAAC;IAC5C,SAAS,kBAAkB,CAGzB,SAAY,EACZ,eAAgE,EAChE,UAAwC;QAExC,MAAM,WAAW,GAAG,IAAI,2CAAmB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAElE,MAAM,KAAK,GAAG,IAAA,2DAA4B,EAAC,SAAS,CAAC,CAAC;QAEtD,OAAO,IAAI,KAAK,CAAC,UAAU,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;IAC7D,CAAC;IACD,IAAA,6BAAqB,EAAC,kBAAkB,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC"}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { EsFact, Queue } from "@ddd-ts/event-sourcing";
|
|
1
|
+
import { type IFact, Queue } from "@ddd-ts/core";
|
|
3
2
|
import { Stream } from "./stream";
|
|
4
3
|
export declare class ProjectedStream extends Stream {
|
|
5
|
-
followers: Set<Queue<
|
|
6
|
-
competitions: Map<string, Queue<
|
|
4
|
+
followers: Set<Queue<IFact>>;
|
|
5
|
+
competitions: Map<string, Queue<IFact>>;
|
|
7
6
|
onCloseCallbacks: any[];
|
|
8
|
-
read(from?: bigint): AsyncGenerator<{
|
|
9
|
-
id: string;
|
|
10
|
-
type: string;
|
|
11
|
-
payload: import("@ddd-ts/event-sourcing").Serializable;
|
|
12
|
-
revision: bigint;
|
|
13
|
-
}, void, unknown>;
|
|
14
7
|
onClose(callback: any): void;
|
|
15
|
-
follow(from?:
|
|
8
|
+
follow(from?: number): Promise<Queue<IFact>>;
|
|
16
9
|
private getCompetition;
|
|
17
10
|
compete(competitionName: string): Promise<AsyncIterableIterator<{
|
|
18
|
-
fact:
|
|
11
|
+
fact: IFact;
|
|
19
12
|
retry: () => NodeJS.Immediate;
|
|
20
13
|
succeed: () => void;
|
|
21
14
|
skip: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projected-stream.d.ts","sourceRoot":"","sources":["../../src/event-store/projected-stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"projected-stream.d.ts","sourceRoot":"","sources":["../../src/event-store/projected-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,KAAK,EAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,eAAgB,SAAQ,MAAM;IACzC,SAAS,oBAA2B;IACpC,YAAY,4BAAmC;IAE/C,gBAAgB,EAAE,GAAG,EAAE,CAAM;IAE7B,OAAO,CAAC,QAAQ,EAAE,GAAG;IAIf,MAAM,CAAC,IAAI,SAAI;IAkBrB,OAAO,CAAC,cAAc;IAYhB,OAAO,CAAC,eAAe,EAAE,MAAM;;;;;;;;CAiBtC"}
|
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProjectedStream = void 0;
|
|
4
|
-
const
|
|
4
|
+
const core_1 = require("@ddd-ts/core");
|
|
5
5
|
const stream_1 = require("./stream");
|
|
6
6
|
class ProjectedStream extends stream_1.Stream {
|
|
7
7
|
followers = new Set();
|
|
8
8
|
competitions = new Map();
|
|
9
9
|
onCloseCallbacks = [];
|
|
10
|
-
async *read(from = 0n) {
|
|
11
|
-
for await (const datedFact of super.readRaw(from)) {
|
|
12
|
-
const { occuredAt, ...fact } = datedFact;
|
|
13
|
-
yield fact;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
10
|
onClose(callback) {
|
|
17
11
|
this.onCloseCallbacks.push(callback);
|
|
18
12
|
}
|
|
19
|
-
async follow(from =
|
|
20
|
-
const follower = new
|
|
13
|
+
async follow(from = 0) {
|
|
14
|
+
const follower = new core_1.Queue();
|
|
21
15
|
this.followers.add(follower);
|
|
22
16
|
for await (const fact of this.read(from)) {
|
|
23
17
|
follower.push(fact);
|
|
24
18
|
}
|
|
25
|
-
const unsubscribe = this.subscribe((
|
|
26
|
-
const { occuredAt, ...fact } = datedFact;
|
|
19
|
+
const unsubscribe = this.subscribe((fact) => {
|
|
27
20
|
if (fact.revision >= from) {
|
|
28
21
|
follower.push(fact);
|
|
29
22
|
}
|
|
@@ -33,9 +26,8 @@ class ProjectedStream extends stream_1.Stream {
|
|
|
33
26
|
}
|
|
34
27
|
getCompetition(competitionName) {
|
|
35
28
|
if (!this.competitions.has(competitionName)) {
|
|
36
|
-
const competition = new
|
|
37
|
-
const unsubscribe = this.subscribe((
|
|
38
|
-
const { occuredAt, ...fact } = datedFact;
|
|
29
|
+
const competition = new core_1.Queue();
|
|
30
|
+
const unsubscribe = this.subscribe((fact) => {
|
|
39
31
|
competition.push(fact);
|
|
40
32
|
});
|
|
41
33
|
competition.onClose(unsubscribe);
|
|
@@ -45,7 +37,7 @@ class ProjectedStream extends stream_1.Stream {
|
|
|
45
37
|
}
|
|
46
38
|
async compete(competitionName) {
|
|
47
39
|
const competition = this.getCompetition(competitionName);
|
|
48
|
-
return (0,
|
|
40
|
+
return (0, core_1.closeable)((0, core_1.map)(competition[Symbol.asyncIterator](), (fact) => ({
|
|
49
41
|
fact,
|
|
50
42
|
retry: () => setImmediate(() => competition.push(fact)),
|
|
51
43
|
succeed: () => { },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projected-stream.js","sourceRoot":"","sources":["../../src/event-store/projected-stream.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"projected-stream.js","sourceRoot":"","sources":["../../src/event-store/projected-stream.ts"],"names":[],"mappings":";;;AAAA,uCAAiE;AACjE,qCAAkC;AAElC,MAAa,eAAgB,SAAQ,eAAM;IACzC,SAAS,GAAG,IAAI,GAAG,EAAgB,CAAC;IACpC,YAAY,GAAG,IAAI,GAAG,EAAwB,CAAC;IAE/C,gBAAgB,GAAU,EAAE,CAAC;IAE7B,OAAO,CAAC,QAAa;QACnB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAA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CAAC,eAAe,CAAC,CAAC;QAEzD,OAAO,IAAA,gBAAS,EACd,IAAA,UAAG,EAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAClD,IAAI;YACJ,KAAK,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvD,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;YACjB,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;SACf,CAAC,CAAC,EACH,KAAK,IAAI,EAAE;YACT,uBAAuB;YACvB,6CAA6C;YAC7C,qCAAqC;QACvC,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAzDD,0CAyDC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type DatedFact = EsFact & {
|
|
3
|
-
occuredAt: Date;
|
|
4
|
-
};
|
|
1
|
+
import { type IFact, type IEsEvent } from "@ddd-ts/core";
|
|
5
2
|
export declare class Stream {
|
|
6
|
-
facts:
|
|
7
|
-
subscribers: Set<(fact:
|
|
8
|
-
append(change:
|
|
9
|
-
subscribe(subscriber: (fact:
|
|
10
|
-
|
|
3
|
+
facts: IFact[];
|
|
4
|
+
subscribers: Set<(fact: IFact) => void>;
|
|
5
|
+
append(change: IEsEvent): void;
|
|
6
|
+
subscribe(subscriber: (fact: IFact) => void): () => void;
|
|
7
|
+
read(from?: number): Generator<IFact, void, unknown>;
|
|
11
8
|
}
|
|
12
|
-
export {};
|
|
13
9
|
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/event-store/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/event-store/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEzD,qBAAa,MAAM;IACjB,KAAK,EAAE,KAAK,EAAE,CAAM;IAEpB,WAAW,aAAkB,KAAK,KAAK,IAAI,EAAI;IAE/C,MAAM,CAAC,MAAM,EAAE,QAAQ;IAevB,SAAS,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI;IAO1C,IAAI,CAAC,IAAI,SAAI;CAKf"}
|
|
@@ -5,16 +5,16 @@ class Stream {
|
|
|
5
5
|
facts = [];
|
|
6
6
|
subscribers = new Set();
|
|
7
7
|
append(change) {
|
|
8
|
-
const revision =
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const revision = this.facts.length;
|
|
9
|
+
const occurredAt = new Date();
|
|
10
|
+
const fact = {
|
|
11
11
|
...change,
|
|
12
12
|
revision,
|
|
13
|
-
|
|
13
|
+
occurredAt,
|
|
14
14
|
};
|
|
15
|
-
this.facts.push(
|
|
15
|
+
this.facts.push(fact);
|
|
16
16
|
for (const subscriber of this.subscribers) {
|
|
17
|
-
subscriber(
|
|
17
|
+
subscriber(fact);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
subscribe(subscriber) {
|
|
@@ -23,9 +23,8 @@ class Stream {
|
|
|
23
23
|
this.subscribers.delete(subscriber);
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
for (let i = revision; i < this.facts.length; i++) {
|
|
26
|
+
*read(from = 0) {
|
|
27
|
+
for (let i = from; i < this.facts.length; i++) {
|
|
29
28
|
yield this.facts[i];
|
|
30
29
|
}
|
|
31
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/event-store/stream.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/event-store/stream.ts"],"names":[],"mappings":";;;AAEA,MAAa,MAAM;IACjB,KAAK,GAAY,EAAE,CAAC;IAEpB,WAAW,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE/C,MAAM,CAAC,MAAgB;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QACnC,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG;YACX,GAAG,MAAM;YACT,QAAQ;YACR,UAAU;SACX,CAAC;QAEF,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC1C,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,SAAS,CAAC,UAAiC;QACzC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACjC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACtC,CAAC,CAAC;IACJ,CAAC;IAED,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AAhCD,wBAgCC"}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { InMemoryDatabase, InMemoryTransaction } from "@ddd-ts/store-inmemory";
|
|
3
|
-
export declare class InMemoryCheckpoint extends Checkpoint {
|
|
4
|
-
private readonly inMemoryDatabase;
|
|
5
|
-
projections: Map<string, bigint>;
|
|
6
|
-
constructor(inMemoryDatabase: InMemoryDatabase);
|
|
7
|
-
get(name: string, trx?: InMemoryTransaction): Promise<bigint>;
|
|
8
|
-
set(name: string, revision: bigint, trx?: InMemoryTransaction): Promise<void>;
|
|
9
|
-
clear(): Promise<void>;
|
|
10
|
-
}
|
|
1
|
+
export {};
|
|
11
2
|
//# sourceMappingURL=in-memory.checkpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.checkpoint.d.ts","sourceRoot":"","sources":["../src/in-memory.checkpoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"in-memory.checkpoint.d.ts","sourceRoot":"","sources":["../src/in-memory.checkpoint.ts"],"names":[],"mappings":""}
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// import { Checkpoint, CheckpointFurtherAway } from "@ddd-ts/core";
|
|
3
|
+
// import { InMemoryDatabase, InMemoryTransaction } from "@ddd-ts/store-inmemory";
|
|
2
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
async clear() {
|
|
27
|
-
this.inMemoryDatabase.clear("checkpoint");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.InMemoryCheckpoint = InMemoryCheckpoint;
|
|
5
|
+
// export class InMemoryCheckpoint extends Checkpoint {
|
|
6
|
+
// projections = new Map<string, bigint>();
|
|
7
|
+
// constructor(private readonly inMemoryDatabase: InMemoryDatabase) {
|
|
8
|
+
// super();
|
|
9
|
+
// }
|
|
10
|
+
// async get(name: string, trx?: InMemoryTransaction) {
|
|
11
|
+
// const checkpoint = this.inMemoryDatabase.load("checkpoint", name, trx?.transaction);
|
|
12
|
+
// if (typeof checkpoint === "bigint") {
|
|
13
|
+
// return checkpoint;
|
|
14
|
+
// }
|
|
15
|
+
// return -1n;
|
|
16
|
+
// }
|
|
17
|
+
// async set(name: string, revision: bigint, trx?: InMemoryTransaction) {
|
|
18
|
+
// const current = await this.get(name);
|
|
19
|
+
// if (revision < current) {
|
|
20
|
+
// throw new CheckpointFurtherAway(name, revision, current);
|
|
21
|
+
// }
|
|
22
|
+
// this.inMemoryDatabase.save("checkpoint", name, revision, trx?.transaction);
|
|
23
|
+
// }
|
|
24
|
+
// async clear() {
|
|
25
|
+
// this.inMemoryDatabase.clear("checkpoint");
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
31
28
|
//# sourceMappingURL=in-memory.checkpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.checkpoint.js","sourceRoot":"","sources":["../src/in-memory.checkpoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"in-memory.checkpoint.js","sourceRoot":"","sources":["../src/in-memory.checkpoint.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,kFAAkF;;AAElF,uDAAuD;AACvD,6CAA6C;AAE7C,uEAAuE;AACvE,eAAe;AACf,MAAM;AAEN,yDAAyD;AACzD,2FAA2F;AAC3F,4CAA4C;AAC5C,2BAA2B;AAC3B,QAAQ;AACR,kBAAkB;AAClB,MAAM;AAEN,2EAA2E;AAC3E,4CAA4C;AAC5C,gCAAgC;AAChC,kEAAkE;AAClE,QAAQ;AAER,kFAAkF;AAClF,MAAM;AAEN,oBAAoB;AACpB,iDAAiD;AACjD,MAAM;AACN,IAAI"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { HasTrait } from "@ddd-ts/traits";
|
|
2
|
+
import { EventSourced, type AggregateStreamId, type IEsAggregateStore, type IEventBus, type Identifiable, type ISerializer } from "@ddd-ts/core";
|
|
3
|
+
import type { InMemoryEventStore } from "./event-store/in-memory.event-store";
|
|
4
|
+
import type { InMemorySnapshotter } from "./in-memory.snapshotter";
|
|
5
|
+
export declare const MakeInMemoryEsAggregateStore: <A extends Omit<(abstract new (props: {}) => {
|
|
6
|
+
acknowledgedRevision: number;
|
|
7
|
+
changes: import("@ddd-ts/core").IEsEvent<string, any>[];
|
|
8
|
+
getAggregateStreamId(this: any): any;
|
|
9
|
+
load(fact: import("@ddd-ts/core").IEsEvent<string, any>): void;
|
|
10
|
+
apply(change: import("@ddd-ts/core").IEsEvent<string, any>): void;
|
|
11
|
+
play(event: import("@ddd-ts/core").IEsEvent<string, any>): any;
|
|
12
|
+
clearChanges(): void;
|
|
13
|
+
acknowledgeChanges(): void;
|
|
14
|
+
}) & {
|
|
15
|
+
events: import("@ddd-ts/types").Constructor<import("@ddd-ts/core").IEsEvent<string, any>>[];
|
|
16
|
+
getAggregateStreamId(id: import("@ddd-ts/core").Identifier): AggregateStreamId;
|
|
17
|
+
instanciate<TH extends import("@ddd-ts/types").Constructor>(this: TH, event: import("@ddd-ts/core").IEsEvent<string, any>): InstanceType<TH>;
|
|
18
|
+
loadFirst<TH_1 extends import("@ddd-ts/types").Constructor>(this: TH_1, event: import("@ddd-ts/core").IEsEvent<string, any>): InstanceType<TH_1>;
|
|
19
|
+
"new"<TH_2 extends import("@ddd-ts/types").Constructor>(this: TH_2, event: import("@ddd-ts/core").IEsEvent<string, any>): InstanceType<TH_2>;
|
|
20
|
+
}, ""> & (new (...args: any[]) => {
|
|
21
|
+
acknowledgedRevision: number;
|
|
22
|
+
changes: import("@ddd-ts/core").IEsEvent<string, any>[];
|
|
23
|
+
getAggregateStreamId(this: any): any;
|
|
24
|
+
load(fact: import("@ddd-ts/core").IEsEvent<string, any>): void;
|
|
25
|
+
apply(change: import("@ddd-ts/core").IEsEvent<string, any>): void;
|
|
26
|
+
play(event: import("@ddd-ts/core").IEsEvent<string, any>): any;
|
|
27
|
+
clearChanges(): void;
|
|
28
|
+
acknowledgeChanges(): void;
|
|
29
|
+
}) & Omit<abstract new (props: {}) => {
|
|
30
|
+
id: import("@ddd-ts/core").Identifier;
|
|
31
|
+
}, ""> & (new (...args: any[]) => {
|
|
32
|
+
id: import("@ddd-ts/core").Identifier;
|
|
33
|
+
})>(AGGREGATE: A) => {
|
|
34
|
+
new (eventStore: InMemoryEventStore, serializer: ISerializer<InstanceType<A>["changes"][number]>, snapshotter?: InMemorySnapshotter<InstanceType<A>> | undefined): {
|
|
35
|
+
loadFirst(event: InstanceType<A>["changes"][number]): InstanceType<A>;
|
|
36
|
+
getAggregateStreamId(id: InstanceType<A>["id"]): AggregateStreamId;
|
|
37
|
+
readonly eventStore: InMemoryEventStore;
|
|
38
|
+
readonly serializer: ISerializer<InstanceType<A>["changes"][number]>;
|
|
39
|
+
readonly snapshotter?: InMemorySnapshotter<InstanceType<A>> | undefined;
|
|
40
|
+
_publishEventsTo?: IEventBus;
|
|
41
|
+
publishEventsTo(eventBus: IEventBus): void;
|
|
42
|
+
load(id: InstanceType<A>["id"]): Promise<any>;
|
|
43
|
+
save(aggregate: InstanceType<A>, attempts?: number): Promise<void>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export declare abstract class InMemoryEsAggregateStore<A extends HasTrait<typeof EventSourced> & HasTrait<typeof Identifiable>> implements IEsAggregateStore<InstanceType<A>> {
|
|
47
|
+
readonly eventStore: InMemoryEventStore;
|
|
48
|
+
readonly serializer: ISerializer<InstanceType<A>["changes"][number]>;
|
|
49
|
+
readonly snapshotter?: InMemorySnapshotter<InstanceType<A>> | undefined;
|
|
50
|
+
constructor(eventStore: InMemoryEventStore, serializer: ISerializer<InstanceType<A>["changes"][number]>, snapshotter?: InMemorySnapshotter<InstanceType<A>> | undefined);
|
|
51
|
+
abstract getAggregateStreamId(id: InstanceType<A>["id"]): AggregateStreamId;
|
|
52
|
+
abstract loadFirst(event: InstanceType<A>["changes"][number]): InstanceType<A>;
|
|
53
|
+
_publishEventsTo?: IEventBus;
|
|
54
|
+
publishEventsTo(eventBus: IEventBus): void;
|
|
55
|
+
load(id: InstanceType<A>["id"]): Promise<any>;
|
|
56
|
+
save(aggregate: InstanceType<A>, attempts?: number): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=in-memory.es-aggregate-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory.es-aggregate-store.d.ts","sourceRoot":"","sources":["../src/in-memory.es-aggregate-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAEL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,eAAO,MAAM,4BAA4B,GAUC,CAAC;;;;;;;;;;;;;;;wBAiG6U,KAAM;;;;;;;;;;;wBAAN,KAAM;;eAjGpV,CAAC,AAP7B;qBAkBkB,kBAAkB;yBAf7B,YAAY,CAIS,CAAC,AAJR,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,YAAY,CAI5B,CAAC,AAJ6B,CAAC;iCAI5C,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,iBAAiB;6BAWtC,kBAAkB;;;2BAU7B,SAAS;kCACF,SAAS;;6DAoCoB,OAAO,CAAC,IAAI,CAAC;;CAtDrE,CAAC;AAEF,8BAAsB,wBAAwB,CAC5C,CAAC,SAAS,QAAQ,CAAC,OAAO,YAAY,CAAC,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CACvE,YAAW,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAG3B,UAAU,EAAE,kBAAkB;aAC9B,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;aAC3D,WAAW,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAFlD,UAAU,EAAE,kBAAkB,EAC9B,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,EAC3D,WAAW,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAA;IAGpE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,iBAAiB;IAC3E,QAAQ,CAAC,SAAS,CAChB,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GACxC,YAAY,CAAC,CAAC,CAAC;IAElB,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,eAAe,CAAC,QAAQ,EAAE,SAAS;IAI7B,IAAI,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAgC9B,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,SAAK,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCrE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemoryEsAggregateStore = exports.MakeInMemoryEsAggregateStore = void 0;
|
|
4
|
+
const core_1 = require("@ddd-ts/core");
|
|
5
|
+
const MakeInMemoryEsAggregateStore = (AGGREGATE) => {
|
|
6
|
+
return class $FirestoreEsAggregateStore extends InMemoryEsAggregateStore {
|
|
7
|
+
loadFirst(event) {
|
|
8
|
+
return AGGREGATE.loadFirst(event);
|
|
9
|
+
}
|
|
10
|
+
getAggregateStreamId(id) {
|
|
11
|
+
return AGGREGATE.getAggregateStreamId(id);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
exports.MakeInMemoryEsAggregateStore = MakeInMemoryEsAggregateStore;
|
|
16
|
+
class InMemoryEsAggregateStore {
|
|
17
|
+
eventStore;
|
|
18
|
+
serializer;
|
|
19
|
+
snapshotter;
|
|
20
|
+
constructor(eventStore, serializer, snapshotter) {
|
|
21
|
+
this.eventStore = eventStore;
|
|
22
|
+
this.serializer = serializer;
|
|
23
|
+
this.snapshotter = snapshotter;
|
|
24
|
+
}
|
|
25
|
+
_publishEventsTo;
|
|
26
|
+
publishEventsTo(eventBus) {
|
|
27
|
+
this._publishEventsTo = eventBus;
|
|
28
|
+
}
|
|
29
|
+
async load(id) {
|
|
30
|
+
const streamId = this.getAggregateStreamId(id);
|
|
31
|
+
const snapshot = await this.snapshotter?.load(streamId);
|
|
32
|
+
if (snapshot) {
|
|
33
|
+
const stream = this.eventStore.read(streamId, snapshot.acknowledgedRevision + 1);
|
|
34
|
+
for await (const serialized of stream) {
|
|
35
|
+
const event = await this.serializer.deserialize(serialized);
|
|
36
|
+
snapshot.load(event);
|
|
37
|
+
}
|
|
38
|
+
return snapshot;
|
|
39
|
+
}
|
|
40
|
+
let instance = undefined;
|
|
41
|
+
for await (const serialized of this.eventStore.read(streamId)) {
|
|
42
|
+
const event = await this.serializer.deserialize(serialized);
|
|
43
|
+
if (!instance) {
|
|
44
|
+
instance = this.loadFirst(event);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
instance.load(event);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return instance;
|
|
51
|
+
}
|
|
52
|
+
async save(aggregate, attempts = 10) {
|
|
53
|
+
const streamId = this.getAggregateStreamId(aggregate.id);
|
|
54
|
+
const changes = [...aggregate.changes];
|
|
55
|
+
const serialized = await Promise.all(changes.map((event) => this.serializer.serialize(event)));
|
|
56
|
+
try {
|
|
57
|
+
await this.eventStore.append(streamId, serialized, aggregate.acknowledgedRevision);
|
|
58
|
+
aggregate.acknowledgeChanges();
|
|
59
|
+
await this.snapshotter?.save(aggregate);
|
|
60
|
+
for (const event of changes) {
|
|
61
|
+
await this._publishEventsTo?.publish(event);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (error instanceof core_1.ConcurrencyError && attempts > 0) {
|
|
66
|
+
const pristine = await this.load(aggregate.id);
|
|
67
|
+
if (!pristine) {
|
|
68
|
+
throw new Error("Invalid concurrency error, aggregate not found");
|
|
69
|
+
}
|
|
70
|
+
for (const change of changes) {
|
|
71
|
+
pristine.apply(change);
|
|
72
|
+
}
|
|
73
|
+
return await this.save(pristine, attempts - 1);
|
|
74
|
+
}
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.InMemoryEsAggregateStore = InMemoryEsAggregateStore;
|
|
80
|
+
//# sourceMappingURL=in-memory.es-aggregate-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory.es-aggregate-store.js","sourceRoot":"","sources":["../src/in-memory.es-aggregate-store.ts"],"names":[],"mappings":";;;AACA,uCAQsB;AAKf,MAAM,4BAA4B,GAAG,CAG1C,SAAY,EACZ,EAAE;IACF,OAAO,MAAM,0BAA2B,SAAQ,wBAA2B;QACzE,SAAS,CAAC,KAAyC;YACjD,OAAO,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QAED,oBAAoB,CAAC,EAAyB;YAC5C,OAAO,SAAS,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;QAC5C,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,4BAA4B,gCAcvC;AAEF,MAAsB,wBAAwB;IAK1B;IACA;IACA;IAHlB,YACkB,UAA8B,EAC9B,UAA2D,EAC3D,WAAkD;QAFlD,eAAU,GAAV,UAA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Q,GAAG,CAAC,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA1FD,4DA0FC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Model } from "@ddd-ts/model";
|
|
3
|
-
import { ISerializer } from "@ddd-ts/serialization";
|
|
1
|
+
import { type IEsAggregateStore, type IEventSourced, type IIdentifiable, type ISerializer } from "@ddd-ts/core";
|
|
4
2
|
import { InMemoryDatabase } from "@ddd-ts/store-inmemory";
|
|
5
|
-
export declare class InMemorySnapshotter<
|
|
3
|
+
export declare class InMemorySnapshotter<A extends IEventSourced & IIdentifiable> implements IEsAggregateStore<A> {
|
|
6
4
|
private readonly db;
|
|
7
|
-
readonly serializer:
|
|
8
|
-
constructor(db: InMemoryDatabase, serializer:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
save(aggregate: S extends ISerializer<infer A extends Model> ? A : never): Promise<void>;
|
|
5
|
+
readonly serializer: ISerializer<A>;
|
|
6
|
+
constructor(db: InMemoryDatabase, serializer: ISerializer<A>);
|
|
7
|
+
load(id: A["id"]): Promise<any>;
|
|
8
|
+
save(aggregate: A): Promise<void>;
|
|
12
9
|
}
|
|
13
10
|
//# sourceMappingURL=in-memory.snapshotter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.snapshotter.d.ts","sourceRoot":"","sources":["../src/in-memory.snapshotter.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"in-memory.snapshotter.d.ts","sourceRoot":"","sources":["../src/in-memory.snapshotter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,qBAAa,mBAAmB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,CACtE,YAAW,iBAAiB,CAAC,CAAC,CAAC;IAG7B,OAAO,CAAC,QAAQ,CAAC,EAAE;aACH,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;gBADzB,EAAE,EAAE,gBAAgB,EACrB,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAGtC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAY/B,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAOxC"}
|
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InMemorySnapshotter = void 0;
|
|
4
|
-
|
|
5
|
-
class InMemorySnapshotter extends event_sourcing_1.Snapshotter {
|
|
4
|
+
class InMemorySnapshotter {
|
|
6
5
|
db;
|
|
7
6
|
serializer;
|
|
8
7
|
constructor(db, serializer) {
|
|
9
|
-
super();
|
|
10
8
|
this.db = db;
|
|
11
9
|
this.serializer = serializer;
|
|
12
10
|
}
|
|
13
|
-
getIdFromModel(model) {
|
|
14
|
-
if (Object.getOwnPropertyNames(model.id).includes('serialize')) {
|
|
15
|
-
if ('serialize' in model.id) {
|
|
16
|
-
return model.id.serialize();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return model.id.toString();
|
|
20
|
-
}
|
|
21
11
|
async load(id) {
|
|
22
12
|
const snapshot = await this.db.loadLatestSnapshot(id.toString());
|
|
23
13
|
if (!snapshot) {
|
|
24
14
|
return undefined;
|
|
25
15
|
}
|
|
26
|
-
|
|
16
|
+
const aggregate = await this.serializer.deserialize(snapshot.serialized);
|
|
17
|
+
aggregate.acknowledgedRevision = snapshot.revision;
|
|
18
|
+
return aggregate;
|
|
27
19
|
}
|
|
28
20
|
async save(aggregate) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
id: id.toString(),
|
|
21
|
+
this.db.save("snapshots", aggregate.id.toString(), {
|
|
22
|
+
id: aggregate.id.toString(),
|
|
32
23
|
revision: Number(aggregate.acknowledgedRevision),
|
|
33
24
|
serialized: await this.serializer.serialize(aggregate),
|
|
34
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.snapshotter.js","sourceRoot":"","sources":["../src/in-memory.snapshotter.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"in-memory.snapshotter.js","sourceRoot":"","sources":["../src/in-memory.snapshotter.ts"],"names":[],"mappings":";;;AASA,MAAa,mBAAmB;IAIX;IACD;IAFlB,YACmB,EAAoB,EACrB,UAA0B;QADzB,OAAE,GAAF,EAAE,CAAkB;QACrB,eAAU,GAAV,UAAU,CAAgB;IACzC,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,EAAW;QACpB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEjE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACzE,SAAS,CAAC,oBAAoB,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACnD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,SAAY;QACrB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE;YACjD,EAAE,EAAE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE;YAC3B,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;YAChD,UAAU,EAAE,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC;SACvD,CAAC,CAAC;IACL,CAAC;CACF;AA3BD,kDA2BC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { InMemorySnapshotter } from "./in-memory.snapshotter";
|
|
2
|
+
export { InMemoryEsAggregateStore, MakeInMemoryEsAggregateStore, } from "./in-memory.es-aggregate-store";
|
|
2
3
|
export { InMemoryEventStore } from "./event-store/in-memory.event-store";
|
|
3
|
-
export { InMemoryCheckpoint } from "./in-memory.checkpoint";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.InMemoryEventStore = exports.MakeInMemoryEsAggregateStore = exports.InMemoryEsAggregateStore = exports.InMemorySnapshotter = void 0;
|
|
4
4
|
var in_memory_snapshotter_1 = require("./in-memory.snapshotter");
|
|
5
5
|
Object.defineProperty(exports, "InMemorySnapshotter", { enumerable: true, get: function () { return in_memory_snapshotter_1.InMemorySnapshotter; } });
|
|
6
|
+
var in_memory_es_aggregate_store_1 = require("./in-memory.es-aggregate-store");
|
|
7
|
+
Object.defineProperty(exports, "InMemoryEsAggregateStore", { enumerable: true, get: function () { return in_memory_es_aggregate_store_1.InMemoryEsAggregateStore; } });
|
|
8
|
+
Object.defineProperty(exports, "MakeInMemoryEsAggregateStore", { enumerable: true, get: function () { return in_memory_es_aggregate_store_1.MakeInMemoryEsAggregateStore; } });
|
|
6
9
|
var in_memory_event_store_1 = require("./event-store/in-memory.event-store");
|
|
7
10
|
Object.defineProperty(exports, "InMemoryEventStore", { enumerable: true, get: function () { return in_memory_event_store_1.InMemoryEventStore; } });
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "InMemoryCheckpoint", { enumerable: true, get: function () { return in_memory_checkpoint_1.InMemoryCheckpoint; } });
|
|
11
|
+
// export { InMemoryCheckpoint } from "./in-memory.checkpoint";
|
|
10
12
|
//# 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,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA;AAC5B,+EAGwC;AAFtC,wIAAA,wBAAwB,OAAA;AACxB,4IAAA,4BAA4B,OAAA;AAE9B,6EAAyE;AAAhE,2HAAA,kBAAkB,OAAA;AAC3B,+DAA+D"}
|
package/dist/test/bank.spec.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const core_1 = require("@ddd-ts/core");
|
|
4
4
|
const store_inmemory_1 = require("@ddd-ts/store-inmemory");
|
|
5
5
|
const tests_1 = require("@ddd-ts/tests");
|
|
6
6
|
const __1 = require("..");
|
|
7
7
|
const in_memory_snapshotter_1 = require("../in-memory.snapshotter");
|
|
8
|
+
const in_memory_es_aggregate_store_1 = require("../in-memory.es-aggregate-store");
|
|
8
9
|
describe("EventSourcingInMemory", () => {
|
|
9
10
|
const es = new __1.InMemoryEventStore();
|
|
10
11
|
const database = new store_inmemory_1.InMemoryDatabase();
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
(0, tests_1.BankSuite)(es, checkpoint, transaction, (serializer, name) => {
|
|
12
|
+
const eventBus = new core_1.DetachedEventBus();
|
|
13
|
+
(0, tests_1.BankSuite)(eventBus, (serializer, name) => {
|
|
14
14
|
const store = new store_inmemory_1.InMemoryStore(name, database, serializer);
|
|
15
15
|
return store;
|
|
16
|
-
}, (AGGREGATE, serializer,
|
|
17
|
-
const persistor = class extends (0, event_sourcing_1.EsAggregatePersistorWithSnapshots)(AGGREGATE) {
|
|
18
|
-
};
|
|
16
|
+
}, (AGGREGATE, serializer, eventSerializer) => {
|
|
19
17
|
const snapshotter = new in_memory_snapshotter_1.InMemorySnapshotter(database, serializer);
|
|
20
|
-
|
|
18
|
+
const Store = (0, in_memory_es_aggregate_store_1.MakeInMemoryEsAggregateStore)(AGGREGATE);
|
|
19
|
+
const store = new Store(es, eventSerializer, snapshotter);
|
|
20
|
+
store.publishEventsTo(eventBus);
|
|
21
|
+
return store;
|
|
21
22
|
});
|
|
22
23
|
});
|
|
23
24
|
//# sourceMappingURL=bank.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank.spec.js","sourceRoot":"","sources":["../../src/test/bank.spec.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"bank.spec.js","sourceRoot":"","sources":["../../src/test/bank.spec.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,2DAAyE;AACzE,yCAA0C;AAC1C,0BAAwC;AACxC,oEAA+D;AAC/D,kFAA+E;AAE/E,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,MAAM,EAAE,GAAG,IAAI,sBAAkB,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,iCAAgB,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,uBAAgB,EAAE,CAAC;IAExC,IAAA,iBAAS,EACP,QAAQ,EACR,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE;QACnB,MAAM,KAAK,GAAG,IAAI,8BAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAQ,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC,EACD,CAAC,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,EAAE;QACzC,MAAM,WAAW,GAAG,IAAI,2CAAmB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAClE,MAAM,KAAK,GAAG,IAAA,2DAA4B,EAAC,SAAS,CAAC,CAAC;QAEtD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;QAC1D,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts/event-sourcing-inmemory",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
"build": "tsc"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@ddd-ts/
|
|
13
|
-
"@ddd-ts/
|
|
14
|
-
"@ddd-ts/
|
|
15
|
-
"@ddd-ts/store-inmemory": "0.0.12"
|
|
12
|
+
"@ddd-ts/core": "0.0.13",
|
|
13
|
+
"@ddd-ts/store-inmemory": "0.0.13",
|
|
14
|
+
"@ddd-ts/types": "0.0.13"
|
|
16
15
|
},
|
|
17
16
|
"devDependencies": {
|
|
18
|
-
"@ddd-ts/tests": "0.0.
|
|
19
|
-
"@ddd-ts/tools": "0.0.
|
|
20
|
-
"@ddd-ts/
|
|
17
|
+
"@ddd-ts/tests": "0.0.13",
|
|
18
|
+
"@ddd-ts/tools": "0.0.13",
|
|
19
|
+
"@ddd-ts/traits": "0.0.13",
|
|
21
20
|
"@types/jest": "^29.5.1",
|
|
22
21
|
"@types/node": "^20.12.4"
|
|
23
22
|
}
|