@observertc/observer-js 0.9.20-beta → 0.9.22-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 (212) hide show
  1. package/.eslintrc.json +143 -0
  2. package/lib/Evaluator.d.ts.map +1 -1
  3. package/lib/Evaluator.js +54 -47
  4. package/lib/Observer.d.ts +1408 -38
  5. package/lib/Observer.d.ts.map +1 -1
  6. package/lib/Observer.js +484 -180
  7. package/lib/common/Semaphore.d.ts.map +1 -1
  8. package/lib/common/callMetaReports.d.ts.map +1 -1
  9. package/lib/common/callMetaReports.js +1 -0
  10. package/lib/common/logger.d.ts.map +1 -1
  11. package/lib/common/logger.js +15 -15
  12. package/lib/common/utils.d.ts +1 -0
  13. package/lib/common/utils.d.ts.map +1 -1
  14. package/lib/common/utils.js +12 -1
  15. package/lib/entries/CallEntry.d.ts +611 -0
  16. package/lib/entries/CallEntry.d.ts.map +1 -0
  17. package/lib/entries/CallEntry.js +75 -0
  18. package/lib/entries/ClientEntry.d.ts +474 -0
  19. package/lib/entries/ClientEntry.d.ts.map +1 -0
  20. package/lib/entries/ClientEntry.js +101 -0
  21. package/lib/entries/InboundTrackEntry.d.ts +670 -0
  22. package/lib/entries/InboundTrackEntry.d.ts.map +1 -0
  23. package/lib/entries/InboundTrackEntry.js +76 -0
  24. package/lib/entries/OutboundTrackEntry.d.ts +670 -0
  25. package/lib/entries/OutboundTrackEntry.d.ts.map +1 -0
  26. package/lib/entries/OutboundTrackEntry.js +73 -0
  27. package/lib/entries/PeerConnectionEntry.d.ts +469 -0
  28. package/lib/entries/PeerConnectionEntry.d.ts.map +1 -0
  29. package/lib/entries/PeerConnectionEntry.js +144 -0
  30. package/lib/entries/SfuEntry.d.ts +150 -0
  31. package/lib/entries/SfuEntry.d.ts.map +1 -0
  32. package/lib/entries/SfuEntry.js +77 -0
  33. package/lib/entries/SfuInboundRtpPadEntry.d.ts +14 -0
  34. package/lib/entries/SfuInboundRtpPadEntry.d.ts.map +1 -0
  35. package/lib/entries/SfuInboundRtpPadEntry.js +49 -0
  36. package/lib/entries/SfuOutboundRtpPadEntry.d.ts +14 -0
  37. package/lib/entries/SfuOutboundRtpPadEntry.d.ts.map +1 -0
  38. package/lib/entries/SfuOutboundRtpPadEntry.js +47 -0
  39. package/lib/entries/SfuSctpChannelEntry.d.ts +12 -0
  40. package/lib/entries/SfuSctpChannelEntry.d.ts.map +1 -0
  41. package/lib/entries/SfuSctpChannelEntry.js +43 -0
  42. package/lib/entries/SfuTransportEntry.d.ts +82 -0
  43. package/lib/entries/SfuTransportEntry.d.ts.map +1 -0
  44. package/lib/entries/SfuTransportEntry.js +122 -0
  45. package/lib/index.d.ts +10 -0
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/middlewares/CallOperationsContext.d.ts.map +1 -1
  48. package/lib/middlewares/CallOperationsContext.js +2 -6
  49. package/lib/middlewares/CallProcessor.d.ts.map +1 -1
  50. package/lib/middlewares/CallProcessor.js +15 -6
  51. package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +1 -1
  52. package/lib/middlewares/CommitTransactionMiddleware.js +22 -26
  53. package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +1 -1
  54. package/lib/middlewares/DeleteOutdatedCallEntries.js +29 -20
  55. package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +1 -1
  56. package/lib/middlewares/DeleteOutdatedSfuEntries.js +27 -18
  57. package/lib/middlewares/Middleware.d.ts.map +1 -1
  58. package/lib/middlewares/Middleware.js +13 -4
  59. package/lib/middlewares/Processor.d.ts.map +1 -1
  60. package/lib/middlewares/Processor.js +18 -9
  61. package/lib/middlewares/TransactionContext.d.ts.map +1 -1
  62. package/lib/middlewares/TransactionContext.js +84 -73
  63. package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
  64. package/lib/middlewares/VisitObservedCallsMiddleware.js +16 -7
  65. package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +1 -1
  66. package/lib/middlewares/VisitObservedSfusMiddleware.js +15 -6
  67. package/lib/middlewares/visitors/visitClient.d.ts.map +1 -1
  68. package/lib/middlewares/visitors/visitClient.js +6 -18
  69. package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +1 -1
  70. package/lib/middlewares/visitors/visitInboundAudioTrack.js +17 -20
  71. package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +1 -1
  72. package/lib/middlewares/visitors/visitInboundVideoTrack.js +16 -21
  73. package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +1 -1
  74. package/lib/middlewares/visitors/visitOutboundAudioTrack.js +16 -16
  75. package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +1 -1
  76. package/lib/middlewares/visitors/visitOutboundVideoTarck.js +16 -17
  77. package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +1 -1
  78. package/lib/middlewares/visitors/visitPeerConnection.js +24 -40
  79. package/lib/middlewares/visitors/visitSfu.d.ts.map +1 -1
  80. package/lib/middlewares/visitors/visitSfu.js +6 -7
  81. package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +1 -1
  82. package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +3 -7
  83. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +1 -1
  84. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +3 -8
  85. package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +1 -1
  86. package/lib/middlewares/visitors/visitSfuSctpChannel.js +3 -6
  87. package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +1 -1
  88. package/lib/middlewares/visitors/visitSfuTransport.js +3 -6
  89. package/lib/processes/closePeerConnectionProcess.d.ts.map +1 -1
  90. package/lib/processes/closePeerConnectionProcess.js +14 -5
  91. package/lib/processes/detachClientProcess.d.ts.map +1 -1
  92. package/lib/processes/detachClientProcess.js +20 -17
  93. package/lib/processes/findRemoteMatches.d.ts +2 -2
  94. package/lib/processes/findRemoteMatches.d.ts.map +1 -1
  95. package/lib/processes/findRemoteMatches.js +70 -56
  96. package/lib/processes/inboundTrackRemoved.d.ts.map +1 -1
  97. package/lib/processes/inboundTrackRemoved.js +12 -3
  98. package/lib/processes/joinClientProcess.d.ts.map +1 -1
  99. package/lib/processes/joinClientProcess.js +15 -6
  100. package/lib/processes/outboundTrackRemoved.d.ts.map +1 -1
  101. package/lib/processes/outboundTrackRemoved.js +12 -3
  102. package/lib/samples/ObservedCall.d.ts.map +1 -1
  103. package/lib/samples/ObservedCall.js +1 -5
  104. package/lib/samples/ObservedCalls.d.ts.map +1 -1
  105. package/lib/samples/ObservedClient.d.ts.map +1 -1
  106. package/lib/samples/ObservedClient.js +1 -9
  107. package/lib/samples/ObservedInboundAudioTrack.d.ts.map +1 -1
  108. package/lib/samples/ObservedInboundAudioTrack.js +1 -5
  109. package/lib/samples/ObservedInboundVideoTrack.d.ts.map +1 -1
  110. package/lib/samples/ObservedInboundVideoTrack.js +1 -5
  111. package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +1 -1
  112. package/lib/samples/ObservedOutboundAudioTrack.js +1 -5
  113. package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +1 -1
  114. package/lib/samples/ObservedOutboundVideoTrack.js +1 -5
  115. package/lib/samples/ObservedPeerConnection.d.ts.map +1 -1
  116. package/lib/samples/ObservedPeerConnection.js +1 -12
  117. package/lib/samples/ObservedSfu.d.ts.map +1 -1
  118. package/lib/samples/ObservedSfu.js +1 -8
  119. package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +1 -1
  120. package/lib/samples/ObservedSfuInboundRtpPad.js +1 -5
  121. package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +1 -1
  122. package/lib/samples/ObservedSfuOutboundRtpPad.js +1 -5
  123. package/lib/samples/ObservedSfuSctpChannel.d.ts.map +1 -1
  124. package/lib/samples/ObservedSfuSctpChannel.js +1 -5
  125. package/lib/samples/ObservedSfuTransport.d.ts.map +1 -1
  126. package/lib/samples/ObservedSfuTransport.js +1 -8
  127. package/lib/samples/ObservedSfus.d.ts.map +1 -1
  128. package/lib/sinks/ObserverSink.d.ts.map +1 -1
  129. package/lib/sinks/ObserverSink.js +42 -31
  130. package/lib/sinks/callEventReports.js +1 -0
  131. package/lib/sources/ObservedCallSource.d.ts +5 -3
  132. package/lib/sources/ObservedCallSource.d.ts.map +1 -1
  133. package/lib/sources/ObservedClientSource.d.ts +3 -2
  134. package/lib/sources/ObservedClientSource.d.ts.map +1 -1
  135. package/lib/sources/ObservedSfuSource.d.ts +3 -2
  136. package/lib/sources/ObservedSfuSource.d.ts.map +1 -1
  137. package/lib/sources/Sources.d.ts +8 -4
  138. package/lib/sources/Sources.d.ts.map +1 -1
  139. package/lib/sources/Sources.js +71 -46
  140. package/lib/storages/ObserverStorage.d.ts.map +1 -1
  141. package/lib/storages/SimpleStorage.d.ts.map +1 -1
  142. package/lib/storages/SimpleStorage.js +40 -23
  143. package/package.json +2 -1
  144. package/src/Evaluator.ts +17 -9
  145. package/src/Observer.ts +239 -171
  146. package/src/common/Semaphore.ts +2 -0
  147. package/src/common/callMetaReports.ts +30 -28
  148. package/src/common/logger.ts +140 -132
  149. package/src/common/types.ts +1 -1
  150. package/src/common/utils.ts +12 -1
  151. package/src/entries/CallEntry.ts +62 -0
  152. package/src/entries/ClientEntry.ts +90 -0
  153. package/src/entries/InboundTrackEntry.ts +74 -0
  154. package/src/entries/OutboundTrackEntry.ts +72 -0
  155. package/src/entries/PeerConnectionEntry.ts +133 -0
  156. package/src/entries/SfuEntry.ts +62 -0
  157. package/src/entries/SfuInboundRtpPadEntry.ts +46 -0
  158. package/src/entries/SfuOutboundRtpPadEntry.ts +44 -0
  159. package/src/entries/SfuSctpChannelEntry.ts +39 -0
  160. package/src/entries/SfuTransportEntry.ts +109 -0
  161. package/src/index.ts +11 -0
  162. package/src/middlewares/CallOperationsContext.ts +9 -5
  163. package/src/middlewares/CallProcessor.ts +4 -2
  164. package/src/middlewares/CommitTransactionMiddleware.ts +8 -5
  165. package/src/middlewares/DeleteOutdatedCallEntries.ts +24 -16
  166. package/src/middlewares/DeleteOutdatedSfuEntries.ts +24 -15
  167. package/src/middlewares/Middleware.ts +1 -0
  168. package/src/middlewares/Processor.ts +10 -5
  169. package/src/middlewares/TransactionContext.ts +1 -2
  170. package/src/middlewares/VisitObservedCallsMiddleware.ts +5 -2
  171. package/src/middlewares/VisitObservedSfusMiddleware.ts +8 -7
  172. package/src/middlewares/visitors/visitClient.ts +15 -1
  173. package/src/middlewares/visitors/visitInboundAudioTrack.ts +4 -1
  174. package/src/middlewares/visitors/visitInboundVideoTrack.ts +5 -1
  175. package/src/middlewares/visitors/visitOutboundAudioTrack.ts +5 -1
  176. package/src/middlewares/visitors/visitOutboundVideoTarck.ts +5 -1
  177. package/src/middlewares/visitors/visitPeerConnection.ts +15 -2
  178. package/src/middlewares/visitors/visitSfu.ts +7 -1
  179. package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +4 -2
  180. package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +3 -1
  181. package/src/middlewares/visitors/visitSfuSctpChannel.ts +23 -21
  182. package/src/middlewares/visitors/visitSfuTransport.ts +3 -1
  183. package/src/processes/closePeerConnectionProcess.ts +3 -0
  184. package/src/processes/detachClientProcess.ts +13 -4
  185. package/src/processes/findRemoteMatches.ts +32 -21
  186. package/src/processes/inboundTrackRemoved.ts +2 -0
  187. package/src/processes/joinClientProcess.ts +8 -2
  188. package/src/processes/outboundTrackRemoved.ts +2 -0
  189. package/src/samples/ObservedCall.ts +6 -0
  190. package/src/samples/ObservedCalls.ts +13 -7
  191. package/src/samples/ObservedClient.ts +24 -8
  192. package/src/samples/ObservedInboundAudioTrack.ts +3 -2
  193. package/src/samples/ObservedInboundVideoTrack.ts +3 -2
  194. package/src/samples/ObservedOutboundAudioTrack.ts +3 -2
  195. package/src/samples/ObservedOutboundVideoTrack.ts +3 -2
  196. package/src/samples/ObservedPeerConnection.ts +27 -11
  197. package/src/samples/ObservedSfu.ts +17 -10
  198. package/src/samples/ObservedSfuInboundRtpPad.ts +5 -4
  199. package/src/samples/ObservedSfuOutboundRtpPad.ts +5 -4
  200. package/src/samples/ObservedSfuSctpChannel.ts +13 -13
  201. package/src/samples/ObservedSfuTransport.ts +19 -7
  202. package/src/samples/ObservedSfus.ts +10 -5
  203. package/src/sinks/ObserverSink.ts +51 -44
  204. package/src/sinks/callEventReports.ts +1 -1
  205. package/src/sources/ObservedCallSource.ts +6 -5
  206. package/src/sources/ObservedClientSource.ts +3 -2
  207. package/src/sources/ObservedSfuSource.ts +4 -8
  208. package/src/sources/Sources.ts +96 -22
  209. package/src/storages/ObserverStorage.ts +1 -0
  210. package/src/storages/SimpleStorage.ts +44 -21
  211. package/tsconfig.json +7 -5
  212. package/.eslintrc.js +0 -27
