@observertc/observer-js 0.42.9 → 1.0.1-57a1811.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.
Files changed (247) hide show
  1. package/.prettierrc +6 -6
  2. package/README.md +0 -104
  3. package/lib/ObservedCall.d.ts +38 -41
  4. package/lib/ObservedCall.d.ts.map +1 -1
  5. package/lib/ObservedCall.js +97 -109
  6. package/lib/ObservedCertificate.d.ts +19 -0
  7. package/lib/ObservedCertificate.d.ts.map +1 -0
  8. package/lib/ObservedCertificate.js +38 -0
  9. package/lib/ObservedClient.d.ts +49 -127
  10. package/lib/ObservedClient.d.ts.map +1 -1
  11. package/lib/ObservedClient.js +201 -750
  12. package/lib/ObservedCodec.d.ts +22 -0
  13. package/lib/ObservedCodec.d.ts.map +1 -0
  14. package/lib/ObservedCodec.js +45 -0
  15. package/lib/ObservedDataChannel.d.ts +23 -69
  16. package/lib/ObservedDataChannel.d.ts.map +1 -1
  17. package/lib/ObservedDataChannel.js +67 -109
  18. package/lib/ObservedIceCandidate.d.ts +29 -0
  19. package/lib/ObservedIceCandidate.d.ts.map +1 -0
  20. package/lib/ObservedIceCandidate.js +59 -0
  21. package/lib/ObservedIceCandidatePair.d.ts +44 -0
  22. package/lib/ObservedIceCandidatePair.d.ts.map +1 -0
  23. package/lib/ObservedIceCandidatePair.js +111 -0
  24. package/lib/ObservedIceTransport.d.ts +32 -0
  25. package/lib/ObservedIceTransport.d.ts.map +1 -0
  26. package/lib/ObservedIceTransport.js +65 -0
  27. package/lib/ObservedInboundRtp.d.ts +92 -0
  28. package/lib/ObservedInboundRtp.d.ts.map +1 -0
  29. package/lib/ObservedInboundRtp.js +193 -0
  30. package/lib/ObservedInboundTrack.d.ts +29 -0
  31. package/lib/ObservedInboundTrack.d.ts.map +1 -0
  32. package/lib/ObservedInboundTrack.js +57 -0
  33. package/lib/ObservedMediaPlayout.d.ts +22 -0
  34. package/lib/ObservedMediaPlayout.d.ts.map +1 -0
  35. package/lib/ObservedMediaPlayout.js +42 -0
  36. package/lib/ObservedMediaSource.d.ts +28 -0
  37. package/lib/ObservedMediaSource.d.ts.map +1 -0
  38. package/lib/ObservedMediaSource.js +55 -0
  39. package/lib/ObservedOutboundRtp.d.ts +62 -0
  40. package/lib/ObservedOutboundRtp.d.ts.map +1 -0
  41. package/lib/ObservedOutboundRtp.js +144 -0
  42. package/lib/ObservedOutboundTrack.d.ts +29 -0
  43. package/lib/ObservedOutboundTrack.d.ts.map +1 -0
  44. package/lib/ObservedOutboundTrack.js +57 -0
  45. package/lib/ObservedPeerConnection.d.ts +128 -78
  46. package/lib/ObservedPeerConnection.d.ts.map +1 -1
  47. package/lib/ObservedPeerConnection.js +624 -357
  48. package/lib/ObservedPeerConnectionTransport.d.ts +17 -0
  49. package/lib/ObservedPeerConnectionTransport.d.ts.map +1 -0
  50. package/lib/ObservedPeerConnectionTransport.js +34 -0
  51. package/lib/ObservedRemoteInboundRtp.d.ts +30 -0
  52. package/lib/ObservedRemoteInboundRtp.d.ts.map +1 -0
  53. package/lib/ObservedRemoteInboundRtp.js +60 -0
  54. package/lib/ObservedRemoteOutboundRtp.d.ts +30 -0
  55. package/lib/ObservedRemoteOutboundRtp.d.ts.map +1 -0
  56. package/lib/ObservedRemoteOutboundRtp.js +60 -0
  57. package/lib/ObservedTURN.d.ts +31 -0
  58. package/lib/ObservedTURN.d.ts.map +1 -0
  59. package/lib/ObservedTURN.js +58 -0
  60. package/lib/ObservedTurnServer.d.ts +25 -0
  61. package/lib/ObservedTurnServer.d.ts.map +1 -0
  62. package/lib/ObservedTurnServer.js +59 -0
  63. package/lib/Observer.d.ts +31 -51
  64. package/lib/Observer.d.ts.map +1 -1
  65. package/lib/Observer.js +75 -229
  66. package/lib/common/Middleware.d.ts +10 -1
  67. package/lib/common/Middleware.d.ts.map +1 -1
  68. package/lib/common/Middleware.js +55 -36
  69. package/lib/common/logger.d.ts +8 -4
  70. package/lib/common/logger.d.ts.map +1 -1
  71. package/lib/common/logger.js +44 -68
  72. package/lib/common/types.d.ts +0 -21
  73. package/lib/common/types.d.ts.map +1 -1
  74. package/lib/common/types.js +1 -0
  75. package/lib/common/utils.d.ts +1 -0
  76. package/lib/common/utils.d.ts.map +1 -1
  77. package/lib/common/utils.js +13 -1
  78. package/lib/detectors/Detector.d.ts +5 -0
  79. package/lib/detectors/Detector.d.ts.map +1 -0
  80. package/lib/detectors/Detector.js +3 -0
  81. package/lib/detectors/Detectors.d.ts +11 -0
  82. package/lib/detectors/Detectors.d.ts.map +1 -0
  83. package/lib/detectors/Detectors.js +34 -0
  84. package/lib/index.d.ts +24 -25
  85. package/lib/index.d.ts.map +1 -1
  86. package/lib/index.js +41 -41
  87. package/lib/monitors/TurnUsageMonitor.d.ts +0 -52
  88. package/lib/monitors/TurnUsageMonitor.d.ts.map +1 -1
  89. package/lib/monitors/TurnUsageMonitor.js +145 -120
  90. package/lib/schema/ClientEventTypes.d.ts +33 -0
  91. package/lib/schema/ClientEventTypes.d.ts.map +1 -0
  92. package/lib/schema/ClientEventTypes.js +38 -0
  93. package/lib/schema/ClientMetaTypes.d.ts +34 -0
  94. package/lib/schema/ClientMetaTypes.d.ts.map +1 -0
  95. package/lib/schema/ClientMetaTypes.js +16 -0
  96. package/lib/schema/ClientSample.d.ts +1333 -0
  97. package/lib/schema/ClientSample.d.ts.map +1 -0
  98. package/lib/schema/ClientSample.js +4 -0
  99. package/lib/scores/CalculatedScore.d.ts +6 -0
  100. package/lib/scores/CalculatedScore.d.ts.map +1 -0
  101. package/lib/scores/DefaultCallScoreCalculator.d.ts +7 -0
  102. package/lib/scores/DefaultCallScoreCalculator.d.ts.map +1 -0
  103. package/lib/scores/DefaultCallScoreCalculator.js +21 -0
  104. package/lib/scores/ScoreCalculator.d.ts +4 -0
  105. package/lib/scores/ScoreCalculator.d.ts.map +1 -0
  106. package/lib/scores/ScoreCalculator.js +2 -0
  107. package/lib/utils/CallUpdater.d.ts +5 -0
  108. package/lib/utils/CallUpdater.d.ts.map +1 -0
  109. package/lib/utils/CallUpdater.js +2 -0
  110. package/lib/utils/OnAllClientCallUpdater.d.ts +16 -0
  111. package/lib/utils/OnAllClientCallUpdater.d.ts.map +1 -0
  112. package/lib/utils/OnAllClientCallUpdater.js +58 -0
  113. package/lib/utils/RemoteTrackResolver.d.ts +7 -0
  114. package/lib/utils/RemoteTrackResolver.d.ts.map +1 -0
  115. package/lib/utils/RemoteTrackResolver.js +2 -0
  116. package/lib/utils/onAnyClientCallUpdater.d.ts +14 -0
  117. package/lib/utils/onAnyClientCallUpdater.d.ts.map +1 -0
  118. package/lib/utils/onAnyClientCallUpdater.js +51 -0
  119. package/package.json +4 -4
  120. package/src/ObservedCall.ts +116 -166
  121. package/src/ObservedCertificate.ts +43 -0
  122. package/src/ObservedClient.ts +213 -1060
  123. package/src/ObservedCodec.ts +49 -0
  124. package/src/ObservedDataChannel.ts +68 -181
  125. package/src/ObservedIceCandidate.ts +64 -0
  126. package/src/ObservedIceCandidatePair.ts +118 -0
  127. package/src/ObservedIceTransport.ts +70 -0
  128. package/src/ObservedInboundRtp.ts +205 -0
  129. package/src/ObservedInboundTrack.ts +70 -0
  130. package/src/ObservedMediaPlayout.ts +49 -0
  131. package/src/ObservedMediaSource.ts +60 -0
  132. package/src/ObservedOutboundRtp.ts +156 -0
  133. package/src/ObservedOutboundTrack.ts +69 -0
  134. package/src/ObservedPeerConnection.ts +827 -405
  135. package/src/ObservedPeerConnectionTransport.ts +38 -0
  136. package/src/ObservedRemoteInboundRtp.ts +64 -0
  137. package/src/ObservedRemoteOutboundRtp.ts +65 -0
  138. package/src/ObservedTURN.ts +86 -0
  139. package/src/ObservedTurnServer.ts +72 -0
  140. package/src/Observer.ts +91 -302
  141. package/src/common/Middleware.ts +70 -42
  142. package/src/common/logger.ts +60 -69
  143. package/src/common/types.ts +0 -42
  144. package/src/common/utils.ts +12 -0
  145. package/src/detectors/Detector.ts +6 -0
  146. package/src/detectors/Detectors.ts +38 -0
  147. package/src/index.ts +24 -90
  148. package/src/monitors/TurnUsageMonitor.ts +164 -164
  149. package/src/schema/ClientEventTypes.ts +36 -0
  150. package/src/schema/ClientMetaTypes.ts +41 -0
  151. package/src/schema/ClientSample.ts +1682 -0
  152. package/src/scores/CalculatedScore.ts +6 -0
  153. package/src/scores/DefaultCallScoreCalculator.ts +23 -0
  154. package/src/scores/ScoreCalculator.ts +3 -0
  155. package/src/utils/CallUpdater.ts +5 -0
  156. package/src/utils/OnAllClientCallUpdater.ts +68 -0
  157. package/src/utils/RemoteTrackResolver.ts +12 -0
  158. package/src/utils/onAnyClientCallUpdater.ts +59 -0
  159. package/tsconfig.json +3 -3
  160. package/lib/ObservedICE.d.ts +0 -64
  161. package/lib/ObservedICE.d.ts.map +0 -1
  162. package/lib/ObservedICE.js +0 -141
  163. package/lib/ObservedInboundAudioTrack.d.ts +0 -96
  164. package/lib/ObservedInboundAudioTrack.d.ts.map +0 -1
  165. package/lib/ObservedInboundAudioTrack.js +0 -217
  166. package/lib/ObservedInboundVideoTrack.d.ts +0 -101
  167. package/lib/ObservedInboundVideoTrack.d.ts.map +0 -1
  168. package/lib/ObservedInboundVideoTrack.js +0 -232
  169. package/lib/ObservedOutboundAudioTrack.d.ts +0 -87
  170. package/lib/ObservedOutboundAudioTrack.d.ts.map +0 -1
  171. package/lib/ObservedOutboundAudioTrack.js +0 -186
  172. package/lib/ObservedOutboundVideoTrack.d.ts +0 -91
  173. package/lib/ObservedOutboundVideoTrack.d.ts.map +0 -1
  174. package/lib/ObservedOutboundVideoTrack.js +0 -193
  175. package/lib/ObservedSfu.d.ts +0 -59
  176. package/lib/ObservedSfu.d.ts.map +0 -1
  177. package/lib/ObservedSfu.js +0 -157
  178. package/lib/ObservedSfuInboundRtpPad.d.ts +0 -42
  179. package/lib/ObservedSfuInboundRtpPad.d.ts.map +0 -1
  180. package/lib/ObservedSfuInboundRtpPad.js +0 -71
  181. package/lib/ObservedSfuOutboundRtpPad.d.ts +0 -42
  182. package/lib/ObservedSfuOutboundRtpPad.d.ts.map +0 -1
  183. package/lib/ObservedSfuOutboundRtpPad.js +0 -72
  184. package/lib/ObservedSfuSctpChannel.d.ts +0 -42
  185. package/lib/ObservedSfuSctpChannel.d.ts.map +0 -1
  186. package/lib/ObservedSfuSctpChannel.js +0 -57
  187. package/lib/ObservedSfuTransport.d.ts +0 -58
  188. package/lib/ObservedSfuTransport.d.ts.map +0 -1
  189. package/lib/ObservedSfuTransport.js +0 -120
  190. package/lib/RemoteTrackAssigner.d.ts +0 -14
  191. package/lib/RemoteTrackAssigner.d.ts.map +0 -1
  192. package/lib/RemoteTrackAssigner.js +0 -52
  193. package/lib/ReportsCollector.d.ts +0 -109
  194. package/lib/ReportsCollector.d.ts.map +0 -1
  195. package/lib/ReportsCollector.js +0 -207
  196. package/lib/common/CalculatedScore.d.ts +0 -80
  197. package/lib/common/CalculatedScore.d.ts.map +0 -1
  198. package/lib/common/CalculatedScore.js +0 -162
  199. package/lib/common/CallEventType.d.ts +0 -63
  200. package/lib/common/CallEventType.d.ts.map +0 -1
  201. package/lib/common/CallEventType.js +0 -39
  202. package/lib/common/CallMetaReports.d.ts +0 -42
  203. package/lib/common/CallMetaReports.d.ts.map +0 -1
  204. package/lib/common/CallMetaReports.js +0 -36
  205. package/lib/common/QualityScoreUtils.d.ts +0 -1
  206. package/lib/common/QualityScoreUtils.d.ts.map +0 -1
  207. package/lib/common/QualityScoreUtils.js +0 -1
  208. package/lib/common/TypedEventEmitter.d.ts +0 -22
  209. package/lib/common/TypedEventEmitter.d.ts.map +0 -1
  210. package/lib/common/TypedEventEmitter.js +0 -11
  211. package/lib/common/callEventReports.d.ts +0 -10
  212. package/lib/common/callEventReports.d.ts.map +0 -1
  213. package/lib/common/callEventReports.js +0 -112
  214. package/lib/monitors/CallSummary.d.ts +0 -37
  215. package/lib/monitors/CallSummary.d.ts.map +0 -1
  216. package/lib/monitors/CallSummaryMonitor.d.ts +0 -32
  217. package/lib/monitors/CallSummaryMonitor.d.ts.map +0 -1
  218. package/lib/monitors/CallSummaryMonitor.js +0 -152
  219. package/lib/monitors/ClientIssueMonitor.d.ts +0 -32
  220. package/lib/monitors/ClientIssueMonitor.d.ts.map +0 -1
  221. package/lib/monitors/ClientIssueMonitor.js +0 -49
  222. package/lib/monitors/SfuServerMonitor.d.ts +0 -79
  223. package/lib/monitors/SfuServerMonitor.d.ts.map +0 -1
  224. package/lib/monitors/SfuServerMonitor.js +0 -198
  225. package/src/ObservedICE.ts +0 -237
  226. package/src/ObservedInboundAudioTrack.ts +0 -344
  227. package/src/ObservedInboundVideoTrack.ts +0 -361
  228. package/src/ObservedOutboundAudioTrack.ts +0 -307
  229. package/src/ObservedOutboundVideoTrack.ts +0 -319
  230. package/src/ObservedSfu.ts +0 -231
  231. package/src/ObservedSfuInboundRtpPad.ts +0 -106
  232. package/src/ObservedSfuOutboundRtpPad.ts +0 -107
  233. package/src/ObservedSfuSctpChannel.ts +0 -103
  234. package/src/ObservedSfuTransport.ts +0 -185
  235. package/src/RemoteTrackAssigner.ts +0 -68
  236. package/src/ReportsCollector.ts +0 -336
  237. package/src/common/CalculatedScore.ts +0 -188
  238. package/src/common/CallEventType.ts +0 -69
  239. package/src/common/CallMetaReports.ts +0 -82
  240. package/src/common/QualityScoreUtils.ts +0 -0
  241. package/src/common/TypedEventEmitter.ts +0 -32
  242. package/src/common/callEventReports.ts +0 -178
  243. package/src/monitors/CallSummary.ts +0 -38
  244. package/src/monitors/CallSummaryMonitor.ts +0 -192
  245. package/src/monitors/ClientIssueMonitor.ts +0 -88
  246. package/src/monitors/SfuServerMonitor.ts +0 -285
  247. /package/lib/{monitors/CallSummary.js → scores/CalculatedScore.js} +0 -0
