@dxos/messaging 0.1.56-main.d4dc79c → 0.1.56-main.d9d1c3e

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.
@@ -39,9 +39,9 @@ __export(src_exports, {
39
39
  module.exports = __toCommonJS(src_exports);
40
40
 
41
41
  // packages/core/mesh/messaging/src/messenger.ts
42
- var import_tiny_invariant = __toESM(require("tiny-invariant"));
43
42
  var import_async = require("@dxos/async");
44
43
  var import_context = require("@dxos/context");
44
+ var import_invariant = require("@dxos/invariant");
45
45
  var import_keys = require("@dxos/keys");
46
46
  var import_log = require("@dxos/log");
47
47
  var import_protocols = require("@dxos/protocols");
@@ -76,14 +76,14 @@ var Messenger = class {
76
76
  id: traceId
77
77
  }), {
78
78
  F: __dxlog_file,
79
- L: 63,
79
+ L: 62,
80
80
  S: this,
81
81
  C: (f, a) => f(...a)
82
82
  });
83
83
  this._ctx = new import_context.Context({
84
84
  onError: (err) => import_log.log.catch(err, void 0, {
85
85
  F: __dxlog_file,
86
- L: 65,
86
+ L: 64,
87
87
  S: this,
88
88
  C: (f, a) => f(...a)
89
89
  })
@@ -93,7 +93,7 @@ var Messenger = class {
93
93
  from: message.author
94
94
  }, {
95
95
  F: __dxlog_file,
96
- L: 69,
96
+ L: 68,
97
97
  S: this,
98
98
  C: (f, a) => f(...a)
99
99
  });
@@ -104,7 +104,7 @@ var Messenger = class {
104
104
  id: traceId
105
105
  }), {
106
106
  F: __dxlog_file,
107
- L: 74,
107
+ L: 73,
108
108
  S: this,
109
109
  C: (f, a) => f(...a)
110
110
  });
@@ -117,20 +117,36 @@ var Messenger = class {
117
117
  await this._ctx.dispose();
118
118
  }
119
119
  async sendMessage({ author, recipient, payload }) {
120
- (0, import_tiny_invariant.default)(!this._closed, "Closed");
120
+ (0, import_invariant.invariant)(!this._closed, "Closed", {
121
+ F: __dxlog_file,
122
+ L: 85,
123
+ S: this,
124
+ A: [
125
+ "!this._closed",
126
+ "'Closed'"
127
+ ]
128
+ });
121
129
  const messageContext = this._ctx.derive();
122
130
  const reliablePayload = {
123
131
  messageId: import_keys.PublicKey.random(),
124
132
  payload
125
133
  };
126
- (0, import_tiny_invariant.default)(!this._onAckCallbacks.has(reliablePayload.messageId));
134
+ (0, import_invariant.invariant)(!this._onAckCallbacks.has(reliablePayload.messageId), void 0, {
135
+ F: __dxlog_file,
136
+ L: 92,
137
+ S: this,
138
+ A: [
139
+ "!this._onAckCallbacks.has(reliablePayload.messageId!)",
140
+ ""
141
+ ]
142
+ });
127
143
  (0, import_log.log)("send message", {
128
144
  messageId: reliablePayload.messageId,
129
145
  author,
130
146
  recipient
131
147
  }, {
132
148
  F: __dxlog_file,
133
- L: 94,
149
+ L: 93,
134
150
  S: this,
135
151
  C: (f, a) => f(...a)
136
152
  });
@@ -145,7 +161,7 @@ var Messenger = class {
145
161
  messageId: reliablePayload.messageId
146
162
  }, {
147
163
  F: __dxlog_file,
148
- L: 108,
164
+ L: 107,
149
165
  S: this,
150
166
  C: (f, a) => f(...a)
151
167
  });
@@ -157,7 +173,7 @@ var Messenger = class {
157
173
  err
158
174
  }, {
159
175
  F: __dxlog_file,
160
- L: 110,
176
+ L: 109,
161
177
  S: this,
162
178
  C: (f, a) => f(...a)
163
179
  }));
@@ -167,7 +183,7 @@ var Messenger = class {
167
183
  messageId: reliablePayload.messageId
168
184
  }, {
169
185
  F: __dxlog_file,
170
- L: 119,
186
+ L: 118,
171
187
  S: this,
172
188
  C: (f, a) => f(...a)
173
189
  });
