@webex/plugin-meetings 3.0.0-beta.2 → 3.0.0-beta.20

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 (365) hide show
  1. package/UPGRADING.md +9 -9
  2. package/browsers.js +19 -24
  3. package/dist/breakouts/breakout.js +116 -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/index.js +226 -0
  8. package/dist/breakouts/index.js.map +1 -0
  9. package/dist/common/browser-detection.js +1 -20
  10. package/dist/common/browser-detection.js.map +1 -1
  11. package/dist/common/collection.js +5 -20
  12. package/dist/common/collection.js.map +1 -1
  13. package/dist/common/config.js +0 -7
  14. package/dist/common/config.js.map +1 -1
  15. package/dist/common/errors/captcha-error.js +10 -24
  16. package/dist/common/errors/captcha-error.js.map +1 -1
  17. package/dist/common/errors/intent-to-join.js +11 -24
  18. package/dist/common/errors/intent-to-join.js.map +1 -1
  19. package/dist/common/errors/join-meeting.js +12 -25
  20. package/dist/common/errors/join-meeting.js.map +1 -1
  21. package/dist/common/errors/media.js +10 -24
  22. package/dist/common/errors/media.js.map +1 -1
  23. package/dist/common/errors/parameter.js +5 -33
  24. package/dist/common/errors/parameter.js.map +1 -1
  25. package/dist/common/errors/password-error.js +10 -24
  26. package/dist/common/errors/password-error.js.map +1 -1
  27. package/dist/common/errors/permission.js +9 -23
  28. package/dist/common/errors/permission.js.map +1 -1
  29. package/dist/common/errors/reconnection-in-progress.js +0 -17
  30. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  31. package/dist/common/errors/reconnection.js +10 -24
  32. package/dist/common/errors/reconnection.js.map +1 -1
  33. package/dist/common/errors/stats.js +10 -24
  34. package/dist/common/errors/stats.js.map +1 -1
  35. package/dist/common/errors/webex-errors.js +6 -41
  36. package/dist/common/errors/webex-errors.js.map +1 -1
  37. package/dist/common/errors/webex-meetings-error.js +5 -25
  38. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  39. package/dist/common/events/events-scope.js +0 -22
  40. package/dist/common/events/events-scope.js.map +1 -1
  41. package/dist/common/events/events.js +0 -23
  42. package/dist/common/events/events.js.map +1 -1
  43. package/dist/common/events/trigger-proxy.js +0 -12
  44. package/dist/common/events/trigger-proxy.js.map +1 -1
  45. package/dist/common/events/util.js +0 -15
  46. package/dist/common/events/util.js.map +1 -1
  47. package/dist/common/logs/logger-config.js +0 -4
  48. package/dist/common/logs/logger-config.js.map +1 -1
  49. package/dist/common/logs/logger-proxy.js +1 -8
  50. package/dist/common/logs/logger-proxy.js.map +1 -1
  51. package/dist/common/logs/request.js +37 -60
  52. package/dist/common/logs/request.js.map +1 -1
  53. package/dist/common/queue.js +4 -14
  54. package/dist/common/queue.js.map +1 -1
  55. package/dist/config.js +6 -6
  56. package/dist/config.js.map +1 -1
  57. package/dist/constants.js +88 -46
  58. package/dist/constants.js.map +1 -1
  59. package/dist/index.js +1 -17
  60. package/dist/index.js.map +1 -1
  61. package/dist/locus-info/controlsUtils.js +12 -29
  62. package/dist/locus-info/controlsUtils.js.map +1 -1
  63. package/dist/locus-info/embeddedAppsUtils.js +3 -26
  64. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  65. package/dist/locus-info/fullState.js +0 -15
  66. package/dist/locus-info/fullState.js.map +1 -1
  67. package/dist/locus-info/hostUtils.js +4 -12
  68. package/dist/locus-info/hostUtils.js.map +1 -1
  69. package/dist/locus-info/index.js +184 -190
  70. package/dist/locus-info/index.js.map +1 -1
  71. package/dist/locus-info/infoUtils.js +3 -37
  72. package/dist/locus-info/infoUtils.js.map +1 -1
  73. package/dist/locus-info/mediaSharesUtils.js +12 -38
  74. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  75. package/dist/locus-info/parser.js +92 -118
  76. package/dist/locus-info/parser.js.map +1 -1
  77. package/dist/locus-info/selfUtils.js +34 -91
  78. package/dist/locus-info/selfUtils.js.map +1 -1
  79. package/dist/media/index.js +67 -111
  80. package/dist/media/index.js.map +1 -1
  81. package/dist/media/properties.js +80 -114
  82. package/dist/media/properties.js.map +1 -1
  83. package/dist/media/util.js +2 -9
  84. package/dist/media/util.js.map +1 -1
  85. package/dist/mediaQualityMetrics/config.js +10 -12
  86. package/dist/mediaQualityMetrics/config.js.map +1 -1
  87. package/dist/meeting/effectsState.js +125 -190
  88. package/dist/meeting/effectsState.js.map +1 -1
  89. package/dist/meeting/in-meeting-actions.js +5 -14
  90. package/dist/meeting/in-meeting-actions.js.map +1 -1
  91. package/dist/meeting/index.js +1692 -1925
  92. package/dist/meeting/index.js.map +1 -1
  93. package/dist/meeting/muteState.js +36 -77
  94. package/dist/meeting/muteState.js.map +1 -1
  95. package/dist/meeting/request.js +224 -230
  96. package/dist/meeting/request.js.map +1 -1
  97. package/dist/meeting/request.type.js +7 -0
  98. package/dist/meeting/request.type.js.map +1 -0
  99. package/dist/meeting/state.js +21 -31
  100. package/dist/meeting/state.js.map +1 -1
  101. package/dist/meeting/util.js +43 -215
  102. package/dist/meeting/util.js.map +1 -1
  103. package/dist/meeting-info/collection.js +6 -25
  104. package/dist/meeting-info/collection.js.map +1 -1
  105. package/dist/meeting-info/index.js +14 -32
  106. package/dist/meeting-info/index.js.map +1 -1
  107. package/dist/meeting-info/meeting-info-v2.js +193 -268
  108. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  109. package/dist/meeting-info/request.js +3 -15
  110. package/dist/meeting-info/request.js.map +1 -1
  111. package/dist/meeting-info/util.js +98 -183
  112. package/dist/meeting-info/util.js.map +1 -1
  113. package/dist/meeting-info/utilv2.js +137 -228
  114. package/dist/meeting-info/utilv2.js.map +1 -1
  115. package/dist/meetings/collection.js +5 -20
  116. package/dist/meetings/collection.js.map +1 -1
  117. package/dist/meetings/index.js +490 -560
  118. package/dist/meetings/index.js.map +1 -1
  119. package/dist/meetings/request.js +24 -41
  120. package/dist/meetings/request.js.map +1 -1
  121. package/dist/meetings/util.js +99 -155
  122. package/dist/meetings/util.js.map +1 -1
  123. package/dist/member/index.js +78 -86
  124. package/dist/member/index.js.map +1 -1
  125. package/dist/member/util.js +31 -68
  126. package/dist/member/util.js.map +1 -1
  127. package/dist/members/collection.js +3 -12
  128. package/dist/members/collection.js.map +1 -1
  129. package/dist/members/index.js +93 -200
  130. package/dist/members/index.js.map +1 -1
  131. package/dist/members/request.js +16 -39
  132. package/dist/members/request.js.map +1 -1
  133. package/dist/members/util.js +9 -38
  134. package/dist/members/util.js.map +1 -1
  135. package/dist/metrics/config.js +0 -2
  136. package/dist/metrics/config.js.map +1 -1
  137. package/dist/metrics/constants.js +1 -2
  138. package/dist/metrics/constants.js.map +1 -1
  139. package/dist/metrics/index.js +55 -135
  140. package/dist/metrics/index.js.map +1 -1
  141. package/dist/multistream/mediaRequestManager.js +57 -32
  142. package/dist/multistream/mediaRequestManager.js.map +1 -1
  143. package/dist/multistream/multistreamMedia.js +15 -21
  144. package/dist/multistream/multistreamMedia.js.map +1 -1
  145. package/dist/multistream/receiveSlot.js +10 -50
  146. package/dist/multistream/receiveSlot.js.map +1 -1
  147. package/dist/multistream/receiveSlotManager.js +45 -82
  148. package/dist/multistream/receiveSlotManager.js.map +1 -1
  149. package/dist/multistream/remoteMedia.js +18 -58
  150. package/dist/multistream/remoteMedia.js.map +1 -1
  151. package/dist/multistream/remoteMediaGroup.js +6 -40
  152. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  153. package/dist/multistream/remoteMediaManager.js +362 -416
  154. package/dist/multistream/remoteMediaManager.js.map +1 -1
  155. package/dist/networkQualityMonitor/index.js +36 -57
  156. package/dist/networkQualityMonitor/index.js.map +1 -1
  157. package/dist/personal-meeting-room/index.js +21 -45
  158. package/dist/personal-meeting-room/index.js.map +1 -1
  159. package/dist/personal-meeting-room/request.js +1 -31
  160. package/dist/personal-meeting-room/request.js.map +1 -1
  161. package/dist/personal-meeting-room/util.js +0 -13
  162. package/dist/personal-meeting-room/util.js.map +1 -1
  163. package/dist/reachability/index.js +138 -182
  164. package/dist/reachability/index.js.map +1 -1
  165. package/dist/reachability/request.js +3 -18
  166. package/dist/reachability/request.js.map +1 -1
  167. package/dist/reactions/constants.js +13 -0
  168. package/dist/reactions/constants.js.map +1 -0
  169. package/dist/reactions/reactions.js +109 -0
  170. package/dist/reactions/reactions.js.map +1 -0
  171. package/dist/reactions/reactions.type.js +36 -0
  172. package/dist/reactions/reactions.type.js.map +1 -0
  173. package/dist/reconnection-manager/index.js +322 -455
  174. package/dist/reconnection-manager/index.js.map +1 -1
  175. package/dist/recording-controller/enums.js +17 -0
  176. package/dist/recording-controller/enums.js.map +1 -0
  177. package/dist/recording-controller/index.js +343 -0
  178. package/dist/recording-controller/index.js.map +1 -0
  179. package/dist/recording-controller/util.js +63 -0
  180. package/dist/recording-controller/util.js.map +1 -0
  181. package/dist/roap/index.js +39 -64
  182. package/dist/roap/index.js.map +1 -1
  183. package/dist/roap/request.js +94 -113
  184. package/dist/roap/request.js.map +1 -1
  185. package/dist/roap/turnDiscovery.js +85 -94
  186. package/dist/roap/turnDiscovery.js.map +1 -1
  187. package/dist/statsAnalyzer/global.js +0 -2
  188. package/dist/statsAnalyzer/global.js.map +1 -1
  189. package/dist/statsAnalyzer/index.js +85 -175
  190. package/dist/statsAnalyzer/index.js.map +1 -1
  191. package/dist/statsAnalyzer/mqaUtil.js +72 -53
  192. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  193. package/dist/transcription/index.js +22 -47
  194. package/dist/transcription/index.js.map +1 -1
  195. package/internal-README.md +7 -6
  196. package/package.json +25 -20
  197. package/src/breakouts/README.md +190 -0
  198. package/src/breakouts/breakout.ts +110 -0
  199. package/src/breakouts/collection.ts +19 -0
  200. package/src/breakouts/index.ts +225 -0
  201. package/src/common/{browser-detection.js → browser-detection.ts} +9 -6
  202. package/src/common/collection.ts +9 -7
  203. package/src/common/{config.js → config.ts} +1 -1
  204. package/src/common/errors/{captcha-error.js → captcha-error.ts} +11 -7
  205. package/src/common/errors/{intent-to-join.js → intent-to-join.ts} +12 -7
  206. package/src/common/errors/{join-meeting.js → join-meeting.ts} +17 -8
  207. package/src/common/errors/{media.js → media.ts} +11 -7
  208. package/src/common/errors/parameter.ts +11 -7
  209. package/src/common/errors/{password-error.js → password-error.ts} +11 -7
  210. package/src/common/errors/{permission.js → permission.ts} +10 -6
  211. package/src/common/errors/{reconnection-in-progress.js → reconnection-in-progress.ts} +0 -0
  212. package/src/common/errors/{reconnection.js → reconnection.ts} +11 -7
  213. package/src/common/errors/{stats.js → stats.ts} +11 -7
  214. package/src/common/errors/{webex-errors.js → webex-errors.ts} +8 -7
  215. package/src/common/errors/{webex-meetings-error.js → webex-meetings-error.ts} +4 -2
  216. package/src/common/events/{events-scope.js → events-scope.ts} +6 -2
  217. package/src/common/events/{events.js → events.ts} +5 -1
  218. package/src/common/events/{trigger-proxy.js → trigger-proxy.ts} +9 -5
  219. package/src/common/events/{util.js → util.ts} +2 -3
  220. package/src/common/logs/{logger-config.js → logger-config.ts} +1 -2
  221. package/src/common/logs/logger-proxy.ts +44 -0
  222. package/src/common/logs/{request.js → request.ts} +22 -9
  223. package/src/common/queue.ts +1 -2
  224. package/src/{config.js → config.ts} +17 -12
  225. package/src/constants.ts +40 -1
  226. package/src/index.js +1 -1
  227. package/src/locus-info/controlsUtils.ts +114 -0
  228. package/src/locus-info/{embeddedAppsUtils.js → embeddedAppsUtils.ts} +5 -6
  229. package/src/locus-info/{fullState.js → fullState.ts} +16 -12
  230. package/src/locus-info/{hostUtils.js → hostUtils.ts} +9 -8
  231. package/src/locus-info/{index.js → index.ts} +148 -64
  232. package/src/locus-info/{infoUtils.js → infoUtils.ts} +19 -8
  233. package/src/locus-info/{mediaSharesUtils.js → mediaSharesUtils.ts} +17 -17
  234. package/src/locus-info/{parser.js → parser.ts} +67 -79
  235. package/src/locus-info/{selfUtils.js → selfUtils.ts} +123 -68
  236. package/src/media/{index.js → index.ts} +181 -131
  237. package/src/media/{properties.js → properties.ts} +47 -28
  238. package/src/media/{util.js → util.ts} +2 -2
  239. package/src/mediaQualityMetrics/{config.js → config.ts} +46 -46
  240. package/src/meeting/{effectsState.js → effectsState.ts} +47 -41
  241. package/src/meeting/in-meeting-actions.ts +15 -3
  242. package/src/meeting/{index.js → index.ts} +2263 -1427
  243. package/src/meeting/{muteState.js → muteState.ts} +78 -42
  244. package/src/meeting/{request.js → request.ts} +292 -142
  245. package/src/meeting/request.type.ts +13 -0
  246. package/src/meeting/{state.js → state.ts} +50 -35
  247. package/src/meeting/{util.js → util.ts} +112 -115
  248. package/src/meeting-info/{collection.js → collection.ts} +6 -2
  249. package/src/meeting-info/{index.js → index.ts} +42 -36
  250. package/src/meeting-info/meeting-info-v2.ts +273 -0
  251. package/src/meeting-info/{request.js → request.ts} +14 -4
  252. package/src/meeting-info/{util.js → util.ts} +60 -51
  253. package/src/meeting-info/{utilv2.js → utilv2.ts} +65 -58
  254. package/src/meetings/{collection.js → collection.ts} +6 -3
  255. package/src/meetings/index.ts +1159 -0
  256. package/src/meetings/{request.js → request.ts} +32 -25
  257. package/src/meetings/{util.js → util.ts} +34 -32
  258. package/src/member/{index.js → index.ts} +102 -56
  259. package/src/member/{util.js → util.ts} +52 -25
  260. package/src/members/{collection.js → collection.ts} +2 -2
  261. package/src/members/{index.js → index.ts} +219 -142
  262. package/src/members/{request.js → request.ts} +60 -16
  263. package/src/members/{util.js → util.ts} +50 -48
  264. package/src/metrics/{config.js → config.ts} +254 -83
  265. package/src/metrics/{constants.js → constants.ts} +0 -2
  266. package/src/metrics/{index.js → index.ts} +106 -74
  267. package/src/multistream/mediaRequestManager.ts +81 -15
  268. package/src/multistream/multistreamMedia.ts +5 -0
  269. package/src/multistream/receiveSlot.ts +18 -12
  270. package/src/multistream/receiveSlotManager.ts +23 -21
  271. package/src/multistream/remoteMedia.ts +15 -5
  272. package/src/multistream/remoteMediaGroup.ts +4 -3
  273. package/src/multistream/remoteMediaManager.ts +153 -37
  274. package/src/networkQualityMonitor/{index.js → index.ts} +37 -25
  275. package/src/personal-meeting-room/{index.js → index.ts} +28 -19
  276. package/src/personal-meeting-room/{request.js → request.ts} +13 -4
  277. package/src/personal-meeting-room/{util.js → util.ts} +4 -4
  278. package/src/reachability/{index.js → index.ts} +99 -83
  279. package/src/reachability/request.ts +39 -33
  280. package/src/reactions/constants.ts +4 -0
  281. package/src/reactions/reactions.ts +104 -0
  282. package/src/reactions/reactions.type.ts +62 -0
  283. package/src/reconnection-manager/{index.js → index.ts} +195 -102
  284. package/src/recording-controller/enums.ts +8 -0
  285. package/src/recording-controller/index.ts +315 -0
  286. package/src/recording-controller/util.ts +58 -0
  287. package/src/roap/{index.js → index.ts} +73 -56
  288. package/src/roap/request.ts +157 -0
  289. package/src/roap/turnDiscovery.ts +77 -37
  290. package/src/statsAnalyzer/{global.js → global.ts} +30 -33
  291. package/src/statsAnalyzer/{index.js → index.ts} +468 -192
  292. package/src/statsAnalyzer/mqaUtil.ts +290 -0
  293. package/src/transcription/{index.js → index.ts} +46 -39
  294. package/test/integration/spec/journey.js +664 -463
  295. package/test/integration/spec/space-meeting.js +320 -206
  296. package/test/integration/spec/transcription.js +7 -8
  297. package/test/unit/spec/breakouts/breakout.ts +119 -0
  298. package/test/unit/spec/breakouts/collection.ts +15 -0
  299. package/test/unit/spec/breakouts/index.ts +293 -0
  300. package/test/unit/spec/common/browser-detection.js +9 -28
  301. package/test/unit/spec/fixture/locus.js +92 -90
  302. package/test/unit/spec/locus-info/controlsUtils.js +25 -5
  303. package/test/unit/spec/locus-info/embeddedAppsUtils.js +8 -6
  304. package/test/unit/spec/locus-info/index.js +104 -2
  305. package/test/unit/spec/locus-info/infoUtils.js +41 -32
  306. package/test/unit/spec/locus-info/lib/BasicSeqCmp.json +88 -430
  307. package/test/unit/spec/locus-info/lib/SeqCmp.json +513 -685
  308. package/test/unit/spec/locus-info/parser.js +3 -9
  309. package/test/unit/spec/locus-info/selfConstant.js +97 -103
  310. package/test/unit/spec/locus-info/selfUtils.js +105 -12
  311. package/test/unit/spec/media/index.ts +31 -47
  312. package/test/unit/spec/media/properties.ts +9 -9
  313. package/test/unit/spec/meeting/effectsState.js +39 -45
  314. package/test/unit/spec/meeting/in-meeting-actions.ts +5 -2
  315. package/test/unit/spec/meeting/index.js +2017 -742
  316. package/test/unit/spec/meeting/muteState.js +42 -33
  317. package/test/unit/spec/meeting/request.js +115 -44
  318. package/test/unit/spec/meeting/utils.js +104 -171
  319. package/test/unit/spec/meeting-info/meetinginfov2.js +100 -73
  320. package/test/unit/spec/meeting-info/request.js +7 -9
  321. package/test/unit/spec/meeting-info/util.js +11 -12
  322. package/test/unit/spec/meeting-info/utilv2.js +110 -74
  323. package/test/unit/spec/meetings/collection.js +1 -1
  324. package/test/unit/spec/meetings/index.js +439 -257
  325. package/test/unit/spec/meetings/utils.js +14 -12
  326. package/test/unit/spec/member/index.js +0 -1
  327. package/test/unit/spec/member/util.js +31 -7
  328. package/test/unit/spec/members/index.js +104 -54
  329. package/test/unit/spec/members/request.js +29 -20
  330. package/test/unit/spec/members/utils.js +8 -5
  331. package/test/unit/spec/metrics/index.js +16 -21
  332. package/test/unit/spec/multistream/mediaRequestManager.ts +316 -50
  333. package/test/unit/spec/multistream/receiveSlot.ts +6 -6
  334. package/test/unit/spec/multistream/receiveSlotManager.ts +13 -13
  335. package/test/unit/spec/multistream/remoteMedia.ts +10 -2
  336. package/test/unit/spec/multistream/remoteMediaGroup.ts +5 -5
  337. package/test/unit/spec/multistream/remoteMediaManager.ts +412 -65
  338. package/test/unit/spec/networkQualityMonitor/index.js +21 -15
  339. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -7
  340. package/test/unit/spec/reachability/index.ts +58 -26
  341. package/test/unit/spec/reconnection-manager/index.js +102 -9
  342. package/test/unit/spec/recording-controller/index.js +231 -0
  343. package/test/unit/spec/recording-controller/util.js +102 -0
  344. package/test/unit/spec/roap/index.ts +2 -1
  345. package/test/unit/spec/roap/request.ts +114 -0
  346. package/test/unit/spec/roap/turnDiscovery.ts +64 -45
  347. package/test/unit/spec/stats-analyzer/index.js +27 -22
  348. package/test/utils/cmr.js +44 -42
  349. package/test/utils/testUtils.js +83 -74
  350. package/test/utils/webex-config.js +18 -18
  351. package/test/utils/webex-test-users.js +54 -50
  352. package/tsconfig.json +6 -0
  353. package/dist/media/internal-media-core-wrapper.js +0 -22
  354. package/dist/media/internal-media-core-wrapper.js.map +0 -1
  355. package/dist/peer-connection-manager/util.js +0 -124
  356. package/dist/peer-connection-manager/util.js.map +0 -1
  357. package/src/common/logs/logger-proxy.js +0 -33
  358. package/src/locus-info/controlsUtils.js +0 -102
  359. package/src/media/internal-media-core-wrapper.ts +0 -9
  360. package/src/meeting-info/meeting-info-v2.js +0 -255
  361. package/src/meetings/index.js +0 -1015
  362. package/src/peer-connection-manager/util.ts +0 -117
  363. package/src/roap/request.js +0 -127
  364. package/src/statsAnalyzer/mqaUtil.js +0 -173
  365. package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +0 -389