package/lib/Observer.js CHANGED
@@ -1,255 +1,101 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.Observer = void 0;
15
4
  const logger_1 = require("./common/logger");
16
5
  const ObservedCall_1 = require("./ObservedCall");
17
- const ReportsCollector_1 = require("./ReportsCollector");
18
6
  const events_1 = require("events");
19
- const callEventReports_1 = require("./common/callEventReports");
20
- const ObservedSfu_1 = require("./ObservedSfu");
21
- const CallSummaryMonitor_1 = require("./monitors/CallSummaryMonitor");
22
- const TurnUsageMonitor_1 = require("./monitors/TurnUsageMonitor");
23
- const ClientIssueMonitor_1 = require("./monitors/ClientIssueMonitor");
24
- const SfuServerMonitor_1 = require("./monitors/SfuServerMonitor");
7
+ const ObservedTURN_1 = require("./ObservedTURN");
25
8
  const logger = (0, logger_1.createLogger)('Observer');
26
9
  class Observer extends events_1.EventEmitter {
27
- static create(providedConfig) {
28
- const config = Object.assign({
29
- defaultServiceId: 'default-service-id',
30
- defaultMediaUnitId: 'default-media-unit-id',
31
- evaluator: {
32
- fetchSamples: true,
33
- maxIdleTimeInMs: 300 * 1000,
34
- },
35
- sink: {},
36
- logLevel: 'info',
37
- }, providedConfig);
38
- return new Observer(config);
10
+ observedTURN = new ObservedTURN_1.ObservedTURN();
11
+ observedCalls = new Map();
12
+ config;
13
+ closed = false;
14
+ numberOfClients = 0;
15
+ numberOfInboundRtpStreams = 0;
16
+ numberOfOutboundRtpStreams = 0;
17
+ numberOfDataChannels = 0;
18
+ numberOfPeerConnections = 0;
19
+ get numberOfCalls() {
20
+ return this.observedCalls.size;
39
21
  }
40
- constructor(config) {
22
+ _timer;
23
+ constructor(config = {
24
+ updateIntervalInMs: 10000,
25
+ }) {
41
26
  super();
42
- this.config = config;
43
- this.reports = new ReportsCollector_1.ReportsCollector();
44
- this._observedCalls = new Map();
45
- this._observedSfus = new Map();
46
- this._monitors = new Map();
47
- this._closed = false;
48
27
  this.setMaxListeners(Infinity);
49
- logger.debug('Observer is created with config', this.config);
50
- const onReports = (context) => this.emit('reports', context);
51
- const onNewReport = (collectedReports) => {
52
- if (!this.config.maxReports || this._closed)
53
- return;
54
- if (this.config.maxReports < collectedReports) {
55
- this._emitReports();
56
- }
57
- };
58
- this._emitReports();
59
- this.once('close', () => {
60
- this.reports.off('newreport', onNewReport);
61
- this.reports.off('reports', onReports);
62
- });
63
- this.reports.on('newreport', onNewReport);
64
- this.reports.on('reports', onReports);
65
- }
66
- createObservedCall(config) {
67
- if (this._closed) {
68
- throw new Error('Attempted to create a call source on a closed observer');
69
- }
70
- const { appData, reportCallEnded = true, reportCallStarted = true } = config, model = __rest(config, ["appData", "reportCallEnded", "reportCallStarted"]);
71
- const call = new ObservedCall_1.ObservedCall(Object.assign(Object.assign({}, model), { serviceId: this.config.defaultServiceId }), this, appData);
72
- if (this._closed)
73
- throw new Error('Cannot create an observed call on a closed observer');
74
- if (this._observedCalls.has(call.callId))
75
- throw new Error(`Observed Call with id ${call.callId} already exists`);
76
- call.once('close', () => {
77
- var _a;
78
- this._observedCalls.delete(call.callId);
79
- reportCallEnded && this.reports.addCallEventReport((0, callEventReports_1.createCallEndedEventReport)(call.serviceId, call.roomId, call.callId, (_a = call.observationEnded) !== null && _a !== void 0 ? _a : Date.now()));
80
- });
81
- this._observedCalls.set(call.callId, call);
82
- reportCallStarted && this.reports.addCallEventReport((0, callEventReports_1.createCallStartedEventReport)(call.serviceId, call.roomId, call.callId, call.observationStarted));
83
- this.emit('newcall', call);
84
- return call;
85
- }
86
- createObservedSfu(model, appData) {
87
- if (this._closed) {
88
- throw new Error('Attempted to create an sfu source on a closed observer');
28
+ this.config = config;
29
+ this.update = this.update.bind(this);
30
+ if (this.config.updateIntervalInMs) {
31
+ this._timer = setInterval(this.update.bind(this), this.config.updateIntervalInMs);
89
32
  }
90
- const sfu = new ObservedSfu_1.ObservedSfu(model, this, appData);
91
- if (this._closed)
92
- throw new Error('Cannot create an observed sfu on a closed observer');
93
- if (this._observedSfus.has(sfu.sfuId))
94
- throw new Error(`Observed SFU with id ${sfu.sfuId} already exists`);
95
- sfu.once('close', () => {
96
- this._observedSfus.delete(sfu.sfuId);
97
- });
98
- this._observedSfus.set(sfu.sfuId, sfu);
99
- this.emit('newsfu', sfu);
100
- return sfu;
101
- }
102
- createCallSummaryMonitor(options) {
103
- if (this._closed)
104
- throw new Error('Cannot create a call summary monitor on a closed observer');
105
- const existingMonitor = this._monitors.get(CallSummaryMonitor_1.CallSummaryMonitor.name);
106
- if (existingMonitor)
107
- return existingMonitor;
108
- const monitor = new CallSummaryMonitor_1.CallSummaryMonitor(options);
109
- const onNewCall = (call) => {
110
- monitor.addCall(call);
111
- call.once('close', () => {
112
- var _a;
113
- return setTimeout(() => {
114
- const summary = monitor.takeSummary(call.callId);
115
- summary && monitor.emit('summary', summary);
116
- }, (_a = options === null || options === void 0 ? void 0 : options.timeoutAfterCallClose) !== null && _a !== void 0 ? _a : 1000);
117
- });
118
- };
119
- monitor.once('close', () => {
120
- this._monitors.delete(CallSummaryMonitor_1.CallSummaryMonitor.name);
121
- this.off('newcall', onNewCall);
122
- });
123
- this._monitors.set(CallSummaryMonitor_1.CallSummaryMonitor.name, monitor);
124
- this.on('newcall', onNewCall);
125
- this.once('close', () => {
126
- monitor.close();
127
- });
128
- return monitor;
129
- }
130
- createTurnUsageMonitor() {
131
- if (this._closed)
132
- throw new Error('Cannot create a turn usage monitor on a closed observer');
133
- const existingMonitor = this._monitors.get(TurnUsageMonitor_1.TurnUsageMonitor.name);
134
- if (existingMonitor)
135
- return existingMonitor;
136
- const monitor = new TurnUsageMonitor_1.TurnUsageMonitor();
137
- const onNewCall = (call) => {
138
- const onNewClient = (client) => {
139
- const onNewPeerConnection = (pc) => {
140
- const onUsingTurnChanged = (usingTurn) => {
141
- if (usingTurn)
142
- monitor.addPeerConnection(pc);
143
- else
144
- monitor.removePeerConnection(pc);
145
- };
146
- pc.once('close', () => {
147
- pc.ICE.off('usingturnchanged', onUsingTurnChanged);
148
- monitor.removePeerConnection(pc);
149
- });
150
- pc.ICE.on('usingturnchanged', onUsingTurnChanged);
151
- };
152
- client.once('close', () => client.off('newpeerconnection', onNewPeerConnection));
153
- client.on('newpeerconnection', onNewPeerConnection);
154
- };
155
- call.once('close', () => call.off('newclient', onNewClient));
156
- call.on('newclient', onNewClient);
157
- };
158
- monitor.once('close', () => {
159
- this._monitors.delete(TurnUsageMonitor_1.TurnUsageMonitor.name);
160
- this.off('newcall', onNewCall);
161
- });
162
- this._monitors.set(TurnUsageMonitor_1.TurnUsageMonitor.name, monitor);
163
- this.on('newcall', onNewCall);
164
- this.once('close', () => {
165
- monitor.close();
166
- });
167
- return monitor;
168
33
  }
169
- createSfuServerMonitor() {
170
- if (this._closed)
171
- throw new Error('Cannot create a turn usage monitor on a closed observer');
172
- const existingMonitor = this._monitors.get(SfuServerMonitor_1.SfuServerMonitor.name);
173
- if (existingMonitor)
174
- return existingMonitor;
175
- const monitor = new SfuServerMonitor_1.SfuServerMonitor({
176
- tooHighRttAlertSettings: {
177
- minNumberOfPeerConnections: 10,
178
- percentageOfPeerConnectionsHighWatermark: 0.5,
179
- percentageOfPeerConnectionsLowWatermark: 0.2,
180
- threshold: 'rtt-gt-300',
181
- }
182
- });
183
- const onNewCall = (call) => {
184
- const onNewClient = (client) => {
185
- const onNewPeerConnection = (pc) => {
186
- monitor.addPeerConnection(pc);
187
- };
188
- client.once('close', () => client.off('newpeerconnection', onNewPeerConnection));
189
- client.on('newpeerconnection', onNewPeerConnection);
190
- };
191
- call.once('close', () => call.off('newclient', onNewClient));
192
- call.on('newclient', onNewClient);
193
- };
194
- monitor.once('close', () => {
195
- this._monitors.delete(SfuServerMonitor_1.SfuServerMonitor.name);
196
- this.off('newcall', onNewCall);
197
- });
198
- this._monitors.set(SfuServerMonitor_1.SfuServerMonitor.name, monitor);
199
- this.on('newcall', onNewCall);
200
- this.once('close', () => {
201
- monitor.close();
202
- });
203
- return monitor;
34
+ getObservedCall(callId) {
35
+ if (this.closed || !this.observedCalls.has(callId))
36
+ return;
37
+ return this.observedCalls.get(callId);
204
38
  }
205
- createClientIssueMonitor() {
206
- if (this._closed)
207
- throw new Error('Cannot create a turn usage monitor on a closed observer');
208
- const existingMonitor = this._monitors.get(ClientIssueMonitor_1.ClientIssueMonitor.name);
209
- if (existingMonitor)
210
- return existingMonitor;
211
- const monitor = new ClientIssueMonitor_1.ClientIssueMonitor();
212
- const onNewCall = (call) => monitor.addCall(call);
213
- monitor.once('close', () => {
214
- this._monitors.delete(ClientIssueMonitor_1.ClientIssueMonitor.name);
215
- this.off('newcall', onNewCall);
216
- });
217
- this._monitors.set(ClientIssueMonitor_1.ClientIssueMonitor.name, monitor);
218
- this.on('newcall', onNewCall);
219
- this.once('close', () => {
220
- monitor.close();
39
+ createObservedCall(settings) {
40
+ if (this.closed) {
41
+ throw new Error('Attempted to create a call source on a closed observer');
42
+ }
43
+ const observedCall = new ObservedCall_1.ObservedCall(settings, this);
44
+ if (this.observedCalls.has(observedCall.callId))
45
+ throw new Error(`Observed Call with id ${observedCall.callId} already exists`);
46
+ observedCall.once('close', () => {
47
+ this.observedCalls.delete(observedCall.callId);
48
+ observedCall.off('update', this.update);
221
49
  });
222
- return monitor;
223
- }
224
- get observedCalls() {
225
- return this._observedCalls;
226
- }
227
- get observedSfus() {
228
- return this._observedSfus;
229
- }
230
- get closed() {
231
- return this._closed;
50
+ this.observedCalls.set(observedCall.callId, observedCall);
51
+ observedCall.on('update', this.update);
52
+ this.emit('newcall', observedCall);
53
+ return observedCall;
232
54
  }
233
55
  close() {
234
- if (this._closed) {
56
+ if (this.closed) {
235
57
  return logger.debug('Attempted to close twice');
236
58
  }
237
- this._closed = true;
238
- this._observedCalls.forEach((call) => call.close());
59
+ this.closed = true;
60
+ clearInterval(this._timer);
61
+ this._timer = undefined;
62
+ this.observedCalls.forEach((call) => call.close());
239
63
  this.emit('close');
240
64
  }
241
- _emitReports() {
242
- if (this._reportTimer) {
243
- clearTimeout(this._reportTimer);
244
- this._reportTimer = undefined;
65
+ accept(sample) {
66
+ if (this.closed)
67
+ return;
68
+ if (!sample.callId)
69
+ return logger.warn('Received sample without callId. %o', sample);
70
+ if (!sample.clientId)
71
+ return logger.warn('Received sample without clientId %o', sample);
72
+ const call = this.getObservedCall(sample.callId);
73
+ if (!call) {
74
+ return logger.warn(`Received sample for unknown call ${sample.callId}. %o`, sample);
75
+ }
76
+ const client = call.getObservedClient(sample.clientId);
77
+ if (!client) {
78
+ return logger.warn(`Received sample for unknown client ${sample.clientId} in call ${sample.callId}. %o`, sample);
79
+ }
80
+ client.accept(sample);
81
+ }
82
+ update() {
83
+ if (this.closed) {
84
+ return;
245
85
  }
246
- this.reports.emit();
247
- if (this.config.maxCollectingTimeInMs) {
248
- this._reportTimer = setTimeout(() => {
249
- this._reportTimer = undefined;
250
- this._emitReports();
251
- }, this.config.maxCollectingTimeInMs);
86
+ this.numberOfInboundRtpStreams = 0;
87
+ this.numberOfOutboundRtpStreams = 0;
88
+ this.numberOfPeerConnections = 0;
89
+ this.numberOfDataChannels = 0;
90
+ this.numberOfClients = 0;
91
+ for (const call of this.observedCalls.values()) {
92
+ this.numberOfInboundRtpStreams += call.numberOfInboundRtpStreams;
93
+ this.numberOfOutboundRtpStreams += call.numberOfOutboundRtpStreams;
94
+ this.numberOfPeerConnections += call.numberOfPeerConnections;
95
+ this.numberOfDataChannels += call.numberOfDataChannels;
96
+ this.numberOfClients += call.numberOfClients;
252
97
  }
98
+ this.observedTURN.update();
253
99
  }
254
100
  }
255
101
  exports.Observer = Observer;
@@ -1,8 +1,17 @@
1
1
  export type Middleware<T> = (input: T, next: (nextInput: T) => void) => void;
2
2
  export interface Processor<T> {
3
+ finalCallback?: Callback<T>;
3
4
  process(value: T): void;
4
5
  addMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
5
6
  removeMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
6
7
  }
7
- export declare function createProcessor<T>(): Processor<T>;
8
+ type Callback<T> = (input: T) => void;
9
+ export declare class MiddlewareProcessor<T> implements Processor<T> {
10
+ private stack;
11
+ finalCallback?: Callback<T>;
12
+ addMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
13
+ removeMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
14
+ process(value: T): void;
15
+ }
16
+ export {};
8
17
  //# sourceMappingURL=Middleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/common/Middleware.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAC3B,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,IAAI,KACxB,IAAI,CAAC;AAEV,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;CAChE;AAED,wBAAgB,eAAe,CAAC,CAAC,KAC9B,SAAS,CAAC,CAAC,CAAC,CA2Cd"}
1
+ {"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/common/Middleware.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAC3B,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,IAAI,KACxB,IAAI,CAAC;AAEV,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;CAChE;AAED,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAoCtC,qBAAa,mBAAmB,CAAC,CAAC,CAAE,YAAW,SAAS,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,KAAK,CAAuB;IAC7B,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE5B,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;IAQ5D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;IAc/D,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;CAS9B"}
@@ -1,41 +1,60 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createProcessor = void 0;
4
- function createProcessor() {
5
- const stack = [];
6
- const result = {
7
- addMiddleware: (...middlewares) => {
8
- if (middlewares && 0 < middlewares.length) {
9
- stack.push(...middlewares);
10
- }
11
- return result;
12
- },
13
- removeMiddleware: (...middlewares) => {
14
- if (middlewares && 0 < middlewares.length) {
15
- for (const process of middlewares) {
16
- const index = stack.indexOf(process);
17
- if (0 < index)
18
- stack.splice(index, 1);
3
+ exports.MiddlewareProcessor = void 0;
4
+ class Executor {
5
+ stack;
6
+ finalCallback;
7
+ done = false;
8
+ index = 0;
9
+ prevIndex = -1;
10
+ constructor(stack, finalCallback) {
11
+ this.stack = stack;
12
+ this.finalCallback = finalCallback;
13
+ }
14
+ // Executes the middleware stack
15
+ execute(input) {
16
+ if (this.index <= this.prevIndex) {
17
+ throw new Error('Middleware must call next() only once!');
18
+ }
19
+ else if (this.done) {
20
+ throw new Error('Middleware stack has already been executed!');
21
+ }
22
+ this.prevIndex = this.index;
23
+ const middleware = this.stack[this.index];
24
+ this.index++;
25
+ if (middleware) {
26
+ return middleware(input, (nextInput) => this.execute(nextInput));
27
+ }
28
+ this.done = true;
29
+ this.finalCallback?.(input);
30
+ }
31
+ }
32
+ class MiddlewareProcessor {
33
+ stack = [];
34
+ finalCallback;
35
+ addMiddleware(...middlewares) {
36
+ if (middlewares && middlewares.length > 0) {
37
+ this.stack.push(...middlewares);
38
+ }
39
+ return this;
40
+ }
41
+ removeMiddleware(...middlewares) {
42
+ if (middlewares && middlewares.length > 0) {
43
+ for (const middleware of middlewares) {
44
+ const index = this.stack.indexOf(middleware);
45
+ if (index >= 0) {
46
+ this.stack.splice(index, 1);
19
47
  }
20
48
  }
21
- return result;
22
- },
23
- process: (value) => {
24
- let prevIndex = -1;
25
- const execute = (index, input) => {
26
- if (index <= prevIndex) {
27
- throw new Error('middleware must call next() only once!');
28
- }
29
- prevIndex = index;
30
- const middleware = stack[index];
31
- if (!middleware)
32
- return;
33
- const next = (nextInput) => execute(index + 1, nextInput);
34
- return middleware(input, next);
35
- };
36
- return execute(0, value);
37
- },
38
- };
39
- return result;
49
+ }
50
+ return this;
51
+ }
52
+ process(value) {
53
+ if (this.stack.length === 0) {
54
+ return this.finalCallback?.(value);
55
+ }
56
+ const executor = new Executor(this.stack, this.finalCallback);
57
+ executor.execute(value);
58
+ }
40
59
  }
41
- exports.createProcessor = createProcessor;
60
+ exports.MiddlewareProcessor = MiddlewareProcessor;
@@ -1,4 +1,3 @@
1
- export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
2
1
  export interface Logger {
3
2
  trace(...args: any[]): void;
4
3
  debug(...args: any[]): void;
@@ -6,8 +5,13 @@ export interface Logger {
6
5
  warn(...args: any[]): void;
7
6
  error(...args: any[]): void;
8
7
  }
9
- export declare function setLogLevel(level: LogLevel): void;
10
- export declare const getLogLevel: () => LogLevel;
11
- export declare function forwardLogsTo(logger: Logger | null): void;
8
+ export interface ObserverLogger {
9
+ trace(module: string, ...args: any[]): void;
10
+ debug(module: string, ...args: any[]): void;
11
+ info(module: string, ...args: any[]): void;
12
+ warn(module: string, ...args: any[]): void;
13
+ error(module: string, ...args: any[]): void;
14
+ }
12
15
  export declare function createLogger(moduleName: string): Logger;
16
+ export declare function setObserverLogger(logger: ObserverLogger): void;
13
17
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/common/logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhF,MAAM,WAAW,MAAM;IAEtB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC5B;AAiBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,QAO1C;AAED,eAAO,MAAM,WAAW,gBAEvB,CAAC;AAEF,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,QAElD;AAcD,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CA+BvD"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/common/logger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IAEtB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAE9B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5C,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC5C;AA8BD,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAuBvD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,QAEvD"}
@@ -1,74 +1,50 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLogger = exports.forwardLogsTo = exports.getLogLevel = exports.setLogLevel = void 0;
4
- let logLevel = 'error';
5
- const loggers = new Map();
6
- let target = {
7
- // eslint-disable-next-line no-console
8
- trace: (...args) => console.log(...args),
9
- // eslint-disable-next-line no-console
10
- debug: (...args) => console.log(...args),
11
- // eslint-disable-next-line no-console
12
- info: (...args) => console.log(...args),
13
- // eslint-disable-next-line no-console
14
- warn: (...args) => console.warn(...args),
15
- // eslint-disable-next-line no-console
16
- error: (...args) => console.error(...args),
17
- };
18
- function setLogLevel(level) {
19
- logLevel = level;
20
- const moduleNames = Array.from(loggers.keys());
21
- loggers.clear();
22
- moduleNames.forEach((moduleName) => createLogger(moduleName));
23
- }
24
- exports.setLogLevel = setLogLevel;
25
- const getLogLevel = () => {
26
- return logLevel;
27
- };
28
- exports.getLogLevel = getLogLevel;
29
- function forwardLogsTo(logger) {
30
- target = logger;
31
- }
32
- exports.forwardLogsTo = forwardLogsTo;
33
- const COLORS = {
34
- black: '\x1b[30m',
35
- red: '\x1b[31m',
36
- green: '\x1b[32m',
37
- yellow: '\x1b[33m',
38
- blue: '\x1b[34m',
39
- magenta: '\x1b[35m',
40
- cyan: '\x1b[36m',
41
- white: '\x1b[37m',
42
- default: '\x1b[39m',
43
- };
44
- function createLogger(moduleName) {
45
- if (loggers.has(moduleName)) {
3
+ exports.setObserverLogger = exports.createLogger = void 0;
4
+ let mainLogger = new class {
5
+ trace = () => void 0;
6
+ // trace(module: string, ...args: any[]) {
7
+ // // eslint-disable-next-line no-console
8
+ // console.log(`[TRACE] ${module}`, ...args);
9
+ // }
10
+ debug(module, ...args) {
46
11
  // eslint-disable-next-line no-console
47
- console.warn(`Logger for module ${moduleName} already exists`);
12
+ console.log(`[DEBUG] ${module}`, ...args);
48
13
  }
49
- const trace = logLevel === 'trace' ? (message, ...args) => {
50
- target === null || target === void 0 ? void 0 : target.trace(`${COLORS.magenta}[TRACE]${COLORS.default} ${moduleName} ${message}`, ...args);
51
- } : () => void 0;
52
- const debug = logLevel === 'trace' || logLevel === 'debug' ? (message, ...args) => {
53
- target === null || target === void 0 ? void 0 : target.debug(`${COLORS.cyan}[DEBUG]${COLORS.default} ${moduleName} ${message}`, ...args);
54
- } : () => void 0;
55
- const info = logLevel === 'trace' || logLevel === 'debug' || logLevel === 'info' ? (message, ...args) => {
56
- target === null || target === void 0 ? void 0 : target.info(`${COLORS.green}[INFO]${COLORS.default} ${moduleName} ${message}`, ...args);
57
- } : () => void 0;
58
- const warn = logLevel === 'trace' || logLevel === 'debug' || logLevel === 'info' || logLevel === 'warn' ? (message, ...args) => {
59
- target === null || target === void 0 ? void 0 : target.warn(`${COLORS.yellow}[WARN]${COLORS.default} ${moduleName} ${message}`, ...args);
60
- } : () => void 0;
61
- const error = logLevel === 'trace' || logLevel === 'debug' || logLevel === 'info' || logLevel === 'warn' || logLevel === 'error' ? (message, ...args) => {
62
- target === null || target === void 0 ? void 0 : target.error(`${COLORS.red}[ERROR]${COLORS.default} ${moduleName} ${message}`, ...args);
63
- } : () => void 0;
64
- const logger = {
65
- trace,
66
- debug,
67
- info,
68
- warn,
69
- error,
70
- };
71
- loggers.set(moduleName, logger);
72
- return logger;
14
+ info(module, ...args) {
15
+ // eslint-disable-next-line no-console
16
+ console.info(`[INFO] ${module}`, ...args);
17
+ }
18
+ warn(module, ...args) {
19
+ // eslint-disable-next-line no-console
20
+ console.warn(`[WARN] ${module}`, ...args);
21
+ }
22
+ error(module, ...args) {
23
+ // eslint-disable-next-line no-console
24
+ console.error(`[ERROR] ${module}`, ...args);
25
+ }
26
+ }();
27
+ function createLogger(moduleName) {
28
+ return new class {
29
+ trace(...args) {
30
+ mainLogger.trace(moduleName, ...args);
31
+ }
32
+ debug(...args) {
33
+ mainLogger.debug(moduleName, ...args);
34
+ }
35
+ info(...args) {
36
+ mainLogger.info(moduleName, ...args);
37
+ }
38
+ warn(...args) {
39
+ mainLogger.warn(moduleName, ...args);
40
+ }
41
+ error(...args) {
42
+ mainLogger.error(moduleName, ...args);
43
+ }
44
+ }();
73
45
  }
74
46
  exports.createLogger = createLogger;
47
+ function setObserverLogger(logger) {
48
+ mainLogger = logger;
49
+ }
50
+ exports.setObserverLogger = setObserverLogger;
@@ -1,24 +1,3 @@
1
- import { CallEventReport, CallMetaReport, ClientDataChannelReport, ClientExtensionReport, IceCandidatePairReport, InboundAudioTrackReport, InboundVideoTrackReport, ObserverEventReport, OutboundAudioTrackReport, OutboundVideoTrackReport, PeerConnectionTransportReport, SfuEventReport, SfuExtensionReport, SfuInboundRtpPadReport, SfuMetaReport, SfuOutboundRtpPadReport, SfuSctpStreamReport, SFUTransportReport } from '@observertc/report-schemas-js';
2
1
  export type MediaKind = 'audio' | 'video';
3
2
  export type SupportedVideoCodecType = 'vp8' | 'vp9' | 'h264' | 'h265';
4
- export interface ObserverSinkContext {
5
- readonly callEventReports: CallEventReport[];
6
- readonly callMetaReports: CallMetaReport[];
7
- readonly clientDataChannelReports: ClientDataChannelReport[];
8
- readonly clientExtensionReports: ClientExtensionReport[];
9
- readonly iceCandidatePairReports: IceCandidatePairReport[];
10
- readonly inboundAudioTrackReports: InboundAudioTrackReport[];
11
- readonly inboundVideoTrackReports: InboundVideoTrackReport[];
12
- readonly peerConnectionTransportReports: PeerConnectionTransportReport[];
13
- readonly observerEventReports: ObserverEventReport[];
14
- readonly outboundAudioTrackReports: OutboundAudioTrackReport[];
15
- readonly outboundVideoTrackReports: OutboundVideoTrackReport[];
16
- readonly sfuEventReports: SfuEventReport[];
17
- readonly sfuExtensionReports: SfuExtensionReport[];
18
- readonly sfuInboundRtpPadReports: SfuInboundRtpPadReport[];
19
- readonly sfuOutboundRtpPadReports: SfuOutboundRtpPadReport[];
20
- readonly sfuSctpStreamReports: SfuSctpStreamReport[];
21
- readonly sfuTransportReports: SFUTransportReport[];
22
- readonly sfuMetaReports: SfuMetaReport[];
23
- }
24
3
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAC1C,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAItE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,cAAc,EAAE,CAAC;IAC3C,QAAQ,CAAC,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IAC7D,QAAQ,CAAC,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;IACzD,QAAQ,CAAC,uBAAuB,EAAE,sBAAsB,EAAE,CAAC;IAC3D,QAAQ,CAAC,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IAC7D,QAAQ,CAAC,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IAC7D,QAAQ,CAAC,8BAA8B,EAAE,6BAA6B,EAAE,CAAC;IACzE,QAAQ,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;IACrD,QAAQ,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,CAAC;IAC/D,QAAQ,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,CAAC;IAC/D,QAAQ,CAAC,eAAe,EAAE,cAAc,EAAE,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IACnD,QAAQ,CAAC,uBAAuB,EAAE,sBAAsB,EAAE,CAAC;IAC3D,QAAQ,CAAC,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IAC7D,QAAQ,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;IACrD,QAAQ,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IACnD,QAAQ,CAAC,cAAc,EAAE,aAAa,EAAE,CAAC;CACzC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAC1C,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ // export type EvaluatorMiddleware = Middleware<EvaluatorContext>;
@@ -6,4 +6,5 @@ export declare function iteratorConverter<T>(generator: Generator<T, void, undef
6
6
  export declare function asyncIteratorConverter<T>(generator: AsyncGenerator<T, void, undefined>): AsyncIterableIterator<T>;
7
7
  export declare function isValidUuid(str: string): boolean;
8
8
  export declare function getMedian(arr: number[]): number;
9
+ export declare function parseJsonAs<T>(json?: string): T | undefined;
9
10
  //# sourceMappingURL=utils.d.ts.map