@webex/plugin-meetings 2.37.0 → 2.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/UPGRADING.md +9 -9
  2. package/browsers.js +19 -24
  3. package/dist/common/browser-detection.js +1 -20
  4. package/dist/common/browser-detection.js.map +1 -1
  5. package/dist/common/collection.js +5 -20
  6. package/dist/common/collection.js.map +1 -1
  7. package/dist/common/config.js +0 -7
  8. package/dist/common/config.js.map +1 -1
  9. package/dist/common/errors/captcha-error.js +5 -26
  10. package/dist/common/errors/captcha-error.js.map +1 -1
  11. package/dist/common/errors/intent-to-join.js +5 -26
  12. package/dist/common/errors/intent-to-join.js.map +1 -1
  13. package/dist/common/errors/join-meeting.js +6 -27
  14. package/dist/common/errors/join-meeting.js.map +1 -1
  15. package/dist/common/errors/media.js +5 -26
  16. package/dist/common/errors/media.js.map +1 -1
  17. package/dist/common/errors/parameter.js +5 -33
  18. package/dist/common/errors/parameter.js.map +1 -1
  19. package/dist/common/errors/password-error.js +5 -26
  20. package/dist/common/errors/password-error.js.map +1 -1
  21. package/dist/common/errors/permission.js +4 -25
  22. package/dist/common/errors/permission.js.map +1 -1
  23. package/dist/common/errors/reconnection-in-progress.js +0 -17
  24. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  25. package/dist/common/errors/reconnection.js +5 -26
  26. package/dist/common/errors/reconnection.js.map +1 -1
  27. package/dist/common/errors/stats.js +5 -26
  28. package/dist/common/errors/stats.js.map +1 -1
  29. package/dist/common/errors/webex-errors.js +7 -46
  30. package/dist/common/errors/webex-errors.js.map +1 -1
  31. package/dist/common/errors/webex-meetings-error.js +1 -24
  32. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  33. package/dist/common/events/events-scope.js +0 -22
  34. package/dist/common/events/events-scope.js.map +1 -1
  35. package/dist/common/events/events.js +0 -23
  36. package/dist/common/events/events.js.map +1 -1
  37. package/dist/common/events/trigger-proxy.js +0 -12
  38. package/dist/common/events/trigger-proxy.js.map +1 -1
  39. package/dist/common/events/util.js +0 -15
  40. package/dist/common/events/util.js.map +1 -1
  41. package/dist/common/logs/logger-config.js +0 -4
  42. package/dist/common/logs/logger-config.js.map +1 -1
  43. package/dist/common/logs/logger-proxy.js +1 -8
  44. package/dist/common/logs/logger-proxy.js.map +1 -1
  45. package/dist/common/logs/request.js +35 -61
  46. package/dist/common/logs/request.js.map +1 -1
  47. package/dist/common/queue.js +4 -14
  48. package/dist/common/queue.js.map +1 -1
  49. package/dist/config.js +1 -5
  50. package/dist/config.js.map +1 -1
  51. package/dist/constants.js +46 -42
  52. package/dist/constants.js.map +1 -1
  53. package/dist/index.js +1 -17
  54. package/dist/index.js.map +1 -1
  55. package/dist/locus-info/controlsUtils.js +10 -28
  56. package/dist/locus-info/controlsUtils.js.map +1 -1
  57. package/dist/locus-info/embeddedAppsUtils.js +3 -26
  58. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  59. package/dist/locus-info/fullState.js +0 -15
  60. package/dist/locus-info/fullState.js.map +1 -1
  61. package/dist/locus-info/hostUtils.js +4 -12
  62. package/dist/locus-info/hostUtils.js.map +1 -1
  63. package/dist/locus-info/index.js +101 -193
  64. package/dist/locus-info/index.js.map +1 -1
  65. package/dist/locus-info/infoUtils.js +0 -37
  66. package/dist/locus-info/infoUtils.js.map +1 -1
  67. package/dist/locus-info/mediaSharesUtils.js +12 -38
  68. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  69. package/dist/locus-info/parser.js +87 -123
  70. package/dist/locus-info/parser.js.map +1 -1
  71. package/dist/locus-info/selfUtils.js +16 -81
  72. package/dist/locus-info/selfUtils.js.map +1 -1
  73. package/dist/media/index.js +74 -137
  74. package/dist/media/index.js.map +1 -1
  75. package/dist/media/properties.js +64 -110
  76. package/dist/media/properties.js.map +1 -1
  77. package/dist/media/util.js +3 -17
  78. package/dist/media/util.js.map +1 -1
  79. package/dist/mediaQualityMetrics/config.js +10 -12
  80. package/dist/mediaQualityMetrics/config.js.map +1 -1
  81. package/dist/meeting/effectsState.js +120 -192
  82. package/dist/meeting/effectsState.js.map +1 -1
  83. package/dist/meeting/in-meeting-actions.js +0 -13
  84. package/dist/meeting/in-meeting-actions.js.map +1 -1
  85. package/dist/meeting/index.js +812 -1487
  86. package/dist/meeting/index.js.map +1 -1
  87. package/dist/meeting/muteState.js +31 -78
  88. package/dist/meeting/muteState.js.map +1 -1
  89. package/dist/meeting/request.js +157 -227
  90. package/dist/meeting/request.js.map +1 -1
  91. package/dist/meeting/state.js +21 -31
  92. package/dist/meeting/state.js.map +1 -1
  93. package/dist/meeting/util.js +25 -169
  94. package/dist/meeting/util.js.map +1 -1
  95. package/dist/meeting-info/collection.js +3 -25
  96. package/dist/meeting-info/collection.js.map +1 -1
  97. package/dist/meeting-info/index.js +10 -33
  98. package/dist/meeting-info/index.js.map +1 -1
  99. package/dist/meeting-info/meeting-info-v2.js +179 -268
  100. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  101. package/dist/meeting-info/request.js +1 -16
  102. package/dist/meeting-info/request.js.map +1 -1
  103. package/dist/meeting-info/util.js +98 -183
  104. package/dist/meeting-info/util.js.map +1 -1
  105. package/dist/meeting-info/utilv2.js +137 -228
  106. package/dist/meeting-info/utilv2.js.map +1 -1
  107. package/dist/meetings/collection.js +3 -21
  108. package/dist/meetings/collection.js.map +1 -1
  109. package/dist/meetings/index.js +451 -570
  110. package/dist/meetings/index.js.map +1 -1
  111. package/dist/meetings/request.js +7 -30
  112. package/dist/meetings/request.js.map +1 -1
  113. package/dist/meetings/util.js +94 -148
  114. package/dist/meetings/util.js.map +1 -1
  115. package/dist/member/index.js +49 -89
  116. package/dist/member/index.js.map +1 -1
  117. package/dist/member/util.js +17 -68
  118. package/dist/member/util.js.map +1 -1
  119. package/dist/members/collection.js +2 -12
  120. package/dist/members/collection.js.map +1 -1
  121. package/dist/members/index.js +68 -184
  122. package/dist/members/index.js.map +1 -1
  123. package/dist/members/request.js +21 -56
  124. package/dist/members/request.js.map +1 -1
  125. package/dist/members/util.js +9 -38
  126. package/dist/members/util.js.map +1 -1
  127. package/dist/metrics/config.js +0 -2
  128. package/dist/metrics/config.js.map +1 -1
  129. package/dist/metrics/constants.js +1 -2
  130. package/dist/metrics/constants.js.map +1 -1
  131. package/dist/metrics/index.js +48 -136
  132. package/dist/metrics/index.js.map +1 -1
  133. package/dist/networkQualityMonitor/index.js +28 -57
  134. package/dist/networkQualityMonitor/index.js.map +1 -1
  135. package/dist/peer-connection-manager/index.js +60 -190
  136. package/dist/peer-connection-manager/index.js.map +1 -1
  137. package/dist/peer-connection-manager/util.js +10 -24
  138. package/dist/peer-connection-manager/util.js.map +1 -1
  139. package/dist/personal-meeting-room/index.js +10 -45
  140. package/dist/personal-meeting-room/index.js.map +1 -1
  141. package/dist/personal-meeting-room/request.js +2 -33
  142. package/dist/personal-meeting-room/request.js.map +1 -1
  143. package/dist/personal-meeting-room/util.js +0 -13
  144. package/dist/personal-meeting-room/util.js.map +1 -1
  145. package/dist/reachability/index.js +100 -166
  146. package/dist/reachability/index.js.map +1 -1
  147. package/dist/reachability/request.js +2 -18
  148. package/dist/reachability/request.js.map +1 -1
  149. package/dist/reactions/reactions.js +0 -2
  150. package/dist/reactions/reactions.js.map +1 -1
  151. package/dist/reactions/reactions.type.js +0 -5
  152. package/dist/reactions/reactions.type.js.map +1 -1
  153. package/dist/reconnection-manager/index.js +294 -468
  154. package/dist/reconnection-manager/index.js.map +1 -1
  155. package/dist/roap/collection.js +1 -12
  156. package/dist/roap/collection.js.map +1 -1
  157. package/dist/roap/handler.js +15 -85
  158. package/dist/roap/handler.js.map +1 -1
  159. package/dist/roap/index.js +42 -94
  160. package/dist/roap/index.js.map +1 -1
  161. package/dist/roap/request.js +81 -148
  162. package/dist/roap/request.js.map +1 -1
  163. package/dist/roap/state.js +2 -39
  164. package/dist/roap/state.js.map +1 -1
  165. package/dist/roap/turnDiscovery.js +8 -52
  166. package/dist/roap/turnDiscovery.js.map +1 -1
  167. package/dist/roap/util.js +0 -26
  168. package/dist/roap/util.js.map +1 -1
  169. package/dist/statsAnalyzer/global.js +0 -2
  170. package/dist/statsAnalyzer/global.js.map +1 -1
  171. package/dist/statsAnalyzer/index.js +68 -168
  172. package/dist/statsAnalyzer/index.js.map +1 -1
  173. package/dist/statsAnalyzer/mqaUtil.js +54 -53
  174. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  175. package/dist/transcription/index.js +13 -45
  176. package/dist/transcription/index.js.map +1 -1
  177. package/internal-README.md +7 -6
  178. package/package.json +17 -17
  179. package/src/common/browser-detection.ts +9 -6
  180. package/src/common/collection.ts +3 -1
  181. package/src/common/errors/captcha-error.ts +6 -6
  182. package/src/common/errors/intent-to-join.ts +6 -6
  183. package/src/common/errors/join-meeting.ts +12 -8
  184. package/src/common/errors/media.ts +6 -6
  185. package/src/common/errors/parameter.ts +9 -6
  186. package/src/common/errors/password-error.ts +6 -6
  187. package/src/common/errors/permission.ts +5 -5
  188. package/src/common/errors/reconnection.ts +6 -6
  189. package/src/common/errors/stats.ts +6 -6
  190. package/src/common/errors/webex-errors.ts +7 -5
  191. package/src/common/errors/webex-meetings-error.ts +1 -1
  192. package/src/common/events/events-scope.ts +5 -1
  193. package/src/common/events/events.ts +5 -1
  194. package/src/common/events/trigger-proxy.ts +8 -3
  195. package/src/common/events/util.ts +1 -2
  196. package/src/common/logs/logger-proxy.ts +21 -10
  197. package/src/common/logs/request.ts +11 -8
  198. package/src/config.ts +11 -11
  199. package/src/constants.ts +138 -119
  200. package/src/index.js +1 -1
  201. package/src/locus-info/controlsUtils.ts +34 -24
  202. package/src/locus-info/fullState.ts +15 -11
  203. package/src/locus-info/hostUtils.ts +4 -3
  204. package/src/locus-info/index.ts +25 -34
  205. package/src/locus-info/infoUtils.ts +12 -4
  206. package/src/locus-info/mediaSharesUtils.ts +4 -4
  207. package/src/locus-info/parser.ts +45 -68
  208. package/src/locus-info/selfUtils.ts +106 -57
  209. package/src/media/index.ts +118 -109
  210. package/src/media/properties.ts +26 -20
  211. package/src/media/util.ts +2 -2
  212. package/src/mediaQualityMetrics/config.ts +46 -46
  213. package/src/meeting/effectsState.ts +35 -35
  214. package/src/meeting/in-meeting-actions.ts +7 -3
  215. package/src/meeting/index.ts +1435 -1210
  216. package/src/meeting/muteState.ts +62 -31
  217. package/src/meeting/request.ts +160 -113
  218. package/src/meeting/state.ts +45 -30
  219. package/src/meeting/util.ts +131 -90
  220. package/src/meeting-info/collection.ts +2 -1
  221. package/src/meeting-info/index.ts +32 -30
  222. package/src/meeting-info/meeting-info-v2.ts +106 -108
  223. package/src/meeting-info/request.ts +9 -3
  224. package/src/meeting-info/util.ts +54 -46
  225. package/src/meeting-info/utilv2.ts +59 -53
  226. package/src/meetings/collection.ts +1 -1
  227. package/src/meetings/index.ts +513 -441
  228. package/src/meetings/request.ts +26 -24
  229. package/src/meetings/util.ts +26 -23
  230. package/src/member/index.ts +55 -49
  231. package/src/member/util.ts +26 -13
  232. package/src/members/collection.ts +0 -1
  233. package/src/members/index.ts +172 -121
  234. package/src/members/request.ts +46 -14
  235. package/src/members/util.ts +44 -42
  236. package/src/metrics/config.ts +254 -81
  237. package/src/metrics/constants.ts +0 -2
  238. package/src/metrics/index.ts +84 -71
  239. package/src/networkQualityMonitor/index.ts +20 -23
  240. package/src/peer-connection-manager/index.ts +321 -241
  241. package/src/peer-connection-manager/util.ts +4 -2
  242. package/src/personal-meeting-room/index.ts +12 -16
  243. package/src/personal-meeting-room/request.ts +10 -3
  244. package/src/personal-meeting-room/util.ts +3 -3
  245. package/src/reachability/index.ts +61 -59
  246. package/src/reachability/request.ts +36 -32
  247. package/src/reactions/reactions.ts +4 -4
  248. package/src/reactions/reactions.type.ts +2 -3
  249. package/src/reconnection-manager/index.ts +159 -98
  250. package/src/roap/collection.ts +2 -4
  251. package/src/roap/handler.ts +63 -32
  252. package/src/roap/index.ts +78 -58
  253. package/src/roap/request.ts +69 -54
  254. package/src/roap/state.ts +17 -11
  255. package/src/roap/turnDiscovery.ts +60 -31
  256. package/src/roap/util.ts +39 -31
  257. package/src/statsAnalyzer/global.ts +30 -33
  258. package/src/statsAnalyzer/index.ts +397 -169
  259. package/src/statsAnalyzer/mqaUtil.ts +178 -72
  260. package/src/transcription/index.ts +34 -32
  261. package/test/integration/spec/journey.js +666 -462
  262. package/test/integration/spec/space-meeting.js +318 -203
  263. package/test/integration/spec/transcription.js +6 -7
  264. package/test/unit/spec/common/browser-detection.js +9 -28
  265. package/test/unit/spec/fixture/locus.js +92 -90
  266. package/test/unit/spec/locus-info/controlsUtils.js +5 -5
  267. package/test/unit/spec/locus-info/embeddedAppsUtils.js +8 -6
  268. package/test/unit/spec/locus-info/index.js +1 -2
  269. package/test/unit/spec/locus-info/infoUtils.js +24 -31
  270. package/test/unit/spec/locus-info/lib/BasicSeqCmp.json +88 -430
  271. package/test/unit/spec/locus-info/lib/SeqCmp.json +513 -685
  272. package/test/unit/spec/locus-info/parser.js +3 -9
  273. package/test/unit/spec/locus-info/selfConstant.js +72 -103
  274. package/test/unit/spec/locus-info/selfUtils.js +21 -12
  275. package/test/unit/spec/meeting/effectsState.js +33 -45
  276. package/test/unit/spec/meeting/in-meeting-actions.ts +2 -3
  277. package/test/unit/spec/meeting/index.js +1141 -649
  278. package/test/unit/spec/meeting/muteState.js +42 -33
  279. package/test/unit/spec/meeting/request.js +56 -45
  280. package/test/unit/spec/meeting/utils.js +66 -49
  281. package/test/unit/spec/meeting-info/meetinginfov2.js +100 -73
  282. package/test/unit/spec/meeting-info/request.js +7 -9
  283. package/test/unit/spec/meeting-info/util.js +11 -12
  284. package/test/unit/spec/meeting-info/utilv2.js +110 -74
  285. package/test/unit/spec/meetings/collection.js +1 -1
  286. package/test/unit/spec/meetings/index.js +438 -257
  287. package/test/unit/spec/meetings/utils.js +14 -12
  288. package/test/unit/spec/member/index.js +0 -1
  289. package/test/unit/spec/member/util.js +5 -6
  290. package/test/unit/spec/members/index.js +84 -35
  291. package/test/unit/spec/members/request.js +29 -20
  292. package/test/unit/spec/members/utils.js +8 -5
  293. package/test/unit/spec/metrics/index.js +16 -21
  294. package/test/unit/spec/networkQualityMonitor/index.js +21 -15
  295. package/test/unit/spec/peerconnection-manager/index.js +88 -58
  296. package/test/unit/spec/peerconnection-manager/utils.js +5 -4
  297. package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +7 -8
  298. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -7
  299. package/test/unit/spec/reachability/index.ts +9 -11
  300. package/test/unit/spec/reconnection-manager/index.js +14 -17
  301. package/test/unit/spec/roap/index.ts +18 -8
  302. package/test/unit/spec/roap/turnDiscovery.ts +22 -19
  303. package/test/unit/spec/roap/util.js +3 -3
  304. package/test/unit/spec/stats-analyzer/index.js +29 -24
  305. package/test/utils/cmr.js +44 -42
  306. package/test/utils/testUtils.js +83 -74
  307. package/test/utils/webex-config.js +18 -18
  308. package/test/utils/webex-test-users.js +53 -50
