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