@adobe/data 0.9.61 → 0.9.63

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 (97) hide show
  1. package/dist/ecs/archetype/archetype.d.ts +9 -2
  2. package/dist/ecs/archetype/archetype.js.map +1 -1
  3. package/dist/ecs/archetype/create-archetype.js +5 -2
  4. package/dist/ecs/archetype/create-archetype.js.map +1 -1
  5. package/dist/ecs/database/concurrency/concurrency-strategy.d.ts +86 -0
  6. package/dist/ecs/database/concurrency/concurrency-strategy.js +3 -0
  7. package/dist/ecs/database/concurrency/concurrency-strategy.js.map +1 -0
  8. package/dist/ecs/database/concurrency/immediate-concurrency.d.ts +22 -0
  9. package/dist/ecs/database/concurrency/immediate-concurrency.js +74 -0
  10. package/dist/ecs/database/concurrency/immediate-concurrency.js.map +1 -0
  11. package/dist/ecs/database/concurrency/index.d.ts +4 -0
  12. package/dist/ecs/database/concurrency/index.js +5 -0
  13. package/dist/ecs/database/concurrency/index.js.map +1 -0
  14. package/dist/ecs/database/concurrency/rebase-replay-concurrency.d.ts +20 -0
  15. package/dist/ecs/database/concurrency/rebase-replay-concurrency.js +34 -0
  16. package/dist/ecs/database/concurrency/rebase-replay-concurrency.js.map +1 -0
  17. package/dist/ecs/database/concurrency/roll-forward-concurrency.d.ts +33 -0
  18. package/dist/ecs/database/concurrency/roll-forward-concurrency.js +115 -0
  19. package/dist/ecs/database/concurrency/roll-forward-concurrency.js.map +1 -0
  20. package/dist/ecs/database/concurrency/roll-forward-concurrency.test.d.ts +1 -0
  21. package/dist/ecs/database/concurrency/roll-forward-concurrency.test.js +136 -0
  22. package/dist/ecs/database/concurrency/roll-forward-concurrency.test.js.map +1 -0
  23. package/dist/ecs/database/create-plugin.d.ts +1 -1
  24. package/dist/ecs/database/database.d.ts +29 -7
  25. package/dist/ecs/database/database.index.performance.test.js +5 -5
  26. package/dist/ecs/database/database.index.performance.test.js.map +1 -1
  27. package/dist/ecs/database/database.index.test.js +556 -51
  28. package/dist/ecs/database/database.index.test.js.map +1 -1
  29. package/dist/ecs/database/database.index.type-test.js +34 -10
  30. package/dist/ecs/database/database.index.type-test.js.map +1 -1
  31. package/dist/ecs/database/database.js.map +1 -1
  32. package/dist/ecs/database/database.reset.test.js +2 -1
  33. package/dist/ecs/database/database.reset.test.js.map +1 -1
  34. package/dist/ecs/database/index-registry/create-index-registry.d.ts +38 -9
  35. package/dist/ecs/database/index-registry/create-index-registry.js +67 -20
  36. package/dist/ecs/database/index-registry/create-index-registry.js.map +1 -1
  37. package/dist/ecs/database/index-registry/create-index.d.ts +10 -2
  38. package/dist/ecs/database/index-registry/create-index.js +44 -47
  39. package/dist/ecs/database/index-registry/create-index.js.map +1 -1
  40. package/dist/ecs/database/index.d.ts +1 -0
  41. package/dist/ecs/database/index.js +1 -0
  42. package/dist/ecs/database/index.js.map +1 -1
  43. package/dist/ecs/database/observe-index-entities.d.ts +26 -0
  44. package/dist/ecs/database/observe-index-entities.js +66 -0
  45. package/dist/ecs/database/observe-index-entities.js.map +1 -0
  46. package/dist/ecs/database/observed/create-observed-database.js +1 -1
  47. package/dist/ecs/database/observed/create-observed-database.js.map +1 -1
  48. package/dist/ecs/database/observed/observed-database.d.ts +1 -1
  49. package/dist/ecs/database/public/create-database.d.ts +12 -27
  50. package/dist/ecs/database/public/create-database.js +131 -37
  51. package/dist/ecs/database/public/create-database.js.map +1 -1
  52. package/dist/ecs/database/public/create-database.test.js +8 -7
  53. package/dist/ecs/database/public/create-database.test.js.map +1 -1
  54. package/dist/ecs/database/public/create-transaction-dispatcher.d.ts +4 -2
  55. package/dist/ecs/database/public/create-transaction-dispatcher.js +2 -8
  56. package/dist/ecs/database/public/create-transaction-dispatcher.js.map +1 -1
  57. package/dist/ecs/database/reconciling/create-rebase-replay-applier.d.ts +26 -0
  58. package/dist/ecs/database/reconciling/create-rebase-replay-applier.js +121 -0
  59. package/dist/ecs/database/reconciling/create-rebase-replay-applier.js.map +1 -0
  60. package/dist/ecs/database/reconciling/create-reconciling-database.d.ts +11 -0
  61. package/dist/ecs/database/reconciling/create-reconciling-database.js +28 -137
  62. package/dist/ecs/database/reconciling/create-reconciling-database.js.map +1 -1
  63. package/dist/ecs/database/transactional-store/create-transactional-store.js.map +1 -1
  64. package/dist/ecs/database/transactional-store/transactional-store.d.ts +1 -1
  65. package/dist/ecs/entity-location-table/create-entity-location-table.js +2 -2
  66. package/dist/ecs/entity-location-table/create-entity-location-table.js.map +1 -1
  67. package/dist/ecs/entity-location-table/entity-location-table.d.ts +7 -1
  68. package/dist/ecs/store/core/core.d.ts +7 -1
  69. package/dist/ecs/store/core/create-core.js +3 -3
  70. package/dist/ecs/store/core/create-core.js.map +1 -1
  71. package/dist/ecs/store/core/select-entities.js +6 -3
  72. package/dist/ecs/store/core/select-entities.js.map +1 -1
  73. package/dist/ecs/store/index-types.d.ts +53 -17
  74. package/dist/ecs/store/public/create-store.js +32 -6
  75. package/dist/ecs/store/public/create-store.js.map +1 -1
  76. package/dist/ecs/store/public/create-store.test.js +25 -0
  77. package/dist/ecs/store/public/create-store.test.js.map +1 -1
  78. package/dist/ecs/store/store.d.ts +10 -3
  79. package/dist/ecs/store/store.js.map +1 -1
  80. package/dist/functions/compare.d.ts +13 -0
  81. package/dist/functions/compare.js +15 -0
  82. package/dist/functions/compare.js.map +1 -0
  83. package/dist/functions/compare.test.d.ts +1 -0
  84. package/dist/functions/compare.test.js +24 -0
  85. package/dist/functions/compare.test.js.map +1 -0
  86. package/dist/functions/index.d.ts +1 -0
  87. package/dist/functions/index.js +1 -0
  88. package/dist/functions/index.js.map +1 -1
  89. package/dist/test-setup.js +2 -2
  90. package/dist/test-setup.js.map +1 -1
  91. package/dist/tsconfig.tsbuildinfo +1 -1
  92. package/package.json +3 -1
  93. package/references/data-lit/package.json +1 -1
  94. package/references/data-lit-tictactoe/package.json +1 -1
  95. package/references/data-react/package.json +1 -1
  96. package/references/data-react-hello/package.json +1 -1
  97. package/references/data-react-pixie/package.json +1 -1
