@spine-event-engine/storage 2.0.0-snapshot.18 → 2.0.0-snapshot.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/REFERENCE.md +13 -7
- package/dist/internal/entity-commit.d.ts +28 -23
- package/dist/internal/entity-commit.d.ts.map +1 -1
- package/dist/internal/entity-commit.js +10 -1
- package/dist/internal/entity-commit.js.map +1 -1
- package/dist/internal/entity-history.d.ts +1 -1
- package/dist/internal/entity-history.d.ts.map +1 -1
- package/dist/memory/canonical-utf8.d.ts.map +1 -1
- package/dist/memory/canonical-utf8.js +13 -6
- package/dist/memory/canonical-utf8.js.map +1 -1
- package/dist/memory/in-memory-entity-commit.d.ts +38 -6
- package/dist/memory/in-memory-entity-commit.d.ts.map +1 -1
- package/dist/memory/in-memory-entity-commit.js +281 -68
- package/dist/memory/in-memory-entity-commit.js.map +1 -1
- package/dist/memory/tenant-records.d.ts +33 -7
- package/dist/memory/tenant-records.d.ts.map +1 -1
- package/dist/memory/tenant-records.js +297 -77
- package/dist/memory/tenant-records.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/REFERENCE.md
CHANGED
|
@@ -15,7 +15,7 @@ types, and entity history interfaces.
|
|
|
15
15
|
|
|
16
16
|
Storage-adapter implementers import the complete provider-only contract set from
|
|
17
17
|
`@spine-event-engine/storage/provider`: Event Store record access, Entity
|
|
18
|
-
history and
|
|
18
|
+
history and Entity commit contracts, query values, tenant boundaries/catalogs,
|
|
19
19
|
and delivery-cleanup handles. The storage root intentionally does not export
|
|
20
20
|
these provider seams; application code uses its root storage contracts instead.
|
|
21
21
|
|
|
@@ -114,9 +114,15 @@ not open or allocate its grouped records. Current Entity loading always uses
|
|
|
114
114
|
the current record, never retained history. Event history is diagnostic data,
|
|
115
115
|
not a source for rebuilding current state.
|
|
116
116
|
|
|
117
|
-
The provider SPI's Entity commit
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
`
|
|
122
|
-
|
|
117
|
+
The provider SPI's Entity commit accepts the next current record and associated
|
|
118
|
+
enabled history and delivery events, without an expected previous record.
|
|
119
|
+
`commit()` returns `Promise<void>`: success resolves without a value and storage
|
|
120
|
+
errors reject. There is no Entity conflict result. This changes the published
|
|
121
|
+
`storage/provider` types for custom adapters; application APIs and persisted
|
|
122
|
+
record layouts are unchanged.
|
|
123
|
+
|
|
124
|
+
The in-memory provider prepares only the affected records before applying them
|
|
125
|
+
together. Saving one Entity does not copy other Entities or whole history/Event
|
|
126
|
+
Store collections. Automatic Entity versions, immutable-record checks and
|
|
127
|
+
unrelated Inbox conditional updates remain. Other providers document their
|
|
128
|
+
transaction and partial-write guarantees separately.
|
|
@@ -5,15 +5,19 @@ import type { StorageContext } from "../storage/storage.js";
|
|
|
5
5
|
import type { EntityStorageInput } from "./entity-history.js";
|
|
6
6
|
import type { StorageFactory } from "../storage/storage-factory.js";
|
|
7
7
|
/**
|
|
8
|
-
* Describes one provider
|
|
8
|
+
* Describes one coordinated provider mutation for an Entity commit.
|
|
9
9
|
*
|
|
10
10
|
* This provider-only contract combines current state, retained histories, and
|
|
11
|
-
* framework delivery events.
|
|
12
|
-
*
|
|
11
|
+
* framework delivery events. Memory and transactional database providers apply
|
|
12
|
+
* the changes atomically. MyISAM and Aria tables can retain partial writes.
|
|
13
|
+
* This contract is not an application-level transaction API.
|
|
14
|
+
*
|
|
15
|
+
* @typeParam I Entity identifier type.
|
|
16
|
+
* @typeParam S Entity state message type.
|
|
13
17
|
*/
|
|
14
18
|
export interface EntityCommitInput<I, S extends Message> {
|
|
15
19
|
/**
|
|
16
|
-
* Identifies the storage scope
|
|
20
|
+
* Identifies the storage scope for this commit.
|
|
17
21
|
*/
|
|
18
22
|
readonly context: StorageContext;
|
|
19
23
|
/**
|
|
@@ -24,10 +28,6 @@ export interface EntityCommitInput<I, S extends Message> {
|
|
|
24
28
|
* Identifies the Entity record being changed.
|
|
25
29
|
*/
|
|
26
30
|
readonly entityId: I;
|
|
27
|
-
/**
|
|
28
|
-
* Requires this current record before applying the next record.
|
|
29
|
-
*/
|
|
30
|
-
readonly expected?: EntityRecord;
|
|
31
31
|
/**
|
|
32
32
|
* Stores the next current record.
|
|
33
33
|
*/
|
|
@@ -46,22 +46,23 @@ export interface EntityCommitInput<I, S extends Message> {
|
|
|
46
46
|
readonly events?: readonly Event[];
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* A provider handle for atomic changes to one bounded Entity scope.
|
|
49
|
+
* A provider handle for coordinated changes to one bounded Entity scope.
|
|
50
|
+
*
|
|
51
|
+
* Memory and transactional database providers apply each commit atomically.
|
|
52
|
+
* MyISAM and Aria tables can retain partial writes if a commit fails.
|
|
54
53
|
*/
|
|
55
54
|
export interface EntityCommitStorage {
|
|
56
55
|
/**
|
|
57
|
-
* Applies one
|
|
56
|
+
* Applies one Entity mutation across its current, history, and delivery records.
|
|
58
57
|
*
|
|
58
|
+
* @typeParam I Entity identifier type.
|
|
59
|
+
* @typeParam S Entity state message type.
|
|
59
60
|
* @param input Defines the unit of Entity, history, and delivery-event work.
|
|
60
|
-
* @returns Resolves
|
|
61
|
+
* @returns Resolves when the Entity mutation completes.
|
|
61
62
|
*/
|
|
62
|
-
commit<I, S extends Message>(input: EntityCommitInput<I, S>): Promise<
|
|
63
|
+
commit<I, S extends Message>(input: EntityCommitInput<I, S>): Promise<void>;
|
|
63
64
|
/**
|
|
64
|
-
* Closes this
|
|
65
|
+
* Closes this independent commit handle.
|
|
65
66
|
*/
|
|
66
67
|
close(): void;
|
|
67
68
|
}
|
|
@@ -70,8 +71,10 @@ export interface EntityCommitStorage {
|
|
|
70
71
|
*/
|
|
71
72
|
export interface EntityCommitStorageFactory {
|
|
72
73
|
/**
|
|
73
|
-
* Creates a handle that
|
|
74
|
+
* Creates a handle that coordinates Entity persistence changes for one provider.
|
|
74
75
|
*
|
|
76
|
+
* @typeParam I Entity identifier type.
|
|
77
|
+
* @typeParam S Entity state message type.
|
|
75
78
|
* @param input Identifies the Entity storage layout the handle may commit.
|
|
76
79
|
* @returns The independently closeable provider commit handle.
|
|
77
80
|
*/
|
|
@@ -82,23 +85,25 @@ export interface EntityCommitStorageFactory {
|
|
|
82
85
|
*/
|
|
83
86
|
interface EntityCommitFactoryAccess {
|
|
84
87
|
/**
|
|
85
|
-
* Registers the
|
|
88
|
+
* Registers the Entity commit capability of one storage factory.
|
|
86
89
|
*
|
|
87
90
|
* @param factory Identifies the storage factory that provides the capability.
|
|
88
|
-
* @param creator Creates
|
|
91
|
+
* @param creator Creates coordinated commit handles for that provider.
|
|
89
92
|
*/
|
|
90
93
|
register(factory: StorageFactory, creator: EntityCommitStorageFactory): void;
|
|
91
94
|
/**
|
|
92
|
-
* Creates
|
|
95
|
+
* Creates a commit handle registered by a storage provider.
|
|
93
96
|
*
|
|
97
|
+
* @typeParam I Entity identifier type.
|
|
98
|
+
* @typeParam S Entity state message type.
|
|
94
99
|
* @param factory Identifies the provider storage factory.
|
|
95
100
|
* @param input Defines the Entity storage layout to commit.
|
|
96
|
-
* @returns The provider
|
|
101
|
+
* @returns The provider commit handle.
|
|
97
102
|
*/
|
|
98
103
|
create<I, S extends Message>(factory: StorageFactory, input: EntityStorageInput<I, S>): EntityCommitStorage;
|
|
99
104
|
}
|
|
100
105
|
/**
|
|
101
|
-
* Provides the typed internal lookup for provider-
|
|
106
|
+
* Provides the typed internal lookup for provider-managed atomic commit handles.
|
|
102
107
|
*
|
|
103
108
|
* Provider adapters register their creator while constructing their factory;
|
|
104
109
|
* the end-user storage root deliberately exposes no commit-construction method.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-commit.d.ts","sourceRoot":"","sources":["../../src/internal/entity-commit.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK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CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;CACpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAGlC;;;;;;;OAOG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5E;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAGzC;;;;;;;OAOG;IACH,yBAAyB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAC5C,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC9B,mBAAmB,CAAC;CACxB;AAED;;GAEG;AACH,UAAU,yBAAyB;IAGjC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAE7E;;;;;;;;OAQG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EACzB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC9B,mBAAmB,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,EAAE,yBAuBzC,CAAC"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* the License.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
* Provides the typed internal lookup for provider-
|
|
15
|
+
* Provides the typed internal lookup for provider-managed atomic commit handles.
|
|
16
16
|
*
|
|
17
17
|
* Provider adapters register their creator while constructing their factory;
|
|
18
18
|
* the end-user storage root deliberately exposes no commit-construction method.
|
|
@@ -21,6 +21,15 @@ export const EntityCommitStorageFactories = Object.freeze({
|
|
|
21
21
|
register(factory, creator) {
|
|
22
22
|
creators.set(factory, creator);
|
|
23
23
|
},
|
|
24
|
+
/**
|
|
25
|
+
* Creates the registered provider's Entity commit handle.
|
|
26
|
+
*
|
|
27
|
+
* @typeParam I Entity identifier type.
|
|
28
|
+
* @typeParam S Entity state message type.
|
|
29
|
+
* @param factory Identifies the registered provider.
|
|
30
|
+
* @param input Defines the Entity scope.
|
|
31
|
+
* @returns The provider commit handle.
|
|
32
|
+
*/
|
|
24
33
|
create(factory, input) {
|
|
25
34
|
const creator = creators.get(factory);
|
|
26
35
|
if (creator === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-commit.js","sourceRoot":"","sources":["../../src/internal/entity-commit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"entity-commit.js","sourceRoot":"","sources":["../../src/internal/entity-commit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA8B,MAAM,CAAC,MAAM,CAAC;IACnF,QAAQ,CAAC,OAAuB,EAAE,OAAmC;QACnE,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CACJ,OAAuB,EACvB,KAA+B;QAE/B,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,OAAO,KAAK,SAAS;YACvB,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAChG,OAAO,OAAO,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAG,IAAI,OAAO,EAA8C,CAAC"}
|
|
@@ -8,5 +8,5 @@ export type { EntityRecord, EntityRecordStorage } from "../entity/entity-record.
|
|
|
8
8
|
export { eventHistorySpec, stateHistorySpec } from "../entity/entity-history-record-spec.js";
|
|
9
9
|
export { EntityHistoryConformance, type EntityHistoryConformanceAdapter, type EntityStorageConformance, } from "../entity/history-conformance.js";
|
|
10
10
|
export type { EntityIdCodec, EntityStorageInput } from "../memory/in-memory-entity-history.js";
|
|
11
|
-
export type { EntityCommitInput,
|
|
11
|
+
export type { EntityCommitInput, EntityCommitStorage, EntityCommitStorageFactory, } from "./entity-commit.js";
|
|
12
12
|
//# sourceMappingURL=entity-history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-history.d.ts","sourceRoot":"","sources":["../../src/internal/entity-history.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,YAAY,EACV,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EACL,wBAAwB,EACxB,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,GAC9B,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC/F,YAAY,EACV,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"entity-history.d.ts","sourceRoot":"","sources":["../../src/internal/entity-history.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,YAAY,EACV,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EACL,wBAAwB,EACxB,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,GAC9B,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC/F,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-utf8.d.ts","sourceRoot":"","sources":["../../src/memory/canonical-utf8.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,eAAO,MAAM,aAAa;IAGxB;;;;;;OAMG;kBACW,MAAM,SAAS,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"canonical-utf8.d.ts","sourceRoot":"","sources":["../../src/memory/canonical-utf8.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,eAAO,MAAM,aAAa;IAGxB;;;;;;OAMG;kBACW,MAAM,SAAS,MAAM,GAAG,MAAM;IAgB5C;;;;;OAKG;iBACU,MAAM,GAAG,UAAU;CAyBjC,CAAC"}
|
|
@@ -24,15 +24,22 @@ export const CanonicalUtf8 = {
|
|
|
24
24
|
* @returns A negative, zero, or positive comparison result.
|
|
25
25
|
*/
|
|
26
26
|
compare(left, right) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
if (left === right)
|
|
28
|
+
return 0;
|
|
29
|
+
let leftIndex = 0;
|
|
30
|
+
let rightIndex = 0;
|
|
31
|
+
while (leftIndex < left.length && rightIndex < right.length) {
|
|
32
|
+
const first = left.codePointAt(leftIndex);
|
|
33
|
+
const second = right.codePointAt(rightIndex);
|
|
34
|
+
if (first === undefined || second === undefined)
|
|
35
|
+
break;
|
|
36
|
+
const difference = first - second;
|
|
32
37
|
if (difference !== 0)
|
|
33
38
|
return difference;
|
|
39
|
+
leftIndex += first > 0xffff ? 2 : 1;
|
|
40
|
+
rightIndex += second > 0xffff ? 2 : 1;
|
|
34
41
|
}
|
|
35
|
-
return
|
|
42
|
+
return (leftIndex < left.length ? 1 : 0) - (rightIndex < right.length ? 1 : 0);
|
|
36
43
|
},
|
|
37
44
|
/**
|
|
38
45
|
* Encodes a string as canonical UTF-8 bytes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-utf8.js","sourceRoot":"","sources":["../../src/memory/canonical-utf8.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,kBAAkB;IAElB;;;;;;OAMG;IACH,OAAO,CAAC,IAAY,EAAE,KAAa;QACjC,
|
|
1
|
+
{"version":3,"file":"canonical-utf8.js","sourceRoot":"","sources":["../../src/memory/canonical-utf8.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,kBAAkB;IAElB;;;;;;OAMG;IACH,OAAO,CAAC,IAAY,EAAE,KAAa;QACjC,IAAI,IAAI,KAAK,KAAK;YAAE,OAAO,CAAC,CAAC;QAC7B,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,OAAO,SAAS,GAAG,IAAI,CAAC,MAAM,IAAI,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAC7C,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;gBAAE,MAAM;YACvD,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;YAClC,IAAI,UAAU,KAAK,CAAC;gBAAE,OAAO,UAAU,CAAC;YACxC,SAAS,IAAI,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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AI,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,EACxB,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EACjC,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAChC,IAAI,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAC1B,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Message } from "@bufbuild/protobuf";
|
|
2
|
-
import type { EntityCommitInput,
|
|
2
|
+
import type { EntityCommitInput, EntityCommitStorage } from "../internal/entity-commit.js";
|
|
3
3
|
import type { RecordSpec } from "../record/record-spec.js";
|
|
4
4
|
import type { StorageGroup } from "../record/storage-group.js";
|
|
5
5
|
import type { StorageContext } from "../storage/storage.js";
|
|
@@ -7,7 +7,17 @@ import type { StorageFactory } from "../storage/storage-factory.js";
|
|
|
7
7
|
import { MemoryEntityStorageFactory, type EntityStorageInput } from "./in-memory-entity-history.js";
|
|
8
8
|
import { TenantRecords } from "./tenant-records.js";
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Opens the in-memory tenant slice for a generated record family.
|
|
11
|
+
* @typeParam I Record identifier type.
|
|
12
|
+
* @typeParam R Record message type.
|
|
13
|
+
* @param context Supplies the storage and tenant context.
|
|
14
|
+
* @param spec Supplies the materialized record layout.
|
|
15
|
+
* @param group Selects a grouped history family when present.
|
|
16
|
+
* @returns The tenant record slice.
|
|
17
|
+
*/
|
|
18
|
+
type OpenRecords = <I, R extends Message>(context: StorageContext, spec: RecordSpec<I, R>, group?: StorageGroup) => TenantRecords<I, R>;
|
|
19
|
+
/**
|
|
20
|
+
* Implements provider Entity commits for one shared in-memory backend.
|
|
11
21
|
*/
|
|
12
22
|
export declare class MemoryEntityCommitStorage implements EntityCommitStorage {
|
|
13
23
|
#private;
|
|
@@ -15,21 +25,43 @@ export declare class MemoryEntityCommitStorage implements EntityCommitStorage {
|
|
|
15
25
|
* Creates a commit handle bound to one Entity source type.
|
|
16
26
|
*
|
|
17
27
|
* @param entities Opens the matching current Entity storage.
|
|
18
|
-
* @param factory
|
|
28
|
+
* @param factory Provides the Event Store coordination lock.
|
|
19
29
|
* @param openRecords Opens exact generic-record backing slices.
|
|
20
30
|
* @param input Defines the Entity storage source type.
|
|
21
31
|
*/
|
|
22
|
-
constructor(entities: MemoryEntityStorageFactory, factory: StorageFactory, openRecords:
|
|
32
|
+
constructor(entities: MemoryEntityStorageFactory, factory: StorageFactory, openRecords: OpenRecords, input: EntityStorageInput<unknown, Message>);
|
|
23
33
|
/**
|
|
24
34
|
* Applies one fully preflighted in-memory Entity commit.
|
|
25
35
|
*
|
|
36
|
+
* @typeParam I Entity identifier type.
|
|
37
|
+
* @typeParam S Entity state type.
|
|
26
38
|
* @param input Defines the current record, retained histories, and delivery events.
|
|
27
|
-
* @returns
|
|
39
|
+
* @returns Completion after the in-memory commit.
|
|
28
40
|
*/
|
|
29
|
-
commit<I, S extends Message>(input: EntityCommitInput<I, S>): Promise<
|
|
41
|
+
commit<I, S extends Message>(input: EntityCommitInput<I, S>): Promise<void>;
|
|
30
42
|
/**
|
|
31
43
|
* Closes this commit handle without closing sibling handles.
|
|
32
44
|
*/
|
|
33
45
|
close(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Opens only record families used by one commit.
|
|
48
|
+
*
|
|
49
|
+
* @typeParam I Entity identifier type.
|
|
50
|
+
* @typeParam S Entity state type.
|
|
51
|
+
* @param input Supplies configured histories and delivery Events.
|
|
52
|
+
* @returns Live affected record families and their layouts.
|
|
53
|
+
*/
|
|
54
|
+
private live;
|
|
55
|
+
/**
|
|
56
|
+
* Captures affected rows and creates isolated adapters for preparation.
|
|
57
|
+
*
|
|
58
|
+
* @typeParam I Entity identifier type.
|
|
59
|
+
* @typeParam S Entity state type.
|
|
60
|
+
* @param input Supplies the proposed record changes.
|
|
61
|
+
* @param backend Supplies the live current-record map.
|
|
62
|
+
* @returns The prepared affected-record workspace.
|
|
63
|
+
*/
|
|
64
|
+
private stage;
|
|
34
65
|
}
|
|
66
|
+
export {};
|
|
35
67
|
//# sourceMappingURL=in-memory-entity-commit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-entity-commit.d.ts","sourceRoot":"","sources":["../../src/memory/in-memory-entity-commit.ts"],"names":[],"mappings":"AAcA,OAAO,
|
|
1
|
+
{"version":3,"file":"in-memory-entity-commit.d.ts","sourceRoot":"","sources":["../../src/memory/in-memory-entity-commit.ts"],"names":[],"mappings":"AAcA,OAAO,EAAS,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAOzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAGL,0BAA0B,EAG1B,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;GAQG;AACH,KAAK,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EACtC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EACtB,KAAK,CAAC,EAAE,YAAY,KACjB,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEzB;;GAEG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;;IAenE;;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