@dxos/teleport 0.1.56-main.83e9b8a → 0.1.56-main.a25bb93

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.
@@ -2,15 +2,15 @@ import "@dxos/node-std/globals";
2
2
 
3
3
  // packages/core/mesh/teleport/src/testing/test-builder.ts
4
4
  import { pipeline } from "@dxos/node-std/stream";
5
- import invariant4 from "tiny-invariant";
5
+ import { invariant as invariant4 } from "@dxos/invariant";
6
6
  import { PublicKey as PublicKey2 } from "@dxos/keys";
7
7
  import { log as log4 } from "@dxos/log";
8
8
 
9
9
  // packages/core/mesh/teleport/src/teleport.ts
10
- import invariant3 from "tiny-invariant";
11
10
  import { asyncTimeout, scheduleTaskInterval as scheduleTaskInterval2, runInContextAsync, synchronized, scheduleTask } from "@dxos/async";
12
11
  import { Context as Context2 } from "@dxos/context";
13
12
  import { failUndefined as failUndefined2 } from "@dxos/debug";
13
+ import { invariant as invariant3 } from "@dxos/invariant";
14
14
  import { PublicKey } from "@dxos/keys";
15
15
  import { log as log3 } from "@dxos/log";
16
16
  import { schema as schema2, RpcClosedError } from "@dxos/protocols";
@@ -19,7 +19,8 @@ import { Callback } from "@dxos/util";
19
19
 
20
20
  // packages/core/mesh/teleport/src/muxing/framer.ts
21
21
  import { Duplex } from "@dxos/node-std/stream";
22
- import invariant from "tiny-invariant";
22
+ import { invariant } from "@dxos/invariant";
23
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/framer.ts";
23
24
  var FRAME_LENGTH_SIZE = 2;