@@ -192,7 +208,15 @@ var Messenger = class {
192
208
  * @param payloadType if not specified, onMessage will be subscribed to all types of messages.
193
209
  */
194
210
  async listen({ peerId, payloadType, onMessage }) {
195
- (0, import_tiny_invariant.default)(!this._closed, "Closed");
211
+ (0, import_invariant.invariant)(!this._closed, "Closed", {
212
+ F: __dxlog_file,
213
+ L: 150,
214
+ S: this,
215
+ A: [
216
+ "!this._closed",
217
+ "'Closed'"
218
+ ]
219
+ });
196
220
  await this._signalManager.subscribeMessages(peerId);
197
221
  let listeners;
198
222
  if (!payloadType) {
@@ -248,7 +272,15 @@ var Messenger = class {
248
272
  }
249
273
  }
250
274
  async _handleReliablePayload({ author, recipient, payload }) {
251
- (0, import_tiny_invariant.default)(payload.type_url === "dxos.mesh.messaging.ReliablePayload");
275
+ (0, import_invariant.invariant)(payload.type_url === "dxos.mesh.messaging.ReliablePayload", void 0, {
276
+ F: __dxlog_file,
277
+ L: 211,
278
+ S: this,
279
+ A: [
280
+ "payload.type_url === 'dxos.mesh.messaging.ReliablePayload'",
281
+ ""
282
+ ]
283
+ });
252
284
  const reliablePayload = ReliablePayload.decode(payload.value, {
253
285
  preserveAny: true
254
286
  });
@@ -256,7 +288,7 @@ var Messenger = class {
256
288
  messageId: reliablePayload.messageId
257
289
  }, {
258
290
  F: __dxlog_file,
259
- L: 215,
291
+ L: 214,
260
292
  S: this,
261
293
  C: (f, a) => f(...a)
262
294
  });
@@ -277,7 +309,15 @@ var Messenger = class {
277
309
  }
278
310
  async _handleAcknowledgement({ payload }) {
279
311
  var _a;
280
- (0, import_tiny_invariant.default)(payload.type_url === "dxos.mesh.messaging.Acknowledgement");
312
+ (0, import_invariant.invariant)(payload.type_url === "dxos.mesh.messaging.Acknowledgement", void 0, {
313
+ F: __dxlog_file,
314
+ L: 236,
315
+ S: this,
316
+ A: [
317
+ "payload.type_url === 'dxos.mesh.messaging.Acknowledgement'",
318
+ ""
319
+ ]
320
+ });
281
321
  (_a = this._onAckCallbacks.get(Acknowledgement.decode(payload.value).messageId)) == null ? void 0 : _a();
282
322
  }
283
323
  async _sendAcknowledgement({ author, recipient, messageId }) {
@@ -287,7 +327,7 @@ var Messenger = class {
287
327
  to: author
288
328
  }, {
289
329
  F: __dxlog_file,
290
- L: 250,
330
+ L: 249,
291
331
  S: this,
292
332
  C: (f, a) => f(...a)
293
333
  });
@@ -326,9 +366,9 @@ var Messenger = class {
326
366
  };
327
367
 
328
368
  // packages/core/mesh/messaging/src/signal-client/signal-client.ts
329
- var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
330
369
  var import_async3 = require("@dxos/async");
331
370
  var import_context2 = require("@dxos/context");
371
+ var import_invariant3 = require("@dxos/invariant");
332
372
  var import_keys3 = require("@dxos/keys");
333
373
  var import_log3 = require("@dxos/log");
334
374
  var import_protocols3 = require("@dxos/protocols");
@@ -337,8 +377,8 @@ var import_util2 = require("@dxos/util");
337
377
 
338
378
  // packages/core/mesh/messaging/src/signal-client/signal-rpc-client.ts
339
379
  var import_isomorphic_ws = __toESM(require("isomorphic-ws"));
340
- var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
341
380
  var import_async2 = require("@dxos/async");
381
+ var import_invariant2 = require("@dxos/invariant");
342
382
  var import_keys2 = require("@dxos/keys");
343
383
  var import_log2 = require("@dxos/log");
344
384
  var import_protocols2 = require("@dxos/protocols");
@@ -484,8 +524,24 @@ var SignalRPCClient = class {
484
524
  C: (f, a) => f(...a)
485
525
  });
486
526
  await this._connectTrigger.wait();
487
- (0, import_tiny_invariant2.default)(!this._closed, "SignalRPCClient is closed");
488
- (0, import_tiny_invariant2.default)(this._rpc, "Rpc is not initialized");
527
+ (0, import_invariant2.invariant)(!this._closed, "SignalRPCClient is closed", {
528
+ F: __dxlog_file2,
529
+ L: 138,
530
+ S: this,
531
+ A: [
532
+ "!this._closed",
533
+ "'SignalRPCClient is closed'"
534
+ ]
535
+ });
536
+ (0, import_invariant2.invariant)(this._rpc, "Rpc is not initialized", {
537
+ F: __dxlog_file2,
538
+ L: 139,
539
+ S: this,
540
+ A: [
541
+ "this._rpc",
542
+ "'Rpc is not initialized'"
543
+ ]
544
+ });
489
545
  const swarmStream = this._rpc.rpc.Signal.join({
490
546
  swarm: topic.asUint8Array(),
491
547
  peer: peerId.asUint8Array()
@@ -502,9 +558,25 @@ var SignalRPCClient = class {
502
558
  S: this,
503
559
  C: (f, a) => f(...a)
504
560
  });
505
- (0, import_tiny_invariant2.default)(!this._closed, "SignalRPCClient is closed");
561
+ (0, import_invariant2.invariant)(!this._closed, "SignalRPCClient is closed", {
562
+ F: __dxlog_file2,
563
+ L: 150,
564
+ S: this,
565
+ A: [
566
+ "!this._closed",
567
+ "'SignalRPCClient is closed'"
568
+ ]
569
+ });
506
570
  await this._connectTrigger.wait();
507
- (0, import_tiny_invariant2.default)(this._rpc, "Rpc is not initialized");
571
+ (0, import_invariant2.invariant)(this._rpc, "Rpc is not initialized", {
572
+ F: __dxlog_file2,
573
+ L: 152,
574
+ S: this,
575
+ A: [
576
+ "this._rpc",
577
+ "'Rpc is not initialized'"
578
+ ]
579
+ });
508
580
  const messageStream = this._rpc.rpc.Signal.receiveMessages({
509
581
  peer: peerId.asUint8Array()
510
582
  });
@@ -522,9 +594,25 @@ var SignalRPCClient = class {
522
594
  S: this,
523
595
  C: (f, a) => f(...a)
524
596
  });
525
- (0, import_tiny_invariant2.default)(!this._closed, "SignalRPCClient is closed");
597
+ (0, import_invariant2.invariant)(!this._closed, "SignalRPCClient is closed", {
598
+ F: __dxlog_file2,
599
+ L: 162,
600
+ S: this,
601
+ A: [
602
+ "!this._closed",
603
+ "'SignalRPCClient is closed'"
604
+ ]
605
+ });
526
606
  await this._connectTrigger.wait();
527
- (0, import_tiny_invariant2.default)(this._rpc, "Rpc is not initialized");
607
+ (0, import_invariant2.invariant)(this._rpc, "Rpc is not initialized", {
608
+ F: __dxlog_file2,
609
+ L: 164,
610
+ S: this,
611
+ A: [
612
+ "this._rpc",
613
+ "'Rpc is not initialized'"
614
+ ]
615
+ });
528
616
  await this._rpc.rpc.Signal.sendMessage({
529
617
  author: author.asUint8Array(),
530
618
  recipient: recipient.asUint8Array(),
@@ -577,7 +665,7 @@ var SignalClient = class {
577
665
  id: this._instanceId
578
666
  }), {
579
667
  F: __dxlog_file3,
580
- L: 136,
668
+ L: 135,
581
669
  S: this,
582
670
  C: (f, a) => f(...a)
583
671
  });
@@ -596,7 +684,7 @@ var SignalClient = class {
596
684
  if (this._state === import_signal.SignalState.CONNECTED) {
597
685
  import_log3.log.warn("SignalClient error:", err, {
598
686
  F: __dxlog_file3,
599
- L: 148,
687
+ L: 147,
600
688
  S: this,
601
689
  C: (f, a) => f(...a)
602
690
  });
@@ -623,7 +711,7 @@ var SignalClient = class {
623
711
  id: this._instanceId
624
712
  }), {
625
713
  F: __dxlog_file3,
626
- L: 177,
714
+ L: 176,
627
715
  S: this,
628
716
  C: (f, a) => f(...a)
629
717
  });
@@ -632,7 +720,7 @@ var SignalClient = class {
632
720
  var _a, _b;
633
721
  (0, import_log3.log)("closing...", void 0, {
634
722
  F: __dxlog_file3,
635
- L: 181,
723
+ L: 180,
636
724
  S: this,
637
725
  C: (f, a) => f(...a)
638
726
  });
@@ -648,7 +736,7 @@ var SignalClient = class {
648
736
  this._setState(import_signal.SignalState.CLOSED);
649
737
  (0, import_log3.log)("closed", void 0, {
650
738
  F: __dxlog_file3,
651
- L: 192,
739
+ L: 191,
652
740
  S: this,
653
741
  C: (f, a) => f(...a)
654
742
  });
@@ -670,7 +758,7 @@ var SignalClient = class {
670
758
  peerId
671
759
  }, {
672
760
  F: __dxlog_file3,
673
- L: 207,
761
+ L: 206,
674
762
  S: this,
675
763
  C: (f, a) => f(...a)
676
764
  });
@@ -689,7 +777,7 @@ var SignalClient = class {
689
777
  peerId
690
778
  }, {
691
779
  F: __dxlog_file3,
692
- L: 215,
780
+ L: 214,
693
781
  S: this,
694
782
  C: (f, a) => f(...a)
695
783
  });
@@ -709,7 +797,15 @@ var SignalClient = class {
709
797
  async sendMessage(msg) {
710
798
  this._performance.sentMessages++;
711
799
  await this._clientReady.wait();
712
- (0, import_tiny_invariant3.default)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server");
800
+ (0, import_invariant3.invariant)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server", {
801
+ F: __dxlog_file3,
802
+ L: 224,
803
+ S: this,
804
+ A: [
805
+ "this._state === SignalState.CONNECTED",
806
+ "'Not connected to Signal Server'"
807
+ ]
808
+ });
713
809
  await this._client.sendMessage(msg);
714
810
  }