@@ -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.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 /**\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 private 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: 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 /**\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 {\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: string) {\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: 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 /**\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(\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: 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 /**\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) => { 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 // @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 }\n else {\n // @ts-ignore\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: string, 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 // @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 /**\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 /**\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 /**\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 // @ts-ignore\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: 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;;;;AAEA;AACA;AACA;AACA;AACA;IACqBA,M;EACnB;EAOA;;EAcA;AACF;AACA;EACE,kBAAc;IAAA;IAAA;IAAA;IACZ,KAAKC,KAAL,GAAa,IAAIC,cAAJ,EAAb,CADY,CAEZ;;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,CAHoB,CAIpB;;MACA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACP,MAAD,EAAY;QAAE,KAAI,CAACA,MA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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 this.status = status;\n };\n\n // one or both objects are not locus delta events\n if (!isLoci(this.workingCopy) || !isLoci(newLoci)) {\n setStatus(IDLE);\n LoggerProxy.logger.info(\n 'Locus-info:parser#processDeltaEvent --> Ignoring non-locus object. workingCopy:',\n this.workingCopy,\n 'newLoci:',\n newLoci\n );\n } else {\n isValid = true;\n }\n\n return isValid;\n }\n\n /**\n * Determines if a paricular locus's sequence is empty\n * @param {Types~Locus} locus\n * @returns {bool}\n */\n static isSequenceEmpty(locus) {\n const {sequence} = locus;\n const hasEmptyEntries = !sequence.entries?.length;\n const hasEmptyRange = sequence.rangeStart === 0 && sequence.rangeEnd === 0;\n\n return hasEmptyEntries && hasEmptyRange;\n }\n\n /**\n * Determines if an object has basic\n * structure of a locus object.\n * @param {Types~Locus} loci\n * @returns {boolean}\n */\n static isLoci(loci) {\n if (!loci || !loci.sequence) {\n return false;\n }\n const hasProp = (prop) => Object.prototype.hasOwnProperty.call(loci.sequence, prop);\n\n if (hasProp('rangeStart') && hasProp('rangeEnd')) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Processes next event in queue,\n * if queue is empty sets status to idle.\n * @returns {undefined}\n */\n nextEvent() {\n // @ts-ignore\n if (this.status === Parser.status.PAUSED) {\n LoggerProxy.logger.info('Locus-info:parser#nextEvent --> Locus parser paused.');\n\n return;\n }\n\n // continue processing until queue is empty\n if (this.queue.size() > 0) {\n this.processDeltaEvent();\n } else {\n // @ts-ignore\n this.status = Parser.status.IDLE;\n }\n }\n\n /**\n * Function handler for delta actions,\n * is set by instance callee.\n * @param {string} action Locus delta action\n * @param {Types~Locus} locus Locus delta\n * @returns {undefined}\n */\n // eslint-disable-next-line no-unused-vars\n onDeltaAction(action: string, locus) {}\n\n /**\n * Event handler for locus delta events\n * @param {Types~Locus} loci Locus Delta\n * @returns {undefined}\n */\n onDeltaEvent(loci) {\n // enqueue the new loci\n this.queue.enqueue(loci);\n // start processing events in the queue if idle\n // and a function handler is defined\n // @ts-ignore\n if (this.status === Parser.status.IDLE && this.onDeltaAction) {\n // Update status, ensure we only process one event at a time.\n // @ts-ignore\n this.status = Parser.status.WORKING;\n\n this.processDeltaEvent();\n }\n }\n\n /**\n * Appends new data onto a string of existing data.\n * @param {string} newData\n * @param {string} oldData\n * @returns {string}\n */\n static packComparisonResult(newData: string, oldData: string) {\n return `${newData}:${oldData}`;\n }\n\n /**\n * Pause locus processing\n * @returns {undefined}\n */\n pause() {\n // @ts-ignore\n this.status = Parser.status.PAUSED;\n LoggerProxy.logger.info('Locus-info:parser#pause --> Locus parser paused.');\n }\n\n /**\n * Processes next locus delta in the queue,\n * continues until the queue is empty\n * or cleared.\n * @returns {undefined}\n */\n processDeltaEvent() {\n const {DESYNC, USE_INCOMING} = Parser.loci;\n const {extractComparisonState: extract} = Parser;\n const newLoci = this.queue.dequeue();\n\n if (!this.isValidLocus(newLoci)) {\n return;\n }\n\n const result = Parser.compare(this.workingCopy, newLoci);\n const lociComparison = extract(result);\n\n // limited debugging, use chrome extension\n // for full debugging.\n LoggerProxy.logger.debug(`Locus-info:parser#processDeltaEvent --> Locus Debug: ${result}`);\n\n if (lociComparison === DESYNC) {\n // wait for desync response\n this.pause();\n } else if (lociComparison === USE_INCOMING) {\n // update working copy for future comparisons.\n // Note: The working copy of parser gets updated in .onFullLocus()\n // and here when USE_INCOMING locus.\n this.workingCopy = newLoci;\n }\n\n if (this.onDeltaAction) {\n LoggerProxy.logger.info(\n `Locus-info:parser#processDeltaEvent --> Locus Delta Action: ${lociComparison}`\n );\n\n // eslint-disable-next-line no-useless-call\n this.onDeltaAction.call(this, lociComparison, newLoci);\n }\n\n this.nextEvent();\n }\n\n /**\n * Resume from a paused state\n * @returns {undefined}\n */\n resume() {\n LoggerProxy.logger.info('Locus-info:parser#resume --> Locus parser resumed.');\n // @ts-ignore\n this.status = Parser.status.WORKING;\n this.nextEvent();\n }\n\n /**\n * Gets related debug info for given error code\n * @param {string} debugCode Debug code\n * @param {string} comparison Locus comparison string\n * @returns {object} Debug message\n */\n static getDebugMessage(debugCode: string, comparison: string) {\n // removes extra spaces from multiline string\n const mStr = (strings) => strings.join('').replace(/\\s{2,}/g, ' ');\n\n const resolutionMap = {\n EQ: `${Parser.loci.LT}: is equal (current == incoming).`,\n LT: `${Parser.loci.LT}: choose right side (incoming).`,\n GT: `${Parser.loci.GT}: choose left side (current).`,\n };\n\n const debugMap = {\n SO001: {\n title: 'checkSequenceOverlap-001',\n description: mStr`Occurs if earliest working copy sequence is more \\\n recent than last incoming sequence.`,\n logic: 'current.min > incoming.max',\n },\n\n SO002: {\n title: 'checkSequenceOverlap-002',\n description: mStr`Occurs if last working copy sequence is before the \\\n earliest incoming sequence.`,\n logic: 'current.max < incoming.min',\n },\n\n UR001: {\n title: 'checkUnequalRanges-001',\n description: mStr`Occurs if there are no unique values for both loci, \\\n and the current working copy loci has a larger range.`,\n logic: 'currentTotalRange > incomingTotalRange',\n },\n\n UR002: {\n title: 'checkUnequalRanges-002',\n description: mStr`Occurs if there are no unique values for both loci, \\\n and the incoming delta loci has a larger range.`,\n logic: 'currentTotalRange < incomingTotalRange',\n },\n\n UR003: {\n title: 'checkUnequalRanges-003',\n description: mStr`Occurs if there are no unique values for both loci, \\\n and with ranges either absent or of the same size, the sequences \\\n are considered equal.`,\n logic: 'currentTotalRange == incomingTotalRange',\n },\n\n UE001: {\n title: 'checkForUniqueEntries-001',\n description: mStr`Occurs if current loci has unique entries and \\\n incoming does not. Entries are considered unique if they \\\n do not overlap with other Loci sequences or range values.`,\n logic: 'currentIsUnique && !incomingIsUnique',\n },\n\n UE002: {\n title: 'checkForUniqueEntries-002',\n description: mStr`Occurs if current has no unique entries but \\\n incoming does. Entries are considered unique if they \\\n do not overlap with other Loci sequences or range values.`,\n logic: '!currentIsUnique && incomingIsUnique',\n },\n\n OOS001: {\n title: 'checkIfOutOfSync-001',\n description: mStr`Occurs if neither sequence has a range, or \\\n if the current loci unique entries overlap the total range of the \\\n incoming sequence, or if the incoming unique entries overlap \\\n the total range of current sequence.`,\n logic: 'neitherSeqHasRange || currentUniqOverlap || incomingUniqOverlap',\n },\n\n OOS002: {\n title: 'checkIfOutOfSync-002',\n description: mStr`Occurs if the minimum value from sequences that are \\\n unique to the current loci is greater than the minimum value from \\\n sequences that are unique to the incoming loci.`,\n logic: 'currentUniqueMin > incomingUniqueMin',\n },\n\n OOS003: {\n title: 'checkIfOutOfSync-003',\n description: mStr`Occurs if none of the comparison rules applied. \\\n It is a catch all.`,\n logic: 'else (catch all)',\n },\n };\n\n const debugObj = debugMap[debugCode];\n\n debugObj.title = `Debug: ${debugObj.title}`;\n debugObj.resolution = resolutionMap[comparison];\n\n return debugObj;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAEA;AACA;AAAsD;AAEtD;AACA;AACA;AACA;AACA;AAJA,IAKqBA,MAAM;EACzB;;EAOA;;EAcA;AACF;AACA;EACE,kBAAc;IAAA;IAAA;IAAA;IACZ,IAAI,CAACC,KAAK,GAAG,IAAIC,cAAW,EAAE;IAC9B;IACA,IAAI,CAACC,MAAM,GAAGH,MAAM,CAACG,MAAM,CAACC,IAAI;IAChC,IAAI,CAACC,aAAa,GAAG,IAAI;IACzB,IAAI,CAACC,WAAW,GAAG,IAAI;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EAPE;IAAA;IAAA;IAyVA;AACF;AACA;AACA;AACA;IACE,sBAAaC,OAAO,EAAE;MAAA;MACpB,IAAIC,OAAO,GAAG,KAAK;MACnB,IAAOJ,IAAI,GAAIJ,MAAM,CAACG,MAAM,CAArBC,IAAI;MACX,IAAOK,MAAM,GAAIT,MAAM,CAAhBS,MAAM;MACb;MACA,IAAMC,SAAS,GAAG,SAAZA,SAAS,CAAIP,MAAM,EAAK;QAC5B,KAAI,CAACA,MAAM,GAAGA,MAAM;MACtB,CAAC;;MAED;MACA,IAAI,CAACM,MAAM,CAAC,IAAI,CAACH,WAAW,CAAC,IAAI,CAACG,MAAM,CAACF,OAAO,CAAC,EAAE;QACjDG,SAAS,CAACN,IAAI,CAAC;QACfO,oBAAW,CAACC,MAAM,CAACC,IAAI,CACrB,iFAAiF,EACjF,IAAI,CAACP,WAAW,EAChB,UAAU,EACVC,OAAO,CACR;MACH,CAAC,MAAM;QACLC,OAAO,GAAG,IAAI;MAChB;MAEA,OAAOA,OAAO;IAChB;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAA;IAAA;IAgCA;AACF;AACA;AACA;AACA;IACE,qBAAY;MACV;MACA,IAAI,IAAI,CAACL,MAAM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KAAK,EAAE;QACT,CAAC;QAEDM,KAAK,EAAE;UACLR,KAAK,EAAE,2BAA2B;UAClCC,WAAW,EAAER,IAAI,+bAE2C;UAC5DS,KAAK,EAAE;QACT,CAAC;QAEDO,MAAM,EAAE;UACNT,KAAK,EAAE,sBAAsB;UAC7BC,WAAW,EAAER,IAAI,+jBAGsB;UACvCS,KAAK,EAAE;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,8BA3pBkBpI,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,28 @@
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
-
15
10
  var _constants = require("../constants");
16
-
17
11
  var _parameter = _interopRequireDefault(require("../common/errors/parameter"));
12
+ /* eslint-disable default-param-last */
18
13
 
19
14
  var SelfUtils = {};
20
15
  var PSTN_DEVICE_TYPE = 'PROVISIONAL';
16
+
21
17
  /**
22
18
  * parses the relevant values for self: muted, guest, moderator, mediaStatus, state, joinedWith, pstnDevices, creator, id
23
19
  * @param {Object} self
24
20
  * @param {String} deviceId
25
21
  * @returns {undefined}
26
22
  */
27
-
28
23
  SelfUtils.parse = function (self, deviceId) {
29
24
  if (self) {
30
25
  var _joinedWith$intent;
31
-
32
26
  var joinedWith = self.devices.find(function (device) {
33
27
  return deviceId === device.url;
34
28
  });
@@ -68,36 +62,27 @@ SelfUtils.parse = function (self, deviceId) {
68
62
  isSharingBlocked: SelfUtils.isSharingBlocked(self)
69
63
  };
70
64
  }
71
-
72
65
  return null;
73
66
  };
74
-
75
67
  SelfUtils.getLayout = function (self) {
76
68
  var _self$controls;
77
-
78
69
  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;
79
70
  };
80
-
81
71
  SelfUtils.getRoles = function (self) {
82
72
  var _self$controls2, _self$controls2$role;
83
-
84
73
  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) {
85
74
  if (role.hasRole) {
86
75
  roles.push(role.type);
87
76
  }
88
-
89
77
  return roles;
90
78
  }, []);
91
79
  };