@@ -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,CAA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AK,EAAE;UACLN,KAAK,EAAE,wBADF;UAELC,WAAW,EAAER,IAAF,+ZAFN;UAKLS,KAAK,EAAE;QALF,CA7BQ;QAqCfK,KAAK,EAAE;UACLP,KAAK,EAAE,2BADF;UAELC,WAAW,EAAER,IAAF,2cAFN;UAKLS,KAAK,EAAE;QALF,CArCQ;QA6CfM,KAAK,EAAE;UACLR,KAAK,EAAE,2BADF;UAELC,WAAW,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;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AAE;QACT,CAAC;QAEDQ,MAAM,EAAE;UACNV,KAAK,EAAE,sBAAsB;UAC7BC,WAAW,EAAER,IAAI,qdAEiC;UAClDS,KAAK,EAAE;QACT,CAAC;QAEDS,MAAM,EAAE;UACNX,KAAK,EAAE,sBAAsB;UAC7BC,WAAW,EAAER,IAAI,yPACI;UACrBS,KAAK,EAAE;QACT;MACF,CAAC;MAED,IAAMU,QAAQ,GAAGd,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
  });
@@ -65,39 +58,35 @@ SelfUtils.parse = function (self, deviceId) {
65
58
  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
59
  layout: SelfUtils.getLayout(self),
67
60
  canNotViewTheParticipantList: SelfUtils.canNotViewTheParticipantList(self),
68
- isSharingBlocked: SelfUtils.isSharingBlocked(self)
61
+ isSharingBlocked: SelfUtils.isSharingBlocked(self),
62
+ breakoutSessions: SelfUtils.getBreakouts(self)
69
63
  };
