@observertc/observer-js 0.9.20-beta → 0.9.22-beta
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/.eslintrc.json +143 -0
- package/lib/Evaluator.d.ts.map +1 -1
- package/lib/Evaluator.js +54 -47
- package/lib/Observer.d.ts +1408 -38
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +484 -180
- package/lib/common/Semaphore.d.ts.map +1 -1
- package/lib/common/callMetaReports.d.ts.map +1 -1
- package/lib/common/callMetaReports.js +1 -0
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +15 -15
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +12 -1
- package/lib/entries/CallEntry.d.ts +611 -0
- package/lib/entries/CallEntry.d.ts.map +1 -0
- package/lib/entries/CallEntry.js +75 -0
- package/lib/entries/ClientEntry.d.ts +474 -0
- package/lib/entries/ClientEntry.d.ts.map +1 -0
- package/lib/entries/ClientEntry.js +101 -0
- package/lib/entries/InboundTrackEntry.d.ts +670 -0
- package/lib/entries/InboundTrackEntry.d.ts.map +1 -0
- package/lib/entries/InboundTrackEntry.js +76 -0
- package/lib/entries/OutboundTrackEntry.d.ts +670 -0
- package/lib/entries/OutboundTrackEntry.d.ts.map +1 -0
- package/lib/entries/OutboundTrackEntry.js +73 -0
- package/lib/entries/PeerConnectionEntry.d.ts +469 -0
- package/lib/entries/PeerConnectionEntry.d.ts.map +1 -0
- package/lib/entries/PeerConnectionEntry.js +144 -0
- package/lib/entries/SfuEntry.d.ts +150 -0
- package/lib/entries/SfuEntry.d.ts.map +1 -0
- package/lib/entries/SfuEntry.js +77 -0
- package/lib/entries/SfuInboundRtpPadEntry.d.ts +14 -0
- package/lib/entries/SfuInboundRtpPadEntry.d.ts.map +1 -0
- package/lib/entries/SfuInboundRtpPadEntry.js +49 -0
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts +14 -0
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts.map +1 -0
- package/lib/entries/SfuOutboundRtpPadEntry.js +47 -0
- package/lib/entries/SfuSctpChannelEntry.d.ts +12 -0
- package/lib/entries/SfuSctpChannelEntry.d.ts.map +1 -0
- package/lib/entries/SfuSctpChannelEntry.js +43 -0
- package/lib/entries/SfuTransportEntry.d.ts +82 -0
- package/lib/entries/SfuTransportEntry.d.ts.map +1 -0
- package/lib/entries/SfuTransportEntry.js +122 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/middlewares/CallOperationsContext.d.ts.map +1 -1
- package/lib/middlewares/CallOperationsContext.js +2 -6
- package/lib/middlewares/CallProcessor.d.ts.map +1 -1
- package/lib/middlewares/CallProcessor.js +15 -6
- package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +1 -1
- package/lib/middlewares/CommitTransactionMiddleware.js +22 -26
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +1 -1
- package/lib/middlewares/DeleteOutdatedCallEntries.js +29 -20
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +1 -1
- package/lib/middlewares/DeleteOutdatedSfuEntries.js +27 -18
- package/lib/middlewares/Middleware.d.ts.map +1 -1
- package/lib/middlewares/Middleware.js +13 -4
- package/lib/middlewares/Processor.d.ts.map +1 -1
- package/lib/middlewares/Processor.js +18 -9
- package/lib/middlewares/TransactionContext.d.ts.map +1 -1
- package/lib/middlewares/TransactionContext.js +84 -73
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.js +16 -7
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedSfusMiddleware.js +15 -6
- package/lib/middlewares/visitors/visitClient.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitClient.js +6 -18
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundAudioTrack.js +17 -20
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundVideoTrack.js +16 -21
- package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundAudioTrack.js +16 -16
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundVideoTarck.js +16 -17
- package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitPeerConnection.js +24 -40
- package/lib/middlewares/visitors/visitSfu.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfu.js +6 -7
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +3 -7
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +3 -8
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuSctpChannel.js +3 -6
- package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuTransport.js +3 -6
- package/lib/processes/closePeerConnectionProcess.d.ts.map +1 -1
- package/lib/processes/closePeerConnectionProcess.js +14 -5
- package/lib/processes/detachClientProcess.d.ts.map +1 -1
- package/lib/processes/detachClientProcess.js +20 -17
- package/lib/processes/findRemoteMatches.d.ts +2 -2
- package/lib/processes/findRemoteMatches.d.ts.map +1 -1
- package/lib/processes/findRemoteMatches.js +70 -56
- package/lib/processes/inboundTrackRemoved.d.ts.map +1 -1
- package/lib/processes/inboundTrackRemoved.js +12 -3
- package/lib/processes/joinClientProcess.d.ts.map +1 -1
- package/lib/processes/joinClientProcess.js +15 -6
- package/lib/processes/outboundTrackRemoved.d.ts.map +1 -1
- package/lib/processes/outboundTrackRemoved.js +12 -3
- package/lib/samples/ObservedCall.d.ts.map +1 -1
- package/lib/samples/ObservedCall.js +1 -5
- package/lib/samples/ObservedCalls.d.ts.map +1 -1
- package/lib/samples/ObservedClient.d.ts.map +1 -1
- package/lib/samples/ObservedClient.js +1 -9
- package/lib/samples/ObservedInboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedInboundAudioTrack.js +1 -5
- package/lib/samples/ObservedInboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedInboundVideoTrack.js +1 -5
- package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundAudioTrack.js +1 -5
- package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundVideoTrack.js +1 -5
- package/lib/samples/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/samples/ObservedPeerConnection.js +1 -12
- package/lib/samples/ObservedSfu.d.ts.map +1 -1
- package/lib/samples/ObservedSfu.js +1 -8
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +1 -1
- package/lib/samples/ObservedSfuInboundRtpPad.js +1 -5
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +1 -1
- package/lib/samples/ObservedSfuOutboundRtpPad.js +1 -5
- package/lib/samples/ObservedSfuSctpChannel.d.ts.map +1 -1
- package/lib/samples/ObservedSfuSctpChannel.js +1 -5
- package/lib/samples/ObservedSfuTransport.d.ts.map +1 -1
- package/lib/samples/ObservedSfuTransport.js +1 -8
- package/lib/samples/ObservedSfus.d.ts.map +1 -1
- package/lib/sinks/ObserverSink.d.ts.map +1 -1
- package/lib/sinks/ObserverSink.js +42 -31
- package/lib/sinks/callEventReports.js +1 -0
- package/lib/sources/ObservedCallSource.d.ts +5 -3
- package/lib/sources/ObservedCallSource.d.ts.map +1 -1
- package/lib/sources/ObservedClientSource.d.ts +3 -2
- package/lib/sources/ObservedClientSource.d.ts.map +1 -1
- package/lib/sources/ObservedSfuSource.d.ts +3 -2
- package/lib/sources/ObservedSfuSource.d.ts.map +1 -1
- package/lib/sources/Sources.d.ts +8 -4
- package/lib/sources/Sources.d.ts.map +1 -1
- package/lib/sources/Sources.js +71 -46
- package/lib/storages/ObserverStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.js +40 -23
- package/package.json +2 -1
- package/src/Evaluator.ts +17 -9
- package/src/Observer.ts +239 -171
- package/src/common/Semaphore.ts +2 -0
- package/src/common/callMetaReports.ts +30 -28
- package/src/common/logger.ts +140 -132
- package/src/common/types.ts +1 -1
- package/src/common/utils.ts +12 -1
- package/src/entries/CallEntry.ts +62 -0
- package/src/entries/ClientEntry.ts +90 -0
- package/src/entries/InboundTrackEntry.ts +74 -0
- package/src/entries/OutboundTrackEntry.ts +72 -0
- package/src/entries/PeerConnectionEntry.ts +133 -0
- package/src/entries/SfuEntry.ts +62 -0
- package/src/entries/SfuInboundRtpPadEntry.ts +46 -0
- package/src/entries/SfuOutboundRtpPadEntry.ts +44 -0
- package/src/entries/SfuSctpChannelEntry.ts +39 -0
- package/src/entries/SfuTransportEntry.ts +109 -0
- package/src/index.ts +11 -0
- package/src/middlewares/CallOperationsContext.ts +9 -5
- package/src/middlewares/CallProcessor.ts +4 -2
- package/src/middlewares/CommitTransactionMiddleware.ts +8 -5
- package/src/middlewares/DeleteOutdatedCallEntries.ts +24 -16
- package/src/middlewares/DeleteOutdatedSfuEntries.ts +24 -15
- package/src/middlewares/Middleware.ts +1 -0
- package/src/middlewares/Processor.ts +10 -5
- package/src/middlewares/TransactionContext.ts +1 -2
- package/src/middlewares/VisitObservedCallsMiddleware.ts +5 -2
- package/src/middlewares/VisitObservedSfusMiddleware.ts +8 -7
- package/src/middlewares/visitors/visitClient.ts +15 -1
- package/src/middlewares/visitors/visitInboundAudioTrack.ts +4 -1
- package/src/middlewares/visitors/visitInboundVideoTrack.ts +5 -1
- package/src/middlewares/visitors/visitOutboundAudioTrack.ts +5 -1
- package/src/middlewares/visitors/visitOutboundVideoTarck.ts +5 -1
- package/src/middlewares/visitors/visitPeerConnection.ts +15 -2
- package/src/middlewares/visitors/visitSfu.ts +7 -1
- package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +4 -2
- package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +3 -1
- package/src/middlewares/visitors/visitSfuSctpChannel.ts +23 -21
- package/src/middlewares/visitors/visitSfuTransport.ts +3 -1
- package/src/processes/closePeerConnectionProcess.ts +3 -0
- package/src/processes/detachClientProcess.ts +13 -4
- package/src/processes/findRemoteMatches.ts +32 -21
- package/src/processes/inboundTrackRemoved.ts +2 -0
- package/src/processes/joinClientProcess.ts +8 -2
- package/src/processes/outboundTrackRemoved.ts +2 -0
- package/src/samples/ObservedCall.ts +6 -0
- package/src/samples/ObservedCalls.ts +13 -7
- package/src/samples/ObservedClient.ts +24 -8
- package/src/samples/ObservedInboundAudioTrack.ts +3 -2
- package/src/samples/ObservedInboundVideoTrack.ts +3 -2
- package/src/samples/ObservedOutboundAudioTrack.ts +3 -2
- package/src/samples/ObservedOutboundVideoTrack.ts +3 -2
- package/src/samples/ObservedPeerConnection.ts +27 -11
- package/src/samples/ObservedSfu.ts +17 -10
- package/src/samples/ObservedSfuInboundRtpPad.ts +5 -4
- package/src/samples/ObservedSfuOutboundRtpPad.ts +5 -4
- package/src/samples/ObservedSfuSctpChannel.ts +13 -13
- package/src/samples/ObservedSfuTransport.ts +19 -7
- package/src/samples/ObservedSfus.ts +10 -5
- package/src/sinks/ObserverSink.ts +51 -44
- package/src/sinks/callEventReports.ts +1 -1
- package/src/sources/ObservedCallSource.ts +6 -5
- package/src/sources/ObservedClientSource.ts +3 -2
- package/src/sources/ObservedSfuSource.ts +4 -8
- package/src/sources/Sources.ts +96 -22
- package/src/storages/ObserverStorage.ts +1 -0
- package/src/storages/SimpleStorage.ts +44 -21
- package/tsconfig.json +7 -5
- package/.eslintrc.js +0 -27
package/lib/Observer.js
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
23
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
24
|
+
var m = o[Symbol.asyncIterator], i;
|
|
25
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
26
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
27
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
28
|
+
};
|
|
29
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
30
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
31
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
32
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
33
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
34
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
35
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
36
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
37
|
+
function fulfill(value) { resume("next", value); }
|
|
38
|
+
function reject(value) { resume("throw", value); }
|
|
39
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
4
40
|
};
|
|
5
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
42
|
exports.Observer = void 0;
|
|
@@ -9,8 +45,19 @@ const Sources_1 = require("./sources/Sources");
|
|
|
9
45
|
const StorageProvider_1 = require("./storages/StorageProvider");
|
|
10
46
|
const Evaluator_1 = require("./Evaluator");
|
|
11
47
|
const Semaphore_1 = require("./common/Semaphore");
|
|
48
|
+
const utils_1 = require("./common/utils");
|
|
12
49
|
const logger_1 = require("./common/logger");
|
|
13
|
-
const events_1 =
|
|
50
|
+
const events_1 = require("events");
|
|
51
|
+
const CallEntry_1 = require("./entries/CallEntry");
|
|
52
|
+
const ClientEntry_1 = require("./entries/ClientEntry");
|
|
53
|
+
const PeerConnectionEntry_1 = require("./entries/PeerConnectionEntry");
|
|
54
|
+
const InboundTrackEntry_1 = require("./entries/InboundTrackEntry");
|
|
55
|
+
const OutboundTrackEntry_1 = require("./entries/OutboundTrackEntry");
|
|
56
|
+
const SfuEntry_1 = require("./entries/SfuEntry");
|
|
57
|
+
const SfuTransportEntry_1 = require("./entries/SfuTransportEntry");
|
|
58
|
+
const SfuInboundRtpPadEntry_1 = require("./entries/SfuInboundRtpPadEntry");
|
|
59
|
+
const SfuOutboundRtpPadEntry_1 = require("./entries/SfuOutboundRtpPadEntry");
|
|
60
|
+
const SfuSctpChannelEntry_1 = require("./entries/SfuSctpChannelEntry");
|
|
14
61
|
const logger = (0, logger_1.createLogger)('Observer');
|
|
15
62
|
class Observer {
|
|
16
63
|
static create(providedConfig) {
|
|
@@ -37,24 +84,31 @@ class Observer {
|
|
|
37
84
|
this.config = config;
|
|
38
85
|
this._storages = _storages;
|
|
39
86
|
this._semaphores = _semaphores;
|
|
40
|
-
this._emitter = new events_1.
|
|
87
|
+
this._emitter = new events_1.EventEmitter();
|
|
41
88
|
this._closed = false;
|
|
42
89
|
this._sources = new Sources_1.Sources(config.sources);
|
|
43
90
|
this._sink = new ObserverSink_1.SinkImpl(config.sink);
|
|
44
91
|
this._evaluator = new Evaluator_1.Evaluator(this.config.evaluator, this._semaphores.callSemaphore, this._storages, this._sink);
|
|
45
92
|
this._sources.on('observed-samples', (event) => {
|
|
93
|
+
this._emitter.emit('processing-started');
|
|
46
94
|
this._evaluator.addObservedSamples(event);
|
|
47
95
|
});
|
|
48
96
|
this._sources.on('added-client-source', (event) => {
|
|
49
97
|
this._evaluator.addCreatedClientSource(event);
|
|
98
|
+
this._emitter.emit('client-added', event.clientId);
|
|
50
99
|
});
|
|
51
100
|
this._sources.on('removed-client-source', (event) => {
|
|
52
101
|
this._evaluator.addClosedClientSource(event);
|
|
102
|
+
this._emitter.emit('client-added', event.clientId);
|
|
53
103
|
});
|
|
54
104
|
this._evaluator.on('ready', () => {
|
|
55
105
|
this._sink.emit();
|
|
106
|
+
this._emitter.emit('processing-ended');
|
|
56
107
|
});
|
|
57
|
-
logger.debug(
|
|
108
|
+
logger.debug('Observer is created with config', this.config);
|
|
109
|
+
}
|
|
110
|
+
get sources() {
|
|
111
|
+
return this._sources;
|
|
58
112
|
}
|
|
59
113
|
on(event, listener) {
|
|
60
114
|
this._emitter.on(event, listener);
|
|
@@ -69,86 +123,35 @@ class Observer {
|
|
|
69
123
|
return this;
|
|
70
124
|
}
|
|
71
125
|
createCallSource(config) {
|
|
72
|
-
var _a, _b;
|
|
73
126
|
if (this._closed) {
|
|
74
|
-
throw new Error(
|
|
127
|
+
throw new Error('Attempted to create a call source on a closed observer');
|
|
75
128
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const mediaUnitId = (_b = config.mediaUnitId) !== null && _b !== void 0 ? _b : this.config.defaultMediaUnitId;
|
|
79
|
-
const clientSources = new Map();
|
|
80
|
-
const callSource = {
|
|
81
|
-
...config,
|
|
82
|
-
serviceId,
|
|
129
|
+
const { serviceId = this.config.defaultServiceId, mediaUnitId = this.config.defaultMediaUnitId, appData = {} } = config, callConfig = __rest(config, ["serviceId", "mediaUnitId", "appData"]);
|
|
130
|
+
return this._sources.createCallSource(Object.assign(Object.assign({}, callConfig), { appData,
|
|
83
131
|
mediaUnitId,
|
|
84
|
-
|
|
85
|
-
const clientSource = this._sources.createClientSource({
|
|
86
|
-
...config,
|
|
87
|
-
...context,
|
|
88
|
-
serviceId,
|
|
89
|
-
mediaUnitId,
|
|
90
|
-
});
|
|
91
|
-
const closeClientSource = clientSource.close;
|
|
92
|
-
clientSource.close = () => {
|
|
93
|
-
closeClientSource();
|
|
94
|
-
clientSources.delete(context.clientId);
|
|
95
|
-
};
|
|
96
|
-
clientSources.set(context.clientId, clientSource);
|
|
97
|
-
return clientSource;
|
|
98
|
-
},
|
|
99
|
-
close: () => {
|
|
100
|
-
if (closed) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
for (const clientSource of clientSources.values()) {
|
|
104
|
-
clientSource.close();
|
|
105
|
-
}
|
|
106
|
-
clientSources.clear();
|
|
107
|
-
closed = true;
|
|
108
|
-
},
|
|
109
|
-
closed,
|
|
110
|
-
};
|
|
111
|
-
return callSource;
|
|
112
|
-
}
|
|
113
|
-
createClientSource(config) {
|
|
114
|
-
var _a, _b, _c;
|
|
115
|
-
if (this._closed) {
|
|
116
|
-
throw new Error(`Attempted to create a client source on a closed observer`);
|
|
117
|
-
}
|
|
118
|
-
const serviceId = (_a = config.serviceId) !== null && _a !== void 0 ? _a : this.config.defaultServiceId;
|
|
119
|
-
const mediaUnitId = (_b = config.mediaUnitId) !== null && _b !== void 0 ? _b : this.config.defaultMediaUnitId;
|
|
120
|
-
const joined = (_c = config.joined) !== null && _c !== void 0 ? _c : Date.now();
|
|
121
|
-
return this._sources.createClientSource({
|
|
122
|
-
...config,
|
|
123
|
-
serviceId,
|
|
124
|
-
mediaUnitId,
|
|
125
|
-
joined,
|
|
126
|
-
});
|
|
132
|
+
serviceId }));
|
|
127
133
|
}
|
|
128
134
|
createSfuSource(config) {
|
|
129
|
-
var _a, _b, _c;
|
|
130
135
|
if (this._closed) {
|
|
131
|
-
throw new Error(
|
|
136
|
+
throw new Error('Attempted to create a sfu source on a closed observer');
|
|
132
137
|
}
|
|
133
|
-
const serviceId =
|
|
134
|
-
|
|
135
|
-
const joined = (_c = config.joined) !== null && _c !== void 0 ? _c : Date.now();
|
|
136
|
-
return this._sources.createSfuSource({
|
|
137
|
-
...config,
|
|
138
|
+
const { appData = {}, serviceId = this.config.defaultServiceId, mediaUnitId = this.config.defaultMediaUnitId, joined = Date.now() } = config, sfuConfig = __rest(config, ["appData", "serviceId", "mediaUnitId", "joined"]);
|
|
139
|
+
return this._sources.createSfuSource(Object.assign(Object.assign({}, sfuConfig), { appData,
|
|
138
140
|
serviceId,
|
|
139
141
|
mediaUnitId,
|
|
140
|
-
joined
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
joined }));
|
|
143
|
+
}
|
|
144
|
+
evaluate() {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
return new Promise((resolve, reject) => {
|
|
147
|
+
this._evaluator.once('ready', (err) => {
|
|
148
|
+
if (err)
|
|
149
|
+
reject(err);
|
|
150
|
+
else
|
|
151
|
+
resolve();
|
|
152
|
+
});
|
|
153
|
+
this._sources.emitSamples();
|
|
150
154
|
});
|
|
151
|
-
this._sources.emitSamples();
|
|
152
155
|
});
|
|
153
156
|
}
|
|
154
157
|
get reports() {
|
|
@@ -156,7 +159,7 @@ class Observer {
|
|
|
156
159
|
}
|
|
157
160
|
addEvaluators(...processes) {
|
|
158
161
|
if (this._closed) {
|
|
159
|
-
throw new Error(
|
|
162
|
+
throw new Error('Attempted to add an evaluator to a closed observer');
|
|
160
163
|
}
|
|
161
164
|
for (const process of processes) {
|
|
162
165
|
this._evaluator.addProcess(process);
|
|
@@ -164,7 +167,7 @@ class Observer {
|
|
|
164
167
|
}
|
|
165
168
|
removeEvaluators(...processes) {
|
|
166
169
|
if (this._closed) {
|
|
167
|
-
throw new Error(
|
|
170
|
+
throw new Error('Attempted to remove an evaluator from a closed observer');
|
|
168
171
|
}
|
|
169
172
|
for (const process of processes) {
|
|
170
173
|
this._evaluator.removeProcess(process);
|
|
@@ -172,7 +175,7 @@ class Observer {
|
|
|
172
175
|
}
|
|
173
176
|
addSinks(...processes) {
|
|
174
177
|
if (this._closed) {
|
|
175
|
-
throw new Error(
|
|
178
|
+
throw new Error('Attempted to add an evaluator to a closed observer');
|
|
176
179
|
}
|
|
177
180
|
for (const process of processes) {
|
|
178
181
|
this._sink.addProcess(process);
|
|
@@ -180,158 +183,459 @@ class Observer {
|
|
|
180
183
|
}
|
|
181
184
|
removeSinks(...processes) {
|
|
182
185
|
if (this._closed) {
|
|
183
|
-
throw new Error(
|
|
186
|
+
throw new Error('Attempted to remove an evaluator from a closed observer');
|
|
184
187
|
}
|
|
185
188
|
for (const process of processes) {
|
|
186
189
|
this._sink.removeProcess(process);
|
|
187
190
|
}
|
|
188
191
|
}
|
|
189
192
|
calls() {
|
|
190
|
-
const
|
|
191
|
-
return
|
|
193
|
+
const storageProvider = this._storages;
|
|
194
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
195
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
196
|
+
var _a, e_1, _b, _c;
|
|
197
|
+
try {
|
|
198
|
+
for (var _d = true, _e = __asyncValues(storageProvider.callStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
199
|
+
_c = _f.value;
|
|
200
|
+
_d = false;
|
|
201
|
+
try {
|
|
202
|
+
const [, callModel] = _c;
|
|
203
|
+
if (!callModel)
|
|
204
|
+
continue;
|
|
205
|
+
yield yield __await((0, CallEntry_1.createCallEntry)(storageProvider, callModel));
|
|
206
|
+
}
|
|
207
|
+
finally {
|
|
208
|
+
_d = true;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
213
|
+
finally {
|
|
214
|
+
try {
|
|
215
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
216
|
+
}
|
|
217
|
+
finally { if (e_1) throw e_1.error; }
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
})());
|
|
192
221
|
}
|
|
193
222
|
sfus() {
|
|
194
|
-
const
|
|
195
|
-
return
|
|
223
|
+
const storageProvider = this._storages;
|
|
224
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
225
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
226
|
+
var _a, e_2, _b, _c;
|
|
227
|
+
try {
|
|
228
|
+
for (var _d = true, _e = __asyncValues(storageProvider.sfuStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
229
|
+
_c = _f.value;
|
|
230
|
+
_d = false;
|
|
231
|
+
try {
|
|
232
|
+
const [, sfuModel] = _c;
|
|
233
|
+
if (!sfuModel)
|
|
234
|
+
continue;
|
|
235
|
+
yield yield __await((0, SfuEntry_1.createSfuEntry)(storageProvider, sfuModel));
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
_d = true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
243
|
+
finally {
|
|
244
|
+
try {
|
|
245
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
246
|
+
}
|
|
247
|
+
finally { if (e_2) throw e_2.error; }
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
})());
|
|
196
251
|
}
|
|
197
252
|
sfuTransports() {
|
|
198
|
-
const
|
|
199
|
-
return
|
|
253
|
+
const storageProvider = this._storages;
|
|
254
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
255
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
256
|
+
var _a, e_3, _b, _c;
|
|
257
|
+
try {
|
|
258
|
+
for (var _d = true, _e = __asyncValues(storageProvider.sfuTransportStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
259
|
+
_c = _f.value;
|
|
260
|
+
_d = false;
|
|
261
|
+
try {
|
|
262
|
+
const [, sfuTransportModel] = _c;
|
|
263
|
+
if (!sfuTransportModel)
|
|
264
|
+
continue;
|
|
265
|
+
yield yield __await((0, SfuTransportEntry_1.createSfuTransportEntry)(storageProvider, sfuTransportModel));
|
|
266
|
+
}
|
|
267
|
+
finally {
|
|
268
|
+
_d = true;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
273
|
+
finally {
|
|
274
|
+
try {
|
|
275
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
276
|
+
}
|
|
277
|
+
finally { if (e_3) throw e_3.error; }
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
})());
|
|
200
281
|
}
|
|
201
282
|
sfuInboundRtpPads() {
|
|
202
|
-
const
|
|
203
|
-
return
|
|
283
|
+
const storageProvider = this._storages;
|
|
284
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
285
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
286
|
+
var _a, e_4, _b, _c;
|
|
287
|
+
try {
|
|
288
|
+
for (var _d = true, _e = __asyncValues(storageProvider.sfuInboundRtpPadStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
289
|
+
_c = _f.value;
|
|
290
|
+
_d = false;
|
|
291
|
+
try {
|
|
292
|
+
const [, sfuInboundRtpPadModel] = _c;
|
|
293
|
+
if (!sfuInboundRtpPadModel)
|
|
294
|
+
continue;
|
|
295
|
+
yield yield __await((0, SfuInboundRtpPadEntry_1.createSfuInboundRtpPadEntry)(storageProvider, sfuInboundRtpPadModel));
|
|
296
|
+
}
|
|
297
|
+
finally {
|
|
298
|
+
_d = true;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
303
|
+
finally {
|
|
304
|
+
try {
|
|
305
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
306
|
+
}
|
|
307
|
+
finally { if (e_4) throw e_4.error; }
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
})());
|
|
204
311
|
}
|
|
205
312
|
sfuOutboundRtpPads() {
|
|
206
|
-
const
|
|
207
|
-
return
|
|
313
|
+
const storageProvider = this._storages;
|
|
314
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
315
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
316
|
+
var _a, e_5, _b, _c;
|
|
317
|
+
try {
|
|
318
|
+
for (var _d = true, _e = __asyncValues(storageProvider.sfuOutboundRtpPadStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
319
|
+
_c = _f.value;
|
|
320
|
+
_d = false;
|
|
321
|
+
try {
|
|
322
|
+
const [, sfuOutboundRtpPadModel] = _c;
|
|
323
|
+
if (!sfuOutboundRtpPadModel)
|
|
324
|
+
continue;
|
|
325
|
+
yield yield __await((0, SfuOutboundRtpPadEntry_1.createSfuOutboundRtpPadEntry)(storageProvider, sfuOutboundRtpPadModel));
|
|
326
|
+
}
|
|
327
|
+
finally {
|
|
328
|
+
_d = true;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
333
|
+
finally {
|
|
334
|
+
try {
|
|
335
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
336
|
+
}
|
|
337
|
+
finally { if (e_5) throw e_5.error; }
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
})());
|
|
208
341
|
}
|
|
209
342
|
clients() {
|
|
210
|
-
const
|
|
211
|
-
return
|
|
343
|
+
const storageProvider = this._storages;
|
|
344
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
345
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
346
|
+
var _a, e_6, _b, _c;
|
|
347
|
+
try {
|
|
348
|
+
for (var _d = true, _e = __asyncValues(storageProvider.clientStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
349
|
+
_c = _f.value;
|
|
350
|
+
_d = false;
|
|
351
|
+
try {
|
|
352
|
+
const [, callModel] = _c;
|
|
353
|
+
if (!callModel)
|
|
354
|
+
continue;
|
|
355
|
+
yield yield __await((0, ClientEntry_1.createClientEntry)(storageProvider, callModel));
|
|
356
|
+
}
|
|
357
|
+
finally {
|
|
358
|
+
_d = true;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
363
|
+
finally {
|
|
364
|
+
try {
|
|
365
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
366
|
+
}
|
|
367
|
+
finally { if (e_6) throw e_6.error; }
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
})());
|
|
212
371
|
}
|
|
213
372
|
peerConnections() {
|
|
214
|
-
const
|
|
215
|
-
return
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
373
|
+
const storageProvider = this._storages;
|
|
374
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
375
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
376
|
+
var _a, e_7, _b, _c;
|
|
377
|
+
try {
|
|
378
|
+
for (var _d = true, _e = __asyncValues(storageProvider.peerConnectionStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
379
|
+
_c = _f.value;
|
|
380
|
+
_d = false;
|
|
381
|
+
try {
|
|
382
|
+
const [, peerConnectionModel] = _c;
|
|
383
|
+
if (!peerConnectionModel)
|
|
384
|
+
continue;
|
|
385
|
+
yield yield __await((0, PeerConnectionEntry_1.createPeerConnectionEntry)(storageProvider, peerConnectionModel));
|
|
386
|
+
}
|
|
387
|
+
finally {
|
|
388
|
+
_d = true;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
393
|
+
finally {
|
|
394
|
+
try {
|
|
395
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
396
|
+
}
|
|
397
|
+
finally { if (e_7) throw e_7.error; }
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
})());
|
|
401
|
+
}
|
|
402
|
+
getTrack(trackId) {
|
|
403
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
404
|
+
const { inboundTrackStorage, outboundTrackStorage } = this._storages;
|
|
405
|
+
const [inbTrackModel, outbTrackModel] = yield Promise.all([
|
|
406
|
+
inboundTrackStorage.get(trackId),
|
|
407
|
+
outboundTrackStorage.get(trackId),
|
|
408
|
+
]);
|
|
409
|
+
if (inbTrackModel)
|
|
410
|
+
return (0, InboundTrackEntry_1.createInboundTrackEntry)(this._storages, inbTrackModel);
|
|
411
|
+
else if (outbTrackModel)
|
|
412
|
+
return (0, OutboundTrackEntry_1.createOutboundTrackEntry)(this._storages, outbTrackModel);
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
getAllTracks(trackIds) {
|
|
416
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
417
|
+
const storageProvider = this._storages;
|
|
418
|
+
const { inboundTrackStorage, outboundTrackStorage } = this._storages;
|
|
419
|
+
const [inbTrackModels, outbTrackModels] = yield Promise.all([
|
|
420
|
+
inboundTrackStorage.getAll(trackIds),
|
|
421
|
+
outboundTrackStorage.getAll(trackIds),
|
|
422
|
+
]);
|
|
423
|
+
const result = new Map();
|
|
424
|
+
for (const [trackId, model] of inbTrackModels) {
|
|
425
|
+
result.set(trackId, (0, InboundTrackEntry_1.createInboundTrackEntry)(storageProvider, model));
|
|
426
|
+
}
|
|
427
|
+
for (const [trackId, model] of outbTrackModels) {
|
|
428
|
+
result.set(trackId, (0, OutboundTrackEntry_1.createOutboundTrackEntry)(storageProvider, model));
|
|
429
|
+
}
|
|
430
|
+
return result;
|
|
431
|
+
});
|
|
235
432
|
}
|
|
236
433
|
inboundTracks() {
|
|
237
|
-
const
|
|
238
|
-
return
|
|
434
|
+
const storageProvider = this._storages;
|
|
435
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
436
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
437
|
+
var _a, e_8, _b, _c;
|
|
438
|
+
try {
|
|
439
|
+
for (var _d = true, _e = __asyncValues(storageProvider.inboundTrackStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
440
|
+
_c = _f.value;
|
|
441
|
+
_d = false;
|
|
442
|
+
try {
|
|
443
|
+
const [, inboundTrackModel] = _c;
|
|
444
|
+
if (!inboundTrackModel)
|
|
445
|
+
continue;
|
|
446
|
+
yield yield __await((0, InboundTrackEntry_1.createInboundTrackEntry)(storageProvider, inboundTrackModel));
|
|
447
|
+
}
|
|
448
|
+
finally {
|
|
449
|
+
_d = true;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
454
|
+
finally {
|
|
455
|
+
try {
|
|
456
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
457
|
+
}
|
|
458
|
+
finally { if (e_8) throw e_8.error; }
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
})());
|
|
239
462
|
}
|
|
240
463
|
outboundTracks() {
|
|
241
|
-
const
|
|
242
|
-
return
|
|
464
|
+
const storageProvider = this._storages;
|
|
465
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
466
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
467
|
+
var _a, e_9, _b, _c;
|
|
468
|
+
try {
|
|
469
|
+
for (var _d = true, _e = __asyncValues(storageProvider.outboundTrackStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
470
|
+
_c = _f.value;
|
|
471
|
+
_d = false;
|
|
472
|
+
try {
|
|
473
|
+
const [, outboundTrackModel] = _c;
|
|
474
|
+
if (!outboundTrackModel)
|
|
475
|
+
continue;
|
|
476
|
+
yield yield __await((0, OutboundTrackEntry_1.createOutboundTrackEntry)(storageProvider, outboundTrackModel));
|
|
477
|
+
}
|
|
478
|
+
finally {
|
|
479
|
+
_d = true;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
484
|
+
finally {
|
|
485
|
+
try {
|
|
486
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
487
|
+
}
|
|
488
|
+
finally { if (e_9) throw e_9.error; }
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
})());
|
|
243
492
|
}
|
|
244
493
|
sfuSctpChannels() {
|
|
245
|
-
const
|
|
246
|
-
return
|
|
494
|
+
const storageProvider = this._storages;
|
|
495
|
+
return (0, utils_1.asyncIteratorConverter)((function () {
|
|
496
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
497
|
+
var _a, e_10, _b, _c;
|
|
498
|
+
try {
|
|
499
|
+
for (var _d = true, _e = __asyncValues(storageProvider.sfuSctpChannelStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
500
|
+
_c = _f.value;
|
|
501
|
+
_d = false;
|
|
502
|
+
try {
|
|
503
|
+
const [, sfuSctpChannelModel] = _c;
|
|
504
|
+
if (!sfuSctpChannelModel)
|
|
505
|
+
continue;
|
|
506
|
+
yield yield __await((0, SfuSctpChannelEntry_1.createSfuSctpChannelEntry)(storageProvider, sfuSctpChannelModel));
|
|
507
|
+
}
|
|
508
|
+
finally {
|
|
509
|
+
_d = true;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
514
|
+
finally {
|
|
515
|
+
try {
|
|
516
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
517
|
+
}
|
|
518
|
+
finally { if (e_10) throw e_10.error; }
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
})());
|
|
247
522
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
523
|
+
getCall(callId) {
|
|
524
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
525
|
+
return (0, CallEntry_1.createCallEntry)(this._storages, yield this._storages.callStorage.get(callId));
|
|
526
|
+
});
|
|
251
527
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
528
|
+
getAllCalls(callIds) {
|
|
529
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
530
|
+
const models = yield this._storages.callStorage.getAll(callIds);
|
|
531
|
+
return new Map(Array.from(models).map(([callId, model]) => [callId, (0, CallEntry_1.createCallEntry)(this._storages, model)]));
|
|
532
|
+
});
|
|
255
533
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
534
|
+
getSfu(sfuId) {
|
|
535
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
536
|
+
return (0, SfuEntry_1.createSfuEntry)(this._storages, yield this._storages.sfuStorage.get(sfuId));
|
|
537
|
+
});
|
|
259
538
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
539
|
+
getAllSfus(sfuIds) {
|
|
540
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
541
|
+
const models = yield this._storages.sfuStorage.getAll(sfuIds);
|
|
542
|
+
return new Map(Array.from(models).map(([sfuId, model]) => [sfuId, (0, SfuEntry_1.createSfuEntry)(this._storages, model)]));
|
|
543
|
+
});
|
|
263
544
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
545
|
+
getSfuTransport(sfuTransportId) {
|
|
546
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
547
|
+
return (0, SfuTransportEntry_1.createSfuTransportEntry)(this._storages, yield this._storages.sfuTransportStorage.get(sfuTransportId));
|
|
548
|
+
});
|
|
267
549
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
550
|
+
getAllSfuTransports(sfuTransportIds) {
|
|
551
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
552
|
+
const models = yield this._storages.sfuTransportStorage.getAll(sfuTransportIds);
|
|
553
|
+
return new Map(Array.from(models).map(([sfuTransportId, model]) => [sfuTransportId, (0, SfuTransportEntry_1.createSfuTransportEntry)(this._storages, model)]));
|
|
554
|
+
});
|
|
271
555
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
556
|
+
getSfuInboundRtpPad(sfuInboundRtpPadId) {
|
|
557
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
558
|
+
return (0, SfuInboundRtpPadEntry_1.createSfuInboundRtpPadEntry)(this._storages, yield this._storages.sfuInboundRtpPadStorage.get(sfuInboundRtpPadId));
|
|
559
|
+
});
|
|
275
560
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
561
|
+
getAllSfuInboundRtpPads(sfuInboundRtpPadIds) {
|
|
562
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
563
|
+
const models = yield this._storages.sfuInboundRtpPadStorage.getAll(sfuInboundRtpPadIds);
|
|
564
|
+
return new Map(Array.from(models).map(([sfuInboundRtpPadId, model]) => [sfuInboundRtpPadId, (0, SfuInboundRtpPadEntry_1.createSfuInboundRtpPadEntry)(this._storages, model)]));
|
|
565
|
+
});
|
|
279
566
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
567
|
+
getSfuOutboundRtpPad(sfuOutboundRtpPadId) {
|
|
568
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
569
|
+
return (0, SfuOutboundRtpPadEntry_1.createSfuOutboundRtpPadEntry)(this._storages, yield this._storages.sfuOutboundRtpPadStorage.get(sfuOutboundRtpPadId));
|
|
570
|
+
});
|
|
283
571
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
572
|
+
getAllSfuOutboundRtpPads(sfuOutboundRtpPadIds) {
|
|
573
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
574
|
+
const models = yield this._storages.sfuOutboundRtpPadStorage.getAll(sfuOutboundRtpPadIds);
|
|
575
|
+
return new Map(Array.from(models).map(([sfuOutboundRtpPadId, model]) => [sfuOutboundRtpPadId, (0, SfuOutboundRtpPadEntry_1.createSfuOutboundRtpPadEntry)(this._storages, model)]));
|
|
576
|
+
});
|
|
287
577
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
578
|
+
getClient(clientId) {
|
|
579
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
580
|
+
return (0, ClientEntry_1.createClientEntry)(this._storages, yield this._storages.clientStorage.get(clientId));
|
|
581
|
+
});
|
|
291
582
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
583
|
+
getAllClient(clientIds) {
|
|
584
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
585
|
+
const models = yield this._storages.clientStorage.getAll(clientIds);
|
|
586
|
+
return new Map(Array.from(models).map(([clientId, model]) => [clientId, (0, ClientEntry_1.createClientEntry)(this._storages, model)]));
|
|
587
|
+
});
|
|
295
588
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
589
|
+
getPeerConnection(peerConnectionId) {
|
|
590
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
591
|
+
return (0, PeerConnectionEntry_1.createPeerConnectionEntry)(this._storages, yield this._storages.peerConnectionStorage.get(peerConnectionId));
|
|
592
|
+
});
|
|
299
593
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
594
|
+
getAllPeerConnections(peerConnectionIds) {
|
|
595
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
596
|
+
const models = yield this._storages.peerConnectionStorage.getAll(peerConnectionIds);
|
|
597
|
+
return new Map(Array.from(models).map(([peerConnectionId, model]) => [peerConnectionId, (0, PeerConnectionEntry_1.createPeerConnectionEntry)(this._storages, model)]));
|
|
598
|
+
});
|
|
303
599
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
600
|
+
getInboundTrack(inboundTrackId) {
|
|
601
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
602
|
+
return (0, InboundTrackEntry_1.createInboundTrackEntry)(this._storages, yield this._storages.inboundTrackStorage.get(inboundTrackId));
|
|
603
|
+
});
|
|
307
604
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
605
|
+
getAllInboundTracks(inboundTrackIds) {
|
|
606
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
607
|
+
const models = yield this._storages.inboundTrackStorage.getAll(inboundTrackIds);
|
|
608
|
+
return new Map(Array.from(models).map(([inboundTrackId, model]) => [inboundTrackId, (0, InboundTrackEntry_1.createInboundTrackEntry)(this._storages, model)]));
|
|
609
|
+
});
|
|
311
610
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
611
|
+
getOutboundTrack(outboundTrackId) {
|
|
612
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
613
|
+
return (0, OutboundTrackEntry_1.createOutboundTrackEntry)(this._storages, yield this._storages.outboundTrackStorage.get(outboundTrackId));
|
|
614
|
+
});
|
|
315
615
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
616
|
+
getAllOutboundTracks(outboundTrackIds) {
|
|
617
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
618
|
+
const models = yield this._storages.outboundTrackStorage.getAll(outboundTrackIds);
|
|
619
|
+
return new Map(Array.from(models).map(([outboundTrackId, model]) => [outboundTrackId, (0, OutboundTrackEntry_1.createOutboundTrackEntry)(this._storages, model)]));
|
|
620
|
+
});
|
|
319
621
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
622
|
+
getSfuSctpChannel(sctpChannelId) {
|
|
623
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
624
|
+
return (0, SfuSctpChannelEntry_1.createSfuSctpChannelEntry)(this._storages, yield this._storages.sfuSctpChannelStorage.get(sctpChannelId));
|
|
625
|
+
});
|
|
323
626
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
627
|
+
getAllSfuSctpChannel(sctpChannelIds) {
|
|
628
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
629
|
+
const models = yield this._storages.sfuSctpChannelStorage.getAll(sctpChannelIds);
|
|
630
|
+
return new Map(Array.from(models).map(([sctpChannelId, model]) => [sctpChannelId, (0, SfuSctpChannelEntry_1.createSfuSctpChannelEntry)(this._storages, model)]));
|
|
631
|
+
});
|
|
327
632
|
}
|
|
328
633
|
get closed() {
|
|
329
634
|
return this._closed;
|
|
330
635
|
}
|
|
331
636
|
close() {
|
|
332
637
|
if (this._closed) {
|
|
333
|
-
logger.debug(
|
|
334
|
-
return;
|
|
638
|
+
return logger.debug('Attempted to close twice');
|
|
335
639
|
}
|
|
336
640
|
this._closed = true;
|
|
337
641
|
this._sources.close();
|