@observertc/observer-js 0.9.27-beta → 0.30.0-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/lib/ObservedCall.d.ts +54 -0
- package/lib/ObservedCall.d.ts.map +1 -0
- package/lib/ObservedCall.js +166 -0
- package/lib/ObservedClient.d.ts +73 -0
- package/lib/ObservedClient.d.ts.map +1 -0
- package/lib/ObservedClient.js +487 -0
- package/lib/ObservedInboundTrack.d.ts +65 -0
- package/lib/ObservedInboundTrack.d.ts.map +1 -0
- package/lib/ObservedInboundTrack.js +192 -0
- package/lib/ObservedOutboundTrack.d.ts +55 -0
- package/lib/ObservedOutboundTrack.d.ts.map +1 -0
- package/lib/ObservedOutboundTrack.js +166 -0
- package/lib/ObservedPeerConnection.d.ts +57 -0
- package/lib/ObservedPeerConnection.d.ts.map +1 -0
- package/lib/ObservedPeerConnection.js +217 -0
- package/lib/Observer.d.ts +26 -1465
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +53 -605
- package/lib/{sinks/ObserverSink.d.ts → ReportsCollector.d.ts} +7 -23
- package/lib/ReportsCollector.d.ts.map +1 -0
- package/lib/{sinks/ObserverSink.js → ReportsCollector.js} +27 -85
- package/lib/common/ReportsCollector.d.ts +21 -24
- package/lib/common/ReportsCollector.d.ts.map +1 -1
- package/lib/common/ReportsCollector.js +24 -0
- package/lib/common/SingleExecutor.d.ts +3 -0
- package/lib/common/SingleExecutor.d.ts.map +1 -0
- package/lib/common/SingleExecutor.js +31 -0
- package/lib/common/TypedEventEmitter.d.ts +22 -0
- package/lib/common/TypedEventEmitter.d.ts.map +1 -0
- package/lib/common/TypedEventEmitter.js +11 -0
- package/lib/common/callEventReports.d.ts.map +1 -0
- package/lib/common/logger.d.ts +3 -9
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +58 -141
- package/lib/common/types.d.ts +2 -14
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +6 -1
- package/lib/index.d.ts +8 -19
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -2
- package/package.json +1 -1
- package/src/ObservedCall.ts +201 -0
- package/src/ObservedClient.ts +681 -0
- package/src/ObservedInboundTrack.ts +238 -0
- package/src/ObservedOutboundTrack.ts +205 -0
- package/src/ObservedPeerConnection.ts +249 -0
- package/src/Observer.ts +86 -442
- package/src/{sinks/ObserverSink.ts → ReportsCollector.ts} +29 -94
- package/src/common/ReportsCollector.ts +48 -23
- package/src/common/SingleExecutor.ts +36 -0
- package/src/common/TypedEventEmitter.ts +32 -0
- package/src/common/logger.ts +58 -161
- package/src/common/types.ts +4 -24
- package/src/common/utils.ts +6 -0
- package/src/index.ts +12 -23
- package/lib/Evaluator.d.ts +0 -43
- package/lib/Evaluator.d.ts.map +0 -1
- package/lib/Evaluator.js +0 -171
- package/lib/common/Semaphore.d.ts +0 -31
- package/lib/common/Semaphore.d.ts.map +0 -1
- package/lib/common/Semaphore.js +0 -16
- package/lib/entries/CallEntry.d.ts +0 -619
- package/lib/entries/CallEntry.d.ts.map +0 -1
- package/lib/entries/CallEntry.js +0 -75
- package/lib/entries/ClientEntry.d.ts +0 -478
- package/lib/entries/ClientEntry.d.ts.map +0 -1
- package/lib/entries/ClientEntry.js +0 -114
- package/lib/entries/InboundTrackEntry.d.ts +0 -682
- package/lib/entries/InboundTrackEntry.d.ts.map +0 -1
- package/lib/entries/InboundTrackEntry.js +0 -76
- package/lib/entries/OutboundTrackEntry.d.ts +0 -682
- package/lib/entries/OutboundTrackEntry.d.ts.map +0 -1
- package/lib/entries/OutboundTrackEntry.js +0 -73
- package/lib/entries/PeerConnectionEntry.d.ts +0 -505
- package/lib/entries/PeerConnectionEntry.d.ts.map +0 -1
- package/lib/entries/PeerConnectionEntry.js +0 -144
- package/lib/entries/SfuEntry.d.ts +0 -150
- package/lib/entries/SfuEntry.d.ts.map +0 -1
- package/lib/entries/SfuEntry.js +0 -77
- package/lib/entries/SfuInboundRtpPadEntry.d.ts +0 -14
- package/lib/entries/SfuInboundRtpPadEntry.d.ts.map +0 -1
- package/lib/entries/SfuInboundRtpPadEntry.js +0 -49
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts +0 -14
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts.map +0 -1
- package/lib/entries/SfuOutboundRtpPadEntry.js +0 -47
- package/lib/entries/SfuSctpChannelEntry.d.ts +0 -12
- package/lib/entries/SfuSctpChannelEntry.d.ts.map +0 -1
- package/lib/entries/SfuSctpChannelEntry.js +0 -43
- package/lib/entries/SfuTransportEntry.d.ts +0 -82
- package/lib/entries/SfuTransportEntry.d.ts.map +0 -1
- package/lib/entries/SfuTransportEntry.js +0 -122
- package/lib/evaluators/SetClientsCoordinateEvaluator.d.ts +0 -9
- package/lib/evaluators/SetClientsCoordinateEvaluator.d.ts.map +0 -1
- package/lib/evaluators/SetClientsCoordinateEvaluator.js +0 -95
- package/lib/middlewares/CallOperationsContext.d.ts +0 -18
- package/lib/middlewares/CallOperationsContext.d.ts.map +0 -1
- package/lib/middlewares/CallOperationsContext.js +0 -27
- package/lib/middlewares/CallProcessor.d.ts +0 -6
- package/lib/middlewares/CallProcessor.d.ts.map +0 -1
- package/lib/middlewares/CallProcessor.js +0 -36
- package/lib/middlewares/CommitTransactionMiddleware.d.ts +0 -6
- package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +0 -1
- package/lib/middlewares/CommitTransactionMiddleware.js +0 -179
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts +0 -6
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +0 -1
- package/lib/middlewares/DeleteOutdatedCallEntries.js +0 -121
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts +0 -6
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +0 -1
- package/lib/middlewares/DeleteOutdatedSfuEntries.js +0 -127
- package/lib/middlewares/Middleware.d.ts +0 -3
- package/lib/middlewares/Middleware.d.ts.map +0 -1
- package/lib/middlewares/Middleware.js +0 -21
- package/lib/middlewares/Processor.d.ts +0 -9
- package/lib/middlewares/Processor.d.ts.map +0 -1
- package/lib/middlewares/Processor.js +0 -54
- package/lib/middlewares/TransactionContext.d.ts +0 -35
- package/lib/middlewares/TransactionContext.d.ts.map +0 -1
- package/lib/middlewares/TransactionContext.js +0 -90
- package/lib/middlewares/TransactoinProcessor.d.ts +0 -6
- package/lib/middlewares/TransactoinProcessor.d.ts.map +0 -1
- package/lib/middlewares/TransactoinProcessor.js +0 -17
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts +0 -7
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +0 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.js +0 -96
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts +0 -6
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +0 -1
- package/lib/middlewares/VisitObservedSfusMiddleware.js +0 -151
- package/lib/middlewares/visitors/visitClient.d.ts +0 -5
- package/lib/middlewares/visitors/visitClient.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitClient.js +0 -174
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts +0 -5
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitInboundAudioTrack.js +0 -93
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts +0 -5
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitInboundVideoTrack.js +0 -94
- package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts +0 -5
- package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitOutboundAudioTrack.js +0 -90
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts +0 -5
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitOutboundVideoTarck.js +0 -90
- package/lib/middlewares/visitors/visitPeerConnection.d.ts +0 -5
- package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitPeerConnection.js +0 -111
- package/lib/middlewares/visitors/visitSfu.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfu.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfu.js +0 -78
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +0 -56
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +0 -56
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfuSctpChannel.js +0 -55
- package/lib/middlewares/visitors/visitSfuTransport.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfuTransport.js +0 -56
- package/lib/processes/closePeerConnectionProcess.d.ts +0 -10
- package/lib/processes/closePeerConnectionProcess.d.ts.map +0 -1
- package/lib/processes/closePeerConnectionProcess.js +0 -51
- package/lib/processes/detachClientProcess.d.ts +0 -14
- package/lib/processes/detachClientProcess.d.ts.map +0 -1
- package/lib/processes/detachClientProcess.js +0 -106
- package/lib/processes/findRemoteMatches.d.ts +0 -9
- package/lib/processes/findRemoteMatches.d.ts.map +0 -1
- package/lib/processes/findRemoteMatches.js +0 -96
- package/lib/processes/inboundTrackRemoved.d.ts +0 -9
- package/lib/processes/inboundTrackRemoved.d.ts.map +0 -1
- package/lib/processes/inboundTrackRemoved.js +0 -22
- package/lib/processes/joinClientProcess.d.ts +0 -11
- package/lib/processes/joinClientProcess.d.ts.map +0 -1
- package/lib/processes/joinClientProcess.js +0 -120
- package/lib/processes/outboundTrackRemoved.d.ts +0 -9
- package/lib/processes/outboundTrackRemoved.d.ts.map +0 -1
- package/lib/processes/outboundTrackRemoved.js +0 -22
- package/lib/samples/ObservedCall.d.ts +0 -17
- package/lib/samples/ObservedCall.d.ts.map +0 -1
- package/lib/samples/ObservedCall.js +0 -29
- package/lib/samples/ObservedCalls.d.ts +0 -19
- package/lib/samples/ObservedCalls.d.ts.map +0 -1
- package/lib/samples/ObservedCalls.js +0 -113
- package/lib/samples/ObservedClient.d.ts +0 -28
- package/lib/samples/ObservedClient.d.ts.map +0 -1
- package/lib/samples/ObservedClient.js +0 -110
- package/lib/samples/ObservedInboundAudioTrack.d.ts +0 -17
- package/lib/samples/ObservedInboundAudioTrack.d.ts.map +0 -1
- package/lib/samples/ObservedInboundAudioTrack.js +0 -17
- package/lib/samples/ObservedInboundVideoTrack.d.ts +0 -17
- package/lib/samples/ObservedInboundVideoTrack.d.ts.map +0 -1
- package/lib/samples/ObservedInboundVideoTrack.js +0 -17
- package/lib/samples/ObservedOutboundAudioTrack.d.ts +0 -16
- package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +0 -1
- package/lib/samples/ObservedOutboundAudioTrack.js +0 -17
- package/lib/samples/ObservedOutboundVideoTrack.d.ts +0 -16
- package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +0 -1
- package/lib/samples/ObservedOutboundVideoTrack.js +0 -17
- package/lib/samples/ObservedPeerConnection.d.ts +0 -47
- package/lib/samples/ObservedPeerConnection.d.ts.map +0 -1
- package/lib/samples/ObservedPeerConnection.js +0 -130
- package/lib/samples/ObservedSfu.d.ts +0 -27
- package/lib/samples/ObservedSfu.d.ts.map +0 -1
- package/lib/samples/ObservedSfu.js +0 -65
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts +0 -15
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +0 -1
- package/lib/samples/ObservedSfuInboundRtpPad.js +0 -17
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts +0 -15
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +0 -1
- package/lib/samples/ObservedSfuOutboundRtpPad.js +0 -17
- package/lib/samples/ObservedSfuSctpChannel.d.ts +0 -15
- package/lib/samples/ObservedSfuSctpChannel.d.ts.map +0 -1
- package/lib/samples/ObservedSfuSctpChannel.js +0 -17
- package/lib/samples/ObservedSfuTransport.d.ts +0 -30
- package/lib/samples/ObservedSfuTransport.d.ts.map +0 -1
- package/lib/samples/ObservedSfuTransport.js +0 -86
- package/lib/samples/ObservedSfus.d.ts +0 -16
- package/lib/samples/ObservedSfus.d.ts.map +0 -1
- package/lib/samples/ObservedSfus.js +0 -72
- package/lib/sinks/ObserverSink.d.ts.map +0 -1
- package/lib/sinks/callEventReports.d.ts.map +0 -1
- package/lib/sources/ObservedCallSource.d.ts +0 -18
- package/lib/sources/ObservedCallSource.d.ts.map +0 -1
- package/lib/sources/ObservedCallSource.js +0 -2
- package/lib/sources/ObservedClientSource.d.ts +0 -19
- package/lib/sources/ObservedClientSource.d.ts.map +0 -1
- package/lib/sources/ObservedClientSource.js +0 -2
- package/lib/sources/ObservedSfuSource.d.ts +0 -15
- package/lib/sources/ObservedSfuSource.d.ts.map +0 -1
- package/lib/sources/ObservedSfuSource.js +0 -2
- package/lib/sources/Sources.d.ts +0 -49
- package/lib/sources/Sources.d.ts.map +0 -1
- package/lib/sources/Sources.js +0 -213
- package/src/Evaluator.ts +0 -229
- package/src/common/Semaphore.ts +0 -45
- package/src/entries/CallEntry.ts +0 -62
- package/src/entries/ClientEntry.ts +0 -106
- package/src/entries/InboundTrackEntry.ts +0 -74
- package/src/entries/OutboundTrackEntry.ts +0 -72
- package/src/entries/PeerConnectionEntry.ts +0 -133
- package/src/entries/SfuEntry.ts +0 -62
- package/src/entries/SfuInboundRtpPadEntry.ts +0 -46
- package/src/entries/SfuOutboundRtpPadEntry.ts +0 -44
- package/src/entries/SfuSctpChannelEntry.ts +0 -39
- package/src/entries/SfuTransportEntry.ts +0 -109
- package/src/evaluators/SetClientsCoordinateEvaluator.ts +0 -78
- package/src/middlewares/CallOperationsContext.ts +0 -56
- package/src/middlewares/CallProcessor.ts +0 -38
- package/src/middlewares/CommitTransactionMiddleware.ts +0 -328
- package/src/middlewares/DeleteOutdatedCallEntries.ts +0 -159
- package/src/middlewares/DeleteOutdatedSfuEntries.ts +0 -168
- package/src/middlewares/Middleware.ts +0 -10
- package/src/middlewares/Processor.ts +0 -59
- package/src/middlewares/TransactionContext.ts +0 -176
- package/src/middlewares/TransactoinProcessor.ts +0 -28
- package/src/middlewares/VisitObservedCallsMiddleware.ts +0 -172
- package/src/middlewares/VisitObservedSfusMiddleware.ts +0 -203
- package/src/middlewares/visitors/visitClient.ts +0 -239
- package/src/middlewares/visitors/visitInboundAudioTrack.ts +0 -113
- package/src/middlewares/visitors/visitInboundVideoTrack.ts +0 -117
- package/src/middlewares/visitors/visitOutboundAudioTrack.ts +0 -100
- package/src/middlewares/visitors/visitOutboundVideoTarck.ts +0 -102
- package/src/middlewares/visitors/visitPeerConnection.ts +0 -151
- package/src/middlewares/visitors/visitSfu.ts +0 -70
- package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +0 -52
- package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +0 -53
- package/src/middlewares/visitors/visitSfuSctpChannel.ts +0 -50
- package/src/middlewares/visitors/visitSfuTransport.ts +0 -50
- package/src/processes/closePeerConnectionProcess.ts +0 -54
- package/src/processes/detachClientProcess.ts +0 -136
- package/src/processes/findRemoteMatches.ts +0 -104
- package/src/processes/inboundTrackRemoved.ts +0 -22
- package/src/processes/joinClientProcess.ts +0 -138
- package/src/processes/outboundTrackRemoved.ts +0 -22
- package/src/samples/ObservedCall.ts +0 -49
- package/src/samples/ObservedCalls.ts +0 -143
- package/src/samples/ObservedClient.ts +0 -172
- package/src/samples/ObservedInboundAudioTrack.ts +0 -35
- package/src/samples/ObservedInboundVideoTrack.ts +0 -36
- package/src/samples/ObservedOutboundAudioTrack.ts +0 -35
- package/src/samples/ObservedOutboundVideoTrack.ts +0 -35
- package/src/samples/ObservedPeerConnection.ts +0 -227
- package/src/samples/ObservedSfu.ts +0 -115
- package/src/samples/ObservedSfuInboundRtpPad.ts +0 -35
- package/src/samples/ObservedSfuOutboundRtpPad.ts +0 -35
- package/src/samples/ObservedSfuSctpChannel.ts +0 -35
- package/src/samples/ObservedSfuTransport.ts +0 -142
- package/src/samples/ObservedSfus.ts +0 -95
- package/src/sources/ObservedCallSource.ts +0 -26
- package/src/sources/ObservedClientSource.ts +0 -28
- package/src/sources/ObservedSfuSource.ts +0 -19
- package/src/sources/Sources.ts +0 -301
- /package/lib/{sinks → common}/callEventReports.d.ts +0 -0
- /package/lib/{sinks → common}/callEventReports.js +0 -0
- /package/src/{sinks → common}/callEventReports.ts +0 -0
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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 __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
12
|
-
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
13
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
14
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
15
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
16
|
-
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); }); }; }
|
|
17
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
18
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
19
|
-
function fulfill(value) { resume("next", value); }
|
|
20
|
-
function reject(value) { resume("throw", value); }
|
|
21
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.createSfuTransportEntry = void 0;
|
|
25
|
-
const utils_1 = require("../common/utils");
|
|
26
|
-
const SfuEntry_1 = require("./SfuEntry");
|
|
27
|
-
const SfuInboundRtpPadEntry_1 = require("./SfuInboundRtpPadEntry");
|
|
28
|
-
const SfuOutboundRtpPadEntry_1 = require("./SfuOutboundRtpPadEntry");
|
|
29
|
-
const SfuSctpChannelEntry_1 = require("./SfuSctpChannelEntry");
|
|
30
|
-
function createSfuTransportEntry(storageProvider, model) {
|
|
31
|
-
if (!model)
|
|
32
|
-
return;
|
|
33
|
-
const { sfuId, transportId: sfuTransportId, opened, internal, } = model;
|
|
34
|
-
if (!sfuId)
|
|
35
|
-
return SfuEntry_1.logger.warn(`SfuTransport model without sfuId: ${JSON.stringify(model)}`);
|
|
36
|
-
if (!sfuTransportId)
|
|
37
|
-
return SfuEntry_1.logger.warn(`SfuTransport model without sfuTransportId: ${JSON.stringify(model)}`);
|
|
38
|
-
if (!opened)
|
|
39
|
-
return SfuEntry_1.logger.warn(`SfuTransport model without opened: ${JSON.stringify(model)}`);
|
|
40
|
-
const getSfu = () => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
return (0, SfuEntry_1.createSfuEntry)(storageProvider, yield storageProvider.sfuStorage.get(sfuId));
|
|
42
|
-
});
|
|
43
|
-
const getSfuInboundRtpPad = (sfuInboundRtpPadId) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
return (0, SfuInboundRtpPadEntry_1.createSfuInboundRtpPadEntry)(storageProvider, yield storageProvider.sfuInboundRtpPadStorage.get(sfuInboundRtpPadId));
|
|
45
|
-
});
|
|
46
|
-
const getSfuOutboundRtpPad = (sfuOutboundRtpPadId) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
return (0, SfuOutboundRtpPadEntry_1.createSfuOutboundRtpPadEntry)(storageProvider, yield storageProvider.sfuOutboundRtpPadStorage.get(sfuOutboundRtpPadId));
|
|
48
|
-
});
|
|
49
|
-
const getSfuSctpChannel = (sfuSctpChannelId) => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
return (0, SfuSctpChannelEntry_1.createSfuSctpChannelEntry)(storageProvider, yield storageProvider.sfuSctpChannelStorage.get(sfuSctpChannelId));
|
|
51
|
-
});
|
|
52
|
-
const asyncSfuInboundRtpPadGenerator = function () {
|
|
53
|
-
return __asyncGenerator(this, arguments, function* () {
|
|
54
|
-
const sfuInboundRtpPadModels = yield __await(Promise.all(model.inboundRtpPadIds.map((sfuInboundRtpPadId) => storageProvider.sfuInboundRtpPadStorage.get(sfuInboundRtpPadId))));
|
|
55
|
-
for (const sfuInboundRtpPadModel of sfuInboundRtpPadModels) {
|
|
56
|
-
if (!sfuInboundRtpPadModel)
|
|
57
|
-
continue;
|
|
58
|
-
yield yield __await((0, SfuInboundRtpPadEntry_1.createSfuInboundRtpPadEntry)(storageProvider, sfuInboundRtpPadModel));
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
const asyncSfuOutboundRtpPadGenerator = function () {
|
|
63
|
-
return __asyncGenerator(this, arguments, function* () {
|
|
64
|
-
const sfuOutboundRtpPadModels = yield __await(Promise.all(model.outboundRtpPadIds.map((sfuOutboundRtpPadId) => storageProvider.sfuOutboundRtpPadStorage.get(sfuOutboundRtpPadId))));
|
|
65
|
-
for (const sfuOutboundRtpPadModel of sfuOutboundRtpPadModels) {
|
|
66
|
-
if (!sfuOutboundRtpPadModel)
|
|
67
|
-
continue;
|
|
68
|
-
yield yield __await((0, SfuOutboundRtpPadEntry_1.createSfuOutboundRtpPadEntry)(storageProvider, sfuOutboundRtpPadModel));
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
const asyncSfuSctpChannelGenerator = function () {
|
|
73
|
-
return __asyncGenerator(this, arguments, function* () {
|
|
74
|
-
const sfuSctpChannelModels = yield __await(Promise.all(model.sctpChannelIds.map((sfuSctpChannelId) => storageProvider.sfuSctpChannelStorage.get(sfuSctpChannelId))));
|
|
75
|
-
for (const sfuSctpChannelModel of sfuSctpChannelModels) {
|
|
76
|
-
if (!sfuSctpChannelModel)
|
|
77
|
-
continue;
|
|
78
|
-
yield yield __await((0, SfuSctpChannelEntry_1.createSfuSctpChannelEntry)(storageProvider, sfuSctpChannelModel));
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
return {
|
|
83
|
-
sfuTransportId,
|
|
84
|
-
sfuId,
|
|
85
|
-
opened,
|
|
86
|
-
get internal() {
|
|
87
|
-
return internal === true;
|
|
88
|
-
},
|
|
89
|
-
get marker() {
|
|
90
|
-
return model.marker;
|
|
91
|
-
},
|
|
92
|
-
get inboundRtpPadIds() {
|
|
93
|
-
return model.inboundRtpPadIds;
|
|
94
|
-
},
|
|
95
|
-
get outboundRtpPadIds() {
|
|
96
|
-
return model.outboundRtpPadIds;
|
|
97
|
-
},
|
|
98
|
-
get sctpChannelIds() {
|
|
99
|
-
return model.sctpChannelIds;
|
|
100
|
-
},
|
|
101
|
-
get inboundRtpPads() {
|
|
102
|
-
return (0, utils_1.asyncIteratorConverter)(asyncSfuInboundRtpPadGenerator());
|
|
103
|
-
},
|
|
104
|
-
get outboundRtpPads() {
|
|
105
|
-
return (0, utils_1.asyncIteratorConverter)(asyncSfuOutboundRtpPadGenerator());
|
|
106
|
-
},
|
|
107
|
-
get sctpChannels() {
|
|
108
|
-
return (0, utils_1.asyncIteratorConverter)(asyncSfuSctpChannelGenerator());
|
|
109
|
-
},
|
|
110
|
-
getSfu,
|
|
111
|
-
getSfuInboundRtpPad,
|
|
112
|
-
getSfuOutboundRtpPad,
|
|
113
|
-
getSfuSctpChannel,
|
|
114
|
-
refresh: () => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const refreshedModel = yield storageProvider.sfuTransportStorage.get(sfuTransportId);
|
|
116
|
-
if (!refreshedModel)
|
|
117
|
-
return;
|
|
118
|
-
model.marker = refreshedModel.marker;
|
|
119
|
-
})
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
exports.createSfuTransportEntry = createSfuTransportEntry;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { EvaluatorProcess } from '..';
|
|
2
|
-
export declare const logger: import("../common/logger").WrappedLogger;
|
|
3
|
-
export type ClientCoordinate = {
|
|
4
|
-
latitude: number;
|
|
5
|
-
longitude: number;
|
|
6
|
-
};
|
|
7
|
-
export type GetClientCoordinate = (ipAddress: string) => ClientCoordinate | undefined;
|
|
8
|
-
export declare function createSetClientsCoordinateEvaluator(getCoordinate: GetClientCoordinate): EvaluatorProcess;
|
|
9
|
-
//# sourceMappingURL=SetClientsCoordinateEvaluator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetClientsCoordinateEvaluator.d.ts","sourceRoot":"","sources":["../../src/evaluators/SetClientsCoordinateEvaluator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAEtC,eAAO,MAAM,MAAM,0CAAgD,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,gBAAgB,GAAG,SAAS,CAAC;AAEtF,wBAAgB,mCAAmC,CAClD,aAAa,EAAE,mBAAmB,GAChC,gBAAgB,CA6DlB"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.createSetClientsCoordinateEvaluator = exports.logger = void 0;
|
|
39
|
-
const logger_1 = require("../common/logger");
|
|
40
|
-
const Models = __importStar(require("../models/Models"));
|
|
41
|
-
const ipaddr_js_1 = __importDefault(require("ipaddr.js"));
|
|
42
|
-
exports.logger = (0, logger_1.createLogger)('SetClientsCoordinateEvaluator');
|
|
43
|
-
function createSetClientsCoordinateEvaluator(getCoordinate) {
|
|
44
|
-
const process = (context) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const clientIds = new Set();
|
|
46
|
-
for (const observedCall of context.observedCalls.observedCalls()) {
|
|
47
|
-
for (const observedClient of observedCall.observedClients()) {
|
|
48
|
-
clientIds.add(observedClient.clientId);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (clientIds.size < 1)
|
|
52
|
-
return;
|
|
53
|
-
const storedClients = yield context.storages.clientStorage.getAll(clientIds);
|
|
54
|
-
for (const observedCall of context.observedCalls.observedCalls()) {
|
|
55
|
-
for (const observedClient of observedCall.observedClients()) {
|
|
56
|
-
const { clientId } = observedClient;
|
|
57
|
-
const storedClient = storedClients.get(clientId);
|
|
58
|
-
if (!storedClient || storedClient.coordinates)
|
|
59
|
-
continue;
|
|
60
|
-
let ipAddress;
|
|
61
|
-
searchForIp: for (const observedPeerConnection of observedClient.observedPeerConnections()) {
|
|
62
|
-
for (const iceLocalCandidate of observedPeerConnection.iceLocalCandidates()) {
|
|
63
|
-
if (!iceLocalCandidate.address)
|
|
64
|
-
continue;
|
|
65
|
-
try {
|
|
66
|
-
const addr = ipaddr_js_1.default.parse(iceLocalCandidate.address);
|
|
67
|
-
ipAddress = addr.toString();
|
|
68
|
-
break searchForIp;
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
exports.logger.warn(`Failed to parse ip address: ${iceLocalCandidate.address}`, e);
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (!ipAddress)
|
|
77
|
-
continue;
|
|
78
|
-
try {
|
|
79
|
-
const coordinate = getCoordinate(ipAddress);
|
|
80
|
-
if (!coordinate)
|
|
81
|
-
continue;
|
|
82
|
-
storedClient.coordinates = new Models.ClientCoordinate({
|
|
83
|
-
latitude: coordinate.latitude,
|
|
84
|
-
longitude: coordinate.longitude,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
catch (e) {
|
|
88
|
-
exports.logger.warn(`Failed to get coordinate for ip address: ${ipAddress}`, e);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return process;
|
|
94
|
-
}
|
|
95
|
-
exports.createSetClientsCoordinateEvaluator = createSetClientsCoordinateEvaluator;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { EvaluatorContext } from '../common/types';
|
|
2
|
-
import { Writable } from '../common/utils';
|
|
3
|
-
import { ObservedClientSourceConfig } from '../sources/ObservedClientSource';
|
|
4
|
-
export type CallOperationsContext = {
|
|
5
|
-
joinedClients: ObservedClientSourceConfig[];
|
|
6
|
-
detachedClients: (ObservedClientSourceConfig & {
|
|
7
|
-
detached: number;
|
|
8
|
-
})[];
|
|
9
|
-
evaluatorContext?: Writable<EvaluatorContext>;
|
|
10
|
-
};
|
|
11
|
-
export type CallOperation = (ObservedClientSourceConfig & {
|
|
12
|
-
type: 'join';
|
|
13
|
-
}) | (ObservedClientSourceConfig & {
|
|
14
|
-
type: 'detach';
|
|
15
|
-
detached: number;
|
|
16
|
-
});
|
|
17
|
-
export declare function createCallOperationContext(clientOperations: Map<string, CallOperation>, evaluatorContext?: Writable<EvaluatorContext>): CallOperationsContext;
|
|
18
|
-
//# sourceMappingURL=CallOperationsContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallOperationsContext.d.ts","sourceRoot":"","sources":["../../src/middlewares/CallOperationsContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,MAAM,MAAM,qBAAqB,GAAG;IACnC,aAAa,EAAE,0BAA0B,EAAE,CAAC;IAC5C,eAAe,EAAE,CAAC,0BAA0B,GAAG;QAC9C,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC,EAAE,CAAC;IAEL,gBAAgB,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,aAAa,GACtB,CAAC,0BAA0B,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;CACb,CAAC,GAAG,CAAC,0BAA0B,GAAG;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEJ,wBAAgB,0BAA0B,CACzC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAC5C,gBAAgB,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAC3C,qBAAqB,CA+BvB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCallOperationContext = void 0;
|
|
4
|
-
function createCallOperationContext(clientOperations, evaluatorContext) {
|
|
5
|
-
const joinedClients = [];
|
|
6
|
-
const detachedClients = [];
|
|
7
|
-
for (const clientOperation of clientOperations.values()) {
|
|
8
|
-
switch (clientOperation.type) {
|
|
9
|
-
case 'join': {
|
|
10
|
-
const joinedClient = Object.assign({}, clientOperation);
|
|
11
|
-
joinedClients.push(joinedClient);
|
|
12
|
-
break;
|
|
13
|
-
}
|
|
14
|
-
case 'detach': {
|
|
15
|
-
const detachedClient = Object.assign({}, clientOperation);
|
|
16
|
-
detachedClients.push(detachedClient);
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
joinedClients,
|
|
23
|
-
detachedClients,
|
|
24
|
-
evaluatorContext,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
exports.createCallOperationContext = createCallOperationContext;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ReportsCollector } from '../common/ReportsCollector';
|
|
2
|
-
import { StorageProvider } from '../storages/StorageProvider';
|
|
3
|
-
import { CallOperationsContext } from './CallOperationsContext';
|
|
4
|
-
import { Processor } from './Processor';
|
|
5
|
-
export declare function createCallProcessor(storageProvider: StorageProvider, reportsCollector: ReportsCollector): Processor<CallOperationsContext>;
|
|
6
|
-
//# sourceMappingURL=CallProcessor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallProcessor.d.ts","sourceRoot":"","sources":["../../src/middlewares/CallProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAmB,SAAS,EAAE,MAAM,aAAa,CAAC;AAEzD,wBAAgB,mBAAmB,CAClC,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,GAChC,SAAS,CAAC,qBAAqB,CAAC,CA0BlC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createCallProcessor = void 0;
|
|
13
|
-
const detachClientProcess_1 = require("../processes/detachClientProcess");
|
|
14
|
-
const joinClientProcess_1 = require("../processes/joinClientProcess");
|
|
15
|
-
const Processor_1 = require("./Processor");
|
|
16
|
-
function createCallProcessor(storageProvider, reportsCollector) {
|
|
17
|
-
const joinClientProcess = (0, joinClientProcess_1.createJoinClientProcess)(storageProvider, reportsCollector);
|
|
18
|
-
const detachClientProcess = (0, detachClientProcess_1.createDetachClientProcess)(storageProvider, reportsCollector);
|
|
19
|
-
const joinClientMiddleware = (context, next) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const input = {
|
|
21
|
-
clients: context.joinedClients,
|
|
22
|
-
evaluatorContext: context.evaluatorContext,
|
|
23
|
-
};
|
|
24
|
-
yield Promise.all([joinClientProcess(input), next ? next(context) : Promise.resolve()]);
|
|
25
|
-
});
|
|
26
|
-
const detachClientMiddleware = (context, next) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const input = {
|
|
28
|
-
clients: context.detachedClients,
|
|
29
|
-
evaluatorContext: context.evaluatorContext,
|
|
30
|
-
recursive: true,
|
|
31
|
-
};
|
|
32
|
-
yield Promise.all([detachClientProcess(input), next ? next(context) : Promise.resolve()]);
|
|
33
|
-
});
|
|
34
|
-
return (0, Processor_1.createProcessor)(joinClientMiddleware, detachClientMiddleware);
|
|
35
|
-
}
|
|
36
|
-
exports.createCallProcessor = createCallProcessor;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ReportsCollector } from '../common/ReportsCollector';
|
|
2
|
-
import { StorageProvider } from '../storages/StorageProvider';
|
|
3
|
-
import { Middleware } from './Middleware';
|
|
4
|
-
import { TransactionContext } from './TransactionContext';
|
|
5
|
-
export declare function createCommitTransactionMiddleware(storageProvider: StorageProvider, reports: ReportsCollector): Middleware<TransactionContext>;
|
|
6
|
-
//# sourceMappingURL=CommitTransactionMiddleware.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommitTransactionMiddleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/CommitTransactionMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D,wBAAgB,iCAAiC,CAChD,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,gBAAgB,GACvB,UAAU,CAAC,kBAAkB,CAAC,CA2ThC"}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createCommitTransactionMiddleware = void 0;
|
|
13
|
-
const logger_1 = require("../common/logger");
|
|
14
|
-
const logger = (0, logger_1.createLogger)('CallUpdateMiddleware');
|
|
15
|
-
function createCommitTransactionMiddleware(storageProvider, reports) {
|
|
16
|
-
const process = (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const { clientStorage, peerConnectionStorage, inboundTrackStorage, outboundTrackStorage, sfuStorage, sfuTransportStorage, sfuInboundRtpPadStorage, sfuOutboundRtpPadStorage, sfuSctpChannelStorage, } = storageProvider;
|
|
18
|
-
const { clients, updatedPeerConnections, deletedPeerConnections, updatedInboundAudioTracks, deletedInboundAudioTracks, updatedInboundVideoTracks, deletedInboundVideoTracks, updatedOutboundAudioTracks, deletedOutboundAudioTracks, updatedOutboundVideoTracks, deletedOutboundVideoTracks, updatedSfus, deletedSfus, updatedSfuTransports, deletedSfuTransports, updatedSfuInboundRtpPads, deletedSfuInboundRtpPads, updatedSfuOutboundRtpPads, deletedSfuOutboundRtpPads, updatedSfuSctpChannels, deletedSfuSctpChannels, evaluatorContext, } = transaction;
|
|
19
|
-
const emptyMap = new Map();
|
|
20
|
-
// Ensure updates are disjointed!
|
|
21
|
-
for (const deletedPeerConnectionId of deletedPeerConnections) {
|
|
22
|
-
if (updatedPeerConnections.has(deletedPeerConnectionId)) {
|
|
23
|
-
logger.warn(`Updated PeerConnection held a peerConnectionId for deletedPeerConnections. Transaction ${transaction.id}`);
|
|
24
|
-
updatedPeerConnections.delete(deletedPeerConnectionId);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
for (const deletedInboundTrackId of deletedInboundAudioTracks) {
|
|
28
|
-
if (updatedInboundAudioTracks.has(deletedInboundTrackId)) {
|
|
29
|
-
logger.warn(`Updated InboundAudioTrack held an inboundAudioTrackId for deletedInboundAudioTracks. Transaction ${transaction.id}`);
|
|
30
|
-
updatedInboundAudioTracks.delete(deletedInboundTrackId);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
for (const deletedInboundTrackId of deletedInboundVideoTracks) {
|
|
34
|
-
if (updatedInboundVideoTracks.has(deletedInboundTrackId)) {
|
|
35
|
-
logger.warn(`Updated InboundVideoTrack held an inboundVideoTrackId for deletedInboundVideoTracks. Transaction ${transaction.id}`);
|
|
36
|
-
updatedInboundVideoTracks.delete(deletedInboundTrackId);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
for (const deletedOutboundTrackId of deletedOutboundAudioTracks) {
|
|
40
|
-
if (updatedOutboundAudioTracks.has(deletedOutboundTrackId)) {
|
|
41
|
-
logger.warn(`Updated OutboundAudioTrack held an outboundAudioTrackId for deletedOutboundAudioTracks. Transaction ${transaction.id}`);
|
|
42
|
-
updatedOutboundAudioTracks.delete(deletedOutboundTrackId);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
for (const deletedOutboundTrackId of deletedOutboundVideoTracks) {
|
|
46
|
-
if (updatedOutboundVideoTracks.has(deletedOutboundTrackId)) {
|
|
47
|
-
logger.warn(`Updated OutboundVideoTrack held an outboundVideoTrackId for deletedOutboundVideoTracks. Transaction ${transaction.id}`);
|
|
48
|
-
updatedOutboundVideoTracks.delete(deletedOutboundTrackId);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
for (const deletedSfuId of deletedSfus) {
|
|
52
|
-
if (updatedSfus.has(deletedSfuId)) {
|
|
53
|
-
logger.warn(`Updated Sfu held an sfuId for deletedSfus. Transaction ${transaction.id}`);
|
|
54
|
-
updatedSfus.delete(deletedSfuId);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
for (const deletedSfuTransportId of deletedSfuTransports) {
|
|
58
|
-
if (updatedSfuTransports.has(deletedSfuTransportId)) {
|
|
59
|
-
logger.warn(`Updated SfuTransport held an sfuTransportId for deletedSfuTransports. Transaction ${transaction.id}`);
|
|
60
|
-
updatedSfuTransports.delete(deletedSfuTransportId);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
for (const deletedSfuInboundRtpPadId of deletedSfuInboundRtpPads) {
|
|
64
|
-
if (updatedSfuInboundRtpPads.has(deletedSfuInboundRtpPadId)) {
|
|
65
|
-
logger.warn(`Updated SfuInboundRtpPad held an updatedSfuInboundRtpPadId for deletedSfuInboundRtpPads. Transaction ${transaction.id}`);
|
|
66
|
-
updatedSfuInboundRtpPads.delete(deletedSfuInboundRtpPadId);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
for (const deletedSfuOutboundRtpPadId of deletedSfuOutboundRtpPads) {
|
|
70
|
-
if (updatedSfuOutboundRtpPads.has(deletedSfuOutboundRtpPadId)) {
|
|
71
|
-
logger.warn(`Updated SfuOutboundRtpPad held an updatedSfuOutboundRtpPadId for deletedSfuOutboundRtpPads. Transaction ${transaction.id}`);
|
|
72
|
-
updatedSfuOutboundRtpPads.delete(deletedSfuOutboundRtpPadId);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
for (const deletedSfuSctpChannelId of deletedSfuSctpChannels) {
|
|
76
|
-
if (updatedSfuSctpChannels.has(deletedSfuSctpChannelId)) {
|
|
77
|
-
logger.warn(`Updated SfuSctpChannelId held an deletedSfuSctpChannelId for deletedSfuSctpChannels. Transaction ${transaction.id}`);
|
|
78
|
-
updatedSfuSctpChannels.delete(deletedSfuSctpChannelId);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const promiseSetAll = (storage, input) => {
|
|
82
|
-
if (0 < input.size) {
|
|
83
|
-
return storage.setAll(input);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
return Promise.resolve(emptyMap);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
const promiseRemoveAll = (storage, input) => {
|
|
90
|
-
if (0 < input.size) {
|
|
91
|
-
return storage.removeAll(input);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
return Promise.resolve(emptyMap);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const [[
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
99
|
-
oldClientModels, oldPeerConnectionModels, oldInboundAudioTrackModels, oldInboundVideoTrackModels, oldOutboundAudioTrackModels, oldOutboundVideoTrackModels,], [removedPeerConnectionModels, removedInboundAudioTrackModels, removedInboundVideoTrackModels, removedOutboundAudioTrackModels, removedOutboundVideoTrackModels,], [oldSfuModels, oldSfuTransportModels, oldSfuInboundRtpPadModels, oldSfuOutboundRtpPadModels, oldSfuSctpChannelModels,], [removedSfuModels, removedSfuTransportModels, removedSfuInboundRtpPadModels, removedSfuOutboundRtpPadModels, removedSfuSctpChannelModels,],] = yield Promise.all([
|
|
100
|
-
// Call related updates
|
|
101
|
-
Promise.all([
|
|
102
|
-
promiseSetAll(clientStorage, clients),
|
|
103
|
-
promiseSetAll(peerConnectionStorage, updatedPeerConnections),
|
|
104
|
-
promiseSetAll(inboundTrackStorage, updatedInboundAudioTracks),
|
|
105
|
-
promiseSetAll(inboundTrackStorage, updatedInboundVideoTracks),
|
|
106
|
-
promiseSetAll(outboundTrackStorage, updatedOutboundAudioTracks),
|
|
107
|
-
promiseSetAll(outboundTrackStorage, updatedOutboundVideoTracks),
|
|
108
|
-
]),
|
|
109
|
-
Promise.all([
|
|
110
|
-
promiseRemoveAll(peerConnectionStorage, deletedPeerConnections),
|
|
111
|
-
promiseRemoveAll(inboundTrackStorage, deletedInboundAudioTracks),
|
|
112
|
-
promiseRemoveAll(inboundTrackStorage, deletedInboundVideoTracks),
|
|
113
|
-
promiseRemoveAll(outboundTrackStorage, deletedOutboundAudioTracks),
|
|
114
|
-
promiseRemoveAll(outboundTrackStorage, deletedOutboundVideoTracks),
|
|
115
|
-
]),
|
|
116
|
-
// Sfu related updates
|
|
117
|
-
Promise.all([
|
|
118
|
-
promiseSetAll(sfuStorage, updatedSfus),
|
|
119
|
-
promiseSetAll(sfuTransportStorage, updatedSfuTransports),
|
|
120
|
-
promiseSetAll(sfuInboundRtpPadStorage, updatedSfuInboundRtpPads),
|
|
121
|
-
promiseSetAll(sfuOutboundRtpPadStorage, updatedSfuOutboundRtpPads),
|
|
122
|
-
promiseSetAll(sfuSctpChannelStorage, updatedSfuSctpChannels),
|
|
123
|
-
]),
|
|
124
|
-
Promise.all([
|
|
125
|
-
promiseRemoveAll(sfuStorage, deletedSfus),
|
|
126
|
-
promiseRemoveAll(sfuTransportStorage, deletedSfuTransports),
|
|
127
|
-
promiseRemoveAll(sfuInboundRtpPadStorage, deletedSfuInboundRtpPads),
|
|
128
|
-
promiseRemoveAll(sfuOutboundRtpPadStorage, deletedSfuOutboundRtpPads),
|
|
129
|
-
promiseRemoveAll(sfuSctpChannelStorage, deletedSfuSctpChannels),
|
|
130
|
-
]),
|
|
131
|
-
]);
|
|
132
|
-
const removedUnits = (removedModels) => {
|
|
133
|
-
return Array.from(removedModels.values()).map((o) => {
|
|
134
|
-
return Object.assign(Object.assign({}, o), { removed: Date.now() });
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
const addedUnits = (oldItems, updatedItems) => {
|
|
138
|
-
const oldSet = new Set(oldItems.keys());
|
|
139
|
-
return Array.from(updatedItems.keys()).filter((updatedKey) => !oldSet.has(updatedKey));
|
|
140
|
-
};
|
|
141
|
-
evaluatorContext.openedPeerConnectionIds.push(...addedUnits(oldPeerConnectionModels, updatedPeerConnections));
|
|
142
|
-
evaluatorContext.closedPeerConnections.push(...Array.from(removedPeerConnectionModels.values()).map((o) => {
|
|
143
|
-
return Object.assign(Object.assign({}, o), { closed: Date.now() });
|
|
144
|
-
}));
|
|
145
|
-
evaluatorContext.removedInboundAudioTracks.push(...removedUnits(removedInboundAudioTrackModels));
|
|
146
|
-
evaluatorContext.addedInboundAudioTrackIds.push(...addedUnits(oldInboundAudioTrackModels, updatedInboundAudioTracks));
|
|
147
|
-
evaluatorContext.removedInboundVideoTracks.push(...removedUnits(removedInboundVideoTrackModels));
|
|
148
|
-
evaluatorContext.addedInboundVideoTrackIds.push(...addedUnits(oldInboundVideoTrackModels, updatedInboundVideoTracks));
|
|
149
|
-
evaluatorContext.removedOutboundAudioTracks.push(...removedUnits(removedOutboundAudioTrackModels));
|
|
150
|
-
evaluatorContext.addedOutboundAudioTrackIds.push(...addedUnits(oldOutboundAudioTrackModels, updatedOutboundAudioTracks));
|
|
151
|
-
evaluatorContext.removedOutboundVideoTracks.push(...removedUnits(removedOutboundVideoTrackModels));
|
|
152
|
-
evaluatorContext.addedOutboundVideoTrackIds.push(...addedUnits(oldOutboundVideoTrackModels, updatedOutboundVideoTracks));
|
|
153
|
-
evaluatorContext.joinedSfuIds.push(...addedUnits(oldSfuModels, updatedSfus));
|
|
154
|
-
evaluatorContext.detachedSfus.push(...Array.from(removedSfuModels.values()).map((o) => {
|
|
155
|
-
return Object.assign(Object.assign({}, o), { detached: Date.now() });
|
|
156
|
-
}));
|
|
157
|
-
evaluatorContext.openedSfuTransportIds.push(...addedUnits(oldSfuTransportModels, updatedSfuTransports));
|
|
158
|
-
evaluatorContext.closedSfuTransports.push(...Array.from(removedSfuTransportModels.values()).map((o) => {
|
|
159
|
-
return Object.assign(Object.assign({}, o), { closed: Date.now() });
|
|
160
|
-
}));
|
|
161
|
-
evaluatorContext.removedSfuInbounRtpPadIds.push(...removedUnits(removedSfuInboundRtpPadModels));
|
|
162
|
-
evaluatorContext.addedSfuInbounRtpPadIds.push(...addedUnits(oldSfuInboundRtpPadModels, updatedSfuInboundRtpPads));
|
|
163
|
-
evaluatorContext.removedSfuOutbounRtpPadIds.push(...removedUnits(removedSfuOutboundRtpPadModels));
|
|
164
|
-
evaluatorContext.addedSfuOutbounRtpPadIds.push(...addedUnits(oldSfuOutboundRtpPadModels, updatedSfuOutboundRtpPads));
|
|
165
|
-
evaluatorContext.openedSfuSctpChannelIds.push(...addedUnits(oldSfuSctpChannelModels, updatedSfuSctpChannels));
|
|
166
|
-
evaluatorContext.closedSfuSctpChannels.push(...Array.from(removedSfuSctpChannelModels.values()).map((o) => {
|
|
167
|
-
return Object.assign(Object.assign({}, o), { closed: Date.now() });
|
|
168
|
-
}));
|
|
169
|
-
evaluatorContext.callEvents = [...reports.getCallEventReports()];
|
|
170
|
-
evaluatorContext.clientExtensionStats = [...reports.getClientExtensionReports()];
|
|
171
|
-
evaluatorContext.sfuEvents = [...reports.getSfuEventReports()];
|
|
172
|
-
evaluatorContext.sfuExtensionStats = [...reports.getSfuExtensionReports()];
|
|
173
|
-
});
|
|
174
|
-
const result = (context, next) => __awaiter(this, void 0, void 0, function* () {
|
|
175
|
-
yield Promise.all([process(context), next ? next(context) : Promise.resolve()]);
|
|
176
|
-
});
|
|
177
|
-
return result;
|
|
178
|
-
}
|
|
179
|
-
exports.createCommitTransactionMiddleware = createCommitTransactionMiddleware;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Middleware } from './Middleware';
|
|
2
|
-
import { TransactionContext } from './TransactionContext';
|
|
3
|
-
import { StorageProvider } from '..';
|
|
4
|
-
export declare const logger: import("../common/logger").WrappedLogger;
|
|
5
|
-
export declare function createDeleteOutdatedCallEntries(storages: StorageProvider, maxIdleTimeInMs: bigint): Middleware<TransactionContext>;
|
|
6
|
-
//# sourceMappingURL=DeleteOutdatedCallEntries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteOutdatedCallEntries.d.ts","sourceRoot":"","sources":["../../src/middlewares/DeleteOutdatedCallEntries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAErC,eAAO,MAAM,MAAM,0CAA4C,CAAC;AAEhE,wBAAgB,+BAA+B,CAC9C,QAAQ,EAAE,eAAe,EACzB,eAAe,EAAE,MAAM,GACrB,UAAU,CAAC,kBAAkB,CAAC,CAoJhC"}
|