715
811
  async subscribeMessages(peerId) {
@@ -717,7 +813,7 @@ var SignalClient = class {
717
813
  peerId
718
814
  }, {
719
815
  F: __dxlog_file3,
720
- L: 230,
816
+ L: 229,
721
817
  S: this,
722
818
  C: (f, a) => f(...a)
723
819
  });
@@ -732,7 +828,7 @@ var SignalClient = class {
732
828
  peerId
733
829
  }, {
734
830
  F: __dxlog_file3,
735
- L: 236,
831
+ L: 235,
736
832
  S: this,
737
833
  C: (f, a) => f(...a)
738
834
  });
@@ -754,7 +850,7 @@ var SignalClient = class {
754
850
  status: this.getStatus()
755
851
  }, {
756
852
  F: __dxlog_file3,
757
- L: 255,
853
+ L: 254,
758
854
  S: this,
759
855
  C: (f, a) => f(...a)
760
856
  });
@@ -766,17 +862,25 @@ var SignalClient = class {
766
862
  state: this._state
767
863
  }, {
768
864
  F: __dxlog_file3,
769
- L: 260,
865
+ L: 259,
770
866
  S: this,
771
867
  C: (f, a) => f(...a)
772
868
  });
773
- (0, import_tiny_invariant3.default)(!this._client, "Client already created");
869
+ (0, import_invariant3.invariant)(!this._client, "Client already created", {
870
+ F: __dxlog_file3,
871
+ L: 260,
872
+ S: this,
873
+ A: [
874
+ "!this._client",
875
+ "'Client already created'"
876
+ ]
877
+ });
774
878
  this._connectionStarted = new Date();
