@webex/plugin-meetings 3.10.0-next.8 → 3.10.0-webex-services-ready.1

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 (265) hide show
  1. package/dist/annotation/annotation.types.js.map +1 -1
  2. package/dist/annotation/constants.js.map +1 -1
  3. package/dist/annotation/index.js +19 -22
  4. package/dist/annotation/index.js.map +1 -1
  5. package/dist/breakouts/breakout.js +6 -6
  6. package/dist/breakouts/breakout.js.map +1 -1
  7. package/dist/breakouts/collection.js.map +1 -1
  8. package/dist/breakouts/edit-lock-error.js +9 -11
  9. package/dist/breakouts/edit-lock-error.js.map +1 -1
  10. package/dist/breakouts/events.js.map +1 -1
  11. package/dist/breakouts/index.js +126 -127
  12. package/dist/breakouts/index.js.map +1 -1
  13. package/dist/breakouts/request.js +6 -8
  14. package/dist/breakouts/request.js.map +1 -1
  15. package/dist/breakouts/utils.js.map +1 -1
  16. package/dist/common/browser-detection.js.map +1 -1
  17. package/dist/common/collection.js +1 -2
  18. package/dist/common/collection.js.map +1 -1
  19. package/dist/common/config.js.map +1 -1
  20. package/dist/common/errors/captcha-error.js +9 -11
  21. package/dist/common/errors/captcha-error.js.map +1 -1
  22. package/dist/common/errors/intent-to-join.js +10 -12
  23. package/dist/common/errors/intent-to-join.js.map +1 -1
  24. package/dist/common/errors/join-forbidden-error.js +10 -12
  25. package/dist/common/errors/join-forbidden-error.js.map +1 -1
  26. package/dist/common/errors/join-meeting.js +10 -12
  27. package/dist/common/errors/join-meeting.js.map +1 -1
  28. package/dist/common/errors/join-webinar-error.js +9 -11
  29. package/dist/common/errors/join-webinar-error.js.map +1 -1
  30. package/dist/common/errors/media.js +9 -11
  31. package/dist/common/errors/media.js.map +1 -1
  32. package/dist/common/errors/multistream-not-supported-error.js +9 -11
  33. package/dist/common/errors/multistream-not-supported-error.js.map +1 -1
  34. package/dist/common/errors/no-meeting-info.js +9 -11
  35. package/dist/common/errors/no-meeting-info.js.map +1 -1
  36. package/dist/common/errors/parameter.js +11 -14
  37. package/dist/common/errors/parameter.js.map +1 -1
  38. package/dist/common/errors/password-error.js +9 -11
  39. package/dist/common/errors/password-error.js.map +1 -1
  40. package/dist/common/errors/permission.js +9 -11
  41. package/dist/common/errors/permission.js.map +1 -1
  42. package/dist/common/errors/reclaim-host-role-errors.js +32 -38
  43. package/dist/common/errors/reclaim-host-role-errors.js.map +1 -1
  44. package/dist/common/errors/reconnection-not-started.js +5 -6
  45. package/dist/common/errors/reconnection-not-started.js.map +1 -1
  46. package/dist/common/errors/reconnection.js +9 -11
  47. package/dist/common/errors/reconnection.js.map +1 -1
  48. package/dist/common/errors/stats.js +9 -11
  49. package/dist/common/errors/stats.js.map +1 -1
  50. package/dist/common/errors/webex-errors.js +20 -29
  51. package/dist/common/errors/webex-errors.js.map +1 -1
  52. package/dist/common/errors/webex-meetings-error.js +9 -12
  53. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  54. package/dist/common/events/events-scope.js +9 -10
  55. package/dist/common/events/events-scope.js.map +1 -1
  56. package/dist/common/events/events.js +9 -10
  57. package/dist/common/events/events.js.map +1 -1
  58. package/dist/common/events/trigger-proxy.js.map +1 -1
  59. package/dist/common/events/util.js.map +1 -1
  60. package/dist/common/logs/logger-config.js.map +1 -1
  61. package/dist/common/logs/logger-proxy.js.map +1 -1
  62. package/dist/common/logs/request.js +17 -17
  63. package/dist/common/logs/request.js.map +1 -1
  64. package/dist/common/queue.js +1 -2
  65. package/dist/common/queue.js.map +1 -1
  66. package/dist/config.js +0 -1
  67. package/dist/config.js.map +1 -1
  68. package/dist/constants.js +11 -8
  69. package/dist/constants.js.map +1 -1
  70. package/dist/controls-options-manager/constants.js.map +1 -1
  71. package/dist/controls-options-manager/enums.js.map +1 -1
  72. package/dist/controls-options-manager/index.js +1 -2
  73. package/dist/controls-options-manager/index.js.map +1 -1
  74. package/dist/controls-options-manager/types.js.map +1 -1
  75. package/dist/controls-options-manager/util.js +1 -2
  76. package/dist/controls-options-manager/util.js.map +1 -1
  77. package/dist/hashTree/constants.js +20 -0
  78. package/dist/hashTree/constants.js.map +1 -0
  79. package/dist/hashTree/hashTree.js +515 -0
  80. package/dist/hashTree/hashTree.js.map +1 -0
  81. package/dist/hashTree/hashTreeParser.js +1266 -0
  82. package/dist/hashTree/hashTreeParser.js.map +1 -0
  83. package/dist/hashTree/types.js +21 -0
  84. package/dist/hashTree/types.js.map +1 -0
  85. package/dist/hashTree/utils.js +48 -0
  86. package/dist/hashTree/utils.js.map +1 -0
  87. package/dist/index.js +1 -2
  88. package/dist/index.js.map +1 -1
  89. package/dist/interceptors/index.js.map +1 -1
  90. package/dist/interceptors/locusRetry.js +6 -8
  91. package/dist/interceptors/locusRetry.js.map +1 -1
  92. package/dist/interceptors/locusRouteToken.js +6 -8
  93. package/dist/interceptors/locusRouteToken.js.map +1 -1
  94. package/dist/interpretation/collection.js.map +1 -1
  95. package/dist/interpretation/index.js +1 -2
  96. package/dist/interpretation/index.js.map +1 -1
  97. package/dist/interpretation/siLanguage.js +1 -1
  98. package/dist/interpretation/siLanguage.js.map +1 -1
  99. package/dist/locus-info/controlsUtils.js.map +1 -1
  100. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  101. package/dist/locus-info/fullState.js.map +1 -1
  102. package/dist/locus-info/hostUtils.js.map +1 -1
  103. package/dist/locus-info/index.js +551 -94
  104. package/dist/locus-info/index.js.map +1 -1
  105. package/dist/locus-info/infoUtils.js.map +1 -1
  106. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  107. package/dist/locus-info/parser.js +3 -4
  108. package/dist/locus-info/parser.js.map +1 -1
  109. package/dist/locus-info/selfUtils.js.map +1 -1
  110. package/dist/locus-info/types.js +7 -0
  111. package/dist/locus-info/types.js.map +1 -0
  112. package/dist/media/MediaConnectionAwaiter.js +1 -2
  113. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  114. package/dist/media/index.js +0 -2
  115. package/dist/media/index.js.map +1 -1
  116. package/dist/media/properties.js +15 -17
  117. package/dist/media/properties.js.map +1 -1
  118. package/dist/media/util.js.map +1 -1
  119. package/dist/meeting/brbState.js +8 -9
  120. package/dist/meeting/brbState.js.map +1 -1
  121. package/dist/meeting/connectionStateHandler.js +10 -13
  122. package/dist/meeting/connectionStateHandler.js.map +1 -1
  123. package/dist/meeting/in-meeting-actions.js.map +1 -1
  124. package/dist/meeting/index.js +1555 -1527
  125. package/dist/meeting/index.js.map +1 -1
  126. package/dist/meeting/locusMediaRequest.js +13 -17
  127. package/dist/meeting/locusMediaRequest.js.map +1 -1
  128. package/dist/meeting/muteState.js +11 -12
  129. package/dist/meeting/muteState.js.map +1 -1
  130. package/dist/meeting/request.js +101 -104
  131. package/dist/meeting/request.js.map +1 -1
  132. package/dist/meeting/request.type.js.map +1 -1
  133. package/dist/meeting/state.js.map +1 -1
  134. package/dist/meeting/type.js.map +1 -1
  135. package/dist/meeting/util.js +24 -23
  136. package/dist/meeting/util.js.map +1 -1
  137. package/dist/meeting/voicea-meeting.js +3 -3
  138. package/dist/meeting/voicea-meeting.js.map +1 -1
  139. package/dist/meeting-info/collection.js +7 -10
  140. package/dist/meeting-info/collection.js.map +1 -1
  141. package/dist/meeting-info/index.js +1 -2
  142. package/dist/meeting-info/index.js.map +1 -1
  143. package/dist/meeting-info/meeting-info-v2.js +135 -146
  144. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  145. package/dist/meeting-info/request.js +1 -2
  146. package/dist/meeting-info/request.js.map +1 -1
  147. package/dist/meeting-info/util.js +36 -37
  148. package/dist/meeting-info/util.js.map +1 -1
  149. package/dist/meeting-info/utilv2.js +30 -31
  150. package/dist/meeting-info/utilv2.js.map +1 -1
  151. package/dist/meetings/collection.js +6 -8
  152. package/dist/meetings/collection.js.map +1 -1
  153. package/dist/meetings/index.js +179 -141
  154. package/dist/meetings/index.js.map +1 -1
  155. package/dist/meetings/meetings.types.js.map +1 -1
  156. package/dist/meetings/request.js +6 -8
  157. package/dist/meetings/request.js.map +1 -1
  158. package/dist/meetings/util.js +25 -23
  159. package/dist/meetings/util.js.map +1 -1
  160. package/dist/member/index.js +1 -2
  161. package/dist/member/index.js.map +1 -1
  162. package/dist/member/types.js +6 -3
  163. package/dist/member/types.js.map +1 -1
  164. package/dist/member/util.js.map +1 -1
  165. package/dist/members/collection.js +1 -2
  166. package/dist/members/collection.js.map +1 -1
  167. package/dist/members/index.js +18 -21
  168. package/dist/members/index.js.map +1 -1
  169. package/dist/members/request.js +8 -11
  170. package/dist/members/request.js.map +1 -1
  171. package/dist/members/types.js.map +1 -1
  172. package/dist/members/util.js.map +1 -1
  173. package/dist/metrics/constants.js +3 -1
  174. package/dist/metrics/constants.js.map +1 -1
  175. package/dist/metrics/index.js +3 -4
  176. package/dist/metrics/index.js.map +1 -1
  177. package/dist/multistream/mediaRequestManager.js +1 -2
  178. package/dist/multistream/mediaRequestManager.js.map +1 -1
  179. package/dist/multistream/receiveSlot.js +34 -45
  180. package/dist/multistream/receiveSlot.js.map +1 -1
  181. package/dist/multistream/receiveSlotManager.js +8 -9
  182. package/dist/multistream/receiveSlotManager.js.map +1 -1
  183. package/dist/multistream/remoteMedia.js +12 -15
  184. package/dist/multistream/remoteMedia.js.map +1 -1
  185. package/dist/multistream/remoteMediaGroup.js +1 -2
  186. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  187. package/dist/multistream/remoteMediaManager.js +122 -123
  188. package/dist/multistream/remoteMediaManager.js.map +1 -1
  189. package/dist/multistream/sendSlotManager.js +29 -30
  190. package/dist/multistream/sendSlotManager.js.map +1 -1
  191. package/dist/personal-meeting-room/index.js +16 -19
  192. package/dist/personal-meeting-room/index.js.map +1 -1
  193. package/dist/personal-meeting-room/request.js +7 -10
  194. package/dist/personal-meeting-room/request.js.map +1 -1
  195. package/dist/personal-meeting-room/util.js.map +1 -1
  196. package/dist/reachability/clusterReachability.js +56 -373
  197. package/dist/reachability/clusterReachability.js.map +1 -1
  198. package/dist/reachability/index.js +203 -205
  199. package/dist/reachability/index.js.map +1 -1
  200. package/dist/reachability/reachability.types.js +14 -1
  201. package/dist/reachability/reachability.types.js.map +1 -1
  202. package/dist/reachability/reachabilityPeerConnection.js +445 -0
  203. package/dist/reachability/reachabilityPeerConnection.js.map +1 -0
  204. package/dist/reachability/request.js.map +1 -1
  205. package/dist/reachability/util.js.map +1 -1
  206. package/dist/reactions/constants.js.map +1 -1
  207. package/dist/reactions/reactions.js.map +1 -1
  208. package/dist/reactions/reactions.type.js.map +1 -1
  209. package/dist/reconnection-manager/index.js +178 -176
  210. package/dist/reconnection-manager/index.js.map +1 -1
  211. package/dist/recording-controller/enums.js.map +1 -1
  212. package/dist/recording-controller/index.js +1 -2
  213. package/dist/recording-controller/index.js.map +1 -1
  214. package/dist/recording-controller/util.js.map +1 -1
  215. package/dist/roap/index.js +12 -15
  216. package/dist/roap/index.js.map +1 -1
  217. package/dist/roap/request.js +24 -26
  218. package/dist/roap/request.js.map +1 -1
  219. package/dist/roap/turnDiscovery.js +75 -76
  220. package/dist/roap/turnDiscovery.js.map +1 -1
  221. package/dist/roap/types.js.map +1 -1
  222. package/dist/transcription/index.js +4 -5
  223. package/dist/transcription/index.js.map +1 -1
  224. package/dist/types/constants.d.ts +26 -21
  225. package/dist/types/hashTree/constants.d.ts +8 -0
  226. package/dist/types/hashTree/hashTree.d.ts +129 -0
  227. package/dist/types/hashTree/hashTreeParser.d.ts +260 -0
  228. package/dist/types/hashTree/types.d.ts +25 -0
  229. package/dist/types/hashTree/utils.d.ts +9 -0
  230. package/dist/types/locus-info/index.d.ts +91 -42
  231. package/dist/types/locus-info/types.d.ts +46 -0
  232. package/dist/types/meeting/index.d.ts +22 -9
  233. package/dist/types/meetings/index.d.ts +9 -2
  234. package/dist/types/metrics/constants.d.ts +2 -0
  235. package/dist/types/reachability/clusterReachability.d.ts +10 -88
  236. package/dist/types/reachability/reachability.types.d.ts +12 -1
  237. package/dist/types/reachability/reachabilityPeerConnection.d.ts +111 -0
  238. package/dist/webinar/collection.js +1 -2
  239. package/dist/webinar/collection.js.map +1 -1
  240. package/dist/webinar/index.js +148 -158
  241. package/dist/webinar/index.js.map +1 -1
  242. package/package.json +22 -21
  243. package/src/constants.ts +13 -1
  244. package/src/hashTree/constants.ts +9 -0
  245. package/src/hashTree/hashTree.ts +463 -0
  246. package/src/hashTree/hashTreeParser.ts +1161 -0
  247. package/src/hashTree/types.ts +30 -0
  248. package/src/hashTree/utils.ts +42 -0
  249. package/src/locus-info/index.ts +556 -85
  250. package/src/locus-info/types.ts +48 -0
  251. package/src/meeting/index.ts +58 -26
  252. package/src/meeting/util.ts +1 -0
  253. package/src/meetings/index.ts +104 -51
  254. package/src/metrics/constants.ts +2 -0
  255. package/src/reachability/clusterReachability.ts +50 -347
  256. package/src/reachability/reachability.types.ts +15 -1
  257. package/src/reachability/reachabilityPeerConnection.ts +416 -0
  258. package/test/unit/spec/hashTree/hashTree.ts +655 -0
  259. package/test/unit/spec/hashTree/hashTreeParser.ts +1532 -0
  260. package/test/unit/spec/hashTree/utils.ts +103 -0
  261. package/test/unit/spec/locus-info/index.js +667 -1
  262. package/test/unit/spec/meeting/index.js +91 -20
  263. package/test/unit/spec/meeting/utils.js +77 -0
  264. package/test/unit/spec/meetings/index.js +71 -26
  265. package/test/unit/spec/reachability/clusterReachability.ts +281 -138
