@observertc/observer-js 0.42.8 → 1.0.1-1b9b3c5.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 (295) hide show
  1. package/.prettierrc +6 -6
  2. package/README.md +0 -104
  3. package/lib/ObservedCall.d.ts +63 -43
  4. package/lib/ObservedCall.d.ts.map +1 -1
  5. package/lib/ObservedCall.js +176 -108
  6. package/lib/ObservedCallEventMonitor.d.ts +103 -0
  7. package/lib/ObservedCallEventMonitor.d.ts.map +1 -0
  8. package/lib/ObservedCallEventMonitor.js +312 -0
  9. package/lib/ObservedCallSummary.d.ts +18 -0
  10. package/lib/ObservedCallSummary.d.ts.map +1 -0
  11. package/lib/ObservedCertificate.d.ts +19 -0
  12. package/lib/ObservedCertificate.d.ts.map +1 -0
  13. package/lib/ObservedCertificate.js +38 -0
  14. package/lib/ObservedClient.d.ts +79 -130
  15. package/lib/ObservedClient.d.ts.map +1 -1
  16. package/lib/ObservedClient.js +463 -744
  17. package/lib/ObservedClientEventMonitor.d.ts +89 -0
  18. package/lib/ObservedClientEventMonitor.d.ts.map +1 -0
  19. package/lib/ObservedClientEventMonitor.js +247 -0
  20. package/lib/ObservedClientSummary.d.ts +23 -0
  21. package/lib/ObservedClientSummary.d.ts.map +1 -0
  22. package/lib/ObservedClientSummary.js +2 -0
  23. package/lib/ObservedCodec.d.ts +22 -0
  24. package/lib/ObservedCodec.d.ts.map +1 -0
  25. package/lib/ObservedCodec.js +45 -0
  26. package/lib/ObservedDataChannel.d.ts +25 -69
  27. package/lib/ObservedDataChannel.d.ts.map +1 -1
  28. package/lib/ObservedDataChannel.js +69 -109
  29. package/lib/ObservedIceCandidate.d.ts +29 -0
  30. package/lib/ObservedIceCandidate.d.ts.map +1 -0
  31. package/lib/ObservedIceCandidate.js +59 -0
  32. package/lib/ObservedIceCandidatePair.d.ts +44 -0
  33. package/lib/ObservedIceCandidatePair.d.ts.map +1 -0
  34. package/lib/ObservedIceCandidatePair.js +111 -0
  35. package/lib/ObservedIceTransport.d.ts +36 -0
  36. package/lib/ObservedIceTransport.d.ts.map +1 -0
  37. package/lib/ObservedIceTransport.js +93 -0
  38. package/lib/ObservedInboundRtp.d.ts +92 -0
  39. package/lib/ObservedInboundRtp.d.ts.map +1 -0
  40. package/lib/ObservedInboundRtp.js +193 -0
  41. package/lib/ObservedInboundTrack.d.ts +31 -0
  42. package/lib/ObservedInboundTrack.d.ts.map +1 -0
  43. package/lib/ObservedInboundTrack.js +59 -0
  44. package/lib/ObservedMediaPlayout.d.ts +22 -0
  45. package/lib/ObservedMediaPlayout.d.ts.map +1 -0
  46. package/lib/ObservedMediaPlayout.js +42 -0
  47. package/lib/ObservedMediaSource.d.ts +28 -0
  48. package/lib/ObservedMediaSource.d.ts.map +1 -0
  49. package/lib/ObservedMediaSource.js +55 -0
  50. package/lib/ObservedOutboundRtp.d.ts +62 -0
  51. package/lib/ObservedOutboundRtp.d.ts.map +1 -0
  52. package/lib/ObservedOutboundRtp.js +144 -0
  53. package/lib/ObservedOutboundTrack.d.ts +31 -0
  54. package/lib/ObservedOutboundTrack.d.ts.map +1 -0
  55. package/lib/ObservedOutboundTrack.js +59 -0
  56. package/lib/ObservedPeerConnection.d.ts +132 -80
  57. package/lib/ObservedPeerConnection.d.ts.map +1 -1
  58. package/lib/ObservedPeerConnection.js +646 -357
  59. package/lib/ObservedPeerConnectionTransport.d.ts +17 -0
  60. package/lib/ObservedPeerConnectionTransport.d.ts.map +1 -0
  61. package/lib/ObservedPeerConnectionTransport.js +34 -0
  62. package/lib/ObservedRemoteInboundRtp.d.ts +30 -0
  63. package/lib/ObservedRemoteInboundRtp.d.ts.map +1 -0
  64. package/lib/ObservedRemoteInboundRtp.js +60 -0
  65. package/lib/ObservedRemoteOutboundRtp.d.ts +30 -0
  66. package/lib/ObservedRemoteOutboundRtp.d.ts.map +1 -0
  67. package/lib/ObservedRemoteOutboundRtp.js +60 -0
  68. package/lib/ObservedTURN.d.ts +31 -0
  69. package/lib/ObservedTURN.d.ts.map +1 -0
  70. package/lib/ObservedTURN.js +58 -0
  71. package/lib/ObservedTurnServer.d.ts +25 -0
  72. package/lib/ObservedTurnServer.d.ts.map +1 -0
  73. package/lib/ObservedTurnServer.js +59 -0
  74. package/lib/Observer.d.ts +44 -51
  75. package/lib/Observer.d.ts.map +1 -1
  76. package/lib/Observer.js +135 -226
  77. package/lib/ObserverEventMonitor.d.ts +106 -0
  78. package/lib/ObserverEventMonitor.d.ts.map +1 -0
  79. package/lib/ObserverEventMonitor.js +320 -0
  80. package/lib/ObserverSummary.d.ts +13 -0
  81. package/lib/ObserverSummary.d.ts.map +1 -0
  82. package/lib/ObserverSummary.js +2 -0
  83. package/lib/common/Middleware.d.ts +10 -1
  84. package/lib/common/Middleware.d.ts.map +1 -1
  85. package/lib/common/Middleware.js +55 -36
  86. package/lib/common/logger.d.ts +8 -4
  87. package/lib/common/logger.d.ts.map +1 -1
  88. package/lib/common/logger.js +44 -68
  89. package/lib/common/types.d.ts +0 -21
  90. package/lib/common/types.d.ts.map +1 -1
  91. package/lib/common/types.js +1 -0
  92. package/lib/common/utils.d.ts +3 -1
  93. package/lib/common/utils.d.ts.map +1 -1
  94. package/lib/common/utils.js +23 -3
  95. package/lib/detectors/Detector.d.ts +5 -0
  96. package/lib/detectors/Detector.d.ts.map +1 -0
  97. package/lib/detectors/Detector.js +3 -0
  98. package/lib/detectors/Detectors.d.ts +11 -0
  99. package/lib/detectors/Detectors.d.ts.map +1 -0
  100. package/lib/detectors/Detectors.js +34 -0
  101. package/lib/index.d.ts +26 -24
  102. package/lib/index.d.ts.map +1 -1
  103. package/lib/index.js +45 -41
  104. package/lib/monitors/TurnUsageMonitor.d.ts +0 -52
  105. package/lib/monitors/TurnUsageMonitor.d.ts.map +1 -1
  106. package/lib/monitors/TurnUsageMonitor.js +145 -120
  107. package/lib/schema/ClientEventTypes.d.ts +160 -0
  108. package/lib/schema/ClientEventTypes.d.ts.map +1 -0
  109. package/lib/schema/ClientEventTypes.js +38 -0
  110. package/lib/schema/ClientMetaTypes.d.ts +34 -0
  111. package/lib/schema/ClientMetaTypes.d.ts.map +1 -0
  112. package/lib/schema/ClientMetaTypes.js +16 -0
  113. package/lib/schema/ClientSample.d.ts +1333 -0
  114. package/lib/schema/ClientSample.d.ts.map +1 -0
  115. package/lib/schema/ClientSample.js +4 -0
  116. package/lib/scores/CalculatedScore.d.ts +6 -0
  117. package/lib/scores/CalculatedScore.d.ts.map +1 -0
  118. package/lib/scores/CalculatedScore.js +2 -0
  119. package/lib/scores/DefaultCallScoreCalculator.d.ts +7 -0
  120. package/lib/scores/DefaultCallScoreCalculator.d.ts.map +1 -0
  121. package/lib/scores/DefaultCallScoreCalculator.js +21 -0
  122. package/lib/scores/ScoreCalculator.d.ts +4 -0
  123. package/lib/scores/ScoreCalculator.d.ts.map +1 -0
  124. package/lib/scores/ScoreCalculator.js +2 -0
  125. package/lib/updaters/CallUpdater.d.ts +5 -0
  126. package/lib/updaters/CallUpdater.d.ts.map +1 -0
  127. package/lib/updaters/CallUpdater.js +2 -0
  128. package/lib/updaters/ObserverUpdater.d.ts +5 -0
  129. package/lib/updaters/ObserverUpdater.d.ts.map +1 -0
  130. package/lib/updaters/ObserverUpdater.js +2 -0
  131. package/lib/updaters/OnAllCallObserverUpdater.d.ts +15 -0
  132. package/lib/updaters/OnAllCallObserverUpdater.d.ts.map +1 -0
  133. package/lib/updaters/OnAllCallObserverUpdater.js +50 -0
  134. package/lib/updaters/OnAllClientCallUpdater.d.ts +15 -0
  135. package/lib/updaters/OnAllClientCallUpdater.d.ts.map +1 -0
  136. package/lib/updaters/OnAllClientCallUpdater.js +53 -0
  137. package/lib/updaters/OnAnyCallObserverUpdater.d.ts +12 -0
  138. package/lib/updaters/OnAnyCallObserverUpdater.d.ts.map +1 -0
  139. package/lib/updaters/OnAnyCallObserverUpdater.js +37 -0
  140. package/lib/updaters/OnAnyClientCallUpdater.d.ts +12 -0
  141. package/lib/updaters/OnAnyClientCallUpdater.d.ts.map +1 -0
  142. package/lib/updaters/OnAnyClientCallUpdater.js +36 -0
  143. package/lib/updaters/OnIntervalUpdater.d.ts +10 -0
  144. package/lib/updaters/OnIntervalUpdater.d.ts.map +1 -0
  145. package/lib/updaters/OnIntervalUpdater.js +17 -0
  146. package/lib/updaters/Updater.d.ts +6 -0
  147. package/lib/updaters/Updater.d.ts.map +1 -0
  148. package/lib/updaters/Updater.js +2 -0
  149. package/lib/utils/MediasoupRemoteTrackResolver.d.ts +25 -0
  150. package/lib/utils/MediasoupRemoteTrackResolver.d.ts.map +1 -0
  151. package/lib/utils/MediasoupRemoteTrackResolver.js +110 -0
  152. package/lib/utils/RemoteTrackResolver.d.ts +7 -0
  153. package/lib/utils/RemoteTrackResolver.d.ts.map +1 -0
  154. package/lib/utils/RemoteTrackResolver.js +2 -0
  155. package/package.json +4 -4
  156. package/src/ObservedCall.ts +267 -166
  157. package/src/ObservedCallEventMonitor.ts +389 -0
  158. package/src/ObservedCallSummary.ts +22 -0
  159. package/src/ObservedCertificate.ts +43 -0
  160. package/src/ObservedClient.ts +520 -1019
  161. package/src/ObservedClientEventMonitor.ts +301 -0
  162. package/src/ObservedClientSummary.ts +24 -0
  163. package/src/ObservedCodec.ts +49 -0
  164. package/src/ObservedDataChannel.ts +71 -181
  165. package/src/ObservedIceCandidate.ts +64 -0
  166. package/src/ObservedIceCandidatePair.ts +118 -0
  167. package/src/ObservedIceTransport.ts +99 -0
  168. package/src/ObservedInboundRtp.ts +205 -0
  169. package/src/ObservedInboundTrack.ts +73 -0
  170. package/src/ObservedMediaPlayout.ts +49 -0
  171. package/src/ObservedMediaSource.ts +60 -0
  172. package/src/ObservedOutboundRtp.ts +156 -0
  173. package/src/ObservedOutboundTrack.ts +72 -0
  174. package/src/ObservedPeerConnection.ts +854 -408
  175. package/src/ObservedPeerConnectionTransport.ts +38 -0
  176. package/src/ObservedRemoteInboundRtp.ts +64 -0
  177. package/src/ObservedRemoteOutboundRtp.ts +65 -0
  178. package/src/ObservedTURN.ts +86 -0
  179. package/src/ObservedTurnServer.ts +72 -0
  180. package/src/Observer.ts +180 -295
  181. package/src/ObserverEventMonitor.ts +398 -0
  182. package/src/ObserverSummary.ts +15 -0
  183. package/src/common/Middleware.ts +70 -42
  184. package/src/common/logger.ts +60 -69
  185. package/src/common/types.ts +0 -42
  186. package/src/common/utils.ts +24 -2
  187. package/src/detectors/Detector.ts +6 -0
  188. package/src/detectors/Detectors.ts +38 -0
  189. package/src/index.ts +26 -87
  190. package/src/monitors/TurnUsageMonitor.ts +164 -164
  191. package/src/schema/ClientEventTypes.ts +176 -0
  192. package/src/schema/ClientMetaTypes.ts +41 -0
  193. package/src/schema/ClientSample.ts +1682 -0
  194. package/src/scores/CalculatedScore.ts +6 -0
  195. package/src/scores/DefaultCallScoreCalculator.ts +23 -0
  196. package/src/scores/ScoreCalculator.ts +3 -0
  197. package/src/updaters/CallUpdater.ts +5 -0
  198. package/src/updaters/ObserverUpdater.ts +5 -0
  199. package/src/updaters/OnAllCallObserverUpdater.ts +59 -0
  200. package/src/updaters/OnAllClientCallUpdater.ts +61 -0
  201. package/src/updaters/OnAnyCallObserverUpdater.ts +41 -0
  202. package/src/updaters/OnAnyClientCallUpdater.ts +39 -0
  203. package/src/updaters/OnIntervalUpdater.ts +19 -0
  204. package/src/updaters/Updater.ts +5 -0
  205. package/src/utils/MediasoupRemoteTrackResolver.ts +155 -0
  206. package/src/utils/RemoteTrackResolver.ts +12 -0
  207. package/tsconfig.json +3 -3
  208. package/lib/ObservedICE.d.ts +0 -64
  209. package/lib/ObservedICE.d.ts.map +0 -1
  210. package/lib/ObservedICE.js +0 -141
  211. package/lib/ObservedInboundAudioTrack.d.ts +0 -96
  212. package/lib/ObservedInboundAudioTrack.d.ts.map +0 -1
  213. package/lib/ObservedInboundAudioTrack.js +0 -217
  214. package/lib/ObservedInboundVideoTrack.d.ts +0 -101
  215. package/lib/ObservedInboundVideoTrack.d.ts.map +0 -1
  216. package/lib/ObservedInboundVideoTrack.js +0 -232
  217. package/lib/ObservedOutboundAudioTrack.d.ts +0 -87
  218. package/lib/ObservedOutboundAudioTrack.d.ts.map +0 -1
  219. package/lib/ObservedOutboundAudioTrack.js +0 -186
  220. package/lib/ObservedOutboundVideoTrack.d.ts +0 -91
  221. package/lib/ObservedOutboundVideoTrack.d.ts.map +0 -1
  222. package/lib/ObservedOutboundVideoTrack.js +0 -193
  223. package/lib/ObservedSfu.d.ts +0 -59
  224. package/lib/ObservedSfu.d.ts.map +0 -1
  225. package/lib/ObservedSfu.js +0 -157
  226. package/lib/ObservedSfuInboundRtpPad.d.ts +0 -42
  227. package/lib/ObservedSfuInboundRtpPad.d.ts.map +0 -1
  228. package/lib/ObservedSfuInboundRtpPad.js +0 -71
  229. package/lib/ObservedSfuOutboundRtpPad.d.ts +0 -42
  230. package/lib/ObservedSfuOutboundRtpPad.d.ts.map +0 -1
  231. package/lib/ObservedSfuOutboundRtpPad.js +0 -72
  232. package/lib/ObservedSfuSctpChannel.d.ts +0 -42
  233. package/lib/ObservedSfuSctpChannel.d.ts.map +0 -1
  234. package/lib/ObservedSfuSctpChannel.js +0 -57
  235. package/lib/ObservedSfuTransport.d.ts +0 -58
  236. package/lib/ObservedSfuTransport.d.ts.map +0 -1
  237. package/lib/ObservedSfuTransport.js +0 -120
  238. package/lib/RemoteTrackAssigner.d.ts +0 -14
  239. package/lib/RemoteTrackAssigner.d.ts.map +0 -1
  240. package/lib/RemoteTrackAssigner.js +0 -52
  241. package/lib/ReportsCollector.d.ts +0 -109
  242. package/lib/ReportsCollector.d.ts.map +0 -1
  243. package/lib/ReportsCollector.js +0 -207
  244. package/lib/common/CalculatedScore.d.ts +0 -80
  245. package/lib/common/CalculatedScore.d.ts.map +0 -1
  246. package/lib/common/CalculatedScore.js +0 -162
  247. package/lib/common/CallEventType.d.ts +0 -63
  248. package/lib/common/CallEventType.d.ts.map +0 -1
  249. package/lib/common/CallEventType.js +0 -39
  250. package/lib/common/CallMetaReports.d.ts +0 -42
  251. package/lib/common/CallMetaReports.d.ts.map +0 -1
  252. package/lib/common/CallMetaReports.js +0 -36
  253. package/lib/common/QualityScoreUtils.d.ts +0 -1
  254. package/lib/common/QualityScoreUtils.d.ts.map +0 -1
  255. package/lib/common/QualityScoreUtils.js +0 -1
  256. package/lib/common/TypedEventEmitter.d.ts +0 -22
  257. package/lib/common/TypedEventEmitter.d.ts.map +0 -1
  258. package/lib/common/TypedEventEmitter.js +0 -11
  259. package/lib/common/callEventReports.d.ts +0 -10
  260. package/lib/common/callEventReports.d.ts.map +0 -1
  261. package/lib/common/callEventReports.js +0 -112
  262. package/lib/monitors/CallSummary.d.ts +0 -37
  263. package/lib/monitors/CallSummary.d.ts.map +0 -1
  264. package/lib/monitors/CallSummaryMonitor.d.ts +0 -32
  265. package/lib/monitors/CallSummaryMonitor.d.ts.map +0 -1
  266. package/lib/monitors/CallSummaryMonitor.js +0 -152
  267. package/lib/monitors/ClientIssueMonitor.d.ts +0 -32
  268. package/lib/monitors/ClientIssueMonitor.d.ts.map +0 -1
  269. package/lib/monitors/ClientIssueMonitor.js +0 -49
  270. package/lib/monitors/SfuServerMonitor.d.ts +0 -79
  271. package/lib/monitors/SfuServerMonitor.d.ts.map +0 -1
  272. package/lib/monitors/SfuServerMonitor.js +0 -198
  273. package/src/ObservedICE.ts +0 -237
  274. package/src/ObservedInboundAudioTrack.ts +0 -344
  275. package/src/ObservedInboundVideoTrack.ts +0 -361
  276. package/src/ObservedOutboundAudioTrack.ts +0 -307
  277. package/src/ObservedOutboundVideoTrack.ts +0 -319
  278. package/src/ObservedSfu.ts +0 -231
  279. package/src/ObservedSfuInboundRtpPad.ts +0 -106
  280. package/src/ObservedSfuOutboundRtpPad.ts +0 -107
  281. package/src/ObservedSfuSctpChannel.ts +0 -103
  282. package/src/ObservedSfuTransport.ts +0 -185
  283. package/src/RemoteTrackAssigner.ts +0 -68
  284. package/src/ReportsCollector.ts +0 -336
  285. package/src/common/CalculatedScore.ts +0 -188
  286. package/src/common/CallEventType.ts +0 -69
  287. package/src/common/CallMetaReports.ts +0 -82
  288. package/src/common/QualityScoreUtils.ts +0 -0
  289. package/src/common/TypedEventEmitter.ts +0 -32
  290. package/src/common/callEventReports.ts +0 -178
  291. package/src/monitors/CallSummary.ts +0 -38
  292. package/src/monitors/CallSummaryMonitor.ts +0 -192
  293. package/src/monitors/ClientIssueMonitor.ts +0 -88
  294. package/src/monitors/SfuServerMonitor.ts +0 -285
  295. /package/lib/{monitors/CallSummary.js → ObservedCallSummary.js} +0 -0
