@observertc/observer-js 0.9.6-beta → 0.9.8-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 (36) hide show
  1. package/LICENSE +201 -22
  2. package/lib/Evaluator.d.ts +1 -1
  3. package/lib/Evaluator.d.ts.map +1 -1
  4. package/lib/Evaluator.js +5 -1
  5. package/lib/Observer.d.ts +4 -2
  6. package/lib/Observer.d.ts.map +1 -1
  7. package/lib/Observer.js +16 -0
  8. package/lib/common/ReportsCollector.d.ts +4 -0
  9. package/lib/common/ReportsCollector.d.ts.map +1 -1
  10. package/lib/common/types.d.ts +26 -1
  11. package/lib/common/types.d.ts.map +1 -1
  12. package/lib/common/types.js +0 -2
  13. package/lib/index.d.ts +2 -2
  14. package/lib/index.d.ts.map +1 -1
  15. package/lib/middlewares/CommitTransactionMiddleware.d.ts +2 -1
  16. package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +1 -1
  17. package/lib/middlewares/CommitTransactionMiddleware.js +5 -1
  18. package/lib/middlewares/Processor.d.ts +1 -0
  19. package/lib/middlewares/Processor.d.ts.map +1 -1
  20. package/lib/middlewares/Processor.js +3 -0
  21. package/lib/middlewares/TransactoinProcessor.js +1 -1
  22. package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
  23. package/lib/sinks/ObserverSink.d.ts +16 -2
  24. package/lib/sinks/ObserverSink.d.ts.map +1 -1
  25. package/lib/sinks/ObserverSink.js +109 -1
  26. package/package.json +1 -1
  27. package/src/Evaluator.ts +9 -2
  28. package/src/Observer.ts +20 -2
  29. package/src/common/ReportsCollector.ts +5 -0
  30. package/src/common/types.ts +36 -2
  31. package/src/index.ts +2 -2
  32. package/src/middlewares/CommitTransactionMiddleware.ts +10 -1
  33. package/src/middlewares/Processor.ts +4 -0
  34. package/src/middlewares/TransactoinProcessor.ts +1 -1
  35. package/src/middlewares/VisitObservedCallsMiddleware.ts +9 -3
  36. package/src/sinks/ObserverSink.ts +126 -3
