@hydranium/data-client-theia 1.0.0-next.232 → 1.0.0-next.235
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/browser/channel-connection.d.ts +2 -2
- package/lib/browser/channel-data-port.d.ts +6 -0
- package/lib/browser/channel-data-port.d.ts.map +1 -1
- package/lib/browser/channel-data-port.js +10 -0
- package/lib/browser/channel-data-port.js.map +1 -1
- package/package.json +5 -5
- package/src/browser/channel-connection.ts +2 -2
- package/src/browser/channel-data-port.ts +10 -0
|
@@ -120,10 +120,10 @@ export interface ChannelConnectionHandle {
|
|
|
120
120
|
*
|
|
121
121
|
* **This is the event a consumer wants, not {@link onDidReconnect}.** Anything
|
|
122
122
|
* derived from a connection — an `createRpcProxy`, a readiness gate, a
|
|
123
|
-
* `
|
|
123
|
+
* `DataConnection` generation — is dead from this moment, and a consumer that
|
|
124
124
|
* waits for the replacement to be live instead keeps sending into the dead one
|
|
125
125
|
* for the whole gap. A `DataPort` implementation translates this into the
|
|
126
|
-
* port's own `onDispose`, which is what makes `
|
|
126
|
+
* port's own `onDispose`, which is what makes `DataConnection` drop its
|
|
127
127
|
* generation.
|
|
128
128
|
*
|
|
129
129
|
* Never fires when {@link OpenChannelConnectionOptions.reconnect} is off.
|
|
@@ -43,6 +43,8 @@ export declare abstract class ChannelDataPort implements DataPort {
|
|
|
43
43
|
protected readonly disposeEmitter: Emitter<void>;
|
|
44
44
|
readonly onDispose: Event<void>;
|
|
45
45
|
protected handle?: ChannelConnectionHandle;
|
|
46
|
+
/** Set by {@link dispose}, after which {@link connect} rejects. */
|
|
47
|
+
protected disposed: boolean;
|
|
46
48
|
/** How long a connection may take before it is reported as failed; it keeps trying after. */
|
|
47
49
|
protected readonly connectFailureNoticeMs: number;
|
|
48
50
|
protected attempt?: ConnectionAttempt;
|
|
@@ -58,6 +60,10 @@ export declare abstract class ChannelDataPort implements DataPort {
|
|
|
58
60
|
* a command the language server answers, and the language server only
|
|
59
61
|
* launches once there is a workspace to launch it for. Asking earlier polls
|
|
60
62
|
* a command nobody has registered.
|
|
63
|
+
*
|
|
64
|
+
* Rejects once the port is disposed: the consumer reconnects when the
|
|
65
|
+
* dispose fires {@link onDispose}, and a channel opened then is closed by
|
|
66
|
+
* nothing.
|
|
61
67
|
*/
|
|
62
68
|
connect(): Promise<MessageConnection>;
|
|
63
69
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-data-port.d.ts","sourceRoot":"","sources":["../../src/browser/channel-data-port.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnI,OAAO,EAIJ,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,cAAc,EAAO,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,uBAAuB,EAAyB,MAAM,sBAAsB,CAAC;AAG3F;;;;;;;;;;;GAWG;AACH,8BACsB,eAAgB,YAAW,QAAQ;IACpB,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAG,yBAAyB,CAAC;IAC1E,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAG,gBAAgB,CAAC;IACzD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAG,cAAc,CAAC;IAC/C,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAG,kBAAkB,CAAC;IAChE,QAAQ,CAAC,MAAM,EAAG,aAAa,CAAC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OAAO,IAAI,IAAI,CAOd;CACH"}
|
|
@@ -54,6 +54,8 @@ let ChannelDataPort = class ChannelDataPort {
|
|
|
54
54
|
disposeEmitter = new core_1.Emitter();
|
|
55
55
|
onDispose = this.disposeEmitter.event;
|
|
56
56
|
handle;
|
|
57
|
+
/** Set by {@link dispose}, after which {@link connect} rejects. */
|
|
58
|
+
disposed = false;
|
|
57
59
|
/** How long a connection may take before it is reported as failed; it keeps trying after. */
|
|
58
60
|
connectFailureNoticeMs = 30_000;
|
|
59
61
|
attempt;
|
|
@@ -83,8 +85,15 @@ let ChannelDataPort = class ChannelDataPort {
|
|
|
83
85
|
* a command the language server answers, and the language server only
|
|
84
86
|
* launches once there is a workspace to launch it for. Asking earlier polls
|
|
85
87
|
* a command nobody has registered.
|
|
88
|
+
*
|
|
89
|
+
* Rejects once the port is disposed: the consumer reconnects when the
|
|
90
|
+
* dispose fires {@link onDispose}, and a channel opened then is closed by
|
|
91
|
+
* nothing.
|
|
86
92
|
*/
|
|
87
93
|
connect() {
|
|
94
|
+
if (this.disposed) {
|
|
95
|
+
return Promise.reject(new Error(`${this.constructor.name}: the port is disposed`));
|
|
96
|
+
}
|
|
88
97
|
// Read per call rather than cached: `current` is repointed at a fresh
|
|
89
98
|
// promise every time the channel is re-opened, so reading through the
|
|
90
99
|
// handle is what makes a later generation reach the live server.
|
|
@@ -146,6 +155,7 @@ let ChannelDataPort = class ChannelDataPort {
|
|
|
146
155
|
return core_1.nls.localize('hydranium/data-client-theia/data-server-timeout', 'The data server did not answer within {0} seconds.', String(Math.round(this.connectFailureNoticeMs / 1000)));
|
|
147
156
|
}
|
|
148
157
|
dispose() {
|
|
158
|
+
this.disposed = true;
|
|
149
159
|
this.settleAttempt();
|
|
150
160
|
this.handle?.dispose();
|
|
151
161
|
this.handle = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-data-port.js","sourceRoot":"","sources":["../../src/browser/channel-data-port.ts"],"names":[],"mappings":";AAAA;;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,uBAAa,CAAC;8BAAmB,uBAAa;+CAAC;0BALpC,eAAe;IADpC,IAAA,sBAAU,GAAE;GACS,eAAe,CA+IpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/data-client-theia",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.235",
|
|
4
4
|
"description": "Theia-coupled client primitives for the hydranium data-server protocol head; companion of @hydranium/data-server. Bridges framework typed errors (e.g. ConflictError) across Theia's RPC boundary so their code + data survive the wire.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hydranium",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@hydranium/client-theia": "1.0.0-next.
|
|
65
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
64
|
+
"@hydranium/client-theia": "1.0.0-next.235",
|
|
65
|
+
"@hydranium/protocol": "1.0.0-next.235",
|
|
66
66
|
"@theia/core": "^1.70.0",
|
|
67
67
|
"@theia/workspace": "^1.70.0",
|
|
68
68
|
"@types/node": "^22.0.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"vscode-jsonrpc": "9.0.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@hydranium/client-theia": "1.0.0-next.
|
|
77
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
76
|
+
"@hydranium/client-theia": "1.0.0-next.235",
|
|
77
|
+
"@hydranium/protocol": "1.0.0-next.235",
|
|
78
78
|
"@theia/core": "^1.70.0",
|
|
79
79
|
"@theia/workspace": "^1.70.0",
|
|
80
80
|
"inversify": "^6.0.0",
|
|
@@ -213,10 +213,10 @@ export interface ChannelConnectionHandle {
|
|
|
213
213
|
*
|
|
214
214
|
* **This is the event a consumer wants, not {@link onDidReconnect}.** Anything
|
|
215
215
|
* derived from a connection — an `createRpcProxy`, a readiness gate, a
|
|
216
|
-
* `
|
|
216
|
+
* `DataConnection` generation — is dead from this moment, and a consumer that
|
|
217
217
|
* waits for the replacement to be live instead keeps sending into the dead one
|
|
218
218
|
* for the whole gap. A `DataPort` implementation translates this into the
|
|
219
|
-
* port's own `onDispose`, which is what makes `
|
|
219
|
+
* port's own `onDispose`, which is what makes `DataConnection` drop its
|
|
220
220
|
* generation.
|
|
221
221
|
*
|
|
222
222
|
* Never fires when {@link OpenChannelConnectionOptions.reconnect} is off.
|
|
@@ -60,6 +60,8 @@ export abstract class ChannelDataPort implements DataPort {
|
|
|
60
60
|
readonly onDispose: Event<void> = this.disposeEmitter.event;
|
|
61
61
|
|
|
62
62
|
protected handle?: ChannelConnectionHandle;
|
|
63
|
+
/** Set by {@link dispose}, after which {@link connect} rejects. */
|
|
64
|
+
protected disposed = false;
|
|
63
65
|
|
|
64
66
|
/** How long a connection may take before it is reported as failed; it keeps trying after. */
|
|
65
67
|
protected readonly connectFailureNoticeMs: number = 30_000;
|
|
@@ -92,8 +94,15 @@ export abstract class ChannelDataPort implements DataPort {
|
|
|
92
94
|
* a command the language server answers, and the language server only
|
|
93
95
|
* launches once there is a workspace to launch it for. Asking earlier polls
|
|
94
96
|
* a command nobody has registered.
|
|
97
|
+
*
|
|
98
|
+
* Rejects once the port is disposed: the consumer reconnects when the
|
|
99
|
+
* dispose fires {@link onDispose}, and a channel opened then is closed by
|
|
100
|
+
* nothing.
|
|
95
101
|
*/
|
|
96
102
|
connect(): Promise<MessageConnection> {
|
|
103
|
+
if (this.disposed) {
|
|
104
|
+
return Promise.reject(new Error(`${this.constructor.name}: the port is disposed`));
|
|
105
|
+
}
|
|
97
106
|
// Read per call rather than cached: `current` is repointed at a fresh
|
|
98
107
|
// promise every time the channel is re-opened, so reading through the
|
|
99
108
|
// handle is what makes a later generation reach the live server.
|
|
@@ -165,6 +174,7 @@ export abstract class ChannelDataPort implements DataPort {
|
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
dispose(): void {
|
|
177
|
+
this.disposed = true;
|
|
168
178
|
this.settleAttempt();
|
|
169
179
|
this.handle?.dispose();
|
|
170
180
|
this.handle = undefined;
|