@dxos/edge-client 0.8.4-main.dedc0f3 → 0.8.4-main.ead640a

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.
@@ -124,7 +124,7 @@ var createStubEdgeIdentity = () => {
124
124
  };
125
125
 
126
126
  // src/edge-client.ts
127
- import { Event, PersistentLifecycle, Trigger, TriggerState, scheduleMicroTask } from "@dxos/async";
127
+ import { Event, PersistentLifecycle, Trigger, TriggerState, scheduleMicroTask, scheduleTaskInterval as scheduleTaskInterval2 } from "@dxos/async";
128
128
  import { Resource as Resource2 } from "@dxos/context";
129
129
  import { log as log2, logInfo as logInfo2 } from "@dxos/log";
130
130
  import { EdgeStatus } from "@dxos/protocols/proto/dxos/client/services";
@@ -208,10 +208,28 @@ var EdgeWsConnection = class extends Resource {
208
208
  device: this._identity.peerKey
209
209
  };
210
210
  }
211
+ get rtt() {
212
+ return this._rtt;
213
+ }
214
+ get uptime() {
215
+ return this._openTimestamp ? (Date.now() - this._openTimestamp) / 1e3 : 0;
216
+ }
217
+ get uploadRate() {
218
+ return this._uploadRate;
219
+ }
220
+ get downloadRate() {
221
+ return this._downloadRate;
222
+ }
223
+ get messagesSent() {
224
+ return this._messagesSent;
225
+ }
226
+ get messagesReceived() {
227
+ return this._messagesReceived;
228
+ }
211
229
  send(message) {
212
230
  invariant3(this._ws, void 0, {
213
231
  F: __dxlog_file3,
214
- L: 53,
232
+ L: 93,
215
233
  S: this,
216
234
  A: [
217
235
  "this._ws",
@@ -220,7 +238,7 @@ var EdgeWsConnection = class extends Resource {
220
238
  });
221
239
  invariant3(this._wsMuxer, void 0, {
222
240
  F: __dxlog_file3,
223
- L: 54,
241
+ L: 94,
224
242
  S: this,
225
243
  A: [
226
244
  "this._wsMuxer",
@@ -232,10 +250,11 @@ var EdgeWsConnection = class extends Resource {
232
250
  payload: protocol.getPayloadType(message)
233
251
  }, {
234
252
  F: __dxlog_file3,
235
- L: 55,
253
+ L: 95,
236
254
  S: this,
237
255
  C: (f, a) => f(...a)
238
256
  });
257
+ this._messagesSent++;
239
258
  if (this._ws?.protocol.includes(EdgeWebsocketProtocol.V0)) {
240
259
  const binary = buf.toBinary(MessageSchema, message);
241
260
  if (binary.length > CLOUDFLARE_MESSAGE_MAX_BYTES) {
@@ -245,17 +264,20 @@ var EdgeWsConnection = class extends Resource {
245
264
  payload: protocol.getPayloadType(message)
246
265
  }, {
247
266
  F: __dxlog_file3,
248
- L: 59,
267
+ L: 100,
249
268
  S: this,
250
269
  C: (f, a) => f(...a)
251
270
  });
252
271
  return;
253
272
  }
273
+ this._recordBytes(binary.byteLength, 0);
254
274
  this._ws.send(binary);
255
275
  } else {
276
+ const binary = buf.toBinary(MessageSchema, message);
277
+ this._recordBytes(binary.byteLength, 0);
256
278
  this._wsMuxer.send(message).catch((e) => log.catch(e, void 0, {
257
279
  F: __dxlog_file3,
258
- L: 68,
280
+ L: 113,
259
281
  S: this,
260
282
  C: (f, a) => f(...a)
261
283
  }));
@@ -277,18 +299,20 @@ var EdgeWsConnection = class extends Resource {
277
299
  if (this.isOpen) {
278
300
  log("connected", void 0, {
279
301
  F: __dxlog_file3,
280
- L: 85,
302
+ L: 130,
281
303
  S: this,
282
304
  C: (f, a) => f(...a)
283
305
  });
306
+ this._openTimestamp = Date.now();
284
307
  this._callbacks.onConnected();
285
308
  this._scheduleHeartbeats();
309
+ this._scheduleRateCalculation();
286
310
  } else {
287
311
  log.verbose("connected after becoming inactive", {
288
312
  currentIdentity: this._identity
289
313
  }, {
290
314
  F: __dxlog_file3,
291
- L: 89,
315
+ L: 136,
292
316
  S: this,
293
317
  C: (f, a) => f(...a)
294
318
  });
@@ -296,12 +320,12 @@ var EdgeWsConnection = class extends Resource {
296
320
  };
297
321
  this._ws.onclose = (event) => {
298
322
  if (this.isOpen) {
299
- log.warn("disconnected while being open", {
323
+ log.warn("server disconnected", {
300
324
  code: event.code,
301
325
  reason: event.reason
302
326
  }, {
303
327
  F: __dxlog_file3,
304
- L: 94,
328
+ L: 141,
305
329
  S: this,
306
330
  C: (f, a) => f(...a)
307
331
  });
@@ -316,7 +340,7 @@ var EdgeWsConnection = class extends Resource {
316
340
  info: event.message
317
341
  }, {
318
342
  F: __dxlog_file3,
319
- L: 101,
343
+ L: 148,
320
344
  S: this,
321
345
  C: (f, a) => f(...a)
322
346
  });
@@ -326,7 +350,7 @@ var EdgeWsConnection = class extends Resource {
326
350
  error: event.error
327
351
  }, {
328
352
  F: __dxlog_file3,
329
- L: 104,
353
+ L: 151,
330
354
  S: this,
331
355
  C: (f, a) => f(...a)
332
356
  });
@@ -338,7 +362,7 @@ var EdgeWsConnection = class extends Resource {
338
362
  event: event.type
339
363
  }, {
340
364
  F: __dxlog_file3,
341
- L: 112,
365
+ L: 159,
342
366
  S: this,
343
367
  C: (f, a) => f(...a)
344
368
  });
@@ -346,13 +370,19 @@ var EdgeWsConnection = class extends Resource {
346
370
  }
347
371
  this._lastReceivedMessageTimestamp = Date.now();
348
372
  if (event.data === "__pong__") {
373
+ if (this._pingTimestamp) {
374
+ this._rtt = Date.now() - this._pingTimestamp;
375
+ this._pingTimestamp = void 0;
376
+ }
349
377
  this._rescheduleHeartbeatTimeout();
350
378
  return;
351
379
  }
352
380
  const bytes = await toUint8Array(event.data);
381
+ this._recordBytes(0, bytes.byteLength);
353
382
  if (!this.isOpen) {
354
383
  return;
355
384
  }
385
+ this._messagesReceived++;
356
386
  const message = this._ws?.protocol?.includes(EdgeWebsocketProtocol.V0) ? buf.fromBinary(MessageSchema, bytes) : muxer.receiveData(bytes);
357
387
  if (message) {
358
388
  log("received", {
@@ -360,7 +390,7 @@ var EdgeWsConnection = class extends Resource {
360
390
  payload: protocol.getPayloadType(message)
361
391
  }, {
362
392
  F: __dxlog_file3,
363
- L: 130,
393
+ L: 185,
364
394
  S: this,
365
395
  C: (f, a) => f(...a)
366
396
  });
@@ -380,11 +410,11 @@ var EdgeWsConnection = class extends Resource {
380
410
  if (err instanceof Error && err.message.includes("WebSocket is closed before the connection is established.")) {
381
411
  return;
382
412
  }
383
- log.warn("Error closing websocket", {
413
+ log.warn("error closing websocket", {
384
414
  err
385
415
  }, {
386
416
  F: __dxlog_file3,
387
- L: 148,
417
+ L: 203,
388
418
  S: this,
389
419
  C: (f, a) => f(...a)
390
420
  });
@@ -393,7 +423,7 @@ var EdgeWsConnection = class extends Resource {
393
423
  _scheduleHeartbeats() {
394
424
  invariant3(this._ws, void 0, {
395
425
  F: __dxlog_file3,
396
- L: 153,
426
+ L: 208,
397
427
  S: this,
398
428
  A: [
399
429
  "this._ws",
@@ -401,8 +431,10 @@ var EdgeWsConnection = class extends Resource {
401
431
  ]
402
432
  });
403
433
  scheduleTaskInterval(this._ctx, async () => {
434
+ this._pingTimestamp = Date.now();
404
435
  this._ws?.send("__ping__");
405
436
  }, SIGNAL_KEEPALIVE_INTERVAL);
437
+ this._pingTimestamp = Date.now();
406
438
  this._ws.send("__ping__");
407
439
  this._rescheduleHeartbeatTimeout();
408
440
  }
@@ -413,7 +445,7 @@ var EdgeWsConnection = class extends Resource {
413
445
  void this._inactivityTimeoutCtx?.dispose();
414
446
  this._inactivityTimeoutCtx = new Context(void 0, {
415
447
  F: __dxlog_file3,
416
- L: 172
448
+ L: 229
417
449
  });
418
450
  scheduleTask(this._inactivityTimeoutCtx, () => {
419
451
  if (this.isOpen) {
@@ -422,7 +454,7 @@ var EdgeWsConnection = class extends Resource {
422
454
  lastReceivedMessageTimestamp: this._lastReceivedMessageTimestamp
423
455
  }, {
424
456
  F: __dxlog_file3,
425
- L: 178,
457
+ L: 235,
426
458
  S: this,
427
459
  C: (f, a) => f(...a)
428
460
  });
@@ -433,8 +465,61 @@ var EdgeWsConnection = class extends Resource {
433
465
  }
434
466
  }, SIGNAL_KEEPALIVE_TIMEOUT);
435
467
  }
468
+ _recordBytes(sent, received) {
469
+ const now = Date.now();
470
+ const currentSecond = Math.floor(now / 1e3) * 1e3;
471
+ const existingSample = this._bytesSamples.find((s) => Math.floor(s.timestamp / 1e3) * 1e3 === currentSecond);
472
+ if (existingSample) {
473
+ existingSample.sent += sent;
474
+ existingSample.received += received;
475
+ } else {
476
+ this._bytesSamples.push({
477
+ timestamp: now,
478
+ sent,
479
+ received
480
+ });
481
+ }
482
+ }
483
+ _scheduleRateCalculation() {
484
+ scheduleTaskInterval(this._ctx, async () => {
485
+ this._calculateRates();
486
+ }, this._rateUpdateInterval);
487
+ this._calculateRates();
488
+ }
489
+ _calculateRates() {
490
+ const now = Date.now();
491
+ const cutoff = now - this._rateWindow;
492
+ this._bytesSamples = this._bytesSamples.filter((s) => s.timestamp > cutoff);
493
+ if (this._bytesSamples.length === 0) {
494
+ this._uploadRate = 0;
495
+ this._downloadRate = 0;
496
+ return;
497
+ }
498
+ let totalSent = 0;
499
+ let totalReceived = 0;
500
+ const oldestTimestamp = Math.min(...this._bytesSamples.map((s) => s.timestamp));
501
+ const timeSpan = (now - oldestTimestamp) / 1e3;
502
+ for (const sample of this._bytesSamples) {
503
+ totalSent += sample.sent;
504
+ totalReceived += sample.received;
505
+ }
506
+ this._uploadRate = timeSpan > 0 ? Math.round(totalSent / timeSpan) : 0;
507
+ this._downloadRate = timeSpan > 0 ? Math.round(totalReceived / timeSpan) : 0;
508
+ }
436
509
  constructor(_identity, _connectionInfo, _callbacks) {
437
- super(), _define_property(this, "_identity", void 0), _define_property(this, "_connectionInfo", void 0), _define_property(this, "_callbacks", void 0), _define_property(this, "_inactivityTimeoutCtx", void 0), _define_property(this, "_ws", void 0), _define_property(this, "_wsMuxer", void 0), _define_property(this, "_lastReceivedMessageTimestamp", void 0), this._identity = _identity, this._connectionInfo = _connectionInfo, this._callbacks = _callbacks, this._lastReceivedMessageTimestamp = Date.now();
510
+ super(), _define_property(this, "_identity", void 0), _define_property(this, "_connectionInfo", void 0), _define_property(this, "_callbacks", void 0), _define_property(this, "_inactivityTimeoutCtx", void 0), _define_property(this, "_ws", void 0), _define_property(this, "_wsMuxer", void 0), _define_property(this, "_lastReceivedMessageTimestamp", void 0), _define_property(this, "_openTimestamp", void 0), // Latency tracking.
511
+ _define_property(this, "_pingTimestamp", void 0), _define_property(this, "_rtt", void 0), // Rate tracking with sliding window.
512
+ _define_property(this, "_uploadRate", void 0), _define_property(this, "_downloadRate", void 0), _define_property(
513
+ this,
514
+ "_rateWindow",
515
+ void 0
516
+ // 10 second sliding window.
517
+ ), _define_property(
518
+ this,
519
+ "_rateUpdateInterval",
520
+ void 0
521
+ // Update rates every second.
522
+ ), _define_property(this, "_bytesSamples", void 0), _define_property(this, "_messagesSent", void 0), _define_property(this, "_messagesReceived", void 0), this._identity = _identity, this._connectionInfo = _connectionInfo, this._callbacks = _callbacks, this._lastReceivedMessageTimestamp = Date.now(), this._rtt = 0, this._uploadRate = 0, this._downloadRate = 0, this._rateWindow = 1e4, this._rateUpdateInterval = 1e3, this._bytesSamples = [], this._messagesSent = 0, this._messagesReceived = 0;
438
523
  }
439
524
  };
440
525
  _ts_decorate([
@@ -483,6 +568,7 @@ function _ts_decorate2(decorators, target, key, desc) {
483
568
  }
484
569
  var __dxlog_file4 = "/__w/dxos/dxos/packages/core/mesh/edge-client/src/edge-client.ts";
485
570
  var DEFAULT_TIMEOUT = 1e4;
571
+ var STATUS_REFRESH_INTERVAL = 1e3;
486
572
  var EdgeClient = class extends Resource2 {
487
573
  get info() {
488
574
  return {
@@ -493,7 +579,15 @@ var EdgeClient = class extends Resource2 {
493
579
  };
494
580
  }
495
581
  get status() {
496
- return Boolean(this._currentConnection) && this._ready.state === TriggerState.RESOLVED ? EdgeStatus.CONNECTED : EdgeStatus.NOT_CONNECTED;
582
+ return {
583
+ state: Boolean(this._currentConnection) && this._ready.state === TriggerState.RESOLVED ? EdgeStatus.ConnectionState.CONNECTED : EdgeStatus.ConnectionState.NOT_CONNECTED,
584
+ uptime: this._currentConnection?.uptime ?? 0,
585
+ rtt: this._currentConnection?.rtt ?? 0,
586
+ rateBytesUp: this._currentConnection?.uploadRate ?? 0,
587
+ rateBytesDown: this._currentConnection?.downloadRate ?? 0,
588
+ messagesSent: this._currentConnection?.messagesSent ?? 0,
589
+ messagesReceived: this._currentConnection?.messagesReceived ?? 0
590
+ };
497
591
  }
498
592
  get identityKey() {
499
593
  return this._identity.identityKey;
@@ -508,7 +602,7 @@ var EdgeClient = class extends Resource2 {
508
602
  oldIdentity: this._identity
509
603
  }, {
510
604
  F: __dxlog_file4,
511
- L: 99,
605
+ L: 118,
512
606
  S: this,
513
607
  C: (f, a) => f(...a)
514
608
  });
@@ -525,7 +619,7 @@ var EdgeClient = class extends Resource2 {
525
619
  if (this._ready.state !== TriggerState.RESOLVED) {
526
620
  log2("waiting for websocket", void 0, {
527
621
  F: __dxlog_file4,
528
- L: 112,
622
+ L: 131,
529
623
  S: this,
530
624
  C: (f, a) => f(...a)
531
625
  });
@@ -555,7 +649,7 @@ var EdgeClient = class extends Resource2 {
555
649
  } catch (error) {
556
650
  log2.catch(error, void 0, {
557
651
  F: __dxlog_file4,
558
- L: 145,
652
+ L: 164,
559
653
  S: this,
560
654
  C: (f, a) => f(...a)
561
655
  });
@@ -573,7 +667,7 @@ var EdgeClient = class extends Resource2 {
573
667
  info: this.info
574
668
  }, {
575
669
  F: __dxlog_file4,
576
- L: 158,
670
+ L: 177,
577
671
  S: this,
578
672
  C: (f, a) => f(...a)
579
673
  });
@@ -582,11 +676,17 @@ var EdgeClient = class extends Resource2 {
582
676
  err
583
677
  }, {
584
678
  F: __dxlog_file4,
585
- L: 160,
679
+ L: 179,
586
680
  S: this,
587
681
  C: (f, a) => f(...a)
588
682
  });
589
683
  });
684
+ scheduleTaskInterval2(this._ctx, async () => {
685
+ if (!this._currentConnection) {
686
+ return;
687
+ }
688
+ this.statusChanged.emit(this.status);
689
+ }, STATUS_REFRESH_INTERVAL);
590
690
  }
591
691
  /**
592
692
  * Close connection and free resources.
@@ -596,7 +696,7 @@ var EdgeClient = class extends Resource2 {
596
696
  peerKey: this._identity.peerKey
597
697
  }, {
598
698
  F: __dxlog_file4,
599
- L: 168,
699
+ L: 199,
600
700
  S: this,
601
701
  C: (f, a) => f(...a)
602
702
  });
@@ -613,7 +713,7 @@ var EdgeClient = class extends Resource2 {
613
713
  if (this._identity !== identity) {
614
714
  log2("identity changed during auth header request", void 0, {
615
715
  F: __dxlog_file4,
616
- L: 182,
716
+ L: 213,
617
717
  S: this,
618
718
  C: (f, a) => f(...a)
619
719
  });
@@ -626,7 +726,7 @@ var EdgeClient = class extends Resource2 {
626
726
  protocolHeader
627
727
  }, {
628
728
  F: __dxlog_file4,
629
- L: 188,
729
+ L: 219,
630
730
  S: this,
631
731
  C: (f, a) => f(...a)
632
732
  });
@@ -641,7 +741,7 @@ var EdgeClient = class extends Resource2 {
641
741
  } else {
642
742
  log2.verbose("connected callback ignored, because connection is not active", void 0, {
643
743
  F: __dxlog_file4,
644
- L: 198,
744
+ L: 229,
645
745
  S: this,
646
746
  C: (f, a) => f(...a)
647
747
  });
@@ -654,7 +754,7 @@ var EdgeClient = class extends Resource2 {
654
754
  } else {
655
755
  log2.verbose("restart requested by inactive connection", void 0, {
656
756
  F: __dxlog_file4,
657
- L: 206,
757
+ L: 237,
658
758
  S: this,
659
759
  C: (f, a) => f(...a)
660
760
  });
@@ -670,7 +770,7 @@ var EdgeClient = class extends Resource2 {
670
770
  type: message.payload?.typeUrl
671
771
  }, {
672
772
  F: __dxlog_file4,
673
- L: 214,
773
+ L: 245,
674
774
  S: this,
675
775
  C: (f, a) => f(...a)
676
776
  });
@@ -707,7 +807,7 @@ var EdgeClient = class extends Resource2 {
707
807
  err
708
808
  }, {
709
809
  F: __dxlog_file4,
710
- L: 249,
810
+ L: 280,
711
811
  S: this,
712
812
  C: (f, a) => f(...a)
713
813
  });
@@ -724,7 +824,7 @@ var EdgeClient = class extends Resource2 {
724
824
  payload: protocol.getPayloadType(message)
725
825
  }, {
726
826
  F: __dxlog_file4,
727
- L: 259,
827
+ L: 290,
728
828
  S: this,
729
829
  C: (f, a) => f(...a)
730
830
  });
@@ -745,7 +845,7 @@ var EdgeClient = class extends Resource2 {
745
845
  statusText: response.statusText
746
846
  }, {
747
847
  F: __dxlog_file4,
748
- L: 271,
848
+ L: 302,
749
849
  S: this,
750
850
  C: (f, a) => f(...a)
751
851
  });
@@ -770,8 +870,10 @@ var encodePresentationWsAuthHeader = (encodedPresentation) => {
770
870
  };
771
871
 
772
872
  // src/edge-http-client.ts
773
- import { FetchHttpClient, HttpClient } from "@effect/platform";
774
- import { Effect as Effect2, pipe } from "effect";
873
+ import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
874
+ import * as HttpClient from "@effect/platform/HttpClient";
875
+ import * as Effect2 from "effect/Effect";
876
+ import * as Function from "effect/Function";
775
877
  import { sleep } from "@dxos/async";
776
878
  import { Context as Context3 } from "@dxos/context";
777
879
  import { log as log4 } from "@dxos/log";
@@ -779,7 +881,11 @@ import { EdgeAuthChallengeError, EdgeCallFailedError } from "@dxos/protocols";
779
881
  import { createUrl } from "@dxos/util";
780
882
 
781
883
  // src/http-client.ts
782
- import { Context as Context2, Duration, Effect, Layer, Schedule } from "effect";
884
+ import * as Context2 from "effect/Context";
885
+ import * as Duration from "effect/Duration";
886
+ import * as Effect from "effect/Effect";
887
+ import * as Layer from "effect/Layer";
888
+ import * as Schedule from "effect/Schedule";
783
889
  import { log as log3 } from "@dxos/log";
784
890
  function _define_property3(obj, key, value) {
785
891
  if (key in obj) {
@@ -803,11 +909,11 @@ _define_property3(HttpConfig, "default", Layer.succeed(HttpConfig, {
803
909
  retryTimes: 3,
804
910
  retryBaseDelay: Duration.millis(1e3)
805
911
  }));
806
- var withRetry = (effect, { timeout = Duration.millis(1e3), retryBaseDelay = Duration.millis(1e3), retryTimes = 3 } = {}) => {
912
+ var withRetry = (effect, { timeout: timeout2 = Duration.millis(1e3), retryBaseDelay = Duration.millis(1e3), retryTimes = 3 } = {}) => {
807
913
  return effect.pipe(Effect.flatMap((res) => (
808
914
  // Treat 500 errors as retryable?
809
915
  res.status === 500 ? Effect.fail(new Error(res.status.toString())) : res.json
810
- )), Effect.timeout(timeout), Effect.retry({
916
+ )), Effect.timeout(timeout2), Effect.retry({
811
917
  schedule: Schedule.exponential(retryBaseDelay).pipe(Schedule.jittered),
812
918
  times: retryTimes
813
919
  }));
@@ -820,7 +926,7 @@ var withLogging = (effect) => effect.pipe(Effect.tap((res) => log3.info("respons
820
926
  status: res.status
821
927
  }, {
822
928
  F: __dxlog_file5,
823
- L: 58,
929
+ L: 64,
824
930
  S: void 0,
825
931
  C: (f, a) => f(...a)
826
932
  })));
@@ -1067,21 +1173,21 @@ var EdgeHttpClient = class {
1067
1173
  // Internal
1068
1174
  //
1069
1175
  async _fetch(url, args) {
1070
- return pipe(HttpClient.get(url), withLogging, withRetryConfig, Effect2.provide(FetchHttpClient.layer), Effect2.provide(HttpConfig.default), Effect2.withSpan("EdgeHttpClient"), Effect2.runPromise);
1176
+ return Function.pipe(HttpClient.get(url), withLogging, withRetryConfig, Effect2.provide(FetchHttpClient.layer), Effect2.provide(HttpConfig.default), Effect2.withSpan("EdgeHttpClient"), Effect2.runPromise);
1071
1177
  }
1072
1178
  // TODO(burdon): Refactor with effect (see edge-http-client.test.ts).
1073
1179
  async _call(url, args) {
1074
1180
  const shouldRetry = createRetryHandler(args);
1075
1181
  const requestContext = args.context ?? new Context3(void 0, {
1076
1182
  F: __dxlog_file6,
1077
- L: 389
1183
+ L: 391
1078
1184
  });
1079
1185
  log4("fetch", {
1080
1186
  url,
1081
1187
  request: args.body
1082
1188
  }, {
1083
1189
  F: __dxlog_file6,
1084
- L: 390,
1190
+ L: 392,
1085
1191
  S: this,
1086
1192
  C: (f, a) => f(...a)
1087
1193
  });
@@ -1109,7 +1215,7 @@ var EdgeHttpClient = class {
1109
1215
  body
1110
1216
  }, {
1111
1217
  F: __dxlog_file6,
1112
- L: 415,
1218
+ L: 417,
1113
1219
  S: this,
1114
1220
  C: (f, a) => f(...a)
1115
1221
  });
@@ -1134,7 +1240,7 @@ var EdgeHttpClient = class {
1134
1240
  processingError
1135
1241
  }, {
1136
1242
  F: __dxlog_file6,
1137
- L: 433,
1243
+ L: 435,
1138
1244
  S: this,
1139
1245
  C: (f, a) => f(...a)
1140
1246
  });
@@ -1147,7 +1253,7 @@ var EdgeHttpClient = class {
1147
1253
  if (!this._edgeIdentity) {
1148
1254
  log4.warn("unauthorized response received before identity was set", void 0, {
1149
1255
  F: __dxlog_file6,
1150
- L: 442,
1256
+ L: 444,
1151
1257
  S: this,
1152
1258
  C: (f, a) => f(...a)
1153
1259
  });
@@ -1165,7 +1271,7 @@ var EdgeHttpClient = class {
1165
1271
  url: this._baseUrl
1166
1272
  }, {
1167
1273
  F: __dxlog_file6,
1168
- L: 97,
1274
+ L: 99,
1169
1275
  S: this,
1170
1276
  C: (f, a) => f(...a)
1171
1277
  });
@@ -1185,7 +1291,7 @@ var createRequest = ({ method, body, json = true }, authHeader) => {
1185
1291
  bodySize: requestBody.length
1186
1292
  }, {
1187
1293
  F: __dxlog_file6,
1188
- L: 466,
1294
+ L: 468,
1189
1295
  S: void 0,
1190
1296
  C: (f, a) => f(...a)
1191
1297
  });
@@ -1199,14 +1305,14 @@ var createRequest = ({ method, body, json = true }, authHeader) => {
1199
1305
  headers
1200
1306
  };
1201
1307
  };
1202
- var createRetryHandler = ({ retry }) => {
1203
- if (!retry || retry.count < 1) {
1308
+ var createRetryHandler = ({ retry: retry2 }) => {
1309
+ if (!retry2 || retry2.count < 1) {
1204
1310
  return async () => false;
1205
1311
  }
1206
1312
  let retries = 0;
1207
- const maxRetries = retry.count ?? DEFAULT_MAX_RETRIES_COUNT;
1208
- const baseTimeout = retry.timeout ?? DEFAULT_RETRY_TIMEOUT;
1209
- const jitter = retry.jitter ?? DEFAULT_RETRY_JITTER;
1313
+ const maxRetries = retry2.count ?? DEFAULT_MAX_RETRIES_COUNT;
1314
+ const baseTimeout = retry2.timeout ?? DEFAULT_RETRY_TIMEOUT;
1315
+ const jitter = retry2.jitter ?? DEFAULT_RETRY_JITTER;
1210
1316
  return async (ctx, retryAfter) => {
1211
1317
  if (++retries > maxRetries || ctx.disposed) {
1212
1318
  return false;
@@ -1214,8 +1320,8 @@ var createRetryHandler = ({ retry }) => {
1214
1320
  if (retryAfter) {
1215
1321
  await sleep(retryAfter);
1216
1322
  } else {
1217
- const timeout = baseTimeout + Math.random() * jitter;
1218
- await sleep(timeout);
1323
+ const timeout2 = baseTimeout + Math.random() * jitter;
1324
+ await sleep(timeout2);
1219
1325
  }
1220
1326
  return true;
1221
1327
  };