@dxos/network-manager 0.8.4-main.72ec0f3 → 0.8.4-main.7ace549

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.
@@ -144,21 +144,25 @@ var Connection = class {
144
144
  });
145
145
  this._protocolClosed.wake();
146
146
  this.close({
147
- error: new ProtocolError("protocol stream closed")
147
+ error: new ProtocolError({
148
+ message: "protocol stream closed"
149
+ })
148
150
  }).catch((err) => this.errors.raise(err));
149
151
  });
150
152
  scheduleTask(this.connectedTimeoutContext, async () => {
151
153
  log.info(`timeout waiting ${TRANSPORT_CONNECTION_TIMEOUT / 1e3}s for transport to connect, aborting`, void 0, {
152
154
  F: __dxlog_file,
153
- L: 194,
155
+ L: 196,
154
156
  S: this,
155
157
  C: (f, a) => f(...a)
156
158
  });
157
- await this.abort(new TimeoutError(`${TRANSPORT_CONNECTION_TIMEOUT / 1e3}s for transport to connect`)).catch((err) => this.errors.raise(err));
159
+ await this.abort(new TimeoutError({
160
+ message: `${TRANSPORT_CONNECTION_TIMEOUT / 1e3}s for transport to connect`
161
+ })).catch((err) => this.errors.raise(err));
158
162
  }, TRANSPORT_CONNECTION_TIMEOUT);
