@webex/plugin-meetings 3.0.0-beta.31 → 3.0.0-beta.310

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 (378) hide show
  1. package/README.md +46 -8
  2. package/dist/annotation/annotation.types.js +7 -0
  3. package/dist/annotation/annotation.types.js.map +1 -0
  4. package/dist/annotation/constants.js +49 -0
  5. package/dist/annotation/constants.js.map +1 -0
  6. package/dist/annotation/index.js +342 -0
  7. package/dist/annotation/index.js.map +1 -0
  8. package/dist/breakouts/breakout.js +94 -15
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/edit-lock-error.js +52 -0
  11. package/dist/breakouts/edit-lock-error.js.map +1 -0
  12. package/dist/breakouts/events.js +45 -0
  13. package/dist/breakouts/events.js.map +1 -0
  14. package/dist/breakouts/index.js +709 -35
  15. package/dist/breakouts/index.js.map +1 -1
  16. package/dist/breakouts/utils.js +45 -1
  17. package/dist/breakouts/utils.js.map +1 -1
  18. package/dist/common/errors/no-meeting-info.js +51 -0
  19. package/dist/common/errors/no-meeting-info.js.map +1 -0
  20. package/dist/common/errors/reclaim-host-role-errors.js +158 -0
  21. package/dist/common/errors/reclaim-host-role-errors.js.map +1 -0
  22. package/dist/common/errors/webex-errors.js +48 -7
  23. package/dist/common/errors/webex-errors.js.map +1 -1
  24. package/dist/common/logs/logger-proxy.js +1 -1
  25. package/dist/common/logs/logger-proxy.js.map +1 -1
  26. package/dist/common/logs/request.js +5 -1
  27. package/dist/common/logs/request.js.map +1 -1
  28. package/dist/common/queue.js +24 -9
  29. package/dist/common/queue.js.map +1 -1
  30. package/dist/config.js +5 -11
  31. package/dist/config.js.map +1 -1
  32. package/dist/constants.js +233 -29
  33. package/dist/constants.js.map +1 -1
  34. package/dist/controls-options-manager/enums.js +14 -2
  35. package/dist/controls-options-manager/enums.js.map +1 -1
  36. package/dist/controls-options-manager/index.js +109 -15
  37. package/dist/controls-options-manager/index.js.map +1 -1
  38. package/dist/controls-options-manager/types.js +7 -0
  39. package/dist/controls-options-manager/types.js.map +1 -0
  40. package/dist/controls-options-manager/util.js +309 -18
  41. package/dist/controls-options-manager/util.js.map +1 -1
  42. package/dist/index.js +112 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/interpretation/collection.js +23 -0
  45. package/dist/interpretation/collection.js.map +1 -0
  46. package/dist/interpretation/index.js +366 -0
  47. package/dist/interpretation/index.js.map +1 -0
  48. package/dist/interpretation/siLanguage.js +25 -0
  49. package/dist/interpretation/siLanguage.js.map +1 -0
  50. package/dist/locus-info/controlsUtils.js +91 -2
  51. package/dist/locus-info/controlsUtils.js.map +1 -1
  52. package/dist/locus-info/index.js +383 -62
  53. package/dist/locus-info/index.js.map +1 -1
  54. package/dist/locus-info/infoUtils.js +7 -1
  55. package/dist/locus-info/infoUtils.js.map +1 -1
  56. package/dist/locus-info/mediaSharesUtils.js +57 -1
  57. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  58. package/dist/locus-info/parser.js +249 -72
  59. package/dist/locus-info/parser.js.map +1 -1
  60. package/dist/locus-info/selfUtils.js +89 -14
  61. package/dist/locus-info/selfUtils.js.map +1 -1
  62. package/dist/media/index.js +61 -116
  63. package/dist/media/index.js.map +1 -1
  64. package/dist/media/properties.js +73 -124
  65. package/dist/media/properties.js.map +1 -1
  66. package/dist/meeting/in-meeting-actions.js +82 -2
  67. package/dist/meeting/in-meeting-actions.js.map +1 -1
  68. package/dist/meeting/index.js +3777 -2929
  69. package/dist/meeting/index.js.map +1 -1
  70. package/dist/meeting/locusMediaRequest.js +292 -0
  71. package/dist/meeting/locusMediaRequest.js.map +1 -0
  72. package/dist/meeting/muteState.js +230 -124
  73. package/dist/meeting/muteState.js.map +1 -1
  74. package/dist/meeting/request.js +260 -196
  75. package/dist/meeting/request.js.map +1 -1
  76. package/dist/meeting/util.js +601 -417
  77. package/dist/meeting/util.js.map +1 -1
  78. package/dist/meeting-info/index.js +73 -7
  79. package/dist/meeting-info/index.js.map +1 -1
  80. package/dist/meeting-info/meeting-info-v2.js +192 -51
  81. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  82. package/dist/meeting-info/util.js +1 -1
  83. package/dist/meeting-info/util.js.map +1 -1
  84. package/dist/meeting-info/utilv2.js +36 -36
  85. package/dist/meeting-info/utilv2.js.map +1 -1
  86. package/dist/meetings/collection.js +39 -0
  87. package/dist/meetings/collection.js.map +1 -1
  88. package/dist/meetings/index.js +415 -115
  89. package/dist/meetings/index.js.map +1 -1
  90. package/dist/meetings/meetings.types.js +7 -0
  91. package/dist/meetings/meetings.types.js.map +1 -0
  92. package/dist/meetings/request.js +2 -0
  93. package/dist/meetings/request.js.map +1 -1
  94. package/dist/meetings/util.js +72 -6
  95. package/dist/meetings/util.js.map +1 -1
  96. package/dist/member/index.js +58 -0
  97. package/dist/member/index.js.map +1 -1
  98. package/dist/member/types.js +25 -0
  99. package/dist/member/types.js.map +1 -0
  100. package/dist/member/util.js +132 -25
  101. package/dist/member/util.js.map +1 -1
  102. package/dist/members/collection.js +10 -0
  103. package/dist/members/collection.js.map +1 -1
  104. package/dist/members/index.js +102 -6
  105. package/dist/members/index.js.map +1 -1
  106. package/dist/members/request.js +106 -38
  107. package/dist/members/request.js.map +1 -1
  108. package/dist/members/types.js +15 -0
  109. package/dist/members/types.js.map +1 -0
  110. package/dist/members/util.js +326 -232
  111. package/dist/members/util.js.map +1 -1
  112. package/dist/metrics/constants.js +13 -5
  113. package/dist/metrics/constants.js.map +1 -1
  114. package/dist/metrics/index.js +1 -468
  115. package/dist/metrics/index.js.map +1 -1
  116. package/dist/multistream/mediaRequestManager.js +238 -49
  117. package/dist/multistream/mediaRequestManager.js.map +1 -1
  118. package/dist/multistream/receiveSlot.js +29 -16
  119. package/dist/multistream/receiveSlot.js.map +1 -1
  120. package/dist/multistream/receiveSlotManager.js +39 -36
  121. package/dist/multistream/receiveSlotManager.js.map +1 -1
  122. package/dist/multistream/remoteMedia.js +44 -18
  123. package/dist/multistream/remoteMedia.js.map +1 -1
  124. package/dist/multistream/remoteMediaGroup.js +60 -3
  125. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  126. package/dist/multistream/remoteMediaManager.js +209 -59
  127. package/dist/multistream/remoteMediaManager.js.map +1 -1
  128. package/dist/multistream/sendSlotManager.js +233 -0
  129. package/dist/multistream/sendSlotManager.js.map +1 -0
  130. package/dist/reachability/index.js +225 -59
  131. package/dist/reachability/index.js.map +1 -1
  132. package/dist/reachability/request.js +17 -8
  133. package/dist/reachability/request.js.map +1 -1
  134. package/dist/reconnection-manager/index.js +201 -156
  135. package/dist/reconnection-manager/index.js.map +1 -1
  136. package/dist/recording-controller/index.js +21 -2
  137. package/dist/recording-controller/index.js.map +1 -1
  138. package/dist/recording-controller/util.js +9 -8
  139. package/dist/recording-controller/util.js.map +1 -1
  140. package/dist/roap/index.js +62 -32
  141. package/dist/roap/index.js.map +1 -1
  142. package/dist/roap/request.js +112 -97
  143. package/dist/roap/request.js.map +1 -1
  144. package/dist/roap/turnDiscovery.js +95 -36
  145. package/dist/roap/turnDiscovery.js.map +1 -1
  146. package/dist/rtcMetrics/constants.js +12 -0
  147. package/dist/rtcMetrics/constants.js.map +1 -0
  148. package/dist/rtcMetrics/index.js +117 -0
  149. package/dist/rtcMetrics/index.js.map +1 -0
  150. package/dist/statsAnalyzer/index.js +86 -78
  151. package/dist/statsAnalyzer/index.js.map +1 -1
  152. package/dist/statsAnalyzer/mqaUtil.js +11 -10
  153. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  154. package/dist/types/annotation/annotation.types.d.ts +42 -0
  155. package/dist/types/annotation/constants.d.ts +31 -0
  156. package/dist/types/annotation/index.d.ts +117 -0
  157. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  158. package/dist/types/breakouts/events.d.ts +8 -0
  159. package/dist/types/breakouts/utils.d.ts +14 -0
  160. package/dist/types/common/errors/no-meeting-info.d.ts +14 -0
  161. package/dist/types/common/errors/reclaim-host-role-errors.d.ts +60 -0
  162. package/dist/types/common/errors/webex-errors.d.ts +25 -1
  163. package/dist/types/common/logs/request.d.ts +2 -0
  164. package/dist/types/common/queue.d.ts +9 -7
  165. package/dist/types/config.d.ts +1 -7
  166. package/dist/types/constants.d.ts +194 -24
  167. package/dist/types/controls-options-manager/enums.d.ts +11 -1
  168. package/dist/types/controls-options-manager/index.d.ts +17 -1
  169. package/dist/types/controls-options-manager/types.d.ts +43 -0
  170. package/dist/types/controls-options-manager/util.d.ts +1 -7
  171. package/dist/types/index.d.ts +6 -4
  172. package/dist/types/interpretation/collection.d.ts +5 -0
  173. package/dist/types/interpretation/index.d.ts +5 -0
  174. package/dist/types/interpretation/siLanguage.d.ts +5 -0
  175. package/dist/types/locus-info/index.d.ts +57 -4
  176. package/dist/types/locus-info/parser.d.ts +67 -6
  177. package/dist/types/media/index.d.ts +2 -0
  178. package/dist/types/media/properties.d.ts +34 -48
  179. package/dist/types/meeting/in-meeting-actions.d.ts +82 -2
  180. package/dist/types/meeting/index.d.ts +463 -510
  181. package/dist/types/meeting/locusMediaRequest.d.ts +74 -0
  182. package/dist/types/meeting/muteState.d.ts +99 -23
  183. package/dist/types/meeting/request.d.ts +72 -43
  184. package/dist/types/meeting/util.d.ts +101 -1
  185. package/dist/types/meeting-info/index.d.ts +13 -1
  186. package/dist/types/meeting-info/meeting-info-v2.d.ts +31 -1
  187. package/dist/types/meetings/collection.d.ts +17 -0
  188. package/dist/types/meetings/index.d.ts +98 -20
  189. package/dist/types/meetings/meetings.types.d.ts +4 -0
  190. package/dist/types/member/index.d.ts +14 -0
  191. package/dist/types/member/types.d.ts +32 -0
  192. package/dist/types/members/collection.d.ts +5 -0
  193. package/dist/types/members/index.d.ts +35 -2
  194. package/dist/types/members/request.d.ts +73 -9
  195. package/dist/types/members/types.d.ts +25 -0
  196. package/dist/types/members/util.d.ts +214 -1
  197. package/dist/types/metrics/constants.d.ts +12 -4
  198. package/dist/types/metrics/index.d.ts +4 -119
  199. package/dist/types/multistream/mediaRequestManager.d.ts +73 -5
  200. package/dist/types/multistream/receiveSlot.d.ts +13 -11
  201. package/dist/types/multistream/receiveSlotManager.d.ts +14 -4
  202. package/dist/types/multistream/remoteMedia.d.ts +8 -29
  203. package/dist/types/multistream/remoteMediaGroup.d.ts +0 -9
  204. package/dist/types/multistream/remoteMediaManager.d.ts +46 -2
  205. package/dist/types/multistream/sendSlotManager.d.ts +61 -0
  206. package/dist/types/reachability/index.d.ts +61 -7
  207. package/dist/types/reachability/request.d.ts +7 -3
  208. package/dist/types/reconnection-manager/index.d.ts +9 -0
  209. package/dist/types/recording-controller/index.d.ts +15 -1
  210. package/dist/types/recording-controller/util.d.ts +5 -4
  211. package/dist/types/roap/index.d.ts +2 -1
  212. package/dist/types/roap/request.d.ts +15 -11
  213. package/dist/types/roap/turnDiscovery.d.ts +21 -3
  214. package/dist/types/rtcMetrics/constants.d.ts +4 -0
  215. package/dist/types/rtcMetrics/index.d.ts +47 -0
  216. package/dist/types/statsAnalyzer/index.d.ts +7 -1
  217. package/dist/types/webinar/collection.d.ts +16 -0
  218. package/dist/types/webinar/index.d.ts +5 -0
  219. package/dist/webinar/collection.js +44 -0
  220. package/dist/webinar/collection.js.map +1 -0
  221. package/dist/webinar/index.js +69 -0
  222. package/dist/webinar/index.js.map +1 -0
  223. package/package.json +23 -20
  224. package/src/annotation/annotation.types.ts +50 -0
  225. package/src/annotation/constants.ts +36 -0
  226. package/src/annotation/index.ts +328 -0
  227. package/src/breakouts/README.md +42 -12
  228. package/src/breakouts/breakout.ts +67 -9
  229. package/src/breakouts/edit-lock-error.ts +25 -0
  230. package/src/breakouts/events.ts +56 -0
  231. package/src/breakouts/index.ts +592 -20
  232. package/src/breakouts/utils.ts +42 -0
  233. package/src/common/errors/no-meeting-info.ts +24 -0
  234. package/src/common/errors/reclaim-host-role-errors.ts +134 -0
  235. package/src/common/errors/webex-errors.ts +44 -2
  236. package/src/common/logs/logger-proxy.ts +1 -1
  237. package/src/common/logs/request.ts +5 -1
  238. package/src/common/queue.ts +22 -8
  239. package/src/config.ts +4 -10
  240. package/src/constants.ts +221 -19
  241. package/src/controls-options-manager/enums.ts +12 -0
  242. package/src/controls-options-manager/index.ts +116 -21
  243. package/src/controls-options-manager/types.ts +59 -0
  244. package/src/controls-options-manager/util.ts +294 -14
  245. package/src/index.ts +40 -0
  246. package/src/interpretation/README.md +60 -0
  247. package/src/interpretation/collection.ts +19 -0
  248. package/src/interpretation/index.ts +332 -0
  249. package/src/interpretation/siLanguage.ts +18 -0
  250. package/src/locus-info/controlsUtils.ts +108 -0
  251. package/src/locus-info/index.ts +413 -59
  252. package/src/locus-info/infoUtils.ts +10 -2
  253. package/src/locus-info/mediaSharesUtils.ts +64 -0
  254. package/src/locus-info/parser.ts +258 -47
  255. package/src/locus-info/selfUtils.ts +81 -5
  256. package/src/media/index.ts +102 -122
  257. package/src/media/properties.ts +87 -110
  258. package/src/meeting/in-meeting-actions.ts +163 -3
  259. package/src/meeting/index.ts +3132 -2541
  260. package/src/meeting/locusMediaRequest.ts +313 -0
  261. package/src/meeting/muteState.ts +229 -131
  262. package/src/meeting/request.ts +177 -121
  263. package/src/meeting/util.ts +588 -394
  264. package/src/meeting-info/index.ts +81 -8
  265. package/src/meeting-info/meeting-info-v2.ts +170 -14
  266. package/src/meeting-info/util.ts +1 -1
  267. package/src/meeting-info/utilv2.ts +23 -23
  268. package/src/meetings/collection.ts +33 -0
  269. package/src/meetings/index.ts +445 -123
  270. package/src/meetings/meetings.types.ts +12 -0
  271. package/src/meetings/request.ts +2 -0
  272. package/src/meetings/util.ts +80 -11
  273. package/src/member/index.ts +58 -0
  274. package/src/member/types.ts +38 -0
  275. package/src/member/util.ts +141 -25
  276. package/src/members/collection.ts +8 -0
  277. package/src/members/index.ts +134 -8
  278. package/src/members/request.ts +97 -17
  279. package/src/members/types.ts +29 -0
  280. package/src/members/util.ts +333 -240
  281. package/src/metrics/constants.ts +12 -4
  282. package/src/metrics/index.ts +1 -490
  283. package/src/multistream/mediaRequestManager.ts +289 -79
  284. package/src/multistream/receiveSlot.ts +31 -17
  285. package/src/multistream/receiveSlotManager.ts +34 -24
  286. package/src/multistream/remoteMedia.ts +27 -2
  287. package/src/multistream/remoteMediaGroup.ts +59 -0
  288. package/src/multistream/remoteMediaManager.ts +148 -30
  289. package/src/multistream/sendSlotManager.ts +170 -0
  290. package/src/reachability/index.ts +228 -37
  291. package/src/reachability/request.ts +17 -8
  292. package/src/reconnection-manager/index.ts +83 -56
  293. package/src/recording-controller/index.ts +20 -3
  294. package/src/recording-controller/util.ts +26 -9
  295. package/src/roap/index.ts +63 -32
  296. package/src/roap/request.ts +100 -104
  297. package/src/roap/turnDiscovery.ts +48 -26
  298. package/src/rtcMetrics/constants.ts +3 -0
  299. package/src/rtcMetrics/index.ts +100 -0
  300. package/src/statsAnalyzer/index.ts +105 -91
  301. package/src/statsAnalyzer/mqaUtil.ts +13 -14
  302. package/src/webinar/collection.ts +31 -0
  303. package/src/webinar/index.ts +62 -0
  304. package/test/integration/spec/converged-space-meetings.js +60 -3
  305. package/test/integration/spec/journey.js +320 -261
  306. package/test/integration/spec/space-meeting.js +76 -3
  307. package/test/unit/spec/annotation/index.ts +418 -0
  308. package/test/unit/spec/breakouts/breakout.ts +118 -28
  309. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  310. package/test/unit/spec/breakouts/events.ts +89 -0
  311. package/test/unit/spec/breakouts/index.ts +1395 -69
  312. package/test/unit/spec/breakouts/utils.js +52 -1
  313. package/test/unit/spec/common/queue.js +31 -2
  314. package/test/unit/spec/controls-options-manager/index.js +163 -0
  315. package/test/unit/spec/controls-options-manager/util.js +576 -60
  316. package/test/unit/spec/fixture/locus.js +1 -0
  317. package/test/unit/spec/interpretation/collection.ts +15 -0
  318. package/test/unit/spec/interpretation/index.ts +589 -0
  319. package/test/unit/spec/interpretation/siLanguage.ts +28 -0
  320. package/test/unit/spec/locus-info/controlsUtils.js +316 -43
  321. package/test/unit/spec/locus-info/index.js +1304 -33
  322. package/test/unit/spec/locus-info/infoUtils.js +37 -15
  323. package/test/unit/spec/locus-info/lib/SeqCmp.json +16 -0
  324. package/test/unit/spec/locus-info/mediaSharesUtils.ts +32 -0
  325. package/test/unit/spec/locus-info/parser.js +116 -35
  326. package/test/unit/spec/locus-info/selfConstant.js +27 -4
  327. package/test/unit/spec/locus-info/selfUtils.js +208 -17
  328. package/test/unit/spec/media/index.ts +104 -37
  329. package/test/unit/spec/media/properties.ts +2 -2
  330. package/test/unit/spec/meeting/in-meeting-actions.ts +81 -3
  331. package/test/unit/spec/meeting/index.js +5216 -1956
  332. package/test/unit/spec/meeting/locusMediaRequest.ts +442 -0
  333. package/test/unit/spec/meeting/muteState.js +408 -208
  334. package/test/unit/spec/meeting/request.js +483 -49
  335. package/test/unit/spec/meeting/utils.js +679 -64
  336. package/test/unit/spec/meeting-info/index.js +300 -0
  337. package/test/unit/spec/meeting-info/meetinginfov2.js +526 -5
  338. package/test/unit/spec/meeting-info/utilv2.js +21 -0
  339. package/test/unit/spec/meetings/collection.js +26 -0
  340. package/test/unit/spec/meetings/index.js +1011 -205
  341. package/test/unit/spec/meetings/utils.js +202 -2
  342. package/test/unit/spec/member/index.js +61 -6
  343. package/test/unit/spec/member/util.js +510 -34
  344. package/test/unit/spec/members/index.js +432 -1
  345. package/test/unit/spec/members/request.js +206 -27
  346. package/test/unit/spec/members/utils.js +210 -0
  347. package/test/unit/spec/metrics/index.js +1 -50
  348. package/test/unit/spec/multistream/mediaRequestManager.ts +803 -162
  349. package/test/unit/spec/multistream/receiveSlot.ts +28 -20
  350. package/test/unit/spec/multistream/receiveSlotManager.ts +32 -30
  351. package/test/unit/spec/multistream/remoteMedia.ts +30 -0
  352. package/test/unit/spec/multistream/remoteMediaGroup.ts +266 -0
  353. package/test/unit/spec/multistream/remoteMediaManager.ts +326 -0
  354. package/test/unit/spec/multistream/sendSlotManager.ts +242 -0
  355. package/test/unit/spec/reachability/index.ts +549 -9
  356. package/test/unit/spec/reachability/request.js +68 -0
  357. package/test/unit/spec/reconnection-manager/index.js +85 -9
  358. package/test/unit/spec/recording-controller/index.js +294 -218
  359. package/test/unit/spec/recording-controller/util.js +223 -96
  360. package/test/unit/spec/roap/index.ts +178 -64
  361. package/test/unit/spec/roap/request.ts +203 -85
  362. package/test/unit/spec/roap/turnDiscovery.ts +82 -36
  363. package/test/unit/spec/rtcMetrics/index.ts +73 -0
  364. package/test/unit/spec/stats-analyzer/index.js +136 -2
  365. package/test/unit/spec/webinar/collection.ts +13 -0
  366. package/test/unit/spec/webinar/index.ts +60 -0
  367. package/test/utils/integrationTestUtils.js +46 -0
  368. package/test/utils/testUtils.js +0 -52
  369. package/dist/meeting/effectsState.js +0 -262
  370. package/dist/meeting/effectsState.js.map +0 -1
  371. package/dist/metrics/config.js +0 -299
  372. package/dist/metrics/config.js.map +0 -1
  373. package/dist/types/meeting/effectsState.d.ts +0 -42
  374. package/dist/types/metrics/config.d.ts +0 -178
  375. package/src/index.js +0 -16
  376. package/src/meeting/effectsState.ts +0 -211
  377. package/src/metrics/config.ts +0 -495
  378. package/test/unit/spec/meeting/effectsState.js +0 -285