92
-
93
80
  SelfUtils.canNotViewTheParticipantList = function (self) {
94
81
  return !!(self !== null && self !== void 0 && self.canNotViewTheParticipantList);
95
82
  };
96
-
97
83
  SelfUtils.isSharingBlocked = function (self) {
98
84
  return !!(self !== null && self !== void 0 && self.isSharingBlocked);
99
85
  };
100
-
101
86
  SelfUtils.getSelves = function (oldSelf, newSelf, deviceId) {
102
87
  var previous = oldSelf && SelfUtils.parse(oldSelf, deviceId);
103
88
  var current = newSelf && SelfUtils.parse(newSelf, deviceId);
@@ -123,16 +108,16 @@ SelfUtils.getSelves = function (oldSelf, newSelf, deviceId) {
123
108
  updates: updates
124
109
  };
125
110
  };
111
+
126
112
  /**
127
113
  * Checks if user has joined the meeting
128
114
  * @param {Object} self
129
115
  * @returns {boolean} isJoined
130
- */
131
-
132
-
116
+ */
133
117
  SelfUtils.isJoined = function (self) {
134
118
  return (self === null || self === void 0 ? void 0 : self.state) === _constants._JOINED_;
135
119
  };
120
+
136
121
  /**
137
122
  * Validate if the Meeting Layout Controls Layout has changed.
138
123
  *
@@ -140,99 +125,76 @@ SelfUtils.isJoined = function (self) {
140
125
  * @param {Self} current - Current self state [per event]
141
126
  * @returns {boolean} - If the MEeting Layout Controls Layout has changed.
142
127
  */