@@ -1,29 +1,5 @@
1
1
  import { Database, FromServiceFactories } from "../database.js";
2
- /**
3
- * Sync-related options. Presence of `sync` means "this database is going to
4
- * be attached to a sync service", which has two consequences:
5
- *
6
- * 1. Every locally-generated `TransactionEnvelope` is stamped with
7
- * `userId`, and the reconciler keys its transient queue by the
8
- * compound `(userId, id)` so two peers' independent local id counters
9
- * cannot collide.
10
- * 2. The transaction wrapper enters deferred-commit mode: calls to
11
- * `db.transactions.X(args)` apply locally as transients (negative
12
- * time) and wait for the server's echoed `committed` envelope to
13
- * promote them via the reconciler's rebase-replay. This is required
14
- * for cross-peer entity-id determinism under concurrent edits.
15
- *
16
- * If `sync` is omitted the database operates in local-only mode: commits
17
- * apply immediately with positive time, no envelope stamping, no deferred
18
- * promotion.
19
- */
20
- export interface DatabaseSyncOptions {
21
- /**
22
- * Stable peer/session identifier. Must be unique across all peers
23
- * sharing the same sync server.
24
- */
25
- readonly userId: number | string;
26
- }
2
+ import type { ConcurrencyStrategyFactory } from "../concurrency/concurrency-strategy.js";
27
3
  interface CreateDatabaseOptions<P extends Database.Plugin<any, any, any, any, any, any, any, any>> {
28
4
  /**
29
5
  * Optional services overrides to use.
@@ -32,8 +8,17 @@ interface CreateDatabaseOptions<P extends Database.Plugin<any, any, any, any, an
32
8
  services?: {
33
9
  [K in keyof FromServiceFactories<P['services']>]?: FromServiceFactories<P['services']>[K];
34
10
  };
35
- /** See {@link DatabaseSyncOptions}. */
36
- sync?: DatabaseSyncOptions;
11
+ /**
12
+ * Concurrency strategy that controls how locally-initiated transactions
13
+ * are applied and how inbound envelopes are reconciled.
14
+ *
15
+ * Built-in strategies:
16
+ * - `createImmediateConcurrency()` — commits apply immediately, no
17
+ * rollback queue. Default when omitted.
18
+ * - `createRebaseReplayConcurrency(userId)` — deferred-commit mode with
19
+ * full rollback-and-replay for multi-peer synchronisation.
20
+ */
21
+ concurrency?: ConcurrencyStrategyFactory;
37
22
  }