@@ -0,0 +1,398 @@
1
+ import { ObservedCall } from './ObservedCall';
2
+ import { ObservedCertificate } from './ObservedCertificate';
3
+ import { ObservedClient } from './ObservedClient';
4
+ import { ObservedCodec } from './ObservedCodec';
5
+ import { ObservedDataChannel } from './ObservedDataChannel';
6
+ import { ObservedIceCandidate } from './ObservedIceCandidate';
7
+ import { ObservedIceCandidatePair } from './ObservedIceCandidatePair';
8
+ import { ObservedIceTransport } from './ObservedIceTransport';
9
+ import { ObservedInboundRtp } from './ObservedInboundRtp';
10
+ import { ObservedInboundTrack } from './ObservedInboundTrack';
11
+ import { ObservedMediaPlayout } from './ObservedMediaPlayout';
12
+ import { ObservedMediaSource } from './ObservedMediaSource';
13
+ import { ObservedOutboundRtp } from './ObservedOutboundRtp';
14
+ import { ObservedOutboundTrack } from './ObservedOutboundTrack';
15
+ import { ObservedPeerConnection } from './ObservedPeerConnection';
16
+ import { Observer } from './Observer';
17
+ import { ClientEvent, ClientIssue, ClientMetaData, ExtensionStat } from './schema/ClientSample';
18
+
19
+ export class ObserverEventMonitor<Context> {
20
+ public constructor(
21
+ public readonly observer: Observer,
22
+ public readonly context: Context,
23
+ ) {
24
+ this._onPeerConnconnectionAdded = this._onPeerConnconnectionAdded.bind(this);
25
+ this._onPeerConnectionRemoved = this._onPeerConnectionRemoved.bind(this);
26
+ this._onCertificateAdded = this._onCertificateAdded.bind(this);
27
+ this._onCertificateRemoved = this._onCertificateRemoved.bind(this);
28
+ this._onInboundTrackAdded = this._onInboundTrackAdded.bind(this);
29
+ this._onInboundTrackRemoved = this._onInboundTrackRemoved.bind(this);
30
+ this._onOutboundTrackAdded = this._onOutboundTrackAdded.bind(this);
31
+ this._onOutboundTrackRemoved = this._onOutboundTrackRemoved.bind(this);
32
+ this._onInboundRtpAdded = this._onInboundRtpAdded.bind(this);
33
+ this._onInboundRtpRemoved = this._onInboundRtpRemoved.bind(this);
34
+ this._onOutboundRtpAdded = this._onOutboundRtpAdded.bind(this);
35
+ this._onOutboundRtpRemoved = this._onOutboundRtpRemoved.bind(this);
36
+ this._onDataChannelAdded = this._onDataChannelAdded.bind(this);
37
+ this._onDataChannelRemoved = this._onDataChannelRemoved.bind(this);
38
+ this._onAddedIceTransport = this._onAddedIceTransport.bind(this);
39
+ this._onRemovedIceTransport = this._onRemovedIceTransport.bind(this);
40
+ this._onIceCandidateAdded = this._onIceCandidateAdded.bind(this);
41
+ this._onIceCandidateRemoved = this._onIceCandidateRemoved.bind(this);
42
+ this._onAddedIceCandidatePair = this._onAddedIceCandidatePair.bind(this);
43
+ this._onRemovedIceCandidatePair = this._onRemovedIceCandidatePair.bind(this);
44
+ this._onAddedMediaCodec = this._onAddedMediaCodec.bind(this);
45
+ this._onRemovedMediaCodec = this._onRemovedMediaCodec.bind(this);
46
+ this._onAddedMediaPlayout = this._onAddedMediaPlayout.bind(this);
47
+ this._onRemovedMediaPlayout = this._onRemovedMediaPlayout.bind(this);
48
+ this._onMediaSourceAdded = this._onMediaSourceAdded.bind(this);
49
+ this._onMediaSourceRemoved = this._onMediaSourceRemoved.bind(this);
50
+ this._onClientIssue = this._onClientIssue.bind(this);
51
+ this._onClientMetadata = this._onClientMetadata.bind(this);
52
+ this._onClientJoined = this._onClientJoined.bind(this);
53
+ this._onClientLeft = this._onClientLeft.bind(this);
54
+ this._onUserMediaError = this._onUserMediaError.bind(this);
55
+ this._onUsingTurn = this._onUsingTurn.bind(this);
56
+ this._onClientAdded = this._onClientAdded.bind(this);
57
+ this._onCallAdded = this._onCallAdded.bind(this);
58
+ this._onClientRejoined = this._onClientRejoined.bind(this);
59
+ this._onClientExtensionStats = this._onClientExtensionStats.bind(this);
60
+
61
+ this.observer.once('close', () => {
62
+ this.observer.off('newcall', this._onCallAdded);
63
+ });
64
+ this.observer.on('newcall', this._onCallAdded);
65
+ }
66
+
67
+ // Public event handlers
68
+ public onCallAdded?: (call: ObservedCall, ctx: Context) => void;
69
+ public onCallRemoved?: (call: ObservedCall, ctx: Context) => void;
70
+ public onCallEmpty?: (call: ObservedCall, ctx: Context) => void;
71
+ public onCallNotEmpty?: (call: ObservedCall, ctx: Context) => void;
72
+ public onCallUpdated?: (call: ObservedCall, ctx: Context) => void;
73
+
74
+ public onClientAdded?: (client: ObservedClient, ctx: Context) => void;
75
+ public onClientClosed?: (client: ObservedClient, ctx: Context) => void;
76
+ public onClientRejoined?: (client: ObservedClient, ctx: Context) => void;
77
+ public onClientIssue?: (observedClent: ObservedClient, issue: ClientIssue, ctx: Context) => void;
78
+ public onClientMetadata?: (observedClient: ObservedClient, metadata: ClientMetaData, ctx: Context) => void;
79
+ public onClientExtensionStats?: (observedClient: ObservedClient, extensionStats: ExtensionStat, ctx: Context) => void;
80
+ public onClientJoined?: (client: ObservedClient, ctx: Context) => void;
81
+ public onClientLeft?: (client: ObservedClient, ctx: Context) => void;
82
+ public onClientUserMediaError?: (observedClient: ObservedClient, error: string, ctx: Context) => void;
83
+ public onClientUsingTurn?: (client: ObservedClient, usingTurn: boolean, ctx: Context) => void;
84
+ public onClientUpdated?: (client: ObservedClient, ctx: Context) => void;
85
+ public onClientEvent?: (client: ObservedClient, event: ClientEvent, ctx: Context) => void;
86
+
87
+ public onPeerConnectionAdded?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
88
+ public onPeerConnectionRemoved?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
89
+ public onSelectedCandidatePairChanged?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
90
+ public onIceGatheringStateChange?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
91
+ public onIceConnectionStateChange?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
92
+ public onConnectionStateChange?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
93
+
94
+ public onCertificateAdded?: (certificate: ObservedCertificate, ctx: Context) => void;
95
+ public onCertificateRemoved?: (certificate: ObservedCertificate, ctx: Context) => void;
96
+
97
+ public onInboundTrackAdded?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
98
+ public onInboundTrackRemoved?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
99
+
100
+ public onOutboundTrackAdded?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
101
+ public onOutboundTrackRemoved?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
102
+
103
+ public onInboundRtpAdded?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
104
+ public onInboundRtpRemoved?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
105
+
106
+ public onOutboundRtpAdded?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
107
+ public onOutboundRtpRemoved?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
108
+
109
+ public onDataChannelAdded?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
110
+ public onDataChannelRemoved?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
111
+
112
+ public onAddedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
113
+ public onRemovedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
114
+
115
+ public onIceCandidateAdded?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
116
+ public onIceCandidateRemoved?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
117
+
118
+ public onAddedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
119
+ public onRemovedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
120
+
121
+ public onAddedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
122
+ public onRemovedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
123
+
124
+ public onAddedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
125
+ public onRemovedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
126
+
127
+ public onMediaSourceAdded?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
128
+ public onMediaSourceRemoved?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
129
+
130
+ private _onCallAdded(call: ObservedCall) {
131
+ const onCallEmpty = () => this.onCallEmpty?.(call, this.context);
132
+ const onCallNotEmpty = () => this.onCallNotEmpty?.(call, this.context);
133
+ const onCallUpdated = () => this.onCallUpdated?.(call, this.context);
134
+
135
+ call.once('close', () => {
136
+ call.off('newclient', this._onClientAdded);
137
+ call.off('empty', onCallEmpty);
138
+ call.off('not-empty', onCallNotEmpty);
139
+ call.off('update', onCallUpdated);
140
+
141
+ this.onCallRemoved?.(call, this.context);
142
+ });
143
+ call.on('newclient', this._onClientAdded);
144
+ call.on('empty', onCallEmpty);
145
+ call.on('not-empty', onCallNotEmpty);
146
+ call.on('update', onCallUpdated);
147
+
148
+ this.onCallAdded?.(call, this.context);
149
+ }
150
+
151
+ private _onClientAdded(observedClient: ObservedClient) {
152
+ const onClientIssue = (issue: ClientIssue) => this._onClientIssue(observedClient, issue);
153
+ const onClientMetadata = (metaData: ClientMetaData) => this._onClientMetadata(observedClient, metaData);
154
+ const onClientJoined = () => this._onClientJoined(observedClient);
155
+ const onClientLeft = () => this._onClientLeft(observedClient);
156
+ const onClientRejoined = () => this._onClientRejoined(observedClient);
157
+ const onClientExtensionStats = (extensionStats: ExtensionStat) => this._onClientExtensionStats(observedClient, extensionStats);
158
+ const onUsingTurn = (usingTurn: boolean) => this._onUsingTurn(observedClient, usingTurn);
159
+ const onUserMediaError = (error: string) => this._onUserMediaError(observedClient, error);
160
+ const onClientUpdated = () => this.onClientUpdated?.(observedClient, this.context);
161
+ const onClientEvent = (event: ClientEvent) => this.onClientEvent?.(observedClient, event, this.context);
162
+
163
+ observedClient.once('close', () => {
164
+ observedClient.off('newpeerconnection', this._onPeerConnconnectionAdded);
165
+ observedClient.off('issue', onClientIssue);
166
+ observedClient.off('metaData', onClientMetadata);
167
+ observedClient.off('joined', onClientJoined);
168
+ observedClient.off('left', onClientLeft);
169
+ observedClient.off('rejoined', onClientJoined);
170
+ observedClient.off('usermediaerror', onUserMediaError);
171
+ observedClient.off('usingturn', onUsingTurn);
172
+ observedClient.off('extensionStats', onClientExtensionStats);
173
+ observedClient.off('update', onClientUpdated);
174
+ observedClient.off('clientEvent', onClientEvent);
175
+
176
+ this.onClientClosed?.(observedClient, this.context);
177
+ });
178
+
179
+ observedClient.on('newpeerconnection', this._onPeerConnconnectionAdded);
180
+ observedClient.on('issue', onClientIssue);
181
+ observedClient.on('metaData', onClientMetadata);
182
+ observedClient.on('joined', onClientJoined);
183
+ observedClient.on('left', onClientLeft);
184
+ observedClient.on('rejoined', onClientRejoined);
185
+ observedClient.on('usermediaerror', onUserMediaError);
186
+ observedClient.on('usingturn', onUsingTurn);
187
+ observedClient.on('extensionStats', onClientExtensionStats);
188
+ observedClient.on('update', onClientUpdated);
189
+ observedClient.on('clientEvent', onClientEvent);
190
+
191
+ this.onClientAdded?.(observedClient, this.context);
192
+ }
193
+
194
+ private _onClientRejoined(observedClient: ObservedClient) {
195
+ this.onClientRejoined?.(observedClient, this.context);
196
+ }
197
+
198
+ private _onPeerConnconnectionAdded(peerConnection: ObservedPeerConnection) {
199
+ const onSelectedCandidatePairChanged = () => this.onSelectedCandidatePairChanged?.(peerConnection, this.context);
200
+ const onIceGatheringStateChange = () => this.onIceGatheringStateChange?.(peerConnection, this.context);
201
+ const onIceConnectionStateChange = () => this.onIceConnectionStateChange?.(peerConnection, this.context);
202
+ const onConnectionStateChange = () => this.onConnectionStateChange?.(peerConnection, this.context);
203
+
204
+ peerConnection.once('close', () => {
205
+ peerConnection.off('added-certificate', this._onCertificateAdded);
206
+ peerConnection.off('removed-certificate', this._onCertificateRemoved);
207
+ peerConnection.off('added-inbound-track', this._onInboundTrackAdded);
208
+ peerConnection.off('removed-inbound-track', this._onInboundTrackRemoved);
209
+ peerConnection.off('added-outbound-track', this._onOutboundTrackAdded);
210
+ peerConnection.off('removed-outbound-track', this._onOutboundTrackRemoved);
211
+ peerConnection.off('added-inbound-rtp', this._onInboundRtpAdded);
212
+ peerConnection.off('removed-inbound-rtp', this._onInboundRtpRemoved);
213
+ peerConnection.off('added-outbound-rtp', this._onOutboundRtpAdded);
214
+ peerConnection.off('removed-outbound-rtp', this._onOutboundRtpRemoved);
215
+ peerConnection.off('added-data-channel', this._onDataChannelAdded);
216
+ peerConnection.off('removed-data-channel', this._onDataChannelRemoved);
217
+ peerConnection.off('added-ice-transport', this._onAddedIceTransport);
218
+ peerConnection.off('removed-ice-transport', this._onRemovedIceTransport);
219
+ peerConnection.off('added-ice-candidate', this._onIceCandidateAdded);
220
+ peerConnection.off('removed-ice-candidate', this._onIceCandidateRemoved);
221
+ peerConnection.off('added-ice-candidate-pair', this._onAddedIceCandidatePair);
222
+ peerConnection.off('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
223
+ peerConnection.off('added-codec', this._onAddedMediaCodec);
224
+ peerConnection.off('removed-codec', this._onRemovedMediaCodec);
225
+ peerConnection.off('added-media-playout', this._onAddedMediaPlayout);
226
+ peerConnection.off('removed-media-playout', this._onRemovedMediaPlayout);
227
+ peerConnection.off('added-media-source', this._onMediaSourceAdded);
228
+ peerConnection.off('removed-media-source', this._onMediaSourceRemoved);
229
+ peerConnection.off('selectedcandidatepair', onSelectedCandidatePairChanged);
230
+ peerConnection.off('icegatheringstatechange', onIceGatheringStateChange);
231
+ peerConnection.off('iceconnectionstatechange', onIceConnectionStateChange);
232
+ peerConnection.off('connectionstatechange', onConnectionStateChange);
233
+
234
+ this.onPeerConnectionRemoved?.(peerConnection, this.context);
235
+ });
236
+
237
+ peerConnection.on('added-certificate', this._onCertificateAdded);
238
+ peerConnection.on('removed-certificate', this._onCertificateRemoved);
239
+ peerConnection.on('added-inbound-track', this._onInboundTrackAdded);
240
+ peerConnection.on('removed-inbound-track', this._onInboundTrackRemoved);
241
+ peerConnection.on('added-outbound-track', this._onOutboundTrackAdded);
242
+ peerConnection.on('removed-outbound-track', this._onOutboundTrackRemoved);
243
+ peerConnection.on('added-inbound-rtp', this._onInboundRtpAdded);
244
+ peerConnection.on('removed-inbound-rtp', this._onInboundRtpRemoved);
245
+ peerConnection.on('added-outbound-rtp', this._onOutboundRtpAdded);
246
+ peerConnection.on('removed-outbound-rtp', this._onOutboundRtpRemoved);
247
+ peerConnection.on('added-data-channel', this._onDataChannelAdded);
248
+ peerConnection.on('removed-data-channel', this._onDataChannelRemoved);
249
+ peerConnection.on('added-ice-transport', this._onAddedIceTransport);
250
+ peerConnection.on('removed-ice-transport', this._onRemovedIceTransport);
251
+ peerConnection.on('added-ice-candidate', this._onIceCandidateAdded);
252
+ peerConnection.on('removed-ice-candidate', this._onIceCandidateRemoved);
253
+ peerConnection.on('added-ice-candidate-pair', this._onAddedIceCandidatePair);
254
+ peerConnection.on('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
255
+ peerConnection.on('added-codec', this._onAddedMediaCodec);
256
+ peerConnection.on('removed-codec', this._onRemovedMediaCodec);
257
+ peerConnection.on('added-media-playout', this._onAddedMediaPlayout);
258
+ peerConnection.on('removed-media-playout', this._onRemovedMediaPlayout);
259
+ peerConnection.on('added-media-source', this._onMediaSourceAdded);
260
+ peerConnection.on('removed-media-source', this._onMediaSourceRemoved);
261
+ peerConnection.on('selectedcandidatepair', onSelectedCandidatePairChanged);
262
+ peerConnection.on('icegatheringstatechange', onIceGatheringStateChange);
263
+ peerConnection.on('iceconnectionstatechange', onIceConnectionStateChange);
264
+ peerConnection.on('connectionstatechange', onConnectionStateChange);
265
+
266
+ this.onPeerConnectionAdded?.(peerConnection, this.context);
267
+
268
+ }
269
+
270
+ private _onPeerConnectionRemoved(peerConnection: ObservedPeerConnection) {
271
+ this.onPeerConnectionRemoved?.(peerConnection, this.context);
272
+
273
+ }
274
+
275
+ private _onCertificateAdded(certificate: ObservedCertificate) {
276
+ this.onCertificateAdded?.(certificate, this.context);
277
+ }
278
+
279
+ private _onCertificateRemoved(certificate: ObservedCertificate) {
280
+ this.onCertificateRemoved?.(certificate, this.context);
281
+ }
282
+
283
+ private _onInboundTrackAdded(inboundTrack: ObservedInboundTrack) {
284
+ this.onInboundTrackAdded?.(inboundTrack, this.context);
285
+ }
286
+
287
+ private _onInboundTrackRemoved(inboundTrack: ObservedInboundTrack) {
288
+ this.onInboundTrackRemoved?.(inboundTrack, this.context);
289
+ }
290
+
291
+ private _onOutboundTrackAdded(outboundTrack: ObservedOutboundTrack) {
292
+ this.onOutboundTrackAdded?.(outboundTrack, this.context);
293
+ }
294
+
295
+ private _onOutboundTrackRemoved(outboundTrack: ObservedOutboundTrack) {
296
+ this.onOutboundTrackRemoved?.(outboundTrack, this.context);
297
+ }
298
+
299
+ private _onInboundRtpAdded(inboundRtp: ObservedInboundRtp) {
300
+ this.onInboundRtpAdded?.(inboundRtp, this.context);
301
+ }
302
+
303
+ private _onInboundRtpRemoved(inboundRtp: ObservedInboundRtp) {
304
+ this.onInboundRtpRemoved?.(inboundRtp, this.context);
305
+ }
306
+
307
+ private _onOutboundRtpAdded(outboundRtp: ObservedOutboundRtp) {
308
+ this.onOutboundRtpAdded?.(outboundRtp, this.context);
309
+ }
310
+
311
+ private _onOutboundRtpRemoved(outboundRtp: ObservedOutboundRtp) {
312
+ this.onOutboundRtpRemoved?.(outboundRtp, this.context);
313
+ }
314
+
315
+ private _onDataChannelAdded(dataChannel: ObservedDataChannel) {
316
+ this.onDataChannelAdded?.(dataChannel, this.context);
317
+ }
318
+
319
+ private _onDataChannelRemoved(dataChannel: ObservedDataChannel) {
320
+ this.onDataChannelRemoved?.(dataChannel, this.context);
321
+ }
322
+
323
+ private _onAddedIceTransport(iceTransport: ObservedIceTransport) {
324
+ this.onAddedIceTransport?.(iceTransport, this.context);
325
+ }
326
+
327
+ private _onRemovedIceTransport(iceTransport: ObservedIceTransport) {
328
+ this.onRemovedIceTransport?.(iceTransport, this.context);
329
+ }
330
+
331
+ private _onIceCandidateAdded(iceCandidate: ObservedIceCandidate) {
332
+ this.onIceCandidateAdded?.(iceCandidate, this.context);
333
+ }
334
+
335
+ private _onIceCandidateRemoved(iceCandidate: ObservedIceCandidate) {
336
+ this.onIceCandidateRemoved?.(iceCandidate, this.context);
337
+ }
338
+
339
+ private _onAddedIceCandidatePair(candidatePair: ObservedIceCandidatePair) {
340
+ this.onAddedIceCandidatePair?.(candidatePair, this.context);
341
+ }
342
+
343
+ private _onRemovedIceCandidatePair(candidatePair: ObservedIceCandidatePair) {
344
+ this.onRemovedIceCandidatePair?.(candidatePair, this.context);
345
+ }
346
+
347
+ private _onAddedMediaCodec(codec: ObservedCodec) {
348
+ this.onAddedMediaCodec?.(codec, this.context);
349
+ }
350
+
351
+ private _onRemovedMediaCodec(codec: ObservedCodec) {
352
+ this.onRemovedMediaCodec?.(codec, this.context);
353
+ }
354
+
355
+ private _onAddedMediaPlayout(mediaPlayout: ObservedMediaPlayout) {
356
+ this.onAddedMediaPlayout?.(mediaPlayout, this.context);
357
+ }
358
+
359
+ private _onRemovedMediaPlayout(mediaPlayout: ObservedMediaPlayout) {
360
+ this.onRemovedMediaPlayout?.(mediaPlayout, this.context);
361
+ }
362
+
363
+ private _onMediaSourceAdded(mediaSource: ObservedMediaSource) {
364
+ this.onMediaSourceAdded?.(mediaSource, this.context);
365
+ }
366
+
367
+ private _onMediaSourceRemoved(mediaSource: ObservedMediaSource) {
368
+ this.onMediaSourceRemoved?.(mediaSource, this.context);
369
+ }
370
+
371
+ private _onClientIssue(observedClent: ObservedClient, issue: ClientIssue) {
372
+ this.onClientIssue?.(observedClent, issue, this.context);
373
+ }
374
+
375
+ private _onClientMetadata(observedClient: ObservedClient, metadata: ClientMetaData) {
376
+ this.onClientMetadata?.(observedClient, metadata, this.context);
377
+ }
378
+
379
+ private _onClientExtensionStats(observedClient: ObservedClient, extensionStats: ExtensionStat) {
380
+ this.onClientExtensionStats?.(observedClient, extensionStats, this.context);
381
+ }
382
+
383
+ private _onClientJoined(observedClient: ObservedClient) {
384
+ this.onClientJoined?.(observedClient, this.context);
385
+ }
386
+
387
+ private _onClientLeft(observedClient: ObservedClient) {
388
+ this.onClientLeft?.(observedClient, this.context);
389
+ }
390
+
391
+ private _onUserMediaError(observedClient: ObservedClient, error: string) {
392
+ this.onClientUserMediaError?.(observedClient, error, this.context);
393
+ }
394
+
395
+ private _onUsingTurn(observedClient: ObservedClient, usingTurn: boolean) {
396
+ this.onClientUsingTurn?.(observedClient, usingTurn, this.context);
397
+ }
398
+ }
@@ -0,0 +1,15 @@
1
+ export type ObserverSummary = {
2
+ currentActiveCalls: number;
3
+ currentNumberOfClientsUsingTURN: number;
4
+ currentNumberOfClients: number;
5
+
6
+ totalAddedCall: number;
7
+ totalRemovedCall: number;
8
+
9
+ totalRttLt50Measurements: number,
10
+ totalRttLt150Measurements: number,
11
+ totalRttLt300Measurements: number,
12
+ totalRttGtOrEq300Measurements: number,
13
+
14
+ totalClientIssues: number,
15
+ }
@@ -1,56 +1,84 @@
1
1
  export type Middleware<T> = (
2
2
  input: T,
3
- next: (nextInput: T) => void,
3
+ next: (nextInput: T) => void
4
4
  ) => void;
5
5
 
6
6
  export interface Processor<T> {
7
+ finalCallback?: Callback<T>;
7
8
  process(value: T): void;
8
9
  addMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
9
10
  removeMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
10
11
  }
11
12
 
12
- export function createProcessor<T>(
13
- ): Processor<T> {
14
- const stack: Middleware<T>[] = [];
15
- const result: Processor<T> = {
16
- addMiddleware: (...middlewares: Middleware<T>[]) => {
17
- if (middlewares && 0 < middlewares.length) {
18
- stack.push(...middlewares);
19
- }
20
-
21
- return result;
22
- },
13
+ type Callback<T> = (input: T) => void;
14
+
15
+ class Executor<T> {
16
+ public done = false;
17
+ private index = 0;
18
+ private prevIndex = -1;
19
+
20
+ constructor(
21
+ private readonly stack: Middleware<T>[],
22
+ private readonly finalCallback?: Callback<T>
23
+ ) {
24
+ }
25
+
26
+ // Executes the middleware stack
27
+ public execute(input: T): void {
28
+ if (this.index <= this.prevIndex) {
29
+ throw new Error('Middleware must call next() only once!');
30
+ } else if (this.done) {
31
+ throw new Error('Middleware stack has already been executed!');
32
+ }
33
+
34
+ this.prevIndex = this.index;
35
+
36
+ const middleware = this.stack[this.index];
37
+
38
+ this.index++;
39
+
40
+ if (middleware) {
41
+ return middleware(input, (nextInput: T) => this.execute(nextInput));
42
+ }
43
+
44
+ this.done = true;
45
+ this.finalCallback?.(input);
46
+ }
47
+ }
48
+
49
+ export class MiddlewareProcessor<T> implements Processor<T> {
50
+ private stack: Middleware<T>[] = [];
51
+ public finalCallback?: Callback<T>;
52
+
53
+ public addMiddleware(...middlewares: Middleware<T>[]): Processor<T> {
54
+ if (middlewares && middlewares.length > 0) {
55
+ this.stack.push(...middlewares);
56
+ }
57
+
58
+ return this;
59
+ }
23
60
 
24
- removeMiddleware: (...middlewares: Middleware<T>[]) => {
25
- if (middlewares && 0 < middlewares.length) {
26
- for (const process of middlewares) {
27
- const index = stack.indexOf(process);
61
+ public removeMiddleware(...middlewares: Middleware<T>[]): Processor<T> {
62
+ if (middlewares && middlewares.length > 0) {
63
+ for (const middleware of middlewares) {
64
+ const index = this.stack.indexOf(middleware);
28
65
 
29
- if (0 < index) stack.splice(index, 1);
66
+ if (index >= 0) {
67
+ this.stack.splice(index, 1);
30
68
  }
31
69
  }
32
-
33
- return result;
34
- },
35
- process: (value: T) => {
36
- let prevIndex = -1;
37
- const execute = (index: number, input: T): void => {
38
- if (index <= prevIndex) {
39
- throw new Error('middleware must call next() only once!');
40
- }
41
- prevIndex = index;
42
- const middleware = stack[index];
43
-
44
- if (!middleware) return;
45
-
46
- const next = (nextInput: T) => execute(index + 1, nextInput);
47
-
48
- return middleware(input, next);
49
- };
50
-
51
- return execute(0, value);
52
- },
53
- };
54
-
55
- return result;
56
- }
70
+ }
71
+
72
+ return this;
73
+ }
74
+
75
+ public process(value: T): void {
76
+ if (this.stack.length === 0) {
77
+ return this.finalCallback?.(value);
78
+ }
79
+
80
+ const executor = new Executor(this.stack, this.finalCallback);
81
+
82
+ executor.execute(value);
83
+ }
84
+ }