@hydranium/protocol 1.0.0-next.25 → 1.0.0-next.251
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 +44 -49
- package/lib/abstract-logger.d.ts +5 -0
- package/lib/abstract-logger.d.ts.map +1 -1
- package/lib/abstract-logger.js +7 -0
- package/lib/abstract-logger.js.map +1 -1
- package/lib/client/data-connection.d.ts +245 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +425 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +13 -1
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +21 -0
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +44 -27
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +473 -81
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +743 -108
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +14 -9
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +14 -9
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +10 -4
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +12 -6
- package/lib/client/message-relay.js.map +1 -1
- package/lib/client/post-message-transport.d.ts +64 -3
- package/lib/client/post-message-transport.d.ts.map +1 -1
- package/lib/client/post-message-transport.js +175 -1
- package/lib/client/post-message-transport.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +157 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +214 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/client-ids.d.ts +45 -0
- package/lib/client-ids.d.ts.map +1 -0
- package/lib/client-ids.js +48 -0
- package/lib/client-ids.js.map +1 -0
- package/lib/clock.d.ts +38 -0
- package/lib/clock.d.ts.map +1 -1
- package/lib/clock.js +36 -1
- package/lib/clock.js.map +1 -1
- package/lib/console-logger.d.ts +23 -0
- package/lib/console-logger.d.ts.map +1 -0
- package/lib/console-logger.js +39 -0
- package/lib/console-logger.js.map +1 -0
- package/lib/data/data-protocol-methods.d.ts +4 -4
- package/lib/data/data-protocol-methods.d.ts.map +1 -1
- package/lib/data/data-protocol-methods.js +12 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +132 -41
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +117 -21
- package/lib/data/events.d.ts.map +1 -1
- package/lib/data/requests.d.ts +69 -11
- package/lib/data/requests.d.ts.map +1 -1
- package/lib/debouncer.d.ts.map +1 -1
- package/lib/debouncer.js.map +1 -1
- package/lib/errors.d.ts +187 -29
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +270 -29
- package/lib/errors.js.map +1 -1
- package/lib/glsp-request-model-args.d.ts +16 -0
- package/lib/glsp-request-model-args.d.ts.map +1 -0
- package/lib/glsp-request-model-args.js +19 -0
- package/lib/glsp-request-model-args.js.map +1 -0
- package/lib/glsp-save-model-actions.d.ts +50 -0
- package/lib/glsp-save-model-actions.d.ts.map +1 -0
- package/lib/glsp-save-model-actions.js +28 -0
- package/lib/glsp-save-model-actions.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -1
- package/lib/latency-collector.d.ts +8 -4
- package/lib/latency-collector.d.ts.map +1 -1
- package/lib/latency-collector.js.map +1 -1
- package/lib/logger.d.ts +22 -1
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +31 -3
- package/lib/logger.js.map +1 -1
- package/lib/messages/index.d.ts +30 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +62 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/messages/primitives.d.ts +188 -0
- package/lib/messages/primitives.d.ts.map +1 -0
- package/lib/messages/primitives.js +161 -0
- package/lib/messages/primitives.js.map +1 -0
- package/lib/model-server.d.ts +60 -13
- 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/base-version.d.ts +64 -0
- package/lib/model-service/base-version.d.ts.map +1 -0
- package/lib/model-service/base-version.js +43 -0
- package/lib/model-service/base-version.js.map +1 -0
- package/lib/model-service/index.d.ts +1 -1
- package/lib/model-service/index.d.ts.map +1 -1
- package/lib/model-service/index.js +4 -5
- package/lib/model-service/index.js.map +1 -1
- package/lib/model-service/reference-candidate.d.ts +5 -3
- package/lib/model-service/reference-candidate.d.ts.map +1 -1
- package/lib/{model-service/args.js → node/index.d.ts} +2 -3
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +29 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/process-memory.d.ts +66 -0
- package/lib/node/process-memory.d.ts.map +1 -0
- package/lib/node/process-memory.js +291 -0
- package/lib/node/process-memory.js.map +1 -0
- package/lib/noop-logger.d.ts.map +1 -1
- package/lib/noop-logger.js.map +1 -1
- package/lib/observable-value.js.map +1 -1
- package/lib/patch-merge.d.ts +35 -32
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +67 -23
- package/lib/patch-merge.js.map +1 -1
- package/lib/profile-session.d.ts +8 -4
- package/lib/profile-session.d.ts.map +1 -1
- package/lib/profile-session.js.map +1 -1
- package/lib/random-uuid.d.ts +14 -0
- package/lib/random-uuid.d.ts.map +1 -0
- package/lib/random-uuid.js +24 -0
- package/lib/random-uuid.js.map +1 -0
- package/lib/reconcile-write.d.ts +65 -0
- package/lib/reconcile-write.d.ts.map +1 -0
- package/lib/reconcile-write.js +67 -0
- package/lib/reconcile-write.js.map +1 -0
- package/lib/rpc/bind-rpc-methods.d.ts +33 -3
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +32 -3
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +10 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +12 -2
- package/lib/rpc/create-rpc-proxy.js.map +1 -1
- package/lib/rpc/index.d.ts +1 -0
- package/lib/rpc/index.d.ts.map +1 -1
- package/lib/rpc/index.js +1 -0
- package/lib/rpc/index.js.map +1 -1
- package/lib/rpc/send-by-method-name.d.ts +76 -0
- package/lib/rpc/send-by-method-name.d.ts.map +1 -0
- package/lib/rpc/send-by-method-name.js +120 -0
- package/lib/rpc/send-by-method-name.js.map +1 -0
- package/lib/rpc/wire-prefix.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 +46 -15
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +58 -10
- package/lib/testing/data-doubles.js.map +1 -1
- package/lib/testing/fake-clock.d.ts +9 -1
- package/lib/testing/fake-clock.d.ts.map +1 -1
- package/lib/testing/fake-clock.js +54 -45
- package/lib/testing/fake-clock.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 +5 -2
- package/lib/testing/index.js.map +1 -1
- package/lib/testing/node/duplex-connection.d.ts.map +1 -1
- package/lib/testing/node/duplex-connection.js +3 -2
- package/lib/testing/node/duplex-connection.js.map +1 -1
- package/lib/testing/node/duplex-stream.js.map +1 -1
- package/lib/testing/node/index.d.ts +1 -0
- package/lib/testing/node/index.d.ts.map +1 -1
- package/lib/testing/node/index.js +2 -2
- package/lib/testing/node/index.js.map +1 -1
- package/lib/testing/node/message-port-pair.d.ts +25 -0
- package/lib/testing/node/message-port-pair.d.ts.map +1 -0
- package/lib/testing/node/message-port-pair.js +26 -0
- package/lib/testing/node/message-port-pair.js.map +1 -0
- package/lib/testing/wait-for.d.ts +3 -2
- package/lib/testing/wait-for.d.ts.map +1 -1
- package/lib/testing/wait-for.js +40 -10
- package/lib/testing/wait-for.js.map +1 -1
- package/lib/tracer.d.ts.map +1 -1
- package/lib/tracer.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 +70 -32
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js +17 -9
- package/lib/transfer-document.js.map +1 -1
- package/lib/uri.d.ts.map +1 -1
- package/lib/uri.js.map +1 -1
- package/lib/util.d.ts +8 -0
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +32 -0
- package/lib/util.js.map +1 -1
- package/package.json +29 -37
- package/src/abstract-logger.ts +8 -0
- package/src/client/data-connection.ts +520 -0
- package/src/client/data-events.ts +33 -1
- package/src/client/data-port.ts +46 -28
- package/src/client/data-session.ts +951 -126
- package/src/client/index.ts +14 -9
- package/src/client/message-relay.ts +30 -8
- package/src/client/post-message-transport.ts +219 -4
- package/src/client/rpc-connection.ts +281 -0
- package/src/client-ids.ts +49 -0
- package/src/clock.ts +56 -0
- package/src/console-logger.ts +39 -0
- package/src/data/data-protocol-methods.ts +13 -4
- package/src/data/data-server-protocol.ts +157 -41
- package/src/data/events.ts +123 -21
- package/src/data/requests.ts +74 -11
- package/src/errors.ts +322 -36
- package/src/glsp-request-model-args.ts +16 -0
- package/src/glsp-save-model-actions.ts +59 -0
- package/src/index.ts +10 -0
- package/src/latency-collector.ts +8 -3
- package/src/logger.ts +28 -2
- package/src/messages/index.ts +37 -0
- package/src/messages/primitives.ts +271 -0
- package/src/model-server.ts +64 -19
- package/src/model-service/base-version.ts +72 -0
- package/src/model-service/index.ts +4 -5
- package/src/model-service/reference-candidate.ts +5 -3
- package/src/node/index.ts +14 -0
- package/src/node/process-memory.ts +299 -0
- package/src/patch-merge.ts +97 -42
- package/src/profile-session.ts +9 -4
- package/src/random-uuid.ts +21 -0
- package/src/reconcile-write.ts +124 -0
- package/src/rpc/README.md +4 -5
- package/src/rpc/bind-rpc-methods.ts +59 -4
- package/src/rpc/create-rpc-proxy.ts +20 -2
- package/src/rpc/index.ts +1 -0
- package/src/rpc/send-by-method-name.ts +140 -0
- package/src/testing/catalogue-audit.ts +111 -0
- package/src/testing/data-doubles.ts +149 -25
- package/src/testing/fake-clock.ts +62 -47
- package/src/testing/index.ts +5 -2
- package/src/testing/node/duplex-connection.ts +3 -2
- package/src/testing/node/index.ts +2 -2
- package/src/testing/node/message-port-pair.ts +40 -0
- package/src/testing/wait-for.ts +38 -11
- package/src/transfer-diagnostic.ts +40 -0
- package/src/transfer-document.ts +87 -34
- package/src/util.ts +33 -0
- package/lib/model-service/args.d.ts +0 -64
- package/lib/model-service/args.d.ts.map +0 -1
- package/lib/model-service/args.js.map +0 -1
- package/src/model-service/args.ts +0 -67
package/README.md
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
# `@hydranium/protocol`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[Hydranium](https://github.com/eclipse-emfcloud/hydranium)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
The contract shared between
|
|
4
|
+
[Hydranium](https://github.com/eclipse-emfcloud/hydranium) servers and their
|
|
5
|
+
clients. With `vscode-jsonrpc`, it is the only Hydranium package a pure client
|
|
6
|
+
needs: a form editor, a tree view or a code generator talking to the data head
|
|
7
|
+
never depends on `@hydranium/core`, which carries the Langium runtime.
|
|
8
|
+
|
|
9
|
+
## What it gives you
|
|
10
|
+
|
|
11
|
+
- Type your client against `DataServerProtocol` and `DataClientProtocol`.
|
|
12
|
+
- Connect, reconnect and open documents through one client tier, in a Theia
|
|
13
|
+
frontend, a VS Code extension or webview, or a plain browser page.
|
|
14
|
+
- Declare your own RPC contract as a TypeScript interface and use it on both
|
|
15
|
+
ends of a connection.
|
|
16
|
+
- Test your client, and audit your translation catalogues (see *Translate your
|
|
17
|
+
language* in
|
|
18
|
+
[Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md)).
|
|
17
19
|
|
|
18
20
|
## Install
|
|
19
21
|
|
|
20
22
|
```bash
|
|
21
|
-
npm install @hydranium/protocol
|
|
23
|
+
npm install @hydranium/protocol vscode-jsonrpc
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`vscode-jsonrpc`
|
|
27
|
-
the Langium runtime and does not bundle for a client.
|
|
26
|
+
| Peer | Range |
|
|
27
|
+
| ---------------- | -------- |
|
|
28
|
+
| `vscode-jsonrpc` | `^9.0.0` |
|
|
28
29
|
|
|
29
30
|
## The RPC pattern
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
between the two is hand-written, and the compiler is what keeps the ends
|
|
35
|
-
agreeing.
|
|
32
|
+
You declare a contract `T`, bind it on the server with `bindRpcMethods`, and
|
|
33
|
+
call it with `createRpcProxy<T>`. Nothing between the two is hand-written, so
|
|
34
|
+
the compiler keeps the ends agreeing.
|
|
36
35
|
|
|
37
36
|
```
|
|
38
|
-
|
|
37
|
+
your contract T your contract T
|
|
39
38
|
│ │
|
|
40
39
|
▼ ▼
|
|
41
40
|
bindRpcMethods createRpcProxy<T>
|
|
@@ -45,37 +44,33 @@ agreeing.
|
|
|
45
44
|
(vscode-jsonrpc)
|
|
46
45
|
```
|
|
47
46
|
|
|
48
|
-
The
|
|
49
|
-
|
|
50
|
-
a contract written once works on both ends with no per-method configuration.
|
|
51
|
-
Both are exported from the package root; there is no `/rpc` subpath.
|
|
47
|
+
The options both ends must agree on, and a worked example, are in
|
|
48
|
+
[`src/rpc/README.md`](./src/rpc/README.md).
|
|
52
49
|
|
|
53
|
-
|
|
54
|
-
names, a worked example — is in
|
|
55
|
-
[`src/rpc/README.md`](./src/rpc/README.md), which ships in the tarball.
|
|
50
|
+
## Entry points
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
| Subpath | Use it for | Runs in |
|
|
53
|
+
| ---------------- | ----------------------------------------------------------- | --------------- |
|
|
54
|
+
| `.` | The production surface, `./data` and `./client` included | browser-neutral |
|
|
55
|
+
| `./data` | The data-head protocol types alone | browser-neutral |
|
|
56
|
+
| `./client` | The client tier alone | browser-neutral |
|
|
57
|
+
| `./messages` | The message codes this package raises | browser-neutral |
|
|
58
|
+
| `./node` | Process-memory and heap-snapshot diagnostics | Node-only |
|
|
59
|
+
| `./testing` | Test doubles, waiters and the translation-catalogue audit | browser-neutral |
|
|
60
|
+
| `./testing/node` | In-memory stream and port pairs for tests | Node-only |
|
|
66
61
|
|
|
67
|
-
The
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
machinery documents itself in [`src/rpc/README.md`](./src/rpc/README.md).
|
|
62
|
+
The subpaths need a TypeScript `moduleResolution` that reads `exports`
|
|
63
|
+
(`NodeNext` or `Bundler`); see *Requirements* in
|
|
64
|
+
[Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
|
|
71
65
|
|
|
72
66
|
## Status
|
|
73
67
|
|
|
74
|
-
Alpha
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
Alpha: every release is a prerelease that may break the API, so pin an exact
|
|
69
|
+
version. Guides and known limitations:
|
|
70
|
+
[Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
|
|
77
71
|
|
|
78
72
|
## License
|
|
79
73
|
|
|
80
74
|
`MIT` — see this package's [`LICENSE`](./LICENSE), and the repository
|
|
81
|
-
[`NOTICE.md`](
|
|
75
|
+
[`NOTICE.md`](https://github.com/eclipse-emfcloud/hydranium/blob/main/NOTICE.md)
|
|
76
|
+
for third-party notices.
|
package/lib/abstract-logger.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export declare abstract class AbstractLogger implements Logger {
|
|
|
35
35
|
protected clock(): Clock;
|
|
36
36
|
/** Render the current wall-clock instant as `HH:MM:SS.mmm`, sourced from {@link clock}. */
|
|
37
37
|
protected timestamp(): string;
|
|
38
|
+
/**
|
|
39
|
+
* The `[Label - HH:MM:SS.mmm] [component]` prefix every sink starts a line
|
|
40
|
+
* with. The label is padded to the widest, so timestamps line up across sinks.
|
|
41
|
+
*/
|
|
42
|
+
protected formatLinePrefix(label: string): string;
|
|
38
43
|
error(message?: string, ...args: unknown[]): this;
|
|
39
44
|
warn(message?: string, ...args: unknown[]): this;
|
|
40
45
|
info(message?: string, ...args: unknown[]): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-logger.d.ts","sourceRoot":"","sources":["../src/abstract-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,SAAS,CAAC;AAClD,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAK1F;;;;;;;;;;;;GAYG;AACH,8BAAsB,cAAe,YAAW,MAAM;IACvC,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"abstract-logger.d.ts","sourceRoot":"","sources":["../src/abstract-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,SAAS,CAAC;AAClD,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAK1F;;;;;;;;;;;;GAYG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B;IAED;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzB;IAED,yFAAyF;IACzF,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,SAAS,OAAO,EAAO,EAAE,KAAK,SAAsB,GAAG,IAAI,CAKlH;IAED,gGAAgG;IAChG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzG,qFAAqF;IACrF,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACrD"}
|
package/lib/abstract-logger.js
CHANGED
|
@@ -46,6 +46,13 @@ class AbstractLogger {
|
|
|
46
46
|
timestamp() {
|
|
47
47
|
return logger_1.Format.timestamp(new Date(this.clock().now()));
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* The `[Label - HH:MM:SS.mmm] [component]` prefix every sink starts a line
|
|
51
|
+
* with. The label is padded to the widest, so timestamps line up across sinks.
|
|
52
|
+
*/
|
|
53
|
+
formatLinePrefix(label) {
|
|
54
|
+
return `[${label.padEnd(5)} - ${this.timestamp()}]${this.component ? ` [${this.component}]` : ''}`;
|
|
55
|
+
}
|
|
49
56
|
error(message, ...args) {
|
|
50
57
|
this.send('error', message, args);
|
|
51
58
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-logger.js","sourceRoot":"","sources":["../src/abstract-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,mCAAkD;AAClD,qCAA0F;AAE1F,uHAAuH;AACvH,MAAM,WAAW,GAAG,IAAI,mBAAW,EAAE,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,
|
|
1
|
+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CAAC,CAAC;IACzB,CAAC;IAED,yFAAyF;IAC/E,IAAI,CAAC,KAAe,EAAE,OAAgB,EAAE,IAAI,GAAuB,EAAE,EAAE,KAAK,GAAG,qBAAY,CAAC,KAAK,CAAC;QACzG,IAAI,CAAC,OAAO,IAAI,CAAC,eAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7C,OAAO;QACV,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CAOH"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { Disposable, Emitter, type Event } from 'vscode-jsonrpc';
|
|
10
|
+
import { type DataClientProtocol, type DataServerProtocol, type DiagnosticOf, type ProjectOf, type TransferDocumentDirtyChangedEvent, type TransferDocumentUpdatedEvent } from '../data';
|
|
11
|
+
import type { Logger } from '../logger';
|
|
12
|
+
import type { TransferElement } from '../transfer-element';
|
|
13
|
+
import { DataEvents } from './data-events';
|
|
14
|
+
import type { DataPort } from './data-port';
|
|
15
|
+
import { DataSession, type DataSessionFactory } from './data-session';
|
|
16
|
+
import { RpcConnection, type RpcConnectionGeneration, type RpcConnectionLifecycle } from './rpc-connection';
|
|
17
|
+
/**
|
|
18
|
+
* A watch {@link DataConnection.watchDocument} keeps could not be sent again to
|
|
19
|
+
* a connection that became ready after a drop; the next one sends it again.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DATA_CONNECTION_WATCH_RESTORE_FAILED: import("../messages/primitives").MessageDefinition<"Could not watch {uri} again after reconnecting to the data server: {detail}">;
|
|
22
|
+
/**
|
|
23
|
+
* A session's restore threw when its connection came back; the connection
|
|
24
|
+
* went on restoring the others.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DATA_CONNECTION_SESSION_RESTORE_FAILED: import("../messages/primitives").MessageDefinition<"Could not restore a session after reconnecting to the data server: {detail}">;
|
|
27
|
+
/** Options for {@link DataConnection}. */
|
|
28
|
+
export interface DataConnectionOptions<TTransfer extends TransferElement = TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> extends RpcConnectionLifecycle {
|
|
29
|
+
/**
|
|
30
|
+
* Wire namespace the server is addressed under. Defaults to the
|
|
31
|
+
* framework's {@link DATA_SERVER_WIRE_PREFIX}, which is what an unmodified
|
|
32
|
+
* `DataServer` binds. Override only alongside the server's own
|
|
33
|
+
* `methodNamespace` option — a mismatch turns every request into
|
|
34
|
+
* "Unhandled method" rather than failing at wire-up.
|
|
35
|
+
*/
|
|
36
|
+
readonly methodNamespace?: string;
|
|
37
|
+
/** Builds the sessions `createSession` hands out. Defaults to a plain {@link DataSession}. */
|
|
38
|
+
readonly sessionFactory?: DataSessionFactory<TTransfer, TServer>;
|
|
39
|
+
}
|
|
40
|
+
/** {@link DataConnectionOptions} for a client that does not speak {@link DataClientProtocol}. */
|
|
41
|
+
export interface DataConnectionOptionsWithMethods<TClient extends object, TTransfer extends TransferElement = TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> extends DataConnectionOptions<TTransfer, TServer> {
|
|
42
|
+
/**
|
|
43
|
+
* Method names of the client to bind as inbound handlers. Declare it
|
|
44
|
+
* `as const satisfies ReadonlyArray<keyof YourClient & string>` so the list
|
|
45
|
+
* cannot drift from the interface.
|
|
46
|
+
*/
|
|
47
|
+
readonly clientMethods: readonly (keyof TClient & string)[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Trailing constructor arguments, required only when the client cannot take
|
|
51
|
+
* the framework's default method list.
|
|
52
|
+
*
|
|
53
|
+
* `bindRpcMethods` throws for a name the target does not implement, so a
|
|
54
|
+
* request/response-only client binding the default list fails at wire-up. The
|
|
55
|
+
* conditional turns that into a compile error.
|
|
56
|
+
*/
|
|
57
|
+
export type DataConnectionArgs<TTransfer extends TransferElement, TClient extends object, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>> = TClient extends DataClientProtocol<TTransfer> ? [options?: DataConnectionOptions<TTransfer, TServer> & Partial<DataConnectionOptionsWithMethods<TClient, TTransfer, TServer>>] : [options: DataConnectionOptionsWithMethods<TClient, TTransfer, TServer>];
|
|
58
|
+
/**
|
|
59
|
+
* A {@link RpcConnection} to the data head, carrying as many participants as
|
|
60
|
+
* the host has interested parties.
|
|
61
|
+
*
|
|
62
|
+
* Document operations live on the participants rather than here: they carry a
|
|
63
|
+
* `clientId`, which identifies a participant rather than a wire, and the server
|
|
64
|
+
* keys its opens and watches per `(uri, clientId)`. Two parties sharing one
|
|
65
|
+
* identity cannot tell each other's writes from their own echoes.
|
|
66
|
+
* {@link DataConnection.watchDocument} is the exception: it acts as no
|
|
67
|
+
* participant, under an id no session holds, and opens or writes nothing.
|
|
68
|
+
*
|
|
69
|
+
* Generic over the transfer root so this file names no grammar. An adopter
|
|
70
|
+
* binds the concrete root (or the union of them, for a multi-grammar head) at
|
|
71
|
+
* its own edge.
|
|
72
|
+
*/
|
|
73
|
+
export declare class DataConnection<TTransfer extends TransferElement, TServer extends DataServerProtocol<TTransfer, DiagnosticOf<TServer>> = DataServerProtocol<TTransfer>, TClient extends object = DataClientProtocol<TTransfer>> extends RpcConnection<TServer, TClient> {
|
|
74
|
+
protected readonly sessions: Set<DataSession<TTransfer, TServer>>;
|
|
75
|
+
protected readonly sessionFactory: DataSessionFactory<TTransfer, TServer>;
|
|
76
|
+
protected readonly createSessionEmitter: Emitter<DataSession<TTransfer, TServer>>;
|
|
77
|
+
/**
|
|
78
|
+
* Fires with each session {@link createSession} starts, before it returns,
|
|
79
|
+
* so a listener sees every session a caller can. A session started before
|
|
80
|
+
* the listener subscribed is in {@link liveSessions}.
|
|
81
|
+
*/
|
|
82
|
+
readonly onDidCreateSession: Event<DataSession<TTransfer, TServer>>;
|
|
83
|
+
/**
|
|
84
|
+
* Per URI, the `dirty` the client was last told, whether a session of this
|
|
85
|
+
* connection has it open or a watch follows it. A session's open or close
|
|
86
|
+
* of the URI forgets it; disposing a watch does not, since a watch knows
|
|
87
|
+
* only the caller's spelling of the URI, not the server's key. A
|
|
88
|
+
* session's restore and a watch sent again after a reconnect tell the
|
|
89
|
+
* client their answer where it differs, a forgotten URI included; see
|
|
90
|
+
* {@link restoreDirty}.
|
|
91
|
+
*/
|
|
92
|
+
protected readonly dirtyStates: Map<string, boolean>;
|
|
93
|
+
/** Backs each session's {@link DataSessionHost.onDidChangeDirty}. */
|
|
94
|
+
protected readonly dirtyChangedEmitter: Emitter<TransferDocumentDirtyChangedEvent>;
|
|
95
|
+
/** Backs each session's {@link DataSessionHost.onDidUpdateDocument}. */
|
|
96
|
+
protected readonly documentUpdatedEmitter: Emitter<TransferDocumentUpdatedEvent<TTransfer, DiagnosticOf<TServer>>>;
|
|
97
|
+
/**
|
|
98
|
+
* Per id {@link watchDocument} watches under, the URI it watches, which
|
|
99
|
+
* {@link generationReady} sends again to every later generation until the
|
|
100
|
+
* watch's handle is disposed.
|
|
101
|
+
*/
|
|
102
|
+
protected readonly watches: Map<string, string>;
|
|
103
|
+
/**
|
|
104
|
+
* Per id, the URI of a watch whose handle was disposed with no ready
|
|
105
|
+
* generation to unwatch on. {@link generationReady} sends the unwatch to the
|
|
106
|
+
* next ready one: a generation that failed its readiness check after its
|
|
107
|
+
* watches were sent leaves them on a connection the port may hand back.
|
|
108
|
+
*/
|
|
109
|
+
protected readonly pendingUnwatches: Map<string, string>;
|
|
110
|
+
/** The port's logger, or one that logs nothing. */
|
|
111
|
+
protected readonly logger: Logger;
|
|
112
|
+
/** Backs {@link onDidReconnect}. */
|
|
113
|
+
protected readonly reconnectEmitter: Emitter<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Fires on every reconnect: once a connection becomes ready after an
|
|
116
|
+
* earlier one was, and its watches have been sent. The server sends no
|
|
117
|
+
* event for a change made while the connection was down, so a watcher reads
|
|
118
|
+
* its document again on this; a read it sends now reaches the server after
|
|
119
|
+
* its watch.
|
|
120
|
+
*/
|
|
121
|
+
readonly onDidReconnect: Event<void>;
|
|
122
|
+
/** Whether a generation was ready before, which makes the next one a reconnect. */
|
|
123
|
+
protected readyBefore: boolean;
|
|
124
|
+
constructor(port: DataPort, client: TClient, ...rest: DataConnectionArgs<TTransfer, TClient, TServer>);
|
|
125
|
+
/**
|
|
126
|
+
* The sessions of this connection that have not ended, in the order they
|
|
127
|
+
* started. A session is listed until its `onDidDispose` fires, or until
|
|
128
|
+
* {@link dispose} clears the list.
|
|
129
|
+
*/
|
|
130
|
+
get liveSessions(): readonly DataSession<TTransfer, TServer>[];
|
|
131
|
+
/**
|
|
132
|
+
* Start a participant on this connection, registered with the server under a
|
|
133
|
+
* fresh id, `label` plus `#` plus a random UUID, or under `clientId` when
|
|
134
|
+
* given. Pass a `label` naming the participant; without one it is
|
|
135
|
+
* `session`. Synchronous: the registration is sent at once, and the
|
|
136
|
+
* session's calls wait for it. The server refuses an id live anywhere in
|
|
137
|
+
* its process, and every call of that session then rejects with an error
|
|
138
|
+
* `isDuplicateClientIdError` recognises; an id the server reserves beyond
|
|
139
|
+
* {@link FRAMEWORK_CLIENT_IDS}, such as the integrity author, with one
|
|
140
|
+
* `isReservedClientIdError` recognises. Only the code crosses the wire, so
|
|
141
|
+
* test with those guards rather than `instanceof`.
|
|
142
|
+
*
|
|
143
|
+
* Throws a {@link ReservedClientIdError} for an id in
|
|
144
|
+
* {@link FRAMEWORK_CLIENT_IDS} — those are authors the SERVER emits rather
|
|
145
|
+
* than participants, so a session holding one would read the framework's
|
|
146
|
+
* own broadcasts as its own echoes and drop them — and a
|
|
147
|
+
* {@link DuplicateClientIdError} for an id a live session on this
|
|
148
|
+
* connection already holds.
|
|
149
|
+
*/
|
|
150
|
+
createSession(label?: string, clientId?: string): DataSession<TTransfer, TServer>;
|
|
151
|
+
/**
|
|
152
|
+
* Follow `uri` without opening it: its update events reach this
|
|
153
|
+
* connection's client once this resolves. An open would hold the document
|
|
154
|
+
* for as long as the caller follows it. The watch runs under an id of its
|
|
155
|
+
* own, `label` plus `#` plus a random UUID, and needs no session: a session
|
|
156
|
+
* closing the document would also end its own watch of it. Every later
|
|
157
|
+
* connection that becomes ready gets the watch again. Disposing the handle
|
|
158
|
+
* unwatches.
|
|
159
|
+
*/
|
|
160
|
+
watchDocument(uri: string, label?: string): Promise<Disposable>;
|
|
161
|
+
/**
|
|
162
|
+
* The client, with its `onDocumentDirtyChanged` passing through
|
|
163
|
+
* {@link deliverDirty} first, so {@link dirtyStates} holds what the server
|
|
164
|
+
* told it, and every session hears it through {@link dirtyChangedEmitter};
|
|
165
|
+
* and with its `onDocumentUpdated` heard by every session through
|
|
166
|
+
* {@link documentUpdatedEmitter} first. Every other bound method forwards
|
|
167
|
+
* to the client unchanged, and one the client lacks stays absent, so the
|
|
168
|
+
* binding still refuses it.
|
|
169
|
+
*/
|
|
170
|
+
protected localTarget(): TClient;
|
|
171
|
+
/**
|
|
172
|
+
* Hand a dirty state a restore read to the client, unless it is what
|
|
173
|
+
* {@link dirtyStates} says the client was last told; a URI it holds
|
|
174
|
+
* nothing for counts as different.
|
|
175
|
+
*/
|
|
176
|
+
protected restoreDirty(event: TransferDocumentDirtyChangedEvent): void;
|
|
177
|
+
/** Record `event` in {@link dirtyStates} and hand it to the client. */
|
|
178
|
+
protected deliverDirty(event: TransferDocumentDirtyChangedEvent): void;
|
|
179
|
+
/**
|
|
180
|
+
* After the transport dropped, reconnect on the next macrotask for the
|
|
181
|
+
* sessions with documents open, so they re-watch and follow their documents
|
|
182
|
+
* again without waiting for a call of their own, and connect for what
|
|
183
|
+
* {@link watchDocument} watches, which {@link generationReady} places
|
|
184
|
+
* again; a session with nothing open restores on its next call. Nothing is
|
|
185
|
+
* scheduled once this connection is disposed, which drops its generation
|
|
186
|
+
* too.
|
|
187
|
+
*/
|
|
188
|
+
protected dropGeneration(): void;
|
|
189
|
+
/**
|
|
190
|
+
* Call `reconnect()` on every session, reporting a throw instead of letting
|
|
191
|
+
* one session's restore stop the others and the watches after them, and,
|
|
192
|
+
* inside the readiness gate, fail the whole generation.
|
|
193
|
+
*/
|
|
194
|
+
protected reconnectSessions(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Restore what the server lost with an earlier generation, whichever
|
|
197
|
+
* request brought this one up: the documents of sessions that have some
|
|
198
|
+
* open, and every watch {@link watchDocument} keeps.
|
|
199
|
+
*/
|
|
200
|
+
protected generationReady(generation: RpcConnectionGeneration<TServer>): void;
|
|
201
|
+
/** Take back the watch of `uri` under `clientId` on `generation`; the server ignores one it does not hold. */
|
|
202
|
+
protected unwatch(generation: RpcConnectionGeneration<TServer>, clientId: string, uri: string): void;
|
|
203
|
+
/**
|
|
204
|
+
* Send the watch of `uri` under `clientId` to `generation`, which has just
|
|
205
|
+
* passed its readiness gate. Sent at once rather than after a wait, so no
|
|
206
|
+
* drop can come between choosing the generation and sending. A failure is
|
|
207
|
+
* reported, since no caller waits on it, only while the watch is kept and
|
|
208
|
+
* `generation` is still current: otherwise the next generation sends it
|
|
209
|
+
* again.
|
|
210
|
+
*
|
|
211
|
+
* Once the watch is in place, the document's dirty state is read and goes
|
|
212
|
+
* through {@link restoreDirty}, as a session's restore does: a flip while
|
|
213
|
+
* the connection was down reached no one.
|
|
214
|
+
*/
|
|
215
|
+
protected watchAgain(generation: RpcConnectionGeneration<TServer>, clientId: string, uri: string): void;
|
|
216
|
+
/**
|
|
217
|
+
* Sessions are detached rather than disposed: the server ends every session
|
|
218
|
+
* on a connection it sees close, so ending each one first sends requests
|
|
219
|
+
* over a connection this call is about to dispose.
|
|
220
|
+
*/
|
|
221
|
+
dispose(): void;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* A {@link DataConnection} that brings its own {@link DataEvents}, so a host
|
|
225
|
+
* with several interested parties does not have to supply one.
|
|
226
|
+
*
|
|
227
|
+
* **The client slot holds exactly one object, and that is why this exists.**
|
|
228
|
+
* `createRpcProxy` binds a single `localTarget`, and underneath a method name
|
|
229
|
+
* maps to one handler — a second registration replaces the first silently. So a
|
|
230
|
+
* properties panel and a tree cannot both be the client; one fan-out sits in the
|
|
231
|
+
* slot and both subscribe to it.
|
|
232
|
+
*
|
|
233
|
+
* Use {@link DataConnection} directly instead when the client is yours: an
|
|
234
|
+
* adopter service that implements the protocol plus its own methods, a single
|
|
235
|
+
* consumer that IS the client, or a request/response-only client that binds
|
|
236
|
+
* nothing.
|
|
237
|
+
*/
|
|
238
|
+
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>>> {
|
|
239
|
+
/** Server pushes, fanned out to as many local listeners as the host has. */
|
|
240
|
+
readonly events: DataEvents<TTransfer, DiagnosticOf<TServer>, ProjectOf<TServer>>;
|
|
241
|
+
constructor(port: DataPort, options?: DataConnectionOptions<TTransfer, TServer>);
|
|
242
|
+
/** Disposes the fan-out it created, which no caller else holds. */
|
|
243
|
+
dispose(): void;
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=data-connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-connection.d.ts","sourceRoot":"","sources":["../../src/client/data-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAGJ,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,YAAY,E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