@spine-event-engine/storage 2.0.0-snapshot.22 → 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.
Files changed (127) hide show
  1. package/README.md +7 -0
  2. package/REFERENCE.md +131 -7
  3. package/dist/entity/agent-execution-record-spec.d.ts +87 -0
  4. package/dist/entity/agent-execution-record-spec.d.ts.map +1 -0
  5. package/dist/entity/agent-execution-record-spec.js +230 -0
  6. package/dist/entity/agent-execution-record-spec.js.map +1 -0
  7. package/dist/entity/agent-execution-sizes.d.ts +30 -0
  8. package/dist/entity/agent-execution-sizes.d.ts.map +1 -0
  9. package/dist/entity/agent-execution-sizes.js +51 -0
  10. package/dist/entity/agent-execution-sizes.js.map +1 -0
  11. package/dist/entity/agent-execution-transitions.d.ts +72 -0
  12. package/dist/entity/agent-execution-transitions.d.ts.map +1 -0
  13. package/dist/entity/agent-execution-transitions.js +165 -0
  14. package/dist/entity/agent-execution-transitions.js.map +1 -0
  15. package/dist/entity/agent-execution-values.d.ts +143 -0
  16. package/dist/entity/agent-execution-values.d.ts.map +1 -0
  17. package/dist/entity/agent-execution-values.js +251 -0
  18. package/dist/entity/agent-execution-values.js.map +1 -0
  19. package/dist/entity/agent-execution.d.ts +235 -0
  20. package/dist/entity/agent-execution.d.ts.map +1 -0
  21. package/dist/entity/agent-execution.js +15 -0
  22. package/dist/entity/agent-execution.js.map +1 -0
  23. package/dist/entity/agent-history-conformance.d.ts +78 -0
  24. package/dist/entity/agent-history-conformance.d.ts.map +1 -0
  25. package/dist/entity/agent-history-conformance.js +493 -0
  26. package/dist/entity/agent-history-conformance.js.map +1 -0
  27. package/dist/entity/agent-history-provider-page.d.ts +39 -0
  28. package/dist/entity/agent-history-provider-page.d.ts.map +1 -0
  29. package/dist/entity/agent-history-provider-page.js +82 -0
  30. package/dist/entity/agent-history-provider-page.js.map +1 -0
  31. package/dist/entity/agent-history-record-spec.d.ts +79 -0
  32. package/dist/entity/agent-history-record-spec.d.ts.map +1 -0
  33. package/dist/entity/agent-history-record-spec.js +147 -0
  34. package/dist/entity/agent-history-record-spec.js.map +1 -0
  35. package/dist/entity/agent-history.d.ts +196 -0
  36. package/dist/entity/agent-history.d.ts.map +1 -0
  37. package/dist/entity/agent-history.js +136 -0
  38. package/dist/entity/agent-history.js.map +1 -0
  39. package/dist/event/event-store.d.ts +41 -35
  40. package/dist/event/event-store.d.ts.map +1 -1
  41. package/dist/event/event-store.js +149 -144
  42. package/dist/event/event-store.js.map +1 -1
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +1 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/internal/agent-execution.d.ts +51 -0
  48. package/dist/internal/agent-execution.d.ts.map +1 -0
  49. package/dist/internal/agent-execution.js +53 -0
  50. package/dist/internal/agent-execution.js.map +1 -0
  51. package/dist/internal/agent-history.d.ts +48 -0
  52. package/dist/internal/agent-history.d.ts.map +1 -0
  53. package/dist/internal/agent-history.js +52 -0
  54. package/dist/internal/agent-history.js.map +1 -0
  55. package/dist/internal/entity-commit.d.ts +30 -11
  56. package/dist/internal/entity-commit.d.ts.map +1 -1
  57. package/dist/internal/entity-commit.js +45 -2
  58. package/dist/internal/entity-commit.js.map +1 -1
  59. package/dist/internal/entity-history.d.ts +11 -0
  60. package/dist/internal/entity-history.d.ts.map +1 -1
  61. package/dist/internal/entity-history.js +10 -0
  62. package/dist/internal/entity-history.js.map +1 -1
  63. package/dist/internal/event-store.d.ts +1 -1
  64. package/dist/internal/event-store.d.ts.map +1 -1
  65. package/dist/internal/event-store.js +1 -1
  66. package/dist/internal/event-store.js.map +1 -1
  67. package/dist/internal/tenancy.d.ts +87 -1
  68. package/dist/internal/tenancy.d.ts.map +1 -1
  69. package/dist/internal/tenancy.js +39 -0
  70. package/dist/internal/tenancy.js.map +1 -1
  71. package/dist/memory/agent-execution-head-index.d.ts +52 -0
  72. package/dist/memory/agent-execution-head-index.d.ts.map +1 -0
  73. package/dist/memory/agent-execution-head-index.js +91 -0
  74. package/dist/memory/agent-execution-head-index.js.map +1 -0
  75. package/dist/memory/agent-history-index.d.ts +49 -0
  76. package/dist/memory/agent-history-index.d.ts.map +1 -0
  77. package/dist/memory/agent-history-index.js +239 -0
  78. package/dist/memory/agent-history-index.js.map +1 -0
  79. package/dist/memory/agent-history-mutation-queue.d.ts +17 -0
  80. package/dist/memory/agent-history-mutation-queue.d.ts.map +1 -0
  81. package/dist/memory/agent-history-mutation-queue.js +31 -0
  82. package/dist/memory/agent-history-mutation-queue.js.map +1 -0
  83. package/dist/memory/in-memory-agent-execution.d.ts +21 -0
  84. package/dist/memory/in-memory-agent-execution.d.ts.map +1 -0
  85. package/dist/memory/in-memory-agent-execution.js +587 -0
  86. package/dist/memory/in-memory-agent-execution.js.map +1 -0
  87. package/dist/memory/in-memory-agent-history.d.ts +21 -0
  88. package/dist/memory/in-memory-agent-history.d.ts.map +1 -0
  89. package/dist/memory/in-memory-agent-history.js +133 -0
  90. package/dist/memory/in-memory-agent-history.js.map +1 -0
  91. package/dist/memory/in-memory-entity-commit.d.ts +107 -28
  92. package/dist/memory/in-memory-entity-commit.d.ts.map +1 -1
  93. package/dist/memory/in-memory-entity-commit.js +198 -286
  94. package/dist/memory/in-memory-entity-commit.js.map +1 -1
  95. package/dist/memory/in-memory-entity-history.d.ts +1 -1
  96. package/dist/memory/in-memory-entity-history.d.ts.map +1 -1
  97. package/dist/memory/in-memory-entity-history.js.map +1 -1
  98. package/dist/memory/in-memory-storage-backend.d.ts +18 -0
  99. package/dist/memory/in-memory-storage-backend.d.ts.map +1 -1
  100. package/dist/memory/in-memory-storage-backend.js +71 -0
  101. package/dist/memory/in-memory-storage-backend.js.map +1 -1
  102. package/dist/memory/in-memory-storage-factory.d.ts +38 -3
  103. package/dist/memory/in-memory-storage-factory.d.ts.map +1 -1
  104. package/dist/memory/in-memory-storage-factory.js +146 -10
  105. package/dist/memory/in-memory-storage-factory.js.map +1 -1
  106. package/dist/memory/tenant-records.d.ts +1 -1
  107. package/dist/memory/tenant-records.d.ts.map +1 -1
  108. package/dist/memory/tenant-records.js +3 -2
  109. package/dist/memory/tenant-records.js.map +1 -1
  110. package/dist/provider.d.ts +0 -1
  111. package/dist/provider.d.ts.map +1 -1
  112. package/dist/provider.js +0 -1
  113. package/dist/provider.js.map +1 -1
  114. package/dist/record/record-query.d.ts +10 -2
  115. package/dist/record/record-query.d.ts.map +1 -1
  116. package/dist/record/record-query.js +9 -0
  117. package/dist/record/record-query.js.map +1 -1
  118. package/dist/tsconfig.tsbuildinfo +1 -1
  119. package/package.json +3 -2
  120. package/dist/internal/delivery-cleanup.d.ts +0 -99
  121. package/dist/internal/delivery-cleanup.d.ts.map +0 -1
  122. package/dist/internal/delivery-cleanup.js +0 -38
  123. package/dist/internal/delivery-cleanup.js.map +0 -1
  124. package/dist/memory/memory-delivery-cleanup.d.ts +0 -32
  125. package/dist/memory/memory-delivery-cleanup.d.ts.map +0 -1
  126. package/dist/memory/memory-delivery-cleanup.js +0 -61
  127. package/dist/memory/memory-delivery-cleanup.js.map +0 -1
