@hydranium/protocol 1.0.0-next.9 → 1.0.0-next.91
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 +35 -1
- package/lib/client/data-connection.d.ts +114 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +128 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +9 -1
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +14 -0
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +17 -22
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +95 -78
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +115 -108
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +10 -7
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +10 -7
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +8 -2
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +10 -4
- package/lib/client/message-relay.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +139 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +171 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/client-ids.d.ts +41 -0
- package/lib/client-ids.d.ts.map +1 -0
- package/lib/client-ids.js +44 -0
- package/lib/client-ids.js.map +1 -0
- 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 +6 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +35 -2
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +70 -3
- package/lib/data/events.d.ts.map +1 -1
- package/lib/errors.d.ts +28 -11
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +35 -17
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib/messages/index.d.ts +28 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +52 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/messages/primitives.d.ts +141 -0
- package/lib/messages/primitives.d.ts.map +1 -0
- package/lib/messages/primitives.js +138 -0
- package/lib/messages/primitives.js.map +1 -0
- package/lib/model-server.d.ts +27 -10
- package/lib/model-server.d.ts.map +1 -1
- package/lib/model-server.js +4 -2
- package/lib/model-server.js.map +1 -1
- package/lib/model-service/args.d.ts +14 -13
- package/lib/model-service/args.d.ts.map +1 -1
- package/lib/model-service/based-on.d.ts +55 -0
- package/lib/model-service/based-on.d.ts.map +1 -0
- package/lib/model-service/based-on.js +34 -0
- package/lib/model-service/based-on.js.map +1 -0
- package/lib/model-service/index.d.ts +1 -0
- package/lib/model-service/index.d.ts.map +1 -1
- package/lib/model-service/index.js +1 -0
- package/lib/model-service/index.js.map +1 -1
- package/lib/rpc/bind-rpc-methods.d.ts +29 -3
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +22 -3
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +7 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +6 -1
- package/lib/rpc/create-rpc-proxy.js.map +1 -1
- package/lib/testing/catalogue-audit.d.ts +80 -0
- package/lib/testing/catalogue-audit.d.ts.map +1 -0
- package/lib/testing/catalogue-audit.js +94 -0
- package/lib/testing/catalogue-audit.js.map +1 -0
- package/lib/testing/data-doubles.d.ts +11 -12
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +14 -5
- package/lib/testing/data-doubles.js.map +1 -1
- package/lib/testing/index.d.ts +1 -0
- package/lib/testing/index.d.ts.map +1 -1
- package/lib/testing/index.js +4 -1
- package/lib/testing/index.js.map +1 -1
- package/lib/transfer-diagnostic.d.ts +33 -0
- package/lib/transfer-diagnostic.d.ts.map +1 -1
- package/lib/transfer-diagnostic.js +23 -0
- package/lib/transfer-diagnostic.js.map +1 -1
- package/lib/transfer-document.d.ts +15 -5
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js +14 -1
- package/lib/transfer-document.js.map +1 -1
- package/package.json +11 -2
- package/src/client/data-connection.ts +181 -0
- package/src/client/data-events.ts +24 -1
- package/src/client/data-port.ts +17 -23
- package/src/client/data-session.ts +172 -131
- package/src/client/index.ts +10 -7
- package/src/client/message-relay.ts +28 -6
- package/src/client/rpc-connection.ts +230 -0
- package/src/client-ids.ts +45 -0
- package/src/data/data-protocol-methods.ts +6 -3
- package/src/data/data-server-protocol.ts +46 -2
- package/src/data/events.ts +74 -3
- package/src/errors.ts +41 -19
- package/src/index.ts +5 -0
- package/src/messages/index.ts +35 -0
- package/src/messages/primitives.ts +215 -0
- package/src/model-server.ts +30 -11
- package/src/model-service/args.ts +15 -13
- package/src/model-service/based-on.ts +60 -0
- package/src/model-service/index.ts +1 -0
- package/src/rpc/bind-rpc-methods.ts +49 -4
- package/src/rpc/create-rpc-proxy.ts +14 -1
- package/src/testing/catalogue-audit.ts +111 -0
- package/src/testing/data-doubles.ts +33 -17
- package/src/testing/index.ts +4 -1
- package/src/transfer-diagnostic.ts +40 -0
- package/src/transfer-document.ts +22 -6
|
@@ -6,84 +6,84 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import type {
|
|
10
|
-
import
|
|
11
|
-
import { type RpcProxy } from '../rpc';
|
|
9
|
+
import type { DataServerProtocol, DiagnosticOf } from '../data';
|
|
10
|
+
import type { RpcProxy } from '../rpc';
|
|
12
11
|
import type { TransferDocument } from '../transfer-document';
|
|
13
12
|
import type { TransferElement } from '../transfer-element';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
/**
|
|
14
|
+
* What one of `TServer`'s document methods takes, minus the `clientId` a
|
|
15
|
+
* {@link DataSession} stamps itself.
|
|
16
|
+
*
|
|
17
|
+
* Read off the SERVER's signature, not off the framework's own arg type: an
|
|
18
|
+
* adopter server widens these, and a wrapper declared against the narrow
|
|
19
|
+
* shape rejects the extra field on a fresh object literal, so that call
|
|
20
|
+
* cannot go through a session at all.
|
|
21
|
+
*/
|
|
22
|
+
export type DataSessionArgs<TMethod extends (args: never) => unknown> = Omit<Parameters<TMethod>[0], 'clientId'>;
|
|
23
|
+
/** Open a document through a session; the session supplies `clientId`. */
|
|
24
|
+
export type DataSessionOpenArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['openModelDocument']>;
|
|
25
|
+
/** Close a document through a session; the session supplies `clientId`. */
|
|
26
|
+
export type DataSessionCloseArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['closeModelDocument']>;
|
|
27
|
+
/** Update a document through a session; the session supplies `clientId`. */
|
|
28
|
+
export type DataSessionUpdateArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['updateModelDocument']>;
|
|
29
|
+
/** Persist a document through a session; the session supplies `clientId`. */
|
|
30
|
+
export type DataSessionSaveArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['saveModelDocument']>;
|
|
31
|
+
/** The document a session hands back, carrying its server's diagnostic shape. */
|
|
32
|
+
export type DataSessionDocument<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = TransferDocument<TTransfer, DiagnosticOf<TServer>>;
|
|
33
|
+
/**
|
|
34
|
+
* What a {@link DataSession} needs from the connection that minted it.
|
|
35
|
+
*
|
|
36
|
+
* Narrower than the connection itself so the dependency points one way:
|
|
37
|
+
* `DataConnection` constructs sessions, and nothing here imports it back.
|
|
38
|
+
*/
|
|
39
|
+
export interface DataSessionHost<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>>> {
|
|
40
|
+
connected(): Promise<RpcProxy<TServer>>;
|
|
41
|
+
releaseSession(session: DataSession<TTransfer, TServer>): void;
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* adapter.
|
|
44
|
+
* One participant on a data connection: a properties panel, a tree, a
|
|
45
|
+
* form editor.
|
|
37
46
|
*
|
|
38
|
-
*
|
|
47
|
+
* The server keys every hold and watch per `(uri, clientId)`, so the identity
|
|
48
|
+
* belongs to the participant rather than to the wire — several sessions share
|
|
49
|
+
* one connection, and two participants forced to share one identity cannot
|
|
50
|
+
* distinguish each other's writes from their own echoes.
|
|
39
51
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* across concurrent callers. A socket client can connect before the
|
|
44
|
-
* workspace walk finishes, and an early request is then answered correctly
|
|
45
|
-
* from an empty registry, which reads as a broken project tier rather than
|
|
46
|
-
* as a race.
|
|
47
|
-
* 3. **Own the reconnect policy**, by dropping its connection generation when
|
|
48
|
-
* the port disposes and building a fresh one on the next request.
|
|
52
|
+
* Every document operation stamps {@link clientId} itself. A caller that
|
|
53
|
+
* passed its own could pass another participant's, and the server would
|
|
54
|
+
* attribute the write and release the hold accordingly.
|
|
49
55
|
*
|
|
50
|
-
*
|
|
51
|
-
* {@link connected}. The one exception is {@link openDocument}, which exists
|
|
52
|
-
* because the open/watch *order* is silently wrong the other way round — see
|
|
53
|
-
* its own doc.
|
|
56
|
+
* Generic over the transfer root so this file names no grammar.
|
|
54
57
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
+
* `TServer` is bound to a server answering with ITS OWN diagnostic shape, read
|
|
59
|
+
* back off the parameter being bound. Simplifying that to
|
|
60
|
+
* `DataServerProtocol<TTransfer>` compiles and costs the wrappers their
|
|
61
|
+
* return type: every call through `TServer` would resolve against that looser
|
|
62
|
+
* bound, so an adopter's diagnostics would come back as the framework's and
|
|
63
|
+
* the document would have to be cast on the way out.
|
|
58
64
|
*/
|
|
59
|
-
export declare class DataSession<TTransfer extends TransferElement
|
|
60
|
-
|
|
61
|
-
protected readonly
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
protected generation?: Generation<TTransfer>;
|
|
65
|
+
export declare class DataSession<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> {
|
|
66
|
+
readonly clientId: string;
|
|
67
|
+
protected readonly host: DataSessionHost<TTransfer, TServer>;
|
|
68
|
+
/** URIs this session holds open, so {@link dispose} can release exactly those. */
|
|
69
|
+
protected readonly openUris: Set<string>;
|
|
65
70
|
protected disposed: boolean;
|
|
66
|
-
protected readonly portDisposeListener: {
|
|
67
|
-
dispose(): void;
|
|
68
|
-
};
|
|
69
|
-
constructor(port: DataPort, client: DataClientProtocol<TTransfer>, options?: DataSessionOptions);
|
|
70
|
-
/** The identity every request is made under — the port's, not a second one. */
|
|
71
|
-
get clientId(): string;
|
|
72
71
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* proxy, so a caller that cached one from an earlier call would go on
|
|
77
|
-
* addressing a dead connection with no error — handing it back per call
|
|
78
|
-
* makes the stale reference unrepresentable.
|
|
79
|
-
*
|
|
80
|
-
* Concurrent callers share one readiness promise, so `waitForReady` is
|
|
81
|
-
* awaited once per generation and not once per caller.
|
|
72
|
+
* Disposed through {@link detach} rather than {@link dispose}, so nothing may
|
|
73
|
+
* be sent. Folding it into {@link disposed} costs {@link openDocument} the
|
|
74
|
+
* distinction, and its close would then go out on a detached session.
|
|
82
75
|
*/
|
|
83
|
-
|
|
76
|
+
protected detached: boolean;
|
|
77
|
+
constructor(clientId: string, host: DataSessionHost<TTransfer, TServer>);
|
|
84
78
|
/**
|
|
85
|
-
*
|
|
86
|
-
* the
|
|
79
|
+
* The connected, READY server proxy, for protocol methods this session does
|
|
80
|
+
* not wrap — the ones carrying no `clientId`, so no identity can be got
|
|
81
|
+
* wrong through them.
|
|
82
|
+
*/
|
|
83
|
+
connected(): Promise<RpcProxy<TServer>>;
|
|
84
|
+
/**
|
|
85
|
+
* Open `args.uri` for editing and start watching it, in that order,
|
|
86
|
+
* returning the opened snapshot.
|
|
87
87
|
*
|
|
88
88
|
* **The order is the whole reason this method exists.**
|
|
89
89
|
* `watchModelDocument` baselines its dedup fingerprint from the *current*
|
|
@@ -98,32 +98,49 @@ export declare class DataSession<TTransfer extends TransferElement> {
|
|
|
98
98
|
* valid: `open` settles at the integrity landmark, not at validation.
|
|
99
99
|
* Validity arrives asynchronously on `onDocumentUpdated`, or synchronously
|
|
100
100
|
* from `getModelDocument({ includeDiagnostics: true })`.
|
|
101
|
+
*
|
|
102
|
+
* A dispose landing between the two awaits is handled here rather than in
|
|
103
|
+
* {@link dispose}, which cannot release a hold that does not exist yet: it
|
|
104
|
+
* reads {@link openUris}, and this method fills it only once both calls have
|
|
105
|
+
* returned. Left to `dispose`, the hold and its watch outlive the participant
|
|
106
|
+
* and go only when the connection closes.
|
|
101
107
|
*/
|
|
102
|
-
openDocument(
|
|
108
|
+
openDocument(args: DataSessionOpenArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
103
109
|
/**
|
|
104
|
-
* Close `uri`. The server unwatches implicitly, so this is the dual of
|
|
110
|
+
* Close `args.uri`. The server unwatches implicitly, so this is the dual of
|
|
105
111
|
* {@link openDocument} and needs no separate unwatch.
|
|
106
112
|
*/
|
|
107
|
-
closeDocument(
|
|
113
|
+
closeDocument(args: DataSessionCloseArgs<TTransfer, TServer>): Promise<void>;
|
|
114
|
+
/** Write `args.model` back as this session. */
|
|
115
|
+
updateDocument(args: DataSessionUpdateArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
116
|
+
/** Persist `args.model` to disk as this session. */
|
|
117
|
+
saveDocument(args: DataSessionSaveArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
108
118
|
/**
|
|
109
|
-
* Whether `
|
|
119
|
+
* Whether `sourceClientId` identifies this session's own write.
|
|
110
120
|
*
|
|
111
121
|
* Every watcher needs this and the check is one comparison, so getting it
|
|
112
122
|
* wrong is cheap to do and expensive to find: an unfiltered echo looks
|
|
113
123
|
* exactly like a concurrent third-party edit.
|
|
114
124
|
*/
|
|
115
125
|
isOwnEcho(sourceClientId: string): boolean;
|
|
116
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Release this session's holds and detach it from the connection.
|
|
128
|
+
* Idempotent, and leaves the connection usable by its other sessions.
|
|
129
|
+
*
|
|
130
|
+
* The closes are fired without being awaited, because a `Disposable` cannot
|
|
131
|
+
* be: a host disposing a widget has nowhere to put the promise. A close
|
|
132
|
+
* that fails is no worse than the leak this exists to prevent, so the
|
|
133
|
+
* rejection is swallowed rather than surfaced from a teardown.
|
|
134
|
+
*/
|
|
117
135
|
dispose(): void;
|
|
118
|
-
/** The live generation, building one if there is none. */
|
|
119
|
-
protected currentGeneration(): Generation<TTransfer>;
|
|
120
|
-
/** Await the connection and the server's startup gate for one generation. */
|
|
121
|
-
protected awaitReady(generation: Generation<TTransfer>): Promise<void>;
|
|
122
136
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
137
|
+
* Come off the connection because it is going away.
|
|
138
|
+
*
|
|
139
|
+
* Sends no close, unlike {@link dispose}: the server releases every hold on
|
|
140
|
+
* a connection it sees close, and the close would travel over the very
|
|
141
|
+
* connection being disposed.
|
|
125
142
|
*/
|
|
126
|
-
|
|
143
|
+
detach(): void;
|
|
144
|
+
protected assertLive(): void;
|
|
127
145
|
}
|
|
128
|
-
export {};
|
|
129
146
|
//# 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,
|
|
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,0EAA0E;AAC1E,MAAM,MAAM,mBAAmB,CAC5B,SAAS,SAAS,eAAe,EACjC,OAAO,SAAS,kBAAkB,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,kBAAkB,CAAC,SAAS,CAAC,IACnG,eAAe,CAAC,OAAO,CAAC,mBAAmB,CAAC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,cAAc,EAAE,MAAM,GAAG,OAAO;IAI1C;;;;;;;;OAQG;IACH,OAAO,IAAI,IAAI;IAgBf;;;;;;OAMG;IACH,MAAM,IAAI,IAAI;IAMd,SAAS,CAAC,UAAU,IAAI,IAAI;CAK9B"}
|
|
@@ -9,77 +9,59 @@
|
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.DataSession = void 0;
|
|
12
|
-
const data_1 = require("../data");
|
|
13
|
-
const rpc_1 = require("../rpc");
|
|
14
12
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* adapter.
|
|
13
|
+
* One participant on a data connection: a properties panel, a tree, a
|
|
14
|
+
* form editor.
|
|
18
15
|
*
|
|
19
|
-
*
|
|
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.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* across concurrent callers. A socket client can connect before the
|
|
25
|
-
* workspace walk finishes, and an early request is then answered correctly
|
|
26
|
-
* from an empty registry, which reads as a broken project tier rather than
|
|
27
|
-
* as a race.
|
|
28
|
-
* 3. **Own the reconnect policy**, by dropping its connection generation when
|
|
29
|
-
* the port disposes and building a fresh one on the next request.
|
|
21
|
+
* Every document operation stamps {@link clientId} itself. A caller that
|
|
22
|
+
* passed its own could pass another participant's, and the server would
|
|
23
|
+
* attribute the write and release the hold accordingly.
|
|
30
24
|
*
|
|
31
|
-
*
|
|
32
|
-
* {@link connected}. The one exception is {@link openDocument}, which exists
|
|
33
|
-
* because the open/watch *order* is silently wrong the other way round — see
|
|
34
|
-
* its own doc.
|
|
25
|
+
* Generic over the transfer root so this file names no grammar.
|
|
35
26
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
27
|
+
* `TServer` is bound to a server answering with ITS OWN diagnostic shape, read
|
|
28
|
+
* back off the parameter being bound. Simplifying that to
|
|
29
|
+
* `DataServerProtocol<TTransfer>` compiles and costs the wrappers their
|
|
30
|
+
* return type: every call through `TServer` would resolve against that looser
|
|
31
|
+
* bound, so an adopter's diagnostics would come back as the framework's and
|
|
32
|
+
* the document would have to be cast on the way out.
|
|
39
33
|
*/
|
|
40
34
|
class DataSession {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
generation;
|
|
35
|
+
clientId;
|
|
36
|
+
host;
|
|
37
|
+
/** URIs this session holds open, so {@link dispose} can release exactly those. */
|
|
38
|
+
openUris = new Set();
|
|
46
39
|
disposed = false;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return this.port.clientId;
|
|
40
|
+
/**
|
|
41
|
+
* Disposed through {@link detach} rather than {@link dispose}, so nothing may
|
|
42
|
+
* be sent. Folding it into {@link disposed} costs {@link openDocument} the
|
|
43
|
+
* distinction, and its close would then go out on a detached session.
|
|
44
|
+
*/
|
|
45
|
+
detached = false;
|
|
46
|
+
constructor(clientId, host) {
|
|
47
|
+
this.clientId = clientId;
|
|
48
|
+
this.host = host;
|
|
57
49
|
}
|
|
58
50
|
/**
|
|
59
|
-
* The connected, READY server proxy
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* proxy, so a caller that cached one from an earlier call would go on
|
|
63
|
-
* addressing a dead connection with no error — handing it back per call
|
|
64
|
-
* makes the stale reference unrepresentable.
|
|
65
|
-
*
|
|
66
|
-
* Concurrent callers share one readiness promise, so `waitForReady` is
|
|
67
|
-
* awaited once per generation and not once per caller.
|
|
51
|
+
* The connected, READY server proxy, for protocol methods this session does
|
|
52
|
+
* not wrap — the ones carrying no `clientId`, so no identity can be got
|
|
53
|
+
* wrong through them.
|
|
68
54
|
*/
|
|
69
55
|
async connected() {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
generation.ready = this.awaitReady(generation);
|
|
76
|
-
}
|
|
77
|
-
await generation.ready;
|
|
78
|
-
return generation.server;
|
|
56
|
+
// `async` so a disposed session REJECTS rather than throwing
|
|
57
|
+
// synchronously: the connection's own `connected` rejects, and a caller
|
|
58
|
+
// reaching for `.catch` on one of them would not catch the other.
|
|
59
|
+
this.assertLive();
|
|
60
|
+
return this.host.connected();
|
|
79
61
|
}
|
|
80
62
|
/**
|
|
81
|
-
* Open `uri` for editing and start watching it, in that order,
|
|
82
|
-
* the opened snapshot.
|
|
63
|
+
* Open `args.uri` for editing and start watching it, in that order,
|
|
64
|
+
* returning the opened snapshot.
|
|
83
65
|
*
|
|
84
66
|
* **The order is the whole reason this method exists.**
|
|
85
67
|
* `watchModelDocument` baselines its dedup fingerprint from the *current*
|
|
@@ -94,23 +76,62 @@ class DataSession {
|
|
|
94
76
|
* valid: `open` settles at the integrity landmark, not at validation.
|
|
95
77
|
* Validity arrives asynchronously on `onDocumentUpdated`, or synchronously
|
|
96
78
|
* from `getModelDocument({ includeDiagnostics: true })`.
|
|
79
|
+
*
|
|
80
|
+
* A dispose landing between the two awaits is handled here rather than in
|
|
81
|
+
* {@link dispose}, which cannot release a hold that does not exist yet: it
|
|
82
|
+
* reads {@link openUris}, and this method fills it only once both calls have
|
|
83
|
+
* returned. Left to `dispose`, the hold and its watch outlive the participant
|
|
84
|
+
* and go only when the connection closes.
|
|
97
85
|
*/
|
|
98
|
-
async openDocument(
|
|
86
|
+
async openDocument(args) {
|
|
99
87
|
const server = await this.connected();
|
|
100
|
-
const document = await server.openModelDocument({
|
|
101
|
-
await server.watchModelDocument({ uri, clientId: this.clientId });
|
|
88
|
+
const document = await server.openModelDocument({ ...args, clientId: this.clientId });
|
|
89
|
+
await server.watchModelDocument({ uri: args.uri, clientId: this.clientId });
|
|
90
|
+
if (this.disposed) {
|
|
91
|
+
// Registering the URI BEFORE the open, so `dispose` could close on
|
|
92
|
+
// intent, is NOT the same fix and can invert into the leak it is meant
|
|
93
|
+
// to prevent: the close would then be issued while the open is still in
|
|
94
|
+
// flight, and a peer that does not serialise the two can complete the
|
|
95
|
+
// close first, after which the open re-registers the hold. Closing
|
|
96
|
+
// strictly after the open has resolved is the only ordering with no
|
|
97
|
+
// losing interleaving.
|
|
98
|
+
if (!this.detached) {
|
|
99
|
+
void server.closeModelDocument({ uri: args.uri, clientId: this.clientId }).catch(() => undefined);
|
|
100
|
+
}
|
|
101
|
+
// Returned rather than thrown: the caller that reaches this window is
|
|
102
|
+
// one that never awaited the open, so a rejection here surfaces as an
|
|
103
|
+
// unhandled one against a participant already gone.
|
|
104
|
+
return document;
|
|
105
|
+
}
|
|
106
|
+
this.openUris.add(args.uri);
|
|
102
107
|
return document;
|
|
103
108
|
}
|
|
104
109
|
/**
|
|
105
|
-
* Close `uri`. The server unwatches implicitly, so this is the dual of
|
|
110
|
+
* Close `args.uri`. The server unwatches implicitly, so this is the dual of
|
|
106
111
|
* {@link openDocument} and needs no separate unwatch.
|
|
107
112
|
*/
|
|
108
|
-
async closeDocument(
|
|
113
|
+
async closeDocument(args) {
|
|
114
|
+
const server = await this.connected();
|
|
115
|
+
await server.closeModelDocument({ ...args, clientId: this.clientId });
|
|
116
|
+
// Untracked only once the close has actually landed. Dropping it first
|
|
117
|
+
// gives a FAILED close the same effect as a successful one: the hold
|
|
118
|
+
// survives on the server and `dispose` no longer knows to retry it.
|
|
119
|
+
// A `dispose` racing this therefore closes the same URI twice, which the
|
|
120
|
+
// server answers as a no-op for a client that no longer holds it.
|
|
121
|
+
this.openUris.delete(args.uri);
|
|
122
|
+
}
|
|
123
|
+
/** Write `args.model` back as this session. */
|
|
124
|
+
async updateDocument(args) {
|
|
109
125
|
const server = await this.connected();
|
|
110
|
-
|
|
126
|
+
return server.updateModelDocument({ ...args, clientId: this.clientId });
|
|
127
|
+
}
|
|
128
|
+
/** Persist `args.model` to disk as this session. */
|
|
129
|
+
async saveDocument(args) {
|
|
130
|
+
const server = await this.connected();
|
|
131
|
+
return server.saveModelDocument({ ...args, clientId: this.clientId });
|
|
111
132
|
}
|
|
112
133
|
/**
|
|
113
|
-
* Whether `
|
|
134
|
+
* Whether `sourceClientId` identifies this session's own write.
|
|
114
135
|
*
|
|
115
136
|
* Every watcher needs this and the check is one comparison, so getting it
|
|
116
137
|
* wrong is cheap to do and expensive to find: an unfiltered echo looks
|
|
@@ -119,60 +140,46 @@ class DataSession {
|
|
|
119
140
|
isOwnEcho(sourceClientId) {
|
|
120
141
|
return sourceClientId === this.clientId;
|
|
121
142
|
}
|
|
122
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* Release this session's holds and detach it from the connection.
|
|
145
|
+
* Idempotent, and leaves the connection usable by its other sessions.
|
|
146
|
+
*
|
|
147
|
+
* The closes are fired without being awaited, because a `Disposable` cannot
|
|
148
|
+
* be: a host disposing a widget has nowhere to put the promise. A close
|
|
149
|
+
* that fails is no worse than the leak this exists to prevent, so the
|
|
150
|
+
* rejection is swallowed rather than surfaced from a teardown.
|
|
151
|
+
*/
|
|
123
152
|
dispose() {
|
|
124
153
|
if (this.disposed) {
|
|
125
154
|
return;
|
|
126
155
|
}
|
|
127
156
|
this.disposed = true;
|
|
128
|
-
this.
|
|
129
|
-
this.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const connection = this.port.connect();
|
|
137
|
-
// Rejection is reported here rather than left to float: an unhandled
|
|
138
|
-
// rejection on a connection promise is the failure mode that reads as
|
|
139
|
-
// "the model is empty" instead of "the transport never opened".
|
|
140
|
-
connection.catch((error) => this.port.reportError(error, 'connecting to the data server'));
|
|
141
|
-
const server = (0, rpc_1.createRpcProxy)(connection, {
|
|
142
|
-
methodNamespace: this.methodNamespace,
|
|
143
|
-
localTarget: this.client,
|
|
144
|
-
localMethods: data_1.DATA_CLIENT_PROTOCOL_METHODS
|
|
145
|
-
});
|
|
146
|
-
this.generation = { connection, server };
|
|
147
|
-
return this.generation;
|
|
148
|
-
}
|
|
149
|
-
/** Await the connection and the server's startup gate for one generation. */
|
|
150
|
-
async awaitReady(generation) {
|
|
151
|
-
try {
|
|
152
|
-
await generation.connection;
|
|
153
|
-
await generation.server.waitForReady();
|
|
154
|
-
}
|
|
155
|
-
catch (error) {
|
|
156
|
-
// Drop the generation so the next request retries rather than
|
|
157
|
-
// re-awaiting a settled rejection forever.
|
|
158
|
-
if (this.generation === generation) {
|
|
159
|
-
this.generation = undefined;
|
|
160
|
-
}
|
|
161
|
-
this.port.reportError(error, 'waiting for the data server to become ready');
|
|
162
|
-
throw error;
|
|
157
|
+
const uris = [...this.openUris];
|
|
158
|
+
this.openUris.clear();
|
|
159
|
+
this.host.releaseSession(this);
|
|
160
|
+
for (const uri of uris) {
|
|
161
|
+
void this.host
|
|
162
|
+
.connected()
|
|
163
|
+
.then(server => server.closeModelDocument({ uri, clientId: this.clientId }))
|
|
164
|
+
.catch(() => undefined);
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
167
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
+
* Come off the connection because it is going away.
|
|
169
|
+
*
|
|
170
|
+
* Sends no close, unlike {@link dispose}: the server releases every hold on
|
|
171
|
+
* a connection it sees close, and the close would travel over the very
|
|
172
|
+
* connection being disposed.
|
|
168
173
|
*/
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
+
detach() {
|
|
175
|
+
this.disposed = true;
|
|
176
|
+
this.detached = true;
|
|
177
|
+
this.openUris.clear();
|
|
178
|
+
}
|
|
179
|
+
assertLive() {
|
|
180
|
+
if (this.disposed) {
|
|
181
|
+
throw new Error('DataSession is disposed');
|
|
174
182
|
}
|
|
175
|
-
generation.connection.then(connection => connection.dispose()).catch(() => undefined);
|
|
176
183
|
}
|
|
177
184
|
}
|
|
178
185
|
exports.DataSession = DataSession;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-session.js","sourceRoot":"","sources":["../../src/client/data-session.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;
|
|
1
|
+
{"version":3,"file":"data-session.js","sourceRoot":"","sources":["../../src/client/data-session.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AA2DlF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,WAAW;IAeT;IACU;IAZtB,kFAAkF;IAC/D,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,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;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,YAAY,CAAC,IAA6C;QAC7D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtF,MAAM,MAAM,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5E,IAAI,IAAI,CAAC,QAAQ,EAAE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/lib/client/index.d.ts
CHANGED
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Where `./data` is the wire *contract* and `./rpc` is the machinery that lowers
|
|
14
14
|
* it onto a connection, this is what a client wraps around both: the seam a host
|
|
15
|
-
* fills in (`DataPort`), the
|
|
16
|
-
*
|
|
15
|
+
* fills in (`DataPort`), the connection above it (`DataConnection` — readiness
|
|
16
|
+
* gate and reconnect), the participants on that connection (`DataSession` —
|
|
17
|
+
* identity, open/watch ordering, echo recognition), the inbound
|
|
17
18
|
* fan-out (`DataEvents`), and the two halves of the hop for hosts whose
|
|
18
19
|
* client cannot hold a socket — `createPostMessageTransport` on the client
|
|
19
20
|
* side and `relayToPostMessageChannel` on the side that does hold it.
|
|
@@ -25,15 +26,17 @@
|
|
|
25
26
|
* carries the entries.
|
|
26
27
|
*
|
|
27
28
|
* The Theia-specific mounting of the same contract lives in
|
|
28
|
-
* `@hydranium/data-client-theia
|
|
29
|
-
*
|
|
30
|
-
* is the Theia-bound counterpart of `DataEvents`.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* `@hydranium/data-client-theia`, and is now only the TRANSPORT: its
|
|
30
|
+
* `ChannelDataPort` fills the `DataPort` seam over a Theia channel, and its
|
|
31
|
+
* `EmitterDataClient` is the Theia-bound counterpart of `DataEvents`.
|
|
32
|
+
* Everything above the port is here, so a Theia frontend and a browser page
|
|
33
|
+
* differ by which port they construct and nothing else.
|
|
33
34
|
*/
|
|
35
|
+
export * from './data-connection';
|
|
34
36
|
export * from './data-events';
|
|
35
37
|
export * from './data-port';
|
|
36
38
|
export * from './data-session';
|
|
37
39
|
export * from './message-relay';
|
|
38
40
|
export * from './post-message-transport';
|
|
41
|
+
export * from './rpc-connection';
|
|
39
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC"}
|
package/lib/client/index.js
CHANGED
|
@@ -28,8 +28,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
28
28
|
*
|
|
29
29
|
* Where `./data` is the wire *contract* and `./rpc` is the machinery that lowers
|
|
30
30
|
* it onto a connection, this is what a client wraps around both: the seam a host
|
|
31
|
-
* fills in (`DataPort`), the
|
|
32
|
-
*
|
|
31
|
+
* fills in (`DataPort`), the connection above it (`DataConnection` — readiness
|
|
32
|
+
* gate and reconnect), the participants on that connection (`DataSession` —
|
|
33
|
+
* identity, open/watch ordering, echo recognition), the inbound
|
|
33
34
|
* fan-out (`DataEvents`), and the two halves of the hop for hosts whose
|
|
34
35
|
* client cannot hold a socket — `createPostMessageTransport` on the client
|
|
35
36
|
* side and `relayToPostMessageChannel` on the side that does hold it.
|
|
@@ -41,15 +42,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
41
42
|
* carries the entries.
|
|
42
43
|
*
|
|
43
44
|
* The Theia-specific mounting of the same contract lives in
|
|
44
|
-
* `@hydranium/data-client-theia
|
|
45
|
-
*
|
|
46
|
-
* is the Theia-bound counterpart of `DataEvents`.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* `@hydranium/data-client-theia`, and is now only the TRANSPORT: its
|
|
46
|
+
* `ChannelDataPort` fills the `DataPort` seam over a Theia channel, and its
|
|
47
|
+
* `EmitterDataClient` is the Theia-bound counterpart of `DataEvents`.
|
|
48
|
+
* Everything above the port is here, so a Theia frontend and a browser page
|
|
49
|
+
* differ by which port they construct and nothing else.
|
|
49
50
|
*/
|
|
51
|
+
__exportStar(require("./data-connection"), exports);
|
|
50
52
|
__exportStar(require("./data-events"), exports);
|
|
51
53
|
__exportStar(require("./data-port"), exports);
|
|
52
54
|
__exportStar(require("./data-session"), exports);
|
|
53
55
|
__exportStar(require("./message-relay"), exports);
|
|
54
56
|
__exportStar(require("./post-message-transport"), exports);
|
|
57
|
+
__exportStar(require("./rpc-connection"), exports);
|
|
55
58
|
//# sourceMappingURL=index.js.map
|