@gonvex/client 0.5.0 → 0.5.2-staging.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"indexeddb-replica.js","sourceRoot":"","sources":["../src/indexeddb-replica.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,OAAO,CAAC;AAqB1C,MAAM,mBAAmB,GAAiB,SAAS,CAAC;AACpD,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,sEAAsE;AACtE,MAAM,OAAO,4BAA4B;IACtB,QAAQ,CAAkB;IACnC,WAAW,CAAiB;IAEpC,YAAY,IAAI,GAAG,sBAAsB;QACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAC,IAAI,CAAoB,CAAC;QACnD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;YACrF,MAAM,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,MAA+C,EAAE,EAAE;gBAC7G,MAAM,CAAC,KAAK,GAAG,mBAAmB,CAAC;gBACnC,OAAO,MAAM,CAAC,GAAG,CAAC;YACpB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC;YACjD,QAAQ,EAAE,0CAA0C;YACpD,OAAO,EAAE,0BAA0B;YACnC,IAAI,EAAE,oBAAoB;YAC1B,sEAAsE;YACtE,mEAAmE;YACnE,SAAS,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,SAAS,cAAc,CAAC,KAAmB;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC;AACjF,CAAC;AAED,SAAS,eAAe,CAAC,KAAuF;IAC9G,OAAO;QACL,GAAG,KAAK;QACR,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,MAAM;QAC1B,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,IAAI;QACtB,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;QACnB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;QAChE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS;KACvD,CAAC;AACJ,CAAC"}
@@ -31,6 +31,15 @@ export type ReplicaWindow = {
31
31
  maxBytes?: number;
32
32
  hashes?: Record<string, string>;
33
33
  };