143
-
144
-
145
128
  SelfUtils.layoutChanged = function (previous, current) {
146
129
  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
130
  };
148
-
149
131
  SelfUtils.isMediaInactive = function (previous, current) {
150
132
  if (previous && previous.joinedWith && previous.joinedWith.mediaSessions && current && current.joinedWith && current.joinedWith.mediaSessions) {
151
133
  var previousMediaStatus = SelfUtils.getMediaStatus(previous.joinedWith.mediaSessions);
152
134
  var currentMediaStatus = SelfUtils.getMediaStatus(current.joinedWith.mediaSessions);
153
-
154
135
  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
136
  return true;
156
137
  }
157
-
158
138
  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
139
  return true;
160
140
  }
161
-
162
141
  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
142
  return true;
164
143
  }
165
-
166
144
  return false;
167
145
  }
168
-
169
146
  return false;
170
147
  };
171
-
172
148
  SelfUtils.getLastModified = function (self) {
173
149
  if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.lastModified) {
174
150
  return null;
175
151
  }
176
-
177
152
  return self.controls.audio.meta.lastModified;
178
153
  };
179
-
180
154
  SelfUtils.getModifiedBy = function (self) {
181
155
  if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.modifiedBy) {
182
156
  return null;
183
157
  }
184
-
185
158
  return self.controls.audio.meta.modifiedBy;