@@ -11,386 +11,298 @@
11
11
  * or implied. See the License for the specific language governing permissions and limitations under
12
12
  * the License.
13
13
  */
14
- import { clone } from "@bufbuild/protobuf";
14
+ import { toBinary } from "@bufbuild/protobuf";
15
15
  import { EventSchema } from "@spine-event-engine/proto";
16
16
  import { EntityRecordSchema } from "@spine-event-engine/proto/generated/spine/server/entity/entity_pb.js";
17
- import { eventStoreAccess, eventStoreRecordSpec } from "../event/event-store.js";
17
+ import { eventStoreRecordSpec } from "../event/event-store.js";
18
18
  import { eventHistorySpec, stateHistorySpec } from "../entity/entity-history-record-spec.js";
19
+ import { EntityCommitSnapshots, } from "../internal/entity-commit.js";
19
20
  import { TenantBoundary } from "../internal/tenancy.js";
20
- import { InMemoryEntityStorage, KeyedSerialQueue, MemoryEntityStorageFactory, ENTITY_SCOPE_MUTATION_KEY, } from "./in-memory-entity-history.js";
21
+ import { MemoryEntityStorageFactory, ENTITY_SCOPE_MUTATION_KEY, } from "./in-memory-entity-history.js";
21
22
  import { InMemoryRecordStorage } from "./in-memory-record-storage.js";
