@spine-event-engine/storage 2.0.0-snapshot.2 → 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/README.md +47 -14
- package/REFERENCE.md +26 -18
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- 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/in-memory-entity-history.d.ts +115 -1
- package/dist/memory/in-memory-entity-history.d.ts.map +1 -1
- package/dist/memory/in-memory-entity-history.js +186 -41
- package/dist/memory/in-memory-entity-history.js.map +1 -1
- package/dist/memory/in-memory-record-storage.d.ts +19 -0
- package/dist/memory/in-memory-record-storage.d.ts.map +1 -1
- package/dist/memory/in-memory-record-storage.js +25 -4
- package/dist/memory/in-memory-record-storage.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/provider.d.ts +18 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +23 -0
- package/dist/provider.js.map +1 -0
- package/dist/query/query-policy.d.ts +18 -14
- package/dist/query/query-policy.d.ts.map +1 -1
- package/dist/query/query-policy.js +55 -28
- package/dist/query/query-policy.js.map +1 -1
- package/dist/record/record-query.d.ts +12 -11
- package/dist/record/record-query.d.ts.map +1 -1
- package/dist/record/record-query.js +4 -1
- package/dist/record/record-query.js.map +1 -1
- package/dist/record/record-storage.d.ts +12 -5
- package/dist/record/record-storage.d.ts.map +1 -1
- package/dist/record/record-storage.js +14 -12
- package/dist/record/record-storage.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -27
- package/dist/record/record-mask.d.ts +0 -11
- package/dist/record/record-mask.d.ts.map +0 -1
- package/dist/record/record-mask.js +0 -82
- package/dist/record/record-mask.js.map +0 -1
package/README.md
CHANGED
|
@@ -5,6 +5,37 @@ includes an in-memory implementation for local development and tests. Use it
|
|
|
5
5
|
when an application needs a small record store, or when an adapter needs to
|
|
6
6
|
implement the same storage contract for a durable provider.
|
|
7
7
|
|
|
8
|
+
This is an experimental snapshot package. Use Node 24 or newer and generated
|
|
9
|
+
Protobuf record schemas before configuring storage.
|
|
10
|
+
|
|
11
|
+
## Install and write one record
|
|
12
|
+
|
|
13
|
+
Install the storage contract and Protobuf-ES in the application or adapter that
|
|
14
|
+
owns persistence:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pnpm add @spine-event-engine/storage@snapshot @bufbuild/protobuf
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The following in-memory record flow is suitable for a local test:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { create } from "@bufbuild/protobuf";
|
|
24
|
+
import { StringValueSchema } from "@bufbuild/protobuf/wkt";
|
|
25
|
+
import { InMemoryStorageFactory, RecordSpec } from "@spine-event-engine/storage";
|
|
26
|
+
|
|
27
|
+
const records = new InMemoryStorageFactory().createRecordStorage(
|
|
28
|
+
{ name: "Users", multitenant: false },
|
|
29
|
+
new RecordSpec({
|
|
30
|
+
recordType: StringValueSchema,
|
|
31
|
+
idKind: "string",
|
|
32
|
+
extractId: (user) => user.value,
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
35
|
+
await records.write(create(StringValueSchema, { value: "ava" }));
|
|
36
|
+
console.log((await records.read("ava"))?.value);
|
|
37
|
+
```
|
|
38
|
+
|
|
8
39
|
For detailed query, lifecycle, and adapter notes, see
|
|
9
40
|
[REFERENCE documentation for agents](REFERENCE.md).
|
|
10
41
|
|
|
@@ -22,9 +53,8 @@ pnpm typecheck:build
|
|
|
22
53
|
```
|
|
23
54
|
|
|
24
55
|
Run this workspace-wide TypeScript build from the repository root. For an
|
|
25
|
-
experimental npm consumer, install
|
|
26
|
-
|
|
27
|
-
`@spine-event-engine/storage@snapshot` tag.
|
|
56
|
+
experimental npm consumer, install `@spine-event-engine/storage@snapshot`.
|
|
57
|
+
The snapshot tag can change before a stable release.
|
|
28
58
|
|
|
29
59
|
## 🧪 Start with the Proto fields people may query
|
|
30
60
|
|
|
@@ -95,8 +125,8 @@ The storage API clones data at its boundaries. For the base factory and the
|
|
|
95
125
|
in-memory implementation, closing a factory prevents new record handles while
|
|
96
126
|
existing handles remain usable. Closing a record handle invalidates that
|
|
97
127
|
handle's later operations. Other adapters can close live handles; see their
|
|
98
|
-
[Datastore reference](
|
|
99
|
-
[MySQL reference](
|
|
128
|
+
[Datastore reference](https://github.com/SpineEventEngine/spine-ts/blob/master/packages/storage-datastore/REFERENCE.md) and
|
|
129
|
+
[MySQL reference](https://github.com/SpineEventEngine/spine-ts/blob/master/packages/storage-mysql/REFERENCE.md) before choosing shutdown
|
|
100
130
|
behavior.
|
|
101
131
|
|
|
102
132
|
## 🧩 Keep compatible record families separate
|
|
@@ -135,15 +165,17 @@ ordinary Event Store is intentionally ungrouped.
|
|
|
135
165
|
## 🗄️ Choose a durable adapter
|
|
136
166
|
|
|
137
167
|
`@spine-event-engine/storage-datastore` provides Google Cloud Datastore
|
|
138
|
-
storage. `@spine-event-engine/storage-
|
|
168
|
+
storage. `@spine-event-engine/storage-mysql` provides MySQL storage and
|
|
169
|
+
`@spine-event-engine/storage-postgres` provides PostgreSQL storage. Configure
|
|
139
170
|
those packages in application code and pass the resulting factory to the Spine
|
|
140
171
|
server; this package does not choose a database.
|
|
141
172
|
|
|
142
|
-
| Need | Adapter
|
|
143
|
-
| --------------------------- |
|
|
144
|
-
| Local development and tests | `InMemoryStorageFactory` in this package
|
|
145
|
-
| Google Cloud Datastore | [`@spine-event-engine/storage-datastore`](
|
|
146
|
-
| MySQL | [`@spine-event-engine/storage-
|
|
173
|
+
| Need | Adapter |
|
|
174
|
+
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
175
|
+
| Local development and tests | `InMemoryStorageFactory` in this package |
|
|
176
|
+
| Google Cloud Datastore | [`@spine-event-engine/storage-datastore`](https://github.com/SpineEventEngine/spine-ts/blob/master/packages/storage-datastore/README.md) |
|
|
177
|
+
| MySQL | [`@spine-event-engine/storage-mysql`](https://github.com/SpineEventEngine/spine-ts/blob/master/packages/storage-mysql/README.md) |
|
|
178
|
+
| PostgreSQL | [`@spine-event-engine/storage-postgres`](https://github.com/SpineEventEngine/spine-ts/blob/master/packages/storage-postgres/README.md) |
|
|
147
179
|
|
|
148
180
|
## ⚠️ Lifecycle differences
|
|
149
181
|
|
|
@@ -154,7 +186,8 @@ shutdown and queries.
|
|
|
154
186
|
|
|
155
187
|
## 🔗 Learn more
|
|
156
188
|
|
|
157
|
-
- [Datastore adapter](
|
|
158
|
-
- [MySQL adapter](
|
|
159
|
-
- [
|
|
189
|
+
- [Datastore adapter](https://github.com/SpineEventEngine/spine-ts/blob/master/packages/storage-datastore/README.md)
|
|
190
|
+
- [MySQL adapter](https://github.com/SpineEventEngine/spine-ts/blob/master/packages/storage-mysql/README.md)
|
|
191
|
+
- [PostgreSQL adapter](https://github.com/SpineEventEngine/spine-ts/blob/master/packages/storage-postgres/README.md)
|
|
192
|
+
- [Server](https://github.com/SpineEventEngine/spine-ts/blob/master/packages/server/README.md)
|
|
160
193
|
- [Reference for coding agents](REFERENCE.md)
|
package/REFERENCE.md
CHANGED
|
@@ -6,16 +6,18 @@ This reference is for agents working with the Spine TS storage contract.
|
|
|
6
6
|
|
|
7
7
|
Import public types from `@spine-event-engine/storage`. The entry point exports
|
|
8
8
|
`StorageFactory`, `RecordStorage`, `RecordSpec`, `RecordSpecOptions`, `RecordColumn`, `RecordQuery`,
|
|
9
|
-
`
|
|
10
|
-
column-mapping contracts, `
|
|
11
|
-
`TenantCatalogProvider`, `InMemoryStorageFactory`,
|
|
9
|
+
`StorageGroup`, `ColumnTypes`, `ColumnMappings`, the exported
|
|
10
|
+
column-mapping contracts, `InMemoryStorageFactory`,
|
|
12
11
|
`InMemoryStorageBackend`, event-store types, normalized query policy/evaluator
|
|
13
12
|
types, and entity history interfaces.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
|
|
14
|
+
## Provider SPI
|
|
15
|
+
|
|
16
|
+
Storage-adapter implementers import the complete provider-only contract set from
|
|
17
|
+
`@spine-event-engine/storage/provider`: Event Store record access, Entity
|
|
18
|
+
history and Entity commit contracts, query values, tenant boundaries/catalogs,
|
|
19
|
+
and delivery-cleanup handles. The storage root intentionally does not export
|
|
20
|
+
these provider seams; application code uses its root storage contracts instead.
|
|
19
21
|
|
|
20
22
|
## Record storage
|
|
21
23
|
|
|
@@ -76,9 +78,9 @@ name validation from the common query shape.
|
|
|
76
78
|
|
|
77
79
|
The normalized-plan matrix is intentionally provider-specific. MySQL admits
|
|
78
80
|
IDs; equality and the five comparisons on mapped orderable columns; nested
|
|
79
|
-
`all` and `either`; declared-column ordering; positive limits
|
|
81
|
+
`all` and `either`; declared-column ordering; and positive limits.
|
|
80
82
|
Datastore admits only IDs, equality, one provider-legal inequality column, flat
|
|
81
|
-
`all`, compatible ordering,
|
|
83
|
+
`all`, compatible ordering, and limits. Both reject unsupported shapes
|
|
82
84
|
before provider access. Normalized plans never include offset: the existing
|
|
83
85
|
`RecordQuery.offset` path is separate. MySQL executes every admitted predicate,
|
|
84
86
|
order, and finite bound in contained parameterized SQL; Datastore executes only
|
|
@@ -92,14 +94,14 @@ until each handle closes. `RecordStorage.close()` rejects that handle's later
|
|
|
92
94
|
operations. Datastore follows the base factory behavior. Adapters can define a
|
|
93
95
|
stronger shutdown lifecycle: the MySQL factory closes live handles while it
|
|
94
96
|
drains its pool. Read the [Datastore reference](../storage-datastore/REFERENCE.md)
|
|
95
|
-
and [MySQL reference](../storage-
|
|
97
|
+
and [MySQL reference](../storage-mysql/REFERENCE.md) or [PostgreSQL reference](../storage-postgres/REFERENCE.md) before relying on shutdown
|
|
96
98
|
behavior. The in-memory backend is ephemeral and process-local. Passing one
|
|
97
99
|
`InMemoryStorageBackend` to multiple in-memory factories deliberately shares
|
|
98
100
|
its scoped rows.
|
|
99
101
|
|
|
100
102
|
## Entity storage
|
|
101
103
|
|
|
102
|
-
The
|
|
104
|
+
The provider SPI supplies the framework's Entity storage
|
|
103
105
|
ports. Current Entity state is a generated `spine.server.entity.EntityRecord`.
|
|
104
106
|
Retained state history stores generated `EntityStateKey`/`EntityRecord` rows in
|
|
105
107
|
a `StorageGroup` named after the Entity state type. Retained diagnostic event
|
|
@@ -112,9 +114,15 @@ not open or allocate its grouped records. Current Entity loading always uses
|
|
|
112
114
|
the current record, never retained history. Event history is diagnostic data,
|
|
113
115
|
not a source for rebuilding current state.
|
|
114
116
|
|
|
115
|
-
The
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
`
|
|
120
|
-
|
|
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.
|
package/dist/index.d.ts
CHANGED
|
@@ -6,12 +6,11 @@ export { InMemoryStorageFactory } from "./memory/in-memory-storage-factory.js";
|
|
|
6
6
|
export { StorageQueryPolicy } from "./query/query-policy.js";
|
|
7
7
|
export { defaultQueryCandidateLimit, QueryCandidateLimitError, StorageQueryEvaluator, } from "./query/query-execution.js";
|
|
8
8
|
export type { NormalizedQueryEntry } from "./query/query-execution.js";
|
|
9
|
-
export type { NormalizedComparisonOperator,
|
|
9
|
+
export type { NormalizedComparisonOperator, NormalizedQueryOrder, NormalizedQueryPlan, NormalizedQueryPredicate, StorageQueryCapabilities, StorageQueryFeature, } from "./query/query-policy.js";
|
|
10
10
|
export { RecordColumn } from "./record/record-column.js";
|
|
11
11
|
export { ColumnTypes, type RecordColumnType } from "./record/column-type.js";
|
|
12
12
|
export { ColumnMappings, type ColumnMapping, type ColumnTypeMapping, } from "./record/column-mapping.js";
|
|
13
|
-
export {
|
|
14
|
-
export type { RecordContinuation, RecordContinuationValue, RecordFilter, RecordOrder, RecordReadOptions, } from "./record/record-query.js";
|
|
13
|
+
export type { RecordContinuation, RecordContinuationValue, RecordFilter, RecordOrder, } from "./record/record-query.js";
|
|
15
14
|
export { RecordQuery } from "./record/record-query.js";
|
|
16
15
|
export { RecordSpec, type RecordSpecOptions } from "./record/record-spec.js";
|
|
17
16
|
export { RecordStorage } from "./record/record-storage.js";
|
|
@@ -19,5 +18,4 @@ export { StorageGroup } from "./record/storage-group.js";
|
|
|
19
18
|
export type { RecordEntry } from "./record/record-storage.js";
|
|
20
19
|
export type { Storage, StorageContext, StorageMode } from "./storage/storage.js";
|
|
21
20
|
export { StorageFactory } from "./storage/storage-factory.js";
|
|
22
|
-
export { TenantBoundary, type TenantCatalog, type TenantCatalogProvider, } from "./internal/tenancy.js";
|
|
23
21
|
//# 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":"AAcA,OAAO,EACL,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,YAAY,EACV,4BAA4B,EAC5B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,YAAY,EACV,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,YAAY,EACZ,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,11 +20,9 @@ export { defaultQueryCandidateLimit, QueryCandidateLimitError, StorageQueryEvalu
|
|
|
20
20
|
export { RecordColumn } from "./record/record-column.js";
|
|
21
21
|
export { ColumnTypes } from "./record/column-type.js";
|
|
22
22
|
export { ColumnMappings, } from "./record/column-mapping.js";
|
|
23
|
-
export { RecordMask } from "./record/record-mask.js";
|
|
24
23
|
export { RecordQuery } from "./record/record-query.js";
|
|
25
24
|
export { RecordSpec } from "./record/record-spec.js";
|
|
26
25
|
export { RecordStorage } from "./record/record-storage.js";
|
|
27
26
|
export { StorageGroup } from "./record/storage-group.js";
|
|
28
27
|
export { StorageFactory } from "./storage/storage-factory.js";
|
|
29
|
-
export { TenantBoundary, } from "./internal/tenancy.js";
|
|
30
28
|
//# 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;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,UAAU,GAIX,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,UAAU,GAIX,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAUpC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAyB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EACL,cAAc,GAGf,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAA0B,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -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,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE
|
|
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,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO;IAGrD;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE1C;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAE1C;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,MAAM,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,CAAC,CAAC;YACpC,UAAU,IAAI,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAa;QACjB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YACrD,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC3C,IAAI,SAAS,KAAK,SAAS;gBAAE,SAAS;YACtC,IAAI,SAAS,GAAG,MAAM;gBAAE,KAAK,EAAE,CAAC;YAChC,IAAI,SAAS,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBACxC,IAAI,SAAS,IAAI,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC;iBACvF,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;gBAC7B,KAAK,CAAC,IAAI,CACR,IAAI,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,EACxB,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAChC,IAAI,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAC1B,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,IAAI,CACR,IAAI,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;;;;;;;OAOG;gBAED,QAAQ,EAAE,0BAA0B,EACpC,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC;IAU7C;;;;;;;OAOG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC3E;;OAEG;IACH,KAAK,IAAI,IAAI;IAyBb;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI;IAsBZ;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK;CA6Nd"}
|