@dxos/edge-client 0.8.2-main.12df754 → 0.8.2-main.36232bc

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 (38) hide show
  1. package/dist/lib/browser/chunk-XS3TKGM4.mjs +545 -0
  2. package/dist/lib/browser/chunk-XS3TKGM4.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +60 -282
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +32 -20
  7. package/dist/lib/browser/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/chunk-ZURVCY7K.cjs +577 -0
  9. package/dist/lib/node/chunk-ZURVCY7K.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +50 -281
  11. package/dist/lib/node/index.cjs.map +4 -4
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +31 -21
  14. package/dist/lib/node/testing/index.cjs.map +3 -3
  15. package/dist/lib/node-esm/chunk-HNRMNQPG.mjs +547 -0
  16. package/dist/lib/node-esm/chunk-HNRMNQPG.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +60 -282
  18. package/dist/lib/node-esm/index.mjs.map +4 -4
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +32 -20
  21. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  22. package/dist/types/src/edge-ws-connection.d.ts +5 -0
  23. package/dist/types/src/edge-ws-connection.d.ts.map +1 -1
  24. package/dist/types/src/edge-ws-muxer.d.ts +23 -0
  25. package/dist/types/src/edge-ws-muxer.d.ts.map +1 -0
  26. package/dist/types/src/testing/test-utils.d.ts +6 -2
  27. package/dist/types/src/testing/test-utils.d.ts.map +1 -1
  28. package/package.json +14 -14
  29. package/src/edge-client.ts +2 -2
  30. package/src/edge-ws-connection.ts +38 -15
  31. package/src/edge-ws-muxer.ts +187 -0
  32. package/src/testing/test-utils.ts +33 -26
  33. package/dist/lib/browser/chunk-ZWJXA37R.mjs +0 -113
  34. package/dist/lib/browser/chunk-ZWJXA37R.mjs.map +0 -7
  35. package/dist/lib/node/chunk-ANV2HBEH.cjs +0 -136
  36. package/dist/lib/node/chunk-ANV2HBEH.cjs.map +0 -7
  37. package/dist/lib/node-esm/chunk-HNVT57AU.mjs +0 -115
  38. package/dist/lib/node-esm/chunk-HNVT57AU.mjs.map +0 -7
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
18
16
  return to;
19
17
  };
20
18
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
20
  var node_exports = {};
