@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
package/dist/lib/node/index.cjs
CHANGED
|
@@ -165,15 +165,29 @@ var Connection = class {
|
|
|
165
165
|
this._transport = this._transportFactory.createTransport({
|
|
166
166
|
initiator: this.initiator,
|
|
167
167
|
stream: this._protocol.stream,
|
|
168
|
-
sendSignal: async (signal) =>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
sendSignal: async (signal) => {
|
|
169
|
+
try {
|
|
170
|
+
await this._signalMessaging.signal({
|
|
171
|
+
author: this.ownId,
|
|
172
|
+
recipient: this.remoteId,
|
|
173
|
+
sessionId: this.sessionId,
|
|
174
|
+
topic: this.topic,
|
|
175
|
+
data: {
|
|
176
|
+
signal
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
} catch (err) {
|
|
180
|
+
(0, import_log.log)("Signal failed", {
|
|
181
|
+
err
|
|
182
|
+
}, {
|
|
183
|
+
file: "connection.ts",
|
|
184
|
+
line: 122,
|
|
185
|
+
scope: this,
|
|
186
|
+
callSite: (f, a) => f(...a)
|
|
187
|
+
});
|
|
188
|
+
await this.close();
|
|
175
189
|
}
|
|
176
|
-
}
|
|
190
|
+
}
|
|
177
191
|
});
|
|
178
192
|
this._transport.connected.once(() => {
|
|
179
193
|
this._changeState(ConnectionState.CONNECTED);
|
|
@@ -195,7 +209,7 @@ var Connection = class {
|
|
|
195
209
|
id: this._instanceId
|
|
196
210
|
}), {
|
|
197
211
|
file: "connection.ts",
|
|
198
|
-
line:
|
|
212
|
+
line: 150,
|
|
199
213
|
scope: this,
|
|
200
214
|
callSite: (f, a) => f(...a)
|
|
201
215
|
});
|
|
@@ -210,7 +224,7 @@ var Connection = class {
|
|
|
210
224
|
peerId: this.ownId
|
|
211
225
|
}, {
|
|
212
226
|
file: "connection.ts",
|
|
213
|
-
line:
|
|
227
|
+
line: 160,
|
|
214
228
|
scope: this,
|
|
215
229
|
callSite: (f, a) => f(...a)
|
|
216
230
|
});
|
|
@@ -219,7 +233,7 @@ var Connection = class {
|
|
|
219
233
|
} catch (err) {
|
|
220
234
|
import_log.log.catch(err, {}, {
|
|
221
235
|
file: "connection.ts",
|
|
222
|
-
line:
|
|
236
|
+
line: 166,
|
|
223
237
|
scope: this,
|
|
224
238
|
callSite: (f, a) => f(...a)
|
|
225
239
|
});
|
|
@@ -229,7 +243,7 @@ var Connection = class {
|
|
|
229
243
|
} catch (err1) {
|
|
230
244
|
import_log.log.catch(err1, {}, {
|
|
231
245
|
file: "connection.ts",
|
|
232
|
-
line:
|
|
246
|
+
line: 173,
|
|
233
247
|
scope: this,
|
|
234
248
|
callSite: (f, a) => f(...a)
|
|
235
249
|
});
|
|
@@ -238,7 +252,7 @@ var Connection = class {
|
|
|
238
252
|
peerId: this.ownId
|
|
239
253
|
}, {
|
|
240
254
|
file: "connection.ts",
|
|
241
|
-
line:
|
|
255
|
+
line: 176,
|
|
242
256
|
scope: this,
|
|
243
257
|
callSite: (f, a) => f(...a)
|
|
244
258
|
});
|
|
@@ -250,7 +264,7 @@ var Connection = class {
|
|
|
250
264
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
251
265
|
(0, import_log.log)("dropping signal for incorrect session id", {}, {
|
|
252
266
|
file: "connection.ts",
|
|
253
|
-
line:
|
|
267
|
+
line: 183,
|
|
254
268
|
scope: this,
|
|
255
269
|
callSite: (f, a) => f(...a)
|
|
256
270
|
});
|
|
@@ -266,7 +280,7 @@ var Connection = class {
|
|
|
266
280
|
msg: msg.data
|
|
267
281
|
}, {
|
|
268
282
|
file: "connection.ts",
|
|
269
|
-
line:
|
|
283
|
+
line: 191,
|
|
270
284
|
scope: this,
|
|
271
285
|
callSite: (f, a) => f(...a)
|
|
272
286
|
});
|
|
@@ -280,7 +294,7 @@ var Connection = class {
|
|
|
280
294
|
msg: msg.data
|
|
281
295
|
}, {
|
|
282
296
|
file: "connection.ts",
|
|
283
|
-
line:
|
|
297
|
+
line: 197,
|
|
284
298
|
scope: this,
|
|
285
299
|
callSite: (f, a) => f(...a)
|
|
286
300
|
});
|
|
@@ -293,7 +307,7 @@ var Connection = class {
|
|
|
293
307
|
peerId: this.ownId
|
|
294
308
|
}, {
|
|
295
309
|
file: "connection.ts",
|
|
296
|
-
line:
|
|
310
|
+
line: 202,
|
|
297
311
|
scope: this,
|
|
298
312
|
callSite: (f, a) => f(...a)
|
|
299
313
|
});
|
|
@@ -370,16 +384,11 @@ var SwarmMessenger = class {
|
|
|
370
384
|
async signal(message) {
|
|
371
385
|
var _a;
|
|
372
386
|
(0, import_node_assert2.default)((_a = message.data) == null ? void 0 : _a.signal);
|
|
373
|
-
|
|
387
|
+
await this._sendReliableMessage({
|
|
374
388
|
author: message.author,
|
|
375
389
|
recipient: message.recipient,
|
|
376
390
|
message
|
|
377
|
-
})
|
|
378
|
-
file: "swarm-messenger.ts",
|
|
379
|
-
line: 85,
|
|
380
|
-
scope: this,
|
|
381
|
-
callSite: (f, a) => f(...a)
|
|
382
|
-
}));
|
|
391
|
+
});
|
|
383
392
|
}
|
|
384
393
|
async offer(message) {
|
|
385
394
|
const networkMessage = {
|
|
@@ -414,7 +423,7 @@ var SwarmMessenger = class {
|
|
|
414
423
|
scope: this,
|
|
415
424
|
callSite: (f, a) => f(...a)
|
|
416
425
|
});
|
|
417
|
-
|
|
426
|
+
await this._sendMessage({
|
|
418
427
|
author,
|
|
419
428
|
recipient,
|
|
420
429
|
payload: {
|
|
@@ -463,12 +472,7 @@ var SwarmMessenger = class {
|
|
|
463
472
|
answer
|
|
464
473
|
}
|
|
465
474
|
}
|
|
466
|
-
})
|
|
467
|
-
file: "swarm-messenger.ts",
|
|
468
|
-
line: 166,
|
|
469
|
-
scope: this,
|
|
470
|
-
callSite: (f, a) => f(...a)
|
|
471
|
-
}));
|
|
475
|
+
});
|
|
472
476
|
}
|
|
473
477
|
async _handleSignal({ author, recipient, message }) {
|
|
474
478
|
(0, import_node_assert2.default)(message.messageId);
|
|
@@ -870,10 +874,19 @@ var Swarm = class {
|
|
|
870
874
|
this._messenger.listen({
|
|
871
875
|
peerId: this._ownPeerId,
|
|
872
876
|
payloadType: "dxos.mesh.swarm.SwarmMessage",
|
|
873
|
-
onMessage: async (message) =>
|
|
877
|
+
onMessage: async (message) => {
|
|
878
|
+
await this._swarmMessenger.receiveMessage(message).catch((err) => (0, import_log4.log)("Error while receiving message", {
|
|
879
|
+
err
|
|
880
|
+
}, {
|
|
881
|
+
file: "swarm.ts",
|
|
882
|
+
line: 105,
|
|
883
|
+
scope: this,
|
|
884
|
+
callSite: (f, a) => f(...a)
|
|
885
|
+
}));
|
|
886
|
+
}
|
|
874
887
|
}).catch((error) => import_log4.log.catch(error, {}, {
|
|
875
888
|
file: "swarm.ts",
|
|
876
|
-
line:
|
|
889
|
+
line: 108,
|
|
877
890
|
scope: this,
|
|
878
891
|
callSite: (f, a) => f(...a)
|
|
879
892
|
}));
|
|
@@ -881,7 +894,7 @@ var Swarm = class {
|
|
|
881
894
|
id: this._instanceId
|
|
882
895
|
}), {
|
|
883
896
|
file: "swarm.ts",
|
|
884
|
-
line:
|
|
897
|
+
line: 110,
|
|
885
898
|
scope: this,
|
|
886
899
|
callSite: (f, a) => f(...a)
|
|
887
900
|
});
|
|
@@ -905,7 +918,7 @@ var Swarm = class {
|
|
|
905
918
|
async destroy() {
|
|
906
919
|
(0, import_log4.log)("destroying...", {}, {
|
|
907
920
|
file: "swarm.ts",
|
|
908
|
-
line:
|
|
921
|
+
line: 138,
|
|
909
922
|
scope: this,
|
|
910
923
|
callSite: (f, a) => f(...a)
|
|
911
924
|
});
|
|
@@ -914,7 +927,7 @@ var Swarm = class {
|
|
|
914
927
|
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
|
|
915
928
|
(0, import_log4.log)("destroyed", {}, {
|
|
916
929
|
file: "swarm.ts",
|
|
917
|
-
line:
|
|
930
|
+
line: 142,
|
|
918
931
|
scope: this,
|
|
919
932
|
callSite: (f, a) => f(...a)
|
|
920
933
|
});
|
|
@@ -929,7 +942,7 @@ var Swarm = class {
|
|
|
929
942
|
topology: getClassName(topology)
|
|
930
943
|
}, {
|
|
931
944
|
file: "swarm.ts",
|
|
932
|
-
line:
|
|
945
|
+
line: 150,
|
|
933
946
|
scope: this,
|
|
934
947
|
callSite: (f, a) => f(...a)
|
|
935
948
|
});
|
|
@@ -944,14 +957,14 @@ var Swarm = class {
|
|
|
944
957
|
swarmEvent
|
|
945
958
|
}, {
|
|
946
959
|
file: "swarm.ts",
|
|
947
|
-
line:
|
|
960
|
+
line: 163,
|
|
948
961
|
scope: this,
|
|
949
962
|
callSite: (f, a) => f(...a)
|
|
950
963
|
});
|
|
951
964
|
if (this._ctx.disposed) {
|
|
952
965
|
(0, import_log4.log)("swarm event ignored for disposed swarm", {}, {
|
|
953
966
|
file: "swarm.ts",
|
|
954
|
-
line:
|
|
967
|
+
line: 166,
|
|
955
968
|
scope: this,
|
|
956
969
|
callSite: (f, a) => f(...a)
|
|
957
970
|
});
|
|
@@ -963,7 +976,7 @@ var Swarm = class {
|
|
|
963
976
|
peerId
|
|
964
977
|
}, {
|
|
965
978
|
file: "swarm.ts",
|
|
966
|
-
line:
|
|
979
|
+
line: 172,
|
|
967
980
|
scope: this,
|
|
968
981
|
callSite: (f, a) => f(...a)
|
|
969
982
|
});
|
|
@@ -978,7 +991,7 @@ var Swarm = class {
|
|
|
978
991
|
if (((_a = peer1.connection) == null ? void 0 : _a.state) !== ConnectionState.CONNECTED) {
|
|
979
992
|
void this._destroyPeer(peer1.id).catch((err) => import_log4.log.catch(err, {}, {
|
|
980
993
|
file: "swarm.ts",
|
|
981
|
-
line:
|
|
994
|
+
line: 183,
|
|
982
995
|
scope: this,
|
|
983
996
|
callSite: (f, a) => f(...a)
|
|
984
997
|
}));
|
|
@@ -993,14 +1006,14 @@ var Swarm = class {
|
|
|
993
1006
|
message
|
|
994
1007
|
}, {
|
|
995
1008
|
file: "swarm.ts",
|
|
996
|
-
line:
|
|
1009
|
+
line: 193,
|
|
997
1010
|
scope: this,
|
|
998
1011
|
callSite: (f, a) => f(...a)
|
|
999
1012
|
});
|
|
1000
1013
|
if (this._ctx.disposed) {
|
|
1001
1014
|
(0, import_log4.log)("ignored for disposed swarm", {}, {
|
|
1002
1015
|
file: "swarm.ts",
|
|
1003
|
-
line:
|
|
1016
|
+
line: 195,
|
|
1004
1017
|
scope: this,
|
|
1005
1018
|
callSite: (f, a) => f(...a)
|
|
1006
1019
|
});
|
|
@@ -1014,7 +1027,7 @@ var Swarm = class {
|
|
|
1014
1027
|
message
|
|
1015
1028
|
}, {
|
|
1016
1029
|
file: "swarm.ts",
|
|
1017
|
-
line:
|
|
1030
|
+
line: 202,
|
|
1018
1031
|
scope: this,
|
|
1019
1032
|
callSite: (f, a) => f(...a)
|
|
1020
1033
|
});
|
|
@@ -1027,7 +1040,7 @@ var Swarm = class {
|
|
|
1027
1040
|
message
|
|
1028
1041
|
}, {
|
|
1029
1042
|
file: "swarm.ts",
|
|
1030
|
-
line:
|
|
1043
|
+
line: 206,
|
|
1031
1044
|
scope: this,
|
|
1032
1045
|
callSite: (f, a) => f(...a)
|
|
1033
1046
|
});
|
|
@@ -1046,14 +1059,14 @@ var Swarm = class {
|
|
|
1046
1059
|
message
|
|
1047
1060
|
}, {
|
|
1048
1061
|
file: "swarm.ts",
|
|
1049
|
-
line:
|
|
1062
|
+
line: 218,
|
|
1050
1063
|
scope: this,
|
|
1051
1064
|
callSite: (f, a) => f(...a)
|
|
1052
1065
|
});
|
|
1053
1066
|
if (this._ctx.disposed) {
|
|
1054
1067
|
import_log4.log.info("ignored for offline swarm", {}, {
|
|
1055
1068
|
file: "swarm.ts",
|
|
1056
|
-
line:
|
|
1069
|
+
line: 220,
|
|
1057
1070
|
scope: this,
|
|
1058
1071
|
callSite: (f, a) => f(...a)
|
|
1059
1072
|
});
|
|
@@ -1134,7 +1147,7 @@ var Swarm = class {
|
|
|
1134
1147
|
} catch (err) {
|
|
1135
1148
|
(0, import_log4.log)("initiation error", err, {
|
|
1136
1149
|
file: "swarm.ts",
|
|
1137
|
-
line:
|
|
1150
|
+
line: 323,
|
|
1138
1151
|
scope: this,
|
|
1139
1152
|
callSite: (f, a) => f(...a)
|
|
1140
1153
|
});
|
|
@@ -1162,7 +1175,7 @@ var Swarm = class {
|
|
|
1162
1175
|
remoteId
|
|
1163
1176
|
}, {
|
|
1164
1177
|
file: "swarm.ts",
|
|
1165
|
-
line:
|
|
1178
|
+
line: 350,
|
|
1166
1179
|
scope: this,
|
|
1167
1180
|
callSite: (f, a) => f(...a)
|
|
1168
1181
|
});
|
|
@@ -1179,7 +1192,7 @@ var Swarm = class {
|
|
|
1179
1192
|
remoteId
|
|
1180
1193
|
}, {
|
|
1181
1194
|
file: "swarm.ts",
|
|
1182
|
-
line:
|
|
1195
|
+
line: 364,
|
|
1183
1196
|
scope: this,
|
|
1184
1197
|
callSite: (f, a) => f(...a)
|
|
1185
1198
|
});
|
|
@@ -1189,7 +1202,7 @@ var Swarm = class {
|
|
|
1189
1202
|
remoteId
|
|
1190
1203
|
}, {
|
|
1191
1204
|
file: "swarm.ts",
|
|
1192
|
-
line:
|
|
1205
|
+
line: 367,
|
|
1193
1206
|
scope: this,
|
|
1194
1207
|
callSite: (f, a) => f(...a)
|
|
1195
1208
|
});
|