@observertc/observer-js 0.9.26-beta → 0.30.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/lib/ObservedCall.d.ts +54 -0
  2. package/lib/ObservedCall.d.ts.map +1 -0
  3. package/lib/ObservedCall.js +166 -0
  4. package/lib/ObservedClient.d.ts +73 -0
  5. package/lib/ObservedClient.d.ts.map +1 -0
  6. package/lib/ObservedClient.js +487 -0
  7. package/lib/ObservedInboundTrack.d.ts +65 -0
  8. package/lib/ObservedInboundTrack.d.ts.map +1 -0
  9. package/lib/ObservedInboundTrack.js +192 -0
  10. package/lib/ObservedOutboundTrack.d.ts +55 -0
  11. package/lib/ObservedOutboundTrack.d.ts.map +1 -0
  12. package/lib/ObservedOutboundTrack.js +166 -0
  13. package/lib/ObservedPeerConnection.d.ts +57 -0
  14. package/lib/ObservedPeerConnection.d.ts.map +1 -0
  15. package/lib/ObservedPeerConnection.js +217 -0
  16. package/lib/Observer.d.ts +26 -1465
  17. package/lib/Observer.d.ts.map +1 -1
  18. package/lib/Observer.js +53 -605
  19. package/lib/{sinks/ObserverSink.d.ts → ReportsCollector.d.ts} +7 -23
  20. package/lib/ReportsCollector.d.ts.map +1 -0
  21. package/lib/{sinks/ObserverSink.js → ReportsCollector.js} +27 -85
  22. package/lib/common/ReportsCollector.d.ts +21 -24
  23. package/lib/common/ReportsCollector.d.ts.map +1 -1
  24. package/lib/common/ReportsCollector.js +24 -0
  25. package/lib/common/SingleExecutor.d.ts +3 -0
  26. package/lib/common/SingleExecutor.d.ts.map +1 -0
  27. package/lib/common/SingleExecutor.js +31 -0
  28. package/lib/common/TypedEventEmitter.d.ts +22 -0
  29. package/lib/common/TypedEventEmitter.d.ts.map +1 -0
  30. package/lib/common/TypedEventEmitter.js +11 -0
  31. package/lib/common/callEventReports.d.ts.map +1 -0
  32. package/lib/common/logger.d.ts +3 -9
  33. package/lib/common/logger.d.ts.map +1 -1
  34. package/lib/common/logger.js +58 -141
  35. package/lib/common/types.d.ts +2 -14
  36. package/lib/common/types.d.ts.map +1 -1
  37. package/lib/common/utils.d.ts +1 -0
  38. package/lib/common/utils.d.ts.map +1 -1
  39. package/lib/common/utils.js +6 -1
  40. package/lib/index.d.ts +8 -19
  41. package/lib/index.d.ts.map +1 -1
  42. package/lib/index.js +7 -2
  43. package/package.json +1 -1
  44. package/src/ObservedCall.ts +201 -0
  45. package/src/ObservedClient.ts +681 -0
  46. package/src/ObservedInboundTrack.ts +238 -0
  47. package/src/ObservedOutboundTrack.ts +205 -0
  48. package/src/ObservedPeerConnection.ts +249 -0
  49. package/src/Observer.ts +86 -442
  50. package/src/{sinks/ObserverSink.ts → ReportsCollector.ts} +29 -94
  51. package/src/common/ReportsCollector.ts +48 -23
  52. package/src/common/SingleExecutor.ts +36 -0
  53. package/src/common/TypedEventEmitter.ts +32 -0
  54. package/src/common/logger.ts +58 -161
  55. package/src/common/types.ts +4 -24
  56. package/src/common/utils.ts +6 -0
  57. package/src/index.ts +12 -23
  58. package/lib/Evaluator.d.ts +0 -43
  59. package/lib/Evaluator.d.ts.map +0 -1
  60. package/lib/Evaluator.js +0 -171
  61. package/lib/common/Semaphore.d.ts +0 -31
  62. package/lib/common/Semaphore.d.ts.map +0 -1
  63. package/lib/common/Semaphore.js +0 -16
  64. package/lib/entries/CallEntry.d.ts +0 -619
  65. package/lib/entries/CallEntry.d.ts.map +0 -1
  66. package/lib/entries/CallEntry.js +0 -75
  67. package/lib/entries/ClientEntry.d.ts +0 -478
  68. package/lib/entries/ClientEntry.d.ts.map +0 -1
  69. package/lib/entries/ClientEntry.js +0 -114
  70. package/lib/entries/InboundTrackEntry.d.ts +0 -682
  71. package/lib/entries/InboundTrackEntry.d.ts.map +0 -1
  72. package/lib/entries/InboundTrackEntry.js +0 -76
  73. package/lib/entries/OutboundTrackEntry.d.ts +0 -682
  74. package/lib/entries/OutboundTrackEntry.d.ts.map +0 -1
  75. package/lib/entries/OutboundTrackEntry.js +0 -73
  76. package/lib/entries/PeerConnectionEntry.d.ts +0 -505
  77. package/lib/entries/PeerConnectionEntry.d.ts.map +0 -1
  78. package/lib/entries/PeerConnectionEntry.js +0 -144
  79. package/lib/entries/SfuEntry.d.ts +0 -150
  80. package/lib/entries/SfuEntry.d.ts.map +0 -1
  81. package/lib/entries/SfuEntry.js +0 -77
  82. package/lib/entries/SfuInboundRtpPadEntry.d.ts +0 -14
  83. package/lib/entries/SfuInboundRtpPadEntry.d.ts.map +0 -1
  84. package/lib/entries/SfuInboundRtpPadEntry.js +0 -49
  85. package/lib/entries/SfuOutboundRtpPadEntry.d.ts +0 -14
  86. package/lib/entries/SfuOutboundRtpPadEntry.d.ts.map +0 -1
  87. package/lib/entries/SfuOutboundRtpPadEntry.js +0 -47
  88. package/lib/entries/SfuSctpChannelEntry.d.ts +0 -12
  89. package/lib/entries/SfuSctpChannelEntry.d.ts.map +0 -1
  90. package/lib/entries/SfuSctpChannelEntry.js +0 -43
  91. package/lib/entries/SfuTransportEntry.d.ts +0 -82
  92. package/lib/entries/SfuTransportEntry.d.ts.map +0 -1
  93. package/lib/entries/SfuTransportEntry.js +0 -122
  94. package/lib/evaluators/SetClientsCoordinateEvaluator.d.ts +0 -9
  95. package/lib/evaluators/SetClientsCoordinateEvaluator.d.ts.map +0 -1
  96. package/lib/evaluators/SetClientsCoordinateEvaluator.js +0 -95
  97. package/lib/middlewares/CallOperationsContext.d.ts +0 -18
  98. package/lib/middlewares/CallOperationsContext.d.ts.map +0 -1
  99. package/lib/middlewares/CallOperationsContext.js +0 -27
  100. package/lib/middlewares/CallProcessor.d.ts +0 -6
  101. package/lib/middlewares/CallProcessor.d.ts.map +0 -1
  102. package/lib/middlewares/CallProcessor.js +0 -36
  103. package/lib/middlewares/CommitTransactionMiddleware.d.ts +0 -6
  104. package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +0 -1
  105. package/lib/middlewares/CommitTransactionMiddleware.js +0 -179
  106. package/lib/middlewares/DeleteOutdatedCallEntries.d.ts +0 -6
  107. package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +0 -1
  108. package/lib/middlewares/DeleteOutdatedCallEntries.js +0 -121
  109. package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts +0 -6
  110. package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +0 -1
  111. package/lib/middlewares/DeleteOutdatedSfuEntries.js +0 -127
  112. package/lib/middlewares/Middleware.d.ts +0 -3
  113. package/lib/middlewares/Middleware.d.ts.map +0 -1
  114. package/lib/middlewares/Middleware.js +0 -21
  115. package/lib/middlewares/Processor.d.ts +0 -9
  116. package/lib/middlewares/Processor.d.ts.map +0 -1
  117. package/lib/middlewares/Processor.js +0 -54
  118. package/lib/middlewares/TransactionContext.d.ts +0 -35
  119. package/lib/middlewares/TransactionContext.d.ts.map +0 -1
  120. package/lib/middlewares/TransactionContext.js +0 -90
  121. package/lib/middlewares/TransactoinProcessor.d.ts +0 -6
  122. package/lib/middlewares/TransactoinProcessor.d.ts.map +0 -1
  123. package/lib/middlewares/TransactoinProcessor.js +0 -17
  124. package/lib/middlewares/VisitObservedCallsMiddleware.d.ts +0 -7
  125. package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +0 -1
  126. package/lib/middlewares/VisitObservedCallsMiddleware.js +0 -96
  127. package/lib/middlewares/VisitObservedSfusMiddleware.d.ts +0 -6
  128. package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +0 -1
  129. package/lib/middlewares/VisitObservedSfusMiddleware.js +0 -151
  130. package/lib/middlewares/visitors/visitClient.d.ts +0 -5
  131. package/lib/middlewares/visitors/visitClient.d.ts.map +0 -1
  132. package/lib/middlewares/visitors/visitClient.js +0 -174
  133. package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts +0 -5
  134. package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +0 -1
  135. package/lib/middlewares/visitors/visitInboundAudioTrack.js +0 -93
  136. package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts +0 -5
  137. package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +0 -1
  138. package/lib/middlewares/visitors/visitInboundVideoTrack.js +0 -94
  139. package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts +0 -5
  140. package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +0 -1
  141. package/lib/middlewares/visitors/visitOutboundAudioTrack.js +0 -90
  142. package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts +0 -5
  143. package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +0 -1
  144. package/lib/middlewares/visitors/visitOutboundVideoTarck.js +0 -90
  145. package/lib/middlewares/visitors/visitPeerConnection.d.ts +0 -5
  146. package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +0 -1
  147. package/lib/middlewares/visitors/visitPeerConnection.js +0 -111
  148. package/lib/middlewares/visitors/visitSfu.d.ts +0 -5
  149. package/lib/middlewares/visitors/visitSfu.d.ts.map +0 -1
  150. package/lib/middlewares/visitors/visitSfu.js +0 -78
  151. package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts +0 -5
  152. package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +0 -1
  153. package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +0 -56
  154. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts +0 -5
  155. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +0 -1
  156. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +0 -56
  157. package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts +0 -5
  158. package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +0 -1
  159. package/lib/middlewares/visitors/visitSfuSctpChannel.js +0 -55
  160. package/lib/middlewares/visitors/visitSfuTransport.d.ts +0 -5
  161. package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +0 -1
  162. package/lib/middlewares/visitors/visitSfuTransport.js +0 -56
  163. package/lib/processes/closePeerConnectionProcess.d.ts +0 -10
  164. package/lib/processes/closePeerConnectionProcess.d.ts.map +0 -1
  165. package/lib/processes/closePeerConnectionProcess.js +0 -51
  166. package/lib/processes/detachClientProcess.d.ts +0 -14
  167. package/lib/processes/detachClientProcess.d.ts.map +0 -1
  168. package/lib/processes/detachClientProcess.js +0 -106
  169. package/lib/processes/findRemoteMatches.d.ts +0 -9
  170. package/lib/processes/findRemoteMatches.d.ts.map +0 -1
  171. package/lib/processes/findRemoteMatches.js +0 -96
  172. package/lib/processes/inboundTrackRemoved.d.ts +0 -9
  173. package/lib/processes/inboundTrackRemoved.d.ts.map +0 -1
  174. package/lib/processes/inboundTrackRemoved.js +0 -22
  175. package/lib/processes/joinClientProcess.d.ts +0 -11
  176. package/lib/processes/joinClientProcess.d.ts.map +0 -1
  177. package/lib/processes/joinClientProcess.js +0 -120
  178. package/lib/processes/outboundTrackRemoved.d.ts +0 -9
  179. package/lib/processes/outboundTrackRemoved.d.ts.map +0 -1
  180. package/lib/processes/outboundTrackRemoved.js +0 -22
  181. package/lib/samples/ObservedCall.d.ts +0 -17
  182. package/lib/samples/ObservedCall.d.ts.map +0 -1
  183. package/lib/samples/ObservedCall.js +0 -29
  184. package/lib/samples/ObservedCalls.d.ts +0 -19
  185. package/lib/samples/ObservedCalls.d.ts.map +0 -1
  186. package/lib/samples/ObservedCalls.js +0 -113
  187. package/lib/samples/ObservedClient.d.ts +0 -28
  188. package/lib/samples/ObservedClient.d.ts.map +0 -1
  189. package/lib/samples/ObservedClient.js +0 -110
  190. package/lib/samples/ObservedInboundAudioTrack.d.ts +0 -17
  191. package/lib/samples/ObservedInboundAudioTrack.d.ts.map +0 -1
  192. package/lib/samples/ObservedInboundAudioTrack.js +0 -17
  193. package/lib/samples/ObservedInboundVideoTrack.d.ts +0 -17
  194. package/lib/samples/ObservedInboundVideoTrack.d.ts.map +0 -1
  195. package/lib/samples/ObservedInboundVideoTrack.js +0 -17
  196. package/lib/samples/ObservedOutboundAudioTrack.d.ts +0 -16
  197. package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +0 -1
  198. package/lib/samples/ObservedOutboundAudioTrack.js +0 -17
  199. package/lib/samples/ObservedOutboundVideoTrack.d.ts +0 -16
  200. package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +0 -1
  201. package/lib/samples/ObservedOutboundVideoTrack.js +0 -17
  202. package/lib/samples/ObservedPeerConnection.d.ts +0 -47
  203. package/lib/samples/ObservedPeerConnection.d.ts.map +0 -1
  204. package/lib/samples/ObservedPeerConnection.js +0 -130
  205. package/lib/samples/ObservedSfu.d.ts +0 -27
  206. package/lib/samples/ObservedSfu.d.ts.map +0 -1
  207. package/lib/samples/ObservedSfu.js +0 -65
  208. package/lib/samples/ObservedSfuInboundRtpPad.d.ts +0 -15
  209. package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +0 -1
  210. package/lib/samples/ObservedSfuInboundRtpPad.js +0 -17
  211. package/lib/samples/ObservedSfuOutboundRtpPad.d.ts +0 -15
  212. package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +0 -1
  213. package/lib/samples/ObservedSfuOutboundRtpPad.js +0 -17
  214. package/lib/samples/ObservedSfuSctpChannel.d.ts +0 -15
  215. package/lib/samples/ObservedSfuSctpChannel.d.ts.map +0 -1
  216. package/lib/samples/ObservedSfuSctpChannel.js +0 -17
  217. package/lib/samples/ObservedSfuTransport.d.ts +0 -30
  218. package/lib/samples/ObservedSfuTransport.d.ts.map +0 -1
  219. package/lib/samples/ObservedSfuTransport.js +0 -86
  220. package/lib/samples/ObservedSfus.d.ts +0 -16
  221. package/lib/samples/ObservedSfus.d.ts.map +0 -1
  222. package/lib/samples/ObservedSfus.js +0 -72
  223. package/lib/sinks/ObserverSink.d.ts.map +0 -1
  224. package/lib/sinks/callEventReports.d.ts.map +0 -1
  225. package/lib/sources/ObservedCallSource.d.ts +0 -18
  226. package/lib/sources/ObservedCallSource.d.ts.map +0 -1
  227. package/lib/sources/ObservedCallSource.js +0 -2
  228. package/lib/sources/ObservedClientSource.d.ts +0 -19
  229. package/lib/sources/ObservedClientSource.d.ts.map +0 -1
  230. package/lib/sources/ObservedClientSource.js +0 -2
  231. package/lib/sources/ObservedSfuSource.d.ts +0 -15
  232. package/lib/sources/ObservedSfuSource.d.ts.map +0 -1
  233. package/lib/sources/ObservedSfuSource.js +0 -2
  234. package/lib/sources/Sources.d.ts +0 -47
  235. package/lib/sources/Sources.d.ts.map +0 -1
  236. package/lib/sources/Sources.js +0 -211
  237. package/src/Evaluator.ts +0 -229
  238. package/src/common/Semaphore.ts +0 -45
  239. package/src/entries/CallEntry.ts +0 -62
  240. package/src/entries/ClientEntry.ts +0 -106
  241. package/src/entries/InboundTrackEntry.ts +0 -74
  242. package/src/entries/OutboundTrackEntry.ts +0 -72
  243. package/src/entries/PeerConnectionEntry.ts +0 -133
  244. package/src/entries/SfuEntry.ts +0 -62
  245. package/src/entries/SfuInboundRtpPadEntry.ts +0 -46
  246. package/src/entries/SfuOutboundRtpPadEntry.ts +0 -44
  247. package/src/entries/SfuSctpChannelEntry.ts +0 -39
  248. package/src/entries/SfuTransportEntry.ts +0 -109
  249. package/src/evaluators/SetClientsCoordinateEvaluator.ts +0 -78
  250. package/src/middlewares/CallOperationsContext.ts +0 -56
  251. package/src/middlewares/CallProcessor.ts +0 -38
  252. package/src/middlewares/CommitTransactionMiddleware.ts +0 -328
  253. package/src/middlewares/DeleteOutdatedCallEntries.ts +0 -159
  254. package/src/middlewares/DeleteOutdatedSfuEntries.ts +0 -168
  255. package/src/middlewares/Middleware.ts +0 -10
  256. package/src/middlewares/Processor.ts +0 -59
  257. package/src/middlewares/TransactionContext.ts +0 -176
  258. package/src/middlewares/TransactoinProcessor.ts +0 -28
  259. package/src/middlewares/VisitObservedCallsMiddleware.ts +0 -172
  260. package/src/middlewares/VisitObservedSfusMiddleware.ts +0 -203
  261. package/src/middlewares/visitors/visitClient.ts +0 -239
  262. package/src/middlewares/visitors/visitInboundAudioTrack.ts +0 -113
  263. package/src/middlewares/visitors/visitInboundVideoTrack.ts +0 -117
  264. package/src/middlewares/visitors/visitOutboundAudioTrack.ts +0 -100
  265. package/src/middlewares/visitors/visitOutboundVideoTarck.ts +0 -102
  266. package/src/middlewares/visitors/visitPeerConnection.ts +0 -151
  267. package/src/middlewares/visitors/visitSfu.ts +0 -70
  268. package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +0 -52
  269. package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +0 -53
  270. package/src/middlewares/visitors/visitSfuSctpChannel.ts +0 -50
  271. package/src/middlewares/visitors/visitSfuTransport.ts +0 -50
  272. package/src/processes/closePeerConnectionProcess.ts +0 -54
  273. package/src/processes/detachClientProcess.ts +0 -136
  274. package/src/processes/findRemoteMatches.ts +0 -104
  275. package/src/processes/inboundTrackRemoved.ts +0 -22
  276. package/src/processes/joinClientProcess.ts +0 -138
  277. package/src/processes/outboundTrackRemoved.ts +0 -22
  278. package/src/samples/ObservedCall.ts +0 -49
  279. package/src/samples/ObservedCalls.ts +0 -143
  280. package/src/samples/ObservedClient.ts +0 -172
  281. package/src/samples/ObservedInboundAudioTrack.ts +0 -35
  282. package/src/samples/ObservedInboundVideoTrack.ts +0 -36
  283. package/src/samples/ObservedOutboundAudioTrack.ts +0 -35
  284. package/src/samples/ObservedOutboundVideoTrack.ts +0 -35
  285. package/src/samples/ObservedPeerConnection.ts +0 -227
  286. package/src/samples/ObservedSfu.ts +0 -115
  287. package/src/samples/ObservedSfuInboundRtpPad.ts +0 -35
  288. package/src/samples/ObservedSfuOutboundRtpPad.ts +0 -35
  289. package/src/samples/ObservedSfuSctpChannel.ts +0 -35
  290. package/src/samples/ObservedSfuTransport.ts +0 -142
  291. package/src/samples/ObservedSfus.ts +0 -95
  292. package/src/sources/ObservedCallSource.ts +0 -26
  293. package/src/sources/ObservedClientSource.ts +0 -28
  294. package/src/sources/ObservedSfuSource.ts +0 -19
  295. package/src/sources/Sources.ts +0 -294
  296. /package/lib/{sinks → common}/callEventReports.d.ts +0 -0
  297. /package/lib/{sinks → common}/callEventReports.js +0 -0
  298. /package/src/{sinks → common}/callEventReports.ts +0 -0
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.visitSfuTransport = void 0;
27
- const Models = __importStar(require("../../models/Models"));
28
- function visitSfuTransport(observedSfuTransport, storedSfu, storedSfuTransports, reports, fetchSamples) {
29
- const { transportId } = observedSfuTransport;
30
- const { serviceId, sfuId, mediaUnitId, marker, minTimestamp: timestamp } = observedSfuTransport.sfu;
31
- let storedSfuTransport = storedSfuTransports.get(transportId);
32
- if (!storedSfuTransport) {
33
- storedSfuTransport = new Models.SfuTransport({
34
- serviceId,
35
- sfuId,
36
- mediaUnitId,
37
- transportId,
38
- opened: BigInt(Date.now()),
39
- marker,
40
- inboundRtpPadIds: [],
41
- outboundRtpPadIds: [],
42
- });
43
- storedSfuTransports.set(transportId, storedSfuTransport);
44
- storedSfu.sfuTransportIds.push(transportId);
45
- }
46
- for (const sfuTransport of observedSfuTransport.transportSamples()) {
47
- const report = Object.assign(Object.assign({ serviceId,
48
- sfuId,
49
- mediaUnitId }, sfuTransport), { timestamp });
50
- reports.addSfuTransportReport(report);
51
- }
52
- if (fetchSamples) {
53
- // empty
54
- }
55
- }
56
- exports.visitSfuTransport = visitSfuTransport;
@@ -1,10 +0,0 @@
1
- import { StorageProvider } from '../storages/StorageProvider';
2
- export type ClosePeerConnectionProcessInput = {
3
- closedPeerConnections: {
4
- peerConnectionId: string;
5
- closed: number;
6
- }[];
7
- recursive: boolean;
8
- };
9
- export declare function createClosePeerConnectionProcess(storageProvider: StorageProvider): (input: ClosePeerConnectionProcessInput) => Promise<void>;
10
- //# sourceMappingURL=closePeerConnectionProcess.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"closePeerConnectionProcess.d.ts","sourceRoot":"","sources":["../../src/processes/closePeerConnectionProcess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAI9D,MAAM,MAAM,+BAA+B,GAAG;IAC7C,qBAAqB,EAAE;QACtB,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,SAAS,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,gCAAgC,CAC/C,eAAe,EAAE,eAAe,GAC9B,CAAC,KAAK,EAAE,+BAA+B,KAAK,OAAO,CAAC,IAAI,CAAC,CAuC3D"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createClosePeerConnectionProcess = void 0;
13
- const inboundTrackRemoved_1 = require("./inboundTrackRemoved");
14
- const outboundTrackRemoved_1 = require("./outboundTrackRemoved");
15
- function createClosePeerConnectionProcess(storageProvider) {
16
- const removeInboundTracks = (0, inboundTrackRemoved_1.createInboundTrackRemoveProcess)(storageProvider);
17
- const removeOutboundTracks = (0, outboundTrackRemoved_1.createOutboundTrackRemoveProcess)(storageProvider);
18
- const process = (input) => __awaiter(this, void 0, void 0, function* () {
19
- const { closedPeerConnections, recursive } = input;
20
- const { peerConnectionStorage } = storageProvider;
21
- const peerConnectionIds = closedPeerConnections.map((c) => c.peerConnectionId);
22
- const peerConnections = yield peerConnectionStorage.getAll(peerConnectionIds);
23
- yield peerConnectionStorage.removeAll(peerConnectionIds);
24
- if (recursive) {
25
- const inboundTrackIds = Array.from(peerConnections.values())
26
- .flatMap((pc) => pc.inboundTrackIds)
27
- .map((trackId) => {
28
- return {
29
- trackId,
30
- };
31
- });
32
- const outboundTrackIds = Array.from(peerConnections.values())
33
- .flatMap((pc) => pc.outboundTrackIds)
34
- .map((trackId) => {
35
- return {
36
- trackId,
37
- };
38
- });
39
- yield Promise.all([
40
- removeInboundTracks({
41
- removedTracks: inboundTrackIds,
42
- }),
43
- removeOutboundTracks({
44
- removedTracks: outboundTrackIds,
45
- }),
46
- ]);
47
- }
48
- });
49
- return process;
50
- }
51
- exports.createClosePeerConnectionProcess = createClosePeerConnectionProcess;
@@ -1,14 +0,0 @@
1
- import { EvaluatorContext } from '../common/types';
2
- import { StorageProvider } from '../storages/StorageProvider';
3
- import { ReportsCollector } from '../common/ReportsCollector';
4
- import { ObservedClientSourceConfig } from '../sources/ObservedClientSource';
5
- import { Writable } from '../common/utils';
6
- export type DetachClientProcessInput = {
7
- clients: (ObservedClientSourceConfig & {
8
- detached: number;
9
- })[];
10
- recursive: boolean;
11
- evaluatorContext?: Writable<EvaluatorContext>;
12
- };
13
- export declare function createDetachClientProcess(storageProvider: StorageProvider, reports: ReportsCollector): (input: DetachClientProcessInput) => Promise<void>;
14
- //# sourceMappingURL=detachClientProcess.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detachClientProcess.d.ts","sourceRoot":"","sources":["../../src/processes/detachClientProcess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAI3C,MAAM,MAAM,wBAAwB,GAAG;IACtC,OAAO,EAAE,CAAC,0BAA0B,GAAG;QACtC,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC,EAAE,CAAC;IACL,SAAS,EAAE,OAAO,CAAC;IAEnB,gBAAgB,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;CAC9C,CAAC;AAEF,wBAAgB,yBAAyB,CACxC,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,gBAAgB,GACvB,CAAC,KAAK,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CA+GpD"}
@@ -1,106 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createDetachClientProcess = void 0;
13
- const callEventReports_1 = require("../sinks/callEventReports");
14
- const closePeerConnectionProcess_1 = require("./closePeerConnectionProcess");
15
- const logger_1 = require("../common/logger");
16
- const logger = (0, logger_1.createLogger)('ClientLeftProcess');
17
- function createDetachClientProcess(storageProvider, reports) {
18
- const peerConnectionClosedProcess = (0, closePeerConnectionProcess_1.createClosePeerConnectionProcess)(storageProvider);
19
- const process = (context) => __awaiter(this, void 0, void 0, function* () {
20
- var _a, _b;
21
- const { clients: detachedClients, recursive, evaluatorContext } = context;
22
- const { callStorage, clientStorage } = storageProvider;
23
- const clientIds = detachedClients.map((c) => c.clientId);
24
- if (clientIds.length < 1)
25
- return;
26
- const clients = yield clientStorage.getAll(clientIds);
27
- const callToClientIds = new Map();
28
- for (const client of clients.values()) {
29
- const { callId, clientId } = client;
30
- if (!callId || !clientId) {
31
- continue;
32
- }
33
- callToClientIds.set(callId, [...((_a = callToClientIds.get(callId)) !== null && _a !== void 0 ? _a : []), clientId]);
34
- }
35
- const peerConnectionCloseProcessInput = {
36
- closedPeerConnections: [],
37
- recursive,
38
- };
39
- const callDetaches = new Map();
40
- yield clientStorage.removeAll(clientIds).then((deletedClientIds) => {
41
- var _a;
42
- for (const { clientId, detached } of detachedClients) {
43
- if (!deletedClientIds.has(clientId)) {
44
- continue;
45
- }
46
- const deletedClient = clients.get(clientId);
47
- if (!deletedClient) {
48
- continue;
49
- }
50
- const { roomId, serviceId, mediaUnitId, marker, callId, userId } = deletedClient;
51
- if (!roomId || !serviceId || !mediaUnitId || !callId) {
52
- continue;
53
- }
54
- for (const peerConnectionId of deletedClient.peerConnectionIds) {
55
- peerConnectionCloseProcessInput.closedPeerConnections.push({
56
- peerConnectionId,
57
- closed: detached,
58
- });
59
- }
60
- reports.addCallEventReport((0, callEventReports_1.createClientLeftEventReport)(serviceId, mediaUnitId, roomId, callId, clientId, detached, userId, marker));
61
- evaluatorContext === null || evaluatorContext === void 0 ? void 0 : evaluatorContext.detachedClients.push(Object.assign(Object.assign({}, deletedClient), { detached: Number(detached) }));
62
- callDetaches.set(callId, Math.max((_a = callDetaches.get(callId)) !== null && _a !== void 0 ? _a : 0, detached));
63
- }
64
- });
65
- if (recursive && 0 < peerConnectionCloseProcessInput.closedPeerConnections.length) {
66
- yield peerConnectionClosedProcess(peerConnectionCloseProcessInput).catch((err) => {
67
- logger.error('Error occurred while closing peer connections', err);
68
- });
69
- }
70
- const calls = yield callStorage.getAll(callToClientIds.keys());
71
- const updatedCalls = new Map();
72
- const removedCallIds = [];
73
- for (const call of calls.values()) {
74
- const { callId, serviceId, roomId } = call;
75
- if (!callId || !roomId || !serviceId)
76
- continue;
77
- const removedClientIds = (_b = callToClientIds.get(callId)) !== null && _b !== void 0 ? _b : [];
78
- call.clientIds = call.clientIds.filter((clientId) => !removedClientIds.includes(clientId));
79
- if (call.clientIds.length < 1) {
80
- removedCallIds.push(callId);
81
- }
82
- else {
83
- updatedCalls.set(callId, call);
84
- }
85
- }
86
- if (0 < updatedCalls.size) {
87
- yield callStorage.setAll(updatedCalls);
88
- }
89
- if (0 < removedCallIds.length) {
90
- yield callStorage.removeAll(removedCallIds).then((deletedCalls) => {
91
- var _a;
92
- for (const [callId, deletedCall] of deletedCalls) {
93
- const { serviceId, roomId } = deletedCall;
94
- if (!serviceId || !roomId || !callId)
95
- continue;
96
- const ended = (_a = callDetaches.get(callId)) !== null && _a !== void 0 ? _a : Date.now();
97
- const callEvent = (0, callEventReports_1.createCallEndedEventReport)(serviceId, roomId, callId, ended);
98
- reports.addCallEventReport(callEvent);
99
- evaluatorContext === null || evaluatorContext === void 0 ? void 0 : evaluatorContext.endedCalls.push(Object.assign(Object.assign({}, deletedCall), { ended }));
100
- }
101
- });
102
- }
103
- });
104
- return process;
105
- }
106
- exports.createDetachClientProcess = createDetachClientProcess;
@@ -1,9 +0,0 @@
1
- import { Client, InboundTrack } from '../models/Models';
2
- import { StorageProvider } from '../storages/StorageProvider';
3
- export declare const logger: import("../common/logger").WrappedLogger;
4
- export declare function findRemoteMatches(storages: StorageProvider, clients: ReadonlyMap<string, Client>, inboundTracks: ReadonlyMap<string, InboundTrack>): Promise<{
5
- remoteTrackIds: Map<string, string>;
6
- remotePeerConnectionIds: Map<string, string>;
7
- remoteClientIds: Map<string, string>;
8
- }>;
9
- //# sourceMappingURL=findRemoteMatches.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"findRemoteMatches.d.ts","sourceRoot":"","sources":["../../src/processes/findRemoteMatches.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAiC,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,eAAO,MAAM,MAAM,0CAAoC,CAAC;AAuBxD,wBAAsB,iBAAiB,CACtC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC;;;;GAyEhD"}
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.findRemoteMatches = exports.logger = void 0;
13
- const logger_1 = require("../common/logger");
14
- exports.logger = (0, logger_1.createLogger)('findRemoteMatches');
15
- function groupToMap(input, getGroupKey) {
16
- const result = new Map();
17
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
- for (const [key, value] of input.entries()) {
19
- const groupKey = getGroupKey(value);
20
- if (!groupKey)
21
- continue;
22
- let group = result.get(groupKey);
23
- if (group === undefined) {
24
- group = [];
25
- result.set(groupKey, group);
26
- }
27
- group.push(value);
28
- }
29
- return result;
30
- }
31
- function findRemoteMatches(storages, clients, inboundTracks) {
32
- var _a;
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const NOT_EXISTS = 'NotExists';
35
- const remoteTrackIds = new Map();
36
- const remotePeerConnectionIds = new Map();
37
- const remoteClientIds = new Map();
38
- function setupMatches(callId, callClients, callIboundTracks) {
39
- var _a, _b, _c, _d, _e, _f;
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const peerConnectionIds = Array.from(callClients.values()).flatMap((client) => client.peerConnectionIds);
42
- const peerConnections = yield storages.peerConnectionStorage.getAll(peerConnectionIds).catch((err) => {
43
- exports.logger.warn(`Error while fetching for remote matching peer connections for call ${callId} `, err);
44
- return new Map();
45
- });
46
- const outboundTrackIds = Array.from(peerConnections.values()).flatMap((pc) => pc.outboundTrackIds);
47
- const outboundTracks = yield storages.outboundTrackStorage.getAll(outboundTrackIds).catch((err) => {
48
- exports.logger.warn(`Error while fetching for remote matching outbound tracks for call ${callId} `, err);
49
- return new Map();
50
- });
51
- // console.warn("setupMatches", peerConnectionIds, outboundTrackIds, callsClients, callsInbTracks);
52
- const ssrcToOutb = new Map();
53
- const sfuStreamToTrackIds = new Map();
54
- for (const outbTrack of outboundTracks.values()) {
55
- if (outbTrack.sfuStreamId) {
56
- sfuStreamToTrackIds.set(outbTrack.sfuStreamId, outbTrack);
57
- }
58
- for (const ssrc of outbTrack.ssrc) {
59
- ssrcToOutb.set(ssrc, outbTrack);
60
- }
61
- }
62
- for (const inbTrack of callIboundTracks) {
63
- let outbTrack;
64
- if (inbTrack.sfuStreamId) {
65
- outbTrack = sfuStreamToTrackIds.get(inbTrack.sfuStreamId);
66
- }
67
- else {
68
- outbTrack = inbTrack.ssrc.map((ssrc) => ssrcToOutb.get(ssrc)).find((outb) => outb !== undefined);
69
- }
70
- if (outbTrack) {
71
- remoteTrackIds.set((_a = inbTrack.trackId) !== null && _a !== void 0 ? _a : NOT_EXISTS, (_b = outbTrack.trackId) !== null && _b !== void 0 ? _b : NOT_EXISTS);
72
- remotePeerConnectionIds.set((_c = inbTrack.trackId) !== null && _c !== void 0 ? _c : NOT_EXISTS, (_d = outbTrack.peerConnectionId) !== null && _d !== void 0 ? _d : NOT_EXISTS);
73
- remoteClientIds.set((_e = inbTrack.trackId) !== null && _e !== void 0 ? _e : NOT_EXISTS, (_f = outbTrack.clientId) !== null && _f !== void 0 ? _f : NOT_EXISTS);
74
- }
75
- }
76
- });
77
- }
78
- const callsClients = groupToMap(clients, (client) => client.callId);
79
- const callsInbTracks = groupToMap(inboundTracks, (inbTrack) => inbTrack.callId);
80
- const promises = [];
81
- for (const [callId, callClients] of callsClients) {
82
- const callIboundTracks = (_a = callsInbTracks.get(callId)) !== null && _a !== void 0 ? _a : [];
83
- const promise = setupMatches(callId, callClients, callIboundTracks);
84
- promises.push(promise);
85
- }
86
- yield Promise.all(promises).catch((err) => {
87
- exports.logger.warn('Error occurred while fetching remote pair matches', err);
88
- });
89
- return {
90
- remoteTrackIds,
91
- remotePeerConnectionIds,
92
- remoteClientIds
93
- };
94
- });
95
- }
96
- exports.findRemoteMatches = findRemoteMatches;
@@ -1,9 +0,0 @@
1
- import { StorageProvider } from '../storages/StorageProvider';
2
- export type InboundTrackRemoveProcessInput = {
3
- removedTracks: {
4
- trackId: string;
5
- timestamp?: number;
6
- }[];
7
- };
8
- export declare function createInboundTrackRemoveProcess(storageProvider: StorageProvider): (input: InboundTrackRemoveProcessInput) => Promise<void>;
9
- //# sourceMappingURL=inboundTrackRemoved.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inboundTrackRemoved.d.ts","sourceRoot":"","sources":["../../src/processes/inboundTrackRemoved.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,MAAM,8BAA8B,GAAG;IAC5C,aAAa,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;CACJ,CAAC;AAEF,wBAAgB,+BAA+B,CAC9C,eAAe,EAAE,eAAe,GAC9B,CAAC,KAAK,EAAE,8BAA8B,KAAK,OAAO,CAAC,IAAI,CAAC,CAU1D"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createInboundTrackRemoveProcess = void 0;
13
- function createInboundTrackRemoveProcess(storageProvider) {
14
- const process = (input) => __awaiter(this, void 0, void 0, function* () {
15
- const { removedTracks } = input;
16
- const { inboundTrackStorage } = storageProvider;
17
- const inboundTrackIds = removedTracks.map((c) => c.trackId);
18
- yield inboundTrackStorage.removeAll(inboundTrackIds);
19
- });
20
- return process;
21
- }
22
- exports.createInboundTrackRemoveProcess = createInboundTrackRemoveProcess;
@@ -1,11 +0,0 @@
1
- import { EvaluatorContext } from '../common/types';
2
- import { StorageProvider } from '../storages/StorageProvider';
3
- import { ReportsCollector } from '../common/ReportsCollector';
4
- import { ObservedClientSourceConfig } from '../sources/ObservedClientSource';
5
- import { Writable } from '../common/utils';
6
- export type JoinClientProcessInput = {
7
- clients: ObservedClientSourceConfig[];
8
- evaluatorContext?: Writable<EvaluatorContext>;
9
- };
10
- export declare function createJoinClientProcess(storageProvider: StorageProvider, reports: ReportsCollector): (input: JoinClientProcessInput) => Promise<void>;
11
- //# sourceMappingURL=joinClientProcess.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"joinClientProcess.d.ts","sourceRoot":"","sources":["../../src/processes/joinClientProcess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAI3C,MAAM,MAAM,sBAAsB,GAAG;IACpC,OAAO,EAAE,0BAA0B,EAAE,CAAC;IAEtC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;CAC9C,CAAC;AAEF,wBAAgB,uBAAuB,CACtC,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,gBAAgB,GACvB,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,CAqHlD"}
@@ -1,120 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.createJoinClientProcess = void 0;
36
- const Models = __importStar(require("../models/Models"));
37
- const callEventReports_1 = require("../sinks/callEventReports");
38
- const logger_1 = require("../common/logger");
39
- const logger = (0, logger_1.createLogger)('ClientLeftProcess');
40
- function createJoinClientProcess(storageProvider, reports) {
41
- const process = (context) => __awaiter(this, void 0, void 0, function* () {
42
- const { clients: joinedClients, evaluatorContext } = context;
43
- if (joinedClients.length < 1) {
44
- return;
45
- }
46
- const { callStorage, clientStorage } = storageProvider;
47
- const callIds = joinedClients.map((c) => c.callId);
48
- const existingCalls = yield callStorage.getAll(callIds);
49
- const newCalls = new Map();
50
- const newClients = new Map();
51
- for (const joinedClient of joinedClients) {
52
- const { serviceId, mediaUnitId, roomId, callId, clientId, userId, joined: timestamp, timeZoneId, marker } = joinedClient;
53
- let call = existingCalls.get(callId);
54
- if (!call) {
55
- call = new Models.Call({
56
- serviceId,
57
- roomId,
58
- callId,
59
- started: BigInt(timestamp),
60
- });
61
- newCalls.set(callId, call);
62
- }
63
- if (call.clientIds.find((callClientId) => callClientId === clientId)) {
64
- logger.warn(`Call ${callId} for room ${roomId} attempted to add client ${clientId} twice`);
65
- continue;
66
- }
67
- call.clientIds.push(clientId);
68
- // we can extract the lowest timestamp here
69
- // const joinedTimestamp
70
- // for (const observedCall of (evaluatorContext?.observedCalls.getObservedCall(callId)?.getObservedClient(clientId)?.samples() ?? [])) {
71
- // }
72
- newClients.set(clientId, new Models.Client({
73
- serviceId,
74
- mediaUnitId,
75
- roomId,
76
- callId,
77
- clientId,
78
- joined: BigInt(timestamp),
79
- timeZoneId,
80
- marker,
81
- userId,
82
- }));
83
- }
84
- const alreadyInsertedCalls = 0 < newCalls.size ? yield callStorage.insertAll(newCalls) : new Map();
85
- for (const [callId, newCall] of newCalls) {
86
- if (alreadyInsertedCalls.has(callId)) {
87
- continue;
88
- }
89
- const { serviceId, roomId, started } = newCall;
90
- if (!serviceId || !roomId || !started) {
91
- continue;
92
- }
93
- const callEvent = (0, callEventReports_1.createCallStartedEventReport)(serviceId, roomId, callId, Number(started));
94
- // if ((evaluatorContext?.observedCalls as ObservedCalls).getObservedCall(callId)) {
95
- // reports.addCallEventReport(callEvent);
96
- // }
97
- reports.addCallEventReport(callEvent);
98
- evaluatorContext === null || evaluatorContext === void 0 ? void 0 : evaluatorContext.startedCallIds.push(callId);
99
- }
100
- if (0 < existingCalls.size) {
101
- yield callStorage.setAll(existingCalls);
102
- }
103
- if (0 < newClients.size) {
104
- yield clientStorage.setAll(newClients);
105
- }
106
- for (const [clientId, client] of newClients) {
107
- const { serviceId, mediaUnitId, roomId, callId, clientId: savedClientId, userId,
108
- // timeZoneId,
109
- marker, joined, } = client;
110
- if (!serviceId || !mediaUnitId || !roomId || !callId || !savedClientId) {
111
- continue;
112
- }
113
- const callEvent = (0, callEventReports_1.createClientJoinedEventReport)(serviceId, mediaUnitId, roomId, callId, clientId, Number(joined), userId, marker);
114
- reports.addCallEventReport(callEvent);
115
- evaluatorContext === null || evaluatorContext === void 0 ? void 0 : evaluatorContext.joinedClientIds.push(clientId);
116
- }
117
- });
118
- return process;
119
- }
120
- exports.createJoinClientProcess = createJoinClientProcess;
@@ -1,9 +0,0 @@
1
- import { StorageProvider } from '../storages/StorageProvider';
2
- export type OutboundTrackRemoveProcessInput = {
3
- removedTracks: {
4
- trackId: string;
5
- timestamp?: number;
6
- }[];
7
- };
8
- export declare function createOutboundTrackRemoveProcess(storageProvider: StorageProvider): (input: OutboundTrackRemoveProcessInput) => Promise<void>;
9
- //# sourceMappingURL=outboundTrackRemoved.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"outboundTrackRemoved.d.ts","sourceRoot":"","sources":["../../src/processes/outboundTrackRemoved.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,MAAM,+BAA+B,GAAG;IAC7C,aAAa,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;CACJ,CAAC;AAEF,wBAAgB,gCAAgC,CAC/C,eAAe,EAAE,eAAe,GAC9B,CAAC,KAAK,EAAE,+BAA+B,KAAK,OAAO,CAAC,IAAI,CAAC,CAU3D"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createOutboundTrackRemoveProcess = void 0;
13
- function createOutboundTrackRemoveProcess(storageProvider) {
14
- const process = (input) => __awaiter(this, void 0, void 0, function* () {
15
- const { removedTracks } = input;
16
- const { outboundTrackStorage } = storageProvider;
17
- const outboundTrackIds = removedTracks.map((c) => c.trackId);
18
- yield outboundTrackStorage.removeAll(outboundTrackIds);
19
- });
20
- return process;
21
- }
22
- exports.createOutboundTrackRemoveProcess = createOutboundTrackRemoveProcess;
@@ -1,17 +0,0 @@
1
- import { ObservedClient, ObservedClientBuilder } from './ObservedClient';
2
- export interface ObservedCall {
3
- readonly serviceId: string;
4
- readonly roomId: string;
5
- readonly callId: string;
6
- readonly createCallStartedReport?: boolean;
7
- observedClients(): IterableIterator<ObservedClient>;
8
- getObservedClient(clientId: string): ObservedClient | undefined;
9
- }
10
- export declare class ObservedCallBuilder {
11
- private _config;
12
- private _observedClientBuilders;
13
- constructor(_config: Omit<ObservedCall, 'observedClients' | 'getObservedClient'>);
14
- getOrCreateObservedClientBuilder(clientId: string, configSupplier: () => ConstructorParameters<typeof ObservedClientBuilder>[0]): ObservedClientBuilder;
15
- build(): ObservedCall;
16
- }
17
- //# sourceMappingURL=ObservedCall.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ObservedCall.d.ts","sourceRoot":"","sources":["../../src/samples/ObservedCall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C,eAAe,IAAI,gBAAgB,CAAC,cAAc,CAAC,CAAC;IACpD,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;CAChE;AAED,qBAAa,mBAAmB;IAEZ,OAAO,CAAC,OAAO;IADlC,OAAO,CAAC,uBAAuB,CAA4C;gBAChD,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,iBAAiB,GAAG,mBAAmB,CAAC;IAExF,gCAAgC,CACtC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,qBAAqB,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC;IActE,KAAK,IAAI,YAAY;CAiB5B"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObservedCallBuilder = void 0;
4
- const ObservedClient_1 = require("./ObservedClient");
5
- class ObservedCallBuilder {
6
- constructor(_config) {
7
- this._config = _config;
8
- this._observedClientBuilders = new Map();
9
- }
10
- getOrCreateObservedClientBuilder(clientId, configSupplier) {
11
- let result = this._observedClientBuilders.get(clientId);
12
- if (!result) {
13
- const config = configSupplier();
14
- result = new ObservedClient_1.ObservedClientBuilder(config);
15
- this._observedClientBuilders.set(clientId, result);
16
- }
17
- return result;
18
- }
19
- build() {
20
- const observedClients = new Map();
21
- const observedCall = Object.assign(Object.assign({}, this._config), { observedClients: () => observedClients.values(), getObservedClient: (clientId) => observedClients.get(clientId) });
22
- for (const observedClientBuilder of this._observedClientBuilders.values()) {
23
- const observedClient = observedClientBuilder.build(observedCall);
24
- observedClients.set(observedClient.clientId, observedClient);
25
- }
26
- return observedCall;
27
- }
28
- }
29
- exports.ObservedCallBuilder = ObservedCallBuilder;
@@ -1,19 +0,0 @@
1
- import { ObservedCall, ObservedCallBuilder } from './ObservedCall';
2
- export interface ObservedCalls {
3
- callIds(): IterableIterator<string>;
4
- clientIds(): IterableIterator<string>;
5
- peerConnectionIds(): IterableIterator<string>;
6
- inboundAudioTrackIds(): IterableIterator<string>;
7
- inboundVideoTrackIds(): IterableIterator<string>;
8
- outboundAudioTrackIds(): IterableIterator<string>;
9
- outboundVideoTrackIds(): IterableIterator<string>;
10
- observedCalls(): IterableIterator<ObservedCall>;
11
- getObservedCall(callId: string): ObservedCall | undefined;
12
- }
13
- export declare class ObservedCallsBuilder {
14
- private _builders;
15
- constructor();
16
- getOrCreateObservedCallBuilder(callId: string, configSupplier: () => ConstructorParameters<typeof ObservedCallBuilder>[0]): ObservedCallBuilder;
17
- build(): ObservedCalls;
18
- }
19
- //# sourceMappingURL=ObservedCalls.d.ts.map