@dxos/network-manager 0.7.0 → 0.7.1-staging.7f6f91c
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-MAR4A5JK.mjs → chunk-6O74LX7U.mjs} +33 -35
- package/dist/lib/browser/{chunk-MAR4A5JK.mjs.map → chunk-6O74LX7U.mjs.map} +3 -3
- 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/{chunk-J5PWZKEH.cjs → chunk-UBEMIUZP.cjs} +36 -38
- package/dist/lib/node/{chunk-J5PWZKEH.cjs.map → chunk-UBEMIUZP.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +23 -23
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +14 -14
- package/dist/lib/node-esm/{chunk-XHE7MQ7U.mjs → chunk-S267VFUM.mjs} +33 -35
- package/dist/lib/node-esm/{chunk-XHE7MQ7U.mjs.map → chunk-S267VFUM.mjs.map} +3 -3
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/transport/webrtc/rtc-peer-connection.d.ts.map +1 -1
- package/module-stub.mjs +8 -0
- package/package.json +23 -22
- package/src/transport/webrtc/rtc-peer-connection.ts +6 -15
|
@@ -3302,7 +3302,6 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
3302
3302
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3303
3303
|
}
|
|
3304
3304
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc/rtc-peer-connection.ts";
|
|
3305
|
-
var isLegacyInteropEnabled = () => Boolean(globalThis?.DEVICE_INVITE_INTEROP);
|
|
3306
3305
|
var RtcPeerConnection = class {
|
|
3307
3306
|
constructor(_factory, _options) {
|
|
3308
3307
|
this._factory = _factory;
|
|
@@ -3312,7 +3311,7 @@ var RtcPeerConnection = class {
|
|
|
3312
3311
|
this._dataChannels = /* @__PURE__ */ new Map();
|
|
3313
3312
|
this._readyForCandidates = new Trigger3();
|
|
3314
3313
|
this._offerProcessingMutex = new Mutex2();
|
|
3315
|
-
this._initiator =
|
|
3314
|
+
this._initiator = chooseInitiatorPeer(_options.ownPeerKey, _options.remotePeerKey) === _options.ownPeerKey;
|
|
3316
3315
|
}
|
|
3317
3316
|
get transportChannelCount() {
|
|
3318
3317
|
return this._transportChannels.size;
|
|
@@ -3321,31 +3320,30 @@ var RtcPeerConnection = class {
|
|
|
3321
3320
|
return this._connection;
|
|
3322
3321
|
}
|
|
3323
3322
|
async createDataChannel(topic) {
|
|
3324
|
-
const channelKey = isLegacyInteropEnabled() ? "dxos.mesh.transport" : topic;
|
|
3325
3323
|
const connection = await this._openConnection();
|
|
3326
|
-
if (
|
|
3324
|
+
if (!this._transportChannels.has(topic)) {
|
|
3327
3325
|
if (!this._transportChannels.size) {
|
|
3328
3326
|
this._lockAndCloseConnection();
|
|
3329
3327
|
}
|
|
3330
3328
|
throw new Error("Transport closed while connection was being open");
|
|
3331
3329
|
}
|
|
3332
3330
|
if (this._initiator) {
|
|
3333
|
-
const channel = connection.createDataChannel(
|
|
3334
|
-
this._dataChannels.set(
|
|
3331
|
+
const channel = connection.createDataChannel(topic);
|
|
3332
|
+
this._dataChannels.set(topic, channel);
|
|
3335
3333
|
return channel;
|
|
3336
3334
|
} else {
|
|
3337
|
-
const existingChannel = this._dataChannels.get(
|
|
3335
|
+
const existingChannel = this._dataChannels.get(topic);
|
|
3338
3336
|
if (existingChannel) {
|
|
3339
3337
|
return existingChannel;
|
|
3340
3338
|
}
|
|
3341
3339
|
log13("waiting for initiator-peer to open a data channel", void 0, {
|
|
3342
3340
|
F: __dxlog_file14,
|
|
3343
|
-
L:
|
|
3341
|
+
L: 95,
|
|
3344
3342
|
S: this,
|
|
3345
3343
|
C: (f, a) => f(...a)
|
|
3346
3344
|
});
|
|
3347
3345
|
return new Promise((resolve, reject) => {
|
|
3348
|
-
this._channelCreatedCallbacks.set(
|
|
3346
|
+
this._channelCreatedCallbacks.set(topic, {
|
|
3349
3347
|
resolve,
|
|
3350
3348
|
reject
|
|
3351
3349
|
});
|
|
@@ -3371,7 +3369,7 @@ var RtcPeerConnection = class {
|
|
|
3371
3369
|
remotePeer: this._options.remotePeerKey
|
|
3372
3370
|
}), {
|
|
3373
3371
|
F: __dxlog_file14,
|
|
3374
|
-
L:
|
|
3372
|
+
L: 120,
|
|
3375
3373
|
S: this,
|
|
3376
3374
|
C: (f, a) => f(...a)
|
|
3377
3375
|
});
|
|
@@ -3382,7 +3380,7 @@ var RtcPeerConnection = class {
|
|
|
3382
3380
|
onnegotiationneeded: async () => {
|
|
3383
3381
|
invariant12(this._initiator, void 0, {
|
|
3384
3382
|
F: __dxlog_file14,
|
|
3385
|
-
L:
|
|
3383
|
+
L: 135,
|
|
3386
3384
|
S: this,
|
|
3387
3385
|
A: [
|
|
3388
3386
|
"this._initiator",
|
|
@@ -3395,7 +3393,7 @@ var RtcPeerConnection = class {
|
|
|
3395
3393
|
}
|
|
3396
3394
|
log13("onnegotiationneeded", void 0, {
|
|
3397
3395
|
F: __dxlog_file14,
|
|
3398
|
-
L:
|
|
3396
|
+
L: 142,
|
|
3399
3397
|
S: this,
|
|
3400
3398
|
C: (f, a) => f(...a)
|
|
3401
3399
|
});
|
|
@@ -3419,7 +3417,7 @@ var RtcPeerConnection = class {
|
|
|
3419
3417
|
candidate: event.candidate.candidate
|
|
3420
3418
|
}, {
|
|
3421
3419
|
F: __dxlog_file14,
|
|
3422
|
-
L:
|
|
3420
|
+
L: 161,
|
|
3423
3421
|
S: this,
|
|
3424
3422
|
C: (f, a) => f(...a)
|
|
3425
3423
|
});
|
|
@@ -3427,7 +3425,7 @@ var RtcPeerConnection = class {
|
|
|
3427
3425
|
} else {
|
|
3428
3426
|
log13("onicecandidate gathering complete", void 0, {
|
|
3429
3427
|
F: __dxlog_file14,
|
|
3430
|
-
L:
|
|
3428
|
+
L: 164,
|
|
3431
3429
|
S: this,
|
|
3432
3430
|
C: (f, a) => f(...a)
|
|
3433
3431
|
});
|
|
@@ -3455,7 +3453,7 @@ var RtcPeerConnection = class {
|
|
|
3455
3453
|
state: connection.iceConnectionState
|
|
3456
3454
|
}, {
|
|
3457
3455
|
F: __dxlog_file14,
|
|
3458
|
-
L:
|
|
3456
|
+
L: 184,
|
|
3459
3457
|
S: this,
|
|
3460
3458
|
C: (f, a) => f(...a)
|
|
3461
3459
|
});
|
|
@@ -3477,7 +3475,7 @@ var RtcPeerConnection = class {
|
|
|
3477
3475
|
state: connection.connectionState
|
|
3478
3476
|
}, {
|
|
3479
3477
|
F: __dxlog_file14,
|
|
3480
|
-
L:
|
|
3478
|
+
L: 201,
|
|
3481
3479
|
S: this,
|
|
3482
3480
|
C: (f, a) => f(...a)
|
|
3483
3481
|
});
|
|
@@ -3490,7 +3488,7 @@ var RtcPeerConnection = class {
|
|
|
3490
3488
|
state: connection.signalingState
|
|
3491
3489
|
}, {
|
|
3492
3490
|
F: __dxlog_file14,
|
|
3493
|
-
L:
|
|
3491
|
+
L: 208,
|
|
3494
3492
|
S: this,
|
|
3495
3493
|
C: (f, a) => f(...a)
|
|
3496
3494
|
});
|
|
@@ -3500,7 +3498,7 @@ var RtcPeerConnection = class {
|
|
|
3500
3498
|
ondatachannel: (event) => {
|
|
3501
3499
|
invariant12(!this._initiator, "Initiator is expected to create data channels.", {
|
|
3502
3500
|
F: __dxlog_file14,
|
|
3503
|
-
L:
|
|
3501
|
+
L: 214,
|
|
3504
3502
|
S: this,
|
|
3505
3503
|
A: [
|
|
3506
3504
|
"!this._initiator",
|
|
@@ -3515,7 +3513,7 @@ var RtcPeerConnection = class {
|
|
|
3515
3513
|
label: event.channel.label
|
|
3516
3514
|
}, {
|
|
3517
3515
|
F: __dxlog_file14,
|
|
3518
|
-
L:
|
|
3516
|
+
L: 221,
|
|
3519
3517
|
S: this,
|
|
3520
3518
|
C: (f, a) => f(...a)
|
|
3521
3519
|
});
|
|
@@ -3543,7 +3541,7 @@ var RtcPeerConnection = class {
|
|
|
3543
3541
|
error
|
|
3544
3542
|
}, {
|
|
3545
3543
|
F: __dxlog_file14,
|
|
3546
|
-
L:
|
|
3544
|
+
L: 246,
|
|
3547
3545
|
S: this,
|
|
3548
3546
|
C: (f, a) => f(...a)
|
|
3549
3547
|
});
|
|
@@ -3564,7 +3562,7 @@ var RtcPeerConnection = class {
|
|
|
3564
3562
|
reason: error.message
|
|
3565
3563
|
}, {
|
|
3566
3564
|
F: __dxlog_file14,
|
|
3567
|
-
L:
|
|
3565
|
+
L: 260,
|
|
3568
3566
|
S: this,
|
|
3569
3567
|
C: (f, a) => f(...a)
|
|
3570
3568
|
});
|
|
@@ -3572,7 +3570,7 @@ var RtcPeerConnection = class {
|
|
|
3572
3570
|
_lockAndCloseConnection() {
|
|
3573
3571
|
invariant12(this._transportChannels.size === 0, void 0, {
|
|
3574
3572
|
F: __dxlog_file14,
|
|
3575
|
-
L:
|
|
3573
|
+
L: 265,
|
|
3576
3574
|
S: this,
|
|
3577
3575
|
A: [
|
|
3578
3576
|
"this._transportChannels.size === 0",
|
|
@@ -3583,7 +3581,7 @@ var RtcPeerConnection = class {
|
|
|
3583
3581
|
this._safeCloseConnection();
|
|
3584
3582
|
log13("connection closed", void 0, {
|
|
3585
3583
|
F: __dxlog_file14,
|
|
3586
|
-
L:
|
|
3584
|
+
L: 268,
|
|
3587
3585
|
S: this,
|
|
3588
3586
|
C: (f, a) => f(...a)
|
|
3589
3587
|
});
|
|
@@ -3596,7 +3594,7 @@ var RtcPeerConnection = class {
|
|
|
3596
3594
|
type: signal.payload.data.type
|
|
3597
3595
|
}, {
|
|
3598
3596
|
F: __dxlog_file14,
|
|
3599
|
-
L:
|
|
3597
|
+
L: 276,
|
|
3600
3598
|
S: this,
|
|
3601
3599
|
C: (f, a) => f(...a)
|
|
3602
3600
|
});
|
|
@@ -3663,7 +3661,7 @@ var RtcPeerConnection = class {
|
|
|
3663
3661
|
type: data.type
|
|
3664
3662
|
}, {
|
|
3665
3663
|
F: __dxlog_file14,
|
|
3666
|
-
L:
|
|
3664
|
+
L: 335,
|
|
3667
3665
|
S: this,
|
|
3668
3666
|
C: (f, a) => f(...a)
|
|
3669
3667
|
});
|
|
@@ -3676,7 +3674,7 @@ var RtcPeerConnection = class {
|
|
|
3676
3674
|
candidate
|
|
3677
3675
|
}, {
|
|
3678
3676
|
F: __dxlog_file14,
|
|
3679
|
-
L:
|
|
3677
|
+
L: 343,
|
|
3680
3678
|
S: this,
|
|
3681
3679
|
C: (f, a) => f(...a)
|
|
3682
3680
|
});
|
|
@@ -3685,7 +3683,7 @@ var RtcPeerConnection = class {
|
|
|
3685
3683
|
} catch (err) {
|
|
3686
3684
|
log13.catch(err, void 0, {
|
|
3687
3685
|
F: __dxlog_file14,
|
|
3688
|
-
L:
|
|
3686
|
+
L: 347,
|
|
3689
3687
|
S: this,
|
|
3690
3688
|
C: (f, a) => f(...a)
|
|
3691
3689
|
});
|
|
@@ -3695,7 +3693,7 @@ var RtcPeerConnection = class {
|
|
|
3695
3693
|
if (connection === this._connection) {
|
|
3696
3694
|
log13("ready to process ice candidates", void 0, {
|
|
3697
3695
|
F: __dxlog_file14,
|
|
3698
|
-
L:
|
|
3696
|
+
L: 353,
|
|
3699
3697
|
S: this,
|
|
3700
3698
|
C: (f, a) => f(...a)
|
|
3701
3699
|
});
|
|
@@ -3703,7 +3701,7 @@ var RtcPeerConnection = class {
|
|
|
3703
3701
|
} else {
|
|
3704
3702
|
log13.warn("session was negotiated after connection became inactive", void 0, {
|
|
3705
3703
|
F: __dxlog_file14,
|
|
3706
|
-
L:
|
|
3704
|
+
L: 356,
|
|
3707
3705
|
S: this,
|
|
3708
3706
|
C: (f, a) => f(...a)
|
|
3709
3707
|
});
|
|
@@ -3715,7 +3713,7 @@ var RtcPeerConnection = class {
|
|
|
3715
3713
|
state: connection.connectionState
|
|
3716
3714
|
}, {
|
|
3717
3715
|
F: __dxlog_file14,
|
|
3718
|
-
L:
|
|
3716
|
+
L: 361,
|
|
3719
3717
|
S: this,
|
|
3720
3718
|
C: (f, a) => f(...a)
|
|
3721
3719
|
});
|
|
@@ -3728,7 +3726,7 @@ var RtcPeerConnection = class {
|
|
|
3728
3726
|
} catch (err) {
|
|
3729
3727
|
log13.catch(err, void 0, {
|
|
3730
3728
|
F: __dxlog_file14,
|
|
3731
|
-
L:
|
|
3729
|
+
L: 373,
|
|
3732
3730
|
S: this,
|
|
3733
3731
|
C: (f, a) => f(...a)
|
|
3734
3732
|
});
|
|
@@ -3739,7 +3737,7 @@ var RtcPeerConnection = class {
|
|
|
3739
3737
|
this._readyForCandidates.wake();
|
|
3740
3738
|
void this._factory.onConnectionDestroyed().catch((err) => log13.catch(err, void 0, {
|
|
3741
3739
|
F: __dxlog_file14,
|
|
3742
|
-
L:
|
|
3740
|
+
L: 379,
|
|
3743
3741
|
S: this,
|
|
3744
3742
|
C: (f, a) => f(...a)
|
|
3745
3743
|
}));
|
|
@@ -3764,7 +3762,7 @@ var RtcPeerConnection = class {
|
|
|
3764
3762
|
} catch (error) {
|
|
3765
3763
|
log13.catch(error, void 0, {
|
|
3766
3764
|
F: __dxlog_file14,
|
|
3767
|
-
L:
|
|
3765
|
+
L: 395,
|
|
3768
3766
|
S: this,
|
|
3769
3767
|
C: (f, a) => f(...a)
|
|
3770
3768
|
});
|
|
@@ -3791,7 +3789,7 @@ var RtcPeerConnection = class {
|
|
|
3791
3789
|
err
|
|
3792
3790
|
}, {
|
|
3793
3791
|
F: __dxlog_file14,
|
|
3794
|
-
L:
|
|
3792
|
+
L: 416,
|
|
3795
3793
|
S: this,
|
|
3796
3794
|
C: (f, a) => f(...a)
|
|
3797
3795
|
});
|
|
@@ -4429,4 +4427,4 @@ export {
|
|
|
4429
4427
|
RtcTransportService,
|
|
4430
4428
|
createTeleportProtocolFactory
|
|
4431
4429
|
};
|
|
4432
|
-
//# sourceMappingURL=chunk-
|
|
4430
|
+
//# sourceMappingURL=chunk-S267VFUM.mjs.map
|