@signalwire/js 4.0.0-dev-20260413184400 → 4.0.0-dev-20260416142417
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/browser.mjs +440 -393
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +440 -393
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +146 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -60
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +96 -60
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +147 -101
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser.mjs
CHANGED
|
@@ -1125,9 +1125,9 @@ var require_Subject = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1125
1125
|
var ObjectUnsubscribedError_1$1 = require_ObjectUnsubscribedError();
|
|
1126
1126
|
var arrRemove_1$6 = require_arrRemove();
|
|
1127
1127
|
var errorContext_1 = require_errorContext();
|
|
1128
|
-
var Subject$
|
|
1129
|
-
__extends$13(Subject$
|
|
1130
|
-
function Subject$
|
|
1128
|
+
var Subject$2 = function(_super) {
|
|
1129
|
+
__extends$13(Subject$3, _super);
|
|
1130
|
+
function Subject$3() {
|
|
1131
1131
|
var _this = _super.call(this) || this;
|
|
1132
1132
|
_this.closed = false;
|
|
1133
1133
|
_this.currentObservers = null;
|
|
@@ -1137,15 +1137,15 @@ var require_Subject = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1137
1137
|
_this.thrownError = null;
|
|
1138
1138
|
return _this;
|
|
1139
1139
|
}
|
|
1140
|
-
Subject$
|
|
1140
|
+
Subject$3.prototype.lift = function(operator) {
|
|
1141
1141
|
var subject = new AnonymousSubject(this, this);
|
|
1142
1142
|
subject.operator = operator;
|
|
1143
1143
|
return subject;
|
|
1144
1144
|
};
|
|
1145
|
-
Subject$
|
|
1145
|
+
Subject$3.prototype._throwIfClosed = function() {
|
|
1146
1146
|
if (this.closed) throw new ObjectUnsubscribedError_1$1.ObjectUnsubscribedError();
|
|
1147
1147
|
};
|
|
1148
|
-
Subject$
|
|
1148
|
+
Subject$3.prototype.next = function(value) {
|
|
1149
1149
|
var _this = this;
|
|
1150
1150
|
errorContext_1.errorContext(function() {
|
|
1151
1151
|
var e_1, _a;
|
|
@@ -1166,7 +1166,7 @@ var require_Subject = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
});
|
|
1168
1168
|
};
|
|
1169
|
-
Subject$
|
|
1169
|
+
Subject$3.prototype.error = function(err) {
|
|
1170
1170
|
var _this = this;
|
|
1171
1171
|
errorContext_1.errorContext(function() {
|
|
1172
1172
|
_this._throwIfClosed();
|
|
@@ -1178,7 +1178,7 @@ var require_Subject = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1178
1178
|
}
|
|
1179
1179
|
});
|
|
1180
1180
|
};
|
|
1181
|
-
Subject$
|
|
1181
|
+
Subject$3.prototype.complete = function() {
|
|
1182
1182
|
var _this = this;
|
|
1183
1183
|
errorContext_1.errorContext(function() {
|
|
1184
1184
|
_this._throwIfClosed();
|
|
@@ -1189,11 +1189,11 @@ var require_Subject = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1189
1189
|
}
|
|
1190
1190
|
});
|
|
1191
1191
|
};
|
|
1192
|
-
Subject$
|
|
1192
|
+
Subject$3.prototype.unsubscribe = function() {
|
|
1193
1193
|
this.isStopped = this.closed = true;
|
|
1194
1194
|
this.observers = this.currentObservers = null;
|
|
1195
1195
|
};
|
|
1196
|
-
Object.defineProperty(Subject$
|
|
1196
|
+
Object.defineProperty(Subject$3.prototype, "observed", {
|
|
1197
1197
|
get: function() {
|
|
1198
1198
|
var _a;
|
|
1199
1199
|
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
@@ -1201,16 +1201,16 @@ var require_Subject = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1201
1201
|
enumerable: false,
|
|
1202
1202
|
configurable: true
|
|
1203
1203
|
});
|
|
1204
|
-
Subject$
|
|
1204
|
+
Subject$3.prototype._trySubscribe = function(subscriber) {
|
|
1205
1205
|
this._throwIfClosed();
|
|
1206
1206
|
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
1207
1207
|
};
|
|
1208
|
-
Subject$
|
|
1208
|
+
Subject$3.prototype._subscribe = function(subscriber) {
|
|
1209
1209
|
this._throwIfClosed();
|
|
1210
1210
|
this._checkFinalizedStatuses(subscriber);
|
|
1211
1211
|
return this._innerSubscribe(subscriber);
|
|
1212
1212
|
};
|
|
1213
|
-
Subject$
|
|
1213
|
+
Subject$3.prototype._innerSubscribe = function(subscriber) {
|
|
1214
1214
|
var _this = this;
|
|
1215
1215
|
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
|
|
1216
1216
|
if (hasError || isStopped) return Subscription_1$6.EMPTY_SUBSCRIPTION;
|
|
@@ -1221,22 +1221,22 @@ var require_Subject = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1221
1221
|
arrRemove_1$6.arrRemove(observers, subscriber);
|
|
1222
1222
|
});
|
|
1223
1223
|
};
|
|
1224
|
-
Subject$
|
|
1224
|
+
Subject$3.prototype._checkFinalizedStatuses = function(subscriber) {
|
|
1225
1225
|
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
|
|
1226
1226
|
if (hasError) subscriber.error(thrownError);
|
|
1227
1227
|
else if (isStopped) subscriber.complete();
|
|
1228
1228
|
};
|
|
1229
|
-
Subject$
|
|
1229
|
+
Subject$3.prototype.asObservable = function() {
|
|
1230
1230
|
var observable = new Observable_1$24.Observable();
|
|
1231
1231
|
observable.source = this;
|
|
1232
1232
|
return observable;
|
|
1233
1233
|
};
|
|
1234
|
-
Subject$
|
|
1234
|
+
Subject$3.create = function(destination, source) {
|
|
1235
1235
|
return new AnonymousSubject(destination, source);
|
|
1236
1236
|
};
|
|
1237
|
-
return Subject$
|
|
1237
|
+
return Subject$3;
|
|
1238
1238
|
}(Observable_1$24.Observable);
|
|
1239
|
-
exports.Subject = Subject$
|
|
1239
|
+
exports.Subject = Subject$2;
|
|
1240
1240
|
var AnonymousSubject = function(_super) {
|
|
1241
1241
|
__extends$13(AnonymousSubject$1, _super);
|
|
1242
1242
|
function AnonymousSubject$1(destination, source) {
|
|
@@ -1262,7 +1262,7 @@ var require_Subject = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1262
1262
|
return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : Subscription_1$6.EMPTY_SUBSCRIPTION;
|
|
1263
1263
|
};
|
|
1264
1264
|
return AnonymousSubject$1;
|
|
1265
|
-
}(Subject$
|
|
1265
|
+
}(Subject$2);
|
|
1266
1266
|
exports.AnonymousSubject = AnonymousSubject;
|
|
1267
1267
|
}));
|
|
1268
1268
|
|
|
@@ -3344,8 +3344,8 @@ var require_timeout = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3344
3344
|
};
|
|
3345
3345
|
});
|
|
3346
3346
|
function timeout$4(config, schedulerArg) {
|
|
3347
|
-
var _a = isDate_1$2.isValidDate(config) ? { first: config } : typeof config === "number" ? { each: config } : config, first$
|
|
3348
|
-
if (first$
|
|
3347
|
+
var _a = isDate_1$2.isValidDate(config) ? { first: config } : typeof config === "number" ? { each: config } : config, first$2 = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : async_1$12.asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
|
|
3348
|
+
if (first$2 == null && each == null) throw new TypeError("No timeout provided.");
|
|
3349
3349
|
return lift_1$65.operate(function(source, subscriber) {
|
|
3350
3350
|
var originalSourceSubscription;
|
|
3351
3351
|
var timerSubscription;
|
|
@@ -3374,7 +3374,7 @@ var require_timeout = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3374
3374
|
if (!(timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.closed)) timerSubscription === null || timerSubscription === void 0 || timerSubscription.unsubscribe();
|
|
3375
3375
|
lastValue = null;
|
|
3376
3376
|
}));
|
|
3377
|
-
!seen && startTimer(first$
|
|
3377
|
+
!seen && startTimer(first$2 != null ? typeof first$2 === "number" ? first$2 : +first$2 - scheduler.now() : each);
|
|
3378
3378
|
});
|
|
3379
3379
|
}
|
|
3380
3380
|
exports.timeout = timeout$4;
|
|
@@ -3390,7 +3390,7 @@ var require_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3390
3390
|
exports.map = void 0;
|
|
3391
3391
|
var lift_1$64 = require_lift();
|
|
3392
3392
|
var OperatorSubscriber_1$54 = require_OperatorSubscriber();
|
|
3393
|
-
function map$
|
|
3393
|
+
function map$18(project, thisArg) {
|
|
3394
3394
|
return lift_1$64.operate(function(source, subscriber) {
|
|
3395
3395
|
var index = 0;
|
|
3396
3396
|
source.subscribe(OperatorSubscriber_1$54.createOperatorSubscriber(subscriber, function(value) {
|
|
@@ -3398,7 +3398,7 @@ var require_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3398
3398
|
}));
|
|
3399
3399
|
});
|
|
3400
3400
|
}
|
|
3401
|
-
exports.map = map$
|
|
3401
|
+
exports.map = map$18;
|
|
3402
3402
|
}));
|
|
3403
3403
|
|
|
3404
3404
|
//#endregion
|
|
@@ -5470,23 +5470,23 @@ var require_distinctUntilChanged = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5470
5470
|
var identity_1$10 = require_identity();
|
|
5471
5471
|
var lift_1$42 = require_lift();
|
|
5472
5472
|
var OperatorSubscriber_1$31 = require_OperatorSubscriber();
|
|
5473
|
-
function distinctUntilChanged$
|
|
5473
|
+
function distinctUntilChanged$8(comparator, keySelector) {
|
|
5474
5474
|
if (keySelector === void 0) keySelector = identity_1$10.identity;
|
|
5475
5475
|
comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
|
|
5476
5476
|
return lift_1$42.operate(function(source, subscriber) {
|
|
5477
5477
|
var previousKey;
|
|
5478
|
-
var first$
|
|
5478
|
+
var first$2 = true;
|
|
5479
5479
|
source.subscribe(OperatorSubscriber_1$31.createOperatorSubscriber(subscriber, function(value) {
|
|
5480
5480
|
var currentKey = keySelector(value);
|
|
5481
|
-
if (first$
|
|
5482
|
-
first$
|
|
5481
|
+
if (first$2 || !comparator(previousKey, currentKey)) {
|
|
5482
|
+
first$2 = false;
|
|
5483
5483
|
previousKey = currentKey;
|
|
5484
5484
|
subscriber.next(value);
|
|
5485
5485
|
}
|
|
5486
5486
|
}));
|
|
5487
5487
|
});
|
|
5488
5488
|
}
|
|
5489
|
-
exports.distinctUntilChanged = distinctUntilChanged$
|
|
5489
|
+
exports.distinctUntilChanged = distinctUntilChanged$8;
|
|
5490
5490
|
function defaultCompare(a, b) {
|
|
5491
5491
|
return a === b;
|
|
5492
5492
|
}
|
|
@@ -5767,7 +5767,7 @@ var require_first = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5767
5767
|
var defaultIfEmpty_1$3 = require_defaultIfEmpty();
|
|
5768
5768
|
var throwIfEmpty_1$3 = require_throwIfEmpty();
|
|
5769
5769
|
var identity_1$8 = require_identity();
|
|
5770
|
-
function first(predicate, defaultValue) {
|
|
5770
|
+
function first$1(predicate, defaultValue) {
|
|
5771
5771
|
var hasDefaultValue = arguments.length >= 2;
|
|
5772
5772
|
return function(source) {
|
|
5773
5773
|
return source.pipe(predicate ? filter_1$5.filter(function(v, i) {
|
|
@@ -5777,7 +5777,7 @@ var require_first = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5777
5777
|
}));
|
|
5778
5778
|
};
|
|
5779
5779
|
}
|
|
5780
|
-
exports.first = first;
|
|
5780
|
+
exports.first = first$1;
|
|
5781
5781
|
}));
|
|
5782
5782
|
|
|
5783
5783
|
//#endregion
|
|
@@ -6825,12 +6825,12 @@ var require_skip = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6825
6825
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6826
6826
|
exports.skip = void 0;
|
|
6827
6827
|
var filter_1$3 = require_filter();
|
|
6828
|
-
function skip$
|
|
6828
|
+
function skip$3(count$1) {
|
|
6829
6829
|
return filter_1$3.filter(function(_, index) {
|
|
6830
6830
|
return count$1 <= index;
|
|
6831
6831
|
});
|
|
6832
6832
|
}
|
|
6833
|
-
exports.skip = skip$
|
|
6833
|
+
exports.skip = skip$3;
|
|
6834
6834
|
}));
|
|
6835
6835
|
|
|
6836
6836
|
//#endregion
|
|
@@ -7208,19 +7208,19 @@ var require_timeoutWith = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7208
7208
|
var isDate_1 = require_isDate();
|
|
7209
7209
|
var timeout_1$2 = require_timeout();
|
|
7210
7210
|
function timeoutWith(due, withObservable, scheduler) {
|
|
7211
|
-
var first$
|
|
7211
|
+
var first$2;
|
|
7212
7212
|
var each;
|
|
7213
7213
|
var _with;
|
|
7214
7214
|
scheduler = scheduler !== null && scheduler !== void 0 ? scheduler : async_1$2.async;
|
|
7215
|
-
if (isDate_1.isValidDate(due)) first$
|
|
7215
|
+
if (isDate_1.isValidDate(due)) first$2 = due;
|
|
7216
7216
|
else if (typeof due === "number") each = due;
|
|
7217
7217
|
if (withObservable) _with = function() {
|
|
7218
7218
|
return withObservable;
|
|
7219
7219
|
};
|
|
7220
7220
|
else throw new TypeError("No observable provided to switch to");
|
|
7221
|
-
if (first$
|
|
7221
|
+
if (first$2 == null && each == null) throw new TypeError("No timeout provided.");
|
|
7222
7222
|
return timeout_1$2.timeout({
|
|
7223
|
-
first: first$
|
|
7223
|
+
first: first$2,
|
|
7224
7224
|
each,
|
|
7225
7225
|
scheduler,
|
|
7226
7226
|
with: _with
|
|
@@ -8933,19 +8933,17 @@ var require_cjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8933
8933
|
|
|
8934
8934
|
//#endregion
|
|
8935
8935
|
//#region src/behaviors/Destroyable.ts
|
|
8936
|
-
var import_cjs$
|
|
8936
|
+
var import_cjs$29 = require_cjs();
|
|
8937
8937
|
var Destroyable = class {
|
|
8938
8938
|
constructor() {
|
|
8939
8939
|
this.subscriptions = [];
|
|
8940
8940
|
this.subjects = [];
|
|
8941
|
-
this._destroyed$ = new import_cjs$
|
|
8942
|
-
this._change$ = new import_cjs$28.Subject();
|
|
8941
|
+
this._destroyed$ = new import_cjs$29.Subject();
|
|
8943
8942
|
}
|
|
8944
8943
|
destroy() {
|
|
8945
8944
|
this._observableCache?.clear();
|
|
8946
8945
|
this.subscriptions.forEach((sub) => sub.unsubscribe());
|
|
8947
8946
|
this.subjects.forEach((subject) => subject.complete());
|
|
8948
|
-
this._change$.complete();
|
|
8949
8947
|
this._destroyed$.next();
|
|
8950
8948
|
this._destroyed$.complete();
|
|
8951
8949
|
}
|
|
@@ -8976,7 +8974,7 @@ var Destroyable = class {
|
|
|
8976
8974
|
this._observableCache ??= /* @__PURE__ */ new Map();
|
|
8977
8975
|
let cached = this._observableCache.get(publicKey);
|
|
8978
8976
|
if (!cached) {
|
|
8979
|
-
cached = factory().pipe((0, import_cjs$
|
|
8977
|
+
cached = factory().pipe((0, import_cjs$29.observeOn)(import_cjs$29.asapScheduler));
|
|
8980
8978
|
this._observableCache.set(publicKey, cached);
|
|
8981
8979
|
}
|
|
8982
8980
|
return cached;
|
|
@@ -8990,33 +8988,27 @@ var Destroyable = class {
|
|
|
8990
8988
|
* Do NOT use for observables consumed internally by the SDK.
|
|
8991
8989
|
*/
|
|
8992
8990
|
deferEmission(observable) {
|
|
8993
|
-
return observable.pipe((0, import_cjs$
|
|
8991
|
+
return observable.pipe((0, import_cjs$29.observeOn)(import_cjs$29.asapScheduler));
|
|
8994
8992
|
}
|
|
8995
8993
|
subscribeTo(observable, observerOrNext) {
|
|
8996
8994
|
const subscription = observable.subscribe(observerOrNext);
|
|
8997
8995
|
this.subscriptions.push(subscription);
|
|
8998
8996
|
}
|
|
8999
8997
|
createSubject() {
|
|
9000
|
-
const subject = new import_cjs$
|
|
8998
|
+
const subject = new import_cjs$29.Subject();
|
|
9001
8999
|
this.subjects.push(subject);
|
|
9002
|
-
this.subscriptions.push(subject.pipe((0, import_cjs$28.map)(() => void 0)).subscribe(this._change$));
|
|
9003
9000
|
return subject;
|
|
9004
9001
|
}
|
|
9005
9002
|
createReplaySubject(bufferSize, windowTime$1) {
|
|
9006
|
-
const subject = new import_cjs$
|
|
9003
|
+
const subject = new import_cjs$29.ReplaySubject(bufferSize, windowTime$1);
|
|
9007
9004
|
this.subjects.push(subject);
|
|
9008
|
-
this.subscriptions.push(subject.pipe((0, import_cjs$28.map)(() => void 0)).subscribe(this._change$));
|
|
9009
9005
|
return subject;
|
|
9010
9006
|
}
|
|
9011
9007
|
createBehaviorSubject(initialValue) {
|
|
9012
|
-
const subject = new import_cjs$
|
|
9008
|
+
const subject = new import_cjs$29.BehaviorSubject(initialValue);
|
|
9013
9009
|
this.subjects.push(subject);
|
|
9014
|
-
this.subscriptions.push(subject.pipe((0, import_cjs$28.skip)(1), (0, import_cjs$28.map)(() => void 0)).subscribe(this._change$));
|
|
9015
9010
|
return subject;
|
|
9016
9011
|
}
|
|
9017
|
-
get $() {
|
|
9018
|
-
return this._change$.pipe((0, import_cjs$28.map)(() => this));
|
|
9019
|
-
}
|
|
9020
9012
|
/**
|
|
9021
9013
|
* Observable that emits when the instance is destroyed
|
|
9022
9014
|
*/
|
|
@@ -9573,7 +9565,7 @@ const asyncRetry = async ({ asyncCallable, maxRetries: retries = DEFAULT_MAX_RET
|
|
|
9573
9565
|
|
|
9574
9566
|
//#endregion
|
|
9575
9567
|
//#region src/controllers/HTTPRequestController.ts
|
|
9576
|
-
var import_cjs$
|
|
9568
|
+
var import_cjs$28 = require_cjs();
|
|
9577
9569
|
const logger$29 = getLogger();
|
|
9578
9570
|
const GET_PARAMS = {
|
|
9579
9571
|
method: "GET",
|
|
@@ -9609,9 +9601,9 @@ var HTTPRequestController = class HTTPRequestController {
|
|
|
9609
9601
|
constructor(baseURL, getCredential, options = {}) {
|
|
9610
9602
|
this.baseURL = baseURL;
|
|
9611
9603
|
this.getCredential = getCredential;
|
|
9612
|
-
this._responses$ = new import_cjs$
|
|
9613
|
-
this._errors$ = new import_cjs$
|
|
9614
|
-
this._status$ = new import_cjs$
|
|
9604
|
+
this._responses$ = new import_cjs$28.Subject();
|
|
9605
|
+
this._errors$ = new import_cjs$28.Subject();
|
|
9606
|
+
this._status$ = new import_cjs$28.BehaviorSubject("idle");
|
|
9615
9607
|
this.maxRetries = options.maxRetries ?? HTTPRequestController.defaultMaxRetries;
|
|
9616
9608
|
this.retryDelayMin = options.retryDelayMin ?? HTTPRequestController.defaultRetryDelayMinMs;
|
|
9617
9609
|
this.retryDelayMax = options.retryDelayMax ?? HTTPRequestController.defaultRetryDelayMaxMs;
|
|
@@ -9871,6 +9863,14 @@ const DEVICE_TOKEN_REFRESH_BUFFER_MS = 3e4;
|
|
|
9871
9863
|
const DEVICE_TOKEN_REFRESH_MAX_RETRIES = 3;
|
|
9872
9864
|
/** Base delay in milliseconds for exponential backoff on refresh retry. */
|
|
9873
9865
|
const DEVICE_TOKEN_REFRESH_RETRY_BASE_MS = 1e3;
|
|
9866
|
+
/** Maximum retry attempts for developer credential refresh on transient failure. */
|
|
9867
|
+
const CREDENTIAL_REFRESH_MAX_RETRIES = 5;
|
|
9868
|
+
/** Base delay in milliseconds for exponential backoff on credential refresh retry. */
|
|
9869
|
+
const CREDENTIAL_REFRESH_RETRY_BASE_MS = 1e3;
|
|
9870
|
+
/** Maximum delay in milliseconds for credential refresh backoff. */
|
|
9871
|
+
const CREDENTIAL_REFRESH_MAX_DELAY_MS = 3e4;
|
|
9872
|
+
/** Buffer in milliseconds before token expiry to trigger refresh. */
|
|
9873
|
+
const CREDENTIAL_REFRESH_BUFFER_MS = 5e3;
|
|
9874
9874
|
/** JSON-RPC error code for requester validation failure (corrupted auth state). */
|
|
9875
9875
|
const RPC_ERROR_REQUESTER_VALIDATION_FAILED = -32003;
|
|
9876
9876
|
/** JSON-RPC error code for invalid params (e.g., missing authentication block). */
|
|
@@ -10637,9 +10637,23 @@ var ClientPreferences = class {
|
|
|
10637
10637
|
}
|
|
10638
10638
|
};
|
|
10639
10639
|
|
|
10640
|
+
//#endregion
|
|
10641
|
+
//#region src/utils/toError.ts
|
|
10642
|
+
/**
|
|
10643
|
+
* Normalizes an unknown caught value into a proper Error instance.
|
|
10644
|
+
*
|
|
10645
|
+
* In catch blocks, the caught value is `unknown` — it could be an Error,
|
|
10646
|
+
* string, number, or any other value. This utility ensures a consistent
|
|
10647
|
+
* Error object is produced.
|
|
10648
|
+
*/
|
|
10649
|
+
function toError(value) {
|
|
10650
|
+
if (value instanceof Error) return value;
|
|
10651
|
+
return new Error(String(value));
|
|
10652
|
+
}
|
|
10653
|
+
|
|
10640
10654
|
//#endregion
|
|
10641
10655
|
//#region src/controllers/NavigatorDeviceController.ts
|
|
10642
|
-
var import_cjs$
|
|
10656
|
+
var import_cjs$27 = require_cjs();
|
|
10643
10657
|
const logger$27 = getLogger();
|
|
10644
10658
|
/** Maps a device kind to its storage key. */
|
|
10645
10659
|
const DEVICE_STORAGE_KEYS = {
|
|
@@ -10699,17 +10713,17 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10699
10713
|
return {};
|
|
10700
10714
|
}
|
|
10701
10715
|
get errors$() {
|
|
10702
|
-
return this.cachedObservable("errors$", () => this._errors$.asObservable().pipe((0, import_cjs$
|
|
10716
|
+
return this.cachedObservable("errors$", () => this._errors$.asObservable().pipe((0, import_cjs$27.takeUntil)(this.destroyed$)));
|
|
10703
10717
|
}
|
|
10704
10718
|
/** Observable that emits when the SDK auto-switches a device. */
|
|
10705
10719
|
get deviceRecovered$() {
|
|
10706
|
-
return this._deviceRecovered$.asObservable().pipe((0, import_cjs$
|
|
10720
|
+
return this._deviceRecovered$.asObservable().pipe((0, import_cjs$27.takeUntil)(this.destroyed$));
|
|
10707
10721
|
}
|
|
10708
10722
|
get videoInputDisabled$() {
|
|
10709
|
-
return this.cachedObservable("videoInputDisabled$", () => this._videoInputDisabled$.asObservable().pipe((0, import_cjs$
|
|
10723
|
+
return this.cachedObservable("videoInputDisabled$", () => this._videoInputDisabled$.asObservable().pipe((0, import_cjs$27.distinctUntilChanged)(), (0, import_cjs$27.takeUntil)(this.destroyed$)));
|
|
10710
10724
|
}
|
|
10711
10725
|
get audioInputDisabled$() {
|
|
10712
|
-
return this.cachedObservable("audioInputDisabled$", () => this._audioInputDisabled$.asObservable().pipe((0, import_cjs$
|
|
10726
|
+
return this.cachedObservable("audioInputDisabled$", () => this._audioInputDisabled$.asObservable().pipe((0, import_cjs$27.distinctUntilChanged)(), (0, import_cjs$27.takeUntil)(this.destroyed$)));
|
|
10713
10727
|
}
|
|
10714
10728
|
get videoInputDisabled() {
|
|
10715
10729
|
return this._videoInputDisabled$.value;
|
|
@@ -10718,22 +10732,22 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10718
10732
|
return this._audioInputDisabled$.value;
|
|
10719
10733
|
}
|
|
10720
10734
|
get audioInputDevices$() {
|
|
10721
|
-
return this.cachedObservable("audioInputDevices$", () => this._devicesState$.pipe((0, import_cjs$
|
|
10735
|
+
return this.cachedObservable("audioInputDevices$", () => this._devicesState$.pipe((0, import_cjs$27.map)((state) => state.audioinput), (0, import_cjs$27.distinctUntilChanged)(), (0, import_cjs$27.takeUntil)(this.destroyed$)));
|
|
10722
10736
|
}
|
|
10723
10737
|
get audioOutputDevices$() {
|
|
10724
|
-
return this.cachedObservable("audioOutputDevices$", () => this._devicesState$.pipe((0, import_cjs$
|
|
10738
|
+
return this.cachedObservable("audioOutputDevices$", () => this._devicesState$.pipe((0, import_cjs$27.map)((state) => state.audiooutput), (0, import_cjs$27.distinctUntilChanged)(), (0, import_cjs$27.takeUntil)(this.destroyed$)));
|
|
10725
10739
|
}
|
|
10726
10740
|
get videoInputDevices$() {
|
|
10727
|
-
return this.cachedObservable("videoInputDevices$", () => this._devicesState$.pipe((0, import_cjs$
|
|
10741
|
+
return this.cachedObservable("videoInputDevices$", () => this._devicesState$.pipe((0, import_cjs$27.map)((state) => state.videoinput), (0, import_cjs$27.distinctUntilChanged)(), (0, import_cjs$27.takeUntil)(this.destroyed$)));
|
|
10728
10742
|
}
|
|
10729
10743
|
get selectedAudioInputDevice$() {
|
|
10730
|
-
return this.cachedObservable("selectedAudioInputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, import_cjs$
|
|
10744
|
+
return this.cachedObservable("selectedAudioInputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, import_cjs$27.map)((state) => state.audioinput), (0, import_cjs$27.distinctUntilChanged)(), (0, import_cjs$27.takeUntil)(this.destroyed$), (0, import_cjs$27.tap)((info) => logger$27.debug("[DeviceController] Selected audio input device changed:", info))));
|
|
10731
10745
|
}
|
|
10732
10746
|
get selectedAudioOutputDevice$() {
|
|
10733
|
-
return this.cachedObservable("selectedAudioOutputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, import_cjs$
|
|
10747
|
+
return this.cachedObservable("selectedAudioOutputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, import_cjs$27.map)((state) => state.audiooutput), (0, import_cjs$27.distinctUntilChanged)(), (0, import_cjs$27.takeUntil)(this.destroyed$), (0, import_cjs$27.tap)((info) => logger$27.debug("[DeviceController] Selected audio output device changed:", info))));
|
|
10734
10748
|
}
|
|
10735
10749
|
get selectedVideoInputDevice$() {
|
|
10736
|
-
return this.cachedObservable("selectedVideoInputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, import_cjs$
|
|
10750
|
+
return this.cachedObservable("selectedVideoInputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, import_cjs$27.map)((state) => state.videoinput), (0, import_cjs$27.distinctUntilChanged)(), (0, import_cjs$27.takeUntil)(this.destroyed$), (0, import_cjs$27.tap)((info) => logger$27.debug("[DeviceController] Selected video input device changed:", info))));
|
|
10737
10751
|
}
|
|
10738
10752
|
get selectedAudioInputDevice() {
|
|
10739
10753
|
if (this._audioInputDisabled$.value) return null;
|
|
@@ -10829,7 +10843,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10829
10843
|
}
|
|
10830
10844
|
init() {
|
|
10831
10845
|
this.loadPersistedDevices();
|
|
10832
|
-
this.subscribeTo(this._devicesState$.pipe((0, import_cjs$
|
|
10846
|
+
this.subscribeTo(this._devicesState$.pipe((0, import_cjs$27.debounceTime)(PreferencesContainer.instance.deviceDebounceTime)), (devicesState) => {
|
|
10833
10847
|
const currentSelected = this._selectedDevicesState$.value;
|
|
10834
10848
|
const newAudioInput = this._audioInputDisabled$.value ? null : this.resolveDevice("audioinput", devicesState.audioinput, currentSelected.audioinput, PreferencesContainer.instance.preferredAudioInput);
|
|
10835
10849
|
const newAudioOutput = this.resolveDevice("audiooutput", devicesState.audiooutput, currentSelected.audiooutput, PreferencesContainer.instance.preferredAudioOutput);
|
|
@@ -10951,7 +10965,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10951
10965
|
enableDeviceMonitoring() {
|
|
10952
10966
|
this.disableDeviceMonitoring();
|
|
10953
10967
|
this.webRTCApiProvider.mediaDevices.addEventListener("devicechange", this.deviceChangeHandler);
|
|
10954
|
-
if (PreferencesContainer.instance.devicePollingInterval > 0) this._devicesPoolingSubscription = (0, import_cjs$
|
|
10968
|
+
if (PreferencesContainer.instance.devicePollingInterval > 0) this._devicesPoolingSubscription = (0, import_cjs$27.interval)(PreferencesContainer.instance.devicePollingInterval).subscribe(() => {
|
|
10955
10969
|
logger$27.debug("[DeviceController] Polling devices due to interval");
|
|
10956
10970
|
this.enumerateDevices();
|
|
10957
10971
|
});
|
|
@@ -10985,7 +10999,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10985
10999
|
});
|
|
10986
11000
|
} catch (error) {
|
|
10987
11001
|
logger$27.error("[DeviceController] Failed to enumerate devices:", error);
|
|
10988
|
-
this._errors$.next(error);
|
|
11002
|
+
this._errors$.next(toError(error));
|
|
10989
11003
|
}
|
|
10990
11004
|
}
|
|
10991
11005
|
async getDeviceCapabilities(deviceInfo) {
|
|
@@ -11001,7 +11015,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
11001
11015
|
return capabilities;
|
|
11002
11016
|
} catch (error) {
|
|
11003
11017
|
logger$27.error("[DeviceController] Failed to get device capabilities:", error);
|
|
11004
|
-
this._errors$.next(error);
|
|
11018
|
+
this._errors$.next(toError(error));
|
|
11005
11019
|
throw error;
|
|
11006
11020
|
}
|
|
11007
11021
|
}
|
|
@@ -11519,7 +11533,7 @@ var CryptoController = class {
|
|
|
11519
11533
|
|
|
11520
11534
|
//#endregion
|
|
11521
11535
|
//#region src/controllers/NetworkMonitor.ts
|
|
11522
|
-
var import_cjs$
|
|
11536
|
+
var import_cjs$26 = require_cjs();
|
|
11523
11537
|
const logger$25 = getLogger();
|
|
11524
11538
|
/**
|
|
11525
11539
|
* Safely check whether we are running in a browser environment
|
|
@@ -11563,13 +11577,13 @@ var NetworkMonitor = class extends Destroyable {
|
|
|
11563
11577
|
this.attachListeners();
|
|
11564
11578
|
}
|
|
11565
11579
|
get isOnline$() {
|
|
11566
|
-
return this._isOnline$.asObservable().pipe((0, import_cjs$
|
|
11580
|
+
return this._isOnline$.asObservable().pipe((0, import_cjs$26.takeUntil)(this._destroyed$));
|
|
11567
11581
|
}
|
|
11568
11582
|
get isOnline() {
|
|
11569
11583
|
return this._isOnline$.value;
|
|
11570
11584
|
}
|
|
11571
11585
|
get networkChange$() {
|
|
11572
|
-
return this._networkChange$.asObservable().pipe((0, import_cjs$
|
|
11586
|
+
return this._networkChange$.asObservable().pipe((0, import_cjs$26.takeUntil)(this._destroyed$));
|
|
11573
11587
|
}
|
|
11574
11588
|
destroy() {
|
|
11575
11589
|
this.removeListeners();
|
|
@@ -11732,7 +11746,7 @@ function getNavigatorMediaDevices() {
|
|
|
11732
11746
|
|
|
11733
11747
|
//#endregion
|
|
11734
11748
|
//#region src/controllers/PreflightRunner.ts
|
|
11735
|
-
var import_cjs$
|
|
11749
|
+
var import_cjs$25 = require_cjs();
|
|
11736
11750
|
const logger$24 = getLogger();
|
|
11737
11751
|
const DEFAULT_MEDIA_TEST_DURATION_S = 10;
|
|
11738
11752
|
const ICE_GATHERING_TIMEOUT_MS = 1e4;
|
|
@@ -11901,7 +11915,7 @@ var PreflightRunner = class extends Destroyable {
|
|
|
11901
11915
|
audio: true,
|
|
11902
11916
|
video: false
|
|
11903
11917
|
});
|
|
11904
|
-
await (0, import_cjs$
|
|
11918
|
+
await (0, import_cjs$25.firstValueFrom)(call.status$.pipe((0, import_cjs$25.filter)((s) => s === "connected"), (0, import_cjs$25.take)(1), (0, import_cjs$25.timeout)(SIGNALING_RTT_TIMEOUT_MS)));
|
|
11905
11919
|
const durationMs = this._options.duration * 1e3;
|
|
11906
11920
|
await new Promise((resolve) => setTimeout(resolve, durationMs));
|
|
11907
11921
|
const metrics = call.networkMetrics;
|
|
@@ -11930,7 +11944,7 @@ var PreflightRunner = class extends Destroyable {
|
|
|
11930
11944
|
|
|
11931
11945
|
//#endregion
|
|
11932
11946
|
//#region src/controllers/VisibilityController.ts
|
|
11933
|
-
var import_cjs$
|
|
11947
|
+
var import_cjs$24 = require_cjs();
|
|
11934
11948
|
const logger$23 = getLogger();
|
|
11935
11949
|
/**
|
|
11936
11950
|
* Checks whether the document visibility API is available.
|
|
@@ -11976,7 +11990,7 @@ var VisibilityController = class extends Destroyable {
|
|
|
11976
11990
|
* Emits 'visible' or 'hidden'. Always starts with the current state.
|
|
11977
11991
|
*/
|
|
11978
11992
|
get visibility$() {
|
|
11979
|
-
return this._visibility$.pipe((0, import_cjs$
|
|
11993
|
+
return this._visibility$.pipe((0, import_cjs$24.takeUntil)(this._destroyed$));
|
|
11980
11994
|
}
|
|
11981
11995
|
/**
|
|
11982
11996
|
* The current visibility state value.
|
|
@@ -11989,7 +12003,7 @@ var VisibilityController = class extends Destroyable {
|
|
|
11989
12003
|
* Each event includes the previous state, new state, and timestamp.
|
|
11990
12004
|
*/
|
|
11991
12005
|
get visibilityChange$() {
|
|
11992
|
-
return this._visibilityChange$.pipe((0, import_cjs$
|
|
12006
|
+
return this._visibilityChange$.pipe((0, import_cjs$24.takeUntil)(this._destroyed$));
|
|
11993
12007
|
}
|
|
11994
12008
|
destroy() {
|
|
11995
12009
|
if (this._hasVisibilityApi) {
|
|
@@ -12021,13 +12035,13 @@ var VisibilityController = class extends Destroyable {
|
|
|
12021
12035
|
|
|
12022
12036
|
//#endregion
|
|
12023
12037
|
//#region src/behaviors/Fetchable.ts
|
|
12024
|
-
var import_cjs$
|
|
12038
|
+
var import_cjs$23 = require_cjs();
|
|
12025
12039
|
var Fetchable = class extends Destroyable {
|
|
12026
12040
|
constructor(fromPath, http) {
|
|
12027
12041
|
super();
|
|
12028
12042
|
this.fromPath = fromPath;
|
|
12029
12043
|
this.http = http;
|
|
12030
|
-
this.fetched$ = (0, import_cjs$
|
|
12044
|
+
this.fetched$ = (0, import_cjs$23.defer)(() => (0, import_cjs$23.from)(this.fetch())).pipe((0, import_cjs$23.shareReplay)(1), (0, import_cjs$23.takeUntil)(this.destroyed$));
|
|
12031
12045
|
}
|
|
12032
12046
|
async fetch() {
|
|
12033
12047
|
const response = await this.http.request({
|
|
@@ -13260,24 +13274,6 @@ var require_operators = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13260
13274
|
});
|
|
13261
13275
|
}));
|
|
13262
13276
|
|
|
13263
|
-
//#endregion
|
|
13264
|
-
//#region src/operators/filterNull.ts
|
|
13265
|
-
var import_operators$1 = require_operators();
|
|
13266
|
-
var import_cjs$21 = require_cjs();
|
|
13267
|
-
/**
|
|
13268
|
-
* RxJS operator that filters out `null` and `undefined` values with type narrowing.
|
|
13269
|
-
*
|
|
13270
|
-
* @example
|
|
13271
|
-
* ```ts
|
|
13272
|
-
* source$.pipe(filterNull()).subscribe(value => {
|
|
13273
|
-
* // value is guaranteed non-null
|
|
13274
|
-
* });
|
|
13275
|
-
* ```
|
|
13276
|
-
*/
|
|
13277
|
-
function filterNull() {
|
|
13278
|
-
return (0, import_cjs$21.filter)((value) => value != null);
|
|
13279
|
-
}
|
|
13280
|
-
|
|
13281
13277
|
//#endregion
|
|
13282
13278
|
//#region src/core/capabilities/types.ts
|
|
13283
13279
|
/**
|
|
@@ -13403,7 +13399,7 @@ function computeCapabilities(capabilities) {
|
|
|
13403
13399
|
|
|
13404
13400
|
//#endregion
|
|
13405
13401
|
//#region src/core/capabilities/SelfCapabilities.ts
|
|
13406
|
-
var import_cjs$
|
|
13402
|
+
var import_cjs$22 = require_cjs();
|
|
13407
13403
|
/**
|
|
13408
13404
|
* SelfCapabilities manages the capability state for the self participant.
|
|
13409
13405
|
*
|
|
@@ -13439,7 +13435,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13439
13435
|
}
|
|
13440
13436
|
/** Observable for self member capabilities */
|
|
13441
13437
|
get self$() {
|
|
13442
|
-
return this.cachedObservable("self$", () => this._state$.pipe((0, import_cjs$
|
|
13438
|
+
return this.cachedObservable("self$", () => this._state$.pipe((0, import_cjs$22.map)((state) => state.self), (0, import_cjs$22.distinctUntilChanged)()));
|
|
13443
13439
|
}
|
|
13444
13440
|
/** Current self member capabilities */
|
|
13445
13441
|
get self() {
|
|
@@ -13447,7 +13443,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13447
13443
|
}
|
|
13448
13444
|
/** Observable for other member capabilities */
|
|
13449
13445
|
get member$() {
|
|
13450
|
-
return this.cachedObservable("member$", () => this._state$.pipe((0, import_cjs$
|
|
13446
|
+
return this.cachedObservable("member$", () => this._state$.pipe((0, import_cjs$22.map)((state) => state.member), (0, import_cjs$22.distinctUntilChanged)()));
|
|
13451
13447
|
}
|
|
13452
13448
|
/** Current other member capabilities */
|
|
13453
13449
|
get member() {
|
|
@@ -13455,7 +13451,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13455
13451
|
}
|
|
13456
13452
|
/** Observable for end call capability */
|
|
13457
13453
|
get end$() {
|
|
13458
|
-
return this.cachedObservable("end$", () => this._state$.pipe((0, import_cjs$
|
|
13454
|
+
return this.cachedObservable("end$", () => this._state$.pipe((0, import_cjs$22.map)((state) => state.end), (0, import_cjs$22.distinctUntilChanged)()));
|
|
13459
13455
|
}
|
|
13460
13456
|
/** Current end call capability */
|
|
13461
13457
|
get end() {
|
|
@@ -13463,7 +13459,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13463
13459
|
}
|
|
13464
13460
|
/** Observable for set layout capability */
|
|
13465
13461
|
get setLayout$() {
|
|
13466
|
-
return this.cachedObservable("setLayout$", () => this._state$.pipe((0, import_cjs$
|
|
13462
|
+
return this.cachedObservable("setLayout$", () => this._state$.pipe((0, import_cjs$22.map)((state) => state.setLayout), (0, import_cjs$22.distinctUntilChanged)()));
|
|
13467
13463
|
}
|
|
13468
13464
|
/** Current set layout capability */
|
|
13469
13465
|
get setLayout() {
|
|
@@ -13471,7 +13467,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13471
13467
|
}
|
|
13472
13468
|
/** Observable for send digit capability */
|
|
13473
13469
|
get sendDigit$() {
|
|
13474
|
-
return this.cachedObservable("sendDigit$", () => this._state$.pipe((0, import_cjs$
|
|
13470
|
+
return this.cachedObservable("sendDigit$", () => this._state$.pipe((0, import_cjs$22.map)((state) => state.sendDigit), (0, import_cjs$22.distinctUntilChanged)()));
|
|
13475
13471
|
}
|
|
13476
13472
|
/** Current send digit capability */
|
|
13477
13473
|
get sendDigit() {
|
|
@@ -13479,7 +13475,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13479
13475
|
}
|
|
13480
13476
|
/** Observable for vmuted hide capability */
|
|
13481
13477
|
get vmutedHide$() {
|
|
13482
|
-
return this.cachedObservable("vmutedHide$", () => this._state$.pipe((0, import_cjs$
|
|
13478
|
+
return this.cachedObservable("vmutedHide$", () => this._state$.pipe((0, import_cjs$22.map)((state) => state.vmutedHide), (0, import_cjs$22.distinctUntilChanged)()));
|
|
13483
13479
|
}
|
|
13484
13480
|
/** Current vmuted hide capability */
|
|
13485
13481
|
get vmutedHide() {
|
|
@@ -13487,7 +13483,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13487
13483
|
}
|
|
13488
13484
|
/** Observable for lock capability */
|
|
13489
13485
|
get lock$() {
|
|
13490
|
-
return this.cachedObservable("lock$", () => this._state$.pipe((0, import_cjs$
|
|
13486
|
+
return this.cachedObservable("lock$", () => this._state$.pipe((0, import_cjs$22.map)((state) => state.lock), (0, import_cjs$22.distinctUntilChanged)()));
|
|
13491
13487
|
}
|
|
13492
13488
|
/** Current lock capability */
|
|
13493
13489
|
get lock() {
|
|
@@ -13495,7 +13491,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13495
13491
|
}
|
|
13496
13492
|
/** Observable for device capability */
|
|
13497
13493
|
get device$() {
|
|
13498
|
-
return this.cachedObservable("device$", () => this._state$.pipe((0, import_cjs$
|
|
13494
|
+
return this.cachedObservable("device$", () => this._state$.pipe((0, import_cjs$22.map)((state) => state.device), (0, import_cjs$22.distinctUntilChanged)()));
|
|
13499
13495
|
}
|
|
13500
13496
|
/** Current device capability */
|
|
13501
13497
|
get device() {
|
|
@@ -13503,7 +13499,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13503
13499
|
}
|
|
13504
13500
|
/** Observable for screenshare capability */
|
|
13505
13501
|
get screenshare$() {
|
|
13506
|
-
return this.cachedObservable("screenshare$", () => this._state$.pipe((0, import_cjs$
|
|
13502
|
+
return this.cachedObservable("screenshare$", () => this._state$.pipe((0, import_cjs$22.map)((state) => state.screenshare), (0, import_cjs$22.distinctUntilChanged)()));
|
|
13507
13503
|
}
|
|
13508
13504
|
/** Current screenshare capability */
|
|
13509
13505
|
get screenshare() {
|
|
@@ -13521,6 +13517,7 @@ var SelfCapabilities = class extends Destroyable {
|
|
|
13521
13517
|
|
|
13522
13518
|
//#endregion
|
|
13523
13519
|
//#region src/core/RPCMessages/utils.ts
|
|
13520
|
+
var import_operators$1 = require_operators();
|
|
13524
13521
|
function toggleDeafMethod(is) {
|
|
13525
13522
|
return is ? "call.undeaf" : "call.deaf";
|
|
13526
13523
|
}
|
|
@@ -13556,83 +13553,83 @@ var Participant = class extends Destroyable {
|
|
|
13556
13553
|
}
|
|
13557
13554
|
/** Observable of the participant's display name. */
|
|
13558
13555
|
get name$() {
|
|
13559
|
-
return this.cachedObservable("name$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.name), (0, import_operators$1.distinctUntilChanged)()
|
|
13556
|
+
return this.cachedObservable("name$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.name), (0, import_operators$1.distinctUntilChanged)()));
|
|
13560
13557
|
}
|
|
13561
13558
|
/** Observable of the participant type (e.g. `'member'`, `'screen'`). */
|
|
13562
13559
|
get type$() {
|
|
13563
|
-
return this.cachedObservable("type$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.type), (0, import_operators$1.distinctUntilChanged)()
|
|
13560
|
+
return this.cachedObservable("type$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.type), (0, import_operators$1.distinctUntilChanged)()));
|
|
13564
13561
|
}
|
|
13565
13562
|
/** Observable indicating whether the participant has raised their hand. */
|
|
13566
13563
|
get handraised$() {
|
|
13567
|
-
return this.cachedObservable("handraised$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.handraised), (0, import_operators$1.distinctUntilChanged)()
|
|
13564
|
+
return this.cachedObservable("handraised$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.handraised), (0, import_operators$1.distinctUntilChanged)()));
|
|
13568
13565
|
}
|
|
13569
13566
|
/** Observable indicating whether the participant is visible in the layout. */
|
|
13570
13567
|
get visible$() {
|
|
13571
|
-
return this.cachedObservable("visible$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.visible), (0, import_operators$1.distinctUntilChanged)()
|
|
13568
|
+
return this.cachedObservable("visible$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.visible), (0, import_operators$1.distinctUntilChanged)()));
|
|
13572
13569
|
}
|
|
13573
13570
|
/** Observable indicating whether the participant's audio is muted. */
|
|
13574
13571
|
get audioMuted$() {
|
|
13575
|
-
return this.cachedObservable("audioMuted$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.audio_muted), (0, import_operators$1.distinctUntilChanged)()
|
|
13572
|
+
return this.cachedObservable("audioMuted$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.audio_muted), (0, import_operators$1.distinctUntilChanged)()));
|
|
13576
13573
|
}
|
|
13577
13574
|
/** Observable indicating whether the participant's video is muted. */
|
|
13578
13575
|
get videoMuted$() {
|
|
13579
|
-
return this.cachedObservable("videoMuted$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.video_muted), (0, import_operators$1.distinctUntilChanged)()
|
|
13576
|
+
return this.cachedObservable("videoMuted$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.video_muted), (0, import_operators$1.distinctUntilChanged)()));
|
|
13580
13577
|
}
|
|
13581
13578
|
/** Observable indicating whether the participant is deafened. */
|
|
13582
13579
|
get deaf$() {
|
|
13583
|
-
return this.cachedObservable("deaf$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.deaf), (0, import_operators$1.distinctUntilChanged)()
|
|
13580
|
+
return this.cachedObservable("deaf$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.deaf), (0, import_operators$1.distinctUntilChanged)()));
|
|
13584
13581
|
}
|
|
13585
13582
|
/** Observable of the participant's microphone input volume. */
|
|
13586
13583
|
get inputVolume$() {
|
|
13587
|
-
return this.cachedObservable("inputVolume$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.input_volume), (0, import_operators$1.distinctUntilChanged)()
|
|
13584
|
+
return this.cachedObservable("inputVolume$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.input_volume), (0, import_operators$1.distinctUntilChanged)()));
|
|
13588
13585
|
}
|
|
13589
13586
|
/** Observable of the participant's speaker output volume. */
|
|
13590
13587
|
get outputVolume$() {
|
|
13591
|
-
return this.cachedObservable("outputVolume$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.output_volume), (0, import_operators$1.distinctUntilChanged)()
|
|
13588
|
+
return this.cachedObservable("outputVolume$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.output_volume), (0, import_operators$1.distinctUntilChanged)()));
|
|
13592
13589
|
}
|
|
13593
13590
|
/** Observable of the microphone input sensitivity level. */
|
|
13594
13591
|
get inputSensitivity$() {
|
|
13595
|
-
return this.cachedObservable("inputSensitivity$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.input_sensitivity), (0, import_operators$1.distinctUntilChanged)()
|
|
13592
|
+
return this.cachedObservable("inputSensitivity$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.input_sensitivity), (0, import_operators$1.distinctUntilChanged)()));
|
|
13596
13593
|
}
|
|
13597
13594
|
/** Observable indicating whether echo cancellation is enabled. */
|
|
13598
13595
|
get echoCancellation$() {
|
|
13599
|
-
return this.cachedObservable("echoCancellation$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.echo_cancellation), (0, import_operators$1.distinctUntilChanged)()
|
|
13596
|
+
return this.cachedObservable("echoCancellation$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.echo_cancellation), (0, import_operators$1.distinctUntilChanged)()));
|
|
13600
13597
|
}
|
|
13601
13598
|
/** Observable indicating whether auto-gain control is enabled. */
|
|
13602
13599
|
get autoGain$() {
|
|
13603
|
-
return this.cachedObservable("autoGain$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.auto_gain), (0, import_operators$1.distinctUntilChanged)()
|
|
13600
|
+
return this.cachedObservable("autoGain$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.auto_gain), (0, import_operators$1.distinctUntilChanged)()));
|
|
13604
13601
|
}
|
|
13605
13602
|
/** Observable indicating whether noise suppression is enabled. */
|
|
13606
13603
|
get noiseSuppression$() {
|
|
13607
|
-
return this.cachedObservable("noiseSuppression$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.noise_suppression), (0, import_operators$1.distinctUntilChanged)()
|
|
13604
|
+
return this.cachedObservable("noiseSuppression$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.noise_suppression), (0, import_operators$1.distinctUntilChanged)()));
|
|
13608
13605
|
}
|
|
13609
13606
|
/** Observable indicating whether low-bitrate mode is active. */
|
|
13610
13607
|
get lowbitrate$() {
|
|
13611
|
-
return this.cachedObservable("lowbitrate$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.lowbitrate), (0, import_operators$1.distinctUntilChanged)()
|
|
13608
|
+
return this.cachedObservable("lowbitrate$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.lowbitrate), (0, import_operators$1.distinctUntilChanged)()));
|
|
13612
13609
|
}
|
|
13613
13610
|
/** Observable indicating whether noise reduction is active. */
|
|
13614
13611
|
get denoise$() {
|
|
13615
|
-
return this.cachedObservable("denoise$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.denoise), (0, import_operators$1.distinctUntilChanged)()
|
|
13612
|
+
return this.cachedObservable("denoise$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.denoise), (0, import_operators$1.distinctUntilChanged)()));
|
|
13616
13613
|
}
|
|
13617
13614
|
/** Observable of custom metadata for this participant. */
|
|
13618
13615
|
get meta$() {
|
|
13619
|
-
return this.cachedObservable("meta$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.meta), (0, import_operators$1.distinctUntilChanged)()
|
|
13616
|
+
return this.cachedObservable("meta$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.meta), (0, import_operators$1.distinctUntilChanged)()));
|
|
13620
13617
|
}
|
|
13621
13618
|
/** Observable of the participant's subscriber ID. */
|
|
13622
13619
|
get subscriberId$() {
|
|
13623
|
-
return this.cachedObservable("subscriberId$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.subscriber_id), (0, import_operators$1.distinctUntilChanged)()
|
|
13620
|
+
return this.cachedObservable("subscriberId$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.subscriber_id), (0, import_operators$1.distinctUntilChanged)()));
|
|
13624
13621
|
}
|
|
13625
13622
|
/** Observable of the participant's address ID. */
|
|
13626
13623
|
get addressId$() {
|
|
13627
|
-
return this.cachedObservable("addressId$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.address_id), (0, import_operators$1.distinctUntilChanged)()
|
|
13624
|
+
return this.cachedObservable("addressId$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.address_id), (0, import_operators$1.distinctUntilChanged)()));
|
|
13628
13625
|
}
|
|
13629
13626
|
/** Observable of the server node ID for this participant. */
|
|
13630
13627
|
get nodeId$() {
|
|
13631
|
-
return this.cachedObservable("nodeId$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.node_id), (0, import_operators$1.distinctUntilChanged)()
|
|
13628
|
+
return this.cachedObservable("nodeId$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.node_id), (0, import_operators$1.distinctUntilChanged)()));
|
|
13632
13629
|
}
|
|
13633
13630
|
/** Observable indicating whether the participant is currently speaking. */
|
|
13634
13631
|
get isTalking$() {
|
|
13635
|
-
return this.cachedObservable("isTalking$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.talking), (0, import_operators$1.distinctUntilChanged)()
|
|
13632
|
+
return this.cachedObservable("isTalking$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.talking), (0, import_operators$1.distinctUntilChanged)()));
|
|
13636
13633
|
}
|
|
13637
13634
|
/** Whether the participant is currently speaking. */
|
|
13638
13635
|
get isTalking() {
|
|
@@ -13640,7 +13637,7 @@ var Participant = class extends Destroyable {
|
|
|
13640
13637
|
}
|
|
13641
13638
|
/** Observable of the participant's layout position. */
|
|
13642
13639
|
get position$() {
|
|
13643
|
-
return this.cachedObservable("position$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.position), (0, import_operators$1.distinctUntilChanged)()
|
|
13640
|
+
return this.cachedObservable("position$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.position), (0, import_operators$1.distinctUntilChanged)()));
|
|
13644
13641
|
}
|
|
13645
13642
|
/** Current layout position. */
|
|
13646
13643
|
get position() {
|
|
@@ -14136,6 +14133,23 @@ function isLayoutChangedPayload(value) {
|
|
|
14136
14133
|
return isObject(value) && hasProperty(value, "room_id") && hasProperty(value, "room_session_id") && hasProperty(value, "layout");
|
|
14137
14134
|
}
|
|
14138
14135
|
|
|
14136
|
+
//#endregion
|
|
14137
|
+
//#region src/operators/filterNull.ts
|
|
14138
|
+
var import_cjs$21 = require_cjs();
|
|
14139
|
+
/**
|
|
14140
|
+
* RxJS operator that filters out `null` and `undefined` values with type narrowing.
|
|
14141
|
+
*
|
|
14142
|
+
* @example
|
|
14143
|
+
* ```ts
|
|
14144
|
+
* source$.pipe(filterNull()).subscribe(value => {
|
|
14145
|
+
* // value is guaranteed non-null
|
|
14146
|
+
* });
|
|
14147
|
+
* ```
|
|
14148
|
+
*/
|
|
14149
|
+
function filterNull() {
|
|
14150
|
+
return (0, import_cjs$21.filter)((value) => value != null);
|
|
14151
|
+
}
|
|
14152
|
+
|
|
14139
14153
|
//#endregion
|
|
14140
14154
|
//#region src/utils/getValueFrom.ts
|
|
14141
14155
|
const getValueFrom = (obj, path, defaultValue) => {
|
|
@@ -14148,7 +14162,7 @@ const getValueFrom = (obj, path, defaultValue) => {
|
|
|
14148
14162
|
|
|
14149
14163
|
//#endregion
|
|
14150
14164
|
//#region src/operators/filterEventAs.ts
|
|
14151
|
-
var import_cjs$
|
|
14165
|
+
var import_cjs$20 = require_cjs();
|
|
14152
14166
|
var import_operators = require_operators();
|
|
14153
14167
|
/**
|
|
14154
14168
|
* RxJS operator that filters events based on a predicate and maps matching events.
|
|
@@ -14182,7 +14196,7 @@ var import_operators = require_operators();
|
|
|
14182
14196
|
* ```
|
|
14183
14197
|
*/
|
|
14184
14198
|
function ifIsMap(predicate, mapFn) {
|
|
14185
|
-
return (0, import_cjs$
|
|
14199
|
+
return (0, import_cjs$20.pipe)((0, import_operators.filter)(predicate), (0, import_operators.map)(mapFn));
|
|
14186
14200
|
}
|
|
14187
14201
|
/**
|
|
14188
14202
|
* Generic RxJS operator that filters events using a type guard and extracts a property.
|
|
@@ -14224,21 +14238,21 @@ function ifIsMap(predicate, mapFn) {
|
|
|
14224
14238
|
* ```
|
|
14225
14239
|
*/
|
|
14226
14240
|
function filterAs(predicate, resultPath) {
|
|
14227
|
-
return (0, import_cjs$
|
|
14241
|
+
return (0, import_cjs$20.pipe)(ifIsMap(predicate, (event) => {
|
|
14228
14242
|
return getValueFrom(event, resultPath);
|
|
14229
14243
|
}), (0, import_operators.filter)((value) => value !== void 0));
|
|
14230
14244
|
}
|
|
14231
14245
|
|
|
14232
14246
|
//#endregion
|
|
14233
14247
|
//#region src/operators/throwOnRPCError.ts
|
|
14234
|
-
var import_cjs$
|
|
14248
|
+
var import_cjs$19 = require_cjs();
|
|
14235
14249
|
const logger$20 = getLogger();
|
|
14236
14250
|
/**
|
|
14237
14251
|
* RxJS operator that throws a {@link JSONRPCError} when the RPC response contains an error.
|
|
14238
14252
|
* Passes successful responses through unchanged.
|
|
14239
14253
|
*/
|
|
14240
14254
|
function throwOnRPCError() {
|
|
14241
|
-
return (0, import_cjs$
|
|
14255
|
+
return (0, import_cjs$19.map)((response) => {
|
|
14242
14256
|
if (response.error) {
|
|
14243
14257
|
logger$20.error("[throwOnRPCError] RPC error response:", {
|
|
14244
14258
|
code: response.error.code,
|
|
@@ -14254,7 +14268,7 @@ function throwOnRPCError() {
|
|
|
14254
14268
|
|
|
14255
14269
|
//#endregion
|
|
14256
14270
|
//#region src/managers/CallEventsManager.ts
|
|
14257
|
-
var import_cjs$
|
|
14271
|
+
var import_cjs$18 = require_cjs();
|
|
14258
14272
|
const logger$19 = getLogger();
|
|
14259
14273
|
const initialSessionState = {};
|
|
14260
14274
|
/** @internal */
|
|
@@ -14271,7 +14285,7 @@ var CallEventsManager = class extends Destroyable {
|
|
|
14271
14285
|
this.initSubscriptions();
|
|
14272
14286
|
}
|
|
14273
14287
|
get participants$() {
|
|
14274
|
-
return this.cachedObservable("participants$", () => this._participants$.asObservable().pipe((0, import_cjs$
|
|
14288
|
+
return this.cachedObservable("participants$", () => this._participants$.asObservable().pipe((0, import_cjs$18.map)((participantsRecord) => Object.values(participantsRecord))));
|
|
14275
14289
|
}
|
|
14276
14290
|
get participants() {
|
|
14277
14291
|
return Object.values(this._participants$.value);
|
|
@@ -14289,40 +14303,40 @@ var CallEventsManager = class extends Destroyable {
|
|
|
14289
14303
|
return this.callIds.has(callId);
|
|
14290
14304
|
}
|
|
14291
14305
|
get recording$() {
|
|
14292
|
-
return this.cachedObservable("recording$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14306
|
+
return this.cachedObservable("recording$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.recording), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14293
14307
|
}
|
|
14294
14308
|
get recordings$() {
|
|
14295
|
-
return this.cachedObservable("recordings$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14309
|
+
return this.cachedObservable("recordings$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.recordings), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14296
14310
|
}
|
|
14297
14311
|
get streaming$() {
|
|
14298
|
-
return this.cachedObservable("streaming$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14312
|
+
return this.cachedObservable("streaming$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.streaming), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14299
14313
|
}
|
|
14300
14314
|
get streams$() {
|
|
14301
|
-
return this.cachedObservable("streams$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14315
|
+
return this.cachedObservable("streams$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.streams), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14302
14316
|
}
|
|
14303
14317
|
get playbacks$() {
|
|
14304
|
-
return this.cachedObservable("playbacks$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14318
|
+
return this.cachedObservable("playbacks$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.playbacks), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14305
14319
|
}
|
|
14306
14320
|
get raiseHandPriority$() {
|
|
14307
|
-
return this.cachedObservable("raiseHandPriority$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14321
|
+
return this.cachedObservable("raiseHandPriority$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.prioritize_handraise), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14308
14322
|
}
|
|
14309
14323
|
get locked$() {
|
|
14310
|
-
return this.cachedObservable("locked$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14324
|
+
return this.cachedObservable("locked$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.locked), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14311
14325
|
}
|
|
14312
14326
|
get meta$() {
|
|
14313
|
-
return this.cachedObservable("meta$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14327
|
+
return this.cachedObservable("meta$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.meta), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14314
14328
|
}
|
|
14315
14329
|
get capabilities$() {
|
|
14316
|
-
return this.cachedObservable("capabilities$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14330
|
+
return this.cachedObservable("capabilities$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.capabilities), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14317
14331
|
}
|
|
14318
14332
|
get layout$() {
|
|
14319
|
-
return this.cachedObservable("layout$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14333
|
+
return this.cachedObservable("layout$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.layout_name), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14320
14334
|
}
|
|
14321
14335
|
get layouts$() {
|
|
14322
|
-
return this.cachedObservable("layouts$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14336
|
+
return this.cachedObservable("layouts$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.layouts), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14323
14337
|
}
|
|
14324
14338
|
get layoutLayers$() {
|
|
14325
|
-
return this.cachedObservable("layoutLayers$", () => this._sessionState$.pipe((0, import_cjs$
|
|
14339
|
+
return this.cachedObservable("layoutLayers$", () => this._sessionState$.pipe((0, import_cjs$18.map)((state) => state.layout_layers), (0, import_cjs$18.distinctUntilChanged)(), filterNull()));
|
|
14326
14340
|
}
|
|
14327
14341
|
get self() {
|
|
14328
14342
|
return this._self$.value;
|
|
@@ -14364,7 +14378,7 @@ var CallEventsManager = class extends Destroyable {
|
|
|
14364
14378
|
roomSessionId: callJoinedEvent.room_session_id
|
|
14365
14379
|
});
|
|
14366
14380
|
const sessionState = callJoinedEvent.room_session;
|
|
14367
|
-
const
|
|
14381
|
+
const capabilities = callJoinedEvent.capabilities;
|
|
14368
14382
|
this.selfId = this.selfId ?? callJoinedEvent.member_id;
|
|
14369
14383
|
this.originCallId = this.originCallId ?? callJoinedEvent.origin_call_id;
|
|
14370
14384
|
this.callIds.add(callJoinedEvent.call_id);
|
|
@@ -14477,17 +14491,17 @@ var CallEventsManager = class extends Destroyable {
|
|
|
14477
14491
|
this._participants$.next(this._participants$.value);
|
|
14478
14492
|
}
|
|
14479
14493
|
get callJoinedEvent$() {
|
|
14480
|
-
return this.cachedObservable("callJoinedEvent$", () => this.webRtcCallSession.callEvent$.pipe((0, import_cjs$
|
|
14494
|
+
return this.cachedObservable("callJoinedEvent$", () => this.webRtcCallSession.callEvent$.pipe((0, import_cjs$18.filter)(isCallJoinedPayload), (0, import_cjs$18.tap)((event) => {
|
|
14481
14495
|
logger$19.debug("[CallEventsManager] Call joined event:", event);
|
|
14482
14496
|
})));
|
|
14483
14497
|
}
|
|
14484
14498
|
get layoutChangedEvent$() {
|
|
14485
|
-
return this.cachedObservable("layoutChangedEvent$", () => this.webRtcCallSession.callEvent$.pipe(filterAs(isLayoutChangedPayload, "layout"), (0, import_cjs$
|
|
14499
|
+
return this.cachedObservable("layoutChangedEvent$", () => this.webRtcCallSession.callEvent$.pipe(filterAs(isLayoutChangedPayload, "layout"), (0, import_cjs$18.tap)((event) => {
|
|
14486
14500
|
logger$19.debug("[CallEventsManager] Layout changed event:", event);
|
|
14487
14501
|
})));
|
|
14488
14502
|
}
|
|
14489
14503
|
get memberUpdates$() {
|
|
14490
|
-
return this.cachedObservable("memberUpdates$", () => (0, import_cjs$
|
|
14504
|
+
return this.cachedObservable("memberUpdates$", () => (0, import_cjs$18.merge)(this.webRtcCallSession.memberJoined$, this.webRtcCallSession.memberUpdated$, this.webRtcCallSession.memberTalking$).pipe((0, import_cjs$18.map)((event) => event.member), (0, import_cjs$18.tap)((event) => {
|
|
14491
14505
|
logger$19.debug("[CallEventsManager] Member update event:", event);
|
|
14492
14506
|
})));
|
|
14493
14507
|
}
|
|
@@ -14744,7 +14758,7 @@ function appendStereoParams(fmtpLine, maxBitrate) {
|
|
|
14744
14758
|
|
|
14745
14759
|
//#endregion
|
|
14746
14760
|
//#region src/controllers/ICEGatheringController.ts
|
|
14747
|
-
var import_cjs$
|
|
14761
|
+
var import_cjs$17 = require_cjs();
|
|
14748
14762
|
const logger$18 = getLogger();
|
|
14749
14763
|
var ICEGatheringController = class extends Destroyable {
|
|
14750
14764
|
constructor(peerConnection, peerConnectionControllerNegotiating$, options = {}) {
|
|
@@ -14782,7 +14796,7 @@ var ICEGatheringController = class extends Destroyable {
|
|
|
14782
14796
|
this.iceGatheringTimeout = options.iceGatheringTimeout ?? DEFAULT_ICE_GATHERING_TIMEOUT_MS;
|
|
14783
14797
|
this.relayOnly = options.relayOnly ?? false;
|
|
14784
14798
|
this.setupEventListeners();
|
|
14785
|
-
this.subscribeTo(this.peerConnectionControllerNegotiating$.pipe((0, import_cjs$
|
|
14799
|
+
this.subscribeTo(this.peerConnectionControllerNegotiating$.pipe((0, import_cjs$17.filter)((isNegotiating) => isNegotiating)), (isNegotiating) => {
|
|
14786
14800
|
if (isNegotiating) {
|
|
14787
14801
|
this.setupEventListeners();
|
|
14788
14802
|
this.iceGatheringTimer = setTimeout(() => {
|
|
@@ -14801,7 +14815,7 @@ var ICEGatheringController = class extends Destroyable {
|
|
|
14801
14815
|
this.peerConnection.addEventListener("icegatheringstatechange", this.onicegatheringstatechangeHandler);
|
|
14802
14816
|
}
|
|
14803
14817
|
get iceCandidatesState$() {
|
|
14804
|
-
return this._iceCandidatesState.pipe((0, import_cjs$
|
|
14818
|
+
return this._iceCandidatesState.pipe((0, import_cjs$17.withLatestFrom)(this.peerConnectionControllerNegotiating$), (0, import_cjs$17.filter)(([_, isNegotiating]) => isNegotiating), (0, import_cjs$17.map)(([state, _]) => state.state));
|
|
14805
14819
|
}
|
|
14806
14820
|
get hasValidLocalDescriptionSDP() {
|
|
14807
14821
|
const sdp = this.peerConnection.localDescription?.sdp;
|
|
@@ -14888,7 +14902,7 @@ var ICEGatheringController = class extends Destroyable {
|
|
|
14888
14902
|
|
|
14889
14903
|
//#endregion
|
|
14890
14904
|
//#region src/controllers/LocalStreamController.ts
|
|
14891
|
-
var import_cjs$
|
|
14905
|
+
var import_cjs$16 = require_cjs();
|
|
14892
14906
|
const logger$17 = getLogger();
|
|
14893
14907
|
var LocalStreamController = class extends Destroyable {
|
|
14894
14908
|
constructor(options) {
|
|
@@ -14903,16 +14917,16 @@ var LocalStreamController = class extends Destroyable {
|
|
|
14903
14917
|
this._mediaTrackEnded$ = this.createSubject();
|
|
14904
14918
|
}
|
|
14905
14919
|
get localStream$() {
|
|
14906
|
-
return this._localStream$.asObservable().pipe((0, import_cjs$
|
|
14920
|
+
return this._localStream$.asObservable().pipe((0, import_cjs$16.takeUntil)(this.destroyed$));
|
|
14907
14921
|
}
|
|
14908
14922
|
get localAudioTracks$() {
|
|
14909
|
-
return this._localAudioTracks$.asObservable().pipe((0, import_cjs$
|
|
14923
|
+
return this._localAudioTracks$.asObservable().pipe((0, import_cjs$16.takeUntil)(this.destroyed$));
|
|
14910
14924
|
}
|
|
14911
14925
|
get localVideoTracks$() {
|
|
14912
|
-
return this._localVideoTracks$.asObservable().pipe((0, import_cjs$
|
|
14926
|
+
return this._localVideoTracks$.asObservable().pipe((0, import_cjs$16.takeUntil)(this.destroyed$));
|
|
14913
14927
|
}
|
|
14914
14928
|
get mediaTrackEnded$() {
|
|
14915
|
-
return this._mediaTrackEnded$.asObservable().pipe((0, import_cjs$
|
|
14929
|
+
return this._mediaTrackEnded$.asObservable().pipe((0, import_cjs$16.takeUntil)(this.destroyed$));
|
|
14916
14930
|
}
|
|
14917
14931
|
get localStream() {
|
|
14918
14932
|
return this._localStream$.value;
|
|
@@ -15301,7 +15315,7 @@ var TransceiverController = class extends Destroyable {
|
|
|
15301
15315
|
|
|
15302
15316
|
//#endregion
|
|
15303
15317
|
//#region src/controllers/RTCPeerConnectionController.ts
|
|
15304
|
-
var import_cjs$
|
|
15318
|
+
var import_cjs$15 = require_cjs();
|
|
15305
15319
|
const logger$15 = getLogger();
|
|
15306
15320
|
var RTCPeerConnectionController = class extends Destroyable {
|
|
15307
15321
|
constructor(options = {}, remoteSessionDescription, deviceController) {
|
|
@@ -15309,11 +15323,11 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15309
15323
|
this.options = options;
|
|
15310
15324
|
this.firstSDPExchangeCompleted = false;
|
|
15311
15325
|
this.negotiationNeeded$ = this.createSubject();
|
|
15312
|
-
this.localDescription$ = (0, import_cjs$
|
|
15326
|
+
this.localDescription$ = (0, import_cjs$15.defer)(() => (0, import_cjs$15.from)(this.init())).pipe((0, import_cjs$15.switchMap)(() => this.iceGatheringController.iceCandidatesState$.pipe((0, import_cjs$15.filter)((iceCandidateState) => !["new", "gathering"].includes(iceCandidateState)), (0, import_cjs$15.tap)(() => {
|
|
15313
15327
|
this.negotiationEnded();
|
|
15314
|
-
}), (0, import_cjs$
|
|
15328
|
+
}), (0, import_cjs$15.filter)(() => this.shouldEmitLocalDescription), (0, import_cjs$15.map)(() => this.peerConnection?.localDescription), filterNull(), (0, import_cjs$15.tap)((desc) => {
|
|
15315
15329
|
if (desc.type === "answer") this._type = "offer";
|
|
15316
|
-
}))), (0, import_cjs$
|
|
15330
|
+
}))), (0, import_cjs$15.shareReplay)(1), (0, import_cjs$15.takeUntil)(this.destroyed$));
|
|
15317
15331
|
this.connectionTimeout = 3e3;
|
|
15318
15332
|
this.oniceconnectionstatechangeHandler = () => {
|
|
15319
15333
|
if (this.peerConnection) {
|
|
@@ -15371,7 +15385,7 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15371
15385
|
logger$15.debug(`[RTCPeerConnectionController] ${kind} input device selected:`, deviceInfo?.label);
|
|
15372
15386
|
} catch (error) {
|
|
15373
15387
|
logger$15.error(`[RTCPeerConnectionController] Failed to select ${kind} input device:`, error);
|
|
15374
|
-
this._errors$.next(error);
|
|
15388
|
+
this._errors$.next(toError(error));
|
|
15375
15389
|
throw error;
|
|
15376
15390
|
}
|
|
15377
15391
|
};
|
|
@@ -15456,43 +15470,43 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15456
15470
|
};
|
|
15457
15471
|
}
|
|
15458
15472
|
get iceGatheringState$() {
|
|
15459
|
-
return this.cachedObservable("iceGatheringState$", () => this._iceGatheringState$.asObservable().pipe((0, import_cjs$
|
|
15473
|
+
return this.cachedObservable("iceGatheringState$", () => this._iceGatheringState$.asObservable().pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15460
15474
|
}
|
|
15461
15475
|
get mediaTrackEnded$() {
|
|
15462
|
-
return this.cachedObservable("mediaTrackEnded$", () => this.localStreamController.mediaTrackEnded$.pipe((0, import_cjs$
|
|
15476
|
+
return this.cachedObservable("mediaTrackEnded$", () => this.localStreamController.mediaTrackEnded$.pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15463
15477
|
}
|
|
15464
15478
|
get errors$() {
|
|
15465
|
-
return this.cachedObservable("errors$", () => this._errors$.asObservable().pipe((0, import_cjs$
|
|
15479
|
+
return this.cachedObservable("errors$", () => this._errors$.asObservable().pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15466
15480
|
}
|
|
15467
15481
|
get iceCandidates$() {
|
|
15468
|
-
return this.cachedObservable("iceCandidates$", () => this._iceCandidates$.asObservable().pipe((0, import_cjs$
|
|
15482
|
+
return this.cachedObservable("iceCandidates$", () => this._iceCandidates$.asObservable().pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15469
15483
|
}
|
|
15470
15484
|
get initialized$() {
|
|
15471
|
-
return this.cachedObservable("initialized$", () => this._initialized$.asObservable().pipe((0, import_cjs$
|
|
15485
|
+
return this.cachedObservable("initialized$", () => this._initialized$.asObservable().pipe((0, import_cjs$15.filter)((initialized) => initialized), (0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15472
15486
|
}
|
|
15473
15487
|
get remoteDescription$() {
|
|
15474
|
-
return this.cachedObservable("remoteDescription$", () => this._remoteDescription$.asObservable().pipe((0, import_cjs$
|
|
15488
|
+
return this.cachedObservable("remoteDescription$", () => this._remoteDescription$.asObservable().pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15475
15489
|
}
|
|
15476
15490
|
get localStream$() {
|
|
15477
|
-
return this.cachedObservable("localStream$", () => this.localStreamController.localStream$.pipe((0, import_cjs$
|
|
15491
|
+
return this.cachedObservable("localStream$", () => this.localStreamController.localStream$.pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15478
15492
|
}
|
|
15479
15493
|
get remoteStream$() {
|
|
15480
|
-
return this.cachedObservable("remoteStream$", () => this._remoteStream$.asObservable().pipe((0, import_cjs$
|
|
15494
|
+
return this.cachedObservable("remoteStream$", () => this._remoteStream$.asObservable().pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15481
15495
|
}
|
|
15482
15496
|
get localAudioTracks$() {
|
|
15483
|
-
return this.cachedObservable("localAudioTracks$", () => this.localStreamController.localAudioTracks$.pipe((0, import_cjs$
|
|
15497
|
+
return this.cachedObservable("localAudioTracks$", () => this.localStreamController.localAudioTracks$.pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15484
15498
|
}
|
|
15485
15499
|
get localVideoTracks$() {
|
|
15486
|
-
return this.cachedObservable("localVideoTracks$", () => this.localStreamController.localVideoTracks$.pipe((0, import_cjs$
|
|
15500
|
+
return this.cachedObservable("localVideoTracks$", () => this.localStreamController.localVideoTracks$.pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15487
15501
|
}
|
|
15488
15502
|
get iceConnectionState$() {
|
|
15489
|
-
return this.cachedObservable("iceConnectionState$", () => this._iceConnectionState$.asObservable().pipe((0, import_cjs$
|
|
15503
|
+
return this.cachedObservable("iceConnectionState$", () => this._iceConnectionState$.asObservable().pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15490
15504
|
}
|
|
15491
15505
|
get connectionState$() {
|
|
15492
|
-
return this.cachedObservable("connectionState$", () => this._connectionState$.asObservable().pipe((0, import_cjs$
|
|
15506
|
+
return this.cachedObservable("connectionState$", () => this._connectionState$.asObservable().pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15493
15507
|
}
|
|
15494
15508
|
get signalingState$() {
|
|
15495
|
-
return this.cachedObservable("signalingState$", () => this._signalingState$.asObservable().pipe((0, import_cjs$
|
|
15509
|
+
return this.cachedObservable("signalingState$", () => this._signalingState$.asObservable().pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
15496
15510
|
}
|
|
15497
15511
|
get type() {
|
|
15498
15512
|
return this._type;
|
|
@@ -15605,16 +15619,16 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15605
15619
|
async doInit() {
|
|
15606
15620
|
try {
|
|
15607
15621
|
this.setupPeerConnection();
|
|
15608
|
-
this.subscribeTo(this.negotiationNeeded$.pipe((0, import_cjs$
|
|
15622
|
+
this.subscribeTo(this.negotiationNeeded$.pipe((0, import_cjs$15.auditTime)(0), (0, import_cjs$15.exhaustMap)(async () => this.startNegotiation())), {
|
|
15609
15623
|
next: () => {
|
|
15610
15624
|
logger$15.debug("[RTCPeerConnectionController] Start Negotiation completed successfully");
|
|
15611
15625
|
},
|
|
15612
15626
|
error: (error) => {
|
|
15613
15627
|
logger$15.error("[RTCPeerConnectionController] Start Negotiation error:", error);
|
|
15614
|
-
this._errors$.next(error);
|
|
15628
|
+
this._errors$.next(toError(error));
|
|
15615
15629
|
}
|
|
15616
15630
|
});
|
|
15617
|
-
this.subscribeTo((0, import_cjs$
|
|
15631
|
+
this.subscribeTo((0, import_cjs$15.merge)(this.deviceController.selectedAudioInputDevice$.pipe((0, import_cjs$15.map)((deviceInfo) => ["audio", deviceInfo])), this.deviceController.selectedVideoInputDevice$.pipe((0, import_cjs$15.map)((deviceInfo) => ["video", deviceInfo]))).pipe((0, import_cjs$15.skipWhile)(() => !this.localStreamController.localStream)), async ([kind, deviceInfo]) => {
|
|
15618
15632
|
logger$15.debug(`[RTCPeerConnectionController] Selected input device changed for:`, {
|
|
15619
15633
|
kind,
|
|
15620
15634
|
deviceInfo
|
|
@@ -15633,7 +15647,7 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15633
15647
|
}
|
|
15634
15648
|
} catch (error) {
|
|
15635
15649
|
logger$15.error("[RTCPeerConnectionController] Initialization error:", error);
|
|
15636
|
-
this._errors$.next(error);
|
|
15650
|
+
this._errors$.next(toError(error));
|
|
15637
15651
|
this.destroy();
|
|
15638
15652
|
}
|
|
15639
15653
|
}
|
|
@@ -15680,7 +15694,7 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15680
15694
|
await this.createOffer(offerOptions);
|
|
15681
15695
|
} catch (error) {
|
|
15682
15696
|
logger$15.error("[RTCPeerConnectionController] Error during negotiation:", error);
|
|
15683
|
-
this._errors$.next(error);
|
|
15697
|
+
this._errors$.next(toError(error));
|
|
15684
15698
|
}
|
|
15685
15699
|
}
|
|
15686
15700
|
/**
|
|
@@ -15703,7 +15717,7 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15703
15717
|
}
|
|
15704
15718
|
} catch (error) {
|
|
15705
15719
|
logger$15.error("[RTCPeerConnectionController] Error updating answer status:", error);
|
|
15706
|
-
this._errors$.next(error);
|
|
15720
|
+
this._errors$.next(toError(error));
|
|
15707
15721
|
readyToConnect = false;
|
|
15708
15722
|
} finally {
|
|
15709
15723
|
if (readyToConnect) this.readyToConnect();
|
|
@@ -15869,7 +15883,7 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15869
15883
|
await this.setLocalDescription(offer);
|
|
15870
15884
|
} catch (error) {
|
|
15871
15885
|
logger$15.error("[RTCPeerConnectionController] ICE restart offer failed:", error);
|
|
15872
|
-
this._errors$.next(error);
|
|
15886
|
+
this._errors$.next(toError(error));
|
|
15873
15887
|
this.negotiationEnded();
|
|
15874
15888
|
if (policyChanged) this.restoreIceTransportPolicy();
|
|
15875
15889
|
throw error;
|
|
@@ -15964,7 +15978,7 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15964
15978
|
logger$15.debug(`[RTCPeerConnectionController] ${track.kind} track added:`, track.id);
|
|
15965
15979
|
} catch (error) {
|
|
15966
15980
|
logger$15.error(`[RTCPeerConnectionController] Failed to add ${track.kind} track:`, error);
|
|
15967
|
-
this._errors$.next(error);
|
|
15981
|
+
this._errors$.next(toError(error));
|
|
15968
15982
|
throw error;
|
|
15969
15983
|
}
|
|
15970
15984
|
}
|
|
@@ -15989,7 +16003,7 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
15989
16003
|
logger$15.debug(`[RTCPeerConnectionController] ${sender.track?.kind} track removed:`, trackId);
|
|
15990
16004
|
} catch (error) {
|
|
15991
16005
|
logger$15.error(`[RTCPeerConnectionController] Failed to remove ${sender.track?.kind} track:`, error);
|
|
15992
|
-
this._errors$.next(error);
|
|
16006
|
+
this._errors$.next(toError(error));
|
|
15993
16007
|
throw error;
|
|
15994
16008
|
}
|
|
15995
16009
|
}
|
|
@@ -16120,7 +16134,7 @@ function isVertoPingInnerParams(value) {
|
|
|
16120
16134
|
|
|
16121
16135
|
//#endregion
|
|
16122
16136
|
//#region src/managers/VertoManager.ts
|
|
16123
|
-
var import_cjs$
|
|
16137
|
+
var import_cjs$14 = require_cjs();
|
|
16124
16138
|
const logger$14 = getLogger();
|
|
16125
16139
|
var VertoManager = class extends Destroyable {
|
|
16126
16140
|
constructor(callSession) {
|
|
@@ -16141,7 +16155,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
16141
16155
|
this.webRTCApiProvider = webRTCApiProvider;
|
|
16142
16156
|
this._rtcPeerConnections$ = this.createBehaviorSubject([]);
|
|
16143
16157
|
this._selfId$ = this.createBehaviorSubject(null);
|
|
16144
|
-
this._signalingStatus$ = this.
|
|
16158
|
+
this._signalingStatus$ = this.createReplaySubject(1);
|
|
16145
16159
|
this._screenShareStatus$ = this.createBehaviorSubject("none");
|
|
16146
16160
|
this._rtcPeerConnectionsMap = /* @__PURE__ */ new Map();
|
|
16147
16161
|
this._screenShareTimeoutMs = 5e4;
|
|
@@ -16213,7 +16227,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
16213
16227
|
return rtcPeerConnection;
|
|
16214
16228
|
}
|
|
16215
16229
|
get signalingStatus$() {
|
|
16216
|
-
return this.cachedObservable("signalingStatus$", () => (0, import_cjs$
|
|
16230
|
+
return this.cachedObservable("signalingStatus$", () => (0, import_cjs$14.merge)(this._signalingStatus$.asObservable(), this.mainPeerConnection.connectionState$.pipe((0, import_cjs$14.filter)((connectionState) => [
|
|
16217
16231
|
"connected",
|
|
16218
16232
|
"disconnected",
|
|
16219
16233
|
"failed"
|
|
@@ -16426,25 +16440,25 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
16426
16440
|
}
|
|
16427
16441
|
}
|
|
16428
16442
|
get callJoinedEvent$() {
|
|
16429
|
-
return this.webRtcCallSession.callEvent$.pipe((0, import_cjs$
|
|
16443
|
+
return this.webRtcCallSession.callEvent$.pipe((0, import_cjs$14.filter)(isCallJoinedPayload), (0, import_cjs$14.takeUntil)(this.destroyed$));
|
|
16430
16444
|
}
|
|
16431
16445
|
get vertoMedia$() {
|
|
16432
|
-
return this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoMediaInnerParams, "params"), (0, import_cjs$
|
|
16446
|
+
return this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoMediaInnerParams, "params"), (0, import_cjs$14.takeUntil)(this.destroyed$));
|
|
16433
16447
|
}
|
|
16434
16448
|
get vertoAnswer$() {
|
|
16435
|
-
return this.cachedObservable("vertoAnswer$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoAnswerInnerParams, "params"), (0, import_cjs$
|
|
16449
|
+
return this.cachedObservable("vertoAnswer$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoAnswerInnerParams, "params"), (0, import_cjs$14.takeUntil)(this.destroyed$)));
|
|
16436
16450
|
}
|
|
16437
16451
|
get vertoMediaParams$() {
|
|
16438
|
-
return this.cachedObservable("vertoMediaParams$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoMediaParamsInnerParams, "params"), (0, import_cjs$
|
|
16452
|
+
return this.cachedObservable("vertoMediaParams$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoMediaParamsInnerParams, "params"), (0, import_cjs$14.takeUntil)(this.destroyed$)));
|
|
16439
16453
|
}
|
|
16440
16454
|
get vertoBye$() {
|
|
16441
|
-
return this.cachedObservable("vertoBye$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoByeMessage, "params"), (0, import_cjs$
|
|
16455
|
+
return this.cachedObservable("vertoBye$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoByeMessage, "params"), (0, import_cjs$14.takeUntil)(this.destroyed$)));
|
|
16442
16456
|
}
|
|
16443
16457
|
get vertoAttach$() {
|
|
16444
|
-
return this.cachedObservable("vertoAttach$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoAttachMessage, "params"), (0, import_cjs$
|
|
16458
|
+
return this.cachedObservable("vertoAttach$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoAttachMessage, "params"), (0, import_cjs$14.takeUntil)(this.destroyed$)));
|
|
16445
16459
|
}
|
|
16446
16460
|
get vertoPing$() {
|
|
16447
|
-
return this.cachedObservable("vertoPing$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoPingInnerParams, "params"), (0, import_cjs$
|
|
16461
|
+
return this.cachedObservable("vertoPing$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoPingInnerParams, "params"), (0, import_cjs$14.takeUntil)(this.destroyed$)));
|
|
16448
16462
|
}
|
|
16449
16463
|
async executeVerto(message, optionals = {}) {
|
|
16450
16464
|
const webrtcVertoMessage = WebrtcVerto({
|
|
@@ -16572,7 +16586,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
16572
16586
|
}
|
|
16573
16587
|
async handleInboundAnswer(rtcPeerConnController) {
|
|
16574
16588
|
logger$14.debug("[WebRTCManager] Waiting for inbound call to be accepted or rejected");
|
|
16575
|
-
const vertoByeOrAccepted = await (0, import_cjs$
|
|
16589
|
+
const vertoByeOrAccepted = await (0, import_cjs$14.firstValueFrom)((0, import_cjs$14.race)(this.vertoBye$, this.webRtcCallSession.answered$).pipe((0, import_cjs$14.takeUntil)(this.destroyed$))).catch(() => null);
|
|
16576
16590
|
if (vertoByeOrAccepted === null) {
|
|
16577
16591
|
logger$14.debug("[WebRTCManager] Inbound answer handler aborted (destroyed).");
|
|
16578
16592
|
return;
|
|
@@ -16615,12 +16629,12 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
16615
16629
|
});
|
|
16616
16630
|
}
|
|
16617
16631
|
initObservables(rtcPeerConnController) {
|
|
16618
|
-
this.mediaDirections$ = rtcPeerConnController.connectionState$.pipe((0, import_cjs$
|
|
16619
|
-
this.localStream$ = rtcPeerConnController.localStream$.pipe(filterNull(), (0, import_cjs$
|
|
16620
|
-
this.remoteStream$ = rtcPeerConnController.remoteStream$.pipe(filterNull(), (0, import_cjs$
|
|
16632
|
+
this.mediaDirections$ = rtcPeerConnController.connectionState$.pipe((0, import_cjs$14.filter)((state) => state === "connected"), (0, import_cjs$14.map)(() => rtcPeerConnController.mediaDirections), (0, import_cjs$14.startWith)(rtcPeerConnController.mediaDirections), (0, import_cjs$14.takeUntil)(this.destroyed$));
|
|
16633
|
+
this.localStream$ = rtcPeerConnController.localStream$.pipe(filterNull(), (0, import_cjs$14.takeUntil)(this.destroyed$));
|
|
16634
|
+
this.remoteStream$ = rtcPeerConnController.remoteStream$.pipe(filterNull(), (0, import_cjs$14.takeUntil)(this.destroyed$));
|
|
16621
16635
|
}
|
|
16622
16636
|
setupLocalDescriptionHandler(rtcPeerConnController) {
|
|
16623
|
-
this.subscribeTo(rtcPeerConnController.localDescription$.pipe((0, import_cjs$
|
|
16637
|
+
this.subscribeTo(rtcPeerConnController.localDescription$.pipe((0, import_cjs$14.filter)((description) => description !== null), (0, import_cjs$14.takeUntil)(this.destroyed$)), (description) => {
|
|
16624
16638
|
const { type, sdp } = description;
|
|
16625
16639
|
const dialogParams = this.dialogParams(rtcPeerConnController);
|
|
16626
16640
|
const initial = !rtcPeerConnController.firstSDPExchangeCompleted;
|
|
@@ -16671,7 +16685,11 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
16671
16685
|
}
|
|
16672
16686
|
async sendLocalDescriptionOnceAccepted(vertoMessageRequest, rtcPeerConnectionController) {
|
|
16673
16687
|
logger$14.debug("[WebRTCManager] Waiting for call to be accepted or ended before sending answer");
|
|
16674
|
-
const vertoByeOrAccepted = await (0, import_cjs$
|
|
16688
|
+
const vertoByeOrAccepted = await (0, import_cjs$14.firstValueFrom)((0, import_cjs$14.race)(this.vertoBye$, this.webRtcCallSession.answered$).pipe((0, import_cjs$14.takeUntil)(this.destroyed$))).catch(() => null);
|
|
16689
|
+
if (vertoByeOrAccepted === null) {
|
|
16690
|
+
logger$14.debug("[WebRTCManager] Destroyed while waiting for call acceptance");
|
|
16691
|
+
return;
|
|
16692
|
+
}
|
|
16675
16693
|
if (isVertoByeMessage(vertoByeOrAccepted)) {
|
|
16676
16694
|
logger$14.info("[WebRTCManager] Call ended before answer was sent.");
|
|
16677
16695
|
this.callSession?.destroy();
|
|
@@ -16780,7 +16798,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
16780
16798
|
this.subscribeTo(rtcPeerConnController.errors$, (error) => {
|
|
16781
16799
|
this.onError?.(error);
|
|
16782
16800
|
});
|
|
16783
|
-
await (0, import_cjs$
|
|
16801
|
+
await (0, import_cjs$14.firstValueFrom)(rtcPeerConnController.connectionState$.pipe((0, import_cjs$14.filter)((state) => state === "connected"), (0, import_cjs$14.take)(1), (0, import_cjs$14.timeout)(this._screenShareTimeoutMs), (0, import_cjs$14.takeUntil)(this.destroyed$)));
|
|
16784
16802
|
this._screenShareStatus$.next("started");
|
|
16785
16803
|
logger$14.info("[WebRTCManager] Screen share started successfully.");
|
|
16786
16804
|
return rtcPeerConnController.id;
|
|
@@ -16883,7 +16901,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
16883
16901
|
|
|
16884
16902
|
//#endregion
|
|
16885
16903
|
//#region src/controllers/RTCStatsMonitor.ts
|
|
16886
|
-
var import_cjs$
|
|
16904
|
+
var import_cjs$13 = require_cjs();
|
|
16887
16905
|
const logger$13 = getLogger();
|
|
16888
16906
|
const DEFAULT_POLLING_INTERVAL_MS = 1e3;
|
|
16889
16907
|
const DEFAULT_BASELINE_SAMPLES = 10;
|
|
@@ -16946,7 +16964,7 @@ var RTCStatsMonitor = class extends Destroyable {
|
|
|
16946
16964
|
}
|
|
16947
16965
|
/** Simple boolean health indicator. */
|
|
16948
16966
|
get isNetworkHealthy$() {
|
|
16949
|
-
return this.cachedObservable("isNetworkHealthy$", () => this._networkIssues$.pipe((0, import_cjs$
|
|
16967
|
+
return this.cachedObservable("isNetworkHealthy$", () => this._networkIssues$.pipe((0, import_cjs$13.map)((issues) => issues.length === 0), (0, import_cjs$13.distinctUntilChanged)(), (0, import_cjs$13.takeUntil)(this.destroyed$)));
|
|
16950
16968
|
}
|
|
16951
16969
|
/** Whether the network is currently healthy. */
|
|
16952
16970
|
get isNetworkHealthy() {
|
|
@@ -16962,7 +16980,7 @@ var RTCStatsMonitor = class extends Destroyable {
|
|
|
16962
16980
|
}
|
|
16963
16981
|
/** Emits individual critical issues for the recovery pipeline. */
|
|
16964
16982
|
get criticalIssue$() {
|
|
16965
|
-
return this.cachedObservable("criticalIssue$", () => this._networkIssues$.pipe((0, import_cjs$
|
|
16983
|
+
return this.cachedObservable("criticalIssue$", () => this._networkIssues$.pipe((0, import_cjs$13.mergeMap)((issues) => (0, import_cjs$13.from)(issues.filter((i) => i.severity === "critical"))), (0, import_cjs$13.takeUntil)(this.destroyed$)));
|
|
16966
16984
|
}
|
|
16967
16985
|
/** Emits each raw stats sample extracted from the peer connection. */
|
|
16968
16986
|
get sample$() {
|
|
@@ -16975,11 +16993,11 @@ var RTCStatsMonitor = class extends Destroyable {
|
|
|
16975
16993
|
this.lastAudioPacketChangeTime = now;
|
|
16976
16994
|
this.lastVideoPacketChangeTime = now;
|
|
16977
16995
|
logger$13.debug("[RTCStatsMonitor] Starting stats monitoring");
|
|
16978
|
-
this.subscribeTo((0, import_cjs$
|
|
16996
|
+
this.subscribeTo((0, import_cjs$13.interval)(this.pollingIntervalMs).pipe((0, import_cjs$13.filter)(() => this.running), (0, import_cjs$13.switchMap)(() => (0, import_cjs$13.from)(this.peerConnection.getStats()).pipe((0, import_cjs$13.catchError)((err) => {
|
|
16979
16997
|
logger$13.warn("[RTCStatsMonitor] Failed to get stats:", err);
|
|
16980
|
-
return import_cjs$
|
|
16981
|
-
}))), (0, import_cjs$
|
|
16982
|
-
this.subscribeTo(this._sample$.pipe((0, import_cjs$
|
|
16998
|
+
return import_cjs$13.EMPTY;
|
|
16999
|
+
}))), (0, import_cjs$13.filter)(() => this.running), (0, import_cjs$13.map)((report) => this.extractSample(report))), (sample$1) => this._sample$.next(sample$1));
|
|
17000
|
+
this.subscribeTo(this._sample$.pipe((0, import_cjs$13.take)(this.baselineSampleCount), (0, import_cjs$13.toArray)(), (0, import_cjs$13.map)((samples) => ({
|
|
16983
17001
|
rtt: samples.reduce((s, b) => s + b.roundTripTime, 0) / samples.length,
|
|
16984
17002
|
jitter: samples.reduce((s, b) => s + b.audioJitter, 0) / samples.length,
|
|
16985
17003
|
ready: true
|
|
@@ -16987,19 +17005,19 @@ var RTCStatsMonitor = class extends Destroyable {
|
|
|
16987
17005
|
logger$13.debug(`[RTCStatsMonitor] Baseline established: rtt=${baseline.rtt.toFixed(1)}ms, jitter=${baseline.jitter.toFixed(1)}ms`);
|
|
16988
17006
|
this._baseline$.next(baseline);
|
|
16989
17007
|
});
|
|
16990
|
-
this.subscribeTo(this._sample$.pipe((0, import_cjs$
|
|
17008
|
+
this.subscribeTo(this._sample$.pipe((0, import_cjs$13.scan)((acc, sample$1) => ({
|
|
16991
17009
|
prev: acc.current,
|
|
16992
17010
|
current: sample$1
|
|
16993
17011
|
}), {
|
|
16994
17012
|
prev: null,
|
|
16995
17013
|
current: null
|
|
16996
|
-
}), (0, import_cjs$
|
|
17014
|
+
}), (0, import_cjs$13.filter)((pair) => pair.current !== null)), ({ prev, current }) => {
|
|
16997
17015
|
const now$1 = current.timestamp;
|
|
16998
17016
|
this.updatePacketTracking(current, now$1);
|
|
16999
17017
|
const issues = this.detectIssues(current, prev, now$1);
|
|
17000
17018
|
this._networkIssues$.next(issues);
|
|
17001
17019
|
});
|
|
17002
|
-
this.subscribeTo(this._sample$.pipe((0, import_cjs$
|
|
17020
|
+
this.subscribeTo(this._sample$.pipe((0, import_cjs$13.scan)((history, sample$1) => {
|
|
17003
17021
|
const cutoff = sample$1.timestamp - this.historyWindowSeconds * 1e3;
|
|
17004
17022
|
const metrics = {
|
|
17005
17023
|
timestamp: sample$1.timestamp,
|
|
@@ -17152,7 +17170,7 @@ var RTCStatsMonitor = class extends Destroyable {
|
|
|
17152
17170
|
|
|
17153
17171
|
//#endregion
|
|
17154
17172
|
//#region src/managers/CallRecoveryManager.ts
|
|
17155
|
-
var import_cjs$
|
|
17173
|
+
var import_cjs$12 = require_cjs();
|
|
17156
17174
|
const logger$12 = getLogger();
|
|
17157
17175
|
const DEFAULT_DEBOUNCE_TIME_MS = 2e3;
|
|
17158
17176
|
const DEFAULT_COOLDOWN_MS = 1e4;
|
|
@@ -17223,16 +17241,16 @@ var CallRecoveryManager = class extends Destroyable {
|
|
|
17223
17241
|
this.initDegradationRecoveryPipeline();
|
|
17224
17242
|
}
|
|
17225
17243
|
get recoveryState$() {
|
|
17226
|
-
return this._recoveryState$.asObservable().pipe((0, import_cjs$
|
|
17244
|
+
return this._recoveryState$.asObservable().pipe((0, import_cjs$12.takeUntil)(this._destroyed$));
|
|
17227
17245
|
}
|
|
17228
17246
|
get recoveryState() {
|
|
17229
17247
|
return this._recoveryState$.value;
|
|
17230
17248
|
}
|
|
17231
17249
|
get recoveryEvent$() {
|
|
17232
|
-
return this._recoveryEvent$.asObservable().pipe((0, import_cjs$
|
|
17250
|
+
return this._recoveryEvent$.asObservable().pipe((0, import_cjs$12.takeUntil)(this._destroyed$));
|
|
17233
17251
|
}
|
|
17234
17252
|
get bandwidthConstrained$() {
|
|
17235
|
-
return this._bandwidthConstrained$.asObservable().pipe((0, import_cjs$
|
|
17253
|
+
return this._bandwidthConstrained$.asObservable().pipe((0, import_cjs$12.takeUntil)(this._destroyed$));
|
|
17236
17254
|
}
|
|
17237
17255
|
get bandwidthConstrained() {
|
|
17238
17256
|
return this._bandwidthConstrained$.value;
|
|
@@ -17362,9 +17380,9 @@ var CallRecoveryManager = class extends Destroyable {
|
|
|
17362
17380
|
super.destroy();
|
|
17363
17381
|
}
|
|
17364
17382
|
initPipeline() {
|
|
17365
|
-
this.subscribeTo(this._trigger$.pipe((0, import_cjs$
|
|
17383
|
+
this.subscribeTo(this._trigger$.pipe((0, import_cjs$12.tap)(() => {
|
|
17366
17384
|
if (this._recoveryState$.value === "idle") this.transitionTo("debouncing");
|
|
17367
|
-
}), (0, import_cjs$
|
|
17385
|
+
}), (0, import_cjs$12.debounceTime)(this._config.debounceTimeMs), (0, import_cjs$12.withLatestFrom)(this._inputs.signalingReady$), (0, import_cjs$12.filter)(([, signalingReady]) => this.passGateChecks(signalingReady)), (0, import_cjs$12.map)(([trigger]) => trigger), (0, import_cjs$12.exhaustMap)((trigger) => this.executeTieredRecovery(trigger)), (0, import_cjs$12.takeUntil)((0, import_cjs$12.merge)(this._destroyed$, this._pipelineStop$))), {
|
|
17368
17386
|
next: () => {},
|
|
17369
17387
|
error: (err) => {
|
|
17370
17388
|
logger$12.error("CallRecoveryManager: pipeline error", err);
|
|
@@ -17383,10 +17401,10 @@ var CallRecoveryManager = class extends Destroyable {
|
|
|
17383
17401
|
initDegradationRecoveryPipeline() {
|
|
17384
17402
|
if (!this._config.enableAutoDegradation) return;
|
|
17385
17403
|
const delayMs = this._config.packetLossRecoveryDelaySec * 1e3;
|
|
17386
|
-
this.subscribeTo((0, import_cjs$
|
|
17387
|
-
if (constrained && !hasPacketLoss) return (0, import_cjs$
|
|
17388
|
-
return import_cjs$
|
|
17389
|
-
}), (0, import_cjs$
|
|
17404
|
+
this.subscribeTo((0, import_cjs$12.combineLatest)([this._bandwidthConstrained$, this._hasPacketLoss$]).pipe((0, import_cjs$12.switchMap)(([constrained, hasPacketLoss]) => {
|
|
17405
|
+
if (constrained && !hasPacketLoss) return (0, import_cjs$12.timer)(delayMs);
|
|
17406
|
+
return import_cjs$12.EMPTY;
|
|
17407
|
+
}), (0, import_cjs$12.takeUntil)(this._destroyed$)), () => {
|
|
17390
17408
|
this._bandwidthConstrained$.next(false);
|
|
17391
17409
|
this._callbacks.enableVideo();
|
|
17392
17410
|
this.emitEvent({
|
|
@@ -17426,10 +17444,10 @@ var CallRecoveryManager = class extends Destroyable {
|
|
|
17426
17444
|
executeTieredRecovery(trigger) {
|
|
17427
17445
|
this.transitionTo("recovering");
|
|
17428
17446
|
logger$12.info(`CallRecoveryManager: starting tiered recovery — source=${trigger.source} detail=${trigger.detail}`);
|
|
17429
|
-
return (0, import_cjs$
|
|
17447
|
+
return (0, import_cjs$12.from)(this.runTiers(trigger)).pipe((0, import_cjs$12.tap)(() => this.startCooldown()), (0, import_cjs$12.catchError)((err) => {
|
|
17430
17448
|
logger$12.error("CallRecoveryManager: tiered recovery failed", err);
|
|
17431
17449
|
this.startCooldown();
|
|
17432
|
-
return import_cjs$
|
|
17450
|
+
return import_cjs$12.EMPTY;
|
|
17433
17451
|
}));
|
|
17434
17452
|
}
|
|
17435
17453
|
async runTiers(trigger) {
|
|
@@ -17549,7 +17567,7 @@ var CallRecoveryManager = class extends Destroyable {
|
|
|
17549
17567
|
this._cooldownUntil = Date.now() + this._config.cooldownMs;
|
|
17550
17568
|
this.transitionTo("cooldown");
|
|
17551
17569
|
if (this._cooldownSubscription) this._cooldownSubscription.unsubscribe();
|
|
17552
|
-
this._cooldownSubscription = (0, import_cjs$
|
|
17570
|
+
this._cooldownSubscription = (0, import_cjs$12.timer)(this._config.cooldownMs).pipe((0, import_cjs$12.take)(1), (0, import_cjs$12.takeUntil)(this._destroyed$), (0, import_cjs$12.filter)(() => this._recoveryState$.value === "cooldown")).subscribe(() => this.transitionTo("idle"));
|
|
17553
17571
|
}
|
|
17554
17572
|
emitEvent(event) {
|
|
17555
17573
|
this._recoveryEvent$.next(event);
|
|
@@ -17643,7 +17661,7 @@ function mosToQualityLevel(mos) {
|
|
|
17643
17661
|
|
|
17644
17662
|
//#endregion
|
|
17645
17663
|
//#region src/core/entities/Call.ts
|
|
17646
|
-
var import_cjs$
|
|
17664
|
+
var import_cjs$11 = require_cjs();
|
|
17647
17665
|
const logger$11 = getLogger();
|
|
17648
17666
|
/**
|
|
17649
17667
|
* Ratio between the critical and warning RTT spike multipliers.
|
|
@@ -17718,7 +17736,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
17718
17736
|
const { deviceController, networkChange$ } = initialization;
|
|
17719
17737
|
this._networkChange$ = networkChange$;
|
|
17720
17738
|
this.participantFactory = new ParticipantFactory(this.executeMethod.bind(this), this.vertoManager, deviceController);
|
|
17721
|
-
this.subscribeTo((0, import_cjs$
|
|
17739
|
+
this.subscribeTo((0, import_cjs$11.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$).pipe((0, import_cjs$11.distinctUntilChanged)(), (0, import_cjs$11.takeUntil)(this._destroyed$)), (status) => {
|
|
17722
17740
|
this._lastMergedStatus = status;
|
|
17723
17741
|
if (status === "connected" && !this._statsMonitor) this.initResilienceSubsystems();
|
|
17724
17742
|
else if (status === "disconnected") {
|
|
@@ -17753,7 +17771,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
17753
17771
|
}
|
|
17754
17772
|
/** Observable of the address associated with this call. */
|
|
17755
17773
|
get address$() {
|
|
17756
|
-
return this.deferEmission((0, import_cjs$
|
|
17774
|
+
return this.deferEmission((0, import_cjs$11.from)([this.address])).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17757
17775
|
}
|
|
17758
17776
|
/** Display name of the caller. */
|
|
17759
17777
|
get fromName() {
|
|
@@ -17832,7 +17850,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
17832
17850
|
}
|
|
17833
17851
|
/** Observable of layout layer positions for all participants. */
|
|
17834
17852
|
get layoutLayers$() {
|
|
17835
|
-
return this.deferEmission(this.callEventsManager.layoutLayers$).pipe((0, import_cjs$
|
|
17853
|
+
return this.deferEmission(this.callEventsManager.layoutLayers$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17836
17854
|
}
|
|
17837
17855
|
/** Current snapshot of layout layers. */
|
|
17838
17856
|
get layoutLayers() {
|
|
@@ -17887,45 +17905,45 @@ var WebRTCCall = class extends Destroyable {
|
|
|
17887
17905
|
}
|
|
17888
17906
|
/** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
|
|
17889
17907
|
get status$() {
|
|
17890
|
-
return this.publicCachedObservable("status$", () => (0, import_cjs$
|
|
17908
|
+
return this.publicCachedObservable("status$", () => (0, import_cjs$11.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$).pipe((0, import_cjs$11.distinctUntilChanged)(), (0, import_cjs$11.tap)((status) => {
|
|
17891
17909
|
this._lastMergedStatus = status;
|
|
17892
17910
|
})));
|
|
17893
17911
|
}
|
|
17894
17912
|
/** Observable of the participants list, emits on join/leave/update. */
|
|
17895
17913
|
get participants$() {
|
|
17896
|
-
return this.deferEmission(this.callEventsManager.participants$).pipe((0, import_cjs$
|
|
17914
|
+
return this.deferEmission(this.callEventsManager.participants$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17897
17915
|
}
|
|
17898
17916
|
/** Observable of the local (self) participant. */
|
|
17899
17917
|
get self$() {
|
|
17900
|
-
return this.deferEmission(this.callEventsManager.self$).pipe((0, import_cjs$
|
|
17918
|
+
return this.deferEmission(this.callEventsManager.self$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17901
17919
|
}
|
|
17902
17920
|
/** Observable indicating whether the call is being recorded. */
|
|
17903
17921
|
get recording$() {
|
|
17904
|
-
return this.deferEmission(this.callEventsManager.recording$).pipe((0, import_cjs$
|
|
17922
|
+
return this.deferEmission(this.callEventsManager.recording$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17905
17923
|
}
|
|
17906
17924
|
/** Observable indicating whether the call is being streamed. */
|
|
17907
17925
|
get streaming$() {
|
|
17908
|
-
return this.deferEmission(this.callEventsManager.streaming$).pipe((0, import_cjs$
|
|
17926
|
+
return this.deferEmission(this.callEventsManager.streaming$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17909
17927
|
}
|
|
17910
17928
|
/** Observable indicating whether raise-hand priority is active. */
|
|
17911
17929
|
get raiseHandPriority$() {
|
|
17912
|
-
return this.deferEmission(this.callEventsManager.raiseHandPriority$).pipe((0, import_cjs$
|
|
17930
|
+
return this.deferEmission(this.callEventsManager.raiseHandPriority$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17913
17931
|
}
|
|
17914
17932
|
/** Observable indicating whether the call room is locked. */
|
|
17915
17933
|
get locked$() {
|
|
17916
|
-
return this.deferEmission(this.callEventsManager.locked$).pipe((0, import_cjs$
|
|
17934
|
+
return this.deferEmission(this.callEventsManager.locked$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17917
17935
|
}
|
|
17918
17936
|
/** Observable of custom metadata associated with the call. */
|
|
17919
17937
|
get meta$() {
|
|
17920
|
-
return this.deferEmission(this.callEventsManager.meta$).pipe((0, import_cjs$
|
|
17938
|
+
return this.deferEmission(this.callEventsManager.meta$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17921
17939
|
}
|
|
17922
17940
|
/** Observable of the call's capability flags. */
|
|
17923
17941
|
get capabilities$() {
|
|
17924
|
-
return this.deferEmission(this.callEventsManager.capabilities$).pipe((0, import_cjs$
|
|
17942
|
+
return this.deferEmission(this.callEventsManager.capabilities$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17925
17943
|
}
|
|
17926
17944
|
/** Observable of the current layout name. */
|
|
17927
17945
|
get layout$() {
|
|
17928
|
-
return this.deferEmission(this.callEventsManager.layout$).pipe((0, import_cjs$
|
|
17946
|
+
return this.deferEmission(this.callEventsManager.layout$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17929
17947
|
}
|
|
17930
17948
|
/** Current call status. */
|
|
17931
17949
|
get status() {
|
|
@@ -17957,7 +17975,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
17957
17975
|
}
|
|
17958
17976
|
/** Observable of available layout names. */
|
|
17959
17977
|
get layouts$() {
|
|
17960
|
-
return this.deferEmission(this.callEventsManager.layouts$).pipe((0, import_cjs$
|
|
17978
|
+
return this.deferEmission(this.callEventsManager.layouts$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17961
17979
|
}
|
|
17962
17980
|
/** Current snapshot of available layout names. */
|
|
17963
17981
|
get layouts() {
|
|
@@ -17965,7 +17983,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
17965
17983
|
}
|
|
17966
17984
|
/** Observable of the local media stream (camera/microphone). */
|
|
17967
17985
|
get localStream$() {
|
|
17968
|
-
return this.deferEmission(this.vertoManager.localStream$).pipe((0, import_cjs$
|
|
17986
|
+
return this.deferEmission(this.vertoManager.localStream$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17969
17987
|
}
|
|
17970
17988
|
/** Current local media stream, or `null` if not available. */
|
|
17971
17989
|
get localStream() {
|
|
@@ -17973,7 +17991,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
17973
17991
|
}
|
|
17974
17992
|
/** Observable of the remote media stream from the far end. */
|
|
17975
17993
|
get remoteStream$() {
|
|
17976
|
-
return this.deferEmission(this.vertoManager.remoteStream$).pipe((0, import_cjs$
|
|
17994
|
+
return this.deferEmission(this.vertoManager.remoteStream$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
17977
17995
|
}
|
|
17978
17996
|
/** Current remote media stream, or `null` if not available. */
|
|
17979
17997
|
get remoteStream() {
|
|
@@ -18176,7 +18194,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
18176
18194
|
});
|
|
18177
18195
|
else if (event.type === "online") this._recoveryManager?.handleWebSocketReconnect();
|
|
18178
18196
|
});
|
|
18179
|
-
this.subscribeTo(this.clientSession.authenticated$.pipe((0, import_cjs$
|
|
18197
|
+
this.subscribeTo(this.clientSession.authenticated$.pipe((0, import_cjs$11.skip)(1), (0, import_cjs$11.filter)(Boolean)), () => {
|
|
18180
18198
|
logger$11.debug("[Call] WebSocket reconnected — notifying recovery manager");
|
|
18181
18199
|
this._recoveryManager?.handleWebSocketReconnect();
|
|
18182
18200
|
});
|
|
@@ -18205,14 +18223,14 @@ var WebRTCCall = class extends Destroyable {
|
|
|
18205
18223
|
}
|
|
18206
18224
|
/** Observable of the current audio/video send/receive directions. */
|
|
18207
18225
|
get mediaDirections$() {
|
|
18208
|
-
return this.deferEmission(this.vertoManager.mediaDirections$).pipe((0, import_cjs$
|
|
18226
|
+
return this.deferEmission(this.vertoManager.mediaDirections$).pipe((0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
18209
18227
|
}
|
|
18210
18228
|
/** Current audio/video send/receive directions. */
|
|
18211
18229
|
get mediaDirections() {
|
|
18212
18230
|
return this.vertoManager.mediaDirections;
|
|
18213
18231
|
}
|
|
18214
18232
|
get participantsId$() {
|
|
18215
|
-
return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, import_cjs$
|
|
18233
|
+
return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, import_cjs$11.map)((participants) => participants.map((participant) => participant.id))));
|
|
18216
18234
|
}
|
|
18217
18235
|
/**
|
|
18218
18236
|
* Executes a raw JSON-RPC request on the client session.
|
|
@@ -18256,37 +18274,37 @@ var WebRTCCall = class extends Destroyable {
|
|
|
18256
18274
|
}
|
|
18257
18275
|
}
|
|
18258
18276
|
get callSessionEvents$() {
|
|
18259
|
-
return this.cachedObservable("callSessionEvents$", () => this.clientSession.signalingEvent$.pipe((0, import_cjs$
|
|
18277
|
+
return this.cachedObservable("callSessionEvents$", () => this.clientSession.signalingEvent$.pipe((0, import_cjs$11.filter)((event) => this.isCallSessionEvent(event)), (0, import_cjs$11.tap)((event) => {
|
|
18260
18278
|
logger$11.debug("[Call] Received call session event:", event);
|
|
18261
|
-
}), (0, import_cjs$
|
|
18279
|
+
}), (0, import_cjs$11.takeUntil)(this.destroyed$), (0, import_cjs$11.share)()));
|
|
18262
18280
|
}
|
|
18263
18281
|
/** Observable of call-updated events. */
|
|
18264
18282
|
get callUpdated$() {
|
|
18265
|
-
return this.publicCachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(filterAs(isCallUpdatedMetadata, "params"), (0, import_cjs$
|
|
18283
|
+
return this.publicCachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(filterAs(isCallUpdatedMetadata, "params"), (0, import_cjs$11.takeUntil)(this.destroyed$)));
|
|
18266
18284
|
}
|
|
18267
18285
|
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
18268
18286
|
get memberJoined$() {
|
|
18269
|
-
return this.publicCachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(filterAs(isMemberJoinedMetadata, "params"), (0, import_cjs$
|
|
18287
|
+
return this.publicCachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(filterAs(isMemberJoinedMetadata, "params"), (0, import_cjs$11.takeUntil)(this.destroyed$)));
|
|
18270
18288
|
}
|
|
18271
18289
|
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
18272
18290
|
get memberLeft$() {
|
|
18273
|
-
return this.publicCachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(filterAs(isMemberLeftMetadata, "params"), (0, import_cjs$
|
|
18291
|
+
return this.publicCachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(filterAs(isMemberLeftMetadata, "params"), (0, import_cjs$11.takeUntil)(this.destroyed$)));
|
|
18274
18292
|
}
|
|
18275
18293
|
/** Observable of member-updated events (mute, volume, etc.). */
|
|
18276
18294
|
get memberUpdated$() {
|
|
18277
|
-
return this.publicCachedObservable("memberUpdated$", () => this.callSessionEvents$.pipe(filterAs(isMemberUpdatedMetadata, "params"), (0, import_cjs$
|
|
18295
|
+
return this.publicCachedObservable("memberUpdated$", () => this.callSessionEvents$.pipe(filterAs(isMemberUpdatedMetadata, "params"), (0, import_cjs$11.takeUntil)(this.destroyed$)));
|
|
18278
18296
|
}
|
|
18279
18297
|
/** Observable of member-talking events (speech start/stop). */
|
|
18280
18298
|
get memberTalking$() {
|
|
18281
|
-
return this.publicCachedObservable("memberTalking$", () => this.callSessionEvents$.pipe(filterAs(isMemberTalkingMetadata, "params"), (0, import_cjs$
|
|
18299
|
+
return this.publicCachedObservable("memberTalking$", () => this.callSessionEvents$.pipe(filterAs(isMemberTalkingMetadata, "params"), (0, import_cjs$11.takeUntil)(this.destroyed$)));
|
|
18282
18300
|
}
|
|
18283
18301
|
/** Observable of call state-change events. */
|
|
18284
18302
|
get callStates$() {
|
|
18285
|
-
return this.publicCachedObservable("callStates$", () => this.callSessionEvents$.pipe(filterAs(isCallStateMetadata, "params"), (0, import_cjs$
|
|
18303
|
+
return this.publicCachedObservable("callStates$", () => this.callSessionEvents$.pipe(filterAs(isCallStateMetadata, "params"), (0, import_cjs$11.takeUntil)(this.destroyed$)));
|
|
18286
18304
|
}
|
|
18287
18305
|
/** Observable of layout-changed events. */
|
|
18288
18306
|
get layoutUpdates$() {
|
|
18289
|
-
return this.publicCachedObservable("layoutUpdates$", () => this.callSessionEvents$.pipe(filterAs(isLayoutChangedMetadata, "params"), (0, import_cjs$
|
|
18307
|
+
return this.publicCachedObservable("layoutUpdates$", () => this.callSessionEvents$.pipe(filterAs(isLayoutChangedMetadata, "params"), (0, import_cjs$11.takeUntil)(this.destroyed$)));
|
|
18290
18308
|
}
|
|
18291
18309
|
/** Underlying `RTCPeerConnection`, for advanced use cases. */
|
|
18292
18310
|
get rtcPeerConnection() {
|
|
@@ -18294,7 +18312,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
18294
18312
|
}
|
|
18295
18313
|
/** Observable of raw signaling events as plain objects. */
|
|
18296
18314
|
get signalingEvent$() {
|
|
18297
|
-
return this.publicCachedObservable("signalingEvent$", () => this.callEvent$.pipe((0, import_cjs$
|
|
18315
|
+
return this.publicCachedObservable("signalingEvent$", () => this.callEvent$.pipe((0, import_cjs$11.map)((event) => JSON.parse(JSON.stringify(event)))));
|
|
18298
18316
|
}
|
|
18299
18317
|
/**
|
|
18300
18318
|
* Subscribe to a custom signaling event type on this call.
|
|
@@ -18322,16 +18340,16 @@ var WebRTCCall = class extends Destroyable {
|
|
|
18322
18340
|
subscribe(eventType) {
|
|
18323
18341
|
const cached = this._customSubscriptions.get(eventType);
|
|
18324
18342
|
if (cached) return cached;
|
|
18325
|
-
const filtered$ = this.callSessionEvents$.pipe((0, import_cjs$
|
|
18343
|
+
const filtered$ = this.callSessionEvents$.pipe((0, import_cjs$11.filter)((event) => event.event_type === eventType), (0, import_cjs$11.map)((event) => JSON.parse(JSON.stringify(event))), (0, import_cjs$11.takeUntil)(this._destroyed$));
|
|
18326
18344
|
this._customSubscriptions.set(eventType, filtered$);
|
|
18327
18345
|
this._sendVertoSubscribe(eventType);
|
|
18328
18346
|
return filtered$;
|
|
18329
18347
|
}
|
|
18330
18348
|
get webrtcMessages$() {
|
|
18331
|
-
return this.cachedObservable("webrtcMessages$", () => this.callSessionEvents$.pipe(filterAs(isWebrtcMessageMetadata, "params"), (0, import_cjs$
|
|
18349
|
+
return this.cachedObservable("webrtcMessages$", () => this.callSessionEvents$.pipe(filterAs(isWebrtcMessageMetadata, "params"), (0, import_cjs$11.tap)((event) => logger$11.debug("[Call] Event is a WebRTC message event:", event)), (0, import_cjs$11.takeUntil)(this.destroyed$), (0, import_cjs$11.share)()));
|
|
18332
18350
|
}
|
|
18333
18351
|
get callEvent$() {
|
|
18334
|
-
return this.cachedObservable("callEvent$", () => this.callSessionEvents$.pipe(filterAs(isSignalwireCallMetadata, "params"), (0, import_cjs$
|
|
18352
|
+
return this.cachedObservable("callEvent$", () => this.callSessionEvents$.pipe(filterAs(isSignalwireCallMetadata, "params"), (0, import_cjs$11.tap)((event) => logger$11.debug("[Call] Event is a call event:", event)), (0, import_cjs$11.takeUntil)(this.destroyed$), (0, import_cjs$11.share)()));
|
|
18335
18353
|
}
|
|
18336
18354
|
get layoutEvent$() {
|
|
18337
18355
|
return this.cachedObservable("layoutEvent$", () => this.callEvent$.pipe(filterAs(isLayoutChangedMetadata, "params")));
|
|
@@ -18424,7 +18442,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
18424
18442
|
*/
|
|
18425
18443
|
async setLayout(layout, positions) {
|
|
18426
18444
|
if (!this.layouts.includes(layout)) throw new InvalidParams(`Layout ${layout} is not available in the current call layouts: ${this.layouts.join(", ")}`);
|
|
18427
|
-
const selfId = await (0, import_cjs$
|
|
18445
|
+
const selfId = await (0, import_cjs$11.firstValueFrom)(this.selfId$.pipe((0, import_cjs$11.filter)((id) => id !== null)));
|
|
18428
18446
|
await this.executeMethod(selfId, "call.layout.set", {
|
|
18429
18447
|
layout,
|
|
18430
18448
|
positions
|
|
@@ -18538,7 +18556,7 @@ var CallFactory = class {
|
|
|
18538
18556
|
|
|
18539
18557
|
//#endregion
|
|
18540
18558
|
//#region src/behaviors/Collection.ts
|
|
18541
|
-
var import_cjs$
|
|
18559
|
+
var import_cjs$10 = require_cjs();
|
|
18542
18560
|
const logger$10 = getLogger();
|
|
18543
18561
|
var Fetcher = class {
|
|
18544
18562
|
constructor(endpoint, params, http) {
|
|
@@ -18580,8 +18598,6 @@ var EntityCollection = class extends Destroyable {
|
|
|
18580
18598
|
this.fetchController = fetchController;
|
|
18581
18599
|
this.update$ = update$;
|
|
18582
18600
|
this.onError = onError;
|
|
18583
|
-
this.loading$ = this.createBehaviorSubject(false);
|
|
18584
|
-
this.values$ = this.createReplaySubject(1);
|
|
18585
18601
|
this.collectionData = /* @__PURE__ */ new Map();
|
|
18586
18602
|
this.observablesRegistry = /* @__PURE__ */ new Map();
|
|
18587
18603
|
this.upsertData = (data) => {
|
|
@@ -18601,22 +18617,28 @@ var EntityCollection = class extends Destroyable {
|
|
|
18601
18617
|
}
|
|
18602
18618
|
this.collectionData.set(data.id, updated);
|
|
18603
18619
|
this.observablesRegistry.get(data.id)?.next(updated);
|
|
18604
|
-
this.
|
|
18620
|
+
this._values$.next(Array.from(this.collectionData.values()));
|
|
18605
18621
|
};
|
|
18622
|
+
this._loading$ = this.createBehaviorSubject(false);
|
|
18623
|
+
this._values$ = this.createReplaySubject(1);
|
|
18606
18624
|
this._hasMore$ = this.createBehaviorSubject(true);
|
|
18607
|
-
this.
|
|
18608
|
-
this.
|
|
18609
|
-
|
|
18610
|
-
|
|
18625
|
+
this.subscribeTo(this.update$, this.upsertData);
|
|
18626
|
+
this.hasMore$ = (0, import_cjs$10.defer)(() => (0, import_cjs$10.from)(this.init())).pipe((0, import_cjs$10.switchMap)(() => this._hasMore$), (0, import_cjs$10.distinctUntilChanged)(), (0, import_cjs$10.shareReplay)(1), (0, import_cjs$10.takeUntil)(this.destroyed$));
|
|
18627
|
+
}
|
|
18628
|
+
get loading$() {
|
|
18629
|
+
return this._loading$.asObservable();
|
|
18611
18630
|
}
|
|
18612
18631
|
get loading() {
|
|
18613
|
-
return this.
|
|
18632
|
+
return this._loading$.value;
|
|
18633
|
+
}
|
|
18634
|
+
get values$() {
|
|
18635
|
+
return this._values$.asObservable();
|
|
18614
18636
|
}
|
|
18615
18637
|
get hasMore() {
|
|
18616
18638
|
return this.fetchController.hasMore ?? true;
|
|
18617
18639
|
}
|
|
18618
18640
|
get updated$() {
|
|
18619
|
-
return this.cachedObservable("updated$", () => this.
|
|
18641
|
+
return this.cachedObservable("updated$", () => this._loading$.pipe((0, import_cjs$10.distinctUntilChanged)(), (0, import_cjs$10.skip)(1), (0, import_cjs$10.filter)((loading) => !loading), (0, import_cjs$10.map)(() => void 0), (0, import_cjs$10.takeUntil)(this.destroyed$)));
|
|
18620
18642
|
}
|
|
18621
18643
|
get values() {
|
|
18622
18644
|
return Array.from(this.collectionData.values());
|
|
@@ -18630,33 +18652,33 @@ var EntityCollection = class extends Destroyable {
|
|
|
18630
18652
|
}
|
|
18631
18653
|
async fetchMore() {
|
|
18632
18654
|
try {
|
|
18633
|
-
this.
|
|
18655
|
+
this._loading$.next(true);
|
|
18634
18656
|
(await this.fetchController.next()).forEach(this.upsertData);
|
|
18635
18657
|
this._hasMore$.next(this.fetchController.hasMore ?? false);
|
|
18636
|
-
this.
|
|
18658
|
+
this._loading$.next(false);
|
|
18637
18659
|
} catch (error) {
|
|
18638
18660
|
logger$10.error(`Failed to fetch initial collection data`, error);
|
|
18639
18661
|
this._hasMore$.next(this.fetchController.hasMore ?? false);
|
|
18640
|
-
this.
|
|
18662
|
+
this._loading$.next(false);
|
|
18641
18663
|
this.onError?.(new CollectionFetchError("fetchMore", error));
|
|
18642
18664
|
}
|
|
18643
18665
|
}
|
|
18644
18666
|
async tryFetch(key, value) {
|
|
18645
18667
|
try {
|
|
18646
|
-
this.
|
|
18668
|
+
this._loading$.next(true);
|
|
18647
18669
|
const data = await this.fetchController[key]?.(value);
|
|
18648
|
-
this.
|
|
18670
|
+
this._loading$.next(false);
|
|
18649
18671
|
if (data) this.upsertData(data);
|
|
18650
18672
|
return data;
|
|
18651
18673
|
} catch (error) {
|
|
18652
18674
|
logger$10.error(`Failed to fetch data for (${String(key)}:${String(value)}) :`, error);
|
|
18653
|
-
this.
|
|
18675
|
+
this._loading$.next(false);
|
|
18654
18676
|
this.onError?.(new CollectionFetchError(`tryFetch(${String(key)})`, error));
|
|
18655
18677
|
}
|
|
18656
18678
|
}
|
|
18657
18679
|
get$(id) {
|
|
18658
18680
|
if (!this.observablesRegistry.has(id)) {
|
|
18659
|
-
this.observablesRegistry.set(id, new import_cjs$
|
|
18681
|
+
this.observablesRegistry.set(id, new import_cjs$10.ReplaySubject(1));
|
|
18660
18682
|
const data = this.collectionData.get(id);
|
|
18661
18683
|
if (data) this.observablesRegistry.get(id)?.next(data);
|
|
18662
18684
|
else this.tryFetch("id", id);
|
|
@@ -18671,11 +18693,8 @@ var EntityCollection = class extends Destroyable {
|
|
|
18671
18693
|
if (this.fetchController.hasMore !== false) this.fetchMore();
|
|
18672
18694
|
}
|
|
18673
18695
|
destroy() {
|
|
18674
|
-
this._destroy$.next();
|
|
18675
|
-
this._destroy$.complete();
|
|
18676
|
-
this.updateSubscription.unsubscribe();
|
|
18677
|
-
this.loading$.complete();
|
|
18678
18696
|
this.observablesRegistry.forEach((subject) => subject.complete());
|
|
18697
|
+
this.observablesRegistry.clear();
|
|
18679
18698
|
super.destroy();
|
|
18680
18699
|
}
|
|
18681
18700
|
};
|
|
@@ -18701,15 +18720,15 @@ var EntityCollectionTransformed = class {
|
|
|
18701
18720
|
return this.originalCollection.values.filter(this.filter).map(this.mapper);
|
|
18702
18721
|
}
|
|
18703
18722
|
get values$() {
|
|
18704
|
-
return this._values$ ??= this.originalCollection.values$.pipe((0, import_cjs$
|
|
18723
|
+
return this._values$ ??= this.originalCollection.values$.pipe((0, import_cjs$10.map)((values) => values.filter(this.filter).map(this.mapper)));
|
|
18705
18724
|
}
|
|
18706
18725
|
get$(id) {
|
|
18707
18726
|
const original$ = this.originalCollection.get$(id);
|
|
18708
|
-
return !original$ ? original$ : original$.pipe((0, import_cjs$
|
|
18727
|
+
return !original$ ? original$ : original$.pipe((0, import_cjs$10.pipe)((0, import_cjs$10.filter)(this.filter), (0, import_cjs$10.map)(this.mapper)));
|
|
18709
18728
|
}
|
|
18710
18729
|
async find$(key, value) {
|
|
18711
18730
|
const original$ = await this.originalCollection.find$(key, value);
|
|
18712
|
-
return !original$ ? original$ : original$.pipe((0, import_cjs$
|
|
18731
|
+
return !original$ ? original$ : original$.pipe((0, import_cjs$10.pipe)((0, import_cjs$10.filter)(this.filter), (0, import_cjs$10.map)(this.mapper)));
|
|
18713
18732
|
}
|
|
18714
18733
|
loadMore() {
|
|
18715
18734
|
this.originalCollection.loadMore();
|
|
@@ -18721,7 +18740,7 @@ var EntityCollectionTransformed = class {
|
|
|
18721
18740
|
|
|
18722
18741
|
//#endregion
|
|
18723
18742
|
//#region src/core/entities/Address.ts
|
|
18724
|
-
var import_cjs$
|
|
18743
|
+
var import_cjs$9 = require_cjs();
|
|
18725
18744
|
/**
|
|
18726
18745
|
* Represents a contact or room in the directory.
|
|
18727
18746
|
*
|
|
@@ -18739,8 +18758,8 @@ var Address = class extends Destroyable {
|
|
|
18739
18758
|
if (this._conversationMessages.hasMore) this._conversationMessages.loadMore();
|
|
18740
18759
|
return this._conversationMessages;
|
|
18741
18760
|
};
|
|
18742
|
-
this.textMessages$ = (0, import_cjs$
|
|
18743
|
-
this.history$ = (0, import_cjs$
|
|
18761
|
+
this.textMessages$ = (0, import_cjs$9.defer)(this.initConversationMessages).pipe((0, import_cjs$9.map)(() => this.textMessage), (0, import_cjs$9.shareReplay)(1), (0, import_cjs$9.takeUntil)(this.destroyed$));
|
|
18762
|
+
this.history$ = (0, import_cjs$9.defer)(this.initConversationMessages).pipe((0, import_cjs$9.map)(() => this.history), (0, import_cjs$9.shareReplay)(1), (0, import_cjs$9.takeUntil)(this.destroyed$));
|
|
18744
18763
|
this._state$ = this.createBehaviorSubject(null);
|
|
18745
18764
|
}
|
|
18746
18765
|
/** @internal */
|
|
@@ -18775,7 +18794,7 @@ var Address = class extends Destroyable {
|
|
|
18775
18794
|
}
|
|
18776
18795
|
/** Observable of the human-readable display name. */
|
|
18777
18796
|
get displayName$() {
|
|
18778
|
-
return this.cachedObservable("displayName$", () => this._state$.pipe(filterNull(), (0, import_cjs$
|
|
18797
|
+
return this.cachedObservable("displayName$", () => this._state$.pipe(filterNull(), (0, import_cjs$9.map)((state) => state.display_name), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
18779
18798
|
}
|
|
18780
18799
|
/** Human-readable display name. */
|
|
18781
18800
|
get displayName() {
|
|
@@ -18784,7 +18803,7 @@ var Address = class extends Destroyable {
|
|
|
18784
18803
|
}
|
|
18785
18804
|
/** Observable of the preview image URL. */
|
|
18786
18805
|
get previewUrl$() {
|
|
18787
|
-
return this.cachedObservable("previewUrl$", () => this._state$.pipe(filterNull(), (0, import_cjs$
|
|
18806
|
+
return this.cachedObservable("previewUrl$", () => this._state$.pipe(filterNull(), (0, import_cjs$9.map)((state) => state.preview_url), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
18788
18807
|
}
|
|
18789
18808
|
/** Preview image URL. */
|
|
18790
18809
|
get previewUrl() {
|
|
@@ -18793,7 +18812,7 @@ var Address = class extends Destroyable {
|
|
|
18793
18812
|
}
|
|
18794
18813
|
/** Observable of the cover image URL. */
|
|
18795
18814
|
get coverUrl$() {
|
|
18796
|
-
return this.cachedObservable("coverUrl$", () => this._state$.pipe(filterNull(), (0, import_cjs$
|
|
18815
|
+
return this.cachedObservable("coverUrl$", () => this._state$.pipe(filterNull(), (0, import_cjs$9.shareReplay)(1), (0, import_cjs$9.map)((state) => state.cover_url), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
18797
18816
|
}
|
|
18798
18817
|
/** Cover image URL. */
|
|
18799
18818
|
get coverUrl() {
|
|
@@ -18802,7 +18821,7 @@ var Address = class extends Destroyable {
|
|
|
18802
18821
|
}
|
|
18803
18822
|
/** Observable of the underlying resource ID. */
|
|
18804
18823
|
get resourceId$() {
|
|
18805
|
-
return this.cachedObservable("resourceId$", () => this._state$.pipe(filterNull(), (0, import_cjs$
|
|
18824
|
+
return this.cachedObservable("resourceId$", () => this._state$.pipe(filterNull(), (0, import_cjs$9.shareReplay)(1), (0, import_cjs$9.map)((state) => state.resource_id), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
18806
18825
|
}
|
|
18807
18826
|
/** Underlying resource ID. */
|
|
18808
18827
|
get resourceId() {
|
|
@@ -18811,7 +18830,7 @@ var Address = class extends Destroyable {
|
|
|
18811
18830
|
}
|
|
18812
18831
|
/** Observable of the resource type (e.g. `'room'`, `'subscriber'`). */
|
|
18813
18832
|
get type$() {
|
|
18814
|
-
return this.cachedObservable("type$", () => this._state$.pipe(filterNull(), (0, import_cjs$
|
|
18833
|
+
return this.cachedObservable("type$", () => this._state$.pipe(filterNull(), (0, import_cjs$9.shareReplay)(1), (0, import_cjs$9.map)((state) => state.type), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
18815
18834
|
}
|
|
18816
18835
|
/** Resource type (e.g. `'room'`, `'subscriber'`). */
|
|
18817
18836
|
get type() {
|
|
@@ -18820,7 +18839,7 @@ var Address = class extends Destroyable {
|
|
|
18820
18839
|
}
|
|
18821
18840
|
/** Observable of available communication channels (audio, video, messaging). */
|
|
18822
18841
|
get channels$() {
|
|
18823
|
-
return this.cachedObservable("channels$", () => this._state$.pipe(filterNull(), (0, import_cjs$
|
|
18842
|
+
return this.cachedObservable("channels$", () => this._state$.pipe(filterNull(), (0, import_cjs$9.shareReplay)(1), (0, import_cjs$9.map)((state) => state.channels), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
18824
18843
|
}
|
|
18825
18844
|
/** Available communication channels. */
|
|
18826
18845
|
get channels() {
|
|
@@ -18834,7 +18853,7 @@ var Address = class extends Destroyable {
|
|
|
18834
18853
|
}
|
|
18835
18854
|
/** Observable indicating whether the address (room) is locked. */
|
|
18836
18855
|
get locked$() {
|
|
18837
|
-
return this.cachedObservable("locked$", () => this._state$.pipe(filterNull(), (0, import_cjs$
|
|
18856
|
+
return this.cachedObservable("locked$", () => this._state$.pipe(filterNull(), (0, import_cjs$9.shareReplay)(1), (0, import_cjs$9.map)((state) => state.locked), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
18838
18857
|
}
|
|
18839
18858
|
/**
|
|
18840
18859
|
* Sends a text message to this address.
|
|
@@ -18900,7 +18919,7 @@ var Address = class extends Destroyable {
|
|
|
18900
18919
|
|
|
18901
18920
|
//#endregion
|
|
18902
18921
|
//#region src/core/utils.ts
|
|
18903
|
-
var import_cjs$
|
|
18922
|
+
var import_cjs$8 = require_cjs();
|
|
18904
18923
|
const logger$9 = getLogger();
|
|
18905
18924
|
const isRPCConnectResult = (e) => {
|
|
18906
18925
|
logger$9.debug("isRPCConnectResult check:", e);
|
|
@@ -18926,18 +18945,18 @@ var PendingRPC = class PendingRPC {
|
|
|
18926
18945
|
return;
|
|
18927
18946
|
}
|
|
18928
18947
|
let isSettled = false;
|
|
18929
|
-
const subscription = (0, import_cjs$
|
|
18948
|
+
const subscription = (0, import_cjs$8.race)(responses$.pipe((0, import_cjs$8.filter)((result) => result.id === request.id), (0, import_cjs$8.take)(1)), new import_cjs$8.Observable((subscriber) => {
|
|
18930
18949
|
const timer$3 = setTimeout(() => {
|
|
18931
18950
|
subscriber.error(new RPCTimeoutError(request.id, timeoutMs));
|
|
18932
18951
|
}, timeoutMs);
|
|
18933
18952
|
return () => clearTimeout(timer$3);
|
|
18934
|
-
}), signal ? new import_cjs$
|
|
18953
|
+
}), signal ? new import_cjs$8.Observable((subscriber) => {
|
|
18935
18954
|
const abortHandler = () => {
|
|
18936
18955
|
subscriber.error(new DOMException("The operation was aborted", "AbortError"));
|
|
18937
18956
|
};
|
|
18938
18957
|
signal.addEventListener("abort", abortHandler);
|
|
18939
18958
|
return () => signal.removeEventListener("abort", abortHandler);
|
|
18940
|
-
}) : import_cjs$
|
|
18959
|
+
}) : import_cjs$8.NEVER).subscribe({
|
|
18941
18960
|
next: (response) => {
|
|
18942
18961
|
isSettled = true;
|
|
18943
18962
|
if (response.error) {
|
|
@@ -18977,7 +18996,7 @@ var PendingRPC = class PendingRPC {
|
|
|
18977
18996
|
|
|
18978
18997
|
//#endregion
|
|
18979
18998
|
//#region src/managers/ClientSessionManager.ts
|
|
18980
|
-
var import_cjs$
|
|
18999
|
+
var import_cjs$7 = require_cjs();
|
|
18981
19000
|
const logger$8 = getLogger();
|
|
18982
19001
|
const getAddressSearchURI = (options) => {
|
|
18983
19002
|
const to = options.to?.split("?")[0];
|
|
@@ -19006,17 +19025,17 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19006
19025
|
};
|
|
19007
19026
|
this._authorization$ = this.createBehaviorSubject(void 0);
|
|
19008
19027
|
this._errors$ = this.createReplaySubject(1);
|
|
19009
|
-
this.
|
|
19010
|
-
this.
|
|
19028
|
+
this._authState$ = this.createBehaviorSubject({ kind: "unauthenticated" });
|
|
19029
|
+
this._wasClientBound = false;
|
|
19011
19030
|
this._subscriberInfo$ = this.createBehaviorSubject(null);
|
|
19012
19031
|
this._calls$ = this.createBehaviorSubject({});
|
|
19013
19032
|
this._iceServers$ = this.createBehaviorSubject([]);
|
|
19014
19033
|
attachManager.setSession(this);
|
|
19015
19034
|
this.callFactory = new CallFactory(this, deviceController, attachManager, webRTCApiProvider, networkChange$);
|
|
19016
|
-
this.initialized$ = (0, import_cjs$
|
|
19035
|
+
this.initialized$ = (0, import_cjs$7.defer)(() => (0, import_cjs$7.from)(this.init())).pipe((0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.takeUntil)(this.destroyed$));
|
|
19017
19036
|
}
|
|
19018
19037
|
get incomingCalls$() {
|
|
19019
|
-
return this.cachedObservable("incomingCalls$", () => this.calls$.pipe((0, import_cjs$
|
|
19038
|
+
return this.cachedObservable("incomingCalls$", () => this.calls$.pipe((0, import_cjs$7.map)((calls) => calls.filter((call) => call.direction === "inbound"))));
|
|
19020
19039
|
}
|
|
19021
19040
|
get incomingCalls() {
|
|
19022
19041
|
return Object.values(this._calls$.value).filter((call) => call.direction === "inbound");
|
|
@@ -19028,7 +19047,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19028
19047
|
return this._subscriberInfo$.value;
|
|
19029
19048
|
}
|
|
19030
19049
|
get calls$() {
|
|
19031
|
-
return this.cachedObservable("calls$", () => this._calls$.pipe((0, import_cjs$
|
|
19050
|
+
return this.cachedObservable("calls$", () => this._calls$.pipe((0, import_cjs$7.map)((calls) => Object.values(calls))));
|
|
19032
19051
|
}
|
|
19033
19052
|
get calls() {
|
|
19034
19053
|
return Object.values(this._calls$.value);
|
|
@@ -19046,10 +19065,10 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19046
19065
|
return this._errors$.asObservable();
|
|
19047
19066
|
}
|
|
19048
19067
|
get authenticated$() {
|
|
19049
|
-
return this.
|
|
19068
|
+
return this._authState$.pipe((0, import_cjs$7.map)((state) => state.kind === "authenticated"), (0, import_cjs$7.distinctUntilChanged)());
|
|
19050
19069
|
}
|
|
19051
19070
|
get authenticated() {
|
|
19052
|
-
return this.
|
|
19071
|
+
return this._authState$.value.kind === "authenticated";
|
|
19053
19072
|
}
|
|
19054
19073
|
/**
|
|
19055
19074
|
* Whether this session is client-bound (using a Client Bound SAT).
|
|
@@ -19058,7 +19077,11 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19058
19077
|
* @internal
|
|
19059
19078
|
*/
|
|
19060
19079
|
get clientBound() {
|
|
19061
|
-
return this.
|
|
19080
|
+
return this._wasClientBound;
|
|
19081
|
+
}
|
|
19082
|
+
/** @internal Current auth state for debugging/testing. */
|
|
19083
|
+
get authState() {
|
|
19084
|
+
return this._authState$.value;
|
|
19062
19085
|
}
|
|
19063
19086
|
/**
|
|
19064
19087
|
* Set the directory instance
|
|
@@ -19096,13 +19119,16 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19096
19119
|
this._errors$.next(new AuthStateHandlerError(error));
|
|
19097
19120
|
}
|
|
19098
19121
|
});
|
|
19099
|
-
this.subscribeTo(this.transport.connectionStatus$.pipe((0, import_cjs$
|
|
19122
|
+
this.subscribeTo(this.transport.connectionStatus$.pipe((0, import_cjs$7.filter)((status) => status === "disconnected" || status === "reconnecting")), () => {
|
|
19123
|
+
if (this._authState$.value.kind === "authenticated") this._authState$.next({ kind: "unauthenticated" });
|
|
19124
|
+
});
|
|
19125
|
+
this.subscribeTo(this.transport.connectionStatus$.pipe((0, import_cjs$7.filter)((status) => status === "connected"), (0, import_cjs$7.exhaustMap)(() => {
|
|
19100
19126
|
logger$8.debug("[Session] Connection established, initiating authentication");
|
|
19101
|
-
return (0, import_cjs$
|
|
19127
|
+
return (0, import_cjs$7.from)(this.authenticate()).pipe((0, import_cjs$7.catchError)((error) => {
|
|
19102
19128
|
this.handleAuthenticationError(error).catch((err) => {
|
|
19103
19129
|
logger$8.error("[Session] Error handling authentication failure:", err);
|
|
19104
19130
|
});
|
|
19105
|
-
return import_cjs$
|
|
19131
|
+
return import_cjs$7.EMPTY;
|
|
19106
19132
|
}));
|
|
19107
19133
|
})), void 0);
|
|
19108
19134
|
this.subscribeTo(this.vertoInvite$, async (invite) => {
|
|
@@ -19155,23 +19181,23 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19155
19181
|
}
|
|
19156
19182
|
}
|
|
19157
19183
|
get authStateEvent$() {
|
|
19158
|
-
return this.cachedObservable("authStateEvent$", () => this.signalingEvent$.pipe((0, import_cjs$
|
|
19184
|
+
return this.cachedObservable("authStateEvent$", () => this.signalingEvent$.pipe((0, import_cjs$7.tap)((msg) => {
|
|
19159
19185
|
logger$8.debug("[Session] Received incoming message:", msg);
|
|
19160
|
-
}), filterAs(isSignalwireAuthorizationStateMetadata, "params"), (0, import_cjs$
|
|
19186
|
+
}), filterAs(isSignalwireAuthorizationStateMetadata, "params"), (0, import_cjs$7.tap)((event) => {
|
|
19161
19187
|
logger$8.debug("[Session] Authorization state event received:", event.authorization_state);
|
|
19162
19188
|
})));
|
|
19163
19189
|
}
|
|
19164
19190
|
get signalingEvent$() {
|
|
19165
|
-
return this.cachedObservable("signalingEvent$", () => this.transport.incomingEvent$.pipe(filterAs(isSignalwireRequest, "params"), (0, import_cjs$
|
|
19191
|
+
return this.cachedObservable("signalingEvent$", () => this.transport.incomingEvent$.pipe(filterAs(isSignalwireRequest, "params"), (0, import_cjs$7.share)()));
|
|
19166
19192
|
}
|
|
19167
19193
|
get vertoInvite$() {
|
|
19168
|
-
return this.cachedObservable("vertoInvite$", () => this.signalingEvent$.pipe((0, import_cjs$
|
|
19194
|
+
return this.cachedObservable("vertoInvite$", () => this.signalingEvent$.pipe((0, import_cjs$7.filter)(isWebrtcMessageMetadata), (0, import_cjs$7.filter)((event) => isVertoInviteMessage(event.params)), (0, import_cjs$7.map)((event) => ({
|
|
19169
19195
|
node_id: event.node_id,
|
|
19170
19196
|
...event.params.params
|
|
19171
19197
|
}))));
|
|
19172
19198
|
}
|
|
19173
19199
|
get vertoAttach$() {
|
|
19174
|
-
return this.cachedObservable("vertoAttach$", () => this.signalingEvent$.pipe((0, import_cjs$
|
|
19200
|
+
return this.cachedObservable("vertoAttach$", () => this.signalingEvent$.pipe((0, import_cjs$7.filter)(isWebrtcMessageMetadata), (0, import_cjs$7.filter)((event) => isVertoAttachMessage(event.params)), (0, import_cjs$7.map)((event) => ({
|
|
19175
19201
|
node_id: event.node_id,
|
|
19176
19202
|
...event.params.params
|
|
19177
19203
|
}))));
|
|
@@ -19191,14 +19217,14 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19191
19217
|
return { jwt_token: credential.token };
|
|
19192
19218
|
}
|
|
19193
19219
|
async connect() {
|
|
19194
|
-
await (0, import_cjs$
|
|
19220
|
+
await (0, import_cjs$7.firstValueFrom)(this.initialized$);
|
|
19195
19221
|
await this.transport.connect();
|
|
19196
|
-
await (0, import_cjs$
|
|
19222
|
+
await (0, import_cjs$7.firstValueFrom)(this.authenticated$.pipe((0, import_cjs$7.takeUntil)(this.destroyed$), (0, import_cjs$7.filter)(Boolean), (0, import_cjs$7.take)(1), (0, import_cjs$7.timeout)({ first: 15e3 })));
|
|
19197
19223
|
}
|
|
19198
19224
|
async handleAuthenticationError(error) {
|
|
19199
19225
|
logger$8.error("Authentication error:", error);
|
|
19200
19226
|
const isRecoverableAuthError = error instanceof JSONRPCError && (error.code === RPC_ERROR_REQUESTER_VALIDATION_FAILED || error.code === RPC_ERROR_INVALID_PARAMS || error.code === RPC_ERROR_AUTHENTICATION_FAILED);
|
|
19201
|
-
const hasStoredState = await (0, import_cjs$
|
|
19227
|
+
const hasStoredState = await (0, import_cjs$7.firstValueFrom)(this.authorizationState$.pipe((0, import_cjs$7.take)(1))) !== void 0;
|
|
19202
19228
|
if (isRecoverableAuthError && hasStoredState) {
|
|
19203
19229
|
logger$8.debug("[Session] Recoverable auth error — cleaning up stored state and reconnecting fresh");
|
|
19204
19230
|
try {
|
|
@@ -19230,7 +19256,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19230
19256
|
if (!resolvedDpopToken && this.dpopManager?.initialized) try {
|
|
19231
19257
|
resolvedDpopToken = await this.dpopManager.createRpcProof({ method: "signalwire.reauthenticate" });
|
|
19232
19258
|
} catch (error) {
|
|
19233
|
-
if (this.
|
|
19259
|
+
if (this.clientBound) throw error;
|
|
19234
19260
|
logger$8.warn("[Session] Failed to create DPoP proof for reauthenticate:", error);
|
|
19235
19261
|
}
|
|
19236
19262
|
const request = RPCReauthenticate({
|
|
@@ -19238,11 +19264,11 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19238
19264
|
jwt_token: token,
|
|
19239
19265
|
...resolvedDpopToken ? { dpop_token: resolvedDpopToken } : {}
|
|
19240
19266
|
});
|
|
19241
|
-
await (0, import_cjs$
|
|
19267
|
+
await (0, import_cjs$7.lastValueFrom)((0, import_cjs$7.from)(this.transport.execute(request)).pipe(throwOnRPCError(), (0, import_cjs$7.take)(1), (0, import_cjs$7.catchError)((err) => {
|
|
19242
19268
|
logger$8.error("[Session] Re-authentication RPC failed:", err);
|
|
19243
19269
|
throw err;
|
|
19244
19270
|
})));
|
|
19245
|
-
if (options?.clientBound) this.
|
|
19271
|
+
if (options?.clientBound) this._wasClientBound = true;
|
|
19246
19272
|
logger$8.debug("[Session] Re-authentication successful, updating stored auth state");
|
|
19247
19273
|
} catch (error) {
|
|
19248
19274
|
logger$8.error("[Session] Re-authentication failed:", error);
|
|
@@ -19252,10 +19278,10 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19252
19278
|
}
|
|
19253
19279
|
async authenticate() {
|
|
19254
19280
|
logger$8.debug("[Session] Starting authentication process");
|
|
19255
|
-
const persistedParams = await (0, import_cjs$
|
|
19281
|
+
const persistedParams = await (0, import_cjs$7.firstValueFrom)((0, import_cjs$7.combineLatest)({
|
|
19256
19282
|
protocol: this.transport.protocol$,
|
|
19257
19283
|
authorization_state: this.authorizationState$
|
|
19258
|
-
}).pipe((0, import_cjs$
|
|
19284
|
+
}).pipe((0, import_cjs$7.take)(1)));
|
|
19259
19285
|
logger$8.debug("[Session] Persisted params:\n", {
|
|
19260
19286
|
protocol: persistedParams.protocol,
|
|
19261
19287
|
authStateLength: persistedParams.authorization_state?.length
|
|
@@ -19265,14 +19291,14 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19265
19291
|
const isReconnect = hasReconnectState && storedToken;
|
|
19266
19292
|
let dpopToken;
|
|
19267
19293
|
if (isReconnect) logger$8.debug("[Session] Reconnecting with stored jwt_token + authorization_state");
|
|
19268
|
-
else if (this.onBeforeReconnect && this.
|
|
19294
|
+
else if (this.onBeforeReconnect && this.clientBound) {
|
|
19269
19295
|
logger$8.debug("[Session] Refreshing credentials before fresh connect");
|
|
19270
19296
|
await this.onBeforeReconnect();
|
|
19271
19297
|
}
|
|
19272
|
-
if ((!isReconnect || this.
|
|
19298
|
+
if ((!isReconnect || this.clientBound) && this.dpopManager?.initialized) try {
|
|
19273
19299
|
dpopToken = await this.dpopManager.createRpcProof({ method: "signalwire.connect" });
|
|
19274
19300
|
} catch (error) {
|
|
19275
|
-
if (this.
|
|
19301
|
+
if (this.clientBound) throw error;
|
|
19276
19302
|
logger$8.warn("[Session] Failed to create DPoP proof for connect, proceeding without:", error);
|
|
19277
19303
|
}
|
|
19278
19304
|
const rpcConnectRequest = RPCConnect({
|
|
@@ -19289,9 +19315,9 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19289
19315
|
protocol: persistedParams.protocol
|
|
19290
19316
|
} : {}
|
|
19291
19317
|
});
|
|
19292
|
-
const response = await (0, import_cjs$
|
|
19318
|
+
const response = await (0, import_cjs$7.lastValueFrom)((0, import_cjs$7.from)(this.transport.execute(rpcConnectRequest)).pipe(throwOnRPCError(), (0, import_cjs$7.map)((res) => res.result), (0, import_cjs$7.filter)(isRPCConnectResult), (0, import_cjs$7.tap)(() => {
|
|
19293
19319
|
logger$8.debug("[Session] Response passed filter, processing authentication result");
|
|
19294
|
-
}), (0, import_cjs$
|
|
19320
|
+
}), (0, import_cjs$7.take)(1), (0, import_cjs$7.catchError)((err) => {
|
|
19295
19321
|
logger$8.error("[Session] Authentication RPC failed:", err);
|
|
19296
19322
|
throw err;
|
|
19297
19323
|
})));
|
|
@@ -19303,12 +19329,12 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19303
19329
|
if (response.protocol) await this.transport.setProtocol(response.protocol);
|
|
19304
19330
|
this._authorization$.next(response.authorization);
|
|
19305
19331
|
this._iceServers$.next(response.ice_servers ?? []);
|
|
19306
|
-
this.
|
|
19332
|
+
this._authState$.next({ kind: "authenticated" });
|
|
19307
19333
|
logger$8.debug("[Session] Authentication completed successfully");
|
|
19308
19334
|
}
|
|
19309
19335
|
async disconnect() {
|
|
19310
19336
|
this.transport.disconnect();
|
|
19311
|
-
this.
|
|
19337
|
+
this._authState$.next({ kind: "unauthenticated" });
|
|
19312
19338
|
await this.cleanupStoredConnectionParams();
|
|
19313
19339
|
}
|
|
19314
19340
|
async createInboundCall(invite) {
|
|
@@ -19323,7 +19349,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19323
19349
|
displayDirection: invite.display_direction,
|
|
19324
19350
|
userVariables: invite.userVariables
|
|
19325
19351
|
});
|
|
19326
|
-
await (0, import_cjs$
|
|
19352
|
+
await (0, import_cjs$7.firstValueFrom)(callSession.status$);
|
|
19327
19353
|
this._calls$.next({
|
|
19328
19354
|
[`${callSession.id}`]: callSession,
|
|
19329
19355
|
...this._calls$.value
|
|
@@ -19356,7 +19382,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19356
19382
|
reattach: true,
|
|
19357
19383
|
...storedOptions
|
|
19358
19384
|
});
|
|
19359
|
-
await (0, import_cjs$
|
|
19385
|
+
await (0, import_cjs$7.firstValueFrom)(callSession.status$);
|
|
19360
19386
|
this._calls$.next({
|
|
19361
19387
|
[`${callSession.id}`]: callSession,
|
|
19362
19388
|
...this._calls$.value
|
|
@@ -19370,7 +19396,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19370
19396
|
to: destinationURI,
|
|
19371
19397
|
...options
|
|
19372
19398
|
});
|
|
19373
|
-
await (0, import_cjs$
|
|
19399
|
+
await (0, import_cjs$7.firstValueFrom)((0, import_cjs$7.race)(callSession.selfId$.pipe((0, import_cjs$7.filter)((id) => Boolean(id)), (0, import_cjs$7.take)(1), (0, import_cjs$7.timeout)(this.callCreateTimeout)), callSession.errors$.pipe((0, import_cjs$7.take)(1), (0, import_cjs$7.switchMap)((callError) => (0, import_cjs$7.throwError)(() => callError.error)))));
|
|
19374
19400
|
this._calls$.next({
|
|
19375
19401
|
[`${callSession.id}`]: callSession,
|
|
19376
19402
|
...this._calls$.value
|
|
@@ -19379,7 +19405,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19379
19405
|
} catch (error) {
|
|
19380
19406
|
logger$8.error("[Session] Error creating outbound call:", error);
|
|
19381
19407
|
callSession?.destroy();
|
|
19382
|
-
const callError = new CallCreateError(error instanceof import_cjs$
|
|
19408
|
+
const callError = new CallCreateError(error instanceof import_cjs$7.TimeoutError ? "Call create timeout" : "Call creation failed", error, "outbound");
|
|
19383
19409
|
this._errors$.next(callError);
|
|
19384
19410
|
throw callError;
|
|
19385
19411
|
}
|
|
@@ -19398,7 +19424,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
19398
19424
|
logger$8.warn(`[Session] Directory lookup failed for ${addressURI}, proceeding with raw URI`);
|
|
19399
19425
|
}
|
|
19400
19426
|
const callSession = this.callFactory.createCall(address, { ...options });
|
|
19401
|
-
this.subscribeTo(callSession.status$.pipe((0, import_cjs$
|
|
19427
|
+
this.subscribeTo(callSession.status$.pipe((0, import_cjs$7.filter)((status) => status === "destroyed"), (0, import_cjs$7.take)(1)), () => {
|
|
19402
19428
|
const { [`${callSession.id}`]: _, ...remainingCalls } = this._calls$.value;
|
|
19403
19429
|
this._calls$.next(remainingCalls);
|
|
19404
19430
|
});
|
|
@@ -19452,7 +19478,7 @@ const isString = (obj) => typeof obj === "string";
|
|
|
19452
19478
|
|
|
19453
19479
|
//#endregion
|
|
19454
19480
|
//#region src/managers/ConversationsManager.ts
|
|
19455
|
-
var import_cjs$
|
|
19481
|
+
var import_cjs$6 = require_cjs();
|
|
19456
19482
|
const logger$7 = getLogger();
|
|
19457
19483
|
var ConversationMessagesFetcher = class extends Fetcher {
|
|
19458
19484
|
constructor(groupId, http) {
|
|
@@ -19499,7 +19525,7 @@ var ConversationsManager = class {
|
|
|
19499
19525
|
}
|
|
19500
19526
|
async getConversationMessageCollection(addressId) {
|
|
19501
19527
|
const groupId = this.groupIds.get(addressId) ?? await this.join(addressId);
|
|
19502
|
-
return Promise.resolve(new ConversationMessageCollection(groupId, this.clientSession.signalingEvent$.pipe(filterAs(isConversationMessageMetadata, "params"), (0, import_cjs$
|
|
19528
|
+
return Promise.resolve(new ConversationMessageCollection(groupId, this.clientSession.signalingEvent$.pipe(filterAs(isConversationMessageMetadata, "params"), (0, import_cjs$6.tap)((event) => logger$7.debug("[ConversationsManager ] Conversation Event:", event)), (0, import_cjs$6.map)((params) => ({ ...params }))), this.http, this.onError));
|
|
19503
19529
|
}
|
|
19504
19530
|
async sendText(text, destinationAddressId) {
|
|
19505
19531
|
const groupId = this.groupIds.get(destinationAddressId) ?? await this.join(destinationAddressId);
|
|
@@ -19524,7 +19550,7 @@ var ConversationsManager = class {
|
|
|
19524
19550
|
|
|
19525
19551
|
//#endregion
|
|
19526
19552
|
//#region src/managers/DeviceTokenManager.ts
|
|
19527
|
-
var import_cjs$
|
|
19553
|
+
var import_cjs$5 = require_cjs();
|
|
19528
19554
|
const logger$6 = getLogger();
|
|
19529
19555
|
/**
|
|
19530
19556
|
* Resolves the token expiry timestamp (epoch seconds) using a 3-tier priority chain:
|
|
@@ -19569,11 +19595,11 @@ var DeviceTokenManager = class extends Destroyable {
|
|
|
19569
19595
|
this._currentToken$ = this.createBehaviorSubject(null);
|
|
19570
19596
|
this._refreshInProgress = false;
|
|
19571
19597
|
this._effectiveExpireIn = DEVICE_TOKEN_DEFAULT_EXPIRE_IN;
|
|
19572
|
-
this.subscribeTo(this._currentToken$.pipe((0, import_cjs$
|
|
19598
|
+
this.subscribeTo(this._currentToken$.pipe((0, import_cjs$5.filter)(Boolean), (0, import_cjs$5.switchMap)((tokenData) => {
|
|
19573
19599
|
const expiresAt = resolveExpiresAt(tokenData);
|
|
19574
19600
|
const refreshIn = Math.max(expiresAt * 1e3 - Date.now() - DEVICE_TOKEN_REFRESH_BUFFER_MS, 1e3);
|
|
19575
19601
|
logger$6.debug(`[DeviceToken] Scheduling Client Bound SAT refresh in ${refreshIn}ms`);
|
|
19576
|
-
return (0, import_cjs$
|
|
19602
|
+
return (0, import_cjs$5.timer)(refreshIn);
|
|
19577
19603
|
})), () => {
|
|
19578
19604
|
this.executeRefresh();
|
|
19579
19605
|
});
|
|
@@ -19877,14 +19903,14 @@ const isEmptyArray = (a) => {
|
|
|
19877
19903
|
|
|
19878
19904
|
//#endregion
|
|
19879
19905
|
//#region src/utils/warnup.ts
|
|
19880
|
-
var import_cjs$
|
|
19906
|
+
var import_cjs$4 = require_cjs();
|
|
19881
19907
|
const warnup = (observable) => {
|
|
19882
|
-
observable.pipe((0, import_cjs$
|
|
19908
|
+
observable.pipe((0, import_cjs$4.take)(1)).subscribe();
|
|
19883
19909
|
};
|
|
19884
19910
|
|
|
19885
19911
|
//#endregion
|
|
19886
19912
|
//#region src/managers/DirectoryManager.ts
|
|
19887
|
-
var import_cjs$
|
|
19913
|
+
var import_cjs$3 = require_cjs();
|
|
19888
19914
|
const logger$4 = getLogger();
|
|
19889
19915
|
var AddressFetcher = class extends Fetcher {
|
|
19890
19916
|
constructor(http) {
|
|
@@ -19922,7 +19948,7 @@ var DirectoryManager = class extends Destroyable {
|
|
|
19922
19948
|
this.onError = onError;
|
|
19923
19949
|
this.addNewAddress = (id) => {
|
|
19924
19950
|
const address = new Address(id, this.conversationManager, this);
|
|
19925
|
-
const observable = this._statesCollection.get$(id)?.pipe(filterNull(), (0, import_cjs$
|
|
19951
|
+
const observable = this._statesCollection.get$(id)?.pipe(filterNull(), (0, import_cjs$3.map)((data) => {
|
|
19926
19952
|
address.upnext(data);
|
|
19927
19953
|
return address;
|
|
19928
19954
|
}));
|
|
@@ -19935,7 +19961,7 @@ var DirectoryManager = class extends Destroyable {
|
|
|
19935
19961
|
this._addresses$ = this.createBehaviorSubject([]);
|
|
19936
19962
|
this._addressesInstances = /* @__PURE__ */ new Map();
|
|
19937
19963
|
this._observableRegistry = /* @__PURE__ */ new Map();
|
|
19938
|
-
this._statesCollection = new AddressStateCollection(clientSession.signalingEvent$.pipe(filterAs(isConversationMessageUpdatedMetadata, "params"), (0, import_cjs$
|
|
19964
|
+
this._statesCollection = new AddressStateCollection(clientSession.signalingEvent$.pipe(filterAs(isConversationMessageUpdatedMetadata, "params"), (0, import_cjs$3.map)((_) => ({}))), this.http, this.onError);
|
|
19939
19965
|
this.initSubscriptions();
|
|
19940
19966
|
}
|
|
19941
19967
|
/** Whether addresses are currently being loaded from the server. */
|
|
@@ -20008,7 +20034,7 @@ var DirectoryManager = class extends Destroyable {
|
|
|
20008
20034
|
if (!addressId) {
|
|
20009
20035
|
const found$ = await this._statesCollection.find$("name", name);
|
|
20010
20036
|
if (found$) {
|
|
20011
|
-
const state = await (0, import_cjs$
|
|
20037
|
+
const state = await (0, import_cjs$3.firstValueFrom)(found$);
|
|
20012
20038
|
this.addNewAddress(state.id);
|
|
20013
20039
|
addressId = state.id;
|
|
20014
20040
|
}
|
|
@@ -20165,13 +20191,14 @@ var WebSocketController = class WebSocketController extends Destroyable {
|
|
|
20165
20191
|
}
|
|
20166
20192
|
scheduleReconnection() {
|
|
20167
20193
|
this.clearReconnectTimer();
|
|
20194
|
+
const jitteredDelay = this.currentReconnectDelay * (.5 + Math.random() * .5);
|
|
20168
20195
|
this.reconnectTimer = setTimeout(() => {
|
|
20169
20196
|
if (this.shouldReconnect) {
|
|
20170
20197
|
this._status$.next("connecting");
|
|
20171
20198
|
this.createWebSocket();
|
|
20172
20199
|
this.increaseReconnectDelay();
|
|
20173
20200
|
}
|
|
20174
|
-
},
|
|
20201
|
+
}, jitteredDelay);
|
|
20175
20202
|
}
|
|
20176
20203
|
increaseReconnectDelay() {
|
|
20177
20204
|
this.currentReconnectDelay = Math.min(this.currentReconnectDelay * 2, this.reconnectDelayMax);
|
|
@@ -20214,7 +20241,7 @@ function isSignalwirePingRequest(value) {
|
|
|
20214
20241
|
|
|
20215
20242
|
//#endregion
|
|
20216
20243
|
//#region src/managers/TransportManager.ts
|
|
20217
|
-
var import_cjs$
|
|
20244
|
+
var import_cjs$2 = require_cjs();
|
|
20218
20245
|
const logger$2 = getLogger();
|
|
20219
20246
|
var TransportManager = class extends Destroyable {
|
|
20220
20247
|
constructor(storage, protocolKey, webSocketConstructor, relayHost, onError) {
|
|
@@ -20226,7 +20253,7 @@ var TransportManager = class extends Destroyable {
|
|
|
20226
20253
|
this.isConnecting = false;
|
|
20227
20254
|
this.isConnected = false;
|
|
20228
20255
|
this.ackEvent = () => {
|
|
20229
|
-
return (0, import_cjs$
|
|
20256
|
+
return (0, import_cjs$2.tap)((message) => {
|
|
20230
20257
|
if (isSignalwireRequest(message)) try {
|
|
20231
20258
|
logger$2.debug("[Transport] Sending event ack", { eventId: message.id });
|
|
20232
20259
|
this.send(RPCEventAckResponse(message.id));
|
|
@@ -20236,7 +20263,7 @@ var TransportManager = class extends Destroyable {
|
|
|
20236
20263
|
});
|
|
20237
20264
|
};
|
|
20238
20265
|
this.replySignalwirePing = () => {
|
|
20239
|
-
return (0, import_cjs$
|
|
20266
|
+
return (0, import_cjs$2.filter)((message) => {
|
|
20240
20267
|
if (isSignalwirePingRequest(message)) {
|
|
20241
20268
|
try {
|
|
20242
20269
|
logger$2.debug("[Transport] Received ping, sending pong", { pingId: message.id });
|
|
@@ -20250,7 +20277,7 @@ var TransportManager = class extends Destroyable {
|
|
|
20250
20277
|
});
|
|
20251
20278
|
};
|
|
20252
20279
|
this.discardStaleEvents = () => {
|
|
20253
|
-
return (0, import_cjs$
|
|
20280
|
+
return (0, import_cjs$2.filter)((message) => {
|
|
20254
20281
|
if (!isSignalwireRequest(message)) return true;
|
|
20255
20282
|
const eventChannel = message.params.event_channel;
|
|
20256
20283
|
if (!eventChannel) return true;
|
|
@@ -20273,8 +20300,8 @@ var TransportManager = class extends Destroyable {
|
|
|
20273
20300
|
this.subscribeTo(this._webSocketConnections.errors$, (error) => {
|
|
20274
20301
|
this.onError?.(error);
|
|
20275
20302
|
});
|
|
20276
|
-
this.initialized$ = (0, import_cjs$
|
|
20277
|
-
this._jsonRPCMessage$ = this._webSocketConnections.incomingMessages$.pipe((0, import_cjs$
|
|
20303
|
+
this.initialized$ = (0, import_cjs$2.defer)(() => (0, import_cjs$2.from)(this._init())).pipe((0, import_cjs$2.shareReplay)(1), (0, import_cjs$2.takeUntil)(this.destroyed$));
|
|
20304
|
+
this._jsonRPCMessage$ = this._webSocketConnections.incomingMessages$.pipe((0, import_cjs$2.map)((event) => {
|
|
20278
20305
|
try {
|
|
20279
20306
|
return JSON.parse(event.data);
|
|
20280
20307
|
} catch (error) {
|
|
@@ -20282,13 +20309,13 @@ var TransportManager = class extends Destroyable {
|
|
|
20282
20309
|
this.onError?.(new MessageParseError(error));
|
|
20283
20310
|
return null;
|
|
20284
20311
|
}
|
|
20285
|
-
}), (0, import_cjs$
|
|
20312
|
+
}), (0, import_cjs$2.filter)((message) => message !== null && (isJSONRPCResponse(message) || isJSONRPCRequest(message))), (0, import_cjs$2.catchError)((error) => {
|
|
20286
20313
|
logger$2.error("[Transport] Message processing error:", error);
|
|
20287
20314
|
this.onError?.(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
20288
|
-
return import_cjs$
|
|
20289
|
-
}), (0, import_cjs$
|
|
20290
|
-
this._jsonRPCResponse$ = this._jsonRPCMessage$.pipe((0, import_cjs$
|
|
20291
|
-
this._incomingEvent$ = this._jsonRPCMessage$.pipe(this.ackEvent(), this.replySignalwirePing(), (0, import_cjs$
|
|
20315
|
+
return import_cjs$2.EMPTY;
|
|
20316
|
+
}), (0, import_cjs$2.share)(), (0, import_cjs$2.takeUntil)(this.destroyed$));
|
|
20317
|
+
this._jsonRPCResponse$ = this._jsonRPCMessage$.pipe((0, import_cjs$2.filter)(isJSONRPCResponse));
|
|
20318
|
+
this._incomingEvent$ = this._jsonRPCMessage$.pipe(this.ackEvent(), this.replySignalwirePing(), (0, import_cjs$2.filter)((message) => !isJSONRPCResponse(message)), this.discardStaleEvents(), (0, import_cjs$2.share)(), (0, import_cjs$2.takeUntil)(this.destroyed$));
|
|
20292
20319
|
}
|
|
20293
20320
|
async setProtocol(protocol) {
|
|
20294
20321
|
this._currentProtocol = protocol;
|
|
@@ -20310,7 +20337,7 @@ var TransportManager = class extends Destroyable {
|
|
|
20310
20337
|
this.isConnecting = true;
|
|
20311
20338
|
this.subscribeTo(this.initialized$, () => {
|
|
20312
20339
|
this._webSocketConnections.connect();
|
|
20313
|
-
const connectionSub = this._webSocketConnections.status$.pipe((0, import_cjs$
|
|
20340
|
+
const connectionSub = this._webSocketConnections.status$.pipe((0, import_cjs$2.filter)((status) => status === "connected" || status === "disconnected"), (0, import_cjs$2.take)(1), (0, import_cjs$2.timeout)(1e4)).subscribe({
|
|
20314
20341
|
next: (status) => {
|
|
20315
20342
|
if (status === "connected") {
|
|
20316
20343
|
this.isConnecting = false;
|
|
@@ -20333,7 +20360,7 @@ var TransportManager = class extends Destroyable {
|
|
|
20333
20360
|
}
|
|
20334
20361
|
});
|
|
20335
20362
|
this.subscriptions.push(connectionSub);
|
|
20336
|
-
this.subscribeTo(this._webSocketConnections.status$.pipe((0, import_cjs$
|
|
20363
|
+
this.subscribeTo(this._webSocketConnections.status$.pipe((0, import_cjs$2.filter)((status) => status === "disconnected")), () => {
|
|
20337
20364
|
logger$2.debug("[Transport] Disconnected");
|
|
20338
20365
|
this.isConnected = false;
|
|
20339
20366
|
});
|
|
@@ -20399,7 +20426,7 @@ var TransportManager = class extends Destroyable {
|
|
|
20399
20426
|
|
|
20400
20427
|
//#endregion
|
|
20401
20428
|
//#region src/clients/SignalWire.ts
|
|
20402
|
-
var import_cjs = require_cjs();
|
|
20429
|
+
var import_cjs$1 = require_cjs();
|
|
20403
20430
|
const logger$1 = getLogger();
|
|
20404
20431
|
const buildOptionsFromDestination = (destination) => {
|
|
20405
20432
|
if (typeof destination === "string") {
|
|
@@ -20532,31 +20559,10 @@ var SignalWire = class extends Destroyable {
|
|
|
20532
20559
|
logger$1.error("[SignalWire] Provided credentials have expired.");
|
|
20533
20560
|
throw new InvalidCredentialsError("Provided credentials have expired.");
|
|
20534
20561
|
}
|
|
20535
|
-
if (_credentials.expiry_at && credentialProvider?.refresh)
|
|
20536
|
-
const refreshFn = async () => {
|
|
20537
|
-
if (!credentialProvider.refresh) throw new InvalidCredentialsError("Credential provider does not support refresh");
|
|
20538
|
-
return credentialProvider.refresh();
|
|
20539
|
-
};
|
|
20540
|
-
const refreshInterval = Math.max(_credentials.expiry_at - Date.now() - 5e3, 1e3);
|
|
20541
|
-
this._refreshTimerId = setTimeout(async () => {
|
|
20542
|
-
try {
|
|
20543
|
-
const newCredentials = await refreshFn();
|
|
20544
|
-
this._deps.credential = newCredentials;
|
|
20545
|
-
this.persistCredential(newCredentials);
|
|
20546
|
-
logger$1.info("[SignalWire] Credentials refreshed successfully.");
|
|
20547
|
-
this.validateCredentials(credentialProvider, newCredentials).catch((error) => {
|
|
20548
|
-
logger$1.error("[SignalWire] Credential refresh error:", error);
|
|
20549
|
-
this._errors$.next(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
20550
|
-
});
|
|
20551
|
-
} catch (error) {
|
|
20552
|
-
logger$1.error("[SignalWire] Credential refresh failed:", error);
|
|
20553
|
-
this._errors$.next(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
20554
|
-
}
|
|
20555
|
-
}, refreshInterval);
|
|
20556
|
-
}
|
|
20562
|
+
if (_credentials.expiry_at && credentialProvider?.refresh) this.scheduleCredentialRefresh(credentialProvider, _credentials.expiry_at);
|
|
20557
20563
|
this._deps.credential = _credentials;
|
|
20558
20564
|
this.persistCredential(_credentials);
|
|
20559
|
-
if (this.isConnected && this._clientSession
|
|
20565
|
+
if (this.isConnected && this._clientSession?.authenticated && _credentials.token) try {
|
|
20560
20566
|
await this._clientSession.reauthenticate(_credentials.token);
|
|
20561
20567
|
logger$1.info("[SignalWire] Session refreshed with new credentials.");
|
|
20562
20568
|
} catch (error) {
|
|
@@ -20564,6 +20570,35 @@ var SignalWire = class extends Destroyable {
|
|
|
20564
20570
|
this._errors$.next(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
20565
20571
|
}
|
|
20566
20572
|
}
|
|
20573
|
+
/**
|
|
20574
|
+
* Schedules credential refresh with exponential backoff retry on failure.
|
|
20575
|
+
* On success, resets attempt counter and schedules the next refresh.
|
|
20576
|
+
* After exhausting retries, emits TokenRefreshError and disconnects.
|
|
20577
|
+
*/
|
|
20578
|
+
scheduleCredentialRefresh(credentialProvider, expiresAt, attempt = 0) {
|
|
20579
|
+
if (this._refreshTimerId !== void 0) clearTimeout(this._refreshTimerId);
|
|
20580
|
+
const refreshInterval = attempt === 0 ? Math.max(expiresAt - Date.now() - CREDENTIAL_REFRESH_BUFFER_MS, 1e3) : Math.min(CREDENTIAL_REFRESH_RETRY_BASE_MS * Math.pow(2, attempt) * (.5 + Math.random() * .5), CREDENTIAL_REFRESH_MAX_DELAY_MS);
|
|
20581
|
+
this._refreshTimerId = setTimeout(async () => {
|
|
20582
|
+
try {
|
|
20583
|
+
if (!credentialProvider.refresh) throw new InvalidCredentialsError("Credential provider does not support refresh");
|
|
20584
|
+
const newCredentials = await credentialProvider.refresh();
|
|
20585
|
+
this._deps.credential = newCredentials;
|
|
20586
|
+
this.persistCredential(newCredentials);
|
|
20587
|
+
logger$1.info("[SignalWire] Credentials refreshed successfully.");
|
|
20588
|
+
if (newCredentials.expiry_at) this.scheduleCredentialRefresh(credentialProvider, newCredentials.expiry_at, 0);
|
|
20589
|
+
} catch (error) {
|
|
20590
|
+
const nextAttempt = attempt + 1;
|
|
20591
|
+
logger$1.error(`[SignalWire] Credential refresh failed (attempt ${nextAttempt}/${CREDENTIAL_REFRESH_MAX_RETRIES}):`, error);
|
|
20592
|
+
this._errors$.next(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
20593
|
+
if (nextAttempt < CREDENTIAL_REFRESH_MAX_RETRIES) this.scheduleCredentialRefresh(credentialProvider, expiresAt, nextAttempt);
|
|
20594
|
+
else {
|
|
20595
|
+
logger$1.error("[SignalWire] Credential refresh exhausted all retries. Disconnecting.");
|
|
20596
|
+
this._errors$.next(new TokenRefreshError("Credential refresh failed after max retries"));
|
|
20597
|
+
this.disconnect();
|
|
20598
|
+
}
|
|
20599
|
+
}
|
|
20600
|
+
}, refreshInterval);
|
|
20601
|
+
}
|
|
20567
20602
|
/** Persist credential to localStorage when persistSession is enabled. */
|
|
20568
20603
|
persistCredential(credential) {
|
|
20569
20604
|
if (!credential.token) return;
|
|
@@ -20636,7 +20671,7 @@ var SignalWire = class extends Destroyable {
|
|
|
20636
20671
|
try {
|
|
20637
20672
|
const subscriber = this._subscriber$.value;
|
|
20638
20673
|
if (!subscriber) throw new UnexpectedError("Subscriber not initialized before connect");
|
|
20639
|
-
if (!await (0, import_cjs.firstValueFrom)(subscriber.fetched$)) throw new UnexpectedError("Failed to fetch subscriber information - fetched$ emitted false");
|
|
20674
|
+
if (!await (0, import_cjs$1.firstValueFrom)(subscriber.fetched$)) throw new UnexpectedError("Failed to fetch subscriber information - fetched$ emitted false");
|
|
20640
20675
|
this._deps.subscriber = subscriber;
|
|
20641
20676
|
} catch (error) {
|
|
20642
20677
|
logger$1.error(`[SignalWire] Failed to fetch subscriber information: ${error instanceof Error ? error.message : "Unknown error"}. This usually means the subscriber token is invalid or expired.`);
|
|
@@ -20659,6 +20694,8 @@ var SignalWire = class extends Destroyable {
|
|
|
20659
20694
|
logger$1.debug("[SignalWire] Credential refreshed successfully for reconnect");
|
|
20660
20695
|
} catch (error) {
|
|
20661
20696
|
logger$1.error("[SignalWire] Failed to refresh credentials for reconnect:", error);
|
|
20697
|
+
this._errors$.next(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
20698
|
+
throw error;
|
|
20662
20699
|
}
|
|
20663
20700
|
};
|
|
20664
20701
|
this.subscribeTo(this._clientSession.errors$, (error) => {
|
|
@@ -20679,7 +20716,7 @@ var SignalWire = class extends Destroyable {
|
|
|
20679
20716
|
};
|
|
20680
20717
|
});
|
|
20681
20718
|
}
|
|
20682
|
-
this.subscribeTo(this._clientSession.authenticated$.pipe((0, import_cjs.skip)(1), (0, import_cjs.filter)(Boolean)), async () => {
|
|
20719
|
+
this.subscribeTo(this._clientSession.authenticated$.pipe((0, import_cjs$1.skip)(1), (0, import_cjs$1.filter)(Boolean)), async () => {
|
|
20683
20720
|
try {
|
|
20684
20721
|
if (this._deviceTokenManager) {
|
|
20685
20722
|
await this._deviceTokenManager.activate(this._deps.subscriber, this._clientSession, (cred) => {
|
|
@@ -20709,7 +20746,7 @@ var SignalWire = class extends Destroyable {
|
|
|
20709
20746
|
this._clientSession.setDirectory(directory);
|
|
20710
20747
|
this._isConnected$.next(true);
|
|
20711
20748
|
this._diagnosticsCollector?.record("connection", "connected");
|
|
20712
|
-
this.subscribeTo(this._clientSession.authenticated$.pipe((0, import_cjs.skip)(2), (0, import_cjs.filter)(Boolean)), () => {
|
|
20749
|
+
this.subscribeTo(this._clientSession.authenticated$.pipe((0, import_cjs$1.skip)(2), (0, import_cjs$1.filter)(Boolean)), () => {
|
|
20713
20750
|
this._diagnosticsCollector?.record("connection", "reconnected");
|
|
20714
20751
|
});
|
|
20715
20752
|
}
|
|
@@ -20771,7 +20808,7 @@ var SignalWire = class extends Destroyable {
|
|
|
20771
20808
|
}
|
|
20772
20809
|
/** Observable that emits `true` when the client is both connected and authenticated. */
|
|
20773
20810
|
get ready$() {
|
|
20774
|
-
return this.publicCachedObservable("ready$", () => this._isConnected$.pipe((0, import_cjs.switchMap)((connected) => connected ? this._clientSession.authenticated$ : (0, import_cjs.of)(false))));
|
|
20811
|
+
return this.publicCachedObservable("ready$", () => this._isConnected$.pipe((0, import_cjs$1.switchMap)((connected) => connected ? this._clientSession.authenticated$ : (0, import_cjs$1.of)(false))));
|
|
20775
20812
|
}
|
|
20776
20813
|
/** Observable stream of errors from transport, authentication, and devices. */
|
|
20777
20814
|
get errors$() {
|
|
@@ -20834,7 +20871,7 @@ var SignalWire = class extends Destroyable {
|
|
|
20834
20871
|
}
|
|
20835
20872
|
try {
|
|
20836
20873
|
this._visibilityController = new VisibilityController();
|
|
20837
|
-
this.subscribeTo(this._visibilityController.visibilityChange$.pipe((0, import_cjs.filter)((event) => event.to === "visible" && PreferencesContainer.instance.refreshDevicesOnVisible)), () => {
|
|
20874
|
+
this.subscribeTo(this._visibilityController.visibilityChange$.pipe((0, import_cjs$1.filter)((event) => event.to === "visible" && PreferencesContainer.instance.refreshDevicesOnVisible)), () => {
|
|
20838
20875
|
logger$1.debug("[SignalWire] Page visible, re-enumerating devices");
|
|
20839
20876
|
try {
|
|
20840
20877
|
this._deviceController.disableDeviceMonitoring();
|
|
@@ -20857,13 +20894,17 @@ var SignalWire = class extends Destroyable {
|
|
|
20857
20894
|
* which creates a fresh transport and session.
|
|
20858
20895
|
*/
|
|
20859
20896
|
async disconnect() {
|
|
20897
|
+
if (this._refreshTimerId) {
|
|
20898
|
+
clearTimeout(this._refreshTimerId);
|
|
20899
|
+
this._refreshTimerId = void 0;
|
|
20900
|
+
}
|
|
20860
20901
|
this._diagnosticsCollector?.record("connection", "disconnected");
|
|
20861
20902
|
await this._clientSession.disconnect();
|
|
20862
20903
|
this._clientSession.destroy();
|
|
20863
20904
|
this._isConnected$.next(false);
|
|
20864
20905
|
}
|
|
20865
20906
|
async waitAuthentication() {
|
|
20866
|
-
await (0, import_cjs.firstValueFrom)(this.ready$.pipe((0, import_cjs.filter)((ready$1) => ready$1 === true)));
|
|
20907
|
+
await (0, import_cjs$1.firstValueFrom)(this.ready$.pipe((0, import_cjs$1.filter)((ready$1) => ready$1 === true)));
|
|
20867
20908
|
}
|
|
20868
20909
|
/**
|
|
20869
20910
|
* Registers the subscriber as online to receive inbound calls and events.
|
|
@@ -21258,6 +21299,7 @@ var EmbedTokenCredentialProvider = class {
|
|
|
21258
21299
|
|
|
21259
21300
|
//#endregion
|
|
21260
21301
|
//#region src/utils/embeddableCall.ts
|
|
21302
|
+
var import_cjs = require_cjs();
|
|
21261
21303
|
/**
|
|
21262
21304
|
* Creates a call using an embed token for simple, embeddable integrations.
|
|
21263
21305
|
*
|
|
@@ -21273,7 +21315,12 @@ async function embeddableCall(options) {
|
|
|
21273
21315
|
if (!embedToken) requiredFailed.push("embedToken");
|
|
21274
21316
|
if (!host) requiredFailed.push("host");
|
|
21275
21317
|
if (requiredFailed.length > 0) return Promise.reject(new DependencyError(`Missing required options: ${requiredFailed.join(", ")}`));
|
|
21276
|
-
|
|
21318
|
+
const client = new SignalWire(new EmbedTokenCredentialProvider(host, embedToken));
|
|
21319
|
+
const call = await client.dial(to);
|
|
21320
|
+
call.status$.pipe((0, import_cjs.first)((status) => status === "destroyed")).subscribe(() => {
|
|
21321
|
+
client.disconnect();
|
|
21322
|
+
});
|
|
21323
|
+
return call;
|
|
21277
21324
|
}
|
|
21278
21325
|
|
|
21279
21326
|
//#endregion
|