70
64
  }
71
-
72
65
  return null;
73
66
  };
74
-
67
+ SelfUtils.getBreakouts = function (self) {
68
+ var _self$controls, _self$controls$breako;
69
+ 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;
70
+ };
75
71
  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;
72
+ var _self$controls2;
73
+ 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
74
  };
80
-
81
75
  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) {
76
+ var _self$controls3, _self$controls3$role;
77
+ 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
78
  if (role.hasRole) {
86
79
  roles.push(role.type);
87
80
  }
88
-
89
81
  return roles;
90
82
  }, []);
91
83
  };
92
-
93
84
  SelfUtils.canNotViewTheParticipantList = function (self) {
94
85
  return !!(self !== null && self !== void 0 && self.canNotViewTheParticipantList);
95
86
  };
96
-
97
87
  SelfUtils.isSharingBlocked = function (self) {
98
88
  return !!(self !== null && self !== void 0 && self.isSharingBlocked);
99
89
  };
100
-
101
90
  SelfUtils.getSelves = function (oldSelf, newSelf, deviceId) {
102
91
  var previous = oldSelf && SelfUtils.parse(oldSelf, deviceId);
103
92
  var current = newSelf && SelfUtils.parse(newSelf, deviceId);
@@ -117,22 +106,23 @@ SelfUtils.getSelves = function (oldSelf, newSelf, deviceId) {
117
106
  updates.shareStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.share) !== current.currentMediaStatus.share;
118
107
  updates.canNotViewTheParticipantListChanged = (previous === null || previous === void 0 ? void 0 : previous.canNotViewTheParticipantList) !== current.canNotViewTheParticipantList;
119
108
  updates.isSharingBlockedChanged = (previous === null || previous === void 0 ? void 0 : previous.isSharingBlocked) !== current.isSharingBlocked;
109
+ updates.breakoutsChanged = SelfUtils.breakoutsChanged(previous, current);
120
110
  return {
121
111
  previous: previous,
122
112
  current: current,
123
113
  updates: updates
124
114
  };
125
115
  };