159
163
  invariant(!this._transport, void 0, {
160
164
  F: __dxlog_file,
161
- L: 202,
165
+ L: 204,
162
166
  S: this,
163
167
  A: [
164
168
  "!this._transport",
@@ -185,7 +189,7 @@ var Connection = class {
185
189
  this._transportClosed.wake();
186
190
  log("abort triggered by transport close", void 0, {
187
191
  F: __dxlog_file,
188
- L: 224,
192
+ L: 226,
189
193
  S: this,
190
194
  C: (f, a) => f(...a)
191
195
  });
@@ -196,7 +200,7 @@ var Connection = class {
196
200
  err
197
201
  }, {
198
202
  F: __dxlog_file,
199
- L: 229,
203
+ L: 231,
200
204
  S: this,
201
205
  C: (f, a) => f(...a)
202
206
  });
@@ -206,7 +210,7 @@ var Connection = class {
206
210
  if (err instanceof ConnectionResetError) {
207
211
  log.info("aborting due to transport ConnectionResetError", void 0, {
208
212
  F: __dxlog_file,
209
- L: 236,
213
+ L: 238,
210
214
  S: this,
211
215
  C: (f, a) => f(...a)
212
216
  });
@@ -214,7 +218,7 @@ var Connection = class {
214
218
  } else if (err instanceof ConnectivityError) {
215
219
  log.info("aborting due to transport ConnectivityError", void 0, {
216
220
  F: __dxlog_file,
217
- L: 239,
221
+ L: 241,
218
222
  S: this,
219
223
  C: (f, a) => f(...a)
220
224
  });
@@ -234,7 +238,7 @@ var Connection = class {
234
238
  id: this._instanceId
235
239
  }), {
236
240
  F: __dxlog_file,
237
- L: 258,
241
+ L: 260,
238
242
  S: this,
239
243
  C: (f, a) => f(...a)
240
244
  });
@@ -244,14 +248,14 @@ var Connection = class {
244
248
  err
245
249
  }, {
246
250
  F: __dxlog_file,
247
- L: 265,
251
+ L: 267,
248
252
  S: this,
249
253
  C: (f, a) => f(...a)
250
254
  });
251
255
  if (this._state === "CLOSED" || this._state === "ABORTED") {
252
256
  log(`abort ignored: already ${this._state}`, this.closeReason, {
253
257
  F: __dxlog_file,
254
- L: 267,
258
+ L: 269,
255
259
  S: this,
256
260
  C: (f, a) => f(...a)
257
261
  });
@@ -268,7 +272,7 @@ var Connection = class {
268
272
  err
269
273
  }, {
270
274
  F: __dxlog_file,
271
- L: 279,
275
+ L: 281,
272
276
  S: this,
273
277
  C: (f, a) => f(...a)
274
278
  });
@@ -279,7 +283,7 @@ var Connection = class {
279
283
  } catch (err2) {
280
284
  log.catch(err2, void 0, {
281
285
  F: __dxlog_file,
282
- L: 285,
286
+ L: 287,
283
287
  S: this,
284
288
  C: (f, a) => f(...a)
285
289
  });
@@ -289,7 +293,7 @@ var Connection = class {
289
293
  } catch (err2) {
290
294
  log.catch(err2, void 0, {
291
295
  F: __dxlog_file,
292
- L: 292,
296
+ L: 294,
293
297
  S: this,
294
298
  C: (f, a) => f(...a)
295
299
  });
@@ -299,7 +303,7 @@ var Connection = class {
299
303
  } catch (err2) {
300
304
  log.catch(err2, void 0, {
301
305
  F: __dxlog_file,
302
- L: 298,
306
+ L: 300,
303
307
  S: this,
304
308
  C: (f, a) => f(...a)
305
309
  });
@@ -311,7 +315,7 @@ var Connection = class {
311
315
  error
312
316
  }, {
313
317
  F: __dxlog_file,
314
- L: 305,
318
+ L: 307,
315
319
  S: this,
316
320
  C: (f, a) => f(...a)
317
321
  });
@@ -326,7 +330,7 @@ var Connection = class {
326
330
  error
327
331
  }, {
328
332
  F: __dxlog_file,
329
- L: 316,
333
+ L: 318,
330
334
  S: this,
331
335
  C: (f, a) => f(...a)
332
336
  });
@@ -340,7 +344,7 @@ var Connection = class {
340
344
  if (lastState !== "CONNECTED" || error != null) {
341
345
  log(`graceful close requested when we were in ${lastState} state? aborting`, void 0, {
342
346
  F: __dxlog_file,
343
- L: 327,
347
+ L: 329,
344
348
  S: this,
345
349
  C: (f, a) => f(...a)
346
350
  });
@@ -352,7 +356,7 @@ var Connection = class {
352
356
  error
353
357
  }, {
354
358
  F: __dxlog_file,
355
- L: 331,
359
+ L: 333,
356
360
  S: this,
357
361
  C: (f, a) => f(...a)
358
362
  });
@@ -363,7 +367,7 @@ var Connection = class {
363
367
  } catch (err) {
364
368
  log.catch(err, void 0, {
365
369
  F: __dxlog_file,
366
- L: 336,
370
+ L: 338,
367
371
  S: this,
368
372
  C: (f, a) => f(...a)
369
373
  });
@@ -373,7 +377,7 @@ var Connection = class {
373
377
  } catch (err) {
374
378
  log.catch(err, void 0, {
375
379
  F: __dxlog_file,
376
- L: 342,
380
+ L: 344,
377
381
  S: this,
378
382
  C: (f, a) => f(...a)
379
383
  });
@@ -382,7 +386,7 @@ var Connection = class {
382
386
  peerId: this.localInfo
383
387
  }, {
384
388
  F: __dxlog_file,
385
- L: 345,
389
+ L: 347,
386
390
  S: this,
387
391
  C: (f, a) => f(...a)
388
392
  });
@@ -392,7 +396,7 @@ var Connection = class {
392
396
  async _closeProtocol(options) {
393
397
  log("closing protocol", options, {
394
398
  F: __dxlog_file,
395
- L: 351,
399
+ L: 353,
396
400
  S: this,
397
401
  C: (f, a) => f(...a)
398
402
  });
@@ -402,7 +406,7 @@ var Connection = class {
402
406
  ]);
403
407
  log("protocol closed", options, {
404
408
  F: __dxlog_file,
405
- L: 353,
409
+ L: 355,
406
410
  S: this,
407
411
  C: (f, a) => f(...a)
408
412
  });
@@ -410,7 +414,7 @@ var Connection = class {
410
414
  async _closeTransport() {
411
415
  log("closing transport", void 0, {
412
416
  F: __dxlog_file,
413
- L: 357,
417
+ L: 359,
414
418
  S: this,
415
419
  C: (f, a) => f(...a)
416
420
  });
@@ -420,7 +424,7 @@ var Connection = class {
420
424
  ]);
421
425
  log("transport closed", void 0, {
422
426
  F: __dxlog_file,
423
- L: 359,
427
+ L: 361,
424
428
  S: this,
425
429
  C: (f, a) => f(...a)
426
430
  });
@@ -461,12 +465,15 @@ var Connection = class {
461
465
  err
462
466
  }, {
463
467
  F: __dxlog_file,
464
- L: 399,
468
+ L: 401,
465
469
  S: this,
466
470
  C: (f, a) => f(...a)
467
471
  });
468
472
  await this.close({
469
- error: new ConnectivityError("signal message failed to deliver", err)
473
+ error: new ConnectivityError({
474
+ message: "signal message failed to deliver",
475
+ cause: err
476
+ })
470
477
  });
471
478
  }
472
479
  }
@@ -476,7 +483,7 @@ var Connection = class {
476
483
  async signal(msg) {
477
484
  invariant(msg.sessionId, void 0, {
478
485
  F: __dxlog_file,
479
- L: 408,
486
+ L: 410,
480
487
  S: this,
481
488
  A: [
482
489
  "msg.sessionId",
@@ -486,7 +493,7 @@ var Connection = class {
486
493
  if (!msg.sessionId.equals(this.sessionId)) {
487
494
  log("dropping signal for incorrect session id", void 0, {
488
495
  F: __dxlog_file,
489
- L: 410,
496
+ L: 412,
490
497
  S: this,
491
498
  C: (f, a) => f(...a)
492
499
  });
@@ -494,7 +501,7 @@ var Connection = class {
494
501
  }
495
502
  invariant(msg.data.signal || msg.data.signalBatch, void 0, {
496
503
  F: __dxlog_file,
497
- L: 413,
504
+ L: 415,
498
505
  S: this,
499
506
  A: [
500
507
  "msg.data.signal || msg.data.signalBatch",
@@ -503,7 +510,7 @@ var Connection = class {
503
510
  });
504
511
  invariant(msg.author.peerKey === this.remoteInfo.peerKey, void 0, {
505
512
  F: __dxlog_file,
506
- L: 414,
513
+ L: 416,
507
514
  S: this,
508
515
  A: [
509
516
  "msg.author.peerKey === this.remoteInfo.peerKey",
@@ -512,7 +519,7 @@ var Connection = class {
512
519
  });
513
520
  invariant(msg.recipient.peerKey === this.localInfo.peerKey, void 0, {
514
521
  F: __dxlog_file,
515
- L: 415,
522
+ L: 417,
516
523
  S: this,
517
524
  A: [
518
525
  "msg.recipient.peerKey === this.localInfo.peerKey",
@@ -536,7 +543,7 @@ var Connection = class {
536
543
  msg: msg.data
537
544
  }, {
538
545
  F: __dxlog_file,
539
- L: 424,
546
+ L: 426,
540
547
  S: this,
541
548
  C: (f, a) => f(...a)
542
549
  });
@@ -544,7 +551,7 @@ var Connection = class {
544
551
  } else {
545
552
  invariant(this._transport, "Connection not ready to accept signals.", {
546
553
  F: __dxlog_file,
547
- L: 427,
554
+ L: 429,
548
555
  S: this,
549
556
  A: [
550
557
  "this._transport",
@@ -557,7 +564,7 @@ var Connection = class {
557
564
  msg: msg.data
558
565
  }, {
559
566
  F: __dxlog_file,
560
- L: 428,
567
+ L: 430,
561
568
  S: this,
562
569
  C: (f, a) => f(...a)
563
570
  });
@@ -575,13 +582,13 @@ var Connection = class {
575
582
  peerId: this.localInfo
576
583
  }, {
577
584
  F: __dxlog_file,
578
- L: 439,
585
+ L: 441,
579
586
  S: this,
580
587
  C: (f, a) => f(...a)
581
588
  });
582
589
  invariant(state !== this._state, "Already in this state.", {
583
590
  F: __dxlog_file,
584
- L: 440,
591
+ L: 442,
585
592
  S: this,
586
593
  A: [
587
594
  "state !== this._state",
@@ -919,7 +926,9 @@ function _ts_decorate2(decorators, target, key, desc) {
919
926
  var __dxlog_file4 = "/__w/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts";
920
927
  var ConnectionDisplacedError = class extends SystemError {
921
928
  constructor() {
922
- super("Connection displaced by remote initiator.");
929
+ super({
930
+ message: "Connection displaced by remote initiator."
931
+ });
923
932
  }
924
933
  };
925
934
  var CONNECTION_COUNTS_STABLE_AFTER = 5e3;
@@ -3228,7 +3237,9 @@ var RtcTransportChannel = class extends Resource {
3228
3237
  }
3229
3238
  }).catch((err) => {
3230
3239
  if (this.isOpen) {
3231
- const error = err instanceof Error ? err : new ConnectivityError2(`Failed to create a channel: ${JSON.stringify(err?.message)}`);
3240
+ const error = err instanceof Error ? err : new ConnectivityError2({
3241
+ message: `Failed to create a channel: ${JSON.stringify(err?.message)}`
3242
+ });
3232
3243
  this.errors.raise(error);
3233
3244
  } else {
3234
3245
  log12.verbose("connection establishment failed after transport was closed", {
@@ -4001,8 +4012,10 @@ var isRemoteDescriptionSet = (connection, data) => {
4001
4012
  };
4002
4013
  var createIceFailureError = (details) => {
4003
4014
  const candidateErrors = details.map(({ url, errorCode, errorText }) => `${errorCode} ${url}: ${errorText}`);
4004
- return new ConnectivityError3(`ICE failed:
4005
- ${candidateErrors.join("\n")}`);
4015
+ return new ConnectivityError3({
4016
+ message: `ICE failed:
4017
+ ${candidateErrors.join("\n")}`
4018
+ });
4006
4019
  };
4007
4020
 
4008
4021
  // src/transport/webrtc/rtc-transport-factory.ts
@@ -4198,7 +4211,9 @@ var RtcTransportProxy = class extends Resource2 {
4198
4211
  } catch (error) {
4199
4212
  const type = signalEvent.payload.payload.data?.type;
4200
4213
  if (type === "offer" || type === "answer") {
4201
- this._raiseIfOpen(new ConnectivityError4(`Session establishment failed: ${type} couldn't be sent.`));
4214
+ this._raiseIfOpen(new ConnectivityError4({
4215
+ message: `Session establishment failed: ${type} couldn't be sent.`
4216
+ }));
4202
4217
  }
4203
4218
  }
4204
4219
  }
@@ -4240,7 +4255,7 @@ var RtcTransportProxy = class extends Resource2 {
4240
4255
  message: error.message
4241
4256
  }, {
4242
4257
  F: __dxlog_file15,
4243
- L: 215,
4258
+ L: 217,
4244
4259
  S: this,
4245
4260
  C: (f, a) => f(...a)
4246
4261
  });
@@ -4271,7 +4286,7 @@ var RtcTransportProxyFactory = class {
4271
4286
  createTransport(options) {
4272
4287
  invariant13(this._bridgeService, "RtcTransportProxyFactory is not ready to open connections", {
4273
4288
  F: __dxlog_file15,
4274
- L: 245,
4289
+ L: 247,
4275
4290
  S: this,
4276
4291
  A: [
4277
4292
  "this._bridgeService",
@@ -4292,11 +4307,17 @@ var RtcTransportProxyFactory = class {
4292
4307
  var decodeError = (err) => {
4293
4308
  const message = typeof err === "string" ? err : err.message;
4294
4309
  if (message.includes("CONNECTION_RESET")) {
4295
- return new ConnectionResetError2(message);
4310
+ return new ConnectionResetError2({
4311
+ message
4312
+ });
4296
4313
  } else if (message.includes("TIMEOUT")) {
4297
- return new TimeoutError3(message);
4314
+ return new TimeoutError3({
4315
+ message
4316
+ });
4298
4317
  } else if (message.includes("CONNECTIVITY_ERROR")) {
4299
- return new ConnectivityError4(message);
4318
+ return new ConnectivityError4({
4319
+ message
4320
+ });
4300
4321
  } else {
4301
4322
  return typeof err === "string" ? new Error(err) : err;
4302
4323
  }
@@ -4565,4 +4586,4 @@ export {
4565
4586
  RtcTransportService,
4566
4587
  createTeleportProtocolFactory
4567
4588
  };
4568
- //# sourceMappingURL=chunk-E3P563GT.mjs.map
4589
+ //# sourceMappingURL=chunk-5ISEIDVN.mjs.map