@hydranium/protocol 1.0.0-next.117 → 1.0.0-next.123

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 (60) hide show
  1. package/lib/client/data-connection.d.ts +28 -66
  2. package/lib/client/data-connection.d.ts.map +1 -1
  3. package/lib/client/data-connection.js +41 -112
  4. package/lib/client/data-connection.js.map +1 -1
  5. package/lib/client/data-session.d.ts +168 -93
  6. package/lib/client/data-session.d.ts.map +1 -1
  7. package/lib/client/data-session.js +291 -147
  8. package/lib/client/data-session.js.map +1 -1
  9. package/lib/data/data-protocol-methods.d.ts +2 -2
  10. package/lib/data/data-protocol-methods.d.ts.map +1 -1
  11. package/lib/data/data-protocol-methods.js +4 -0
  12. package/lib/data/data-protocol-methods.js.map +1 -1
  13. package/lib/data/data-server-protocol.d.ts +66 -30
  14. package/lib/data/data-server-protocol.d.ts.map +1 -1
  15. package/lib/data/requests.d.ts +67 -11
  16. package/lib/data/requests.d.ts.map +1 -1
  17. package/lib/errors.d.ts +66 -4
  18. package/lib/errors.d.ts.map +1 -1
  19. package/lib/errors.js +96 -5
  20. package/lib/errors.js.map +1 -1
  21. package/lib/messages/index.d.ts +1 -0
  22. package/lib/messages/index.d.ts.map +1 -1
  23. package/lib/messages/index.js +4 -1
  24. package/lib/messages/index.js.map +1 -1
  25. package/lib/model-server.d.ts +13 -1
  26. package/lib/model-server.d.ts.map +1 -1
  27. package/lib/model-server.js.map +1 -1
  28. package/lib/model-service/based-on.d.ts +2 -0
  29. package/lib/model-service/based-on.d.ts.map +1 -1
  30. package/lib/model-service/based-on.js +3 -0
  31. package/lib/model-service/based-on.js.map +1 -1
  32. package/lib/model-service/index.d.ts +0 -1
  33. package/lib/model-service/index.d.ts.map +1 -1
  34. package/lib/model-service/index.js +3 -5
  35. package/lib/model-service/index.js.map +1 -1
  36. package/lib/patch-merge.d.ts +28 -27
  37. package/lib/patch-merge.d.ts.map +1 -1
  38. package/lib/patch-merge.js +66 -22
  39. package/lib/patch-merge.js.map +1 -1
  40. package/lib/transfer-document.d.ts +2 -3
  41. package/lib/transfer-document.d.ts.map +1 -1
  42. package/lib/transfer-document.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/client/data-connection.ts +69 -119
  45. package/src/client/data-session.ts +348 -177
  46. package/src/data/data-protocol-methods.ts +4 -0
  47. package/src/data/data-server-protocol.ts +74 -30
  48. package/src/data/requests.ts +71 -11
  49. package/src/errors.ts +101 -4
  50. package/src/messages/index.ts +1 -0
  51. package/src/model-server.ts +13 -5
  52. package/src/model-service/based-on.ts +3 -0
  53. package/src/model-service/index.ts +3 -5
  54. package/src/patch-merge.ts +90 -37
  55. package/src/transfer-document.ts +2 -3
  56. package/lib/model-service/args.d.ts +0 -65
  57. package/lib/model-service/args.d.ts.map +0 -1
  58. package/lib/model-service/args.js +0 -11
  59. package/lib/model-service/args.js.map +0 -1
  60. package/src/model-service/args.ts +0 -69
@@ -8,19 +8,44 @@
8
8
  * SPDX-License-Identifier: MIT
