@dxos/edge-client 0.8.1 → 0.8.2-main.2f9c567

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 (53) hide show
  1. package/dist/lib/browser/chunk-TKYUZ5ZK.mjs +302 -0
  2. package/dist/lib/browser/chunk-TKYUZ5ZK.mjs.map +7 -0
  3. package/dist/lib/browser/edge-ws-muxer.mjs +11 -0
  4. package/dist/lib/browser/edge-ws-muxer.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +93 -49
  6. package/dist/lib/browser/index.mjs.map +3 -3
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/testing/index.mjs +32 -20
  9. package/dist/lib/browser/testing/index.mjs.map +3 -3
  10. package/dist/lib/node/chunk-ZOL3YSDR.cjs +322 -0
  11. package/dist/lib/node/chunk-ZOL3YSDR.cjs.map +7 -0
  12. package/dist/lib/node/edge-ws-muxer.cjs +33 -0
  13. package/dist/lib/node/edge-ws-muxer.cjs.map +7 -0
  14. package/dist/lib/node/index.cjs +105 -61
  15. package/dist/lib/node/index.cjs.map +3 -3
  16. package/dist/lib/node/meta.json +1 -1
  17. package/dist/lib/node/testing/index.cjs +32 -21
  18. package/dist/lib/node/testing/index.cjs.map +3 -3
  19. package/dist/lib/node-esm/chunk-25HGRGNZ.mjs +304 -0
  20. package/dist/lib/node-esm/chunk-25HGRGNZ.mjs.map +7 -0
  21. package/dist/lib/node-esm/edge-ws-muxer.mjs +12 -0
  22. package/dist/lib/node-esm/edge-ws-muxer.mjs.map +7 -0
  23. package/dist/lib/node-esm/index.mjs +93 -49
  24. package/dist/lib/node-esm/index.mjs.map +3 -3
  25. package/dist/lib/node-esm/meta.json +1 -1
  26. package/dist/lib/node-esm/testing/index.mjs +32 -20
  27. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  28. package/dist/types/src/edge-client.d.ts +7 -2
  29. package/dist/types/src/edge-client.d.ts.map +1 -1
  30. package/dist/types/src/edge-ws-connection.d.ts +1 -0
  31. package/dist/types/src/edge-ws-connection.d.ts.map +1 -1
  32. package/dist/types/src/edge-ws-muxer.d.ts +35 -0
  33. package/dist/types/src/edge-ws-muxer.d.ts.map +1 -0
  34. package/dist/types/src/edge-ws-muxer.test.d.ts +2 -0
  35. package/dist/types/src/edge-ws-muxer.test.d.ts.map +1 -0
  36. package/dist/types/src/index.d.ts +1 -0
  37. package/dist/types/src/index.d.ts.map +1 -1
  38. package/dist/types/src/testing/test-utils.d.ts +6 -2
  39. package/dist/types/src/testing/test-utils.d.ts.map +1 -1
  40. package/package.json +19 -14
  41. package/src/edge-client.test.ts +5 -4
  42. package/src/edge-client.ts +16 -8
  43. package/src/edge-ws-connection.ts +36 -18
  44. package/src/edge-ws-muxer.test.ts +55 -0
  45. package/src/edge-ws-muxer.ts +217 -0
  46. package/src/index.ts +1 -0
  47. package/src/testing/test-utils.ts +33 -26
  48. package/dist/lib/browser/chunk-ZWJXA37R.mjs +0 -113
  49. package/dist/lib/browser/chunk-ZWJXA37R.mjs.map +0 -7
  50. package/dist/lib/node/chunk-ANV2HBEH.cjs +0 -136
  51. package/dist/lib/node/chunk-ANV2HBEH.cjs.map +0 -7
  52. package/dist/lib/node-esm/chunk-HNVT57AU.mjs +0 -115
  53. package/dist/lib/node-esm/chunk-HNVT57AU.mjs.map +0 -7
@@ -29,27 +29,31 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
30
  var node_exports = {};
