@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,31 +1,19 @@
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 _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/taggedTemplateLiteral"));
14
-
15
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
16
-
17
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
18
-
19
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
20
-
21
13
  var _difference2 = _interopRequireDefault(require("lodash/difference"));
22
-
23
14
  var _queue = _interopRequireDefault(require("../common/queue"));
24
-
25
15
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
26
-
27
16
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
28
-
29
17
  /**
30
18
  * Locus Delta Parser
31
19
  * @private
@@ -33,6 +21,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
33
21
  */
34
22
  var Parser = /*#__PURE__*/function () {
35
23
  // processing status
24
+
36
25
  // loci comparison states
37
26
 
38
27
  /**
@@ -42,12 +31,13 @@ var Parser = /*#__PURE__*/function () {
42
31
  (0, _classCallCheck2.default)(this, Parser);
43
32
  (0, _defineProperty2.default)(this, "queue", void 0);
44
33
  (0, _defineProperty2.default)(this, "workingCopy", void 0);
45
- this.queue = new _queue.default(); // @ts-ignore - This is declared as static class member and again being initialized here from same
46
-
34
+ this.queue = new _queue.default();
35
+ // @ts-ignore - This is declared as static class member and again being initialized here from same
47
36
  this.status = Parser.status.IDLE;
48
37
  this.onDeltaAction = null;
49
38
  this.workingCopy = null;
50
39
  }
40
+
51
41
  /**
52
42
  * Checks if two sequences overlap in time,
53
43
  * the sequence with the higher minimum value is greater.
@@ -56,8 +46,6 @@ var Parser = /*#__PURE__*/function () {
56
46
  * @param {Types~Locus} incoming
57
47
  * @returns {string} loci comparison state
58
48
  */
59
-
60
-
61
49
  (0, _createClass2.default)(Parser, [{
62
50
  key: "isValidLocus",
63
51
  value:
@@ -68,32 +56,29 @@ var Parser = /*#__PURE__*/function () {
68
56
  */
69
57
  function isValidLocus(newLoci) {
70
58
  var _this = this;
71
-
72
59
  var isValid = false;
73
60
  var IDLE = Parser.status.IDLE;
74
- var isLoci = Parser.isLoci; // @ts-ignore
75
-
61
+ var isLoci = Parser.isLoci;
62
+ // @ts-ignore
76
63
  var setStatus = function setStatus(status) {
77
64
  _this.status = status;
78
- }; // one or both objects are not locus delta events
79
-
65
+ };
80
66
 
67
+ // one or both objects are not locus delta events
81
68
  if (!isLoci(this.workingCopy) || !isLoci(newLoci)) {
82
69
  setStatus(IDLE);
83
-
84
70
  _loggerProxy.default.logger.info('Locus-info:parser#processDeltaEvent --> Ignoring non-locus object. workingCopy:', this.workingCopy, 'newLoci:', newLoci);
85
71
  } else {
86
72
  isValid = true;
87
73
  }
88
-
89
74
  return isValid;
90
75
  }
76
+
91
77
  /**
92
78
  * Determines if a paricular locus's sequence is empty
93
79
  * @param {Types~Locus} locus
94
80
  * @returns {bool}
95
81
  */
96
-
97
82
  }, {
98
83
  key: "nextEvent",
99
84
  value:
@@ -106,11 +91,10 @@ var Parser = /*#__PURE__*/function () {
106
91
  // @ts-ignore
107
92
  if (this.status === Parser.status.PAUSED) {
108
93
  _loggerProxy.default.logger.info('Locus-info:parser#nextEvent --> Locus parser paused.');
109
-
110
94
  return;
111
- } // continue processing until queue is empty
112
-
95
+ }
113
96
 
97
+ // continue processing until queue is empty
114
98
  if (this.queue.size() > 0) {
115
99
  this.processDeltaEvent();
116
100
  } else {
@@ -118,6 +102,7 @@ var Parser = /*#__PURE__*/function () {
118
102
  this.status = Parser.status.IDLE;
119
103
  }
120
104
  }
105
+
121
106
  /**
122
107
  * Function handler for delta actions,
123
108
  * is set by instance callee.
@@ -126,24 +111,23 @@ var Parser = /*#__PURE__*/function () {
126
111
  * @returns {undefined}
127
112
  */
128
113
  // eslint-disable-next-line no-unused-vars
129
-
130
114
  }, {
131
115
  key: "onDeltaAction",
132
116
  value: function onDeltaAction(action, locus) {}
117
+
133
118
  /**
134
119
  * Event handler for locus delta events
135
120
  * @param {Types~Locus} loci Locus Delta
136
121
  * @returns {undefined}
137
122
  */
138
-
139
123
  }, {
140
124
  key: "onDeltaEvent",
141
125
  value: function onDeltaEvent(loci) {
142
126
  // enqueue the new loci
143
- this.queue.enqueue(loci); // start processing events in the queue if idle
127
+ this.queue.enqueue(loci);
128
+ // start processing events in the queue if idle
144
129
  // and a function handler is defined
145
130
  // @ts-ignore
146
-
147
131
  if (this.status === Parser.status.IDLE && this.onDeltaAction) {
148
132
  // Update status, ensure we only process one event at a time.
149
133
  // @ts-ignore
@@ -151,13 +135,13 @@ var Parser = /*#__PURE__*/function () {
151
135
  this.processDeltaEvent();
152
136
  }
153
137
  }
138
+
154
139
  /**
155
140
  * Appends new data onto a string of existing data.
156
141
  * @param {string} newData
157
142
  * @param {string} oldData
158
143
  * @returns {string}
159
144
  */
160
-
161
145
  }, {
162
146
  key: "pause",
163
147
  value:
@@ -168,35 +152,32 @@ var Parser = /*#__PURE__*/function () {
168
152
  function pause() {
169
153
  // @ts-ignore
170
154
  this.status = Parser.status.PAUSED;
171
-
172
155
  _loggerProxy.default.logger.info('Locus-info:parser#pause --> Locus parser paused.');
173
156
  }
157
+
174
158
  /**
175
159
  * Processes next locus delta in the queue,
176
160
  * continues until the queue is empty
177
161
  * or cleared.
178
162
  * @returns {undefined}
179
163
  */
180
-
181
164
  }, {
182
165
  key: "processDeltaEvent",
183
166
  value: function processDeltaEvent() {
184
167
  var _Parser$loci = Parser.loci,
185
- DESYNC = _Parser$loci.DESYNC,
186
- USE_INCOMING = _Parser$loci.USE_INCOMING;
168
+ DESYNC = _Parser$loci.DESYNC,
169
+ USE_INCOMING = _Parser$loci.USE_INCOMING;
187
170
  var extract = Parser.extractComparisonState;
188
171
  var newLoci = this.queue.dequeue();
189
-
190
172
  if (!this.isValidLocus(newLoci)) {
191
173
  return;
192
174
  }
193
-
194
175
  var result = Parser.compare(this.workingCopy, newLoci);
195
- var lociComparison = extract(result); // limited debugging, use chrome extension
196
- // for full debugging.
176
+ var lociComparison = extract(result);
197
177
 
178
+ // limited debugging, use chrome extension
179
+ // for full debugging.
198
180
  _loggerProxy.default.logger.debug("Locus-info:parser#processDeltaEvent --> Locus Debug: ".concat(result));
199
-
200
181
  if (lociComparison === DESYNC) {
201
182
  // wait for desync response
202
183
  this.pause();
@@ -206,53 +187,54 @@ var Parser = /*#__PURE__*/function () {
206
187
  // and here when USE_INCOMING locus.
207
188
  this.workingCopy = newLoci;
208
189
  }
209
-
210
190
  if (this.onDeltaAction) {
211
191
  _loggerProxy.default.logger.info("Locus-info:parser#processDeltaEvent --> Locus Delta Action: ".concat(lociComparison));
212
192
 
193
+ // eslint-disable-next-line no-useless-call
213
194
  this.onDeltaAction.call(this, lociComparison, newLoci);
214
195
  }
215
-
216
196
  this.nextEvent();
217
197
  }
198
+
218
199
  /**
219
200
  * Resume from a paused state
220
201
  * @returns {undefined}
221
202
  */
222
-
223
203
  }, {
224
204
  key: "resume",
225
205
  value: function resume() {
226
- _loggerProxy.default.logger.info('Locus-info:parser#resume --> Locus parser resumed.'); // @ts-ignore
227
-
228
-
206
+ _loggerProxy.default.logger.info('Locus-info:parser#resume --> Locus parser resumed.');
207
+ // @ts-ignore
229
208
  this.status = Parser.status.WORKING;
230
209
  this.nextEvent();
231
210
  }
211
+
232
212
  /**
233
213
  * Gets related debug info for given error code
234
214
  * @param {string} debugCode Debug code
235
215
  * @param {string} comparison Locus comparison string
236
216
  * @returns {object} Debug message
237
217
  */
238
-
239
218
  }], [{
240
219
  key: "checkSequenceOverlap",
241
220
  value: function checkSequenceOverlap(current, incoming) {
242
- var comparison = null; // if earliest working copy sequence is more recent than last incoming sequence
221
+ var comparison = null;
243
222
 
223
+ // if earliest working copy sequence is more recent than last incoming sequence
244
224
  if (current.min > incoming.max) {
245
225
  // choose left side (current)
246
226
  comparison = "".concat(Parser.loci.GT, ":SO001");
247
- } // if last working copy sequence is before the earliest incoming sequence
227
+ }
228
+ // if last working copy sequence is before the earliest incoming sequence
248
229
  else if (current.max < incoming.min) {
249
230
  // choose right side (incoming)
250
231
  comparison = "".concat(Parser.loci.LT, ":SO002");
251
- } // if no match above, defaults to null
252
-
232
+ }
253
233
 
234
+ // if no match above, defaults to null
254
235
  return comparison;
255
236
  }
237
+
256
238
  /**
257
239
  * Checks if two sequences have unequal ranges.
258
240
  * Chooses sequence with most larger range.
@@ -260,7 +242,6 @@ var Parser = /*#__PURE__*/function () {
260
242
  * @param {Types~Locus} incoming
261
243
  * @returns {object} loci comparison
262
244
  */
263
-
264
245
  }, {
265
246
  key: "checkUnequalRanges",
266
247
  value: function checkUnequalRanges(current, incoming) {
@@ -268,14 +249,16 @@ var Parser = /*#__PURE__*/function () {
268
249
  var currentIsNotUnique = current.unique.length === 0;
269
250
  var incomingIsNotUnique = incoming.unique.length === 0;
270
251
  var currentTotalRange = current.end - current.min;
271
- var incomingTotalRange = incoming.end - incoming.min; // no unique values for both loci
252
+ var incomingTotalRange = incoming.end - incoming.min;
272
253
 
254
+ // no unique values for both loci
273
255
  if (currentIsNotUnique && incomingIsNotUnique) {
274
256
  // current working copy loci has a larger range
275
257
  if (currentTotalRange > incomingTotalRange) {
276
258
  // choose left side (current)
277
259
  comparison = "".concat(Parser.loci.GT, ":UR001");
278
- } // incoming delta loci has a larger range
260
+ }
261
+ // incoming delta loci has a larger range
279
262
  else if (currentTotalRange < incomingTotalRange) {
280
263
  // choose right side (incoming)
281
264
  comparison = "".concat(Parser.loci.LT, ":UR002");
@@ -285,9 +268,9 @@ var Parser = /*#__PURE__*/function () {
285
268
  comparison = "".concat(Parser.loci.EQ, ":UR003");
286
269
  }
287
270
  }
288
-
289
271
  return comparison;
290
272
  }
273
+
291
274
  /**
292
275
  * Checks if either sequences has unique entries.
293
276
  * Entries are considered unique if they do not overlap
@@ -297,25 +280,26 @@ var Parser = /*#__PURE__*/function () {
297
280
  * @param {Types~Locus} incoming
298
281
  * @returns {string} loci comparison state
299
282
  */
300
-
301
283
  }, {
302
284
  key: "checkForUniqueEntries",
303
285
  value: function checkForUniqueEntries(current, incoming) {
304
286
  var comparison = null;
305
287
  var currentIsUnique = current.unique.length > 0;
306
- var incomingIsUnique = incoming.unique.length > 0; // current has unique entries and incoming does not
288
+ var incomingIsUnique = incoming.unique.length > 0;
307
289
 
290
+ // current has unique entries and incoming does not
308
291
  if (currentIsUnique && !incomingIsUnique) {
309
292
  // choose left side (current)
310
293
  comparison = "".concat(Parser.loci.GT, ":UE001");
311
- } // current has no unique entries but incoming does
294
+ }
295
+ // current has no unique entries but incoming does
312
296
  else if (!currentIsUnique && incomingIsUnique) {
313
297
  // choose right side (incoming)
314
298
  comparison = "".concat(Parser.loci.LT, ":UE002");
315
299
  }
316
-
317
300
  return comparison;
318
301
  }
302
+
319
303
  /**
320
304
  * Checks both Locus Delta objects to see if they are
321
305
  * out of sync with one another. If so sends a DESYNC
@@ -324,7 +308,6 @@ var Parser = /*#__PURE__*/function () {
324
308
  * @param {Types~Locus} incoming
325
309
  * @returns {string} loci comparison state
326
310
  */
327
-
328
311
  }, {
329
312
  key: "checkIfOutOfSync",
330
313
  value: function checkIfOutOfSync(current, incoming) {
@@ -334,22 +317,20 @@ var Parser = /*#__PURE__*/function () {
334
317
  var currentHasNoRange = !current.start && !current.end;
335
318
  var incomingHasNoRange = !incoming.start && !incoming.end;
336
319
  var neitherSeqHasRange = currentHasNoRange && incomingHasNoRange;
337
-
338
320
  var hasUniqOverlap = function hasUniqOverlap(list, min, max) {
339
321
  return list.some(function (seq) {
340
322
  return min < seq && seq < max;
341
323
  });
342
- }; // current unique entries overlap the total range of incoming
343
-
344
-
345
- var currentUniqOverlap = hasUniqOverlap(current.unique, incoming.min, incoming.max); // vice-versa, incoming unique entries overlap the total range of current
346
-
324
+ };
325
+ // current unique entries overlap the total range of incoming
326
+ var currentUniqOverlap = hasUniqOverlap(current.unique, incoming.min, incoming.max);
327
+ // vice-versa, incoming unique entries overlap the total range of current
347
328
  var incomingUniqOverlap = hasUniqOverlap(incoming.unique, current.min, current.max);
348
-
349
329
  if (neitherSeqHasRange || currentUniqOverlap || incomingUniqOverlap) {
350
330
  // outputs string indicating which condition occurred. ex: 0,1,0
351
- var debugInfo = "".concat(+neitherSeqHasRange, ",").concat(+currentUniqOverlap, ",").concat(+incomingUniqOverlap); // send DESYNC to server
331
+ var debugInfo = "".concat(+neitherSeqHasRange, ",").concat(+currentUniqOverlap, ",").concat(+incomingUniqOverlap);
352
332
 
333
+ // send DESYNC to server
353
334
  comparison = "".concat(Parser.loci.DESYNC, ":OOS001:").concat(debugInfo);
354
335
  } else if (currentUniqueMin > incomingUniqueMin) {
355
336
  // choose left side (current)
@@ -358,9 +339,9 @@ var Parser = /*#__PURE__*/function () {
358
339
  // choose right side (incoming)
359
340
  comparison = "".concat(Parser.loci.LT, ":OOS003");
360
341
  }
361
-
362
342
  return comparison;
363
343
  }
344
+
364
345
  /**
365
346
  * Compares two loci to determine which one contains the most recent state
366
347
  * @instance
@@ -369,26 +350,23 @@ var Parser = /*#__PURE__*/function () {
369
350
  * @param {Types~Locus} incoming
370
351
  * @returns {string} loci comparison state
371
352
  */
372
-
373
353
  }, {
374
354
  key: "compare",
375
355
  value: function compare(current, incoming) {
376
356
  var isSequenceEmpty = Parser.isSequenceEmpty;
377
357
  var extract = Parser.extractComparisonState;
378
358
  var pack = Parser.packComparisonResult;
379
-
380
359
  if (isSequenceEmpty(current) || isSequenceEmpty(incoming)) {
381
360
  return pack(Parser.loci.USE_INCOMING, 'C001');
382
361
  }
383
-
384
362
  if (incoming.baseSequence) {
385
363
  return pack(Parser.compareDelta(current, incoming), 'C002');
386
364
  }
387
-
388
365
  var result = Parser.compareSequence(current.sequence, incoming.sequence);
389
366
  var action = Parser.compareToAction(extract(result));
390
367
  return pack(action, result);
391
368
  }
369
+
392
370
  /**
393
371
  * Compares two loci sequences (with delta params) and indicates what action
394
372
  * to take.
@@ -399,127 +377,117 @@ var Parser = /*#__PURE__*/function () {
399
377
  * @private
400
378
  * @returns {string} loci comparison state
401
379
  */
402
-
403
380
  }, {
404
381
  key: "compareDelta",
405
382
  value: function compareDelta(current, incoming) {
406
383
  var _Parser$loci2 = Parser.loci,
407
- LT = _Parser$loci2.LT,
408
- GT = _Parser$loci2.GT,
409
- EQ = _Parser$loci2.EQ,
410
- DESYNC = _Parser$loci2.DESYNC,
411
- USE_INCOMING = _Parser$loci2.USE_INCOMING;
384
+ LT = _Parser$loci2.LT,
385
+ GT = _Parser$loci2.GT,
386
+ EQ = _Parser$loci2.EQ,
387
+ DESYNC = _Parser$loci2.DESYNC,
388
+ USE_INCOMING = _Parser$loci2.USE_INCOMING;
412
389
  var extract = Parser.extractComparisonState;
413
390
  var pack = Parser.packComparisonResult;
414
391
  var result = Parser.compareSequence(current.sequence, incoming.sequence);
415
392
  var comparison = extract(result);
416
-
417
393
  if (comparison !== LT) {
418
394
  return pack(Parser.compareToAction(comparison), result);
419
395
  }
420
-
421
396
  comparison = Parser.compareSequence(current.sequence, incoming.baseSequence);
422
-
423
397
  switch (extract(comparison)) {
424
398
  case GT:
425
399
  case EQ:
426
400
  comparison = USE_INCOMING;
427
401
  break;
428
-
429
402
  default:
430
403
  comparison = DESYNC;
431
404
  }
432
-
433
405
  return pack(comparison, result);
434
406
  }
407
+
435
408
  /**
436
409
  * Compares Locus sequences
437
410
  * @param {Types~Locus} current Current working copy
438
411
  * @param {Types~Locus} incoming New Locus delta
439
412
  * @returns {string}
440
413
  */
441
-
442
414
  }, {
443
415
  key: "compareSequence",
444
416
  value: function compareSequence(current, incoming) {
445
417
  // Locus sequence comparison rules in order of priority.
446
418
  // https://sqbu-github.cisco.com/WebExSquared/cloud-apps/wiki/Locus-Sequence-Comparison-Algorithm
419
+
447
420
  var local = Parser.getMetaData(current);
448
- var delta = Parser.getMetaData(incoming); // update loci metadata
421
+ var delta = Parser.getMetaData(incoming);
449
422
 
423
+ // update loci metadata
450
424
  local.unique = Parser.getUniqueSequences(local, delta);
451
- delta.unique = Parser.getUniqueSequences(delta, local); // Locus sequence comparison rules
452
- // order matters
425
+ delta.unique = Parser.getUniqueSequences(delta, local);
453
426
 
427
+ // Locus sequence comparison rules
428
+ // order matters
454
429
  var rules = [Parser.checkSequenceOverlap, Parser.checkUnequalRanges, Parser.checkForUniqueEntries, Parser.checkIfOutOfSync];
455
-
456
430
  for (var _i = 0, _rules = rules; _i < _rules.length; _i++) {
457
431
  var rule = _rules[_i];
458
432
  // Rule only returns a value if the rule applies,
459
433
  // otherwise returns null.
460
434
  var result = rule(local, delta);
461
-
462
435
  if (result) {
463
436
  return result;
464
437
  }
465
- } // error, none of rules above applied
438
+ }
439
+
440
+ // error, none of rules above applied
466
441
  // should never get here as last rule
467
442
  // should be catch all.
468
-
469
-
470
443
  return Parser.loci.ERROR;
471
444
  }
445
+
472
446
  /**
473
447
  * Transates the result of a sequence comparison into an intended behavior
474
448
  * @param {string} result
475
449
  * @returns {string} Locus comparison action
476
450
  */
477
-
478
451
  }, {
479
452
  key: "compareToAction",
480
453
  value: function compareToAction(result) {
481
454
  var _Parser$loci3 = Parser.loci,
482
- DESYNC = _Parser$loci3.DESYNC,
483
- EQ = _Parser$loci3.EQ,
484
- ERROR = _Parser$loci3.ERROR,
485
- GT = _Parser$loci3.GT,
486
- LT = _Parser$loci3.LT,
487
- USE_CURRENT = _Parser$loci3.USE_CURRENT,
488
- USE_INCOMING = _Parser$loci3.USE_INCOMING;
455
+ DESYNC = _Parser$loci3.DESYNC,
456
+ EQ = _Parser$loci3.EQ,
457
+ ERROR = _Parser$loci3.ERROR,
458
+ GT = _Parser$loci3.GT,
459
+ LT = _Parser$loci3.LT,
460
+ USE_CURRENT = _Parser$loci3.USE_CURRENT,
461
+ USE_INCOMING = _Parser$loci3.USE_INCOMING;
489
462
  var action = ERROR;
490
-
491
463
  switch (result) {
492
464
  case EQ:
493
465
  case GT:
494
466
  action = USE_CURRENT;
495
467
  break;
496
-
497
468
  case LT:
498
469
  action = USE_INCOMING;
499
470
  break;
500
-
501
471
  case DESYNC:
502
472
  action = DESYNC;
503
473
  break;
504
-
505
474
  default:
506
475
  _loggerProxy.default.logger.info("Locus-info:parser#compareToAction --> Error: ".concat(result, " is not a recognized sequence comparison result."));
507
-
508
476
  }
509
-
510
477
  return action;
511
478
  }
479
+
512
480
  /**
513
481
  * Extracts a loci comparison from a string of data.
514
482
  * @param {string} lociComparisonResult Comparison result with extra data
515
483
  * @returns {string} Comparison of EQ, LT, GT, or DESYNC.
516
484
  */
517
-
518
485
  }, {
519
486
  key: "extractComparisonState",
520
487
  value: function extractComparisonState(lociComparisonResult) {
521
488
  return lociComparisonResult.split(':')[0];
522
489
  }
490
+
523
491
  /**
524
492
  * @typedef {object} LociMetadata
525
493
  * @property {number} start - Starting sequence number
@@ -536,17 +504,18 @@ var Parser = /*#__PURE__*/function () {
536
504
  * @param {Array.<number>} sequence Locus delta sequence
537
505
  * @returns {LociMetadata} Locus Delta Metadata
538
506
  */
539
-
540
507
  }, {
541
508
  key: "getMetaData",
542
509
  value: function getMetaData(sequence) {
543
510
  var entries = sequence.entries;
544
511
  var first = entries[0];
545
- var last = entries.slice(-1)[0]; // rangeStart or rangeEnd is 0 if a range doesn't exist
512
+ var last = entries.slice(-1)[0];
546
513
 
514
+ // rangeStart or rangeEnd is 0 if a range doesn't exist
547
515
  var start = sequence.rangeStart;
548
- var end = sequence.rangeEnd; // sequence data
516
+ var end = sequence.rangeEnd;
549
517
 
518
+ // sequence data
550
519
  return {
551
520
  start: start,
552
521
  end: end,
@@ -560,6 +529,7 @@ var Parser = /*#__PURE__*/function () {
560
529
  entries: entries
561
530
  };
562
531
  }
532
+
563
533
  /**
564
534
  * Compares two Locus delta objects and notes unique
565
535
  * values contained within baseLoci.
@@ -567,15 +537,15 @@ var Parser = /*#__PURE__*/function () {
567
537
  * @param {LociMetadata} otherLoci
568
538
  * @returns {Array.<number>} List of unique sequences
569
539
  */
570
-
571
540
  }, {
572
541
  key: "getUniqueSequences",
573
542
  value: function getUniqueSequences(baseLoci, otherLoci) {
574
543
  var diff = (0, _difference2.default)(baseLoci.entries, otherLoci.entries);
575
544
  var start = otherLoci.start,
576
- end = otherLoci.end;
545
+ end = otherLoci.end;
577
546
  return Parser.getNumbersOutOfRange(diff, start, end);
578
547
  }
548
+
579
549
  /**
580
550
  * Returns an array of numbers outside of a given range.
581
551
  * @param {Array.<number>} list Array to filter
@@ -583,15 +553,15 @@ var Parser = /*#__PURE__*/function () {
583
553
  * @param {number} rangeEnd End of range
584
554
  * @returns {Array.<number>} Array of numbers sorted ASC
585
555
  */
586
-
587
556
  }, {
588
557
  key: "getNumbersOutOfRange",
589
558
  value: function getNumbersOutOfRange(list, rangeStart, rangeEnd) {
590
559
  // Collect all numbers if number is outside of specified range
591
560
  var output = list.filter(function (num) {
592
561
  return num < rangeStart || num > rangeEnd;
593
- }); // sort ascending
562
+ });
594
563
 
564
+ // sort ascending
595
565
  return output.sort(function (a, b) {
596
566
  return a - b;
597
567
  });
@@ -600,34 +570,30 @@ var Parser = /*#__PURE__*/function () {
600
570
  key: "isSequenceEmpty",
601
571
  value: function isSequenceEmpty(locus) {
602
572
  var _sequence$entries;
603
-
604
573
  var sequence = locus.sequence;
605
574
  var hasEmptyEntries = !((_sequence$entries = sequence.entries) !== null && _sequence$entries !== void 0 && _sequence$entries.length);
606
575
  var hasEmptyRange = sequence.rangeStart === 0 && sequence.rangeEnd === 0;
607
576
  return hasEmptyEntries && hasEmptyRange;
608
577
  }
578
+
609
579
  /**
610
580
  * Determines if an object has basic
611
581
  * structure of a locus object.
612
582
  * @param {Types~Locus} loci
613
583
  * @returns {boolean}
614
584
  */
615
-
616
585
  }, {
617
586
  key: "isLoci",
618
587
  value: function isLoci(loci) {
619
588
  if (!loci || !loci.sequence) {
620
589
  return false;
621
590
  }
622
-
623
591
  var hasProp = function hasProp(prop) {
624
592
  return Object.prototype.hasOwnProperty.call(loci.sequence, prop);
625
593
  };
626
-
627
594
  if (hasProp('rangeStart') && hasProp('rangeEnd')) {
628
595
  return true;
629
596
  }
630
-
631
597
  return false;
632
598
  }
633
599
  }, {
@@ -642,7 +608,6 @@ var Parser = /*#__PURE__*/function () {
642
608
  var mStr = function mStr(strings) {
643
609
  return strings.join('').replace(/\s{2,}/g, ' ');
644
610
  };
645
-
646
611
  var resolutionMap = {
647
612
  EQ: "".concat(Parser.loci.LT, ": is equal (current == incoming)."),
648
613
  LT: "".concat(Parser.loci.LT, ": choose right side (incoming)."),
@@ -708,7 +673,6 @@ var Parser = /*#__PURE__*/function () {
708
673
  }]);
709
674
  return Parser;
710
675
  }();
711
-
712
676
  exports.default = Parser;
713
677
  (0, _defineProperty2.default)(Parser, "status", {
714
678
  IDLE: 'IDLE',