22
23
  import { TenantRecords } from "./tenant-records.js";
23
24
  /**
24
- * Implements provider Entity commits for one shared in-memory backend.
25
+ * Writes in-memory Entity records in order and retains a completed prefix.
25
26
  */
26
27
  export class MemoryEntityCommitStorage {
27
- #entities;
28
- #factory;
29
- #openRecords;
30
- #input;
28
+ entities;
29
+ openRecords;
30
+ input;
31
+ /**
32
+ * Tenant boundary selected by this handle.
33
+ */
31
34
  #tenantKey;
35
+ /**
36
+
37
+ * Whether this handle uses multitenant storage.
38
+
39
+ */
32
40
  #multitenant;
41
+ /**
42
+
43
+ * Whether this handle accepts commits.
44
+
45
+ */
33
46
  #open = true;
34
47
  /**
35
- * Creates a commit handle bound to one Entity source type.
48
+ * Creates one source- and tenant-bound commit handle.
36
49
  *
37
- * @param entities Opens the matching current Entity storage.
38
- * @param factory Provides the Event Store coordination lock.
39
- * @param openRecords Opens exact generic-record backing slices.
40
- * @param input Defines the Entity storage source type.
50
+ * @param entities Opens current Entity storage.
51
+ * @param openRecords Opens generated history and Event record slices.
52
+ * @param input Captures the Entity source and tenant boundary.
41
53
  */
42
- constructor(entities, factory, openRecords, input) {
43
- this.#entities = entities;
44
- this.#factory = factory;
45
- this.#openRecords = openRecords;
46
- this.#input = input;
54
+ constructor(entities, openRecords, input) {
55
+ this.entities = entities;
56
+ this.openRecords = openRecords;
57
+ this.input = input;
47
58
  this.#tenantKey = TenantBoundary.of(input.context).key;
48
59
  this.#multitenant = input.context.multitenant;
49
60
  }
50
61
  /**
51
- * Applies one fully preflighted in-memory Entity commit.
62
+ * Writes history, diagnostics, delivery Events, then current state.
52
63
  *
53
64
  * @typeParam I Entity identifier type.
54
65
  * @typeParam S Entity state type.
55
- * @param input Defines the current record, retained histories, and delivery events.
56
- * @returns Completion after the in-memory commit.
66
+ * @param input Supplies the proposed mutation.
67
+ * @returns Completion after every record has been stored.
57
68
  */
58
69
  commit(input) {
59
- this.#requireOpen();
60
- this.#requireCompatible(input);
61
- const tenant = TenantBoundary.of(input.context);
62
- const context = tenant.tenantId === undefined
63
- ? { name: input.context.name, multitenant: false }
64
- : { name: input.context.name, multitenant: true, tenantId: tenant.tenantId };
65
- const snapshot = {
66
- ...input,
67
- context,
68
- entity: { ...input.entity, context },
69
- entityId: input.entity.id.clone(input.entityId),
70
- next: clone(EntityRecordSchema, input.next),
71
- ...(input.states === undefined
72
- ? {}
73
- : { states: input.states.map((record) => clone(EntityRecordSchema, record)) }),
74
- ...(input.diagnostics === undefined
75
- ? {}
76
- : { diagnostics: input.diagnostics.map((event) => clone(EventSchema, event)) }),
77
- ...(input.events === undefined
78
- ? {}
79
- : { events: input.events.map((event) => clone(EventSchema, event)) }),
80
- };
81
- const backend = this.#entities.backend(snapshot.entity);
82
- const work = () => backend.mutationQueue.run(ENTITY_SCOPE_MUTATION_KEY, () => this.#commit(snapshot, backend));
83
- return snapshot.events === undefined || snapshot.events.length === 0
84
- ? work()
85
- : eventStoreAccess.withLock(this.#factory, snapshot.context, work);
70
+ this.requireOpen();
71
+ this.requireCompatible(input);
72
+ return this.apply(EntityCommitSnapshots.capture(input));
86
73
  }
87
74
  /**
88
- * Closes this commit handle without closing sibling handles.
75
+ * Commits one Agent transition under the Entity scope queue and Version fence.
76
+ *
77
+ * @typeParam I Entity identifier type.
78
+ * @typeParam S Entity state type.
79
+ * @param entity Configured Entity storage layout.
80
+ * @param entityId Typed Agent Entity identifier.
81
+ * @param expectedVersion Version read before the Agent handler ran.
82
+ * @param input Optional changed Entity state and history.
83
+ * @param extra Applies or restores the Agent execution record with the Entity state.
84
+ * @returns Completion after the fenced transition is stored.
89
85
  */
90
- close() {
91
- this.#open = false;
86
+ commitAgentConditional(entity, entityId, expectedVersion, input, extra) {
87
+ this.requireOpen();
88
+ const backend = this.entities.backend(entity);
89
+ const key = entity.id.key(entityId);
90
+ const snapshot = input === undefined ? undefined : EntityCommitSnapshots.capture(input);
91
+ if (snapshot !== undefined) {
92
+ this.requireCompatible(snapshot);
93
+ this.requireEnabledHistories(snapshot);
94
+ this.validateRows(snapshot);
95
+ if (snapshot.diagnostics?.length || snapshot.events?.length)
96
+ throw new Error("Agent completion cannot save delivery Events as Entity commit obligations.");
97
+ }
98
+ return backend.mutationQueue.run(ENTITY_SCOPE_MUTATION_KEY, () => this.applyAgentConditional(entity, backend, key, expectedVersion, snapshot, extra));
92
99
  }
93
100
  /**
94
- * Prepares and publishes one affected-record Entity commit under its existing queue.
101
+ * Applies one prepared Agent transition and restores affected rows on failure.
95
102
  *
96
103
  * @typeParam I Entity identifier type.
97
104
  * @typeParam S Entity state type.
98
- * @param input Supplies current and immutable records.
99
- * @param liveBackend Supplies the live current-record map and queue.
105
+ * @param entity Configured Entity storage layout.
106
+ * @param backend Shared current records for this Entity scope.
107
+ * @param key Canonical Entity ID key.
108
+ * @param expectedVersion Version read before handler execution.
109
+ * @param snapshot Optional captured Entity state transition.
110
+ * @param extra Applies or restores the Agent execution record.
111
+ * @returns Completion after the transition is stored.
100
112
  */
101
- async #commit(input, liveBackend) {
102
- const stage = this.stage(input, liveBackend);
113
+ applyAgentConditional(entity, backend, key, expectedVersion, snapshot, extra) {
114
+ const prior = backend.current.get(key);
115
+ if ((prior?.version?.number ?? 0) !== expectedVersion)
116
+ throw new Error("Agent execution initial Entity Version is no longer current.");
117
+ const layout = snapshot?.states?.length ? stateHistorySpec(entity.stateSchema) : undefined;
118
+ const states = layout === undefined
119
+ ? undefined
120
+ : this.openRecords(entity.context, layout.spec, layout.group);
121
+ const prepared = layout === undefined
122
+ ? []
123
+ : (snapshot?.states ?? []).map((record) => layout.spec.materialize(record));
124
+ const priorStates = prepared.map((record) => states?.capture(record.id));
103
125
  try {
104
- await this.#writeStage(input, stage);
105
- this.#publish(stage, liveBackend);
126
+ this.writeAgentStates(states, prepared);
127
+ if (snapshot !== undefined)
128
+ backend.current.set(key, snapshot.next);
129
+ extra.apply();
106
130
  }
107
- finally {
108
- stage.entity.close();
131
+ catch (error) {
132
+ extra.restore();
133
+ if (prior === undefined)
134
+ backend.current.delete(key);
135
+ else
136
+ backend.current.set(key, prior);
137
+ for (const priorState of priorStates)
138
+ if (priorState !== undefined)
139
+ states?.apply(priorState);
140
+ throw error;
109
141
  }
142
+ return Promise.resolve();
110
143
  }
111
144
  /**
112
- * Opens only record families used by one commit.
145
+ * Writes immutable Agent state history after checking each Version slot.
113
146
  *
114
- * @typeParam I Entity identifier type.
115
- * @typeParam S Entity state type.
116
- * @param input Supplies configured histories and delivery Events.
117
- * @returns Live affected record families and their layouts.
147
+ * @param states State-history records when that family is configured.
148
+ * @param prepared Materialized state rows from the captured transition.
118
149
  */
119
- live(input) {
120
- this.#requireEnabledHistories(input);
121
- const stateLayout = input.states?.length
122
- ? stateHistorySpec(input.entity.stateSchema)
123
- : undefined;
124
- const eventLayout = input.diagnostics?.length
125
- ? eventHistorySpec(input.entity.stateSchema)
126
- : undefined;
127
- const states = stateLayout === undefined
128
- ? undefined
129
- : this.#openRecords(input.context, stateLayout.spec, stateLayout.group);
130
- const diagnostics = eventLayout === undefined
131
- ? undefined
132
- : this.#openRecords(input.context, eventLayout.spec, eventLayout.group);
133
- const events = input.events?.length
134
- ? this.#openRecords(input.context, eventStoreRecordSpec)
135
- : undefined;
136
- return { stateLayout, eventLayout, states, diagnostics, events };
150
+ writeAgentStates(states, prepared) {
151
+ if (states === undefined)
152
+ return;
153
+ for (const record of prepared) {
154
+ const existing = states.read(record.id);
155
+ if (existing !== undefined &&
156
+ !this.sameBytes(toBinary(EntityRecordSchema, existing), toBinary(EntityRecordSchema, record.record)))
157
+ throw new Error("Agent state history collides with another Version.");
158
+ states.write(record);
159
+ }
160
+ }
161
+ /**
162
+ * Closes this handle to new commits.
163
+ */
164
+ close() {
165
+ this.#open = false;
137
166
  }
138
167
  /**
139
- * Captures affected rows and creates isolated adapters for preparation.
168
+ * Applies one captured mutation without cross-record compensation.
140
169
  *
141
170
  * @typeParam I Entity identifier type.
142
171
  * @typeParam S Entity state type.
143
- * @param input Supplies the proposed record changes.
144
- * @param backend Supplies the live current-record map.
145
- * @returns The prepared affected-record workspace.
172
+ * @param input Supplies immutable record snapshots.
173
+ * @returns Completion after every requested record write.
146
174
  */
147
- stage(input, backend) {
148
- const live = this.live(input);
149
- const key = input.entity.id.key(input.entityId);
150
- const previous = backend.current.get(key);
151
- const ids = this.#ids(input, live);
152
- const stagedBackend = {
153
- current: new Map(previous === undefined ? [] : [[key, previous]]),
154
- mutationQueue: new KeyedSerialQueue(),
155
- };
156
- const stagedStates = InMemoryCommitValues.stage(live.states, ids.stateIds);
157
- const stagedDiagnostics = InMemoryCommitValues.stage(live.diagnostics, ids.diagnosticIds);
158
- const stagedEvents = InMemoryCommitValues.stage(live.events, ids.deliveryIds);
159
- const entity = new InMemoryEntityStorage(this.#stagedInput(input.entity, live.stateLayout, stagedStates, live.eventLayout, stagedDiagnostics), stagedBackend);
160
- return {
161
- live,
162
- key,
163
- previous,
164
- ...ids,
165
- stagedBackend,
166
- stagedStates,
167
- stagedDiagnostics,
168
- stagedEvents,
169
- entity,
170
- };
175
+ async apply(input) {
176
+ this.requireEnabledHistories(input);
177
+ this.validateRows(input);
178
+ const [entity, stateStorage, diagnosticStorage, eventStorage] = this.openCommit(input);
179
+ try {
180
+ for (const state of input.states ?? [])
181
+ await entity.states.append(state);
182
+ for (const diagnostic of input.diagnostics ?? [])
183
+ await entity.events.append(diagnostic);
184
+ for (const event of input.events ?? []) {
185
+ if (event.id === undefined || eventStorage === undefined)
186
+ throw new Error("Entity commit requires delivery-event IDs.");
187
+ await this.appendEvent(eventStorage, event.id, event);
188
+ }
189
+ await entity.current.write(input.next);
190
+ }
191
+ finally {
192
+ entity.close();
193
+ stateStorage?.close();
194
+ diagnosticStorage?.close();
195
+ eventStorage?.close();
196
+ }
171
197
  }
172
198
  /**
173
- * Materializes the storage identities and delivery rows before live application.
199
+ * Opens the record families needed by one captured mutation.
174
200
  *
175
201
  * @typeParam I Entity identifier type.
176
202
  * @typeParam S Entity state type.
177
- * @param input Supplies the changed records.
178
- * @param live Supplies generated history layouts.
179
- * @returns Affected keys and cloned delivery rows.
203
+ * @param input Supplies requested history and delivery records.
204
+ * @returns Entity and record handles to close after the mutation.
180
205
  */
181
- #ids(input, live) {
182
- const stateIds = (input.states ?? []).map((record) => {
183
- const layout = live.stateLayout;
184
- if (layout === undefined)
185
- throw new TypeError("Cannot read properties of undefined (reading 'spec')");
186
- return layout.spec.materialize(record).id;
187
- });
188
- const diagnosticIds = (input.diagnostics ?? []).map((event) => {
189
- const layout = live.eventLayout;
190
- if (layout === undefined)
191
- throw new TypeError("Cannot read properties of undefined (reading 'spec')");
192
- return layout.spec.materialize(event).id;
206
+ openCommit(input) {
207
+ const states = input.states?.length ? stateHistorySpec(input.entity.stateSchema) : undefined;
208
+ const diagnostics = input.diagnostics?.length
209
+ ? eventHistorySpec(input.entity.stateSchema)
210
+ : undefined;
211
+ const stateStorage = states === undefined
212
+ ? undefined
213
+ : new InMemoryRecordStorage(input.context, states.spec, () => this.openRecords(input.context, states.spec, states.group));
214
+ const diagnosticStorage = diagnostics === undefined
215
+ ? undefined
216
+ : new InMemoryRecordStorage(input.context, diagnostics.spec, () => this.openRecords(input.context, diagnostics.spec, diagnostics.group));
217
+ const eventStorage = input.events?.length
218
+ ? new InMemoryRecordStorage(input.context, eventStoreRecordSpec, () => this.openRecords(input.context, eventStoreRecordSpec))
219
+ : undefined;
220
+ const entityInput = { ...input.entity };
221
+ delete entityInput.stateHistoryStorage;
222
+ delete entityInput.eventHistoryStorage;
223
+ const entity = this.entities.create({
224
+ ...entityInput,
225
+ ...(stateStorage === undefined ? {} : { stateHistoryStorage: stateStorage }),
226
+ ...(diagnosticStorage === undefined ? {} : { eventHistoryStorage: diagnosticStorage }),
193
227
  });
194
- const materialized = (input.events ?? []).map((event) => eventStoreRecordSpec.materialize(clone(eventStoreRecordSpec.recordType, event)));
195
- const deliveryIds = materialized.map((record) => record.id);
196
- return { stateIds, diagnosticIds, materialized, deliveryIds };
228
+ return [entity, stateStorage, diagnosticStorage, eventStorage];
197
229
  }
198
230
  /**
199
- * Validates and writes only staged records before any live change.
231
+ * Writes one immutable delivery Event or accepts an identical retry.
200
232
  *
201
- * @typeParam I Entity identifier type.
202
- * @typeParam S Entity state type.
203
- * @param input Supplies the proposed record changes.
204
- * @param stage Supplies affected-record adapters and materialized Events.
233
+ * @param storage Supplies atomic single-record insertion.
234
+ * @param id Identifies the delivery Event.
235
+ * @param event Supplies the captured Event.
236
+ * @returns Completion after an identical Event is stored.
205
237
  */
206
- async #writeStage(input, stage) {
207
- const nextId = input.next.entityId === undefined ? undefined : input.entity.id.unpack(input.next.entityId);
208
- if (nextId === undefined || input.entity.id.key(nextId) !== stage.key)
209
- throw new Error("Entity commit current record identifies another Entity.");
210
- if (new Set(stage.deliveryIds.map((id) => id.value)).size !== stage.deliveryIds.length ||
211
- stage.deliveryIds.some((id) => stage.stagedEvents?.read(id) !== undefined))
238
+ async appendEvent(storage, id, event) {
239
+ if (await storage.compareAndSet(id, undefined, event))
240
+ return;
241
+ const prior = await storage.read(id);
242
+ if (prior === undefined ||
243
+ !this.sameBytes(toBinary(EventSchema, prior), toBinary(EventSchema, event))) {
212
244
  throw new Error("Entity commit requires unique delivery-event IDs.");
213
- await stage.entity.current.write(input.next);
214
- for (const state of input.states ?? [])
215
- await stage.entity.states.append(state);
216
- for (const diagnostic of input.diagnostics ?? [])
217
- await stage.entity.events.append(diagnostic);
218
- stage.stagedEvents?.writeAll(stage.materialized);
245
+ }
219
246
  }
220
247
  /**
221
- * Applies prepared rows synchronously and restores affected entries on failure.
248
+ * Compares two stored Protobuf byte sequences.
222
249
  *
223
- * @param stage Supplies the complete affected-record preparation.
224
- * @param backend Supplies the live current-record map.
250
+ * @param left First byte sequence.
251
+ * @param right Second byte sequence.
252
+ * @returns Whether every byte matches.
225
253
  */
226
- #publish(stage, backend) {
227
- const changes = [
228
- ...InMemoryCommitValues.changes(stage.live.states, stage.stagedStates, stage.stateIds),
229
- ...InMemoryCommitValues.changes(stage.live.diagnostics, stage.stagedDiagnostics, stage.diagnosticIds),
230
- ...InMemoryCommitValues.changes(stage.live.events, stage.stagedEvents, stage.deliveryIds),
231
- ];
232
- const next = stage.stagedBackend.current.get(stage.key);
233
- try {
234
- for (const change of changes)
235
- change.apply();
236
- backend.current.set(stage.key, next);
237
- }
238
- catch (error) {
239
- if (stage.previous === undefined)
240
- backend.current.delete(stage.key);
241
- else
242
- backend.current.set(stage.key, stage.previous);
243
- for (const change of changes.reverse())
244
- change.restore();
245
- throw error;
246
- }
254
+ sameBytes(left, right) {
255
+ return left.length === right.length && left.every((value, index) => value === right[index]);
247
256
  }
248
257
  /**
249
- * Connects affected staged history slices to the existing Entity adapters.
258
+ * Validates current identity and duplicate delivery IDs before writes.
250
259
  *
251
260
  * @typeParam I Entity identifier type.
252
261
  * @typeParam S Entity state type.
253
- * @param entity Supplies the Entity storage layout.
254
- * @param stateLayout Supplies the enabled state-history layout.
255
- * @param states Supplies the affected staged state rows.
256
- * @param eventLayout Supplies the enabled diagnostic-history layout.
257
- * @param diagnostics Supplies the affected staged diagnostic rows.
258
- * @returns The staged Entity storage layout.
262
+ * @param input Supplies the captured mutation.
259
263
  */
260
- #stagedInput(entity, stateLayout, states, eventLayout, diagnostics) {
261
- const base = { ...entity };
262
- delete base.stateHistoryStorage;
263
- delete base.eventHistoryStorage;
264
- return {
265
- ...base,
266
- ...(stateLayout === undefined || states === undefined
267
- ? {}
268
- : {
269
- stateHistoryStorage: new InMemoryRecordStorage(entity.context, stateLayout.spec, () => states),
270
- }),
271
- ...(eventLayout === undefined || diagnostics === undefined
272
- ? {}
273
- : {
274
- eventHistoryStorage: new InMemoryRecordStorage(entity.context, eventLayout.spec, () => diagnostics),
275
- }),
276
- };
264
+ validateRows(input) {
265
+ const nextId = input.next.entityId === undefined ? undefined : input.entity.id.unpack(input.next.entityId);
266
+ if (nextId === undefined || input.entity.id.key(nextId) !== input.entity.id.key(input.entityId))
267
+ throw new Error("Entity commit current record identifies another Entity.");
268
+ const ids = (input.events ?? []).map((event) => event.id?.value);
269
+ if (ids.some((id) => id === undefined || id.trim() === "") || new Set(ids).size !== ids.length)
270
+ throw new Error("Entity commit requires unique delivery-event IDs.");
277
271
  }
278
272
  /**
279
- * Rejects history rows when their corresponding history is disabled.
273
+ * Rejects disabled history families.
280
274
  *
281
275
  * @typeParam I Entity identifier type.
282
276
  * @typeParam S Entity state type.
283
- * @param input Supplies the requested histories.
277
+ * @param input Supplies the proposed histories.
284
278
  */
285
- #requireEnabledHistories(input) {
286
- if ((input.states?.length ?? 0) > 0 && !input.entity.stateHistory) {
279
+ requireEnabledHistories(input) {
280
+ if ((input.states?.length ?? 0) > 0 && !input.entity.stateHistory)
287
281
  throw new Error("Entity commit cannot append state history when it is disabled.");
288
- }
289
- if ((input.diagnostics?.length ?? 0) > 0 && !input.entity.eventHistory) {
282
+ if ((input.diagnostics?.length ?? 0) > 0 && !input.entity.eventHistory)
290
283
  throw new Error("Entity commit cannot append event history when it is disabled.");
291
- }
292
284
  }
293
285
  /**
294
- * Checks the tenant and Entity source type captured by this handle.
286
+ * Checks the tenant and source captured by this handle.
295
287
  *
296
288
  * @typeParam I Entity identifier type.
297
289
  * @typeParam S Entity state type.
298
290
  * @param input Supplies the requested scope.
299
291
  */
300
- #requireCompatible(input) {
292
+ requireCompatible(input) {
301
293
  if (input.context.multitenant !== this.#multitenant ||
302
294
  TenantBoundary.of(input.context).key !== this.#tenantKey ||
303
295
  TenantBoundary.of(input.entity.context).key !== this.#tenantKey ||
304
- input.entity.sourceType.typeName !== this.#input.sourceType.typeName) {
296
+ input.entity.sourceType.typeName !== this.input.sourceType.typeName) {
305
297
  throw new Error("Entity commit handle cannot commit another Entity storage scope.");
306
298
  }
307
299
  }
308
300
  /**
309
301
  * Rejects commits after this handle closes.
310
302
  */
311
- #requireOpen() {
303
+ requireOpen() {
312
304
  if (!this.#open)
313
305
  throw new Error("Entity commit storage is closed.");
314
306
  }
315
307
  }
316
- /**
317
- * Prepares only affected materialized rows for an in-memory commit.
318
- */
319
- const InMemoryCommitValues = Object.freeze({
320
- /**
321
- * Captures the affected live rows in an isolated tenant slice.
322
- *
323
- * @typeParam I Record identifier type.
324
- * @typeParam R Record message type.
325
- * @param live Supplies the live tenant slice when enabled.
326
- * @param ids Identifies affected slots.
327
- * @returns An isolated slice with only affected prior entries.
328
- */
329
- stage(live, ids) {
330
- if (live === undefined)
331
- return undefined;
332
- const staged = new TenantRecords();
333
- for (const id of ids)
334
- staged.apply(live.capture(id));
335
- return staged;
336
- },
337
- /**
338
- * Builds synchronous apply and restore operations for affected slots.
339
- *
340
- * @typeParam I Record identifier type.
341
- * @typeParam R Record message type.
342
- * @param live Supplies the live tenant slice when enabled.
343
- * @param staged Supplies fully prepared replacements.
344
- * @param ids Identifies affected slots.
345
- * @returns Operations that preserve complete prior entries and absence.
346
- */
347
- changes(live, staged, ids) {
348
- if (live === undefined || staged === undefined)
349
- return [];
350
- const seen = new Set();
351
- return ids.flatMap((id) => {
352
- const prior = live.capture(id);
353
- if (seen.has(prior.key))
354
- return [];
355
- seen.add(prior.key);
356
- const prepared = staged.capture(id);
357
- return [new MemoryCommitChange(live, prepared, prior)];
358
- });
359
- },
360
- });
361
- /**
362
- * Applies one affected materialized row and restores its complete prior slot.
363
- *
364
- * @typeParam I Record identifier type.
365
- * @typeParam R Record message type.
366
- */
367
- class MemoryCommitChange {
368
- live;
369
- prepared;
370
- prior;
371
- /**
372
- * Captures the prepared and prior versions of one slot.
373
- *
374
- * @param live Supplies the affected tenant slice.
375
- * @param prepared Supplies the replacement entry or absence.
376
- * @param prior Supplies the complete prior entry or absence.
377
- */
378
- constructor(live, prepared, prior) {
379
- this.live = live;
380
- this.prepared = prepared;
381
- this.prior = prior;
382
- }
383
- /**
384
- * Applies the fully prepared materialized row.
385
- */
386
- apply() {
387
- this.live.apply(this.prepared);
388
- }
389
- /**
390
- * Restores the complete prior row or absence.
391
- */
392
- restore() {
393
- this.live.apply(this.prior);
394
- }
395
- }
396
308
  //# sourceMappingURL=in-memory-entity-commit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"in-memory-entity-commit.js","sourceRoot":"","sources":["../../src/memory/in-memory-entity-commit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAgB,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAA4B,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sEAAsE,CAAC;AAE1G,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAO7F,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,0BAA0B,EAC1B,yBAAyB,GAG1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAiBpD;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAC3B,SAAS,CAA6B;IAEtC,QAAQ,CAAiB;IAEzB,YAAY,CAAc;IAE1B,MAAM,CAAuC;IAE7C,UAAU,CAAwB;IAElC,YAAY,CAAU;IAE/B,KAAK,GAAG,IAAI,CAAC;IAEb;;;;;;;OAOG;IACH,YACE,QAAoC,EACpC,OAAuB,EACvB,WAAwB,EACxB,KAA2C;QAE3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAA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uBAAuB,CAAuB,KAA8B;QAClF,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY;YAC/D,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACpF,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY;YACpE,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;OAMG;IACK,iBAAiB,CAAuB,KAA8B;QAC5E,IACE,KAAK,CAAC,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,YAAY;YAC/C,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,UAAU;YACxD,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,UAAU;YAC/D,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EACnE,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;IAED;;OAEG;IACK,WAAW;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACvE,CAAC;CACF"}
@@ -488,6 +488,6 @@ export declare class KeyedSerialQueue {
488
488
  * @param operation Supplies the operation to run.
489
489
  * @returns Resolves to the operation result.
490
490
  */
491
- run<T>(key: string, operation: () => Promise<T>): Promise<T>;
491
+ run<T>(key: string, operation: () => Promise<T> | T): Promise<T>;
492
492
  }
493
493
  //# sourceMappingURL=in-memory-entity-history.d.ts.map