31
31
  __export(node_exports, {
32
+ CLOUDFLARE_MESSAGE_MAX_BYTES: () => import_chunk_ZOL3YSDR.CLOUDFLARE_MESSAGE_MAX_BYTES,
33
+ CLOUDFLARE_RPC_MAX_BYTES: () => import_chunk_ZOL3YSDR.CLOUDFLARE_RPC_MAX_BYTES,
32
34
  EdgeClient: () => EdgeClient,
33
35
  EdgeConnectionClosedError: () => EdgeConnectionClosedError,
34
36
  EdgeHttpClient: () => EdgeHttpClient,
35
37
  EdgeIdentityChangedError: () => EdgeIdentityChangedError,
36
- Protocol: () => import_chunk_ANV2HBEH.Protocol,
38
+ Protocol: () => import_chunk_ZOL3YSDR.Protocol,
39
+ WebSocketMuxer: () => import_chunk_ZOL3YSDR.WebSocketMuxer,
37
40
  createChainEdgeIdentity: () => createChainEdgeIdentity,
38
41
  createDeviceEdgeIdentity: () => createDeviceEdgeIdentity,
39
42
  createEphemeralEdgeIdentity: () => createEphemeralEdgeIdentity,
40
43
  createStubEdgeIdentity: () => createStubEdgeIdentity,
41
44
  createTestHaloEdgeIdentity: () => createTestHaloEdgeIdentity,
42
- getTypename: () => import_chunk_ANV2HBEH.getTypename,
45
+ getTypename: () => import_chunk_ZOL3YSDR.getTypename,
43
46
  handleAuthChallenge: () => handleAuthChallenge,
44
- protocol: () => import_chunk_ANV2HBEH.protocol,
45
- toUint8Array: () => import_chunk_ANV2HBEH.toUint8Array
47
+ protocol: () => import_chunk_ZOL3YSDR.protocol,
48
+ toUint8Array: () => import_chunk_ZOL3YSDR.toUint8Array
46
49
  });
47
50
  module.exports = __toCommonJS(node_exports);
48
- var import_chunk_ANV2HBEH = require("./chunk-ANV2HBEH.cjs");
51
+ var import_chunk_ZOL3YSDR = require("./chunk-ZOL3YSDR.cjs");
49
52
  __reExport(node_exports, require("@dxos/protocols/buf/dxos/edge/messenger_pb"), module.exports);
50
53
  var import_async = require("@dxos/async");
51
54
  var import_context = require("@dxos/context");
52
55
  var import_log = require("@dxos/log");
56
+ var import_services = require("@dxos/protocols/proto/dxos/client/services");
53
57
  var import_invariant = require("@dxos/invariant");
54
58
  var import_proto = require("@dxos/protocols/proto");
55
59
  var import_isomorphic_ws = __toESM(require("isomorphic-ws"));
@@ -57,6 +61,7 @@ var import_async2 = require("@dxos/async");
57
61
  var import_context2 = require("@dxos/context");
58
62
  var import_invariant2 = require("@dxos/invariant");
59
63
  var import_log2 = require("@dxos/log");
64
+ var import_protocols = require("@dxos/protocols");
60
65
  var import_buf = require("@dxos/protocols/buf");
61
66
  var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
62
67
  var import_credentials = require("@dxos/credentials");
@@ -66,7 +71,7 @@ var import_keys = require("@dxos/keys");
66
71
  var import_async3 = require("@dxos/async");
67
72
  var import_context3 = require("@dxos/context");
68
73
  var import_log3 = require("@dxos/log");
