@dxos/network-manager 0.1.53-main.55faa2f → 0.1.53-main.5bcfb84

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.
@@ -67,7 +67,7 @@ var import_errors = require("@dxos/errors");
67
67
  var import_keys = require("@dxos/keys");
68
68
  var import_log = require("@dxos/log");
69
69
  var import_protocols = require("@dxos/protocols");
70
- var __decorate = function(decorators, target, key, desc) {
70
+ function _ts_decorate(decorators, target, key, desc) {
71
71
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
72
72
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
73
73
  r = Reflect.decorate(decorators, target, key, desc);
@@ -76,7 +76,8 @@ var __decorate = function(decorators, target, key, desc) {
76
76
  if (d = decorators[i])
77
77
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
78
78
  return c > 3 && r && Object.defineProperty(target, key, r), r;
79
- };
79
+ }
80
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection.ts";
80
81
  var STARTING_SIGNALLING_DELAY = 10;
81
82
  var MAX_SIGNALLING_DELAY = 300;
82
83
  var ConnectionState;
@@ -153,21 +154,21 @@ var Connection = class {
153
154
  import_log.log.trace("dxos.mesh.connection.open-connection", import_protocols.trace.begin({
154
155
  id: this._instanceId
155
156
  }), {
156
- file: "connection.ts",
157
- line: 115,
158
- scope: this,
159
- callSite: (f, a) => f(...a)
157
+ F: __dxlog_file,
158
+ L: 115,
159
+ S: this,
160
+ C: (f, a) => f(...a)
160
161
  });
161
162
  this._changeState(ConnectionState.CONNECTING);
162
163
  this._protocol.initialize().catch((err) => {
163
164
  this.errors.raise(err);
164
165
  });
165
166
  this._protocol.stream.on("close", () => {
166
- (0, import_log.log)("protocol stream closed", {}, {
167
- file: "connection.ts",
168
- line: 126,
169
- scope: this,
170
- callSite: (f, a) => f(...a)
167
+ (0, import_log.log)("protocol stream closed", void 0, {
168
+ F: __dxlog_file,
169
+ L: 126,
170
+ S: this,
171
+ C: (f, a) => f(...a)
171
172
  });
172
173
  this.close().catch((err) => this.errors.raise(err));
173
174
  });
@@ -196,10 +197,10 @@ var Connection = class {
196
197
  import_log.log.trace("dxos.mesh.connection.open-connection", import_protocols.trace.end({
197
198
  id: this._instanceId
198
199
  }), {
199
- file: "connection.ts",
200
- line: 159,
201
- scope: this,
202
- callSite: (f, a) => f(...a)
200
+ F: __dxlog_file,
201
+ L: 159,
202
+ S: this,
203
+ C: (f, a) => f(...a)
203
204
  });
204
205
  }
205
206
  async close() {
@@ -212,38 +213,38 @@ var Connection = class {
212
213
  (0, import_log.log)("closing...", {
213
214
  peerId: this.ownId
214
215
  }, {
215
- file: "connection.ts",
216
- line: 171,
217
- scope: this,
218
- callSite: (f, a) => f(...a)
216
+ F: __dxlog_file,
217
+ L: 171,
218
+ S: this,
219
+ C: (f, a) => f(...a)
219
220
  });
220
221
  try {
221
222
  await this._protocol.destroy();
222
223
  } catch (err) {
223
- import_log.log.catch(err, {}, {
224
- file: "connection.ts",
225
- line: 177,
226
- scope: this,
227
- callSite: (f, a) => f(...a)
224
+ import_log.log.catch(err, void 0, {
225
+ F: __dxlog_file,
226
+ L: 177,
227
+ S: this,
228
+ C: (f, a) => f(...a)
228
229
  });
229
230
  }
230
231
  try {
231
232
  await ((_a = this._transport) == null ? void 0 : _a.destroy());
232
- } catch (err1) {
233
- import_log.log.catch(err1, {}, {
234
- file: "connection.ts",
235
- line: 184,
236
- scope: this,
237
- callSite: (f, a) => f(...a)
233
+ } catch (err) {
234
+ import_log.log.catch(err, void 0, {
235
+ F: __dxlog_file,
236
+ L: 184,
237
+ S: this,
238
+ C: (f, a) => f(...a)
238
239
  });
239
240
  }
240
241
  (0, import_log.log)("closed", {
241
242
  peerId: this.ownId
242
243
  }, {
243
- file: "connection.ts",
244
- line: 187,
245
- scope: this,
246
- callSite: (f, a) => f(...a)
244
+ F: __dxlog_file,
245
+ L: 187,
246
+ S: this,
247
+ C: (f, a) => f(...a)
247
248
  });
248
249
  this._changeState(ConnectionState.CLOSED);
249
250
  }
@@ -280,10 +281,10 @@ var Connection = class {
280
281
  import_log.log.warn("Signal failed", {
281
282
  err
282
283
  }, {
283
- file: "connection.ts",
284
- line: 221,
285
- scope: this,
286
- callSite: (f, a) => f(...a)
284
+ F: __dxlog_file,
285
+ L: 221,
286
+ S: this,
287
+ C: (f, a) => f(...a)
287
288
  });
288
289
  await this.close();
289
290
  }
@@ -295,11 +296,11 @@ var Connection = class {
295
296
  var _a, _b, _c;
296
297
  (0, import_tiny_invariant.default)(msg.sessionId);
297
298
  if (!msg.sessionId.equals(this.sessionId)) {
298
- (0, import_log.log)("dropping signal for incorrect session id", {}, {
299
- file: "connection.ts",
300
- line: 232,
301
- scope: this,
302
- callSite: (f, a) => f(...a)
299
+ (0, import_log.log)("dropping signal for incorrect session id", void 0, {
300
+ F: __dxlog_file,
301
+ L: 232,
302
+ S: this,
303
+ C: (f, a) => f(...a)
303
304
  });
304
305
  return;
305
306
  }
@@ -319,10 +320,10 @@ var Connection = class {
319
320
  remoteId: this.remoteId,
320
321
  msg: msg.data
321
322
  }, {
322
- file: "connection.ts",
323
- line: 246,
324
- scope: this,
325
- callSite: (f, a) => f(...a)
323
+ F: __dxlog_file,
324
+ L: 246,
325
+ S: this,
326
+ C: (f, a) => f(...a)
326
327
  });
327
328
  this._incomingSignalBuffer.push(signal);
328
329
  } else {
@@ -332,10 +333,10 @@ var Connection = class {
332
333
  remoteId: this.remoteId,
333
334
  msg: msg.data
334
335
  }, {
335
- file: "connection.ts",
336
- line: 250,
337
- scope: this,
338
- callSite: (f, a) => f(...a)
336
+ F: __dxlog_file,
337
+ L: 250,
338
+ S: this,
339
+ C: (f, a) => f(...a)
339
340
  });
340
341
  await this._transport.signal(signal);
341
342
  }
@@ -347,17 +348,17 @@ var Connection = class {
347
348
  too: state,
348
349
  peerId: this.ownId
349
350
  }, {
350
- file: "connection.ts",
351
- line: 257,
352
- scope: this,
353
- callSite: (f, a) => f(...a)
351
+ F: __dxlog_file,
352
+ L: 257,
353
+ S: this,
354
+ C: (f, a) => f(...a)
354
355
  });
355
356
  (0, import_tiny_invariant.default)(state !== this._state, "Already in this state.");
356
357
  this._state = state;
357
358
  this.stateChanged.emit(state);
358
359
  }
359
360
  };
360
- __decorate([
361
+ _ts_decorate([
361
362
  import_async.synchronized
362
363
  ], Connection.prototype, "close", null);
363
364
 
@@ -378,6 +379,7 @@ var import_keys2 = require("@dxos/keys");
378
379
  var import_log2 = require("@dxos/log");
379
380
  var import_protocols2 = require("@dxos/protocols");
380
381
  var import_util = require("@dxos/util");
382
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/signal/swarm-messenger.ts";
381
383
  var SwarmMessenger = class {
382
384
  constructor({ sendMessage, onSignal, onOffer, topic }) {
383
385
  this._ctx = new import_context2.Context();
@@ -401,10 +403,10 @@ var SwarmMessenger = class {
401
403
  to: recipient,
402
404
  msg: message
403
405
  }, {
404
- file: "swarm-messenger.ts",
405
- line: 68,
406
- scope: this,
407
- callSite: (f, a) => f(...a)
406
+ F: __dxlog_file2,
407
+ L: 68,
408
+ S: this,
409
+ C: (f, a) => f(...a)
408
410
  });
409
411
  if ((_a = message.data) == null ? void 0 : _a.offer) {
410
412
  await this._handleOffer({
@@ -430,10 +432,10 @@ var SwarmMessenger = class {
430
432
  import_log2.log.warn("unknown message", {
431
433
  message
432
434
  }, {
433
- file: "swarm-messenger.ts",
434
- line: 79,
435
- scope: this,
436
- callSite: (f, a) => f(...a)
435
+ F: __dxlog_file2,
436
+ L: 79,
437
+ S: this,
438
+ C: (f, a) => f(...a)
437
439
  });
438
440
  }
439
441
  }
@@ -474,10 +476,10 @@ var SwarmMessenger = class {
474
476
  to: recipient,
475
477
  msg: networkMessage
476
478
  }, {
477
- file: "swarm-messenger.ts",
478
- line: 122,
479
- scope: this,
480
- callSite: (f, a) => f(...a)
479
+ F: __dxlog_file2,
480
+ L: 122,
481
+ S: this,
482
+ C: (f, a) => f(...a)
481
483
  });
482
484
  await this._sendMessage({
483
485
  author,
@@ -498,10 +500,10 @@ var SwarmMessenger = class {
498
500
  (0, import_log2.log)("resolving", {
499
501
  answer: message.data.answer
500
502
  }, {
501
- file: "swarm-messenger.ts",
502
- line: 139,
503
- scope: this,
504
- callSite: (f, a) => f(...a)
503
+ F: __dxlog_file2,
504
+ L: 139,
505
+ S: this,
506
+ C: (f, a) => f(...a)
505
507
  });
506
508
  offerRecord.resolve(message.data.answer);
507
509
  }
@@ -534,10 +536,10 @@ var SwarmMessenger = class {
534
536
  import_log2.log.warn("error sending answer", {
535
537
  err
536
538
  }, {
537
- file: "swarm-messenger.ts",
538
- line: 173,
539
- scope: this,
540
- callSite: (f, a) => f(...a)
539
+ F: __dxlog_file2,
540
+ L: 173,
541
+ S: this,
542
+ C: (f, a) => f(...a)
541
543
  });
542
544
  }
543
545
  }
@@ -563,7 +565,7 @@ var import_async2 = require("@dxos/async");
563
565
  var import_context3 = require("@dxos/context");
564
566
  var import_keys3 = require("@dxos/keys");
565
567
  var import_log3 = require("@dxos/log");
566
- var __decorate2 = function(decorators, target, key, desc) {
568
+ function _ts_decorate2(decorators, target, key, desc) {
567
569
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
568
570
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
569
571
  r = Reflect.decorate(decorators, target, key, desc);
@@ -572,7 +574,8 @@ var __decorate2 = function(decorators, target, key, desc) {
572
574
  if (d = decorators[i])
573
575
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
574
576
  return c > 3 && r && Object.defineProperty(target, key, r), r;
575
- };
577
+ }
578
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts";
576
579
  var CONNECTION_COUNTS_STABLE_AFTER = 5e3;
577
580
  var Peer = class {
578
581
  constructor(id, topic, localPeerId, _signalMessaging, _protocolProvider, _transportFactory, _callbacks) {
@@ -601,10 +604,10 @@ var Peer = class {
601
604
  topic: this.topic,
602
605
  peerId: this.localPeerId
603
606
  }, {
604
- file: "peer.ts",
605
- line: 105,
606
- scope: this,
607
- callSite: (f, a) => f(...a)
607
+ F: __dxlog_file3,
608
+ L: 105,
609
+ S: this,
610
+ C: (f, a) => f(...a)
608
611
  });
609
612
  if (this.connection) {
610
613
  await this.closeConnection();
@@ -628,10 +631,10 @@ var Peer = class {
628
631
  remoteId: this.id,
629
632
  err
630
633
  }, {
631
- file: "peer.ts",
632
- line: 129,
633
- scope: this,
634
- callSite: (f, a) => f(...a)
634
+ F: __dxlog_file3,
635
+ L: 129,
636
+ S: this,
637
+ C: (f, a) => f(...a)
635
638
  });
636
639
  await this.closeConnection();
637
640
  }
@@ -657,10 +660,10 @@ var Peer = class {
657
660
  peerId: this.id,
658
661
  sessionId
659
662
  }, {
660
- file: "peer.ts",
661
- line: 147,
662
- scope: this,
663
- callSite: (f, a) => f(...a)
663
+ F: __dxlog_file3,
664
+ L: 147,
665
+ S: this,
666
+ C: (f, a) => f(...a)
664
667
  });
665
668
  const connection = this._createConnection(true, sessionId);
666
669
  this.initiating = true;
@@ -680,17 +683,17 @@ var Peer = class {
680
683
  ownId: this.localPeerId,
681
684
  remoteId: this.id
682
685
  }, {
683
- file: "peer.ts",
684
- line: 159,
685
- scope: this,
686
- callSite: (f, a) => f(...a)
686
+ F: __dxlog_file3,
687
+ L: 159,
688
+ S: this,
689
+ C: (f, a) => f(...a)
687
690
  });
688
691
  if (connection.state !== ConnectionState.INITIAL) {
689
- (0, import_log3.log)("ignoring response", {}, {
690
- file: "peer.ts",
691
- line: 161,
692
- scope: this,
693
- callSite: (f, a) => f(...a)
692
+ (0, import_log3.log)("ignoring response", void 0, {
693
+ F: __dxlog_file3,
694
+ L: 161,
695
+ S: this,
696
+ C: (f, a) => f(...a)
694
697
  });
695
698
  return;
696
699
  }
@@ -707,10 +710,10 @@ var Peer = class {
707
710
  peerId: this.localPeerId,
708
711
  remoteId: this.id
709
712
  }, {
710
- file: "peer.ts",
711
- line: 172,
712
- scope: this,
713
- callSite: (f, a) => f(...a)
713
+ F: __dxlog_file3,
714
+ L: 172,
715
+ S: this,
716
+ C: (f, a) => f(...a)
714
717
  });
715
718
  await this.closeConnection();
716
719
  throw err;
@@ -731,10 +734,10 @@ var Peer = class {
731
734
  initiator,
732
735
  sessionId
733
736
  }, {
734
- file: "peer.ts",
735
- line: 186,
736
- scope: this,
737
- callSite: (f, a) => f(...a)
737
+ F: __dxlog_file3,
738
+ L: 186,
739
+ S: this,
740
+ C: (f, a) => f(...a)
738
741
  });
739
742
  (0, import_tiny_invariant3.default)(!this.connection, "Already connected.");
740
743
  const connection = new Connection(
@@ -771,10 +774,10 @@ var Peer = class {
771
774
  remoteId: this.id,
772
775
  initiator
773
776
  }, {
774
- file: "peer.ts",
775
- line: 221,
776
- scope: this,
777
- callSite: (f, a) => f(...a)
777
+ F: __dxlog_file3,
778
+ L: 221,
779
+ S: this,
780
+ C: (f, a) => f(...a)
778
781
  });
779
782
  (0, import_tiny_invariant3.default)(this.connection === connection, "Connection mismatch (race condition).");
780
783
  if (this._lastConnectionTime && this._lastConnectionTime + CONNECTION_COUNTS_STABLE_AFTER < Date.now()) {
@@ -801,10 +804,10 @@ var Peer = class {
801
804
  initiator,
802
805
  err
803
806
  }, {
804
- file: "peer.ts",
805
- line: 249,
806
- scope: this,
807
- callSite: (f, a) => f(...a)
807
+ F: __dxlog_file3,
808
+ L: 249,
809
+ S: this,
810
+ C: (f, a) => f(...a)
808
811
  });
809
812
  void this.closeConnection();
810
813
  });
@@ -820,20 +823,20 @@ var Peer = class {
820
823
  peerId: this.id,
821
824
  sessionId: connection.sessionId
822
825
  }, {
823
- file: "peer.ts",
824
- line: 265,
825
- scope: this,
826
- callSite: (f, a) => f(...a)
826
+ F: __dxlog_file3,
827
+ L: 265,
828
+ S: this,
829
+ C: (f, a) => f(...a)
827
830
  });
828
831
  await connection.close();
829
832
  (0, import_log3.log)("closed", {
830
833
  peerId: this.id,
831
834
  sessionId: connection.sessionId
832
835
  }, {
833
- file: "peer.ts",
834
- line: 271,
835
- scope: this,
836
- callSite: (f, a) => f(...a)
836
+ F: __dxlog_file3,
837
+ L: 271,
838
+ S: this,
839
+ C: (f, a) => f(...a)
837
840
  });
838
841
  }
839
842
  async onSignal(message) {
@@ -841,10 +844,10 @@ var Peer = class {
841
844
  (0, import_log3.log)("dropping signal message for non-existent connection", {
842
845
  message
843
846
  }, {
844
- file: "peer.ts",
845
- line: 276,
846
- scope: this,
847
- callSite: (f, a) => f(...a)
847
+ F: __dxlog_file3,
848
+ L: 276,
849
+ S: this,
850
+ C: (f, a) => f(...a)
848
851
  });
849
852
  return;
850
853
  }
@@ -857,15 +860,15 @@ var Peer = class {
857
860
  peerId: this.id,
858
861
  topic: this.topic
859
862
  }, {
860
- file: "peer.ts",
861
- line: 285,
862
- scope: this,
863
- callSite: (f, a) => f(...a)
863
+ F: __dxlog_file3,
864
+ L: 285,
865
+ S: this,
866
+ C: (f, a) => f(...a)
864
867
  });
865
868
  await ((_a = this == null ? void 0 : this.connection) == null ? void 0 : _a.close());
866
869
  }
867
870
  };
868
- __decorate2([
871
+ _ts_decorate2([
869
872
  import_async2.synchronized
870
873
  ], Peer.prototype, "destroy", null);
871
874
  var increaseInterval = (interval) => {
@@ -882,7 +885,7 @@ var increaseInterval = (interval) => {
882
885
  };
883
886
 
884
887
  // packages/core/mesh/network-manager/src/swarm/swarm.ts
885
- var __decorate3 = function(decorators, target, key, desc) {
888
+ function _ts_decorate3(decorators, target, key, desc) {
886
889
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
887
890
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
888
891
  r = Reflect.decorate(decorators, target, key, desc);
@@ -891,7 +894,8 @@ var __decorate3 = function(decorators, target, key, desc) {
891
894
  if (d = decorators[i])
892
895
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
893
896
  return c > 3 && r && Object.defineProperty(target, key, r), r;
894
- };
897
+ }
898
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm.ts";
895
899
  var INITIATION_DELAY = 100;
896
900
  var getClassName = (obj) => Object.getPrototypeOf(obj).constructor.name;
897
901
  var Swarm = class {
@@ -908,11 +912,11 @@ var Swarm = class {
908
912
  this._peers = new import_util2.ComplexMap(import_keys4.PublicKey.hash);
909
913
  this._ctx = new import_context4.Context();
910
914
  this._listeningHandle = void 0;
915
+ this._instanceId = import_keys4.PublicKey.random().toHex();
911
916
  this.connectionAdded = new import_async3.Event();
912
917
  this.disconnected = new import_async3.Event();
913
918
  this.connected = new import_async3.Event();
914
919
  this.errors = new import_debug2.ErrorStream();
915
- this._instanceId = import_keys4.PublicKey.random().toHex();
916
920
  import_log4.log.trace("dxos.mesh.swarm.constructor", import_protocols3.trace.begin({
917
921
  id: this._instanceId,
918
922
  data: {
@@ -920,18 +924,18 @@ var Swarm = class {
920
924
  peerId: this._ownPeerId.toHex()
921
925
  }
922
926
  }), {
923
- file: "swarm.ts",
924
- line: 86,
925
- scope: this,
926
- callSite: (f, a) => f(...a)
927
+ F: __dxlog_file4,
928
+ L: 86,
929
+ S: this,
930
+ C: (f, a) => f(...a)
927
931
  });
928
932
  (0, import_log4.log)("creating swarm", {
929
933
  peerId: _ownPeerId
930
934
  }, {
931
- file: "swarm.ts",
932
- line: 90,
933
- scope: this,
934
- callSite: (f, a) => f(...a)
935
+ F: __dxlog_file4,
936
+ L: 90,
937
+ S: this,
938
+ C: (f, a) => f(...a)
935
939
  });
936
940
  _topology.init(this._getSwarmController());
937
941
  this._swarmMessenger = new SwarmMessenger({
@@ -943,10 +947,10 @@ var Swarm = class {
943
947
  import_log4.log.trace("dxos.mesh.swarm.constructor", import_protocols3.trace.end({
944
948
  id: this._instanceId
945
949
  }), {
946
- file: "swarm.ts",
947
- line: 99,
948
- scope: this,
949
- callSite: (f, a) => f(...a)
950
+ F: __dxlog_file4,
951
+ L: 99,
952
+ S: this,
953
+ C: (f, a) => f(...a)
950
954
  });
951
955
  }
952
956
  get connections() {
@@ -973,32 +977,32 @@ var Swarm = class {
973
977
  await this._swarmMessenger.receiveMessage(message).catch((err) => import_log4.log.warn("Error while receiving message", {
974
978
  err
975
979
  }, {
976
- file: "swarm.ts",
977
- line: 133,
978
- scope: this,
979
- callSite: (f, a) => f(...a)
980
+ F: __dxlog_file4,
981
+ L: 133,
982
+ S: this,
983
+ C: (f, a) => f(...a)
980
984
  }));
981
985
  }
982
986
  });
983
987
  }
984
988
  async destroy() {
985
989
  var _a;
986
- (0, import_log4.log)("destroying...", {}, {
987
- file: "swarm.ts",
988
- line: 139,
989
- scope: this,
990
- callSite: (f, a) => f(...a)
990
+ (0, import_log4.log)("destroying...", void 0, {
991
+ F: __dxlog_file4,
992
+ L: 139,
993
+ S: this,
994
+ C: (f, a) => f(...a)
991
995
  });
992
996
  await ((_a = this._listeningHandle) == null ? void 0 : _a.unsubscribe());
993
997
  this._listeningHandle = void 0;
994
998
  await this._ctx.dispose();
995
999
  await this._topology.destroy();
996
1000
  await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
997
- (0, import_log4.log)("destroyed", {}, {
998
- file: "swarm.ts",
999
- line: 146,
1000
- scope: this,
1001
- callSite: (f, a) => f(...a)
1001
+ (0, import_log4.log)("destroyed", void 0, {
1002
+ F: __dxlog_file4,
1003
+ L: 146,
1004
+ S: this,
1005
+ C: (f, a) => f(...a)
1002
1006
  });
1003
1007
  }
1004
1008
  async setTopology(topology) {
@@ -1010,10 +1014,10 @@ var Swarm = class {
1010
1014
  previous: getClassName(this._topology),
1011
1015
  topology: getClassName(topology)
1012
1016
  }, {
1013
- file: "swarm.ts",
1014
- line: 154,
1015
- scope: this,
1016
- callSite: (f, a) => f(...a)
1017
+ F: __dxlog_file4,
1018
+ L: 154,
1019
+ S: this,
1020
+ C: (f, a) => f(...a)
1017
1021
  });
1018
1022
  await this._topology.destroy();
1019
1023
  this._topology = topology;
@@ -1025,17 +1029,17 @@ var Swarm = class {
1025
1029
  (0, import_log4.log)("swarm event", {
1026
1030
  swarmEvent
1027
1031
  }, {
1028
- file: "swarm.ts",
1029
- line: 167,
1030
- scope: this,
1031
- callSite: (f, a) => f(...a)
1032
+ F: __dxlog_file4,
1033
+ L: 167,
1034
+ S: this,
1035
+ C: (f, a) => f(...a)
1032
1036
  });
1033
1037
  if (this._ctx.disposed) {
1034
- (0, import_log4.log)("swarm event ignored for disposed swarm", {}, {
1035
- file: "swarm.ts",
1036
- line: 170,
1037
- scope: this,
1038
- callSite: (f, a) => f(...a)
1038
+ (0, import_log4.log)("swarm event ignored for disposed swarm", void 0, {
1039
+ F: __dxlog_file4,
1040
+ L: 170,
1041
+ S: this,
1042
+ C: (f, a) => f(...a)
1039
1043
  });
1040
1044
  return;
1041
1045
  }
@@ -1044,25 +1048,25 @@ var Swarm = class {
1044
1048
  (0, import_log4.log)("new peer", {
1045
1049
  peerId
1046
1050
  }, {
1047
- file: "swarm.ts",
1048
- line: 176,
1049
- scope: this,
1050
- callSite: (f, a) => f(...a)
1051
+ F: __dxlog_file4,
1052
+ L: 176,
1053
+ S: this,
1054
+ C: (f, a) => f(...a)
1051
1055
  });
1052
1056
  if (!peerId.equals(this._ownPeerId)) {
1053
1057
  const peer = this._getOrCreatePeer(peerId);
1054
1058
  peer.advertizing = true;
1055
1059
  }
1056
1060
  } else if (swarmEvent.peerLeft) {
1057
- const peer1 = this._peers.get(import_keys4.PublicKey.from(swarmEvent.peerLeft.peer));
1058
- if (peer1) {
1059
- peer1.advertizing = false;
1060
- if (((_a = peer1.connection) == null ? void 0 : _a.state) !== ConnectionState.CONNECTED) {
1061
- void this._destroyPeer(peer1.id).catch((err) => import_log4.log.catch(err, {}, {
1062
- file: "swarm.ts",
1063
- line: 187,
1064
- scope: this,
1065
- callSite: (f, a) => f(...a)
1061
+ const peer = this._peers.get(import_keys4.PublicKey.from(swarmEvent.peerLeft.peer));
1062
+ if (peer) {
1063
+ peer.advertizing = false;
1064
+ if (((_a = peer.connection) == null ? void 0 : _a.state) !== ConnectionState.CONNECTED) {
1065
+ void this._destroyPeer(peer.id).catch((err) => import_log4.log.catch(err, void 0, {
1066
+ F: __dxlog_file4,
1067
+ L: 187,
1068
+ S: this,
1069
+ C: (f, a) => f(...a)
1066
1070
  }));
1067
1071
  }
1068
1072
  }
@@ -1074,17 +1078,17 @@ var Swarm = class {
1074
1078
  (0, import_log4.log)("offer", {
1075
1079
  message
1076
1080
  }, {
1077
- file: "swarm.ts",
1078
- line: 197,
1079
- scope: this,
1080
- callSite: (f, a) => f(...a)
1081
+ F: __dxlog_file4,
1082
+ L: 197,
1083
+ S: this,
1084
+ C: (f, a) => f(...a)
1081
1085
  });
1082
1086
  if (this._ctx.disposed) {
1083
- (0, import_log4.log)("ignored for disposed swarm", {}, {
1084
- file: "swarm.ts",
1085
- line: 199,
1086
- scope: this,
1087
- callSite: (f, a) => f(...a)
1087
+ (0, import_log4.log)("ignored for disposed swarm", void 0, {
1088
+ F: __dxlog_file4,
1089
+ L: 199,
1090
+ S: this,
1091
+ C: (f, a) => f(...a)
1088
1092
  });
1089
1093
  return {
1090
1094
  accept: false
@@ -1095,10 +1099,10 @@ var Swarm = class {
1095
1099
  (0, import_log4.log)("rejecting offer with incorrect peerId", {
1096
1100
  message
1097
1101
  }, {
1098
- file: "swarm.ts",
1099
- line: 206,
1100
- scope: this,
1101
- callSite: (f, a) => f(...a)
1102
+ F: __dxlog_file4,
1103
+ L: 206,
1104
+ S: this,
1105
+ C: (f, a) => f(...a)
1102
1106
  });
1103
1107
  return {
1104
1108
  accept: false
@@ -1108,10 +1112,10 @@ var Swarm = class {
1108
1112
  (0, import_log4.log)("rejecting offer with incorrect topic", {
1109
1113
  message
1110
1114
  }, {
1111
- file: "swarm.ts",
1112
- line: 210,
1113
- scope: this,
1114
- callSite: (f, a) => f(...a)
1115
+ F: __dxlog_file4,
1116
+ L: 210,
1117
+ S: this,
1118
+ C: (f, a) => f(...a)
1115
1119
  });
1116
1120
  return {
1117
1121
  accept: false
@@ -1127,17 +1131,17 @@ var Swarm = class {
1127
1131
  (0, import_log4.log)("signal", {
1128
1132
  message
1129
1133
  }, {
1130
- file: "swarm.ts",
1131
- line: 222,
1132
- scope: this,
1133
- callSite: (f, a) => f(...a)
1134
+ F: __dxlog_file4,
1135
+ L: 222,
1136
+ S: this,
1137
+ C: (f, a) => f(...a)
1134
1138
  });
1135
1139
  if (this._ctx.disposed) {
1136
- import_log4.log.info("ignored for offline swarm", {}, {
1137
- file: "swarm.ts",
1138
- line: 224,
1139
- scope: this,
1140
- callSite: (f, a) => f(...a)
1140
+ import_log4.log.info("ignored for offline swarm", void 0, {
1141
+ F: __dxlog_file4,
1142
+ L: 224,
1143
+ S: this,
1144
+ C: (f, a) => f(...a)
1141
1145
  });
1142
1146
  return;
1143
1147
  }
@@ -1215,10 +1219,10 @@ var Swarm = class {
1215
1219
  await this._initiateConnection(peer);
1216
1220
  } catch (err) {
1217
1221
  (0, import_log4.log)("initiation error", err, {
1218
- file: "swarm.ts",
1219
- line: 327,
1220
- scope: this,
1221
- callSite: (f, a) => f(...a)
1222
+ F: __dxlog_file4,
1223
+ L: 327,
1224
+ S: this,
1225
+ C: (f, a) => f(...a)
1222
1226
  });
1223
1227
  }
1224
1228
  });
@@ -1243,10 +1247,10 @@ var Swarm = class {
1243
1247
  (0, import_log4.log)("initiation delay", {
1244
1248
  remoteId
1245
1249
  }, {
1246
- file: "swarm.ts",
1247
- line: 354,
1248
- scope: this,
1249
- callSite: (f, a) => f(...a)
1250
+ F: __dxlog_file4,
1251
+ L: 354,
1252
+ S: this,
1253
+ C: (f, a) => f(...a)
1250
1254
  });
1251
1255
  await (0, import_async3.sleep)(INITIATION_DELAY);
1252
1256
  }
@@ -1260,20 +1264,20 @@ var Swarm = class {
1260
1264
  (0, import_log4.log)("initiating connection...", {
1261
1265
  remoteId
1262
1266
  }, {
1263
- file: "swarm.ts",
1264
- line: 368,
1265
- scope: this,
1266
- callSite: (f, a) => f(...a)
1267
+ F: __dxlog_file4,
1268
+ L: 368,
1269
+ S: this,
1270
+ C: (f, a) => f(...a)
1267
1271
  });
1268
1272
  await peer.initiateConnection();
1269
1273
  this._topology.update();
1270
1274
  (0, import_log4.log)("initiated", {
1271
1275
  remoteId
1272
1276
  }, {
1273
- file: "swarm.ts",
1274
- line: 371,
1275
- scope: this,
1276
- callSite: (f, a) => f(...a)
1277
+ F: __dxlog_file4,
1278
+ L: 371,
1279
+ S: this,
1280
+ C: (f, a) => f(...a)
1277
1281
  });
1278
1282
  }
1279
1283
  async _closeConnection(peerId) {
@@ -1284,28 +1288,28 @@ var Swarm = class {
1284
1288
  await peer.closeConnection();
1285
1289
  }
1286
1290
  };
1287
- __decorate3([
1291
+ _ts_decorate3([
1288
1292
  import_log4.logInfo
1289
1293
  ], Swarm.prototype, "_instanceId", void 0);
1290
- __decorate3([
1294
+ _ts_decorate3([
1291
1295
  import_log4.logInfo
1292
1296
  ], Swarm.prototype, "ownPeerId", null);
1293
- __decorate3([
1297
+ _ts_decorate3([
1294
1298
  import_log4.logInfo
1295
1299
  ], Swarm.prototype, "topic", null);
1296
- __decorate3([
1300
+ _ts_decorate3([
1297
1301
  import_async3.synchronized
1298
1302
  ], Swarm.prototype, "onSwarmEvent", null);
1299
- __decorate3([
1303
+ _ts_decorate3([
1300
1304
  import_async3.synchronized
1301
1305
  ], Swarm.prototype, "onOffer", null);
1302
- __decorate3([
1306
+ _ts_decorate3([
1303
1307
  import_async3.synchronized
1304
1308
  ], Swarm.prototype, "onSignal", null);
1305
- __decorate3([
1309
+ _ts_decorate3([
1306
1310
  import_async3.synchronized
1307
1311
  ], Swarm.prototype, "goOffline", null);
1308
- __decorate3([
1312
+ _ts_decorate3([
1309
1313
  import_async3.synchronized
1310
1314
  ], Swarm.prototype, "goOnline", null);
1311
1315
 
@@ -1314,6 +1318,7 @@ var import_async4 = require("@dxos/async");
1314
1318
  var import_keys5 = require("@dxos/keys");
1315
1319
  var import_log5 = require("@dxos/log");
1316
1320
  var import_util3 = require("@dxos/util");
1321
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm-mapper.ts";
1317
1322
  var SwarmMapper = class {
1318
1323
  get peers() {
1319
1324
  return Array.from(this._peers.values());
@@ -1340,11 +1345,11 @@ var SwarmMapper = class {
1340
1345
  this._update();
1341
1346
  }
1342
1347
  _update() {
1343
- (0, import_log5.log)("updating swarm", {}, {
1344
- file: "swarm-mapper.ts",
1345
- line: 75,
1346
- scope: this,
1347
- callSite: (f, a) => f(...a)
1348
+ (0, import_log5.log)("updating swarm", void 0, {
1349
+ F: __dxlog_file5,
1350
+ L: 75,
1351
+ S: this,
1352
+ C: (f, a) => f(...a)
1348
1353
  });
1349
1354
  this._peers.clear();
1350
1355
  this._peers.set(this._swarm.ownPeerId, {
@@ -1365,10 +1370,10 @@ var SwarmMapper = class {
1365
1370
  directConnections: this._swarm.connections.length,
1366
1371
  totalPeersInSwarm: this._peers.size
1367
1372
  }, {
1368
- file: "swarm-mapper.ts",
1369
- line: 116,
1370
- scope: this,
1371
- callSite: (f, a) => f(...a)
1373
+ F: __dxlog_file5,
1374
+ L: 116,
1375
+ S: this,
1376
+ C: (f, a) => f(...a)
1372
1377
  });
1373
1378
  this.mapUpdated.emit(Array.from(this._peers.values()));
1374
1379
  }
@@ -1454,8 +1459,9 @@ var import_messaging = require("@dxos/messaging");
1454
1459
  var import_protocols4 = require("@dxos/protocols");
1455
1460
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
1456
1461
  var import_util5 = require("@dxos/util");
1462
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/network-manager.ts";
1457
1463
  var NetworkManager = class {
1458
- constructor({ transportFactory, signalManager, log: log13 }) {
1464
+ constructor({ transportFactory, signalManager, log: log1 }) {
1459
1465
  this._swarms = new import_util5.ComplexMap(import_keys7.PublicKey.hash);
1460
1466
  this._mappers = new import_util5.ComplexMap(import_keys7.PublicKey.hash);
1461
1467
  this._connectionState = import_services.ConnectionState.ONLINE;
@@ -1475,7 +1481,7 @@ var NetworkManager = class {
1475
1481
  join: (opts) => this._signalManager.join(opts),
1476
1482
  leave: (opts) => this._signalManager.leave(opts)
1477
1483
  };
1478
- if (log13) {
1484
+ if (log1) {
1479
1485
  this._connectionLog = new ConnectionLog();
1480
1486
  }
1481
1487
  }
@@ -1500,30 +1506,30 @@ var NetworkManager = class {
1500
1506
  import_log6.log.trace("dxos.mesh.network-manager.open", import_protocols4.trace.begin({
1501
1507
  id: this._instanceId
1502
1508
  }), {
1503
- file: "network-manager.ts",
1504
- line: 127,
1505
- scope: this,
1506
- callSite: (f, a) => f(...a)
1509
+ F: __dxlog_file6,
1510
+ L: 127,
1511
+ S: this,
1512
+ C: (f, a) => f(...a)
1507
1513
  });
1508
1514
  await this._messenger.open();
1509
1515
  await this._signalManager.open();
1510
1516
  import_log6.log.trace("dxos.mesh.network-manager.open", import_protocols4.trace.end({
1511
1517
  id: this._instanceId
1512
1518
  }), {
1513
- file: "network-manager.ts",
1514
- line: 130,
1515
- scope: this,
1516
- callSite: (f, a) => f(...a)
1519
+ F: __dxlog_file6,
1520
+ L: 130,
1521
+ S: this,
1522
+ C: (f, a) => f(...a)
1517
1523
  });
1518
1524
  }
1519
1525
  async close() {
1520
1526
  for (const topic of this._swarms.keys()) {
1521
1527
  await this.leaveSwarm(topic).catch((err) => {
1522
- (0, import_log6.log)(err, {}, {
1523
- file: "network-manager.ts",
1524
- line: 136,
1525
- scope: this,
1526
- callSite: (f, a) => f(...a)
1528
+ (0, import_log6.log)(err, void 0, {
1529
+ F: __dxlog_file6,
1530
+ L: 136,
1531
+ S: this,
1532
+ C: (f, a) => f(...a)
1527
1533
  });
1528
1534
  });
1529
1535
  }
@@ -1547,20 +1553,20 @@ var NetworkManager = class {
1547
1553
  peerId,
1548
1554
  topology: topology.toString()
1549
1555
  }, {
1550
- file: "network-manager.ts",
1551
- line: 162,
1552
- scope: this,
1553
- callSite: (f, a) => f(...a)
1556
+ F: __dxlog_file6,
1557
+ L: 162,
1558
+ S: this,
1559
+ C: (f, a) => f(...a)
1554
1560
  });
1555
1561
  const swarm = new Swarm(topic, peerId, topology, protocol, this._messenger, this._transportFactory, label);
1556
1562
  swarm.errors.handle((error) => {
1557
1563
  (0, import_log6.log)("swarm error", {
1558
1564
  error
1559
1565
  }, {
1560
- file: "network-manager.ts",
1561
- line: 165,
1562
- scope: this,
1563
- callSite: (f, a) => f(...a)
1566
+ F: __dxlog_file6,
1567
+ L: 165,
1568
+ S: this,
1569
+ C: (f, a) => f(...a)
1564
1570
  });
1565
1571
  });
1566
1572
  this._swarms.set(topic, swarm);
@@ -1569,11 +1575,11 @@ var NetworkManager = class {
1569
1575
  this._signalConnection.join({
1570
1576
  topic,
1571
1577
  peerId
1572
- }).catch((error) => import_log6.log.catch(error, {}, {
1573
- file: "network-manager.ts",
1574
- line: 174,
1575
- scope: this,
1576
- callSite: (f, a) => f(...a)
1578
+ }).catch((error) => import_log6.log.catch(error, void 0, {
1579
+ F: __dxlog_file6,
1580
+ L: 174,
1581
+ S: this,
1582
+ C: (f, a) => f(...a)
1577
1583
  }));
1578
1584
  this.topicsUpdated.emit();
1579
1585
  (_a = this._connectionLog) == null ? void 0 : _a.joinedSwarm(swarm);
@@ -1581,10 +1587,10 @@ var NetworkManager = class {
1581
1587
  topic: import_keys7.PublicKey.from(topic),
1582
1588
  count: this._swarms.size
1583
1589
  }, {
1584
- file: "network-manager.ts",
1585
- line: 178,
1586
- scope: this,
1587
- callSite: (f, a) => f(...a)
1590
+ F: __dxlog_file6,
1591
+ L: 178,
1592
+ S: this,
1593
+ C: (f, a) => f(...a)
1588
1594
  });
1589
1595
  return {
1590
1596
  close: () => this.leaveSwarm(topic)
@@ -1601,10 +1607,10 @@ var NetworkManager = class {
1601
1607
  (0, import_log6.log)("leaving", {
1602
1608
  topic: import_keys7.PublicKey.from(topic)
1603
1609
  }, {
1604
- file: "network-manager.ts",
1605
- line: 194,
1606
- scope: this,
1607
- callSite: (f, a) => f(...a)
1610
+ F: __dxlog_file6,
1611
+ L: 194,
1612
+ S: this,
1613
+ C: (f, a) => f(...a)
1608
1614
  });
1609
1615
  const swarm = this._swarms.get(topic);
1610
1616
  await this._signalConnection.leave({
@@ -1622,10 +1628,10 @@ var NetworkManager = class {
1622
1628
  topic: import_keys7.PublicKey.from(topic),
1623
1629
  count: this._swarms.size
1624
1630
  }, {
1625
- file: "network-manager.ts",
1626
- line: 208,
1627
- scope: this,
1628
- callSite: (f, a) => f(...a)
1631
+ F: __dxlog_file6,
1632
+ L: 208,
1633
+ S: this,
1634
+ C: (f, a) => f(...a)
1629
1635
  });
1630
1636
  }
1631
1637
  async setConnectionState(state) {
@@ -1684,6 +1690,7 @@ var FullyConnectedTopology = class {
1684
1690
  var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
1685
1691
  var import_xor_distance = __toESM(require("xor-distance"));
1686
1692
  var import_log7 = require("@dxos/log");
1693
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/mmst-topology.ts";
1687
1694
  var MMSTTopology = class {
1688
1695
  constructor({ originateConnections = 2, maxPeers = 4, sampleSize = 10 } = {}) {
1689
1696
  this._sampleCollected = false;
@@ -1699,11 +1706,11 @@ var MMSTTopology = class {
1699
1706
  (0, import_tiny_invariant7.default)(this._controller, "Not initialized");
1700
1707
  const { connected, candidates } = this._controller.getState();
1701
1708
  if (this._sampleCollected || connected.length > this._maxPeers || candidates.length > 0) {
1702
- (0, import_log7.log)("Running the algorithm.", {}, {
1703
- file: "mmst-topology.ts",
1704
- line: 55,
1705
- scope: this,
1706
- callSite: (f, a) => f(...a)
1709
+ (0, import_log7.log)("Running the algorithm.", void 0, {
1710
+ F: __dxlog_file7,
1711
+ L: 55,
1712
+ S: this,
1713
+ C: (f, a) => f(...a)
1707
1714
  });
1708
1715
  this._sampleCollected = true;
1709
1716
  this._runAlgorithm();
@@ -1713,11 +1720,11 @@ var MMSTTopology = class {
1713
1720
  (0, import_tiny_invariant7.default)(this._controller, "Not initialized");
1714
1721
  const { connected } = this._controller.getState();
1715
1722
  const accept = connected.length < this._maxPeers;
1716
- (0, import_log7.log)(`Offer ${peer} accept=${accept}`, {}, {
1717
- file: "mmst-topology.ts",
1718
- line: 65,
1719
- scope: this,
1720
- callSite: (f, a) => f(...a)
1723
+ (0, import_log7.log)(`Offer ${peer} accept=${accept}`, void 0, {
1724
+ F: __dxlog_file7,
1725
+ L: 65,
1726
+ S: this,
1727
+ C: (f, a) => f(...a)
1721
1728
  });
1722
1729
  return accept;
1723
1730
  }
@@ -1729,25 +1736,25 @@ var MMSTTopology = class {
1729
1736
  if (connected.length > this._maxPeers) {
1730
1737
  const sorted = sortByXorDistance(connected, ownPeerId).reverse().slice(0, this._maxPeers - connected.length);
1731
1738
  for (const peer of sorted) {
1732
- (0, import_log7.log)(`Disconnect ${peer}.`, {}, {
1733
- file: "mmst-topology.ts",
1734
- line: 83,
1735
- scope: this,
1736
- callSite: (f, a) => f(...a)
1739
+ (0, import_log7.log)(`Disconnect ${peer}.`, void 0, {
1740
+ F: __dxlog_file7,
1741
+ L: 83,
1742
+ S: this,
1743
+ C: (f, a) => f(...a)
1737
1744
  });
1738
1745
  this._controller.disconnect(peer);
1739
1746
  }
1740
1747
  } else if (connected.length < this._originateConnections) {
1741
1748
  const sample = candidates.sort(() => Math.random() - 0.5).slice(0, this._sampleSize);
1742
- const sorted1 = sortByXorDistance(sample, ownPeerId).slice(0, this._originateConnections - connected.length);
1743
- for (const peer1 of sorted1) {
1744
- (0, import_log7.log)(`Connect ${peer1}.`, {}, {
1745
- file: "mmst-topology.ts",
1746
- line: 91,
1747
- scope: this,
1748
- callSite: (f, a) => f(...a)
1749
+ const sorted = sortByXorDistance(sample, ownPeerId).slice(0, this._originateConnections - connected.length);
1750
+ for (const peer of sorted) {
1751
+ (0, import_log7.log)(`Connect ${peer}.`, void 0, {
1752
+ F: __dxlog_file7,
1753
+ L: 91,
1754
+ S: this,
1755
+ C: (f, a) => f(...a)
1749
1756
  });
1750
- this._controller.connect(peer1);
1757
+ this._controller.connect(peer);
1751
1758
  }
1752
1759
  }
1753
1760
  }
@@ -1760,6 +1767,7 @@ var sortByXorDistance = (keys, reference) => keys.sort((a, b) => import_xor_dist
1760
1767
  // packages/core/mesh/network-manager/src/topology/star-topology.ts
1761
1768
  var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
1762
1769
  var import_log8 = require("@dxos/log");
1770
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/star-topology.ts";
1763
1771
  var StarTopology = class {
1764
1772
  // prettier-ignore
1765
1773
  constructor(_centralPeer) {
@@ -1776,37 +1784,37 @@ var StarTopology = class {
1776
1784
  (0, import_tiny_invariant8.default)(this._controller, "Not initialized.");
1777
1785
  const { candidates, connected, ownPeerId } = this._controller.getState();
1778
1786
  if (!ownPeerId.equals(this._centralPeer)) {
1779
- (0, import_log8.log)("leaf peer dropping all connections apart from central peer.", {}, {
1780
- file: "star-topology.ts",
1781
- line: 33,
1782
- scope: this,
1783
- callSite: (f, a) => f(...a)
1787
+ (0, import_log8.log)("leaf peer dropping all connections apart from central peer.", void 0, {
1788
+ F: __dxlog_file8,
1789
+ L: 33,
1790
+ S: this,
1791
+ C: (f, a) => f(...a)
1784
1792
  });
1785
1793
  for (const peer of connected) {
1786
1794
  if (!peer.equals(this._centralPeer)) {
1787
1795
  (0, import_log8.log)("dropping connection", {
1788
1796
  peer
1789
1797
  }, {
1790
- file: "star-topology.ts",
1791
- line: 38,
1792
- scope: this,
1793
- callSite: (f, a) => f(...a)
1798
+ F: __dxlog_file8,
1799
+ L: 38,
1800
+ S: this,
1801
+ C: (f, a) => f(...a)
1794
1802
  });
1795
1803
  this._controller.disconnect(peer);
1796
1804
  }
1797
1805
  }
1798
1806
  }
1799
- for (const peer1 of candidates) {
1800
- if (peer1.equals(this._centralPeer) || ownPeerId.equals(this._centralPeer)) {
1807
+ for (const peer of candidates) {
1808
+ if (peer.equals(this._centralPeer) || ownPeerId.equals(this._centralPeer)) {
1801
1809
  (0, import_log8.log)("connecting to peer", {
1802
- peer: peer1
1810
+ peer
1803
1811
  }, {
1804
- file: "star-topology.ts",
1805
- line: 47,
1806
- scope: this,
1807
- callSite: (f, a) => f(...a)
1812
+ F: __dxlog_file8,
1813
+ L: 47,
1814
+ S: this,
1815
+ C: (f, a) => f(...a)
1808
1816
  });
1809
- this._controller.connect(peer1);
1817
+ this._controller.connect(peer);
1810
1818
  }
1811
1819
  }
1812
1820
  }
@@ -1818,10 +1826,10 @@ var StarTopology = class {
1818
1826
  isCentral: peer.equals(this._centralPeer),
1819
1827
  isSelfCentral: ownPeerId.equals(this._centralPeer)
1820
1828
  }, {
1821
- file: "star-topology.ts",
1822
- line: 56,
1823
- scope: this,
1824
- callSite: (f, a) => f(...a)
1829
+ F: __dxlog_file8,
1830
+ L: 56,
1831
+ S: this,
1832
+ C: (f, a) => f(...a)
1825
1833
  });
1826
1834
  return ownPeerId.equals(this._centralPeer) || peer.equals(this._centralPeer);
1827
1835
  }
@@ -1837,7 +1845,7 @@ var import_debug4 = require("@dxos/debug");
1837
1845
  var import_keys8 = require("@dxos/keys");
1838
1846
  var import_log9 = require("@dxos/log");
1839
1847
  var import_util6 = require("@dxos/util");
1840
- var __decorate4 = function(decorators, target, key, desc) {
1848
+ function _ts_decorate4(decorators, target, key, desc) {
1841
1849
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1842
1850
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1843
1851
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1846,7 +1854,8 @@ var __decorate4 = function(decorators, target, key, desc) {
1846
1854
  if (d = decorators[i])
1847
1855
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1848
1856
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1849
- };
1857
+ }
1858
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/memory-transport.ts";
1850
1859
  var MEMORY_TRANSPORT_DELAY = 1;
1851
1860
  var createStreamDelay = (delay) => {
1852
1861
  return new import_node_stream.Transform({
@@ -1866,26 +1875,26 @@ var _MemoryTransport = class {
1866
1875
  this.closed = new import_async7.Event();
1867
1876
  this.connected = new import_async7.Event();
1868
1877
  this.errors = new import_debug4.ErrorStream();
1878
+ this._instanceId = import_keys8.PublicKey.random();
1869
1879
  this._remote = new import_async7.Trigger();
1870
1880
  this._outgoingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY);
1871
1881
  this._incomingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY);
1872
1882
  this._destroyed = false;
1873
- this._instanceId = import_keys8.PublicKey.random();
1874
- (0, import_log9.log)("creating", {}, {
1875
- file: "memory-transport.ts",
1876
- line: 64,
1877
- scope: this,
1878
- callSite: (f, a) => f(...a)
1883
+ (0, import_log9.log)("creating", void 0, {
1884
+ F: __dxlog_file9,
1885
+ L: 64,
1886
+ S: this,
1887
+ C: (f, a) => f(...a)
1879
1888
  });
1880
1889
  (0, import_tiny_invariant9.default)(!_MemoryTransport._connections.has(this._instanceId), "Duplicate memory connection");
1881
1890
  _MemoryTransport._connections.set(this._instanceId, this);
1882
1891
  if (this.options.initiator) {
1883
1892
  setTimeout(async () => {
1884
- (0, import_log9.log)("sending signal", {}, {
1885
- file: "memory-transport.ts",
1886
- line: 73,
1887
- scope: this,
1888
- callSite: (f, a) => f(...a)
1893
+ (0, import_log9.log)("sending signal", void 0, {
1894
+ F: __dxlog_file9,
1895
+ L: 73,
1896
+ S: this,
1897
+ C: (f, a) => f(...a)
1889
1898
  });
1890
1899
  void this.options.sendSignal({
1891
1900
  payload: {
@@ -1914,11 +1923,11 @@ var _MemoryTransport = class {
1914
1923
  (0, import_tiny_invariant9.default)(!this._remoteConnection._remoteConnection, `Remote already connected: ${this._remoteInstanceId}`);
1915
1924
  this._remoteConnection._remoteConnection = this;
1916
1925
  this._remoteConnection._remoteInstanceId = this._instanceId;
1917
- (0, import_log9.log)("connected", {}, {
1918
- file: "memory-transport.ts",
1919
- line: 103,
1920
- scope: this,
1921
- callSite: (f, a) => f(...a)
1926
+ (0, import_log9.log)("connected", void 0, {
1927
+ F: __dxlog_file9,
1928
+ L: 103,
1929
+ S: this,
1930
+ C: (f, a) => f(...a)
1922
1931
  });
1923
1932
  this.options.stream.pipe(this._outgoingDelay).pipe(this._remoteConnection.options.stream).pipe(this._incomingDelay).pipe(this.options.stream);
1924
1933
  this.connected.emit();
@@ -1932,20 +1941,20 @@ var _MemoryTransport = class {
1932
1941
  }
1933
1942
  }
1934
1943
  async destroy() {
1935
- (0, import_log9.log)("closing", {}, {
1936
- file: "memory-transport.ts",
1937
- line: 124,
1938
- scope: this,
1939
- callSite: (f, a) => f(...a)
1944
+ (0, import_log9.log)("closing", void 0, {
1945
+ F: __dxlog_file9,
1946
+ L: 124,
1947
+ S: this,
1948
+ C: (f, a) => f(...a)
1940
1949
  });
1941
1950
  this._destroyed = true;
1942
1951
  _MemoryTransport._connections.delete(this._instanceId);
1943
1952
  if (this._remoteConnection) {
1944
- (0, import_log9.log)("closing", {}, {
1945
- file: "memory-transport.ts",
1946
- line: 129,
1947
- scope: this,
1948
- callSite: (f, a) => f(...a)
1953
+ (0, import_log9.log)("closing", void 0, {
1954
+ F: __dxlog_file9,
1955
+ L: 129,
1956
+ S: this,
1957
+ C: (f, a) => f(...a)
1949
1958
  });
1950
1959
  this._remoteConnection._destroyed = true;
1951
1960
  _MemoryTransport._connections.delete(this._remoteInstanceId);
@@ -1954,29 +1963,29 @@ var _MemoryTransport = class {
1954
1963
  this._remoteConnection.closed.emit();
1955
1964
  this._remoteConnection._remoteConnection = void 0;
1956
1965
  this._remoteConnection = void 0;
1957
- (0, import_log9.log)("closed", {}, {
1958
- file: "memory-transport.ts",
1959
- line: 147,
1960
- scope: this,
1961
- callSite: (f, a) => f(...a)
1966
+ (0, import_log9.log)("closed", void 0, {
1967
+ F: __dxlog_file9,
1968
+ L: 147,
1969
+ S: this,
1970
+ C: (f, a) => f(...a)
1962
1971
  });
1963
1972
  }
1964
1973
  this.closed.emit();
1965
- (0, import_log9.log)("closed", {}, {
1966
- file: "memory-transport.ts",
1967
- line: 151,
1968
- scope: this,
1969
- callSite: (f, a) => f(...a)
1974
+ (0, import_log9.log)("closed", void 0, {
1975
+ F: __dxlog_file9,
1976
+ L: 151,
1977
+ S: this,
1978
+ C: (f, a) => f(...a)
1970
1979
  });
1971
1980
  }
1972
1981
  signal({ payload }) {
1973
1982
  (0, import_log9.log)("received signal", {
1974
1983
  payload
1975
1984
  }, {
1976
- file: "memory-transport.ts",
1977
- line: 155,
1978
- scope: this,
1979
- callSite: (f, a) => f(...a)
1985
+ F: __dxlog_file9,
1986
+ L: 155,
1987
+ S: this,
1988
+ C: (f, a) => f(...a)
1980
1989
  });
1981
1990
  if (!(payload == null ? void 0 : payload.transportId)) {
1982
1991
  return;
@@ -1991,10 +2000,10 @@ var _MemoryTransport = class {
1991
2000
  var MemoryTransport = _MemoryTransport;
1992
2001
  // TODO(burdon): Remove static properties (inject context into constructor).
1993
2002
  MemoryTransport._connections = new import_util6.ComplexMap(import_keys8.PublicKey.hash);
1994
- __decorate4([
2003
+ _ts_decorate4([
1995
2004
  import_log9.logInfo
1996
2005
  ], MemoryTransport.prototype, "_instanceId", void 0);
1997
- __decorate4([
2006
+ _ts_decorate4([
1998
2007
  import_log9.logInfo
1999
2008
  ], MemoryTransport.prototype, "_remoteInstanceId", void 0);
2000
2009
 
@@ -2015,6 +2024,7 @@ try {
2015
2024
  }
2016
2025
 
2017
2026
  // packages/core/mesh/network-manager/src/transport/webrtc-transport.ts
2027
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc-transport.ts";
2018
2028
  var WebRTCTransport = class {
2019
2029
  constructor(params) {
2020
2030
  var _a;
@@ -2027,16 +2037,16 @@ var WebRTCTransport = class {
2027
2037
  import_log10.log.trace("dxos.mesh.webrtc-transport.constructor", import_protocols5.trace.begin({
2028
2038
  id: this._instanceId
2029
2039
  }), {
2030
- file: "webrtc-transport.ts",
2031
- line: 39,
2032
- scope: this,
2033
- callSite: (f, a) => f(...a)
2040
+ F: __dxlog_file10,
2041
+ L: 39,
2042
+ S: this,
2043
+ C: (f, a) => f(...a)
2034
2044
  });
2035
2045
  (0, import_log10.log)("created connection", params, {
2036
- file: "webrtc-transport.ts",
2037
- line: 40,
2038
- scope: this,
2039
- callSite: (f, a) => f(...a)
2046
+ F: __dxlog_file10,
2047
+ L: 40,
2048
+ S: this,
2049
+ C: (f, a) => f(...a)
2040
2050
  });
2041
2051
  this._peer = new import_simple_peer.default({
2042
2052
  initiator: this.params.initiator,
@@ -2045,10 +2055,10 @@ var WebRTCTransport = class {
2045
2055
  });
2046
2056
  this._peer.on("signal", async (data) => {
2047
2057
  (0, import_log10.log)("signal", data, {
2048
- file: "webrtc-transport.ts",
2049
- line: 48,
2050
- scope: this,
2051
- callSite: (f, a) => f(...a)
2058
+ F: __dxlog_file10,
2059
+ L: 48,
2060
+ S: this,
2061
+ C: (f, a) => f(...a)
2052
2062
  });
2053
2063
  await this.params.sendSignal({
2054
2064
  payload: {
@@ -2057,21 +2067,21 @@ var WebRTCTransport = class {
2057
2067
  });
2058
2068
  });
2059
2069
  this._peer.on("connect", () => {
2060
- (0, import_log10.log)("connected", {}, {
2061
- file: "webrtc-transport.ts",
2062
- line: 53,
2063
- scope: this,
2064
- callSite: (f, a) => f(...a)
2070
+ (0, import_log10.log)("connected", void 0, {
2071
+ F: __dxlog_file10,
2072
+ L: 53,
2073
+ S: this,
2074
+ C: (f, a) => f(...a)
2065
2075
  });
2066
2076
  this.params.stream.pipe(this._peer).pipe(this.params.stream);
2067
2077
  this.connected.emit();
2068
2078
  });
2069
2079
  this._peer.on("close", async () => {
2070
- (0, import_log10.log)("closed", {}, {
2071
- file: "webrtc-transport.ts",
2072
- line: 59,
2073
- scope: this,
2074
- callSite: (f, a) => f(...a)
2080
+ (0, import_log10.log)("closed", void 0, {
2081
+ F: __dxlog_file10,
2082
+ L: 59,
2083
+ S: this,
2084
+ C: (f, a) => f(...a)
2075
2085
  });
2076
2086
  await this._disconnectStreams();
2077
2087
  this.closed.emit();
@@ -2086,10 +2096,10 @@ var WebRTCTransport = class {
2086
2096
  config: this.params.webrtcConfig,
2087
2097
  stats
2088
2098
  }, {
2089
- file: "webrtc-transport.ts",
2090
- line: 71,
2091
- scope: this,
2092
- callSite: (f, a) => f(...a)
2099
+ F: __dxlog_file10,
2100
+ L: 71,
2101
+ S: this,
2102
+ C: (f, a) => f(...a)
2093
2103
  });
2094
2104
  });
2095
2105
  }
@@ -2100,28 +2110,28 @@ var WebRTCTransport = class {
2100
2110
  import_log10.log.trace("dxos.mesh.webrtc-transport.constructor", import_protocols5.trace.end({
2101
2111
  id: this._instanceId
2102
2112
  }), {
2103
- file: "webrtc-transport.ts",
2104
- line: 81,
2105
- scope: this,
2106
- callSite: (f, a) => f(...a)
2113
+ F: __dxlog_file10,
2114
+ L: 81,
2115
+ S: this,
2116
+ C: (f, a) => f(...a)
2107
2117
  });
2108
2118
  }
2109
2119
  async destroy() {
2110
- (0, import_log10.log)("closing...", {}, {
2111
- file: "webrtc-transport.ts",
2112
- line: 85,
2113
- scope: this,
2114
- callSite: (f, a) => f(...a)
2120
+ (0, import_log10.log)("closing...", void 0, {
2121
+ F: __dxlog_file10,
2122
+ L: 85,
2123
+ S: this,
2124
+ C: (f, a) => f(...a)
2115
2125
  });
2116
2126
  this._closed = true;
2117
2127
  await this._disconnectStreams();
2118
2128
  this._peer.destroy();
2119
2129
  this.closed.emit();
2120
- (0, import_log10.log)("closed", {}, {
2121
- file: "webrtc-transport.ts",
2122
- line: 90,
2123
- scope: this,
2124
- callSite: (f, a) => f(...a)
2130
+ (0, import_log10.log)("closed", void 0, {
2131
+ F: __dxlog_file10,
2132
+ L: 90,
2133
+ S: this,
2134
+ C: (f, a) => f(...a)
2125
2135
  });
2126
2136
  }
2127
2137
  signal(signal) {
@@ -2151,6 +2161,7 @@ var import_keys10 = require("@dxos/keys");
2151
2161
  var import_log11 = require("@dxos/log");
2152
2162
  var import_bridge = require("@dxos/protocols/proto/dxos/mesh/bridge");
2153
2163
  var import_util7 = require("@dxos/util");
2164
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc-transport-service.ts";
2154
2165
  var WebRTCTransportService = class {
2155
2166
  // prettier-ignore
2156
2167
  constructor(_webrtcConfig) {
@@ -2233,11 +2244,11 @@ var WebRTCTransportService = class {
2233
2244
  await ((_a = this.transports.get(proxyId)) == null ? void 0 : _a.transport.destroy());
2234
2245
  await ((_b = this.transports.get(proxyId)) == null ? void 0 : _b.stream.end());
2235
2246
  this.transports.delete(proxyId);
2236
- (0, import_log11.log)("Closed.", {}, {
2237
- file: "webrtc-transport-service.ts",
2238
- line: 109,
2239
- scope: this,
2240
- callSite: (f, a) => f(...a)
2247
+ (0, import_log11.log)("Closed.", void 0, {
2248
+ F: __dxlog_file11,
2249
+ L: 109,
2250
+ S: this,
2251
+ C: (f, a) => f(...a)
2241
2252
  });
2242
2253
  }
2243
2254
  };
@@ -2251,6 +2262,7 @@ var import_keys11 = require("@dxos/keys");
2251
2262
  var import_log12 = require("@dxos/log");
2252
2263
  var import_bridge2 = require("@dxos/protocols/proto/dxos/mesh/bridge");
2253
2264
  var import_util8 = require("@dxos/util");
2265
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc-transport-proxy.ts";
2254
2266
  var WebRTCTransportProxy = class {
2255
2267
  // prettier-ignore
2256
2268
  constructor(_params) {
@@ -2268,10 +2280,10 @@ var WebRTCTransportProxy = class {
2268
2280
  this._serviceStream.waitUntilReady().then(() => {
2269
2281
  this._serviceStream.subscribe(async (event) => {
2270
2282
  (0, import_log12.log)("WebRTCTransportProxy: event", event, {
2271
- file: "webrtc-transport-proxy.ts",
2272
- line: 50,
2273
- scope: this,
2274
- callSite: (f, a) => f(...a)
2283
+ F: __dxlog_file12,
2284
+ L: 50,
2285
+ S: this,
2286
+ C: (f, a) => f(...a)
2275
2287
  });
2276
2288
  if (event.connection) {
2277
2289
  await this._handleConnection(event.connection);
@@ -2288,11 +2300,11 @@ var WebRTCTransportProxy = class {
2288
2300
  payload: data
2289
2301
  });
2290
2302
  } catch (err) {
2291
- import_log12.log.catch(err, {}, {
2292
- file: "webrtc-transport-proxy.ts",
2293
- line: 67,
2294
- scope: this,
2295
- callSite: (f, a) => f(...a)
2303
+ import_log12.log.catch(err, void 0, {
2304
+ F: __dxlog_file12,
2305
+ L: 67,
2306
+ S: this,
2307
+ C: (f, a) => f(...a)
2296
2308
  });
2297
2309
  }
2298
2310
  };
@@ -2300,11 +2312,11 @@ var WebRTCTransportProxy = class {
2300
2312
  this._ctx.onDispose(() => {
2301
2313
  this._params.stream.off("data", dataListener);
2302
2314
  });
2303
- }, (error) => import_log12.log.catch(error, {}, {
2304
- file: "webrtc-transport-proxy.ts",
2305
- line: 73,
2306
- scope: this,
2307
- callSite: (f, a) => f(...a)
2315
+ }, (error) => import_log12.log.catch(error, void 0, {
2316
+ F: __dxlog_file12,
2317
+ L: 73,
2318
+ S: this,
2319
+ C: (f, a) => f(...a)
2308
2320
  }));
2309
2321
  }
2310
2322
  async _handleConnection(connectionEvent) {
@@ -2346,11 +2358,11 @@ var WebRTCTransportProxy = class {
2346
2358
  proxyId: this._proxyId
2347
2359
  });
2348
2360
  } catch (err) {
2349
- import_log12.log.catch(err, {}, {
2350
- file: "webrtc-transport-proxy.ts",
2351
- line: 124,
2352
- scope: this,
2353
- callSite: (f, a) => f(...a)
2361
+ import_log12.log.catch(err, void 0, {
2362
+ F: __dxlog_file12,
2363
+ L: 124,
2364
+ S: this,
2365
+ C: (f, a) => f(...a)
2354
2366
  });
2355
2367
  }
2356
2368
  this.closed.emit();