@webex/plugin-meetings 3.0.0-beta.7 → 3.0.0-beta.71

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 (506) hide show
  1. package/UPGRADING.md +9 -9
  2. package/browsers.js +19 -24
  3. package/dist/breakouts/breakout.js +178 -0
  4. package/dist/breakouts/breakout.js.map +1 -0
  5. package/dist/breakouts/collection.js +23 -0
  6. package/dist/breakouts/collection.js.map +1 -0
  7. package/dist/breakouts/edit-lock-error.js +52 -0
  8. package/dist/breakouts/edit-lock-error.js.map +1 -0
  9. package/dist/breakouts/index.js +843 -0
  10. package/dist/breakouts/index.js.map +1 -0
  11. package/dist/breakouts/request.js +78 -0
  12. package/dist/breakouts/request.js.map +1 -0
  13. package/dist/breakouts/utils.js +56 -0
  14. package/dist/breakouts/utils.js.map +1 -0
  15. package/dist/common/browser-detection.js +1 -20
  16. package/dist/common/browser-detection.js.map +1 -1
  17. package/dist/common/collection.js +5 -20
  18. package/dist/common/collection.js.map +1 -1
  19. package/dist/common/config.js +0 -7
  20. package/dist/common/config.js.map +1 -1
  21. package/dist/common/errors/captcha-error.js +10 -24
  22. package/dist/common/errors/captcha-error.js.map +1 -1
  23. package/dist/common/errors/intent-to-join.js +11 -24
  24. package/dist/common/errors/intent-to-join.js.map +1 -1
  25. package/dist/common/errors/join-meeting.js +12 -25
  26. package/dist/common/errors/join-meeting.js.map +1 -1
  27. package/dist/common/errors/media.js +10 -24
  28. package/dist/common/errors/media.js.map +1 -1
  29. package/dist/common/errors/parameter.js +5 -33
  30. package/dist/common/errors/parameter.js.map +1 -1
  31. package/dist/common/errors/password-error.js +10 -24
  32. package/dist/common/errors/password-error.js.map +1 -1
  33. package/dist/common/errors/permission.js +9 -23
  34. package/dist/common/errors/permission.js.map +1 -1
  35. package/dist/common/errors/reconnection-in-progress.js +0 -17
  36. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  37. package/dist/common/errors/reconnection.js +10 -24
  38. package/dist/common/errors/reconnection.js.map +1 -1
  39. package/dist/common/errors/stats.js +10 -24
  40. package/dist/common/errors/stats.js.map +1 -1
  41. package/dist/common/errors/webex-errors.js +6 -41
  42. package/dist/common/errors/webex-errors.js.map +1 -1
  43. package/dist/common/errors/webex-meetings-error.js +5 -25
  44. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  45. package/dist/common/events/events-scope.js +0 -22
  46. package/dist/common/events/events-scope.js.map +1 -1
  47. package/dist/common/events/events.js +0 -23
  48. package/dist/common/events/events.js.map +1 -1
  49. package/dist/common/events/trigger-proxy.js +0 -12
  50. package/dist/common/events/trigger-proxy.js.map +1 -1
  51. package/dist/common/events/util.js +0 -15
  52. package/dist/common/events/util.js.map +1 -1
  53. package/dist/common/logs/logger-config.js +0 -4
  54. package/dist/common/logs/logger-config.js.map +1 -1
  55. package/dist/common/logs/logger-proxy.js +1 -8
  56. package/dist/common/logs/logger-proxy.js.map +1 -1
  57. package/dist/common/logs/request.js +37 -60
  58. package/dist/common/logs/request.js.map +1 -1
  59. package/dist/common/queue.js +4 -14
  60. package/dist/common/queue.js.map +1 -1
  61. package/dist/config.js +6 -6
  62. package/dist/config.js.map +1 -1
  63. package/dist/constants.js +143 -52
  64. package/dist/constants.js.map +1 -1
  65. package/dist/controls-options-manager/constants.js +14 -0
  66. package/dist/controls-options-manager/constants.js.map +1 -0
  67. package/dist/controls-options-manager/enums.js +16 -0
  68. package/dist/controls-options-manager/enums.js.map +1 -0
  69. package/dist/controls-options-manager/index.js +261 -0
  70. package/dist/controls-options-manager/index.js.map +1 -0
  71. package/dist/controls-options-manager/util.js +39 -0
  72. package/dist/controls-options-manager/util.js.map +1 -0
  73. package/dist/index.js +11 -18
  74. package/dist/index.js.map +1 -1
  75. package/dist/locus-info/controlsUtils.js +31 -29
  76. package/dist/locus-info/controlsUtils.js.map +1 -1
  77. package/dist/locus-info/embeddedAppsUtils.js +3 -26
  78. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  79. package/dist/locus-info/fullState.js +0 -15
  80. package/dist/locus-info/fullState.js.map +1 -1
  81. package/dist/locus-info/hostUtils.js +4 -12
  82. package/dist/locus-info/hostUtils.js.map +1 -1
  83. package/dist/locus-info/index.js +237 -198
  84. package/dist/locus-info/index.js.map +1 -1
  85. package/dist/locus-info/infoUtils.js +3 -37
  86. package/dist/locus-info/infoUtils.js.map +1 -1
  87. package/dist/locus-info/mediaSharesUtils.js +12 -38
  88. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  89. package/dist/locus-info/parser.js +92 -118
  90. package/dist/locus-info/parser.js.map +1 -1
  91. package/dist/locus-info/selfUtils.js +80 -89
  92. package/dist/locus-info/selfUtils.js.map +1 -1
  93. package/dist/media/index.js +56 -146
  94. package/dist/media/index.js.map +1 -1
  95. package/dist/media/properties.js +83 -117
  96. package/dist/media/properties.js.map +1 -1
  97. package/dist/media/util.js +2 -9
  98. package/dist/media/util.js.map +1 -1
  99. package/dist/mediaQualityMetrics/config.js +505 -495
  100. package/dist/mediaQualityMetrics/config.js.map +1 -1
  101. package/dist/meeting/in-meeting-actions.js +31 -14
  102. package/dist/meeting/in-meeting-actions.js.map +1 -1
  103. package/dist/meeting/index.js +2225 -2244
  104. package/dist/meeting/index.js.map +1 -1
  105. package/dist/meeting/muteState.js +102 -100
  106. package/dist/meeting/muteState.js.map +1 -1
  107. package/dist/meeting/request.js +308 -264
  108. package/dist/meeting/request.js.map +1 -1
  109. package/dist/meeting/request.type.js +7 -0
  110. package/dist/meeting/request.type.js.map +1 -0
  111. package/dist/meeting/state.js +21 -31
  112. package/dist/meeting/state.js.map +1 -1
  113. package/dist/meeting/util.js +63 -217
  114. package/dist/meeting/util.js.map +1 -1
  115. package/dist/meeting-info/collection.js +6 -25
  116. package/dist/meeting-info/collection.js.map +1 -1
  117. package/dist/meeting-info/index.js +14 -32
  118. package/dist/meeting-info/index.js.map +1 -1
  119. package/dist/meeting-info/meeting-info-v2.js +193 -268
  120. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  121. package/dist/meeting-info/request.js +3 -15
  122. package/dist/meeting-info/request.js.map +1 -1
  123. package/dist/meeting-info/util.js +98 -183
  124. package/dist/meeting-info/util.js.map +1 -1
  125. package/dist/meeting-info/utilv2.js +137 -228
  126. package/dist/meeting-info/utilv2.js.map +1 -1
  127. package/dist/meetings/collection.js +26 -19
  128. package/dist/meetings/collection.js.map +1 -1
  129. package/dist/meetings/index.js +565 -552
  130. package/dist/meetings/index.js.map +1 -1
  131. package/dist/meetings/request.js +26 -41
  132. package/dist/meetings/request.js.map +1 -1
  133. package/dist/meetings/util.js +151 -155
  134. package/dist/meetings/util.js.map +1 -1
  135. package/dist/member/index.js +100 -85
  136. package/dist/member/index.js.map +1 -1
  137. package/dist/member/types.js +15 -0
  138. package/dist/member/types.js.map +1 -0
  139. package/dist/member/util.js +90 -68
  140. package/dist/member/util.js.map +1 -1
  141. package/dist/members/collection.js +13 -12
  142. package/dist/members/collection.js.map +1 -1
  143. package/dist/members/index.js +152 -204
  144. package/dist/members/index.js.map +1 -1
  145. package/dist/members/request.js +35 -39
  146. package/dist/members/request.js.map +1 -1
  147. package/dist/members/types.js +15 -0
  148. package/dist/members/types.js.map +1 -0
  149. package/dist/members/util.js +76 -46
  150. package/dist/members/util.js.map +1 -1
  151. package/dist/metrics/config.js +4 -14
  152. package/dist/metrics/config.js.map +1 -1
  153. package/dist/metrics/constants.js +1 -6
  154. package/dist/metrics/constants.js.map +1 -1
  155. package/dist/metrics/index.js +59 -156
  156. package/dist/metrics/index.js.map +1 -1
  157. package/dist/multistream/mediaRequestManager.js +116 -52
  158. package/dist/multistream/mediaRequestManager.js.map +1 -1
  159. package/dist/multistream/receiveSlot.js +58 -65
  160. package/dist/multistream/receiveSlot.js.map +1 -1
  161. package/dist/multistream/receiveSlotManager.js +58 -93
  162. package/dist/multistream/receiveSlotManager.js.map +1 -1
  163. package/dist/multistream/remoteMedia.js +55 -74
  164. package/dist/multistream/remoteMedia.js.map +1 -1
  165. package/dist/multistream/remoteMediaGroup.js +6 -40
  166. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  167. package/dist/multistream/remoteMediaManager.js +466 -442
  168. package/dist/multistream/remoteMediaManager.js.map +1 -1
  169. package/dist/networkQualityMonitor/index.js +40 -59
  170. package/dist/networkQualityMonitor/index.js.map +1 -1
  171. package/dist/personal-meeting-room/index.js +21 -45
  172. package/dist/personal-meeting-room/index.js.map +1 -1
  173. package/dist/personal-meeting-room/request.js +1 -31
  174. package/dist/personal-meeting-room/request.js.map +1 -1
  175. package/dist/personal-meeting-room/util.js +0 -13
  176. package/dist/personal-meeting-room/util.js.map +1 -1
  177. package/dist/reachability/index.js +192 -191
  178. package/dist/reachability/index.js.map +1 -1
  179. package/dist/reachability/request.js +15 -23
  180. package/dist/reachability/request.js.map +1 -1
  181. package/dist/reactions/constants.js +13 -0
  182. package/dist/reactions/constants.js.map +1 -0
  183. package/dist/reactions/reactions.js +109 -0
  184. package/dist/reactions/reactions.js.map +1 -0
  185. package/dist/reactions/reactions.type.js +36 -0
  186. package/dist/reactions/reactions.type.js.map +1 -0
  187. package/dist/reconnection-manager/index.js +342 -460
  188. package/dist/reconnection-manager/index.js.map +1 -1
  189. package/dist/recording-controller/enums.js +17 -0
  190. package/dist/recording-controller/enums.js.map +1 -0
  191. package/dist/recording-controller/index.js +343 -0
  192. package/dist/recording-controller/index.js.map +1 -0
  193. package/dist/recording-controller/util.js +63 -0
  194. package/dist/recording-controller/util.js.map +1 -0
  195. package/dist/roap/index.js +48 -70
  196. package/dist/roap/index.js.map +1 -1
  197. package/dist/roap/request.js +143 -131
  198. package/dist/roap/request.js.map +1 -1
  199. package/dist/roap/turnDiscovery.js +91 -98
  200. package/dist/roap/turnDiscovery.js.map +1 -1
  201. package/dist/statsAnalyzer/global.js +1 -95
  202. package/dist/statsAnalyzer/global.js.map +1 -1
  203. package/dist/statsAnalyzer/index.js +372 -455
  204. package/dist/statsAnalyzer/index.js.map +1 -1
  205. package/dist/statsAnalyzer/mqaUtil.js +143 -87
  206. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  207. package/dist/transcription/index.js +22 -47
  208. package/dist/transcription/index.js.map +1 -1
  209. package/dist/types/breakouts/breakout.d.ts +8 -0
  210. package/dist/types/breakouts/collection.d.ts +5 -0
  211. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  212. package/dist/types/breakouts/index.d.ts +5 -0
  213. package/dist/types/breakouts/request.d.ts +22 -0
  214. package/dist/types/breakouts/utils.d.ts +8 -0
  215. package/dist/types/common/browser-detection.d.ts +9 -0
  216. package/dist/types/common/collection.d.ts +48 -0
  217. package/dist/types/common/config.d.ts +2 -0
  218. package/dist/types/common/errors/captcha-error.d.ts +15 -0
  219. package/dist/types/common/errors/intent-to-join.d.ts +16 -0
  220. package/dist/types/common/errors/join-meeting.d.ts +17 -0
  221. package/dist/types/common/errors/media.d.ts +15 -0
  222. package/dist/types/common/errors/parameter.d.ts +15 -0
  223. package/dist/types/common/errors/password-error.d.ts +15 -0
  224. package/dist/types/common/errors/permission.d.ts +14 -0
  225. package/dist/types/common/errors/reconnection-in-progress.d.ts +9 -0
  226. package/dist/types/common/errors/reconnection.d.ts +15 -0
  227. package/dist/types/common/errors/stats.d.ts +15 -0
  228. package/dist/types/common/errors/webex-errors.d.ts +69 -0
  229. package/dist/types/common/errors/webex-meetings-error.d.ts +20 -0
  230. package/dist/types/common/events/events-scope.d.ts +17 -0
  231. package/dist/types/common/events/events.d.ts +12 -0
  232. package/dist/types/common/events/trigger-proxy.d.ts +2 -0
  233. package/dist/types/common/events/util.d.ts +2 -0
  234. package/dist/types/common/logs/logger-config.d.ts +2 -0
  235. package/dist/types/common/logs/logger-proxy.d.ts +2 -0
  236. package/dist/types/common/logs/request.d.ts +34 -0
  237. package/dist/types/common/queue.d.ts +32 -0
  238. package/dist/types/config.d.ts +77 -0
  239. package/dist/types/constants.d.ts +944 -0
  240. package/dist/types/controls-options-manager/constants.d.ts +4 -0
  241. package/dist/types/controls-options-manager/enums.d.ts +6 -0
  242. package/dist/types/controls-options-manager/index.d.ts +128 -0
  243. package/dist/types/controls-options-manager/util.d.ts +9 -0
  244. package/dist/types/index.d.ts +6 -0
  245. package/dist/types/locus-info/controlsUtils.d.ts +2 -0
  246. package/dist/types/locus-info/embeddedAppsUtils.d.ts +2 -0
  247. package/dist/types/locus-info/fullState.d.ts +2 -0
  248. package/dist/types/locus-info/hostUtils.d.ts +2 -0
  249. package/dist/types/locus-info/index.d.ts +276 -0
  250. package/dist/types/locus-info/infoUtils.d.ts +2 -0
  251. package/dist/types/locus-info/mediaSharesUtils.d.ts +2 -0
  252. package/dist/types/locus-info/parser.d.ts +212 -0
  253. package/dist/types/locus-info/selfUtils.d.ts +2 -0
  254. package/dist/types/media/index.d.ts +32 -0
  255. package/dist/types/media/properties.d.ts +108 -0
  256. package/dist/types/media/util.d.ts +2 -0
  257. package/dist/types/mediaQualityMetrics/config.d.ts +365 -0
  258. package/dist/types/meeting/in-meeting-actions.d.ts +101 -0
  259. package/dist/types/meeting/index.d.ts +1720 -0
  260. package/dist/types/meeting/muteState.d.ts +132 -0
  261. package/dist/types/meeting/request.d.ts +271 -0
  262. package/dist/types/meeting/request.type.d.ts +11 -0
  263. package/dist/types/meeting/state.d.ts +9 -0
  264. package/dist/types/meeting/util.d.ts +2 -0
  265. package/dist/types/meeting-info/collection.d.ts +20 -0
  266. package/dist/types/meeting-info/index.d.ts +57 -0
  267. package/dist/types/meeting-info/meeting-info-v2.d.ts +93 -0
  268. package/dist/types/meeting-info/request.d.ts +22 -0
  269. package/dist/types/meeting-info/util.d.ts +2 -0
  270. package/dist/types/meeting-info/utilv2.d.ts +2 -0
  271. package/dist/types/meetings/collection.d.ts +31 -0
  272. package/dist/types/meetings/index.d.ts +315 -0
  273. package/dist/types/meetings/request.d.ts +27 -0
  274. package/dist/types/meetings/util.d.ts +18 -0
  275. package/dist/types/member/index.d.ts +156 -0
  276. package/dist/types/member/types.d.ts +21 -0
  277. package/dist/types/member/util.d.ts +2 -0
  278. package/dist/types/members/collection.d.ts +29 -0
  279. package/dist/types/members/index.d.ts +343 -0
  280. package/dist/types/members/request.d.ts +58 -0
  281. package/dist/types/members/types.d.ts +24 -0
  282. package/dist/types/members/util.d.ts +2 -0
  283. package/dist/types/metrics/config.d.ts +171 -0
  284. package/dist/types/metrics/constants.d.ts +53 -0
  285. package/dist/types/metrics/index.d.ts +152 -0
  286. package/dist/types/multistream/mediaRequestManager.d.ts +68 -0
  287. package/dist/types/multistream/receiveSlot.d.ts +68 -0
  288. package/dist/types/multistream/receiveSlotManager.d.ts +49 -0
  289. package/dist/types/multistream/remoteMedia.d.ts +100 -0
  290. package/dist/types/multistream/remoteMediaGroup.d.ts +56 -0
  291. package/dist/types/multistream/remoteMediaManager.d.ts +263 -0
  292. package/dist/types/networkQualityMonitor/index.d.ts +70 -0
  293. package/dist/types/personal-meeting-room/index.d.ts +47 -0
  294. package/dist/types/personal-meeting-room/request.d.ts +14 -0
  295. package/dist/types/personal-meeting-room/util.d.ts +2 -0
  296. package/dist/types/reachability/index.d.ts +152 -0
  297. package/dist/types/reachability/request.d.ts +37 -0
  298. package/dist/types/reactions/constants.d.ts +3 -0
  299. package/dist/types/reactions/reactions.d.ts +4 -0
  300. package/dist/types/reactions/reactions.type.d.ts +52 -0
  301. package/dist/types/reconnection-manager/index.d.ts +126 -0
  302. package/dist/types/recording-controller/enums.d.ts +7 -0
  303. package/dist/types/recording-controller/index.d.ts +193 -0
  304. package/dist/types/recording-controller/util.d.ts +13 -0
  305. package/dist/types/roap/index.d.ts +77 -0
  306. package/dist/types/roap/request.d.ts +38 -0
  307. package/dist/types/roap/turnDiscovery.d.ts +74 -0
  308. package/dist/types/statsAnalyzer/global.d.ts +36 -0
  309. package/dist/types/statsAnalyzer/index.d.ts +195 -0
  310. package/dist/types/statsAnalyzer/mqaUtil.d.ts +24 -0
  311. package/dist/types/transcription/index.d.ts +64 -0
  312. package/internal-README.md +7 -6
  313. package/package.json +27 -21
  314. package/src/breakouts/README.md +219 -0
  315. package/src/breakouts/breakout.ts +153 -0
  316. package/src/breakouts/collection.ts +19 -0
  317. package/src/breakouts/edit-lock-error.ts +25 -0
  318. package/src/breakouts/index.ts +745 -0
  319. package/src/breakouts/request.ts +55 -0
  320. package/src/breakouts/utils.ts +44 -0
  321. package/src/common/{browser-detection.js → browser-detection.ts} +9 -6
  322. package/src/common/collection.ts +9 -7
  323. package/src/common/{config.js → config.ts} +1 -1
  324. package/src/common/errors/{captcha-error.js → captcha-error.ts} +11 -7
  325. package/src/common/errors/{intent-to-join.js → intent-to-join.ts} +12 -7
  326. package/src/common/errors/{join-meeting.js → join-meeting.ts} +17 -8
  327. package/src/common/errors/{media.js → media.ts} +11 -7
  328. package/src/common/errors/parameter.ts +11 -7
  329. package/src/common/errors/{password-error.js → password-error.ts} +11 -7
  330. package/src/common/errors/{permission.js → permission.ts} +10 -6
  331. package/src/common/errors/{reconnection.js → reconnection.ts} +11 -7
  332. package/src/common/errors/{stats.js → stats.ts} +11 -7
  333. package/src/common/errors/{webex-errors.js → webex-errors.ts} +8 -7
  334. package/src/common/errors/{webex-meetings-error.js → webex-meetings-error.ts} +4 -2
  335. package/src/common/events/{events-scope.js → events-scope.ts} +6 -2
  336. package/src/common/events/{events.js → events.ts} +5 -1
  337. package/src/common/events/{trigger-proxy.js → trigger-proxy.ts} +9 -5
  338. package/src/common/events/{util.js → util.ts} +2 -3
  339. package/src/common/logs/{logger-config.js → logger-config.ts} +1 -2
  340. package/src/common/logs/logger-proxy.ts +44 -0
  341. package/src/common/logs/{request.js → request.ts} +22 -9
  342. package/src/common/queue.ts +1 -2
  343. package/src/{config.js → config.ts} +17 -12
  344. package/src/constants.ts +92 -5
  345. package/src/controls-options-manager/constants.ts +5 -0
  346. package/src/controls-options-manager/enums.ts +7 -0
  347. package/src/controls-options-manager/index.ts +240 -0
  348. package/src/controls-options-manager/util.ts +30 -0
  349. package/src/index.js +4 -1
  350. package/src/locus-info/controlsUtils.ts +141 -0
  351. package/src/locus-info/{embeddedAppsUtils.js → embeddedAppsUtils.ts} +5 -6
  352. package/src/locus-info/{fullState.js → fullState.ts} +16 -12
  353. package/src/locus-info/{hostUtils.js → hostUtils.ts} +9 -8
  354. package/src/locus-info/{index.js → index.ts} +211 -71
  355. package/src/locus-info/{infoUtils.js → infoUtils.ts} +19 -8
  356. package/src/locus-info/{mediaSharesUtils.js → mediaSharesUtils.ts} +17 -17
  357. package/src/locus-info/{parser.js → parser.ts} +67 -79
  358. package/src/locus-info/{selfUtils.js → selfUtils.ts} +183 -67
  359. package/src/media/{index.js → index.ts} +179 -176
  360. package/src/media/{properties.js → properties.ts} +60 -37
  361. package/src/media/{util.js → util.ts} +2 -2
  362. package/src/mediaQualityMetrics/config.ts +384 -0
  363. package/src/meeting/in-meeting-actions.ts +67 -3
  364. package/src/meeting/{index.js → index.ts} +2605 -1605
  365. package/src/meeting/{muteState.js → muteState.ts} +138 -73
  366. package/src/meeting/{request.js → request.ts} +326 -142
  367. package/src/meeting/request.type.ts +13 -0
  368. package/src/meeting/{state.js → state.ts} +50 -35
  369. package/src/meeting/{util.js → util.ts} +131 -115
  370. package/src/meeting-info/{collection.js → collection.ts} +6 -2
  371. package/src/meeting-info/{index.js → index.ts} +42 -36
  372. package/src/meeting-info/meeting-info-v2.ts +273 -0
  373. package/src/meeting-info/{request.js → request.ts} +14 -4
  374. package/src/meeting-info/{util.js → util.ts} +60 -51
  375. package/src/meeting-info/{utilv2.js → utilv2.ts} +65 -58
  376. package/src/meetings/{collection.js → collection.ts} +26 -3
  377. package/src/meetings/index.ts +1275 -0
  378. package/src/meetings/{request.js → request.ts} +34 -25
  379. package/src/meetings/{util.js → util.ts} +99 -33
  380. package/src/member/{index.js → index.ts} +124 -56
  381. package/src/member/types.ts +24 -0
  382. package/src/member/{util.js → util.ts} +105 -25
  383. package/src/members/{collection.js → collection.ts} +10 -2
  384. package/src/members/{index.js → index.ts} +281 -144
  385. package/src/members/{request.js → request.ts} +80 -16
  386. package/src/members/types.ts +28 -0
  387. package/src/members/{util.js → util.ts} +108 -55
  388. package/src/metrics/{config.js → config.ts} +255 -92
  389. package/src/metrics/{constants.js → constants.ts} +0 -6
  390. package/src/metrics/{index.js → index.ts} +110 -94
  391. package/src/multistream/mediaRequestManager.ts +144 -40
  392. package/src/multistream/receiveSlot.ts +69 -26
  393. package/src/multistream/receiveSlotManager.ts +50 -38
  394. package/src/multistream/remoteMedia.ts +30 -4
  395. package/src/multistream/remoteMediaGroup.ts +4 -3
  396. package/src/multistream/remoteMediaManager.ts +230 -66
  397. package/src/networkQualityMonitor/{index.js → index.ts} +41 -29
  398. package/src/personal-meeting-room/{index.js → index.ts} +28 -19
  399. package/src/personal-meeting-room/{request.js → request.ts} +13 -4
  400. package/src/personal-meeting-room/{util.js → util.ts} +4 -4
  401. package/src/reachability/{index.js → index.ts} +157 -94
  402. package/src/reachability/request.ts +46 -35
  403. package/src/reactions/constants.ts +4 -0
  404. package/src/reactions/reactions.ts +104 -0
  405. package/src/reactions/reactions.type.ts +62 -0
  406. package/src/reconnection-manager/{index.js → index.ts} +228 -120
  407. package/src/recording-controller/enums.ts +8 -0
  408. package/src/recording-controller/index.ts +315 -0
  409. package/src/recording-controller/util.ts +58 -0
  410. package/src/roap/{index.js → index.ts} +77 -60
  411. package/src/roap/request.ts +172 -0
  412. package/src/roap/turnDiscovery.ts +81 -41
  413. package/src/statsAnalyzer/global.ts +37 -0
  414. package/src/statsAnalyzer/index.ts +1242 -0
  415. package/src/statsAnalyzer/mqaUtil.ts +291 -0
  416. package/src/transcription/{index.js → index.ts} +46 -39
  417. package/test/integration/spec/converged-space-meetings.js +176 -0
  418. package/test/integration/spec/journey.js +665 -464
  419. package/test/integration/spec/space-meeting.js +320 -206
  420. package/test/integration/spec/transcription.js +7 -8
  421. package/test/unit/spec/breakouts/breakout.ts +178 -0
  422. package/test/unit/spec/breakouts/collection.ts +15 -0
  423. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  424. package/test/unit/spec/breakouts/index.ts +1252 -0
  425. package/test/unit/spec/breakouts/request.ts +104 -0
  426. package/test/unit/spec/breakouts/utils.js +54 -0
  427. package/test/unit/spec/common/browser-detection.js +9 -28
  428. package/test/unit/spec/controls-options-manager/index.js +204 -0
  429. package/test/unit/spec/controls-options-manager/util.js +86 -0
  430. package/test/unit/spec/fixture/locus.js +92 -90
  431. package/test/unit/spec/locus-info/controlsUtils.js +133 -34
  432. package/test/unit/spec/locus-info/embeddedAppsUtils.js +8 -6
  433. package/test/unit/spec/locus-info/index.js +303 -2
  434. package/test/unit/spec/locus-info/infoUtils.js +41 -32
  435. package/test/unit/spec/locus-info/lib/BasicSeqCmp.json +88 -430
  436. package/test/unit/spec/locus-info/lib/SeqCmp.json +513 -685
  437. package/test/unit/spec/locus-info/parser.js +3 -9
  438. package/test/unit/spec/locus-info/selfConstant.js +101 -103
  439. package/test/unit/spec/locus-info/selfUtils.js +165 -12
  440. package/test/unit/spec/media/index.ts +72 -8
  441. package/test/unit/spec/media/properties.ts +9 -9
  442. package/test/unit/spec/meeting/in-meeting-actions.ts +29 -2
  443. package/test/unit/spec/meeting/index.js +2503 -802
  444. package/test/unit/spec/meeting/muteState.js +146 -61
  445. package/test/unit/spec/meeting/request.js +141 -43
  446. package/test/unit/spec/meeting/utils.js +135 -164
  447. package/test/unit/spec/meeting-info/meetinginfov2.js +100 -73
  448. package/test/unit/spec/meeting-info/request.js +7 -9
  449. package/test/unit/spec/meeting-info/util.js +11 -12
  450. package/test/unit/spec/meeting-info/utilv2.js +110 -74
  451. package/test/unit/spec/meetings/collection.js +15 -1
  452. package/test/unit/spec/meetings/index.js +622 -263
  453. package/test/unit/spec/meetings/utils.js +65 -14
  454. package/test/unit/spec/member/index.js +24 -1
  455. package/test/unit/spec/member/util.js +359 -32
  456. package/test/unit/spec/members/index.js +294 -54
  457. package/test/unit/spec/members/request.js +50 -20
  458. package/test/unit/spec/members/utils.js +147 -4
  459. package/test/unit/spec/metrics/index.js +16 -21
  460. package/test/unit/spec/multistream/mediaRequestManager.ts +369 -68
  461. package/test/unit/spec/multistream/receiveSlot.ts +76 -17
  462. package/test/unit/spec/multistream/receiveSlotManager.ts +60 -38
  463. package/test/unit/spec/multistream/remoteMedia.ts +32 -2
  464. package/test/unit/spec/multistream/remoteMediaGroup.ts +5 -5
  465. package/test/unit/spec/multistream/remoteMediaManager.ts +549 -65
  466. package/test/unit/spec/networkQualityMonitor/index.js +24 -18
  467. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -7
  468. package/test/unit/spec/reachability/index.ts +176 -27
  469. package/test/unit/spec/reachability/request.js +66 -0
  470. package/test/unit/spec/reconnection-manager/index.js +58 -30
  471. package/test/unit/spec/recording-controller/index.js +231 -0
  472. package/test/unit/spec/recording-controller/util.js +102 -0
  473. package/test/unit/spec/roap/index.ts +12 -8
  474. package/test/unit/spec/roap/request.ts +217 -0
  475. package/test/unit/spec/roap/turnDiscovery.ts +72 -49
  476. package/test/unit/spec/stats-analyzer/index.js +108 -57
  477. package/test/utils/cmr.js +44 -42
  478. package/test/utils/constants.js +9 -0
  479. package/test/utils/testUtils.js +98 -77
  480. package/test/utils/webex-config.js +22 -18
  481. package/test/utils/webex-test-users.js +57 -50
  482. package/tsconfig.json +6 -0
  483. package/dist/media/internal-media-core-wrapper.js +0 -22
  484. package/dist/media/internal-media-core-wrapper.js.map +0 -1
  485. package/dist/meeting/effectsState.js +0 -327
  486. package/dist/meeting/effectsState.js.map +0 -1
  487. package/dist/multistream/multistreamMedia.js +0 -116
  488. package/dist/multistream/multistreamMedia.js.map +0 -1
  489. package/dist/peer-connection-manager/util.js +0 -124
  490. package/dist/peer-connection-manager/util.js.map +0 -1
  491. package/src/common/logs/logger-proxy.js +0 -33
  492. package/src/locus-info/controlsUtils.js +0 -102
  493. package/src/media/internal-media-core-wrapper.ts +0 -9
  494. package/src/mediaQualityMetrics/config.js +0 -382
  495. package/src/meeting/effectsState.js +0 -205
  496. package/src/meeting-info/meeting-info-v2.js +0 -255
  497. package/src/meetings/index.js +0 -1015
  498. package/src/multistream/multistreamMedia.ts +0 -92
  499. package/src/peer-connection-manager/util.ts +0 -117
  500. package/src/roap/request.js +0 -127
  501. package/src/statsAnalyzer/global.js +0 -133
  502. package/src/statsAnalyzer/index.js +0 -1006
  503. package/src/statsAnalyzer/mqaUtil.js +0 -173
  504. package/test/unit/spec/meeting/effectsState.js +0 -291
  505. package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +0 -389
  506. /package/src/common/errors/{reconnection-in-progress.js → reconnection-in-progress.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["Parser","queue","SimpleQueue","status","IDLE","onDeltaAction","workingCopy","newLoci","isValid","isLoci","setStatus","LoggerProxy","logger","info","PAUSED","size","processDeltaEvent","action","locus","loci","enqueue","WORKING","DESYNC","USE_INCOMING","extract","extractComparisonState","dequeue","isValidLocus","result","compare","lociComparison","debug","pause","call","nextEvent","current","incoming","comparison","min","max","GT","LT","currentIsNotUnique","unique","length","incomingIsNotUnique","currentTotalRange","end","incomingTotalRange","EQ","currentIsUnique","incomingIsUnique","currentUniqueMin","incomingUniqueMin","currentHasNoRange","start","incomingHasNoRange","neitherSeqHasRange","hasUniqOverlap","list","some","seq","currentUniqOverlap","incomingUniqOverlap","debugInfo","isSequenceEmpty","pack","packComparisonResult","baseSequence","compareDelta","compareSequence","sequence","compareToAction","local","getMetaData","delta","getUniqueSequences","rules","checkSequenceOverlap","checkUnequalRanges","checkForUniqueEntries","checkIfOutOfSync","rule","ERROR","USE_CURRENT","lociComparisonResult","split","entries","first","last","slice","rangeStart","rangeEnd","baseLoci","otherLoci","diff","getNumbersOutOfRange","output","filter","num","sort","a","b","hasEmptyEntries","hasEmptyRange","hasProp","prop","Object","prototype","hasOwnProperty","newData","oldData","debugCode","mStr","strings","join","replace","resolutionMap","debugMap","SO001","title","description","logic","SO002","UR001","UR002","UR003","UE001","UE002","OOS001","OOS002","OOS003","debugObj","resolution"],"sources":["parser.js"],"sourcesContent":["import {difference} from 'lodash';\n\nimport SimpleQueue from '../common/queue';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\n/**\n * Locus Delta Parser\n * @private\n * https://sqbu-github.cisco.com/WebExSquared/cloud-apps/wiki/Locus-Delta-Events\n */\nexport default class Parser {\n // processing status\n static status = {\n IDLE: 'IDLE',\n PAUSED: 'PAUSED',\n WORKING: 'WORKING'\n };\n\n // loci comparison states\n static loci = {\n EQ: 'EQUAL',\n GT: 'GREATER_THAN',\n LT: 'LESS_THAN',\n DESYNC: 'DESYNC',\n USE_INCOMING: 'USE_INCOMING',\n USE_CURRENT: 'USE_CURRENT',\n ERROR: 'ERROR'\n };\n\n\n /**\n * @constructs Parser\n */\n constructor() {\n this.queue = new SimpleQueue();\n this.status = Parser.status.IDLE;\n this.onDeltaAction = null;\n this.workingCopy = null;\n }\n\n\n /**\n * Checks if two sequences overlap in time,\n * the sequence with the higher minimum value is greater.\n * Chooses sequence with most recent data.\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {string} loci comparison state\n */\n static checkSequenceOverlap(current, incoming) {\n let comparison = null;\n\n // if earliest working copy sequence is more recent than last incoming sequence\n if (current.min > incoming.max) {\n // choose left side (current)\n comparison = `${Parser.loci.GT}:SO001`;\n }\n // if last working copy sequence is before the earliest incoming sequence\n else if (current.max < incoming.min) {\n // choose right side (incoming)\n comparison = `${Parser.loci.LT}:SO002`;\n }\n\n // if no match above, defaults to null\n return comparison;\n }\n\n\n /**\n * Checks if two sequences have unequal ranges.\n * Chooses sequence with most larger range.\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {object} loci comparison\n */\n static checkUnequalRanges(current, incoming) {\n let comparison = null;\n const currentIsNotUnique = current.unique.length === 0;\n const incomingIsNotUnique = incoming.unique.length === 0;\n const currentTotalRange = current.end - current.min;\n const incomingTotalRange = incoming.end - incoming.min;\n\n // no unique values for both loci\n if (currentIsNotUnique && incomingIsNotUnique) {\n // current working copy loci has a larger range\n if (currentTotalRange > incomingTotalRange) {\n // choose left side (current)\n comparison = `${Parser.loci.GT}:UR001`;\n }\n // incoming delta loci has a larger range\n else if (currentTotalRange < incomingTotalRange) {\n // choose right side (incoming)\n comparison = `${Parser.loci.LT}:UR002`;\n }\n else {\n // with no unique entries and with ranges either absent or\n // of the same size, the sequences are considered equal.\n comparison = `${Parser.loci.EQ}:UR003`;\n }\n }\n\n return comparison;\n }\n\n\n /**\n * Checks if either sequences has unique entries.\n * Entries are considered unique if they do not overlap\n * with other Loci sequences or range values.\n * Chooses sequence with the unique entries.\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {string} loci comparison state\n */\n static checkForUniqueEntries(current, incoming) {\n let comparison = null;\n const currentIsUnique = current.unique.length > 0;\n const incomingIsUnique = incoming.unique.length > 0;\n\n // current has unique entries and incoming does not\n if (currentIsUnique && !incomingIsUnique) {\n // choose left side (current)\n comparison = `${Parser.loci.GT}:UE001`;\n }\n // current has no unique entries but incoming does\n else if (!currentIsUnique && incomingIsUnique) {\n // choose right side (incoming)\n comparison = `${Parser.loci.LT}:UE002`;\n }\n\n return comparison;\n }\n\n\n /**\n * Checks both Locus Delta objects to see if they are\n * out of sync with one another. If so sends a DESYNC\n * request to the server.\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {string} loci comparison state\n */\n static checkIfOutOfSync(current, incoming) {\n let comparison = null;\n const currentUniqueMin = current.unique[0];\n const incomingUniqueMin = incoming.unique[0];\n\n const currentHasNoRange = !current.start && !current.end;\n const incomingHasNoRange = !incoming.start && !incoming.end;\n const neitherSeqHasRange = currentHasNoRange && incomingHasNoRange;\n\n const hasUniqOverlap = (list, min, max) => list.some((seq) => min < seq && seq < max);\n // current unique entries overlap the total range of incoming\n const currentUniqOverlap = hasUniqOverlap(current.unique, incoming.min, incoming.max);\n // vice-versa, incoming unique entries overlap the total range of current\n const incomingUniqOverlap = hasUniqOverlap(incoming.unique, current.min, current.max);\n\n if (neitherSeqHasRange || currentUniqOverlap || incomingUniqOverlap) {\n // outputs string indicating which condition occurred. ex: 0,1,0\n const debugInfo = `${+neitherSeqHasRange},${+currentUniqOverlap},${+incomingUniqOverlap}`;\n\n // send DESYNC to server\n comparison = `${Parser.loci.DESYNC}:OOS001:${debugInfo}`;\n }\n else if (currentUniqueMin > incomingUniqueMin) {\n // choose left side (current)\n comparison = `${Parser.loci.GT}:OOS002`;\n }\n else {\n // choose right side (incoming)\n comparison = `${Parser.loci.LT}:OOS003`;\n }\n\n return comparison;\n }\n\n\n /**\n * Compares two loci to determine which one contains the most recent state\n * @instance\n * @memberof Locus\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {string} loci comparison state\n */\n static compare(current, incoming) {\n const {isSequenceEmpty} = Parser;\n const {extractComparisonState: extract} = Parser;\n const {packComparisonResult: pack} = Parser;\n\n\n if (isSequenceEmpty(current) || isSequenceEmpty(incoming)) {\n return pack(Parser.loci.USE_INCOMING, 'C001');\n }\n\n if (incoming.baseSequence) {\n return pack(Parser.compareDelta(current, incoming), 'C002');\n }\n\n const result = Parser.compareSequence(current.sequence, incoming.sequence);\n const action = Parser.compareToAction(extract(result));\n\n return pack(action, result);\n }\n\n\n /**\n * Compares two loci sequences (with delta params) and indicates what action\n * to take.\n * @instance\n * @memberof Locus\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @private\n * @returns {string} loci comparison state\n */\n static compareDelta(current, incoming) {\n const {\n LT, GT, EQ, DESYNC, USE_INCOMING\n } = Parser.loci;\n const {extractComparisonState: extract} = Parser;\n const {packComparisonResult: pack} = Parser;\n\n const result = Parser.compareSequence(current.sequence, incoming.sequence);\n let comparison = extract(result);\n\n\n if (comparison !== LT) {\n return pack(Parser.compareToAction(comparison), result);\n }\n\n comparison = Parser.compareSequence(current.sequence, incoming.baseSequence);\n\n switch (extract(comparison)) {\n case GT:\n case EQ:\n comparison = USE_INCOMING;\n break;\n\n default:\n comparison = DESYNC;\n }\n\n return pack(comparison, result);\n }\n\n\n /**\n * Compares Locus sequences\n * @param {Types~Locus} current Current working copy\n * @param {Types~Locus} incoming New Locus delta\n * @returns {string}\n */\n static compareSequence(current, incoming) {\n // Locus sequence comparison rules in order of priority.\n // https://sqbu-github.cisco.com/WebExSquared/cloud-apps/wiki/Locus-Sequence-Comparison-Algorithm\n\n const local = Parser.getMetaData(current);\n const delta = Parser.getMetaData(incoming);\n\n // update loci metadata\n local.unique = Parser.getUniqueSequences(local, delta);\n delta.unique = Parser.getUniqueSequences(delta, local);\n\n // Locus sequence comparison rules\n // order matters\n const rules = [\n Parser.checkSequenceOverlap,\n Parser.checkUnequalRanges,\n Parser.checkForUniqueEntries,\n Parser.checkIfOutOfSync\n ];\n\n for (const rule of rules) {\n // Rule only returns a value if the rule applies,\n // otherwise returns null.\n const result = rule(local, delta);\n\n if (result) {\n return result;\n }\n }\n\n // error, none of rules above applied\n // should never get here as last rule\n // should be catch all.\n return Parser.loci.ERROR;\n }\n\n\n /**\n * Transates the result of a sequence comparison into an intended behavior\n * @param {string} result\n * @returns {string} Locus comparison action\n */\n static compareToAction(result) {\n const {\n DESYNC, EQ, ERROR, GT, LT, USE_CURRENT, USE_INCOMING\n } = Parser.loci;\n\n let action = ERROR;\n\n switch (result) {\n case EQ:\n case GT:\n action = USE_CURRENT;\n break;\n case LT:\n action = USE_INCOMING;\n break;\n case DESYNC:\n action = DESYNC;\n break;\n default:\n LoggerProxy.logger.info(`Locus-info:parser#compareToAction --> Error: ${result} is not a recognized sequence comparison result.`);\n }\n\n return action;\n }\n\n\n /**\n * Extracts a loci comparison from a string of data.\n * @param {string} lociComparisonResult Comparison result with extra data\n * @returns {string} Comparison of EQ, LT, GT, or DESYNC.\n */\n static extractComparisonState(lociComparisonResult) {\n return lociComparisonResult.split(':')[0];\n }\n\n\n /**\n * @typedef {object} LociMetadata\n * @property {number} start - Starting sequence number\n * @property {number} end - Ending sequence number\n * @property {number} first - First sequence number\n * @property {number} last - Last sequence number\n * @property {number} min - Minimum sequence number\n * @property {number} max - Maximum sequence number\n * @property {number} entries - Loci sequence entries\n */\n\n /**\n * Metadata for Locus delta\n * @param {Array.<number>} sequence Locus delta sequence\n * @returns {LociMetadata} Locus Delta Metadata\n */\n static getMetaData(sequence) {\n const {entries} = sequence;\n const first = entries[0];\n const last = entries.slice(-1)[0];\n\n // rangeStart or rangeEnd is 0 if a range doesn't exist\n const start = sequence.rangeStart;\n const end = sequence.rangeEnd;\n\n // sequence data\n return {\n start,\n end,\n first,\n last,\n // Rule is: rangeStart <= rangeEnd <= min(entries)\n min: start || first,\n // Grab last entry if exist else default to rangeEnd\n max: last || end,\n // keep reference to actual sequence entries\n entries\n };\n }\n\n\n /**\n * Compares two Locus delta objects and notes unique\n * values contained within baseLoci.\n * @param {LociMetadata} baseLoci\n * @param {LociMetadata} otherLoci\n * @returns {Array.<number>} List of unique sequences\n */\n static getUniqueSequences(baseLoci, otherLoci) {\n const diff = difference(\n baseLoci.entries,\n otherLoci.entries\n );\n const {start, end} = otherLoci;\n\n return Parser.getNumbersOutOfRange(diff, start, end);\n }\n\n\n /**\n * Returns an array of numbers outside of a given range.\n * @param {Array.<number>} list Array to filter\n * @param {number} rangeStart Start of range\n * @param {number} rangeEnd End of range\n * @returns {Array.<number>} Array of numbers sorted ASC\n */\n static getNumbersOutOfRange(list, rangeStart, rangeEnd) {\n // Collect all numbers if number is outside of specified range\n const output = list.filter((num) => num < rangeStart || num > rangeEnd);\n\n // sort ascending\n return output.sort((a, b) => a - b);\n }\n\n\n /**\n * Checks if newLoci or workingCopy is invalid.\n * @param {Types~Locus} newLoci\n * @returns {boolean}\n */\n isValidLocus(newLoci) {\n let isValid = false;\n const {IDLE} = Parser.status;\n const {isLoci} = Parser;\n const setStatus = (status) => { this.status = status; };\n\n // one or both objects are not locus delta events\n if (!isLoci(this.workingCopy) || !isLoci(newLoci)) {\n setStatus(IDLE);\n LoggerProxy.logger.info('Locus-info:parser#processDeltaEvent --> Ignoring non-locus object. workingCopy:', this.workingCopy, 'newLoci:', newLoci);\n }\n else {\n isValid = true;\n }\n\n return isValid;\n }\n\n\n /**\n * Determines if a paricular locus's sequence is empty\n * @param {Types~Locus} locus\n * @returns {bool}\n */\n static isSequenceEmpty(locus) {\n const {sequence} = locus;\n const hasEmptyEntries = !sequence.entries?.length;\n const hasEmptyRange = sequence.rangeStart === 0 && sequence.rangeEnd === 0;\n\n return hasEmptyEntries && hasEmptyRange;\n }\n\n\n /**\n * Determines if an object has basic\n * structure of a locus object.\n * @param {Types~Locus} loci\n * @returns {boolean}\n */\n static isLoci(loci) {\n if (!loci || !loci.sequence) {\n return false;\n }\n const hasProp = (prop) =>\n Object.prototype.hasOwnProperty.call(loci.sequence, prop);\n\n if (hasProp('rangeStart') && hasProp('rangeEnd')) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Processes next event in queue,\n * if queue is empty sets status to idle.\n * @returns {undefined}\n */\n nextEvent() {\n if (this.status === Parser.status.PAUSED) {\n LoggerProxy.logger.info('Locus-info:parser#nextEvent --> Locus parser paused.');\n\n return;\n }\n\n // continue processing until queue is empty\n if (this.queue.size() > 0) {\n this.processDeltaEvent();\n }\n else {\n this.status = Parser.status.IDLE;\n }\n }\n\n\n /**\n * Function handler for delta actions,\n * is set by instance callee.\n * @param {string} action Locus delta action\n * @param {Types~Locus} locus Locus delta\n * @returns {undefined}\n */\n // eslint-disable-next-line no-unused-vars\n onDeltaAction(action, locus) {}\n\n\n /**\n * Event handler for locus delta events\n * @param {Types~Locus} loci Locus Delta\n * @returns {undefined}\n */\n onDeltaEvent(loci) {\n // enqueue the new loci\n this.queue.enqueue(loci);\n // start processing events in the queue if idle\n // and a function handler is defined\n if (this.status === Parser.status.IDLE && this.onDeltaAction) {\n // Update status, ensure we only process one event at a time.\n this.status = Parser.status.WORKING;\n\n this.processDeltaEvent();\n }\n }\n\n\n /**\n * Appends new data onto a string of existing data.\n * @param {string} newData\n * @param {string} oldData\n * @returns {string}\n */\n static packComparisonResult(newData, oldData) {\n return `${newData}:${oldData}`;\n }\n\n\n /**\n * Pause locus processing\n * @returns {undefined}\n */\n pause() {\n this.status = Parser.status.PAUSED;\n LoggerProxy.logger.info('Locus-info:parser#pause --> Locus parser paused.');\n }\n\n\n /**\n * Processes next locus delta in the queue,\n * continues until the queue is empty\n * or cleared.\n * @returns {undefined}\n */\n processDeltaEvent() {\n const {DESYNC, USE_INCOMING} = Parser.loci;\n const {extractComparisonState: extract} = Parser;\n const newLoci = this.queue.dequeue();\n\n if (!this.isValidLocus(newLoci)) {\n return;\n }\n\n const result = Parser.compare(this.workingCopy, newLoci);\n const lociComparison = extract(result);\n\n // limited debugging, use chrome extension\n // for full debugging.\n LoggerProxy.logger.debug(`Locus-info:parser#processDeltaEvent --> Locus Debug: ${result}`);\n\n if (lociComparison === DESYNC) {\n // wait for desync response\n this.pause();\n }\n else if (lociComparison === USE_INCOMING) {\n // update working copy for future comparisons.\n // Note: The working copy of parser gets updated in .onFullLocus()\n // and here when USE_INCOMING locus.\n this.workingCopy = newLoci;\n }\n\n if (this.onDeltaAction) {\n LoggerProxy.logger.info(`Locus-info:parser#processDeltaEvent --> Locus Delta Action: ${lociComparison}`);\n this.onDeltaAction.call(this, lociComparison, newLoci);\n }\n\n this.nextEvent();\n }\n\n\n /**\n * Resume from a paused state\n * @returns {undefined}\n */\n resume() {\n LoggerProxy.logger.info('Locus-info:parser#resume --> Locus parser resumed.');\n this.status = Parser.status.WORKING;\n this.nextEvent();\n }\n\n\n /**\n * Gets related debug info for given error code\n * @param {string} debugCode Debug code\n * @param {string} comparison Locus comparison string\n * @returns {object} Debug message\n */\n static getDebugMessage(debugCode, comparison) {\n // removes extra spaces from multiline string\n const mStr = (strings) => strings.join('').replace(/\\s{2,}/g, ' ');\n\n const resolutionMap = {\n EQ: `${Parser.loci.LT}: is equal (current == incoming).`,\n LT: `${Parser.loci.LT}: choose right side (incoming).`,\n GT: `${Parser.loci.GT}: choose left side (current).`\n };\n\n const debugMap = {\n SO001: {\n title: 'checkSequenceOverlap-001',\n description: mStr`Occurs if earliest working copy sequence is more \\\n recent than last incoming sequence.`,\n logic: 'current.min > incoming.max'\n },\n\n SO002: {\n title: 'checkSequenceOverlap-002',\n description: mStr`Occurs if last working copy sequence is before the \\\n earliest incoming sequence.`,\n logic: 'current.max < incoming.min'\n },\n\n UR001: {\n title: 'checkUnequalRanges-001',\n description: mStr`Occurs if there are no unique values for both loci, \\\n and the current working copy loci has a larger range.`,\n logic: 'currentTotalRange > incomingTotalRange'\n },\n\n UR002: {\n title: 'checkUnequalRanges-002',\n description: mStr`Occurs if there are no unique values for both loci, \\\n and the incoming delta loci has a larger range.`,\n logic: 'currentTotalRange < incomingTotalRange'\n },\n\n UR003: {\n title: 'checkUnequalRanges-003',\n description: mStr`Occurs if there are no unique values for both loci, \\\n and with ranges either absent or of the same size, the sequences \\\n are considered equal.`,\n logic: 'currentTotalRange == incomingTotalRange'\n },\n\n UE001: {\n title: 'checkForUniqueEntries-001',\n description: mStr`Occurs if current loci has unique entries and \\\n incoming does not. Entries are considered unique if they \\\n do not overlap with other Loci sequences or range values.`,\n logic: 'currentIsUnique && !incomingIsUnique'\n },\n\n UE002: {\n title: 'checkForUniqueEntries-002',\n description: mStr`Occurs if current has no unique entries but \\\n incoming does. Entries are considered unique if they \\\n do not overlap with other Loci sequences or range values.`,\n logic: '!currentIsUnique && incomingIsUnique'\n },\n\n OOS001: {\n title: 'checkIfOutOfSync-001',\n description: mStr`Occurs if neither sequence has a range, or \\\n if the current loci unique entries overlap the total range of the \\\n incoming sequence, or if the incoming unique entries overlap \\\n the total range of current sequence.`,\n logic: 'neitherSeqHasRange || currentUniqOverlap || incomingUniqOverlap'\n },\n\n OOS002: {\n title: 'checkIfOutOfSync-002',\n description: mStr`Occurs if the minimum value from sequences that are \\\n unique to the current loci is greater than the minimum value from \\\n sequences that are unique to the incoming loci.`,\n logic: 'currentUniqueMin > incomingUniqueMin'\n },\n\n OOS003: {\n title: 'checkIfOutOfSync-003',\n description: mStr`Occurs if none of the comparison rules applied. \\\n It is a catch all.`,\n logic: 'else (catch all)'\n }\n };\n\n const debugObj = debugMap[debugCode];\n\n debugObj.title = `Debug: ${debugObj.title}`;\n debugObj.resolution = resolutionMap[comparison];\n\n return debugObj;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;;;AAEA;AACA;AACA;AACA;AACA;IACqBA,M;EACnB;EAOA;;EAYA;AACF;AACA;EACE,kBAAc;IAAA;IACZ,KAAKC,KAAL,GAAa,IAAIC,cAAJ,EAAb;IACA,KAAKC,MAAL,GAAcH,MAAM,CAACG,MAAP,CAAcC,IAA5B;IACA,KAAKC,aAAL,GAAqB,IAArB;IACA,KAAKC,WAAL,GAAmB,IAAnB;EACD;EAGD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;IAsWE;AACF;AACA;AACA;AACA;IACE,sBAAaC,OAAb,EAAsB;MAAA;;MACpB,IAAIC,OAAO,GAAG,KAAd;MACA,IAAOJ,IAAP,GAAeJ,MAAM,CAACG,MAAtB,CAAOC,IAAP;MACA,IAAOK,MAAP,GAAiBT,MAAjB,CAAOS,MAAP;;MACA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACP,MAAD,EAAY;QAAE,KAAI,CAACA,MAAL,GAAcA,MAAd;MAAuB,CAAvD,CAJoB,CAMpB;;;MACA,IAAI,CAACM,MAAM,CAAC,KAAKH,WAAN,CAAP,IAA6B,CAACG,MAAM,CAACF,OAAD,CAAxC,EAAmD;QACjDG,SAAS,CAACN,IAAD,CAAT;;QACAO,oBAAA,CAAYC,MAAZ,CAAmBC,IAAnB,CAAwB,iFAAxB,EAA2G,KAAKP,WAAhH,EAA6H,UAA7H,EAAyIC,OAAzI;MACD,CAHD,MAIK;QACHC,OAAO,GAAG,IAAV;MACD;;MAED,OAAOA,OAAP;IACD;IAGD;AACF;AACA;AACA;AACA;;;;;IA8BE;AACF;AACA;AACA;AACA;IACE,qBAAY;MACV,IAAI,KAAKL,MAAL,KAAgBH,MAAM,CAACG,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EAAER,IAAF,+bAFN;UAKLS,KAAK,EAAE;QALF,CA7CQ;QAqDfO,MAAM,EAAE;UACNT,KAAK,EAAE,sBADD;UAENC,WAAW,EAAER,IAAF,+jBAFL;UAMNS,KAAK,EAAE;QAND,CArDO;QA8DfQ,MAAM,EAAE;UACNV,KAAK,EAAE,sBADD;UAENC,WAAW,EAAER,IAAF,qdAFL;UAKNS,KAAK,EAAE;QALD,CA9DO;QAsEfS,MAAM,EAAE;UACNX,KAAK,EAAE,sBADD;UAENC,WAAW,EAAER,IAAF,yPAFL;UAINS,KAAK,EAAE;QAJD;MAtEO,CAAjB;MA8EA,IAAMU,QAAQ,GAAGd,QAAQ,CAACN,SAAD,CAAzB;MAEAoB,QAAQ,CAACZ,KAAT,oBAA2BY,QAAQ,CAACZ,KAApC;MACAY,QAAQ,CAACC,UAAT,GAAsBhB,aAAa,CAAChF,UAAD,CAAnC;MAEA,OAAO+F,QAAP;IACD;;;;;;8BAxqBkBpI,M,YAEH;EACdI,IAAI,EAAE,MADQ;EAEdU,MAAM,EAAE,QAFM;EAGdO,OAAO,EAAE;AAHK,C;8BAFGrB,M,UASL;EACZiD,EAAE,EAAE,OADQ;EAEZT,EAAE,EAAE,cAFQ;EAGZC,EAAE,EAAE,WAHQ;EAIZnB,MAAM,EAAE,QAJI;EAKZC,YAAY,EAAE,cALF;EAMZ6D,WAAW,EAAE,aAND;EAOZD,KAAK,EAAE;AAPK,C"}
1
+ {"version":3,"names":["Parser","queue","SimpleQueue","status","IDLE","onDeltaAction","workingCopy","newLoci","isValid","isLoci","setStatus","LoggerProxy","logger","info","PAUSED","size","processDeltaEvent","action","locus","loci","enqueue","WORKING","DESYNC","USE_INCOMING","extract","extractComparisonState","dequeue","isValidLocus","result","compare","lociComparison","debug","pause","call","nextEvent","current","incoming","comparison","min","max","GT","LT","currentIsNotUnique","unique","length","incomingIsNotUnique","currentTotalRange","end","incomingTotalRange","EQ","currentIsUnique","incomingIsUnique","currentUniqueMin","incomingUniqueMin","currentHasNoRange","start","incomingHasNoRange","neitherSeqHasRange","hasUniqOverlap","list","some","seq","currentUniqOverlap","incomingUniqOverlap","debugInfo","isSequenceEmpty","pack","packComparisonResult","baseSequence","compareDelta","compareSequence","sequence","compareToAction","local","getMetaData","delta","getUniqueSequences","rules","checkSequenceOverlap","checkUnequalRanges","checkForUniqueEntries","checkIfOutOfSync","rule","ERROR","USE_CURRENT","lociComparisonResult","split","entries","first","last","slice","rangeStart","rangeEnd","baseLoci","otherLoci","diff","getNumbersOutOfRange","output","filter","num","sort","a","b","hasEmptyEntries","hasEmptyRange","hasProp","prop","Object","prototype","hasOwnProperty","newData","oldData","debugCode","mStr","strings","join","replace","resolutionMap","debugMap","SO001","title","description","logic","SO002","UR001","UR002","UR003","UE001","UE002","OOS001","OOS002","OOS003","debugObj","resolution"],"sources":["parser.ts"],"sourcesContent":["import {difference} from 'lodash';\n\nimport SimpleQueue from '../common/queue';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\n/**\n * Locus Delta Parser\n * @private\n * https://sqbu-github.cisco.com/WebExSquared/cloud-apps/wiki/Locus-Delta-Events\n */\nexport default class Parser {\n // processing status\n static status = {\n IDLE: 'IDLE',\n PAUSED: 'PAUSED',\n WORKING: 'WORKING',\n };\n\n // loci comparison states\n static loci = {\n EQ: 'EQUAL',\n GT: 'GREATER_THAN',\n LT: 'LESS_THAN',\n DESYNC: 'DESYNC',\n USE_INCOMING: 'USE_INCOMING',\n USE_CURRENT: 'USE_CURRENT',\n ERROR: 'ERROR',\n };\n\n queue: any;\n workingCopy: any;\n\n /**\n * @constructs Parser\n */\n constructor() {\n this.queue = new SimpleQueue();\n // @ts-ignore - This is declared as static class member and again being initialized here from same\n this.status = Parser.status.IDLE;\n this.onDeltaAction = null;\n this.workingCopy = null;\n }\n\n /**\n * Checks if two sequences overlap in time,\n * the sequence with the higher minimum value is greater.\n * Chooses sequence with most recent data.\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {string} loci comparison state\n */\n static checkSequenceOverlap(current, incoming) {\n let comparison = null;\n\n // if earliest working copy sequence is more recent than last incoming sequence\n if (current.min > incoming.max) {\n // choose left side (current)\n comparison = `${Parser.loci.GT}:SO001`;\n }\n // if last working copy sequence is before the earliest incoming sequence\n else if (current.max < incoming.min) {\n // choose right side (incoming)\n comparison = `${Parser.loci.LT}:SO002`;\n }\n\n // if no match above, defaults to null\n return comparison;\n }\n\n /**\n * Checks if two sequences have unequal ranges.\n * Chooses sequence with most larger range.\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {object} loci comparison\n */\n static checkUnequalRanges(current, incoming) {\n let comparison = null;\n const currentIsNotUnique = current.unique.length === 0;\n const incomingIsNotUnique = incoming.unique.length === 0;\n const currentTotalRange = current.end - current.min;\n const incomingTotalRange = incoming.end - incoming.min;\n\n // no unique values for both loci\n if (currentIsNotUnique && incomingIsNotUnique) {\n // current working copy loci has a larger range\n if (currentTotalRange > incomingTotalRange) {\n // choose left side (current)\n comparison = `${Parser.loci.GT}:UR001`;\n }\n // incoming delta loci has a larger range\n else if (currentTotalRange < incomingTotalRange) {\n // choose right side (incoming)\n comparison = `${Parser.loci.LT}:UR002`;\n } else {\n // with no unique entries and with ranges either absent or\n // of the same size, the sequences are considered equal.\n comparison = `${Parser.loci.EQ}:UR003`;\n }\n }\n\n return comparison;\n }\n\n /**\n * Checks if either sequences has unique entries.\n * Entries are considered unique if they do not overlap\n * with other Loci sequences or range values.\n * Chooses sequence with the unique entries.\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {string} loci comparison state\n */\n static checkForUniqueEntries(current, incoming) {\n let comparison = null;\n const currentIsUnique = current.unique.length > 0;\n const incomingIsUnique = incoming.unique.length > 0;\n\n // current has unique entries and incoming does not\n if (currentIsUnique && !incomingIsUnique) {\n // choose left side (current)\n comparison = `${Parser.loci.GT}:UE001`;\n }\n // current has no unique entries but incoming does\n else if (!currentIsUnique && incomingIsUnique) {\n // choose right side (incoming)\n comparison = `${Parser.loci.LT}:UE002`;\n }\n\n return comparison;\n }\n\n /**\n * Checks both Locus Delta objects to see if they are\n * out of sync with one another. If so sends a DESYNC\n * request to the server.\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {string} loci comparison state\n */\n static checkIfOutOfSync(current, incoming) {\n let comparison = null;\n const currentUniqueMin = current.unique[0];\n const incomingUniqueMin = incoming.unique[0];\n\n const currentHasNoRange = !current.start && !current.end;\n const incomingHasNoRange = !incoming.start && !incoming.end;\n const neitherSeqHasRange = currentHasNoRange && incomingHasNoRange;\n\n const hasUniqOverlap = (list, min, max) => list.some((seq) => min < seq && seq < max);\n // current unique entries overlap the total range of incoming\n const currentUniqOverlap = hasUniqOverlap(current.unique, incoming.min, incoming.max);\n // vice-versa, incoming unique entries overlap the total range of current\n const incomingUniqOverlap = hasUniqOverlap(incoming.unique, current.min, current.max);\n\n if (neitherSeqHasRange || currentUniqOverlap || incomingUniqOverlap) {\n // outputs string indicating which condition occurred. ex: 0,1,0\n const debugInfo = `${+neitherSeqHasRange},${+currentUniqOverlap},${+incomingUniqOverlap}`;\n\n // send DESYNC to server\n comparison = `${Parser.loci.DESYNC}:OOS001:${debugInfo}`;\n } else if (currentUniqueMin > incomingUniqueMin) {\n // choose left side (current)\n comparison = `${Parser.loci.GT}:OOS002`;\n } else {\n // choose right side (incoming)\n comparison = `${Parser.loci.LT}:OOS003`;\n }\n\n return comparison;\n }\n\n /**\n * Compares two loci to determine which one contains the most recent state\n * @instance\n * @memberof Locus\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @returns {string} loci comparison state\n */\n static compare(current, incoming) {\n const {isSequenceEmpty} = Parser;\n const {extractComparisonState: extract} = Parser;\n const {packComparisonResult: pack} = Parser;\n\n if (isSequenceEmpty(current) || isSequenceEmpty(incoming)) {\n return pack(Parser.loci.USE_INCOMING, 'C001');\n }\n\n if (incoming.baseSequence) {\n return pack(Parser.compareDelta(current, incoming), 'C002');\n }\n\n const result = Parser.compareSequence(current.sequence, incoming.sequence);\n const action = Parser.compareToAction(extract(result));\n\n return pack(action, result);\n }\n\n /**\n * Compares two loci sequences (with delta params) and indicates what action\n * to take.\n * @instance\n * @memberof Locus\n * @param {Types~Locus} current\n * @param {Types~Locus} incoming\n * @private\n * @returns {string} loci comparison state\n */\n private static compareDelta(current, incoming) {\n const {LT, GT, EQ, DESYNC, USE_INCOMING} = Parser.loci;\n\n const {extractComparisonState: extract} = Parser;\n const {packComparisonResult: pack} = Parser;\n\n const result = Parser.compareSequence(current.sequence, incoming.sequence);\n let comparison = extract(result);\n\n if (comparison !== LT) {\n return pack(Parser.compareToAction(comparison), result);\n }\n\n comparison = Parser.compareSequence(current.sequence, incoming.baseSequence);\n\n switch (extract(comparison)) {\n case GT:\n case EQ:\n comparison = USE_INCOMING;\n break;\n\n default:\n comparison = DESYNC;\n }\n\n return pack(comparison, result);\n }\n\n /**\n * Compares Locus sequences\n * @param {Types~Locus} current Current working copy\n * @param {Types~Locus} incoming New Locus delta\n * @returns {string}\n */\n static compareSequence(current, incoming) {\n // Locus sequence comparison rules in order of priority.\n // https://sqbu-github.cisco.com/WebExSquared/cloud-apps/wiki/Locus-Sequence-Comparison-Algorithm\n\n const local: any = Parser.getMetaData(current);\n const delta: any = Parser.getMetaData(incoming);\n\n // update loci metadata\n local.unique = Parser.getUniqueSequences(local, delta);\n delta.unique = Parser.getUniqueSequences(delta, local);\n\n // Locus sequence comparison rules\n // order matters\n const rules = [\n Parser.checkSequenceOverlap,\n Parser.checkUnequalRanges,\n Parser.checkForUniqueEntries,\n Parser.checkIfOutOfSync,\n ];\n\n for (const rule of rules) {\n // Rule only returns a value if the rule applies,\n // otherwise returns null.\n const result = rule(local, delta);\n\n if (result) {\n return result;\n }\n }\n\n // error, none of rules above applied\n // should never get here as last rule\n // should be catch all.\n return Parser.loci.ERROR;\n }\n\n /**\n * Transates the result of a sequence comparison into an intended behavior\n * @param {string} result\n * @returns {string} Locus comparison action\n */\n static compareToAction(result: string) {\n const {DESYNC, EQ, ERROR, GT, LT, USE_CURRENT, USE_INCOMING} = Parser.loci;\n\n let action = ERROR;\n\n switch (result) {\n case EQ:\n case GT:\n action = USE_CURRENT;\n break;\n case LT:\n action = USE_INCOMING;\n break;\n case DESYNC:\n action = DESYNC;\n break;\n default:\n LoggerProxy.logger.info(\n `Locus-info:parser#compareToAction --> Error: ${result} is not a recognized sequence comparison result.`\n );\n }\n\n return action;\n }\n\n /**\n * Extracts a loci comparison from a string of data.\n * @param {string} lociComparisonResult Comparison result with extra data\n * @returns {string} Comparison of EQ, LT, GT, or DESYNC.\n */\n static extractComparisonState(lociComparisonResult: string) {\n return lociComparisonResult.split(':')[0];\n }\n\n /**\n * @typedef {object} LociMetadata\n * @property {number} start - Starting sequence number\n * @property {number} end - Ending sequence number\n * @property {number} first - First sequence number\n * @property {number} last - Last sequence number\n * @property {number} min - Minimum sequence number\n * @property {number} max - Maximum sequence number\n * @property {number} entries - Loci sequence entries\n */\n\n /**\n * Metadata for Locus delta\n * @param {Array.<number>} sequence Locus delta sequence\n * @returns {LociMetadata} Locus Delta Metadata\n */\n static getMetaData(sequence: any) {\n const {entries} = sequence;\n const first = entries[0];\n const last = entries.slice(-1)[0];\n\n // rangeStart or rangeEnd is 0 if a range doesn't exist\n const start = sequence.rangeStart;\n const end = sequence.rangeEnd;\n\n // sequence data\n return {\n start,\n end,\n first,\n last,\n // Rule is: rangeStart <= rangeEnd <= min(entries)\n min: start || first,\n // Grab last entry if exist else default to rangeEnd\n max: last || end,\n // keep reference to actual sequence entries\n entries,\n };\n }\n\n /**\n * Compares two Locus delta objects and notes unique\n * values contained within baseLoci.\n * @param {LociMetadata} baseLoci\n * @param {LociMetadata} otherLoci\n * @returns {Array.<number>} List of unique sequences\n */\n static getUniqueSequences(baseLoci: any, otherLoci: any) {\n const diff: any = difference(baseLoci.entries, otherLoci.entries);\n\n const {start, end} = otherLoci;\n\n return Parser.getNumbersOutOfRange(diff, start, end);\n }\n\n /**\n * Returns an array of numbers outside of a given range.\n * @param {Array.<number>} list Array to filter\n * @param {number} rangeStart Start of range\n * @param {number} rangeEnd End of range\n * @returns {Array.<number>} Array of numbers sorted ASC\n */\n static getNumbersOutOfRange(list: Array<number>, rangeStart: number, rangeEnd: number) {\n // Collect all numbers if number is outside of specified range\n const output = list.filter((num) => num < rangeStart || num > rangeEnd);\n\n // sort ascending\n return output.sort((a, b) => a - b);\n }\n\n /**\n * Checks if newLoci or workingCopy is invalid.\n * @param {Types~Locus} newLoci\n * @returns {boolean}\n */\n isValidLocus(newLoci) {\n let isValid = false;\n const {IDLE} = Parser.status;\n const {isLoci} = Parser;\n // @ts-ignore\n const setStatus = (status) => {\n // @ts-ignore\n this.status = status;\n };\n\n // one or both objects are not locus delta events\n if (!isLoci(this.workingCopy) || !isLoci(newLoci)) {\n setStatus(IDLE);\n LoggerProxy.logger.info(\n 'Locus-info:parser#processDeltaEvent --> Ignoring non-locus object. workingCopy:',\n this.workingCopy,\n 'newLoci:',\n newLoci\n );\n } else {\n isValid = true;\n }\n\n return isValid;\n }\n\n /**\n * Determines if a paricular locus's sequence is empty\n * @param {Types~Locus} locus\n * @returns {bool}\n */\n static isSequenceEmpty(locus) {\n const {sequence} = locus;\n const hasEmptyEntries = !sequence.entries?.length;\n const hasEmptyRange = sequence.rangeStart === 0 && sequence.rangeEnd === 0;\n\n return hasEmptyEntries && hasEmptyRange;\n }\n\n /**\n * Determines if an object has basic\n * structure of a locus object.\n * @param {Types~Locus} loci\n * @returns {boolean}\n */\n static isLoci(loci) {\n if (!loci || !loci.sequence) {\n return false;\n }\n const hasProp = (prop) => Object.prototype.hasOwnProperty.call(loci.sequence, prop);\n\n if (hasProp('rangeStart') && hasProp('rangeEnd')) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Processes next event in queue,\n * if queue is empty sets status to idle.\n * @returns {undefined}\n */\n nextEvent() {\n // @ts-ignore\n if (this.status === Parser.status.PAUSED) {\n LoggerProxy.logger.info('Locus-info:parser#nextEvent --> Locus parser paused.');\n\n return;\n }\n\n // continue processing until queue is empty\n if (this.queue.size() > 0) {\n this.processDeltaEvent();\n } else {\n // @ts-ignore\n this.status = Parser.status.IDLE;\n }\n }\n\n /**\n * Function handler for delta actions,\n * is set by instance callee.\n * @param {string} action Locus delta action\n * @param {Types~Locus} locus Locus delta\n * @returns {undefined}\n */\n // eslint-disable-next-line no-unused-vars\n onDeltaAction(action: string, locus) {}\n\n /**\n * Event handler for locus delta events\n * @param {Types~Locus} loci Locus Delta\n * @returns {undefined}\n */\n onDeltaEvent(loci) {\n // enqueue the new loci\n this.queue.enqueue(loci);\n // start processing events in the queue if idle\n // and a function handler is defined\n // @ts-ignore\n if (this.status === Parser.status.IDLE && this.onDeltaAction) {\n // Update status, ensure we only process one event at a time.\n // @ts-ignore\n this.status = Parser.status.WORKING;\n\n this.processDeltaEvent();\n }\n }\n\n /**\n * Appends new data onto a string of existing data.\n * @param {string} newData\n * @param {string} oldData\n * @returns {string}\n */\n static packComparisonResult(newData: string, oldData: string) {\n return `${newData}:${oldData}`;\n }\n\n /**\n * Pause locus processing\n * @returns {undefined}\n */\n pause() {\n // @ts-ignore\n this.status = Parser.status.PAUSED;\n LoggerProxy.logger.info('Locus-info:parser#pause --> Locus parser paused.');\n }\n\n /**\n * Processes next locus delta in the queue,\n * continues until the queue is empty\n * or cleared.\n * @returns {undefined}\n */\n processDeltaEvent() {\n const {DESYNC, USE_INCOMING} = Parser.loci;\n const {extractComparisonState: extract} = Parser;\n const newLoci = this.queue.dequeue();\n\n if (!this.isValidLocus(newLoci)) {\n return;\n }\n\n const result = Parser.compare(this.workingCopy, newLoci);\n const lociComparison = extract(result);\n\n // limited debugging, use chrome extension\n // for full debugging.\n LoggerProxy.logger.debug(`Locus-info:parser#processDeltaEvent --> Locus Debug: ${result}`);\n\n if (lociComparison === DESYNC) {\n // wait for desync response\n this.pause();\n } else if (lociComparison === USE_INCOMING) {\n // update working copy for future comparisons.\n // Note: The working copy of parser gets updated in .onFullLocus()\n // and here when USE_INCOMING locus.\n this.workingCopy = newLoci;\n }\n\n if (this.onDeltaAction) {\n LoggerProxy.logger.info(\n `Locus-info:parser#processDeltaEvent --> Locus Delta Action: ${lociComparison}`\n );\n\n // eslint-disable-next-line no-useless-call\n this.onDeltaAction.call(this, lociComparison, newLoci);\n }\n\n this.nextEvent();\n }\n\n /**\n * Resume from a paused state\n * @returns {undefined}\n */\n resume() {\n LoggerProxy.logger.info('Locus-info:parser#resume --> Locus parser resumed.');\n // @ts-ignore\n this.status = Parser.status.WORKING;\n this.nextEvent();\n }\n\n /**\n * Gets related debug info for given error code\n * @param {string} debugCode Debug code\n * @param {string} comparison Locus comparison string\n * @returns {object} Debug message\n */\n static getDebugMessage(debugCode: string, comparison: string) {\n // removes extra spaces from multiline string\n const mStr = (strings) => strings.join('').replace(/\\s{2,}/g, ' ');\n\n const resolutionMap = {\n EQ: `${Parser.loci.LT}: is equal (current == incoming).`,\n LT: `${Parser.loci.LT}: choose right side (incoming).`,\n GT: `${Parser.loci.GT}: choose left side (current).`,\n };\n\n const debugMap = {\n SO001: {\n title: 'checkSequenceOverlap-001',\n description: mStr`Occurs if earliest working copy sequence is more \\\n recent than last incoming sequence.`,\n logic: 'current.min > incoming.max',\n },\n\n SO002: {\n title: 'checkSequenceOverlap-002',\n description: mStr`Occurs if last working copy sequence is before the \\\n earliest incoming sequence.`,\n logic: 'current.max < incoming.min',\n },\n\n UR001: {\n title: 'checkUnequalRanges-001',\n description: mStr`Occurs if there are no unique values for both loci, \\\n and the current working copy loci has a larger range.`,\n logic: 'currentTotalRange > incomingTotalRange',\n },\n\n UR002: {\n title: 'checkUnequalRanges-002',\n description: mStr`Occurs if there are no unique values for both loci, \\\n and the incoming delta loci has a larger range.`,\n logic: 'currentTotalRange < incomingTotalRange',\n },\n\n UR003: {\n title: 'checkUnequalRanges-003',\n description: mStr`Occurs if there are no unique values for both loci, \\\n and with ranges either absent or of the same size, the sequences \\\n are considered equal.`,\n logic: 'currentTotalRange == incomingTotalRange',\n },\n\n UE001: {\n title: 'checkForUniqueEntries-001',\n description: mStr`Occurs if current loci has unique entries and \\\n incoming does not. Entries are considered unique if they \\\n do not overlap with other Loci sequences or range values.`,\n logic: 'currentIsUnique && !incomingIsUnique',\n },\n\n UE002: {\n title: 'checkForUniqueEntries-002',\n description: mStr`Occurs if current has no unique entries but \\\n incoming does. Entries are considered unique if they \\\n do not overlap with other Loci sequences or range values.`,\n logic: '!currentIsUnique && incomingIsUnique',\n },\n\n OOS001: {\n title: 'checkIfOutOfSync-001',\n description: mStr`Occurs if neither sequence has a range, or \\\n if the current loci unique entries overlap the total range of the \\\n incoming sequence, or if the incoming unique entries overlap \\\n the total range of current sequence.`,\n logic: 'neitherSeqHasRange || currentUniqOverlap || incomingUniqOverlap',\n },\n\n OOS002: {\n title: 'checkIfOutOfSync-002',\n description: mStr`Occurs if the minimum value from sequences that are \\\n unique to the current loci is greater than the minimum value from \\\n sequences that are unique to the incoming loci.`,\n logic: 'currentUniqueMin > incomingUniqueMin',\n },\n\n OOS003: {\n title: 'checkIfOutOfSync-003',\n description: mStr`Occurs if none of the comparison rules applied. \\\n It is a catch all.`,\n logic: 'else (catch all)',\n },\n };\n\n const debugObj = debugMap[debugCode];\n\n debugObj.title = `Debug: ${debugObj.title}`;\n debugObj.resolution = resolutionMap[comparison];\n\n return debugObj;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAEA;AACA;AAAsD;AAEtD;AACA;AACA;AACA;AACA;AAJA,IAKqBA,MAAM;EACzB;;EAOA;;EAcA;AACF;AACA;EACE,kBAAc;IAAA;IAAA;IAAA;IACZ,IAAI,CAACC,KAAK,GAAG,IAAIC,cAAW,EAAE;IAC9B;IACA,IAAI,CAACC,MAAM,GAAGH,MAAM,CAACG,MAAM,CAACC,IAAI;IAChC,IAAI,CAACC,aAAa,GAAG,IAAI;IACzB,IAAI,CAACC,WAAW,GAAG,IAAI;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EAPE;IAAA;IA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AGd,QAAQ,CAACN,SAAS,CAAC;MAEpCoB,QAAQ,CAACZ,KAAK,oBAAaY,QAAQ,CAACZ,KAAK,CAAE;MAC3CY,QAAQ,CAACC,UAAU,GAAGhB,aAAa,CAAChF,UAAU,CAAC;MAE/C,OAAO+F,QAAQ;IACjB;EAAC;EAAA;AAAA;AAAA;AAAA,8BA5pBkBpI,MAAM,YAET;EACdI,IAAI,EAAE,MAAM;EACZU,MAAM,EAAE,QAAQ;EAChBO,OAAO,EAAE;AACX,CAAC;AAAA,8BANkBrB,MAAM,UASX;EACZiD,EAAE,EAAE,OAAO;EACXT,EAAE,EAAE,cAAc;EAClBC,EAAE,EAAE,WAAW;EACfnB,MAAM,EAAE,QAAQ;EAChBC,YAAY,EAAE,cAAc;EAC5B6D,WAAW,EAAE,aAAa;EAC1BD,KAAK,EAAE;AACT,CAAC"}
@@ -1,34 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
9
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
14
-
10
+ var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
15
11
  var _constants = require("../constants");
16
-
17
12
  var _parameter = _interopRequireDefault(require("../common/errors/parameter"));
18
-
19
13
  var SelfUtils = {};
20
14
  var PSTN_DEVICE_TYPE = 'PROVISIONAL';
15
+
21
16
  /**
22
17
  * parses the relevant values for self: muted, guest, moderator, mediaStatus, state, joinedWith, pstnDevices, creator, id
23
18
  * @param {Object} self
24
19
  * @param {String} deviceId
25
20
  * @returns {undefined}
26
21
  */
27
-
28
22
  SelfUtils.parse = function (self, deviceId) {
29
23
  if (self) {
30
24
  var _joinedWith$intent;
31
-
32
25
  var joinedWith = self.devices.find(function (device) {
33
26
  return deviceId === device.url;
34
27
  });
@@ -36,6 +29,7 @@ SelfUtils.parse = function (self, deviceId) {
36
29
  return PSTN_DEVICE_TYPE === device.deviceType;
37
30
  });
38
31
  return {
32
+ remoteVideoMuted: SelfUtils.getRemoteVideoMuted(self),
39
33
  remoteMuted: SelfUtils.getRemoteMuted(self),
40
34
  unmuteAllowed: SelfUtils.getUnmuteAllowed(self),
41
35
  localAudioUnmuteRequested: SelfUtils.getLocalAudioUnmuteRequested(self),
@@ -65,49 +59,47 @@ SelfUtils.parse = function (self, deviceId) {
65
59
  isUserUnadmitted: self.state === _constants._IDLE_ && (joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent = joinedWith.intent) === null || _joinedWith$intent === void 0 ? void 0 : _joinedWith$intent.type) === _constants._WAIT_,
66
60
  layout: SelfUtils.getLayout(self),
67
61
  canNotViewTheParticipantList: SelfUtils.canNotViewTheParticipantList(self),
68
- isSharingBlocked: SelfUtils.isSharingBlocked(self)
62
+ isSharingBlocked: SelfUtils.isSharingBlocked(self),
63
+ breakoutSessions: SelfUtils.getBreakouts(self)
69
64
  };
70
65
  }
71
-
72
66
  return null;
73
67
  };
74
-
68
+ SelfUtils.getBreakouts = function (self) {
69
+ var _self$controls, _self$controls$breako;
70
+ return self === null || self === void 0 ? void 0 : (_self$controls = self.controls) === null || _self$controls === void 0 ? void 0 : (_self$controls$breako = _self$controls.breakout) === null || _self$controls$breako === void 0 ? void 0 : _self$controls$breako.sessions;
71
+ };
75
72
  SelfUtils.getLayout = function (self) {
76
- var _self$controls;
77
-
78
- return (0, _isArray.default)(self === null || self === void 0 ? void 0 : (_self$controls = self.controls) === null || _self$controls === void 0 ? void 0 : _self$controls.layouts) ? self.controls.layouts[0].type : undefined;
73
+ var _self$controls2;
74
+ return (0, _isArray.default)(self === null || self === void 0 ? void 0 : (_self$controls2 = self.controls) === null || _self$controls2 === void 0 ? void 0 : _self$controls2.layouts) ? self.controls.layouts[0].type : undefined;
79
75
  };
80
-
81
76
  SelfUtils.getRoles = function (self) {
82
- var _self$controls2, _self$controls2$role;
83
-
84
- return ((self === null || self === void 0 ? void 0 : (_self$controls2 = self.controls) === null || _self$controls2 === void 0 ? void 0 : (_self$controls2$role = _self$controls2.role) === null || _self$controls2$role === void 0 ? void 0 : _self$controls2$role.roles) || []).reduce(function (roles, role) {
77
+ var _self$controls3, _self$controls3$role;
78
+ return ((self === null || self === void 0 ? void 0 : (_self$controls3 = self.controls) === null || _self$controls3 === void 0 ? void 0 : (_self$controls3$role = _self$controls3.role) === null || _self$controls3$role === void 0 ? void 0 : _self$controls3$role.roles) || []).reduce(function (roles, role) {
85
79
  if (role.hasRole) {
86
80
  roles.push(role.type);
87
81
  }
88
-
89
82
  return roles;
90
83
  }, []);
91
84
  };
92
-
93
85
  SelfUtils.canNotViewTheParticipantList = function (self) {
94
86
  return !!(self !== null && self !== void 0 && self.canNotViewTheParticipantList);
95
87
  };
96
-
97
88
  SelfUtils.isSharingBlocked = function (self) {
98
89
  return !!(self !== null && self !== void 0 && self.isSharingBlocked);
99
90
  };
100
-
101
91
  SelfUtils.getSelves = function (oldSelf, newSelf, deviceId) {
102
92
  var previous = oldSelf && SelfUtils.parse(oldSelf, deviceId);
103
93
  var current = newSelf && SelfUtils.parse(newSelf, deviceId);
104
94
  var updates = {};
105
95
  updates.isUserUnadmitted = SelfUtils.isUserUnadmitted(current);
106
96
  updates.isUserAdmitted = SelfUtils.isUserAdmitted(previous, current);
97
+ updates.isVideoMutedByOthersChanged = SelfUtils.videoMutedByOthersChanged(previous, current);
107
98
  updates.isMutedByOthersChanged = SelfUtils.mutedByOthersChanged(previous, current);
108
99
  updates.localAudioUnmuteRequestedByServer = SelfUtils.localAudioUnmuteRequestedByServer(previous, current);
109
100
  updates.localAudioUnmuteRequiredByServer = SelfUtils.localAudioUnmuteRequiredByServer(previous, current);
110
101
  updates.moderatorChanged = SelfUtils.moderatorChanged(previous, current);
102
+ updates.isUpgradeToModeratorOrCohost = SelfUtils.isUpgradeToModeratorOrCohost(previous, current);
111
103
  updates.isMediaInactiveOrReleased = SelfUtils.wasMediaInactiveOrReleased(previous, current);
112
104
  updates.isUserObserving = SelfUtils.isDeviceObserving(previous, current);
113
105
  updates.layoutChanged = SelfUtils.layoutChanged(previous, current);
@@ -117,22 +109,23 @@ SelfUtils.getSelves = function (oldSelf, newSelf, deviceId) {
117
109
  updates.shareStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.share) !== current.currentMediaStatus.share;
118
110
  updates.canNotViewTheParticipantListChanged = (previous === null || previous === void 0 ? void 0 : previous.canNotViewTheParticipantList) !== current.canNotViewTheParticipantList;
119
111
  updates.isSharingBlockedChanged = (previous === null || previous === void 0 ? void 0 : previous.isSharingBlocked) !== current.isSharingBlocked;
112
+ updates.breakoutsChanged = SelfUtils.breakoutsChanged(previous, current);
120
113
  return {
121
114
  previous: previous,
122
115
  current: current,
123
116
  updates: updates
124
117
  };
125
118
  };
119
+
126
120
  /**
127
121
  * Checks if user has joined the meeting
128
122
  * @param {Object} self
129
123
  * @returns {boolean} isJoined
130
- */
131
-
132
-
124
+ */
133
125
  SelfUtils.isJoined = function (self) {
134
126
  return (self === null || self === void 0 ? void 0 : self.state) === _constants._JOINED_;
135
127
  };
128
+
136
129
  /**
137
130
  * Validate if the Meeting Layout Controls Layout has changed.
138
131
  *
@@ -140,99 +133,91 @@ SelfUtils.isJoined = function (self) {
140
133
  * @param {Self} current - Current self state [per event]
141
134
  * @returns {boolean} - If the MEeting Layout Controls Layout has changed.
142
135
  */
143
-
144
-
145
136
  SelfUtils.layoutChanged = function (previous, current) {
146
137
  return (current === null || current === void 0 ? void 0 : current.layout) && (previous === null || previous === void 0 ? void 0 : previous.layout) !== (current === null || current === void 0 ? void 0 : current.layout);
147
138
  };
148
-
139
+ SelfUtils.breakoutsChanged = function (previous, current) {
140
+ return !(0, _isEqual2.default)(previous === null || previous === void 0 ? void 0 : previous.breakoutSessions, current === null || current === void 0 ? void 0 : current.breakoutSessions);
141
+ };
149
142
  SelfUtils.isMediaInactive = function (previous, current) {
150
143
  if (previous && previous.joinedWith && previous.joinedWith.mediaSessions && current && current.joinedWith && current.joinedWith.mediaSessions) {
151
144
  var previousMediaStatus = SelfUtils.getMediaStatus(previous.joinedWith.mediaSessions);
152
145
  var currentMediaStatus = SelfUtils.getMediaStatus(current.joinedWith.mediaSessions);
153
-
154
146
  if (previousMediaStatus.audio && currentMediaStatus.audio && previousMediaStatus.audio.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.direction !== _constants.MEDIA_STATE.inactive) {
155
147
  return true;
156
148
  }
157
-
158
149
  if (previousMediaStatus.video && currentMediaStatus.video && previousMediaStatus.video.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.video.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.video.direction !== _constants.MEDIA_STATE.inactive) {
159
150
  return true;
160
151
  }
161
-
162
152
  if (previousMediaStatus.share && currentMediaStatus.share && previousMediaStatus.share.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.share.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.share.direction !== _constants.MEDIA_STATE.inactive) {
163
153
  return true;
164
154
  }
165
-
166
155
  return false;
167
156
  }
168
-
169
157
  return false;
170
158
  };
171
-
172
159
  SelfUtils.getLastModified = function (self) {
173
160
  if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.lastModified) {
174
161
  return null;
175
162
  }
176
-
177
163
  return self.controls.audio.meta.lastModified;
178
164
  };
179
-
180
165
  SelfUtils.getModifiedBy = function (self) {
181
166
  if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.modifiedBy) {
182
167
  return null;
183
168
  }
184
-
185
169
  return self.controls.audio.meta.modifiedBy;
186
170
  };
171
+
187
172
  /**
188
173
  * get the id from the self object
189
174
  * @param {Object} self
190
175
  * @returns {String}
191
176
  */
192
-
193
-
194
177
  SelfUtils.getSelfIdentity = function (self) {
195
178
  if (!self && !self.person) {
196
179
  return null;
197
180
  }
198
-
199
181
  return self.person.id;
200
182
  };
183
+
201
184
  /**
202
- * get the "remote mute" property from the self object
185
+ * get the "remote video mute" property from the self object
203
186
  * @param {Object} self
204
187
  * @returns {Boolean}
205
188
  */
189
+ SelfUtils.getRemoteVideoMuted = function (self) {
190
+ if (!self || !self.controls || !self.controls.video) {
191
+ return null;
192
+ }
193
+ return self.controls.video.muted;
194
+ };
206
195
 
207
-
196
+ /**
197
+ * get the "remote mute" property from the self object
198
+ * @param {Object} self
199
+ * @returns {Boolean}
200
+ */
208
201
  SelfUtils.getRemoteMuted = function (self) {
209
202
  if (!self || !self.controls || !self.controls.audio) {
210
203
  return null;
211
204
  }
212
-
213
205
  return self.controls.audio.muted;
214
206
  };
215
-
216
207
  SelfUtils.getLocalAudioUnmuteRequested = function (self) {
217
- var _self$controls3, _self$controls3$audio;
218
-
219
- return !!(self !== null && self !== void 0 && (_self$controls3 = self.controls) !== null && _self$controls3 !== void 0 && (_self$controls3$audio = _self$controls3.audio) !== null && _self$controls3$audio !== void 0 && _self$controls3$audio.requestedToUnmute);
208
+ var _self$controls4, _self$controls4$audio;
209
+ return !!(self !== null && self !== void 0 && (_self$controls4 = self.controls) !== null && _self$controls4 !== void 0 && (_self$controls4$audio = _self$controls4.audio) !== null && _self$controls4$audio !== void 0 && _self$controls4$audio.requestedToUnmute);
220
210
  };
221
-
222
211
  SelfUtils.getUnmuteAllowed = function (self) {
223
212
  if (!self || !self.controls || !self.controls.audio) {
224
213
  return null;
225
214
  }
226
-
227
215
  return !self.controls.audio.disallowUnmute;
228
216
  };
229
-
230
217
  SelfUtils.getLocalAudioUnmuteRequired = function (self) {
231
- var _self$controls4, _self$controls4$audio;
232
-
233
- return !!(self !== null && self !== void 0 && (_self$controls4 = self.controls) !== null && _self$controls4 !== void 0 && (_self$controls4$audio = _self$controls4.audio) !== null && _self$controls4$audio !== void 0 && _self$controls4$audio.localAudioUnmuteRequired);
218
+ var _self$controls5, _self$controls5$audio;
219
+ return !!(self !== null && self !== void 0 && (_self$controls5 = self.controls) !== null && _self$controls5 !== void 0 && (_self$controls5$audio = _self$controls5.audio) !== null && _self$controls5$audio !== void 0 && _self$controls5$audio.localAudioUnmuteRequired);
234
220
  };
235
-
236
221
  SelfUtils.getStatus = function (status) {
237
222
  return {
238
223
  audio: status.audioStatus,
@@ -240,138 +225,148 @@ SelfUtils.getStatus = function (status) {
240
225
  slides: status.videoSlidesStatus
241
226
  };
242
227
  };
228
+
243
229
  /**
244
230
  * @param {Object} oldSelf
245
231
  * @param {Object} changedSelf
246
232
  * @returns {Boolean}
247
233
  */
248
-
249
-
250
234
  SelfUtils.wasMediaInactiveOrReleased = function () {
251
235
  var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
252
236
  var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
253
237
  return oldSelf.joinedWith && oldSelf.joinedWith.state === _constants._JOINED_ && changedSelf.joinedWith.state === _constants._LEFT_ && (changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.INACTIVE || changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.MEDIA_RELEASED);
254
238
  };
239
+
255
240
  /**
256
241
  * @param {Object} check
257
242
  * @returns {Boolean}
258
243
  */
259
-
260
-
261
244
  SelfUtils.isLocusUserUnadmitted = function (check) {
262
245
  var _check$joinedWith, _check$joinedWith$int;
263
-
264
246
  return check && ((_check$joinedWith = check.joinedWith) === null || _check$joinedWith === void 0 ? void 0 : (_check$joinedWith$int = _check$joinedWith.intent) === null || _check$joinedWith$int === void 0 ? void 0 : _check$joinedWith$int.type) === _constants._WAIT_ && check.state === _constants._IDLE_;
265
247
  };
248
+
266
249
  /**
267
250
  * @param {Object} check
268
251
  * @returns {Boolean}
269
252
  */
270
-
271
-
272
253
  SelfUtils.isLocusUserAdmitted = function (check) {
273
254
  var _check$joinedWith2, _check$joinedWith2$in;
274
-
275
255
  return check && ((_check$joinedWith2 = check.joinedWith) === null || _check$joinedWith2 === void 0 ? void 0 : (_check$joinedWith2$in = _check$joinedWith2.intent) === null || _check$joinedWith2$in === void 0 ? void 0 : _check$joinedWith2$in.type) !== _constants._WAIT_ && check.state === _constants._JOINED_;
276
256
  };
257
+
277
258
  /**
278
259
  * @param {Object} self
279
260
  * @returns {Boolean}
280
261
  * @throws {Error} when self is undefined
281
262
  */
282
-
283
-
284
263
  SelfUtils.isUserUnadmitted = function (self) {
285
264
  if (!self) {
286
265
  throw new _parameter.default('self must be defined to determine if self is unadmitted as guest.');
287
266
  }
288
-
289
267
  return SelfUtils.isLocusUserUnadmitted(self);
290
268
  };
291
-
292
269
  SelfUtils.moderatorChanged = function (oldSelf, changedSelf) {
293
270
  if (!oldSelf) {
294
271
  return true;
295
272
  }
296
-
297
273
  if (!changedSelf) {
298
274
  throw new _parameter.default('New self must be defined to determine if self transitioned moderator status.');
299
275
  }
300
-
301
276
  return oldSelf.moderator !== changedSelf.moderator;
302
277
  };
278
+
303
279
  /**
304
280
  * @param {Object} oldSelf
305
281
  * @param {Object} changedSelf
306
282
  * @returns {Boolean}
307
283
  * @throws {Error} if changed self was undefined
308
284
  */
285
+ SelfUtils.isUpgradeToModeratorOrCohost = function (oldSelf, changedSelf) {
286
+ if (!oldSelf) {
287
+ return false;
288
+ }
289
+ if (!changedSelf) {
290
+ throw new _parameter.default('New self must be defined to determine if self transitioned moderator or cohost status.');
291
+ }
292
+ var isAttendeeOnly = oldSelf.roles.includes(_constants.SELF_ROLES.ATTENDEE) && !oldSelf.roles.includes(_constants.SELF_ROLES.COHOST) && !oldSelf.roles.includes(_constants.SELF_ROLES.MODERATOR);
293
+ var isCohost = changedSelf.roles.includes(_constants.SELF_ROLES.COHOST);
294
+ var isModerator = changedSelf.roles.includes(_constants.SELF_ROLES.MODERATOR);
295
+ return isAttendeeOnly && (isCohost || isModerator);
296
+ };
309
297
 
310
-
298
+ /**
299
+ * @param {Object} oldSelf
300
+ * @param {Object} changedSelf
301
+ * @returns {Boolean}
302
+ * @throws {Error} if changed self was undefined
303
+ */
311
304
  SelfUtils.isDeviceObserving = function (oldSelf, changedSelf) {
312
305
  var _oldSelf$joinedWith, _oldSelf$joinedWith$i, _changedSelf$joinedWi, _changedSelf$joinedWi2;
313
-
314
306
  return oldSelf && ((_oldSelf$joinedWith = oldSelf.joinedWith) === null || _oldSelf$joinedWith === void 0 ? void 0 : (_oldSelf$joinedWith$i = _oldSelf$joinedWith.intent) === null || _oldSelf$joinedWith$i === void 0 ? void 0 : _oldSelf$joinedWith$i.type) === _constants._MOVE_MEDIA_ && changedSelf && ((_changedSelf$joinedWi = changedSelf.joinedWith) === null || _changedSelf$joinedWi === void 0 ? void 0 : (_changedSelf$joinedWi2 = _changedSelf$joinedWi.intent) === null || _changedSelf$joinedWi2 === void 0 ? void 0 : _changedSelf$joinedWi2.type) === _constants._OBSERVE_;
315
307
  };
308
+
316
309
  /**
317
310
  * @param {Object} oldSelf
318
311
  * @param {Object} changedSelf
319
312
  * @returns {Boolean}
320
313
  * @throws {Error} if changed self was undefined
321
314
  */
322
-
323
-
324
315
  SelfUtils.isUserAdmitted = function (oldSelf, changedSelf) {
325
316
  if (!oldSelf) {
326
317
  // if there was no previous locus, it couldn't have been admitted yet
327
318
  return false;
328
319
  }
329
-
330
320
  if (!changedSelf) {
331
321
  throw new _parameter.default('New self must be defined to determine if self transitioned to admitted as guest.');
332
322
  }
333
-
334
323
  return SelfUtils.isLocusUserUnadmitted(oldSelf) && SelfUtils.isLocusUserAdmitted(changedSelf);
335
324
  };
325
+ SelfUtils.videoMutedByOthersChanged = function (oldSelf, changedSelf) {
326
+ if (!changedSelf) {
327
+ throw new _parameter.default('New self must be defined to determine if self was video muted by others.');
328
+ }
329
+ if (!oldSelf || oldSelf.remoteVideoMuted === null) {
330
+ if (changedSelf.remoteVideoMuted) {
331
+ return true; // this happens when host disables "Allow start video"
332
+ }
336
333
 
334
+ // we don't want to be sending the 'meeting:self:videoUnmutedByOthers' notification on meeting join
335
+ return false;
336
+ }
337
+ return oldSelf.remoteVideoMuted !== changedSelf.remoteVideoMuted;
338
+ };
337
339
  SelfUtils.mutedByOthersChanged = function (oldSelf, changedSelf) {
338
340
  if (!changedSelf) {
339
341
  throw new _parameter.default('New self must be defined to determine if self was muted by others.');
340
342
  }
341
-
342
343
  if (!oldSelf || oldSelf.remoteMuted === null) {
343
344
  if (changedSelf.remoteMuted) {
344
345
  return true; // this happens when mute on-entry is enabled
345
- } // we don't want to be sending the 'meeting:self:unmutedByOthers' notification on meeting join
346
-
346
+ }
347
347
 
348
+ // we don't want to be sending the 'meeting:self:unmutedByOthers' notification on meeting join
348
349
  return false;
349
350
  }
350
-
351
351
  return changedSelf.remoteMuted !== null && (oldSelf.remoteMuted !== changedSelf.remoteMuted || changedSelf.remoteMuted && oldSelf.unmuteAllowed !== changedSelf.unmuteAllowed);
352
352
  };
353
-
354
353
  SelfUtils.localAudioUnmuteRequestedByServer = function () {
355
354
  var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
356
355
  var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
357
-
358
356
  if (!changedSelf) {
359
357
  throw new _parameter.default('New self must be defined to determine if self received request to unmute.');
360
358
  }
361
-
362
359
  return changedSelf.localAudioUnmuteRequested && !oldSelf.localAudioUnmuteRequested;
363
360
  };
364
-
365
361
  SelfUtils.localAudioUnmuteRequiredByServer = function () {
366
362
  var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
367
363
  var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
368
-
369
364
  if (!changedSelf) {
370
365
  throw new _parameter.default('New self must be defined to determine if localAudioUnmuteRequired changed.');
371
366
  }
372
-
373
367
  return !changedSelf.remoteMuted && changedSelf.localAudioUnmuteRequired && oldSelf.localAudioUnmuteRequired !== changedSelf.localAudioUnmuteRequired;
374
368
  };
369
+
375
370
  /**
376
371
  * extract the sipUrl from the partner
377
372
  * @param {Object} partner
@@ -379,7 +374,6 @@ SelfUtils.localAudioUnmuteRequiredByServer = function () {
379
374
  * @returns {Object}
380
375
  */
381
376
 
382
-
383
377
  SelfUtils.getSipUrl = function (partner, type, sipUri) {
384
378
  // For webex meeting the sipUrl gets updated in info parser
385
379
  if (partner && type === _constants._CALL_) {
@@ -387,12 +381,10 @@ SelfUtils.getSipUrl = function (partner, type, sipUri) {
387
381
  sipUri: partner.person.sipUrl || partner.person.id
388
382
  };
389
383
  }
390
-
391
384
  return {
392
385
  sipUri: sipUri
393
386
  };
394
387
  };
395
-
396
388
  SelfUtils.getMediaStatus = function () {
397
389
  var mediaSessions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
398
390
  var mediaStatus = {
@@ -411,7 +403,6 @@ SelfUtils.getMediaStatus = function () {
411
403
  });
412
404
  return mediaStatus;
413
405
  };
414
-
415
406
  var _default = SelfUtils;
416
407
  exports.default = _default;
417
408
  //# sourceMappingURL=selfUtils.js.map