186
159
  };
160
+
187
161
  /**
188
162
  * get the id from the self object
189
163
  * @param {Object} self
190
164
  * @returns {String}
191
165
  */
192
-
193
-
194
166
  SelfUtils.getSelfIdentity = function (self) {
195
167
  if (!self && !self.person) {
196
168
  return null;
197
169
  }
198
-
199
170
  return self.person.id;
200
171
  };
172
+
201
173
  /**
202
174
  * get the "remote mute" property from the self object
203
175
  * @param {Object} self
204
176
  * @returns {Boolean}
205
177
  */
206
-
207
-
208
178
  SelfUtils.getRemoteMuted = function (self) {
209
179
  if (!self || !self.controls || !self.controls.audio) {
210
180
  return null;
211
181
  }
212
-
213
182
  return self.controls.audio.muted;
214
183
  };
215
-
216
184
  SelfUtils.getLocalAudioUnmuteRequested = function (self) {
217
185
  var _self$controls3, _self$controls3$audio;
218
-
219
186
  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);
220
187
  };
221
-
222
188
  SelfUtils.getUnmuteAllowed = function (self) {
223
189
  if (!self || !self.controls || !self.controls.audio) {
224
190
  return null;
225
191
  }
226
-
227
192
  return !self.controls.audio.disallowUnmute;
228
193
  };