69
- var import_protocols = require("@dxos/protocols");
74
+ var import_protocols2 = require("@dxos/protocols");
70
75
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-identity.ts";
71
76
  var handleAuthChallenge = async (failedResponse, identity) => {
72
77
  (0, import_invariant.invariant)(failedResponse.status === 401, void 0, {
@@ -112,7 +117,6 @@ function _ts_decorate(decorators, target, key, desc) {
112
117
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-ws-connection.ts";
113
118
  var SIGNAL_KEEPALIVE_INTERVAL = 4e3;
114
119
  var SIGNAL_KEEPALIVE_TIMEOUT = 12e3;
115
- var CLOUDFLARE_MESSAGE_LENGTH_LIMIT = 1024 * 1024;
116
120
  var EdgeWsConnection = class extends import_context2.Resource {
117
121
  constructor(_identity, _connectionInfo, _callbacks) {
118
122
  super();
@@ -130,47 +134,73 @@ var EdgeWsConnection = class extends import_context2.Resource {
130
134
  send(message) {
131
135
  (0, import_invariant2.invariant)(this._ws, void 0, {
132
136
  F: __dxlog_file2,
133
- L: 54,
137
+ L: 52,
134
138
  S: this,
135
139
  A: [
136
140
  "this._ws",
137
141
  ""
138
142
  ]
139
143
  });
144
+ (0, import_invariant2.invariant)(this._wsMuxer, void 0, {
145
+ F: __dxlog_file2,
146
+ L: 53,
147
+ S: this,
148
+ A: [
149
+ "this._wsMuxer",
150
+ ""
151
+ ]
152
+ });
140
153
  (0, import_log2.log)("sending...", {
141
154
  peerKey: this._identity.peerKey,
142
- payload: import_chunk_ANV2HBEH.protocol.getPayloadType(message)
155
+ payload: import_chunk_ZOL3YSDR.protocol.getPayloadType(message)
143
156
  }, {
144
157
  F: __dxlog_file2,
145
- L: 55,
158
+ L: 54,
146
159
  S: this,
147
160
  C: (f, a) => f(...a)
148
161
  });
149
- const encoded = import_buf.buf.toBinary(import_messenger_pb.MessageSchema, message);
150
- if (encoded.byteLength >= CLOUDFLARE_MESSAGE_LENGTH_LIMIT) {
151
- import_log2.log.error("edge message dropped due to websocket message limit", {
152
- byteLength: encoded.byteLength,
153
- serviceId: message.serviceId,
154
- payload: import_chunk_ANV2HBEH.protocol.getPayloadType(message)
155
- }, {
162
+ if (this._ws?.protocol.includes(import_protocols.EdgeWebsocketProtocol.V0)) {
163
+ const binary = import_buf.buf.toBinary(import_messenger_pb.MessageSchema, message);
164
+ if (binary.length > import_chunk_ZOL3YSDR.CLOUDFLARE_MESSAGE_MAX_BYTES) {
165
+ import_log2.log.error("Message dropped because it was too large (>1MB).", {
166
+ byteLength: binary.byteLength,
167
+ serviceId: message.serviceId,
168
+ payload: import_chunk_ZOL3YSDR.protocol.getPayloadType(message)
169
+ }, {
170
+ F: __dxlog_file2,
171
+ L: 58,
172
+ S: this,
173
+ C: (f, a) => f(...a)
174
+ });
175
+ return;
176
+ }
177
+ this._ws.send(binary);
178
+ } else {
179
+ this._wsMuxer.send(message).catch((e) => import_log2.log.catch(e, void 0, {
156
180
  F: __dxlog_file2,
157
- L: 58,
181
+ L: 67,
158
182
  S: this,
159
183
  C: (f, a) => f(...a)
160
- });
161
- return;
184
+ }));
162
185
  }
163
- this._ws.send(encoded);
164
186
  }
165
187
  async _open() {
188
+ const baseProtocols = [
189
+ ...Object.values(import_protocols.EdgeWebsocketProtocol)
190
+ ];
166
191
  this._ws = new import_isomorphic_ws.default(this._connectionInfo.url.toString(), this._connectionInfo.protocolHeader ? [
192
+ ...baseProtocols,
167
193
  this._connectionInfo.protocolHeader
168
- ] : []);
194
+ ] : [
195
+ ...baseProtocols
196
+ ]);
197
+ const muxer = new import_chunk_ZOL3YSDR.WebSocketMuxer(this._ws);
198
+ this._wsMuxer = muxer;
169
199
  this._ws.onopen = () => {
170
200
  if (this.isOpen) {
171
201
  (0, import_log2.log)("connected", void 0, {
172
202
  F: __dxlog_file2,
173
- L: 76,
203
+ L: 84,
174
204
  S: this,
175
205
  C: (f, a) => f(...a)
176
206
  });
@@ -181,7 +211,7 @@ var EdgeWsConnection = class extends import_context2.Resource {
181
211
  currentIdentity: this._identity
182
212
  }, {
183
213
  F: __dxlog_file2,
184
- L: 80,
214
+ L: 88,
185
215
  S: this,
186
216
  C: (f, a) => f(...a)
187
217
  });
@@ -194,11 +224,12 @@ var EdgeWsConnection = class extends import_context2.Resource {
194
224
  reason: event.reason
195
225
  }, {
196
226
  F: __dxlog_file2,
197
- L: 85,
227
+ L: 93,
198
228
  S: this,
199
229
  C: (f, a) => f(...a)
200
230
  });
201
231
  this._callbacks.onRestartRequired();
232
+ muxer.destroy();
202
233
  }
203
234
  };
204
235
  this._ws.onerror = (event) => {
@@ -208,7 +239,7 @@ var EdgeWsConnection = class extends import_context2.Resource {
208
239
  info: event.message
209
240
  }, {
210
241
  F: __dxlog_file2,
211
- L: 91,
242
+ L: 100,
212
243
  S: this,
213
244
  C: (f, a) => f(...a)
214
245
  });
@@ -218,7 +249,7 @@ var EdgeWsConnection = class extends import_context2.Resource {
218
249
  error: event.error
219
250
  }, {
220
251
  F: __dxlog_file2,
221
- L: 94,
252
+ L: 103,
222
253
  S: this,
223
254
  C: (f, a) => f(...a)
224
255
  });
@@ -230,7 +261,7 @@ var EdgeWsConnection = class extends import_context2.Resource {
230
261
  event: event.type
231
262
  }, {
232
263
  F: __dxlog_file2,
233
- L: 102,
264
+ L: 111,
234
265
  S: this,
235
266
  C: (f, a) => f(...a)
236
267
  });
@@ -240,15 +271,18 @@ var EdgeWsConnection = class extends import_context2.Resource {
240
271
  this._rescheduleHeartbeatTimeout();
241
272
  return;
242
273
  }
243
- const data = await (0, import_chunk_ANV2HBEH.toUint8Array)(event.data);
244
- if (this.isOpen) {
245
- const message = import_buf.buf.fromBinary(import_messenger_pb.MessageSchema, data);
274
+ const bytes = await (0, import_chunk_ZOL3YSDR.toUint8Array)(event.data);
275
+ if (!this.isOpen) {
276
+ return;
277
+ }
278
+ const message = this._ws?.protocol?.includes(import_protocols.EdgeWebsocketProtocol.V0) ? import_buf.buf.fromBinary(import_messenger_pb.MessageSchema, bytes) : muxer.receiveData(bytes);
279
+ if (message) {
246
280
  (0, import_log2.log)("received", {
247
281
  from: message.source,
248
- payload: import_chunk_ANV2HBEH.protocol.getPayloadType(message)
282
+ payload: import_chunk_ZOL3YSDR.protocol.getPayloadType(message)
249
283
  }, {
250
284
  F: __dxlog_file2,
251
- L: 112,
285
+ L: 128,
252
286
  S: this,
253
287
  C: (f, a) => f(...a)
254
288
  });
@@ -262,6 +296,8 @@ var EdgeWsConnection = class extends import_context2.Resource {
262
296
  try {
263
297
  this._ws?.close();
264
298
  this._ws = void 0;
299
+ this._wsMuxer?.destroy();
300
+ this._wsMuxer = void 0;
265
301
  } catch (err) {
266
302
  if (err instanceof Error && err.message.includes("WebSocket is closed before the connection is established.")) {
267
303
  return;
@@ -270,7 +306,7 @@ var EdgeWsConnection = class extends import_context2.Resource {
270
306
  err
271
307
  }, {
272
308
  F: __dxlog_file2,
273
- L: 128,
309
+ L: 146,
274
310
  S: this,
275
311
  C: (f, a) => f(...a)
276
312
  });
@@ -279,7 +315,7 @@ var EdgeWsConnection = class extends import_context2.Resource {
279
315
  _scheduleHeartbeats() {
280
316
  (0, import_invariant2.invariant)(this._ws, void 0, {
281
317
  F: __dxlog_file2,
282
- L: 133,
318
+ L: 151,
283
319
  S: this,
284
320
  A: [
285
321
  "this._ws",
@@ -299,13 +335,13 @@ var EdgeWsConnection = class extends import_context2.Resource {
299
335
  void this._inactivityTimeoutCtx?.dispose();
300
336
  this._inactivityTimeoutCtx = new import_context2.Context(void 0, {
301
337
  F: __dxlog_file2,
302
- L: 152
338
+ L: 170
303
339
  });
304
340
  (0, import_async2.scheduleTask)(this._inactivityTimeoutCtx, () => {
305
341
  if (this.isOpen) {
306
342
  import_log2.log.warn("restart due to inactivity timeout", void 0, {
307
343
  F: __dxlog_file2,
308
- L: 157,
344
+ L: 175,
309
345
  S: this,
310
346
  C: (f, a) => f(...a)
311
347
  });
@@ -346,6 +382,7 @@ var EdgeClient = class extends import_context.Resource {
346
382
  super();
347
383
  this._identity = _identity;
348
384
  this._config = _config;
385
+ this.statusChanged = new import_async.Event();
349
386
  this._persistentLifecycle = new import_async.PersistentLifecycle({
350
387
  start: async () => this._connect(),
351
388
  stop: async (state) => this._disconnect(state)
@@ -361,12 +398,13 @@ var EdgeClient = class extends import_context.Resource {
361
398
  get info() {
362
399
  return {
363
400
  open: this.isOpen,
401
+ status: this.status,
364
402
  identity: this._identity.identityKey,
365
403
  device: this._identity.peerKey
366
404
  };
367
405
  }
368
- get isConnected() {
369
- return Boolean(this._currentConnection) && this._ready.state === import_async.TriggerState.RESOLVED;
406
+ get status() {
407
+ return Boolean(this._currentConnection) && this._ready.state === import_async.TriggerState.RESOLVED ? import_services.EdgeStatus.CONNECTED : import_services.EdgeStatus.NOT_CONNECTED;
370
408
  }
371
409
  get identityKey() {
372
410
  return this._identity.identityKey;
@@ -381,13 +419,13 @@ var EdgeClient = class extends import_context.Resource {
381
419
  oldIdentity: this._identity
382
420
  }, {
383
421
  F: __dxlog_file3,
384
- L: 94,
422
+ L: 99,
385
423
  S: this,
386
424
  C: (f, a) => f(...a)
387
425
  });
388
426
  this._identity = identity;
389
427
  this._closeCurrentConnection(new EdgeIdentityChangedError());
390
- this._persistentLifecycle.scheduleRestart();
428
+ void this._persistentLifecycle.scheduleRestart();
391
429
  }
392
430
  }
393
431
  onMessage(listener) {
@@ -404,7 +442,7 @@ var EdgeClient = class extends import_context.Resource {
404
442
  } catch (error) {
405
443
  import_log.log.catch(error, void 0, {
406
444
  F: __dxlog_file3,
407
- L: 116,
445
+ L: 121,
408
446
  S: this,
409
447
  C: (f, a) => f(...a)
410
448
  });
@@ -422,7 +460,7 @@ var EdgeClient = class extends import_context.Resource {
422
460
  info: this.info
423
461
  }, {
424
462
  F: __dxlog_file3,
425
- L: 128,
463
+ L: 133,
426
464
  S: this,
427
465
  C: (f, a) => f(...a)
428
466
  });
@@ -431,7 +469,7 @@ var EdgeClient = class extends import_context.Resource {
431
469
  err
432
470
  }, {
433
471
  F: __dxlog_file3,
434
- L: 130,
472
+ L: 135,
435
473
  S: this,
436
474
  C: (f, a) => f(...a)
437
475
  });
@@ -445,7 +483,7 @@ var EdgeClient = class extends import_context.Resource {
445
483
  peerKey: this._identity.peerKey
446
484
  }, {
447
485
  F: __dxlog_file3,
448
- L: 138,
486
+ L: 143,
449
487
  S: this,
450
488
  C: (f, a) => f(...a)
451
489
  });
@@ -462,7 +500,7 @@ var EdgeClient = class extends import_context.Resource {
462
500
  if (this._identity !== identity) {
463
501
  (0, import_log.log)("identity changed during auth header request", void 0, {
464
502
  F: __dxlog_file3,
465
- L: 152,
503
+ L: 157,
466
504
  S: this,
467
505
  C: (f, a) => f(...a)
468
506
  });
@@ -475,7 +513,7 @@ var EdgeClient = class extends import_context.Resource {
475
513
  protocolHeader
476
514
  }, {
477
515
  F: __dxlog_file3,
478
- L: 158,
516
+ L: 163,
479
517
  S: this,
480
518
  C: (f, a) => f(...a)
481
519
  });
@@ -490,7 +528,7 @@ var EdgeClient = class extends import_context.Resource {
490
528
  } else {
491
529
  import_log.log.verbose("connected callback ignored, because connection is not active", void 0, {
492
530
  F: __dxlog_file3,
493
- L: 168,
531
+ L: 173,
494
532
  S: this,
495
533
  C: (f, a) => f(...a)
496
534
  });
@@ -499,11 +537,11 @@ var EdgeClient = class extends import_context.Resource {
499
537
  onRestartRequired: () => {
500
538
  if (this._isActive(connection)) {
501
539
  this._closeCurrentConnection();
502
- this._persistentLifecycle.scheduleRestart();
540
+ void this._persistentLifecycle.scheduleRestart();
503
541
  } else {
504
542
  import_log.log.verbose("restart requested by inactive connection", void 0, {
505
543
  F: __dxlog_file3,
506
- L: 176,
544
+ L: 181,
507
545
  S: this,
508
546
  C: (f, a) => f(...a)
509
547
  });
@@ -519,7 +557,7 @@ var EdgeClient = class extends import_context.Resource {
519
557
  type: message.payload?.typeUrl
520
558
  }, {
521
559
  F: __dxlog_file3,
522
- L: 184,
560
+ L: 189,
523
561
  S: this,
524
562
  C: (f, a) => f(...a)
525
563
  });
@@ -538,13 +576,16 @@ var EdgeClient = class extends import_context.Resource {
538
576
  }
539
577
  async _disconnect(state) {
540
578
  await state.close();
579
+ this.statusChanged.emit(this.status);
541
580
  }
542
581
  _closeCurrentConnection(error = new EdgeConnectionClosedError()) {
543
582
  this._currentConnection = void 0;
544
583
  this._ready.throw(error);
545
584
  this._ready.reset();
585
+ this.statusChanged.emit(this.status);
546
586
  }
547
587
  _notifyReconnected() {
588
+ this.statusChanged.emit(this.status);
548
589
  for (const listener of this._reconnectListeners) {
549
590
  try {
550
591
  listener();
@@ -553,7 +594,7 @@ var EdgeClient = class extends import_context.Resource {
553
594
  err
554
595
  }, {
555
596
  F: __dxlog_file3,
556
- L: 217,
597
+ L: 225,
557
598
  S: this,
558
599
  C: (f, a) => f(...a)
559
600
  });
@@ -567,10 +608,10 @@ var EdgeClient = class extends import_context.Resource {
567
608
  } catch (err) {
568
609
  import_log.log.error("ws incoming message processing failed", {
569
610
  err,
570
- payload: import_chunk_ANV2HBEH.protocol.getPayloadType(message)
611
+ payload: import_chunk_ZOL3YSDR.protocol.getPayloadType(message)
571
612
  }, {
572
613
  F: __dxlog_file3,
573
- L: 227,
614
+ L: 235,
574
615
  S: this,
575
616
  C: (f, a) => f(...a)
576
617
  });
@@ -585,7 +626,7 @@ var EdgeClient = class extends import_context.Resource {
585
626
  if (this._ready.state !== import_async.TriggerState.RESOLVED) {
586
627
  (0, import_log.log)("waiting for websocket to become ready", void 0, {
587
628
  F: __dxlog_file3,
588
- L: 238,
629
+ L: 246,
589
630
  S: this,
590
631
  C: (f, a) => f(...a)
591
632
  });
@@ -615,7 +656,7 @@ var EdgeClient = class extends import_context.Resource {
615
656
  statusText: response.statusText
616
657
  }, {
617
658
  F: __dxlog_file3,
618
- L: 263,
659
+ L: 271,
619
660
  S: this,
620
661
  C: (f, a) => f(...a)
621
662
  });
@@ -924,19 +965,19 @@ var EdgeHttpClient = class {
924
965
  C: (f, a) => f(...a)
925
966
  });
926
967
  if (body.errorData?.type === "auth_challenge" && typeof body.errorData?.challenge === "string") {
927
- processingError = new import_protocols.EdgeAuthChallengeError(body.errorData.challenge, body.errorData);
968
+ processingError = new import_protocols2.EdgeAuthChallengeError(body.errorData.challenge, body.errorData);
928
969
  } else {
929
- processingError = import_protocols.EdgeCallFailedError.fromUnsuccessfulResponse(response, body);
970
+ processingError = import_protocols2.EdgeCallFailedError.fromUnsuccessfulResponse(response, body);
930
971
  }
931
972
  } else if (response.status === 401 && !handledAuth) {
932
973
  authHeader = await this._handleUnauthorized(response);
933
974
  handledAuth = true;
934
975
  continue;
935
976
  } else {
936
- processingError = import_protocols.EdgeCallFailedError.fromHttpFailure(response);
977
+ processingError = import_protocols2.EdgeCallFailedError.fromHttpFailure(response);
937
978
  }
938
979
  } catch (error) {
939
- processingError = import_protocols.EdgeCallFailedError.fromProcessingFailureCause(error);
980
+ processingError = import_protocols2.EdgeCallFailedError.fromProcessingFailureCause(error);
940
981
  }
941
982
  if (processingError.isRetryable && await shouldRetry(requestContext, retryAfterHeaderValue)) {
942
983
  (0, import_log3.log)("retrying edge request", {
@@ -961,7 +1002,7 @@ var EdgeHttpClient = class {
961
1002
  S: this,
962
1003
  C: (f, a) => f(...a)
963
1004
  });
964
- throw import_protocols.EdgeCallFailedError.fromHttpFailure(response);
1005
+ throw import_protocols2.EdgeCallFailedError.fromHttpFailure(response);
965
1006
  }
966
1007
  const challenge = await handleAuthChallenge(response, this._edgeIdentity);
967
1008
  this._authHeader = encodeAuthHeader(challenge);
@@ -1010,11 +1051,14 @@ var encodeAuthHeader = (challenge) => {
1010
1051
  };
1011
1052
  // Annotate the CommonJS export names for ESM import in node:
1012
1053
  0 && (module.exports = {
1054
+ CLOUDFLARE_MESSAGE_MAX_BYTES,
1055
+ CLOUDFLARE_RPC_MAX_BYTES,
1013
1056
  EdgeClient,
1014
1057
  EdgeConnectionClosedError,
1015
1058
  EdgeHttpClient,
1016
1059
  EdgeIdentityChangedError,
1017
1060
  Protocol,
1061
+ WebSocketMuxer,
1018
1062
  createChainEdgeIdentity,
1019
1063
  createDeviceEdgeIdentity,
1020
1064
  createEphemeralEdgeIdentity,