@observertc/observer-js 1.0.1-c3edea3.0 → 1.0.1-eb834f5.0
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 +0 -1
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +12 -20
- package/lib/ObservedCertificate.d.ts +0 -1
- package/lib/ObservedCertificate.d.ts.map +1 -1
- package/lib/ObservedCertificate.js +1 -8
- package/lib/ObservedClient.d.ts +4 -4
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +29 -33
- package/lib/ObservedCodec.js +1 -5
- package/lib/ObservedDataChannel.js +1 -5
- package/lib/ObservedIceCandidate.js +1 -5
- package/lib/ObservedIceCandidatePair.js +1 -5
- package/lib/ObservedIceTransport.js +1 -5
- package/lib/ObservedInboundRtp.js +1 -5
- package/lib/ObservedInboundTrack.js +3 -7
- package/lib/ObservedMediaPlayout.js +1 -5
- package/lib/ObservedMediaSource.js +1 -5
- package/lib/ObservedOutboundRtp.js +1 -5
- package/lib/ObservedOutboundTrack.js +3 -7
- package/lib/ObservedPeerConnection.js +34 -38
- package/lib/ObservedPeerConnectionTransport.js +1 -5
- package/lib/ObservedRemoteInboundRtp.js +1 -5
- package/lib/ObservedRemoteOutboundRtp.js +1 -5
- package/lib/Observer.js +11 -15
- package/lib/common/Middleware.js +1 -5
- package/lib/common/SingleExecutor.js +1 -5
- package/lib/common/logger.js +2 -7
- package/lib/common/types.js +1 -2
- package/lib/common/utils.js +5 -13
- package/lib/detectors/Detector.js +1 -2
- package/lib/detectors/Detectors.js +3 -7
- package/lib/index.js +19 -41
- package/lib/schema/ClientSample.js +1 -4
- package/lib/schema/eventTypes.js +2 -5
- package/lib/schema/metaTypes.js +2 -5
- package/lib/scores/CalculatedScore.js +1 -2
- package/lib/scores/DefaultCallScoreCalculator.js +1 -5
- package/lib/scores/ScoreCalculator.js +1 -2
- package/lib/utils/CallUpdater.js +1 -2
- package/lib/utils/OnAllClientCallUpdater.js +1 -5
- package/lib/utils/RemoteTrackResolver.js +1 -2
- package/lib/utils/onAnyClientCallUpdater.js +1 -5
- package/package.json +1 -1
- package/src/ObservedCall.ts +1 -7
- package/src/ObservedCertificate.ts +0 -4
- package/src/ObservedClient.ts +6 -6
- package/tsconfig.json +3 -3
package/lib/ObservedCall.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedCall.d.ts","sourceRoot":"","sources":["../src/ObservedCall.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlD,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACrG,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wBAAwB,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC;IACnD,iBAAiB,CAAC,EAAE,mBAAmB,GAAG,oBAAoB,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAChC,MAAM,EAAE,EAAE,CAAC;IACX,SAAS,EAAE,CAAC,cAAc,CAAC,CAAC;IAC5B,KAAK,EAAE,EAAE,CAAC;IACV,
|
|
1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,GAAG,cAAc,CAAC,aAAa,CAAC,GAAG,SAAS;IAMvJ,oBAAoB,CAAC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,sBAAsB,CAAC,aAAa,CAAC,GAAG,cAAc,CAAC,aAAa,CAAC;IAwB7K,MAAM;CAMb"}
|
package/lib/ObservedCall.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const OnAllClientCallUpdater_1 = require("./utils/OnAllClientCallUpdater");
|
|
9
|
-
const onAnyClientCallUpdater_1 = require("./utils/onAnyClientCallUpdater");
|
|
10
|
-
class ObservedCall extends events_1.EventEmitter {
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { ObservedClient } from './ObservedClient';
|
|
3
|
+
import { DefaultCallScoreCalculator } from './scores/DefaultCallScoreCalculator';
|
|
4
|
+
import { Detectors } from './detectors/Detectors';
|
|
5
|
+
import { OnAllClientCallUpdater } from './utils/OnAllClientCallUpdater';
|
|
6
|
+
import { OnAnyClientCallUpdater } from './utils/onAnyClientCallUpdater';
|
|
7
|
+
export class ObservedCall extends EventEmitter {
|
|
11
8
|
observer;
|
|
12
9
|
detectors;
|
|
13
10
|
callId;
|
|
@@ -29,14 +26,14 @@ class ObservedCall extends events_1.EventEmitter {
|
|
|
29
26
|
this.setMaxListeners(Infinity);
|
|
30
27
|
this.callId = settings.callId;
|
|
31
28
|
this.appData = settings.appData;
|
|
32
|
-
this.scoreCalculator = new
|
|
33
|
-
this.detectors = new
|
|
29
|
+
this.scoreCalculator = new DefaultCallScoreCalculator(this);
|
|
30
|
+
this.detectors = new Detectors();
|
|
34
31
|
switch (settings.callUpdaterPolicy) {
|
|
35
32
|
case 'onAllClientsUpdate':
|
|
36
|
-
this.callUpdater = new
|
|
33
|
+
this.callUpdater = new OnAllClientCallUpdater(this);
|
|
37
34
|
break;
|
|
38
35
|
case 'onAnyClientUpdate':
|
|
39
|
-
this.callUpdater = new
|
|
36
|
+
this.callUpdater = new OnAnyClientCallUpdater(this);
|
|
40
37
|
break;
|
|
41
38
|
}
|
|
42
39
|
switch (settings.remoteTrackResolvePolicy) {
|
|
@@ -64,8 +61,7 @@ class ObservedCall extends events_1.EventEmitter {
|
|
|
64
61
|
throw new Error(`Call ${this.callId} is closed`);
|
|
65
62
|
if (this.observedClients.has(settings.clientId))
|
|
66
63
|
throw new Error(`Client with id ${settings.clientId} already exists`);
|
|
67
|
-
const result = new
|
|
68
|
-
const wasEmpty = this.observedClients.size === 0;
|
|
64
|
+
const result = new ObservedClient(settings, this);
|
|
69
65
|
const onUpdate = () => this.callUpdater?.onClientUpdate(result);
|
|
70
66
|
result.once('close', () => {
|
|
71
67
|
result.off('update', onUpdate);
|
|
@@ -77,9 +73,6 @@ class ObservedCall extends events_1.EventEmitter {
|
|
|
77
73
|
result.on('update', onUpdate);
|
|
78
74
|
this.observedClients.set(settings.clientId, result);
|
|
79
75
|
this.emit('newclient', result);
|
|
80
|
-
if (wasEmpty) {
|
|
81
|
-
this.emit('not-empty');
|
|
82
|
-
}
|
|
83
76
|
return result;
|
|
84
77
|
}
|
|
85
78
|
update() {
|
|
@@ -88,4 +81,3 @@ class ObservedCall extends events_1.EventEmitter {
|
|
|
88
81
|
this.emit('update');
|
|
89
82
|
}
|
|
90
83
|
}
|
|
91
|
-
exports.ObservedCall = ObservedCall;
|
|
@@ -13,7 +13,6 @@ export declare class ObservedCertificate implements CertificateStats {
|
|
|
13
13
|
attachments?: Record<string, unknown>;
|
|
14
14
|
constructor(timestamp: number, id: string, _peerConnection: ObservedPeerConnection);
|
|
15
15
|
get visited(): boolean;
|
|
16
|
-
getPeerConnection(): ObservedPeerConnection;
|
|
17
16
|
update(stats: CertificateStats): void;
|
|
18
17
|
}
|
|
19
18
|
//# sourceMappingURL=ObservedCertificate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedCertificate.d.ts","sourceRoot":"","sources":["../src/ObservedCertificate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,qBAAa,mBAAoB,YAAW,gBAAgB;IAYnD,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAb1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC,OAAO,CAAC,QAAQ,CAAS;IAEzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAG9B,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACA,eAAe,EAAE,sBAAsB;IAGzD,IAAW,OAAO,YAMjB;IAEM,
|
|
1
|
+
{"version":3,"file":"ObservedCertificate.d.ts","sourceRoot":"","sources":["../src/ObservedCertificate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,qBAAa,mBAAoB,YAAW,gBAAgB;IAYnD,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAb1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC,OAAO,CAAC,QAAQ,CAAS;IAEzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAG9B,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACA,eAAe,EAAE,sBAAsB;IAGzD,IAAW,OAAO,YAMjB;IAEM,MAAM,CAAC,KAAK,EAAE,gBAAgB;CAUrC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedCertificate = void 0;
|
|
4
|
-
class ObservedCertificate {
|
|
1
|
+
export class ObservedCertificate {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
_peerConnection;
|
|
@@ -22,9 +19,6 @@ class ObservedCertificate {
|
|
|
22
19
|
this._visited = false;
|
|
23
20
|
return visited;
|
|
24
21
|
}
|
|
25
|
-
getPeerConnection() {
|
|
26
|
-
return this._peerConnection;
|
|
27
|
-
}
|
|
28
22
|
update(stats) {
|
|
29
23
|
this._visited = true;
|
|
30
24
|
this.timestamp = stats.timestamp;
|
|
@@ -35,4 +29,3 @@ class ObservedCertificate {
|
|
|
35
29
|
this.attachments = stats.attachments;
|
|
36
30
|
}
|
|
37
31
|
}
|
|
38
|
-
exports.ObservedCertificate = ObservedCertificate;
|
package/lib/ObservedClient.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
4
|
-
import {
|
|
4
|
+
import { ClientSample, ClientIssue } from './schema/ClientSample';
|
|
5
5
|
import * as MetaData from './schema/metaTypes';
|
|
6
6
|
import { ObservedCall } from './ObservedCall';
|
|
7
7
|
import { CalculatedScore } from './scores/CalculatedScore';
|
|
@@ -64,9 +64,9 @@ export declare class ObservedClient<AppData extends Record<string, unknown> = Re
|
|
|
64
64
|
close(): void;
|
|
65
65
|
accept(sample: ClientSample): void;
|
|
66
66
|
private _processClientEvent;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
private _processMetaData;
|
|
68
|
+
private _processIssue;
|
|
69
|
+
private _processExtensionStats;
|
|
70
70
|
private _updatePeerConnection;
|
|
71
71
|
}
|
|
72
72
|
//# sourceMappingURL=ObservedClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedClient.d.ts","sourceRoot":"","sources":["../src/ObservedClient.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,
|
|
1
|
+
{"version":3,"file":"ObservedClient.d.ts","sourceRoot":"","sources":["../src/ObservedClient.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAA+B,YAAY,EAAwB,WAAW,EAAiB,MAAM,uBAAuB,CAAC;AACpI,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,MAAM,MAAM,sBAAsB,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACvG,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CA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B;IA2BxB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,qBAAqB;CAqB7B"}
|
package/lib/ObservedClient.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const Detectors_1 = require("./detectors/Detectors");
|
|
11
|
-
const logger = (0, logger_1.createLogger)('ObservedClient');
|
|
12
|
-
class ObservedClient extends events_1.EventEmitter {
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
3
|
+
import { createLogger } from './common/logger';
|
|
4
|
+
import { ClientEventType } from './schema/eventTypes';
|
|
5
|
+
import { ClientMetaType } from './schema/metaTypes';
|
|
6
|
+
import { parseJsonAs } from './common/utils';
|
|
7
|
+
import { Detectors } from './detectors/Detectors';
|
|
8
|
+
const logger = createLogger('ObservedClient');
|
|
9
|
+
export class ObservedClient extends EventEmitter {
|
|
13
10
|
call;
|
|
14
11
|
detectors;
|
|
15
12
|
clientId;
|
|
@@ -67,7 +64,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
67
64
|
this.setMaxListeners(Infinity);
|
|
68
65
|
this.clientId = settings.clientId;
|
|
69
66
|
this.appData = settings.appData;
|
|
70
|
-
this.detectors = new
|
|
67
|
+
this.detectors = new Detectors();
|
|
71
68
|
}
|
|
72
69
|
get score() {
|
|
73
70
|
return this.calculatedScore.value;
|
|
@@ -84,10 +81,10 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
84
81
|
throw new Error(`Client ${this.clientId} is closed`);
|
|
85
82
|
const now = Date.now();
|
|
86
83
|
sample.clientEvents?.forEach(this._processClientEvent.bind(this));
|
|
87
|
-
sample.clientMetaItems?.forEach(this.
|
|
88
|
-
sample.clientIssues?.forEach(this.
|
|
84
|
+
sample.clientMetaItems?.forEach(this._processMetaData.bind(this));
|
|
85
|
+
sample.clientIssues?.forEach(this._processIssue.bind(this));
|
|
89
86
|
sample.peerConnections?.forEach(this._updatePeerConnection.bind(this));
|
|
90
|
-
sample.extensionStats?.forEach(this.
|
|
87
|
+
sample.extensionStats?.forEach(this._processExtensionStats.bind(this));
|
|
91
88
|
// emit new attachments?
|
|
92
89
|
this.attachments = sample.attachments;
|
|
93
90
|
this.calculatedScore.value = sample.score;
|
|
@@ -101,15 +98,15 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
101
98
|
}
|
|
102
99
|
_processClientEvent(event) {
|
|
103
100
|
switch (event.type) {
|
|
104
|
-
case
|
|
101
|
+
case ClientEventType.CALL_STARTED: {
|
|
105
102
|
// update call timestamp if it's the first time
|
|
106
103
|
break;
|
|
107
104
|
}
|
|
108
|
-
case
|
|
105
|
+
case ClientEventType.CALL_ENDED: {
|
|
109
106
|
// update call timestamp if it's the first time
|
|
110
107
|
break;
|
|
111
108
|
}
|
|
112
|
-
case
|
|
109
|
+
case ClientEventType.CLIENT_JOINED: {
|
|
113
110
|
if (event.timestamp) {
|
|
114
111
|
if (!this.joinedAt) {
|
|
115
112
|
this.joinedAt = event.timestamp;
|
|
@@ -125,7 +122,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
125
122
|
}
|
|
126
123
|
break;
|
|
127
124
|
}
|
|
128
|
-
case
|
|
125
|
+
case ClientEventType.CLIENT_LEFT: {
|
|
129
126
|
if (event.timestamp) {
|
|
130
127
|
if (!this.leftAt) {
|
|
131
128
|
this.leftAt = event.timestamp;
|
|
@@ -141,22 +138,22 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
141
138
|
data: event,
|
|
142
139
|
});
|
|
143
140
|
}
|
|
144
|
-
|
|
141
|
+
_processMetaData(metadata) {
|
|
145
142
|
switch (metadata.type) {
|
|
146
|
-
case
|
|
147
|
-
this.browser =
|
|
143
|
+
case ClientMetaType.BROWSER: {
|
|
144
|
+
this.browser = parseJsonAs(metadata.payload);
|
|
148
145
|
break;
|
|
149
146
|
}
|
|
150
|
-
case
|
|
151
|
-
this.engine =
|
|
147
|
+
case ClientMetaType.ENGINE: {
|
|
148
|
+
this.engine = parseJsonAs(metadata.payload);
|
|
152
149
|
break;
|
|
153
150
|
}
|
|
154
|
-
case
|
|
155
|
-
this.platform =
|
|
151
|
+
case ClientMetaType.PLATFORM: {
|
|
152
|
+
this.platform = parseJsonAs(metadata.payload);
|
|
156
153
|
break;
|
|
157
154
|
}
|
|
158
|
-
case
|
|
159
|
-
this.operationSystem =
|
|
155
|
+
case ClientMetaType.OPERATION_SYSTEM: {
|
|
156
|
+
this.operationSystem = parseJsonAs(metadata.payload);
|
|
160
157
|
break;
|
|
161
158
|
}
|
|
162
159
|
}
|
|
@@ -166,14 +163,14 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
166
163
|
data: metadata,
|
|
167
164
|
});
|
|
168
165
|
}
|
|
169
|
-
|
|
166
|
+
_processIssue(issue) {
|
|
170
167
|
this.call.observer.processors.issues.process({
|
|
171
168
|
call: this.call,
|
|
172
169
|
client: this,
|
|
173
170
|
data: issue,
|
|
174
171
|
});
|
|
175
172
|
}
|
|
176
|
-
|
|
173
|
+
_processExtensionStats(stats) {
|
|
177
174
|
this.call.observer.processors.extensionStats.process({
|
|
178
175
|
call: this.call,
|
|
179
176
|
client: this,
|
|
@@ -186,7 +183,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
186
183
|
if (!sample.peerConnectionId) {
|
|
187
184
|
return logger.warn(`ObservedClient received an invalid PeerConnectionSample (missing peerConnectionId field). ClientId: ${this.clientId}, CallId: ${this.call.callId}`, sample);
|
|
188
185
|
}
|
|
189
|
-
observedPeerConnection = new
|
|
186
|
+
observedPeerConnection = new ObservedPeerConnection(sample.peerConnectionId, this);
|
|
190
187
|
observedPeerConnection.once('close', () => {
|
|
191
188
|
this.observedPeerConnections.delete(sample.peerConnectionId);
|
|
192
189
|
});
|
|
@@ -195,4 +192,3 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
195
192
|
observedPeerConnection.accept(sample);
|
|
196
193
|
}
|
|
197
194
|
}
|
|
198
|
-
exports.ObservedClient = ObservedClient;
|
package/lib/ObservedCodec.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedCodec = void 0;
|
|
4
|
-
class ObservedCodec {
|
|
1
|
+
export class ObservedCodec {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
mimeType;
|
|
@@ -42,4 +39,3 @@ class ObservedCodec {
|
|
|
42
39
|
this.attachments = stats.attachments;
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
exports.ObservedCodec = ObservedCodec;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedDataChannel = void 0;
|
|
4
|
-
class ObservedDataChannel {
|
|
1
|
+
export class ObservedDataChannel {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
_peerConnection;
|
|
@@ -42,4 +39,3 @@ class ObservedDataChannel {
|
|
|
42
39
|
this.attachments = stats.attachments;
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
exports.ObservedDataChannel = ObservedDataChannel;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedIceCandidate = void 0;
|
|
4
|
-
class ObservedIceCandidate {
|
|
1
|
+
export class ObservedIceCandidate {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
_peerConnection;
|
|
@@ -56,4 +53,3 @@ class ObservedIceCandidate {
|
|
|
56
53
|
this.attachments = stats.attachments;
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
exports.ObservedIceCandidate = ObservedIceCandidate;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedIceCandidatePair = void 0;
|
|
4
|
-
class ObservedIceCandidatePair {
|
|
1
|
+
export class ObservedIceCandidatePair {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
_peerConnection;
|
|
@@ -80,4 +77,3 @@ class ObservedIceCandidatePair {
|
|
|
80
77
|
this.attachments = stats.attachments;
|
|
81
78
|
}
|
|
82
79
|
}
|
|
83
|
-
exports.ObservedIceCandidatePair = ObservedIceCandidatePair;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedIceTransport = void 0;
|
|
4
|
-
class ObservedIceTransport {
|
|
1
|
+
export class ObservedIceTransport {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
_peerConnection;
|
|
@@ -62,4 +59,3 @@ class ObservedIceTransport {
|
|
|
62
59
|
this.attachments = stats.attachments;
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
|
-
exports.ObservedIceTransport = ObservedIceTransport;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedInboundRtp = void 0;
|
|
4
|
-
class ObservedInboundRtp {
|
|
1
|
+
export class ObservedInboundRtp {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
ssrc;
|
|
@@ -190,4 +187,3 @@ class ObservedInboundRtp {
|
|
|
190
187
|
this.concealmentEvents = stats.concealmentEvents;
|
|
191
188
|
}
|
|
192
189
|
}
|
|
193
|
-
exports.ObservedInboundRtp = ObservedInboundRtp;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ObservedInboundTrack = void 0;
|
|
4
|
-
const Detectors_1 = require("./detectors/Detectors");
|
|
5
|
-
class ObservedInboundTrack {
|
|
1
|
+
import { Detectors } from './detectors/Detectors';
|
|
2
|
+
export class ObservedInboundTrack {
|
|
6
3
|
timestamp;
|
|
7
4
|
id;
|
|
8
5
|
kind;
|
|
@@ -24,7 +21,7 @@ class ObservedInboundTrack {
|
|
|
24
21
|
this._peerConnection = _peerConnection;
|
|
25
22
|
this._inboundRtp = _inboundRtp;
|
|
26
23
|
this._mediaPlayout = _mediaPlayout;
|
|
27
|
-
this.detectors = new
|
|
24
|
+
this.detectors = new Detectors();
|
|
28
25
|
}
|
|
29
26
|
get score() {
|
|
30
27
|
return this.calculatedScore.value;
|
|
@@ -54,4 +51,3 @@ class ObservedInboundTrack {
|
|
|
54
51
|
this.detectors.update();
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
|
-
exports.ObservedInboundTrack = ObservedInboundTrack;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedMediaPlayout = void 0;
|
|
4
|
-
class ObservedMediaPlayout {
|
|
1
|
+
export class ObservedMediaPlayout {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
kind;
|
|
@@ -39,4 +36,3 @@ class ObservedMediaPlayout {
|
|
|
39
36
|
this.attachments = stats.attachments;
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
|
-
exports.ObservedMediaPlayout = ObservedMediaPlayout;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedMediaSource = void 0;
|
|
4
|
-
class ObservedMediaSource {
|
|
1
|
+
export class ObservedMediaSource {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
kind;
|
|
@@ -52,4 +49,3 @@ class ObservedMediaSource {
|
|
|
52
49
|
this.attachments = stats.attachments;
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
|
-
exports.ObservedMediaSource = ObservedMediaSource;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedOutboundRtp = void 0;
|
|
4
|
-
class ObservedOutboundRtp {
|
|
1
|
+
export class ObservedOutboundRtp {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
ssrc;
|
|
@@ -141,4 +138,3 @@ class ObservedOutboundRtp {
|
|
|
141
138
|
this.attachments = stats.attachments;
|
|
142
139
|
}
|
|
143
140
|
}
|
|
144
|
-
exports.ObservedOutboundRtp = ObservedOutboundRtp;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ObservedOutboundTrack = void 0;
|
|
4
|
-
const Detectors_1 = require("./detectors/Detectors");
|
|
5
|
-
class ObservedOutboundTrack {
|
|
1
|
+
import { Detectors } from './detectors/Detectors';
|
|
2
|
+
export class ObservedOutboundTrack {
|
|
6
3
|
timestamp;
|
|
7
4
|
id;
|
|
8
5
|
kind;
|
|
@@ -24,7 +21,7 @@ class ObservedOutboundTrack {
|
|
|
24
21
|
this._peerConnection = _peerConnection;
|
|
25
22
|
this._outboundRtps = _outboundRtps;
|
|
26
23
|
this._mediaSource = _mediaSource;
|
|
27
|
-
this.detectors = new
|
|
24
|
+
this.detectors = new Detectors();
|
|
28
25
|
}
|
|
29
26
|
get score() {
|
|
30
27
|
return this.calculatedScore.value;
|
|
@@ -54,4 +51,3 @@ class ObservedOutboundTrack {
|
|
|
54
51
|
this.detectors.update();
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
|
-
exports.ObservedOutboundTrack = ObservedOutboundTrack;
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const ObservedOutboundTrack_1 = require("./ObservedOutboundTrack");
|
|
21
|
-
const logger = (0, logger_1.createLogger)('ObservedPeerConnection');
|
|
22
|
-
class ObservedPeerConnection extends events_1.EventEmitter {
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { ObservedInboundRtp } from './ObservedInboundRtp';
|
|
3
|
+
import { createLogger } from './common/logger';
|
|
4
|
+
import { ObservedOutboundRtp } from './ObservedOutboundRtp';
|
|
5
|
+
import { ObservedCertificate } from './ObservedCertificate';
|
|
6
|
+
import { ObservedCodec } from './ObservedCodec';
|
|
7
|
+
import { ObservedDataChannel } from './ObservedDataChannel';
|
|
8
|
+
import { ObservedIceCandidate } from './ObservedIceCandidate';
|
|
9
|
+
import { ObservedIceCandidatePair } from './ObservedIceCandidatePair';
|
|
10
|
+
import { ObservedIceTransport } from './ObservedIceTransport';
|
|
11
|
+
import { ObservedMediaSource } from './ObservedMediaSource';
|
|
12
|
+
import { ObservedPeerConnectionTransport } from './ObservedPeerConnectionTransport';
|
|
13
|
+
import { ObservedMediaPlayout } from './ObservedMediaPlayout';
|
|
14
|
+
import { ObservedRemoteInboundRtp } from './ObservedRemoteInboundRtp';
|
|
15
|
+
import { ObservedRemoteOutboundRtp } from './ObservedRemoteOutboundRtp';
|
|
16
|
+
import { ObservedInboundTrack } from './ObservedInboundTrack';
|
|
17
|
+
import { ObservedOutboundTrack } from './ObservedOutboundTrack';
|
|
18
|
+
const logger = createLogger('ObservedPeerConnection');
|
|
19
|
+
export class ObservedPeerConnection extends EventEmitter {
|
|
23
20
|
peerConnectionId;
|
|
24
21
|
client;
|
|
25
22
|
_visited = true;
|
|
@@ -419,7 +416,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
419
416
|
if (!stats.timestamp || !stats.id || !stats.fingerprint) {
|
|
420
417
|
return logger.warn(`ObservedPeerConnection received an invalid CertificateStats (missing timestamp OR id OR fingerprint field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
421
418
|
}
|
|
422
|
-
observedCertificate = new
|
|
419
|
+
observedCertificate = new ObservedCertificate(stats.timestamp, stats.id, this);
|
|
423
420
|
this.observedCertificates.set(stats.id, observedCertificate);
|
|
424
421
|
this.emit('added-certificate', observedCertificate);
|
|
425
422
|
}
|
|
@@ -432,7 +429,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
432
429
|
if (!stats.timestamp || !stats.id || !stats.mimeType) {
|
|
433
430
|
return logger.warn(`ObservedPeerConnection received an invalid CodecStats (missing timestamp OR id OR mimeType field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
434
431
|
}
|
|
435
|
-
observedCodec = new
|
|
432
|
+
observedCodec = new ObservedCodec(stats.timestamp, stats.id, stats.mimeType, this);
|
|
436
433
|
this.observedCodecs.set(stats.id, observedCodec);
|
|
437
434
|
this.emit('added-codec', observedCodec);
|
|
438
435
|
}
|
|
@@ -445,7 +442,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
445
442
|
if (!stats.timestamp || !stats.id) {
|
|
446
443
|
return logger.warn(`ObservedPeerConnection received an invalid DataChannelStats (missing timestamp OR id field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
447
444
|
}
|
|
448
|
-
observedDataChannel = new
|
|
445
|
+
observedDataChannel = new ObservedDataChannel(stats.timestamp, stats.id, this);
|
|
449
446
|
this.observedDataChannels.set(stats.id, observedDataChannel);
|
|
450
447
|
this.emit('added-data-channel', observedDataChannel);
|
|
451
448
|
}
|
|
@@ -458,7 +455,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
458
455
|
if (!stats.timestamp || !stats.id) {
|
|
459
456
|
return logger.warn(`ObservedPeerConnection received an invalid IceCandidateStats (missing timestamp OR id field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
460
457
|
}
|
|
461
|
-
observedIceCandidate = new
|
|
458
|
+
observedIceCandidate = new ObservedIceCandidate(stats.timestamp, stats.id, this);
|
|
462
459
|
this.observedIceCandidates.set(stats.id, observedIceCandidate);
|
|
463
460
|
this.emit('added-ice-candidate', observedIceCandidate);
|
|
464
461
|
}
|
|
@@ -471,7 +468,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
471
468
|
if (!stats.timestamp || !stats.id) {
|
|
472
469
|
return logger.warn(`ObservedPeerConnection received an invalid IceCandidateStats (missing timestamp OR id field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
473
470
|
}
|
|
474
|
-
observedIceCandidatePair = new
|
|
471
|
+
observedIceCandidatePair = new ObservedIceCandidatePair(stats.timestamp, stats.id, this);
|
|
475
472
|
this.observedIceCandidatesPair.set(stats.id, observedIceCandidatePair);
|
|
476
473
|
this.emit('added-ice-candidate-pair', observedIceCandidatePair);
|
|
477
474
|
}
|
|
@@ -484,7 +481,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
484
481
|
if (!stats.timestamp || !stats.id) {
|
|
485
482
|
return logger.warn(`ObservedPeerConnection received an invalid IceCandidateStats (missing timestamp OR id field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
486
483
|
}
|
|
487
|
-
observedIceTransport = new
|
|
484
|
+
observedIceTransport = new ObservedIceTransport(stats.timestamp, stats.id, this);
|
|
488
485
|
this.observedIceTransports.set(stats.id, observedIceTransport);
|
|
489
486
|
this.emit('added-ice-transport', observedIceTransport);
|
|
490
487
|
}
|
|
@@ -497,7 +494,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
497
494
|
if (!stats.timestamp || !stats.id || !stats.ssrc || !stats.kind || !stats.trackIdentifier) {
|
|
498
495
|
return logger.warn(`ObservedPeerConnection received an invalid InboundRtpStats (missing timestamp OR id OR ssrc OR kind OR trackIdentifier field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
499
496
|
}
|
|
500
|
-
observedInboundRtp = new
|
|
497
|
+
observedInboundRtp = new ObservedInboundRtp(stats.timestamp, stats.id, stats.ssrc, stats.kind, stats.trackIdentifier, this);
|
|
501
498
|
this.observedInboundRtps.set(stats.ssrc, observedInboundRtp);
|
|
502
499
|
this.emit('added-inbound-rtp', observedInboundRtp);
|
|
503
500
|
}
|
|
@@ -513,7 +510,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
513
510
|
const inboundRtp = [...this.observedInboundRtps.values()].find((inbRtp) => inbRtp.trackIdentifier === stats.id);
|
|
514
511
|
const mediaPlayout = inboundRtp ?
|
|
515
512
|
[...this.observedMediaPlayouts.values()].find((mp) => mp.id === inboundRtp.playoutId) : undefined;
|
|
516
|
-
observedInboundTrack = new
|
|
513
|
+
observedInboundTrack = new ObservedInboundTrack(stats.timestamp, stats.id, stats.kind, this, inboundRtp, mediaPlayout);
|
|
517
514
|
this.observedInboundTracks.set(stats.id, observedInboundTrack);
|
|
518
515
|
this.emit('added-inbound-track', observedInboundTrack);
|
|
519
516
|
}
|
|
@@ -526,7 +523,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
526
523
|
if (!stats.timestamp || !stats.id || !stats.kind) {
|
|
527
524
|
return logger.warn(`ObservedPeerConnection received an invalid InboundRtpStats (missing timestamp OR id OR kind OR trackIdentifier field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
528
525
|
}
|
|
529
|
-
observedMediaPlayout = new
|
|
526
|
+
observedMediaPlayout = new ObservedMediaPlayout(stats.timestamp, stats.id, stats.kind, this);
|
|
530
527
|
this.observedMediaPlayouts.set(stats.id, observedMediaPlayout);
|
|
531
528
|
this.emit('added-media-playout', observedMediaPlayout);
|
|
532
529
|
}
|
|
@@ -539,7 +536,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
539
536
|
if (!stats.timestamp || !stats.id || !stats.kind) {
|
|
540
537
|
return logger.warn(`ObservedPeerConnection received an invalid InboundRtpStats (missing timestamp OR id OR kind field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
541
538
|
}
|
|
542
|
-
observedMediaSource = new
|
|
539
|
+
observedMediaSource = new ObservedMediaSource(stats.timestamp, stats.id, stats.kind, this);
|
|
543
540
|
this.observedMediaSources.set(stats.id, observedMediaSource);
|
|
544
541
|
this.emit('added-media-source', observedMediaSource);
|
|
545
542
|
}
|
|
@@ -552,7 +549,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
552
549
|
if (!stats.timestamp || !stats.id || !stats.ssrc || !stats.kind) {
|
|
553
550
|
return logger.warn(`ObservedPeerConnection received an invalid OutboundRtpStats (missing timestamp OR id OR ssrc OR kind field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
554
551
|
}
|
|
555
|
-
observedOutboundRtp = new
|
|
552
|
+
observedOutboundRtp = new ObservedOutboundRtp(stats.timestamp, stats.id, stats.ssrc, stats.kind, this);
|
|
556
553
|
this.observedOutboundRtps.set(stats.ssrc, observedOutboundRtp);
|
|
557
554
|
this.emit('added-outbound-rtp', observedOutboundRtp);
|
|
558
555
|
}
|
|
@@ -568,7 +565,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
568
565
|
const observedMediaSource = [...this.observedMediaSources.values()].find((mediaSource) => mediaSource.trackIdentifier === stats.id);
|
|
569
566
|
const outboundRtps = observedMediaSource
|
|
570
567
|
? [...this.observedOutboundRtps.values()].filter((outboundRtp) => outboundRtp.mediaSourceId === observedMediaSource?.id) : undefined;
|
|
571
|
-
observedOutboundTrack = new
|
|
568
|
+
observedOutboundTrack = new ObservedOutboundTrack(stats.timestamp, stats.id, stats.kind, this, outboundRtps, observedMediaSource);
|
|
572
569
|
this.observedOutboundTracks.set(stats.id, observedOutboundTrack);
|
|
573
570
|
this.emit('added-outbound-track', observedOutboundTrack);
|
|
574
571
|
}
|
|
@@ -581,7 +578,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
581
578
|
if (!stats.timestamp || !stats.id) {
|
|
582
579
|
return logger.warn(`ObservedPeerConnection received an invalid PeerConnectionTransportStats (missing timestamp OR id field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
583
580
|
}
|
|
584
|
-
observedPeerConnectionTransport = new
|
|
581
|
+
observedPeerConnectionTransport = new ObservedPeerConnectionTransport(stats.timestamp, stats.id, this);
|
|
585
582
|
this.observedPeerConnectionTransports.set(stats.id, observedPeerConnectionTransport);
|
|
586
583
|
this.emit('added-peer-connection-transport', observedPeerConnectionTransport);
|
|
587
584
|
}
|
|
@@ -594,7 +591,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
594
591
|
if (!stats.timestamp || !stats.id || !stats.ssrc || !stats.kind) {
|
|
595
592
|
return logger.warn(`ObservedPeerConnection received an invalid RemoteInboundRtpStats (missing timestamp OR id OR ssrc OR kind field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
596
593
|
}
|
|
597
|
-
observedRemoteInboundRtp = new
|
|
594
|
+
observedRemoteInboundRtp = new ObservedRemoteInboundRtp(stats.timestamp, stats.id, stats.ssrc, stats.kind, this);
|
|
598
595
|
this.observedRemoteInboundRtps.set(stats.ssrc, observedRemoteInboundRtp);
|
|
599
596
|
this.emit('added-remote-inbound-rtp', observedRemoteInboundRtp);
|
|
600
597
|
}
|
|
@@ -607,7 +604,7 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
607
604
|
if (!stats.timestamp || !stats.id || !stats.ssrc || !stats.kind) {
|
|
608
605
|
return logger.warn(`ObservedPeerConnection received an invalid RemoteOutboundRtpStats (missing timestamp OR id OR ssrc OR kind field). PeerConnectionId: ${this.peerConnectionId} ClientId: ${this.client.clientId}, CallId: ${this.client.call.callId}`, stats);
|
|
609
606
|
}
|
|
610
|
-
observedRemoteOutboundRtp = new
|
|
607
|
+
observedRemoteOutboundRtp = new ObservedRemoteOutboundRtp(stats.timestamp, stats.id, stats.ssrc, stats.kind, this);
|
|
611
608
|
this.observedRemoteOutboundRtps.set(stats.ssrc, observedRemoteOutboundRtp);
|
|
612
609
|
this.emit('added-remote-outbound-rtp', observedRemoteOutboundRtp);
|
|
613
610
|
}
|
|
@@ -615,4 +612,3 @@ class ObservedPeerConnection extends events_1.EventEmitter {
|
|
|
615
612
|
return observedRemoteOutboundRtp;
|
|
616
613
|
}
|
|
617
614
|
}
|
|
618
|
-
exports.ObservedPeerConnection = ObservedPeerConnection;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedPeerConnectionTransport = void 0;
|
|
4
|
-
class ObservedPeerConnectionTransport {
|
|
1
|
+
export class ObservedPeerConnectionTransport {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
_peerConnection;
|
|
@@ -31,4 +28,3 @@ class ObservedPeerConnectionTransport {
|
|
|
31
28
|
this.attachments = stats.attachments;
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
|
-
exports.ObservedPeerConnectionTransport = ObservedPeerConnectionTransport;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedRemoteInboundRtp = void 0;
|
|
4
|
-
class ObservedRemoteInboundRtp {
|
|
1
|
+
export class ObservedRemoteInboundRtp {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
ssrc;
|
|
@@ -57,4 +54,3 @@ class ObservedRemoteInboundRtp {
|
|
|
57
54
|
this.attachments = stats.attachments;
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
|
-
exports.ObservedRemoteInboundRtp = ObservedRemoteInboundRtp;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservedRemoteOutboundRtp = void 0;
|
|
4
|
-
class ObservedRemoteOutboundRtp {
|
|
1
|
+
export class ObservedRemoteOutboundRtp {
|
|
5
2
|
timestamp;
|
|
6
3
|
id;
|
|
7
4
|
ssrc;
|
|
@@ -57,4 +54,3 @@ class ObservedRemoteOutboundRtp {
|
|
|
57
54
|
this.attachments = stats.attachments;
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
|
-
exports.ObservedRemoteOutboundRtp = ObservedRemoteOutboundRtp;
|
package/lib/Observer.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const events_1 = require("events");
|
|
8
|
-
const logger = (0, logger_1.createLogger)('Observer');
|
|
9
|
-
class Observer extends events_1.EventEmitter {
|
|
1
|
+
import { createLogger } from './common/logger';
|
|
2
|
+
import { MiddlewareProcessor } from './common/Middleware';
|
|
3
|
+
import { ObservedCall } from './ObservedCall';
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
const logger = createLogger('Observer');
|
|
6
|
+
export class Observer extends EventEmitter {
|
|
10
7
|
processors = {
|
|
11
|
-
events: new
|
|
12
|
-
metaData: new
|
|
13
|
-
issues: new
|
|
14
|
-
extensionStats: new
|
|
8
|
+
events: new MiddlewareProcessor(),
|
|
9
|
+
metaData: new MiddlewareProcessor(),
|
|
10
|
+
issues: new MiddlewareProcessor(),
|
|
11
|
+
extensionStats: new MiddlewareProcessor(),
|
|
15
12
|
};
|
|
16
13
|
observedCalls = new Map();
|
|
17
14
|
closed = false;
|
|
@@ -28,7 +25,7 @@ class Observer extends events_1.EventEmitter {
|
|
|
28
25
|
if (this.closed) {
|
|
29
26
|
throw new Error('Attempted to create a call source on a closed observer');
|
|
30
27
|
}
|
|
31
|
-
const observedCall = new
|
|
28
|
+
const observedCall = new ObservedCall(settings, this);
|
|
32
29
|
if (this.observedCalls.has(observedCall.callId))
|
|
33
30
|
throw new Error(`Observed Call with id ${observedCall.callId} already exists`);
|
|
34
31
|
observedCall.once('close', () => {
|
|
@@ -79,4 +76,3 @@ class Observer extends events_1.EventEmitter {
|
|
|
79
76
|
this.emit('close');
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
|
-
exports.Observer = Observer;
|
package/lib/common/Middleware.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MiddlewareProcessor = void 0;
|
|
4
1
|
class Executor {
|
|
5
2
|
stack;
|
|
6
3
|
finalCallback;
|
|
@@ -29,7 +26,7 @@ class Executor {
|
|
|
29
26
|
this.finalCallback?.(input);
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
class MiddlewareProcessor {
|
|
29
|
+
export class MiddlewareProcessor {
|
|
33
30
|
stack = [];
|
|
34
31
|
finalCallback;
|
|
35
32
|
addMiddleware(...middlewares) {
|
|
@@ -57,4 +54,3 @@ class MiddlewareProcessor {
|
|
|
57
54
|
executor.execute(value);
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
|
-
exports.MiddlewareProcessor = MiddlewareProcessor;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSingleExecutor = void 0;
|
|
4
|
-
function createSingleExecutor() {
|
|
1
|
+
export function createSingleExecutor() {
|
|
5
2
|
let semaphore = 1;
|
|
6
3
|
const tasks = [];
|
|
7
4
|
const execute = (task) => {
|
|
@@ -28,4 +25,3 @@ function createSingleExecutor() {
|
|
|
28
25
|
};
|
|
29
26
|
return execute;
|
|
30
27
|
}
|
|
31
|
-
exports.createSingleExecutor = createSingleExecutor;
|
package/lib/common/logger.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setObserverLogger = exports.createLogger = void 0;
|
|
4
1
|
let mainLogger = new class {
|
|
5
2
|
trace = () => void 0;
|
|
6
3
|
// trace(module: string, ...args: any[]) {
|
|
@@ -24,7 +21,7 @@ let mainLogger = new class {
|
|
|
24
21
|
console.error(`[ERROR] ${module}`, ...args);
|
|
25
22
|
}
|
|
26
23
|
}();
|
|
27
|
-
function createLogger(moduleName) {
|
|
24
|
+
export function createLogger(moduleName) {
|
|
28
25
|
return new class {
|
|
29
26
|
trace(...args) {
|
|
30
27
|
mainLogger.trace(moduleName, ...args);
|
|
@@ -43,8 +40,6 @@ function createLogger(moduleName) {
|
|
|
43
40
|
}
|
|
44
41
|
}();
|
|
45
42
|
}
|
|
46
|
-
|
|
47
|
-
function setObserverLogger(logger) {
|
|
43
|
+
export function setObserverLogger(logger) {
|
|
48
44
|
mainLogger = logger;
|
|
49
45
|
}
|
|
50
|
-
exports.setObserverLogger = setObserverLogger;
|
package/lib/common/types.js
CHANGED
package/lib/common/utils.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseJsonAs = exports.getMedian = exports.isValidUuid = exports.asyncIteratorConverter = exports.iteratorConverter = void 0;
|
|
4
|
-
function iteratorConverter(generator) {
|
|
1
|
+
export function iteratorConverter(generator) {
|
|
5
2
|
return {
|
|
6
3
|
[Symbol.iterator]() {
|
|
7
4
|
return this;
|
|
@@ -11,8 +8,7 @@ function iteratorConverter(generator) {
|
|
|
11
8
|
},
|
|
12
9
|
};
|
|
13
10
|
}
|
|
14
|
-
|
|
15
|
-
function asyncIteratorConverter(generator) {
|
|
11
|
+
export function asyncIteratorConverter(generator) {
|
|
16
12
|
return {
|
|
17
13
|
[Symbol.asyncIterator]() {
|
|
18
14
|
return this;
|
|
@@ -22,13 +18,11 @@ function asyncIteratorConverter(generator) {
|
|
|
22
18
|
},
|
|
23
19
|
};
|
|
24
20
|
}
|
|
25
|
-
|
|
26
|
-
function isValidUuid(str) {
|
|
21
|
+
export function isValidUuid(str) {
|
|
27
22
|
const regexp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
28
23
|
return regexp.test(str);
|
|
29
24
|
}
|
|
30
|
-
|
|
31
|
-
function getMedian(arr) {
|
|
25
|
+
export function getMedian(arr) {
|
|
32
26
|
// Sort the array in ascending order
|
|
33
27
|
const sortedArr = arr.slice().sort((a, b) => a - b);
|
|
34
28
|
// Calculate the middle index
|
|
@@ -40,8 +34,7 @@ function getMedian(arr) {
|
|
|
40
34
|
// If the array length is even, return the average of the two middle elements
|
|
41
35
|
return (sortedArr[mid - 1] + sortedArr[mid]) / 2;
|
|
42
36
|
}
|
|
43
|
-
|
|
44
|
-
function parseJsonAs(json) {
|
|
37
|
+
export function parseJsonAs(json) {
|
|
45
38
|
if (!json) {
|
|
46
39
|
return undefined;
|
|
47
40
|
}
|
|
@@ -52,4 +45,3 @@ function parseJsonAs(json) {
|
|
|
52
45
|
return undefined;
|
|
53
46
|
}
|
|
54
47
|
}
|
|
55
|
-
exports.parseJsonAs = parseJsonAs;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const logger_1 = require("../common/logger");
|
|
5
|
-
const logger = (0, logger_1.createLogger)('Detectors');
|
|
6
|
-
class Detectors {
|
|
1
|
+
import { createLogger } from '../common/logger';
|
|
2
|
+
const logger = createLogger('Detectors');
|
|
3
|
+
export class Detectors {
|
|
7
4
|
_detectors;
|
|
8
5
|
constructor(...detectors) {
|
|
9
6
|
this._detectors = detectors;
|
|
@@ -31,4 +28,3 @@ class Detectors {
|
|
|
31
28
|
this._detectors = [];
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
|
-
exports.Detectors = Detectors;
|
package/lib/index.js
CHANGED
|
@@ -1,41 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var ObservedCodec_1 = require("./ObservedCodec");
|
|
21
|
-
Object.defineProperty(exports, "ObservedCodec", { enumerable: true, get: function () { return ObservedCodec_1.ObservedCodec; } });
|
|
22
|
-
var ObservedCertificate_1 = require("./ObservedCertificate");
|
|
23
|
-
Object.defineProperty(exports, "ObservedCertificate", { enumerable: true, get: function () { return ObservedCertificate_1.ObservedCertificate; } });
|
|
24
|
-
var ObservedDataChannel_1 = require("./ObservedDataChannel");
|
|
25
|
-
Object.defineProperty(exports, "ObservedDataChannel", { enumerable: true, get: function () { return ObservedDataChannel_1.ObservedDataChannel; } });
|
|
26
|
-
var ObservedInboundRtp_1 = require("./ObservedInboundRtp");
|
|
27
|
-
Object.defineProperty(exports, "ObservedInboundRtp", { enumerable: true, get: function () { return ObservedInboundRtp_1.ObservedInboundRtp; } });
|
|
28
|
-
var ObservedOutboundRtp_1 = require("./ObservedOutboundRtp");
|
|
29
|
-
Object.defineProperty(exports, "ObservedOutboundRtp", { enumerable: true, get: function () { return ObservedOutboundRtp_1.ObservedOutboundRtp; } });
|
|
30
|
-
var ObservedRemoteInboundRtp_1 = require("./ObservedRemoteInboundRtp");
|
|
31
|
-
Object.defineProperty(exports, "ObservedRemoteInboundRtp", { enumerable: true, get: function () { return ObservedRemoteInboundRtp_1.ObservedRemoteInboundRtp; } });
|
|
32
|
-
var ObservedRemoteOutboundRtp_1 = require("./ObservedRemoteOutboundRtp");
|
|
33
|
-
Object.defineProperty(exports, "ObservedRemoteOutboundRtp", { enumerable: true, get: function () { return ObservedRemoteOutboundRtp_1.ObservedRemoteOutboundRtp; } });
|
|
34
|
-
var ObservedIceCandidatePair_1 = require("./ObservedIceCandidatePair");
|
|
35
|
-
Object.defineProperty(exports, "ObservedIceCandidatePair", { enumerable: true, get: function () { return ObservedIceCandidatePair_1.ObservedIceCandidatePair; } });
|
|
36
|
-
var ObservedIceCandidate_1 = require("./ObservedIceCandidate");
|
|
37
|
-
Object.defineProperty(exports, "ObservedIceCandidate", { enumerable: true, get: function () { return ObservedIceCandidate_1.ObservedIceCandidate; } });
|
|
38
|
-
var ObservedIceTransport_1 = require("./ObservedIceTransport");
|
|
39
|
-
Object.defineProperty(exports, "ObservedIceTransport", { enumerable: true, get: function () { return ObservedIceTransport_1.ObservedIceTransport; } });
|
|
40
|
-
var ObservedPeerConnectionTransport_1 = require("./ObservedPeerConnectionTransport");
|
|
41
|
-
Object.defineProperty(exports, "ObservedPeerConnectionTransport", { enumerable: true, get: function () { return ObservedPeerConnectionTransport_1.ObservedPeerConnectionTransport; } });
|
|
1
|
+
export { Observer } from './Observer';
|
|
2
|
+
export { ObservedCall } from './ObservedCall';
|
|
3
|
+
export { ObservedInboundTrack } from './ObservedInboundTrack';
|
|
4
|
+
export { ObservedOutboundTrack } from './ObservedOutboundTrack';
|
|
5
|
+
export { ObservedClient } from './ObservedClient';
|
|
6
|
+
export { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
7
|
+
export { ObservedMediaSource } from './ObservedMediaSource';
|
|
8
|
+
export { ObservedMediaPlayout } from './ObservedMediaPlayout';
|
|
9
|
+
export { ObservedCodec } from './ObservedCodec';
|
|
10
|
+
export { ObservedCertificate } from './ObservedCertificate';
|
|
11
|
+
export { ObservedDataChannel } from './ObservedDataChannel';
|
|
12
|
+
export { ObservedInboundRtp } from './ObservedInboundRtp';
|
|
13
|
+
export { ObservedOutboundRtp } from './ObservedOutboundRtp';
|
|
14
|
+
export { ObservedRemoteInboundRtp } from './ObservedRemoteInboundRtp';
|
|
15
|
+
export { ObservedRemoteOutboundRtp } from './ObservedRemoteOutboundRtp';
|
|
16
|
+
export { ObservedIceCandidatePair } from './ObservedIceCandidatePair';
|
|
17
|
+
export { ObservedIceCandidate } from './ObservedIceCandidate';
|
|
18
|
+
export { ObservedIceTransport } from './ObservedIceTransport';
|
|
19
|
+
export { ObservedPeerConnectionTransport } from './ObservedPeerConnectionTransport';
|
package/lib/schema/eventTypes.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* eslint-disable no-shadow */
|
|
3
|
-
|
|
4
|
-
exports.ClientEventType = void 0;
|
|
5
|
-
var ClientEventType;
|
|
2
|
+
export var ClientEventType;
|
|
6
3
|
(function (ClientEventType) {
|
|
7
4
|
ClientEventType["CALL_STARTED"] = "CALL_STARTED";
|
|
8
5
|
ClientEventType["CALL_ENDED"] = "CALL_ENDED";
|
|
@@ -35,4 +32,4 @@ var ClientEventType;
|
|
|
35
32
|
ClientEventType["DATA_PRODUCER_CLOSED"] = "DATA_PRODUCER_CLOSED";
|
|
36
33
|
ClientEventType["DATA_CONSUMER_CREATED"] = "DATA_CONSUMER_CREATED";
|
|
37
34
|
ClientEventType["DATA_CONSUMER_CLOSED"] = "DATA_CONSUMER_CLOSED";
|
|
38
|
-
})(ClientEventType
|
|
35
|
+
})(ClientEventType || (ClientEventType = {}));
|
package/lib/schema/metaTypes.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* eslint-disable no-shadow */
|
|
3
|
-
|
|
4
|
-
exports.ClientMetaType = void 0;
|
|
5
|
-
var ClientMetaType;
|
|
2
|
+
export var ClientMetaType;
|
|
6
3
|
(function (ClientMetaType) {
|
|
7
4
|
ClientMetaType["MEDIA_CONSTRAINT"] = "MEDIA_CONSTRAINT";
|
|
8
5
|
ClientMetaType["MEDIA_DEVICE"] = "MEDIA_DEVICE";
|
|
@@ -13,4 +10,4 @@ var ClientMetaType;
|
|
|
13
10
|
ClientMetaType["ENGINE"] = "ENGINE";
|
|
14
11
|
ClientMetaType["PLATFORM"] = "PLATFORM";
|
|
15
12
|
ClientMetaType["BROWSER"] = "BROWSER";
|
|
16
|
-
})(ClientMetaType
|
|
13
|
+
})(ClientMetaType || (ClientMetaType = {}));
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DefaultCallScoreCalculator = void 0;
|
|
4
|
-
class DefaultCallScoreCalculator {
|
|
1
|
+
export class DefaultCallScoreCalculator {
|
|
5
2
|
observedCall;
|
|
6
3
|
constructor(observedCall) {
|
|
7
4
|
this.observedCall = observedCall;
|
|
@@ -18,4 +15,3 @@ class DefaultCallScoreCalculator {
|
|
|
18
15
|
this.observedCall.calculatedScore.value = totalWeight ? totalScore / totalWeight : undefined;
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
exports.DefaultCallScoreCalculator = DefaultCallScoreCalculator;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/utils/CallUpdater.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OnAllClientCallUpdater = void 0;
|
|
4
|
-
class OnAllClientCallUpdater {
|
|
1
|
+
export class OnAllClientCallUpdater {
|
|
5
2
|
_observedCall;
|
|
6
3
|
_updatedClients = new Set();
|
|
7
4
|
_minClientJoinedTimestamp;
|
|
@@ -55,4 +52,3 @@ class OnAllClientCallUpdater {
|
|
|
55
52
|
this._observedCall.ended = this._maxClientLeftTimestamp;
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
|
-
exports.OnAllClientCallUpdater = OnAllClientCallUpdater;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OnAnyClientCallUpdater = void 0;
|
|
4
|
-
class OnAnyClientCallUpdater {
|
|
1
|
+
export class OnAnyClientCallUpdater {
|
|
5
2
|
_observedCall;
|
|
6
3
|
_minClientJoinedTimestamp;
|
|
7
4
|
_maxClientLeftTimestamp;
|
|
@@ -48,4 +45,3 @@ class OnAnyClientCallUpdater {
|
|
|
48
45
|
this._observedCall.ended = this._maxClientLeftTimestamp;
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
|
-
exports.OnAnyClientCallUpdater = OnAnyClientCallUpdater;
|
package/package.json
CHANGED
package/src/ObservedCall.ts
CHANGED
|
@@ -21,7 +21,6 @@ export type ObservedCallEvents = {
|
|
|
21
21
|
update: [],
|
|
22
22
|
newclient: [ObservedClient],
|
|
23
23
|
empty: [],
|
|
24
|
-
'not-empty': [],
|
|
25
24
|
close: [],
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -100,7 +99,7 @@ export class ObservedCall<AppData extends Record<string, unknown> = Record<strin
|
|
|
100
99
|
if (this.observedClients.has(settings.clientId)) throw new Error(`Client with id ${settings.clientId} already exists`);
|
|
101
100
|
|
|
102
101
|
const result = new ObservedClient<ClientAppData>(settings, this);
|
|
103
|
-
|
|
102
|
+
|
|
104
103
|
const onUpdate = () => this.callUpdater?.onClientUpdate(result);
|
|
105
104
|
|
|
106
105
|
result.once('close', () => {
|
|
@@ -112,15 +111,10 @@ export class ObservedCall<AppData extends Record<string, unknown> = Record<strin
|
|
|
112
111
|
}
|
|
113
112
|
});
|
|
114
113
|
result.on('update', onUpdate);
|
|
115
|
-
|
|
116
114
|
this.observedClients.set(settings.clientId, result);
|
|
117
115
|
|
|
118
116
|
this.emit('newclient', result);
|
|
119
117
|
|
|
120
|
-
if (wasEmpty) {
|
|
121
|
-
this.emit('not-empty');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
118
|
return result;
|
|
125
119
|
}
|
|
126
120
|
|
package/src/ObservedClient.ts
CHANGED
|
@@ -131,10 +131,10 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
|
|
|
131
131
|
const now = Date.now();
|
|
132
132
|
|
|
133
133
|
sample.clientEvents?.forEach(this._processClientEvent.bind(this));
|
|
134
|
-
sample.clientMetaItems?.forEach(this.
|
|
135
|
-
sample.clientIssues?.forEach(this.
|
|
134
|
+
sample.clientMetaItems?.forEach(this._processMetaData.bind(this));
|
|
135
|
+
sample.clientIssues?.forEach(this._processIssue.bind(this));
|
|
136
136
|
sample.peerConnections?.forEach(this._updatePeerConnection.bind(this));
|
|
137
|
-
sample.extensionStats?.forEach(this.
|
|
137
|
+
sample.extensionStats?.forEach(this._processExtensionStats.bind(this));
|
|
138
138
|
|
|
139
139
|
// emit new attachments?
|
|
140
140
|
this.attachments = sample.attachments;
|
|
@@ -192,7 +192,7 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
|
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
private _processMetaData(metadata: ClientMetaData) {
|
|
196
196
|
switch (metadata.type) {
|
|
197
197
|
case ClientMetaType.BROWSER: {
|
|
198
198
|
this.browser = parseJsonAs(metadata.payload);
|
|
@@ -219,7 +219,7 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
|
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
private _processIssue(issue: ClientIssue) {
|
|
223
223
|
this.call.observer.processors.issues.process({
|
|
224
224
|
call: this.call,
|
|
225
225
|
client: this,
|
|
@@ -227,7 +227,7 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
|
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
private _processExtensionStats(stats: ExtensionStat) {
|
|
231
231
|
this.call.observer.processors.extensionStats.process({
|
|
232
232
|
call: this.call,
|
|
233
233
|
client: this,
|
package/tsconfig.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"compileOnSave": true,
|
|
3
3
|
"compilerOptions":
|
|
4
4
|
{
|
|
5
|
-
"lib": [ "
|
|
6
|
-
"target": "
|
|
7
|
-
"module": "
|
|
5
|
+
"lib": [ "ES2022" ],
|
|
6
|
+
"target": "ES2022",
|
|
7
|
+
"module": "ES2022",
|
|
8
8
|
"moduleResolution": "node",
|
|
9
9
|
"esModuleInterop": true,
|
|
10
10
|
"strict": true,
|