775
879
  this._connectionCtx = this._ctx.derive();
776
880
  this._connectionCtx.onDispose(() => {
777
881
  (0, import_log3.log)("connection context disposed", void 0, {
778
882
  F: __dxlog_file3,
779
- L: 268,
883
+ L: 267,
780
884
  S: this,
781
885
  C: (f, a) => f(...a)
782
886
  });
@@ -792,7 +896,7 @@ var SignalClient = class {
792
896
  onConnected: () => {
793
897
  (0, import_log3.log)("socket connected", void 0, {
794
898
  F: __dxlog_file3,
795
- L: 280,
899
+ L: 279,
796
900
  S: this,
797
901
  C: (f, a) => f(...a)
798
902
  });
@@ -807,7 +911,7 @@ var SignalClient = class {
807
911
  state: this._state
808
912
  }, {
809
913
  F: __dxlog_file3,
810
- L: 289,
914
+ L: 288,
811
915
  S: this,
812
916
  C: (f, a) => f(...a)
813
917
  });
@@ -827,7 +931,7 @@ var SignalClient = class {
827
931
  state: this._state
828
932
  }, {
829
933
  F: __dxlog_file3,
830
- L: 304,
934
+ L: 303,
831
935
  S: this,
832
936
  C: (f, a) => f(...a)
833
937
  });
@@ -859,7 +963,7 @@ var SignalClient = class {
859
963
  state: this._state
860
964
  }, {
861
965
  F: __dxlog_file3,
862
- L: 331,
966
+ L: 330,
863
967
  S: this,
864
968
  C: (f, a) => f(...a)
865
969
  });
@@ -867,7 +971,7 @@ var SignalClient = class {
867
971
  if (this._state === import_signal.SignalState.RECONNECTING) {
868
972
  import_log3.log.warn("Signal api already reconnecting.", void 0, {
869
973
  F: __dxlog_file3,
870
- L: 335,
974
+ L: 334,
871
975
  S: this,
872
976
  C: (f, a) => f(...a)
873
977
  });
@@ -889,7 +993,15 @@ var SignalClient = class {
889
993
  var _a;
890
994
  await (0, import_async3.asyncTimeout)((0, import_context2.cancelWithContext)(this._connectionCtx, this._clientReady.wait()), 5e3);
891
995
  const client = this._client;
892
- (0, import_tiny_invariant3.default)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server");
996
+ (0, import_invariant3.invariant)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server", {
997
+ F: __dxlog_file3,
998
+ L: 359,
999
+ S: this,
1000
+ A: [
1001
+ "this._state === SignalState.CONNECTED",
1002
+ "'Not connected to Signal Server'"
1003
+ ]
1004
+ });
893
1005
  for (const { topic, peerId } of this._swarmStreams.keys()) {
894
1006
  if (this._joinedTopics.has({
895
1007
  topic,
@@ -922,7 +1034,7 @@ var SignalClient = class {
922
1034
  swarmEvent
923
1035
  }, {
924
1036
  F: __dxlog_file3,
925
- L: 387,
1037
+ L: 386,
926
1038
  S: this,
927
1039
  C: (f, a) => f(...a)
928
1040
  });
@@ -941,7 +1053,15 @@ var SignalClient = class {
941
1053
  var _a;
942
1054
  await (0, import_async3.asyncTimeout)((0, import_context2.cancelWithContext)(this._connectionCtx, this._clientReady.wait()), 5e3);
943
1055
  const client = this._client;
944
- (0, import_tiny_invariant3.default)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server");
1056
+ (0, import_invariant3.invariant)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server", {
1057
+ F: __dxlog_file3,
1058
+ L: 399,
1059
+ S: this,
1060
+ A: [
1061
+ "this._state === SignalState.CONNECTED",
1062
+ "'Not connected to Signal Server'"
1063
+ ]
1064
+ });
945
1065
  for (const peerId of this._messageStreams.keys()) {
946
1066
  if (this._subscribedMessages.has({
947
1067
  peerId
@@ -970,9 +1090,9 @@ var SignalClient = class {
970
1090
  };
971
1091
 
972
1092
  // packages/core/mesh/messaging/src/signal-manager/memory-signal-manager.ts
973
- var import_tiny_invariant4 = __toESM(require("tiny-invariant"));
974
1093
  var import_async4 = require("@dxos/async");
975
1094
  var import_context3 = require("@dxos/context");
1095
+ var import_invariant4 = require("@dxos/invariant");
976
1096
  var import_keys4 = require("@dxos/keys");
977
1097
  var import_log4 = require("@dxos/log");
978
1098
  var import_protocols4 = require("@dxos/protocols");
@@ -1028,7 +1148,15 @@ var MemorySignalManager = class {
1028
1148
  return [];
1029
1149
  }
1030
1150
  async join({ topic, peerId }) {
1031
- (0, import_tiny_invariant4.default)(!this._ctx.disposed, "Closed");
1151
+ (0, import_invariant4.invariant)(!this._ctx.disposed, "Closed", {
1152
+ F: __dxlog_file4,
1153
+ L: 104,
1154
+ S: this,
1155
+ A: [
1156
+ "!this._ctx.disposed",
1157
+ "'Closed'"
1158
+ ]
1159
+ });
1032
1160
  this._joinedSwarms.add({
1033
1161
  topic,
1034
1162
  peerId
@@ -1061,7 +1189,15 @@ var MemorySignalManager = class {
1061
1189
  }
1062
1190
  }
1063
1191
  async leave({ topic, peerId }) {
1064
- (0, import_tiny_invariant4.default)(!this._ctx.disposed, "Closed");
1192
+ (0, import_invariant4.invariant)(!this._ctx.disposed, "Closed", {
1193
+ F: __dxlog_file4,
1194
+ L: 140,
1195
+ S: this,
1196
+ A: [
1197
+ "!this._ctx.disposed",
1198
+ "'Closed'"
1199
+ ]
1200
+ });
1065
1201
  this._joinedSwarms.delete({
1066
1202
  topic,
1067
1203
  peerId
@@ -1087,12 +1223,28 @@ var MemorySignalManager = class {
1087
1223
  ...dec(payload)
1088
1224
  }, {
1089
1225
  F: __dxlog_file4,
1090
- L: 161,
1226
+ L: 160,
1091
1227
  S: this,
1092
1228
  C: (f, a) => f(...a)
1093
1229
  });
1094
- (0, import_tiny_invariant4.default)(recipient);
1095
- (0, import_tiny_invariant4.default)(!this._ctx.disposed, "Closed");
1230
+ (0, import_invariant4.invariant)(recipient, void 0, {
1231
+ F: __dxlog_file4,
1232
+ L: 162,
1233
+ S: this,
1234
+ A: [
1235
+ "recipient",
1236
+ ""
1237
+ ]
1238
+ });
1239
+ (0, import_invariant4.invariant)(!this._ctx.disposed, "Closed", {
1240
+ F: __dxlog_file4,
1241
+ L: 163,
1242
+ S: this,
1243
+ A: [
1244
+ "!this._ctx.disposed",
1245
+ "'Closed'"
1246
+ ]
1247
+ });
1096
1248
  await this._freezeTrigger.wait();
1097
1249
  const remote = this._context.connections.get(recipient);
1098
1250
  if (!remote) {
@@ -1101,7 +1253,7 @@ var MemorySignalManager = class {
1101
1253
  recipient
1102
1254
  }, {
1103
1255
  F: __dxlog_file4,
1104
- L: 170,
1256
+ L: 169,
1105
1257
  S: this,
1106
1258
  C: (f, a) => f(...a)
1107
1259
  });
@@ -1113,7 +1265,7 @@ var MemorySignalManager = class {
1113
1265
  recipient
1114
1266
  }, {
1115
1267
  F: __dxlog_file4,
1116
- L: 175,
1268
+ L: 174,
1117
1269
  S: this,
1118
1270
  C: (f, a) => f(...a)
1119
1271
  });
@@ -1126,7 +1278,7 @@ var MemorySignalManager = class {
1126
1278
  recipient
1127
1279
  }, {
1128
1280
  F: __dxlog_file4,
1129
- L: 183,
1281
+ L: 182,
1130
1282
  S: this,
1131
1283
  C: (f, a) => f(...a)
1132
1284
  });
@@ -1138,7 +1290,7 @@ var MemorySignalManager = class {
1138
1290
  ...dec(payload)
1139
1291
  }, {
1140
1292
  F: __dxlog_file4,
1141
- L: 187,
1293
+ L: 186,
1142
1294
  S: this,
1143
1295
  C: (f, a) => f(...a)
1144
1296
  });
@@ -1152,7 +1304,7 @@ var MemorySignalManager = class {
1152
1304
  err
1153
1305
  }, {
1154
1306
  F: __dxlog_file4,
1155
- L: 192,
1307
+ L: 191,
1156
1308
  S: this,
1157
1309
  C: (f, a) => f(...a)
1158
1310
  });
@@ -1163,7 +1315,7 @@ var MemorySignalManager = class {
1163
1315
  peerId
1164
1316
  }, {
1165
1317
  F: __dxlog_file4,
1166
- L: 197,
1318
+ L: 196,
1167
1319
  S: this,
1168
1320
  C: (f, a) => f(...a)
1169
1321
  });
@@ -1174,7 +1326,7 @@ var MemorySignalManager = class {
1174
1326
  peerId
1175
1327
  }, {
1176
1328
  F: __dxlog_file4,
1177
- L: 202,
1329
+ L: 201,
1178
1330
  S: this,
1179
1331
  C: (f, a) => f(...a)
1180
1332
  });
@@ -1203,9 +1355,9 @@ var dec = (payload) => {
1203
1355
  };
1204
1356
 
1205
1357
  // packages/core/mesh/messaging/src/signal-manager/websocket-signal-manager.ts
1206
- var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
1207
1358
  var import_async5 = require("@dxos/async");
1208
1359
  var import_context4 = require("@dxos/context");
1360
+ var import_invariant5 = require("@dxos/invariant");
1209
1361
  var import_keys5 = require("@dxos/keys");
1210
1362
  var import_log5 = require("@dxos/log");
1211
1363
  var import_protocols5 = require("@dxos/protocols");
@@ -1235,7 +1387,7 @@ var WebsocketSignalManager = class {
1235
1387
  hosts: this._hosts
1236
1388
  }, {
1237
1389
  F: __dxlog_file5,
1238
- L: 47,
1390
+ L: 46,
1239
1391
  S: this,
1240
1392
  C: (f, a) => f(...a)
1241
1393
  });
@@ -1257,7 +1409,7 @@ var WebsocketSignalManager = class {
1257
1409
  hosts: this._hosts
1258
1410
  }, {
1259
1411
  F: __dxlog_file5,
1260
- L: 69,
1412
+ L: 68,
1261
1413
  S: this,
1262
1414
  C: (f, a) => f(...a)
1263
1415
  });
@@ -1265,7 +1417,7 @@ var WebsocketSignalManager = class {
1265
1417
  id: this._instanceId
1266
1418
  }), {
1267
1419
  F: __dxlog_file5,
1268
- L: 70,
1420
+ L: 69,
1269
1421
  S: this,
1270
1422
  C: (f, a) => f(...a)
1271
1423
  });
@@ -1278,7 +1430,7 @@ var WebsocketSignalManager = class {
1278
1430
  id: this._instanceId
1279
1431
  }), {
1280
1432
  F: __dxlog_file5,
1281
- L: 77,
1433
+ L: 76,
1282
1434
  S: this,
1283
1435
  C: (f, a) => f(...a)
1284
1436
  });