24
25
  var Framer = class {
25
26
  constructor() {
@@ -32,7 +33,15 @@ var Framer = class {
32
33
  this._processResponseQueue();
33
34
  },
34
35
  write: (chunk, encoding, callback) => {
35
- invariant(!this._subscribeCb, "Internal Framer bug. Concurrent writes detected.");
36
+ invariant(!this._subscribeCb, "Internal Framer bug. Concurrent writes detected.", {
37
+ F: __dxlog_file,
38
+ L: 34,
39
+ S: this,
40
+ A: [
41
+ "!this._subscribeCb",
42
+ "'Internal Framer bug. Concurrent writes detected.'"
43
+ ]
44
+ });
36
45
  this._bytesReceived += chunk.length;
37
46
  if (this._buffer && this._buffer.length > 0) {
38
47
  this._buffer = Buffer.concat([
@@ -69,7 +78,15 @@ var Framer = class {
69
78
  },
70
79
  subscribe: (callback) => {
71
80
  var _a;
72
- invariant(!this._messageCb, "Rpc port already has a message listener.");
81
+ invariant(!this._messageCb, "Rpc port already has a message listener.", {
82
+ F: __dxlog_file,
83
+ L: 73,
84
+ S: this,
85
+ A: [
86
+ "!this._messageCb",
87
+ "'Rpc port already has a message listener.'"
88
+ ]
89
+ });
73
90
  this._messageCb = callback;
74
91
  (_a = this._subscribeCb) == null ? void 0 : _a.call(this);
75
92
  return () => {
@@ -139,10 +156,10 @@ var encodeFrame = (payload) => {
139
156
 
140
157
  // packages/core/mesh/teleport/src/muxing/muxer.ts
141
158
  import { Duplex as Duplex2 } from "@dxos/node-std/stream";
142
- import invariant2 from "tiny-invariant";
143
159
  import { scheduleTaskInterval, Event as Event2, Trigger } from "@dxos/async";
144
160
  import { Context } from "@dxos/context";
145
161
  import { failUndefined } from "@dxos/debug";
162
+ import { invariant as invariant2 } from "@dxos/invariant";
146
163
  import { log as log2 } from "@dxos/log";
147
164
  import { schema } from "@dxos/protocols";
148
165
 
@@ -150,7 +167,7 @@ import { schema } from "@dxos/protocols";
150
167
  import * as varint from "varint";
151
168
  import { Event } from "@dxos/async";
152
169
  import { log } from "@dxos/log";
153
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/balancer.ts";
170
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/balancer.ts";
154
171
  var MAX_CHUNK_SIZE = 8192;
155
172
  var Balancer = class {
156
173
  constructor(_sysChannelId) {
@@ -200,7 +217,7 @@ var Balancer = class {
200
217
  });
201
218
  if (noCalls) {
202
219
  this._sendChunks().catch((err) => log.catch(err, void 0, {
203
- F: __dxlog_file,
220
+ F: __dxlog_file2,
204
221
  L: 96,
205
222
  S: this,
206
223
  C: (f, a) => f(...a)
@@ -302,7 +319,7 @@ var decodeChunk = (data, withLength) => {
302
319
  };
303
320
 
304
321
  // packages/core/mesh/teleport/src/muxing/muxer.ts
305
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/muxer.ts";
322
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/muxer.ts";
306
323
  var Command = schema.getCodecForType("dxos.mesh.muxer.Command");
307
324
  var STATS_INTERVAL = 1e3;
308
325
  var MAX_SAFE_FRAME_SIZE = 1e6;
@@ -335,7 +352,15 @@ var Muxer = class {
335
352
  tag,
336
353
  contentType: opts.contentType
337
354
  });
338
- invariant2(!channel.push, `Channel already open: ${tag}`);
355
+ invariant2(!channel.push, `Channel already open: ${tag}`, {
356
+ F: __dxlog_file3,
357
+ L: 91,
358
+ S: this,
359
+ A: [
360
+ "!channel.push",
361
+ "`Channel already open: ${tag}`"
362
+ ]
363
+ });
339
364
  const stream = new Duplex2({
340
365
  write: (data, encoding, callback) => {
341
366
  this._sendData(channel, data).then(() => callback()).catch(callback);
@@ -375,7 +400,15 @@ var Muxer = class {
375
400
  tag,
376
401
  contentType: opts.contentType
377
402
  });
378
- invariant2(!channel.push, `Channel already open: ${tag}`);
403
+ invariant2(!channel.push, `Channel already open: ${tag}`, {
404
+ F: __dxlog_file3,
405
+ L: 143,
406
+ S: this,
407
+ A: [
408
+ "!channel.push",
409
+ "`Channel already open: ${tag}`"
410
+ ]
411
+ });
379
412
  let inboundBuffer = [];
380
413
  let callback;
381
414
  channel.push = (data) => {
@@ -391,7 +424,15 @@ var Muxer = class {
391
424
  await this._sendData(channel, data);
392
425
  },
393
426
  subscribe: (cb) => {
394
- invariant2(!callback, "Only one subscriber is allowed");
427
+ invariant2(!callback, "Only one subscriber is allowed", {
428
+ F: __dxlog_file3,
429
+ L: 165,
430
+ S: this,
431
+ A: [
432
+ "!callback",
433
+ "'Only one subscriber is allowed'"
434
+ ]
435
+ });
395
436
  callback = cb;
396
437
  for (const data of inboundBuffer) {
397
438
  cb(data);
@@ -451,17 +492,20 @@ var Muxer = class {
451
492
  log2("Received command", {
452
493
  cmd
453
494
  }, {
454
- F: __dxlog_file2,
495
+ F: __dxlog_file3,
455
496
  L: 240,
456
497
  S: this,
457
498
  C: (f, a) => f(...a)
458
499
  });
459
500
  if (this._destroyed || this._destroying) {
501
+ if (cmd.destroy) {
502
+ return;
503
+ }
460
504
  log2.warn("Received command after destroy", {
461
505
  cmd
462
506
  }, {
463
- F: __dxlog_file2,
464
- L: 243,
507
+ F: __dxlog_file3,
508
+ L: 247,
465
509
  S: this,
466
510
  C: (f, a) => f(...a)
467
511
  });
@@ -488,8 +532,8 @@ var Muxer = class {
488
532
  log2.warn("Received data for channel before it was opened", {
489
533
  tag: stream.tag
490
534
  }, {
491
- F: __dxlog_file2,
492
- L: 270,
535
+ F: __dxlog_file3,
536
+ L: 274,
493
537
  S: this,
494
538
  C: (f, a) => f(...a)
495
539
  });
@@ -537,8 +581,8 @@ var Muxer = class {
537
581
  size: data.length,
538
582
  threshold: MAX_SAFE_FRAME_SIZE
539
583
  }, {
540
- F: __dxlog_file2,
541
- L: 314,
584
+ F: __dxlog_file3,
585
+ L: 318,
542
586
  S: this,
543
587
  C: (f, a) => f(...a)
544
588
  });
@@ -593,14 +637,14 @@ function _ts_decorate(decorators, target, key, desc) {
593
637
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
594
638
  return c > 3 && r && Object.defineProperty(target, key, r), r;
595
639
  }
596
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/teleport.ts";
640
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/teleport.ts";
597
641
  var Teleport = class {
598
642
  constructor({ initiator, localPeerId, remotePeerId }) {
599
643
  this._ctx = new Context2({
600
644
  onError: (err) => {
601
645
  void this.destroy(err).catch(() => {
602
646
  log3.error("Error during destroy", err, {
603
- F: __dxlog_file3,
647
+ F: __dxlog_file4,
604
648
  L: 34,
605
649
  S: this,
606
650
  C: (f, a) => f(...a)
@@ -614,7 +658,7 @@ var Teleport = class {
614
658
  heartbeatTimeout: 1e4,
615
659
  onTimeout: () => {
616
660
  this.destroy(new Error("Connection timed out")).catch((err) => log3.catch(err, void 0, {
617
- F: __dxlog_file3,
661
+ F: __dxlog_file4,
618
662
  L: 45,
619
663
  S: this,
620
664
  C: (f, a) => f(...a)
@@ -624,9 +668,33 @@ var Teleport = class {
624
668
  this._extensions = /* @__PURE__ */ new Map();
625
669
  this._remoteExtensions = /* @__PURE__ */ new Set();
626
670
  this._open = false;
627
- invariant3(typeof initiator === "boolean");
628
- invariant3(PublicKey.isPublicKey(localPeerId));
629
- invariant3(PublicKey.isPublicKey(remotePeerId));
671
+ invariant3(typeof initiator === "boolean", void 0, {
672
+ F: __dxlog_file4,
673
+ L: 55,
674
+ S: this,
675
+ A: [
676
+ "typeof initiator === 'boolean'",
677
+ ""
678
+ ]
679
+ });
680
+ invariant3(PublicKey.isPublicKey(localPeerId), void 0, {
681
+ F: __dxlog_file4,
682
+ L: 56,
683
+ S: this,
684
+ A: [
685
+ "PublicKey.isPublicKey(localPeerId)",
686
+ ""
687
+ ]
688
+ });
689
+ invariant3(PublicKey.isPublicKey(remotePeerId), void 0, {
690
+ F: __dxlog_file4,
691
+ L: 57,
692
+ S: this,
693
+ A: [
694
+ "PublicKey.isPublicKey(remotePeerId)",
695
+ ""
696
+ ]
697
+ });
630
698
  this.initiator = initiator;
631
699
  this.localPeerId = localPeerId;
632
700
  this.remotePeerId = remotePeerId;
@@ -634,12 +702,20 @@ var Teleport = class {
634
702
  log3("remote extension", {
635
703
  name
636
704
  }, {
637
- F: __dxlog_file3,
705
+ F: __dxlog_file4,
638
706
  L: 63,
639
707
  S: this,
640
708
  C: (f, a) => f(...a)
641
709
  });
642
- invariant3(!this._remoteExtensions.has(name), "Remote extension already exists");
710
+ invariant3(!this._remoteExtensions.has(name), "Remote extension already exists", {
711
+ F: __dxlog_file4,
712
+ L: 64,
713
+ S: this,
714
+ A: [
715
+ "!this._remoteExtensions.has(name)",
716
+ "'Remote extension already exists'"
717
+ ]
718
+ });
643
719
  this._remoteExtensions.add(name);
644
720
  if (this._extensions.has(name)) {
645
721
  try {
@@ -665,7 +741,7 @@ var Teleport = class {
665
741
  bytesReceived: stats.bytesReceived,
666
742
  channels: stats.channels
667
743
  }, {
668
- F: __dxlog_file3,
744
+ F: __dxlog_file4,
669
745
  L: 88,
670
746
  S: this,
671
747
  C: (f, a) => f(...a)
@@ -699,7 +775,7 @@ var Teleport = class {
699
775
  await extension.onClose(err);
700
776
  } catch (err2) {
701
777
  log3.catch(err2, void 0, {
702
- F: __dxlog_file3,
778
+ F: __dxlog_file4,
703
779
  L: 132,
704
780
  S: this,
705
781
  C: (f, a) => f(...a)
@@ -715,7 +791,7 @@ var Teleport = class {
715
791
  log3("addExtension", {
716
792
  name
717
793
  }, {
718
- F: __dxlog_file3,
794
+ F: __dxlog_file4,
719
795
  L: 144,
720
796
  S: this,
721
797
  C: (f, a) => f(...a)
@@ -738,8 +814,24 @@ var Teleport = class {
738
814
  }
739
815
  }
740
816
  _setExtension(extensionName, extension) {
741
- invariant3(!extensionName.includes("/"), "Invalid extension name");
742
- invariant3(!this._extensions.has(extensionName), "Extension already exists");
817
+ invariant3(!extensionName.includes("/"), "Invalid extension name", {
818
+ F: __dxlog_file4,
819
+ L: 168,
820
+ S: this,
821
+ A: [
822
+ "!extensionName.includes('/')",
823
+ "'Invalid extension name'"
824
+ ]
825
+ });
826
+ invariant3(!this._extensions.has(extensionName), "Extension already exists", {
827
+ F: __dxlog_file4,
828
+ L: 169,
829
+ S: this,
830
+ A: [
831
+ "!this._extensions.has(extensionName)",
832
+ "'Extension already exists'"
833
+ ]
834
+ });
743
835
  this._extensions.set(extensionName, extension);
744
836
  }
745
837
  async _openExtension(extensionName) {
@@ -747,7 +839,7 @@ var Teleport = class {
747
839
  log3("open extension", {
748
840
  extensionName
749
841
  }, {
750
- F: __dxlog_file3,
842
+ F: __dxlog_file4,
751
843
  L: 174,
752
844
  S: this,
753
845
  C: (f, a) => f(...a)
@@ -758,11 +850,27 @@ var Teleport = class {
758
850
  localPeerId: this.localPeerId,
759
851
  remotePeerId: this.remotePeerId,
760
852
  createPort: async (channelName, opts) => {
761
- invariant3(!channelName.includes("/"), "Invalid channel name");
853
+ invariant3(!channelName.includes("/"), "Invalid channel name", {
854
+ F: __dxlog_file4,
855
+ L: 182,
856
+ S: this,
857
+ A: [
858
+ "!channelName.includes('/')",
859
+ "'Invalid channel name'"
860
+ ]
861
+ });
762
862
  return this._muxer.createPort(`${extensionName}/${channelName}`, opts);
763
863
  },
764
864
  createStream: async (channelName, opts) => {
765
- invariant3(!channelName.includes("/"), "Invalid channel name");
865
+ invariant3(!channelName.includes("/"), "Invalid channel name", {
866
+ F: __dxlog_file4,
867
+ L: 186,
868
+ S: this,
869
+ A: [
870
+ "!channelName.includes('/')",
871
+ "'Invalid channel name'"
872
+ ]
873
+ });
766
874
  return this._muxer.createStream(`${extensionName}/${channelName}`, opts);
767
875
  },
768
876
  close: (err) => {
@@ -775,7 +883,7 @@ var Teleport = class {
775
883
  log3("extension opened", {
776
884
  extensionName
777
885
  }, {
778
- F: __dxlog_file3,
886
+ F: __dxlog_file4,
779
887
  L: 197,
780
888
  S: this,
781
889
  C: (f, a) => f(...a)
@@ -838,7 +946,7 @@ var ControlExtension = class {
838
946
  };
839
947
 
840
948
  // packages/core/mesh/teleport/src/testing/test-builder.ts
841
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-builder.ts";
949
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-builder.ts";
842
950
  var TestBuilder = class {
843
951
  constructor() {
844
952
  this._peers = /* @__PURE__ */ new Set();
@@ -857,9 +965,33 @@ var TestBuilder = class {
857
965
  await Promise.all(Array.from(this._peers).map((agent) => agent.destroy()));
858
966
  }
859
967
  async connect(peer1, peer2) {
860
- invariant4(peer1 !== peer2);
861
- invariant4(this._peers.has(peer1));
862
- invariant4(this._peers.has(peer1));
968
+ invariant4(peer1 !== peer2, void 0, {
969
+ F: __dxlog_file5,
970
+ L: 37,
971
+ S: this,
972
+ A: [
973
+ "peer1 !== peer2",
974
+ ""
975
+ ]
976
+ });
977
+ invariant4(this._peers.has(peer1), void 0, {
978
+ F: __dxlog_file5,
979
+ L: 38,
980
+ S: this,
981
+ A: [
982
+ "this._peers.has(peer1)",
983
+ ""
984
+ ]
985
+ });
986
+ invariant4(this._peers.has(peer1), void 0, {
987
+ F: __dxlog_file5,
988
+ L: 39,
989
+ S: this,
990
+ A: [
991
+ "this._peers.has(peer1)",
992
+ ""
993
+ ]
994
+ });
863
995
  const connection1 = peer1.createConnection({
864
996
  initiator: true,
865
997
  remotePeerId: peer2.peerId
@@ -879,13 +1011,53 @@ var TestBuilder = class {
879
1011
  ];
880
1012
  }
881
1013
  async disconnect(peer1, peer2) {
882
- invariant4(peer1 !== peer2);
883
- invariant4(this._peers.has(peer1));
884
- invariant4(this._peers.has(peer1));
1014
+ invariant4(peer1 !== peer2, void 0, {
1015
+ F: __dxlog_file5,
1016
+ L: 51,
1017
+ S: this,
1018
+ A: [
1019
+ "peer1 !== peer2",
1020
+ ""
1021
+ ]
1022
+ });
1023
+ invariant4(this._peers.has(peer1), void 0, {
1024
+ F: __dxlog_file5,
1025
+ L: 52,
1026
+ S: this,
1027
+ A: [
1028
+ "this._peers.has(peer1)",
1029
+ ""
1030
+ ]
1031
+ });
1032
+ invariant4(this._peers.has(peer1), void 0, {
1033
+ F: __dxlog_file5,
1034
+ L: 53,
1035
+ S: this,
1036
+ A: [
1037
+ "this._peers.has(peer1)",
1038
+ ""
1039
+ ]
1040
+ });
885
1041
  const connection1 = Array.from(peer1.connections).find((connection) => connection.remotePeerId.equals(peer2.peerId));
886
1042
  const connection2 = Array.from(peer2.connections).find((connection) => connection.remotePeerId.equals(peer1.peerId));
887
- invariant4(connection1);
888
- invariant4(connection2);
1043
+ invariant4(connection1, void 0, {
1044
+ F: __dxlog_file5,
1045
+ L: 62,
1046
+ S: this,
1047
+ A: [
1048
+ "connection1",
1049
+ ""
1050
+ ]
1051
+ });
1052
+ invariant4(connection2, void 0, {
1053
+ F: __dxlog_file5,
1054
+ L: 63,
1055
+ S: this,
1056
+ A: [
1057
+ "connection2",
1058
+ ""
1059
+ ]
1060
+ });
889
1061
  await Promise.all([
890
1062
  peer1.closeConnection(connection1),
891
1063
  peer2.closeConnection(connection2)
@@ -907,12 +1079,28 @@ var TestPeer = class {
907
1079
  return connection;
908
1080
  }
909
1081
  async openConnection(connection) {
910
- invariant4(this.connections.has(connection));
1082
+ invariant4(this.connections.has(connection), void 0, {
1083
+ F: __dxlog_file5,
1084
+ L: 84,
1085
+ S: this,
1086
+ A: [
1087
+ "this.connections.has(connection)",
1088
+ ""
1089
+ ]
1090
+ });
911
1091
  await connection.teleport.open();
912
1092
  await this.onOpen(connection);
913
1093
  }
914
1094
  async closeConnection(connection) {
915
- invariant4(this.connections.has(connection));
1095
+ invariant4(this.connections.has(connection), void 0, {
1096
+ F: __dxlog_file5,
1097
+ L: 90,
1098
+ S: this,
1099
+ A: [
1100
+ "this.connections.has(connection)",
1101
+ ""
1102
+ ]
1103
+ });
916
1104
  await this.onClose(connection);
917
1105
  await connection.teleport.close();
918
1106
  this.connections.delete(connection);
@@ -927,7 +1115,7 @@ var pipeStreams = (stream1, stream2) => {
927
1115
  pipeline(stream1, stream2, (err) => {
928
1116
  if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
929
1117
  log4.catch(err, void 0, {
930
- F: __dxlog_file4,
1118
+ F: __dxlog_file5,
931
1119
  L: 106,
932
1120
  S: void 0,
933
1121
  C: (f, a) => f(...a)
@@ -937,7 +1125,7 @@ var pipeStreams = (stream1, stream2) => {
937
1125
  pipeline(stream2, stream1, (err) => {
938
1126
  if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
939
1127
  log4.catch(err, void 0, {
940
- F: __dxlog_file4,
1128
+ F: __dxlog_file5,
941
1129
  L: 111,
942
1130
  S: void 0,
943
1131
  C: (f, a) => f(...a)
@@ -959,12 +1147,12 @@ var TestConnection = class {
959
1147
  };
960
1148
 
961
1149
  // packages/core/mesh/teleport/src/testing/test-extension.ts
962
- import invariant5 from "tiny-invariant";
963
1150
  import { asyncTimeout as asyncTimeout2, Trigger as Trigger2 } from "@dxos/async";
1151
+ import { invariant as invariant5 } from "@dxos/invariant";
964
1152
  import { log as log5 } from "@dxos/log";
965
1153
  import { schema as schema3 } from "@dxos/protocols";
966
1154
  import { createProtoRpcPeer as createProtoRpcPeer2 } from "@dxos/rpc";
967
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension.ts";
1155
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension.ts";
968
1156
  var TestExtension = class {
969
1157
  constructor(callbacks = {}) {
970
1158
  this.callbacks = callbacks;
@@ -981,8 +1169,8 @@ var TestExtension = class {
981
1169
  localPeerId: context.localPeerId,
982
1170
  remotePeerId: context.remotePeerId
983
1171
  }, {
984
- F: __dxlog_file5,
985
- L: 33,
1172
+ F: __dxlog_file6,
1173
+ L: 32,
986
1174
  S: this,
987
1175
  C: (f, a) => f(...a)
988
1176
  });
@@ -1019,8 +1207,8 @@ var TestExtension = class {
1019
1207
  log5("onClose", {
1020
1208
  err
1021
1209
  }, {
1022
- F: __dxlog_file5,
1023
- L: 67,
1210
+ F: __dxlog_file6,
1211
+ L: 66,
1024
1212
  S: this,
1025
1213
  C: (f, a) => f(...a)
1026
1214
  });
@@ -1035,7 +1223,15 @@ var TestExtension = class {
1035
1223
  const res = await asyncTimeout2(this._rpc.rpc.TestService.testCall({
1036
1224
  data: message
1037
1225
  }), 1500);
1038
- invariant5(res.data === message);
1226
+ invariant5(res.data === message, void 0, {
1227
+ F: __dxlog_file6,
1228
+ L: 75,
1229
+ S: this,
1230
+ A: [
1231
+ "res.data === message",
1232
+ ""
1233
+ ]
1234
+ });
1039
1235
  }
1040
1236
  /**
1041
1237
  * Force-close the connection.
@@ -1047,13 +1243,13 @@ var TestExtension = class {
1047
1243
  };
1048
1244
 
1049
1245
  // packages/core/mesh/teleport/src/testing/test-extension-with-streams.ts
1050
- import assert from "@dxos/node-std/assert";
1051
1246
  import { randomBytes } from "@dxos/node-std/crypto";
1052
1247
  import { Trigger as Trigger3 } from "@dxos/async";
1248
+ import { invariant as invariant6 } from "@dxos/invariant";
1053
1249
  import { log as log6 } from "@dxos/log";
1054
1250
  import { schema as schema4 } from "@dxos/protocols";
1055
1251
  import { createProtoRpcPeer as createProtoRpcPeer3 } from "@dxos/rpc";
1056
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension-with-streams.ts";
1252
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension-with-streams.ts";
1057
1253
  var TestExtensionWithStreams = class {
1058
1254
  constructor(callbacks = {}) {
1059
1255
  this.callbacks = callbacks;
@@ -1066,7 +1262,15 @@ var TestExtensionWithStreams = class {
1066
1262
  return (_a = this.extensionContext) == null ? void 0 : _a.remotePeerId;
1067
1263
  }
1068
1264
  async _openStream(streamTag, interval = 5, chunkSize = 2048) {
1069
- assert(!this._streams.has(streamTag), `Stream already exists: ${streamTag}`);
1265
+ invariant6(!this._streams.has(streamTag), `Stream already exists: ${streamTag}`, {
1266
+ F: __dxlog_file7,
1267
+ L: 37,
1268
+ S: this,
1269
+ A: [
1270
+ "!this._streams.has(streamTag)",
1271
+ "`Stream already exists: ${streamTag}`"
1272
+ ]
1273
+ });
1070
1274
  const networkStream = await this.extensionContext.createStream(streamTag, {
1071
1275
  contentType: "application/x-test-stream"
1072
1276
  });
@@ -1117,7 +1321,7 @@ var TestExtensionWithStreams = class {
1117
1321
  from: (_a = this.extensionContext) == null ? void 0 : _a.localPeerId,
1118
1322
  to: (_b = this.extensionContext) == null ? void 0 : _b.remotePeerId
1119
1323
  }, {
1120
- F: __dxlog_file6,
1324
+ F: __dxlog_file7,
1121
1325
  L: 91,
1122
1326
  S: this,
1123
1327
  C: (f, a) => f(...a)
@@ -1125,7 +1329,15 @@ var TestExtensionWithStreams = class {
1125
1329
  }, 100);
1126
1330
  }
1127
1331
  _closeStream(streamTag) {
1128
- assert(this._streams.has(streamTag), `Stream does not exist: ${streamTag}`);
1332
+ invariant6(this._streams.has(streamTag), `Stream does not exist: ${streamTag}`, {
1333
+ F: __dxlog_file7,
1334
+ L: 104,
1335
+ S: this,
1336
+ A: [
1337
+ "this._streams.has(streamTag)",
1338
+ "`Stream does not exist: ${streamTag}`"
1339
+ ]
1340
+ });
1129
1341
  const stream = this._streams.get(streamTag);
1130
1342
  clearTimeout(stream.timer);
1131
1343
  clearTimeout(stream.reportingTimer);
@@ -1146,7 +1358,7 @@ var TestExtensionWithStreams = class {
1146
1358
  localPeerId: context.localPeerId,
1147
1359
  remotePeerId: context.remotePeerId
1148
1360
  }, {
1149
- F: __dxlog_file6,
1361
+ F: __dxlog_file7,
1150
1362
  L: 126,
1151
1363
  S: this,
1152
1364
  C: (f, a) => f(...a)
@@ -1196,7 +1408,7 @@ var TestExtensionWithStreams = class {
1196
1408
  log6("onClose", {
1197
1409
  err
1198
1410
  }, {
1199
- F: __dxlog_file6,
1411
+ F: __dxlog_file7,
1200
1412
  L: 177,
1201
1413
  S: this,
1202
1414
  C: (f, a) => f(...a)
@@ -1207,7 +1419,7 @@ var TestExtensionWithStreams = class {
1207
1419
  log6("closing stream", {
1208
1420
  streamTag
1209
1421
  }, {
1210
- F: __dxlog_file6,
1422
+ F: __dxlog_file7,
1211
1423
  L: 181,
1212
1424
  S: this,
1213
1425
  C: (f, a) => f(...a)
@@ -1229,7 +1441,15 @@ var TestExtensionWithStreams = class {
1229
1441
  streamLoadInterval,
1230
1442
  streamLoadChunkSize
1231
1443
  });
1232
- assert(data === streamTag);
1444
+ invariant6(data === streamTag, void 0, {
1445
+ F: __dxlog_file7,
1446
+ L: 198,
1447
+ S: this,
1448
+ A: [
1449
+ "data === streamTag",
1450
+ ""
1451
+ ]
1452
+ });
1233
1453
  await this._openStream(streamTag, streamLoadInterval, streamLoadChunkSize);
1234
1454
  return streamTag;
1235
1455
  }
@@ -1240,7 +1460,15 @@ var TestExtensionWithStreams = class {
1240
1460
  const { data, bytesSent, bytesReceived, sendErrors, receiveErrors, runningTime } = await this._rpc.rpc.TestServiceWithStreams.closeTestStream({
1241
1461
  data: streamTag
1242
1462
  });
1243
- assert(data === streamTag);
1463
+ invariant6(data === streamTag, void 0, {
1464
+ F: __dxlog_file7,
1465
+ L: 211,
1466
+ S: this,
1467
+ A: [
1468
+ "data === streamTag",
1469
+ ""
1470
+ ]
1471
+ });
1244
1472
  const local = this._closeStream(streamTag);
1245
1473
  return {
1246
1474
  streamTag,
@@ -1277,4 +1505,4 @@ export {
1277
1505
  TestExtension,
1278
1506
  TestExtensionWithStreams
1279
1507
  };
1280
- //# sourceMappingURL=chunk-GGVQ27WJ.mjs.map
1508
+ //# sourceMappingURL=chunk-3FNN6ZOF.mjs.map