9
9
  ********************************************************************************/
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.DataSession = void 0;
11
+ exports.DataSession = exports.DATA_SESSION_UNSAVED_LOST = exports.DATA_SESSION_RESTORE_FAILED = void 0;
12
+ const primitives_1 = require("../messages/primitives");
12
13
  /**
13
- * One participant on a data connection: a properties panel, a tree, a
14
- * form editor.
14
+ * A session could not re-open a document it had open after its connection
15
+ * dropped.
16
+ */
17
+ exports.DATA_SESSION_RESTORE_FAILED = (0, primitives_1.defineMessage)('hydranium/protocol/data-session-restore-failed', 'Could not restore {uri} after reconnecting to the data server: {detail}');
18
+ /**
19
+ * A session re-opened documents after its connection dropped whose version had
20
+ * moved on since the session's last unsaved write to them: another client
21
+ * edited them, even while the session was still connected, the server reverted
22
+ * them to what is on disk, or the server restarted. The session's unsaved edits
23
+ * may be gone.
24
+ */
25
+ exports.DATA_SESSION_UNSAVED_LOST = (0, primitives_1.defineMessage)('hydranium/protocol/data-session-unsaved-lost', 'Unsaved changes to {uris} may have been lost when the connection to the data server dropped.');
26
+ /**
27
+ * One participant on a data connection: a properties panel, a tree, a form
28
+ * editor. The client side of a server client session, registered over the
29
+ * wire under {@link clientId}.
15
30
  *
16
- * The server keys every hold and watch per `(uri, clientId)`, so the identity
17
- * belongs to the participant rather than to the wire — several sessions share
18
- * one connection, and two participants forced to share one identity cannot
19
- * distinguish each other's writes from their own echoes.
31
+ * The session writes only what it has open: the server refuses its update or
32
+ * save of a document it has not opened with a `DocumentNotOpenError` code.
33
+ * Every call waits for the registration, so the first can be issued at once.
20
34
  *
21
35
  * Every document operation stamps {@link clientId} itself. A caller that
22
36
  * passed its own could pass another participant's, and the server would
23
- * attribute the write and release the hold accordingly.
37
+ * attribute the write and close the document accordingly.
38
+ *
39
+ * {@link closeDocument} and {@link dispose} first wait, up to
40
+ * {@link settleBeforeCloseMs}, for this session's calls still in flight on the
41
+ * URI, or on any URI for `dispose`: a save sent just before its close would
42
+ * otherwise reach the server after it, and fail as not open.
43
+ *
44
+ * After the connection drops, the session registers again under the same id,
45
+ * re-opens and re-watches what it had open, and reports the documents whose
46
+ * unsaved edits did not survive; see {@link restore}. The connection does this at
47
+ * once for a session with documents open, and any session's next call does it
48
+ * too.
24
49
  *
25
50
  * Generic over the transfer root so this file names no grammar.
26
51
  *
@@ -34,39 +59,73 @@ exports.DataSession = void 0;
34
59
  class DataSession {
35
60
  clientId;
36
61
  host;
37
- /** URIs this session holds open, so {@link dispose} can release exactly those. */
62
+ label;
63
+ /**
64
+ * How long {@link closeDocument} and {@link dispose} wait for this session's
65
+ * calls in flight before closing anyway. Long, because the wait only runs
66
+ * out when a call hangs, and a close sent while a save is still running
67
+ * fails that save.
68
+ */
69
+ settleBeforeCloseMs = 10_000;
70
+ /** URIs this session has open, re-opened after a reconnect. */
38
71
  openUris = new Set();
39
72
  /**
40
- * The in-flight {@link openDocument} group per URI, while one is running.
41
- *
42
- * A hold is one per `(uri, clientId)`, and {@link openUris} is filled only
43
- * once an open has fully returned — so overlapping opens of one URI all read
44
- * it as unheld and all believe the hold is theirs to release. Tracking the
45
- * group lets the last of them answer for it once, knowing what the rest did.
73
+ * Per URI, how many opens of it this session has under way. Such a URI
74
+ * counts as open for {@link withOpenDocument}, which would otherwise close
75
+ * it under the open that is still being made.
46
76
  */
47
77
  openingUris = new Map();
78
+ /**
79
+ * Per URI written since its last save, the version the server answered this
80
+ * session's last write with; see {@link restore}.
81
+ */
82
+ unsavedWrites = new Map();
83
+ /** Per URI, this session's calls still in flight on it, which a close waits for. */
84
+ inFlight = new Map();
85
+ /**
86
+ * Sent with every registration, so the server lets this session register
87
+ * its id again while the dropped connection's session is still live there:
88
+ * a server that has not yet noticed the drop would otherwise refuse the id
89
+ * as a duplicate until it does.
90
+ */
91
+ resumeToken = globalThis.crypto.randomUUID();
92
+ /** The proxy the session is registered on; another one means the connection was replaced. */
93
+ registeredOn;
94
+ registration;
48
95
  disposed = false;