@@ -1300,11 +1452,19 @@ var WebsocketSignalManager = class {
1300
1452
  peerId
1301
1453
  }, {
1302
1454
  F: __dxlog_file5,
1303
- L: 97,
1455
+ L: 96,
1304
1456
  S: this,
1305
1457
  C: (f, a) => f(...a)
1306
1458
  });
1307
- (0, import_tiny_invariant5.default)(this._opened, "Closed");
1459
+ (0, import_invariant5.invariant)(this._opened, "Closed", {
1460
+ F: __dxlog_file5,
1461
+ L: 97,
1462
+ S: this,
1463
+ A: [
1464
+ "this._opened",
1465
+ "'Closed'"
1466
+ ]
1467
+ });
1308
1468
  await this._forEachServer((server) => server.join({
1309
1469
  topic,
1310
1470
  peerId
@@ -1316,11 +1476,19 @@ var WebsocketSignalManager = class {
1316
1476
  peerId
1317
1477
  }, {
1318
1478
  F: __dxlog_file5,
1319
- L: 104,
1479
+ L: 103,
1320
1480
  S: this,
1321
1481
  C: (f, a) => f(...a)
1322
1482
  });
1323
- (0, import_tiny_invariant5.default)(this._opened, "Closed");
1483
+ (0, import_invariant5.invariant)(this._opened, "Closed", {
1484
+ F: __dxlog_file5,
1485
+ L: 104,
1486
+ S: this,
1487
+ A: [
1488
+ "this._opened",
1489
+ "'Closed'"
1490
+ ]
1491
+ });
1324
1492
  await this._forEachServer((server) => server.leave({
1325
1493
  topic,
1326
1494
  peerId
@@ -1329,11 +1497,19 @@ var WebsocketSignalManager = class {
1329
1497
  async sendMessage({ author, recipient, payload }) {
1330
1498
  (0, import_log5.log)(`Signal ${recipient}`, void 0, {
1331
1499
  F: __dxlog_file5,
1332
- L: 119,
1500
+ L: 118,
1333
1501
  S: this,
1334
1502
  C: (f, a) => f(...a)
1335
1503
  });
1336
- (0, import_tiny_invariant5.default)(this._opened, "Closed");
1504
+ (0, import_invariant5.invariant)(this._opened, "Closed", {
1505
+ F: __dxlog_file5,
1506
+ L: 119,
1507
+ S: this,
1508
+ A: [
1509
+ "this._opened",
1510
+ "'Closed'"
1511
+ ]
1512
+ });
1337
1513
  void this._forEachServer(async (server) => {
1338
1514
  void server.sendMessage({
1339
1515
  author,
@@ -1341,7 +1517,7 @@ var WebsocketSignalManager = class {
1341
1517
  payload
1342
1518
  }).catch((err) => (0, import_log5.log)(err, void 0, {
1343
1519
  F: __dxlog_file5,
1344
- L: 123,
1520
+ L: 122,
1345
1521
  S: this,
1346
1522
  C: (f, a) => f(...a)
1347
1523
  }));
@@ -1350,28 +1526,44 @@ var WebsocketSignalManager = class {
1350
1526
  async subscribeMessages(peerId) {
1351
1527
  (0, import_log5.log)(`Subscribed for message stream peerId=${peerId}`, void 0, {
1352
1528
  F: __dxlog_file5,
1353
- L: 128,
1529
+ L: 127,
1354
1530
  S: this,
1355
1531
  C: (f, a) => f(...a)
1356
1532
  });
1357
- (0, import_tiny_invariant5.default)(this._opened, "Closed");
1533
+ (0, import_invariant5.invariant)(this._opened, "Closed", {
1534
+ F: __dxlog_file5,
1535
+ L: 128,
1536
+ S: this,
1537
+ A: [
1538
+ "this._opened",
1539
+ "'Closed'"
1540
+ ]
1541
+ });
1358
1542
  await this._forEachServer(async (server) => server.subscribeMessages(peerId));
1359
1543
  }
1360
1544
  async unsubscribeMessages(peerId) {
1361
1545
  (0, import_log5.log)(`Subscribed for message stream peerId=${peerId}`, void 0, {
1362
1546
  F: __dxlog_file5,
1363
- L: 135,
1547
+ L: 134,
1364
1548
  S: this,
1365
1549
  C: (f, a) => f(...a)
1366
1550
  });
1367
- (0, import_tiny_invariant5.default)(this._opened, "Closed");
1551
+ (0, import_invariant5.invariant)(this._opened, "Closed", {
1552
+ F: __dxlog_file5,
1553
+ L: 135,
1554
+ S: this,
1555
+ A: [
1556
+ "this._opened",
1557
+ "'Closed'"
1558
+ ]
1559
+ });
1368
1560
  await this._forEachServer(async (server) => server.unsubscribeMessages(peerId));
1369
1561
  }
1370
1562
  _initContext() {
1371
1563
  this._ctx = new import_context4.Context({
1372
1564
  onError: (err) => import_log5.log.catch(err, void 0, {
1373
1565
  F: __dxlog_file5,
1374
- L: 143,
1566
+ L: 142,
1375
1567
  S: this,
1376
1568
  C: (f, a) => f(...a)
1377
1569
  })