38
23
  export declare function createDatabase(): Database<{}, {}, {}, {}, never, {}, {}, {}>;
39
24
  export declare function createDatabase<P extends Database.Plugin<{}, {}, {}, {}, never, {}, any, any>>(plugin: P, options?: CreateDatabaseOptions<P>): Database.FromPlugin<P>;
@@ -1,9 +1,11 @@
1
1
  // © 2026 Adobe. MIT License. See /LICENSE for details.
2
2
  import { Store } from "../../store/index.js";
3
- import { createReconcilingDatabase } from "../reconciling/create-reconciling-database.js";
4
3
  import { calculateSystemOrder } from "../calculate-system-order.js";
5
4
  import { createTransactionDispatcher } from "./create-transaction-dispatcher.js";
6
5
  import { observeSelectEntities } from "../observe-select-entities.js";
6
+ import { observeIndexEntities } from "../observe-index-entities.js";
7
+ import { createObservedDatabase } from "../observed/create-observed-database.js";
8
+ import { createImmediateConcurrency } from "../concurrency/immediate-concurrency.js";
7
9
  /**
8
10
  * For each system in newDeclarations that is not yet in systemFunctions: call create(db),
9
11
  * store the returned value in systemFunctions, and assign by name. Uses natural declaration order.
@@ -18,7 +20,7 @@ function createAndAssignSystems(db, systemFunctions, newDeclarations) {
18
20
  }
19
21
  }
20
22
  export function createDatabase(plugin, options) {
21
- const db = createEmptyDatabase(options?.sync);
23
+ const db = createEmptyDatabase(options?.concurrency);
22
24
  if (plugin === undefined) {
23
25
  return db;
24
26
  }
@@ -31,20 +33,29 @@ export function createDatabase(plugin, options) {
31
33
  * Creates a database with empty store, no transactions, actions, services, computed, or systems.
32
34
  * All content is added via .extend(plugin). Single code path for extension.
33
35
  */
