@quereus/sync-client 4.6.0 → 4.8.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.
package/README.md CHANGED
@@ -11,6 +11,7 @@ WebSocket sync client for [Quereus](https://github.com/gotchoices/quereus). Hand
11
11
  - **Automatic reconnection**: Exponential backoff (1s → 60s max) on connection loss
12
12
  - **Local change batching**: Debounces rapid changes into efficient batches
13
13
  - **Delta sync**: Only sends changes since last successful sync
14
+ - **Snapshot bootstrap**: A new (empty) device downloads a full copy of the database, with progress reporting and automatic resume of an interrupted transfer
14
15
  - **Framework agnostic**: Works in any JavaScript environment with WebSocket support
15
16
  - **Type-safe**: Full TypeScript support
16
17
 
@@ -91,6 +92,15 @@ interface SyncClientOptions {
91
92
 
92
93
  /** Debounce window for local changes in ms (default: 50) */
93
94
  localChangeDebounceMs?: number;
95
+
96
+ /** Auto-download a full snapshot on first connect to an empty replica (default: true) */
97
+ bootstrapOnEmpty?: boolean;
98
+
99
+ /** Snapshot stall watchdog: abort if no chunk arrives within this window in ms (default: 60000) */
100
+ snapshotChunkTimeoutMs?: number;
101
+
102
+ /** Fine-grained snapshot transfer progress */
103
+ onSnapshotProgress?: (progress: SnapshotProgress) => void;
94
104
  }
95
105
  ```
96
106
 
@@ -98,9 +108,12 @@ interface SyncClientOptions {
98
108
 
99
109
  - `connect(url: string, databaseId: string, token?: string): Promise<void>` - Connect to sync server
100
110
  - `disconnect(): Promise<void>` - Disconnect and stop reconnection attempts
111
+ - `requestSnapshot(): Promise<void>` - Explicitly download a full snapshot. **Do not write to the database while it is landing** — a concurrent local write is overwritten by the snapshot and never pushed
112
+ - `hasPendingSnapshot(): Promise<boolean>` - Whether an interrupted snapshot left the local database partial (usable before connecting; the next connect resumes the transfer)
101
113
  - `status: SyncStatus` - Current connection status (getter property)
102
114
  - `isConnected: boolean` - Whether the WebSocket is open (getter property)
103
115
  - `isSynced: boolean` - Whether the client is fully synced (getter property)
116
+ - `isBootstrapping: boolean` - Whether a snapshot transfer is in flight (getter property)
104
117
 
105
118
  ### Serialization Helpers
106
119
 
@@ -127,6 +140,7 @@ DISCONNECTED → CONNECTING → SYNCING → SYNCED
127
140
 
128
141
  - `disconnected`: Not connected
129
142
  - `connecting`: WebSocket connecting, handshake in progress
143
+ - `bootstrapping`: A full snapshot is streaming in — the local database is partial; hold writes until it finishes
130
144
  - `syncing`: Connected, exchanging initial changes
131
145
  - `synced`: Fully synchronized, real-time updates active
132
146
  - `error`: Connection error (will auto-reconnect if enabled)
@@ -144,6 +158,10 @@ The client implements the Quereus sync WebSocket protocol:
144
158
  | `apply_changes` | Client→Server | Send local changes |
145
159
  | `apply_result` | Server→Client | Confirm changes applied |
146
160
  | `push_changes` | Server→Client | Real-time changes from other clients |
161
+ | `get_snapshot` | Client→Server | Request a full snapshot stream |
162
+ | `resume_snapshot` | Client→Server | Resume an interrupted snapshot from a checkpoint |
163
+ | `snapshot_chunk` | Server→Client | One streamed snapshot chunk |
164
+ | `snapshot_complete` | Server→Client | Snapshot stream finished |
147
165
  | `ping`/`pong` | Both | Keepalive |
148
166
 
149
167
  ## Related Packages
@@ -26,6 +26,7 @@
26
26
  * @packageDocumentation
27
27
  */
28
28
  export { SyncClient } from './sync-client.js';
29
+ export { SnapshotStreamReader } from './snapshot-reader.js';
29
30
  export { serializeChangeSet, deserializeChangeSet, serializeHLCForTransport, deserializeHLCFromTransport, } from '@quereus/sync';
30
31
  export type { SerializedChangeSet, SerializedChange, SerializedSchemaMigration, ClientMessage, ServerMessage, HandshakeMessage, HandshakeAckMessage, GetChangesMessage, ChangesMessage, PushChangesMessage, ApplyChangesMessage, ApplyResultMessage, GetSnapshotMessage, PingMessage, PongMessage, ErrorMessage, } from '@quereus/sync';
31
32
  export type { SyncStatus, SyncEvent, SyncEventType, SyncClientOptions, } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAK9C,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,yBAAyB,EAEzB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAK5D,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,yBAAyB,EAEzB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
package/dist/src/index.js CHANGED
@@ -26,6 +26,7 @@
26
26
  * @packageDocumentation
27
27
  */
28
28
  export { SyncClient } from './sync-client.js';
29
+ export { SnapshotStreamReader } from './snapshot-reader.js';
29
30
  // The wire codec and message/Serialized types now live in @quereus/sync (the
30
31
  // single source of truth shared with the coordinator). Re-export them here so the
31
32
  // client's public API is unchanged for existing consumers.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,6EAA6E;AAC7E,kFAAkF;AAClF,2DAA2D;AAC3D,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,6EAA6E;AAC7E,kFAAkF;AAClF,2DAA2D;AAC3D,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,eAAe,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * SnapshotStreamReader - push-to-pull adapter for a streamed snapshot transfer.
3
+ *
4
+ * `SyncManager.applySnapshotStream` consumes an `AsyncIterable<SnapshotChunk>`;
5
+ * the WebSocket delivers `snapshot_chunk` messages as callbacks. This class
6
+ * bridges the two: the socket callback `push`es serialized chunks into a queue,
7
+ * and `chunks()` yields them (deserialized) to the apply loop, parking when the
8
+ * queue runs dry and waking on the next push/complete/abort.
9
+ */
10
+ import { type HLC, type SerializedSnapshotChunk, type SnapshotChunk } from '@quereus/sync';
11
+ export declare class SnapshotStreamReader {
12
+ private queue;
13
+ private head;
14
+ private completed;
15
+ private error;
16
+ private wake;
17
+ private highWaterWarned;
18
+ private iterating;
19
+ private _headerHLC;
20
+ /**
21
+ * Enqueue one chunk. Synchronous and safe to call from the socket callback
22
+ * with no await — chunk order is preserved exactly because nothing between
23
+ * the socket event and this call can interleave.
24
+ *
25
+ * Deserialization is deferred to `chunks()` so this stays cheap on the
26
+ * socket's event path. Chunks pushed after `complete()`/`abort()` are
27
+ * dropped: a late message from a dead stream must never leak into the queue.
28
+ */
29
+ push(chunk: SerializedSnapshotChunk): void;
30
+ /** No more chunks: the iterator ends after draining the queue. */
31
+ complete(): void;
32
+ /** Fail the transfer: the iterator throws `error` after draining what it has. */
33
+ abort(error: Error): void;
34
+ /** The header chunk's HLC, once the header has been consumed via `chunks()`. */
35
+ get headerHLC(): HLC | undefined;
36
+ /** Number of chunks enqueued but not yet consumed. */
37
+ get queueDepth(): number;
38
+ /**
39
+ * The chunk stream. Single-consumer: one transfer, one apply loop.
40
+ *
41
+ * Drains the queue first, then checks abort, then complete, then parks on a
42
+ * promise the next push/complete/abort resolves — so an abort still yields
43
+ * everything received before it, then throws.
44
+ */
45
+ chunks(): AsyncIterable<SnapshotChunk>;
46
+ /** Reset or compact the backing array so consumed entries don't accumulate. */
47
+ private compact;
48
+ /** Wake a parked iterator, if any. */
49
+ private notify;
50
+ }
51
+ //# sourceMappingURL=snapshot-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-reader.d.ts","sourceRoot":"","sources":["../../src/snapshot-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAoBvB,qBAAa,oBAAoB;IAG/B,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,IAAI,CAAK;IAEjB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,IAAI,CAA6B;IACzC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,UAAU,CAAkB;IAEpC;;;;;;;;OAQG;IACH,IAAI,CAAC,KAAK,EAAE,uBAAuB,GAAG,IAAI;IAa1C,kEAAkE;IAClE,QAAQ,IAAI,IAAI;IAMhB,iFAAiF;IACjF,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAMzB,gFAAgF;IAChF,IAAI,SAAS,IAAI,GAAG,GAAG,SAAS,CAE/B;IAED,sDAAsD;IACtD,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;;;;OAMG;IACI,MAAM,IAAI,aAAa,CAAC,aAAa,CAAC;IA0B7C,+EAA+E;IAC/E,OAAO,CAAC,OAAO;IAUf,sCAAsC;IACtC,OAAO,CAAC,MAAM;CAKf"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * SnapshotStreamReader - push-to-pull adapter for a streamed snapshot transfer.
3
+ *
4
+ * `SyncManager.applySnapshotStream` consumes an `AsyncIterable<SnapshotChunk>`;
5
+ * the WebSocket delivers `snapshot_chunk` messages as callbacks. This class
6
+ * bridges the two: the socket callback `push`es serialized chunks into a queue,
7
+ * and `chunks()` yields them (deserialized) to the apply loop, parking when the
8
+ * queue runs dry and waking on the next push/complete/abort.
9
+ */
10
+ import { deserializeSnapshotChunk, } from '@quereus/sync';
11
+ /**
12
+ * Queue depth above which a warning is logged once per transfer. Nothing paces
13
+ * the sender, so a client applying slower than the server streams buffers the
14
+ * backlog here.
15
+ * NOTE: no flow control on this queue — a slow client buffers the whole
16
+ * snapshot in memory. Mirror of the server-side concern tracked as
17
+ * `backlog/debt-sync-socket-backpressure`; if the warning ever fires in
18
+ * practice, that ticket is where pacing belongs.
19
+ */
20
+ const QUEUE_HIGH_WATER_MARK = 5_000;
21
+ /**
22
+ * Dead entries tolerated at the front of the backing array before it is
23
+ * compacted. Keeps memory bounded when the consumer trails the producer for a
24
+ * long stream without paying a copy per chunk.
25
+ */
26
+ const COMPACT_THRESHOLD = 1_024;
27
+ export class SnapshotStreamReader {
28
+ // Consumed with a head index rather than Array.prototype.shift(): a snapshot
29
+ // can queue thousands of chunks and repeated shift() is quadratic.
30
+ queue = [];
31
+ head = 0;
32
+ completed = false;
33
+ error = null;
34
+ wake = null;
35
+ highWaterWarned = false;
36
+ iterating = false;
37
+ _headerHLC;
38
+ /**
39
+ * Enqueue one chunk. Synchronous and safe to call from the socket callback
40
+ * with no await — chunk order is preserved exactly because nothing between
41
+ * the socket event and this call can interleave.
42
+ *
43
+ * Deserialization is deferred to `chunks()` so this stays cheap on the
44
+ * socket's event path. Chunks pushed after `complete()`/`abort()` are
45
+ * dropped: a late message from a dead stream must never leak into the queue.
46
+ */
47
+ push(chunk) {
48
+ if (this.completed || this.error)
49
+ return;
50
+ this.queue.push(chunk);
51
+ if (!this.highWaterWarned && this.queueDepth > QUEUE_HIGH_WATER_MARK) {
52
+ this.highWaterWarned = true;
53
+ console.warn(`Snapshot chunk queue exceeded ${QUEUE_HIGH_WATER_MARK} entries; ` +
54
+ 'the local apply is trailing the server stream and the backlog is buffered in memory');
55
+ }
56
+ this.notify();
57
+ }
58
+ /** No more chunks: the iterator ends after draining the queue. */
59
+ complete() {
60
+ if (this.completed || this.error)
61
+ return;
62
+ this.completed = true;
63
+ this.notify();
64
+ }
65
+ /** Fail the transfer: the iterator throws `error` after draining what it has. */
66
+ abort(error) {
67
+ if (this.completed || this.error)
68
+ return;
69
+ this.error = error;
70
+ this.notify();
71
+ }
72
+ /** The header chunk's HLC, once the header has been consumed via `chunks()`. */
73
+ get headerHLC() {
74
+ return this._headerHLC;
75
+ }
76
+ /** Number of chunks enqueued but not yet consumed. */
77
+ get queueDepth() {
78
+ return this.queue.length - this.head;
79
+ }
80
+ /**
81
+ * The chunk stream. Single-consumer: one transfer, one apply loop.
82
+ *
83
+ * Drains the queue first, then checks abort, then complete, then parks on a
84
+ * promise the next push/complete/abort resolves — so an abort still yields
85
+ * everything received before it, then throws.
86
+ */
87
+ async *chunks() {
88
+ if (this.iterating) {
89
+ throw new Error('SnapshotStreamReader.chunks() supports a single consumer');
90
+ }
91
+ this.iterating = true;
92
+ for (;;) {
93
+ while (this.head < this.queue.length) {
94
+ const serialized = this.queue[this.head++];
95
+ this.compact();
96
+ const chunk = deserializeSnapshotChunk(serialized);
97
+ if (chunk.type === 'header') {
98
+ this._headerHLC = chunk.hlc;
99
+ }
100
+ yield chunk;
101
+ }
102
+ // Re-checked after every wake: an abort during the park (or during a
103
+ // consumer await between yields) lands here once the queue is dry.
104
+ if (this.error)
105
+ throw this.error;
106
+ if (this.completed)
107
+ return;
108
+ await new Promise(resolve => {
109
+ this.wake = resolve;
110
+ });
111
+ }
112
+ }
113
+ /** Reset or compact the backing array so consumed entries don't accumulate. */
114
+ compact() {
115
+ if (this.head === this.queue.length) {
116
+ this.queue.length = 0;
117
+ this.head = 0;
118
+ }
119
+ else if (this.head >= COMPACT_THRESHOLD) {
120
+ this.queue = this.queue.slice(this.head);
121
+ this.head = 0;
122
+ }
123
+ }
124
+ /** Wake a parked iterator, if any. */
125
+ notify() {
126
+ const wake = this.wake;
127
+ this.wake = null;
128
+ wake?.();
129
+ }
130
+ }
131
+ //# sourceMappingURL=snapshot-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-reader.js","sourceRoot":"","sources":["../../src/snapshot-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,wBAAwB,GAIzB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAEpC;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC,MAAM,OAAO,oBAAoB;IAC/B,6EAA6E;IAC7E,mEAAmE;IAC3D,KAAK,GAA8B,EAAE,CAAC;IACtC,IAAI,GAAG,CAAC,CAAC;IAET,SAAS,GAAG,KAAK,CAAC;IAClB,KAAK,GAAiB,I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AAC;IAED,sCAAsC;IAC9B,MAAM;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,EAAE,EAAE,CAAC;IACX,CAAC;CACF"}
@@ -42,6 +42,11 @@ export declare class SyncClient {
42
42
  private debounceTimer;
43
43
  private pendingLocalChangeCount;
44
44
  private localChangeUnsubscribe;
45
+ private activeSnapshotReader;
46
+ private snapshotTransferPromise;
47
+ private snapshotStallTimer;
48
+ private snapshotEventTablesProcessed;
49
+ private droppedChunkWarned;
45
50
  private _connectResolve;
46
51
  private _connectReject;
47
52
  constructor(options: SyncClientOptions);
@@ -51,6 +56,20 @@ export declare class SyncClient {
51
56
  get isConnected(): boolean;
52
57
  /** Whether the client is fully synced */
53
58
  get isSynced(): boolean;
59
+ /**
60
+ * Whether a snapshot transfer (bootstrap or resume) is in flight. While true
61
+ * the local database is partial: incoming deltas are dropped (re-fetched by
62
+ * the post-bootstrap catch-up), local pushes are held, and the application
63
+ * should not write to the database.
64
+ */
65
+ get isBootstrapping(): boolean;
66
+ /**
67
+ * Whether the local store holds a pending snapshot checkpoint — i.e. a
68
+ * previous snapshot apply was interrupted and the database is PARTIAL.
69
+ * Usable before connecting (e.g. at app startup, to gate reads); the next
70
+ * connect resumes the transfer automatically.
71
+ */
72
+ hasPendingSnapshot(): Promise<boolean>;
54
73
  /**
55
74
  * Connect to a sync server.
56
75
  *
@@ -104,6 +123,83 @@ export declare class SyncClient {
104
123
  */
105
124
  private promoteWatermark;
106
125
  private handleRequestChanges;
126
+ /**
127
+ * Explicitly request a full snapshot of the database from the server.
128
+ *
129
+ * CONTRACT: do not write to the database while the snapshot is landing. The
130
+ * apply clears sync metadata and rewrites cell records unconditionally — a
131
+ * concurrent local write is silently overwritten and never pushed. Hold
132
+ * application writes until this resolves (watch {@link isBootstrapping} /
133
+ * the `bootstrapping` status).
134
+ *
135
+ * Idempotent while a transfer is in flight: a second call joins the same
136
+ * transfer instead of starting another stream. Rejects when not connected /
137
+ * handshaken, or when the transfer fails (the socket is then closed and the
138
+ * normal reconnect path resumes from the saved checkpoint).
139
+ */
140
+ requestSnapshot(): Promise<void>;
141
+ /**
142
+ * Decide, on handshake, whether to run a snapshot transfer before the
143
+ * incremental path: resume a pending checkpoint, bootstrap an empty replica,
144
+ * or neither.
145
+ *
146
+ * @returns false when a transfer failed — the socket has been closed and the
147
+ * caller must stop the handshake flow (reconnect resumes it).
148
+ */
149
+ private maybeBootstrap;
150
+ /**
151
+ * A replica is "empty" — safe to bootstrap wholesale — only when BOTH hold
152
+ * against the server learned at handshake:
153
+ *
154
+ * - no peer sync state (never synced with this server), and
155
+ * - no local change facts of our own.
156
+ *
157
+ * The first alone would also match a device holding real local data that is
158
+ * merely meeting this server for the first time — bootstrapping it would
159
+ * clear its sync metadata while leaving its rows in place (divergence). The
160
+ * second alone would match a device whose entire contents came from this
161
+ * server. Requiring both admits only the genuinely new device. A device that
162
+ * pre-created its schema locally still counts as empty: schema migration
163
+ * records are not consulted, and replicated DDL applies idempotently.
164
+ */
165
+ private isReplicaEmpty;
166
+ /**
167
+ * Run one snapshot transfer: send the request, stream chunks through the
168
+ * reader into `applySnapshotStream`, then write the peer watermark.
169
+ *
170
+ * Resolves to null on success or the failure Error — never rejects, so the
171
+ * automatic bootstrap path (which nobody awaits externally) cannot surface
172
+ * an unhandled rejection. On failure the socket is closed WITHOUT detaching
173
+ * handlers: onclose firing is the retry mechanism (status → disconnected,
174
+ * scheduleReconnect, and the next handshake finds the pending checkpoint and
175
+ * sends resume_snapshot). No lingering `error` status and no stopReconnect —
176
+ * a snapshot failure is transient by construction.
177
+ */
178
+ private runSnapshotTransfer;
179
+ /** The transfer body itself; state setup/teardown belongs to {@link runSnapshotTransfer}. */
180
+ private executeSnapshotTransfer;
181
+ /** Route one snapshot_chunk to the active transfer. Synchronous — see the dispatch comment. */
182
+ private handleSnapshotChunk;
183
+ /** End the active transfer's stream (no-op when none). */
184
+ private handleSnapshotComplete;
185
+ /**
186
+ * Abort the in-flight transfer, if any. The reader throws into
187
+ * `applySnapshotStream`, which lands in the transfer's failure path.
188
+ */
189
+ private abortSnapshotTransfer;
190
+ /**
191
+ * Stall watchdog: a server that stops sending mid-stream without closing the
192
+ * socket would otherwise hang the bootstrap forever with no reconnect. Reset
193
+ * on every chunk; cleared on complete and when the transfer settles.
194
+ */
195
+ private resetSnapshotStallTimer;
196
+ private clearSnapshotStallTimer;
197
+ /**
198
+ * Forward apply progress: every tick to `onSnapshotProgress` and the status,
199
+ * but a human-readable sync event only when `tablesProcessed` changes —
200
+ * progress fires once per column-versions chunk and would flood an event log.
201
+ */
202
+ private reportSnapshotProgress;
107
203
  private sendHandshake;
108
204
  private requestChangesFromServer;
109
205
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sync-client.d.ts","sourceRoot":"","sources":["../../src/sync-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoBH,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EAEX,MAAM,YAAY,CAAC;AAOpB;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAC9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAED;IAGvB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,YAAY,CAAuB;IAG3C,OAAO,CAAC,OAAO,CAA0C;IACzD,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,eAAe,CAAiC;IAGxD,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,cAAc,CAA8C;IAGpE,OAAO,CAAC,qBAAqB,CAAS;IAItC,OAAO,CAAC,aAAa,CAAS;IAE9B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAItC;IAUH,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OASG;YACW,iBAAiB;IAQ/B;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI;IAkBZ,8EAA8E;IAC9E,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,uBAAuB;IAa/B,OAAO,CAAC,wBAAwB;YASlB,gBAAgB;IA8C9B,8EAA8E;IAC9E,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,aAAa;CAatB"}
@@ -8,11 +8,13 @@
8
8
  * - Local change debouncing
9
9
  * - Delta sync tracking (lastSentHLC + per-request pending watermarks)
10
10
  */
11
- import { siteIdToBase64, siteIdFromBase64, maxHLC, compareHLC, serializeChangeSet, deserializeChangeSet, serializeHLCForTransport, deserializeHLCFromTransport, PROTOCOL_VERSION, } from '@quereus/sync';
11
+ import { siteIdToBase64, siteIdFromBase64, maxHLC, compareHLC, serializeChangeSet, deserializeChangeSet, serializeHLCForTransport, deserializeHLCFromTransport, serializeSnapshotCheckpoint, PROTOCOL_VERSION, } from '@quereus/sync';
12
+ import { SnapshotStreamReader } from './snapshot-reader.js';
12
13
  // Default configuration values
13
14
  const DEFAULT_RECONNECT_DELAY_MS = 1000;
14
15
  const DEFAULT_MAX_RECONNECT_DELAY_MS = 60_000;
15
16
  const DEFAULT_LOCAL_CHANGE_DEBOUNCE_MS = 50;
17
+ const DEFAULT_SNAPSHOT_CHUNK_TIMEOUT_MS = 60_000;
16
18
  /**
17
19
  * WebSocket sync client for Quereus.
18
20
  *
@@ -77,6 +79,22 @@ export class SyncClient {
77
79
  pendingLocalChangeCount = 0;
78
80
  // Local change listener cleanup
79
81
  localChangeUnsubscribe = null;
82
+ // Snapshot bootstrap state. `activeSnapshotReader` routes incoming
83
+ // snapshot_chunk messages; `snapshotTransferPromise` is the whole in-flight
84
+ // transfer (request → stream → apply → watermark), resolving to the failure
85
+ // Error or null on success — it never rejects, so an unobserved automatic
86
+ // bootstrap can't surface an unhandled rejection. Both are null when no
87
+ // transfer is active.
88
+ activeSnapshotReader = null;
89
+ snapshotTransferPromise = null;
90
+ snapshotStallTimer = null;
91
+ // Last tablesProcessed a sync event was emitted for — progress fires once per
92
+ // column-versions chunk and would flood an event log; events are throttled to
93
+ // table boundaries. -1 = none yet this transfer.
94
+ snapshotEventTablesProcessed = -1;
95
+ // One dropped-chunk warning per transfer gap, not one per chunk — an aborted
96
+ // stream can trail thousands of late chunks.
97
+ droppedChunkWarned = false;
80
98
  // Pending connect() promise settlement — allows handshake_ack / server error
81
99
  // to resolve or reject the promise returned by connect().
82
100
  _connectResolve = null;
@@ -90,6 +108,8 @@ export class SyncClient {
90
108
  reconnectDelayMs: options.reconnectDelayMs ?? DEFAULT_RECONNECT_DELAY_MS,
91
109
  maxReconnectDelayMs: options.maxReconnectDelayMs ?? DEFAULT_MAX_RECONNECT_DELAY_MS,
92
110
  localChangeDebounceMs: options.localChangeDebounceMs ?? DEFAULT_LOCAL_CHANGE_DEBOUNCE_MS,
111
+ bootstrapOnEmpty: options.bootstrapOnEmpty ?? true,
112
+ snapshotChunkTimeoutMs: options.snapshotChunkTimeoutMs ?? DEFAULT_SNAPSHOT_CHUNK_TIMEOUT_MS,
93
113
  };
94
114
  }
95
115
  /** Current connection status */
@@ -104,6 +124,25 @@ export class SyncClient {
104
124
  get isSynced() {
105
125
  return this._status.status === 'synced';
106
126
  }
127
+ /**
128
+ * Whether a snapshot transfer (bootstrap or resume) is in flight. While true
129
+ * the local database is partial: incoming deltas are dropped (re-fetched by
130
+ * the post-bootstrap catch-up), local pushes are held, and the application
131
+ * should not write to the database.
132
+ */
133
+ get isBootstrapping() {
134
+ return this.snapshotTransferPromise !== null;
135
+ }
136
+ /**
137
+ * Whether the local store holds a pending snapshot checkpoint — i.e. a
138
+ * previous snapshot apply was interrupted and the database is PARTIAL.
139
+ * Usable before connecting (e.g. at app startup, to gate reads); the next
140
+ * connect resumes the transfer automatically.
141
+ */
142
+ async hasPendingSnapshot() {
143
+ const checkpoints = await this.syncManager.listSnapshotCheckpoints();
144
+ return checkpoints.length > 0;
145
+ }
107
146
  /**
108
147
  * Connect to a sync server.
109
148
  *
@@ -146,6 +185,9 @@ export class SyncClient {
146
185
  // Don't resolve yet — wait for handshake_ack (or server error).
147
186
  };
148
187
  this.ws.onclose = () => {
188
+ // A transfer interrupted by a socket drop aborts here; the saved
189
+ // checkpoint makes the reconnect below resume it via resume_snapshot.
190
+ this.abortSnapshotTransfer(new Error('Connection closed during snapshot transfer'));
149
191
  const wasError = this._status.status === 'error';
150
192
  if (!wasError) {
151
193
  this.setStatus({ status: 'disconnected' });
@@ -195,6 +237,10 @@ export class SyncClient {
195
237
  */
196
238
  async disconnect() {
197
239
  this.intentionalDisconnect = true;
240
+ // Abort any in-flight snapshot transfer. Its promise settles (resolved with
241
+ // the abort error — it never rejects), and the checkpoint saved by the
242
+ // interrupted apply lets a later connect resume.
243
+ this.abortSnapshotTransfer(new Error('Disconnected'));
198
244
  // Reject any pending connect() promise
199
245
  this.settleConnect(new Error('Disconnected'));
200
246
  // Clear timers
@@ -247,6 +293,17 @@ export class SyncClient {
247
293
  case 'apply_result':
248
294
  await this.handleApplyResult(message);
249
295
  break;
296
+ case 'snapshot_chunk':
297
+ // MUST stay synchronous: handleMessage is invoked from ws.onmessage
298
+ // without serialization, so two messages can be in-flight through it at
299
+ // once and anything after an `await` may interleave. Reaching push()
300
+ // with no intervening await is what preserves chunk order — the whole
301
+ // transfer's correctness rests on it.
302
+ this.handleSnapshotChunk(message);
303
+ break;
304
+ case 'snapshot_complete':
305
+ this.handleSnapshotComplete();
306
+ break;
250
307
  case 'error':
251
308
  this.handleServerError(message);
252
309
  break;
@@ -281,6 +338,13 @@ export class SyncClient {
281
338
  // Trust the server's `fatal` flag when present; fall back to the known
282
339
  // fatal-code set for coordinators that predate it.
283
340
  const fatal = message.fatal ?? SyncClient.FATAL_ERROR_CODES.has(message.code);
341
+ // A snapshot-stream failure (or any fatal error) kills the transfer. For
342
+ // SNAPSHOT_ERROR the failure path closes the socket and the reconnect
343
+ // resumes from the checkpoint; for a fatal error the stopReconnect set
344
+ // below wins — no reconnect, no resume.
345
+ if (fatal || message.code === 'SNAPSHOT_ERROR') {
346
+ this.abortSnapshotTransfer(new Error(`Server error during snapshot: ${message.message}`));
347
+ }
284
348
  if (fatal) {
285
349
  // Unrecoverable — a bare reconnect would just fail again. Stop reconnect
286
350
  // and settle any pending connect(). Note: NOT intentionalDisconnect,
@@ -327,6 +391,14 @@ export class SyncClient {
327
391
  this.emitSyncEvent('state-change', `Authenticated with server (connection: ${message.connectionId?.slice(0, 8) ?? 'unknown'})`);
328
392
  // Handshake accepted — resolve the connect() promise.
329
393
  this.settleConnect();
394
+ // Bootstrap is decided and FINISHED before the incremental path starts, so
395
+ // the post-snapshot get_changes below carries the snapshot's HLC and the
396
+ // local-change subscription never sees a partial database. A failed
397
+ // transfer has already closed the socket — stop here and let the reconnect
398
+ // (which finds the saved checkpoint) resume it.
399
+ const bootstrapOk = await this.maybeBootstrap();
400
+ if (!bootstrapOk)
401
+ return;
330
402
  // Request changes from server since our last sync with this peer
331
403
  await this.requestChangesFromServer();
332
404
  // Seed the sent watermark from durable per-peer state so a fresh process
@@ -352,6 +424,15 @@ export class SyncClient {
352
424
  * `get_changes sinceHLC=<watermark>`.
353
425
  */
354
426
  async handleChanges(serializedChangeSets, advanceWatermark) {
427
+ // While a snapshot is streaming, incoming deltas are DROPPED, not applied:
428
+ // applyChanges would interleave with the snapshot's clear-and-rewrite of
429
+ // the same cv:/tb:/cl: records. Nothing is lost — the watermark is not
430
+ // advanced here, so the get_changes catch-up that runs right after
431
+ // bootstrap re-fetches everything past the snapshot HLC.
432
+ if (this.isBootstrapping) {
433
+ this.emitSyncEvent('info', `Dropped ${serializedChangeSets.length} incoming change set(s) during snapshot bootstrap (re-fetched afterwards)`);
434
+ return;
435
+ }
355
436
  const changeSets = serializedChangeSets.map(cs => deserializeChangeSet(cs));
356
437
  const result = await this.syncManager.applyChanges(changeSets);
357
438
  // Advance peer sync state with the max HLC from received changes — but only
@@ -426,6 +507,9 @@ export class SyncClient {
426
507
  // Server is relaying a request for changes from another peer
427
508
  if (!message.siteId)
428
509
  return;
510
+ // No pushes while a snapshot is landing — local data is partial.
511
+ if (this.isBootstrapping)
512
+ return;
429
513
  const peerSiteId = siteIdFromBase64(message.siteId);
430
514
  const sinceHLC = message.sinceHLC ? deserializeHLCFromTransport(message.sinceHLC) : undefined;
431
515
  const changes = await this.syncManager.getChangesSince(peerSiteId, sinceHLC);
@@ -438,6 +522,287 @@ export class SyncClient {
438
522
  }
439
523
  }
440
524
  // ==========================================================================
525
+ // Snapshot bootstrap
526
+ // ==========================================================================
527
+ //
528
+ // NOTE: this file is ~1170 lines; this section is ~300 of them and is the
529
+ // natural extraction seam — it touches the rest of the client only through
530
+ // `send`, `setStatus`, `emitSyncEvent`, `syncManager` and `ws`. If the file
531
+ // grows much further, lift it into a `SnapshotBootstrap` collaborator that
532
+ // takes those five as its interface rather than splitting elsewhere.
533
+ /**
534
+ * Explicitly request a full snapshot of the database from the server.
535
+ *
536
+ * CONTRACT: do not write to the database while the snapshot is landing. The
537
+ * apply clears sync metadata and rewrites cell records unconditionally — a
538
+ * concurrent local write is silently overwritten and never pushed. Hold
539
+ * application writes until this resolves (watch {@link isBootstrapping} /
540
+ * the `bootstrapping` status).
541
+ *
542
+ * Idempotent while a transfer is in flight: a second call joins the same
543
+ * transfer instead of starting another stream. Rejects when not connected /
544
+ * handshaken, or when the transfer fails (the socket is then closed and the
545
+ * normal reconnect path resumes from the saved checkpoint).
546
+ */
547
+ async requestSnapshot() {
548
+ if (this.snapshotTransferPromise) {
549
+ const error = await this.snapshotTransferPromise;
550
+ if (error)
551
+ throw error;
552
+ return;
553
+ }
554
+ if (!this.isConnected || !this.serverSiteId) {
555
+ throw new Error('Cannot request a snapshot: not connected to a sync server');
556
+ }
557
+ const error = await this.runSnapshotTransfer({ type: 'get_snapshot' });
558
+ if (error)
559
+ throw error;
560
+ }
561
+ /**
562
+ * Decide, on handshake, whether to run a snapshot transfer before the
563
+ * incremental path: resume a pending checkpoint, bootstrap an empty replica,
564
+ * or neither.
565
+ *
566
+ * @returns false when a transfer failed — the socket has been closed and the
567
+ * caller must stop the handshake flow (reconnect resumes it).
568
+ */
569
+ async maybeBootstrap() {
570
+ // A transfer from the PREVIOUS socket can still be unwinding (its abort has
571
+ // to propagate through the apply). This handshake belongs to a new socket,
572
+ // so joining that dead transfer would report its failure as this
573
+ // connection's and stop the handshake with nothing scheduled to retry it.
574
+ // Wait for it to settle, then decide fresh off the checkpoint it left.
575
+ if (this.snapshotTransferPromise)
576
+ await this.snapshotTransferPromise;
577
+ // NOTE: checkpoints carry no server identity (the apply stamps the
578
+ // RECEIVER's site id into them), so a replica that syncs one database to
579
+ // two different coordinators would resume server A's checkpoint against
580
+ // server B — B skips the tables A already completed, silently. One
581
+ // coordinator per database today; key checkpoints by peer before that
582
+ // changes.
583
+ const pending = await this.syncManager.listSnapshotCheckpoints();
584
+ if (pending.length > 0) {
585
+ // A checkpoint means the database is PARTIAL: a prior apply cleared sync
586
+ // metadata and never reached its footer. Resume the newest; clear the
587
+ // rest — the client tracks one transfer, so they are unreachable and
588
+ // would otherwise accumulate forever.
589
+ const newest = pending.reduce((a, b) => (b.createdAt > a.createdAt ? b : a));
590
+ for (const checkpoint of pending) {
591
+ if (checkpoint.snapshotId !== newest.snapshotId) {
592
+ await this.syncManager.clearSnapshotCheckpoint(checkpoint.snapshotId);
593
+ }
594
+ }
595
+ this.emitSyncEvent('state-change', 'Resuming interrupted snapshot transfer');
596
+ const error = await this.runSnapshotTransfer({
597
+ type: 'resume_snapshot',
598
+ checkpoint: serializeSnapshotCheckpoint(newest),
599
+ });
600
+ return error === null;
601
+ }
602
+ if (this.options.bootstrapOnEmpty && await this.isReplicaEmpty()) {
603
+ this.emitSyncEvent('state-change', 'Empty replica: requesting full snapshot from server');
604
+ const error = await this.runSnapshotTransfer({ type: 'get_snapshot' });
605
+ return error === null;
606
+ }
607
+ return true;
608
+ }
609
+ /**
610
+ * A replica is "empty" — safe to bootstrap wholesale — only when BOTH hold
611
+ * against the server learned at handshake:
612
+ *
613
+ * - no peer sync state (never synced with this server), and
614
+ * - no local change facts of our own.
615
+ *
616
+ * The first alone would also match a device holding real local data that is
617
+ * merely meeting this server for the first time — bootstrapping it would
618
+ * clear its sync metadata while leaving its rows in place (divergence). The
619
+ * second alone would match a device whose entire contents came from this
620
+ * server. Requiring both admits only the genuinely new device. A device that
621
+ * pre-created its schema locally still counts as empty: schema migration
622
+ * records are not consulted, and replicated DDL applies idempotently.
623
+ */
624
+ async isReplicaEmpty() {
625
+ if (!this.serverSiteId)
626
+ return false;
627
+ const peerState = await this.syncManager.getPeerSyncState(this.serverSiteId);
628
+ if (peerState !== undefined)
629
+ return false;
630
+ // NOTE: this arm materializes every local change set when it runs. It runs
631
+ // only when no peer sync state exists — in practice once, on a device with
632
+ // nothing to materialize. If some future caller runs the probe on a
633
+ // populated replica, replace it with a cheap existence scan over the `cv:`
634
+ // prefix.
635
+ const localChanges = await this.syncManager.getChangesSince(this.serverSiteId);
636
+ return localChanges.length === 0;
637
+ }
638
+ /**
639
+ * Run one snapshot transfer: send the request, stream chunks through the
640
+ * reader into `applySnapshotStream`, then write the peer watermark.
641
+ *
642
+ * Resolves to null on success or the failure Error — never rejects, so the
643
+ * automatic bootstrap path (which nobody awaits externally) cannot surface
644
+ * an unhandled rejection. On failure the socket is closed WITHOUT detaching
645
+ * handlers: onclose firing is the retry mechanism (status → disconnected,
646
+ * scheduleReconnect, and the next handshake finds the pending checkpoint and
647
+ * sends resume_snapshot). No lingering `error` status and no stopReconnect —
648
+ * a snapshot failure is transient by construction.
649
+ */
650
+ runSnapshotTransfer(msg) {
651
+ if (this.snapshotTransferPromise) {
652
+ return this.snapshotTransferPromise;
653
+ }
654
+ // Cleanup rides on the returned promise rather than a `finally` INSIDE the
655
+ // transfer body: the body can settle synchronously (a send that fails
656
+ // before its first await), and an inner finally would then null the field
657
+ // before the assignment below ever set it — pinning isBootstrapping true
658
+ // for the life of the client. A .finally() callback always runs a microtask
659
+ // later, i.e. after the assignment.
660
+ const promise = this.executeSnapshotTransfer(msg).finally(() => {
661
+ this.clearSnapshotStallTimer();
662
+ this.activeSnapshotReader = null;
663
+ this.snapshotTransferPromise = null;
664
+ });
665
+ this.snapshotTransferPromise = promise;
666
+ return promise;
667
+ }
668
+ /** The transfer body itself; state setup/teardown belongs to {@link runSnapshotTransfer}. */
669
+ async executeSnapshotTransfer(msg) {
670
+ // The socket this transfer belongs to. A reconnect can replace `this.ws`
671
+ // while the apply unwinds, and the failure path below must not close the
672
+ // fresh socket in the dead one's name.
673
+ const socket = this.ws;
674
+ const reader = new SnapshotStreamReader();
675
+ this.activeSnapshotReader = reader;
676
+ this.snapshotEventTablesProcessed = -1;
677
+ this.droppedChunkWarned = false;
678
+ try {
679
+ this.setStatus({
680
+ status: 'bootstrapping',
681
+ tablesProcessed: 0, totalTables: 0,
682
+ entriesProcessed: 0, totalEntries: 0,
683
+ });
684
+ if (!this.send(msg)) {
685
+ // Socket died before the request left — abandon without starting the
686
+ // apply; the reconnect path retries.
687
+ throw new Error('Snapshot request could not be sent (socket not open)');
688
+ }
689
+ this.resetSnapshotStallTimer();
690
+ // NOTE: the apply returns only when the stream ENDS, and only
691
+ // snapshot_complete ends it — a socket drop between the footer and that
692
+ // message fails a transfer whose data already landed and whose
693
+ // checkpoint the footer already cleared, so the next connect
694
+ // re-bootstraps from scratch. Correct (idempotent), just wasteful; if it
695
+ // ever shows up in practice, end the stream on the footer instead.
696
+ await this.syncManager.applySnapshotStream(reader.chunks(), progress => this.reportSnapshotProgress(progress));
697
+ // The snapshot delivered everything up to its header HLC; record that
698
+ // as the received watermark so the follow-up get_changes asks for
699
+ // changes AFTER the snapshot point instead of replaying from nothing.
700
+ // (applySnapshotStream merges the HLC into the local clock but writes
701
+ // no peer state — the client owns that.) On a RESUMED transfer this is
702
+ // conservative: the header carries the original snapshot's HLC while
703
+ // the data served was read live, so the watermark is older than some
704
+ // applied data and the catch-up re-fetches a little. That is correct —
705
+ // re-application is idempotent — and cheaper than the alternative; do
706
+ // not "fix" it by advancing past the header HLC.
707
+ if (reader.headerHLC && this.serverSiteId) {
708
+ await this.syncManager.updatePeerSyncState(this.serverSiteId, reader.headerHLC);
709
+ }
710
+ this.emitSyncEvent('state-change', 'Snapshot bootstrap complete');
711
+ this.setStatus({ status: 'syncing', progress: 0 });
712
+ return null;
713
+ }
714
+ catch (err) {
715
+ const error = err instanceof Error ? err : new Error(String(err));
716
+ // A transfer torn down by our own disconnect() is not a failure to
717
+ // report — the caller asked for it, and onError means "needs attention".
718
+ if (!this.intentionalDisconnect) {
719
+ this.emitSyncEvent('error', `Snapshot transfer failed: ${error.message}`);
720
+ this.options.onError?.(error);
721
+ }
722
+ // Close (handlers attached — see doc comment) unless the socket is
723
+ // already closed, in which case onclose has fired or is in flight.
724
+ // `socket.OPEN`, not the global `WebSocket.OPEN`: this runs long after
725
+ // the transfer started, and a teardown that has since removed the global
726
+ // (an environment shim, a test harness) would turn this cleanup into a
727
+ // ReferenceError and break the "never rejects" contract above.
728
+ if (socket && socket.readyState === socket.OPEN) {
729
+ socket.close();
730
+ }
731
+ return error;
732
+ }
733
+ }
734
+ /** Route one snapshot_chunk to the active transfer. Synchronous — see the dispatch comment. */
735
+ handleSnapshotChunk(message) {
736
+ if (!this.activeSnapshotReader) {
737
+ // A late chunk from an aborted stream must never leak into the next
738
+ // transfer. Warn once per gap, not per chunk — a dead stream can trail
739
+ // thousands.
740
+ if (!this.droppedChunkWarned) {
741
+ this.droppedChunkWarned = true;
742
+ console.warn('Dropping snapshot_chunk with no active snapshot transfer');
743
+ this.emitSyncEvent('info', 'Dropped snapshot chunk(s) received with no active transfer');
744
+ }
745
+ return;
746
+ }
747
+ if (!message.chunk)
748
+ return;
749
+ this.activeSnapshotReader.push(message.chunk);
750
+ this.resetSnapshotStallTimer();
751
+ }
752
+ /** End the active transfer's stream (no-op when none). */
753
+ handleSnapshotComplete() {
754
+ if (!this.activeSnapshotReader)
755
+ return;
756
+ this.clearSnapshotStallTimer();
757
+ this.activeSnapshotReader.complete();
758
+ }
759
+ /**
760
+ * Abort the in-flight transfer, if any. The reader throws into
761
+ * `applySnapshotStream`, which lands in the transfer's failure path.
762
+ */
763
+ abortSnapshotTransfer(error) {
764
+ this.activeSnapshotReader?.abort(error);
765
+ }
766
+ /**
767
+ * Stall watchdog: a server that stops sending mid-stream without closing the
768
+ * socket would otherwise hang the bootstrap forever with no reconnect. Reset
769
+ * on every chunk; cleared on complete and when the transfer settles.
770
+ */
771
+ resetSnapshotStallTimer() {
772
+ this.clearSnapshotStallTimer();
773
+ const timeoutMs = this.options.snapshotChunkTimeoutMs;
774
+ this.snapshotStallTimer = setTimeout(() => {
775
+ this.snapshotStallTimer = null;
776
+ this.abortSnapshotTransfer(new Error(`Snapshot transfer stalled: no chunk within ${timeoutMs}ms`));
777
+ }, timeoutMs);
778
+ }
779
+ clearSnapshotStallTimer() {
780
+ if (this.snapshotStallTimer) {
781
+ clearTimeout(this.snapshotStallTimer);
782
+ this.snapshotStallTimer = null;
783
+ }
784
+ }
785
+ /**
786
+ * Forward apply progress: every tick to `onSnapshotProgress` and the status,
787
+ * but a human-readable sync event only when `tablesProcessed` changes —
788
+ * progress fires once per column-versions chunk and would flood an event log.
789
+ */
790
+ reportSnapshotProgress(progress) {
791
+ this.options.onSnapshotProgress?.(progress);
792
+ this.setStatus({
793
+ status: 'bootstrapping',
794
+ tablesProcessed: progress.tablesProcessed,
795
+ totalTables: progress.totalTables,
796
+ entriesProcessed: progress.entriesProcessed,
797
+ totalEntries: progress.totalEntries,
798
+ currentTable: progress.currentTable,
799
+ });
800
+ if (progress.tablesProcessed !== this.snapshotEventTablesProcessed) {
801
+ this.snapshotEventTablesProcessed = progress.tablesProcessed;
802
+ this.emitSyncEvent('info', `Snapshot: ${progress.tablesProcessed} of ${progress.totalTables} tables`, { changeCount: progress.entriesProcessed });
803
+ }
804
+ }
805
+ // ==========================================================================
441
806
  // Private: Message Sending
442
807
  // ==========================================================================
443
808
  sendHandshake(databaseId, token) {
@@ -540,6 +905,9 @@ export class SyncClient {
540
905
  return;
541
906
  if (!this.isConnected || !this.serverSiteId)
542
907
  return;
908
+ // No pushes while a snapshot is landing — local data is partial.
909
+ if (this.isBootstrapping)
910
+ return;
543
911
  // Get changes since lastSentHLC (delta sync)
544
912
  // Use serverSiteId to filter out changes that originated from the server
545
913
  // (which we already have), keeping our local changes to send
@@ -1 +1 @@
1
- {"version":3,"file":"sync-client.js","sourceRoot":"","sources":["../../src/sync-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,gBAAgB,GAOjB,MAAM,eAAe,CAAC;AAQvB,+BAA+B;AAC/B,MAAM,0BAA0B,GAAG,IAAI,CAAC;AACxC,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAC9C,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACJ,WAAW,CAAc;IACzB,UAAU,CAAmB;IAC7B,OAAO,CAED;IAEvB,kBAAkB;IACV,EAAE,GAAqB,IAAI,CAAC;IAC5B,YAAY,GAAkB,IAAI,CAAC;IAE3C,mBAAmB;IACX,OAAO,GAAe,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IACjD,aAAa,GAAkB,IAAI,CAAC;IACpC,oBAAoB,GAAkB,IAAI,CAAC;IAC3C,eAAe,GAAuB,SAAS,CAAC;IAExD,qBAAqB;IACb,iBAAiB,GAAG,CAAC,CAAC;IACtB,cAAc,GAAyC,IAAI,CAAC;IACpE,uEAAuE;IACvE,+DAA+D;IACvD,qBAAqB,GAAG,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AE,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Types for the WebSocket sync client.
3
3
  */
4
- import type { ApplyResult, ChangeSet, SyncManager, SyncEventEmitter } from '@quereus/sync';
4
+ import type { ApplyResult, ChangeSet, SnapshotProgress, SyncManager, SyncEventEmitter } from '@quereus/sync';
5
5
  /**
6
6
  * Sync connection status.
7
7
  */
@@ -9,6 +9,19 @@ export type SyncStatus = {
9
9
  status: 'disconnected';
10
10
  } | {
11
11
  status: 'connecting';
12
+ }
13
+ /**
14
+ * A snapshot bootstrap is streaming into the local store. The local database
15
+ * is PARTIAL until this ends — do not write to it (a concurrent local write
16
+ * is silently overwritten by the snapshot and never pushed).
17
+ */
18
+ | {
19
+ status: 'bootstrapping';
20
+ tablesProcessed: number;
21
+ totalTables: number;
22
+ entriesProcessed: number;
23
+ totalEntries: number;
24
+ currentTable?: string;
12
25
  } | {
13
26
  status: 'syncing';
14
27
  progress: number;
@@ -102,5 +115,26 @@ export interface SyncClientOptions {
102
115
  * @default false
103
116
  */
104
117
  readOnly?: boolean;
118
+ /**
119
+ * Automatically request a full snapshot on the first connect to an EMPTY
120
+ * replica — one that has never synced with this server and holds no local
121
+ * change facts of its own. Disable to keep bootstrap purely explicit via
122
+ * {@link SyncClient.requestSnapshot}.
123
+ * @default true
124
+ */
125
+ bootstrapOnEmpty?: boolean;
126
+ /**
127
+ * Stall watchdog for a snapshot transfer: if no `snapshot_chunk` arrives
128
+ * within this window, the transfer is aborted and the socket closed so the
129
+ * normal reconnect path can resume from the saved checkpoint.
130
+ * @default 60000
131
+ */
132
+ snapshotChunkTimeoutMs?: number;
133
+ /**
134
+ * Fine-grained snapshot transfer progress (fires once per applied chunk).
135
+ * The coarser table-boundary progress also rides `onSyncEvent` and the
136
+ * `bootstrapping` status.
137
+ */
138
+ onSnapshotProgress?: (progress: SnapshotProgress) => void;
105
139
  }
106
140
  //# sourceMappingURL=types.d.ts.map
@@ -1 +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K,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAEhE;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAqHH,wEAAwE;AACxE,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,oEAAoE"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAoJH,wEAAwE;AACxE,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,oEAAoE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quereus/sync-client",
3
- "version": "4.6.0",
3
+ "version": "4.8.0",
4
4
  "type": "module",
5
5
  "description": "WebSocket sync client for Quereus - handles connection, reconnection, and change synchronization",
6
6
  "keywords": [
@@ -42,7 +42,7 @@
42
42
  "test:single": "cd ../.. && node --import ./packages/quereus-sync-client/register.mjs node_modules/mocha/bin/mocha.js --bail"
43
43
  },
44
44
  "peerDependencies": {
45
- "@quereus/sync": "^4.6.0"
45
+ "@quereus/sync": "^4.8.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/mocha": "^10.0.10",
@@ -54,8 +54,8 @@
54
54
  "typescript": "^5.9.3"
55
55
  },
56
56
  "dependencies": {
57
- "@quereus/quereus": "^4.6.0",
58
- "@quereus/sync": "^4.6.0"
57
+ "@quereus/quereus": "^4.8.0",
58
+ "@quereus/sync": "^4.8.0"
59
59
  },
60
60
  "quereus": {
61
61
  "provides": {