@spine-event-engine/storage 2.0.0-snapshot.23 → 2.0.0-snapshot.24
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 +32 -13
- package/dist/entity/agent-execution-transitions.d.ts +14 -13
- package/dist/entity/agent-execution-transitions.d.ts.map +1 -1
- package/dist/entity/agent-execution-transitions.js +20 -37
- package/dist/entity/agent-execution-transitions.js.map +1 -1
- package/dist/entity/agent-execution-values.d.ts +4 -3
- package/dist/entity/agent-execution-values.d.ts.map +1 -1
- package/dist/entity/agent-execution-values.js +13 -12
- package/dist/entity/agent-execution-values.js.map +1 -1
- package/dist/entity/agent-execution.d.ts +6 -5
- package/dist/entity/agent-execution.d.ts.map +1 -1
- package/dist/event/event-store.d.ts +30 -72
- package/dist/event/event-store.d.ts.map +1 -1
- package/dist/event/event-store.js +124 -268
- package/dist/event/event-store.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/entity-commit.d.ts +30 -11
- package/dist/internal/entity-commit.d.ts.map +1 -1
- package/dist/internal/entity-commit.js +45 -2
- package/dist/internal/entity-commit.js.map +1 -1
- package/dist/internal/event-store.d.ts +1 -1
- package/dist/internal/event-store.d.ts.map +1 -1
- package/dist/internal/event-store.js +1 -1
- package/dist/internal/event-store.js.map +1 -1
- package/dist/memory/in-memory-agent-execution.d.ts.map +1 -1
- package/dist/memory/in-memory-agent-execution.js +3 -3
- package/dist/memory/in-memory-agent-execution.js.map +1 -1
- package/dist/memory/in-memory-entity-commit.d.ts +100 -38
- package/dist/memory/in-memory-entity-commit.d.ts.map +1 -1
- package/dist/memory/in-memory-entity-commit.js +191 -323
- package/dist/memory/in-memory-entity-commit.js.map +1 -1
- package/dist/memory/in-memory-storage-factory.d.ts +1 -1
- package/dist/memory/in-memory-storage-factory.d.ts.map +1 -1
- package/dist/memory/in-memory-storage-factory.js +2 -7
- package/dist/memory/in-memory-storage-factory.js.map +1 -1
- package/dist/memory/tenant-records.d.ts +1 -1
- package/dist/memory/tenant-records.d.ts.map +1 -1
- package/dist/memory/tenant-records.js +3 -2
- package/dist/memory/tenant-records.js.map +1 -1
- package/dist/provider.d.ts +0 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +0 -1
- package/dist/provider.js.map +1 -1
- package/dist/record/record-query.d.ts +10 -2
- package/dist/record/record-query.d.ts.map +1 -1
- package/dist/record/record-query.js +9 -0
- package/dist/record/record-query.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/internal/delivery-cleanup.d.ts +0 -99
- package/dist/internal/delivery-cleanup.d.ts.map +0 -1
- package/dist/internal/delivery-cleanup.js +0 -38
- package/dist/internal/delivery-cleanup.js.map +0 -1
- package/dist/memory/memory-delivery-cleanup.d.ts +0 -32
- package/dist/memory/memory-delivery-cleanup.d.ts.map +0 -1
- package/dist/memory/memory-delivery-cleanup.js +0 -61
- package/dist/memory/memory-delivery-cleanup.js.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { Event, EventId, TenantId } from "@spine-event-engine/proto";
|
|
2
2
|
import type { RecordQuery } from "../record/record-query.js";
|
|
3
3
|
import { RecordSpec } from "../record/record-spec.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { StorageGroup } from "../record/storage-group.js";
|
|
5
5
|
import type { StorageFactory } from "../storage/storage-factory.js";
|
|
6
6
|
/**
|
|
7
7
|
* Framework event store backed by record storage.
|
|
8
8
|
*
|
|
9
|
-
* Snapshots input
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Snapshots input Events and rejects missing, blank, or repeated IDs within a
|
|
10
|
+
* batch. Immutable append accepts identical complete stored Events and leaves
|
|
11
|
+
* completed prefixes when a later insert fails. Admission methods reject every
|
|
12
|
+
* existing ID, including an identical Event.
|
|
12
13
|
*/
|
|
13
14
|
export declare class EventStore {
|
|
14
15
|
#private;
|
|
@@ -17,8 +18,9 @@ export declare class EventStore {
|
|
|
17
18
|
*
|
|
18
19
|
* @param context Specifies the storage context.
|
|
19
20
|
* @param factory Creates the backing record storage.
|
|
21
|
+
* @param group Selects a separate Event record family when supplied.
|
|
20
22
|
*/
|
|
21
|
-
constructor(context: EventStoreContext, factory: StorageFactory);
|
|
23
|
+
constructor(context: EventStoreContext, factory: StorageFactory, group?: StorageGroup);
|
|
22
24
|
/**
|
|
23
25
|
* Returns whether this Event Store still accepts operations.
|
|
24
26
|
*
|
|
@@ -30,15 +32,17 @@ export declare class EventStore {
|
|
|
30
32
|
*/
|
|
31
33
|
close(): void;
|
|
32
34
|
/**
|
|
33
|
-
* Validates
|
|
35
|
+
* Validates strict new admission without storing an Event. An identical
|
|
36
|
+
* existing Event still rejects; this precheck does not reserve its ID.
|
|
34
37
|
*
|
|
35
38
|
* @param event Supplies the event to validate.
|
|
36
39
|
* @returns Completes when the event is accepted.
|
|
37
40
|
*/
|
|
38
41
|
accept(event: Event): Promise<void>;
|
|
39
42
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
43
|
+
* Checks strict new admission, runs caller acceptance, then atomically inserts
|
|
44
|
+
* under one captured context. Competing callbacks may both run, but only one
|
|
45
|
+
* absent-slot insertion can succeed.
|
|
42
46
|
*
|
|
43
47
|
* @param event Supplies the event to accept.
|
|
44
48
|
* @param onAccepted Runs after uniqueness validation and before append.
|
|
@@ -46,26 +50,21 @@ export declare class EventStore {
|
|
|
46
50
|
*/
|
|
47
51
|
acceptThenAppend(event: Event, onAccepted: OnEventAccepted): Promise<Event>;
|
|
48
52
|
/**
|
|
49
|
-
* Writes one
|
|
53
|
+
* Writes one complete Event, accepting an identical immutable retry without
|
|
54
|
+
* overwriting it. A conflicting Event at the same ID rejects.
|
|
50
55
|
*
|
|
51
56
|
* @param event Supplies the event to append.
|
|
52
57
|
* @returns Completes when the event is appended.
|
|
53
58
|
*/
|
|
54
59
|
append(event: Event): Promise<void>;
|
|
55
60
|
/**
|
|
56
|
-
* Writes generated
|
|
61
|
+
* Writes generated Events in order, accepting identical immutable retries.
|
|
62
|
+
* A later failure retains the completed prefix for retry with the same IDs.
|
|
57
63
|
*
|
|
58
64
|
* @param events Supplies the events to append.
|
|
59
65
|
* @returns Completes when the events are appended.
|
|
60
66
|
*/
|
|
61
67
|
appendAll(events: Iterable<Event>): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Writes generated Spine events and returns a one-shot rollback token.
|
|
64
|
-
*
|
|
65
|
-
* @param events Supplies the events to append.
|
|
66
|
-
* @returns Resolves to the rollback token for this append.
|
|
67
|
-
*/
|
|
68
|
-
appendAllWithRollback(events: Iterable<Event>): Promise<EventRollback>;
|
|
69
68
|
/**
|
|
70
69
|
* Reads persisted events through the underlying record-storage query seam.
|
|
71
70
|
*
|
|
@@ -74,31 +73,31 @@ export declare class EventStore {
|
|
|
74
73
|
*/
|
|
75
74
|
read(query?: RecordQuery<EventId>): Promise<readonly Event[]>;
|
|
76
75
|
/**
|
|
77
|
-
*
|
|
76
|
+
* Writes strictly new Events after caller acceptance.
|
|
78
77
|
*
|
|
79
|
-
* @param records
|
|
80
|
-
* @param context
|
|
81
|
-
* @returns Completion after
|
|
78
|
+
* @param records Supplies validated Event snapshots.
|
|
79
|
+
* @param context Selects their storage boundary.
|
|
80
|
+
* @returns Completion after every strict insertion.
|
|
82
81
|
*/
|
|
83
82
|
private appendUnique;
|
|
84
83
|
/**
|
|
85
|
-
*
|
|
84
|
+
* Writes captured immutable Events, accepting identical stored retries.
|
|
86
85
|
*
|
|
87
|
-
* @param
|
|
88
|
-
* @param context
|
|
89
|
-
* @returns Completion after
|
|
86
|
+
* @param records Supplies ordered Event snapshots.
|
|
87
|
+
* @param context Selects their single storage boundary.
|
|
88
|
+
* @returns Completion after every immutable Event is confirmed.
|
|
90
89
|
*/
|
|
91
|
-
private
|
|
90
|
+
private appendImmutable;
|
|
92
91
|
/**
|
|
93
|
-
* Checks
|
|
92
|
+
* Checks strict admission without writing an Event.
|
|
94
93
|
*
|
|
95
|
-
* @param ids
|
|
96
|
-
* @param context
|
|
97
|
-
* @returns Completion
|
|
94
|
+
* @param ids Supplies IDs that must be absent.
|
|
95
|
+
* @param context Selects the storage boundary.
|
|
96
|
+
* @returns Completion when no ID is stored.
|
|
98
97
|
*/
|
|
99
98
|
private checkUnique;
|
|
100
99
|
/**
|
|
101
|
-
* Rejects
|
|
100
|
+
* Rejects operations after this Event Store closes.
|
|
102
101
|
*/
|
|
103
102
|
private requireOpen;
|
|
104
103
|
}
|
|
@@ -139,51 +138,10 @@ export type EventStoreContext = {
|
|
|
139
138
|
* @returns Completes after caller acceptance finishes.
|
|
140
139
|
*/
|
|
141
140
|
export type OnEventAccepted = (event: Event) => Promise<void> | void;
|
|
142
|
-
/**
|
|
143
|
-
* One-shot rollback token scoped to one successful event-store append.
|
|
144
|
-
*/
|
|
145
|
-
export interface EventRollback {
|
|
146
|
-
/**
|
|
147
|
-
* Deletes the events appended by the operation that created this token.
|
|
148
|
-
*
|
|
149
|
-
* @returns Completes when the events are deleted.
|
|
150
|
-
*/
|
|
151
|
-
rollback(): Promise<void>;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Provider-only Event Store coordination bound to a captured Bounded Context and tenant.
|
|
155
|
-
* @internal
|
|
156
|
-
*/
|
|
157
|
-
interface EventStoreAccess {
|
|
158
|
-
/**
|
|
159
|
-
* Serializes work for one captured storage context.
|
|
160
|
-
*
|
|
161
|
-
* @param factory Storage provider used for the Event family.
|
|
162
|
-
* @param context Captured tenant and Bounded Context.
|
|
163
|
-
* @param work Operation run under the Bounded Context and tenant lock.
|
|
164
|
-
* @returns Result returned by the operation.
|
|
165
|
-
* @typeParam T Result of the serialized operation.
|
|
166
|
-
*/
|
|
167
|
-
withLock<T>(factory: StorageFactory, context: StorageContext, work: () => Promise<T>): Promise<T>;
|
|
168
|
-
/**
|
|
169
|
-
* Accepts an original saved Event ID or verifies its exact stored envelope.
|
|
170
|
-
*
|
|
171
|
-
* @param store Event Store with a captured Bounded Context and tenant.
|
|
172
|
-
* @param event Original saved Event envelope.
|
|
173
|
-
* @returns Stored or newly appended original Event.
|
|
174
|
-
*/
|
|
175
|
-
appendOrVerifyOriginal(store: EventStore, event: Event): Promise<Event>;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Exposes captured Event Store coordination to provider and Agent delivery paths.
|
|
179
|
-
* @internal
|
|
180
|
-
*/
|
|
181
|
-
export declare const eventStoreAccess: EventStoreAccess;
|
|
182
141
|
/**
|
|
183
142
|
* Provides the canonical event-store record layout to provider-only internals.
|
|
184
143
|
*
|
|
185
144
|
* @internal
|
|
186
145
|
*/
|
|
187
146
|
export declare const eventStoreRecordSpec: RecordSpec<EventId, Event>;
|
|
188
|
-
export {};
|
|
189
147
|
//# sourceMappingURL=event-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-store.d.ts","sourceRoot":"","sources":["../../src/event/event-store.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAK1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"event-store.d.ts","sourceRoot":"","sources":["../../src/event/event-store.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAK1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK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