116
+
126
117
  /**
127
118
  * Checks if user has joined the meeting
128
119
  * @param {Object} self
129
120
  * @returns {boolean} isJoined
130
- */
131
-
132
-
121
+ */
133
122
  SelfUtils.isJoined = function (self) {
134
123
  return (self === null || self === void 0 ? void 0 : self.state) === _constants._JOINED_;
135
124
  };
125
+
136
126
  /**
137
127
  * Validate if the Meeting Layout Controls Layout has changed.
138
128
  *
@@ -140,99 +130,79 @@ SelfUtils.isJoined = function (self) {
140
130
  * @param {Self} current - Current self state [per event]
141
131
  * @returns {boolean} - If the MEeting Layout Controls Layout has changed.
142
132
  */
143
-
144
-
145
133
  SelfUtils.layoutChanged = function (previous, current) {
146
134
  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
135
  };
148
-
136
+ SelfUtils.breakoutsChanged = function (previous, current) {
137
+ return !(0, _isEqual2.default)(previous === null || previous === void 0 ? void 0 : previous.breakoutSessions, current === null || current === void 0 ? void 0 : current.breakoutSessions);
138
+ };
149
139
  SelfUtils.isMediaInactive = function (previous, current) {
150
140
  if (previous && previous.joinedWith && previous.joinedWith.mediaSessions && current && current.joinedWith && current.joinedWith.mediaSessions) {
151
141
  var previousMediaStatus = SelfUtils.getMediaStatus(previous.joinedWith.mediaSessions);
152
142
  var currentMediaStatus = SelfUtils.getMediaStatus(current.joinedWith.mediaSessions);
153
-
154
143
  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
144
  return true;
156
145
  }
157
-
158
146
  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
147
  return true;
160
148
  }
