yrby-client 0.4.3 → 0.6.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.
Files changed (44) hide show
  1. package/README.md +250 -36
  2. package/dist/actioncable_provider.d.ts +26 -1
  3. package/dist/actioncable_provider.d.ts.map +1 -1
  4. package/dist/actioncable_provider.js +295 -150
  5. package/dist/actioncable_provider.js.map +1 -1
  6. package/dist/cjs/actioncable_provider.d.ts +26 -1
  7. package/dist/cjs/actioncable_provider.js +296 -151
  8. package/dist/cjs/document_element.d.ts +24 -0
  9. package/dist/cjs/document_element.js +260 -0
  10. package/dist/cjs/document_session.d.ts +62 -0
  11. package/dist/cjs/document_session.js +335 -0
  12. package/dist/cjs/index.d.ts +2 -0
  13. package/dist/cjs/index.js +4 -1
  14. package/dist/cjs/reliable_sync.d.ts +18 -31
  15. package/dist/cjs/reliable_sync.js +128 -98
  16. package/dist/cjs/turbo_adapter.d.ts +9 -0
  17. package/dist/cjs/turbo_adapter.js +81 -0
  18. package/dist/cjs/y_protocol_session.d.ts +7 -14
  19. package/dist/cjs/y_protocol_session.js +97 -92
  20. package/dist/document_element.d.ts +25 -0
  21. package/dist/document_element.d.ts.map +1 -0
  22. package/dist/document_element.js +225 -0
  23. package/dist/document_element.js.map +1 -0
  24. package/dist/document_session.d.ts +63 -0
  25. package/dist/document_session.d.ts.map +1 -0
  26. package/dist/document_session.js +296 -0
  27. package/dist/document_session.js.map +1 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +2 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/reliable_sync.d.ts +18 -31
  33. package/dist/reliable_sync.d.ts.map +1 -1
  34. package/dist/reliable_sync.js +128 -98
  35. package/dist/reliable_sync.js.map +1 -1
  36. package/dist/turbo_adapter.d.ts +10 -0
  37. package/dist/turbo_adapter.d.ts.map +1 -0
  38. package/dist/turbo_adapter.js +78 -0
  39. package/dist/turbo_adapter.js.map +1 -0
  40. package/dist/y_protocol_session.d.ts +7 -14
  41. package/dist/y_protocol_session.d.ts.map +1 -1
  42. package/dist/y_protocol_session.js +97 -92
  43. package/dist/y_protocol_session.js.map +1 -1
  44. package/package.json +29 -6
@@ -1,139 +1,169 @@
1
- // Transport-agnostic reliable-delivery core for the yrby y-websocket
2
- // protocol: an ack-tracked queue of unacknowledged local updates,
3
- // sync-since-last-ack (the unacked tail goes out as one merged, causally-complete
4
- // delta so the server never sees an internal gap), cumulative acks, periodic
5
- // retransmit, and reconnect replay.
1
+ // Transport-agnostic reliable delivery for the yrby y-websocket protocol.
6
2
  //
7
- // It doesn't touch the transport, the Yjs binding, or wire encoding. Inject two
8
- // functions:
9
- // send(update, id) transmits one update (raw merged bytes plus a cumulative
10
- // sequence id; you frame, base64, and put it on the socket), and merge(updates)
11
- // merges update byte-arrays into one (usually Y.mergeUpdates). Drive it from the
12
- // provider lifecycle: enqueue(update) on each local edit, onAck(id) when an
13
- // { ack: id } frame arrives, and onConnect()/onDisconnect() on transport changes.
3
+ // Each local update gets a sequence number and sits in an ordered queue until
4
+ // the server acknowledges it. While the transport is up, ReliableSync sends the
5
+ // whole unacknowledged tail as one merged, causally complete delta so the
6
+ // server never sees an internal gap, and resends it on a timer until an ack
7
+ // arrives. Acks are cumulative, so one { ack: n } clears everything up to n.
8
+ // While the transport is down, ReliableSync sends nothing and drops nothing,
9
+ // and it replays the tail when the transport reconnects.
10
+ //
11
+ // It doesn't touch the transport or Yjs itself. You inject two functions.
12
+ // send(update, id) transmits one delta with the sequence id the server should
13
+ // acknowledge, and merge(updates) combines update byte arrays into one (usually
14
+ // Y.mergeUpdates). Call enqueue(update) on each local edit, acknowledge(id) when
15
+ // an { ack: id } envelope arrives, resume() when the transport connects, and
16
+ // pause() when it drops.
14
17
  //
