@hydranium/protocol 1.0.0-next.25 → 1.0.0-next.250
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/src/client/data-port.ts
CHANGED
|
@@ -8,15 +8,21 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
10
|
import type { Event, MessageConnection } from 'vscode-jsonrpc';
|
|
11
|
+
import type { Logger } from '../logger';
|
|
12
|
+
import type { ResolvedMessage } from '../messages/primitives';
|
|
13
|
+
import type { RpcConnectionLifecycle } from './rpc-connection';
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* The one thing a host has to supply for the data head: a live JSON-RPC
|
|
14
|
-
* connection to the data server, plus the
|
|
15
|
-
* with it.
|
|
17
|
+
* connection to the data server, plus the failure sink that goes with it.
|
|
16
18
|
*
|
|
17
|
-
* "Port" in the hexagonal sense — the host implements it, `
|
|
19
|
+
* "Port" in the hexagonal sense — the host implements it, `DataConnection`
|
|
18
20
|
* consumes it, and nothing on either side of the boundary imports the other.
|
|
19
21
|
*
|
|
22
|
+
* Carries no identity. A `clientId` names a participant, and one transport
|
|
23
|
+
* serves as many as the host has; binding an identity here is what makes two
|
|
24
|
+
* of them share one, so it lives on `DataSession` instead.
|
|
25
|
+
*
|
|
20
26
|
* **This deliberately does NOT wrap the protocol methods.** `createRpcProxy`
|
|
21
27
|
* already takes a promise of a connection and produces the whole typed
|
|
22
28
|
* `DataServerProtocol` surface, so wrapping it would re-derive the framework's
|
|
@@ -24,7 +30,7 @@ import type { Event, MessageConnection } from 'vscode-jsonrpc';
|
|
|
24
30
|
* method allowlists, which cannot drift. Everything a form or a tree actually
|
|
25
31
|
* does — the wire contract, the open/watch/update/close sequence, `baseVersion`
|
|
26
32
|
* conflict handling, echo filtering by `sourceClientId` — is host-invariant and
|
|
27
|
-
* lives above this interface. What varies between hosts is exactly the
|
|
33
|
+
* lives above this interface. What varies between hosts is exactly the
|
|
28
34
|
* members below.
|
|
29
35
|
*
|
|
30
36
|
* **Why the transport hop and not merely the protocol.** In a Theia frontend
|
|
@@ -45,29 +51,25 @@ import type { Event, MessageConnection } from 'vscode-jsonrpc';
|
|
|
45
51
|
* calls on the promise but never calls `listen` itself.
|
|
46
52
|
*/
|
|
47
53
|
export interface DataPort {
|
|
48
|
-
/**
|
|
49
|
-
* Stable identity of this client on the data server, passed as `clientId`
|
|
50
|
-
* on every document request.
|
|
51
|
-
*
|
|
52
|
-
* It has to be stable for the session because it is the echo key: an
|
|
53
|
-
* inbound `onDocumentUpdated` carries the originating mutation's
|
|
54
|
-
* `clientId` as `sourceClientId`, and a client that cannot recognise its
|
|
55
|
-
* own echo treats its own write as a concurrent third-party one. It also
|
|
56
|
-
* has to be distinct per client, since it keys the server's per-
|
|
57
|
-
* `(uri, clientId)` watch bucket.
|
|
58
|
-
*
|
|
59
|
-
* Avoid the three values the framework itself uses as sentinels —
|
|
60
|
-
* `'language-client'`, `'unknown'` and `'revert-on-close'`.
|
|
61
|
-
*/
|
|
62
|
-
readonly clientId: string;
|
|
63
|
-
|
|
64
54
|
/**
|
|
65
55
|
* Open the transport and hand back a listening `MessageConnection`.
|
|
66
56
|
*
|
|
67
|
-
* Called at most once per connection generation. A rejection
|
|
68
|
-
* transport-construction failure and is reported
|
|
69
|
-
* {@link reportError} by the consumer; it must leave the port
|
|
70
|
-
* that a later generation can retry.
|
|
57
|
+
* Called at most once per connection generation. A rejection before the
|
|
58
|
+
* port is disposed is a transport-construction failure and is reported
|
|
59
|
+
* through {@link reportError} by the consumer; it must leave the port
|
|
60
|
+
* reusable, so that a later generation can retry.
|
|
61
|
+
*
|
|
62
|
+
* The consumer disposes a connection only when it drops the generation on
|
|
63
|
+
* {@link onDispose} or is disposed itself, so the connection of a generation
|
|
64
|
+
* that failed its readiness check stays with the port. A port whose
|
|
65
|
+
* connections reach one far end hands back the same connection until it is
|
|
66
|
+
* disposed: a second live one would take answers meant for the first, or end
|
|
67
|
+
* that far end when disposed. A port that opens an independent transport per
|
|
68
|
+
* call disposes the one it opened before at the next call. Either releases
|
|
69
|
+
* its connection at its own dispose and refuses to connect after it, since
|
|
70
|
+
* the consumer reconnects when told. Either serves one consumer: one
|
|
71
|
+
* consumer's dispose, or its next call to a port of the second kind,
|
|
72
|
+
* disposes the connection another still uses.
|
|
71
73
|
*/
|
|
72
74
|
connect(): Promise<MessageConnection>;
|
|
73
75
|
|
|
@@ -77,10 +79,19 @@ export interface DataPort {
|
|
|
77
79
|
*
|
|
78
80
|
* It exists because the alternative is worse in both directions: this tier
|
|
79
81
|
* cannot import a host's UI, and swallowing the error makes a dead
|
|
80
|
-
* connection look like an empty model.
|
|
81
|
-
*
|
|
82
|
+
* connection look like an empty model.
|
|
83
|
+
*
|
|
84
|
+
* `reported` is a complete sentence plus the identity needed to render it in
|
|
85
|
+
* another language. It carries a value rather than using a protocol field
|
|
86
|
+
* because this tier does not know whether a process hop intervenes — in a
|
|
87
|
+
* webview host the render happens across one — and a `ResolvedMessage` is
|
|
88
|
+
* structured-clone safe either way. Render it with `renderFrameworkMessage`;
|
|
89
|
+
* passing no translation map yields the English.
|
|
82
90
|
*/
|
|
83
|
-
reportError(error: unknown,
|
|
91
|
+
reportError(error: unknown, reported: ResolvedMessage): void;
|
|
92
|
+
|
|
93
|
+
/** Where a connection over this port logs what it does on its own. Without one it logs nothing. */
|
|
94
|
+
readonly logger?: Logger;
|
|
84
95
|
|
|
85
96
|
/**
|
|
86
97
|
* Fires when the host tears the transport down and the current connection
|
|
@@ -88,7 +99,7 @@ export interface DataPort {
|
|
|
88
99
|
* forces this to exist, since a restarted server binds new ephemeral ports
|
|
89
100
|
* and nothing re-discovers them.
|
|
90
101
|
*
|
|
91
|
-
* `
|
|
102
|
+
* `DataConnection` drops its connection generation on this event and
|
|
92
103
|
* builds a fresh one on the next request.
|
|
93
104
|
*
|
|
94
105
|
* A local `Event`, deliberately: nothing here crosses a structured-clone
|
|
@@ -96,4 +107,11 @@ export interface DataPort {
|
|
|
96
107
|
* `Disposable` on the *wire* would not be.
|
|
97
108
|
*/
|
|
98
109
|
readonly onDispose: Event<void>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Called for each connection generation, beside the lifecycle the
|
|
113
|
+
* connection's options pass, so a host reporting its connections itself
|
|
114
|
+
* does so without every connection built over it passing this on.
|
|
115
|
+
*/
|
|
116
|
+
readonly connectionLifecycle?: RpcConnectionLifecycle;
|
|
99
117
|
}
|