@@ -13,7 +13,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/he
13
13
  var _difference2 = _interopRequireDefault(require("lodash/difference"));
14
14
  var _queue = _interopRequireDefault(require("../common/queue"));
15
15
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
16
+ var _metrics = _interopRequireDefault(require("../metrics"));
17
+ var _constants = _interopRequireDefault(require("../metrics/constants"));
16
18
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
19
+ var MAX_OOO_DELTA_COUNT = 5; // when we receive an out-of-order delta and the queue builds up to MAX_OOO_DELTA_COUNT, we do a sync with Locus
20
+ var OOO_DELTA_WAIT_TIME = 10000; // [ms] minimum wait time before we do a sync if we get out-of-order deltas
21
+ var OOO_DELTA_WAIT_TIME_RANDOM_DELAY = 5000; // [ms] max random delay added to OOO_DELTA_WAIT_TIME
17
22
  /**
18
23
  * Locus Delta Parser
19
24
  * @private
@@ -22,6 +27,8 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
22
27
  var Parser = /*#__PURE__*/function () {
23
28
  // processing status
24
29
 
30
+ // received an out-of-order delta, so waiting for the missing one
31
+
25
32
  // loci comparison states
26
33
 
27
34
  /**
@@ -29,24 +36,72 @@ var Parser = /*#__PURE__*/function () {
29
36
  */
30
37
  function Parser() {
31
38
  (0, _classCallCheck2.default)(this, Parser);
39
+ (0, _defineProperty2.default)(this, "status", void 0);
32
40
  (0, _defineProperty2.default)(this, "queue", void 0);
33
41
  (0, _defineProperty2.default)(this, "workingCopy", void 0);
34
- this.queue = new _queue.default();
35
- // @ts-ignore - This is declared as static class member and again being initialized here from same
36
- this.status = Parser.status.IDLE;
42
+ (0, _defineProperty2.default)(this, "syncTimer", void 0);
43
+ var deltaCompareFunc = function deltaCompareFunc(left, right) {
44
+ var _Parser$loci = Parser.loci,
45
+ LT = _Parser$loci.LT,
46
+ GT = _Parser$loci.GT;
47
+ var extract = Parser.extractComparisonState;
48
+ if (Parser.isSequenceEmpty(left)) {
49
+ return -1;
50
+ }
51
+ if (Parser.isSequenceEmpty(right)) {
52
+ return 1;
53
+ }
54
+ var result = extract(Parser.compareSequence(left.baseSequence, right.baseSequence));
55
+ if (result === LT) {
56
+ return -1;
57
+ }
58
+ if (result === GT) {
59
+ return 1;
60
+ }
61
+ return 0;
62
+ };
63
+ this.queue = new _queue.default(deltaCompareFunc);
64
+ this.status = 'IDLE';
37
65
  this.onDeltaAction = null;
38
66
  this.workingCopy = null;
67
+ this.syncTimer = null;
39
68
  }
40
69
 
41
70
  /**
42
- * Checks if two sequences overlap in time,
43
- * the sequence with the higher minimum value is greater.
44
- * Chooses sequence with most recent data.
45
- * @param {Types~Locus} current
46
- * @param {Types~Locus} incoming
47
- * @returns {string} loci comparison state
71
+ * Returns a debug string representing a locus delta - useful for logging
72
+ *
73
+ * @param {LocusDeltaDto} locus Locus delta
74
+ * @returns {string}
48
75
  */
49
76
  (0, _createClass2.default)(Parser, [{
77
+ key: "isNewFullLocus",
78
+ value:
79
+ /**
80
+ * Returns true if the incoming full locus DTO is newer than the current working copy
81
+ *
82
+ * @param {Types~Locus} incomingFullDto New Full Locus DTO
83
+ * @returns {string} either Parser.loci.USE_INCOMING or Parser.loci.USE_CURRENT
84
+ */
85
+ function isNewFullLocus(incomingFullDto) {
86
+ if (!Parser.isLoci(incomingFullDto)) {
87
+ _loggerProxy.default.logger.info('Locus-info:parser#isNewFullLocus --> Ignoring non-locus object.');
88
+ return false;
89
+ }
90
+ if (!this.workingCopy) {
91
+ // we don't have a working copy yet, so any full locus is better than nothing
92
+ return true;
93
+ }
94
+ var comparisonResult = Parser.compareFullDtoSequence(this.workingCopy, incomingFullDto);
95
+ return comparisonResult === Parser.loci.USE_INCOMING;
96
+ }
97
+
98
+ /**
99
+ * Compares Locus sequences
100
+ * @param {Types~Locus} current Current working copy
101
+ * @param {Types~Locus} incoming New Locus delta
102
+ * @returns {string}
103
+ */
104
+ }, {
50
105
  key: "isValidLocus",
51
106
  value:
52
107
  /**
@@ -55,19 +110,11 @@ var Parser = /*#__PURE__*/function () {
55
110
  * @returns {boolean}
56
111
  */
57
112
  function isValidLocus(newLoci) {
58
- var _this = this;
59
113
  var isValid = false;
60
- var IDLE = Parser.status.IDLE;
61
114
  var isLoci = Parser.isLoci;
62
- // @ts-ignore
63
- var setStatus = function setStatus(status) {
64
- // @ts-ignore
65
- _this.status = status;
66
- };
67
115
 
68
116
  // one or both objects are not locus delta events
69
117
  if (!isLoci(this.workingCopy) || !isLoci(newLoci)) {
70
- setStatus(IDLE);
71
118
  _loggerProxy.default.logger.info('Locus-info:parser#processDeltaEvent --> Ignoring non-locus object. workingCopy:', this.workingCopy, 'newLoci:', newLoci);
72
119
  } else {
73
120
  isValid = true;
@@ -89,18 +136,20 @@ var Parser = /*#__PURE__*/function () {
89
136
  * @returns {undefined}
90
137
  */
91
138
  function nextEvent() {
92
- // @ts-ignore
93
- if (this.status === Parser.status.PAUSED) {
139
+ if (this.status === 'PAUSED') {
94
140
  _loggerProxy.default.logger.info('Locus-info:parser#nextEvent --> Locus parser paused.');
95
141
  return;
96
142
  }
143
+ if (this.status === 'BLOCKED') {
144
+ _loggerProxy.default.logger.info('Locus-info:parser#nextEvent --> Locus parser blocked by out-of-order delta.');
145
+ return;
146
+ }
97
147
 
98
148
  // continue processing until queue is empty
99
149
  if (this.queue.size() > 0) {
100
150
  this.processDeltaEvent();
101
151
  } else {
102
- // @ts-ignore
103
- this.status = Parser.status.IDLE;
152
+ this.status = 'IDLE';
104
153
  }
105
154
  }
106
155
 
@@ -111,7 +160,7 @@ var Parser = /*#__PURE__*/function () {
111
160
  * @param {Types~Locus} locus Locus delta
112
161
  * @returns {undefined}
113
162
  */
114
- // eslint-disable-next-line no-unused-vars
163
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
115
164
  }, {
116
165
  key: "onDeltaAction",
117
166
  value: function onDeltaAction(action, locus) {}
@@ -126,14 +175,18 @@ var Parser = /*#__PURE__*/function () {
126
175
  value: function onDeltaEvent(loci) {
127
176
  // enqueue the new loci
128
177
  this.queue.enqueue(loci);
129
- // start processing events in the queue if idle
130
- // and a function handler is defined
131
- // @ts-ignore
132
- if (this.status === Parser.status.IDLE && this.onDeltaAction) {
133
- // Update status, ensure we only process one event at a time.
134
- // @ts-ignore
135
- this.status = Parser.status.WORKING;
136
- this.processDeltaEvent();
178
+ if (this.onDeltaAction) {
179
+ if (this.status === 'BLOCKED') {
180
+ if (this.queue.size() > MAX_OOO_DELTA_COUNT) {
181
+ this.triggerSync('queue too big, blocked on out-of-order delta');
182
+ } else {
183
+ this.processDeltaEvent();
184
+ }
185
+ } else if (this.status === 'IDLE') {
186
+ // Update status, ensure we only process one event at a time.
187
+ this.status = 'WORKING';
188
+ this.processDeltaEvent();
189
+ }
137
190
  }
138
191
  }
139
192
 
@@ -151,11 +204,61 @@ var Parser = /*#__PURE__*/function () {
151
204
  * @returns {undefined}
152
205
  */
153
206
  function pause() {
154
- // @ts-ignore
155
- this.status = Parser.status.PAUSED;
207
+ this.status = 'PAUSED';
156
208
  _loggerProxy.default.logger.info('Locus-info:parser#pause --> Locus parser paused.');
157
209
  }
158
210
 
211
+ /**
212
+ * Triggers a sync with Locus
213
+ *
214
+ * @param {string} reason used just for logging
215
+ * @returns {undefined}
216
+ */
217
+ }, {
218
+ key: "triggerSync",
219
+ value: function triggerSync(reason) {
220
+ _loggerProxy.default.logger.info("Locus-info:parser#triggerSync --> doing sync, reason: ".concat(reason));
221
+ this.stopSyncTimer();
222
+ this.pause();
223
+ this.onDeltaAction(Parser.loci.DESYNC, this.workingCopy);
224
+ }
225
+
226
+ /**
227
+ * Starts a timer with a random delay. When that timer expires we will do a sync.
228
+ *
229
+ * The main purpose of this timer is to handle a case when we get some out-of-order deltas,
230
+ * so we start waiting to receive the missing delta. If that delta never arrives, this timer
231
+ * will trigger a sync with Locus.
232
+ *
233
+ * @returns {undefined}
234
+ */
235
+ }, {
236
+ key: "startSyncTimer",
237
+ value: function startSyncTimer() {
238
+ var _this = this;
239
+ if (this.syncTimer === null) {
240
+ var timeout = OOO_DELTA_WAIT_TIME + Math.random() * OOO_DELTA_WAIT_TIME_RANDOM_DELAY;
241
+ this.syncTimer = setTimeout(function () {
242
+ _this.syncTimer = null;
243
+ _this.triggerSync('timer expired, blocked on out-of-order delta');
244
+ }, timeout);
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Stops the timer for triggering a sync
250
+ *
251
+ * @returns {undefined}
252
+ */
253
+ }, {
254
+ key: "stopSyncTimer",
255
+ value: function stopSyncTimer() {
256
+ if (this.syncTimer !== null) {
257
+ clearTimeout(this.syncTimer);
258
+ this.syncTimer = null;
259
+ }
260
+ }
261
+
159
262
  /**
160
263
  * Processes next locus delta in the queue,
161
264
  * continues until the queue is empty
@@ -165,12 +268,15 @@ var Parser = /*#__PURE__*/function () {
165
268
  }, {
166
269
  key: "processDeltaEvent",
167
270
  value: function processDeltaEvent() {
168
- var _Parser$loci = Parser.loci,
169
- DESYNC = _Parser$loci.DESYNC,
170
- USE_INCOMING = _Parser$loci.USE_INCOMING;
271
+ var _Parser$loci2 = Parser.loci,
272
+ DESYNC = _Parser$loci2.DESYNC,
273
+ USE_INCOMING = _Parser$loci2.USE_INCOMING,
274
+ WAIT = _Parser$loci2.WAIT,
275
+ LOCUS_URL_CHANGED = _Parser$loci2.LOCUS_URL_CHANGED;
171
276
  var extract = Parser.extractComparisonState;
172
277
  var newLoci = this.queue.dequeue();
173
278
  if (!this.isValidLocus(newLoci)) {
279
+ this.nextEvent();
174
280
  return;
175
281
  }
176
282
  var result = Parser.compare(this.workingCopy, newLoci);
@@ -179,20 +285,42 @@ var Parser = /*#__PURE__*/function () {
179
285
  // limited debugging, use chrome extension
180
286
  // for full debugging.
181
287
  _loggerProxy.default.logger.debug("Locus-info:parser#processDeltaEvent --> Locus Debug: ".concat(result));
182
- if (lociComparison === DESYNC) {
183
- // wait for desync response
184
- this.pause();
185
- } else if (lociComparison === USE_INCOMING) {
186
- // update working copy for future comparisons.
187
- // Note: The working copy of parser gets updated in .onFullLocus()
188
- // and here when USE_INCOMING locus.
189
- this.workingCopy = newLoci;
288
+ var needToWait = false;
289
+ switch (lociComparison) {
290
+ case DESYNC:
291
+ // wait for desync response
292
+ this.pause();
293
+ break;
294
+ case USE_INCOMING:
295
+ case LOCUS_URL_CHANGED:
296
+ // update working copy for future comparisons.
297
+ // Note: The working copy of parser gets updated in .onFullLocus()
298
+ // and here when USE_INCOMING or LOCUS_URL_CHANGED locus.
299
+ this.workingCopy = newLoci;
300
+ break;
301
+ case WAIT:
302
+ // we've taken newLoci from the front of the queue, so put it back there as we have to wait
303
+ // for the one that should be in front of it, before we can process it
304
+ this.queue.enqueue(newLoci);
305
+ needToWait = true;
306
+ break;
307
+ default:
308
+ break;
309
+ }
310
+ if (needToWait) {
311
+ this.status = 'BLOCKED';
312
+ this.startSyncTimer();
313
+ } else {
314
+ this.stopSyncTimer();
315
+ if (this.status === 'BLOCKED') {
316
+ // we are not blocked anymore
317
+ this.status = 'WORKING';
318
+ _loggerProxy.default.logger.info("Locus-info:parser#processDeltaEvent --> received delta that we were waiting for ".concat(Parser.locus2string(newLoci), ", not blocked anymore"));
319
+ }
190
320
  }
191
321
  if (this.onDeltaAction) {
192
- _loggerProxy.default.logger.info("Locus-info:parser#processDeltaEvent --> Locus Delta Action: ".concat(lociComparison));
193
-
194
- // eslint-disable-next-line no-useless-call
195
- this.onDeltaAction.call(this, lociComparison, newLoci);
322
+ _loggerProxy.default.logger.info("Locus-info:parser#processDeltaEvent --> Locus Delta ".concat(Parser.locus2string(newLoci), ", Action: ").concat(lociComparison));
323
+ this.onDeltaAction(lociComparison, newLoci);
196
324
  }
197
325
  this.nextEvent();
198
326
  }
@@ -205,8 +333,7 @@ var Parser = /*#__PURE__*/function () {
205
333
  key: "resume",
206
334
  value: function resume() {
207
335
  _loggerProxy.default.logger.info('Locus-info:parser#resume --> Locus parser resumed.');
208
- // @ts-ignore
209
- this.status = Parser.status.WORKING;
336
+ this.status = 'WORKING';
210
337
  this.nextEvent();
211
338
  }
212
339
 
@@ -217,6 +344,24 @@ var Parser = /*#__PURE__*/function () {
217
344
  * @returns {object} Debug message
218
345
  */
219
346
  }], [{
347
+ key: "locus2string",
348
+ value: function locus2string(locus) {
349
+ var _locus$sequence;
350
+ if (!((_locus$sequence = locus.sequence) !== null && _locus$sequence !== void 0 && _locus$sequence.entries)) {
351
+ return 'invalid';
352
+ }
353
+ return locus.sequence.entries.length ? "seq=".concat(locus.sequence.entries.at(-1)) : 'empty';
354
+ }
355
+
356
+ /**
357
+ * Checks if two sequences overlap in time,
358
+ * the sequence with the higher minimum value is greater.
359
+ * Chooses sequence with most recent data.
360
+ * @param {Types~Locus} current
361
+ * @param {Types~Locus} incoming
362
+ * @returns {string} loci comparison state
363
+ */
364
+ }, {
220
365
  key: "checkSequenceOverlap",
221
366
  value: function checkSequenceOverlap(current, incoming) {
222
367
  var comparison = null;
@@ -381,12 +526,14 @@ var Parser = /*#__PURE__*/function () {
381
526
  }, {
382
527
  key: "compareDelta",
383
528
  value: function compareDelta(current, incoming) {
384
- var _Parser$loci2 = Parser.loci,
385
- LT = _Parser$loci2.LT,
386
- GT = _Parser$loci2.GT,
387
- EQ = _Parser$loci2.EQ,
388
- DESYNC = _Parser$loci2.DESYNC,
389
- USE_INCOMING = _Parser$loci2.USE_INCOMING;
529
+ var _Parser$loci3 = Parser.loci,
530
+ LT = _Parser$loci3.LT,
531
+ GT = _Parser$loci3.GT,
532
+ EQ = _Parser$loci3.EQ,
533
+ DESYNC = _Parser$loci3.DESYNC,
534
+ USE_INCOMING = _Parser$loci3.USE_INCOMING,
535
+ WAIT = _Parser$loci3.WAIT,
536
+ LOCUS_URL_CHANGED = _Parser$loci3.LOCUS_URL_CHANGED;
390
537
  var extract = Parser.extractComparisonState;
391
538
  var pack = Parser.packComparisonResult;
392
539
  var result = Parser.compareSequence(current.sequence, incoming.sequence);
@@ -394,12 +541,32 @@ var Parser = /*#__PURE__*/function () {
394
541
  if (comparison !== LT) {
395
542
  return pack(Parser.compareToAction(comparison), result);
396
543
  }
544
+ if (incoming.url !== current.url) {
545
+ // when moving to/from a breakout session, the locus URL will change and also
546
+ // the baseSequence, making incoming and current incomparable, so use a
547
+ // unique comparison state
548
+ return pack(LOCUS_URL_CHANGED, result);
549
+ }
397
550
  comparison = Parser.compareSequence(current.sequence, incoming.baseSequence);
398
551
  switch (extract(comparison)) {
399
552
  case GT:
400
553
  case EQ:
401
554
  comparison = USE_INCOMING;
402
555
  break;
556
+ case LT:
557
+ if (extract(Parser.compareSequence(incoming.baseSequence, incoming.sequence)) === EQ) {
558
+ // special case where Locus sends a delta with baseSequence === sequence to trigger a sync,
559
+ // because the delta event is too large to be sent over mercury connection
560
+ comparison = DESYNC;
561
+ } else {
562
+ // the incoming locus has baseSequence from the future, so it is out-of-order,
563
+ // we are missing 1 or more locus that should be in front of it, we need to wait for it
564
+ comparison = WAIT;
565
+ _metrics.default.sendBehavioralMetric(_constants.default.LOCUS_DELTA_OUT_OF_ORDER, {
566
+ stack: new Error().stack
567
+ });
568
+ }
569
+ break;
403
570
  default:
404
571
  comparison = DESYNC;
405
572
  }
@@ -407,11 +574,24 @@ var Parser = /*#__PURE__*/function () {
407
574
  }
408
575
 
409
576
  /**
410
- * Compares Locus sequences
577
+ * Compares Locus sequences - it should be called only for full Locus DTOs, not deltas
578
+ *
411
579
  * @param {Types~Locus} current Current working copy
412
- * @param {Types~Locus} incoming New Locus delta
413
- * @returns {string}
580
+ * @param {Types~Locus} incomingFullDto New Full Locus DTO
581
+ * @returns {string} either Parser.loci.USE_INCOMING or Parser.loci.USE_CURRENT
414
582
  */
583
+ }, {
584
+ key: "compareFullDtoSequence",
585
+ value: function compareFullDtoSequence(current, incomingFullDto) {
586
+ if (Parser.isSequenceEmpty(current) || Parser.isSequenceEmpty(incomingFullDto)) {
587
+ return Parser.loci.USE_INCOMING;
588
+ }
589
+
590
+ // the sequence.entries list will always contain at least 1 entry
591
+ // https://sqbu-github.cisco.com/WebExSquared/cloud-apps/wiki/Locus-Sequence-Comparison-Algorithm
592
+
593
+ return incomingFullDto.sequence.entries.slice(-1)[0] > current.sequence.entries.slice(-1)[0] ? Parser.loci.USE_INCOMING : Parser.loci.USE_CURRENT;
594
+ }
415
595
  }, {
416
596
  key: "compareSequence",
417
597
  value: function compareSequence(current, incoming) {
@@ -452,14 +632,14 @@ var Parser = /*#__PURE__*/function () {
452
632
  }, {
453
633
  key: "compareToAction",
454
634
  value: function compareToAction(result) {
455
- var _Parser$loci3 = Parser.loci,
456
- DESYNC = _Parser$loci3.DESYNC,
457
- EQ = _Parser$loci3.EQ,
458
- ERROR = _Parser$loci3.ERROR,
459
- GT = _Parser$loci3.GT,
460
- LT = _Parser$loci3.LT,
461
- USE_CURRENT = _Parser$loci3.USE_CURRENT,
462
- USE_INCOMING = _Parser$loci3.USE_INCOMING;
635
+ var _Parser$loci4 = Parser.loci,
636
+ DESYNC = _Parser$loci4.DESYNC,
637
+ EQ = _Parser$loci4.EQ,
638
+ ERROR = _Parser$loci4.ERROR,
639
+ GT = _Parser$loci4.GT,
640
+ LT = _Parser$loci4.LT,
641
+ USE_CURRENT = _Parser$loci4.USE_CURRENT,
642
+ USE_INCOMING = _Parser$loci4.USE_INCOMING;
463
643
  var action = ERROR;
464
644
  switch (result) {
465
645
  case EQ:
@@ -675,11 +855,6 @@ var Parser = /*#__PURE__*/function () {
675
855
  return Parser;
676
856
  }();
677
857
  exports.default = Parser;
678
- (0, _defineProperty2.default)(Parser, "status", {
679
- IDLE: 'IDLE',
680
- PAUSED: 'PAUSED',
681
- WORKING: 'WORKING'
682
- });
683
858
  (0, _defineProperty2.default)(Parser, "loci", {
684
859
  EQ: 'EQUAL',
685
860
  GT: 'GREATER_THAN',
@@ -687,6 +862,8 @@ exports.default = Parser;
687
862
  DESYNC: 'DESYNC',
688
863
  USE_INCOMING: 'USE_INCOMING',
689
864
  USE_CURRENT: 'USE_CURRENT',
690
- ERROR: 'ERROR'
865
+ WAIT: 'WAIT',
866
+ ERROR: 'ERROR',
867
+ LOCUS_URL_CHANGED: 'LOCUS_URL_CHANGED'
691
868
  });
692
869
  //# sourceMappingURL=parser.js.map