229
-
230
194
  SelfUtils.getLocalAudioUnmuteRequired = function (self) {
231
195
  var _self$controls4, _self$controls4$audio;
232
-
233
196
  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);
234
197
  };
235
-
236
198
  SelfUtils.getStatus = function (status) {
237
199
  return {
238
200
  audio: status.audioStatus,
@@ -240,138 +202,115 @@ SelfUtils.getStatus = function (status) {
240
202
  slides: status.videoSlidesStatus
241
203
  };
242
204
  };
205
+
243
206
  /**
244
207
  * @param {Object} oldSelf
245
208
  * @param {Object} changedSelf
246
209
  * @returns {Boolean}
247
210
  */
248
-
249
-
250
211
  SelfUtils.wasMediaInactiveOrReleased = function () {
251
212
  var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
252
213
  var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
253
214
  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
215
  };
216
+
255
217
  /**
256
218
  * @param {Object} check
257
219
  * @returns {Boolean}
258
220
  */
259
-
260
-
261
221
  SelfUtils.isLocusUserUnadmitted = function (check) {
262
222
  var _check$joinedWith, _check$joinedWith$int;
263
-
264
223
  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
224
  };
225
+
266
226
  /**
267
227
  * @param {Object} check
268
228
  * @returns {Boolean}
269
229
  */
270
-
271
-
272
230
  SelfUtils.isLocusUserAdmitted = function (check) {
273
231
  var _check$joinedWith2, _check$joinedWith2$in;
274
-
275
232
  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
233
  };
234
+
277
235
  /**
278
236
  * @param {Object} self
279
237
  * @returns {Boolean}
280
238
  * @throws {Error} when self is undefined
281
239
  */
282
-
283
-
284
240
  SelfUtils.isUserUnadmitted = function (self) {
285
241
  if (!self) {
286
242
  throw new _parameter.default('self must be defined to determine if self is unadmitted as guest.');
287
243
  }
288
-
289
244
  return SelfUtils.isLocusUserUnadmitted(self);
290
245
  };
291
-
292
246
  SelfUtils.moderatorChanged = function (oldSelf, changedSelf) {
293
247
  if (!oldSelf) {
294
248
  return true;
295
249
  }
296
-
297
250
  if (!changedSelf) {
298
251
  throw new _parameter.default('New self must be defined to determine if self transitioned moderator status.');
299
252
  }
300
-
301
253
  return oldSelf.moderator !== changedSelf.moderator;
302
254
  };
255
+
303
256
  /**
304
257
  * @param {Object} oldSelf
305
258
  * @param {Object} changedSelf
306
259
  * @returns {Boolean}
307
260
  * @throws {Error} if changed self was undefined
308
261
  */
309
-
310
-
311
262
  SelfUtils.isDeviceObserving = function (oldSelf, changedSelf) {
312
263
  var _oldSelf$joinedWith, _oldSelf$joinedWith$i, _changedSelf$joinedWi, _changedSelf$joinedWi2;
313
-
314
264
  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
265
  };
266
+
316
267
  /**
317
268
  * @param {Object} oldSelf
318
269
  * @param {Object} changedSelf
319
270
  * @returns {Boolean}
320
271
  * @throws {Error} if changed self was undefined
321
272
  */
322
-
323
-
324
273
  SelfUtils.isUserAdmitted = function (oldSelf, changedSelf) {
325
274
  if (!oldSelf) {
326
275
  // if there was no previous locus, it couldn't have been admitted yet
327
276
  return false;
328
277
  }
329
-
330
278
  if (!changedSelf) {
331
279
  throw new _parameter.default('New self must be defined to determine if self transitioned to admitted as guest.');
332
280
  }
333
-
334
281
  return SelfUtils.isLocusUserUnadmitted(oldSelf) && SelfUtils.isLocusUserAdmitted(changedSelf);
335
282
  };
336
-
337
283
  SelfUtils.mutedByOthersChanged = function (oldSelf, changedSelf) {
338
284
  if (!changedSelf) {
339
285
  throw new _parameter.default('New self must be defined to determine if self was muted by others.');
340
286
  }
341
-
342
287
  if (!oldSelf || oldSelf.remoteMuted === null) {
343
288
  if (changedSelf.remoteMuted) {
344
289
  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
-
290
+ }
347
291
 
292
+ // we don't want to be sending the 'meeting:self:unmutedByOthers' notification on meeting join
348
293
  return false;
349
294
  }
350
-
351
295
  return changedSelf.remoteMuted !== null && (oldSelf.remoteMuted !== changedSelf.remoteMuted || changedSelf.remoteMuted && oldSelf.unmuteAllowed !== changedSelf.unmuteAllowed);
352
296
  };
353
-
354
297
  SelfUtils.localAudioUnmuteRequestedByServer = function () {
355
298
  var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
356
299
  var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
357
-
358
300
  if (!changedSelf) {
359
301
  throw new _parameter.default('New self must be defined to determine if self received request to unmute.');
360
302
  }
361
-
362
303
  return changedSelf.localAudioUnmuteRequested && !oldSelf.localAudioUnmuteRequested;
363
304
  };
364
-
365
305
  SelfUtils.localAudioUnmuteRequiredByServer = function () {
366
306
  var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
367
307
  var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
368
-
369
308
  if (!changedSelf) {
370
309
  throw new _parameter.default('New self must be defined to determine if localAudioUnmuteRequired changed.');
371
310
  }
372
-
373
311
  return !changedSelf.remoteMuted && changedSelf.localAudioUnmuteRequired && oldSelf.localAudioUnmuteRequired !== changedSelf.localAudioUnmuteRequired;
374
312
  };
313
+
375
314
  /**
376
315
  * extract the sipUrl from the partner
377
316
  * @param {Object} partner
@@ -379,7 +318,6 @@ SelfUtils.localAudioUnmuteRequiredByServer = function () {
379
318
  * @returns {Object}
380
319
  */
381
320
 
382
-
383
321
  SelfUtils.getSipUrl = function (partner, type, sipUri) {
384
322
  // For webex meeting the sipUrl gets updated in info parser
385
323
  if (partner && type === _constants._CALL_) {
@@ -387,12 +325,10 @@ SelfUtils.getSipUrl = function (partner, type, sipUri) {
387
325
  sipUri: partner.person.sipUrl || partner.person.id
388
326
  };
389
327
  }
390
-
391
328
  return {
392
329
  sipUri: sipUri
393
330
  };
394
331
  };
395
-
396
332
  SelfUtils.getMediaStatus = function () {
397
333
  var mediaSessions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
398
334
  var mediaStatus = {
@@ -411,7 +347,6 @@ SelfUtils.getMediaStatus = function () {
411
347
  });
412
348
  return mediaStatus;
413
349
  };
414
-
415
350
  var _default = SelfUtils;
416
351
  exports.default = _default;
417
352
  //# sourceMappingURL=selfUtils.js.map