161
-
162
149
  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
150
  return true;
164
151
  }
165
-
166
152
  return false;
167
153
  }
168
-
169
154
  return false;
170
155
  };
171
-
172
156
  SelfUtils.getLastModified = function (self) {
173
157
  if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.lastModified) {
174
158
  return null;
175
159
  }
176
-
177
160
  return self.controls.audio.meta.lastModified;
178
161
  };
179
-
180
162
  SelfUtils.getModifiedBy = function (self) {
181
163
  if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.modifiedBy) {
182
164
  return null;
183
165
  }
184
-
185
166
  return self.controls.audio.meta.modifiedBy;
186
167
  };
168
+
187
169
  /**
188
170
  * get the id from the self object
189
171
  * @param {Object} self
190
172
  * @returns {String}
191
173
  */
192
-
193
-
194
174
  SelfUtils.getSelfIdentity = function (self) {
195
175
  if (!self && !self.person) {
196
176
  return null;
197
177
  }
198
-
199
178
  return self.person.id;
200
179
  };
180
+
201
181
  /**
202
182
  * get the "remote mute" property from the self object
203
183
  * @param {Object} self
204
184
  * @returns {Boolean}
205
185
  */
206
-
207
-
208
186
  SelfUtils.getRemoteMuted = function (self) {
209
187
  if (!self || !self.controls || !self.controls.audio) {
210
188
  return null;
211
189
  }
212
-
213
190
  return self.controls.audio.muted;
214
191
  };