@@ -1,23 +1,35 @@
1
1
  "use strict";
2
2
 
3
+ var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
3
4
  var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
5
+ var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
6
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
7
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
8
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
9
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
10
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
11
  var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
5
12
  var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
6
13
  var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
7
14
  var _Array$isArray2 = require("@babel/runtime-corejs2/core-js/array/is-array");
8
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
15
+ var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
9
16
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
10
17
  _Object$defineProperty(exports, "__esModule", {
11
18
  value: true
12
19
  });
13
20
  exports.default = void 0;
21
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
22
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
23
+ var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
24
+ var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
25
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
14
26
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
27
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
15
28
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
16
29
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
17
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
19
30
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
20
31
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
32
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
21
33
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
22
34
  var _lodash = require("lodash");
23
35
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
@@ -33,11 +45,25 @@ var _mediaSharesUtils = _interopRequireDefault(require("./mediaSharesUtils"));
33
45
  var _parser = _interopRequireDefault(require("./parser"));
34
46
  var _metrics = _interopRequireDefault(require("../metrics"));
35
47
  var _constants2 = _interopRequireDefault(require("../metrics/constants"));
36
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
37
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
38
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
39
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
40
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
48
+ var _hashTreeParser = _interopRequireWildcard(require("../hashTree/hashTreeParser"));
49
+ var _types = require("../hashTree/types");
50
+ function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
51
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && r[_Symbol$iterator] || r["@@iterator"]; if (!t) { if (_Array$isArray2(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
52
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
53
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
54
+ function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
55
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
56
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
57
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
58
+ // list of top level keys in Locus DTO relevant for Hash Tree DTOs processing
59
+ // it does not contain fields specific to classic Locus DTOs like sequence or baseSequence
60
+ var LocusDtoTopLevelKeys = ['controls', 'fullState', 'host', 'info', 'links', 'mediaShares', 'meetings', 'participants', 'replaces', 'self', 'sequence', 'syncUrl', 'url', 'htMeta' // only exists when hash trees are used
61
+ ];
62
+ var LocusObjectStateAfterUpdates = {
63
+ unchanged: 'unchanged',
64
+ removed: 'removed',
65
+ updated: 'updated'
66
+ };
41
67
  /**
42
68
  * @description LocusInfo extends ChildEmitter to convert locusInfo info a private emitter to parent object
43
69
  * @export
@@ -45,8 +71,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
45
71
  * @class LocusInfo
46
72
  */
47
73
  var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
48
- (0, _inherits2.default)(LocusInfo, _EventsScope);
49
- var _super = _createSuper(LocusInfo);
50
74
  /**
51
75
  * Constructor
52
76
  * @param {function} updateMeeting callback to update the meeting object from an object
@@ -57,38 +81,42 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
57
81
  function LocusInfo(updateMeeting, webex, meetingId) {
58
82
  var _this;
59
83
  (0, _classCallCheck2.default)(this, LocusInfo);
60
- _this = _super.call(this);
61
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "compareAndUpdateFlags", void 0);
62
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "emitChange", void 0);
63
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "locusParser", void 0);
64
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingId", void 0);
65
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "parsedLocus", void 0);
66
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateMeeting", void 0);
67
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webex", void 0);
68
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "aclUrl", void 0);
69
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "baseSequence", void 0);
70
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "created", void 0);
71
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "identities", void 0);
72
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "membership", void 0);
73
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "participants", void 0);
74
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "participantsUrl", void 0);
75
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "replaces", void 0);
76
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scheduledMeeting", void 0);
77
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sequence", void 0);
78
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "controls", void 0);
79
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "conversationUrl", void 0);
80
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "embeddedApps", void 0);
81
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fullState", void 0);
82
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "host", void 0);
83
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "info", void 0);
84
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "roles", void 0);
85
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaShares", void 0);
86
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "replace", void 0);
87
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "url", void 0);
88
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "services", void 0);
89
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resources", void 0);
90
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mainSessionLocusCache", void 0);
91
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "self", void 0);
84
+ _this = _callSuper(this, LocusInfo);
85
+ (0, _defineProperty2.default)(_this, "compareAndUpdateFlags", void 0);
86
+ (0, _defineProperty2.default)(_this, "emitChange", void 0);
87
+ (0, _defineProperty2.default)(_this, "locusParser", void 0);
88
+ (0, _defineProperty2.default)(_this, "meetingId", void 0);
89
+ (0, _defineProperty2.default)(_this, "parsedLocus", void 0);
90
+ (0, _defineProperty2.default)(_this, "updateMeeting", void 0);
91
+ (0, _defineProperty2.default)(_this, "webex", void 0);
92
+ (0, _defineProperty2.default)(_this, "aclUrl", void 0);
93
+ (0, _defineProperty2.default)(_this, "baseSequence", void 0);
94
+ (0, _defineProperty2.default)(_this, "created", void 0);
95
+ (0, _defineProperty2.default)(_this, "identities", void 0);
96
+ (0, _defineProperty2.default)(_this, "membership", void 0);
97
+ (0, _defineProperty2.default)(_this, "participants", void 0);
98
+ (0, _defineProperty2.default)(_this, "participantsUrl", void 0);
99
+ (0, _defineProperty2.default)(_this, "replaces", void 0);
100
+ (0, _defineProperty2.default)(_this, "scheduledMeeting", void 0);
101
+ (0, _defineProperty2.default)(_this, "sequence", void 0);
102
+ (0, _defineProperty2.default)(_this, "controls", void 0);
103
+ (0, _defineProperty2.default)(_this, "conversationUrl", void 0);
104
+ (0, _defineProperty2.default)(_this, "embeddedApps", void 0);
105
+ (0, _defineProperty2.default)(_this, "fullState", void 0);
106
+ (0, _defineProperty2.default)(_this, "host", void 0);
107
+ (0, _defineProperty2.default)(_this, "info", void 0);
108
+ (0, _defineProperty2.default)(_this, "roles", void 0);
109
+ (0, _defineProperty2.default)(_this, "mediaShares", void 0);
110
+ (0, _defineProperty2.default)(_this, "replace", void 0);
111
+ (0, _defineProperty2.default)(_this, "url", void 0);
112
+ (0, _defineProperty2.default)(_this, "services", void 0);
113
+ (0, _defineProperty2.default)(_this, "resources", void 0);
114
+ (0, _defineProperty2.default)(_this, "mainSessionLocusCache", void 0);
115
+ (0, _defineProperty2.default)(_this, "self", void 0);
116
+ (0, _defineProperty2.default)(_this, "hashTreeParser", void 0);
117
+ (0, _defineProperty2.default)(_this, "hashTreeObjectId2ParticipantId", void 0);
118
+ // mapping of hash tree object ids to participant ids
119
+ (0, _defineProperty2.default)(_this, "classicVsHashTreeMismatchMetricCounter", 0);
92
120
  _this.parsedLocus = {
93
121
  states: []
94
122
  };
@@ -98,18 +126,21 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
98
126
  _this.meetingId = meetingId;
99
127
  _this.updateMeeting = updateMeeting;
100
128
  _this.locusParser = new _parser.default();
129
+ _this.hashTreeObjectId2ParticipantId = new _map.default();
101
130
  return _this;
102
131
  }
103
132
 
104
133
  /**
105
134
  * Does a Locus sync. It tries to get the latest delta DTO or if it can't, it falls back to getting the full Locus DTO.
135
+ * WARNING: This function must not be used for hash tree based Locus meetings.
106
136
  *
107
137
  * @param {Meeting} meeting
108
138
  * @param {boolean} isLocusUrlChanged
109
139
  * @param {Locus} locus
110
140
  * @returns {undefined}
111
141
  */
112
- (0, _createClass2.default)(LocusInfo, [{
142
+ (0, _inherits2.default)(LocusInfo, _EventsScope);
143
+ return (0, _createClass2.default)(LocusInfo, [{
113
144
  key: "doLocusSync",
114
145
  value: function doLocusSync(meeting, isLocusUrlChanged, locus) {
115
146
  var _this$locusParser$wor,
@@ -309,30 +340,380 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
309
340
  }
310
341
 
311
342
  /**
312
- * @param {Object} locus
343
+ * Creates the HashTreeParser instance.
344
+ * @param {Object} initial locus data
345
+ * @returns {void}
346
+ */
347
+ }, {
348
+ key: "createHashTreeParser",
349
+ value: function createHashTreeParser(_ref) {
350
+ var initialLocus = _ref.initialLocus;
351
+ return new _hashTreeParser.default({
352
+ initialLocus: initialLocus,
353
+ webexRequest: this.webex.request.bind(this.webex),
354
+ locusInfoUpdateCallback: this.updateFromHashTree.bind(this),
355
+ debugId: "HT-".concat(this.meetingId.substring(0, 4))
356
+ });
357
+ }
358
+
359
+ /**
360
+ * @param {Object} data - data to initialize locus info with. It may be from a join or GET /loci response or from a Mercury event that triggers a creation of meeting object
313
361
  * @returns {undefined}
314
362
  * @memberof LocusInfo
315
363
  */
316
364
  }, {
317
365
  key: "initialSetup",
318
- value: function initialSetup(locus) {
319
- this.updateLocusCache(locus);
320
- this.onFullLocus(locus);
366
+ value: (function () {
367
+ var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(data) {
368
+ var _data$locus, _data$locus$links, _data$locus$links$res, _data$locus$links$res2;
369
+ var _data$hashTreeMessage, _selfObject$data, selfObject, _data$locus2, _data$locus2$self, _t;
370
+ return _regenerator.default.wrap(function (_context) {
371
+ while (1) switch (_context.prev = _context.next) {
372
+ case 0:
373
+ _t = data.trigger;
374
+ _context.next = _t === 'locus-message' ? 1 : _t === 'join-response' ? 6 : _t === 'get-loci-response' ? 7 : 10;
375
+ break;
376
+ case 1:
377
+ if (!data.hashTreeMessage) {
378
+ _context.next = 4;
379
+ break;
380
+ }
381
+ // we need the SELF object to be in the received message, because it contains visibleDataSets
382
+ // and these are needed to initialize all the hash trees
383
+ selfObject = (_data$hashTreeMessage = data.hashTreeMessage.locusStateElements) === null || _data$hashTreeMessage === void 0 ? void 0 : _data$hashTreeMessage.find(function (el) {
384
+ return (0, _hashTreeParser.isSelf)(el);
385
+ });
386
+ if (selfObject !== null && selfObject !== void 0 && (_selfObject$data = selfObject.data) !== null && _selfObject$data !== void 0 && _selfObject$data.visibleDataSets) {
387
+ _context.next = 2;
388
+ break;
389
+ }
390
+ _loggerProxy.default.logger.warn("Locus-info:index#initialSetup --> cannot initialize HashTreeParser, SELF object with visibleDataSets is missing in the message");
391
+ throw new Error('SELF object with visibleDataSets is missing in the message');
392
+ case 2:
393
+ _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from message');
394
+ // first create the HashTreeParser, but don't initialize it with any data yet
395
+ // pass just a fake locus that contains only the visibleDataSets
396
+ this.hashTreeParser = this.createHashTreeParser({
397
+ initialLocus: {
398
+ locus: {
399
+ self: {
400
+ visibleDataSets: selfObject.data.visibleDataSets
401
+ }
402
+ },
403
+ dataSets: [] // empty, because they will be populated in initializeFromMessage() call // dataSets: data.hashTreeMessage.dataSets,
404
+ }
405
+ });
321
406
 
322
- // Change it to true after it receives it first locus object
323
- this.emitChange = true;
324
- }
407
+ // now handle the message - that should populate all the visible datasets
408
+ _context.next = 3;
409
+ return this.hashTreeParser.initializeFromMessage(data.hashTreeMessage);
410
+ case 3:
411
+ _context.next = 5;
412
+ break;
413
+ case 4:
414
+ // "classic" Locus case, no hash trees involved
415
+ this.updateLocusCache(data.locus);
416
+ this.onFullLocus(data.locus, undefined);
417
+ case 5:
418
+ return _context.abrupt("continue", 10);
419
+ case 6:
420
+ this.updateLocusCache(data.locus);
421
+ this.onFullLocus(data.locus, undefined, data.dataSets);
422
+ return _context.abrupt("continue", 10);
423
+ case 7:
424
+ if (!((_data$locus = data.locus) !== null && _data$locus !== void 0 && (_data$locus$links = _data$locus.links) !== null && _data$locus$links !== void 0 && (_data$locus$links$res = _data$locus$links.resources) !== null && _data$locus$links$res !== void 0 && (_data$locus$links$res2 = _data$locus$links$res.visibleDataSets) !== null && _data$locus$links$res2 !== void 0 && _data$locus$links$res2.url)) {
425
+ _context.next = 9;
426
+ break;
427
+ }
428
+ _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from get-loci-response');
429
+ // first create the HashTreeParser, but don't initialize it with any data yet
430
+ // pass just a fake locus that contains only the visibleDataSets
431
+ this.hashTreeParser = this.createHashTreeParser({
432
+ initialLocus: {
433
+ locus: {
434
+ self: {
435
+ visibleDataSets: (_data$locus2 = data.locus) === null || _data$locus2 === void 0 ? void 0 : (_data$locus2$self = _data$locus2.self) === null || _data$locus2$self === void 0 ? void 0 : _data$locus2$self.visibleDataSets
436
+ }
437
+ },
438
+ dataSets: [] // empty, because we don't have them yet
439
+ }
440
+ });
325
441
 
442
+ // now initialize all the data
443
+ _context.next = 8;
444
+ return this.hashTreeParser.initializeFromGetLociResponse(data.locus);
445
+ case 8:
446
+ _context.next = 10;
447
+ break;
448
+ case 9:
449
+ // "classic" Locus case, no hash trees involved
450
+ this.updateLocusCache(data.locus);
451
+ this.onFullLocus(data.locus, undefined);
452
+ case 10:
453
+ // Change it to true after it receives it first locus object
454
+ this.emitChange = true;
455
+ case 11:
456
+ case "end":
457
+ return _context.stop();
458
+ }
459
+ }, _callee, this);
460
+ }));
461
+ function initialSetup(_x) {
462
+ return _initialSetup.apply(this, arguments);
463
+ }
464
+ return initialSetup;
465
+ }()
326
466
  /**
327
467
  * Handles HTTP response from Locus API call.
328
468
  * @param {Meeting} meeting meeting object
329
469
  * @param {LocusApiResponseBody} responseBody body of the http response from Locus API call
330
470
  * @returns {void}
331
471
  */
472
+ )
332
473
  }, {
333
474
  key: "handleLocusAPIResponse",
334
475
  value: function handleLocusAPIResponse(meeting, responseBody) {
335
- this.handleLocusDelta(responseBody.locus, meeting);
476
+ if (this.hashTreeParser) {
477
+ if (!responseBody.dataSets) {
478
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "expected hash tree dataSets in API response but they are missing");
479
+ // continuing as we can still manage without responseBody.dataSets, but this is very suspicious
480
+ }
481
+ _loggerProxy.default.logger.info('Locus-info:index#handleLocusAPIResponse --> passing Locus API response to HashTreeParser: ', responseBody);
482
+ // update the data in our hash trees
483
+ this.hashTreeParser.handleLocusUpdate(responseBody);
484
+ } else {
485
+ if (responseBody.dataSets) {
486
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "unexpected hash tree dataSets in API response");
487
+ }
488
+ // classic Locus delta
489
+ this.handleLocusDelta(responseBody.locus, meeting);
490
+ }
491
+ }
492
+
493
+ /**
494
+ *
495
+ * @param {HashTreeObject} object data set object
496
+ * @param {any} locus
497
+ * @returns {void}
498
+ */
499
+ }, {
500
+ key: "updateLocusFromHashTreeObject",
501
+ value: function updateLocusFromHashTreeObject(object, locus) {
502
+ var type = object.htMeta.elementId.type.toLowerCase();
503
+ switch (type) {
504
+ case _types.ObjectType.locus:
505
+ {
506
+ if (!object.data) {
507
+ // not doing anything here, as we need Locus to always be there (at least some fields)
508
+ // and that's already taken care of in updateFromHashTree()
509
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> LOCUS object removed, version=".concat(object.htMeta.elementId.version));
510
+ return locus;
511
+ }
512
+ // replace the main locus
513
+
514
+ // The Locus object we receive from backend has empty participants array,
515
+ // and may have (although it shouldn't) other fields that are managed by other ObjectTypes
516
+ // like "fullState" or "info", so we're making sure to delete them here
517
+ var locusObjectFromData = object.data;
518
+ (0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
519
+ delete locusObjectFromData[locusDtoKey];
520
+ });
521
+ locus = _objectSpread(_objectSpread({}, locus), locusObjectFromData);
522
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> LOCUS object updated to version=".concat(object.htMeta.elementId.version));
523
+ break;
524
+ }
525
+ case _types.ObjectType.mediaShare:
526
+ if (object.data) {
527
+ var _object$data$floor, _object$data$floor2, _object$data$floor2$b, _locus$mediaShares;
528
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> mediaShare id=".concat(object.htMeta.elementId.id, " name='").concat(object.data.name, "' updated ").concat(object.data.name === 'content' ? "floor=".concat((_object$data$floor = object.data.floor) === null || _object$data$floor === void 0 ? void 0 : _object$data$floor.disposition, ", ").concat((_object$data$floor2 = object.data.floor) === null || _object$data$floor2 === void 0 ? void 0 : (_object$data$floor2$b = _object$data$floor2.beneficiary) === null || _object$data$floor2$b === void 0 ? void 0 : _object$data$floor2$b.id) : '', " version=").concat(object.htMeta.elementId.version));
529
+ var existingMediaShare = (_locus$mediaShares = locus.mediaShares) === null || _locus$mediaShares === void 0 ? void 0 : _locus$mediaShares.find(function (ms) {
530
+ return ms.htMeta.elementId.id === object.htMeta.elementId.id;
531
+ });
532
+ if (existingMediaShare) {
533
+ (0, _assign.default)(existingMediaShare, object.data);
534
+ } else {
535
+ locus.mediaShares = locus.mediaShares || [];
536
+ locus.mediaShares.push(object.data);
537
+ }
538
+ } else {
539
+ var _locus$mediaShares2;
540
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> mediaShare id=".concat(object.htMeta.elementId.id, " removed, version=").concat(object.htMeta.elementId.version));
541
+ locus.mediaShares = (_locus$mediaShares2 = locus.mediaShares) === null || _locus$mediaShares2 === void 0 ? void 0 : _locus$mediaShares2.filter(function (ms) {
542
+ return ms.htMeta.elementId.id !== object.htMeta.elementId.id;
543
+ });
544
+ }
545
+ break;
546
+ case _types.ObjectType.participant:
547
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> participant id=".concat(object.htMeta.elementId.id, " ").concat(object.data ? 'updated' : 'removed', " version=").concat(object.htMeta.elementId.version));
548
+ if (object.data) {
549
+ if (!locus.participants) {
550
+ locus.participants = [];
551
+ }
552
+ var participantObject = object.data;
553
+ participantObject.htMeta = object.htMeta;
554
+ locus.participants.push(participantObject);
555
+ this.hashTreeObjectId2ParticipantId.set(object.htMeta.elementId.id, participantObject.id);
556
+ } else {
557
+ var participantId = this.hashTreeObjectId2ParticipantId.get(object.htMeta.elementId.id);
558
+ if (!locus.jsSdkMeta) {
559
+ locus.jsSdkMeta = {
560
+ removedParticipantIds: []
561
+ };
562
+ }
563
+ locus.jsSdkMeta.removedParticipantIds.push(participantId);
564
+ this.hashTreeObjectId2ParticipantId.delete(object.htMeta.elementId.id);
565
+ }
566
+ break;
567
+ case _types.ObjectType.info:
568
+ case _types.ObjectType.fullState:
569
+ case _types.ObjectType.self:
570
+ if (!object.data) {
571
+ // self without data is handled inside HashTreeParser and results in LocusInfoUpdateType.MEETING_ENDED, so we should never get here
572
+ // other types like info or fullstate - Locus should never send them without data
573
+ _loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received ".concat(type, " object without data, this is not expected! version=").concat(object.htMeta.elementId.version));
574
+ } else {
575
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> ".concat(type, " object updated to version ").concat(object.htMeta.elementId.version));
576
+ var locusDtoKey = _types.ObjectTypeToLocusKeyMap[type];
577
+ locus[locusDtoKey] = object.data;
578
+ }
579
+ break;
580
+ default:
581
+ _loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received unsupported object type ".concat(type));
582
+ break;
583
+ }
584
+ return locus;
585
+ }
586
+
587
+ /**
588
+ * Sends a metric when we receive something from Locus that uses hash trees while we
589
+ * expect classic deltas or the other way around.
590
+ * @param {Meeting} meeting
591
+ * @param {string} message
592
+ * @returns {void}
593
+ */
594
+ }, {
595
+ key: "sendClassicVsHashTreeMismatchMetric",
596
+ value: function sendClassicVsHashTreeMismatchMetric(meeting, message) {
597
+ _loggerProxy.default.logger.warn("Locus-info:index#sendClassicVsHashTreeMismatchMetric --> classic vs hash tree mismatch! ".concat(message));
598
+
599
+ // we don't want to flood the metrics system
600
+ if (this.classicVsHashTreeMismatchMetricCounter < 5) {
601
+ _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_CLASSIC_VS_HASH_TREE_MISMATCH, {
602
+ correlationId: meeting.correlationId,
603
+ message: message
604
+ });
605
+ this.classicVsHashTreeMismatchMetricCounter += 1;
606
+ }
607
+ }
608
+
609
+ /**
610
+ * Handles a hash tree message received from Locus.
611
+ *
612
+ * @param {Meeting} meeting - The meeting object
613
+ * @param {eventType} eventType - The event type
614
+ * @param {HashTreeMessage} message incoming hash tree message
615
+ * @returns {void}
616
+ */
617
+ }, {
618
+ key: "handleHashTreeMessage",
619
+ value: function handleHashTreeMessage(meeting, eventType, message) {
620
+ if (eventType !== _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
621
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected ").concat(_constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED));
622
+ return;
623
+ }
624
+ this.hashTreeParser.handleMessage(message);
625
+ }
626
+
627
+ /**
628
+ * Callback registered with HashTreeParser to receive locus info updates.
629
+ * Updates our locus info based on the data parsed by the hash tree parser.
630
+ *
631
+ * @param {LocusInfoUpdateType} updateType - The type of update received.
632
+ * @param {Object} [data] - Additional data for the update, if applicable.
633
+ * @returns {void}
634
+ */
635
+ }, {
636
+ key: "updateFromHashTree",
637
+ value: function updateFromHashTree(updateType, data) {
638
+ var _this4 = this;
639
+ switch (updateType) {
640
+ case _hashTreeParser.LocusInfoUpdateType.OBJECTS_UPDATED:
641
+ {
642
+ // initialize our new locus
643
+ var locus = {
644
+ participants: [],
645
+ jsSdkMeta: {
646
+ removedParticipantIds: []
647
+ }
648
+ };
649
+
650
+ // first go over all the updates and check what happens with the main locus object
651
+ var locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.unchanged;
652
+ data.updatedObjects.forEach(function (object) {
653
+ if (object.htMeta.elementId.type.toLowerCase() === _types.ObjectType.locus) {
654
+ if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.updated) {
655
+ var _object$data;
656
+ // this code doesn't supported it right now,
657
+ // cases for "updated" followed by "removed", or multiple "updated" would need more handling
658
+ // but these should never happen
659
+ _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> received multiple LOCUS objects in one update, this is unexpected!");
660
+ _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_HASH_TREE_UNSUPPORTED_OPERATION, {
661
+ locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this4.url,
662
+ message: object.data ? 'multiple LOCUS object updates' : 'LOCUS object update followed by removal'
663
+ });
664
+ }
665
+ if (object.data) {
666
+ locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.updated;
667
+ } else {
668
+ locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.removed;
669
+ }
670
+ }
671
+ });
672
+
673
+ // if Locus object is unchanged or removed, we need to keep using the existing locus
674
+ // because the rest of the locusInfo code expects locus to always be present (with at least some of the fields)
675
+ // if it gets updated, we only need to have the fields that are not part of "locus" object (like "info" or "mediaShares")
676
+ // so that when Locus object gets updated, if the new one is missing some field, that field will
677
+ // be removed from our locusInfo
678
+ if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.unchanged || locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.removed) {
679
+ // copy over all of existing locus except participants
680
+ LocusDtoTopLevelKeys.forEach(function (key) {
681
+ if (key !== 'participants') {
682
+ locus[key] = (0, _lodash.cloneDeep)(_this4[key]);
683
+ }
684
+ });
685
+ } else {
686
+ // initialize only the fields that are not part of main "Locus" object
687
+ // (except participants, which need to stay empty - that means "no participant changes")
688
+ (0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
689
+ if (locusDtoKey !== 'participants') {
690
+ locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this4[locusDtoKey]);
691
+ }
692
+ });
693
+ }
694
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> LOCUS object is ".concat(locusObjectStateAfterUpdates, ", all updates: ").concat((0, _stringify.default)(data.updatedObjects.map(function (o) {
695
+ return {
696
+ type: o.htMeta.elementId.type,
697
+ id: o.htMeta.elementId.id,
698
+ hasData: !!o.data
699
+ };
700
+ }))));
701
+ // now apply all the updates from the hash tree onto the locus
702
+ data.updatedObjects.forEach(function (object) {
703
+ locus = _this4.updateLocusFromHashTreeObject(object, locus);
704
+ });
705
+
706
+ // update our locus info with the new locus
707
+ this.onDeltaLocus(locus);
708
+ break;
709
+ }
710
+ case _hashTreeParser.LocusInfoUpdateType.MEETING_ENDED:
711
+ {
712
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received signal that meeting ended, destroying meeting ".concat(this.meetingId));
713
+ var meeting = this.webex.meetings.meetingCollection.get(this.meetingId);
714
+ this.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.SELF_REMOVED);
715
+ }
716
+ }
336
717
  }
