@dxos/network-manager 0.1.48-next.83f55fd → 0.1.48
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/{chunk-CVPTBFWI.mjs → chunk-6HMQOZ2C.mjs} +65 -52
- package/dist/lib/browser/chunk-6HMQOZ2C.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +64 -51
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +64 -51
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/signal/swarm-messenger.ts +4 -4
- package/src/swarm/connection.ts +15 -8
- package/src/swarm/swarm.ts +5 -1
- package/src/tests/basic-test-suite.ts +6 -6
- package/dist/lib/browser/chunk-CVPTBFWI.mjs.map +0 -7
|
@@ -114,15 +114,29 @@ var Connection = class {
|
|
|
114
114
|
this._transport = this._transportFactory.createTransport({
|
|
115
115
|
initiator: this.initiator,
|
|
116
116
|
stream: this._protocol.stream,
|
|
117
|
-
sendSignal: async (signal) =>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
sendSignal: async (signal) => {
|
|
118
|
+
try {
|
|
119
|
+
await this._signalMessaging.signal({
|
|
120
|
+
author: this.ownId,
|
|
121
|
+
recipient: this.remoteId,
|
|
122
|
+
sessionId: this.sessionId,
|
|
123
|
+
topic: this.topic,
|
|
124
|
+
data: {
|
|
125
|
+
signal
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
} catch (err) {
|
|
129
|
+
log("Signal failed", {
|
|
130
|
+
err
|
|
131
|
+
}, {
|
|
132
|
+
file: "connection.ts",
|
|
133
|
+
line: 122,
|
|
134
|
+
scope: this,
|
|
135
|
+
callSite: (f, a) => f(...a)
|
|
136
|
+
});
|
|
137
|
+
await this.close();
|
|
124
138
|
}
|
|
125
|
-
}
|
|
139
|
+
}
|
|
126
140
|
});
|
|
127
141
|
this._transport.connected.once(() => {
|
|
128
142
|
this._changeState(ConnectionState.CONNECTED);
|
|
@@ -144,7 +158,7 @@ var Connection = class {
|
|
|
144
158
|
id: this._instanceId
|
|
145
159
|
}), {
|
|
146
160
|
file: "connection.ts",
|
|
147
|
-
line:
|
|
161
|
+
line: 150,
|
|
148
162
|
scope: this,
|
|
149
163
|
callSite: (f, a) => f(...a)
|
|
150
164
|
});
|
|
@@ -159,7 +173,7 @@ var Connection = class {
|
|
|
159
173
|
peerId: this.ownId
|
|
160
174
|
}, {
|
|
161
175
|
file: "connection.ts",
|
|
162
|
-
line:
|
|
176
|
+
line: 160,
|
|
163
177
|
scope: this,
|
|
164
178
|
callSite: (f, a) => f(...a)
|
|
165
179
|
});
|
|
@@ -168,7 +182,7 @@ var Connection = class {
|
|
|
168
182
|
} catch (err) {
|
|
169
183
|
log.catch(err, {}, {
|
|
170
184
|
file: "connection.ts",
|
|
171
|
-
line:
|
|
185
|
+
line: 166,
|
|
172
186
|
scope: this,
|
|
173
187
|
callSite: (f, a) => f(...a)
|
|
174
188
|
});
|
|
@@ -178,7 +192,7 @@ var Connection = class {
|
|
|
178
192
|
} catch (err1) {
|
|
179
193
|
log.catch(err1, {}, {
|
|
180
194
|
file: "connection.ts",
|
|
181
|
-
line:
|
|
195
|
+
line: 173,
|
|
182
196
|
scope: this,
|
|
183
197
|
callSite: (f, a) => f(...a)
|
|
184
198
|
});
|
|
@@ -187,7 +201,7 @@ var Connection = class {
|
|
|
187
201
|
peerId: this.ownId
|
|
188
202
|
}, {
|
|
189
203
|
file: "connection.ts",
|
|
190
|
-
line:
|
|
204
|
+
line: 176,
|
|
191
205
|
scope: this,
|
|
192
206
|
callSite: (f, a) => f(...a)
|
|
193
207
|
});
|
|
@@ -199,7 +213,7 @@ var Connection = class {
|
|
|
199
213
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
200
214
|
log("dropping signal for incorrect session id", {}, {
|
|
201
215
|
file: "connection.ts",
|
|
202
|
-
line:
|
|
216
|
+
line: 183,
|
|
203
217
|
scope: this,
|
|
204
218
|
callSite: (f, a) => f(...a)
|
|
205
219
|
});
|
|
@@ -215,7 +229,7 @@ var Connection = class {
|
|
|
215
229
|
msg: msg.data
|
|
216
230
|
}, {
|
|
217
231
|
file: "connection.ts",
|
|
218
|
-
line:
|
|
232
|
+
line: 191,
|
|
219
233
|
scope: this,
|
|
220
234
|
callSite: (f, a) => f(...a)
|
|
221
235
|
});
|
|
@@ -229,7 +243,7 @@ var Connection = class {
|
|
|
229
243
|
msg: msg.data
|
|
230
244
|
}, {
|
|
231
245
|
file: "connection.ts",
|
|
232
|
-
line:
|
|
246
|
+
line: 197,
|
|
233
247
|
scope: this,
|
|
234
248
|
callSite: (f, a) => f(...a)
|
|
235
249
|
});
|
|
@@ -242,7 +256,7 @@ var Connection = class {
|
|
|
242
256
|
peerId: this.ownId
|
|
243
257
|
}, {
|
|
244
258
|
file: "connection.ts",
|
|
245
|
-
line:
|
|
259
|
+
line: 202,
|
|
246
260
|
scope: this,
|
|
247
261
|
callSite: (f, a) => f(...a)
|
|
248
262
|
});
|
|
@@ -309,16 +323,11 @@ var SwarmMessenger = class {
|
|
|
309
323
|
async signal(message) {
|
|
310
324
|
var _a;
|
|
311
325
|
assert2((_a = message.data) == null ? void 0 : _a.signal);
|
|
312
|
-
|
|
326
|
+
await this._sendReliableMessage({
|
|
313
327
|
author: message.author,
|
|
314
328
|
recipient: message.recipient,
|
|
315
329
|
message
|
|
316
|
-
})
|
|
317
|
-
file: "swarm-messenger.ts",
|
|
318
|
-
line: 85,
|
|
319
|
-
scope: this,
|
|
320
|
-
callSite: (f, a) => f(...a)
|
|
321
|
-
}));
|
|
330
|
+
});
|
|
322
331
|
}
|
|
323
332
|
async offer(message) {
|
|
324
333
|
const networkMessage = {
|
|
@@ -353,7 +362,7 @@ var SwarmMessenger = class {
|
|
|
353
362
|
scope: this,
|
|
354
363
|
callSite: (f, a) => f(...a)
|
|
355
364
|
});
|
|
356
|
-
|
|
365
|
+
await this._sendMessage({
|
|
357
366
|
author,
|
|
358
367
|
recipient,
|
|
359
368
|
payload: {
|
|
@@ -402,12 +411,7 @@ var SwarmMessenger = class {
|
|
|
402
411
|
answer
|
|
403
412
|
}
|
|
404
413
|
}
|
|
405
|
-
})
|
|
406
|
-
file: "swarm-messenger.ts",
|
|
407
|
-
line: 166,
|
|
408
|
-
scope: this,
|
|
409
|
-
callSite: (f, a) => f(...a)
|
|
410
|
-
}));
|
|
414
|
+
});
|
|
411
415
|
}
|
|
412
416
|
async _handleSignal({ author, recipient, message }) {
|
|
413
417
|
assert2(message.messageId);
|
|
@@ -819,10 +823,19 @@ var Swarm = class {
|
|
|
819
823
|
this._messenger.listen({
|
|
820
824
|
peerId: this._ownPeerId,
|
|
821
825
|
payloadType: "dxos.mesh.swarm.SwarmMessage",
|
|
822
|
-
onMessage: async (message) =>
|
|
826
|
+
onMessage: async (message) => {
|
|
827
|
+
await this._swarmMessenger.receiveMessage(message).catch((err) => log4("Error while receiving message", {
|
|
828
|
+
err
|
|
829
|
+
}, {
|
|
830
|
+
file: "swarm.ts",
|
|
831
|
+
line: 105,
|
|
832
|
+
scope: this,
|
|
833
|
+
callSite: (f, a) => f(...a)
|
|
834
|
+
}));
|
|
835
|
+
}
|
|
823
836
|
}).catch((error) => log4.catch(error, {}, {
|
|
824
837
|
file: "swarm.ts",
|
|
825
|
-
line:
|
|
838
|
+
line: 108,
|
|
826
839
|
scope: this,
|
|
827
840
|
callSite: (f, a) => f(...a)
|
|
828
841
|
}));
|
|
@@ -830,7 +843,7 @@ var Swarm = class {
|
|
|
830
843
|
id: this._instanceId
|
|
831
844
|
}), {
|
|
832
845
|
file: "swarm.ts",
|
|
833
|
-
line:
|
|
846
|
+
line: 110,
|
|
834
847
|
scope: this,
|
|
835
848
|
callSite: (f, a) => f(...a)
|
|
836
849
|
});
|
|
@@ -854,7 +867,7 @@ var Swarm = class {
|
|
|
854
867
|
async destroy() {
|
|
855
868
|
log4("destroying...", {}, {
|
|
856
869
|
file: "swarm.ts",
|
|
857
|
-
line:
|
|
870
|
+
line: 138,
|
|
858
871
|
scope: this,
|
|
859
872
|
callSite: (f, a) => f(...a)
|
|
860
873
|
});
|
|
@@ -863,7 +876,7 @@ var Swarm = class {
|
|
|
863
876
|
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
|
|
864
877
|
log4("destroyed", {}, {
|
|
865
878
|
file: "swarm.ts",
|
|
866
|
-
line:
|
|
879
|
+
line: 142,
|
|
867
880
|
scope: this,
|
|
868
881
|
callSite: (f, a) => f(...a)
|
|
869
882
|
});
|
|
@@ -878,7 +891,7 @@ var Swarm = class {
|
|
|
878
891
|
topology: getClassName(topology)
|
|
879
892
|
}, {
|
|
880
893
|
file: "swarm.ts",
|
|
881
|
-
line:
|
|
894
|
+
line: 150,
|
|
882
895
|
scope: this,
|
|
883
896
|
callSite: (f, a) => f(...a)
|
|
884
897
|
});
|
|
@@ -893,14 +906,14 @@ var Swarm = class {
|
|
|
893
906
|
swarmEvent
|
|
894
907
|
}, {
|
|
895
908
|
file: "swarm.ts",
|
|
896
|
-
line:
|
|
909
|
+
line: 163,
|
|
897
910
|
scope: this,
|
|
898
911
|
callSite: (f, a) => f(...a)
|
|
899
912
|
});
|
|
900
913
|
if (this._ctx.disposed) {
|
|
901
914
|
log4("swarm event ignored for disposed swarm", {}, {
|
|
902
915
|
file: "swarm.ts",
|
|
903
|
-
line:
|
|
916
|
+
line: 166,
|
|
904
917
|
scope: this,
|
|
905
918
|
callSite: (f, a) => f(...a)
|
|
906
919
|
});
|
|
@@ -912,7 +925,7 @@ var Swarm = class {
|
|
|
912
925
|
peerId
|
|
913
926
|
}, {
|
|
914
927
|
file: "swarm.ts",
|
|
915
|
-
line:
|
|
928
|
+
line: 172,
|
|
916
929
|
scope: this,
|
|
917
930
|
callSite: (f, a) => f(...a)
|
|
918
931
|
});
|
|
@@ -927,7 +940,7 @@ var Swarm = class {
|
|
|
927
940
|
if (((_a = peer1.connection) == null ? void 0 : _a.state) !== ConnectionState.CONNECTED) {
|
|
928
941
|
void this._destroyPeer(peer1.id).catch((err) => log4.catch(err, {}, {
|
|
929
942
|
file: "swarm.ts",
|
|
930
|
-
line:
|
|
943
|
+
line: 183,
|
|
931
944
|
scope: this,
|
|
932
945
|
callSite: (f, a) => f(...a)
|
|
933
946
|
}));
|
|
@@ -942,14 +955,14 @@ var Swarm = class {
|
|
|
942
955
|
message
|
|
943
956
|
}, {
|
|
944
957
|
file: "swarm.ts",
|
|
945
|
-
line:
|
|
958
|
+
line: 193,
|
|
946
959
|
scope: this,
|
|
947
960
|
callSite: (f, a) => f(...a)
|
|
948
961
|
});
|
|
949
962
|
if (this._ctx.disposed) {
|
|
950
963
|
log4("ignored for disposed swarm", {}, {
|
|
951
964
|
file: "swarm.ts",
|
|
952
|
-
line:
|
|
965
|
+
line: 195,
|
|
953
966
|
scope: this,
|
|
954
967
|
callSite: (f, a) => f(...a)
|
|
955
968
|
});
|
|
@@ -963,7 +976,7 @@ var Swarm = class {
|
|
|
963
976
|
message
|
|
964
977
|
}, {
|
|
965
978
|
file: "swarm.ts",
|
|
966
|
-
line:
|
|
979
|
+
line: 202,
|
|
967
980
|
scope: this,
|
|
968
981
|
callSite: (f, a) => f(...a)
|
|
969
982
|
});
|
|
@@ -976,7 +989,7 @@ var Swarm = class {
|
|
|
976
989
|
message
|
|
977
990
|
}, {
|
|
978
991
|
file: "swarm.ts",
|
|
979
|
-
line:
|
|
992
|
+
line: 206,
|
|
980
993
|
scope: this,
|
|
981
994
|
callSite: (f, a) => f(...a)
|
|
982
995
|
});
|
|
@@ -995,14 +1008,14 @@ var Swarm = class {
|
|
|
995
1008
|
message
|
|
996
1009
|
}, {
|
|
997
1010
|
file: "swarm.ts",
|
|
998
|
-
line:
|
|
1011
|
+
line: 218,
|
|
999
1012
|
scope: this,
|
|
1000
1013
|
callSite: (f, a) => f(...a)
|
|
1001
1014
|
});
|
|
1002
1015
|
if (this._ctx.disposed) {
|
|
1003
1016
|
log4.info("ignored for offline swarm", {}, {
|
|
1004
1017
|
file: "swarm.ts",
|
|
1005
|
-
line:
|
|
1018
|
+
line: 220,
|
|
1006
1019
|
scope: this,
|
|
1007
1020
|
callSite: (f, a) => f(...a)
|
|
1008
1021
|
});
|
|
@@ -1083,7 +1096,7 @@ var Swarm = class {
|
|
|
1083
1096
|
} catch (err) {
|
|
1084
1097
|
log4("initiation error", err, {
|
|
1085
1098
|
file: "swarm.ts",
|
|
1086
|
-
line:
|
|
1099
|
+
line: 323,
|
|
1087
1100
|
scope: this,
|
|
1088
1101
|
callSite: (f, a) => f(...a)
|
|
1089
1102
|
});
|
|
@@ -1111,7 +1124,7 @@ var Swarm = class {
|
|
|
1111
1124
|
remoteId
|
|
1112
1125
|
}, {
|
|
1113
1126
|
file: "swarm.ts",
|
|
1114
|
-
line:
|
|
1127
|
+
line: 350,
|
|
1115
1128
|
scope: this,
|
|
1116
1129
|
callSite: (f, a) => f(...a)
|
|
1117
1130
|
});
|
|
@@ -1128,7 +1141,7 @@ var Swarm = class {
|
|
|
1128
1141
|
remoteId
|
|
1129
1142
|
}, {
|
|
1130
1143
|
file: "swarm.ts",
|
|
1131
|
-
line:
|
|
1144
|
+
line: 364,
|
|
1132
1145
|
scope: this,
|
|
1133
1146
|
callSite: (f, a) => f(...a)
|
|
1134
1147
|
});
|
|
@@ -1138,7 +1151,7 @@ var Swarm = class {
|
|
|
1138
1151
|
remoteId
|
|
1139
1152
|
}, {
|
|
1140
1153
|
file: "swarm.ts",
|
|
1141
|
-
line:
|
|
1154
|
+
line: 367,
|
|
1142
1155
|
scope: this,
|
|
1143
1156
|
callSite: (f, a) => f(...a)
|
|
1144
1157
|
});
|
|
@@ -2296,4 +2309,4 @@ export {
|
|
|
2296
2309
|
WebRTCTransportProxyFactory,
|
|
2297
2310
|
createTeleportProtocolFactory
|
|
2298
2311
|
};
|
|
2299
|
-
//# sourceMappingURL=chunk-
|
|
2312
|
+
//# sourceMappingURL=chunk-6HMQOZ2C.mjs.map
|