34
+ /** Static Replica Collection metadata plus the arguments for one subscription. */
35
+ export type ReplicaCollectionPlan = {
36
+ table: string;
37
+ key: string;
38
+ equalFilters?: Readonly<Record<string, string>>;
39
+ excludeWhenSet?: readonly string[];
40
+ orderBy?: string;
41
+ orderDirection?: "asc" | "desc";
42
+ };
34
43
  export type ReplicaTransaction = {
35
44
  cursor: ReplicaCursor;
36
45
  originCommandId?: string;
@@ -53,6 +62,8 @@ export type ReplicaScope = string;
53
62
  export interface LocalReplicaStorage {
54
63
  load(scope?: ReplicaScope): Promise<ReplicaSnapshot | undefined>;
55
64
  applyTransaction(transaction: ReplicaTransaction, snapshot: ReplicaSnapshot, scope?: ReplicaScope): Promise<void>;
65
+ /** Advance ready Replica Collection cursors without rewriting normalized rows. */
66
+ advanceWatermark?(windows: readonly ReplicaWindow[], cursor: ReplicaCursor | undefined, scope?: ReplicaScope): Promise<void>;
56
67
  /** Persist a normalized Query/Collection materialization atomically. */
57
68
  replaceSnapshot?(snapshot: ReplicaSnapshot, scope?: ReplicaScope): Promise<void>;
58
69
  replaceWindow?(window: ReplicaWindow, snapshot: ReplicaSnapshot, scope?: ReplicaScope): Promise<void>;
@@ -78,9 +89,18 @@ export type LiveQueryResult<T extends ReplicaRow = ReplicaRow> = {
78
89
  unsupportedOperator?: string;
79
90
  };
80
91
  export type ReplicaCollectionState<T extends ReplicaRow = ReplicaRow> = LiveQueryResult<T> & {
92
+ /**
93
+ * True only after this exact Replica Collection subscription receives replica.ready.
94
+ * Direct LocalReplicaView reads omit it because verification belongs to the transport subscription.
95
+ */
96
+ isUpToDate?: boolean;
81
97
  truncated: boolean;
82
98
  computedRevision: number;
83
99
  };
100
+ /** Collection state returned by a live client watch or React hook. */
101
+ export type ReplicaCollectionSubscriptionState<T extends ReplicaRow = ReplicaRow> = ReplicaCollectionState<T> & {
102
+ isUpToDate: boolean;
103
+ };
84
104
  /**
85
105
  * Read-only view of the normalized Local Replica exposed to application code.
86
106
  *
@@ -114,6 +134,7 @@ export declare class LocalReplica implements LocalReplicaView {
114
134
  private liveQueries;
115
135
  /** Rows introduced by a materialized window may be reclaimed conservatively. */
116
136
  private readonly windowOwned;
137
+ private readonly replicaPlans;
117
138
  private pendingCommands;
118
139
  private listeners;
119
140
  private persistence;
@@ -121,6 +142,8 @@ export declare class LocalReplica implements LocalReplicaView {
121
142
  private hydration?;
122
143
  private freshnessValue;
123
144
  private versionValue;
145
+ private windowVersionClock;
146
+ private readonly windowVersions;
124
147
  private scopeValue;
125
148
  private scopeLoaded;
126
149
  private scopeActivation?;
@@ -140,9 +163,13 @@ export declare class LocalReplica implements LocalReplicaView {
140
163
  } | undefined;
141
164
  freshness(): ReplicaFreshness;
142
165
  version(): number;
166
+ /** Monotonic version for one materialized window and its referenced rows. */
167
+ windowVersion(signature: string): number;
143
168
  setFreshness(freshness: ReplicaFreshness): void;
144
169
  subscribe(listener: () => void): () => boolean;
145
170
  applyOptimistic(commandId: string, patches: OptimisticPatch[]): void;
171
+ /** Register generated Replica metadata without persisting it with the window. */
172
+ registerReplicaCollection(signature: string, definition: ReplicaCollectionPlan, args?: ReplicaRow): void;
146
173
  acknowledgeCommand(commandId: string, committedRevision?: number): void;
147
174
  rejectCommand(commandId: string): void;
148
175
  /** True while an optimistic command still contributes visible patches. */
@@ -200,9 +227,22 @@ export declare class LocalReplica implements LocalReplicaView {
200
227
  removedIDs?: string[];
201
228
  scope?: ReplicaScope;
202
229
  }): Promise<void>;
230
+ /**
231
+ * Advance a set of ready Replica Collection cursors for one server
232
+ * watermark. This is deliberately separate from window materialization:
233
+ * watermarks contain no row data, so persistence must update only window and
234
+ * cursor metadata in one storage transaction.
235
+ */
236
+ advanceWatermark(revision: number, signatures?: readonly string[], scope?: ReplicaScope): Promise<void>;
203
237
  getWindow(signature: string): ReplicaWindow | undefined;
204
238
  listWindows(): ReplicaWindow[];
205
239
  windowRows<T extends ReplicaRow = ReplicaRow>(signature: string): T[];
240
+ /**
241
+ * Return only rows in the committed server membership. Optimistic rows are
242
+ * deliberately excluded because this is used for resume keys and integrity
243
+ * hashes, never for rendering.
244
+ */
245
+ committedWindowRows<T extends ReplicaRow = ReplicaRow>(signature: string): T[];
206
246
  removeWindow(signature: string, scope?: ReplicaScope): Promise<void>;
207
247
  clear(scope?: ReplicaScope): Promise<void>;
208
248
  private materializeWindowNow;
@@ -222,6 +262,14 @@ export declare class LocalReplica implements LocalReplicaView {
222
262
  private reconcileCommands;
223
263
  private persist;
224
264
  private notify;
265
+ private markWindowChanged;
266
+ private markWindowsForPatches;
267
+ /**
268
+ * Apply optimistic membership transiently. The persisted window.ids remain
269
+ * the committed server membership, so rejection and reconciliation are
270
+ * reversible and never write optimistic IDs to storage.
271
+ */
272
+ private effectiveMembership;
225
273
  private trackWindowOwnership;
226
274
  private pruneOwnedEntities;
227
275
  private pruneOwnedEntitiesAfterRemoval;
@@ -230,6 +278,7 @@ export declare class MemoryLocalReplicaStorage implements LocalReplicaStorage {
230
278
  private readonly values;
231
279
  load(scope?: ReplicaScope): Promise<ReplicaSnapshot | undefined>;
232
280
  applyTransaction(_transaction: ReplicaTransaction, snapshot: ReplicaSnapshot, scope?: ReplicaScope): Promise<void>;
281
+ advanceWatermark(windows: readonly ReplicaWindow[], cursor: ReplicaCursor | undefined, scope?: ReplicaScope): Promise<void>;
233
282
  replaceSnapshot(snapshot: ReplicaSnapshot, scope?: ReplicaScope): Promise<void>;
234
283
  replaceWindow(_window: ReplicaWindow, snapshot: ReplicaSnapshot, scope?: ReplicaScope): Promise<void>;
235
284
  applyWindowDelta(_window: ReplicaWindow, _delta: {
@@ -6,6 +6,7 @@ export class LocalReplica {
6
6
  liveQueries = new Map();
7
7
  /** Rows introduced by a materialized window may be reclaimed conservatively. */
8
8
  windowOwned = new Map();
9
+ replicaPlans = new Map();
9
10
  pendingCommands = new Map();
10
11
  listeners = new Set();
11
12
  persistence = Promise.resolve();
@@ -13,6 +14,8 @@ export class LocalReplica {
13
14
  hydration;
14
15
  freshnessValue = "verifying";
15
16
  versionValue = 0;
17
+ windowVersionClock = 0;
18
+ windowVersions = new Map();
16
19
  scopeValue = defaultReplicaScope;
17
20
  // The default scope starts as an immediately usable empty in-memory store.
18
21
  // Persistence is restored only by hydrate()/activateScope(), so direct
@@ -57,11 +60,13 @@ export class LocalReplica {
57
60
  return;
58
61
  this.scopeValue = nextScope;
59
62
  this.scopeLoaded = true;
60
- this.cursorValue = snapshot?.cursor;
61
63
  this.entities = snapshot ? entitiesFromSnapshot(snapshot.entities) : new Map();
62
64
  this.liveQueries = snapshot
63
65
  ? new Map(Object.entries(snapshot.liveQueries).map(([key, value]) => [key, normalizeWindow(value)]))
64
66
  : new Map();
67
+ this.cursorValue = hydratedTransactionFloor(snapshot?.cursor, this.liveQueries);
68
+ for (const signature of this.liveQueries.keys())
69
+ this.markWindowChanged(signature);
65
70
  this.windowOwned.clear();
66
71
  // Optimistic commands belong to the old identity and must never be
67
72
  // projected while the newly restored scope is becoming authoritative.
@@ -81,6 +86,8 @@ export class LocalReplica {
81
86
  return this.freshnessValue;
82
87
  }
83
88
  version() { return this.versionValue; }
89
+ /** Monotonic version for one materialized window and its referenced rows. */
90
+ windowVersion(signature) { return this.windowVersions.get(signature) ?? 0; }
84
91
  setFreshness(freshness) {
85
92
  if (freshness === this.freshnessValue)
86
93
  return;
@@ -95,9 +102,22 @@ export class LocalReplica {
95
102
  commandId = commandId.trim();
96
103
  if (!commandId)
97
104
  throw new Error("optimistic commandId is required");
98
- this.pendingCommands.set(commandId, { commandId, patches: patches.map(cloneOptimisticPatch) });
105
+ const clonedPatches = patches.map(cloneOptimisticPatch);
106
+ this.pendingCommands.set(commandId, { commandId, patches: clonedPatches });
107
+ this.markWindowsForPatches(clonedPatches);
99
108
  this.notify();
100
109
  }
110
+ /** Register generated Replica metadata without persisting it with the window. */
111
+ registerReplicaCollection(signature, definition, args = {}) {
112
+ this.replicaPlans.set(signature, {
113
+ definition: {
114
+ ...definition,
115
+ equalFilters: definition.equalFilters ? { ...definition.equalFilters } : undefined,
116
+ excludeWhenSet: definition.excludeWhenSet ? [...definition.excludeWhenSet] : undefined,
117
+ },
118
+ args: cloneRow(args),
119
+ });
120
+ }
101
121
  acknowledgeCommand(commandId, committedRevision) {
102
122
  const pending = this.pendingCommands.get(commandId);
103
123
  if (!pending)
@@ -108,8 +128,10 @@ export class LocalReplica {
108
128
  this.reconcileCommands();
109
129
  }
110
130
  rejectCommand(commandId) {
111
- if (!this.pendingCommands.delete(commandId))
131
+ const command = this.pendingCommands.get(commandId);
132
+ if (!command || !this.pendingCommands.delete(commandId))
112
133
  return;
134
+ this.markWindowsForPatches(command.patches);
113
135
  this.notify();
114
136
  }
115
137
  /** True while an optimistic command still contributes visible patches. */
@@ -158,6 +180,64 @@ export class LocalReplica {
158
180
  this.application = application.catch(() => undefined);
159
181
  return application;
160
182
  }
183
+ /**
184
+ * Advance a set of ready Replica Collection cursors for one server
185
+ * watermark. This is deliberately separate from window materialization:
186
+ * watermarks contain no row data, so persistence must update only window and
187
+ * cursor metadata in one storage transaction.
188
+ */
189
+ advanceWatermark(revision, signatures = [], scope) {
190
+ const requestedScope = scope === undefined ? undefined : normalizeReplicaScope(scope);
191
+ const application = this.application.then(async () => {
192
+ if (requestedScope !== undefined && requestedScope !== this.scopeValue)
193
+ return;
194
+ if (!Number.isSafeInteger(revision) || revision < 0 || signatures.length === 0)
195
+ return;
196
+ const eligible = new Set(signatures);
197
+ const nextQueries = new Map([...this.liveQueries.entries()].map(([signature, window]) => [signature, cloneWindow(window)]));
198
+ const changedWindows = [];
199
+ for (const [signature, window] of nextQueries) {
200
+ if (!eligible.has(signature) || window.kind !== "replica" || !window.cursor)
201
+ continue;
202
+ if (window.cursor.revision >= revision)
203
+ continue;
204
+ window.cursor = { ...window.cursor, revision };
205
+ changedWindows.push(window);
206
+ }
207
+ if (changedWindows.length === 0)
208
+ return;
209
+ // Compute the shared floor exactly once from the complete next window
210
+ // set. A watermark cannot outrun an older retained Replica Collection.
211
+ const nextCursor = replicaTransactionFloor(this.cursorValue, nextQueries);
212
+ const writeScope = this.scopeValue;
213
+ if (this.storage?.advanceWatermark) {
214
+ await this.persist(() => this.storage.advanceWatermark(changedWindows, nextCursor, writeScope));
215
+ }
216
+ else if (this.storage?.replaceSnapshot) {
217
+ // Compatibility for older/custom storage adapters. Current IndexedDB
218
+ // and SQLite adapters implement the metadata-only operation above.
219
+ const snapshot = snapshotFrom(nextCursor, this.entities, nextQueries);
220
+ await this.persist(() => this.storage.replaceSnapshot(snapshot, writeScope));
221
+ }
222
+ else if (this.storage?.replaceWindow) {
223
+ // The original storage contract only exposed replaceWindow. Preserve
224
+ // durability for those adapters by reusing one computed snapshot;
225
+ // this path is intentionally serial and is not used by the bundled
226
+ // normalized adapters.
227
+ const snapshot = snapshotFrom(nextCursor, this.entities, nextQueries);
228
+ for (const window of changedWindows) {
229
+ await this.persist(() => this.storage.replaceWindow(window, snapshot, writeScope));
230
+ }
231
+ }
232
+ this.liveQueries = nextQueries;
233
+ for (const window of changedWindows)
234
+ this.markWindowChanged(window.signature);
235
+ this.cursorValue = nextCursor;
236
+ this.notify();
237
+ });
238
+ this.application = application.catch(() => undefined);
239
+ return application;
240
+ }
161
241
  getWindow(signature) {
162
242
  const window = this.liveQueries.get(signature);
163
243
  return window ? cloneWindow(window) : undefined;
@@ -168,6 +248,22 @@ export class LocalReplica {
168
248
  windowRows(signature) {
169
249
  return this.liveQuery(signature).rows;
170
250
  }
251
+ /**
252
+ * Return only rows in the committed server membership. Optimistic rows are
253
+ * deliberately excluded because this is used for resume keys and integrity
254
+ * hashes, never for rendering.
255
+ */
256
+ committedWindowRows(signature) {
257
+ if (!this.scopeLoaded)
258
+ return [];
259
+ const window = this.liveQueries.get(signature);
260
+ if (!window)
261
+ return [];
262
+ return window.ids
263
+ .map((id) => this.entities.get(window.entity)?.get(id))
264
+ .filter((row) => row !== undefined)
265
+ .map(cloneRow);
266
+ }
171
267
  removeWindow(signature, scope) {
172
268
  const application = this.application.then(async () => {
173
269
  if (scope !== undefined && normalizeReplicaScope(scope) !== this.scopeValue)
@@ -184,6 +280,7 @@ export class LocalReplica {
184
280
  await this.persist(() => this.storage.replaceSnapshot(snapshot, this.scopeValue));
185
281
  }
186
282
  this.liveQueries = nextQueries;
283
+ this.markWindowChanged(signature);
187
284
  this.pruneOwnedEntitiesAfterRemoval(signature, nextQueries);
188
285
  this.notify();
189
286
  });
@@ -198,6 +295,8 @@ export class LocalReplica {
198
295
  await this.persist(() => this.storage.clear(this.scopeValue));
199
296
  this.cursorValue = undefined;
200
297
  this.entities.clear();
298
+ for (const signature of this.liveQueries.keys())
299
+ this.markWindowChanged(signature);
201
300
  this.liveQueries.clear();
202
301
  this.windowOwned.clear();
203
302
  this.pendingCommands.clear();
@@ -231,7 +330,11 @@ export class LocalReplica {
231
330
  if (!id)
232
331
  continue;
233
332
  ids.push(id);
234
- entityRows.set(id, cloneRow(row));
333
+ // Different Replica Collections may project different columns from the
334
+ // same table. They all hydrate one normalized entity, so a narrow
335
+ // projection must update the fields it owns without erasing fields
336
+ // supplied by another collection.
337
+ entityRows.set(id, { ...(entityRows.get(id) ?? {}), ...cloneRow(row) });
235
338
  }
236
339
  const previous = nextQueries.get(input.signature);
237
340
  const window = {
@@ -263,10 +366,12 @@ export class LocalReplica {
263
366
  nextEntities.get(input.entity)?.delete(id);
264
367
  }
265
368
  this.trackWindowOwnership(window, input.rows, previous);
266
- let nextCursor = this.cursorValue;
267
- if (input.cursor && (!nextCursor || input.cursor.epoch !== nextCursor.epoch || input.cursor.revision > nextCursor.revision)) {
268
- nextCursor = { ...input.cursor };
269
- }
369
+ // A collection cursor proves only that collection's materialized rows.
370
+ // Advancing the connection-wide transaction floor to the newest single
371
+ // snapshot can discard an older, still-unapplied transaction for another
372
+ // collection. The only revision proven by snapshots alone is the minimum
373
+ // cursor shared by every materialized Replica window in the epoch.
374
+ const nextCursor = replicaTransactionFloor(this.cursorValue, nextQueries);
270
375
  const snapshot = snapshotFrom(nextCursor, nextEntities, nextQueries);
271
376
  const writeScope = this.scopeValue;
272
377
  if (this.storage?.replaceWindow) {
@@ -277,6 +382,7 @@ export class LocalReplica {
277
382
  }
278
383
  this.entities = nextEntities;
279
384
  this.liveQueries = nextQueries;
385
+ this.markWindowChanged(input.signature);
280
386
  this.pruneOwnedEntities(input.signature);
281
387
  this.cursorValue = nextCursor;
282
388
  if (input.source === "server")
@@ -294,18 +400,25 @@ export class LocalReplica {
294
400
  // A transaction is invisible until its storage write succeeds. Deep-clone
295
401
  // memberships because row deletion edits their ordered ID arrays.
296
402
  const nextQueries = new Map([...this.liveQueries.entries()].map(([signature, window]) => [signature, cloneWindow(window)]));
403
+ const changedWindows = new Set();
297
404
  if (this.cursorValue && this.cursorValue.epoch !== transaction.cursor.epoch) {
405
+ for (const signature of nextQueries.keys())
406
+ changedWindows.add(signature);
298
407
  nextEntities.clear();
299
408
  nextQueries.clear();
300
409
  this.windowOwned.clear();
301
410
  }
302
411
  for (const change of transaction.changes) {
412
+ for (const [signature, window] of nextQueries) {
413
+ if (window.entity === change.entity && window.ids.includes(change.id))
414
+ changedWindows.add(signature);
415
+ }
303
416
  const rows = nextEntities.get(change.entity) ?? new Map();
304
417
  nextEntities.set(change.entity, rows);
305
418
  if (change.operation === "delete") {
306
419
  rows.delete(change.id);
307
420
  for (const window of nextQueries.values()) {
308
- if (window.ids.includes(change.id)) {
421
+ if (window.entity === change.entity && window.ids.includes(change.id)) {
309
422
  window.ids = window.ids.filter((id) => id !== change.id);
310
423
  }
311
424
  }
@@ -315,6 +428,7 @@ export class LocalReplica {
315
428
  }
316
429
  for (const membership of transaction.memberships ?? []) {
317
430
  nextQueries.set(membership.signature, normalizeWindow(membership));
431
+ changedWindows.add(membership.signature);
318
432
  }
319
433
  const snapshot = snapshotFrom(transaction.cursor, nextEntities, nextQueries);
320
434
  const writeScope = this.scopeValue;
@@ -323,10 +437,15 @@ export class LocalReplica {
323
437
  // exactly once. No subscriber can observe a partial entity/query update.
324
438
  this.entities = nextEntities;
325
439
  this.liveQueries = nextQueries;
440
+ for (const signature of changedWindows)
441
+ this.markWindowChanged(signature);
326
442
  this.cursorValue = { ...transaction.cursor };
327
443
  this.freshnessValue = "current";
328
- if (transaction.originCommandId)
329
- this.pendingCommands.delete(transaction.originCommandId);
444
+ // A change-feed transaction carries normalized row changes, but not the
445
+ // per-subscription membership windows. Keep the optimistic command until
446
+ // the Reducer result supplies its committed revision; otherwise a newly
447
+ // created row can disappear from a complete Replica Collection between
448
+ // the transaction and its membership delta.
330
449
  this.reconcileCommands(false);
331
450
  this.notify();
332
451
  }
@@ -387,13 +506,14 @@ export class LocalReplica {
387
506
  if (!membership) {
388
507
  return { rows: [], ids: [], source: "cache", completeness: "partial", freshness: this.freshnessValue };
389
508
  }
390
- const rows = membership.ids
509
+ const ids = this.effectiveMembership(membership);
510
+ const rows = ids
391
511
  .map((id) => this.entity(membership.entity, id))
392
512
  .filter((row) => row !== undefined);
393
513
  const metadata = windowResultMetadata(membership.resultSkeleton, membership.resultPath);
394
514
  return {
395
515
  rows,
396
- ids: [...membership.ids],
516
+ ids,
397
517
  ...metadata,
398
518
  source: this.freshnessValue === "current" ? membership.source : "cache",
399
519
  completeness: membership.completeness,
@@ -424,6 +544,7 @@ export class LocalReplica {
424
544
  for (const [commandId, command] of this.pendingCommands) {
425
545
  if (command.committedRevision && revision >= command.committedRevision) {
426
546
  this.pendingCommands.delete(commandId);
547
+ this.markWindowsForPatches(command.patches);
427
548
  changed = true;
428
549
  }
429
550
  }
@@ -440,6 +561,72 @@ export class LocalReplica {
440
561
  for (const listener of [...this.listeners])
441
562
  listener();
442
563
  }
564
+ markWindowChanged(signature) {
565
+ this.windowVersionClock += 1;
566
+ this.windowVersions.set(signature, this.windowVersionClock);
567
+ }
568
+ markWindowsForPatches(patches) {
569
+ const affected = new Set();
570
+ for (const patch of patches) {
571
+ const entity = patch.entity ?? patch.collection;
572
+ for (const [signature, window] of this.liveQueries) {
573
+ if (window.entity !== entity)
574
+ continue;
575
+ const currentIDs = this.effectiveMembership(window);
576
+ if (window.ids.includes(patch.rowId) || currentIDs.includes(patch.rowId)) {
577
+ affected.add(signature);
578
+ continue;
579
+ }
580
+ // A complete Replica Collection can gain a new ID only when its
581
+ // generated membership plan is available. Partial windows and Live
582
+ // Queries intentionally retain their committed membership.
583
+ if (window.kind === "replica" && window.completeness === "complete" && window.truncated !== true
584
+ && this.replicaPlans.has(signature))
585
+ affected.add(signature);
586
+ }
587
+ }
588
+ for (const signature of affected)
589
+ this.markWindowChanged(signature);
590
+ }
591
+ /**
592
+ * Apply optimistic membership transiently. The persisted window.ids remain
593
+ * the committed server membership, so rejection and reconciliation are
594
+ * reversible and never write optimistic IDs to storage.
595
+ */
596
+ effectiveMembership(window) {
597
+ const plan = this.replicaPlans.get(window.signature);
598
+ const patches = [...this.pendingCommands.values()]
599
+ .flatMap((command) => command.patches)
600
+ .filter((patch) => (patch.entity ?? patch.collection) === window.entity);
601
+ if (window.kind !== "replica"
602
+ || window.completeness !== "complete"
603
+ || window.truncated === true
604
+ || !plan
605
+ || plan.definition.table !== window.entity
606
+ || plan.definition.key !== window.key
607
+ || patches.length === 0)
608
+ return [...window.ids];
609
+ const ids = new Set(window.ids);
610
+ const touched = new Set(patches.map((patch) => patch.rowId));
611
+ for (const id of touched) {
612
+ const row = this.entity(window.entity, id);
613
+ if (row && replicaRowMatchesPlan(row, plan.definition, plan.args))
614
+ ids.add(id);
615
+ else
616
+ ids.delete(id);
617
+ }
618
+ const effectiveIDs = [...ids];
619
+ const membershipChanged = ids.size !== window.ids.length || window.ids.some((id) => !ids.has(id));
620
+ if (!membershipChanged && !plan.definition.orderBy)
621
+ return [...window.ids];
622
+ const committed = new Set(window.ids);
623
+ const additions = [...ids].filter((id) => !committed.has(id));
624
+ const retained = window.ids.filter((id) => ids.has(id));
625
+ const orderBy = plan.definition.orderBy;
626
+ if (!orderBy)
627
+ return [...retained, ...additions.sort(compareReplicaKeys)];
628
+ return effectiveIDs.sort((left, right) => compareReplicaMembershipRows(this.entity(window.entity, left), this.entity(window.entity, right), window.key, orderBy, plan.definition.orderDirection));
629
+ }
443
630
  trackWindowOwnership(window, rows, previous) {
444
631
  const owned = this.windowOwned.get(window.signature) ?? new Map();
445
632
  const oldIDs = new Set(previous?.ids ?? []);
@@ -488,6 +675,40 @@ export class LocalReplica {
488
675
  this.windowOwned.delete(signature);
489
676
  }
490
677
  }
678
+ function replicaRowMatchesPlan(row, definition, args) {
679
+ // The module manifest encodes equalFilters as argument name -> row column
680
+ // (for example `{ id: "_id" }`). Keep this aligned with artifact parsing.
681
+ for (const [argument, column] of Object.entries(definition.equalFilters ?? {})) {
682
+ if (!Object.prototype.hasOwnProperty.call(row, column)
683
+ || !Object.prototype.hasOwnProperty.call(args, argument)
684
+ || row[column] !== args[argument])
685
+ return false;
686
+ }
687
+ for (const column of definition.excludeWhenSet ?? []) {
688
+ if (row[column] !== null && row[column] !== undefined)
689
+ return false;
690
+ }
691
+ return true;
692
+ }
693
+ function compareReplicaKeys(left, right) {
694
+ return left < right ? -1 : left > right ? 1 : 0;
695
+ }
696
+ function compareReplicaMembershipRows(left, right, key, orderBy, orderDirection) {
697
+ const leftValue = replicaOrderValue(left?.[orderBy]);
698
+ const rightValue = replicaOrderValue(right?.[orderBy]);
699
+ if (leftValue === null && rightValue !== null)
700
+ return 1;
701
+ if (leftValue !== null && rightValue === null)
702
+ return -1;
703
+ if (leftValue !== null && rightValue !== null && leftValue !== rightValue) {
704
+ const direction = orderDirection === "asc" ? 1 : -1;
705
+ return leftValue < rightValue ? -direction : direction;
706
+ }
707
+ return compareReplicaKeys(String(left?.[key] ?? ""), String(right?.[key] ?? ""));
708
+ }
709
+ function replicaOrderValue(value) {
710
+ return typeof value === "string" || typeof value === "number" ? value : null;
711
+ }
491
712
  export class MemoryLocalReplicaStorage {
492
713
  values = new Map();
493
714
  async load(scope = defaultReplicaScope) {
@@ -497,6 +718,17 @@ export class MemoryLocalReplicaStorage {
497
718
  async applyTransaction(_transaction, snapshot, scope = defaultReplicaScope) {
498
719
  this.values.set(normalizeReplicaScope(scope), cloneSnapshot(snapshot));
499
720
  }
721
+ async advanceWatermark(windows, cursor, scope = defaultReplicaScope) {
722
+ const normalizedScope = normalizeReplicaScope(scope);
723
+ const existing = this.values.get(normalizedScope);
724
+ if (!existing)
725
+ return;
726
+ const snapshot = cloneSnapshot(existing);
727
+ for (const window of windows)
728
+ snapshot.liveQueries[window.signature] = cloneWindow(window);
729
+ snapshot.cursor = cursor ? { ...cursor } : undefined;
730
+ this.values.set(normalizedScope, snapshot);
731
+ }
500
732
  async replaceSnapshot(snapshot, scope = defaultReplicaScope) {
501
733
  this.values.set(normalizeReplicaScope(scope), cloneSnapshot(snapshot));
502
734
  }
@@ -566,6 +798,41 @@ function normalizeWindow(value) {
566
798
  };
567
799
  }
568
800
  function cloneWindow(value) { return normalizeWindow(value); }
801
+ function replicaTransactionFloor(current, windows) {
802
+ const cursors = [...windows.values()]
803
+ .filter((window) => window.kind === "replica" && window.cursor !== undefined)
804
+ .map((window) => window.cursor);
805
+ if (cursors.length === 0)
806
+ return current ? { ...current } : undefined;
807
+ const epoch = cursors[0].epoch;
808
+ if (cursors.some((cursor) => cursor.epoch !== epoch)) {
809
+ // Epoch replacement is reconciled by materializeWindowNow. Until every
810
+ // retained window agrees, snapshots cannot prove a global transaction
811
+ // floor.
812
+ return current?.epoch === epoch ? { ...current } : undefined;
813
+ }
814
+ const provenRevision = Math.min(...cursors.map((cursor) => cursor.revision));
815
+ if (current?.epoch === epoch && current.revision >= provenRevision)
816
+ return { ...current };
817
+ return { epoch, revision: provenRevision };
818
+ }
819
+ function hydratedTransactionFloor(persisted, windows) {
820
+ const cursors = [...windows.values()]
821
+ .filter((window) => window.kind === "replica" && window.cursor !== undefined)
822
+ .map((window) => window.cursor);
823
+ if (cursors.length === 0)
824
+ return persisted ? { ...persisted } : undefined;
825
+ const epoch = cursors[0].epoch;
826
+ if (cursors.some((cursor) => cursor.epoch !== epoch))
827
+ return undefined;
828
+ const provenRevision = Math.min(...cursors.map((cursor) => cursor.revision));
829
+ if (persisted?.epoch !== epoch)
830
+ return { epoch, revision: provenRevision };
831
+ // Older clients persisted the maximum individual snapshot revision as the
832
+ // global cursor. Clamp it on hydration so upgrading cannot retain that
833
+ // unsafe floor across a browser restart.
834
+ return { epoch, revision: Math.min(persisted.revision, provenRevision) };
835
+ }
569
836
  function cloneEntities(source) {
570
837
  return new Map([...source].map(([entity, rows]) => [entity, new Map([...rows].map(([id, row]) => [id, cloneRow(row)]))]));
571
838
  }