@hydranium/data-client-theia 1.0.0-next.7 → 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.
Files changed (48) hide show
  1. package/README.md +24 -25
  2. package/lib/browser/channel-connection.d.ts +2 -2
  3. package/lib/browser/channel-data-port.d.ts +65 -0
  4. package/lib/browser/channel-data-port.d.ts.map +1 -0
  5. package/lib/browser/channel-data-port.js +115 -0
  6. package/lib/browser/channel-data-port.js.map +1 -0
  7. package/lib/browser/index.d.ts +1 -3
  8. package/lib/browser/index.d.ts.map +1 -1
  9. package/lib/browser/index.js +1 -3
  10. package/lib/browser/index.js.map +1 -1
  11. package/lib/common/emitter-data-client.d.ts +9 -1
  12. package/lib/common/emitter-data-client.d.ts.map +1 -1
  13. package/lib/common/emitter-data-client.js +12 -0
  14. package/lib/common/emitter-data-client.js.map +1 -1
  15. package/lib/node/connection-container-module.d.ts +5 -4
  16. package/lib/node/connection-container-module.d.ts.map +1 -1
  17. package/lib/node/connection-container-module.js +5 -4
  18. package/lib/node/connection-container-module.js.map +1 -1
  19. package/lib/node/data-server-connection-handler.d.ts +10 -0
  20. package/lib/node/data-server-connection-handler.d.ts.map +1 -1
  21. package/lib/node/data-server-connection-handler.js +1 -1
  22. package/lib/node/data-server-connection-handler.js.map +1 -1
  23. package/lib/node/socket-channel-forwarder.d.ts.map +1 -1
  24. package/lib/node/socket-channel-forwarder.js +6 -1
  25. package/lib/node/socket-channel-forwarder.js.map +1 -1
  26. package/package.json +13 -12
  27. package/src/browser/channel-connection.ts +2 -2
  28. package/src/browser/channel-data-port.ts +100 -0
  29. package/src/browser/index.ts +1 -3
  30. package/src/common/emitter-data-client.ts +18 -0
  31. package/src/node/connection-container-module.ts +5 -4
  32. package/src/node/data-server-connection-handler.ts +11 -1
  33. package/src/node/socket-channel-forwarder.ts +6 -1
  34. package/lib/browser/data-service-frontend.d.ts +0 -154
  35. package/lib/browser/data-service-frontend.d.ts.map +0 -1
  36. package/lib/browser/data-service-frontend.js +0 -169
  37. package/lib/browser/data-service-frontend.js.map +0 -1
  38. package/lib/browser/diagnostics-data-service-frontend.d.ts +0 -35
  39. package/lib/browser/diagnostics-data-service-frontend.d.ts.map +0 -1
  40. package/lib/browser/diagnostics-data-service-frontend.js +0 -54
  41. package/lib/browser/diagnostics-data-service-frontend.js.map +0 -1
  42. package/lib/browser/references-data-service-frontend.d.ts +0 -45
  43. package/lib/browser/references-data-service-frontend.d.ts.map +0 -1
  44. package/lib/browser/references-data-service-frontend.js +0 -55
  45. package/lib/browser/references-data-service-frontend.js.map +0 -1
  46. package/src/browser/data-service-frontend.ts +0 -208
  47. package/src/browser/diagnostics-data-service-frontend.ts +0 -70
  48. package/src/browser/references-data-service-frontend.ts +0 -70
