@hydranium/protocol 1.0.0-next.70 → 1.0.0-next.71
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 +4 -4
- package/lib/client/data-connection.d.ts.map +1 -1
- package/lib/client/data-connection.js.map +1 -1
- package/lib/client/data-session.d.ts +35 -12
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +17 -10
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +9 -1
- package/lib/client/rpc-connection.d.ts.map +1 -1
- package/lib/client/rpc-connection.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +13 -0
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/data-connection.ts +13 -6
- package/src/client/data-session.ts +62 -17
- package/src/client/rpc-connection.ts +9 -1
- package/src/data/data-server-protocol.ts +16 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type DataClientProtocol, type DataServerProtocol } from '../data';
|
|
9
|
+
import { type DataClientProtocol, type DataServerProtocol, type DiagnosticOf, type ProjectOf } from '../data';
|
|
10
10
|
import type { TransferElement } from '../transfer-element';
|
|
11
11
|
import { DataEvents } from './data-events';
|
|
12
12
|
import type { DataPort } from './data-port';
|
|
@@ -54,7 +54,7 @@ export type DataConnectionArgs<TTransfer extends TransferElement, TClient extend
|
|
|
54
54
|
* binds the concrete root (or the union of them, for a multi-grammar head) at
|
|
55
55
|
* its own edge.
|
|
56
56
|
*/
|
|
57
|
-
export declare class DataConnection<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer
|
|
57
|
+
export declare class DataConnection<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>, TClient extends object = DataClientProtocol<TTransfer>> extends RpcConnection<TServer, TClient> {
|
|
58
58
|
protected readonly sessions: Set<DataSession<TTransfer, TServer>>;
|
|
59
59
|
constructor(port: DataPort, client: TClient, ...rest: DataConnectionArgs<TTransfer, TClient>);
|
|
60
60
|
/**
|
|
@@ -93,9 +93,9 @@ export declare class DataConnection<TTransfer extends TransferElement, TServer e
|
|
|
93
93
|
* consumer that IS the client, or a request/response-only client that binds
|
|
94
94
|
* nothing.
|
|
95
95
|
*/
|
|
96
|
-
export declare class DataConnectionWithEvents<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer
|
|
96
|
+
export declare class DataConnectionWithEvents<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> extends DataConnection<TTransfer, TServer, DataEvents<TTransfer, DiagnosticOf<TServer>, ProjectOf<TServer>>> {
|
|
97
97
|
/** Server pushes, fanned out to as many local listeners as the host has. */
|
|
98
|
-
readonly events: DataEvents<TTransfer
|
|
98
|
+
readonly events: DataEvents<TTransfer, DiagnosticOf<TServer>, ProjectOf<TServer>>;
|
|
99
99
|
constructor(port: DataPort, options?: DataConnectionOptions);
|
|
100
100
|
/** Disposes the fan-out it created, which no caller else holds. */
|
|
101
101
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-connection.d.ts","sourceRoot":"","sources":["../../src/client/data-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,
|
|
1
|
+
{"version":3,"file":"data-connection.d.ts","sourceRoot":"","sources":["../../src/client/data-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAGJ,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,SAAS,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,C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,OAAO,CAAC;IAY5F;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC;IAahE;;;;OAIG;IACM,OAAO,IAAI,IAAI;CAO1B;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,wBAAwB,CAClC,SAAS,SAAS,eAAe,EACjC,OAAO,SAAS,kBAAkB,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,kBAAkB,CAAC,SAAS,CAAC,CACrG,SAAQ,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3G,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;gBAEtE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAQ3D,mEAAmE;IAC1D,OAAO,IAAI,IAAI;CAI1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-connection.js","sourceRoot":"","sources":["../../src/client/data-connection.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,8CAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"data-connection.js","sourceRoot":"","sources":["../../src/client/data-connection.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,8CAAqD;AACrD,kCAOiB;AAEjB,+CAA2C;AAE3C,iDAA6C;AAC7C,qDAA8E;AAqC9E;;;;;;;;;;;;GAYG;AACH,MAAa,cAIX,SAAQ,8BAA+B;IACnB,QAAQ,GAAG,IAAI,GAAG,EAAmC,CAAC;IAEzE,YAAY,IAAc,EAAE,MAAe,EAAE,GAAG,IAA4C;QACzF,MAAM,CAAC,O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B;QACxD,sEAAsE;QACtE,4BAA4B;QAC5B,MAAM,MAAM,GAAG,IAAI,wBAAU,EAAwD,CAAC;QACtF,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,mEAAmE;IAC1D,OAAO;QACb,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACH;AApBD,4DAoBC"}
|
|
@@ -6,21 +6,37 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import type { DataServerProtocol,
|
|
9
|
+
import type { DataServerProtocol, DiagnosticOf } from '../data';
|
|
10
10
|
import type { RpcProxy } from '../rpc';
|
|
11
11
|
import type { TransferDocument } from '../transfer-document';
|
|
12
12
|
import type { TransferElement } from '../transfer-element';
|
|
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']>;
|
|
13
27
|
/** Update a document through a session; the session supplies `clientId`. */
|
|
14
|
-
export type DataSessionUpdateArgs<TTransfer
|
|
28
|
+
export type DataSessionUpdateArgs<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = DataSessionArgs<TServer['updateModelDocument']>;
|
|
15
29
|
/** Persist a document through a session; the session supplies `clientId`. */
|
|
16
|
-
export type DataSessionSaveArgs<TTransfer
|
|
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>>;
|
|
17
33
|
/**
|
|
18
34
|
* What a {@link DataSession} needs from the connection that minted it.
|
|
19
35
|
*
|
|
20
36
|
* Narrower than the connection itself so the dependency points one way:
|
|
21
37
|
* `DataConnection` constructs sessions, and nothing here imports it back.
|
|
22
38
|
*/
|
|
23
|
-
export interface DataSessionHost<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer
|
|
39
|
+
export interface DataSessionHost<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>>> {
|
|
24
40
|
connected(): Promise<RpcProxy<TServer>>;
|
|
25
41
|
releaseSession(session: DataSession<TTransfer, TServer>): void;
|
|
26
42
|
}
|
|
@@ -38,8 +54,15 @@ export interface DataSessionHost<TTransfer extends TransferElement, TServer exte
|
|
|
38
54
|
* attribute the write and release the hold accordingly.
|
|
39
55
|
*
|
|
40
56
|
* Generic over the transfer root so this file names no grammar.
|
|
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.
|
|
41
64
|
*/
|
|
42
|
-
export declare class DataSession<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer
|
|
65
|
+
export declare class DataSession<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> {
|
|
43
66
|
readonly clientId: string;
|
|
44
67
|
protected readonly host: DataSessionHost<TTransfer, TServer>;
|
|
45
68
|
/** URIs this session holds open, so {@link dispose} can release exactly those. */
|
|
@@ -53,8 +76,8 @@ export declare class DataSession<TTransfer extends TransferElement, TServer exte
|
|
|
53
76
|
*/
|
|
54
77
|
connected(): Promise<RpcProxy<TServer>>;
|
|
55
78
|
/**
|
|
56
|
-
* Open `uri` for editing and start watching it, in that order,
|
|
57
|
-
* the opened snapshot.
|
|
79
|
+
* Open `args.uri` for editing and start watching it, in that order,
|
|
80
|
+
* returning the opened snapshot.
|
|
58
81
|
*
|
|
59
82
|
* **The order is the whole reason this method exists.**
|
|
60
83
|
* `watchModelDocument` baselines its dedup fingerprint from the *current*
|
|
@@ -70,16 +93,16 @@ export declare class DataSession<TTransfer extends TransferElement, TServer exte
|
|
|
70
93
|
* Validity arrives asynchronously on `onDocumentUpdated`, or synchronously
|
|
71
94
|
* from `getModelDocument({ includeDiagnostics: true })`.
|
|
72
95
|
*/
|
|
73
|
-
openDocument(
|
|
96
|
+
openDocument(args: DataSessionOpenArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
74
97
|
/**
|
|
75
|
-
* Close `uri`. The server unwatches implicitly, so this is the dual of
|
|
98
|
+
* Close `args.uri`. The server unwatches implicitly, so this is the dual of
|
|
76
99
|
* {@link openDocument} and needs no separate unwatch.
|
|
77
100
|
*/
|
|
78
|
-
closeDocument(
|
|
101
|
+
closeDocument(args: DataSessionCloseArgs<TTransfer, TServer>): Promise<void>;
|
|
79
102
|
/** Write `args.model` back as this session. */
|
|
80
|
-
updateDocument(args: DataSessionUpdateArgs<TTransfer>): Promise<
|
|
103
|
+
updateDocument(args: DataSessionUpdateArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
81
104
|
/** Persist `args.model` to disk as this session. */
|
|
82
|
-
saveDocument(args: DataSessionSaveArgs<TTransfer>): Promise<
|
|
105
|
+
saveDocument(args: DataSessionSaveArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>>;
|
|
83
106
|
/**
|
|
84
107
|
* Whether `sourceClientId` identifies this session's own write.
|
|
85
108
|
*
|
|
@@ -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,
|
|
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,OAA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,SAAS,EAAE,OAAO,CAAC,CAAC;IAKvH,oDAAoD;IAC9C,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAKnH;;;;;;OAMG;IACH,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO;IAI1C;;;;;;;;OAQG;IACH,OAAO,IAAI,IAAI;IAgBf;;;;;;OAMG;IACH,MAAM,IAAI,IAAI;IAKd,SAAS,CAAC,UAAU,IAAI,IAAI;CAK9B"}
|
|
@@ -23,6 +23,13 @@ exports.DataSession = void 0;
|
|
|
23
23
|
* attribute the write and release the hold accordingly.
|
|
24
24
|
*
|
|
25
25
|
* Generic over the transfer root so this file names no grammar.
|
|
26
|
+
*
|
|
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.
|
|
26
33
|
*/
|
|
27
34
|
class DataSession {
|
|
28
35
|
clientId;
|
|
@@ -47,8 +54,8 @@ class DataSession {
|
|
|
47
54
|
return this.host.connected();
|
|
48
55
|
}
|
|
49
56
|
/**
|
|
50
|
-
* Open `uri` for editing and start watching it, in that order,
|
|
51
|
-
* the opened snapshot.
|
|
57
|
+
* Open `args.uri` for editing and start watching it, in that order,
|
|
58
|
+
* returning the opened snapshot.
|
|
52
59
|
*
|
|
53
60
|
* **The order is the whole reason this method exists.**
|
|
54
61
|
* `watchModelDocument` baselines its dedup fingerprint from the *current*
|
|
@@ -64,21 +71,21 @@ class DataSession {
|
|
|
64
71
|
* Validity arrives asynchronously on `onDocumentUpdated`, or synchronously
|
|
65
72
|
* from `getModelDocument({ includeDiagnostics: true })`.
|
|
66
73
|
*/
|
|
67
|
-
async openDocument(
|
|
74
|
+
async openDocument(args) {
|
|
68
75
|
const server = await this.connected();
|
|
69
|
-
const document = await server.openModelDocument({
|
|
70
|
-
await server.watchModelDocument({ uri, clientId: this.clientId });
|
|
71
|
-
this.openUris.add(uri);
|
|
76
|
+
const document = await server.openModelDocument({ ...args, clientId: this.clientId });
|
|
77
|
+
await server.watchModelDocument({ uri: args.uri, clientId: this.clientId });
|
|
78
|
+
this.openUris.add(args.uri);
|
|
72
79
|
return document;
|
|
73
80
|
}
|
|
74
81
|
/**
|
|
75
|
-
* Close `uri`. The server unwatches implicitly, so this is the dual of
|
|
82
|
+
* Close `args.uri`. The server unwatches implicitly, so this is the dual of
|
|
76
83
|
* {@link openDocument} and needs no separate unwatch.
|
|
77
84
|
*/
|
|
78
|
-
async closeDocument(
|
|
85
|
+
async closeDocument(args) {
|
|
79
86
|
const server = await this.connected();
|
|
80
|
-
this.openUris.delete(uri);
|
|
81
|
-
await server.closeModelDocument({
|
|
87
|
+
this.openUris.delete(args.uri);
|
|
88
|
+
await server.closeModelDocument({ ...args, clientId: this.clientId });
|
|
82
89
|
}
|
|
83
90
|
/** Write `args.model` back as this session. */
|
|
84
91
|
async updateDocument(args) {
|
|
@@ -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;IAST;IACU;IANtB,kFAAkF;IAC/D,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,QAAQ,GAAG,KAAK,CAAC;IAE3B,YACY,QAAgB,EACN,IAAyC;QADnD,aAAQ,GAAR,QAAQ,CAAQ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AAK,CAAC,yBAAyB,CAAC,CAAC;QAC9C,CAAC;IACJ,CAAC;CACH;AA/HD,kCA+HC"}
|
|
@@ -22,7 +22,15 @@ export declare const DATA_SERVER_NOT_READY: import("../messages/primitives").Mes
|
|
|
22
22
|
export interface ReadyServer {
|
|
23
23
|
waitForReady(): Promise<void>;
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Lifecycle reporting, for a host that raises warm-up UI around the two waits.
|
|
27
|
+
*
|
|
28
|
+
* Nothing fires until something asks for the connection — the generation is
|
|
29
|
+
* built on the first {@link RpcConnection.connected}. A host that wants the
|
|
30
|
+
* sequence at startup drives that call itself, or a workspace where nobody
|
|
31
|
+
* opens a document reports neither the connect nor the readiness its UI waits
|
|
32
|
+
* on.
|
|
33
|
+
*/
|
|
26
34
|
export interface RpcConnectionLifecycle {
|
|
27
35
|
/** A generation is opening its transport, including on each reconnect. */
|
|
28
36
|
readonly onConnecting?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-connection.d.ts","sourceRoot":"","sources":["../../src/client/rpc-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,eAAe,EAAyC,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,QAAQ,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,sGAGtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,sGAGjC,CAAC;AAEF,yEAAyE;AACzE,MAAM,WAAW,WAAW;IACzB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED
|
|
1
|
+
{"version":3,"file":"rpc-connection.d.ts","sourceRoot":"","sources":["../../src/client/rpc-connection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AAS,CAAC,cAAc,IAAI,IAAI;IAShC,SAAS,CAAC,UAAU,IAAI,IAAI;CAK9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-connection.js","sourceRoot":"","sources":["../../src/client/rpc-connection.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAGlF,uDAAqG;AACrG,gCAAuD;AAGvD;;;;;GAKG;AACU,QAAA,0BAA0B,GAAG,IAAA,0BAAa,EACpD,+CAA+C,EAC/C,gDAAgD,CAClD,CAAC;AAEW,QAAA,qBAAqB,GAAG,IAAA,0BAAa,EAC/C,0CAA0C,EAC1C,gDAAgD,CAClD,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc-connection.js","sourceRoot":"","sources":["../../src/client/rpc-connection.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAGlF,uDAAqG;AACrG,gCAAuD;AAGvD;;;;;GAKG;AACU,QAAA,0BAA0B,GAAG,IAAA,0BAAa,EACpD,+CAA+C,EAC/C,gDAAgD,CAClD,CAAC;AAEW,QAAA,qBAAqB,GAAG,IAAA,0BAAa,EAC/C,0CAA0C,EAC1C,gDAAgD,CAClD,CAAC;AA4CF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,aAAa;IAUD;IACA;IAVH,eAAe,CAAS;IACxB,aAAa,CAAsC;IACnD,SAAS,CAAyB;IACrD,0FAA0F;IAChF,UAAU,CAAuB;IACjC,QAAQ,GAAG,KAAK,CAAC;IACR,mBAAmB,CAAsB;IAE5D,YACsB,IAAc,EACd,MAAe,EAClC,OAA8C;QAF3B,SAAI,GAAJ,IAAI,CAAU;QACd,WAAM,GAAN,MAAM,CAAS;QAGlC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,mB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IAED;;;OAGG;IACO,cAAc;QACrB,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;YACf,OAAO;QACV,CAAC;QACD,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACzF,CAAC;IAES,UAAU;QACjB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,cAAc,CAAC,CAAC;QAC3D,CAAC;IACJ,CAAC;CACH;AA3ID,sCA2IC"}
|
|
@@ -171,6 +171,19 @@ export interface ProjectServerProtocol<TProject extends Project = Project> {
|
|
|
171
171
|
*/
|
|
172
172
|
export interface DataServerProtocol<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic, TProject extends Project = Project> extends DocumentServerProtocol<TTransfer, TDiagnostic>, ProjectServerProtocol<TProject> {
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* The diagnostic shape a server answers with, read back off its own
|
|
176
|
+
* declaration.
|
|
177
|
+
*
|
|
178
|
+
* This is what lets a client tier stay generic over the server alone and still
|
|
179
|
+
* describe what it hands back. Both parameters must be inferred: naming
|
|
180
|
+
* {@link TransferElement} for the transfer instead fails to match while that
|
|
181
|
+
* parameter is still generic, and a default declared against the constraint
|
|
182
|
+
* then stops satisfying it.
|
|
183
|
+
*/
|
|
184
|
+
export type DiagnosticOf<TServer> = TServer extends DocumentServerProtocol<infer _TTransfer, infer TDiagnostic> ? TDiagnostic : TransferDiagnostic;
|
|
185
|
+
/** The project shape a server answers with, read back off its own declaration. */
|
|
186
|
+
export type ProjectOf<TServer> = TServer extends ProjectServerProtocol<infer TProject> ? TProject : Project;
|
|
174
187
|
/**
|
|
175
188
|
* Cross-reference / naming slice of the server surface — scope-aware
|
|
176
189
|
* queries that resolve against the language's reference services. NOT part
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-server-protocol.d.ts","sourceRoot":"","sources":["../../src/data/data-server-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC3H,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,KAAK,EACT,oBAAoB,EACpB,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC9B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACT,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC5B,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,sBAAsB,CAAC,SAAS,SAAS,eAAe,EAAE,WAAW,SAAS,kBAAkB,GAAG,kBAAkB;IACnI;;;;;;;;;;;;;;;;;OAiBG;IACH,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;IAE1F;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CA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,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;CACjE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB,CAChC,SAAS,SAAS,eAAe,EACjC,WAAW,SAAS,kBAAkB,GAAG,kBAAkB,EAC3D,QAAQ,SAAS,OAAO,GAAG,OAAO,CAElC,SAAQ,sBAAsB,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC;CAAG"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,14 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
10
|
import { FRAMEWORK_CLIENT_IDS } from '../client-ids';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
DATA_CLIENT_PROTOCOL_METHODS,
|
|
13
|
+
DATA_SERVER_WIRE_PREFIX,
|
|
14
|
+
type DataClientProtocol,
|
|
15
|
+
type DataServerProtocol,
|
|
16
|
+
type DiagnosticOf,
|
|
17
|
+
type ProjectOf
|
|
18
|
+
} from '../data';
|
|
12
19
|
import type { TransferElement } from '../transfer-element';
|
|
13
20
|
import { DataEvents } from './data-events';
|
|
14
21
|
import type { DataPort } from './data-port';
|
|
@@ -65,7 +72,7 @@ export type DataConnectionArgs<TTransfer extends TransferElement, TClient extend
|
|
|
65
72
|
*/
|
|
66
73
|
export class DataConnection<
|
|
67
74
|
TTransfer extends TransferElement,
|
|
68
|
-
TServer extends DataServerProtocol<TTransfer
|
|
75
|
+
TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>,
|
|
69
76
|
TClient extends object = DataClientProtocol<TTransfer>
|
|
70
77
|
> extends RpcConnection<TServer, TClient> {
|
|
71
78
|
protected readonly sessions = new Set<DataSession<TTransfer, TServer>>();
|
|
@@ -139,15 +146,15 @@ export class DataConnection<
|
|
|
139
146
|
*/
|
|
140
147
|
export class DataConnectionWithEvents<
|
|
141
148
|
TTransfer extends TransferElement,
|
|
142
|
-
TServer extends DataServerProtocol<TTransfer
|
|
143
|
-
> extends DataConnection<TTransfer, TServer, DataEvents<TTransfer
|
|
149
|
+
TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>
|
|
150
|
+
> extends DataConnection<TTransfer, TServer, DataEvents<TTransfer, DiagnosticOf<TServer>, ProjectOf<TServer>>> {
|
|
144
151
|
/** Server pushes, fanned out to as many local listeners as the host has. */
|
|
145
|
-
readonly events: DataEvents<TTransfer
|
|
152
|
+
readonly events: DataEvents<TTransfer, DiagnosticOf<TServer>, ProjectOf<TServer>>;
|
|
146
153
|
|
|
147
154
|
constructor(port: DataPort, options?: DataConnectionOptions) {
|
|
148
155
|
// Built as a local because `this` is unavailable before `super`, then
|
|
149
156
|
// read back onto the field.
|
|
150
|
-
const events = new DataEvents<TTransfer
|
|
157
|
+
const events = new DataEvents<TTransfer, DiagnosticOf<TServer>, ProjectOf<TServer>>();
|
|
151
158
|
super(port, events, options);
|
|
152
159
|
this.events = events;
|
|
153
160
|
}
|
|
@@ -7,16 +7,51 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
|
-
import type { DataServerProtocol,
|
|
10
|
+
import type { DataServerProtocol, DiagnosticOf } from '../data';
|
|
11
11
|
import type { RpcProxy } from '../rpc';
|
|
12
12
|
import type { TransferDocument } from '../transfer-document';
|
|
13
13
|
import type { TransferElement } from '../transfer-element';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* What one of `TServer`'s document methods takes, minus the `clientId` a
|
|
17
|
+
* {@link DataSession} stamps itself.
|
|
18
|
+
*
|
|
19
|
+
* Read off the SERVER's signature, not off the framework's own arg type: an
|
|
20
|
+
* adopter server widens these, and a wrapper declared against the narrow
|
|
21
|
+
* shape rejects the extra field on a fresh object literal, so that call
|
|
22
|
+
* cannot go through a session at all.
|
|
23
|
+
*/
|
|
24
|
+
export type DataSessionArgs<TMethod extends (args: never) => unknown> = Omit<Parameters<TMethod>[0], 'clientId'>;
|
|
25
|
+
|
|
26
|
+
/** Open a document through a session; the session supplies `clientId`. */
|
|
27
|
+
export type DataSessionOpenArgs<
|
|
28
|
+
TTransfer extends TransferElement,
|
|
29
|
+
TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>
|
|
30
|
+
> = DataSessionArgs<TServer['openModelDocument']>;
|
|
31
|
+
|
|
32
|
+
/** Close a document through a session; the session supplies `clientId`. */
|
|
33
|
+
export type DataSessionCloseArgs<
|
|
34
|
+
TTransfer extends TransferElement,
|
|
35
|
+
TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>
|
|
36
|
+
> = DataSessionArgs<TServer['closeModelDocument']>;
|
|
37
|
+
|
|
15
38
|
/** Update a document through a session; the session supplies `clientId`. */
|
|
16
|
-
export type DataSessionUpdateArgs<
|
|
39
|
+
export type DataSessionUpdateArgs<
|
|
40
|
+
TTransfer extends TransferElement,
|
|
41
|
+
TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>
|
|
42
|
+
> = DataSessionArgs<TServer['updateModelDocument']>;
|
|
17
43
|
|
|
18
44
|
/** Persist a document through a session; the session supplies `clientId`. */
|
|
19
|
-
export type DataSessionSaveArgs<
|
|
45
|
+
export type DataSessionSaveArgs<
|
|
46
|
+
TTransfer extends TransferElement,
|
|
47
|
+
TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>
|
|
48
|
+
> = DataSessionArgs<TServer['saveModelDocument']>;
|
|
49
|
+
|
|
50
|
+
/** The document a session hands back, carrying its server's diagnostic shape. */
|
|
51
|
+
export type DataSessionDocument<
|
|
52
|
+
TTransfer extends TransferElement,
|
|
53
|
+
TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>
|
|
54
|
+
> = TransferDocument<TTransfer, DiagnosticOf<TServer>>;
|
|
20
55
|
|
|
21
56
|
/**
|
|
22
57
|
* What a {@link DataSession} needs from the connection that minted it.
|
|
@@ -24,7 +59,7 @@ export type DataSessionSaveArgs<TTransfer> = Omit<TransferSaveDocumentArgs<TTran
|
|
|
24
59
|
* Narrower than the connection itself so the dependency points one way:
|
|
25
60
|
* `DataConnection` constructs sessions, and nothing here imports it back.
|
|
26
61
|
*/
|
|
27
|
-
export interface DataSessionHost<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer
|
|
62
|
+
export interface DataSessionHost<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>>> {
|
|
28
63
|
connected(): Promise<RpcProxy<TServer>>;
|
|
29
64
|
releaseSession(session: DataSession<TTransfer, TServer>): void;
|
|
30
65
|
}
|
|
@@ -43,8 +78,18 @@ export interface DataSessionHost<TTransfer extends TransferElement, TServer exte
|
|
|
43
78
|
* attribute the write and release the hold accordingly.
|
|
44
79
|
*
|
|
45
80
|
* Generic over the transfer root so this file names no grammar.
|
|
81
|
+
*
|
|
82
|
+
* `TServer` is bound to a server answering with ITS OWN diagnostic shape, read
|
|
83
|
+
* back off the parameter being bound. Simplifying that to
|
|
84
|
+
* `DataServerProtocol<TTransfer>` compiles and costs the wrappers their
|
|
85
|
+
* return type: every call through `TServer` would resolve against that looser
|
|
86
|
+
* bound, so an adopter's diagnostics would come back as the framework's and
|
|
87
|
+
* the document would have to be cast on the way out.
|
|
46
88
|
*/
|
|
47
|
-
export class DataSession<
|
|
89
|
+
export class DataSession<
|
|
90
|
+
TTransfer extends TransferElement,
|
|
91
|
+
TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>
|
|
92
|
+
> {
|
|
48
93
|
/** URIs this session holds open, so {@link dispose} can release exactly those. */
|
|
49
94
|
protected readonly openUris = new Set<string>();
|
|
50
95
|
protected disposed = false;
|
|
@@ -68,8 +113,8 @@ export class DataSession<TTransfer extends TransferElement, TServer extends Data
|
|
|
68
113
|
}
|
|
69
114
|
|
|
70
115
|
/**
|
|
71
|
-
* Open `uri` for editing and start watching it, in that order,
|
|
72
|
-
* the opened snapshot.
|
|
116
|
+
* Open `args.uri` for editing and start watching it, in that order,
|
|
117
|
+
* returning the opened snapshot.
|
|
73
118
|
*
|
|
74
119
|
* **The order is the whole reason this method exists.**
|
|
75
120
|
* `watchModelDocument` baselines its dedup fingerprint from the *current*
|
|
@@ -85,32 +130,32 @@ export class DataSession<TTransfer extends TransferElement, TServer extends Data
|
|
|
85
130
|
* Validity arrives asynchronously on `onDocumentUpdated`, or synchronously
|
|
86
131
|
* from `getModelDocument({ includeDiagnostics: true })`.
|
|
87
132
|
*/
|
|
88
|
-
async openDocument(
|
|
133
|
+
async openDocument(args: DataSessionOpenArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>> {
|
|
89
134
|
const server = await this.connected();
|
|
90
|
-
const document = await server.openModelDocument({
|
|
91
|
-
await server.watchModelDocument({ uri, clientId: this.clientId });
|
|
92
|
-
this.openUris.add(uri);
|
|
135
|
+
const document = await server.openModelDocument({ ...args, clientId: this.clientId });
|
|
136
|
+
await server.watchModelDocument({ uri: args.uri, clientId: this.clientId });
|
|
137
|
+
this.openUris.add(args.uri);
|
|
93
138
|
return document;
|
|
94
139
|
}
|
|
95
140
|
|
|
96
141
|
/**
|
|
97
|
-
* Close `uri`. The server unwatches implicitly, so this is the dual of
|
|
142
|
+
* Close `args.uri`. The server unwatches implicitly, so this is the dual of
|
|
98
143
|
* {@link openDocument} and needs no separate unwatch.
|
|
99
144
|
*/
|
|
100
|
-
async closeDocument(
|
|
145
|
+
async closeDocument(args: DataSessionCloseArgs<TTransfer, TServer>): Promise<void> {
|
|
101
146
|
const server = await this.connected();
|
|
102
|
-
this.openUris.delete(uri);
|
|
103
|
-
await server.closeModelDocument({
|
|
147
|
+
this.openUris.delete(args.uri);
|
|
148
|
+
await server.closeModelDocument({ ...args, clientId: this.clientId });
|
|
104
149
|
}
|
|
105
150
|
|
|
106
151
|
/** Write `args.model` back as this session. */
|
|
107
|
-
async updateDocument(args: DataSessionUpdateArgs<TTransfer>): Promise<
|
|
152
|
+
async updateDocument(args: DataSessionUpdateArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>> {
|
|
108
153
|
const server = await this.connected();
|
|
109
154
|
return server.updateModelDocument({ ...args, clientId: this.clientId });
|
|
110
155
|
}
|
|
111
156
|
|
|
112
157
|
/** Persist `args.model` to disk as this session. */
|
|
113
|
-
async saveDocument(args: DataSessionSaveArgs<TTransfer>): Promise<
|
|
158
|
+
async saveDocument(args: DataSessionSaveArgs<TTransfer, TServer>): Promise<DataSessionDocument<TTransfer, TServer>> {
|
|
114
159
|
const server = await this.connected();
|
|
115
160
|
return server.saveModelDocument({ ...args, clientId: this.clientId });
|
|
116
161
|
}
|
|
@@ -33,7 +33,15 @@ export interface ReadyServer {
|
|
|
33
33
|
waitForReady(): Promise<void>;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Lifecycle reporting, for a host that raises warm-up UI around the two waits.
|
|
38
|
+
*
|
|
39
|
+
* Nothing fires until something asks for the connection — the generation is
|
|
40
|
+
* built on the first {@link RpcConnection.connected}. A host that wants the
|
|
41
|
+
* sequence at startup drives that call itself, or a workspace where nobody
|
|
42
|
+
* opens a document reports neither the connect nor the readiness its UI waits
|
|
43
|
+
* on.
|
|
44
|
+
*/
|
|
37
45
|
export interface RpcConnectionLifecycle {
|
|
38
46
|
/** A generation is opening its transport, including on each reconnect. */
|
|
39
47
|
readonly onConnecting?: () => void;
|
|
@@ -200,6 +200,22 @@ export interface DataServerProtocol<
|
|
|
200
200
|
>
|
|
201
201
|
extends DocumentServerProtocol<TTransfer, TDiagnostic>, ProjectServerProtocol<TProject> {}
|
|
202
202
|
|
|
203
|
+
/**
|
|
204
|
+
* The diagnostic shape a server answers with, read back off its own
|
|
205
|
+
* declaration.
|
|
206
|
+
*
|
|
207
|
+
* This is what lets a client tier stay generic over the server alone and still
|
|
208
|
+
* describe what it hands back. Both parameters must be inferred: naming
|
|
209
|
+
* {@link TransferElement} for the transfer instead fails to match while that
|
|
210
|
+
* parameter is still generic, and a default declared against the constraint
|
|
211
|
+
* then stops satisfying it.
|
|
212
|
+
*/
|
|
213
|
+
export type DiagnosticOf<TServer> =
|
|
214
|
+
TServer extends DocumentServerProtocol<infer _TTransfer, infer TDiagnostic> ? TDiagnostic : TransferDiagnostic;
|
|
215
|
+
|
|
216
|
+
/** The project shape a server answers with, read back off its own declaration. */
|
|
217
|
+
export type ProjectOf<TServer> = TServer extends ProjectServerProtocol<infer TProject> ? TProject : Project;
|
|
218
|
+
|
|
203
219
|
/**
|
|
204
220
|
* Cross-reference / naming slice of the server surface — scope-aware
|
|
205
221
|
* queries that resolve against the language's reference services. NOT part
|