package/lib/Observer.js CHANGED
@@ -1,6 +1,42 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
23
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
24
+ var m = o[Symbol.asyncIterator], i;
25
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
26
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
27
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
28
+ };
29
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
30
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
31
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
32
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
33
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
34
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
35
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
36
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
37
+ function fulfill(value) { resume("next", value); }
38
+ function reject(value) { resume("throw", value); }
39
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
4
40
  };
5
41
  Object.defineProperty(exports, "__esModule", { value: true });
6
42
  exports.Observer = void 0;
@@ -9,8 +45,19 @@ const Sources_1 = require("./sources/Sources");
9
45
  const StorageProvider_1 = require("./storages/StorageProvider");
10
46
  const Evaluator_1 = require("./Evaluator");
11
47
  const Semaphore_1 = require("./common/Semaphore");
48
+ const utils_1 = require("./common/utils");
12
49
  const logger_1 = require("./common/logger");
13
- const events_1 = __importDefault(require("events"));
50
+ const events_1 = require("events");
51
+ const CallEntry_1 = require("./entries/CallEntry");
52
+ const ClientEntry_1 = require("./entries/ClientEntry");
53
+ const PeerConnectionEntry_1 = require("./entries/PeerConnectionEntry");
54
+ const InboundTrackEntry_1 = require("./entries/InboundTrackEntry");
55
+ const OutboundTrackEntry_1 = require("./entries/OutboundTrackEntry");
56
+ const SfuEntry_1 = require("./entries/SfuEntry");
57
+ const SfuTransportEntry_1 = require("./entries/SfuTransportEntry");
58
+ const SfuInboundRtpPadEntry_1 = require("./entries/SfuInboundRtpPadEntry");
59
+ const SfuOutboundRtpPadEntry_1 = require("./entries/SfuOutboundRtpPadEntry");
60
+ const SfuSctpChannelEntry_1 = require("./entries/SfuSctpChannelEntry");
14
61
  const logger = (0, logger_1.createLogger)('Observer');
