@observertc/observer-js 1.0.1-08efe5e.0 → 1.0.1-1a01da3.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/common/ObserverSummary.d.ts.map +1 -0
- package/lib/common/SummaryTypes.d.ts +75 -0
- package/lib/common/SummaryTypes.d.ts.map +1 -0
- package/lib/common/SummaryTypes.js +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +27 -1
- package/lib/monitors/SummaryMonitor.d.ts +19 -0
- package/lib/monitors/SummaryMonitor.d.ts.map +1 -0
- package/lib/monitors/SummaryMonitor.js +129 -0
- package/package.json +1 -1
- package/src/common/SummaryTypes.ts +91 -0
- package/src/index.ts +5 -0
- package/src/monitors/SummaryMonitor.ts +181 -0
- package/lib/ObserverSummary.d.ts.map +0 -1
- /package/lib/{ObserverSummary.d.ts → common/ObserverSummary.d.ts} +0 -0
- /package/lib/{ObserverSummary.js → common/ObserverSummary.js} +0 -0
- /package/src/{ObserverSummary.ts → common/ObserverSummary.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObserverSummary.d.ts","sourceRoot":"","sources":["../../src/common/ObserverSummary.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,+BAA+B,EAAE,MAAM,CAAC;IACxC,sBAAsB,EAAE,MAAM,CAAC;IAE/B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IAEzB,wBAAwB,EAAE,MAAM,CAAC;IACjC,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,6BAA6B,EAAE,MAAM,CAAC;IAEtC,iBAAiB,EAAE,MAAM,CAAC;CAC1B,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { MediaKind } from "./types";
|
|
2
|
+
export type CallSummary = {
|
|
3
|
+
startedAt: number;
|
|
4
|
+
endedAt?: number;
|
|
5
|
+
id: string;
|
|
6
|
+
attachments: Record<string, unknown>;
|
|
7
|
+
clients: Record<string, ClientSummary>;
|
|
8
|
+
issues: Record<string, number>;
|
|
9
|
+
totalScore: number;
|
|
10
|
+
numberOfScores: number;
|
|
11
|
+
scoreReasons: Record<string, number>;
|
|
12
|
+
liveState?: {};
|
|
13
|
+
};
|
|
14
|
+
export type ClientSummary = {
|
|
15
|
+
id: string;
|
|
16
|
+
attachments: Record<string, unknown>;
|
|
17
|
+
joinedAt: number;
|
|
18
|
+
leftAt?: number;
|
|
19
|
+
peerConnections: Record<string, PeerConnectionSummary>;
|
|
20
|
+
issues: Record<string, number>;
|
|
21
|
+
totalScore: number;
|
|
22
|
+
numberOfScores: number;
|
|
23
|
+
scoreReasons: Record<string, number>;
|
|
24
|
+
liveState?: {
|
|
25
|
+
score?: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type PeerConnectionSummary = {
|
|
29
|
+
id: string;
|
|
30
|
+
attachments: Record<string, unknown>;
|
|
31
|
+
openedAt: number;
|
|
32
|
+
closedAt?: number;
|
|
33
|
+
inboundTracks: Record<string, InboundTrackSummary>;
|
|
34
|
+
outboundTracks: Record<string, OutboundTrackSummary>;
|
|
35
|
+
liveState?: {
|
|
36
|
+
score?: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type InboundTrackSummary = {
|
|
40
|
+
callId: string;
|
|
41
|
+
clientId: string;
|
|
42
|
+
peerConnectionId: string;
|
|
43
|
+
id: string;
|
|
44
|
+
attachments: Record<string, unknown>;
|
|
45
|
+
createdAt: number;
|
|
46
|
+
closedAt?: number;
|
|
47
|
+
kind: MediaKind;
|
|
48
|
+
totalScore: number;
|
|
49
|
+
numberOfScores: number;
|
|
50
|
+
scoreReasons: Record<string, number>;
|
|
51
|
+
liveState?: {
|
|
52
|
+
score?: number;
|
|
53
|
+
remoteTrackMuted?: boolean;
|
|
54
|
+
muted?: boolean;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
type OutboundTrackSummary = {
|
|
58
|
+
callId: string;
|
|
59
|
+
clientId: string;
|
|
60
|
+
peerConnectionId: string;
|
|
61
|
+
id: string;
|
|
62
|
+
attachments: Record<string, unknown>;
|
|
63
|
+
createdAt: number;
|
|
64
|
+
closedAt?: number;
|
|
65
|
+
kind: MediaKind;
|
|
66
|
+
totalScore: number;
|
|
67
|
+
numberOfScores: number;
|
|
68
|
+
scoreReasons: Record<string, number>;
|
|
69
|
+
liveState?: {
|
|
70
|
+
score?: number;
|
|
71
|
+
muted?: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=SummaryTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SummaryTypes.d.ts","sourceRoot":"","sources":["../../src/common/SummaryTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,MAAM,MAAM,WAAW,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErC,SAAS,CAAC,EAAE,EAEX,CAAC;CACL,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC,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M,CAAC,CAAC;IAErC,SAAS,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACL,CAAA;AAED,KAAK,oBAAoB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IAEzB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAEb,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErC,SAAS,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACL,CAAA"}
|
package/lib/index.d.ts
CHANGED
|
@@ -25,4 +25,6 @@ export { ScoreCalculator } from './scores/ScoreCalculator';
|
|
|
25
25
|
export { ObservedClientEventMonitor } from './ObservedClientEventMonitor';
|
|
26
26
|
export { ObserverEventMonitor } from './ObserverEventMonitor';
|
|
27
27
|
export { Middleware } from './common/Middleware';
|
|
28
|
+
export * as SummaryTypes from './common/SummaryTypes';
|
|
29
|
+
export { createSummaryMonitor, OngoingCallSumariesMap, } from './monitors/SummaryMonitor';
|
|
28
30
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD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,CAAC;AACrE,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,EACH,oBAAoB,EACpB,sBAAsB,GACzB,MAAM,2BAA2B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
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
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObserverEventMonitor = exports.ObservedClientEventMonitor = exports.ClientMetaTypes = exports.ClientEventTypes = exports.ObservedPeerConnectionTransport = exports.ObservedIceTransport = exports.ObservedIceCandidate = exports.ObservedIceCandidatePair = exports.ObservedRemoteOutboundRtp = exports.ObservedRemoteInboundRtp = exports.ObservedOutboundRtp = exports.ObservedInboundRtp = exports.ObservedDataChannel = exports.ObservedCertificate = exports.ObservedCodec = exports.ObservedMediaPlayout = exports.ObservedMediaSource = exports.ObservedPeerConnection = exports.ObservedClient = exports.ObservedOutboundTrack = exports.ObservedInboundTrack = exports.ObservedCall = exports.Observer = void 0;
|
|
26
|
+
exports.createSummaryMonitor = exports.SummaryTypes = exports.ObserverEventMonitor = exports.ObservedClientEventMonitor = exports.ClientMetaTypes = exports.ClientEventTypes = exports.ObservedPeerConnectionTransport = exports.ObservedIceTransport = exports.ObservedIceCandidate = exports.ObservedIceCandidatePair = exports.ObservedRemoteOutboundRtp = exports.ObservedRemoteInboundRtp = exports.ObservedOutboundRtp = exports.ObservedInboundRtp = exports.ObservedDataChannel = exports.ObservedCertificate = exports.ObservedCodec = exports.ObservedMediaPlayout = exports.ObservedMediaSource = exports.ObservedPeerConnection = exports.ObservedClient = exports.ObservedOutboundTrack = exports.ObservedInboundTrack = exports.ObservedCall = exports.Observer = void 0;
|
|
4
27
|
var Observer_1 = require("./Observer");
|
|
5
28
|
Object.defineProperty(exports, "Observer", { enumerable: true, get: function () { return Observer_1.Observer; } });
|
|
6
29
|
var ObservedCall_1 = require("./ObservedCall");
|
|
@@ -47,3 +70,6 @@ var ObservedClientEventMonitor_1 = require("./ObservedClientEventMonitor");
|
|
|
47
70
|
Object.defineProperty(exports, "ObservedClientEventMonitor", { enumerable: true, get: function () { return ObservedClientEventMonitor_1.ObservedClientEventMonitor; } });
|
|
48
71
|
var ObserverEventMonitor_1 = require("./ObserverEventMonitor");
|
|
49
72
|
Object.defineProperty(exports, "ObserverEventMonitor", { enumerable: true, get: function () { return ObserverEventMonitor_1.ObserverEventMonitor; } });
|
|
73
|
+
exports.SummaryTypes = __importStar(require("./common/SummaryTypes"));
|
|
74
|
+
var SummaryMonitor_1 = require("./monitors/SummaryMonitor");
|
|
75
|
+
Object.defineProperty(exports, "createSummaryMonitor", { enumerable: true, get: function () { return SummaryMonitor_1.createSummaryMonitor; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from "events";
|
|
3
|
+
import { CallSummary } from "../common/SummaryTypes";
|
|
4
|
+
import { Observer } from "../Observer";
|
|
5
|
+
export type SummaryMonitorEvents = {
|
|
6
|
+
'call-summary': [CallSummary];
|
|
7
|
+
};
|
|
8
|
+
export interface OngoingCallSumariesMap {
|
|
9
|
+
create(call: CallSummary): void | Promise<void>;
|
|
10
|
+
update(call: CallSummary): void | Promise<void>;
|
|
11
|
+
read(callId: string): Promise<CallSummary | undefined>;
|
|
12
|
+
delete(callId: string): void | Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare class SummaryMonitor extends EventEmitter {
|
|
15
|
+
readonly callSummaries: OngoingCallSumariesMap;
|
|
16
|
+
constructor(callSummaries?: OngoingCallSumariesMap);
|
|
17
|
+
}
|
|
18
|
+
export declare function createSummaryMonitor(observer: Observer): SummaryMonitor;
|
|
19
|
+
//# sourceMappingURL=SummaryMonitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SummaryMonitor.d.ts","sourceRoot":"","sources":["../../src/monitors/SummaryMonitor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,WAAW,EAAiB,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,MAAM,MAAM,oBAAoB,GAAG;IAC/B,cAAc,EAAE,CAAC,WAAW,CAAC,CAAA;CAChC,CAAA;AAED,MAAM,WAAW,sBAAsB;IACnC,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IACvD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAGD,qBAAa,cAAe,SAAQ,YAAY;aAGxB,aAAa;gBAAb,aAAa,yBAAwC;CAK5E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAYvE"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSummaryMonitor = exports.SummaryMonitor = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const logger_1 = require("../common/logger");
|
|
6
|
+
const logger = (0, logger_1.createLogger)("SummaryMonitor");
|
|
7
|
+
class SummaryMonitor extends events_1.EventEmitter {
|
|
8
|
+
callSummaries;
|
|
9
|
+
constructor(callSummaries = createSimpleOngoingCallSummariesMap()) {
|
|
10
|
+
super();
|
|
11
|
+
this.callSummaries = callSummaries;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.SummaryMonitor = SummaryMonitor;
|
|
15
|
+
function createSummaryMonitor(observer) {
|
|
16
|
+
const result = new SummaryMonitor();
|
|
17
|
+
const eventer = observer.createEventMonitor(result);
|
|
18
|
+
eventer.onCallAdded = onCallAdded;
|
|
19
|
+
eventer.onCallUpdated = onCallUpdated;
|
|
20
|
+
eventer.onCallRemoved = onCallRemoved;
|
|
21
|
+
eventer.onClientAdded = onClientAdded;
|
|
22
|
+
eventer.onClientUpdated = onClientUpdated;
|
|
23
|
+
eventer.onClientClosed = onClientClosed;
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
exports.createSummaryMonitor = createSummaryMonitor;
|
|
27
|
+
async function onCallAdded(call, monitor) {
|
|
28
|
+
const summary = {
|
|
29
|
+
startedAt: call.startedAt ?? Date.now(),
|
|
30
|
+
id: call.callId,
|
|
31
|
+
attachments: {},
|
|
32
|
+
clients: {},
|
|
33
|
+
issues: {},
|
|
34
|
+
totalScore: 0,
|
|
35
|
+
numberOfScores: 0,
|
|
36
|
+
scoreReasons: {}
|
|
37
|
+
};
|
|
38
|
+
await monitor.callSummaries.create(summary);
|
|
39
|
+
}
|
|
40
|
+
async function onCallUpdated(call, monitor) {
|
|
41
|
+
const summary = await monitor.callSummaries.read(call.callId);
|
|
42
|
+
if (!summary)
|
|
43
|
+
return logger.warn(`Call summary not found for call ID ${call.callId}`);
|
|
44
|
+
// Update the summary with the latest call data
|
|
45
|
+
if (call.startedAt) {
|
|
46
|
+
summary.startedAt = call.startedAt;
|
|
47
|
+
}
|
|
48
|
+
if (call.score !== undefined) {
|
|
49
|
+
summary.totalScore += call.score;
|
|
50
|
+
++summary.numberOfScores;
|
|
51
|
+
summary.liveState = {
|
|
52
|
+
...summary.liveState,
|
|
53
|
+
score: call.score
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
await monitor.callSummaries.update(summary);
|
|
57
|
+
}
|
|
58
|
+
async function onCallRemoved(call, monitor) {
|
|
59
|
+
const summary = await monitor.callSummaries.read(call.callId);
|
|
60
|
+
if (!summary)
|
|
61
|
+
return logger.warn(`Call summary not found for call ID ${call.callId}`);
|
|
62
|
+
summary.liveState = undefined;
|
|
63
|
+
await monitor.callSummaries.delete(call.callId);
|
|
64
|
+
monitor.emit('call-summary', summary);
|
|
65
|
+
}
|
|
66
|
+
async function onClientAdded(client, monitor) {
|
|
67
|
+
const callSummary = await monitor.callSummaries.read(client.call.callId);
|
|
68
|
+
if (!callSummary)
|
|
69
|
+
return logger.warn(`Call summary not found for call ID ${client.call.callId}`);
|
|
70
|
+
const clientSummary = {
|
|
71
|
+
id: client.clientId,
|
|
72
|
+
attachments: {},
|
|
73
|
+
joinedAt: client.joinedAt ?? Date.now(),
|
|
74
|
+
leftAt: client.leftAt,
|
|
75
|
+
peerConnections: {},
|
|
76
|
+
issues: {},
|
|
77
|
+
totalScore: 0,
|
|
78
|
+
numberOfScores: 0,
|
|
79
|
+
scoreReasons: {}
|
|
80
|
+
};
|
|
81
|
+
callSummary.clients[client.clientId] = clientSummary;
|
|
82
|
+
await monitor.callSummaries.update(callSummary);
|
|
83
|
+
}
|
|
84
|
+
async function onClientUpdated(client, sample, monitor) {
|
|
85
|
+
const callSummary = await monitor.callSummaries.read(client.call.callId);
|
|
86
|
+
if (!callSummary)
|
|
87
|
+
return logger.warn(`Call summary not found for call ID ${client.call.callId}`);
|
|
88
|
+
const clientSummary = callSummary.clients[client.clientId];
|
|
89
|
+
if (!clientSummary)
|
|
90
|
+
return logger.warn(`Client summary not found for client ID ${client.clientId} in call ID ${callSummary.id}`);
|
|
91
|
+
if (client.score !== undefined) {
|
|
92
|
+
clientSummary.totalScore += client.score;
|
|
93
|
+
++clientSummary.numberOfScores;
|
|
94
|
+
clientSummary.liveState = {
|
|
95
|
+
...clientSummary.liveState,
|
|
96
|
+
score: client.score
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
await monitor.callSummaries.update(callSummary);
|
|
100
|
+
sample;
|
|
101
|
+
}
|
|
102
|
+
async function onClientClosed(client, monitor) {
|
|
103
|
+
const callSummary = await monitor.callSummaries.read(client.call.callId);
|
|
104
|
+
if (!callSummary)
|
|
105
|
+
return logger.warn(`Call summary not found for call ID ${client.call.callId}`);
|
|
106
|
+
const clientSummary = callSummary.clients[client.clientId];
|
|
107
|
+
if (!clientSummary)
|
|
108
|
+
return logger.warn(`Client summary not found for client ID ${client.clientId} in call ID ${callSummary.id}`);
|
|
109
|
+
clientSummary.leftAt = client.leftAt ?? Date.now();
|
|
110
|
+
await monitor.callSummaries.update(callSummary);
|
|
111
|
+
}
|
|
112
|
+
// -----------------------------------------------------
|
|
113
|
+
function createSimpleOngoingCallSummariesMap() {
|
|
114
|
+
const map = new Map();
|
|
115
|
+
return {
|
|
116
|
+
create(call) {
|
|
117
|
+
map.set(call.id, call);
|
|
118
|
+
},
|
|
119
|
+
update(call) {
|
|
120
|
+
// empty
|
|
121
|
+
},
|
|
122
|
+
async read(callId) {
|
|
123
|
+
return map.get(callId);
|
|
124
|
+
},
|
|
125
|
+
delete(callId) {
|
|
126
|
+
map.delete(callId);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { MediaKind } from "./types"
|
|
2
|
+
|
|
3
|
+
export type CallSummary = {
|
|
4
|
+
startedAt: number; // the timestamp when the call started
|
|
5
|
+
endedAt?: number; // the timestamp when the call ended
|
|
6
|
+
id: string; // the call ID
|
|
7
|
+
attachments: Record<string, unknown>; // will contain the merged attachments
|
|
8
|
+
clients: Record<string, ClientSummary>; // client ID -> client report
|
|
9
|
+
issues: Record<string, number>;
|
|
10
|
+
totalScore: number;
|
|
11
|
+
numberOfScores: number;
|
|
12
|
+
scoreReasons: Record<string, number>;
|
|
13
|
+
|
|
14
|
+
liveState?: {
|
|
15
|
+
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type ClientSummary = {
|
|
20
|
+
id: string; // the client ID
|
|
21
|
+
attachments: Record<string, unknown>; // will contain the merged attachments
|
|
22
|
+
joinedAt: number; // the timestamp when the client joined the call
|
|
23
|
+
leftAt?: number; // the timestamp when the client left the call
|
|
24
|
+
peerConnections: Record<string, PeerConnectionSummary>; // peer connection ID -> peer connection report
|
|
25
|
+
issues: Record<string, number>;
|
|
26
|
+
totalScore: number;
|
|
27
|
+
numberOfScores: number;
|
|
28
|
+
scoreReasons: Record<string, number>;
|
|
29
|
+
|
|
30
|
+
liveState?: {
|
|
31
|
+
score?: number; // the current score of the client
|
|
32
|
+
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type PeerConnectionSummary = {
|
|
37
|
+
id: string; // the peer connection ID
|
|
38
|
+
attachments: Record<string, unknown>; // will contain the merged attachments
|
|
39
|
+
openedAt: number; // the timestamp when the peer connection was opened
|
|
40
|
+
closedAt?: number; // the timestamp when the peer connection was closed
|
|
41
|
+
|
|
42
|
+
inboundTracks: Record<string, InboundTrackSummary>; // track ID -> inbound track report
|
|
43
|
+
outboundTracks: Record<string, OutboundTrackSummary>; // track ID -> outbound track report
|
|
44
|
+
|
|
45
|
+
liveState?: {
|
|
46
|
+
score?: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type InboundTrackSummary = {
|
|
51
|
+
callId: string; // the call ID this track belongs to
|
|
52
|
+
clientId: string; // the client ID this track belongs to
|
|
53
|
+
peerConnectionId: string; // the peer connection ID this track belongs to
|
|
54
|
+
|
|
55
|
+
id: string;
|
|
56
|
+
attachments: Record<string, unknown>; // will contain the merged attachments
|
|
57
|
+
createdAt: number;
|
|
58
|
+
closedAt?: number;
|
|
59
|
+
kind: MediaKind;
|
|
60
|
+
|
|
61
|
+
totalScore: number;
|
|
62
|
+
numberOfScores: number;
|
|
63
|
+
scoreReasons: Record<string, number>;
|
|
64
|
+
|
|
65
|
+
liveState?: {
|
|
66
|
+
score?: number;
|
|
67
|
+
remoteTrackMuted?: boolean;
|
|
68
|
+
muted?: boolean;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type OutboundTrackSummary = {
|
|
73
|
+
callId: string; // the call ID this track belongs to
|
|
74
|
+
clientId: string; // the client ID this track belongs to
|
|
75
|
+
peerConnectionId: string; // the peer connection ID this track belongs to
|
|
76
|
+
|
|
77
|
+
id: string;
|
|
78
|
+
attachments: Record<string, unknown>; // will contain the merged attachments
|
|
79
|
+
createdAt: number;
|
|
80
|
+
closedAt?: number;
|
|
81
|
+
kind: MediaKind;
|
|
82
|
+
|
|
83
|
+
totalScore: number;
|
|
84
|
+
numberOfScores: number;
|
|
85
|
+
scoreReasons: Record<string, number>;
|
|
86
|
+
|
|
87
|
+
liveState?: {
|
|
88
|
+
score?: number;
|
|
89
|
+
muted?: boolean;
|
|
90
|
+
};
|
|
91
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -26,3 +26,8 @@ export { ScoreCalculator } from './scores/ScoreCalculator';
|
|
|
26
26
|
export { ObservedClientEventMonitor } from './ObservedClientEventMonitor';
|
|
27
27
|
export { ObserverEventMonitor } from './ObserverEventMonitor';
|
|
28
28
|
export { Middleware } from './common/Middleware';
|
|
29
|
+
export * as SummaryTypes from './common/SummaryTypes';
|
|
30
|
+
export {
|
|
31
|
+
createSummaryMonitor,
|
|
32
|
+
OngoingCallSumariesMap,
|
|
33
|
+
} from './monitors/SummaryMonitor';
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
|
+
import { CallSummary, ClientSummary } from "../common/SummaryTypes";
|
|
3
|
+
import { ObservedCall } from "../ObservedCall";
|
|
4
|
+
import { Observer } from "../Observer";
|
|
5
|
+
import { createLogger } from "../common/logger";
|
|
6
|
+
import { ObservedClient } from "../ObservedClient";
|
|
7
|
+
import { ClientSample } from "../schema/ClientSample";
|
|
8
|
+
|
|
9
|
+
const logger = createLogger("SummaryMonitor");
|
|
10
|
+
|
|
11
|
+
export type SummaryMonitorEvents = {
|
|
12
|
+
'call-summary': [CallSummary]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface OngoingCallSumariesMap {
|
|
16
|
+
create(call: CallSummary): void | Promise<void>;
|
|
17
|
+
update(call: CallSummary): void | Promise<void>;
|
|
18
|
+
read(callId: string): Promise<CallSummary | undefined>;
|
|
19
|
+
delete(callId: string): void | Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export class SummaryMonitor extends EventEmitter {
|
|
24
|
+
|
|
25
|
+
public constructor(
|
|
26
|
+
public readonly callSummaries = createSimpleOngoingCallSummariesMap(),
|
|
27
|
+
) {
|
|
28
|
+
super();
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function createSummaryMonitor(observer: Observer): SummaryMonitor {
|
|
34
|
+
const result = new SummaryMonitor();
|
|
35
|
+
const eventer = observer.createEventMonitor(result);
|
|
36
|
+
|
|
37
|
+
eventer.onCallAdded = onCallAdded;
|
|
38
|
+
eventer.onCallUpdated = onCallUpdated;
|
|
39
|
+
eventer.onCallRemoved = onCallRemoved;
|
|
40
|
+
eventer.onClientAdded = onClientAdded;
|
|
41
|
+
eventer.onClientUpdated = onClientUpdated;
|
|
42
|
+
eventer.onClientClosed = onClientClosed;
|
|
43
|
+
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function onCallAdded(call: ObservedCall, monitor: SummaryMonitor) {
|
|
48
|
+
const summary: CallSummary = {
|
|
49
|
+
startedAt: call.startedAt ?? Date.now(),
|
|
50
|
+
id: call.callId,
|
|
51
|
+
attachments: {},
|
|
52
|
+
clients: {},
|
|
53
|
+
issues: {},
|
|
54
|
+
totalScore: 0,
|
|
55
|
+
numberOfScores: 0,
|
|
56
|
+
scoreReasons: {}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
await monitor.callSummaries.create(summary);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function onCallUpdated(call: ObservedCall, monitor: SummaryMonitor) {
|
|
63
|
+
const summary = await monitor.callSummaries.read(call.callId);
|
|
64
|
+
|
|
65
|
+
if (!summary) return logger.warn(`Call summary not found for call ID ${call.callId}`);
|
|
66
|
+
|
|
67
|
+
// Update the summary with the latest call data
|
|
68
|
+
if (call.startedAt) {
|
|
69
|
+
summary.startedAt = call.startedAt;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (call.score !== undefined) {
|
|
73
|
+
summary.totalScore += call.score;
|
|
74
|
+
++summary.numberOfScores;
|
|
75
|
+
|
|
76
|
+
summary.liveState = {
|
|
77
|
+
...summary.liveState,
|
|
78
|
+
score: call.score
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
await monitor.callSummaries.update(summary);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function onCallRemoved(call: ObservedCall, monitor: SummaryMonitor) {
|
|
86
|
+
const summary = await monitor.callSummaries.read(call.callId);
|
|
87
|
+
|
|
88
|
+
if (!summary) return logger.warn(`Call summary not found for call ID ${call.callId}`);
|
|
89
|
+
|
|
90
|
+
summary.liveState = undefined;
|
|
91
|
+
|
|
92
|
+
await monitor.callSummaries.delete(call.callId);
|
|
93
|
+
|
|
94
|
+
monitor.emit('call-summary', summary);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
async function onClientAdded(client: ObservedClient, monitor: SummaryMonitor) {
|
|
99
|
+
const callSummary = await monitor.callSummaries.read(client.call.callId);
|
|
100
|
+
|
|
101
|
+
if (!callSummary) return logger.warn(`Call summary not found for call ID ${client.call.callId}`);
|
|
102
|
+
|
|
103
|
+
const clientSummary: ClientSummary = {
|
|
104
|
+
id: client.clientId,
|
|
105
|
+
attachments: {},
|
|
106
|
+
joinedAt: client.joinedAt ?? Date.now(),
|
|
107
|
+
leftAt: client.leftAt,
|
|
108
|
+
peerConnections: {},
|
|
109
|
+
issues: {},
|
|
110
|
+
totalScore: 0,
|
|
111
|
+
numberOfScores: 0,
|
|
112
|
+
scoreReasons: {}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
callSummary.clients[client.clientId] = clientSummary;
|
|
116
|
+
|
|
117
|
+
await monitor.callSummaries.update(callSummary);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async function onClientUpdated(client: ObservedClient, sample: ClientSample, monitor: SummaryMonitor) {
|
|
121
|
+
const callSummary = await monitor.callSummaries.read(client.call.callId);
|
|
122
|
+
|
|
123
|
+
if (!callSummary) return logger.warn(`Call summary not found for call ID ${client.call.callId}`);
|
|
124
|
+
|
|
125
|
+
const clientSummary = callSummary.clients[client.clientId];
|
|
126
|
+
|
|
127
|
+
if (!clientSummary) return logger.warn(`Client summary not found for client ID ${client.clientId} in call ID ${callSummary.id}`);
|
|
128
|
+
|
|
129
|
+
if (client.score !== undefined) {
|
|
130
|
+
clientSummary.totalScore += client.score;
|
|
131
|
+
++clientSummary.numberOfScores;
|
|
132
|
+
|
|
133
|
+
clientSummary.liveState = {
|
|
134
|
+
...clientSummary.liveState,
|
|
135
|
+
score: client.score
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
await monitor.callSummaries.update(callSummary);
|
|
140
|
+
|
|
141
|
+
sample;
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async function onClientClosed(client: ObservedClient, monitor: SummaryMonitor) {
|
|
146
|
+
const callSummary = await monitor.callSummaries.read(client.call.callId);
|
|
147
|
+
|
|
148
|
+
if (!callSummary) return logger.warn(`Call summary not found for call ID ${client.call.callId}`);
|
|
149
|
+
|
|
150
|
+
const clientSummary = callSummary.clients[client.clientId];
|
|
151
|
+
|
|
152
|
+
if (!clientSummary) return logger.warn(`Client summary not found for client ID ${client.clientId} in call ID ${callSummary.id}`);
|
|
153
|
+
|
|
154
|
+
clientSummary.leftAt = client.leftAt ?? Date.now();
|
|
155
|
+
|
|
156
|
+
await monitor.callSummaries.update(callSummary);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
// -----------------------------------------------------
|
|
163
|
+
|
|
164
|
+
function createSimpleOngoingCallSummariesMap(): OngoingCallSumariesMap {
|
|
165
|
+
const map = new Map<string, CallSummary>();
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
create(call: CallSummary) {
|
|
169
|
+
map.set(call.id, call);
|
|
170
|
+
},
|
|
171
|
+
update(call: CallSummary) {
|
|
172
|
+
// empty
|
|
173
|
+
},
|
|
174
|
+
async read(callId: string) {
|
|
175
|
+
return map.get(callId);
|
|
176
|
+
},
|
|
177
|
+
delete(callId: string) {
|
|
178
|
+
map.delete(callId);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ObserverSummary.d.ts","sourceRoot":"","sources":["../src/ObserverSummary.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,+BAA+B,EAAE,MAAM,CAAC;IACxC,sBAAsB,EAAE,MAAM,CAAC;IAE/B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IAEzB,wBAAwB,EAAE,MAAM,CAAC;IACjC,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,6BAA6B,EAAE,MAAM,CAAC;IAEtC,iBAAiB,EAAE,MAAM,CAAC;CAC1B,CAAA"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|