@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.
- package/lib/client/data-connection.d.ts +28 -66
- package/lib/client/data-connection.d.ts.map +1 -1
- package/lib/client/data-connection.js +41 -112
- package/lib/client/data-connection.js.map +1 -1
- package/lib/client/data-session.d.ts +168 -93
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +291 -147
- package/lib/client/data-session.js.map +1 -1
- package/lib/data/data-protocol-methods.d.ts +2 -2
- package/lib/data/data-protocol-methods.d.ts.map +1 -1
- package/lib/data/data-protocol-methods.js +4 -0
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +66 -30
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/requests.d.ts +67 -11
- package/lib/data/requests.d.ts.map +1 -1
- package/lib/errors.d.ts +66 -4
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +96 -5
- package/lib/errors.js.map +1 -1
- package/lib/messages/index.d.ts +1 -0
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +4 -1
- package/lib/messages/index.js.map +1 -1
- package/lib/model-server.d.ts +13 -1
- package/lib/model-server.d.ts.map +1 -1
- package/lib/model-server.js.map +1 -1
- package/lib/model-service/based-on.d.ts +2 -0
- package/lib/model-service/based-on.d.ts.map +1 -1
- package/lib/model-service/based-on.js +3 -0
- package/lib/model-service/based-on.js.map +1 -1
- package/lib/model-service/index.d.ts +0 -1
- package/lib/model-service/index.d.ts.map +1 -1
- package/lib/model-service/index.js +3 -5
- package/lib/model-service/index.js.map +1 -1
- package/lib/patch-merge.d.ts +28 -27
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +66 -22
- package/lib/patch-merge.js.map +1 -1
- package/lib/transfer-document.d.ts +2 -3
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js.map +1 -1
- package/package.json +1 -1
- package/src/client/data-connection.ts +69 -119
- package/src/client/data-session.ts +348 -177
- package/src/data/data-protocol-methods.ts +4 -0
- package/src/data/data-server-protocol.ts +74 -30
- package/src/data/requests.ts +71 -11
- package/src/errors.ts +101 -4
- package/src/messages/index.ts +1 -0
- package/src/model-server.ts +13 -5
- package/src/model-service/based-on.ts +3 -0
- package/src/model-service/index.ts +3 -5
- package/src/patch-merge.ts +90 -37
- package/src/transfer-document.ts +2 -3
- package/lib/model-service/args.d.ts +0 -65
- package/lib/model-service/args.d.ts.map +0 -1
- package/lib/model-service/args.js +0 -11
- package/lib/model-service/args.js.map +0 -1
- package/src/model-service/args.ts +0 -69
|
@@ -7,9 +7,26 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import type { DataServerProtocol, DiagnosticOf } from '../data';
|
|
10
|
+
import type { SnapshotVersion } from '../model-service/based-on';
|
|
11
|
+
import { type ResolvedMessage } from '../messages/primitives';
|
|
12
|
+
import type { OpenModelArgs } from '../model-server';
|
|
13
|
+
import type { MaybePromise } from '../util';
|
|
10
14
|
import type { RpcProxy } from '../rpc';
|
|
11
15
|
import type { TransferDocument } from '../transfer-document';
|
|
12
16
|
import type { TransferElement } from '../transfer-element';
|
|
17
|
+
/**
|
|
18
|
+
* A session could not re-open a document it had open after its connection
|
|
19
|
+
* dropped.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DATA_SESSION_RESTORE_FAILED: import("../messages/primitives").MessageDefinition<"Could not restore {uri} after reconnecting to the data server: {detail}">;
|
|
22
|
+
/**
|
|
23
|
+
* A session re-opened documents after its connection dropped whose version had
|
|
24
|
+
* moved on since the session's last unsaved write to them: another client
|
|
25
|
+
* edited them, even while the session was still connected, the server reverted
|
|
26
|
+
* them to what is on disk, or the server restarted. The session's unsaved edits
|
|
27
|
+
* may be gone.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DATA_SESSION_UNSAVED_LOST: import("../messages/primitives").MessageDefinition<"Unsaved changes to {uris} may have been lost when the connection to the data server dropped.">;
|
|
13
30
|
/**
|
|
14
31
|
* What one of `TServer`'s document methods takes, minus the `clientId` a
|
|
15
32
|
* {@link DataSession} stamps itself.
|
|
@@ -20,30 +37,25 @@ import type { TransferElement } from '../transfer-element';
|
|
|
20
37
|
* cannot go through a session at all.
|
|
21
38
|
*/
|
|
22
39
|
export type DataSessionArgs<TMethod extends (args: never) => unknown> = Omit<Parameters<TMethod>[0], 'clientId'>;
|
|
23
|
-
/**
|
|
24
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Open a document through a session; the session supplies `clientId`. Only the
|
|
42
|
+
* URI and the open's options: a session's open reads the file, and the server
|
|
43
|
+
* ignores the `languageId`, `version` and `text` seeds of `OpenModelArgs`, so
|
|
44
|
+
* accepting them here would let a caller believe they took effect.
|
|
45
|
+
*/
|
|
46
|
+
export type DataSessionOpenArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = Pick<OpenModelArgs, 'uri' | 'options'>;
|
|
47
|
+
/** Create a document through a session; the session supplies `clientId`. */
|
|
48
|
+
export type DataSessionCreateArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['createModelDocument']>;
|
|
25
49
|
/** Close a document through a session; the session supplies `clientId`. */
|
|
26
50
|
export type DataSessionCloseArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['closeModelDocument']>;
|
|
27
51
|
/** Update a document through a session; the session supplies `clientId`. */
|
|
28
52
|
export type DataSessionUpdateArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['updateModelDocument']>;
|
|
53
|
+
/** Update several documents at once through a session; the session supplies `clientId`. */
|
|
54
|
+
export type DataSessionUpdatesArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['updateModelDocuments']>;
|
|
29
55
|
/** Persist a document through a session; the session supplies `clientId`. */
|
|
30
56
|
export type DataSessionSaveArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['saveModelDocument']>;
|
|
31
57
|
/** The document a session hands back, carrying its server's diagnostic shape. */
|
|
32
58
|
export type DataSessionDocument<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = TransferDocument<TTransfer, DiagnosticOf<TServer>>;
|
|
33
|
-
/**
|
|
34
|
-
* The {@link DataSession.openDocument} calls running against one URI, and
|
|
35
|
-
* whether any of them has taken a server hold that no open has claimed yet.
|
|
36
|
-
*
|
|
37
|
-
* One record per URI rather than per call, because the hold is per
|
|
38
|
-
* `(uri, clientId)`: the server has one, however many opens are in flight, so
|
|
39
|
-
* one flag is the accurate model of it.
|
|
40
|
-
*/
|
|
41
|
-
export interface OpeningDocument {
|
|
42
|
-
/** Opens still running for this URI. The last one out answers for the hold. */
|
|
43
|
-
inFlight: number;
|
|
44
|
-
/** An open succeeded, and no open has since claimed the hold via `openUris`. */
|
|
45
|
-
holdTaken: boolean;
|
|
46
|
-
}
|
|
47
59
|
/**
|
|
48
60
|
* What a {@link DataSession} needs from the connection that minted it.
|
|
49
61
|
*
|
|
@@ -51,35 +63,41 @@ export interface OpeningDocument {
|
|
|
51
63
|
* `DataConnection` constructs sessions, and nothing here imports it back.
|
|
52
64
|
*/
|
|
53
65
|
export interface DataSessionHost<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>>> {
|
|
66
|
+
/** The connected, READY proxy of the current connection; a new object after each reconnect. */
|
|
54
67
|
connected(): Promise<RpcProxy<TServer>>;
|
|
55
68
|
releaseSession(session: DataSession<TTransfer, TServer>): void;
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
* retried while the wire is still up.
|
|
59
|
-
*
|
|
60
|
-
* A session that has been disposed has already drained and will not read its
|
|
61
|
-
* own tracking again, so a close it issues and the server refuses leaves the
|
|
62
|
-
* hold with nobody to answer for it. The host outlives every session it
|
|
63
|
-
* mints, which is what makes it the one thing that still can.
|
|
64
|
-
*
|
|
65
|
-
* Optional so a host predating it keeps working; without it such a hold falls
|
|
66
|
-
* to the server's connection-close cleanup, which on a shared connection is
|
|
67
|
-
* as long as every other participant's session.
|
|
68
|
-
*/
|
|
69
|
-
orphanHold?(uri: string, clientId: string): void;
|
|
69
|
+
/** Surface a failure no caller is waiting on, such as restoring a document after a reconnect. */
|
|
70
|
+
reportError?(error: unknown, reported: ResolvedMessage): void;
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
73
|
+
* Builds the session `DataConnection.createSession` hands out, for an adopter
|
|
74
|
+
* that extends {@link DataSession}. The connection has minted `clientId` and
|
|
75
|
+
* checked it by then.
|
|
76
|
+
*/
|
|
77
|
+
export type DataSessionFactory<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>>> = (clientId: string, host: DataSessionHost<TTransfer, TServer>, label: string) => DataSession<TTransfer, TServer>;
|
|
78
|
+
/**
|
|
79
|
+
* One participant on a data connection: a properties panel, a tree, a form
|
|
80
|
+
* editor. The client side of a server client session, registered over the
|
|
81
|
+
* wire under {@link clientId}.
|
|
74
82
|
*
|
|
75
|
-
* The
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* distinguish each other's writes from their own echoes.
|
|
83
|
+
* The session writes only what it has open: the server refuses its update or
|
|
84
|
+
* save of a document it has not opened with a `DocumentNotOpenError` code.
|
|
85
|
+
* Every call waits for the registration, so the first can be issued at once.
|
|
79
86
|
*
|
|
80
87
|
* Every document operation stamps {@link clientId} itself. A caller that
|
|
81
88
|
* passed its own could pass another participant's, and the server would
|
|
82
|
-
* attribute the write and
|
|
89
|
+
* attribute the write and close the document accordingly.
|
|
90
|
+
*
|
|
91
|
+
* {@link closeDocument} and {@link dispose} first wait, up to
|
|
92
|
+
* {@link settleBeforeCloseMs}, for this session's calls still in flight on the
|
|
93
|
+
* URI, or on any URI for `dispose`: a save sent just before its close would
|
|
94
|
+
* otherwise reach the server after it, and fail as not open.
|
|
95
|
+
*
|
|
96
|
+
* After the connection drops, the session registers again under the same id,
|
|
97
|
+
* re-opens and re-watches what it had open, and reports the documents whose
|
|
98
|
+
* unsaved edits did not survive; see {@link restore}. The connection does this at
|
|
99
|
+
* once for a session with documents open, and any session's next call does it
|
|
100
|
+
* too.
|
|
83
101
|
*
|
|
84
102
|
* Generic over the transfer root so this file names no grammar.
|
|
85
103
|
*
|
|
@@ -93,29 +111,52 @@ export interface DataSessionHost<TTransfer extends TransferElement, TServer exte
|
|
|
93
111
|
export declare class DataSession<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> {
|
|
94
112
|
readonly clientId: string;
|
|
95
113
|
protected readonly host: DataSessionHost<TTransfer, TServer>;
|
|
96
|
-
|
|
114
|
+
readonly label: string;
|
|
115
|
+
/**
|
|
116
|
+
* How long {@link closeDocument} and {@link dispose} wait for this session's
|
|
117
|
+
* calls in flight before closing anyway. Long, because the wait only runs
|
|
118
|
+
* out when a call hangs, and a close sent while a save is still running
|
|
119
|
+
* fails that save.
|
|
120
|
+
*/
|
|
121
|
+
protected readonly settleBeforeCloseMs: number;
|
|
122
|
+
/** URIs this session has open, re-opened after a reconnect. */
|
|
97
123
|
protected readonly openUris: Set<string>;
|
|
98
124
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* once an open has fully returned — so overlapping opens of one URI all read
|
|
103
|
-
* it as unheld and all believe the hold is theirs to release. Tracking the
|
|
104
|
-
* group lets the last of them answer for it once, knowing what the rest did.
|
|
125
|
+
* Per URI, how many opens of it this session has under way. Such a URI
|
|
126
|
+
* counts as open for {@link withOpenDocument}, which would otherwise close
|
|
127
|
+
* it under the open that is still being made.
|
|
105
128
|
*/
|
|
106
|
-
protected readonly openingUris: Map<string,
|
|
129
|
+
protected readonly openingUris: Map<string, number>;
|
|
130
|
+
/**
|
|
131
|
+
* Per URI written since its last save, the version the server answered this
|
|
132
|
+
* session's last write with; see {@link restore}.
|
|
133
|
+
*/
|
|
134
|
+
protected readonly unsavedWrites: Map<string, SnapshotVersion>;
|
|
135
|
+
/** Per URI, this session's calls still in flight on it, which a close waits for. */
|
|
136
|
+
protected readonly inFlight: Map<string, Set<Promise<unknown>>>;
|
|
137
|
+
/**
|
|
138
|
+
* Sent with every registration, so the server lets this session register
|
|
139
|
+
* its id again while the dropped connection's session is still live there:
|
|
140
|
+
* a server that has not yet noticed the drop would otherwise refuse the id
|
|
141
|
+
* as a duplicate until it does.
|
|
142
|
+
*/
|
|
143
|
+
protected readonly resumeToken: string;
|
|
144
|
+
/** The proxy the session is registered on; another one means the connection was replaced. */
|
|
145
|
+
protected registeredOn?: RpcProxy<TServer>;
|
|
146
|
+
protected registration?: Promise<void>;
|
|
107
147
|
protected disposed: boolean;
|
|
108
148
|
/**
|
|
109
149
|
* Disposed through {@link detach} rather than {@link dispose}, so nothing may
|
|
110
|
-
* be sent. Folding it into {@link disposed}
|
|
111
|
-
*
|
|
150
|
+
* be sent. Folding it into {@link disposed} would send the session's close
|
|
151
|
+
* over a connection that is going away.
|
|
112
152
|
*/
|
|
113
153
|
protected detached: boolean;
|
|
114
|
-
constructor(clientId: string, host: DataSessionHost<TTransfer, TServer
|
|
154
|
+
constructor(clientId: string, host: DataSessionHost<TTransfer, TServer>, label: string);
|
|
115
155
|
/**
|
|
116
|
-
* The connected, READY server proxy
|
|
117
|
-
*
|
|
118
|
-
*
|
|
156
|
+
* The connected, READY server proxy once this session is registered on it,
|
|
157
|
+
* for protocol methods this session does not wrap. The proxy stamps
|
|
158
|
+
* nothing: pass this session's {@link clientId} to any method that carries
|
|
159
|
+
* one.
|
|
119
160
|
*/
|
|
120
161
|
connected(): Promise<RpcProxy<TServer>>;
|
|
121
162
|
/**
|
|
@@ -128,53 +169,48 @@ export declare class DataSession<TTransfer extends TransferElement, TServer exte
|
|
|
128
169
|
* baseline, and the first phase event after the open arrives as a spurious
|
|
129
170
|
* `'changed'` — which a widget that resets its in-memory root to the server
|
|
130
171
|
* view misreads as a concurrent third-party write, losing whatever the user
|
|
131
|
-
* had typed.
|
|
132
|
-
* here rather than documented and re-derived.
|
|
172
|
+
* had typed.
|
|
133
173
|
*
|
|
134
174
|
* Note that the returned snapshot's empty `diagnostics` does not mean
|
|
135
175
|
* valid: `open` settles at the integrity landmark, not at validation.
|
|
136
176
|
* Validity arrives asynchronously on `onDocumentUpdated`, or synchronously
|
|
137
177
|
* from `getModelDocument({ includeDiagnostics: true })`.
|
|
138
|
-
*
|
|
139
|
-
* A dispose landing between the two awaits is handled here rather than in
|
|
140
|
-
* {@link dispose}, which cannot release a hold that does not exist yet: it
|
|
141
|
-
* reads {@link openUris}, and this method fills it only once both calls have
|
|
142
|
-
* returned. Left to `dispose`, the hold and its watch outlive the participant
|
|
143
|
-
* and go only when the connection closes.
|
|
144
|
-
*
|
|
145
|
-
* A watch that REJECTS is the same problem arriving by a different door: the
|
|
146
|
-
* open already took a hold, and the caller sees only a failed open, so
|
|
147
|
-
* nothing on its side will ever issue the close.
|
|
148
|
-
*
|
|
149
|
-
* Which call releases it is decided by {@link finishOpening} rather than by
|
|
150
|
-
* the one that failed, because a hold is per `(uri, clientId)` and any number
|
|
151
|
-
* of this session's opens share it. A failing open that closed on its own
|
|
152
|
-
* behalf would revoke a peer's; one that deferred to a peer would leak the
|
|
153
|
-
* hold whenever that peer fails at its OWN open, having then taken no hold to
|
|
154
|
-
* roll back and having no rollback path to run. Making the last open for the
|
|
155
|
-
* URI answer for it is the only rule that holds in both directions.
|
|
156
178
|
*/
|
|
157
179
|
openDocument(args: DataSessionOpenArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
158
|
-
/** Join (or start) the in-flight group for `uri`, counting this call into it. */
|
|
159
|
-
protected beginOpening(uri: string): OpeningDocument;
|
|
160
180
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
*
|
|
181
|
+
* Create a document that exists nowhere yet, open and watched for this
|
|
182
|
+
* session; it reaches disk with the first {@link saveDocument}. The server
|
|
183
|
+
* refuses a URI that exists on disk or that any client has open.
|
|
184
|
+
*/
|
|
185
|
+
createDocument(args: DataSessionCreateArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
186
|
+
/**
|
|
187
|
+
* Watch a document this session just opened, and record it as open. A
|
|
188
|
+
* failed watch closes it again: the caller sees a failed open and so would
|
|
189
|
+
* never close it.
|
|
168
190
|
*/
|
|
169
|
-
protected
|
|
191
|
+
protected watchOpened(server: RpcProxy<TServer>, uri: string, document: DataSessionDocument<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
170
192
|
/**
|
|
171
|
-
* Close `args.uri
|
|
172
|
-
* {@link
|
|
193
|
+
* Close `args.uri`, once this session's calls on it have settled or
|
|
194
|
+
* {@link settleBeforeCloseMs} has passed. The server unwatches implicitly,
|
|
195
|
+
* so this is the dual of {@link openDocument} and needs no separate unwatch.
|
|
173
196
|
*/
|
|
174
197
|
closeDocument(args: DataSessionCloseArgs<TTransfer, TServer>): Promise<void>;
|
|
175
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* Open `args.uri`, run `fn` with the opened snapshot, and close it once
|
|
200
|
+
* `fn` settles, whether it returned or threw. A URI this session already
|
|
201
|
+
* had open, or is still opening through another call, stays open: the close
|
|
202
|
+
* undoes only the open this call made.
|
|
203
|
+
*/
|
|
204
|
+
withOpenDocument<T>(args: DataSessionOpenArgs<TTransfer, TServer>, fn: (document: DataSessionDocument<TTransfer, TServer>) => MaybePromise<T>): Promise<T>;
|
|
205
|
+
/** Write `args.model` back as this session. The session must have `args.uri` open. */
|
|
176
206
|
updateDocument(args: DataSessionUpdateArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
177
|
-
/**
|
|
207
|
+
/**
|
|
208
|
+
* Write several documents this session has open, all or none: the server
|
|
209
|
+
* refuses the whole set, before any text applies, when one is stale or not
|
|
210
|
+
* open. Resolves to the documents in the order given.
|
|
211
|
+
*/
|
|
212
|
+
updateDocuments(args: DataSessionUpdatesArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>[]>;
|
|
213
|
+
/** Persist `args.model` to disk as this session. The session must have `args.uri` open. */
|
|
178
214
|
saveDocument(args: DataSessionSaveArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
179
215
|
/**
|
|
180
216
|
* Whether `sourceClientId` identifies this session's own write.
|
|
@@ -185,23 +221,62 @@ export declare class DataSession<TTransfer extends TransferElement, TServer exte
|
|
|
185
221
|
*/
|
|
186
222
|
isOwnEcho(sourceClientId: string): boolean;
|
|
187
223
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
224
|
+
* End the session: detach it from the connection at once, and once its
|
|
225
|
+
* calls in flight have settled or {@link settleBeforeCloseMs} has passed,
|
|
226
|
+
* end it on the server, which closes everything it has open. Idempotent,
|
|
227
|
+
* and leaves the connection usable by its other sessions.
|
|
190
228
|
*
|
|
191
|
-
* The
|
|
192
|
-
* be
|
|
193
|
-
*
|
|
194
|
-
* rejection is swallowed rather than surfaced from a teardown.
|
|
229
|
+
* Every later call rejects. The server close is not awaited, because a
|
|
230
|
+
* `Disposable` cannot be; a close that fails leaves the session to the
|
|
231
|
+
* server's connection-close cleanup.
|
|
195
232
|
*/
|
|
196
233
|
dispose(): void;
|
|
197
234
|
/**
|
|
198
235
|
* Come off the connection because it is going away.
|
|
199
236
|
*
|
|
200
|
-
* Sends
|
|
201
|
-
*
|
|
237
|
+
* Sends nothing, unlike {@link dispose}: the server ends every session on a
|
|
238
|
+
* connection it sees close, and the close would travel over the very
|
|
202
239
|
* connection being disposed.
|
|
203
240
|
*/
|
|
204
241
|
detach(): void;
|
|
242
|
+
/**
|
|
243
|
+
* Register again and restore now, after the connection dropped, instead of
|
|
244
|
+
* on the next call. A no-op for a session with nothing open, which the next
|
|
245
|
+
* call restores anyway. A failure is left to that next call, which meets it
|
|
246
|
+
* again.
|
|
247
|
+
*/
|
|
248
|
+
reconnect(): void;
|
|
249
|
+
/**
|
|
250
|
+
* Register on `server`, and after a reconnect restore what the ended session
|
|
251
|
+
* had. Calls issued meanwhile wait for this.
|
|
252
|
+
*/
|
|
253
|
+
protected register(server: RpcProxy<TServer>, reconnected: boolean): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* Re-open and re-watch every document the session had open, and tell the
|
|
256
|
+
* host which of them lost what the session wrote since their last save.
|
|
257
|
+
*
|
|
258
|
+
* The unsaved text is not sent again. A document whose re-opened version is
|
|
259
|
+
* the one the session's last write was answered with still holds that
|
|
260
|
+
* write. Any other version means the text changed after that write:
|
|
261
|
+
* another client edited it, even while the session was still connected;
|
|
262
|
+
* the server reverted it to disk when the session's open closed as the
|
|
263
|
+
* document's last; or the server restarted and numbers versions afresh.
|
|
264
|
+
* Re-sending based on the write's own version then always conflicts, and
|
|
265
|
+
* based on the re-opened version it would overwrite whatever changed, so
|
|
266
|
+
* neither is done.
|
|
267
|
+
*
|
|
268
|
+
* No caller is waiting, so both outcomes go through the host: one report
|
|
269
|
+
* naming every document whose unsaved text is gone, whose record is then
|
|
270
|
+
* dropped, and one per document that could not be re-opened, which is
|
|
271
|
+
* forgotten.
|
|
272
|
+
*/
|
|
273
|
+
protected restore(server: RpcProxy<TServer>): Promise<void>;
|
|
274
|
+
/** Run `call`, counted as in flight on each of `uris` until it settles. */
|
|
275
|
+
protected track<T>(uris: readonly string[], call: () => Promise<T>): Promise<T>;
|
|
276
|
+
/** {@link track} an open of `uri`, counted in {@link openingUris} until it settles. */
|
|
277
|
+
protected trackOpen<T>(uri: string, call: () => Promise<T>): Promise<T>;
|
|
278
|
+
/** Wait until `calls` have settled, or {@link settleBeforeCloseMs} has passed. */
|
|
279
|
+
protected settle(calls: Iterable<Promise<unknown>> | undefined): Promise<void>;
|
|
205
280
|
protected assertLive(): void;
|
|
206
281
|
}
|
|
207
282
|
//# sourceMappingURL=data-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-session.d.ts","sourceRoot":"","sources":["../../src/client/data-session.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAEjH
|
|
1
|
+
{"version":3,"file":"data-session.d.ts","sourceRoot":"","sources":["../../src/client/data-session.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,KAAK,eAAe,EAAyC,MAAM,wBAAwB,CAAC;AAC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