@observertc/observer-js 0.9.21-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 +1404 -38
  5. package/lib/Observer.d.ts.map +1 -1
  6. package/lib/Observer.js +479 -176
  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 +1 -1
  144. package/src/Evaluator.ts +17 -9
  145. package/src/Observer.ts +230 -170
  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,4 +1,43 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ 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]); }
40
+ };
2
41
  Object.defineProperty(exports, "__esModule", { value: true });
3
42
  exports.Observer = void 0;
4
43
  const ObserverSink_1 = require("./sinks/ObserverSink");
@@ -6,8 +45,19 @@ const Sources_1 = require("./sources/Sources");
6
45
  const StorageProvider_1 = require("./storages/StorageProvider");
7
46
  const Evaluator_1 = require("./Evaluator");
8
47
  const Semaphore_1 = require("./common/Semaphore");
48
+ const utils_1 = require("./common/utils");
9
49
  const logger_1 = require("./common/logger");
10
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");
11
61
  const logger = (0, logger_1.createLogger)('Observer');
12
62
  class Observer {
13
63
  static create(providedConfig) {
@@ -55,7 +105,10 @@ class Observer {
55
105
  this._sink.emit();
56
106
  this._emitter.emit('processing-ended');
57
107
  });
58
- 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;
59
112
  }
60
113
  on(event, listener) {
61
114
  this._emitter.on(event, listener);
@@ -70,86 +123,35 @@ class Observer {
70
123
  return this;
71
124
  }
72
125
  createCallSource(config) {
73
- var _a, _b;
74
- if (this._closed) {
75
- throw new Error(`Attempted to create a call source on a closed observer`);
76
- }
77
- let closed = false;
78
- const serviceId = (_a = config.serviceId) !== null && _a !== void 0 ? _a : this.config.defaultServiceId;
79
- const mediaUnitId = (_b = config.mediaUnitId) !== null && _b !== void 0 ? _b : this.config.defaultMediaUnitId;
80
- const clientSources = new Map();
81
- const callSource = {
82
- ...config,
83
- serviceId,
84
- mediaUnitId,
85
- createClientSource: (context) => {
86
- const clientSource = this._sources.createClientSource({
87
- ...config,
88
- ...context,
89
- serviceId,
90
- mediaUnitId,
91
- });
92
- const closeClientSource = clientSource.close;
93
- clientSource.close = () => {
94
- closeClientSource();
95
- clientSources.delete(context.clientId);
96
- };
97
- clientSources.set(context.clientId, clientSource);
98
- return clientSource;
99
- },
100
- close: () => {
101
- if (closed) {
102
- return;
103
- }
104
- for (const clientSource of clientSources.values()) {
105
- clientSource.close();
106
- }
107
- clientSources.clear();
108
- closed = true;
109
- },
110
- closed,
111
- };
112
- return callSource;
113
- }
114
- createClientSource(config) {
115
- var _a, _b, _c;
116
126
  if (this._closed) {
117
- throw new Error(`Attempted to create a client source on a closed observer`);
127
+ throw new Error('Attempted to create a call source on a closed observer');
118
128
  }
119
- const serviceId = (_a = config.serviceId) !== null && _a !== void 0 ? _a : this.config.defaultServiceId;
120
- const mediaUnitId = (_b = config.mediaUnitId) !== null && _b !== void 0 ? _b : this.config.defaultMediaUnitId;
121
- const joined = (_c = config.joined) !== null && _c !== void 0 ? _c : Date.now();
122
- return this._sources.createClientSource({
123
- ...config,
124
- 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,
125
131
  mediaUnitId,
126
- joined,
127
- });
132
+ serviceId }));
128
133
  }
129
134
  createSfuSource(config) {
130
- var _a, _b, _c;
131
135
  if (this._closed) {
132
- 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');
133
137
  }
134
- const serviceId = (_a = config.serviceId) !== null && _a !== void 0 ? _a : this.config.defaultServiceId;
135
- const mediaUnitId = (_b = config.mediaUnitId) !== null && _b !== void 0 ? _b : this.config.defaultMediaUnitId;
136
- const joined = (_c = config.joined) !== null && _c !== void 0 ? _c : Date.now();
137
- return this._sources.createSfuSource({
138
- ...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,
139
140
  serviceId,
140
141
  mediaUnitId,
141
- joined,
142
- });
143
- }
144
- async evaluate() {
145
- return new Promise((resolve, reject) => {
146
- this._evaluator.once('ready', err => {
147
- if (err)
148
- reject(err);
149
- else
150
- 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();
151
154
  });
152
- this._sources.emitSamples();
153
155
  });
154
156
  }
155
157
  get reports() {
@@ -157,7 +159,7 @@ class Observer {
157
159
  }
158
160
  addEvaluators(...processes) {
159
161
  if (this._closed) {
160
- 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');
161
163
  }
162
164
  for (const process of processes) {
163
165
  this._evaluator.addProcess(process);
@@ -165,7 +167,7 @@ class Observer {
165
167
  }
166
168
  removeEvaluators(...processes) {
167
169
  if (this._closed) {
168
- 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');
169
171
  }
170
172
  for (const process of processes) {
171
173
  this._evaluator.removeProcess(process);
@@ -173,7 +175,7 @@ class Observer {
173
175
  }
174
176
  addSinks(...processes) {
175
177
  if (this._closed) {
176
- 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');
177
179
  }
178
180
  for (const process of processes) {
179
181
  this._sink.addProcess(process);
@@ -181,158 +183,459 @@ class Observer {
181
183
  }
182
184
  removeSinks(...processes) {
183
185
  if (this._closed) {
184
- 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');
185
187
  }
186
188
  for (const process of processes) {
187
189
  this._sink.removeProcess(process);
188
190
  }
189
191
  }
190
192
  calls() {
191
- const { callStorage } = this._storages;
192
- 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
+ })());
193
221
  }
194
222
  sfus() {
195
- const { sfuStorage } = this._storages;
196
- 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
+ })());
197
251
  }
198
252
  sfuTransports() {
199
- const { sfuTransportStorage } = this._storages;
200
- 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
+ })());
201
281
  }
