@dxos/edge-client 0.8.2-staging.7ac8446 → 0.8.2
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/dist/lib/browser/chunk-VHS3XEIX.mjs +297 -0
- package/dist/lib/browser/chunk-VHS3XEIX.mjs.map +7 -0
- package/dist/lib/browser/edge-ws-muxer.mjs +11 -0
- package/dist/lib/browser/edge-ws-muxer.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +95 -64
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +32 -20
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/chunk-XNHBUTNB.cjs +317 -0
- package/dist/lib/node/chunk-XNHBUTNB.cjs.map +7 -0
- package/dist/lib/node/edge-ws-muxer.cjs +33 -0
- package/dist/lib/node/edge-ws-muxer.cjs.map +7 -0
- package/dist/lib/node/index.cjs +107 -76
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +32 -21
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/chunk-HGQUUFIJ.mjs +299 -0
- package/dist/lib/node-esm/chunk-HGQUUFIJ.mjs.map +7 -0
- package/dist/lib/node-esm/edge-ws-muxer.mjs +12 -0
- package/dist/lib/node-esm/edge-ws-muxer.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +95 -64
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +32 -20
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/auth.d.ts.map +1 -1
- package/dist/types/src/edge-client.d.ts +7 -2
- package/dist/types/src/edge-client.d.ts.map +1 -1
- package/dist/types/src/edge-http-client.d.ts +0 -1
- package/dist/types/src/edge-http-client.d.ts.map +1 -1
- package/dist/types/src/edge-identity.d.ts.map +1 -1
- package/dist/types/src/edge-ws-connection.d.ts +1 -0
- package/dist/types/src/edge-ws-connection.d.ts.map +1 -1
- package/dist/types/src/edge-ws-muxer.d.ts +35 -0
- package/dist/types/src/edge-ws-muxer.d.ts.map +1 -0
- package/dist/types/src/edge-ws-muxer.test.d.ts +2 -0
- package/dist/types/src/edge-ws-muxer.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/protocol.d.ts.map +1 -1
- package/dist/types/src/testing/test-utils.d.ts +6 -2
- package/dist/types/src/testing/test-utils.d.ts.map +1 -1
- package/dist/types/src/utils.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -14
- package/src/edge-client.test.ts +5 -4
- package/src/edge-client.ts +23 -15
- package/src/edge-http-client.ts +4 -4
- package/src/edge-ws-connection.ts +41 -23
- package/src/edge-ws-muxer.test.ts +55 -0
- package/src/edge-ws-muxer.ts +217 -0
- package/src/index.ts +1 -0
- package/src/protocol.ts +1 -1
- package/src/testing/test-utils.ts +33 -26
- package/dist/lib/browser/chunk-ZWJXA37R.mjs +0 -113
- package/dist/lib/browser/chunk-ZWJXA37R.mjs.map +0 -7
- package/dist/lib/node/chunk-ANV2HBEH.cjs +0 -136
- package/dist/lib/node/chunk-ANV2HBEH.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-HNVT57AU.mjs +0 -115
- package/dist/lib/node-esm/chunk-HNVT57AU.mjs.map +0 -7
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
CLOUDFLARE_MESSAGE_MAX_BYTES,
|
|
4
|
+
CLOUDFLARE_RPC_MAX_BYTES,
|
|
3
5
|
Protocol,
|
|
6
|
+
WebSocketMuxer,
|
|
4
7
|
getTypename,
|
|
5
8
|
protocol,
|
|
6
9
|
toUint8Array
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HGQUUFIJ.mjs";
|
|
8
11
|
|
|
9
12
|
// packages/core/mesh/edge-client/src/index.ts
|
|
10
13
|
export * from "@dxos/protocols/buf/dxos/edge/messenger_pb";
|
|
11
14
|
|
|
12
15
|
// packages/core/mesh/edge-client/src/edge-client.ts
|
|
13
|
-
import { Trigger, scheduleMicroTask, TriggerState, PersistentLifecycle } from "@dxos/async";
|
|
16
|
+
import { Trigger, scheduleMicroTask, TriggerState, PersistentLifecycle, Event } from "@dxos/async";
|
|
14
17
|
import { Resource as Resource2 } from "@dxos/context";
|
|
15
18
|
import { log as log2, logInfo as logInfo2 } from "@dxos/log";
|
|
19
|
+
import { EdgeStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
16
20
|
|
|
17
21
|
// packages/core/mesh/edge-client/src/edge-identity.ts
|
|
18
22
|
import { invariant } from "@dxos/invariant";
|
|
@@ -60,6 +64,7 @@ import { scheduleTask, scheduleTaskInterval } from "@dxos/async";
|
|
|
60
64
|
import { Context, Resource } from "@dxos/context";
|
|
61
65
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
62
66
|
import { log, logInfo } from "@dxos/log";
|
|
67
|
+
import { EdgeWebsocketProtocol } from "@dxos/protocols";
|
|
63
68
|
import { buf } from "@dxos/protocols/buf";
|
|
64
69
|
import { MessageSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
|
|
65
70
|
function _ts_decorate(decorators, target, key, desc) {
|
|
@@ -71,13 +76,9 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
71
76
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-ws-connection.ts";
|
|
72
77
|
var SIGNAL_KEEPALIVE_INTERVAL = 4e3;
|
|
73
78
|
var SIGNAL_KEEPALIVE_TIMEOUT = 12e3;
|
|
74
|
-
var CLOUDFLARE_MESSAGE_LENGTH_LIMIT = 1024 * 1024;
|
|
75
79
|
var EdgeWsConnection = class extends Resource {
|
|
76
80
|
constructor(_identity, _connectionInfo, _callbacks) {
|
|
77
|
-
super();
|
|
78
|
-
this._identity = _identity;
|
|
79
|
-
this._connectionInfo = _connectionInfo;
|
|
80
|
-
this._callbacks = _callbacks;
|
|
81
|
+
super(), this._identity = _identity, this._connectionInfo = _connectionInfo, this._callbacks = _callbacks;
|
|
81
82
|
}
|
|
82
83
|
get info() {
|
|
83
84
|
return {
|
|
@@ -89,47 +90,73 @@ var EdgeWsConnection = class extends Resource {
|
|
|
89
90
|
send(message) {
|
|
90
91
|
invariant2(this._ws, void 0, {
|
|
91
92
|
F: __dxlog_file2,
|
|
92
|
-
L:
|
|
93
|
+
L: 52,
|
|
93
94
|
S: this,
|
|
94
95
|
A: [
|
|
95
96
|
"this._ws",
|
|
96
97
|
""
|
|
97
98
|
]
|
|
98
99
|
});
|
|
100
|
+
invariant2(this._wsMuxer, void 0, {
|
|
101
|
+
F: __dxlog_file2,
|
|
102
|
+
L: 53,
|
|
103
|
+
S: this,
|
|
104
|
+
A: [
|
|
105
|
+
"this._wsMuxer",
|
|
106
|
+
""
|
|
107
|
+
]
|
|
108
|
+
});
|
|
99
109
|
log("sending...", {
|
|
100
110
|
peerKey: this._identity.peerKey,
|
|
101
111
|
payload: protocol.getPayloadType(message)
|
|
102
112
|
}, {
|
|
103
113
|
F: __dxlog_file2,
|
|
104
|
-
L:
|
|
114
|
+
L: 54,
|
|
105
115
|
S: this,
|
|
106
116
|
C: (f, a) => f(...a)
|
|
107
117
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
if (this._ws?.protocol.includes(EdgeWebsocketProtocol.V0)) {
|
|
119
|
+
const binary = buf.toBinary(MessageSchema, message);
|
|
120
|
+
if (binary.length > CLOUDFLARE_MESSAGE_MAX_BYTES) {
|
|
121
|
+
log.error("Message dropped because it was too large (>1MB).", {
|
|
122
|
+
byteLength: binary.byteLength,
|
|
123
|
+
serviceId: message.serviceId,
|
|
124
|
+
payload: protocol.getPayloadType(message)
|
|
125
|
+
}, {
|
|
126
|
+
F: __dxlog_file2,
|
|
127
|
+
L: 58,
|
|
128
|
+
S: this,
|
|
129
|
+
C: (f, a) => f(...a)
|
|
130
|
+
});
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
this._ws.send(binary);
|
|
134
|
+
} else {
|
|
135
|
+
this._wsMuxer.send(message).catch((e) => log.catch(e, void 0, {
|
|
115
136
|
F: __dxlog_file2,
|
|
116
|
-
L:
|
|
137
|
+
L: 67,
|
|
117
138
|
S: this,
|
|
118
139
|
C: (f, a) => f(...a)
|
|
119
|
-
});
|
|
120
|
-
return;
|
|
140
|
+
}));
|
|
121
141
|
}
|
|
122
|
-
this._ws.send(encoded);
|
|
123
142
|
}
|
|
124
143
|
async _open() {
|
|
144
|
+
const baseProtocols = [
|
|
145
|
+
...Object.values(EdgeWebsocketProtocol)
|
|
146
|
+
];
|
|
125
147
|
this._ws = new WebSocket(this._connectionInfo.url.toString(), this._connectionInfo.protocolHeader ? [
|
|
148
|
+
...baseProtocols,
|
|
126
149
|
this._connectionInfo.protocolHeader
|
|
127
|
-
] : [
|
|
150
|
+
] : [
|
|
151
|
+
...baseProtocols
|
|
152
|
+
]);
|
|
153
|
+
const muxer = new WebSocketMuxer(this._ws);
|
|
154
|
+
this._wsMuxer = muxer;
|
|
128
155
|
this._ws.onopen = () => {
|
|
129
156
|
if (this.isOpen) {
|
|
130
157
|
log("connected", void 0, {
|
|
131
158
|
F: __dxlog_file2,
|
|
132
|
-
L:
|
|
159
|
+
L: 84,
|
|
133
160
|
S: this,
|
|
134
161
|
C: (f, a) => f(...a)
|
|
135
162
|
});
|
|
@@ -140,7 +167,7 @@ var EdgeWsConnection = class extends Resource {
|
|
|
140
167
|
currentIdentity: this._identity
|
|
141
168
|
}, {
|
|
142
169
|
F: __dxlog_file2,
|
|
143
|
-
L:
|
|
170
|
+
L: 88,
|
|
144
171
|
S: this,
|
|
145
172
|
C: (f, a) => f(...a)
|
|
146
173
|
});
|
|
@@ -153,11 +180,12 @@ var EdgeWsConnection = class extends Resource {
|
|
|
153
180
|
reason: event.reason
|
|
154
181
|
}, {
|
|
155
182
|
F: __dxlog_file2,
|
|
156
|
-
L:
|
|
183
|
+
L: 93,
|
|
157
184
|
S: this,
|
|
158
185
|
C: (f, a) => f(...a)
|
|
159
186
|
});
|
|
160
187
|
this._callbacks.onRestartRequired();
|
|
188
|
+
muxer.destroy();
|
|
161
189
|
}
|
|
162
190
|
};
|
|
163
191
|
this._ws.onerror = (event) => {
|
|
@@ -167,7 +195,7 @@ var EdgeWsConnection = class extends Resource {
|
|
|
167
195
|
info: event.message
|
|
168
196
|
}, {
|
|
169
197
|
F: __dxlog_file2,
|
|
170
|
-
L:
|
|
198
|
+
L: 100,
|
|
171
199
|
S: this,
|
|
172
200
|
C: (f, a) => f(...a)
|
|
173
201
|
});
|
|
@@ -177,7 +205,7 @@ var EdgeWsConnection = class extends Resource {
|
|
|
177
205
|
error: event.error
|
|
178
206
|
}, {
|
|
179
207
|
F: __dxlog_file2,
|
|
180
|
-
L:
|
|
208
|
+
L: 103,
|
|
181
209
|
S: this,
|
|
182
210
|
C: (f, a) => f(...a)
|
|
183
211
|
});
|
|
@@ -189,7 +217,7 @@ var EdgeWsConnection = class extends Resource {
|
|
|
189
217
|
event: event.type
|
|
190
218
|
}, {
|
|
191
219
|
F: __dxlog_file2,
|
|
192
|
-
L:
|
|
220
|
+
L: 111,
|
|
193
221
|
S: this,
|
|
194
222
|
C: (f, a) => f(...a)
|
|
195
223
|
});
|
|
@@ -199,15 +227,18 @@ var EdgeWsConnection = class extends Resource {
|
|
|
199
227
|
this._rescheduleHeartbeatTimeout();
|
|
200
228
|
return;
|
|
201
229
|
}
|
|
202
|
-
const
|
|
203
|
-
if (this.isOpen) {
|
|
204
|
-
|
|
230
|
+
const bytes = await toUint8Array(event.data);
|
|
231
|
+
if (!this.isOpen) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const message = this._ws?.protocol?.includes(EdgeWebsocketProtocol.V0) ? buf.fromBinary(MessageSchema, bytes) : muxer.receiveData(bytes);
|
|
235
|
+
if (message) {
|
|
205
236
|
log("received", {
|
|
206
237
|
from: message.source,
|
|
207
238
|
payload: protocol.getPayloadType(message)
|
|
208
239
|
}, {
|
|
209
240
|
F: __dxlog_file2,
|
|
210
|
-
L:
|
|
241
|
+
L: 128,
|
|
211
242
|
S: this,
|
|
212
243
|
C: (f, a) => f(...a)
|
|
213
244
|
});
|
|
@@ -221,6 +252,8 @@ var EdgeWsConnection = class extends Resource {
|
|
|
221
252
|
try {
|
|
222
253
|
this._ws?.close();
|
|
223
254
|
this._ws = void 0;
|
|
255
|
+
this._wsMuxer?.destroy();
|
|
256
|
+
this._wsMuxer = void 0;
|
|
224
257
|
} catch (err) {
|
|
225
258
|
if (err instanceof Error && err.message.includes("WebSocket is closed before the connection is established.")) {
|
|
226
259
|
return;
|
|
@@ -229,7 +262,7 @@ var EdgeWsConnection = class extends Resource {
|
|
|
229
262
|
err
|
|
230
263
|
}, {
|
|
231
264
|
F: __dxlog_file2,
|
|
232
|
-
L:
|
|
265
|
+
L: 146,
|
|
233
266
|
S: this,
|
|
234
267
|
C: (f, a) => f(...a)
|
|
235
268
|
});
|
|
@@ -238,7 +271,7 @@ var EdgeWsConnection = class extends Resource {
|
|
|
238
271
|
_scheduleHeartbeats() {
|
|
239
272
|
invariant2(this._ws, void 0, {
|
|
240
273
|
F: __dxlog_file2,
|
|
241
|
-
L:
|
|
274
|
+
L: 151,
|
|
242
275
|
S: this,
|
|
243
276
|
A: [
|
|
244
277
|
"this._ws",
|
|
@@ -258,13 +291,13 @@ var EdgeWsConnection = class extends Resource {
|
|
|
258
291
|
void this._inactivityTimeoutCtx?.dispose();
|
|
259
292
|
this._inactivityTimeoutCtx = new Context(void 0, {
|
|
260
293
|
F: __dxlog_file2,
|
|
261
|
-
L:
|
|
294
|
+
L: 170
|
|
262
295
|
});
|
|
263
296
|
scheduleTask(this._inactivityTimeoutCtx, () => {
|
|
264
297
|
if (this.isOpen) {
|
|
265
298
|
log.warn("restart due to inactivity timeout", void 0, {
|
|
266
299
|
F: __dxlog_file2,
|
|
267
|
-
L:
|
|
300
|
+
L: 175,
|
|
268
301
|
S: this,
|
|
269
302
|
C: (f, a) => f(...a)
|
|
270
303
|
});
|
|
@@ -308,30 +341,23 @@ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/
|
|
|
308
341
|
var DEFAULT_TIMEOUT = 1e4;
|
|
309
342
|
var EdgeClient = class extends Resource2 {
|
|
310
343
|
constructor(_identity, _config) {
|
|
311
|
-
super()
|
|
312
|
-
this._identity = _identity;
|
|
313
|
-
this._config = _config;
|
|
314
|
-
this._persistentLifecycle = new PersistentLifecycle({
|
|
344
|
+
super(), this._identity = _identity, this._config = _config, this.statusChanged = new Event(), this._persistentLifecycle = new PersistentLifecycle({
|
|
315
345
|
start: async () => this._connect(),
|
|
316
346
|
stop: async (state) => this._disconnect(state)
|
|
317
|
-
});
|
|
318
|
-
this._messageListeners = /* @__PURE__ */ new Set();
|
|
319
|
-
this._reconnectListeners = /* @__PURE__ */ new Set();
|
|
320
|
-
this._currentConnection = void 0;
|
|
321
|
-
this._ready = new Trigger();
|
|
322
|
-
this._isActive = (connection) => connection === this._currentConnection;
|
|
347
|
+
}), this._messageListeners = /* @__PURE__ */ new Set(), this._reconnectListeners = /* @__PURE__ */ new Set(), this._currentConnection = void 0, this._ready = new Trigger(), this._isActive = (connection) => connection === this._currentConnection;
|
|
323
348
|
this._baseWsUrl = getEdgeUrlWithProtocol(_config.socketEndpoint, "ws");
|
|
324
349
|
this._baseHttpUrl = getEdgeUrlWithProtocol(_config.socketEndpoint, "http");
|
|
325
350
|
}
|
|
326
351
|
get info() {
|
|
327
352
|
return {
|
|
328
353
|
open: this.isOpen,
|
|
354
|
+
status: this.status,
|
|
329
355
|
identity: this._identity.identityKey,
|
|
330
356
|
device: this._identity.peerKey
|
|
331
357
|
};
|
|
332
358
|
}
|
|
333
|
-
get
|
|
334
|
-
return Boolean(this._currentConnection) && this._ready.state === TriggerState.RESOLVED;
|
|
359
|
+
get status() {
|
|
360
|
+
return Boolean(this._currentConnection) && this._ready.state === TriggerState.RESOLVED ? EdgeStatus.CONNECTED : EdgeStatus.NOT_CONNECTED;
|
|
335
361
|
}
|
|
336
362
|
get identityKey() {
|
|
337
363
|
return this._identity.identityKey;
|
|
@@ -346,13 +372,13 @@ var EdgeClient = class extends Resource2 {
|
|
|
346
372
|
oldIdentity: this._identity
|
|
347
373
|
}, {
|
|
348
374
|
F: __dxlog_file3,
|
|
349
|
-
L:
|
|
375
|
+
L: 99,
|
|
350
376
|
S: this,
|
|
351
377
|
C: (f, a) => f(...a)
|
|
352
378
|
});
|
|
353
379
|
this._identity = identity;
|
|
354
380
|
this._closeCurrentConnection(new EdgeIdentityChangedError());
|
|
355
|
-
this._persistentLifecycle.scheduleRestart();
|
|
381
|
+
void this._persistentLifecycle.scheduleRestart();
|
|
356
382
|
}
|
|
357
383
|
}
|
|
358
384
|
onMessage(listener) {
|
|
@@ -369,7 +395,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
369
395
|
} catch (error) {
|
|
370
396
|
log2.catch(error, void 0, {
|
|
371
397
|
F: __dxlog_file3,
|
|
372
|
-
L:
|
|
398
|
+
L: 121,
|
|
373
399
|
S: this,
|
|
374
400
|
C: (f, a) => f(...a)
|
|
375
401
|
});
|
|
@@ -387,7 +413,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
387
413
|
info: this.info
|
|
388
414
|
}, {
|
|
389
415
|
F: __dxlog_file3,
|
|
390
|
-
L:
|
|
416
|
+
L: 133,
|
|
391
417
|
S: this,
|
|
392
418
|
C: (f, a) => f(...a)
|
|
393
419
|
});
|
|
@@ -396,7 +422,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
396
422
|
err
|
|
397
423
|
}, {
|
|
398
424
|
F: __dxlog_file3,
|
|
399
|
-
L:
|
|
425
|
+
L: 135,
|
|
400
426
|
S: this,
|
|
401
427
|
C: (f, a) => f(...a)
|
|
402
428
|
});
|
|
@@ -410,7 +436,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
410
436
|
peerKey: this._identity.peerKey
|
|
411
437
|
}, {
|
|
412
438
|
F: __dxlog_file3,
|
|
413
|
-
L:
|
|
439
|
+
L: 143,
|
|
414
440
|
S: this,
|
|
415
441
|
C: (f, a) => f(...a)
|
|
416
442
|
});
|
|
@@ -427,7 +453,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
427
453
|
if (this._identity !== identity) {
|
|
428
454
|
log2("identity changed during auth header request", void 0, {
|
|
429
455
|
F: __dxlog_file3,
|
|
430
|
-
L:
|
|
456
|
+
L: 157,
|
|
431
457
|
S: this,
|
|
432
458
|
C: (f, a) => f(...a)
|
|
433
459
|
});
|
|
@@ -440,7 +466,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
440
466
|
protocolHeader
|
|
441
467
|
}, {
|
|
442
468
|
F: __dxlog_file3,
|
|
443
|
-
L:
|
|
469
|
+
L: 163,
|
|
444
470
|
S: this,
|
|
445
471
|
C: (f, a) => f(...a)
|
|
446
472
|
});
|
|
@@ -455,7 +481,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
455
481
|
} else {
|
|
456
482
|
log2.verbose("connected callback ignored, because connection is not active", void 0, {
|
|
457
483
|
F: __dxlog_file3,
|
|
458
|
-
L:
|
|
484
|
+
L: 173,
|
|
459
485
|
S: this,
|
|
460
486
|
C: (f, a) => f(...a)
|
|
461
487
|
});
|
|
@@ -464,11 +490,11 @@ var EdgeClient = class extends Resource2 {
|
|
|
464
490
|
onRestartRequired: () => {
|
|
465
491
|
if (this._isActive(connection)) {
|
|
466
492
|
this._closeCurrentConnection();
|
|
467
|
-
this._persistentLifecycle.scheduleRestart();
|
|
493
|
+
void this._persistentLifecycle.scheduleRestart();
|
|
468
494
|
} else {
|
|
469
495
|
log2.verbose("restart requested by inactive connection", void 0, {
|
|
470
496
|
F: __dxlog_file3,
|
|
471
|
-
L:
|
|
497
|
+
L: 181,
|
|
472
498
|
S: this,
|
|
473
499
|
C: (f, a) => f(...a)
|
|
474
500
|
});
|
|
@@ -484,7 +510,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
484
510
|
type: message.payload?.typeUrl
|
|
485
511
|
}, {
|
|
486
512
|
F: __dxlog_file3,
|
|
487
|
-
L:
|
|
513
|
+
L: 189,
|
|
488
514
|
S: this,
|
|
489
515
|
C: (f, a) => f(...a)
|
|
490
516
|
});
|
|
@@ -503,13 +529,16 @@ var EdgeClient = class extends Resource2 {
|
|
|
503
529
|
}
|
|
504
530
|
async _disconnect(state) {
|
|
505
531
|
await state.close();
|
|
532
|
+
this.statusChanged.emit(this.status);
|
|
506
533
|
}
|
|
507
534
|
_closeCurrentConnection(error = new EdgeConnectionClosedError()) {
|
|
508
535
|
this._currentConnection = void 0;
|
|
509
536
|
this._ready.throw(error);
|
|
510
537
|
this._ready.reset();
|
|
538
|
+
this.statusChanged.emit(this.status);
|
|
511
539
|
}
|
|
512
540
|
_notifyReconnected() {
|
|
541
|
+
this.statusChanged.emit(this.status);
|
|
513
542
|
for (const listener of this._reconnectListeners) {
|
|
514
543
|
try {
|
|
515
544
|
listener();
|
|
@@ -518,7 +547,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
518
547
|
err
|
|
519
548
|
}, {
|
|
520
549
|
F: __dxlog_file3,
|
|
521
|
-
L:
|
|
550
|
+
L: 225,
|
|
522
551
|
S: this,
|
|
523
552
|
C: (f, a) => f(...a)
|
|
524
553
|
});
|
|
@@ -535,7 +564,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
535
564
|
payload: protocol.getPayloadType(message)
|
|
536
565
|
}, {
|
|
537
566
|
F: __dxlog_file3,
|
|
538
|
-
L:
|
|
567
|
+
L: 235,
|
|
539
568
|
S: this,
|
|
540
569
|
C: (f, a) => f(...a)
|
|
541
570
|
});
|
|
@@ -550,7 +579,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
550
579
|
if (this._ready.state !== TriggerState.RESOLVED) {
|
|
551
580
|
log2("waiting for websocket to become ready", void 0, {
|
|
552
581
|
F: __dxlog_file3,
|
|
553
|
-
L:
|
|
582
|
+
L: 246,
|
|
554
583
|
S: this,
|
|
555
584
|
C: (f, a) => f(...a)
|
|
556
585
|
});
|
|
@@ -580,7 +609,7 @@ var EdgeClient = class extends Resource2 {
|
|
|
580
609
|
statusText: response.statusText
|
|
581
610
|
}, {
|
|
582
611
|
F: __dxlog_file3,
|
|
583
|
-
L:
|
|
612
|
+
L: 271,
|
|
584
613
|
S: this,
|
|
585
614
|
C: (f, a) => f(...a)
|
|
586
615
|
});
|
|
@@ -787,7 +816,6 @@ var EdgeHttpClient = class {
|
|
|
787
816
|
async uploadFunction(pathParts, body, args) {
|
|
788
817
|
const path = [
|
|
789
818
|
"functions",
|
|
790
|
-
pathParts.spaceId,
|
|
791
819
|
...pathParts.functionId ? [
|
|
792
820
|
pathParts.functionId
|
|
793
821
|
] : []
|
|
@@ -986,11 +1014,14 @@ var encodeAuthHeader = (challenge) => {
|
|
|
986
1014
|
return `VerifiablePresentation pb;base64,${encodedChallenge}`;
|
|
987
1015
|
};
|
|
988
1016
|
export {
|
|
1017
|
+
CLOUDFLARE_MESSAGE_MAX_BYTES,
|
|
1018
|
+
CLOUDFLARE_RPC_MAX_BYTES,
|
|
989
1019
|
EdgeClient,
|
|
990
1020
|
EdgeConnectionClosedError,
|
|
991
1021
|
EdgeHttpClient,
|
|
992
1022
|
EdgeIdentityChangedError,
|
|
993
1023
|
Protocol,
|
|
1024
|
+
WebSocketMuxer,
|
|
994
1025
|
createChainEdgeIdentity,
|
|
995
1026
|
createDeviceEdgeIdentity,
|
|
996
1027
|
createEphemeralEdgeIdentity,
|