package/LICENSE CHANGED
@@ -1,22 +1,201 @@
1
- Copyright (c) 2022 Balazs Kreith
2
-
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023 Balazs Kreith
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -17,13 +17,13 @@ export declare class Evaluator {
17
17
  private readonly _storageProvider;
18
18
  private readonly _reportsCollector;
19
19
  private _index;
20
+ private _evaluations;
20
21
  private _clientOperations;
21
22
  private _emitter;
22
23
  private _evaluatorProcesses;
23
24
  private _callProcessor;
24
25
  private _transactionProcessor;
25
26
  private _customProcessor;
26
- private _evaluations;
27
27
  constructor(config: EvaluatorConfig, _callSemaphore: Semaphore, _storageProvider: StorageProvider, _reportsCollector: ReportsCollector);
28
28
  addProcess(process: EvaluatorProcess): void;
29
29
  removeProcess(process: EvaluatorProcess): void;
@@ -1 +1 @@
1
- {"version":3,"file":"Evaluator.d.ts","sourceRoot":"","sources":["../src/Evaluator.ts"],"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C/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAjBnC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,YAAY,CAAoC;IAExD,OAAO,CAAC,iBAAiB,CAAoC;IAC7D,OAAO,CAAC,QAAQ,CAAsB;IAEtC,OAAO,CAAC,mBAAmB,CAA6D;IACxF,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,qBAAqB,CAAgC;IAC7D,OAAO,CAAC,gBAAgB,CAA8B;gBAKrC,MAAM,EAAE,eAAe,EACtB,cAAc,EAAE,SAAS,EACzB,gBAAgB,EAAE,eAAe,EACjC,iBAAiB,EAAE,gBAAgB;IAa9C,UAAU,CAAC,OAAO,EAAE,gBAAgB;IASpC,aAAa,CAAC,OAAO,EAAE,gBAAgB;IASvC,qBAAqB,CAAC,YAAY,EAAE,0BAA0B;IAQ9D,sBAAsB,CAAC,YAAY,EAAE,0BAA0B;IAO/D,EAAE,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAKjG,GAAG,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAKzG,OAAO,CAAC,KAAK;IAIN,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAAG,IAAI;YAuD7D,KAAK;IAuBnB,IAAW,cAAc,IAAI,MAAM,CAElC;YAEa,QAAQ;CAqBtB"}
package/lib/Evaluator.js CHANGED
@@ -16,10 +16,10 @@ class Evaluator {
16
16
  this._storageProvider = _storageProvider;
17
17
  this._reportsCollector = _reportsCollector;
18
18
  this._index = 0;
19
+ this._evaluations = new Map();
19
20
  this._clientOperations = new Map();
20
21
  this._emitter = new events_1.EventEmitter();
21
22
  this._evaluatorProcesses = new Map();
22
- this._evaluations = new Map();
23
23
  this._callProcessor = (0, CallProcessor_1.createCallProcessor)(_storageProvider, _reportsCollector);
24
24
  this._transactionProcessor = (0, TransactoinProcessor_1.createTransactionProcessor)(_storageProvider, _reportsCollector, this.config.fetchSamples);
25
25
  this._customProcessor = (0, Processor_1.createProcessor)();
@@ -97,6 +97,10 @@ class Evaluator {
97
97
  removedSfuOutbounRtpPadIds: [],
98
98
  openedSfuSctpChannelIds: [],
99
99
  closedSfuSctpChannels: [],
100
+ clientExtensionStats: [],
101
+ callEvents: [],
102
+ sfuEvents: [],
103
+ sfuExtensionStats: [],
100
104
  };
101
105
  const callOperations = (0, CallOperationsContext_1.createCallOperationContext)(this._clientOperations, evaluatorContext);
102
106
  this._clientOperations.clear();
package/lib/Observer.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ObserverSink, SinkConfig } from './sinks/ObserverSink';
1
+ import { ObserverSinkEmitter, ObserverSinkProcess, SinkConfig } from './sinks/ObserverSink';
2
2
  import { SourcesConfig } from './sources/Sources';
3
3
  import { StorageProvider } from './storages/StorageProvider';
4
4
  import * as Models from './models/Models';
@@ -47,9 +47,11 @@ export declare class Observer {
47
47
  createCallSource(config: PartialBy<ObservedCallSourceConfig, 'serviceId' | 'mediaUnitId'>): ObservedCallSource;
48
48
  createClientSource(config: PartialBy<ObservedClientSourceConfig, 'serviceId' | 'mediaUnitId' | 'joined'>): ObservedClientSource;
49
49
  createSfuSource(config: PartialBy<ObservedSfuSourceConfig, 'serviceId' | 'mediaUnitId' | 'joined'>): ObservedSfuSource;
50
- get sink(): ObserverSink;
50
+ get sink(): ObserverSinkEmitter;
51
51
  addEvaluators(...processes: EvaluatorProcess[]): void;
52
52
  removeEvaluators(...processes: EvaluatorProcess[]): void;
53
+ addSinks(...processes: ObserverSinkProcess[]): void;
54
+ removeSinks(...processes: ObserverSinkProcess[]): void;
53
55
  calls(): AsyncIterableIterator<[string, Models.Call]>;
54
56
  sfus(): AsyncIterableIterator<[string, Models.Sfu]>;
55
57
  sfuTransports(): AsyncIterableIterator<[string, Models.SfuTransport]>;
@@ -1 +1 @@
1
- {"version":3,"file":"Observer.d.ts","sourceRoot":"","sources":["../src/Observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAW,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAA+B,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAa,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAiC,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAgB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAIzF,MAAM,MAAM,cAAc,GAAG;IAC5B;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC;IACvB,SAAS,EAAE,eAAe,CAAC;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAE/B,QAAQ,EAAE,QAAQ,CAAC;CACnB,CAAC;AAEF,qBAAa,QAAQ;a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C;IAKzC,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC;IAKjF,mBAAmB,CAC/B,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,GAC/B,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAKvC,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC;IAKpF,oBAAoB,CAChC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,GAChC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IAKxC,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,GAAG,SAAS,CAAC;IAKpF,oBAAoB,CAChC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,GAC9B,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;IAKtD,IAAW,MAAM,YAEhB;IAEM,KAAK;CAQZ"}
package/lib/Observer.js CHANGED
@@ -141,6 +141,22 @@ class Observer {
141
141
  this._evaluator.removeProcess(process);
142
142
  }
143
143
  }
144
+ addSinks(...processes) {
145
+ if (this._closed) {
146
+ throw new Error(`Attempted to add an evaluator to a closed observer`);
147
+ }
148
+ for (const process of processes) {
149
+ this._sink.addProcess(process);
150
+ }
151
+ }
152
+ removeSinks(...processes) {
153
+ if (this._closed) {
154
+ throw new Error(`Attempted to remove an evaluator from a closed observer`);
155
+ }
156
+ for (const process of processes) {
157
+ this._sink.removeProcess(process);
158
+ }
159
+ }
144
160
  calls() {
145
161
  const { callStorage } = this._storages;
146
162
  return callStorage[Symbol.asyncIterator]();
@@ -18,5 +18,9 @@ export interface ReportsCollector {
18
18
  addSfuSctpStreamReport(report: SfuSctpStreamReport): void;
19
19
  addSfuTransportReport(report: SFUTransportReport): void;
20
20
  addSfuMetaReport(report: SfuMetaReport): void;
21
+ getCallEventReports(): CallEventReport[];
22
+ getClientExtensionReports(): ClientExtensionReport[];
23
+ getSfuEventReports(): SfuEventReport[];
24
+ getSfuExtensionReports(): SfuExtensionReport[];
21
25
  }
22
26
  //# sourceMappingURL=ReportsCollector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReportsCollector.d.ts","sourceRoot":"","sources":["../../src/common/ReportsCollector.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAChC,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAClD,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAChD,0BAA0B,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAClE,wBAAwB,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC9D,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAChE,0BAA0B,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAClE,0BAA0B,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAClE,iCAAiC,CAAC,MAAM,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC/E,sBAAsB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC1D,2BAA2B,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACpE,2BA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,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAClE,iCAAiC,CAAC,MAAM,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC/E,sBAAsB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC1D,2BAA2B,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACpE,2BAA2B,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACpE,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAChD,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACxD,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAChE,0BAA0B,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAClE,sBAAsB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC1D,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACxD,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAE9C,mBAAmB,IAAI,eAAe,EAAE,CAAC;IACzC,yBAAyB,IAAI,qBAAqB,EAAE,CAAC;IACrD,kBAAkB,IAAI,cAAc,EAAE,CAAC;IACvC,sBAAsB,IAAI,kBAAkB,EAAE,CAAC;CAC/C"}
@@ -1,4 +1,4 @@
1
- import { CallEventReport, CallMetaReport, ClientExtensionReport, InboundAudioTrackReport, InboundVideoTrackReport, OutboundAudioTrackReport, OutboundVideoTrackReport, PeerConnectionTransportReport } from '@observertc/report-schemas-js';
1
+ import { CallEventReport, CallMetaReport, ClientDataChannelReport, ClientExtensionReport, IceCandidatePairReport, InboundAudioTrackReport, InboundVideoTrackReport, ObserverEventReport, OutboundAudioTrackReport, OutboundVideoTrackReport, PeerConnectionTransportReport, SfuEventReport, SfuExtensionReport, SfuInboundRtpPadReport, SfuMetaReport, SfuOutboundRtpPadReport, SfuSctpStreamReport, SFUTransportReport } from '@observertc/report-schemas-js';
2
2
  import { ObservedCalls } from '../samples/ObservedCalls';
3
3
  import { ReportsCollector } from './ReportsCollector';
4
4
  import * as Models from '../models/Models';
@@ -60,6 +60,31 @@ export interface EvaluatorContext {
60
60
  readonly observedSfus: ObservedSfus;
61
61
  readonly storages: StorageProvider;
62
62
  readonly reports: ReportsCollector;
63
+ readonly clientExtensionStats: ClientExtensionReport[];
64
+ readonly callEvents: CallEventReport[];
65
+ readonly sfuEvents: SfuEventReport[];
66
+ readonly sfuExtensionStats: SfuExtensionReport[];
63
67
  }
64
68
  export type EvaluatorMiddleware = Middleware<EvaluatorContext>;
69
+ export interface ObserverSinkContext {
70
+ readonly callEventReports: CallEventReport[];
71
+ readonly callMetaReports: CallMetaReport[];
72
+ readonly clientDataChannelReports: ClientDataChannelReport[];
73
+ readonly clientExtensionReports: ClientExtensionReport[];
74
+ readonly iceCandidatePairReports: IceCandidatePairReport[];
75
+ readonly inboundAudioTrackReports: InboundAudioTrackReport[];
76
+ readonly inboundVideoTrackReports: InboundVideoTrackReport[];
77
+ readonly peerConnectionTransportReports: PeerConnectionTransportReport[];
78
+ readonly observerEventReports: ObserverEventReport[];
79
+ readonly outboundAudioTrackReports: OutboundAudioTrackReport[];
80
+ readonly outboundVideoTrackReports: OutboundVideoTrackReport[];
81
+ readonly sfuEventReports: SfuEventReport[];
82
+ readonly sfuExtensionReports: SfuExtensionReport[];
83
+ readonly sfuInboundRtpPadReports: SfuInboundRtpPadReport[];
84
+ readonly sfuOutboundRtpPadReports: SfuOutboundRtpPadReport[];
85
+ readonly sfuSctpStreamReports: SfuSctpStreamReport[];
86
+ readonly sfuTransportReports: SFUTransportReport[];
87
+ readonly sfuMetaReports: SfuMetaReport[];
88
+ }
89
+ export type ObserverSinkMiddleware = Middleware<ObserverSinkContext>;
65
90
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.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AC;IAC7D,QAAQ,CAAC,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;IACzD,QAAQ,CAAC,uBAAuB,EAAE,sBAAsB,EAAE,CAAC;IAC3D,QAAQ,CAAC,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IAC7D,QAAQ,CAAC,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IAC7D,QAAQ,CAAC,8BAA8B,EAAE,6BAA6B,EAAE,CAAC;IACzE,QAAQ,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;IACrD,QAAQ,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,CAAC;IAC/D,QAAQ,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,CAAC;IAC/D,QAAQ,CAAC,eAAe,EAAE,cAAc,EAAE,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IACnD,QAAQ,CAAC,uBAAuB,EAAE,sBAAsB,EAAE,CAAC;IAC3D,QAAQ,CAAC,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IAC7D,QAAQ,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;IACrD,QAAQ,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IACnD,QAAQ,CAAC,cAAc,EAAE,aAAa,EAAE,CAAC;CACzC;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC"}
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // const c: EvaluatorContext;
4
- // c.endedCalls[0].
package/lib/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export type { ObserverConfig } from './Observer';
2
2
  export type { EvaluatorConfig, EvaluatorProcess } from './Evaluator';
3
3
  export type { SourcesConfig } from './sources/Sources';
4
4
  export { Observer } from './Observer';
5
- export type { ObserverSink } from './sinks/ObserverSink';
5
+ export type { ObserverSinkEmitter as ObserverSink } from './sinks/ObserverSink';
6
6
  export type { ObserverStorage } from './storages/ObserverStorage';
7
7
  export type { StorageProvider } from './storages/StorageProvider';
8
8
  export * as Models from './models/Models';
@@ -13,7 +13,7 @@ export type { CallEventReport, CallMetaReport, ClientDataChannelReport, ClientEx
13
13
  export type { ObservedClientSource, ObservedClientSourceConfig } from './sources/ObservedClientSource';
14
14
  export type { ObservedSfuSource, ObservedSfuSourceConfig } from './sources/ObservedSfuSource';
15
15
  export type { ObservedCallSource, ObservedCallSourceConfig as ObservedCallConfig } from './sources/ObservedCallSource';
16
- export type { EvaluatorContext, EvaluatorMiddleware } from './common/types';
16
+ export type { EvaluatorContext, EvaluatorMiddleware, ObserverSinkContext, ObserverSinkMiddleware } from './common/types';
17
17
  import { Observer, ObserverConfig } from './Observer';
18
18
  export declare function createObserver(config?: Partial<ObserverConfig>): Observer;
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAErE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAE1C,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAE9D,YAAY,EACX,OAAO,EACP,YAAY,EACZ,SAAS,EACT,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,eAA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CAAC;AACtD,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,YAE9D"}
@@ -1,5 +1,6 @@
1
+ import { ReportsCollector } from '../common/ReportsCollector';
1
2
  import { StorageProvider } from '../storages/StorageProvider';
2
3
  import { Middleware } from './Middleware';
3
4
  import { TransactionContext } from './TransactionContext';
4
- export declare function createCommitTransactionMiddleware(storageProvider: StorageProvider): Middleware<TransactionContext>;
5
+ export declare function createCommitTransactionMiddleware(storageProvider: StorageProvider, reports: ReportsCollector): Middleware<TransactionContext>;
5
6
  //# sourceMappingURL=CommitTransactionMiddleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommitTransactionMiddleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/CommitTransactionMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D,wBAAgB,iCAAiC,CAAC,eAAe,EAAE,eAAe,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAmTlH"}
1
+ {"version":3,"file":"CommitTransactionMiddleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/CommitTransactionMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D,wBAAgB,iCAAiC,CAChD,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,gBAAgB,GACvB,UAAU,CAAC,kBAAkB,CAAC,CAwThC"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCommitTransactionMiddleware = void 0;
4
4
  const logger_1 = require("../common/logger");
5
5
  const logger = (0, logger_1.createLogger)('CallUpdateMiddleware');
6
- function createCommitTransactionMiddleware(storageProvider) {
6
+ function createCommitTransactionMiddleware(storageProvider, reports) {
7
7
  const process = async (transaction) => {
8
8
  const { clientStorage, peerConnectionStorage, inboundTrackStorage, outboundTrackStorage, sfuStorage, sfuTransportStorage, sfuInboundRtpPadStorage, sfuOutboundRtpPadStorage, sfuSctpChannelStorage, } = storageProvider;
9
9
  const { clients, updatedPeerConnections, deletedPeerConnections, updatedInboundAudioTracks, deletedInboundAudioTracks, updatedInboundVideoTracks, deletedInboundVideoTracks, updatedOutboundAudioTracks, deletedOutboundAudioTracks, updatedOutboundVideoTracks, deletedOutboundVideoTracks, updatedSfus, deletedSfus, updatedSfuTransports, deletedSfuTransports, updatedSfuInboundRtpPads, deletedSfuInboundRtpPads, updatedSfuOutboundRtpPads, deletedSfuOutboundRtpPads, updatedSfuSctpChannels, deletedSfuSctpChannels, evaluatorContext, } = transaction;
@@ -170,6 +170,10 @@ function createCommitTransactionMiddleware(storageProvider) {
170
170
  closed: Date.now(),
171
171
  };
172
172
  }));
173
+ evaluatorContext.callEvents = [...reports.getCallEventReports()];
174
+ evaluatorContext.clientExtensionStats = [...reports.getClientExtensionReports()];
175
+ evaluatorContext.sfuEvents = [...reports.getSfuEventReports()];
176
+ evaluatorContext.sfuExtensionStats = [...reports.getSfuExtensionReports()];
173
177
  };
174
178
  const result = async (context, next) => {
175
179
  await Promise.all([process(context), next ? next(context) : Promise.resolve()]);
@@ -3,6 +3,7 @@ export interface Processor<T> {
3
3
  use(value: T): Promise<void | T>;
4
4
  addMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
5
5
  removeMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
6
+ getSize(): number;
6
7
  }
7
8
  export declare function createProcessor<T>(...processes: Middleware<T>[]): Processor<T>;
8
9
  //# sourceMappingURL=Processor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Processor.d.ts","sourceRoot":"","sources":["../../src/middlewares/Processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACjC,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;CAChE;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAsC9E"}
1
+ {"version":3,"file":"Processor.d.ts","sourceRoot":"","sources":["../../src/middlewares/Processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACjC,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO,IAAI,MAAM,CAAC;CAClB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAyC9E"}
@@ -36,6 +36,9 @@ function createProcessor(...processes) {
36
36
  };
37
37
  return executeMiddleware(value, 0);
38
38
  },
39
+ getSize: () => {
40
+ return stack.length;
41
+ }
39
42
  };
40
43
  return result;
41
44
  }
@@ -10,6 +10,6 @@ function createTransactionProcessor(storageProvider, reportsCollector, fetchSamp
10
10
  // all of these middlewares must execute sequentially!
11
11
  (0, VisitObservedCallsMiddleware_1.createVisitObservedCallsMiddleware)(reportsCollector, fetchSamples), (0, VisitObservedSfusMiddleware_1.createVisitObservedSfusMiddleware)(reportsCollector, fetchSamples),
12
12
  // must be the last one!
13
- (0, CommitTransactionMiddleware_1.createCommitTransactionMiddleware)(storageProvider));
13
+ (0, CommitTransactionMiddleware_1.createCommitTransactionMiddleware)(storageProvider, reportsCollector));
14
14
  }
15
15
  exports.createTransactionProcessor = createTransactionProcessor;
@@ -1 +1 @@
1
- {"version":3,"file":"VisitObservedCallsMiddleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/VisitObservedCallsMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAQ9D,eAAO,MAAM,MAAM,0CAA+C,CAAC;AAEnE,wBAAgB,kCAAkC,CACjD,OAAO,EAAE,gBAAgB,EACzB,YAAY,EAAE,OAAO,GACnB,UAAU,CAAC,kBAAkB,CAAC,CAyOhC"}
1
+ {"version":3,"file":"VisitObservedCallsMiddleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/VisitObservedCallsMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAS9D,eAAO,MAAM,MAAM,0CAA+C,CAAC;AAEnE,wBAAgB,kCAAkC,CACjD,OAAO,EAAE,gBAAgB,EACzB,YAAY,EAAE,OAAO,GACnB,UAAU,CAAC,kBAAkB,CAAC,CA8OhC"}
@@ -1,5 +1,6 @@
1
1
  import { CallEventReport, CallMetaReport, ClientDataChannelReport, ClientExtensionReport, IceCandidatePairReport, InboundAudioTrackReport, InboundVideoTrackReport, ObserverEventReport, OutboundAudioTrackReport, OutboundVideoTrackReport, PeerConnectionTransportReport, SfuEventReport, SfuExtensionReport, SfuInboundRtpPadReport, SfuMetaReport, SfuOutboundRtpPadReport, SfuSctpStreamReport, SFUTransportReport } from '@observertc/report-schemas-js';
2
2
  import { ReportsCollector } from '../common/ReportsCollector';
3
+ import { ObserverSinkContext } from '../common/types';
3
4
  export type SinkEventsMap = {
4
5
  'call-event': {
5
6
  reports: CallEventReport[];
@@ -57,13 +58,18 @@ export type SinkEventsMap = {
57
58
  };
58
59
  };
59
60
  export type SinkConfig = Record<string, unknown>;
60
- export interface ObserverSink {
61
+ export type ObserverSinkProcess = (observerSinkContext: ObserverSinkContext) => Promise<void>;
62
+ export interface ObserverSinkEmitter {
61
63
  on<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
62
64
  off<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
63
65
  once<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
64
66
  }
65
- export declare class SinkImpl implements ReportsCollector, ObserverSink {
67
+ export declare class SinkImpl implements ReportsCollector, ObserverSinkEmitter {
66
68
  readonly config: SinkConfig;
69
+ private _index;
70
+ private _processes;
71
+ private _customProcesses;
72
+ private readonly _processor;
67
73
  private _emitter;
68
74
  private _callEventReports;
69
75
  private _callMetaReports;
@@ -105,7 +111,15 @@ export declare class SinkImpl implements ReportsCollector, ObserverSink {
105
111
  addSfuSctpStreamReport(report: SfuSctpStreamReport): void;
106
112
  addSfuTransportReport(report: SFUTransportReport): void;
107
113
  addSfuMetaReport(report: SfuMetaReport): void;
114
+ getCallEventReports(): CallEventReport[];
115
+ getClientExtensionReports(): ClientExtensionReport[];
116
+ getSfuEventReports(): SfuEventReport[];
117
+ getSfuExtensionReports(): SfuExtensionReport[];
118
+ addProcess(process: ObserverSinkProcess): void;
119
+ removeProcess(process: ObserverSinkProcess): void;
120
+ private _process;
108
121
  emit(): number;
109
122
  private _emit;
123
+ private _createObserverSinkContext;
110
124
  }
111
125
  //# sourceMappingURL=ObserverSink.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObserverSink.d.ts","sourceRoot":"","sources":["../../src/sinks/ObserverSink.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG;IAC3B,YAAY,EAAE;QACb,OAAO,EAAE,eAAe,EAAE,CAAC;KAC3B,CAAC;IACF,WAAW,EAAE;QACZ,OAAO,EAAE,cAAc,EAAE,CAAC;KAC1B,CAAC;IACF,qBAAqB,EAAE;QACtB,OAAO,EAAE,uBAAuB,EAAE,CAAC;KACnC,CAAC;IACF,kBAAkB,EAAE;QACnB,OAAO,EAAE,qBAAqB,EAAE,CAAC;KACjC,CAAC;IACF,oBAAoB,EAAE;QACrB,OAAO,EAAE,sBAAsB,EAAE,CAAC;KAClC,CAAC;IACF,2BAA2B,EAAE;QAC5B,OAAO,EAAE,6BAA6B,EAAE,CAAC;KACzC,CAAC;IACF,qBAAqB,EAAE;QACtB,OAAO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MAAM,EAAE,uBAAuB;IAI1D,0BAA0B,CAAC,MAAM,EAAE,uBAAuB;IAI1D,iCAAiC,CAAC,MAAM,EAAE,6BAA6B;IAIvE,sBAAsB,CAAC,MAAM,EAAE,mBAAmB;IAIlD,2BAA2B,CAAC,MAAM,EAAE,wBAAwB;IAI5D,2BAA2B,CAAC,MAAM,EAAE,wBAAwB;IAI5D,iBAAiB,CAAC,MAAM,EAAE,cAAc;IAIxC,qBAAqB,CAAC,MAAM,EAAE,kBAAkB;IAIhD,yBAAyB,CAAC,MAAM,EAAE,sBAAsB;IAIxD,0BAA0B,CAAC,MAAM,EAAE,uBAAuB;IAI1D,sBAAsB,CAAC,MAAM,EAAE,mBAAmB;IAIlD,qBAAqB,CAAC,MAAM,EAAE,kBAAkB;IAIhD,gBAAgB,CAAC,MAAM,EAAE,aAAa;IAItC,mBAAmB,IAAI,eAAe,EAAE;IAIxC,yBAAyB,IAAI,qBAAqB,EAAE;IAIpD,kBAAkB,IAAI,cAAc,EAAE;IAItC,sBAAsB,IAAI,kBAAkB,EAAE;IAI9C,UAAU,CAAC,OAAO,EAAE,mBAAmB;IASvC,aAAa,CAAC,OAAO,EAAE,mBAAmB;YASnC,QAAQ;IA+Bf,IAAI,IAAI,MAAM;IAuErB,OAAO,CAAC,KAAK;IAIb,OAAO,CAAE,0BAA0B;CAyCnC"}
@@ -2,9 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SinkImpl = void 0;
4
4
  const events_1 = require("events");
5
+ const Processor_1 = require("../middlewares/Processor");
6
+ const VisitObservedCallsMiddleware_1 = require("../middlewares/VisitObservedCallsMiddleware");
5
7
  class SinkImpl {
6
8
  constructor(config) {
7
9
  this.config = config;
10
+ this._index = 0;
11
+ this._processes = new Map();
12
+ this._customProcesses = new Map();
8
13
  this._emitter = new events_1.EventEmitter();
9
14
  this._callEventReports = [];
10
15
  this._callMetaReports = [];
@@ -24,7 +29,7 @@ class SinkImpl {
24
29
  this._sfuSctpStreamReports = [];
25
30
  this._sfuTransportReports = [];
26
31
  this._sfuMetaReports = [];
27
- // empty block
32
+ this._processor = (0, Processor_1.createProcessor)();
28
33
  }
29
34
  on(event, listener) {
30
35
  this._emitter.addListener(event, listener);
@@ -92,6 +97,65 @@ class SinkImpl {
92
97
  addSfuMetaReport(report) {
93
98
  this._sfuMetaReports.push(report);
94
99
  }
100
+ getCallEventReports() {
101
+ return this._callEventReports;
102
+ }
103
+ getClientExtensionReports() {
104
+ return this._clientExtensionReports;
105
+ }
106
+ getSfuEventReports() {
107
+ return this._sfuEventReports;
108
+ }
109
+ getSfuExtensionReports() {
110
+ return this._sfuExtensionReports;
111
+ }
112
+ addProcess(process) {
113
+ const middleware = async (context, next) => {
114
+ await process(context);
115
+ if (next)
116
+ await next(context);
117
+ };
118
+ this._customProcesses.set(process, middleware);
119
+ this._processor.addMiddleware(middleware);
120
+ }
121
+ removeProcess(process) {
122
+ const middleware = this._customProcesses.get(process);
123
+ if (!middleware) {
124
+ return;
125
+ }
126
+ this._customProcesses.delete(process);
127
+ this._processor.removeMiddleware(middleware);
128
+ }
129
+ async _process(context) {
130
+ var _a;
131
+ if (this._processor.getSize() < 1) {
132
+ // no process to execute
133
+ return;
134
+ }
135
+ if (this._processes.has(this._index)) {
136
+ VisitObservedCallsMiddleware_1.logger.warn(`The sink process has been called while the previous process has not yet completed. This may indicate that the observer is attempting to process more reports than it can handle.`);
137
+ }
138
+ const actualBlockingPoint = (_a = this._processes.get(this._index)) !== null && _a !== void 0 ? _a : Promise.resolve();
139
+ const index = ++this._index;
140
+ const result = new Promise((resolve, reject) => {
141
+ actualBlockingPoint.then(() => {
142
+ this._processor.use(context)
143
+ .then(() => resolve())
144
+ .catch((err) => reject(err));
145
+ });
146
+ });
147
+ const nextBlockingPoint = new Promise((resolve) => {
148
+ result.then(() => {
149
+ this._processes.delete(index);
150
+ resolve();
151
+ }).catch(() => {
152
+ this._processes.delete(index);
153
+ resolve();
154
+ });
155
+ });
156
+ this._processes.set(index, nextBlockingPoint);
157
+ return result;
158
+ }
95
159
  emit() {
96
160
  let result = 0;
97
161
  const checkAndEmit = (eventName, reports) => {
@@ -100,6 +164,10 @@ class SinkImpl {
100
164
  result += reports.length;
101
165
  }
102
166
  };
167
+ const context = this._createObserverSinkContext();
168
+ this._process(context).catch(err => {
169
+ VisitObservedCallsMiddleware_1.logger.error(`Error occurred while processing reports`, err);
170
+ });
103
171
  checkAndEmit('call-event', this._callEventReports);
104
172
  this._callEventReports = [];
105
173
  checkAndEmit('call-meta', this._callMetaReports);
@@ -141,5 +209,45 @@ class SinkImpl {
141
209
  _emit(event, reports) {
142
210
  return this._emitter.emit(event, reports);
143
211
  }
212
+ _createObserverSinkContext() {
213
+ const callEventReports = [...this._callEventReports];
214
+ const callMetaReports = [...this._callMetaReports];
215
+ const clientDataChannelReports = [...this._clientDataChannelReports];
216
+ const clientExtensionReports = [...this._clientExtensionReports];
217
+ const iceCandidatePairReports = [...this._iceCandidatePairReports];
218
+ const inboundAudioTrackReports = [...this._inboundAudioTrackReports];
219
+ const inboundVideoTrackReports = [...this._inboundVideoTrackReports];
220
+ const peerConnectionTransportReports = [...this._peerConnectionTransportReports];
221
+ const observerEventReports = [...this._observerEventReports];
222
+ const outboundAudioTrackReports = [...this._outboundAudioTrackReports];
223
+ const outboundVideoTrackReports = [...this._outboundVideoTrackReports];
224
+ const sfuEventReports = [...this._sfuEventReports];
225
+ const sfuExtensionReports = [...this._sfuExtensionReports];
226
+ const sfuInboundRtpPadReports = [...this._sfuInboundRtpPadReports];
227
+ const sfuOutboundRtpPadReports = [...this._sfuOutboundRtpPadReports];
228
+ const sfuSctpStreamReports = [...this._sfuSctpStreamReports];
229
+ const sfuTransportReports = [...this._sfuTransportReports];
230
+ const sfuMetaReports = [...this._sfuMetaReports];
231
+ return {
232
+ callEventReports,
233
+ callMetaReports,
234
+ clientDataChannelReports,
235
+ clientExtensionReports,
236
+ iceCandidatePairReports,
237
+ inboundAudioTrackReports,
238
+ inboundVideoTrackReports,
239
+ peerConnectionTransportReports,
240
+ observerEventReports,
241
+ outboundAudioTrackReports,
242
+ outboundVideoTrackReports,
243
+ sfuEventReports,
244
+ sfuExtensionReports,
245
+ sfuInboundRtpPadReports,
246
+ sfuOutboundRtpPadReports,
247
+ sfuSctpStreamReports,
248
+ sfuTransportReports,
249
+ sfuMetaReports,
250
+ };
251
+ }
144
252
  }
145
253
  exports.SinkImpl = SinkImpl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@observertc/observer-js",
3
- "version": "0.9.6-beta",
3
+ "version": "0.9.8-beta",
4
4
  "description": "Server Side NodeJS Library for processing ObserveRTC Samples",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/Evaluator.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from './common/logger';
2
2
  import { Semaphore } from './common/Semaphore';
3
- import { EvaluatorContext } from './common/types';
3
+ import { EvaluatorContext, ObserverSinkContext } from './common/types';
4
4
  import { ReportsCollector } from './common/ReportsCollector';
5
5
  import { ObservedClientSourceConfig } from './sources/ObservedClientSource';
6
6
  import { SourcesEvents } from './sources/Sources';
@@ -27,6 +27,8 @@ export type EvaluatorProcess = (evaluatorContext: EvaluatorContext) => Promise<v
27
27
 
28
28
  export class Evaluator {
29
29
  private _index = 0;
30
+ private _evaluations = new Map<number, Promise<void>>();
31
+
30
32
  private _clientOperations = new Map<string, CallOperation>();
31
33
  private _emitter = new EventEmitter();
32
34
 
@@ -35,7 +37,7 @@ export class Evaluator {
35
37
  private _transactionProcessor: Processor<TransactionContext>;
36
38
  private _customProcessor: Processor<EvaluatorContext>;
37
39
 
38
- private _evaluations = new Map<number, Promise<void>>();
40
+
39
41
 
40
42
  public constructor(
41
43
  public readonly config: EvaluatorConfig,
@@ -134,6 +136,11 @@ export class Evaluator {
134
136
  removedSfuOutbounRtpPadIds: [],
135
137
  openedSfuSctpChannelIds: [],
136
138
  closedSfuSctpChannels: [],
139
+
140
+ clientExtensionStats: [],
141
+ callEvents: [],
142
+ sfuEvents: [],
143
+ sfuExtensionStats: [],
137
144
  };
138
145
 
139
146
  const callOperations = createCallOperationContext(this._clientOperations, evaluatorContext);
package/src/Observer.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ObserverSink, SinkConfig, SinkImpl } from './sinks/ObserverSink';
1
+ import { ObserverSinkEmitter, ObserverSinkProcess, SinkConfig, SinkImpl } from './sinks/ObserverSink';
2
2
  import { Sources, SourcesConfig } from './sources/Sources';
3
3
  import { createSimpleStorageProvider, StorageProvider } from './storages/StorageProvider';
4
4
  import * as Models from './models/Models';
@@ -172,7 +172,7 @@ export class Observer {
172
172
  });
173
173
  }
174
174
 
175
- public get sink(): ObserverSink {
175
+ public get sink(): ObserverSinkEmitter {
176
176
  return this._sink;
177
177
  }
178
178
 
@@ -194,6 +194,24 @@ export class Observer {
194
194
  }
195
195
  }
196
196
 
197
+ public addSinks(...processes: ObserverSinkProcess[]) {
198
+ if (this._closed) {
199
+ throw new Error(`Attempted to add an evaluator to a closed observer`);
200
+ }
201
+ for (const process of processes) {
202
+ this._sink.addProcess(process);
203
+ }
204
+ }
205
+
206
+ public removeSinks(...processes: ObserverSinkProcess[]) {
207
+ if (this._closed) {
208
+ throw new Error(`Attempted to remove an evaluator from a closed observer`);
209
+ }
210
+ for (const process of processes) {
211
+ this._sink.removeProcess(process);
212
+ }
213
+ }
214
+
197
215
  public calls(): AsyncIterableIterator<[string, Models.Call]> {
198
216
  const { callStorage } = this._storages;
199
217
  return callStorage[Symbol.asyncIterator]();
@@ -38,4 +38,9 @@ export interface ReportsCollector {
38
38
  addSfuSctpStreamReport(report: SfuSctpStreamReport): void;
39
39
  addSfuTransportReport(report: SFUTransportReport): void;
40
40
  addSfuMetaReport(report: SfuMetaReport): void;
41
+
42
+ getCallEventReports(): CallEventReport[];
43
+ getClientExtensionReports(): ClientExtensionReport[];
44
+ getSfuEventReports(): SfuEventReport[];
45
+ getSfuExtensionReports(): SfuExtensionReport[];
41
46
  }
@@ -1,12 +1,22 @@
1
1
  import {
2
2
  CallEventReport,
3
3
  CallMetaReport,
4
+ ClientDataChannelReport,
4
5
  ClientExtensionReport,
6
+ IceCandidatePairReport,
5
7
  InboundAudioTrackReport,
6
8
  InboundVideoTrackReport,
9
+ ObserverEventReport,
7
10
  OutboundAudioTrackReport,
8
11
  OutboundVideoTrackReport,
9
12
  PeerConnectionTransportReport,
13
+ SfuEventReport,
14
+ SfuExtensionReport,
15
+ SfuInboundRtpPadReport,
16
+ SfuMetaReport,
17
+ SfuOutboundRtpPadReport,
18
+ SfuSctpStreamReport,
19
+ SFUTransportReport,
10
20
  } from '@observertc/report-schemas-js';
11
21
  import { ObservedCalls } from '../samples/ObservedCalls';
12
22
  import { ReportsCollector } from './ReportsCollector';
@@ -91,10 +101,34 @@ export interface EvaluatorContext {
91
101
  readonly observedSfus: ObservedSfus;
92
102
  readonly storages: StorageProvider;
93
103
  readonly reports: ReportsCollector;
104
+
105
+ readonly clientExtensionStats: ClientExtensionReport[],
106
+ readonly callEvents: CallEventReport[],
107
+ readonly sfuEvents: SfuEventReport[],
108
+ readonly sfuExtensionStats: SfuExtensionReport[],
94
109
  }
95
110
 
96
111
  export type EvaluatorMiddleware = Middleware<EvaluatorContext>;
97
112
 
98
- // const c: EvaluatorContext;
113
+ export interface ObserverSinkContext {
114
+ readonly callEventReports: CallEventReport[];
115
+ readonly callMetaReports: CallMetaReport[];
116
+ readonly clientDataChannelReports: ClientDataChannelReport[];
117
+ readonly clientExtensionReports: ClientExtensionReport[];
118
+ readonly iceCandidatePairReports: IceCandidatePairReport[];
119
+ readonly inboundAudioTrackReports: InboundAudioTrackReport[];
120
+ readonly inboundVideoTrackReports: InboundVideoTrackReport[];
121
+ readonly peerConnectionTransportReports: PeerConnectionTransportReport[];
122
+ readonly observerEventReports: ObserverEventReport[];
123
+ readonly outboundAudioTrackReports: OutboundAudioTrackReport[];
124
+ readonly outboundVideoTrackReports: OutboundVideoTrackReport[];
125
+ readonly sfuEventReports: SfuEventReport[];
126
+ readonly sfuExtensionReports: SfuExtensionReport[];
127
+ readonly sfuInboundRtpPadReports: SfuInboundRtpPadReport[];
128
+ readonly sfuOutboundRtpPadReports: SfuOutboundRtpPadReport[];
129
+ readonly sfuSctpStreamReports: SfuSctpStreamReport[];
130
+ readonly sfuTransportReports: SFUTransportReport[];
131
+ readonly sfuMetaReports: SfuMetaReport[];
132
+ }
99
133
 
100
- // c.endedCalls[0].
134
+ export type ObserverSinkMiddleware = Middleware<ObserverSinkContext>;
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ export type { EvaluatorConfig, EvaluatorProcess } from './Evaluator';
5
5
  export type { SourcesConfig } from './sources/Sources';
6
6
 
7
7
  export { Observer } from './Observer';
8
- export type { ObserverSink } from './sinks/ObserverSink';
8
+ export type { ObserverSinkEmitter as ObserverSink } from './sinks/ObserverSink';
9
9
  export type { ObserverStorage } from './storages/ObserverStorage';
10
10
  export type { StorageProvider } from './storages/StorageProvider';
11
11
  export * as Models from './models/Models';
@@ -64,7 +64,7 @@ export type { ObservedSfuSource, ObservedSfuSourceConfig } from './sources/Obser
64
64
 
65
65
  export type { ObservedCallSource, ObservedCallSourceConfig as ObservedCallConfig } from './sources/ObservedCallSource';
66
66
 
67
- export type { EvaluatorContext, EvaluatorMiddleware } from './common/types';
67
+ export type { EvaluatorContext, EvaluatorMiddleware, ObserverSinkContext, ObserverSinkMiddleware } from './common/types';
68
68
 
69
69
  import { Observer, ObserverConfig } from './Observer';
70
70
  export function createObserver(config?: Partial<ObserverConfig>) {
@@ -1,4 +1,5 @@
1
1
  import { createLogger } from '../common/logger';
2
+ import { ReportsCollector } from '../common/ReportsCollector';
2
3
  import { ObserverStorage } from '../storages/ObserverStorage';
3
4
  import { StorageProvider } from '../storages/StorageProvider';
4
5
  import { Middleware } from './Middleware';
@@ -6,7 +7,10 @@ import { TransactionContext } from './TransactionContext';
6
7
 
7
8
  const logger = createLogger('CallUpdateMiddleware');
8
9
 
9
- export function createCommitTransactionMiddleware(storageProvider: StorageProvider): Middleware<TransactionContext> {
10
+ export function createCommitTransactionMiddleware(
11
+ storageProvider: StorageProvider,
12
+ reports: ReportsCollector,
13
+ ): Middleware<TransactionContext> {
10
14
  const process = async (transaction: TransactionContext) => {
11
15
  const {
12
16
  clientStorage,
@@ -307,6 +311,11 @@ export function createCommitTransactionMiddleware(storageProvider: StorageProvid
307
311
  };
308
312
  })
309
313
  );
314
+
315
+ evaluatorContext.callEvents = [...reports.getCallEventReports()];
316
+ evaluatorContext.clientExtensionStats = [...reports.getClientExtensionReports()];
317
+ evaluatorContext.sfuEvents = [...reports.getSfuEventReports()];
318
+ evaluatorContext.sfuExtensionStats = [...reports.getSfuExtensionReports()];
310
319
  };
311
320
 
312
321
  const result = async (context: TransactionContext, next?: Middleware<TransactionContext>) => {
@@ -7,6 +7,7 @@ export interface Processor<T> {
7
7
  use(value: T): Promise<void | T>;
8
8
  addMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
9
9
  removeMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
10
+ getSize(): number;
10
11
  }
11
12
 
12
13
  export function createProcessor<T>(...processes: Middleware<T>[]): Processor<T> {
@@ -44,6 +45,9 @@ export function createProcessor<T>(...processes: Middleware<T>[]): Processor<T>
44
45
 
45
46
  return executeMiddleware(value, 0);
46
47
  },
48
+ getSize: (): number => {
49
+ return stack.length;
50
+ }
47
51
  };
48
52
 
49
53
  return result;
@@ -17,6 +17,6 @@ export function createTransactionProcessor(
17
17
  createVisitObservedSfusMiddleware(reportsCollector, fetchSamples),
18
18
 
19
19
  // must be the last one!
20
- createCommitTransactionMiddleware(storageProvider)
20
+ createCommitTransactionMiddleware(storageProvider, reportsCollector)
21
21
  );
22
22
  }
@@ -7,6 +7,7 @@ import { createLogger } from '../common/logger';
7
7
  import { visitInboundAudioTrack } from './visitors/visitInboundAudioTrack';
8
8
  import { visitOutboundAudioTrack } from './visitors/visitOutboundAudioTrack';
9
9
  import { visitOutboundVideoTrack } from './visitors/visitOutboundVideoTarck';
10
+ import { CallEventReport, ClientExtensionReport } from '@observertc/report-schemas-js';
10
11
 
11
12
  export const logger = createLogger('VisitObservedCallsMiddleware');
12
13
 
@@ -39,7 +40,7 @@ export function createVisitObservedCallsMiddleware(
39
40
  const visitedInboundVideoTrackIds = new Set<string>();
40
41
  const visitedOutboundAudioTrackIds = new Set<string>();
41
42
  const visitedOutboundVideoTrackIds = new Set<string>();
42
-
43
+
43
44
  for (const observedCall of observedCalls.observedCalls()) {
44
45
  const { callId, serviceId, roomId } = observedCall;
45
46
 
@@ -53,8 +54,13 @@ export function createVisitObservedCallsMiddleware(
53
54
  logger.warn('Client has not been registered');
54
55
  continue;
55
56
  }
56
-
57
- visitClient(observedClient, storedClient, reports, fetchSamples);
57
+
58
+ visitClient(
59
+ observedClient,
60
+ storedClient,
61
+ reports,
62
+ fetchSamples
63
+ );
58
64
 
59
65
  for (const observedPeerConnection of observedClient.observedPeerConnections()) {
60
66
  const { peerConnectionId } = observedPeerConnection;
@@ -20,6 +20,10 @@ import {
20
20
  } from '@observertc/report-schemas-js';
21
21
  import { EventEmitter } from 'events';
22
22
  import { ReportsCollector } from '../common/ReportsCollector';
23
+ import { ObserverSinkContext } from '../common/types';
24
+ import { Middleware } from '../middlewares/Middleware';
25
+ import { createProcessor, Processor } from '../middlewares/Processor';
26
+ import { logger } from '../middlewares/VisitObservedCallsMiddleware';
23
27
 
24
28
  export type SinkEventsMap = {
25
29
  'call-event': {
@@ -79,14 +83,20 @@ export type SinkEventsMap = {
79
83
  };
80
84
 
81
85
  export type SinkConfig = Record<string, unknown>;
86
+ export type ObserverSinkProcess = (observerSinkContext: ObserverSinkContext) => Promise<void>;
82
87
 
83
- export interface ObserverSink {
88
+ export interface ObserverSinkEmitter {
84
89
  on<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
85
90
  off<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
86
91
  once<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
87
92
  }
88
93
 
89
- export class SinkImpl implements ReportsCollector, ObserverSink {
94
+ export class SinkImpl implements ReportsCollector, ObserverSinkEmitter {
95
+ private _index = 0;
96
+ private _processes = new Map<number, Promise<void>>();
97
+ private _customProcesses = new Map<ObserverSinkProcess, Middleware<ObserverSinkContext>>();
98
+ private readonly _processor: Processor<ObserverSinkContext>;
99
+
90
100
  private _emitter = new EventEmitter();
91
101
  private _callEventReports: CallEventReport[] = [];
92
102
  private _callMetaReports: CallMetaReport[] = [];
@@ -108,9 +118,10 @@ export class SinkImpl implements ReportsCollector, ObserverSink {
108
118
  private _sfuMetaReports: SfuMetaReport[] = [];
109
119
 
110
120
  public constructor(public readonly config: SinkConfig) {
111
- // empty block
121
+ this._processor = createProcessor();
112
122
  }
113
123
 
124
+
114
125
  public on<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this {
115
126
  this._emitter.addListener(event, listener);
116
127
  return this;
@@ -198,6 +209,71 @@ export class SinkImpl implements ReportsCollector, ObserverSink {
198
209
  this._sfuMetaReports.push(report);
199
210
  }
200
211
 
212
+ public getCallEventReports(): CallEventReport[] {
213
+ return this._callEventReports;
214
+ }
215
+
216
+ public getClientExtensionReports(): ClientExtensionReport[] {
217
+ return this._clientExtensionReports;
218
+ }
219
+
220
+ public getSfuEventReports(): SfuEventReport[] {
221
+ return this._sfuEventReports;
222
+ }
223
+
224
+ public getSfuExtensionReports(): SfuExtensionReport[] {
225
+ return this._sfuExtensionReports;
226
+ }
227
+
228
+ public addProcess(process: ObserverSinkProcess) {
229
+ const middleware: Middleware<ObserverSinkContext> = async (context, next) => {
230
+ await process(context);
231
+ if (next) await next(context);
232
+ };
233
+ this._customProcesses.set(process, middleware);
234
+ this._processor.addMiddleware(middleware);
235
+ }
236
+
237
+ public removeProcess(process: ObserverSinkProcess) {
238
+ const middleware = this._customProcesses.get(process);
239
+ if (!middleware) {
240
+ return;
241
+ }
242
+ this._customProcesses.delete(process);
243
+ this._processor.removeMiddleware(middleware);
244
+ }
245
+
246
+ private async _process(context: ObserverSinkContext): Promise<void> {
247
+ if (this._processor.getSize() < 1) {
248
+ // no process to execute
249
+ return;
250
+ }
251
+ if (this._processes.has(this._index)) {
252
+ logger.warn(`The sink process has been called while the previous process has not yet completed. This may indicate that the observer is attempting to process more reports than it can handle.`);
253
+ }
254
+
255
+ const actualBlockingPoint = this._processes.get(this._index) ?? Promise.resolve();
256
+ const index = ++this._index;
257
+ const result = new Promise<void>((resolve, reject) => {
258
+ actualBlockingPoint.then(() => {
259
+ this._processor.use(context)
260
+ .then(() => resolve())
261
+ .catch((err) => reject(err));
262
+ });
263
+ });
264
+ const nextBlockingPoint = new Promise<void>((resolve) => {
265
+ result.then(() => {
266
+ this._processes.delete(index);
267
+ resolve();
268
+ }).catch(() => {
269
+ this._processes.delete(index);
270
+ resolve();
271
+ });
272
+ });
273
+ this._processes.set(index, nextBlockingPoint);
274
+ return result;
275
+ }
276
+
201
277
  public emit(): number {
202
278
  let result = 0;
203
279
  const checkAndEmit = (eventName: keyof SinkEventsMap, reports: any[]) => {
@@ -206,6 +282,11 @@ export class SinkImpl implements ReportsCollector, ObserverSink {
206
282
  result += reports.length;
207
283
  }
208
284
  };
285
+
286
+ const context = this._createObserverSinkContext();
287
+ this._process(context).catch(err => {
288
+ logger.error(`Error occurred while processing reports`, err);
289
+ })
209
290
 
210
291
  checkAndEmit('call-event', this._callEventReports);
211
292
  this._callEventReports = [];
@@ -267,4 +348,46 @@ export class SinkImpl implements ReportsCollector, ObserverSink {
267
348
  private _emit<K extends keyof SinkEventsMap>(event: K, reports: SinkEventsMap[K]): boolean {
268
349
  return this._emitter.emit(event, reports);
269
350
  }
351
+
352
+ private _createObserverSinkContext(): ObserverSinkContext {
353
+ const callEventReports = [...this._callEventReports];
354
+ const callMetaReports = [...this._callMetaReports];
355
+ const clientDataChannelReports = [...this._clientDataChannelReports];
356
+ const clientExtensionReports = [...this._clientExtensionReports];
357
+ const iceCandidatePairReports = [...this._iceCandidatePairReports];
358
+ const inboundAudioTrackReports = [...this._inboundAudioTrackReports];
359
+ const inboundVideoTrackReports = [...this._inboundVideoTrackReports];
360
+ const peerConnectionTransportReports = [...this._peerConnectionTransportReports];
361
+ const observerEventReports = [...this._observerEventReports];
362
+ const outboundAudioTrackReports = [...this._outboundAudioTrackReports];
363
+ const outboundVideoTrackReports = [...this._outboundVideoTrackReports];
364
+ const sfuEventReports = [...this._sfuEventReports];
365
+ const sfuExtensionReports = [...this._sfuExtensionReports];
366
+ const sfuInboundRtpPadReports = [...this._sfuInboundRtpPadReports];
367
+ const sfuOutboundRtpPadReports = [...this._sfuOutboundRtpPadReports];
368
+ const sfuSctpStreamReports = [...this._sfuSctpStreamReports];
369
+ const sfuTransportReports = [...this._sfuTransportReports];
370
+ const sfuMetaReports = [...this._sfuMetaReports];
371
+
372
+ return {
373
+ callEventReports,
374
+ callMetaReports,
375
+ clientDataChannelReports,
376
+ clientExtensionReports,
377
+ iceCandidatePairReports,
378
+ inboundAudioTrackReports,
379
+ inboundVideoTrackReports,
380
+ peerConnectionTransportReports,
381
+ observerEventReports,
382
+ outboundAudioTrackReports,
383
+ outboundVideoTrackReports,
384
+ sfuEventReports,
385
+ sfuExtensionReports,
386
+ sfuInboundRtpPadReports,
387
+ sfuOutboundRtpPadReports,
388
+ sfuSctpStreamReports,
389
+ sfuTransportReports,
390
+ sfuMetaReports,
391
+ };
392
+ }
270
393
  }