15
62
  class Observer {
16
63
  static create(providedConfig) {
@@ -37,24 +84,31 @@ class Observer {
37
84
  this.config = config;
38
85
  this._storages = _storages;
39
86
  this._semaphores = _semaphores;
40
- this._emitter = new events_1.default();
87
+ this._emitter = new events_1.EventEmitter();
41
88
  this._closed = false;
42
89
  this._sources = new Sources_1.Sources(config.sources);
43
90
  this._sink = new ObserverSink_1.SinkImpl(config.sink);
44
91
  this._evaluator = new Evaluator_1.Evaluator(this.config.evaluator, this._semaphores.callSemaphore, this._storages, this._sink);
45
92
  this._sources.on('observed-samples', (event) => {
93
+ this._emitter.emit('processing-started');
46
94
  this._evaluator.addObservedSamples(event);
47
95
  });
48
96
  this._sources.on('added-client-source', (event) => {
49
97
  this._evaluator.addCreatedClientSource(event);
98
+ this._emitter.emit('client-added', event.clientId);
50
99
  });
51
100
  this._sources.on('removed-client-source', (event) => {
52
101
  this._evaluator.addClosedClientSource(event);
102
+ this._emitter.emit('client-added', event.clientId);
53
103
  });
54
104
  this._evaluator.on('ready', () => {
55
105
  this._sink.emit();
106
+ this._emitter.emit('processing-ended');
56
107
  });
57
- logger.debug(`Observer is created with config`, this.config);
108
+ logger.debug('Observer is created with config', this.config);
109
+ }
110
+ get sources() {
111
+ return this._sources;
58
112
  }
59
113
  on(event, listener) {
60
114
  this._emitter.on(event, listener);
@@ -69,86 +123,35 @@ class Observer {
69
123
  return this;
70
124
  }
71
125
  createCallSource(config) {
72
- var _a, _b;
73
126
  if (this._closed) {
74
- throw new Error(`Attempted to create a call source on a closed observer`);
127
+ throw new Error('Attempted to create a call source on a closed observer');
75
128
  }
76
- let closed = false;
77
- const serviceId = (_a = config.serviceId) !== null && _a !== void 0 ? _a : this.config.defaultServiceId;
78
- const mediaUnitId = (_b = config.mediaUnitId) !== null && _b !== void 0 ? _b : this.config.defaultMediaUnitId;
79
- const clientSources = new Map();
80
- const callSource = {
81
- ...config,
82
- serviceId,
129
+ const { serviceId = this.config.defaultServiceId, mediaUnitId = this.config.defaultMediaUnitId, appData = {} } = config, callConfig = __rest(config, ["serviceId", "mediaUnitId", "appData"]);
130
+ return this._sources.createCallSource(Object.assign(Object.assign({}, callConfig), { appData,
83
131
  mediaUnitId,
84
- createClientSource: (context) => {
85
- const clientSource = this._sources.createClientSource({
86
- ...config,
87
- ...context,
88
- serviceId,
89
- mediaUnitId,
90
- });
91
- const closeClientSource = clientSource.close;
92
- clientSource.close = () => {
93
- closeClientSource();
94
- clientSources.delete(context.clientId);
95
- };
96
- clientSources.set(context.clientId, clientSource);
97
- return clientSource;
98
- },
99
- close: () => {
100
- if (closed) {
101
- return;
102
- }
103
- for (const clientSource of clientSources.values()) {
104
- clientSource.close();
105
- }
106
- clientSources.clear();
107
- closed = true;
108
- },
109
- closed,
110
- };
111
- return callSource;
112
- }
113
- createClientSource(config) {
114
- var _a, _b, _c;
115
- if (this._closed) {
116
- throw new Error(`Attempted to create a client source on a closed observer`);
117
- }
118
- const serviceId = (_a = config.serviceId) !== null && _a !== void 0 ? _a : this.config.defaultServiceId;
119
- const mediaUnitId = (_b = config.mediaUnitId) !== null && _b !== void 0 ? _b : this.config.defaultMediaUnitId;
120
- const joined = (_c = config.joined) !== null && _c !== void 0 ? _c : Date.now();
121
- return this._sources.createClientSource({
122
- ...config,
123
- serviceId,
124
- mediaUnitId,
125
- joined,
126
- });
132
+ serviceId }));
127
133
  }
128
134
  createSfuSource(config) {
129
- var _a, _b, _c;
130
135
  if (this._closed) {
131
- throw new Error(`Attempted to create a sfu source on a closed observer`);
136
+ throw new Error('Attempted to create a sfu source on a closed observer');
132
137
  }
133
- const serviceId = (_a = config.serviceId) !== null && _a !== void 0 ? _a : this.config.defaultServiceId;
134
- const mediaUnitId = (_b = config.mediaUnitId) !== null && _b !== void 0 ? _b : this.config.defaultMediaUnitId;
135
- const joined = (_c = config.joined) !== null && _c !== void 0 ? _c : Date.now();
136
- return this._sources.createSfuSource({
137
- ...config,
138
+ const { appData = {}, serviceId = this.config.defaultServiceId, mediaUnitId = this.config.defaultMediaUnitId, joined = Date.now() } = config, sfuConfig = __rest(config, ["appData", "serviceId", "mediaUnitId", "joined"]);
139
+ return this._sources.createSfuSource(Object.assign(Object.assign({}, sfuConfig), { appData,
138
140
  serviceId,
139
141
  mediaUnitId,
140
- joined,
141
- });
142
- }
143
- async evaluate() {
144
- return new Promise((resolve, reject) => {
145
- this._evaluator.once('ready', err => {
146
- if (err)
147
- reject(err);
148
- else
149
- resolve();
142
+ joined }));
143
+ }
144
+ evaluate() {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ return new Promise((resolve, reject) => {
147
+ this._evaluator.once('ready', (err) => {
148
+ if (err)
149
+ reject(err);
150
+ else
151
+ resolve();
152
+ });
153
+ this._sources.emitSamples();
150
154
  });
151
- this._sources.emitSamples();
152
155
  });
153
156
  }
154
157
  get reports() {
@@ -156,7 +159,7 @@ class Observer {
156
159
  }
157
160
  addEvaluators(...processes) {
158
161
  if (this._closed) {
159
- throw new Error(`Attempted to add an evaluator to a closed observer`);
162
+ throw new Error('Attempted to add an evaluator to a closed observer');
160
163
  }
161
164
  for (const process of processes) {
162
165
  this._evaluator.addProcess(process);
@@ -164,7 +167,7 @@ class Observer {
164
167
  }
165
168
  removeEvaluators(...processes) {
166
169
  if (this._closed) {
167
- throw new Error(`Attempted to remove an evaluator from a closed observer`);
170
+ throw new Error('Attempted to remove an evaluator from a closed observer');
168
171
  }
169
172
  for (const process of processes) {
170
173
  this._evaluator.removeProcess(process);
@@ -172,7 +175,7 @@ class Observer {
172
175
  }
173
176
  addSinks(...processes) {
174
177
  if (this._closed) {
175
- throw new Error(`Attempted to add an evaluator to a closed observer`);
178
+ throw new Error('Attempted to add an evaluator to a closed observer');
176
179
  }
177
180
  for (const process of processes) {
178
181
  this._sink.addProcess(process);
@@ -180,158 +183,459 @@ class Observer {
180
183
  }
181
184
  removeSinks(...processes) {
182
185
  if (this._closed) {
183
- throw new Error(`Attempted to remove an evaluator from a closed observer`);
186
+ throw new Error('Attempted to remove an evaluator from a closed observer');
184
187
  }
185
188
  for (const process of processes) {
186
189
  this._sink.removeProcess(process);
187
190
  }
188
191
  }
189
192
  calls() {
190
- const { callStorage } = this._storages;
191
- return callStorage[Symbol.asyncIterator]();
193
+ const storageProvider = this._storages;
194
+ return (0, utils_1.asyncIteratorConverter)((function () {
195
+ return __asyncGenerator(this, arguments, function* () {
196
+ var _a, e_1, _b, _c;
197
+ try {
198
+ for (var _d = true, _e = __asyncValues(storageProvider.callStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
199
+ _c = _f.value;
200
+ _d = false;
201
+ try {
202
+ const [, callModel] = _c;
203
+ if (!callModel)
204
+ continue;
205
+ yield yield __await((0, CallEntry_1.createCallEntry)(storageProvider, callModel));
206
+ }
207
+ finally {
208
+ _d = true;
209
+ }
210
+ }
211
+ }
212
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
213
+ finally {
214
+ try {
215
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
216
+ }
217
+ finally { if (e_1) throw e_1.error; }
218
+ }
219
+ });
220
+ })());
192
221
  }
193
222
  sfus() {
194
- const { sfuStorage } = this._storages;
195
- return sfuStorage[Symbol.asyncIterator]();
223
+ const storageProvider = this._storages;
224
+ return (0, utils_1.asyncIteratorConverter)((function () {
225
+ return __asyncGenerator(this, arguments, function* () {
226
+ var _a, e_2, _b, _c;
227
+ try {
228
+ for (var _d = true, _e = __asyncValues(storageProvider.sfuStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
229
+ _c = _f.value;
230
+ _d = false;
231
+ try {
232
+ const [, sfuModel] = _c;
233
+ if (!sfuModel)
234
+ continue;
235
+ yield yield __await((0, SfuEntry_1.createSfuEntry)(storageProvider, sfuModel));
236
+ }
237
+ finally {
238
+ _d = true;
239
+ }
240
+ }
241
+ }
242
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
243
+ finally {
244
+ try {
245
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
246
+ }
247
+ finally { if (e_2) throw e_2.error; }
248
+ }
249
+ });
250
+ })());
196
251
  }
197
252
  sfuTransports() {
198
- const { sfuTransportStorage } = this._storages;
199
- return sfuTransportStorage[Symbol.asyncIterator]();
253
+ const storageProvider = this._storages;
254
+ return (0, utils_1.asyncIteratorConverter)((function () {
255
+ return __asyncGenerator(this, arguments, function* () {
256
+ var _a, e_3, _b, _c;
257
+ try {
258
+ for (var _d = true, _e = __asyncValues(storageProvider.sfuTransportStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
259
+ _c = _f.value;
260
+ _d = false;
261
+ try {
262
+ const [, sfuTransportModel] = _c;
263
+ if (!sfuTransportModel)
264
+ continue;
265
+ yield yield __await((0, SfuTransportEntry_1.createSfuTransportEntry)(storageProvider, sfuTransportModel));
266
+ }
267
+ finally {
268
+ _d = true;
269
+ }
270
+ }
271
+ }
272
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
273
+ finally {
274
+ try {
275
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
276
+ }
277
+ finally { if (e_3) throw e_3.error; }
278
+ }
279
+ });
280
+ })());
200
281
  }
201
282
  sfuInboundRtpPads() {
202
- const { sfuInboundRtpPadStorage } = this._storages;
203
- return sfuInboundRtpPadStorage[Symbol.asyncIterator]();
283
+ const storageProvider = this._storages;
284
+ return (0, utils_1.asyncIteratorConverter)((function () {
285
+ return __asyncGenerator(this, arguments, function* () {
286
+ var _a, e_4, _b, _c;
287
+ try {
288
+ for (var _d = true, _e = __asyncValues(storageProvider.sfuInboundRtpPadStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
289
+ _c = _f.value;
290
+ _d = false;
291
+ try {
292
+ const [, sfuInboundRtpPadModel] = _c;
293
+ if (!sfuInboundRtpPadModel)
294
+ continue;
295
+ yield yield __await((0, SfuInboundRtpPadEntry_1.createSfuInboundRtpPadEntry)(storageProvider, sfuInboundRtpPadModel));
296
+ }
297
+ finally {
298
+ _d = true;
299
+ }
300
+ }
301
+ }
302
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
303
+ finally {
304
+ try {
305
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
306
+ }
307
+ finally { if (e_4) throw e_4.error; }
308
+ }
309
+ });
310
+ })());
204
311
  }
205
312
  sfuOutboundRtpPads() {
206
- const { sfuOutboundRtpPadStorage } = this._storages;
207
- return sfuOutboundRtpPadStorage[Symbol.asyncIterator]();
313
+ const storageProvider = this._storages;
314
+ return (0, utils_1.asyncIteratorConverter)((function () {
315
+ return __asyncGenerator(this, arguments, function* () {
316
+ var _a, e_5, _b, _c;
317
+ try {
318
+ for (var _d = true, _e = __asyncValues(storageProvider.sfuOutboundRtpPadStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
319
+ _c = _f.value;
320
+ _d = false;
321
+ try {
322
+ const [, sfuOutboundRtpPadModel] = _c;
323
+ if (!sfuOutboundRtpPadModel)
324
+ continue;
325
+ yield yield __await((0, SfuOutboundRtpPadEntry_1.createSfuOutboundRtpPadEntry)(storageProvider, sfuOutboundRtpPadModel));
326
+ }
327
+ finally {
328
+ _d = true;
329
+ }
330
+ }
331
+ }
332
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
333
+ finally {
334
+ try {
335
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
336
+ }
337
+ finally { if (e_5) throw e_5.error; }
338
+ }
339
+ });
340
+ })());
208
341
  }
209
342
  clients() {
210
- const { clientStorage } = this._storages;
211
- return clientStorage[Symbol.asyncIterator]();
343
+ const storageProvider = this._storages;
344
+ return (0, utils_1.asyncIteratorConverter)((function () {
345
+ return __asyncGenerator(this, arguments, function* () {
346
+ var _a, e_6, _b, _c;
347
+ try {
348
+ for (var _d = true, _e = __asyncValues(storageProvider.clientStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
349
+ _c = _f.value;
350
+ _d = false;
351
+ try {
352
+ const [, callModel] = _c;
353
+ if (!callModel)
354
+ continue;
355
+ yield yield __await((0, ClientEntry_1.createClientEntry)(storageProvider, callModel));
356
+ }
357
+ finally {
358
+ _d = true;
359
+ }
360
+ }
361
+ }
362
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
363
+ finally {
364
+ try {
365
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
366
+ }
367
+ finally { if (e_6) throw e_6.error; }
368
+ }
369
+ });
370
+ })());
212
371
  }
213
372
  peerConnections() {
214
- const { peerConnectionStorage } = this._storages;
215
- return peerConnectionStorage[Symbol.asyncIterator]();
216
- }
217
- async getTrack(trackId) {
218
- const { inboundTrackStorage, outboundTrackStorage } = this._storages;
219
- const [inbTrack, outbTrack] = await Promise.all([
220
- inboundTrackStorage.get(trackId),
221
- outboundTrackStorage.get(trackId),
222
- ]);
223
- if (inbTrack)
224
- return inbTrack;
225
- else if (outbTrack)
226
- return outbTrack;
227
- }
228
- async getAllTracks(trackIds) {
229
- const { inboundTrackStorage, outboundTrackStorage } = this._storages;
230
- const [inbTracks, outbTracks] = await Promise.all([
231
- inboundTrackStorage.getAll(trackIds),
232
- outboundTrackStorage.getAll(trackIds),
233
- ]);
234
- return new Map([...inbTracks, ...outbTracks]);
373
+ const storageProvider = this._storages;
374
+ return (0, utils_1.asyncIteratorConverter)((function () {
375
+ return __asyncGenerator(this, arguments, function* () {
376
+ var _a, e_7, _b, _c;
377
+ try {
378
+ for (var _d = true, _e = __asyncValues(storageProvider.peerConnectionStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
379
+ _c = _f.value;
380
+ _d = false;
381
+ try {
382
+ const [, peerConnectionModel] = _c;
383
+ if (!peerConnectionModel)
384
+ continue;
385
+ yield yield __await((0, PeerConnectionEntry_1.createPeerConnectionEntry)(storageProvider, peerConnectionModel));
386
+ }
387
+ finally {
388
+ _d = true;
389
+ }
390
+ }
391
+ }
392
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
393
+ finally {
394
+ try {
395
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
396
+ }
397
+ finally { if (e_7) throw e_7.error; }
398
+ }
399
+ });
400
+ })());
401
+ }
402
+ getTrack(trackId) {
403
+ return __awaiter(this, void 0, void 0, function* () {
404
+ const { inboundTrackStorage, outboundTrackStorage } = this._storages;
405
+ const [inbTrackModel, outbTrackModel] = yield Promise.all([
406
+ inboundTrackStorage.get(trackId),
407
+ outboundTrackStorage.get(trackId),
408
+ ]);
409
+ if (inbTrackModel)
410
+ return (0, InboundTrackEntry_1.createInboundTrackEntry)(this._storages, inbTrackModel);
411
+ else if (outbTrackModel)
412
+ return (0, OutboundTrackEntry_1.createOutboundTrackEntry)(this._storages, outbTrackModel);
413
+ });
414
+ }
415
+ getAllTracks(trackIds) {
416
+ return __awaiter(this, void 0, void 0, function* () {
417
+ const storageProvider = this._storages;
418
+ const { inboundTrackStorage, outboundTrackStorage } = this._storages;
419
+ const [inbTrackModels, outbTrackModels] = yield Promise.all([
420
+ inboundTrackStorage.getAll(trackIds),
421
+ outboundTrackStorage.getAll(trackIds),
422
+ ]);
423
+ const result = new Map();
424
+ for (const [trackId, model] of inbTrackModels) {
425
+ result.set(trackId, (0, InboundTrackEntry_1.createInboundTrackEntry)(storageProvider, model));
426
+ }
427
+ for (const [trackId, model] of outbTrackModels) {
428
+ result.set(trackId, (0, OutboundTrackEntry_1.createOutboundTrackEntry)(storageProvider, model));
429
+ }
430
+ return result;
431
+ });
235
432
  }
236
433
  inboundTracks() {
237
- const { inboundTrackStorage } = this._storages;
238
- return inboundTrackStorage[Symbol.asyncIterator]();
434
+ const storageProvider = this._storages;
435
+ return (0, utils_1.asyncIteratorConverter)((function () {
436
+ return __asyncGenerator(this, arguments, function* () {
437
+ var _a, e_8, _b, _c;
438
+ try {
439
+ for (var _d = true, _e = __asyncValues(storageProvider.inboundTrackStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
440
+ _c = _f.value;
441
+ _d = false;
442
+ try {
443
+ const [, inboundTrackModel] = _c;
444
+ if (!inboundTrackModel)
445
+ continue;
446
+ yield yield __await((0, InboundTrackEntry_1.createInboundTrackEntry)(storageProvider, inboundTrackModel));
447
+ }
448
+ finally {
449
+ _d = true;
450
+ }
451
+ }
452
+ }
453
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
454
+ finally {
455
+ try {
456
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
457
+ }
458
+ finally { if (e_8) throw e_8.error; }
459
+ }
460
+ });
461
+ })());
239
462
  }
240
463
  outboundTracks() {
241
- const { outboundTrackStorage } = this._storages;
242
- return outboundTrackStorage[Symbol.asyncIterator]();
464
+ const storageProvider = this._storages;
465
+ return (0, utils_1.asyncIteratorConverter)((function () {
466
+ return __asyncGenerator(this, arguments, function* () {
467
+ var _a, e_9, _b, _c;
468
+ try {
469
+ for (var _d = true, _e = __asyncValues(storageProvider.outboundTrackStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
470
+ _c = _f.value;
471
+ _d = false;
472
+ try {
473
+ const [, outboundTrackModel] = _c;
474
+ if (!outboundTrackModel)
475
+ continue;
476
+ yield yield __await((0, OutboundTrackEntry_1.createOutboundTrackEntry)(storageProvider, outboundTrackModel));
477
+ }
478
+ finally {
479
+ _d = true;
480
+ }
481
+ }
482
+ }
483
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
484
+ finally {
485
+ try {
486
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
487
+ }
488
+ finally { if (e_9) throw e_9.error; }
489
+ }
490
+ });
491
+ })());
243
492
  }
244
493
  sfuSctpChannels() {
245
- const { sfuSctpChannelStorage } = this._storages;
246
- return sfuSctpChannelStorage[Symbol.asyncIterator]();
494
+ const storageProvider = this._storages;
495
+ return (0, utils_1.asyncIteratorConverter)((function () {
496
+ return __asyncGenerator(this, arguments, function* () {
497
+ var _a, e_10, _b, _c;
498
+ try {
499
+ for (var _d = true, _e = __asyncValues(storageProvider.sfuSctpChannelStorage[Symbol.asyncIterator]()), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
500
+ _c = _f.value;
501
+ _d = false;
502
+ try {
503
+ const [, sfuSctpChannelModel] = _c;
504
+ if (!sfuSctpChannelModel)
505
+ continue;
506
+ yield yield __await((0, SfuSctpChannelEntry_1.createSfuSctpChannelEntry)(storageProvider, sfuSctpChannelModel));
507
+ }
508
+ finally {
509
+ _d = true;
510
+ }
511
+ }
512
+ }
513
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
514
+ finally {
515
+ try {
516
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
517
+ }
518
+ finally { if (e_10) throw e_10.error; }
519
+ }
520
+ });
521
+ })());
247
522
  }
248
- async getCall(callId) {
249
- const { callStorage } = this._storages;
250
- return callStorage.get(callId);
523
+ getCall(callId) {
524
+ return __awaiter(this, void 0, void 0, function* () {
525
+ return (0, CallEntry_1.createCallEntry)(this._storages, yield this._storages.callStorage.get(callId));
526
+ });
251
527
  }
252
- async getAllCalls(callIds) {
253
- const { callStorage } = this._storages;
254
- return callStorage.getAll(callIds);
528
+ getAllCalls(callIds) {
529
+ return __awaiter(this, void 0, void 0, function* () {
530
+ const models = yield this._storages.callStorage.getAll(callIds);
531
+ return new Map(Array.from(models).map(([callId, model]) => [callId, (0, CallEntry_1.createCallEntry)(this._storages, model)]));
532
+ });
255
533
  }
256
- async getSfu(sfuId) {
257
- const { sfuStorage } = this._storages;
258
- return sfuStorage.get(sfuId);
534
+ getSfu(sfuId) {
535
+ return __awaiter(this, void 0, void 0, function* () {
536
+ return (0, SfuEntry_1.createSfuEntry)(this._storages, yield this._storages.sfuStorage.get(sfuId));
537
+ });
259
538
  }
260
- async getAllSfus(sfuIds) {
261
- const { sfuStorage } = this._storages;
262
- return sfuStorage.getAll(sfuIds);
539
+ getAllSfus(sfuIds) {
540
+ return __awaiter(this, void 0, void 0, function* () {
541
+ const models = yield this._storages.sfuStorage.getAll(sfuIds);
542
+ return new Map(Array.from(models).map(([sfuId, model]) => [sfuId, (0, SfuEntry_1.createSfuEntry)(this._storages, model)]));
543
+ });
263
544
  }
264
- async getSfuTransport(sfuTransportId) {
265
- const { sfuTransportStorage } = this._storages;
266
- return sfuTransportStorage.get(sfuTransportId);
545
+ getSfuTransport(sfuTransportId) {
546
+ return __awaiter(this, void 0, void 0, function* () {
547
+ return (0, SfuTransportEntry_1.createSfuTransportEntry)(this._storages, yield this._storages.sfuTransportStorage.get(sfuTransportId));
548
+ });
267
549
  }
268
- async getAllSfuTransports(sfuTransportIds) {
269
- const { sfuTransportStorage } = this._storages;
270
- return sfuTransportStorage.getAll(sfuTransportIds);
550
+ getAllSfuTransports(sfuTransportIds) {
551
+ return __awaiter(this, void 0, void 0, function* () {
552
+ const models = yield this._storages.sfuTransportStorage.getAll(sfuTransportIds);
553
+ return new Map(Array.from(models).map(([sfuTransportId, model]) => [sfuTransportId, (0, SfuTransportEntry_1.createSfuTransportEntry)(this._storages, model)]));
554
+ });
271
555
  }
272
- async getSfuInboundRtpPad(sfuInboundRtpPadId) {
273
- const { sfuInboundRtpPadStorage } = this._storages;
274
- return sfuInboundRtpPadStorage.get(sfuInboundRtpPadId);
556
+ getSfuInboundRtpPad(sfuInboundRtpPadId) {
557
+ return __awaiter(this, void 0, void 0, function* () {
558
+ return (0, SfuInboundRtpPadEntry_1.createSfuInboundRtpPadEntry)(this._storages, yield this._storages.sfuInboundRtpPadStorage.get(sfuInboundRtpPadId));
559
+ });
275
560
  }
276
- async getAllSfuInboundRtpPads(sfuInboundRtpPadIds) {
277
- const { sfuInboundRtpPadStorage } = this._storages;
278
- return sfuInboundRtpPadStorage.getAll(sfuInboundRtpPadIds);
561
+ getAllSfuInboundRtpPads(sfuInboundRtpPadIds) {
562
+ return __awaiter(this, void 0, void 0, function* () {
563
+ const models = yield this._storages.sfuInboundRtpPadStorage.getAll(sfuInboundRtpPadIds);
564
+ return new Map(Array.from(models).map(([sfuInboundRtpPadId, model]) => [sfuInboundRtpPadId, (0, SfuInboundRtpPadEntry_1.createSfuInboundRtpPadEntry)(this._storages, model)]));
565
+ });
279
566
  }
280
- async getSfuOutboundRtpPad(sfuOutboundRtpPadId) {
281
- const { sfuOutboundRtpPadStorage } = this._storages;
282
- return sfuOutboundRtpPadStorage.get(sfuOutboundRtpPadId);
567
+ getSfuOutboundRtpPad(sfuOutboundRtpPadId) {
568
+ return __awaiter(this, void 0, void 0, function* () {
569
+ return (0, SfuOutboundRtpPadEntry_1.createSfuOutboundRtpPadEntry)(this._storages, yield this._storages.sfuOutboundRtpPadStorage.get(sfuOutboundRtpPadId));
570
+ });
283
571
  }
284
- async getAllSfuOutboundRtpPads(sfuOutboundRtpPadIds) {
285
- const { sfuOutboundRtpPadStorage } = this._storages;
286
- return sfuOutboundRtpPadStorage.getAll(sfuOutboundRtpPadIds);
572
+ getAllSfuOutboundRtpPads(sfuOutboundRtpPadIds) {
573
+ return __awaiter(this, void 0, void 0, function* () {
574
+ const models = yield this._storages.sfuOutboundRtpPadStorage.getAll(sfuOutboundRtpPadIds);
575
+ return new Map(Array.from(models).map(([sfuOutboundRtpPadId, model]) => [sfuOutboundRtpPadId, (0, SfuOutboundRtpPadEntry_1.createSfuOutboundRtpPadEntry)(this._storages, model)]));
576
+ });
287
577
  }
288
- async getClient(clientId) {
289
- const { clientStorage } = this._storages;
290
- return clientStorage.get(clientId);
578
+ getClient(clientId) {
579
+ return __awaiter(this, void 0, void 0, function* () {
580
+ return (0, ClientEntry_1.createClientEntry)(this._storages, yield this._storages.clientStorage.get(clientId));
581
+ });
291
582
  }
292
- async getAllClient(clientIds) {
293
- const { clientStorage } = this._storages;
294
- return clientStorage.getAll(clientIds);
583
+ getAllClient(clientIds) {
584
+ return __awaiter(this, void 0, void 0, function* () {
585
+ const models = yield this._storages.clientStorage.getAll(clientIds);
586
+ return new Map(Array.from(models).map(([clientId, model]) => [clientId, (0, ClientEntry_1.createClientEntry)(this._storages, model)]));
587
+ });
295
588
  }
296
- async getPeerConnection(peerConnectionId) {
297
- const { peerConnectionStorage } = this._storages;
298
- return peerConnectionStorage.get(peerConnectionId);
589
+ getPeerConnection(peerConnectionId) {
590
+ return __awaiter(this, void 0, void 0, function* () {
591
+ return (0, PeerConnectionEntry_1.createPeerConnectionEntry)(this._storages, yield this._storages.peerConnectionStorage.get(peerConnectionId));
592
+ });
299
593
  }
300
- async getAllPeerConnections(peerConnectionIds) {
301
- const { peerConnectionStorage } = this._storages;
302
- return peerConnectionStorage.getAll(peerConnectionIds);
594
+ getAllPeerConnections(peerConnectionIds) {
595
+ return __awaiter(this, void 0, void 0, function* () {
596
+ const models = yield this._storages.peerConnectionStorage.getAll(peerConnectionIds);
597
+ return new Map(Array.from(models).map(([peerConnectionId, model]) => [peerConnectionId, (0, PeerConnectionEntry_1.createPeerConnectionEntry)(this._storages, model)]));
598
+ });
303
599
  }
304
- async getInboundTrack(inboundTrackId) {
305
- const { inboundTrackStorage } = this._storages;
306
- return inboundTrackStorage.get(inboundTrackId);
600
+ getInboundTrack(inboundTrackId) {
601
+ return __awaiter(this, void 0, void 0, function* () {
602
+ return (0, InboundTrackEntry_1.createInboundTrackEntry)(this._storages, yield this._storages.inboundTrackStorage.get(inboundTrackId));
603
+ });
307
604
  }
308
- async getAllInboundTracks(inboundTrackIds) {
309
- const { inboundTrackStorage } = this._storages;
310
- return inboundTrackStorage.getAll(inboundTrackIds);
605
+ getAllInboundTracks(inboundTrackIds) {
606
+ return __awaiter(this, void 0, void 0, function* () {
607
+ const models = yield this._storages.inboundTrackStorage.getAll(inboundTrackIds);
608
+ return new Map(Array.from(models).map(([inboundTrackId, model]) => [inboundTrackId, (0, InboundTrackEntry_1.createInboundTrackEntry)(this._storages, model)]));
609
+ });
311
610
  }
312
- async getOutboundTrack(outboundTrackId) {
313
- const { outboundTrackStorage } = this._storages;
314
- return outboundTrackStorage.get(outboundTrackId);
611
+ getOutboundTrack(outboundTrackId) {
612
+ return __awaiter(this, void 0, void 0, function* () {
613
+ return (0, OutboundTrackEntry_1.createOutboundTrackEntry)(this._storages, yield this._storages.outboundTrackStorage.get(outboundTrackId));
614
+ });
315
615
  }
316
- async getAllOutboundTracks(outboundTrackIds) {
317
- const { outboundTrackStorage } = this._storages;
318
- return outboundTrackStorage.getAll(outboundTrackIds);
616
+ getAllOutboundTracks(outboundTrackIds) {
617
+ return __awaiter(this, void 0, void 0, function* () {
618
+ const models = yield this._storages.outboundTrackStorage.getAll(outboundTrackIds);
619
+ return new Map(Array.from(models).map(([outboundTrackId, model]) => [outboundTrackId, (0, OutboundTrackEntry_1.createOutboundTrackEntry)(this._storages, model)]));
620
+ });
319
621
  }
320
- async getSfuSctpChannel(sctpChannelId) {
321
- const { sfuSctpChannelStorage } = this._storages;
322
- return sfuSctpChannelStorage.get(sctpChannelId);
622
+ getSfuSctpChannel(sctpChannelId) {
623
+ return __awaiter(this, void 0, void 0, function* () {
624
+ return (0, SfuSctpChannelEntry_1.createSfuSctpChannelEntry)(this._storages, yield this._storages.sfuSctpChannelStorage.get(sctpChannelId));
625
+ });
323
626
  }
324
- async getAllSfuSctpChannel(sctpChannelIds) {
325
- const { sfuSctpChannelStorage } = this._storages;
326
- return sfuSctpChannelStorage.getAll(sctpChannelIds);
627
+ getAllSfuSctpChannel(sctpChannelIds) {
628
+ return __awaiter(this, void 0, void 0, function* () {
629
+ const models = yield this._storages.sfuSctpChannelStorage.getAll(sctpChannelIds);
630
+ return new Map(Array.from(models).map(([sctpChannelId, model]) => [sctpChannelId, (0, SfuSctpChannelEntry_1.createSfuSctpChannelEntry)(this._storages, model)]));
631
+ });
327
632
  }
328
633
  get closed() {
329
634
  return this._closed;
330
635
  }
331
636
  close() {
332
637
  if (this._closed) {
333
- logger.debug(`Attempted to close twice`);
334
- return;
638
+ return logger.debug('Attempted to close twice');
335
639
  }
336
640
  this._closed = true;
337
641
  this._sources.close();