@dxos/network-manager 0.1.58-main.3349da8 → 0.1.58-main.385b5e4

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 (44) hide show
  1. package/dist/lib/browser/{chunk-PSWNMALH.mjs → chunk-JIGWYM5K.mjs} +86 -68
  2. package/dist/lib/browser/chunk-JIGWYM5K.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +109 -109
  6. package/dist/lib/browser/testing/index.mjs.map +4 -4
  7. package/dist/lib/node/index.cjs +389 -371
  8. package/dist/lib/node/index.cjs.map +4 -4
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +901 -882
  11. package/dist/lib/node/testing/index.cjs.map +4 -4
  12. package/dist/types/src/swarm/connection-limiter.d.ts +1 -1
  13. package/dist/types/src/swarm/connection-limiter.d.ts.map +1 -1
  14. package/dist/types/src/swarm/connection.d.ts.map +1 -1
  15. package/dist/types/src/swarm/peer.d.ts +3 -3
  16. package/dist/types/src/swarm/peer.d.ts.map +1 -1
  17. package/dist/types/src/swarm/swarm-mapper.d.ts.map +1 -1
  18. package/dist/types/src/swarm/swarm.d.ts +2 -2
  19. package/dist/types/src/swarm/swarm.d.ts.map +1 -1
  20. package/dist/types/src/testing/test-builder.d.ts +1 -1
  21. package/dist/types/src/testing/test-builder.d.ts.map +1 -1
  22. package/dist/types/src/tests/basic-test-suite.d.ts.map +1 -1
  23. package/dist/types/src/topology/star-topology.d.ts.map +1 -1
  24. package/dist/types/src/transport/simplepeer-transport-proxy.d.ts.map +1 -1
  25. package/dist/types/src/transport/simplepeer-transport-service.d.ts.map +1 -1
  26. package/dist/types/src/transport/simplepeer-transport.d.ts.map +1 -1
  27. package/package.json +17 -18
  28. package/src/swarm/connection-limiter.ts +2 -2
  29. package/src/swarm/connection.test.ts +1 -1
  30. package/src/swarm/connection.ts +5 -5
  31. package/src/swarm/peer.ts +7 -3
  32. package/src/swarm/swarm-mapper.ts +4 -7
  33. package/src/swarm/swarm.test.ts +3 -3
  34. package/src/swarm/swarm.ts +3 -3
  35. package/src/testing/test-builder.ts +1 -1
  36. package/src/tests/basic-test-suite.ts +1 -1
  37. package/src/tests/memory-transport.test.ts +2 -2
  38. package/src/tests/tcp-transport.test.ts +2 -2
  39. package/src/tests/webrtc-transport.test.ts +1 -1
  40. package/src/topology/star-topology.ts +1 -4
  41. package/src/transport/simplepeer-transport-proxy.ts +29 -28
  42. package/src/transport/simplepeer-transport-service.ts +1 -4
  43. package/src/transport/simplepeer-transport.ts +4 -7
  44. package/dist/lib/browser/chunk-PSWNMALH.mjs.map +0 -7