31
21
  __export(node_exports, {
@@ -33,19 +23,19 @@ __export(node_exports, {
33
23
  EdgeConnectionClosedError: () => EdgeConnectionClosedError,
34
24
  EdgeHttpClient: () => EdgeHttpClient,
35
25
  EdgeIdentityChangedError: () => EdgeIdentityChangedError,
36
- Protocol: () => import_chunk_ANV2HBEH.Protocol,
26
+ Protocol: () => import_chunk_ZURVCY7K.Protocol,
37
27
  createChainEdgeIdentity: () => createChainEdgeIdentity,
38
28
  createDeviceEdgeIdentity: () => createDeviceEdgeIdentity,
39
29
  createEphemeralEdgeIdentity: () => createEphemeralEdgeIdentity,
40
30
  createStubEdgeIdentity: () => createStubEdgeIdentity,
41
31
  createTestHaloEdgeIdentity: () => createTestHaloEdgeIdentity,
42
- getTypename: () => import_chunk_ANV2HBEH.getTypename,
32
+ getTypename: () => import_chunk_ZURVCY7K.getTypename,
43
33
  handleAuthChallenge: () => handleAuthChallenge,
44
- protocol: () => import_chunk_ANV2HBEH.protocol,
45
- toUint8Array: () => import_chunk_ANV2HBEH.toUint8Array
34
+ protocol: () => import_chunk_ZURVCY7K.protocol,
35
+ toUint8Array: () => import_chunk_ZURVCY7K.toUint8Array
46
36
  });
47
37
  module.exports = __toCommonJS(node_exports);
48
- var import_chunk_ANV2HBEH = require("./chunk-ANV2HBEH.cjs");
38
+ var import_chunk_ZURVCY7K = require("./chunk-ZURVCY7K.cjs");
49
39
  __reExport(node_exports, require("@dxos/protocols/buf/dxos/edge/messenger_pb"), module.exports);
50
40
  var import_async = require("@dxos/async");
51
41
  var import_context = require("@dxos/context");
@@ -53,20 +43,13 @@ var import_log = require("@dxos/log");
53
43
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
54
44
  var import_invariant = require("@dxos/invariant");
55
45
  var import_proto = require("@dxos/protocols/proto");
56
- var import_isomorphic_ws = __toESM(require("isomorphic-ws"));
57
- var import_async2 = require("@dxos/async");
58
- var import_context2 = require("@dxos/context");
59
- var import_invariant2 = require("@dxos/invariant");
60
- var import_log2 = require("@dxos/log");
61
- var import_buf = require("@dxos/protocols/buf");
62
- var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
63
46
  var import_credentials = require("@dxos/credentials");
64
- var import_invariant3 = require("@dxos/invariant");
47
+ var import_invariant2 = require("@dxos/invariant");
65
48
  var import_keyring = require("@dxos/keyring");
66
49
  var import_keys = require("@dxos/keys");
67
- var import_async3 = require("@dxos/async");
68
- var import_context3 = require("@dxos/context");
69
- var import_log3 = require("@dxos/log");
50
+ var import_async2 = require("@dxos/async");
51
+ var import_context2 = require("@dxos/context");
52
+ var import_log2 = require("@dxos/log");
70
53
  var import_protocols = require("@dxos/protocols");
71
54
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-identity.ts";
72
55
  var handleAuthChallenge = async (failedResponse, identity) => {
@@ -104,220 +87,6 @@ var handleAuthChallenge = async (failedResponse, identity) => {
104
87
  });
105
88
  return import_proto.schema.getCodecForType("dxos.halo.credentials.Presentation").encode(presentation);
106
89
  };
107
- function _ts_decorate(decorators, target, key, desc) {
108
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
109
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
110
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
111
- return c > 3 && r && Object.defineProperty(target, key, r), r;
112
- }
113
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-ws-connection.ts";
114
- var SIGNAL_KEEPALIVE_INTERVAL = 4e3;
115
- var SIGNAL_KEEPALIVE_TIMEOUT = 12e3;
116
- var CLOUDFLARE_MESSAGE_LENGTH_LIMIT = 1024 * 1024;
117
- var EdgeWsConnection = class extends import_context2.Resource {
118
- constructor(_identity, _connectionInfo, _callbacks) {
119
- super();
120
- this._identity = _identity;
121
- this._connectionInfo = _connectionInfo;
122
- this._callbacks = _callbacks;
123
- }
124
- get info() {
125
- return {
126
- open: this.isOpen,
127
- identity: this._identity.identityKey,
128
- device: this._identity.peerKey
129
- };
130
- }
131
- send(message) {
132
- (0, import_invariant2.invariant)(this._ws, void 0, {
133
- F: __dxlog_file2,
134
- L: 54,
135
- S: this,
136
- A: [
137
- "this._ws",
138
- ""
139
- ]
140
- });
141
- (0, import_log2.log)("sending...", {
142
- peerKey: this._identity.peerKey,
143
- payload: import_chunk_ANV2HBEH.protocol.getPayloadType(message)
144
- }, {
145
- F: __dxlog_file2,
146
- L: 55,
147
- S: this,
148
- C: (f, a) => f(...a)
149
- });
150
- const encoded = import_buf.buf.toBinary(import_messenger_pb.MessageSchema, message);
151
- if (encoded.byteLength >= CLOUDFLARE_MESSAGE_LENGTH_LIMIT) {
152
- import_log2.log.error("edge message dropped due to websocket message limit", {
153
- byteLength: encoded.byteLength,
154
- serviceId: message.serviceId,
155
- payload: import_chunk_ANV2HBEH.protocol.getPayloadType(message)
156
- }, {
157
- F: __dxlog_file2,
158
- L: 58,
159
- S: this,
160
- C: (f, a) => f(...a)
161
- });
162
- return;
163
- }
164
- this._ws.send(encoded);
165
- }
166
- async _open() {
167
- this._ws = new import_isomorphic_ws.default(this._connectionInfo.url.toString(), this._connectionInfo.protocolHeader ? [
168
- this._connectionInfo.protocolHeader
169
- ] : []);
170
- this._ws.onopen = () => {
171
- if (this.isOpen) {
172
- (0, import_log2.log)("connected", void 0, {
173
- F: __dxlog_file2,
174
- L: 76,
175
- S: this,
176
- C: (f, a) => f(...a)
177
- });
178
- this._callbacks.onConnected();
179
- this._scheduleHeartbeats();
180
- } else {
181
- import_log2.log.verbose("connected after becoming inactive", {
182
- currentIdentity: this._identity
183
- }, {
184
- F: __dxlog_file2,
185
- L: 80,
186
- S: this,
187
- C: (f, a) => f(...a)
188
- });
189
- }
190
- };
191
- this._ws.onclose = (event) => {
192
- if (this.isOpen) {
193
- import_log2.log.warn("disconnected while being open", {
194
- code: event.code,
195
- reason: event.reason
196
- }, {
197
- F: __dxlog_file2,
198
- L: 85,
199
- S: this,
200
- C: (f, a) => f(...a)
201
- });
202
- this._callbacks.onRestartRequired();
203
- }
204
- };
205
- this._ws.onerror = (event) => {
206
- if (this.isOpen) {
207
- import_log2.log.warn("edge connection socket error", {
208
- error: event.error,
209
- info: event.message
210
- }, {
211
- F: __dxlog_file2,
212
- L: 91,
213
- S: this,
214
- C: (f, a) => f(...a)
215
- });
216
- this._callbacks.onRestartRequired();
217
- } else {
218
- import_log2.log.verbose("error ignored on closed connection", {
219
- error: event.error
220
- }, {
221
- F: __dxlog_file2,
222
- L: 94,
223
- S: this,
224
- C: (f, a) => f(...a)
225
- });
226
- }
227
- };
228
- this._ws.onmessage = async (event) => {
229
- if (!this.isOpen) {
230
- import_log2.log.verbose("message ignored on closed connection", {
231
- event: event.type
232
- }, {
233
- F: __dxlog_file2,
234
- L: 102,
235
- S: this,
236
- C: (f, a) => f(...a)
237
- });
238
- return;
239
- }
240
- if (event.data === "__pong__") {
241
- this._rescheduleHeartbeatTimeout();
242
- return;
243
- }
244
- const data = await (0, import_chunk_ANV2HBEH.toUint8Array)(event.data);
245
- if (this.isOpen) {
246
- const message = import_buf.buf.fromBinary(import_messenger_pb.MessageSchema, data);
247
- (0, import_log2.log)("received", {
248
- from: message.source,
249
- payload: import_chunk_ANV2HBEH.protocol.getPayloadType(message)
250
- }, {
251
- F: __dxlog_file2,
252
- L: 112,
253
- S: this,
254
- C: (f, a) => f(...a)
255
- });
256
- this._callbacks.onMessage(message);
257
- }
258
- };
259
- }
260
- async _close() {
261
- void this._inactivityTimeoutCtx?.dispose().catch(() => {
262
- });
263
- try {
264
- this._ws?.close();
265
- this._ws = void 0;
266
- } catch (err) {
267
- if (err instanceof Error && err.message.includes("WebSocket is closed before the connection is established.")) {
268
- return;
269
- }
270
- import_log2.log.warn("Error closing websocket", {
271
- err
272
- }, {
273
- F: __dxlog_file2,
274
- L: 128,
275
- S: this,
276
- C: (f, a) => f(...a)
277
- });
278
- }
279
- }
280
- _scheduleHeartbeats() {
281
- (0, import_invariant2.invariant)(this._ws, void 0, {
282
- F: __dxlog_file2,
283
- L: 133,
284
- S: this,
285
- A: [
286
- "this._ws",
287
- ""
288
- ]
289
- });
290
- (0, import_async2.scheduleTaskInterval)(this._ctx, async () => {
291
- this._ws?.send("__ping__");
292
- }, SIGNAL_KEEPALIVE_INTERVAL);
293
- this._ws.send("__ping__");
294
- this._rescheduleHeartbeatTimeout();
295
- }
296
- _rescheduleHeartbeatTimeout() {
297
- if (!this.isOpen) {
298
- return;
299
- }
300
- void this._inactivityTimeoutCtx?.dispose();
301
- this._inactivityTimeoutCtx = new import_context2.Context(void 0, {
302
- F: __dxlog_file2,
303
- L: 152
304
- });
305
- (0, import_async2.scheduleTask)(this._inactivityTimeoutCtx, () => {
306
- if (this.isOpen) {
307
- import_log2.log.warn("restart due to inactivity timeout", void 0, {
308
- F: __dxlog_file2,
309
- L: 157,
310
- S: this,
311
- C: (f, a) => f(...a)
312
- });
313
- this._callbacks.onRestartRequired();
314
- }
315
- }, SIGNAL_KEEPALIVE_TIMEOUT);
316
- }
317
- };
318
- _ts_decorate([
319
- import_log2.logInfo
320
- ], EdgeWsConnection.prototype, "info", null);
321
90
  var EdgeConnectionClosedError = class extends Error {
322
91
  constructor() {
323
92
  super("Edge connection closed.");
@@ -334,13 +103,13 @@ var getEdgeUrlWithProtocol = (baseUrl, protocol2) => {
334
103
  url.protocol = protocol2 + (isSecure ? "s" : "");
335
104
  return url.toString();
336
105
  };
337
- function _ts_decorate2(decorators, target, key, desc) {
106
+ function _ts_decorate(decorators, target, key, desc) {
338
107
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
339
108
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
340
109
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
341
110
  return c > 3 && r && Object.defineProperty(target, key, r), r;
342
111
  }
343
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-client.ts";
112
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-client.ts";
344
113
  var DEFAULT_TIMEOUT = 1e4;
345
114
  var EdgeClient = class extends import_context.Resource {
346
115
  constructor(_identity, _config) {
@@ -383,14 +152,14 @@ var EdgeClient = class extends import_context.Resource {
383
152
  identity,
384
153
  oldIdentity: this._identity
385
154
  }, {
386
- F: __dxlog_file3,
155
+ F: __dxlog_file2,
387
156
  L: 99,
388
157
  S: this,
389
158
  C: (f, a) => f(...a)
390
159
  });
391
160
  this._identity = identity;
392
161
  this._closeCurrentConnection(new EdgeIdentityChangedError());
393
- this._persistentLifecycle.scheduleRestart();
162
+ void this._persistentLifecycle.scheduleRestart();
394
163
  }
395
164
  }
396
165
  onMessage(listener) {
@@ -406,7 +175,7 @@ var EdgeClient = class extends import_context.Resource {
406
175
  listener();
407
176
  } catch (error) {
408
177
  import_log.log.catch(error, void 0, {
409
- F: __dxlog_file3,
178
+ F: __dxlog_file2,
410
179
  L: 121,
411
180
  S: this,
412
181
  C: (f, a) => f(...a)
@@ -424,7 +193,7 @@ var EdgeClient = class extends import_context.Resource {
424
193
  (0, import_log.log)("opening...", {
425
194
  info: this.info
426
195
  }, {
427
- F: __dxlog_file3,
196
+ F: __dxlog_file2,
428
197
  L: 133,
429
198
  S: this,
430
199
  C: (f, a) => f(...a)
@@ -433,7 +202,7 @@ var EdgeClient = class extends import_context.Resource {
433
202
  import_log.log.warn("Error while opening connection", {
434
203
  err
435
204
  }, {
436
- F: __dxlog_file3,
205
+ F: __dxlog_file2,
437
206
  L: 135,
438
207
  S: this,
439
208
  C: (f, a) => f(...a)
@@ -447,7 +216,7 @@ var EdgeClient = class extends import_context.Resource {
447
216
  (0, import_log.log)("closing...", {
448
217
  peerKey: this._identity.peerKey
449
218
  }, {
450
- F: __dxlog_file3,
219
+ F: __dxlog_file2,
451
220
  L: 143,
452
221
  S: this,
453
222
  C: (f, a) => f(...a)
@@ -464,7 +233,7 @@ var EdgeClient = class extends import_context.Resource {
464
233
  const protocolHeader = this._config.disableAuth ? void 0 : await this._createAuthHeader(path);
465
234
  if (this._identity !== identity) {
466
235
  (0, import_log.log)("identity changed during auth header request", void 0, {
467
- F: __dxlog_file3,
236
+ F: __dxlog_file2,
468
237
  L: 157,
469
238
  S: this,
470
239
  C: (f, a) => f(...a)
@@ -477,12 +246,12 @@ var EdgeClient = class extends import_context.Resource {
477
246
  url: url.toString(),
478
247
  protocolHeader
479
248
  }, {
480
- F: __dxlog_file3,
249
+ F: __dxlog_file2,
481
250
  L: 163,
482
251
  S: this,
483
252
  C: (f, a) => f(...a)
484
253
  });
485
- const connection = new EdgeWsConnection(identity, {
254
+ const connection = new import_chunk_ZURVCY7K.EdgeWsConnection(identity, {
486
255
  url,
487
256
  protocolHeader
488
257
  }, {
@@ -492,7 +261,7 @@ var EdgeClient = class extends import_context.Resource {
492
261
  this._notifyReconnected();
493
262
  } else {
494
263
  import_log.log.verbose("connected callback ignored, because connection is not active", void 0, {
495
- F: __dxlog_file3,
264
+ F: __dxlog_file2,
496
265
  L: 173,
497
266
  S: this,
498
267
  C: (f, a) => f(...a)
@@ -502,10 +271,10 @@ var EdgeClient = class extends import_context.Resource {
502
271
  onRestartRequired: () => {
503
272
  if (this._isActive(connection)) {
504
273
  this._closeCurrentConnection();
505
- this._persistentLifecycle.scheduleRestart();
274
+ void this._persistentLifecycle.scheduleRestart();
506
275
  } else {
507
276
  import_log.log.verbose("restart requested by inactive connection", void 0, {
508
- F: __dxlog_file3,
277
+ F: __dxlog_file2,
509
278
  L: 181,
510
279
  S: this,
511
280
  C: (f, a) => f(...a)
@@ -521,7 +290,7 @@ var EdgeClient = class extends import_context.Resource {
521
290
  from: message.source,
522
291
  type: message.payload?.typeUrl
523
292
  }, {
524
- F: __dxlog_file3,
293
+ F: __dxlog_file2,
525
294
  L: 189,
526
295
  S: this,
527
296
  C: (f, a) => f(...a)
@@ -558,7 +327,7 @@ var EdgeClient = class extends import_context.Resource {
558
327
  import_log.log.error("ws reconnect listener failed", {
559
328
  err
560
329
  }, {
561
- F: __dxlog_file3,
330
+ F: __dxlog_file2,
562
331
  L: 225,
563
332
  S: this,
564
333
  C: (f, a) => f(...a)
@@ -573,9 +342,9 @@ var EdgeClient = class extends import_context.Resource {
573
342
  } catch (err) {
574
343
  import_log.log.error("ws incoming message processing failed", {
575
344
  err,
576
- payload: import_chunk_ANV2HBEH.protocol.getPayloadType(message)
345
+ payload: import_chunk_ZURVCY7K.protocol.getPayloadType(message)
577
346
  }, {
578
- F: __dxlog_file3,
347
+ F: __dxlog_file2,
579
348
  L: 235,
580
349
  S: this,
581
350
  C: (f, a) => f(...a)
@@ -590,7 +359,7 @@ var EdgeClient = class extends import_context.Resource {
590
359
  async send(message) {
591
360
  if (this._ready.state !== import_async.TriggerState.RESOLVED) {
592
361
  (0, import_log.log)("waiting for websocket to become ready", void 0, {
593
- F: __dxlog_file3,
362
+ F: __dxlog_file2,
594
363
  L: 246,
595
364
  S: this,
596
365
  C: (f, a) => f(...a)
@@ -620,7 +389,7 @@ var EdgeClient = class extends import_context.Resource {
620
389
  status: response.status,
621
390
  statusText: response.statusText
622
391
  }, {
623
- F: __dxlog_file3,
392
+ F: __dxlog_file2,
624
393
  L: 271,
625
394
  S: this,
626
395
  C: (f, a) => f(...a)
@@ -629,14 +398,14 @@ var EdgeClient = class extends import_context.Resource {
629
398
  }
630
399
  }
631
400
  };
632
- _ts_decorate2([
401
+ _ts_decorate([
633
402
  import_log.logInfo
634
403
  ], EdgeClient.prototype, "info", null);
635
404
  var encodePresentationWsAuthHeader = (encodedPresentation) => {
636
405
  const encodedToken = Buffer.from(encodedPresentation).toString("base64").replace(/=*$/, "").replaceAll("/", "|");
637
406
  return `base64url.bearer.authorization.dxos.org.${encodedToken}`;
638
407
  };
639
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/auth.ts";
408
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/auth.ts";
640
409
  var createDeviceEdgeIdentity = async (signer, key) => {
641
410
  return {
642
411
  identityKey: key.toHex(),
@@ -680,8 +449,8 @@ var createChainEdgeIdentity = async (signer, identityKey, peerKey, chain, creden
680
449
  identityKey: identityKey.toHex(),
681
450
  peerKey: peerKey.toHex(),
682
451
  presentCredentials: async ({ challenge }) => {
683
- (0, import_invariant3.invariant)(chain, void 0, {
684
- F: __dxlog_file4,
452
+ (0, import_invariant2.invariant)(chain, void 0, {
453
+ F: __dxlog_file3,
685
454
  L: 75,
686
455
  S: void 0,
687
456
  A: [
@@ -741,17 +510,17 @@ var createStubEdgeIdentity = () => {
741
510
  }
742
511
  };
743
512
  };
744
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-http-client.ts";
513
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-http-client.ts";
745
514
  var DEFAULT_RETRY_TIMEOUT = 1500;
746
515
  var DEFAULT_RETRY_JITTER = 500;
747
516
  var DEFAULT_MAX_RETRIES_COUNT = 3;
748
517
  var EdgeHttpClient = class {
749
518
  constructor(baseUrl) {
750
519
  this._baseUrl = getEdgeUrlWithProtocol(baseUrl, "http");
751
- (0, import_log3.log)("created", {
520
+ (0, import_log2.log)("created", {
752
521
  url: this._baseUrl
753
522
  }, {
754
- F: __dxlog_file5,
523
+ F: __dxlog_file4,
755
524
  L: 53,
756
525
  S: this,
757
526
  C: (f, a) => f(...a)
@@ -883,8 +652,8 @@ var EdgeHttpClient = class {
883
652
  });
884
653
  }
885
654
  async _call(path, args) {
886
- const requestContext = args.context ?? new import_context3.Context(void 0, {
887
- F: __dxlog_file5,
655
+ const requestContext = args.context ?? new import_context2.Context(void 0, {
656
+ F: __dxlog_file4,
888
657
  L: 192
889
658
  });
890
659
  const shouldRetry = createRetryHandler(args);
@@ -896,12 +665,12 @@ var EdgeHttpClient = class {
896
665
  }
897
666
  url += `?${queryParams.toString()}`;
898
667
  }
899
- (0, import_log3.log)("call", {
668
+ (0, import_log2.log)("call", {
900
669
  method: args.method,
901
670
  path,
902
671
  request: args.body
903
672
  }, {
904
- F: __dxlog_file5,
673
+ F: __dxlog_file4,
905
674
  L: 204,
906
675
  S: this,
907
676
  C: (f, a) => f(...a)
@@ -920,11 +689,11 @@ var EdgeHttpClient = class {
920
689
  if (body.success) {
921
690
  return body.data;
922
691
  }
923
- (0, import_log3.log)("unsuccessful edge response", {
692
+ (0, import_log2.log)("unsuccessful edge response", {
924
693
  path,
925
694
  body
926
695
  }, {
927
- F: __dxlog_file5,
696
+ F: __dxlog_file4,
928
697
  L: 223,
929
698
  S: this,
930
699
  C: (f, a) => f(...a)
@@ -945,11 +714,11 @@ var EdgeHttpClient = class {
945
714
  processingError = import_protocols.EdgeCallFailedError.fromProcessingFailureCause(error);
946
715
  }
947
716
  if (processingError.isRetryable && await shouldRetry(requestContext, retryAfterHeaderValue)) {
948
- (0, import_log3.log)("retrying edge request", {
717
+ (0, import_log2.log)("retrying edge request", {
949
718
  path,
950
719
  processingError
951
720
  }, {
952
- F: __dxlog_file5,
721
+ F: __dxlog_file4,
953
722
  L: 242,
954
723
  S: this,
955
724
  C: (f, a) => f(...a)
@@ -961,8 +730,8 @@ var EdgeHttpClient = class {
961
730
  }
962
731
  async _handleUnauthorized(response) {
963
732
  if (!this._edgeIdentity) {
964
- import_log3.log.warn("edge unauthorized response received before identity was set", void 0, {
965
- F: __dxlog_file5,
733
+ import_log2.log.warn("edge unauthorized response received before identity was set", void 0, {
734
+ F: __dxlog_file4,
966
735
  L: 251,
967
736
  S: this,
968
737
  C: (f, a) => f(...a)
@@ -971,8 +740,8 @@ var EdgeHttpClient = class {
971
740
  }
972
741
  const challenge = await handleAuthChallenge(response, this._edgeIdentity);
973
742
  this._authHeader = encodeAuthHeader(challenge);
974
- (0, import_log3.log)("auth header updated", void 0, {
975
- F: __dxlog_file5,
743
+ (0, import_log2.log)("auth header updated", void 0, {
744
+ F: __dxlog_file4,
976
745
  L: 256,
977
746
  S: this,
978
747
  C: (f, a) => f(...a)
@@ -993,10 +762,10 @@ var createRetryHandler = (args) => {
993
762
  return false;
994
763
  }
995
764
  if (retryAfter) {
996
- await (0, import_async3.sleep)(retryAfter);
765
+ await (0, import_async2.sleep)(retryAfter);
997
766
  } else {
998
767
  const timeout = baseTimeout + Math.random() * jitter;
999
- await (0, import_async3.sleep)(timeout);
768
+ await (0, import_async2.sleep)(timeout);
1000
769
  }
1001
770
  return true;
1002
771
  };