49
96
  /**
50
97
  * Disposed through {@link detach} rather than {@link dispose}, so nothing may
51
- * be sent. Folding it into {@link disposed} costs {@link openDocument} the
52
- * distinction, and its close would then go out on a detached session.
98
+ * be sent. Folding it into {@link disposed} would send the session's close
99
+ * over a connection that is going away.
53
100
  */
54
101
  detached = false;
55
- constructor(clientId, host) {
102
+ constructor(clientId, host, label) {
56
103
  this.clientId = clientId;
57
104
  this.host = host;
105
+ this.label = label;
58
106
  }
59
107
  /**
60
- * The connected, READY server proxy, for protocol methods this session does
61
- * not wrap — the ones carrying no `clientId`, so no identity can be got
62
- * wrong through them.
108
+ * The connected, READY server proxy once this session is registered on it,
109
+ * for protocol methods this session does not wrap. The proxy stamps
110
+ * nothing: pass this session's {@link clientId} to any method that carries
111
+ * one.
63
112
  */
64
113
  async connected() {
65
114
  // `async` so a disposed session REJECTS rather than throwing
66
115
  // synchronously: the connection's own `connected` rejects, and a caller
67
116
  // reaching for `.catch` on one of them would not catch the other.
68
117
  this.assertLive();
69
- return this.host.connected();
118
+ const server = await this.host.connected();
119
+ // Again after the wait: a session disposed meanwhile must not register,
120
+ // since its dispose found nothing registered to end.
121
+ this.assertLive();
122
+ if (this.registeredOn !== server) {
123
+ const reconnected = this.registeredOn !== undefined;
124
+ this.registeredOn = server;
125
+ this.registration = this.register(server, reconnected);
126
+ }
127
+ await this.registration;
128
+ return server;
70
129
  }
71
130
  /**
72
131
  * Open `args.uri` for editing and start watching it, in that order,
@@ -78,135 +137,110 @@ class DataSession {
78
137
  * baseline, and the first phase event after the open arrives as a spurious
79
138
  * `'changed'` — which a widget that resets its in-memory root to the server
80
139
  * view misreads as a concurrent third-party write, losing whatever the user
81
- * had typed. Nothing about the wrong order fails loudly, so it is encoded
82
- * here rather than documented and re-derived.
140
+ * had typed.
83
141
  *
84
142
  * Note that the returned snapshot's empty `diagnostics` does not mean
85
143
  * valid: `open` settles at the integrity landmark, not at validation.
86
144
  * Validity arrives asynchronously on `onDocumentUpdated`, or synchronously
87
145
  * from `getModelDocument({ includeDiagnostics: true })`.
88
- *
89
- * A dispose landing between the two awaits is handled here rather than in
90
- * {@link dispose}, which cannot release a hold that does not exist yet: it
91
- * reads {@link openUris}, and this method fills it only once both calls have
92
- * returned. Left to `dispose`, the hold and its watch outlive the participant
93
- * and go only when the connection closes.
94
- *
95
- * A watch that REJECTS is the same problem arriving by a different door: the
96
- * open already took a hold, and the caller sees only a failed open, so
97
- * nothing on its side will ever issue the close.
98
- *
99
- * Which call releases it is decided by {@link finishOpening} rather than by
100
- * the one that failed, because a hold is per `(uri, clientId)` and any number
101
- * of this session's opens share it. A failing open that closed on its own
102
- * behalf would revoke a peer's; one that deferred to a peer would leak the
103
- * hold whenever that peer fails at its OWN open, having then taken no hold to
104
- * roll back and having no rollback path to run. Making the last open for the
105
- * URI answer for it is the only rule that holds in both directions.
106
146
  */
107
- async openDocument(args) {
108
- const server = await this.connected();
109
- const opening = this.beginOpening(args.uri);
110
- try {
111
- const document = await server.openModelDocument({ ...args, clientId: this.clientId });
112
- // From here a hold exists. It belongs to the URI rather than to this
113
- // call, so the flag lives on the shared per-URI record.
114
- opening.holdTaken = true;
115
- await server.watchModelDocument({ uri: args.uri, clientId: this.clientId });
116
- if (this.disposed) {
117
- // Registering the URI BEFORE the open, so `dispose` could close on
118
- // intent, is NOT the same fix and can invert into the leak it is meant
119
- // to prevent: the close would then be issued while the open is still in
120
- // flight, and a peer that does not serialise the two can complete the
121
- // close first, after which the open re-registers the hold. Closing
122
- // strictly after the open has resolved is the only ordering with no
123
- // losing interleaving.
124
- if (!this.detached) {
125
- void server.closeModelDocument({ uri: args.uri, clientId: this.clientId }).catch(() => undefined);
126
- }
127
- // Answered for here, so the group's own release sends no second one.
128
- opening.holdTaken = false;
129
- // Returned rather than thrown: the caller that reaches this window is
130
- // one that never awaited the open, so a rejection here surfaces as an
131
- // unhandled one against a participant already gone.
132
- return document;
133
- }
134
- this.openUris.add(args.uri);
135
- return document;
136
- }
137
- finally {
138
- await this.finishOpening(args.uri, server);
139
- }
147
+ openDocument(args) {
148
+ return this.trackOpen(args.uri, async () => {
149
+ const server = await this.connected();
150
+ return this.watchOpened(server, args.uri, await server.openModelDocument({ ...args, clientId: this.clientId }));
151
+ });
140
152
  }
141
- /** Join (or start) the in-flight group for `uri`, counting this call into it. */
142
- beginOpening(uri) {
143
- const opening = this.openingUris.get(uri) ?? { inFlight: 0, holdTaken: false };
144
- opening.inFlight += 1;
145
- this.openingUris.set(uri, opening);
146
- return opening;
153
+ /**
154
+ * Create a document that exists nowhere yet, open and watched for this
155
+ * session; it reaches disk with the first {@link saveDocument}. The server
156
+ * refuses a URI that exists on disk or that any client has open.
157
+ */
158
+ createDocument(args) {
159
+ return this.trackOpen(args.uri, async () => {
160
+ const server = await this.connected();
161
+ return this.watchOpened(server, args.uri, await server.createModelDocument({ ...args, clientId: this.clientId }));
162
+ });
147
163
  }
148
164
  /**
149
- * Count this call out of the in-flight group for `uri` and, if it was the
150
- * last one, answer for whatever hold the group took.
151
- *
152
- * The last call is the only one that can see the group's whole outcome, which
153
- * is what makes it the right one to decide. A hold that some open took and no
154
- * open claimed — `openUris` is the claim — belongs to nobody, and closing it
155
- * here is the only release that will ever be issued for it.
165
+ * Watch a document this session just opened, and record it as open. A
166
+ * failed watch closes it again: the caller sees a failed open and so would
167
+ * never close it.
156
168
  */
157
- async finishOpening(uri, server) {
158
- const opening = this.openingUris.get(uri);
159
- if (opening === undefined) {
160
- return;
161
- }
162
- opening.inFlight -= 1;
163
- if (opening.inFlight > 0) {
164
- return;
169
+ async watchOpened(server, uri, document) {
170
+ try {
171
+ await server.watchModelDocument({ uri, clientId: this.clientId });
165
172
  }
166
- this.openingUris.delete(uri);
167
- // `detached` means the wire is going away and the server's connection-close
168
- // cleanup owns the release, so a close here would travel over a connection
169
- // that is already leaving. A claimed URI is one an open is keeping.
170
- if (!opening.holdTaken || this.detached || this.openUris.has(uri)) {
171
- return;
173
+ catch (error) {
174
+ await server.closeModelDocument({ uri, clientId: this.clientId }).catch(() => undefined);
175
+ throw error;
172
176
  }
173
- await server.closeModelDocument({ uri, clientId: this.clientId }).catch(() => {
174
- // Hand it to `dispose` while there is still a `dispose` to come. Once
175
- // that has run it has already drained `openUris` and will not read it
176
- // again, so tracking would read as handled while nothing released it —
177
- // there the host is the owner, being the one thing that outlives this
178
- // session and can still reach the server.
179
- if (this.disposed) {
180
- this.host.orphanHold?.(uri, this.clientId);
181
- }
182
- else {
183
- this.openUris.add(uri);
184
- }
185
- });
177
+ this.openUris.add(uri);
178
+ return document;
186
179
  }
187
180
  /**
188
- * Close `args.uri`. The server unwatches implicitly, so this is the dual of
189
- * {@link openDocument} and needs no separate unwatch.
181
+ * Close `args.uri`, once this session's calls on it have settled or
182
+ * {@link settleBeforeCloseMs} has passed. The server unwatches implicitly,
183
+ * so this is the dual of {@link openDocument} and needs no separate unwatch.
190
184
  */
191
185
  async closeDocument(args) {
186
+ this.assertLive();
187
+ await this.settle(this.inFlight.get(args.uri));
188
+ // Forgotten before the close is sent, so a reconnect in between does not
189
+ // re-open a document the caller has closed; after the wait, so an open
190
+ // of it that was still in flight does not record it again.
191
+ this.openUris.delete(args.uri);
192
+ this.unsavedWrites.delete(args.uri);
192
193
  const server = await this.connected();
193
194
  await server.closeModelDocument({ ...args, clientId: this.clientId });
194
- // Untracked only once the close has actually landed. Dropping it first
195
- // gives a FAILED close the same effect as a successful one: the hold
196
- // survives on the server and `dispose` no longer knows to retry it.
197
- // A `dispose` racing this therefore closes the same URI twice, which the
198
- // server answers as a no-op for a client that no longer holds it.
199
- this.openUris.delete(args.uri);
200
195
  }
201
- /** Write `args.model` back as this session. */
202
- async updateDocument(args) {
203
- const server = await this.connected();
204
- return server.updateModelDocument({ ...args, clientId: this.clientId });
196
+ /**
197
+ * Open `args.uri`, run `fn` with the opened snapshot, and close it once
198
+ * `fn` settles, whether it returned or threw. A URI this session already
199
+ * had open, or is still opening through another call, stays open: the close
200
+ * undoes only the open this call made.
201
+ */
202
+ async withOpenDocument(args, fn) {
203
+ const alreadyOpen = this.openUris.has(args.uri) || this.openingUris.has(args.uri);
204
+ const document = await this.openDocument(args);
205
+ try {
206
+ return await fn(document);
207
+ }
208
+ finally {
209
+ if (!alreadyOpen && !this.disposed) {
210
+ await this.closeDocument({ uri: args.uri });
211
+ }
212
+ }
205
213
  }
206
- /** Persist `args.model` to disk as this session. */
207
- async saveDocument(args) {
208
- const server = await this.connected();
209
- return server.saveModelDocument({ ...args, clientId: this.clientId });
214
+ /** Write `args.model` back as this session. The session must have `args.uri` open. */
215
+ updateDocument(args) {
216
+ return this.track([args.uri], async () => {
217
+ const server = await this.connected();
218
+ const document = await server.updateModelDocument({ ...args, clientId: this.clientId });
219
+ this.unsavedWrites.set(args.uri, document.version);
220
+ return document;
221
+ });
222
+ }
223
+ /**
224
+ * Write several documents this session has open, all or none: the server
225
+ * refuses the whole set, before any text applies, when one is stale or not
226
+ * open. Resolves to the documents in the order given.
227
+ */
228
+ updateDocuments(args) {
229
+ return this.track(args.updates.map(update => update.uri), async () => {
230
+ const server = await this.connected();
231
+ const documents = await server.updateModelDocuments({ ...args, clientId: this.clientId });
232
+ args.updates.forEach((update, i) => this.unsavedWrites.set(update.uri, documents[i].version));
233
+ return documents;
234
+ });
235
+ }
236
+ /** Persist `args.model` to disk as this session. The session must have `args.uri` open. */
237
+ saveDocument(args) {
238
+ return this.track([args.uri], async () => {
239
+ const server = await this.connected();
240
+ const document = await server.saveModelDocument({ ...args, clientId: this.clientId });
241
+ this.unsavedWrites.delete(args.uri);
242
+ return document;
243
+ });
210
244
  }
211
245
  /**
212
246
  * Whether `sourceClientId` identifies this session's own write.
@@ -219,40 +253,150 @@ class DataSession {
219
253
  return sourceClientId === this.clientId;
220
254
  }
221
255
  /**
222
- * Release this session's holds and detach it from the connection.
223
- * Idempotent, and leaves the connection usable by its other sessions.
256
+ * End the session: detach it from the connection at once, and once its
257
+ * calls in flight have settled or {@link settleBeforeCloseMs} has passed,
258
+ * end it on the server, which closes everything it has open. Idempotent,
259
+ * and leaves the connection usable by its other sessions.
224
260
  *
225
- * The closes are fired without being awaited, because a `Disposable` cannot
226
- * be: a host disposing a widget has nowhere to put the promise. A close
227
- * that fails is no worse than the leak this exists to prevent, so the
228
- * rejection is swallowed rather than surfaced from a teardown.
261
+ * Every later call rejects. The server close is not awaited, because a
262
+ * `Disposable` cannot be; a close that fails leaves the session to the
263
+ * server's connection-close cleanup.
229
264
  */
230
265
  dispose() {
231
266
  if (this.disposed) {
232
267
  return;
233
268
  }
234
269
  this.disposed = true;
235
- const uris = [...this.openUris];
236
- this.openUris.clear();
237
270
  this.host.releaseSession(this);
238
- for (const uri of uris) {
239
- void this.host
240
- .connected()
241
- .then(server => server.closeModelDocument({ uri, clientId: this.clientId }))
242
- .catch(() => undefined);
243
- }
271
+ const pending = [...this.inFlight.values()].flatMap(calls => [...calls]);
272
+ void (async () => {
273
+ await this.settle(pending);
274
+ await this.registration;
275
+ // The proxy the session registered on, never a fresh connection: a
276
+ // connection that dropped already ended the session on the server.
277
+ if (!this.detached && this.registeredOn) {
278
+ await this.registeredOn.closeSession({ clientId: this.clientId });
279
+ }
280
+ })().catch(() => undefined);
244
281
  }
245
282
  /**
246
283
  * Come off the connection because it is going away.
247
284
  *
248
- * Sends no close, unlike {@link dispose}: the server releases every hold on
249
- * a connection it sees close, and the close would travel over the very
285
+ * Sends nothing, unlike {@link dispose}: the server ends every session on a
286
+ * connection it sees close, and the close would travel over the very
250
287
  * connection being disposed.
251
288
  */
252
289
  detach() {
253
290
  this.disposed = true;
254
291
  this.detached = true;
255
292
  this.openUris.clear();
293
+ this.unsavedWrites.clear();
294
+ }
295
+ /**
296
+ * Register again and restore now, after the connection dropped, instead of
297
+ * on the next call. A no-op for a session with nothing open, which the next
298
+ * call restores anyway. A failure is left to that next call, which meets it
299
+ * again.
300
+ */
301
+ reconnect() {
302
+ if (!this.disposed && this.openUris.size > 0) {
303
+ this.connected().catch(() => undefined);
304
+ }
305
+ }
306
+ /**
307
+ * Register on `server`, and after a reconnect restore what the ended session
308
+ * had. Calls issued meanwhile wait for this.
309
+ */
310
+ async register(server, reconnected) {
311
+ await server.createSession({ clientId: this.clientId, label: this.label, resumeToken: this.resumeToken });
312
+ if (reconnected) {
313
+ await this.restore(server);
314
+ }
315
+ }
316
+ /**
317
+ * Re-open and re-watch every document the session had open, and tell the
318
+ * host which of them lost what the session wrote since their last save.
319
+ *
320
+ * The unsaved text is not sent again. A document whose re-opened version is
321
+ * the one the session's last write was answered with still holds that
322
+ * write. Any other version means the text changed after that write:
323
+ * another client edited it, even while the session was still connected;
324
+ * the server reverted it to disk when the session's open closed as the
325
+ * document's last; or the server restarted and numbers versions afresh.
326
+ * Re-sending based on the write's own version then always conflicts, and
327
+ * based on the re-opened version it would overwrite whatever changed, so
328
+ * neither is done.
329
+ *
330
+ * No caller is waiting, so both outcomes go through the host: one report
331
+ * naming every document whose unsaved text is gone, whose record is then
332
+ * dropped, and one per document that could not be re-opened, which is
333
+ * forgotten.
334
+ */
335
+ async restore(server) {
336
+ const lost = [];
337
+ for (const uri of [...this.openUris]) {
338
+ try {
339
+ const document = await server.openModelDocument({ uri, clientId: this.clientId });
340
+ await server.watchModelDocument({ uri, clientId: this.clientId });
341
+ const written = this.unsavedWrites.get(uri);
342
+ if (written !== undefined && written !== document.version) {
343
+ lost.push(uri);
344
+ this.unsavedWrites.delete(uri);
345
+ }
346
+ }
347
+ catch (error) {
348
+ this.openUris.delete(uri);
349
+ this.unsavedWrites.delete(uri);
350
+ this.host.reportError?.(error, (0, primitives_1.resolve)(exports.DATA_SESSION_RESTORE_FAILED, { uri, detail: (0, primitives_1.describeError)(error) }));
351
+ }
352
+ }
353
+ if (lost.length > 0) {
354
+ const reported = (0, primitives_1.resolve)(exports.DATA_SESSION_UNSAVED_LOST, { uris: lost.join(', ') });
355
+ this.host.reportError?.(new Error(reported.text), reported);
356
+ }
357
+ }
358
+ /** Run `call`, counted as in flight on each of `uris` until it settles. */
359
+ track(uris, call) {
360
+ const running = call();
361
+ for (const uri of uris) {
362
+ this.inFlight.set(uri, (this.inFlight.get(uri) ?? new Set()).add(running));
363
+ }
364
+ const done = () => uris.forEach(uri => this.inFlight.get(uri)?.delete(running));
365
+ running.then(done, done);
366
+ return running;
367
+ }
368
+ /** {@link track} an open of `uri`, counted in {@link openingUris} until it settles. */
369
+ trackOpen(uri, call) {
370
+ this.openingUris.set(uri, (this.openingUris.get(uri) ?? 0) + 1);
371
+ const done = () => {
372
+ const remaining = (this.openingUris.get(uri) ?? 1) - 1;
373
+ if (remaining > 0) {
374
+ this.openingUris.set(uri, remaining);
375
+ }
376
+ else {
377
+ this.openingUris.delete(uri);
378
+ }
379
+ };
380
+ const running = this.track([uri], call);
381
+ running.then(done, done);
382
+ return running;
383
+ }
384
+ /** Wait until `calls` have settled, or {@link settleBeforeCloseMs} has passed. */
385
+ async settle(calls) {
386
+ const pending = [...(calls ?? [])];
387
+ if (pending.length === 0) {
388
+ return;
389
+ }
390
+ let timer;
391
+ const bound = new Promise(resolveBound => {
392
+ timer = setTimeout(resolveBound, this.settleBeforeCloseMs);
393
+ });
394
+ try {
395
+ await Promise.race([Promise.allSettled(pending), bound]);
396
+ }
397
+ finally {
398
+ clearTimeout(timer);
399
+ }
256
400
  }
257
401
  assertLive() {
258
402
  if (this.disposed) {
@@ -1 +1 @@
1
- {"version":3,"file":"data-session.js","sourceRoot":"","sources":["../../src/client/data-session.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAwFlF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,WAAW;IAwBT;IACU;IArBtB,kFAAkF;IAC/D,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IAChD;;;;;;;OAOG;IACgB,WAAW,GAAG,IAAI,GAAG,EAA2B,CAAC;IAC1D,QAAQ,GAAG,KAAK,CAAC;IAC3B;;;;OAIG;IACO,QAAQ,GAAG,KAAK,CAAC;IAE3B,YACY,QAAgB,EACN,IAAyC;QADnD,aAAQ,GAAR,QAAQ,CAAQ;QACN,SAAI,GAAJ,IAAI,CAAqC;IAC5D,CAAC;IAEJ;;;;OAIG;IACH,KAAK,CAAC,SAAS;QACZ,6DAA6D;QAC7D,wEAAwE;QACxE,kEAAkE;QAClE,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,KAAK,CAAC,YAAY,CAAC,IAA6C;QAC7D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtF,qEAAqE;YACrE,wDAAw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C,YAAY,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QACH,IAAI,CAAC;YACF,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAC5D,CAAC;gBAAS,CAAC;YACR,YAAY,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACJ,CAAC;IAES,UAAU;QACjB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC9C,CAAC;IACJ,CAAC;CACH;AApXD,kCAoXC"}
@@ -7,7 +7,7 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  /** Request-method names on {@link DocumentServerProtocol}. */
10
- export declare const DOCUMENT_SERVER_PROTOCOL_METHODS: readonly ["openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady"];
10
+ export declare const DOCUMENT_SERVER_PROTOCOL_METHODS: readonly ["createSession", "closeSession", "createModelDocument", "updateModelDocuments", "openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady"];
11
11
  /** Request-method names on {@link ProjectServerProtocol}. */
12
12
  export declare const PROJECT_SERVER_PROTOCOL_METHODS: readonly ["getProjects", "getProjectForUri"];
13
13
  /**
@@ -16,7 +16,7 @@ export declare const PROJECT_SERVER_PROTOCOL_METHODS: readonly ["getProjects", "
16
16
  * constraint makes the array typed against the interface — stale names (typos,
17
17
  * renamed methods) fail to typecheck.
18
18
  */
19
- export declare const DATA_SERVER_PROTOCOL_METHODS: readonly ["openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady", "getProjects", "getProjectForUri"];
19
+ export declare const DATA_SERVER_PROTOCOL_METHODS: readonly ["createSession", "closeSession", "createModelDocument", "updateModelDocuments", "openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady", "getProjects", "getProjectForUri"];
20
20
  /**
21
21
  * Request-method names on {@link ReferenceServerProtocol}. NOT part of
22
22
  * {@link DATA_SERVER_PROTOCOL_METHODS} — adopters that compose the reference
@@ -1 +1 @@
1
- {"version":3,"file":"data-protocol-methods.d.ts","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,oLAS6C,CAAC;AAE3F,6DAA6D;AAC7D,eAAO,MAAM,+BAA+B,8CAE3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,uNAG6C,CAAC;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,0EAI6C,CAAC;AAE5F,mEAAmE;AACnE,eAAO,MAAM,gCAAgC,4FAK6C,CAAC;AAE3F,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,gCAA+F,CAAC;AAE5I;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,iHAG6C,CAAC"}
1
+ {"version":3,"file":"data-protocol-methods.d.ts","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,oQAa6C,CAAC;AAE3F,6DAA6D;AAC7D,eAAO,MAAM,+BAA+B,8CAE3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,uSAG6C,CAAC;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,0EAI6C,CAAC;AAE5F,mEAAmE;AACnE,eAAO,MAAM,gCAAgC,4FAK6C,CAAC;AAE3F,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,gCAA+F,CAAC;AAE5I;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,iHAG6C,CAAC"}
@@ -11,6 +11,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.DATA_CLIENT_PROTOCOL_METHODS = exports.PROJECT_CLIENT_PROTOCOL_METHODS = exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = exports.REFERENCE_SERVER_PROTOCOL_METHODS = exports.DATA_SERVER_PROTOCOL_METHODS = exports.PROJECT_SERVER_PROTOCOL_METHODS = exports.DOCUMENT_SERVER_PROTOCOL_METHODS = void 0;
12
12
  /** Request-method names on {@link DocumentServerProtocol}. */
13
13
  exports.DOCUMENT_SERVER_PROTOCOL_METHODS = [
14
+ 'createSession',
15
+ 'closeSession',
16
+ 'createModelDocument',
17
+ 'updateModelDocuments',
14
18
  'openModelDocument',
15
19
  'closeModelDocument',
16
20
  'getModelDocument',
@@ -1 +1 @@
1
- {"version":3,"file":"data-protocol-methods.js","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAalF,8DAA8D;AACjD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,cAAc;CACyE,CAAC;AAE3F,6DAA6D;AAChD,QAAA,+BAA+B,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAEhF,CAAC;AAEF;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC;AAEvF;;;;;GAKG;AACU,QAAA,iCAAiC,GAAG;IAC9C,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CAC0E,CAAC;AAE5F,mEAAmE;AACtD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,iBAAiB;IACjB,mBAAmB;IACnB,kBAAkB;CACqE,CAAC;AAE3F,kEAAkE;AACrD,QAAA,+BAA+B,GAAG,CAAC,mBAAmB,CAAwE,CAAC;AAE5I;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC"}
1
+ {"version":3,"file":"data-protocol-methods.js","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAalF,8DAA8D;AACjD,QAAA,gCAAgC,GAAG;IAC7C,eAAe;IACf,cAAc;IACd,qBAAqB;IACrB,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,cAAc;CACyE,CAAC;AAE3F,6DAA6D;AAChD,QAAA,+BAA+B,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAEhF,CAAC;AAEF;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC;AAEvF;;;;;GAKG;AACU,QAAA,iCAAiC,GAAG;IAC9C,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CAC0E,CAAC;AAE5F,mEAAmE;AACtD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,iBAAiB;IACjB,mBAAmB;IACnB,kBAAkB;CACqE,CAAC;AAE3F,kEAAkE;AACrD,QAAA,+BAA+B,GAAG,CAAC,mBAAmB,CAAwE,CAAC;AAE5I;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC"}