@observertc/observer-js 1.0.1-f31d7a4.0 → 1.1.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/README.md +2184 -1
- package/dist/index.d.mts +6842 -0
- package/dist/index.d.ts +6842 -0
- package/dist/index.js +7736 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +7608 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +44 -18
- package/.eslintrc.json +0 -143
- package/.prettierignore +0 -5
- package/.prettierrc +0 -7
- package/jest.config.js +0 -9
- package/lib/ObservedCall.d.ts +0 -62
- package/lib/ObservedCall.d.ts.map +0 -1
- package/lib/ObservedCall.js +0 -127
- package/lib/ObservedCertificate.d.ts +0 -19
- package/lib/ObservedCertificate.d.ts.map +0 -1
- package/lib/ObservedCertificate.js +0 -38
- package/lib/ObservedClient.d.ts +0 -104
- package/lib/ObservedClient.d.ts.map +0 -1
- package/lib/ObservedClient.js +0 -250
- package/lib/ObservedCodec.d.ts +0 -22
- package/lib/ObservedCodec.d.ts.map +0 -1
- package/lib/ObservedCodec.js +0 -45
- package/lib/ObservedDataChannel.d.ts +0 -28
- package/lib/ObservedDataChannel.d.ts.map +0 -1
- package/lib/ObservedDataChannel.js +0 -73
- package/lib/ObservedIceCandidate.d.ts +0 -29
- package/lib/ObservedIceCandidate.d.ts.map +0 -1
- package/lib/ObservedIceCandidate.js +0 -59
- package/lib/ObservedIceCandidatePair.d.ts +0 -44
- package/lib/ObservedIceCandidatePair.d.ts.map +0 -1
- package/lib/ObservedIceCandidatePair.js +0 -111
- package/lib/ObservedIceTransport.d.ts +0 -32
- package/lib/ObservedIceTransport.d.ts.map +0 -1
- package/lib/ObservedIceTransport.js +0 -65
- package/lib/ObservedInboundRtp.d.ts +0 -92
- package/lib/ObservedInboundRtp.d.ts.map +0 -1
- package/lib/ObservedInboundRtp.js +0 -193
- package/lib/ObservedInboundTrack.d.ts +0 -29
- package/lib/ObservedInboundTrack.d.ts.map +0 -1
- package/lib/ObservedInboundTrack.js +0 -57
- package/lib/ObservedMediaPlayout.d.ts +0 -22
- package/lib/ObservedMediaPlayout.d.ts.map +0 -1
- package/lib/ObservedMediaPlayout.js +0 -42
- package/lib/ObservedMediaSource.d.ts +0 -28
- package/lib/ObservedMediaSource.d.ts.map +0 -1
- package/lib/ObservedMediaSource.js +0 -55
- package/lib/ObservedOutboundRtp.d.ts +0 -62
- package/lib/ObservedOutboundRtp.d.ts.map +0 -1
- package/lib/ObservedOutboundRtp.js +0 -144
- package/lib/ObservedOutboundTrack.d.ts +0 -29
- package/lib/ObservedOutboundTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundTrack.js +0 -57
- package/lib/ObservedPeerConnection.d.ts +0 -183
- package/lib/ObservedPeerConnection.d.ts.map +0 -1
- package/lib/ObservedPeerConnection.js +0 -688
- package/lib/ObservedPeerConnectionTransport.d.ts +0 -17
- package/lib/ObservedPeerConnectionTransport.d.ts.map +0 -1
- package/lib/ObservedPeerConnectionTransport.js +0 -34
- package/lib/ObservedRemoteInboundRtp.d.ts +0 -30
- package/lib/ObservedRemoteInboundRtp.d.ts.map +0 -1
- package/lib/ObservedRemoteInboundRtp.js +0 -60
- package/lib/ObservedRemoteOutboundRtp.d.ts +0 -30
- package/lib/ObservedRemoteOutboundRtp.d.ts.map +0 -1
- package/lib/ObservedRemoteOutboundRtp.js +0 -60
- package/lib/ObservedTURN.d.ts +0 -30
- package/lib/ObservedTURN.d.ts.map +0 -1
- package/lib/ObservedTURN.js +0 -54
- package/lib/ObservedTurnServer.d.ts +0 -25
- package/lib/ObservedTurnServer.d.ts.map +0 -1
- package/lib/ObservedTurnServer.js +0 -59
- package/lib/Observer.d.ts +0 -50
- package/lib/Observer.d.ts.map +0 -1
- package/lib/Observer.js +0 -101
- package/lib/common/Middleware.d.ts +0 -17
- package/lib/common/Middleware.d.ts.map +0 -1
- package/lib/common/Middleware.js +0 -60
- package/lib/common/SingleExecutor.d.ts +0 -3
- package/lib/common/SingleExecutor.d.ts.map +0 -1
- package/lib/common/SingleExecutor.js +0 -31
- package/lib/common/logger.d.ts +0 -17
- package/lib/common/logger.d.ts.map +0 -1
- package/lib/common/logger.js +0 -50
- package/lib/common/types.d.ts +0 -3
- package/lib/common/types.d.ts.map +0 -1
- package/lib/common/types.js +0 -3
- package/lib/common/utils.d.ts +0 -10
- package/lib/common/utils.d.ts.map +0 -1
- package/lib/common/utils.js +0 -55
- package/lib/detectors/Detector.d.ts +0 -5
- package/lib/detectors/Detector.d.ts.map +0 -1
- package/lib/detectors/Detector.js +0 -3
- package/lib/detectors/Detectors.d.ts +0 -11
- package/lib/detectors/Detectors.d.ts.map +0 -1
- package/lib/detectors/Detectors.js +0 -34
- package/lib/index.d.ts +0 -26
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -41
- package/lib/monitors/TurnUsageMonitor.d.ts +0 -1
- package/lib/monitors/TurnUsageMonitor.d.ts.map +0 -1
- package/lib/monitors/TurnUsageMonitor.js +0 -146
- package/lib/schema/ClientEventTypes.d.ts +0 -33
- package/lib/schema/ClientEventTypes.d.ts.map +0 -1
- package/lib/schema/ClientEventTypes.js +0 -38
- package/lib/schema/ClientMetaTypes.d.ts +0 -34
- package/lib/schema/ClientMetaTypes.d.ts.map +0 -1
- package/lib/schema/ClientMetaTypes.js +0 -16
- package/lib/schema/ClientSample.d.ts +0 -1333
- package/lib/schema/ClientSample.d.ts.map +0 -1
- package/lib/schema/ClientSample.js +0 -4
- package/lib/scores/CalculatedScore.d.ts +0 -6
- package/lib/scores/CalculatedScore.d.ts.map +0 -1
- package/lib/scores/CalculatedScore.js +0 -2
- package/lib/scores/DefaultCallScoreCalculator.d.ts +0 -7
- package/lib/scores/DefaultCallScoreCalculator.d.ts.map +0 -1
- package/lib/scores/DefaultCallScoreCalculator.js +0 -21
- package/lib/scores/ScoreCalculator.d.ts +0 -4
- package/lib/scores/ScoreCalculator.d.ts.map +0 -1
- package/lib/scores/ScoreCalculator.js +0 -2
- package/lib/utils/CallUpdater.d.ts +0 -5
- package/lib/utils/CallUpdater.d.ts.map +0 -1
- package/lib/utils/CallUpdater.js +0 -2
- package/lib/utils/OnAllClientCallUpdater.d.ts +0 -16
- package/lib/utils/OnAllClientCallUpdater.d.ts.map +0 -1
- package/lib/utils/OnAllClientCallUpdater.js +0 -58
- package/lib/utils/RemoteTrackResolver.d.ts +0 -7
- package/lib/utils/RemoteTrackResolver.d.ts.map +0 -1
- package/lib/utils/RemoteTrackResolver.js +0 -2
- package/lib/utils/onAnyClientCallUpdater.d.ts +0 -14
- package/lib/utils/onAnyClientCallUpdater.d.ts.map +0 -1
- package/lib/utils/onAnyClientCallUpdater.js +0 -51
- package/src/ObservedCall.ts +0 -176
- package/src/ObservedCertificate.ts +0 -43
- package/src/ObservedClient.ts +0 -324
- package/src/ObservedCodec.ts +0 -49
- package/src/ObservedDataChannel.ts +0 -82
- package/src/ObservedIceCandidate.ts +0 -64
- package/src/ObservedIceCandidatePair.ts +0 -118
- package/src/ObservedIceTransport.ts +0 -70
- package/src/ObservedInboundRtp.ts +0 -205
- package/src/ObservedInboundTrack.ts +0 -70
- package/src/ObservedMediaPlayout.ts +0 -49
- package/src/ObservedMediaSource.ts +0 -60
- package/src/ObservedOutboundRtp.ts +0 -156
- package/src/ObservedOutboundTrack.ts +0 -69
- package/src/ObservedPeerConnection.ts +0 -995
- package/src/ObservedPeerConnectionTransport.ts +0 -38
- package/src/ObservedRemoteInboundRtp.ts +0 -64
- package/src/ObservedRemoteOutboundRtp.ts +0 -65
- package/src/ObservedTURN.ts +0 -80
- package/src/ObservedTurnServer.ts +0 -72
- package/src/Observer.ts +0 -152
- package/src/common/Middleware.ts +0 -84
- package/src/common/SingleExecutor.ts +0 -36
- package/src/common/logger.ts +0 -82
- package/src/common/types.ts +0 -4
- package/src/common/utils.ts +0 -59
- package/src/detectors/Detector.ts +0 -6
- package/src/detectors/Detectors.ts +0 -38
- package/src/index.ts +0 -27
- package/src/monitors/TurnUsageMonitor.ts +0 -187
- package/src/schema/ClientEventTypes.ts +0 -36
- package/src/schema/ClientMetaTypes.ts +0 -41
- package/src/schema/ClientSample.ts +0 -1682
- package/src/scores/CalculatedScore.ts +0 -6
- package/src/scores/DefaultCallScoreCalculator.ts +0 -23
- package/src/scores/ScoreCalculator.ts +0 -3
- package/src/utils/CallUpdater.ts +0 -5
- package/src/utils/OnAllClientCallUpdater.ts +0 -68
- package/src/utils/RemoteTrackResolver.ts +0 -12
- package/src/utils/onAnyClientCallUpdater.ts +0 -59
- package/tsconfig.json +0 -19
- package/tslint.json +0 -6
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ObservedCall } from '../ObservedCall';
|
|
2
|
-
|
|
3
|
-
export class DefaultCallScoreCalculator {
|
|
4
|
-
|
|
5
|
-
public constructor(
|
|
6
|
-
public readonly observedCall: ObservedCall,
|
|
7
|
-
) {
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
public update() {
|
|
11
|
-
let totalScore = 0;
|
|
12
|
-
let totalWeight = 0;
|
|
13
|
-
|
|
14
|
-
for (const client of this.observedCall.observedClients.values()) {
|
|
15
|
-
if (client.score === undefined) continue;
|
|
16
|
-
|
|
17
|
-
totalScore += client.score * client.calculatedScore.weight;
|
|
18
|
-
totalWeight += client.calculatedScore.weight;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
this.observedCall.calculatedScore.value = totalWeight ? totalScore / totalWeight : undefined;
|
|
22
|
-
}
|
|
23
|
-
}
|
package/src/utils/CallUpdater.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { ObservedCall } from '../ObservedCall';
|
|
2
|
-
import { ObservedClient } from '../ObservedClient';
|
|
3
|
-
import { CallUpdater } from './CallUpdater';
|
|
4
|
-
|
|
5
|
-
export class OnAllClientCallUpdater implements CallUpdater {
|
|
6
|
-
|
|
7
|
-
private readonly _updatedClients = new Set<string>();
|
|
8
|
-
private _minClientJoinedTimestamp?: number;
|
|
9
|
-
private _maxClientLeftTimestamp?: number;
|
|
10
|
-
|
|
11
|
-
public constructor(
|
|
12
|
-
private _observedCall: ObservedCall
|
|
13
|
-
) {
|
|
14
|
-
this._onNewObservedClient = this._onNewObservedClient.bind(this);
|
|
15
|
-
this._onCallEmpty = this._onCallEmpty.bind(this);
|
|
16
|
-
|
|
17
|
-
this._observedCall.once('close', () => {
|
|
18
|
-
this._observedCall.off('empty', this._onCallEmpty);
|
|
19
|
-
this._observedCall.off('newclient', this._onNewObservedClient);
|
|
20
|
-
});
|
|
21
|
-
this._observedCall.on('newclient', this._onNewObservedClient);
|
|
22
|
-
this._observedCall.on('empty', this._onCallEmpty);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public onClientUpdate(observedClient: ObservedClient) {
|
|
26
|
-
this._updatedClients.add(observedClient.clientId);
|
|
27
|
-
|
|
28
|
-
if (this._updatedClients.size < this._observedCall.observedClients.size) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
this._updatedClients.clear();
|
|
32
|
-
this._observedCall.update();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
private _onNewObservedClient(observedClient: ObservedClient) {
|
|
36
|
-
const onJoined = () => this._onClientJoined(observedClient);
|
|
37
|
-
const onLeft = () => this._onClientLeft(observedClient);
|
|
38
|
-
|
|
39
|
-
observedClient.once('close', () => {
|
|
40
|
-
observedClient.off('joined', onJoined);
|
|
41
|
-
observedClient.off('left', onLeft);
|
|
42
|
-
this._updatedClients.delete(observedClient.clientId);
|
|
43
|
-
});
|
|
44
|
-
observedClient.on('joined', onJoined);
|
|
45
|
-
observedClient.on('left', onLeft);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
private _onClientJoined(observedClient: ObservedClient) {
|
|
49
|
-
if (!observedClient.joinedAt) return;
|
|
50
|
-
|
|
51
|
-
if (!this._minClientJoinedTimestamp || observedClient.joinedAt < this._minClientJoinedTimestamp) {
|
|
52
|
-
this._minClientJoinedTimestamp = observedClient.joinedAt;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private _onClientLeft(observedClient: ObservedClient) {
|
|
57
|
-
if (!observedClient.leftAt) return;
|
|
58
|
-
|
|
59
|
-
if (!this._maxClientLeftTimestamp || observedClient.leftAt > this._maxClientLeftTimestamp) {
|
|
60
|
-
this._maxClientLeftTimestamp = observedClient.leftAt;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
private _onCallEmpty() {
|
|
65
|
-
this._observedCall.started = this._minClientJoinedTimestamp;
|
|
66
|
-
this._observedCall.ended = this._maxClientLeftTimestamp;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ObservedInboundTrack } from '../ObservedInboundTrack';
|
|
2
|
-
import { ObservedOutboundTrack } from '../ObservedOutboundTrack';
|
|
3
|
-
|
|
4
|
-
export interface RemoteTrackResolver {
|
|
5
|
-
resolveRemoteOutboundTrack(
|
|
6
|
-
inboundTrack: ObservedInboundTrack,
|
|
7
|
-
): ObservedOutboundTrack | undefined;
|
|
8
|
-
|
|
9
|
-
resolveRemoteInboundTracks(
|
|
10
|
-
outboundTrack: ObservedOutboundTrack,
|
|
11
|
-
): ObservedInboundTrack[] | undefined;
|
|
12
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ObservedCall } from '../ObservedCall';
|
|
2
|
-
import { ObservedClient } from '../ObservedClient';
|
|
3
|
-
import { CallUpdater } from './CallUpdater';
|
|
4
|
-
|
|
5
|
-
export class OnAnyClientCallUpdater implements CallUpdater {
|
|
6
|
-
private _minClientJoinedTimestamp?: number;
|
|
7
|
-
private _maxClientLeftTimestamp?: number;
|
|
8
|
-
|
|
9
|
-
public constructor(
|
|
10
|
-
private _observedCall: ObservedCall
|
|
11
|
-
) {
|
|
12
|
-
this._onNewObservedClient = this._onNewObservedClient.bind(this);
|
|
13
|
-
this._onCallEmpty = this._onCallEmpty.bind(this);
|
|
14
|
-
|
|
15
|
-
this._observedCall.once('close', () => {
|
|
16
|
-
this._observedCall.off('empty', this._onCallEmpty);
|
|
17
|
-
this._observedCall.off('newclient', this._onNewObservedClient);
|
|
18
|
-
});
|
|
19
|
-
this._observedCall.on('newclient', this._onNewObservedClient);
|
|
20
|
-
this._observedCall.on('empty', this._onCallEmpty);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public onClientUpdate() {
|
|
24
|
-
this._observedCall.update();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
private _onNewObservedClient(observedClient: ObservedClient) {
|
|
28
|
-
const onJoined = () => this._onClientJoined(observedClient);
|
|
29
|
-
const onLeft = () => this._onClientLeft(observedClient);
|
|
30
|
-
|
|
31
|
-
observedClient.once('close', () => {
|
|
32
|
-
observedClient.off('joined', onJoined);
|
|
33
|
-
observedClient.off('left', onLeft);
|
|
34
|
-
});
|
|
35
|
-
observedClient.on('joined', onJoined);
|
|
36
|
-
observedClient.on('left', onLeft);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
private _onClientJoined(observedClient: ObservedClient) {
|
|
40
|
-
if (!observedClient.joinedAt) return;
|
|
41
|
-
|
|
42
|
-
if (!this._minClientJoinedTimestamp || observedClient.joinedAt < this._minClientJoinedTimestamp) {
|
|
43
|
-
this._minClientJoinedTimestamp = observedClient.joinedAt;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
private _onClientLeft(observedClient: ObservedClient) {
|
|
48
|
-
if (!observedClient.leftAt) return;
|
|
49
|
-
|
|
50
|
-
if (!this._maxClientLeftTimestamp || observedClient.leftAt > this._maxClientLeftTimestamp) {
|
|
51
|
-
this._maxClientLeftTimestamp = observedClient.leftAt;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
private _onCallEmpty() {
|
|
56
|
-
this._observedCall.started = this._minClientJoinedTimestamp;
|
|
57
|
-
this._observedCall.ended = this._maxClientLeftTimestamp;
|
|
58
|
-
}
|
|
59
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compileOnSave": true,
|
|
3
|
-
"compilerOptions":
|
|
4
|
-
{
|
|
5
|
-
"lib": [ "ES2020" ],
|
|
6
|
-
"target": "ESNext",
|
|
7
|
-
"module": "CommonJS",
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"strict": true,
|
|
11
|
-
"outDir": "lib",
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"declarationMap": true,
|
|
14
|
-
"experimentalDecorators": true,
|
|
15
|
-
"emitDecoratorMetadata": true
|
|
16
|
-
},
|
|
17
|
-
"include": [ "src" ]
|
|
18
|
-
}
|
|
19
|
-
|