215
-
216
192
  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);
193
+ var _self$controls4, _self$controls4$audio;
194
+ 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
195
  };
221
-
222
196
  SelfUtils.getUnmuteAllowed = function (self) {
223
197
  if (!self || !self.controls || !self.controls.audio) {
224
198
  return null;
225
199
  }
226
-
227
200
  return !self.controls.audio.disallowUnmute;
228
201
  };
229
-
230
202
  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);
203
+ var _self$controls5, _self$controls5$audio;
204
+ 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
205
  };
235
-
236
206
  SelfUtils.getStatus = function (status) {
237
207
  return {
238
208
  audio: status.audioStatus,
@@ -240,138 +210,115 @@ SelfUtils.getStatus = function (status) {
240
210
  slides: status.videoSlidesStatus
241
211
  };
242
212
  };
213
+
243
214
  /**
244
215
  * @param {Object} oldSelf
245
216
  * @param {Object} changedSelf
246
217
  * @returns {Boolean}
247
218
  */
248
-
249
-
250
219
  SelfUtils.wasMediaInactiveOrReleased = function () {
251
220
  var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
252
221
  var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
253
222
  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
223
  };
224
+
255
225
  /**
256
226
  * @param {Object} check
257
227
  * @returns {Boolean}
258
228
  */
259
-
260
-
261
229
  SelfUtils.isLocusUserUnadmitted = function (check) {
262
230
  var _check$joinedWith, _check$joinedWith$int;
263
-
264
231
  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
232
  };
233
+
266
234
  /**
267
235
  * @param {Object} check
268
236
  * @returns {Boolean}
269
237
  */
270
-
271
-
272
238
  SelfUtils.isLocusUserAdmitted = function (check) {
273
239
  var _check$joinedWith2, _check$joinedWith2$in;
274
-
275
240
  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
241
  };
242
+
277
243
  /**
278
244
  * @param {Object} self
279
245
  * @returns {Boolean}
280
246
  * @throws {Error} when self is undefined
281
247
  */
282
-
283
-
284
248
  SelfUtils.isUserUnadmitted = function (self) {
285
249
  if (!self) {
286
250
  throw new _parameter.default('self must be defined to determine if self is unadmitted as guest.');
287
251
  }
288
-
289
252
  return SelfUtils.isLocusUserUnadmitted(self);
290
253
  };
291
-
292
254
  SelfUtils.moderatorChanged = function (oldSelf, changedSelf) {
293
255
  if (!oldSelf) {
294
256
  return true;
295
257
  }
296
-
297
258
  if (!changedSelf) {
298
259
  throw new _parameter.default('New self must be defined to determine if self transitioned moderator status.');
299
260
  }
300
-
301
261
  return oldSelf.moderator !== changedSelf.moderator;
302
262
  };
263
+
303
264
  /**
304
265
  * @param {Object} oldSelf
305
266
  * @param {Object} changedSelf
306
267
  * @returns {Boolean}
307
268
  * @throws {Error} if changed self was undefined
308
269
  */
309
-
310
-
311
270
  SelfUtils.isDeviceObserving = function (oldSelf, changedSelf) {
312
271
  var _oldSelf$joinedWith, _oldSelf$joinedWith$i, _changedSelf$joinedWi, _changedSelf$joinedWi2;
313
-
314
272
  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
273
  };
274
+
316
275
  /**
317
276
  * @param {Object} oldSelf
318
277
  * @param {Object} changedSelf
319
278
  * @returns {Boolean}
320
279
  * @throws {Error} if changed self was undefined
321
280
  */
322
-
323
-
324
281
  SelfUtils.isUserAdmitted = function (oldSelf, changedSelf) {
325
282
  if (!oldSelf) {
326
283
  // if there was no previous locus, it couldn't have been admitted yet
327
284
  return false;
328
285
  }
329
-
330
286
  if (!changedSelf) {
331
287
  throw new _parameter.default('New self must be defined to determine if self transitioned to admitted as guest.');
332
288
  }
333
-
334
289
  return SelfUtils.isLocusUserUnadmitted(oldSelf) && SelfUtils.isLocusUserAdmitted(changedSelf);
335
290
  };
336
-
337
291
  SelfUtils.mutedByOthersChanged = function (oldSelf, changedSelf) {
338
292
  if (!changedSelf) {
339
293
  throw new _parameter.default('New self must be defined to determine if self was muted by others.');
340
294
  }
341
-
342
295
  if (!oldSelf || oldSelf.remoteMuted === null) {
343
296
  if (changedSelf.remoteMuted) {
344
297
  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
-
298
+ }
347
299
 
300
+ // we don't want to be sending the 'meeting:self:unmutedByOthers' notification on meeting join
348
301
  return false;
349
302
  }
350
-
351
303
  return changedSelf.remoteMuted !== null && (oldSelf.remoteMuted !== changedSelf.remoteMuted || changedSelf.remoteMuted && oldSelf.unmuteAllowed !== changedSelf.unmuteAllowed);
352
304
  };
353
-
354
305
  SelfUtils.localAudioUnmuteRequestedByServer = function () {
355
306
  var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
356
307
  var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
357
-
358
308
  if (!changedSelf) {
359
309
  throw new _parameter.default('New self must be defined to determine if self received request to unmute.');
360
310
  }
361
-
362
311
  return changedSelf.localAudioUnmuteRequested && !oldSelf.localAudioUnmuteRequested;
363
312
  };
364
-
365
313
  SelfUtils.localAudioUnmuteRequiredByServer = function () {
366
314
  var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
367
315
  var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
368
-
369
316
  if (!changedSelf) {
370
317
  throw new _parameter.default('New self must be defined to determine if localAudioUnmuteRequired changed.');
371
318
  }
372
-
373
319
  return !changedSelf.remoteMuted && changedSelf.localAudioUnmuteRequired && oldSelf.localAudioUnmuteRequired !== changedSelf.localAudioUnmuteRequired;
374
320
  };
321
+
375
322
  /**
376
323
  * extract the sipUrl from the partner
377
324
  * @param {Object} partner
@@ -379,7 +326,6 @@ SelfUtils.localAudioUnmuteRequiredByServer = function () {
379
326
  * @returns {Object}
380
327
  */
381
328
 
382
-
383
329
  SelfUtils.getSipUrl = function (partner, type, sipUri) {
384
330
  // For webex meeting the sipUrl gets updated in info parser
385
331
  if (partner && type === _constants._CALL_) {
@@ -387,12 +333,10 @@ SelfUtils.getSipUrl = function (partner, type, sipUri) {
387
333
  sipUri: partner.person.sipUrl || partner.person.id
388
334
  };
389
335
  }
390
-
391
336
  return {
392
337
  sipUri: sipUri
393
338
  };
394
339
  };
395
-
396
340
  SelfUtils.getMediaStatus = function () {
397
341
  var mediaSessions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
398
342
  var mediaStatus = {
@@ -411,7 +355,6 @@ SelfUtils.getMediaStatus = function () {
411
355
  });
412
356
  return mediaStatus;
413
357
  };
414
-
415
358
  var _default = SelfUtils;
416
359
  exports.default = _default;
417
360
  //# sourceMappingURL=selfUtils.js.map