@dxos/messaging 0.6.8-main.3be982f → 0.6.8-staging.77f93a3
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.
- package/dist/lib/browser/index.mjs +466 -199
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +456 -197
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/messenger.blueprint-test.d.ts +4 -0
- package/dist/types/src/messenger.blueprint-test.d.ts.map +1 -0
- package/dist/types/src/messenger.d.ts +4 -10
- package/dist/types/src/messenger.d.ts.map +1 -1
- package/dist/types/src/signal-client/signal-client.d.ts +6 -10
- package/dist/types/src/signal-client/signal-client.d.ts.map +1 -1
- package/dist/types/src/signal-client/signal-local-state.d.ts +2 -10
- package/dist/types/src/signal-client/signal-local-state.d.ts.map +1 -1
- package/dist/types/src/signal-manager/edge-signal-manager.d.ts +18 -19
- package/dist/types/src/signal-manager/edge-signal-manager.d.ts.map +1 -1
- package/dist/types/src/signal-manager/index.d.ts +1 -0
- package/dist/types/src/signal-manager/index.d.ts.map +1 -1
- package/dist/types/src/signal-manager/memory-signal-manager.d.ts +14 -25
- package/dist/types/src/signal-manager/memory-signal-manager.d.ts.map +1 -1
- package/dist/types/src/signal-manager/signal-manager.d.ts +5 -6
- package/dist/types/src/signal-manager/signal-manager.d.ts.map +1 -1
- package/dist/types/src/signal-manager/websocket-signal-manager.d.ts +14 -29
- package/dist/types/src/signal-manager/websocket-signal-manager.d.ts.map +1 -1
- package/dist/types/src/signal-methods.d.ts +29 -14
- package/dist/types/src/signal-methods.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +5 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/test-builder.d.ts +19 -0
- package/dist/types/src/testing/test-builder.d.ts.map +1 -0
- package/dist/types/src/testing/test-messages.d.ts +6 -0
- package/dist/types/src/testing/test-messages.d.ts.map +1 -0
- package/dist/types/src/testing/test-peer.d.ts +23 -0
- package/dist/types/src/testing/test-peer.d.ts.map +1 -0
- package/dist/types/src/testing/utils.d.ts +10 -0
- package/dist/types/src/testing/utils.d.ts.map +1 -0
- package/package.json +15 -14
- package/src/messenger.blueprint-test.ts +346 -0
- package/src/messenger.test.ts +26 -362
- package/src/messenger.ts +20 -18
- package/src/signal-client/signal-client-monitor.ts +3 -3
- package/src/signal-client/signal-client.test.ts +56 -52
- package/src/signal-client/signal-client.ts +30 -16
- package/src/signal-client/signal-local-state.ts +28 -10
- package/src/signal-manager/edge-signal-manager.test.ts +31 -35
- package/src/signal-manager/edge-signal-manager.ts +88 -36
- package/src/signal-manager/index.ts +1 -0
- package/src/signal-manager/memory-signal-manager.ts +36 -50
- package/src/signal-manager/signal-manager.ts +5 -7
- package/src/signal-manager/websocket-signal-manager.test.ts +27 -31
- package/src/signal-manager/websocket-signal-manager.ts +34 -65
- package/src/signal-methods.ts +33 -11
- package/src/testing/index.ts +8 -0
- package/src/testing/test-builder.ts +54 -0
- package/src/testing/test-messages.ts +24 -0
- package/src/testing/test-peer.ts +66 -0
- package/src/testing/utils.ts +50 -0
- package/dist/types/src/testing.d.ts +0 -40
- package/dist/types/src/testing.d.ts.map +0 -1
- package/src/testing.ts +0 -120
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,9 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
+
EdgeSignalManager: () => EdgeSignalManager,
|
|
31
32
|
MemorySignalManager: () => MemorySignalManager,
|
|
32
33
|
MemorySignalManagerContext: () => MemorySignalManagerContext,
|
|
33
34
|
Messenger: () => Messenger,
|
|
35
|
+
PeerInfoHash: () => PeerInfoHash,
|
|
34
36
|
SignalClient: () => SignalClient,
|
|
35
37
|
WebsocketSignalManager: () => WebsocketSignalManager,
|
|
36
38
|
setIdentityTags: () => setIdentityTags
|
|
@@ -81,8 +83,18 @@ var import_log6 = require("@dxos/log");
|
|
|
81
83
|
var import_protocols5 = require("@dxos/protocols");
|
|
82
84
|
var import_util4 = require("@dxos/util");
|
|
83
85
|
var import_tracing4 = require("@dxos/tracing");
|
|
86
|
+
var import_wkt = require("@bufbuild/protobuf/wkt");
|
|
87
|
+
var import_async7 = require("@dxos/async");
|
|
88
|
+
var import_context7 = require("@dxos/context");
|
|
89
|
+
var import_edge_client = require("@dxos/edge-client");
|
|
84
90
|
var import_invariant6 = require("@dxos/invariant");
|
|
91
|
+
var import_keys7 = require("@dxos/keys");
|
|
85
92
|
var import_log7 = require("@dxos/log");
|
|
93
|
+
var import_protocols6 = require("@dxos/protocols");
|
|
94
|
+
var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
|
|
95
|
+
var import_util5 = require("@dxos/util");
|
|
96
|
+
var import_invariant7 = require("@dxos/invariant");
|
|
97
|
+
var import_log8 = require("@dxos/log");
|
|
86
98
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
87
99
|
var MessengerMonitor = class {
|
|
88
100
|
recordMessageAckFailed() {
|
|
@@ -105,8 +117,8 @@ var RECEIVED_MESSAGES_GC_INTERVAL = 12e4;
|
|
|
105
117
|
var Messenger = class {
|
|
106
118
|
constructor({ signalManager, retryDelay = 300 }) {
|
|
107
119
|
this._monitor = new MessengerMonitor();
|
|
108
|
-
this._listeners = new import_util.ComplexMap(({ peerId, payloadType }) => peerId
|
|
109
|
-
this._defaultListeners = new
|
|
120
|
+
this._listeners = new import_util.ComplexMap(({ peerId, payloadType }) => peerId + payloadType);
|
|
121
|
+
this._defaultListeners = /* @__PURE__ */ new Map();
|
|
110
122
|
this._onAckCallbacks = new import_util.ComplexMap(import_keys.PublicKey.hash);
|
|
111
123
|
this._receivedMessages = new import_util.ComplexSet(import_keys.PublicKey.hash);
|
|
112
124
|
this._toClear = new import_util.ComplexSet(import_keys.PublicKey.hash);
|
|
@@ -271,7 +283,7 @@ var Messenger = class {
|
|
|
271
283
|
* Subscribes onMessage function to messages that contains payload with payloadType.
|
|
272
284
|
* @param payloadType if not specified, onMessage will be subscribed to all types of messages.
|
|
273
285
|
*/
|
|
274
|
-
async listen({
|
|
286
|
+
async listen({ peer, payloadType, onMessage }) {
|
|
275
287
|
(0, import_invariant.invariant)(!this._closed, "Closed", {
|
|
276
288
|
F: __dxlog_file,
|
|
277
289
|
L: 177,
|
|
@@ -281,23 +293,32 @@ var Messenger = class {
|
|
|
281
293
|
"'Closed'"
|
|
282
294
|
]
|
|
283
295
|
});
|
|
284
|
-
await this._signalManager.subscribeMessages(
|
|
296
|
+
await this._signalManager.subscribeMessages(peer);
|
|
285
297
|
let listeners;
|
|
298
|
+
(0, import_invariant.invariant)(peer.peerKey, "Peer key is required", {
|
|
299
|
+
F: __dxlog_file,
|
|
300
|
+
L: 181,
|
|
301
|
+
S: this,
|
|
302
|
+
A: [
|
|
303
|
+
"peer.peerKey",
|
|
304
|
+
"'Peer key is required'"
|
|
305
|
+
]
|
|
306
|
+
});
|
|
286
307
|
if (!payloadType) {
|
|
287
|
-
listeners = this._defaultListeners.get(
|
|
308
|
+
listeners = this._defaultListeners.get(peer.peerKey);
|
|
288
309
|
if (!listeners) {
|
|
289
310
|
listeners = /* @__PURE__ */ new Set();
|
|
290
|
-
this._defaultListeners.set(
|
|
311
|
+
this._defaultListeners.set(peer.peerKey, listeners);
|
|
291
312
|
}
|
|
292
313
|
} else {
|
|
293
314
|
listeners = this._listeners.get({
|
|
294
|
-
peerId,
|
|
315
|
+
peerId: peer.peerKey,
|
|
295
316
|
payloadType
|
|
296
317
|
});
|
|
297
318
|
if (!listeners) {
|
|
298
319
|
listeners = /* @__PURE__ */ new Set();
|
|
299
320
|
this._listeners.set({
|
|
300
|
-
peerId,
|
|
321
|
+
peerId: peer.peerKey,
|
|
301
322
|
payloadType
|
|
302
323
|
}, listeners);
|
|
303
324
|
}
|
|
@@ -338,7 +359,7 @@ var Messenger = class {
|
|
|
338
359
|
async _handleReliablePayload({ author, recipient, payload }) {
|
|
339
360
|
(0, import_invariant.invariant)(payload.type_url === "dxos.mesh.messaging.ReliablePayload", void 0, {
|
|
340
361
|
F: __dxlog_file,
|
|
341
|
-
L:
|
|
362
|
+
L: 239,
|
|
342
363
|
S: this,
|
|
343
364
|
A: [
|
|
344
365
|
"payload.type_url === 'dxos.mesh.messaging.ReliablePayload'",
|
|
@@ -352,7 +373,7 @@ var Messenger = class {
|
|
|
352
373
|
messageId: reliablePayload.messageId
|
|
353
374
|
}, {
|
|
354
375
|
F: __dxlog_file,
|
|
355
|
-
L:
|
|
376
|
+
L: 242,
|
|
356
377
|
S: this,
|
|
357
378
|
C: (f, a) => f(...a)
|
|
358
379
|
});
|
|
@@ -379,7 +400,7 @@ var Messenger = class {
|
|
|
379
400
|
async _handleAcknowledgement({ payload }) {
|
|
380
401
|
(0, import_invariant.invariant)(payload.type_url === "dxos.mesh.messaging.Acknowledgement", void 0, {
|
|
381
402
|
F: __dxlog_file,
|
|
382
|
-
L:
|
|
403
|
+
L: 270,
|
|
383
404
|
S: this,
|
|
384
405
|
A: [
|
|
385
406
|
"payload.type_url === 'dxos.mesh.messaging.Acknowledgement'",
|
|
@@ -395,7 +416,7 @@ var Messenger = class {
|
|
|
395
416
|
to: author
|
|
396
417
|
}, {
|
|
397
418
|
F: __dxlog_file,
|
|
398
|
-
L:
|
|
419
|
+
L: 283,
|
|
399
420
|
S: this,
|
|
400
421
|
C: (f, a) => f(...a)
|
|
401
422
|
});
|
|
@@ -412,7 +433,16 @@ var Messenger = class {
|
|
|
412
433
|
}
|
|
413
434
|
async _callListeners(message) {
|
|
414
435
|
{
|
|
415
|
-
|
|
436
|
+
(0, import_invariant.invariant)(message.recipient.peerKey, "Peer key is required", {
|
|
437
|
+
F: __dxlog_file,
|
|
438
|
+
L: 297,
|
|
439
|
+
S: this,
|
|
440
|
+
A: [
|
|
441
|
+
"message.recipient.peerKey",
|
|
442
|
+
"'Peer key is required'"
|
|
443
|
+
]
|
|
444
|
+
});
|
|
445
|
+
const defaultListenerMap = this._defaultListeners.get(message.recipient.peerKey);
|
|
416
446
|
if (defaultListenerMap) {
|
|
417
447
|
for (const listener of defaultListenerMap) {
|
|
418
448
|
await listener(message);
|
|
@@ -421,7 +451,7 @@ var Messenger = class {
|
|
|
421
451
|
}
|
|
422
452
|
{
|
|
423
453
|
const listenerMap = this._listeners.get({
|
|
424
|
-
peerId: message.recipient,
|
|
454
|
+
peerId: message.recipient.peerKey,
|
|
425
455
|
payloadType: message.payload.type_url
|
|
426
456
|
});
|
|
427
457
|
if (listenerMap) {
|
|
@@ -446,7 +476,7 @@ var Messenger = class {
|
|
|
446
476
|
elapsed
|
|
447
477
|
}, {
|
|
448
478
|
F: __dxlog_file,
|
|
449
|
-
L:
|
|
479
|
+
L: 332,
|
|
450
480
|
S: this,
|
|
451
481
|
C: (f, a) => f(...a)
|
|
452
482
|
});
|
|
@@ -536,11 +566,11 @@ var SignalClientMonitor = class {
|
|
|
536
566
|
}
|
|
537
567
|
};
|
|
538
568
|
var getByteCount = (message) => {
|
|
539
|
-
return message.author.
|
|
569
|
+
return message.author.peerKey.length + message.recipient.peerKey.length + message.payload.type_url.length + message.payload.value.length;
|
|
540
570
|
};
|
|
541
571
|
var createIdentityTags = (message) => {
|
|
542
572
|
return {
|
|
543
|
-
peer: message.author.
|
|
573
|
+
peer: message.author.peerKey
|
|
544
574
|
};
|
|
545
575
|
};
|
|
546
576
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-client/signal-local-state.ts";
|
|
@@ -597,7 +627,7 @@ var SignalLocalState = class {
|
|
|
597
627
|
peerId
|
|
598
628
|
}, {
|
|
599
629
|
F: __dxlog_file2,
|
|
600
|
-
L:
|
|
630
|
+
L: 79,
|
|
601
631
|
S: this,
|
|
602
632
|
C: (f, a) => f(...a)
|
|
603
633
|
});
|
|
@@ -649,14 +679,28 @@ var SignalLocalState = class {
|
|
|
649
679
|
swarmEvent
|
|
650
680
|
}, {
|
|
651
681
|
F: __dxlog_file2,
|
|
652
|
-
L:
|
|
682
|
+
L: 115,
|
|
653
683
|
S: this,
|
|
654
684
|
C: (f, a) => f(...a)
|
|
655
685
|
});
|
|
656
|
-
|
|
686
|
+
const event = swarmEvent.peerAvailable ? {
|
|
657
687
|
topic,
|
|
658
|
-
|
|
659
|
-
|
|
688
|
+
peerAvailable: {
|
|
689
|
+
...swarmEvent.peerAvailable,
|
|
690
|
+
peer: {
|
|
691
|
+
peerKey: import_keys3.PublicKey.from(swarmEvent.peerAvailable.peer).toHex()
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
} : {
|
|
695
|
+
topic,
|
|
696
|
+
peerLeft: {
|
|
697
|
+
...swarmEvent.peerLeft,
|
|
698
|
+
peer: {
|
|
699
|
+
peerKey: import_keys3.PublicKey.from(swarmEvent.peerLeft.peer).toHex()
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
await this._onSwarmEvent(event);
|
|
660
704
|
}
|
|
661
705
|
});
|
|
662
706
|
this._swarmStreams.set({
|
|
@@ -685,8 +729,12 @@ var SignalLocalState = class {
|
|
|
685
729
|
peerId
|
|
686
730
|
})) {
|
|
687
731
|
const message = {
|
|
688
|
-
author:
|
|
689
|
-
|
|
732
|
+
author: {
|
|
733
|
+
peerKey: import_keys3.PublicKey.from(signalMessage.author).toHex()
|
|
734
|
+
},
|
|
735
|
+
recipient: {
|
|
736
|
+
peerKey: import_keys3.PublicKey.from(signalMessage.recipient).toHex()
|
|
737
|
+
},
|
|
690
738
|
payload: signalMessage.payload
|
|
691
739
|
};
|
|
692
740
|
await this._onMessage(message);
|
|
@@ -982,7 +1030,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
982
1030
|
id: this._instanceId
|
|
983
1031
|
}), {
|
|
984
1032
|
F: __dxlog_file4,
|
|
985
|
-
L:
|
|
1033
|
+
L: 92,
|
|
986
1034
|
S: this,
|
|
987
1035
|
C: (f, a) => f(...a)
|
|
988
1036
|
});
|
|
@@ -1000,7 +1048,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1000
1048
|
}));
|
|
1001
1049
|
(0, import_invariant2.invariant)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server", {
|
|
1002
1050
|
F: __dxlog_file4,
|
|
1003
|
-
L:
|
|
1051
|
+
L: 102,
|
|
1004
1052
|
S: this,
|
|
1005
1053
|
A: [
|
|
1006
1054
|
"this._state === SignalState.CONNECTED",
|
|
@@ -1043,7 +1091,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1043
1091
|
id: this._instanceId
|
|
1044
1092
|
}), {
|
|
1045
1093
|
F: __dxlog_file4,
|
|
1046
|
-
L:
|
|
1094
|
+
L: 135,
|
|
1047
1095
|
S: this,
|
|
1048
1096
|
C: (f, a) => f(...a)
|
|
1049
1097
|
});
|
|
@@ -1055,7 +1103,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1055
1103
|
if (this._state === import_signal.SignalState.CONNECTED && !this._lastReconciliationFailed) {
|
|
1056
1104
|
import_log2.log.warn("SignalClient error:", err, {
|
|
1057
1105
|
F: __dxlog_file4,
|
|
1058
|
-
L:
|
|
1106
|
+
L: 144,
|
|
1059
1107
|
S: this,
|
|
1060
1108
|
C: (f, a) => f(...a)
|
|
1061
1109
|
});
|
|
@@ -1065,7 +1113,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1065
1113
|
async _close() {
|
|
1066
1114
|
(0, import_log2.log)("closing...", void 0, {
|
|
1067
1115
|
F: __dxlog_file4,
|
|
1068
|
-
L:
|
|
1116
|
+
L: 150,
|
|
1069
1117
|
S: this,
|
|
1070
1118
|
C: (f, a) => f(...a)
|
|
1071
1119
|
});
|
|
@@ -1078,7 +1126,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1078
1126
|
await this._safeResetClient();
|
|
1079
1127
|
(0, import_log2.log)("closed", void 0, {
|
|
1080
1128
|
F: __dxlog_file4,
|
|
1081
|
-
L:
|
|
1129
|
+
L: 158,
|
|
1082
1130
|
S: this,
|
|
1083
1131
|
C: (f, a) => f(...a)
|
|
1084
1132
|
});
|
|
@@ -1095,67 +1143,113 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1095
1143
|
async join(args) {
|
|
1096
1144
|
(0, import_log2.log)("joining", {
|
|
1097
1145
|
topic: args.topic,
|
|
1098
|
-
peerId: args.
|
|
1146
|
+
peerId: args.peer.peerKey
|
|
1099
1147
|
}, {
|
|
1100
1148
|
F: __dxlog_file4,
|
|
1101
|
-
L:
|
|
1149
|
+
L: 172,
|
|
1102
1150
|
S: this,
|
|
1103
1151
|
C: (f, a) => f(...a)
|
|
1104
1152
|
});
|
|
1105
1153
|
this._monitor.recordJoin();
|
|
1106
|
-
this.localState.join(
|
|
1154
|
+
this.localState.join({
|
|
1155
|
+
topic: args.topic,
|
|
1156
|
+
peerId: import_keys2.PublicKey.from(args.peer.peerKey)
|
|
1157
|
+
});
|
|
1107
1158
|
this._reconcileTask?.schedule();
|
|
1108
1159
|
}
|
|
1109
1160
|
async leave(args) {
|
|
1110
1161
|
(0, import_log2.log)("leaving", {
|
|
1111
1162
|
topic: args.topic,
|
|
1112
|
-
peerId: args.
|
|
1163
|
+
peerId: args.peer.peerKey
|
|
1113
1164
|
}, {
|
|
1114
1165
|
F: __dxlog_file4,
|
|
1115
|
-
L:
|
|
1166
|
+
L: 179,
|
|
1116
1167
|
S: this,
|
|
1117
1168
|
C: (f, a) => f(...a)
|
|
1118
1169
|
});
|
|
1119
1170
|
this._monitor.recordLeave();
|
|
1120
|
-
this.localState.leave(
|
|
1171
|
+
this.localState.leave({
|
|
1172
|
+
topic: args.topic,
|
|
1173
|
+
peerId: import_keys2.PublicKey.from(args.peer.peerKey)
|
|
1174
|
+
});
|
|
1121
1175
|
}
|
|
1122
1176
|
async sendMessage(msg) {
|
|
1123
1177
|
return this._monitor.recordMessageSending(msg, async () => {
|
|
1124
1178
|
await this._clientReady.wait();
|
|
1125
1179
|
(0, import_invariant2.invariant)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server", {
|
|
1126
1180
|
F: __dxlog_file4,
|
|
1127
|
-
L:
|
|
1181
|
+
L: 187,
|
|
1128
1182
|
S: this,
|
|
1129
1183
|
A: [
|
|
1130
1184
|
"this._state === SignalState.CONNECTED",
|
|
1131
1185
|
"'Not connected to Signal Server'"
|
|
1132
1186
|
]
|
|
1133
1187
|
});
|
|
1134
|
-
|
|
1188
|
+
(0, import_invariant2.invariant)(msg.author.peerKey, "Author key required", {
|
|
1189
|
+
F: __dxlog_file4,
|
|
1190
|
+
L: 188,
|
|
1191
|
+
S: this,
|
|
1192
|
+
A: [
|
|
1193
|
+
"msg.author.peerKey",
|
|
1194
|
+
"'Author key required'"
|
|
1195
|
+
]
|
|
1196
|
+
});
|
|
1197
|
+
(0, import_invariant2.invariant)(msg.recipient.peerKey, "Recipient key required", {
|
|
1198
|
+
F: __dxlog_file4,
|
|
1199
|
+
L: 189,
|
|
1200
|
+
S: this,
|
|
1201
|
+
A: [
|
|
1202
|
+
"msg.recipient.peerKey",
|
|
1203
|
+
"'Recipient key required'"
|
|
1204
|
+
]
|
|
1205
|
+
});
|
|
1206
|
+
await this._client.sendMessage({
|
|
1207
|
+
author: import_keys2.PublicKey.from(msg.author.peerKey),
|
|
1208
|
+
recipient: import_keys2.PublicKey.from(msg.recipient.peerKey),
|
|
1209
|
+
payload: msg.payload
|
|
1210
|
+
});
|
|
1135
1211
|
});
|
|
1136
1212
|
}
|
|
1137
|
-
async subscribeMessages(
|
|
1213
|
+
async subscribeMessages(peer) {
|
|
1214
|
+
(0, import_invariant2.invariant)(peer.peerKey, "Peer key required", {
|
|
1215
|
+
F: __dxlog_file4,
|
|
1216
|
+
L: 199,
|
|
1217
|
+
S: this,
|
|
1218
|
+
A: [
|
|
1219
|
+
"peer.peerKey",
|
|
1220
|
+
"'Peer key required'"
|
|
1221
|
+
]
|
|
1222
|
+
});
|
|
1138
1223
|
(0, import_log2.log)("subscribing to messages", {
|
|
1139
|
-
|
|
1224
|
+
peer
|
|
1140
1225
|
}, {
|
|
1141
1226
|
F: __dxlog_file4,
|
|
1142
|
-
L:
|
|
1227
|
+
L: 200,
|
|
1143
1228
|
S: this,
|
|
1144
1229
|
C: (f, a) => f(...a)
|
|
1145
1230
|
});
|
|
1146
|
-
this.localState.subscribeMessages(
|
|
1231
|
+
this.localState.subscribeMessages(import_keys2.PublicKey.from(peer.peerKey));
|
|
1147
1232
|
this._reconcileTask?.schedule();
|
|
1148
1233
|
}
|
|
1149
|
-
async unsubscribeMessages(
|
|
1234
|
+
async unsubscribeMessages(peer) {
|
|
1235
|
+
(0, import_invariant2.invariant)(peer.peerKey, "Peer key required", {
|
|
1236
|
+
F: __dxlog_file4,
|
|
1237
|
+
L: 206,
|
|
1238
|
+
S: this,
|
|
1239
|
+
A: [
|
|
1240
|
+
"peer.peerKey",
|
|
1241
|
+
"'Peer key required'"
|
|
1242
|
+
]
|
|
1243
|
+
});
|
|
1150
1244
|
(0, import_log2.log)("unsubscribing from messages", {
|
|
1151
|
-
|
|
1245
|
+
peer
|
|
1152
1246
|
}, {
|
|
1153
1247
|
F: __dxlog_file4,
|
|
1154
|
-
L:
|
|
1248
|
+
L: 207,
|
|
1155
1249
|
S: this,
|
|
1156
1250
|
C: (f, a) => f(...a)
|
|
1157
1251
|
});
|
|
1158
|
-
this.localState.unsubscribeMessages(
|
|
1252
|
+
this.localState.unsubscribeMessages(import_keys2.PublicKey.from(peer.peerKey));
|
|
1159
1253
|
}
|
|
1160
1254
|
_scheduleReconcileAfterError() {
|
|
1161
1255
|
(0, import_async2.scheduleTask)(this._ctx, () => this._reconcileTask.schedule(), ERROR_RECONCILE_DELAY);
|
|
@@ -1166,13 +1260,13 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1166
1260
|
state: this._state
|
|
1167
1261
|
}, {
|
|
1168
1262
|
F: __dxlog_file4,
|
|
1169
|
-
L:
|
|
1263
|
+
L: 216,
|
|
1170
1264
|
S: this,
|
|
1171
1265
|
C: (f, a) => f(...a)
|
|
1172
1266
|
});
|
|
1173
1267
|
(0, import_invariant2.invariant)(!this._client, "Client already created", {
|
|
1174
1268
|
F: __dxlog_file4,
|
|
1175
|
-
L:
|
|
1269
|
+
L: 217,
|
|
1176
1270
|
S: this,
|
|
1177
1271
|
A: [
|
|
1178
1272
|
"!this._client",
|
|
@@ -1184,7 +1278,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1184
1278
|
this._connectionCtx.onDispose(async () => {
|
|
1185
1279
|
(0, import_log2.log)("connection context disposed", void 0, {
|
|
1186
1280
|
F: __dxlog_file4,
|
|
1187
|
-
L:
|
|
1281
|
+
L: 224,
|
|
1188
1282
|
S: this,
|
|
1189
1283
|
C: (f, a) => f(...a)
|
|
1190
1284
|
});
|
|
@@ -1199,7 +1293,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1199
1293
|
if (client === this._client) {
|
|
1200
1294
|
(0, import_log2.log)("socket connected", void 0, {
|
|
1201
1295
|
F: __dxlog_file4,
|
|
1202
|
-
L:
|
|
1296
|
+
L: 235,
|
|
1203
1297
|
S: this,
|
|
1204
1298
|
C: (f, a) => f(...a)
|
|
1205
1299
|
});
|
|
@@ -1214,7 +1308,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1214
1308
|
state: this._state
|
|
1215
1309
|
}, {
|
|
1216
1310
|
F: __dxlog_file4,
|
|
1217
|
-
L:
|
|
1311
|
+
L: 244,
|
|
1218
1312
|
S: this,
|
|
1219
1313
|
C: (f, a) => f(...a)
|
|
1220
1314
|
});
|
|
@@ -1231,7 +1325,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1231
1325
|
state: this._state
|
|
1232
1326
|
}, {
|
|
1233
1327
|
F: __dxlog_file4,
|
|
1234
|
-
L:
|
|
1328
|
+
L: 256,
|
|
1235
1329
|
S: this,
|
|
1236
1330
|
C: (f, a) => f(...a)
|
|
1237
1331
|
});
|
|
@@ -1256,14 +1350,14 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1256
1350
|
state: this._state
|
|
1257
1351
|
}, {
|
|
1258
1352
|
F: __dxlog_file4,
|
|
1259
|
-
L:
|
|
1353
|
+
L: 271,
|
|
1260
1354
|
S: this,
|
|
1261
1355
|
C: (f, a) => f(...a)
|
|
1262
1356
|
});
|
|
1263
1357
|
if (this._state === import_signal.SignalState.RECONNECTING) {
|
|
1264
1358
|
import_log2.log.info("Signal api already reconnecting.", void 0, {
|
|
1265
1359
|
F: __dxlog_file4,
|
|
1266
|
-
L:
|
|
1360
|
+
L: 274,
|
|
1267
1361
|
S: this,
|
|
1268
1362
|
C: (f, a) => f(...a)
|
|
1269
1363
|
});
|
|
@@ -1305,7 +1399,7 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1305
1399
|
status: this.getStatus()
|
|
1306
1400
|
}, {
|
|
1307
1401
|
F: __dxlog_file4,
|
|
1308
|
-
L:
|
|
1402
|
+
L: 315,
|
|
1309
1403
|
S: this,
|
|
1310
1404
|
C: (f, a) => f(...a)
|
|
1311
1405
|
});
|
|
@@ -1326,12 +1420,13 @@ var SignalClient = class extends import_context2.Resource {
|
|
|
1326
1420
|
this._client = void 0;
|
|
1327
1421
|
}
|
|
1328
1422
|
};
|
|
1423
|
+
var PeerInfoHash = ({ peerKey }) => peerKey;
|
|
1329
1424
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/memory-signal-manager.ts";
|
|
1330
1425
|
var MemorySignalManagerContext = class {
|
|
1331
1426
|
constructor() {
|
|
1332
1427
|
this.swarmEvent = new import_async5.Event();
|
|
1333
1428
|
this.swarms = new import_util3.ComplexMap(import_keys5.PublicKey.hash);
|
|
1334
|
-
this.connections = new import_util3.ComplexMap(
|
|
1429
|
+
this.connections = new import_util3.ComplexMap(PeerInfoHash);
|
|
1335
1430
|
}
|
|
1336
1431
|
};
|
|
1337
1432
|
var MemorySignalManager = class {
|
|
@@ -1340,11 +1435,11 @@ var MemorySignalManager = class {
|
|
|
1340
1435
|
this.statusChanged = new import_async5.Event();
|
|
1341
1436
|
this.swarmEvent = new import_async5.Event();
|
|
1342
1437
|
this.onMessage = new import_async5.Event();
|
|
1343
|
-
this._joinedSwarms = new import_util3.ComplexSet(({ topic,
|
|
1438
|
+
this._joinedSwarms = new import_util3.ComplexSet(({ topic, peer }) => topic.toHex() + peer.peerKey);
|
|
1344
1439
|
this._freezeTrigger = new import_async5.Trigger().wake();
|
|
1345
1440
|
this._ctx = new import_context5.Context(void 0, {
|
|
1346
1441
|
F: __dxlog_file5,
|
|
1347
|
-
L:
|
|
1442
|
+
L: 51
|
|
1348
1443
|
});
|
|
1349
1444
|
this._ctx.onDispose(this._context.swarmEvent.on((data) => this.swarmEvent.emit(data)));
|
|
1350
1445
|
}
|
|
@@ -1354,7 +1449,7 @@ var MemorySignalManager = class {
|
|
|
1354
1449
|
}
|
|
1355
1450
|
this._ctx = new import_context5.Context(void 0, {
|
|
1356
1451
|
F: __dxlog_file5,
|
|
1357
|
-
L:
|
|
1452
|
+
L: 60
|
|
1358
1453
|
});
|
|
1359
1454
|
this._ctx.onDispose(this._context.swarmEvent.on((data) => this.swarmEvent.emit(data)));
|
|
1360
1455
|
await Promise.all([
|
|
@@ -1365,7 +1460,7 @@ var MemorySignalManager = class {
|
|
|
1365
1460
|
if (this._ctx.disposed) {
|
|
1366
1461
|
return;
|
|
1367
1462
|
}
|
|
1368
|
-
const joinedSwarmsCopy = new import_util3.ComplexSet(({ topic,
|
|
1463
|
+
const joinedSwarmsCopy = new import_util3.ComplexSet(({ topic, peer }) => topic.toHex() + peer.peerKey, [
|
|
1369
1464
|
...this._joinedSwarms.values()
|
|
1370
1465
|
]);
|
|
1371
1466
|
await Promise.all([
|
|
@@ -1377,10 +1472,10 @@ var MemorySignalManager = class {
|
|
|
1377
1472
|
getStatus() {
|
|
1378
1473
|
return [];
|
|
1379
1474
|
}
|
|
1380
|
-
async join({ topic,
|
|
1475
|
+
async join({ topic, peer }) {
|
|
1381
1476
|
(0, import_invariant4.invariant)(!this._ctx.disposed, "Closed", {
|
|
1382
1477
|
F: __dxlog_file5,
|
|
1383
|
-
L:
|
|
1478
|
+
L: 89,
|
|
1384
1479
|
S: this,
|
|
1385
1480
|
A: [
|
|
1386
1481
|
"!this._ctx.disposed",
|
|
@@ -1389,39 +1484,35 @@ var MemorySignalManager = class {
|
|
|
1389
1484
|
});
|
|
1390
1485
|
this._joinedSwarms.add({
|
|
1391
1486
|
topic,
|
|
1392
|
-
|
|
1487
|
+
peer
|
|
1393
1488
|
});
|
|
1394
1489
|
if (!this._context.swarms.has(topic)) {
|
|
1395
|
-
this._context.swarms.set(topic, new import_util3.ComplexSet(
|
|
1490
|
+
this._context.swarms.set(topic, new import_util3.ComplexSet(PeerInfoHash));
|
|
1396
1491
|
}
|
|
1397
|
-
this._context.swarms.get(topic).add(
|
|
1492
|
+
this._context.swarms.get(topic).add(peer);
|
|
1398
1493
|
this._context.swarmEvent.emit({
|
|
1399
1494
|
topic,
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
since: /* @__PURE__ */ new Date()
|
|
1404
|
-
}
|
|
1495
|
+
peerAvailable: {
|
|
1496
|
+
peer,
|
|
1497
|
+
since: /* @__PURE__ */ new Date()
|
|
1405
1498
|
}
|
|
1406
1499
|
});
|
|
1407
|
-
for (const [topic2,
|
|
1408
|
-
Array.from(
|
|
1500
|
+
for (const [topic2, peers] of this._context.swarms) {
|
|
1501
|
+
Array.from(peers).forEach((peer2) => {
|
|
1409
1502
|
this.swarmEvent.emit({
|
|
1410
1503
|
topic: topic2,
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
since: /* @__PURE__ */ new Date()
|
|
1415
|
-
}
|
|
1504
|
+
peerAvailable: {
|
|
1505
|
+
peer: peer2,
|
|
1506
|
+
since: /* @__PURE__ */ new Date()
|
|
1416
1507
|
}
|
|
1417
1508
|
});
|
|
1418
1509
|
});
|
|
1419
1510
|
}
|
|
1420
1511
|
}
|
|
1421
|
-
async leave({ topic,
|
|
1512
|
+
async leave({ topic, peer }) {
|
|
1422
1513
|
(0, import_invariant4.invariant)(!this._ctx.disposed, "Closed", {
|
|
1423
1514
|
F: __dxlog_file5,
|
|
1424
|
-
L:
|
|
1515
|
+
L: 121,
|
|
1425
1516
|
S: this,
|
|
1426
1517
|
A: [
|
|
1427
1518
|
"!this._ctx.disposed",
|
|
@@ -1430,21 +1521,19 @@ var MemorySignalManager = class {
|
|
|
1430
1521
|
});
|
|
1431
1522
|
this._joinedSwarms.delete({
|
|
1432
1523
|
topic,
|
|
1433
|
-
|
|
1524
|
+
peer
|
|
1434
1525
|
});
|
|
1435
1526
|
if (!this._context.swarms.has(topic)) {
|
|
1436
|
-
this._context.swarms.set(topic, new import_util3.ComplexSet(
|
|
1527
|
+
this._context.swarms.set(topic, new import_util3.ComplexSet(PeerInfoHash));
|
|
1437
1528
|
}
|
|
1438
|
-
this._context.swarms.get(topic).delete(
|
|
1529
|
+
this._context.swarms.get(topic).delete(peer);
|
|
1439
1530
|
const swarmEvent = {
|
|
1531
|
+
topic,
|
|
1440
1532
|
peerLeft: {
|
|
1441
|
-
peer
|
|
1533
|
+
peer
|
|
1442
1534
|
}
|
|
1443
1535
|
};
|
|
1444
|
-
this._context.swarmEvent.emit(
|
|
1445
|
-
topic,
|
|
1446
|
-
swarmEvent
|
|
1447
|
-
});
|
|
1536
|
+
this._context.swarmEvent.emit(swarmEvent);
|
|
1448
1537
|
}
|
|
1449
1538
|
async sendMessage({ author, recipient, payload }) {
|
|
1450
1539
|
(0, import_log5.log)("send message", {
|
|
@@ -1453,13 +1542,13 @@ var MemorySignalManager = class {
|
|
|
1453
1542
|
...dec(payload)
|
|
1454
1543
|
}, {
|
|
1455
1544
|
F: __dxlog_file5,
|
|
1456
|
-
L:
|
|
1545
|
+
L: 142,
|
|
1457
1546
|
S: this,
|
|
1458
1547
|
C: (f, a) => f(...a)
|
|
1459
1548
|
});
|
|
1460
1549
|
(0, import_invariant4.invariant)(recipient, void 0, {
|
|
1461
1550
|
F: __dxlog_file5,
|
|
1462
|
-
L:
|
|
1551
|
+
L: 144,
|
|
1463
1552
|
S: this,
|
|
1464
1553
|
A: [
|
|
1465
1554
|
"recipient",
|
|
@@ -1468,7 +1557,7 @@ var MemorySignalManager = class {
|
|
|
1468
1557
|
});
|
|
1469
1558
|
(0, import_invariant4.invariant)(!this._ctx.disposed, "Closed", {
|
|
1470
1559
|
F: __dxlog_file5,
|
|
1471
|
-
L:
|
|
1560
|
+
L: 145,
|
|
1472
1561
|
S: this,
|
|
1473
1562
|
A: [
|
|
1474
1563
|
"!this._ctx.disposed",
|
|
@@ -1483,7 +1572,7 @@ var MemorySignalManager = class {
|
|
|
1483
1572
|
recipient
|
|
1484
1573
|
}, {
|
|
1485
1574
|
F: __dxlog_file5,
|
|
1486
|
-
L:
|
|
1575
|
+
L: 151,
|
|
1487
1576
|
S: this,
|
|
1488
1577
|
C: (f, a) => f(...a)
|
|
1489
1578
|
});
|
|
@@ -1495,7 +1584,7 @@ var MemorySignalManager = class {
|
|
|
1495
1584
|
recipient
|
|
1496
1585
|
}, {
|
|
1497
1586
|
F: __dxlog_file5,
|
|
1498
|
-
L:
|
|
1587
|
+
L: 156,
|
|
1499
1588
|
S: this,
|
|
1500
1589
|
C: (f, a) => f(...a)
|
|
1501
1590
|
});
|
|
@@ -1508,7 +1597,7 @@ var MemorySignalManager = class {
|
|
|
1508
1597
|
recipient
|
|
1509
1598
|
}, {
|
|
1510
1599
|
F: __dxlog_file5,
|
|
1511
|
-
L:
|
|
1600
|
+
L: 164,
|
|
1512
1601
|
S: this,
|
|
1513
1602
|
C: (f, a) => f(...a)
|
|
1514
1603
|
});
|
|
@@ -1520,7 +1609,7 @@ var MemorySignalManager = class {
|
|
|
1520
1609
|
...dec(payload)
|
|
1521
1610
|
}, {
|
|
1522
1611
|
F: __dxlog_file5,
|
|
1523
|
-
L:
|
|
1612
|
+
L: 168,
|
|
1524
1613
|
S: this,
|
|
1525
1614
|
C: (f, a) => f(...a)
|
|
1526
1615
|
});
|
|
@@ -1534,33 +1623,33 @@ var MemorySignalManager = class {
|
|
|
1534
1623
|
err
|
|
1535
1624
|
}, {
|
|
1536
1625
|
F: __dxlog_file5,
|
|
1537
|
-
L:
|
|
1626
|
+
L: 173,
|
|
1538
1627
|
S: this,
|
|
1539
1628
|
C: (f, a) => f(...a)
|
|
1540
1629
|
});
|
|
1541
1630
|
});
|
|
1542
1631
|
}
|
|
1543
|
-
async subscribeMessages(
|
|
1632
|
+
async subscribeMessages(peerInfo) {
|
|
1544
1633
|
(0, import_log5.log)("subscribing", {
|
|
1545
|
-
|
|
1634
|
+
peerInfo
|
|
1546
1635
|
}, {
|
|
1547
1636
|
F: __dxlog_file5,
|
|
1548
|
-
L:
|
|
1637
|
+
L: 178,
|
|
1549
1638
|
S: this,
|
|
1550
1639
|
C: (f, a) => f(...a)
|
|
1551
1640
|
});
|
|
1552
|
-
this._context.connections.set(
|
|
1641
|
+
this._context.connections.set(peerInfo, this);
|
|
1553
1642
|
}
|
|
1554
|
-
async unsubscribeMessages(
|
|
1643
|
+
async unsubscribeMessages(peerInfo) {
|
|
1555
1644
|
(0, import_log5.log)("unsubscribing", {
|
|
1556
|
-
|
|
1645
|
+
peerInfo
|
|
1557
1646
|
}, {
|
|
1558
1647
|
F: __dxlog_file5,
|
|
1559
|
-
L:
|
|
1648
|
+
L: 183,
|
|
1560
1649
|
S: this,
|
|
1561
1650
|
C: (f, a) => f(...a)
|
|
1562
1651
|
});
|
|
1563
|
-
this._context.connections.delete(
|
|
1652
|
+
this._context.connections.delete(peerInfo);
|
|
1564
1653
|
}
|
|
1565
1654
|
freeze() {
|
|
1566
1655
|
this._freezeTrigger.reset();
|
|
@@ -1608,13 +1697,13 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
1608
1697
|
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/websocket-signal-manager.ts";
|
|
1609
1698
|
var MAX_SERVER_FAILURES = 5;
|
|
1610
1699
|
var WSS_SIGNAL_SERVER_REBOOT_DELAY = 3e3;
|
|
1611
|
-
var WebsocketSignalManager = class {
|
|
1700
|
+
var WebsocketSignalManager = class extends import_context6.Resource {
|
|
1612
1701
|
constructor(_hosts, _getMetadata) {
|
|
1702
|
+
super();
|
|
1613
1703
|
this._hosts = _hosts;
|
|
1614
1704
|
this._getMetadata = _getMetadata;
|
|
1615
1705
|
this._servers = /* @__PURE__ */ new Map();
|
|
1616
1706
|
this._monitor = new WebsocketSignalManagerMonitor();
|
|
1617
|
-
this._opened = false;
|
|
1618
1707
|
this.failureCount = /* @__PURE__ */ new Map();
|
|
1619
1708
|
this.statusChanged = new import_async6.Event();
|
|
1620
1709
|
this.swarmEvent = new import_async6.Event();
|
|
@@ -1624,7 +1713,7 @@ var WebsocketSignalManager = class {
|
|
|
1624
1713
|
hosts: this._hosts
|
|
1625
1714
|
}, {
|
|
1626
1715
|
F: __dxlog_file6,
|
|
1627
|
-
L:
|
|
1716
|
+
L: 54,
|
|
1628
1717
|
S: this,
|
|
1629
1718
|
C: (f, a) => f(...a)
|
|
1630
1719
|
});
|
|
@@ -1641,15 +1730,12 @@ var WebsocketSignalManager = class {
|
|
|
1641
1730
|
}
|
|
1642
1731
|
this._failedServersBitfield = import_util4.BitField.zeros(this._hosts.length);
|
|
1643
1732
|
}
|
|
1644
|
-
async
|
|
1645
|
-
if (this._opened) {
|
|
1646
|
-
return;
|
|
1647
|
-
}
|
|
1733
|
+
async _open() {
|
|
1648
1734
|
(0, import_log6.log)("open signal manager", {
|
|
1649
1735
|
hosts: this._hosts
|
|
1650
1736
|
}, {
|
|
1651
1737
|
F: __dxlog_file6,
|
|
1652
|
-
L:
|
|
1738
|
+
L: 74,
|
|
1653
1739
|
S: this,
|
|
1654
1740
|
C: (f, a) => f(...a)
|
|
1655
1741
|
});
|
|
@@ -1657,28 +1743,21 @@ var WebsocketSignalManager = class {
|
|
|
1657
1743
|
id: this._instanceId
|
|
1658
1744
|
}), {
|
|
1659
1745
|
F: __dxlog_file6,
|
|
1660
|
-
L:
|
|
1746
|
+
L: 75,
|
|
1661
1747
|
S: this,
|
|
1662
1748
|
C: (f, a) => f(...a)
|
|
1663
1749
|
});
|
|
1664
|
-
this._initContext();
|
|
1665
1750
|
await (0, import_util4.safeAwaitAll)(this._servers.values(), (server) => server.open());
|
|
1666
|
-
this._opened = true;
|
|
1667
1751
|
import_log6.log.trace("dxos.mesh.websocket-signal-manager.open", import_protocols5.trace.end({
|
|
1668
1752
|
id: this._instanceId
|
|
1669
1753
|
}), {
|
|
1670
1754
|
F: __dxlog_file6,
|
|
1671
|
-
L:
|
|
1755
|
+
L: 79,
|
|
1672
1756
|
S: this,
|
|
1673
1757
|
C: (f, a) => f(...a)
|
|
1674
1758
|
});
|
|
1675
1759
|
}
|
|
1676
|
-
async
|
|
1677
|
-
if (!this._opened) {
|
|
1678
|
-
return;
|
|
1679
|
-
}
|
|
1680
|
-
this._opened = false;
|
|
1681
|
-
await this._ctx.dispose();
|
|
1760
|
+
async _close() {
|
|
1682
1761
|
await (0, import_util4.safeAwaitAll)(this._servers.values(), (server) => server.close());
|
|
1683
1762
|
}
|
|
1684
1763
|
async restartServer(serverName) {
|
|
@@ -1686,23 +1765,23 @@ var WebsocketSignalManager = class {
|
|
|
1686
1765
|
serverName
|
|
1687
1766
|
}, {
|
|
1688
1767
|
F: __dxlog_file6,
|
|
1689
|
-
L:
|
|
1768
|
+
L: 87,
|
|
1690
1769
|
S: this,
|
|
1691
1770
|
C: (f, a) => f(...a)
|
|
1692
1771
|
});
|
|
1693
|
-
(0, import_invariant5.invariant)(this.
|
|
1772
|
+
(0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
|
|
1694
1773
|
F: __dxlog_file6,
|
|
1695
|
-
L:
|
|
1774
|
+
L: 88,
|
|
1696
1775
|
S: this,
|
|
1697
1776
|
A: [
|
|
1698
|
-
"this.
|
|
1699
|
-
"
|
|
1777
|
+
"this._lifecycleState === LifecycleState.OPEN",
|
|
1778
|
+
""
|
|
1700
1779
|
]
|
|
1701
1780
|
});
|
|
1702
1781
|
const server = this._servers.get(serverName);
|
|
1703
1782
|
(0, import_invariant5.invariant)(server, "server not found", {
|
|
1704
1783
|
F: __dxlog_file6,
|
|
1705
|
-
L:
|
|
1784
|
+
L: 91,
|
|
1706
1785
|
S: this,
|
|
1707
1786
|
A: [
|
|
1708
1787
|
"server",
|
|
@@ -1716,52 +1795,52 @@ var WebsocketSignalManager = class {
|
|
|
1716
1795
|
getStatus() {
|
|
1717
1796
|
return Array.from(this._servers.values()).map((server) => server.getStatus());
|
|
1718
1797
|
}
|
|
1719
|
-
async join({ topic,
|
|
1798
|
+
async join({ topic, peer }) {
|
|
1720
1799
|
(0, import_log6.log)("join", {
|
|
1721
1800
|
topic,
|
|
1722
|
-
|
|
1801
|
+
peer
|
|
1723
1802
|
}, {
|
|
1724
1803
|
F: __dxlog_file6,
|
|
1725
|
-
L:
|
|
1804
|
+
L: 104,
|
|
1726
1805
|
S: this,
|
|
1727
1806
|
C: (f, a) => f(...a)
|
|
1728
1807
|
});
|
|
1729
|
-
(0, import_invariant5.invariant)(this.
|
|
1808
|
+
(0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
|
|
1730
1809
|
F: __dxlog_file6,
|
|
1731
|
-
L:
|
|
1810
|
+
L: 105,
|
|
1732
1811
|
S: this,
|
|
1733
1812
|
A: [
|
|
1734
|
-
"this.
|
|
1735
|
-
"
|
|
1813
|
+
"this._lifecycleState === LifecycleState.OPEN",
|
|
1814
|
+
""
|
|
1736
1815
|
]
|
|
1737
1816
|
});
|
|
1738
1817
|
await this._forEachServer((server) => server.join({
|
|
1739
1818
|
topic,
|
|
1740
|
-
|
|
1819
|
+
peer
|
|
1741
1820
|
}));
|
|
1742
1821
|
}
|
|
1743
|
-
async leave({ topic,
|
|
1822
|
+
async leave({ topic, peer }) {
|
|
1744
1823
|
(0, import_log6.log)("leaving", {
|
|
1745
1824
|
topic,
|
|
1746
|
-
|
|
1825
|
+
peer
|
|
1747
1826
|
}, {
|
|
1748
1827
|
F: __dxlog_file6,
|
|
1749
|
-
L:
|
|
1828
|
+
L: 111,
|
|
1750
1829
|
S: this,
|
|
1751
1830
|
C: (f, a) => f(...a)
|
|
1752
1831
|
});
|
|
1753
|
-
(0, import_invariant5.invariant)(this.
|
|
1832
|
+
(0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
|
|
1754
1833
|
F: __dxlog_file6,
|
|
1755
|
-
L:
|
|
1834
|
+
L: 112,
|
|
1756
1835
|
S: this,
|
|
1757
1836
|
A: [
|
|
1758
|
-
"this.
|
|
1759
|
-
"
|
|
1837
|
+
"this._lifecycleState === LifecycleState.OPEN",
|
|
1838
|
+
""
|
|
1760
1839
|
]
|
|
1761
1840
|
});
|
|
1762
1841
|
await this._forEachServer((server) => server.leave({
|
|
1763
1842
|
topic,
|
|
1764
|
-
|
|
1843
|
+
peer
|
|
1765
1844
|
}));
|
|
1766
1845
|
}
|
|
1767
1846
|
async sendMessage({ author, recipient, payload }) {
|
|
@@ -1769,17 +1848,17 @@ var WebsocketSignalManager = class {
|
|
|
1769
1848
|
recipient
|
|
1770
1849
|
}, {
|
|
1771
1850
|
F: __dxlog_file6,
|
|
1772
|
-
L:
|
|
1851
|
+
L: 117,
|
|
1773
1852
|
S: this,
|
|
1774
1853
|
C: (f, a) => f(...a)
|
|
1775
1854
|
});
|
|
1776
|
-
(0, import_invariant5.invariant)(this.
|
|
1855
|
+
(0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
|
|
1777
1856
|
F: __dxlog_file6,
|
|
1778
|
-
L:
|
|
1857
|
+
L: 118,
|
|
1779
1858
|
S: this,
|
|
1780
1859
|
A: [
|
|
1781
|
-
"this.
|
|
1782
|
-
"
|
|
1860
|
+
"this._lifecycleState === LifecycleState.OPEN",
|
|
1861
|
+
""
|
|
1783
1862
|
]
|
|
1784
1863
|
});
|
|
1785
1864
|
void this._forEachServer(async (server, serverName, index) => {
|
|
@@ -1793,7 +1872,7 @@ var WebsocketSignalManager = class {
|
|
|
1793
1872
|
err
|
|
1794
1873
|
}, {
|
|
1795
1874
|
F: __dxlog_file6,
|
|
1796
|
-
L:
|
|
1875
|
+
L: 126,
|
|
1797
1876
|
S: this,
|
|
1798
1877
|
C: (f, a) => f(...a)
|
|
1799
1878
|
});
|
|
@@ -1803,7 +1882,7 @@ var WebsocketSignalManager = class {
|
|
|
1803
1882
|
err
|
|
1804
1883
|
}, {
|
|
1805
1884
|
F: __dxlog_file6,
|
|
1806
|
-
L:
|
|
1885
|
+
L: 129,
|
|
1807
1886
|
S: this,
|
|
1808
1887
|
C: (f, a) => f(...a)
|
|
1809
1888
|
});
|
|
@@ -1813,7 +1892,7 @@ var WebsocketSignalManager = class {
|
|
|
1813
1892
|
err
|
|
1814
1893
|
}, {
|
|
1815
1894
|
F: __dxlog_file6,
|
|
1816
|
-
L:
|
|
1895
|
+
L: 132,
|
|
1817
1896
|
S: this,
|
|
1818
1897
|
C: (f, a) => f(...a)
|
|
1819
1898
|
});
|
|
@@ -1836,7 +1915,7 @@ var WebsocketSignalManager = class {
|
|
|
1836
1915
|
failureCount
|
|
1837
1916
|
}, {
|
|
1838
1917
|
F: __dxlog_file6,
|
|
1839
|
-
L:
|
|
1918
|
+
L: 146,
|
|
1840
1919
|
S: this,
|
|
1841
1920
|
C: (f, a) => f(...a)
|
|
1842
1921
|
});
|
|
@@ -1854,7 +1933,7 @@ var WebsocketSignalManager = class {
|
|
|
1854
1933
|
serverName
|
|
1855
1934
|
}, {
|
|
1856
1935
|
F: __dxlog_file6,
|
|
1857
|
-
L:
|
|
1936
|
+
L: 159,
|
|
1858
1937
|
S: this,
|
|
1859
1938
|
C: (f, a) => f(...a)
|
|
1860
1939
|
});
|
|
@@ -1862,69 +1941,50 @@ var WebsocketSignalManager = class {
|
|
|
1862
1941
|
this.failureCount.set(serverName, 0);
|
|
1863
1942
|
}
|
|
1864
1943
|
}
|
|
1865
|
-
async subscribeMessages(
|
|
1944
|
+
async subscribeMessages(peer) {
|
|
1866
1945
|
(0, import_log6.log)("subscribed for message stream", {
|
|
1867
|
-
|
|
1946
|
+
peer
|
|
1868
1947
|
}, {
|
|
1869
1948
|
F: __dxlog_file6,
|
|
1870
|
-
L:
|
|
1949
|
+
L: 166,
|
|
1871
1950
|
S: this,
|
|
1872
1951
|
C: (f, a) => f(...a)
|
|
1873
1952
|
});
|
|
1874
|
-
(0, import_invariant5.invariant)(this.
|
|
1953
|
+
(0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
|
|
1875
1954
|
F: __dxlog_file6,
|
|
1876
|
-
L:
|
|
1955
|
+
L: 167,
|
|
1877
1956
|
S: this,
|
|
1878
1957
|
A: [
|
|
1879
|
-
"this.
|
|
1880
|
-
"
|
|
1958
|
+
"this._lifecycleState === LifecycleState.OPEN",
|
|
1959
|
+
""
|
|
1881
1960
|
]
|
|
1882
1961
|
});
|
|
1883
|
-
await this._forEachServer(async (server) => server.subscribeMessages(
|
|
1962
|
+
await this._forEachServer(async (server) => server.subscribeMessages(peer));
|
|
1884
1963
|
}
|
|
1885
|
-
async unsubscribeMessages(
|
|
1964
|
+
async unsubscribeMessages(peer) {
|
|
1886
1965
|
(0, import_log6.log)("subscribed for message stream", {
|
|
1887
|
-
|
|
1966
|
+
peer
|
|
1888
1967
|
}, {
|
|
1889
1968
|
F: __dxlog_file6,
|
|
1890
|
-
L:
|
|
1969
|
+
L: 173,
|
|
1891
1970
|
S: this,
|
|
1892
1971
|
C: (f, a) => f(...a)
|
|
1893
1972
|
});
|
|
1894
|
-
(0, import_invariant5.invariant)(this.
|
|
1973
|
+
(0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
|
|
1895
1974
|
F: __dxlog_file6,
|
|
1896
|
-
L:
|
|
1975
|
+
L: 174,
|
|
1897
1976
|
S: this,
|
|
1898
1977
|
A: [
|
|
1899
|
-
"this.
|
|
1900
|
-
"
|
|
1978
|
+
"this._lifecycleState === LifecycleState.OPEN",
|
|
1979
|
+
""
|
|
1901
1980
|
]
|
|
1902
1981
|
});
|
|
1903
|
-
await this._forEachServer(async (server) => server.unsubscribeMessages(
|
|
1904
|
-
}
|
|
1905
|
-
_initContext() {
|
|
1906
|
-
this._ctx = new import_context6.Context({
|
|
1907
|
-
onError: (err) => import_log6.log.catch(err, void 0, {
|
|
1908
|
-
F: __dxlog_file6,
|
|
1909
|
-
L: 206,
|
|
1910
|
-
S: this,
|
|
1911
|
-
C: (f, a) => f(...a)
|
|
1912
|
-
})
|
|
1913
|
-
}, {
|
|
1914
|
-
F: __dxlog_file6,
|
|
1915
|
-
L: 205
|
|
1916
|
-
});
|
|
1982
|
+
await this._forEachServer(async (server) => server.unsubscribeMessages(peer));
|
|
1917
1983
|
}
|
|
1918
1984
|
async _forEachServer(fn) {
|
|
1919
1985
|
return Promise.all(Array.from(this._servers.entries()).map(([serverName, server], idx) => fn(server, serverName, idx)));
|
|
1920
1986
|
}
|
|
1921
1987
|
};
|
|
1922
|
-
_ts_decorate([
|
|
1923
|
-
import_async6.synchronized
|
|
1924
|
-
], WebsocketSignalManager.prototype, "open", null);
|
|
1925
|
-
_ts_decorate([
|
|
1926
|
-
import_async6.synchronized
|
|
1927
|
-
], WebsocketSignalManager.prototype, "close", null);
|
|
1928
1988
|
_ts_decorate([
|
|
1929
1989
|
import_async6.synchronized
|
|
1930
1990
|
], WebsocketSignalManager.prototype, "join", null);
|
|
@@ -1934,14 +1994,211 @@ _ts_decorate([
|
|
|
1934
1994
|
_ts_decorate([
|
|
1935
1995
|
import_async6.synchronized
|
|
1936
1996
|
], WebsocketSignalManager.prototype, "checkServerFailure", null);
|
|
1937
|
-
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/
|
|
1997
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/edge-signal-manager.ts";
|
|
1998
|
+
var EdgeSignalManager = class extends import_context7.Resource {
|
|
1999
|
+
constructor({ edgeConnection }) {
|
|
2000
|
+
super();
|
|
2001
|
+
this.swarmEvent = new import_async7.Event();
|
|
2002
|
+
this.onMessage = new import_async7.Event();
|
|
2003
|
+
this._swarmPeers = new import_util5.ComplexMap(import_keys7.PublicKey.hash);
|
|
2004
|
+
this._edgeConnection = edgeConnection;
|
|
2005
|
+
}
|
|
2006
|
+
async _open() {
|
|
2007
|
+
this._ctx.onDispose(this._edgeConnection.addListener((message) => this._onMessage(message)));
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* Warning: PeerInfo is inferred from edgeConnection.
|
|
2011
|
+
*/
|
|
2012
|
+
async join({ topic, peer }) {
|
|
2013
|
+
if (!this._matchSelfPeerInfo(peer)) {
|
|
2014
|
+
import_log7.log.warn("ignoring peer info on join request", {
|
|
2015
|
+
peer,
|
|
2016
|
+
expected: {
|
|
2017
|
+
peerKey: this._edgeConnection.deviceKey.toHex(),
|
|
2018
|
+
identityKey: this._edgeConnection.identityKey.toHex()
|
|
2019
|
+
}
|
|
2020
|
+
}, {
|
|
2021
|
+
F: __dxlog_file7,
|
|
2022
|
+
L: 51,
|
|
2023
|
+
S: this,
|
|
2024
|
+
C: (f, a) => f(...a)
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
this._swarmPeers.set(topic, new import_util5.ComplexSet(PeerInfoHash));
|
|
2028
|
+
await this._edgeConnection.send(import_edge_client.protocol.createMessage(import_messenger_pb.SwarmRequestSchema, {
|
|
2029
|
+
serviceId: import_protocols6.EdgeService.SWARM_SERVICE_ID,
|
|
2030
|
+
payload: {
|
|
2031
|
+
action: import_messenger_pb.SwarmRequest_Action.JOIN,
|
|
2032
|
+
swarmKeys: [
|
|
2033
|
+
topic.toHex()
|
|
2034
|
+
]
|
|
2035
|
+
}
|
|
2036
|
+
}));
|
|
2037
|
+
}
|
|
2038
|
+
async leave({ topic, peer }) {
|
|
2039
|
+
this._swarmPeers.delete(topic);
|
|
2040
|
+
await this._edgeConnection.send(import_edge_client.protocol.createMessage(import_messenger_pb.SwarmRequestSchema, {
|
|
2041
|
+
serviceId: import_protocols6.EdgeService.SWARM_SERVICE_ID,
|
|
2042
|
+
payload: {
|
|
2043
|
+
action: import_messenger_pb.SwarmRequest_Action.LEAVE,
|
|
2044
|
+
swarmKeys: [
|
|
2045
|
+
topic.toHex()
|
|
2046
|
+
]
|
|
2047
|
+
}
|
|
2048
|
+
}));
|
|
2049
|
+
}
|
|
2050
|
+
async sendMessage(message) {
|
|
2051
|
+
if (!this._matchSelfPeerInfo(message.author)) {
|
|
2052
|
+
import_log7.log.warn("ignoring author on send request", {
|
|
2053
|
+
author: message.author,
|
|
2054
|
+
expected: {
|
|
2055
|
+
peerKey: this._edgeConnection.deviceKey,
|
|
2056
|
+
identityKey: this._edgeConnection.identityKey
|
|
2057
|
+
}
|
|
2058
|
+
}, {
|
|
2059
|
+
F: __dxlog_file7,
|
|
2060
|
+
L: 82,
|
|
2061
|
+
S: this,
|
|
2062
|
+
C: (f, a) => f(...a)
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
await this._edgeConnection.send(import_edge_client.protocol.createMessage(import_wkt.AnySchema, {
|
|
2066
|
+
serviceId: import_protocols6.EdgeService.SIGNAL_SERVICE_ID,
|
|
2067
|
+
source: message.author,
|
|
2068
|
+
target: [
|
|
2069
|
+
message.recipient
|
|
2070
|
+
],
|
|
2071
|
+
payload: {
|
|
2072
|
+
typeUrl: message.payload.type_url,
|
|
2073
|
+
value: message.payload.value
|
|
2074
|
+
}
|
|
2075
|
+
}));
|
|
2076
|
+
}
|
|
2077
|
+
async subscribeMessages(peerInfo) {
|
|
2078
|
+
}
|
|
2079
|
+
async unsubscribeMessages(peerInfo) {
|
|
2080
|
+
}
|
|
2081
|
+
_onMessage(message) {
|
|
2082
|
+
switch (message.serviceId) {
|
|
2083
|
+
case import_protocols6.EdgeService.SWARM_SERVICE_ID: {
|
|
2084
|
+
this._processSwarmResponse(message);
|
|
2085
|
+
break;
|
|
2086
|
+
}
|
|
2087
|
+
case import_protocols6.EdgeService.SIGNAL_SERVICE_ID: {
|
|
2088
|
+
this._processMessage(message);
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
_processSwarmResponse(message) {
|
|
2093
|
+
(0, import_invariant6.invariant)(import_edge_client.protocol.getPayloadType(message) === import_messenger_pb.SwarmResponseSchema.typeName, "Wrong payload type", {
|
|
2094
|
+
F: __dxlog_file7,
|
|
2095
|
+
L: 119,
|
|
2096
|
+
S: this,
|
|
2097
|
+
A: [
|
|
2098
|
+
"protocol.getPayloadType(message) === SwarmResponseSchema.typeName",
|
|
2099
|
+
"'Wrong payload type'"
|
|
2100
|
+
]
|
|
2101
|
+
});
|
|
2102
|
+
const payload = import_edge_client.protocol.getPayload(message, import_messenger_pb.SwarmResponseSchema);
|
|
2103
|
+
const topic = import_keys7.PublicKey.from(payload.swarmKey);
|
|
2104
|
+
if (!this._swarmPeers.has(topic)) {
|
|
2105
|
+
import_log7.log.warn("Received message from wrong topic", {
|
|
2106
|
+
topic
|
|
2107
|
+
}, {
|
|
2108
|
+
F: __dxlog_file7,
|
|
2109
|
+
L: 123,
|
|
2110
|
+
S: this,
|
|
2111
|
+
C: (f, a) => f(...a)
|
|
2112
|
+
});
|
|
2113
|
+
return;
|
|
2114
|
+
}
|
|
2115
|
+
const oldPeers = this._swarmPeers.get(topic);
|
|
2116
|
+
const timestamp = new Date(Date.parse(message.timestamp));
|
|
2117
|
+
const newPeers = new import_util5.ComplexSet(PeerInfoHash, payload.peers);
|
|
2118
|
+
for (const peer of newPeers) {
|
|
2119
|
+
if (oldPeers.has(peer)) {
|
|
2120
|
+
continue;
|
|
2121
|
+
}
|
|
2122
|
+
this.swarmEvent.emit({
|
|
2123
|
+
topic,
|
|
2124
|
+
peerAvailable: {
|
|
2125
|
+
peer,
|
|
2126
|
+
since: timestamp
|
|
2127
|
+
}
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
for (const peer of oldPeers) {
|
|
2131
|
+
if (newPeers.has(peer)) {
|
|
2132
|
+
continue;
|
|
2133
|
+
}
|
|
2134
|
+
this.swarmEvent.emit({
|
|
2135
|
+
topic,
|
|
2136
|
+
peerLeft: {
|
|
2137
|
+
peer
|
|
2138
|
+
}
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
this._swarmPeers.set(topic, newPeers);
|
|
2142
|
+
}
|
|
2143
|
+
_processMessage(message) {
|
|
2144
|
+
(0, import_invariant6.invariant)(import_edge_client.protocol.getPayloadType(message) === import_wkt.AnySchema.typeName, "Wrong payload type", {
|
|
2145
|
+
F: __dxlog_file7,
|
|
2146
|
+
L: 156,
|
|
2147
|
+
S: this,
|
|
2148
|
+
A: [
|
|
2149
|
+
"protocol.getPayloadType(message) === AnySchema.typeName",
|
|
2150
|
+
"'Wrong payload type'"
|
|
2151
|
+
]
|
|
2152
|
+
});
|
|
2153
|
+
const payload = import_edge_client.protocol.getPayload(message, import_wkt.AnySchema);
|
|
2154
|
+
(0, import_invariant6.invariant)(message.source, "source is missing", {
|
|
2155
|
+
F: __dxlog_file7,
|
|
2156
|
+
L: 158,
|
|
2157
|
+
S: this,
|
|
2158
|
+
A: [
|
|
2159
|
+
"message.source",
|
|
2160
|
+
"'source is missing'"
|
|
2161
|
+
]
|
|
2162
|
+
});
|
|
2163
|
+
(0, import_invariant6.invariant)(message.target, "target is missing", {
|
|
2164
|
+
F: __dxlog_file7,
|
|
2165
|
+
L: 159,
|
|
2166
|
+
S: this,
|
|
2167
|
+
A: [
|
|
2168
|
+
"message.target",
|
|
2169
|
+
"'target is missing'"
|
|
2170
|
+
]
|
|
2171
|
+
});
|
|
2172
|
+
(0, import_invariant6.invariant)(message.target.length === 1, "target should have exactly one item", {
|
|
2173
|
+
F: __dxlog_file7,
|
|
2174
|
+
L: 160,
|
|
2175
|
+
S: this,
|
|
2176
|
+
A: [
|
|
2177
|
+
"message.target.length === 1",
|
|
2178
|
+
"'target should have exactly one item'"
|
|
2179
|
+
]
|
|
2180
|
+
});
|
|
2181
|
+
this.onMessage.emit({
|
|
2182
|
+
author: message.source,
|
|
2183
|
+
recipient: message.target[0],
|
|
2184
|
+
payload: {
|
|
2185
|
+
type_url: payload.typeUrl,
|
|
2186
|
+
value: payload.value
|
|
2187
|
+
}
|
|
2188
|
+
});
|
|
2189
|
+
}
|
|
2190
|
+
_matchSelfPeerInfo(peer) {
|
|
2191
|
+
return peer && (peer.peerKey === this._edgeConnection.deviceKey.toHex() || peer.identityKey === this._edgeConnection.identityKey.toHex());
|
|
2192
|
+
}
|
|
2193
|
+
};
|
|
2194
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/utils.ts";
|
|
1938
2195
|
var setIdentityTags = ({ identityService, devicesService, setTag }) => {
|
|
1939
2196
|
identityService.queryIdentity().subscribe((idqr) => {
|
|
1940
2197
|
if (!idqr?.identity?.identityKey) {
|
|
1941
|
-
(0,
|
|
2198
|
+
(0, import_log8.log)("empty response from identity service", {
|
|
1942
2199
|
idqr
|
|
1943
2200
|
}, {
|
|
1944
|
-
F:
|
|
2201
|
+
F: __dxlog_file8,
|
|
1945
2202
|
L: 21,
|
|
1946
2203
|
S: void 0,
|
|
1947
2204
|
C: (f, a) => f(...a)
|
|
@@ -1952,18 +2209,18 @@ var setIdentityTags = ({ identityService, devicesService, setTag }) => {
|
|
|
1952
2209
|
});
|
|
1953
2210
|
devicesService.queryDevices().subscribe((dqr) => {
|
|
1954
2211
|
if (!dqr || !dqr.devices || dqr.devices.length === 0) {
|
|
1955
|
-
(0,
|
|
2212
|
+
(0, import_log8.log)("empty response from device service", {
|
|
1956
2213
|
device: dqr
|
|
1957
2214
|
}, {
|
|
1958
|
-
F:
|
|
2215
|
+
F: __dxlog_file8,
|
|
1959
2216
|
L: 30,
|
|
1960
2217
|
S: void 0,
|
|
1961
2218
|
C: (f, a) => f(...a)
|
|
1962
2219
|
});
|
|
1963
2220
|
return;
|
|
1964
2221
|
}
|
|
1965
|
-
(0,
|
|
1966
|
-
F:
|
|
2222
|
+
(0, import_invariant7.invariant)(dqr, "empty response from device service", {
|
|
2223
|
+
F: __dxlog_file8,
|
|
1967
2224
|
L: 33,
|
|
1968
2225
|
S: void 0,
|
|
1969
2226
|
A: [
|
|
@@ -1973,10 +2230,10 @@ var setIdentityTags = ({ identityService, devicesService, setTag }) => {
|
|
|
1973
2230
|
});
|
|
1974
2231
|
const thisDevice = dqr.devices.find((device) => device.kind === import_services.DeviceKind.CURRENT);
|
|
1975
2232
|
if (!thisDevice) {
|
|
1976
|
-
(0,
|
|
2233
|
+
(0, import_log8.log)("no current device", {
|
|
1977
2234
|
device: dqr
|
|
1978
2235
|
}, {
|
|
1979
|
-
F:
|
|
2236
|
+
F: __dxlog_file8,
|
|
1980
2237
|
L: 37,
|
|
1981
2238
|
S: void 0,
|
|
1982
2239
|
C: (f, a) => f(...a)
|
|
@@ -1988,9 +2245,11 @@ var setIdentityTags = ({ identityService, devicesService, setTag }) => {
|
|
|
1988
2245
|
};
|
|
1989
2246
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1990
2247
|
0 && (module.exports = {
|
|
2248
|
+
EdgeSignalManager,
|
|
1991
2249
|
MemorySignalManager,
|
|
1992
2250
|
MemorySignalManagerContext,
|
|
1993
2251
|
Messenger,
|
|
2252
|
+
PeerInfoHash,
|
|
1994
2253
|
SignalClient,
|
|
1995
2254
|
WebsocketSignalManager,
|
|
1996
2255
|
setIdentityTags
|