@@ -7,11 +7,10 @@ import {
7
7
  import { DeferredTask, Event, sleep, synchronized } from "@dxos/async";
8
8
  import { Context, cancelWithContext } from "@dxos/context";
9
9
  import { ErrorStream } from "@dxos/debug";
10
- import { CancelledError, ProtocolError, ConnectionResetError, ConnectivityError, UnknownProtocolError } from "@dxos/errors";
11
10
  import { invariant } from "@dxos/invariant";
12
11
  import { PublicKey } from "@dxos/keys";
13
12
  import { log } from "@dxos/log";
14
- import { trace } from "@dxos/protocols";
13
+ import { CancelledError, ProtocolError, ConnectionResetError, ConnectivityError, UnknownProtocolError, trace } from "@dxos/protocols";
15
14
  function _ts_decorate(decorators, target, key, desc) {
16
15
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17
16
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -771,10 +770,10 @@ import { ComplexMap as ComplexMap2, isNotNullOrUndefined } from "@dxos/util";
771
770
  // packages/core/mesh/network-manager/src/swarm/peer.ts
772
771
  import { Event as Event2, scheduleTask, synchronized as synchronized2 } from "@dxos/async";
773
772
  import { Context as Context3 } from "@dxos/context";
774
- import { CancelledError as CancelledError2, SystemError, TimeoutError } from "@dxos/errors";
775
773
  import { invariant as invariant3 } from "@dxos/invariant";
776
774
  import { PublicKey as PublicKey3 } from "@dxos/keys";
777
775
  import { log as log3 } from "@dxos/log";
776
+ import { CancelledError as CancelledError2, SystemError, TimeoutError } from "@dxos/protocols";
778
777
  function _ts_decorate2(decorators, target, key, desc) {
779
778
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
780
779
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -815,6 +814,20 @@ var Peer = class {
815
814
  */
816
815
  async onOffer(message) {
817
816
  const remoteId = message.author;
817
+ if (this.connection && ![
818
+ ConnectionState.CREATED,
819
+ ConnectionState.INITIAL
820
+ ].includes(this.connection.state)) {
821
+ log3.info(`received offer when connection already in ${this.connection.state} state`, void 0, {
822
+ F: __dxlog_file3,
823
+ L: 112,
824
+ S: this,
825
+ C: (f, a) => f(...a)
826
+ });
827
+ return {
828
+ accept: false
829
+ };
830
+ }
818
831
  if (this.connection || this.initiating) {
819
832
  if (remoteId.toHex() < this.localPeerId.toHex()) {
820
833
  log3("close local connection", {
@@ -824,7 +837,7 @@ var Peer = class {
824
837
  sessionId: this.connection?.sessionId
825
838
  }, {
826
839
  F: __dxlog_file3,
827
- L: 117,
840
+ L: 121,
828
841
  S: this,
829
842
  C: (f, a) => f(...a)
830
843
  });
@@ -841,7 +854,7 @@ var Peer = class {
841
854
  if (!this.connection) {
842
855
  invariant3(message.sessionId, void 0, {
843
856
  F: __dxlog_file3,
844
- L: 137,
857
+ L: 141,
845
858
  S: this,
846
859
  A: [
847
860
  "message.sessionId",
@@ -862,7 +875,7 @@ var Peer = class {
862
875
  err
863
876
  }, {
864
877
  F: __dxlog_file3,
865
- L: 147,
878
+ L: 151,
866
879
  S: this,
867
880
  C: (f, a) => f(...a)
868
881
  });
@@ -884,7 +897,7 @@ var Peer = class {
884
897
  async initiateConnection() {
885
898
  invariant3(!this.initiating, "Initiation in progress.", {
886
899
  F: __dxlog_file3,
887
- L: 164,
900
+ L: 168,
888
901
  S: this,
889
902
  A: [
890
903
  "!this.initiating",
@@ -893,7 +906,7 @@ var Peer = class {
893
906
  });
894
907
  invariant3(!this.connection, "Already connected.", {
895
908
  F: __dxlog_file3,
896
- L: 165,
909
+ L: 169,
897
910
  S: this,
898
911
  A: [
899
912
  "!this.connection",
@@ -908,7 +921,7 @@ var Peer = class {
908
921
  sessionId
909
922
  }, {
910
923
  F: __dxlog_file3,
911
- L: 167,
924
+ L: 171,
912
925
  S: this,
913
926
  C: (f, a) => f(...a)
914
927
  });
@@ -933,14 +946,14 @@ var Peer = class {
933
946
  remoteId: this.id
934
947
  }, {
935
948
  F: __dxlog_file3,
936
- L: 183,
949
+ L: 187,
937
950
  S: this,
938
951
  C: (f, a) => f(...a)
939
952
  });
940
953
  if (connection.state !== ConnectionState.INITIAL) {
941
954
  log3("ignoring response", void 0, {
942
955
  F: __dxlog_file3,
943
- L: 185,
956
+ L: 189,
944
957
  S: this,
945
958
  C: (f, a) => f(...a)
946
959
  });
@@ -960,7 +973,7 @@ var Peer = class {
960
973
  remoteId: this.id
961
974
  }, {
962
975
  F: __dxlog_file3,
963
- L: 196,
976
+ L: 200,
964
977
  S: this,
965
978
  C: (f, a) => f(...a)
966
979
  });
@@ -986,13 +999,13 @@ var Peer = class {
986
999
  sessionId
987
1000
  }, {
988
1001
  F: __dxlog_file3,
989
- L: 213,
1002
+ L: 217,
990
1003
  S: this,
991
1004
  C: (f, a) => f(...a)
992
1005
  });
993
1006
  invariant3(!this.connection, "Already connected.", {
994
1007
  F: __dxlog_file3,
995
- L: 220,
1008
+ L: 224,
996
1009
  S: this,
997
1010
  A: [
998
1011
  "!this.connection",
@@ -1028,7 +1041,7 @@ var Peer = class {
1028
1041
  initiator
1029
1042
  }, {
1030
1043
  F: __dxlog_file3,
1031
- L: 239,
1044
+ L: 243,
1032
1045
  S: this,
1033
1046
  C: (f, a) => f(...a)
1034
1047
  });
@@ -1041,14 +1054,14 @@ var Peer = class {
1041
1054
  initiator
1042
1055
  }, {
1043
1056
  F: __dxlog_file3,
1044
- L: 248,
1057
+ L: 252,
1045
1058
  S: this,
1046
1059
  C: (f, a) => f(...a)
1047
1060
  });
1048
1061
  this._connectionLimiter.doneConnecting(sessionId);
1049
1062
  invariant3(this.connection === connection, "Connection mismatch (race condition).", {
1050
1063
  F: __dxlog_file3,
1051
- L: 253,
1064
+ L: 257,
1052
1065
  S: this,
1053
1066
  A: [
1054
1067
  "this.connection === connection",
@@ -1063,7 +1076,7 @@ var Peer = class {
1063
1076
  initiator
1064
1077
  }, {
1065
1078
  F: __dxlog_file3,
1066
- L: 255,
1079
+ L: 259,
1067
1080
  S: this,
1068
1081
  C: (f, a) => f(...a)
1069
1082
  });
@@ -1098,7 +1111,7 @@ var Peer = class {
1098
1111
  err
1099
1112
  }, {
1100
1113
  F: __dxlog_file3,
1101
- L: 295,
1114
+ L: 299,
1102
1115
  S: this,
1103
1116
  C: (f, a) => f(...a)
1104
1117
  });
@@ -1111,7 +1124,7 @@ var Peer = class {
1111
1124
  err
1112
1125
  }, {
1113
1126
  F: __dxlog_file3,
1114
- L: 296,
1127
+ L: 300,
1115
1128
  S: this,
1116
1129
  C: (f, a) => f(...a)
1117
1130
  });
@@ -1130,7 +1143,7 @@ var Peer = class {
1130
1143
  sessionId: connection.sessionId
1131
1144
  }, {
1132
1145
  F: __dxlog_file3,
1133
- L: 321,
1146
+ L: 325,
1134
1147
  S: this,
1135
1148
  C: (f, a) => f(...a)
1136
1149
  });
@@ -1140,7 +1153,7 @@ var Peer = class {
1140
1153
  sessionId: connection.sessionId
1141
1154
  }, {
1142
1155
  F: __dxlog_file3,
1143
- L: 327,
1156
+ L: 331,
1144
1157
  S: this,
1145
1158
  C: (f, a) => f(...a)
1146
1159
  });
@@ -1151,7 +1164,7 @@ var Peer = class {
1151
1164
  message
1152
1165
  }, {
1153
1166
  F: __dxlog_file3,
1154
- L: 332,
1167
+ L: 336,
1155
1168
  S: this,
1156
1169
  C: (f, a) => f(...a)
1157
1170
  });
@@ -1166,7 +1179,7 @@ var Peer = class {
1166
1179
  topic: this.topic
1167
1180
  }, {
1168
1181
  F: __dxlog_file3,
1169
- L: 342,
1182
+ L: 346,
1170
1183
  S: this,
1171
1184
  C: (f, a) => f(...a)
1172
1185
  });
@@ -1679,7 +1692,6 @@ var SwarmMapper = class {
1679
1692
  get peers() {
1680
1693
  return Array.from(this._peers.values());
1681
1694
  }
1682
- // prettier-ignore
1683
1695
  constructor(_swarm) {
1684
1696
  this._swarm = _swarm;
1685
1697
  this._subscriptions = new EventSubscriptions();
@@ -1702,7 +1714,7 @@ var SwarmMapper = class {
1702
1714
  _update() {
1703
1715
  log5("updating swarm", void 0, {
1704
1716
  F: __dxlog_file5,
1705
- L: 75,
1717
+ L: 72,
1706
1718
  S: this,
1707
1719
  C: (f, a) => f(...a)
1708
1720
  });
@@ -1726,7 +1738,7 @@ var SwarmMapper = class {
1726
1738
  totalPeersInSwarm: this._peers.size
1727
1739
  }, {
1728
1740
  F: __dxlog_file5,
1729
- L: 116,
1741
+ L: 113,
1730
1742
  S: this,
1731
1743
  C: (f, a) => f(...a)
1732
1744
  });
@@ -1742,13 +1754,13 @@ var SwarmMapper = class {
1742
1754
  // packages/core/mesh/network-manager/src/swarm/connection-limiter.ts
1743
1755
  import { DeferredTask as DeferredTask2 } from "@dxos/async";
1744
1756
  import { Context as Context5 } from "@dxos/context";
1745
- import { CancelledError as CancelledError3 } from "@dxos/errors";
1746
1757
  import { invariant as invariant5 } from "@dxos/invariant";
1747
1758
  import { PublicKey as PublicKey6 } from "@dxos/keys";
1748
1759
  import { log as log6 } from "@dxos/log";
1760
+ import { CancelledError as CancelledError3 } from "@dxos/protocols";
1749
1761
  import { ComplexMap as ComplexMap4 } from "@dxos/util";
1750
1762
  var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection-limiter.ts";
1751
- var MAX_CONCURRENT_INITIATING_CONNECTIONS = 10;
1763
+ var MAX_CONCURRENT_INITIATING_CONNECTIONS = 50;
1752
1764
  var ConnectionLimiter = class {
1753
1765
  constructor({ maxConcurrentInitConnections = MAX_CONCURRENT_INITIATING_CONNECTIONS } = {}) {
1754
1766
  this._ctx = new Context5();
@@ -2290,7 +2302,6 @@ import { invariant as invariant9 } from "@dxos/invariant";
2290
2302
  import { log as log9 } from "@dxos/log";
2291
2303
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/star-topology.ts";
2292
2304
  var StarTopology = class {
2293
- // prettier-ignore
2294
2305
  constructor(_centralPeer) {
2295
2306
  this._centralPeer = _centralPeer;
2296
2307
  }
@@ -2300,7 +2311,7 @@ var StarTopology = class {
2300
2311
  init(controller) {
2301
2312
  invariant9(!this._controller, "Already initialized.", {
2302
2313
  F: __dxlog_file10,
2303
- L: 24,
2314
+ L: 21,
2304
2315
  S: this,
2305
2316
  A: [
2306
2317
  "!this._controller",
@@ -2312,7 +2323,7 @@ var StarTopology = class {
2312
2323
  update() {
2313
2324
  invariant9(this._controller, "Not initialized.", {
2314
2325
  F: __dxlog_file10,
2315
- L: 29,
2326
+ L: 26,
2316
2327
  S: this,
2317
2328
  A: [
2318
2329
  "this._controller",
@@ -2323,7 +2334,7 @@ var StarTopology = class {
2323
2334
  if (!ownPeerId.equals(this._centralPeer)) {
2324
2335
  log9("leaf peer dropping all connections apart from central peer.", void 0, {
2325
2336
  F: __dxlog_file10,
2326
- L: 32,
2337
+ L: 29,
2327
2338
  S: this,
2328
2339
  C: (f, a) => f(...a)
2329
2340
  });
@@ -2333,7 +2344,7 @@ var StarTopology = class {
2333
2344
  peer
2334
2345
  }, {
2335
2346
  F: __dxlog_file10,
2336
- L: 37,
2347
+ L: 34,
2337
2348
  S: this,
2338
2349
  C: (f, a) => f(...a)
2339
2350
  });
@@ -2347,7 +2358,7 @@ var StarTopology = class {
2347
2358
  peer
2348
2359
  }, {
2349
2360
  F: __dxlog_file10,
2350
- L: 46,
2361
+ L: 43,
2351
2362
  S: this,
2352
2363
  C: (f, a) => f(...a)
2353
2364
  });
@@ -2358,7 +2369,7 @@ var StarTopology = class {
2358
2369
  async onOffer(peer) {
2359
2370
  invariant9(this._controller, "Not initialized.", {
2360
2371
  F: __dxlog_file10,
2361
- L: 53,
2372
+ L: 50,
2362
2373
  S: this,
2363
2374
  A: [
2364
2375
  "this._controller",
@@ -2372,7 +2383,7 @@ var StarTopology = class {
2372
2383
  isSelfCentral: ownPeerId.equals(this._centralPeer)
2373
2384
  }, {
2374
2385
  F: __dxlog_file10,
2375
- L: 55,
2386
+ L: 52,
2376
2387
  S: this,
2377
2388
  C: (f, a) => f(...a)
2378
2389
  });
@@ -2583,10 +2594,9 @@ import SimplePeerConstructor from "simple-peer";
2583
2594
  import invariant11 from "tiny-invariant";
2584
2595
  import { Event as Event8 } from "@dxos/async";
2585
2596
  import { ErrorStream as ErrorStream4, raise as raise2 } from "@dxos/debug";
2586
- import { ConnectionResetError as ConnectionResetError2, ConnectivityError as ConnectivityError2, ProtocolError as ProtocolError2, UnknownProtocolError as UnknownProtocolError2 } from "@dxos/errors";
2587
2597
  import { PublicKey as PublicKey10 } from "@dxos/keys";
2588
2598
  import { log as log11 } from "@dxos/log";
2589
- import { trace as trace4 } from "@dxos/protocols";
2599
+ import { ConnectionResetError as ConnectionResetError2, ConnectivityError as ConnectivityError2, ProtocolError as ProtocolError2, UnknownProtocolError as UnknownProtocolError2, trace as trace4 } from "@dxos/protocols";
2590
2600
 
2591
2601
  // packages/core/mesh/network-manager/src/transport/webrtc.ts
2592
2602
  var wrtc = null;
@@ -2609,13 +2619,13 @@ var SimplePeerTransport = class {
2609
2619
  id: this._instanceId
2610
2620
  }), {
2611
2621
  F: __dxlog_file12,
2612
- L: 41,
2622
+ L: 40,
2613
2623
  S: this,
2614
2624
  C: (f, a) => f(...a)
2615
2625
  });
2616
2626
  log11("created connection", params, {
2617
2627
  F: __dxlog_file12,
2618
- L: 42,
2628
+ L: 41,
2619
2629
  S: this,
2620
2630
  C: (f, a) => f(...a)
2621
2631
  });
@@ -2628,7 +2638,7 @@ var SimplePeerTransport = class {
2628
2638
  this._peer.on("signal", async (data) => {
2629
2639
  log11("signal", data, {
2630
2640
  F: __dxlog_file12,
2631
- L: 51,
2641
+ L: 50,
2632
2642
  S: this,
2633
2643
  C: (f, a) => f(...a)
2634
2644
  });
@@ -2641,7 +2651,7 @@ var SimplePeerTransport = class {
2641
2651
  this._peer.on("connect", () => {
2642
2652
  log11("connected", void 0, {
2643
2653
  F: __dxlog_file12,
2644
- L: 56,
2654
+ L: 55,
2645
2655
  S: this,
2646
2656
  C: (f, a) => f(...a)
2647
2657
  });
@@ -2651,7 +2661,7 @@ var SimplePeerTransport = class {
2651
2661
  this._peer.on("close", async () => {
2652
2662
  log11("closed", void 0, {
2653
2663
  F: __dxlog_file12,
2654
- L: 62,
2664
+ L: 61,
2655
2665
  S: this,
2656
2666
  C: (f, a) => f(...a)
2657
2667
  });
@@ -2665,9 +2675,13 @@ var SimplePeerTransport = class {
2665
2675
  } else {
2666
2676
  this.errors.raise(new UnknownProtocolError2("unknown RTCError", err));
2667
2677
  }
2668
- } else if (err.name === "InvalidStateError") {
2669
- this.errors.raise(new ConnectionResetError2("safari WebRTC error", err));
2670
2678
  } else if ("code" in err) {
2679
+ log11.info("simple-peer error", err, {
2680
+ F: __dxlog_file12,
2681
+ L: 77,
2682
+ S: this,
2683
+ C: (f, a) => f(...a)
2684
+ });
2671
2685
  switch (err.code) {
2672
2686
  case "ERR_WEBRTC_SUPPORT":
2673
2687
  this.errors.raise(new ProtocolError2("WebRTC not supported", err));
@@ -2686,17 +2700,23 @@ var SimplePeerTransport = class {
2686
2700
  this.errors.raise(new Error("unknown simple-peer error"));
2687
2701
  }
2688
2702
  } else {
2703
+ log11.info("unknown peer connection error", err, {
2704
+ F: __dxlog_file12,
2705
+ L: 96,
2706
+ S: this,
2707
+ C: (f, a) => f(...a)
2708
+ });
2689
2709
  this.errors.raise(err);
2690
2710
  }
2691
2711
  try {
2692
- if (typeof this._peer?._pc.getStats === "function") {
2712
+ if (typeof this._peer?._pc?.getStats === "function") {
2693
2713
  this._peer._pc.getStats().then((stats) => {
2694
2714
  log11.warn("report after webrtc error", {
2695
2715
  config: this.params.webrtcConfig,
2696
2716
  stats
2697
2717
  }, {
2698
2718
  F: __dxlog_file12,
2699
- L: 107,
2719
+ L: 104,
2700
2720
  S: this,
2701
2721
  C: (f, a) => f(...a)
2702
2722
  });
@@ -2705,7 +2725,7 @@ var SimplePeerTransport = class {
2705
2725
  } catch (err2) {
2706
2726
  log11.catch(err2, void 0, {
2707
2727
  F: __dxlog_file12,
2708
- L: 114,
2728
+ L: 111,
2709
2729
  S: this,
2710
2730
  C: (f, a) => f(...a)
2711
2731
  });
@@ -2716,7 +2736,7 @@ var SimplePeerTransport = class {
2716
2736
  id: this._instanceId
2717
2737
  }), {
2718
2738
  F: __dxlog_file12,
2719
- L: 119,
2739
+ L: 116,
2720
2740
  S: this,
2721
2741
  C: (f, a) => f(...a)
2722
2742
  });
@@ -2724,7 +2744,7 @@ var SimplePeerTransport = class {
2724
2744
  async destroy() {
2725
2745
  log11("closing...", void 0, {
2726
2746
  F: __dxlog_file12,
2727
- L: 123,
2747
+ L: 120,
2728
2748
  S: this,
2729
2749
  C: (f, a) => f(...a)
2730
2750
  });
@@ -2734,7 +2754,7 @@ var SimplePeerTransport = class {
2734
2754
  this.closed.emit();
2735
2755
  log11("closed", void 0, {
2736
2756
  F: __dxlog_file12,
2737
- L: 128,
2757
+ L: 125,
2738
2758
  S: this,
2739
2759
  C: (f, a) => f(...a)
2740
2760
  });
@@ -2767,7 +2787,6 @@ import { ConnectionState as ConnectionState3 } from "@dxos/protocols/proto/dxos/
2767
2787
  import { ComplexMap as ComplexMap8 } from "@dxos/util";
2768
2788
  var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-service.ts";
2769
2789
  var SimplePeerTransportService = class {
2770
- // prettier-ignore
2771
2790
  constructor(_webrtcConfig) {
2772
2791
  this._webrtcConfig = _webrtcConfig;
2773
2792
  this.transports = new ComplexMap8(PublicKey11.hash);
@@ -2847,7 +2866,7 @@ var SimplePeerTransportService = class {
2847
2866
  async sendSignal({ proxyId, signal }) {
2848
2867
  invariant12(this.transports.has(proxyId), void 0, {
2849
2868
  F: __dxlog_file13,
2850
- L: 113,
2869
+ L: 110,
2851
2870
  S: this,
2852
2871
  A: [
2853
2872
  "this.transports.has(proxyId)",
@@ -2859,7 +2878,7 @@ var SimplePeerTransportService = class {
2859
2878
  async sendData({ proxyId, payload }) {
2860
2879
  invariant12(this.transports.has(proxyId), void 0, {
2861
2880
  F: __dxlog_file13,
2862
- L: 118,
2881
+ L: 115,
2863
2882
  S: this,
2864
2883
  A: [
2865
2884
  "this.transports.has(proxyId)",
@@ -2880,7 +2899,7 @@ var SimplePeerTransportService = class {
2880
2899
  this.transports.delete(proxyId);
2881
2900
  log12("Closed.", void 0, {
2882
2901
  F: __dxlog_file13,
2883
- L: 132,
2902
+ L: 129,
2884
2903
  S: this,
2885
2904
  C: (f, a) => f(...a)
2886
2905
  });
@@ -2892,15 +2911,14 @@ import { Writable } from "@dxos/node-std/stream";
2892
2911
  import { Event as Event9 } from "@dxos/async";
2893
2912
  import { Context as Context6 } from "@dxos/context";
2894
2913
  import { ErrorStream as ErrorStream5 } from "@dxos/debug";
2895
- import { ConnectionResetError as ConnectionResetError3, TimeoutError as TimeoutError2, ProtocolError as ProtocolError3, ConnectivityError as ConnectivityError3, UnknownProtocolError as UnknownProtocolError3 } from "@dxos/errors";
2896
2914
  import { invariant as invariant13 } from "@dxos/invariant";
2897
2915
  import { PublicKey as PublicKey12 } from "@dxos/keys";
2898
2916
  import { log as log13 } from "@dxos/log";
2917
+ import { ConnectionResetError as ConnectionResetError3, TimeoutError as TimeoutError2, ProtocolError as ProtocolError3, ConnectivityError as ConnectivityError3, UnknownProtocolError as UnknownProtocolError3 } from "@dxos/protocols";
2899
2918
  import { ConnectionState as ConnectionState4 } from "@dxos/protocols/proto/dxos/mesh/bridge";
2900
2919
  import { arrayToBuffer } from "@dxos/util";
2901
2920
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-proxy.ts";
2902
2921
  var SimplePeerTransportProxy = class {
2903
- // prettier-ignore
2904
2922
  constructor(_params) {
2905
2923
  this._params = _params;
2906
2924
  this._proxyId = PublicKey12.random();
@@ -2917,7 +2935,7 @@ var SimplePeerTransportProxy = class {
2917
2935
  this._serviceStream.subscribe(async (event) => {
2918
2936
  log13("SimplePeerTransportProxy: event", event, {
2919
2937
  F: __dxlog_file14,
2920
- L: 58,
2938
+ L: 55,
2921
2939
  S: this,
2922
2940
  C: (f, a) => f(...a)
2923
2941
  });
@@ -2946,7 +2964,7 @@ var SimplePeerTransportProxy = class {
2946
2964
  }));
2947
2965
  }, (error) => log13.catch(error, void 0, {
2948
2966
  F: __dxlog_file14,
2949
- L: 82,
2967
+ L: 83,
2950
2968
  S: this,
2951
2969
  C: (f, a) => f(...a)
2952
2970
  }));
@@ -2992,7 +3010,7 @@ var SimplePeerTransportProxy = class {
2992
3010
  } catch (err) {
2993
3011
  log13.catch(err, void 0, {
2994
3012
  F: __dxlog_file14,
2995
- L: 133,
3013
+ L: 134,
2996
3014
  S: this,
2997
3015
  C: (f, a) => f(...a)
2998
3016
  });
@@ -3028,7 +3046,7 @@ var SimplePeerTransportProxyFactory = class {
3028
3046
  createTransport(options) {
3029
3047
  invariant13(this._bridgeService, "SimplePeerTransportProxyFactory is not ready to open connections", {
3030
3048
  F: __dxlog_file14,
3031
- L: 170,
3049
+ L: 171,
3032
3050
  S: this,
3033
3051
  A: [
3034
3052
  "this._bridgeService",
@@ -3046,15 +3064,15 @@ var SimplePeerTransportProxyFactory = class {
3046
3064
  };
3047
3065
  var decodeError = (err) => {
3048
3066
  const message = typeof err === "string" ? err : err.message;
3049
- if (message.includes("ConnectionResetError")) {
3067
+ if (message.includes("CONNECTION_RESET")) {
3050
3068
  return new ConnectionResetError3(message);
3051
- } else if (message.includes("TimeoutError")) {
3069
+ } else if (message.includes("TIMEOUT")) {
3052
3070
  return new TimeoutError2(message);
3053
- } else if (message.includes("ProtocolError")) {
3071
+ } else if (message.includes("PROTOCOL_ERROR")) {
3054
3072
  return new ProtocolError3(message);
3055
- } else if (message.includes("ConnectivityError")) {
3073
+ } else if (message.includes("CONNECTIVITY_ERROR")) {
3056
3074
  return new ConnectivityError3(message);
3057
- } else if (message.includes("UnknownProtocolError")) {
3075
+ } else if (message.includes("UNKNOWN_PROTOCOL_ERROR")) {
3058
3076
  return new UnknownProtocolError3(message);
3059
3077
  } else {
3060
3078
  return typeof err === "string" ? new Error(err) : err;
@@ -3447,4 +3465,4 @@ export {
3447
3465
  createLibDataChannelTransportFactory,
3448
3466
  createTeleportProtocolFactory
3449
3467
  };
3450
- //# sourceMappingURL=chunk-PSWNMALH.mjs.map
3468
+ //# sourceMappingURL=chunk-JIGWYM5K.mjs.map