202
282
  sfuInboundRtpPads() {
203
- const { sfuInboundRtpPadStorage } = this._storages;
204
- 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
+ })());
205
311
  }
206
312
  sfuOutboundRtpPads() {
207
- const { sfuOutboundRtpPadStorage } = this._storages;
208
- 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
+ })());
209
341
  }
210
342
  clients() {
211
- const { clientStorage } = this._storages;
212
- 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
+ })());
213
371
  }
214
372
  peerConnections() {
215
- const { peerConnectionStorage } = this._storages;
216
- return peerConnectionStorage[Symbol.asyncIterator]();
217
- }
218
- async getTrack(trackId) {
219
- const { inboundTrackStorage, outboundTrackStorage } = this._storages;
220
- const [inbTrack, outbTrack] = await Promise.all([
221
- inboundTrackStorage.get(trackId),
222
- outboundTrackStorage.get(trackId),
223
- ]);
224
- if (inbTrack)
225
- return inbTrack;
226
- else if (outbTrack)
227
- return outbTrack;
228
- }
229
- async getAllTracks(trackIds) {
230
- const { inboundTrackStorage, outboundTrackStorage } = this._storages;
231
- const [inbTracks, outbTracks] = await Promise.all([
232
- inboundTrackStorage.getAll(trackIds),
233
- outboundTrackStorage.getAll(trackIds),
234
- ]);
235
- 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
+ });
236
432
  }
237
433
  inboundTracks() {
238
- const { inboundTrackStorage } = this._storages;
239
- 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
+ })());
240
462
  }
241
463
  outboundTracks() {
242
- const { outboundTrackStorage } = this._storages;
243
- 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
+ })());
244
492
  }
245
493
  sfuSctpChannels() {
246
- const { sfuSctpChannelStorage } = this._storages;
247
- 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
+ })());
248
522
  }
249
- async getCall(callId) {
250
- const { callStorage } = this._storages;
251
- 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
+ });
252
527
  }
253
- async getAllCalls(callIds) {
254
- const { callStorage } = this._storages;
255
- 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
+ });
256
533
  }
257
- async getSfu(sfuId) {
258
- const { sfuStorage } = this._storages;
259
- 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
+ });
260
538
  }
261
- async getAllSfus(sfuIds) {
262
- const { sfuStorage } = this._storages;
263
- 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
+ });
264
544
  }
265
- async getSfuTransport(sfuTransportId) {
266
- const { sfuTransportStorage } = this._storages;
267
- 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
+ });
268
549
  }
269
- async getAllSfuTransports(sfuTransportIds) {
270
- const { sfuTransportStorage } = this._storages;
271
- 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
+ });
272
555
  }
273
- async getSfuInboundRtpPad(sfuInboundRtpPadId) {
274
- const { sfuInboundRtpPadStorage } = this._storages;
275
- 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
+ });
276
560
  }
277
- async getAllSfuInboundRtpPads(sfuInboundRtpPadIds) {
278
- const { sfuInboundRtpPadStorage } = this._storages;
279
- 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
+ });
280
566
  }
281
- async getSfuOutboundRtpPad(sfuOutboundRtpPadId) {
282
- const { sfuOutboundRtpPadStorage } = this._storages;
283
- 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
+ });
284
571
  }
285
- async getAllSfuOutboundRtpPads(sfuOutboundRtpPadIds) {
286
- const { sfuOutboundRtpPadStorage } = this._storages;
287
- 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
+ });
288
577
  }
289
- async getClient(clientId) {
290
- const { clientStorage } = this._storages;
291
- 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
+ });
292
582
  }
293
- async getAllClient(clientIds) {
294
- const { clientStorage } = this._storages;
295
- 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
+ });
296
588
  }
297
- async getPeerConnection(peerConnectionId) {
298
- const { peerConnectionStorage } = this._storages;
299
- 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
+ });
300
593
  }
301
- async getAllPeerConnections(peerConnectionIds) {
302
- const { peerConnectionStorage } = this._storages;
303
- 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
+ });
304
599
  }
305
- async getInboundTrack(inboundTrackId) {
306
- const { inboundTrackStorage } = this._storages;
307
- 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
+ });
308
604
  }
309
- async getAllInboundTracks(inboundTrackIds) {
310
- const { inboundTrackStorage } = this._storages;
311
- 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
+ });
312
610
  }
313
- async getOutboundTrack(outboundTrackId) {
314
- const { outboundTrackStorage } = this._storages;
315
- 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
+ });
316
615
  }
317
- async getAllOutboundTracks(outboundTrackIds) {
318
- const { outboundTrackStorage } = this._storages;
319
- 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
+ });
320
621
  }
321
- async getSfuSctpChannel(sctpChannelId) {
322
- const { sfuSctpChannelStorage } = this._storages;
323
- 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
+ });
324
626
  }
325
- async getAllSfuSctpChannel(sctpChannelIds) {
326
- const { sfuSctpChannelStorage } = this._storages;
327
- 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
+ });
328
632
  }
329
633
  get closed() {
330
634
  return this._closed;
331
635
  }
332
636
  close() {
333
637
  if (this._closed) {
334
- logger.debug(`Attempted to close twice`);
335
- return;
638
+ return logger.debug('Attempted to close twice');
336
639
  }
337
640
  this._closed = true;
338
641
  this._sources.close();