15
18
  // Awareness/presence stays out of scope; it's fire-and-forget in the provider.
16
- const DEFAULTS = { resendInterval: 1000 };
19
+ const DEFAULT_RESEND_INTERVAL = 1000;
17
20
  export class ReliableSync {
18
- /** Unacked local updates, in order. */
19
- pending = [];
21
+ #pending = [];
20
22
  #send;
21
23
  #merge;
22
24
  #resendInterval;
23
25
  #setInterval;
24
26
  #clearInterval;
25
27
  #nextSeq = 1;
26
- #connected = false;
27
- #timer = undefined;
28
- // Memoized merge of the unacked tail. The tail only changes on enqueue/ack, so
29
- // retransmit ticks reuse this instead of re-merging the whole queue each time.
30
- #tailCache = undefined;
28
+ #phase = "paused";
29
+ #timer;
30
+ // Incremented on every queue or phase change. Injected send/merge/timer
31
+ // functions can call back into this object, so code that calls one compares
32
+ // the version afterwards to detect changes made during the call.
33
+ #version = 0;
34
+ // The queue merged into one delta. It's memoized until the queue changes so
35
+ // retransmit ticks don't re-merge the whole queue every second.
36
+ #tail;
31
37
  constructor(opts) {
32
- const { send, merge, resendInterval } = opts ?? {};
38
+ const { send, merge, resendInterval, setInterval: setTimer, clearInterval: clearTimer } = opts ?? {};
33
39
  if (typeof send !== "function")
34
40
  throw new TypeError("ReliableSync requires a send(update, id) function");
35
41
  if (typeof merge !== "function")
36
42
  throw new TypeError("ReliableSync requires a merge(updates) function");
37
- this.#send = send;
38
- this.#merge = merge;
39
- const interval = resendInterval ?? DEFAULTS.resendInterval;
43
+ const interval = resendInterval ?? DEFAULT_RESEND_INTERVAL;
40
44
  if (!Number.isFinite(interval) || interval <= 0) {
41
45
  throw new TypeError("ReliableSync resendInterval must be a positive number");
42
46
  }
47
+ this.#send = send;
48
+ this.#merge = merge;
43
49
  this.#resendInterval = interval;
44
- // Injectable timer hooks make the resend loop testable; default to globals.
45
- this.#setInterval = opts.setInterval ?? ((fn, ms) => setInterval(fn, ms));
46
- this.#clearInterval = opts.clearInterval ?? ((h) => clearInterval(h));
50
+ this.#setInterval = setTimer ?? ((fn, ms) => setInterval(fn, ms));
51
+ this.#clearInterval = clearTimer ?? ((h) => clearInterval(h));
52
+ }
53
+ /** A snapshot of unacknowledged local updates, oldest first. Editing it does not change the queue. */
54
+ get pending() {
55
+ return this.#pending.map(({ seq, update }) => ({ seq, update: update.slice() }));
47
56
  }
48
57
  /** True while there are unacknowledged local updates. */
49
58
  get hasPending() {
50
- return this.pending.length > 0;
59
+ return this.#pending.length > 0;
51
60
  }
52
- /**
53
- * Record a local document update. It is queued and the unacked tail is
54
- * flushed; the update remains retained until the server acknowledges it.
55
- */
61
+ /** Queue a local update and, while connected, send the tail. Ignored after destroy(). */
56
62
  enqueue(update) {
57
- this.pending.push({ seq: this.#nextSeq++, update });
58
- this.#tailCache = undefined; // tail changed
59
- if (this.#connected)
60
- this.#startTimer();
61
- this.flush();
63
+ if (this.#phase === "destroyed")
64
+ return;
65
+ this.#pending.push({ seq: this.#nextSeq++, update: new Uint8Array(update) });
66
+ this.#queueChanged();
67
+ this.#flush();
62
68
  }
63
69
  /**
64
- * Send the whole unacked tail as one merged delta. The id is the highest seq
65
- * in the batch, so a single { ack } cumulatively confirms everything up to it.
66
- * No-op while disconnected (the tail is replayed on the next onConnect).
70
+ * Confirm delivery through `id`, removing every queued update with
71
+ * seq <= id. Acks come off the wire, so ignore a malformed value or an id
72
+ * beyond anything sent.
67
73
  */
68
- flush() {
69
- if (!this.#connected || this.pending.length === 0)
74
+ acknowledge(id) {
75
+ if (this.#phase === "destroyed" || !Number.isSafeInteger(id) || id < 0)
76
+ return;
77
+ const newest = this.#pending.at(-1);
78
+ if (newest && id > newest.seq)
70
79
  return;
71
- this.#send(this.#mergedTail(), this.pending[this.pending.length - 1].seq);
80
+ this.#pending = this.#pending.filter((p) => p.seq > id);
81
+ this.#queueChanged();
72
82
  }
73
- /**
74
- * Confirm delivery up to `id`: prune every queued update with seq <= id.
75
- * Acks arrive over the wire, so validate before pruning. A malformed value
76
- * (NaN/string/negative) or an impossible future id must not silently drop the
77
- * queue; invalid acks are ignored.
78
- */
79
- onAck(id) {
80
- if (!Number.isSafeInteger(id) || id < 0)
81
- return; // malformed / impossible
82
- if (this.pending.length > 0 && id > this.pending[this.pending.length - 1].seq)
83
- return; // future ack
84
- this.pending = this.pending.filter((p) => p.seq > id);
85
- this.#tailCache = undefined; // tail changed
86
- if (this.pending.length === 0)
87
- this.#stopTimer();
83
+ /** Call when the transport is up. Replays the tail and keeps retransmitting until it is acknowledged. */
84
+ resume() {
85
+ if (this.#phase === "destroyed")
86
+ return;
87
+ this.#phase = "live";
88
+ this.#version++;
89
+ this.#updateTimer();
90
+ this.#flush();
88
91
  }
89
- /** Transport (re)connected: replay the unacked tail and resume retransmits. */
90
- onConnect() {
91
- this.#connected = true;
92
- this.flush();
93
- if (this.pending.length > 0)
94
- this.#startTimer();
92
+ /** Call when the transport is down. Keeps the queue and stops retransmitting. */
93
+ pause() {
94
+ if (this.#phase === "destroyed")
95
+ return;
96
+ this.#phase = "paused";
97
+ this.#version++;
98
+ this.#updateTimer();
95
99
  }
96
- /** Transport dropped: keep the queue (for reconnect replay), pause the timer. */
97
- onDisconnect() {
98
- this.#connected = false;
99
- this.#stopTimer();
100
+ /** Send the tail again if anything is unacknowledged. The internal timer calls this, and a host with its own scheduler can too. */
101
+ retransmit() {
102
+ this.#flush();
100
103
  }
101
- /**
102
- * One retransmit tick. Exposed for deterministic testing; normally driven by
103
- * the internal timer.
104
- */
105
- onTick() {
106
- if (!this.#connected || this.pending.length === 0)
104
+ /** Stop the timer and drop the queue. Later enqueues are ignored. */
105
+ destroy() {
106
+ if (this.#phase === "destroyed")
107
107
  return;
108
- this.flush();
108
+ this.#phase = "destroyed";
109
+ this.#pending = [];
110
+ this.#queueChanged();
109
111
  }
110
- /** Stop timers and drop references. Call when the provider is destroyed. */
111
- destroy() {
112
- this.#connected = false;
113
- this.#stopTimer();
114
- this.pending = [];
115
- this.#tailCache = undefined;
112
+ #queueChanged() {
113
+ this.#version++;
114
+ this.#tail = undefined;
115
+ this.#updateTimer();
116
116
  }
117
- /** The unacked tail merged into one delta (memoized between tail changes). */
118
- #mergedTail() {
119
- if (this.#tailCache === undefined) {
120
- const updates = this.pending.map((p) => p.update);
121
- this.#tailCache = updates.length === 1 ? updates[0] : this.#merge(updates);
117
+ // Start or stop the retransmit timer so it runs only while live with work queued.
118
+ #updateTimer() {
119
+ const wanted = this.#phase === "live" && this.hasPending;
120
+ if (wanted === (this.#timer !== undefined))
121
+ return;
122
+ if (!wanted) {
123
+ const timer = this.#timer;
124
+ this.#timer = undefined;
125
+ timer.stop();
126
+ return;
122
127
  }
123
- return this.#tailCache;
124
- }
125
- #startTimer() {
126
- if (this.#timer !== undefined)
128
+ // Install the timer before calling setInterval so a tick during that call
129
+ // finds its own timer. Stopping it before the handle exists is a no-op, and
130
+ // the check after setInterval returns cancels the real handle.
131
+ const timer = this.#timer = { stop: () => { } };
132
+ let handle;
133
+ try {
134
+ handle = this.#setInterval(() => { if (this.#timer === timer)
135
+ this.#flush(); }, this.#resendInterval);
136
+ }
137
+ catch (error) {
138
+ // The queue is untouched, and the next resume or queue change tries again.
139
+ if (this.#timer === timer)
140
+ this.#timer = undefined;
141
+ throw error;
142
+ }
143
+ timer.stop = () => this.#clearInterval(handle);
144
+ // An injected timer may tick before returning its handle, and that tick
145
+ // can pause or drain delivery.
146
+ if (this.#timer !== timer) {
147
+ timer.stop();
127
148
  return;
128
- this.#timer = this.#setInterval(() => this.onTick(), this.#resendInterval);
129
- const t = this.#timer;
130
- if (t && typeof t.unref === "function")
131
- t.unref();
149
+ }
150
+ handle?.unref?.();
132
151
  }
133
- #stopTimer() {
134
- if (this.#timer !== undefined)
135
- this.#clearInterval(this.#timer);
136
- this.#timer = undefined;
152
+ // Send the whole tail as one delta, tagged with its highest seq so one ack
153
+ // covers all of it. Does nothing while disconnected.
154
+ #flush() {
155
+ if (this.#phase !== "live" || !this.#pending.length)
156
+ return;
157
+ if (this.#tail === undefined) {
158
+ const version = this.#version;
159
+ const updates = this.#pending.map((p) => p.update);
160
+ const tail = updates.length === 1 ? updates[0] : this.#merge(updates);
161
+ // merge may have changed the queue, paused, or already sent through a nested resume.
162
+ if (this.#version !== version)
163
+ return;
164
+ this.#tail = tail;
165
+ }
166
+ this.#send(this.#tail, this.#pending.at(-1).seq);
137
167
  }
138
168
  }
139
169
  //# sourceMappingURL=reliable_sync.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reliable_sync.js","sourceRoot":"","sources":["../src/reliable_sync.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,kEAAkE;AAClE,kFAAkF;AAClF,6EAA6E;AAC7E,oCAAoC;AACpC,EAAE;AACF,gFAAgF;AAChF,aAAa;AACb,4EAA4E;AAC5E,gFAAgF;AAChF,iFAAiF;AACjF,4EAA4E;AAC5E,kFAAkF;AAClF,EAAE;AACF,+EAA+E;AAoB/E,MAAM,QAAQ,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;AAO1C,MAAM,OAAO,YAAY;IACvB,uCAAuC;IACvC,OAAO,GAAc,EAAE,CAAC;IAExB,KAAK,CAA8B;IACnC,MAAM,CAA+B;IACrC,eAAe,CAAS;IACxB,YAAY,CAAmD;IAC/D,cAAc,CAAgC;IAE9C,QAAQ,GAAG,CAAC,CAAC;IACb,UAAU,GAAG,KAAK,CAAC;IACnB,MAAM,GAA4B,SAAS,CAAC;IAC5C,+EAA+E;IAC/E,+EAA+E;IAC/E,UAAU,GAA2B,SAAS,CAAC;IAE/C,YAAY,IAAyB;QACnC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,IAAK,EAA0B,CAAC;QAC5E,IAAI,OAAO,IAAI,KAAK,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,mDAAmD,CAAC,CAAC;QACzG,IAAI,OAAO,KAAK,KAAK,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC,CAAC;QAExG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,MAAM,QAAQ,GAAG,cAAc,IAAI,QAAQ,CAAC,cAAc,CAAC;QAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,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AAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YACnD,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACtE,qFAAqF;YACrF,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO;gBAAE,OAAO;YACtC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ export interface DocumentMount {
2
+ readonly ownerDocument: Document;
3
+ readonly isConnected: boolean;
4
+ activate(): void;
5
+ deactivate(): void;
6
+ }
7
+ export declare function registerDocumentMount(mount: DocumentMount): () => void;
8
+ /** Tears down the adapter, for application shutdown or tests. */
9
+ export declare function disconnectTurbo(document: Document): void;
10
+ //# sourceMappingURL=turbo_adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turbo_adapter.d.ts","sourceRoot":"","sources":["../src/turbo_adapter.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,IAAI,IAAI,CAAC;IACjB,UAAU,IAAI,IAAI,CAAC;CACpB;AAOD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,IAAI,CAStE;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAuC"}
@@ -0,0 +1,78 @@
1
+ const adapters = new WeakMap();
2
+ // Turbo (Hotwire) and Turbolinks 5 fire the same lifecycle events under different names.
3
+ const CACHE_EVENTS = ["turbo:before-cache", "turbolinks:before-cache"];
4
+ const RENDER_EVENTS = ["turbo:render", "turbo:load", "turbo:fetch-request-error", "turbolinks:render", "turbolinks:load"];
5
+ const PREVIEW_ATTRIBUTES = ["data-turbo-preview", "data-turbolinks-preview"];
6
+ export function registerDocumentMount(mount) {
7
+ let adapter = adapters.get(mount.ownerDocument);
8
+ if (!adapter)
9
+ adapters.set(mount.ownerDocument, adapter = new TurboAdapter(mount.ownerDocument));
10
+ adapter.mounts.add(mount);
11
+ adapter.reconcile();
12
+ return () => {
13
+ adapter.mounts.delete(mount);
14
+ if (!adapter.mounts.size)
15
+ adapter.destroy();
16
+ };
17
+ }
18
+ /** Tears down the adapter, for application shutdown or tests. */
19
+ export function disconnectTurbo(document) { adapters.get(document)?.destroy(); }
20
+ class TurboAdapter {
21
+ document;
22
+ mounts = new Set();
23
+ #state = { phase: "active" };
24
+ constructor(document) {
25
+ this.document = document;
26
+ for (const event of CACHE_EVENTS)
27
+ document.addEventListener(event, this.#beforeCache);
28
+ for (const event of RENDER_EVENTS)
29
+ document.addEventListener(event, this.reconcile);
30
+ }
31
+ reconcile = () => {
32
+ if (this.#state.phase !== "active")
33
+ return;
34
+ const html = this.document.documentElement;
35
+ const preview = PREVIEW_ATTRIBUTES.some(attribute => html?.hasAttribute(attribute));
36
+ for (const mount of this.mounts) {
37
+ if (!mount.isConnected || preview)
38
+ mount.deactivate();
39
+ else
40
+ mount.activate();
41
+ }
42
+ };
43
+ #beforeCache = () => {
44
+ const state = this.#state;
45
+ if (state.phase !== "active")
46
+ return;
47
+ for (const mount of this.mounts)
48
+ mount.deactivate();
49
+ if (this.#state !== state)
50
+ return;
51
+ // A canceled or failed navigation fires no render or load event, so we
52
+ // reconcile ourselves after Turbo finishes cloning the snapshot. The clone
53
+ // takes two turns, which is why the timers are nested.
54
+ clearTimeout(state.timer);
55
+ state.timer = setTimeout(() => {
56
+ if (this.#state === state)
57
+ state.timer = setTimeout(this.reconcile, 0);
58
+ }, 0);
59
+ };
60
+ destroy() {
61
+ const state = this.#state;
62
+ if (state.phase === "destroyed")
63
+ return;
64
+ this.#state = { phase: "destroyed" };
65
+ clearTimeout(state.timer);
66
+ // Leave the registry first so cleanup callbacks can register a replacement
67
+ // adapter for this document.
68
+ adapters.delete(this.document);
69
+ for (const event of CACHE_EVENTS)
70
+ this.document.removeEventListener(event, this.#beforeCache);
71
+ for (const event of RENDER_EVENTS)
72
+ this.document.removeEventListener(event, this.reconcile);
73
+ for (const mount of this.mounts)
74
+ mount.deactivate();
75
+ this.mounts.clear();
76
+ }
77
+ }
78
+ //# sourceMappingURL=turbo_adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turbo_adapter.js","sourceRoot":"","sources":["../src/turbo_adapter.ts"],"names":[],"mappings":"AASA,MAAM,QAAQ,GAAG,IAAI,OAAO,EAA0B,CAAC;AACvD,yFAAyF;AACzF,MAAM,YAAY,GAAG,CAAC,oBAAoB,EAAE,yBAAyB,CAAC,CAAC;AACvE,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,YAAY,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;AAC1H,MAAM,kBAAkB,GAAG,CAAC,oBAAoB,EAAE,yBAAyB,CAAC,CAAC;AAE7E,MAAM,UAAU,qBAAqB,CAAC,KAAoB;IACxD,IAAI,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAChD,IAAI,CAAC,OAAO;QAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IACjG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,CAAC,SA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AI,IAAI,CAAC,MAAM;YAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF"}
@@ -37,10 +37,10 @@ export declare class YProtocolSession {
37
37
  get synced(): boolean;
38
38
  /** True while there are unacknowledged local document updates in flight. */
39
39
  get hasPending(): boolean;
40
- /** Transport connected: send the opening handshake and replay the unacked tail. */
41
- onConnect(): void;
42
- /** Transport dropped: pause retransmits (queue kept) and clear remote presence. */
43
- onDisconnect(): void;
40
+ /** Call when the transport is up. Sends the opening handshake, re-announces presence, and replays the unacked tail. */
41
+ resume(): void;
42
+ /** Call when the transport is down. Keeps the queue, stops retransmits, and clears peers' presence. */
43
+ pause(): void;
44
44
  /**
45
45
  * Broadcast that our local presence is gone (sets local state to null, which
46
46
  * emits a removal awareness frame through `send`). Call this while the
@@ -48,15 +48,8 @@ export declare class YProtocolSession {
48
48
  * waiting for the awareness timeout. A no-op when there's no local state.
49
49
  */
50
50
  removeLocalAwareness(): void;
51
- /**
52
- * A reliable-delivery `{ ack: id }` envelope arrived. `dropped` is set when
53
- * the server settled the update WITHOUT recording it (rejected as an
54
- * unhealable causal gap after repeated resyncs). The queue is pruned either
55
- * way — retransmitting an unhealable update would loop forever — but a
56
- * dropped settle is surfaced via onError ("ack-dropped") so the app can warn
57
- * or reload instead of silently reporting synced over lost data.
58
- */
59
- ack(id: number, dropped?: boolean): void;
51
+ /** A reliable-delivery `{ ack: id }` envelope arrived. */
52
+ acknowledge(id: number): void;
60
53
  /**
61
54
  * Apply an update without treating it as a local edit, so it isn't queued for
62
55
  * re-delivery to the server. Use it for bootstrap/restore: initial state loaded
@@ -67,7 +60,7 @@ export declare class YProtocolSession {
67
60
  * keystroke becomes an outbound frame), so a bare `Y.applyUpdate(doc, update)`
68
61
  * would look like a local edit and get echoed back on the next connect. Going
69
62
  * through here applies under the session's own origin, which the outbound
70
- * filter skips. Safe to call before `onConnect()`: the state folds into the
63
+ * filter skips. Safe to call before `resume()`: the state folds into the
71
64
  * SyncStep1 handshake instead of being re-sent.
72
65
  */
73
66
  applyRemoteUpdate(update: Uint8Array): void;
@@ -1 +1 @@
1
- {"version":3,"file":"y_protocol_session.d.ts","sourceRoot":"","sources":["../src/y_protocol_session.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,GAAG,EAA6B,MAAM,KAAK,CAAC;AAIrD,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIpE,eAAO,MAAM,WAAW;;;CAAqC,CAAC;AAE9D,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1D,+EAA+E;IAC/E,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,2EAA2E;IAC3E,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,KAAK,WAAW,CAAC;IAC/D,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC/C;AAID,qBAAa,gBAAgB;;IAC3B,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;gBASzB,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,uBAAuB;IA6CnD,mFAAmF;IACnF,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,4EAA4E;IAC5E,IAAI,UAAU,IAAI,OAAO,CAExB;IA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