@@ -1,45 +0,0 @@
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 type { FindNextNameArgs, ReferenceCandidate, ReferenceContext, ReferenceRequest, ReferenceServerProtocol, ReferenceTarget, TransferElement } from '@hydranium/protocol';
10
- import { AbstractDataServiceFrontend } from './data-service-frontend';
11
- /**
12
- * {@link AbstractDataServiceFrontend} specialised for a server that also
13
- * composes the framework {@link ReferenceServerProtocol} fragment. It
14
- * implements each reference method as a readiness-gated pass-through —
15
- * `await this.ensureConnected()`, then delegate to `this.server` — so an
16
- * adopter frontend gets the candidate / resolve / next-name surface without
17
- * hand-writing identical one-liner bodies.
18
- *
19
- * The sibling of `AbstractDiagnosticsDataServiceFrontend`, and the same
20
- * shape for the same reason: `this.server` is already a forwarding proxy, but
21
- * it queues only on the channel being live, not on the server's `waitForReady`
22
- * gate — so the gate has to be interposed per method.
23
- *
24
- * Extend this instead of {@link AbstractDataServiceFrontend} whenever the
25
- * head's `DataServer` registers the reference fragment (typically via a
26
- * subclass's `additionalMethods`, since
27
- * `REFERENCE_SERVER_PROTOCOL_METHODS` is deliberately NOT part of
28
- * `DATA_SERVER_PROTOCOL_METHODS`). The `TServer` bound carries
29
- * `ReferenceServerProtocol`, so the delegates are type-checked without casts.
30
- *
31
- * A frontend needing both fragments extends the diagnostics base and mixes
32
- * these three in, or vice versa — TypeScript allows only one base class, so
33
- * the two bases are deliberately independent rather than chained. Chaining
34
- * them would force every reference-fragment adopter to also carry the
35
- * diagnostics surface, which a head that dropped those methods via
36
- * `DataServerOptions.excludedMethods` cannot satisfy.
37
- */
38
- export declare abstract class AbstractReferencesDataServiceFrontend<TTransfer extends TransferElement, TServer extends {
39
- waitForReady(): Promise<void>;
40
- } & ReferenceServerProtocol<TTransfer>, TClient extends object> extends AbstractDataServiceFrontend<TServer, TClient> implements ReferenceServerProtocol<TTransfer> {
41
- findReferenceCandidates(ctx: ReferenceContext): Promise<ReferenceCandidate[]>;
42
- resolveReference(ref: ReferenceRequest): Promise<ReferenceTarget<TTransfer> | undefined>;
43
- findNextName(args: FindNextNameArgs): Promise<string>;
44
- }
45
- //# sourceMappingURL=references-data-service-frontend.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"references-data-service-frontend.d.ts","sourceRoot":"","sources":["../../src/browser/references-data-service-frontend.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EACT,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,eAAe,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,8BAAsB,qCAAqC,CACxD,SAAS,SAAS,eAAe,EACjC,OAAO,SAAS;IAAE,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GAAG,uBAAuB,CAAC,SAAS,CAAC,EACtF,OAAO,SAAS,MAAM,CAEtB,SAAQ,2BAA2B,CAAC,OAAO,EAAE,OAAO,CACpD,YAAW,uBAAuB,CAAC,SAAS,CAAC;IAEvC,uBAAuB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAK7E,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAKxF,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;CAI7D"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
- /********************************************************************************
3
- * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
4
- *
5
- * This program and the accompanying materials are made available under the
6
- * terms of the MIT License which is available in the project root.
7
- *
8
- * SPDX-License-Identifier: MIT
9
- ********************************************************************************/
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.AbstractReferencesDataServiceFrontend = void 0;
12
- const data_service_frontend_1 = require("./data-service-frontend");
13
- /**
14
- * {@link AbstractDataServiceFrontend} specialised for a server that also
15
- * composes the framework {@link ReferenceServerProtocol} fragment. It
16
- * implements each reference method as a readiness-gated pass-through —
17
- * `await this.ensureConnected()`, then delegate to `this.server` — so an
18
- * adopter frontend gets the candidate / resolve / next-name surface without
19
- * hand-writing identical one-liner bodies.
20
- *
21
- * The sibling of `AbstractDiagnosticsDataServiceFrontend`, and the same
22
- * shape for the same reason: `this.server` is already a forwarding proxy, but
23
- * it queues only on the channel being live, not on the server's `waitForReady`
24
- * gate — so the gate has to be interposed per method.
25
- *
26
- * Extend this instead of {@link AbstractDataServiceFrontend} whenever the
27
- * head's `DataServer` registers the reference fragment (typically via a
28
- * subclass's `additionalMethods`, since
29
- * `REFERENCE_SERVER_PROTOCOL_METHODS` is deliberately NOT part of
30
- * `DATA_SERVER_PROTOCOL_METHODS`). The `TServer` bound carries
31
- * `ReferenceServerProtocol`, so the delegates are type-checked without casts.
32
- *
33
- * A frontend needing both fragments extends the diagnostics base and mixes
34
- * these three in, or vice versa — TypeScript allows only one base class, so
35
- * the two bases are deliberately independent rather than chained. Chaining
36
- * them would force every reference-fragment adopter to also carry the
37
- * diagnostics surface, which a head that dropped those methods via
38
- * `DataServerOptions.excludedMethods` cannot satisfy.
39
- */
40
- class AbstractReferencesDataServiceFrontend extends data_service_frontend_1.AbstractDataServiceFrontend {
41
- async findReferenceCandidates(ctx) {
42
- await this.ensureConnected();
43
- return this.server.findReferenceCandidates(ctx);
44
- }
45
- async resolveReference(ref) {
46
- await this.ensureConnected();
47
- return this.server.resolveReference(ref);
48
- }
49
- async findNextName(args) {
50
- await this.ensureConnected();
51
- return this.server.findNextName(args);
52
- }
53
- }
54
- exports.AbstractReferencesDataServiceFrontend = AbstractReferencesDataServiceFrontend;
55
- //# sourceMappingURL=references-data-service-frontend.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"references-data-service-frontend.js","sourceRoot":"","sources":["../../src/browser/references-data-service-frontend.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAWlF,mEAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAsB,qCAKnB,SAAQ,mDAA6C;IAGrD,KAAK,CAAC,uBAAuB,CAAC,GAAqB;QAChD,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,GAAqB;QACzC,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAsB;QACtC,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACH;AAtBD,sFAsBC"}
@@ -1,208 +0,0 @@
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
-
10
- import { createRpcProxy } from '@hydranium/protocol';
11
- import type { ServiceConnectionProvider } from '@theia/core/lib/browser';
12
- import { Deferred } from '@theia/core/lib/common/promise-util';
13
- import type { WorkspaceService } from '@theia/workspace/lib/browser';
14
- import type { MessageConnection } from 'vscode-jsonrpc';
15
- import { type ChannelConnectionHandle, openChannelConnection } from './channel-connection';
16
- import { whenWorkspaceOpen } from './workspace-gate';
17
-
18
- /**
19
- * Base for a Theia frontend that owns the data-server vscode-jsonrpc
20
- * connection directly (the data head's "frontend speaks the model-server's
21
- * protocol over a relayed channel" pattern). Lifts the mechanical wiring —
22
- * the workspace-gated connection, the combined server proxy + inbound client
23
- * binding, and the lazy idempotent init gate — leaving the adopter to supply
24
- * the connection seams and any progress UI / domain caching / request-method
25
- * delegation on top.
26
- *
27
- * Generic over the server protocol `TServer` (must expose `waitForReady`) and
28
- * the local notification target `TClient`. A subclass supplies the abstract
29
- * members below, calls {@link start} from its `@postConstruct`, and awaits
30
- * {@link ensureConnected} before its first `this.server.*` call.
31
- */
32
- export abstract class AbstractDataServiceFrontend<TServer extends { waitForReady(): Promise<void> }, TClient extends object> {
33
- /**
34
- * The workspace-gated connection to the backend forwarder. Set by
35
- * {@link start}, and REPLACED whenever the connection is lost and
36
- * {@link reconnectOnConnectionLoss} is on — so read it per use and never
37
- * cache the resolved connection.
38
- */
39
- protected connectionPromise!: Promise<MessageConnection>;
40
- /**
41
- * Typed proxy over {@link connectionPromise}, addressing the server under
42
- * {@link methodNamespace}. Set by {@link start}, and replaced alongside
43
- * {@link connectionPromise} on reconnect.
44
- *
45
- * `createRpcProxy` resolves the connection promise once and binds to it for
46
- * good, so a reconnect necessarily means a new proxy. Reading
47
- * `this.server.foo()` per call — rather than hoisting `this.server` into a
48
- * local or a constructor-time field — is what keeps a subclass correct
49
- * across one.
50
- */
51
- protected server!: TServer;
52
- /** The channel handle {@link start} opened; owns reconnect and disposal. */
53
- protected channel?: ChannelConnectionHandle;
54
- /** Shared init Deferred so concurrent {@link ensureConnected} callers await one initialization. */
55
- protected initialized?: Deferred<void>;
56
-
57
- /** Theia connection provider the channel is opened through. */
58
- protected abstract readonly connectionProvider: ServiceConnectionProvider;
59
- /**
60
- * Optional workspace service. When provided, the default
61
- * {@link connectionReadyGate} waits for a workspace before opening the
62
- * channel; a head that is not workspace-scoped omits it (and may override
63
- * {@link connectionReadyGate} for a different gate).
64
- */
65
- protected abstract readonly workspaceService?: WorkspaceService;
66
- /** Local inbound-notification target bound on the connection (the `localTarget`). */
67
- protected abstract readonly client: TClient;
68
- /**
69
- * Theia service path the backend forwarder is registered under.
70
- *
71
- * **Unique per frontend, not per server.** Theia keys a frontend channel by
72
- * this path and throws `Another channel with the id '<path>' is already open`
73
- * on a second opener — so a subclass sharing the framework default with any
74
- * other consumer of the same head (a host-neutral `DataPort`, a sibling
75
- * service frontend) breaks whichever opens second. The failure is remote from
76
- * its cause: the throw escapes an `openChannelConnection` the other consumer
77
- * awaited, leaving its request permanently unsettled rather than rejected,
78
- * which presents as a view stuck on its loading state with a clean server
79
- * log. Give each frontend its own path and register a forwarder per path;
80
- * they still reach one server, since the shared `portCommand` is what names
81
- * the process.
82
- */
83
- protected abstract readonly servicePath: string;
84
- /** Wire namespace the server + client methods are addressed under. */
85
- protected abstract readonly methodNamespace: string;
86
- /** Allowlist of {@link client} methods to bind as inbound handlers. */
87
- protected abstract readonly clientMethods: readonly (keyof TClient & string)[];
88
-
89
- /**
90
- * Rebuild the connection and the proxy when the current connection is lost,
91
- * and re-run initialization against the replacement. Defaults to `true` —
92
- * see `OpenChannelConnectionOptions.reconnect` for why re-opening the
93
- * channel is the only thing that recovers a restarted language server, and
94
- * why a dead connection leaves no alternative worth preserving.
95
- *
96
- * The subclass-facing cost is that {@link doInitialize} runs again per
97
- * connection, so any progress UI it drives reappears. Turn this off for a
98
- * frontend that would rather show nothing than show its warm-up twice, or
99
- * that tears itself down on transport loss.
100
- */
101
- protected readonly reconnectOnConnectionLoss: boolean = true;
102
-
103
- /**
104
- * Readiness gate for the connection — the channel opens only once the
105
- * returned promise settles. Default: waits for a workspace when
106
- * {@link workspaceService} is provided, otherwise opens immediately
107
- * (`undefined`). Override for a different gate (e.g. a fixed model store
108
- * that is always ready, or a custom warm-up).
109
- */
110
- protected connectionReadyGate(): Promise<void> | undefined {
111
- return this.workspaceService ? whenWorkspaceOpen(this.workspaceService) : undefined;
112
- }
113
-
114
- /**
115
- * Open the connection (workspace-gated by default via
116
- * {@link connectionReadyGate}) and build the combined server proxy +
117
- * inbound client binding. Call once (typically from the adopter's
118
- * `@postConstruct`). Outbound calls + inbound notifications queue over the
119
- * connection promise until the channel is live.
120
- */
121
- protected start(): void {
122
- this.channel = openChannelConnection(this.connectionProvider, this.servicePath, {
123
- whenReady: this.connectionReadyGate(),
124
- reconnect: this.reconnectOnConnectionLoss
125
- });
126
- this.bindConnection();
127
- // The LOSS, not the replacement's arrival: rebinding when the channel
128
- // closes points `server` at the queueing replacement promise, so a request
129
- // made during the gap waits for the new server instead of being addressed
130
- // at the dead one and never settling.
131
- this.channel.onDidLoseConnection(() => this.handleConnectionLost());
132
- }
133
-
134
- /**
135
- * Point {@link connectionPromise} and {@link server} at the channel's
136
- * current connection. Called by {@link start} and again per reconnect.
137
- */
138
- protected bindConnection(): void {
139
- if (!this.channel) {
140
- throw new Error('bindConnection called before start');
141
- }
142
- this.connectionPromise = this.channel.current;
143
- this.server = createRpcProxy<TServer, TClient>(this.connectionPromise, {
144
- methodNamespace: this.methodNamespace,
145
- localTarget: this.client,
146
- localMethods: this.clientMethods
147
- });
148
- }
149
-
150
- /**
151
- * Rebind onto the replacement connection and arm initialization to run again.
152
- *
153
- * Clearing {@link initialized} is the load-bearing half. A restarted server
154
- * has an unwarmed workspace, so its `waitForReady` gate has to be awaited
155
- * afresh; leaving the old resolved Deferred in place would let the first
156
- * request after a restart through against a server still walking the
157
- * workspace, and be answered correctly from an empty registry — which reads
158
- * as data loss rather than as a race.
159
- */
160
- protected handleConnectionLost(): void {
161
- this.initialized = undefined;
162
- this.bindConnection();
163
- }
164
-
165
- /**
166
- * Release the connection and stop tracking the channel. Idempotent.
167
- *
168
- * Subclasses that are Theia `Disposable`s should route their own disposal
169
- * here; nothing calls it automatically, because the base is not bound to a
170
- * lifecycle of its own.
171
- */
172
- dispose(): void {
173
- this.channel?.dispose();
174
- this.channel = undefined;
175
- this.initialized = undefined;
176
- }
177
-
178
- /**
179
- * Lazily drive initialization, shared across concurrent callers via one
180
- * {@link Deferred}. Request methods `await this.ensureConnected()` before
181
- * their first `this.server.*` call.
182
- */
183
- protected ensureConnected(): Promise<void> {
184
- if (!this.initialized) {
185
- this.initialized = new Deferred<void>();
186
- void this.doInitialize(this.initialized);
187
- }
188
- return this.initialized.promise;
189
- }
190
-
191
- /**
192
- * Default initialization: await the connection, await the server's readiness
193
- * gate, then resolve the passed Deferred. Initialization completion is
194
- * observable by awaiting {@link ensureConnected} (which returns this same
195
- * Deferred's promise) — there is no separate post-init hook. Override
196
- * wholesale to interleave progress UI / extra warm-up; an override owns
197
- * resolving/rejecting `initialized` (there is no `super` step to call).
198
- */
199
- protected async doInitialize(initialized: Deferred<void>): Promise<void> {
200
- try {
201
- await this.connectionPromise;
202
- await this.server.waitForReady();
203
- initialized.resolve();
204
- } catch (error) {
205
- initialized.reject(error instanceof Error ? error : new Error(String(error)));
206
- }
207
- }
208
- }
@@ -1,70 +0,0 @@
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
-
10
- import type {
11
- DataServerDiagnosticsProtocol,
12
- DumpServerStateArgs,
13
- LatencyReport,
14
- StartProfilingArgs,
15
- StopProfilingArgs,
16
- WriteServerHeapSnapshotArgs
17
- } from '@hydranium/protocol';
18
- import { AbstractDataServiceFrontend } from './data-service-frontend';
19
-
20
- /**
21
- * {@link AbstractDataServiceFrontend} specialised for a server that also exposes
22
- * the framework {@link DataServerDiagnosticsProtocol} (which the framework
23
- * `DataServer` implements by default). It implements each diagnostics method as
24
- * a readiness-gated pass-through — `await this.ensureConnected()`, then delegate
25
- * to `this.server` — so every adopter frontend gets the memory / state /
26
- * profiling / latency surface without hand-writing identical one-liner bodies.
27
- *
28
- * Extend this instead of {@link AbstractDataServiceFrontend} whenever the head's
29
- * `DataServer` keeps the default diagnostics registration; the `TServer` bound
30
- * carries `DataServerDiagnosticsProtocol`, so the delegates are type-checked
31
- * (no casts). A head that dropped the diagnostics methods via
32
- * `DataServerOptions.excludedMethods` should extend the plain base instead.
33
- */
34
- export abstract class AbstractDiagnosticsDataServiceFrontend<
35
- TServer extends { waitForReady(): Promise<void> } & DataServerDiagnosticsProtocol,
36
- TClient extends object
37
- >
38
- extends AbstractDataServiceFrontend<TServer, TClient>
39
- implements DataServerDiagnosticsProtocol
40
- {
41
- async dumpServerState(args: DumpServerStateArgs): Promise<string> {
42
- await this.ensureConnected();
43
- return this.server.dumpServerState(args);
44
- }
45
-
46
- async writeHeapSnapshot(args: WriteServerHeapSnapshotArgs): Promise<string> {
47
- await this.ensureConnected();
48
- return this.server.writeHeapSnapshot(args);
49
- }
50
-
51
- async dumpPodMemory(): Promise<string> {
52
- await this.ensureConnected();
53
- return this.server.dumpPodMemory();
54
- }
55
-
56
- async startProfiling(args: StartProfilingArgs): Promise<void> {
57
- await this.ensureConnected();
58
- return this.server.startProfiling(args);
59
- }
60
-
61
- async stopProfiling(args: StopProfilingArgs): Promise<string> {
62
- await this.ensureConnected();
63
- return this.server.stopProfiling(args);
64
- }
65
-
66
- async getLatency(): Promise<LatencyReport> {
67
- await this.ensureConnected();
68
- return this.server.getLatency();
69
- }
70
- }
@@ -1,70 +0,0 @@
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
-
10
- import type {
11
- FindNextNameArgs,
12
- ReferenceCandidate,
13
- ReferenceContext,
14
- ReferenceRequest,
15
- ReferenceServerProtocol,
16
- ReferenceTarget,
17
- TransferElement
18
- } from '@hydranium/protocol';
19
- import { AbstractDataServiceFrontend } from './data-service-frontend';
20
-
21
- /**
22
- * {@link AbstractDataServiceFrontend} specialised for a server that also
23
- * composes the framework {@link ReferenceServerProtocol} fragment. It
24
- * implements each reference method as a readiness-gated pass-through —
25
- * `await this.ensureConnected()`, then delegate to `this.server` — so an
26
- * adopter frontend gets the candidate / resolve / next-name surface without
27
- * hand-writing identical one-liner bodies.
28
- *
29
- * The sibling of `AbstractDiagnosticsDataServiceFrontend`, and the same
30
- * shape for the same reason: `this.server` is already a forwarding proxy, but
31
- * it queues only on the channel being live, not on the server's `waitForReady`
32
- * gate — so the gate has to be interposed per method.
33
- *
34
- * Extend this instead of {@link AbstractDataServiceFrontend} whenever the
35
- * head's `DataServer` registers the reference fragment (typically via a
36
- * subclass's `additionalMethods`, since
37
- * `REFERENCE_SERVER_PROTOCOL_METHODS` is deliberately NOT part of
38
- * `DATA_SERVER_PROTOCOL_METHODS`). The `TServer` bound carries
39
- * `ReferenceServerProtocol`, so the delegates are type-checked without casts.
40
- *
41
- * A frontend needing both fragments extends the diagnostics base and mixes
42
- * these three in, or vice versa — TypeScript allows only one base class, so
43
- * the two bases are deliberately independent rather than chained. Chaining
44
- * them would force every reference-fragment adopter to also carry the
45
- * diagnostics surface, which a head that dropped those methods via
46
- * `DataServerOptions.excludedMethods` cannot satisfy.
47
- */
48
- export abstract class AbstractReferencesDataServiceFrontend<
49
- TTransfer extends TransferElement,
50
- TServer extends { waitForReady(): Promise<void> } & ReferenceServerProtocol<TTransfer>,
51
- TClient extends object
52
- >
53
- extends AbstractDataServiceFrontend<TServer, TClient>
54
- implements ReferenceServerProtocol<TTransfer>
55
- {
56
- async findReferenceCandidates(ctx: ReferenceContext): Promise<ReferenceCandidate[]> {
57
- await this.ensureConnected();
58
- return this.server.findReferenceCandidates(ctx);
59
- }
60
-
61
- async resolveReference(ref: ReferenceRequest): Promise<ReferenceTarget<TTransfer> | undefined> {
62
- await this.ensureConnected();
63
- return this.server.resolveReference(ref);
64
- }
65
-
66
- async findNextName(args: FindNextNameArgs): Promise<string> {
67
- await this.ensureConnected();
68
- return this.server.findNextName(args);
69
- }
70
- }