337
718
 
338
719
  /**
@@ -344,37 +725,44 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
344
725
  }, {
345
726
  key: "parse",
346
727
  value: function parse(meeting, data) {
347
- // eslint-disable-next-line @typescript-eslint/no-shadow
348
- var eventType = data.eventType;
349
- var locus = this.getTheLocusToUpdate(data.locus);
350
- _loggerProxy.default.logger.info("Locus-info:index#parse --> received locus data: ".concat(eventType));
351
- locus.jsSdkMeta = {
352
- removedParticipantIds: []
353
- };
354
- switch (eventType) {
355
- case _constants.LOCUSEVENT.PARTICIPANT_JOIN:
356
- case _constants.LOCUSEVENT.PARTICIPANT_LEFT:
357
- case _constants.LOCUSEVENT.CONTROLS_UPDATED:
358
- case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_MUTED:
359
- case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_UNMUTED:
360
- case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_MUTED:
361
- case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_UNMUTED:
362
- case _constants.LOCUSEVENT.SELF_CHANGED:
363
- case _constants.LOCUSEVENT.PARTICIPANT_UPDATED:
364
- case _constants.LOCUSEVENT.PARTICIPANT_CONTROLS_UPDATED:
365
- case _constants.LOCUSEVENT.PARTICIPANT_ROLES_UPDATED:
366
- case _constants.LOCUSEVENT.PARTICIPANT_DECLINED:
367
- case _constants.LOCUSEVENT.FLOOR_GRANTED:
368
- case _constants.LOCUSEVENT.FLOOR_RELEASED:
369
- this.onFullLocus(locus, eventType);
370
- break;
371
- case _constants.LOCUSEVENT.DIFFERENCE:
372
- this.handleLocusDelta(locus, meeting);
373
- break;
374
- default:
375
- // Why will there be a event with no eventType ????
376
- // we may not need this, we can get full locus
377
- this.handleLocusDelta(locus, meeting);
728
+ if (this.hashTreeParser) {
729
+ this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
730
+ } else {
731
+ // eslint-disable-next-line @typescript-eslint/no-shadow
732
+ var eventType = data.eventType;
733
+ var locus = this.getTheLocusToUpdate(data.locus);
734
+ _loggerProxy.default.logger.info("Locus-info:index#parse --> received locus data: ".concat(eventType));
735
+ locus.jsSdkMeta = {
736
+ removedParticipantIds: []
737
+ };
738
+ switch (eventType) {
739
+ case _constants.LOCUSEVENT.PARTICIPANT_JOIN:
740
+ case _constants.LOCUSEVENT.PARTICIPANT_LEFT:
741
+ case _constants.LOCUSEVENT.CONTROLS_UPDATED:
742
+ case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_MUTED:
743
+ case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_UNMUTED:
744
+ case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_MUTED:
745
+ case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_UNMUTED:
746
+ case _constants.LOCUSEVENT.SELF_CHANGED:
747
+ case _constants.LOCUSEVENT.PARTICIPANT_UPDATED:
748
+ case _constants.LOCUSEVENT.PARTICIPANT_CONTROLS_UPDATED:
749
+ case _constants.LOCUSEVENT.PARTICIPANT_ROLES_UPDATED:
750
+ case _constants.LOCUSEVENT.PARTICIPANT_DECLINED:
751
+ case _constants.LOCUSEVENT.FLOOR_GRANTED:
752
+ case _constants.LOCUSEVENT.FLOOR_RELEASED:
753
+ this.onFullLocus(locus, eventType);
754
+ break;
755
+ case _constants.LOCUSEVENT.DIFFERENCE:
756
+ this.handleLocusDelta(locus, meeting);
757
+ break;
758
+ case _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED:
759
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected classic events"));
760
+ break;
761
+ default:
762
+ // Why will there be a event with no eventType ????
763
+ // we may not need this, we can get full locus
764
+ this.handleLocusDelta(locus, meeting);
765
+ }
378
766
  }
379
767
  }
380
768
 
@@ -391,26 +779,99 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
391
779
  return this.emit(scope, eventName, args);
392
780
  }
393
781
 
782
+ /**
783
+ * Function for handling full locus when it's using hash trees (so not the "classic" one).
784
+ *
785
+ * @param {object} locus locus object
786
+ * @param {string} eventType locus event
787
+ * @param {DataSet[]} dataSets
788
+ * @returns {void}
789
+ */
790
+ }, {
791
+ key: "onFullLocusWithHashTrees",
792
+ value: function onFullLocusWithHashTrees(locus, eventType, dataSets) {
793
+ if (!this.hashTreeParser) {
794
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> creating hash tree parser");
795
+ _loggerProxy.default.logger.info('Locus-info:index#onFullLocus --> dataSets:', dataSets, ' and locus:', locus);
796
+ this.hashTreeParser = this.createHashTreeParser({
797
+ initialLocus: {
798
+ locus: locus,
799
+ dataSets: dataSets
800
+ }
801
+ });
802
+ this.onFullLocusCommon(locus, eventType);
803
+ } else {
804
+ // in this case the Locus we're getting is not necessarily the full one
805
+ // so treat it like if we just got it in any api response
806
+
807
+ _loggerProxy.default.logger.info('Locus-info:index#onFullLocus --> hash tree parser already exists, handling it like a normal API response');
808
+ this.handleLocusAPIResponse(undefined, {
809
+ dataSets: dataSets,
810
+ locus: locus
811
+ });
812
+ }
813
+ }
814
+
815
+ /**
816
+ * Function for handling full locus when it's the "classic" one (not hash trees)
817
+ *
818
+ * @param {object} locus locus object
819
+ * @param {string} eventType locus event
820
+ * @returns {void}
821
+ */
822
+ }, {
823
+ key: "onFullLocusClassic",
824
+ value: function onFullLocusClassic(locus, eventType) {
825
+ if (!this.locusParser.isNewFullLocus(locus)) {
826
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=".concat(eventType));
827
+ return;
828
+ }
829
+ this.onFullLocusCommon(locus, eventType);
830
+ }
831
+
394
832
  /**
395
833
  * updates the locus with full locus object
396
834
  * @param {object} locus locus object
397
- * @param {string} eventType particulat locus event
835
+ * @param {string} eventType locus event
836
+ * @param {DataSet[]} dataSets
398
837
  * @returns {object} null
399
838
  * @memberof LocusInfo
400
839
  */
401
840
  }, {
402
841
  key: "onFullLocus",
403
- value: function onFullLocus(locus, eventType) {
404
- var _locus$jsSdkMeta;
842
+ value: function onFullLocus(locus, eventType, dataSets) {
405
843
  if (!locus) {
406
844
  _loggerProxy.default.logger.error('Locus-info:index#onFullLocus --> object passed as argument was invalid, continuing.');
407
845
  }
408
- if (!this.locusParser.isNewFullLocus(locus)) {
409
- _loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=".concat(eventType));
410
- return;
846
+ if (dataSets) {
847
+ // this is the new hashmap Locus DTO format (only applicable to webinars for now)
848
+ this.onFullLocusWithHashTrees(locus, eventType, dataSets);
849
+ } else {
850
+ this.onFullLocusClassic(locus, eventType);
411
851
  }
852
+ }
853
+
854
+ /**
855
+ * Common part of handling full locus, used by both classic and hash tree based locus handling
856
+ * @param {object} locus locus object
857
+ * @param {string} eventType locus event
858
+ * @returns {void}
859
+ */
860
+ }, {
861
+ key: "onFullLocusCommon",
862
+ value: function onFullLocusCommon(locus, eventType) {
863
+ var _this$participants,
864
+ _this5 = this,
865
+ _locus$jsSdkMeta;
412
866
  this.scheduledMeeting = locus.meeting || null;
413
867
  this.participants = locus.participants;
868
+ (_this$participants = this.participants) === null || _this$participants === void 0 ? void 0 : _this$participants.forEach(function (participant) {
869
+ var _participant$htMeta;
870
+ // participant.htMeta is set only for hash tree based locus
871
+ if ((_participant$htMeta = participant.htMeta) !== null && _participant$htMeta !== void 0 && _participant$htMeta.elementId.id) {
872
+ _this5.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
873
+ }
874
+ });
414
875
  var isReplaceMembers = _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
415
876
  this.updateLocusInfo(locus);
416
877
  this.updateParticipants(locus.participants, (_locus$jsSdkMeta = locus.jsSdkMeta) === null || _locus$jsSdkMeta === void 0 ? void 0 : _locus$jsSdkMeta.removedParticipantIds, isReplaceMembers);
@@ -1192,7 +1653,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1192
1653
  isInitializing: !self // if self is undefined, then the update is caused by locus init
1193
1654
  });
1194
1655
  }
1195
-
1196
1656
  this.roles = roles;
1197
1657
  }