34
- function createEmptyDatabase(sync) {
36
+ function createEmptyDatabase(concurrency) {
35
37
  const store = Store.create({
36
38
  components: {},
37
39
  resources: {},
38
40
  archetypes: {},
39
41
  });
40
- const reconcilingDatabase = createReconcilingDatabase(store, {});
42
+ const observedDatabase = createObservedDatabase(store);
43
+ // The transaction declarations dict is shared with the strategy via the
44
+ // getTransaction closure: extend() updates it, the strategy reads from it.
45
+ const transactionDeclarationsRef = {};
46
+ const getTransaction = (name) => transactionDeclarationsRef[name];
47
+ const strategyFactory = concurrency ?? createImmediateConcurrency();
48
+ const strategy = strategyFactory(observedDatabase.execute, getTransaction);
41
49
  // The dispatcher owns everything envelope-related: id allocation,
42
50
  // commit/transient/cancel intent decisions, the deferred-commit
43
- // behaviour implied by sync mode, and resolving plain/promise/async-
51
+ // behaviour implied by the strategy, and resolving plain/promise/async-
44
52
  // generator argument shapes. We just plug its outputs into the
45
53
  // database surface.
46
- const dispatcher = createTransactionDispatcher(reconcilingDatabase.apply, sync);
47
- reconcilingDatabase.observe.envelopes = dispatcher.envelopes;
54
+ const dispatcher = createTransactionDispatcher(strategy.apply, {
55
+ deferredCommit: strategy.deferredCommit,
56
+ userId: strategy.userId,
57
+ });
58
+ observedDatabase.observe.envelopes = dispatcher.envelopes;
48
59
  const transactions = { serviceName: "ecs-database-transactions-service" };
49
60
  const addTransactionWrappers = (transactionDecls) => {
50
61
  for (const name of Object.keys(transactionDecls)) {
@@ -70,10 +81,36 @@ function createEmptyDatabase(sync) {
70
81
  // the same reference (via spread / explicit field below) so users see
71
82
  // `db.indexes.<name>` and `t.indexes.<name>` pointing at one source of
72
83
  // truth.
84
+ const toData = () => {
85
+ // Fast path: a strategy with no replay hook leaves the store untouched
86
+ // after serialization, so a live-reference snapshot is safe.
87
+ if (!strategy.onAfterToData) {
88
+ return observedDatabase.toData();
89
+ }
90
+ // A replay strategy mutates the live buffers in `onAfterToData`, which
91
+ // would corrupt a live-reference snapshot. Capture a detached copy of
92
+ // the committed (rolled-back) state before replaying.
93
+ strategy.onBeforeToData?.();
94
+ const data = observedDatabase.toData(true);
95
+ strategy.onAfterToData();
96
+ return data;
97
+ };
98
+ const fromData = (data) => {
99
+ observedDatabase.fromData(data);
100
+ strategy.onAfterFromData?.();
101
+ };
73
102
  const partialDatabase = {
74
103
  serviceName: "ecs-database-service",
75
- ...reconcilingDatabase,
76
- sync,
104
+ ...observedDatabase,
105
+ concurrency: strategy,
106
+ apply: strategy.apply,
107
+ cancel: strategy.cancel,
108
+ reset: () => {
109
+ strategy.onReset();
110
+ observedDatabase.reset();
111
+ },
112
+ toData,
113
+ fromData,
77
114
  transactions,
78
115
  actions,
79
116
  services,
@@ -111,10 +148,35 @@ function createEmptyDatabase(sync) {
111
148
  locate: store.locate.bind(store),
112
149
  };
113
150
  partialDatabase.observe.select = observeSelectEntities(indexAwareStoreFacade, partialDatabase.observe.transactions);
151
+ // Reactive index handles. Each index's `observe(arg)` is built from its
152
+ // handle's `find` + `readColumns` and fires on the same transaction-commit
153
+ // boundary as `observe.select` (see `observeIndexEntities`). Attached at
154
+ // the Database layer because the Store layer that creates the handles has
155
+ // no transaction observable. `db.indexes` and `t.indexes` share the same
156
+ // handle objects, so attaching here covers both.
157
+ const observeIndex = observeIndexEntities(partialDatabase.observe.transactions);
158
+ const attachIndexObservers = () => {
159
+ // Structural view of the handle map: the Store augments each handle
160
+ // with `find` + `readColumns` (the same internal contract the query
161
+ // planner relies on for `find` + `routableColumns`).
162
+ const handles = store.indexes;
163
+ for (const name in handles) {
164
+ const handle = handles[name];
165
+ if (handle.observe)
166
+ continue;
167
+ handle.observe = observeIndex(handle.find, handle.readColumns);
168
+ }
169
+ };
170
+ attachIndexObservers();
114
171
  const extend = (plugin) => {
115
172
  if (!extendedPlugins.has(plugin)) {
116
173
  extendedPlugins.add(plugin);
117
- reconcilingDatabase.extend(plugin);
174
+ observedDatabase.extend(plugin);
175
+ // Update the shared transaction declarations ref so the strategy's
176
+ // getTransaction closure sees the new names during replay.
177
+ if (plugin.transactions) {
178
+ Object.assign(transactionDeclarationsRef, plugin.transactions);
179
+ }
118
180
  const pluginTransactions = plugin.transactions ?? {};
119
181
  const pluginActions = plugin.actions ?? {};
120
182
  const pluginServices = plugin.services ?? {};
@@ -129,12 +191,13 @@ function createEmptyDatabase(sync) {
129
191
  if (!(name in computed))
130
192
  computed[name] = pluginComputed[name](partialDatabase);
131
193
  }
132
- // `reconcilingDatabase.extend(plugin)` above propagates down to
194
+ // `observedDatabase.extend(plugin)` above propagates down to
133
195
  // `store.extend({ components, resources, archetypes, indexes })`,
134
196
  // so the Store has already absorbed `plugin.indexes`. We refresh
135
197
  // our local indexes reference in case the underlying map got a
136
198
  // new identity (it doesn't today, but stay defensive).
137
199
  partialDatabase.indexes = store.indexes;
200
+ attachIndexObservers();
138
201
  if (plugin.systems && Object.keys(plugin.systems).length > 0) {
139
202
  Object.assign(allSystemDeclarations, plugin.systems);
140
203
  systemOrder = calculateSystemOrder(allSystemDeclarations);
@@ -169,28 +232,34 @@ const equalityValue = (cond) => {
169
232
  * Returns `null` when no index applies; the caller must fall back to the
170
233
  * archetype scan. Returns an `Entity[]` when an index can answer the query.
171
234
  *
172
- * Match conditions (intentionally conservative for V2):
235
+ * Match conditions (intentionally conservative):
173
236
  * - `options.where` is non-empty.
174
- * - `options.order` is absent (sort orders are routed in a follow-up).
175
237
  * - Every `where` key is a pure equality (`v` or `{ "==": v }`).
176
- * - The `where` keys, as a set, equal some index's `components`.
238
+ * - The `where` keys, as a set, equal some index's key columns.
239
+ * - When `options.order` is present, that same index must be sorted with
240
+ * the default comparator on exactly the requested order columns (in
241
+ * sequence), and every requested direction must be ascending. A
242
+ * descending clause, a mismatched / partial column sequence, or a custom
243
+ * comparator falls back to the scan. (A sorted index's `find` already
244
+ * returns its bucket pre-sorted, so a matched ordered query is served
245
+ * without a second sort.)
177
246
  *
178
247
  * The query planner accesses `store.indexes` (the user-visible handle map),
179
248
  * so test spies and any future user-installed instrumentation see the call.
180
- * Components for each index are recovered from the registry-internal handle
181
- * (the handle exposes `find`/`findRange`/`get`; the column set is held by
182
- * the underlying `RuntimeIndex`, which is the registry's source of truth).
183
- * For the planner we treat the handle map structurally as
184
- * `{ [name]: { findByValues, routableColumns } }` because Store internally
185
- * augments each handle with these fields — see `createStore`.
249
+ * The column / sort metadata for each index lives on the registry-internal
250
+ * `RuntimeIndex`; `createStore` copies the routable subset onto each handle
251
+ * as `routableColumns` / `routableOrder`, which is the structural shape the
252
+ * planner reads below.
186
253
  *
187
254
  * After the index lookup returns candidate entities, each candidate is
188
255
  * checked for archetype membership of every `include` component so the
189
- * returned set respects the same archetype filter as the scan path.
256
+ * returned set respects the same archetype filter as the scan path. Index
257
+ * order is preserved through that filter, so a matched ordered query stays
258
+ * sorted.
190
259
  */
191
260
  function trySelectViaIndex(store, include, options) {
192
261
  const where = options?.where;
193
- if (!where || options?.order)
262
+ if (!where)
194
263
  return null;
195
264
  const whereKeys = Object.keys(where);
196
265
  if (whereKeys.length === 0)
@@ -204,17 +273,32 @@ function trySelectViaIndex(store, include, options) {
204
273
  return null;
205
274
  values[k] = eq;
206
275
  }
207
- // Iterate the public handle map (store.indexes). Each handle carries a
208
- // non-public `routableColumns` field placed by `createStore` for exactly
209
- // this purpose. `routableColumns: null` opts an index out of raw-where
276
+ // Resolve the order constraint, if any. An empty order object is treated
277
+ // as no order. Any descending (falsy) direction opts the whole query out
278
+ // of routing a sorted index only materializes its single ascending
279
+ // order, so it cannot serve a descending request without re-sorting.
280
+ let orderCols = null;
281
+ if (options?.order) {
282
+ const cols = Object.keys(options.order);
283
+ if (cols.length > 0) {
284
+ for (const c of cols) {
285
+ if (!options.order[c])
286
+ return null;
287
+ }
288
+ orderCols = cols;
289
+ }
290
+ }
291
+ // Iterate the public handle map (store.indexes). Each handle carries the
292
+ // non-public `routableColumns` / `routableOrder` fields placed by
293
+ // `createStore`. `routableColumns: null` opts an index out of raw-where
210
294
  // auto-routing (function and slot-map keys live in a value space the
211
- // planner cannot infer from a where clause).
295
+ // planner cannot infer from a where clause); `routableOrder: null` opts it
296
+ // out of serving an `order` clause (unsorted, or custom comparator).
212
297
  //
213
- // For a matched index the planner builds the appropriate `find`
214
- // argument: a scalar for a single-column key, the full values object
215
- // for a multi-column key. The call goes through `handle.find` so any
216
- // user-installed spy or instrumentation on the handle sees the
217
- // dispatch.
298
+ // For a matched index the planner passes the `{ column: value }` object as
299
+ // the `find` argument every index key is object-shaped, including a
300
+ // single-column key. The call goes through `handle.find` so any
301
+ // user-installed spy or instrumentation on the handle sees the dispatch.
218
302
  const handles = store.indexes;
219
303
  let matchedHandle;
220
304
  let matchedCols;
@@ -225,16 +309,26 @@ function trySelectViaIndex(store, include, options) {
225
309
  continue;
226
310
  if (cols.length !== whereKeys.length)
227
311
  continue;
228
- if (cols.every(c => c in values)) {
229
- matchedHandle = handle;
230
- matchedCols = cols;
231
- break;
312
+ if (!cols.every(c => c in values))
313
+ continue;
314
+ // Key matches. If an order was requested, the same index must be
315
+ // sorted on exactly those columns in the same sequence.
316
+ if (orderCols !== null) {
317
+ const sortCols = handle.routableOrder;
318
+ if (sortCols === null)
319
+ continue;
320
+ if (sortCols.length !== orderCols.length)
321
+ continue;
322
+ if (!sortCols.every((c, i) => c === orderCols[i]))
323
+ continue;
232
324
  }
325
+ matchedHandle = handle;
326
+ matchedCols = cols;
327
+ break;
233
328
  }
234
329
  if (!matchedHandle || !matchedCols)
235
330
  return null;
236
- const findArg = matchedCols.length === 1 ? values[matchedCols[0]] : values;
237
- const candidates = matchedHandle.find(findArg);
331
+ const candidates = matchedHandle.find(values);
238
332
  if (candidates.length === 0)
239
333
  return [];
240
334
  const includeArr = Array.from(include);
@@ -1 +1 @@
1
- {"version":3,"file":"create-database.js","sourceRoot":"","sources":["../../../../src/ecs/database/public/create-database.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAiB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGtE;;;;;GAKG;AACH,SAAS,sBAAsB,CAC3B,EAAO,EACP,eAAwC,EACxC,eAAiE;IAEjE,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QACjC,IAAI,IAAI,IAAI,eAAe;YAAE,SAAS;QACtC,eAA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QACxB,MAAM,IAAI,GAAI,QAAQ,CAAC,SAAkD,CAAC,OAAO,CAAC;QAClF,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,EAAE,CAAC;YAC/C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"create-database.js","sourceRoot":"","sources":["../../../../src/ecs/database/public/create-database.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAiB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAKrF;;;;;GAKG;AACH,SAAS,sBAAsB,CAC3B,EAAO,EACP,eAAwC,EACxC,eAAiE;IAEjE,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QACjC,IAAI,IAAI,IAAI,eAAe;YAAE,SAAS;QACtC,eAAe,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;IACrE,CAAC;AACL,CAAC;AA6BD,MAAM,UAAU,cAAc,CAC1B,MAAgE,EAChE,OAAoC;IAEpC,MAAM,EAAE,GAAG,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACrD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE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,CAAC,KAAK,SAAS,CAAC,EAAE,CAAC;YAC/C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -2,6 +2,7 @@
2
2
  import { describe, it, expect, vi } from "vitest";
3
3
  import { Database } from "../database.js";
4
4
  import { createReconcilingDatabase } from "../reconciling/create-reconciling-database.js";
5
+ import { createRebaseReplayConcurrency } from "../concurrency/index.js";
5
6
  import { Store } from "../../store/index.js";
6
7
  import { F32 } from "../../../math/f32/index.js";
7
8
  import { Observe } from "../../../observe/index.js";
@@ -1050,13 +1051,13 @@ describe("createDatabase", () => {
1050
1051
  },
1051
1052
  });
1052
1053
  // Wrong value type: token should be string, not number
1053
- // @ts-expect-error
1054
+ // @ts-expect-error token must be a string
1054
1055
  Database.create(plugin, { services: { auth: { token: 123, isAuthenticated: false } } });
1055
1056
  // Unknown service key
1056
- // @ts-expect-error
1057
+ // @ts-expect-error nonexistent is not a declared service
1057
1058
  Database.create(plugin, { services: { nonexistent: { foo: 'bar' } } });
1058
1059
  // Missing required property (isAuthenticated)
1059
- // @ts-expect-error
1060
+ // @ts-expect-error auth override is missing isAuthenticated
1060
1061
  Database.create(plugin, { services: { auth: { token: 'x' } } });
1061
1062
  });
1062
1063
  });
@@ -1371,13 +1372,13 @@ describe("userId in transaction context", () => {
1371
1372
  expect(db.resources.seen).toBeUndefined();
1372
1373
  });
1373
1374
  it("t.userId matches sync.userId for locally-initiated transactions", () => {
1374
- const db = Database.create(makePlugin(), { sync: { userId: "alice" } });
1375
+ const db = Database.create(makePlugin(), { concurrency: createRebaseReplayConcurrency("alice") });
1375
1376
  db.transactions.capture();
1376
1377
  expect(db.resources.seen).toBe("alice");
1377
1378
  });
1378
1379
  it("t.userId matches the envelope userId for inbound db.apply(envelope) calls", () => {
1379
1380
  const plugin = makePlugin();
1380
- const db = Database.create(plugin, { sync: { userId: "alice" } });
1381
+ const db = Database.create(plugin, { concurrency: createRebaseReplayConcurrency("alice") });
1381
1382
  // Build a committed envelope that looks like it came from "bob"
1382
1383
  const envelope = { id: 1, userId: "bob", name: "capture", args: undefined, time: 1 };
1383
1384
  db.apply(envelope);
@@ -1403,7 +1404,7 @@ describe("no-op envelope suppression", () => {
1403
1404
  },
1404
1405
  });
1405
1406
  it("a no-op commit (wrong userId) does not fire observe.envelopes", () => {
1406
- const db = Database.create(makeGatedPlugin(), { sync: { userId: "O" } });
1407
+ const db = Database.create(makeGatedPlugin(), { concurrency: createRebaseReplayConcurrency("O") });
1407
1408
  const listener = vi.fn();
1408
1409
  db.observe.envelopes(listener);
1409
1410
  db.transactions.setIfX({ v: 99 });
@@ -1411,7 +1412,7 @@ describe("no-op envelope suppression", () => {
1411
1412
  expect(db.resources.value).toBe(0);
1412
1413
  });
1413
1414
  it("an effective commit (correct userId) does fire observe.envelopes", () => {
1414
- const db = Database.create(makeGatedPlugin(), { sync: { userId: "X" } });
1415
+ const db = Database.create(makeGatedPlugin(), { concurrency: createRebaseReplayConcurrency("X") });
1415
1416
  const listener = vi.fn();
1416
1417
  db.observe.envelopes(listener);
1417
1418
  db.transactions.setIfX({ v: 99 });