1198
1658
 
@@ -1287,7 +1747,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1287
1747
  // @ts-ignore
1288
1748
  var parsedSelves = _selfUtils.default.getSelves(this.parsedLocus.self, self, this.webex.internal.device.url, this.participants // using this.participants instead of locus.participants here, because with delta DTOs locus.participants will only contain a small subset of participants
1289
1749
  );
1290
-
1291
1750
  this.updateMeeting(parsedSelves.current);
1292
1751
  this.parsedLocus.self = parsedSelves.current;
1293
1752
  var element = this.parsedLocus.states[this.parsedLocus.states.length - 1];
@@ -1372,7 +1831,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1372
1831
  // unmuteAllowed: not part of .self
1373
1832
  });
1374
1833
  }
1375
-
1376
1834
  if (parsedSelves.updates.localAudioUnmuteRequiredByServer) {
1377
1835
  this.emitScoped({
1378
1836
  file: 'locus-info',
@@ -1633,7 +2091,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1633
2091
  }, {
1634
2092
  key: "updateMainSessionLocusCache",
1635
2093
  value: function updateMainSessionLocusCache(mainLocus) {
1636
- var _this4 = this;
2094
+ var _this6 = this;
1637
2095
  if (!mainLocus) {
1638
2096
  return;
1639
2097
  }
@@ -1642,7 +2100,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1642
2100
  // shallow merge and do special merge for participants
1643
2101
  (0, _lodash.assignWith)(this.mainSessionLocusCache, locusClone, function (objValue, srcValue, key) {
1644
2102
  if (key === 'participants') {
1645
- return _this4.mergeParticipants(objValue, srcValue);
2103
+ return _this6.mergeParticipants(objValue, srcValue);
1646
2104
  }
1647
2105
  return srcValue || objValue;
1648
2106
  });
@@ -1662,6 +2120,5 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1662
2120
  this.mainSessionLocusCache = null;
1663
2121
  }
1664
2122
  }]);
1665
- return LocusInfo;
1666
2123
  }(_eventsScope.default);
1667
2124
  //# sourceMappingURL=index.js.map