@webex/plugin-meetings 3.11.0-next.2 → 3.11.0-next.21

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 (64) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/hashTree/hashTree.js +18 -0
  4. package/dist/hashTree/hashTree.js.map +1 -1
  5. package/dist/hashTree/hashTreeParser.js +307 -139
  6. package/dist/hashTree/hashTreeParser.js.map +1 -1
  7. package/dist/hashTree/types.js +2 -1
  8. package/dist/hashTree/types.js.map +1 -1
  9. package/dist/hashTree/utils.js +10 -0
  10. package/dist/hashTree/utils.js.map +1 -1
  11. package/dist/interpretation/index.js +1 -1
  12. package/dist/interpretation/siLanguage.js +1 -1
  13. package/dist/locus-info/index.js +55 -42
  14. package/dist/locus-info/index.js.map +1 -1
  15. package/dist/media/MediaConnectionAwaiter.js +57 -1
  16. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  17. package/dist/media/properties.js +4 -2
  18. package/dist/media/properties.js.map +1 -1
  19. package/dist/meeting/index.js +33 -22
  20. package/dist/meeting/index.js.map +1 -1
  21. package/dist/meeting/util.js +108 -2
  22. package/dist/meeting/util.js.map +1 -1
  23. package/dist/meetings/index.js +76 -26
  24. package/dist/meetings/index.js.map +1 -1
  25. package/dist/metrics/constants.js +2 -1
  26. package/dist/metrics/constants.js.map +1 -1
  27. package/dist/multistream/mediaRequestManager.js +1 -1
  28. package/dist/multistream/mediaRequestManager.js.map +1 -1
  29. package/dist/reactions/reactions.type.js.map +1 -1
  30. package/dist/types/hashTree/hashTree.d.ts +7 -0
  31. package/dist/types/hashTree/hashTreeParser.d.ts +47 -12
  32. package/dist/types/hashTree/types.d.ts +1 -0
  33. package/dist/types/hashTree/utils.d.ts +6 -0
  34. package/dist/types/locus-info/index.d.ts +9 -2
  35. package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
  36. package/dist/types/media/properties.d.ts +2 -1
  37. package/dist/types/meeting/index.d.ts +8 -5
  38. package/dist/types/meeting/util.d.ts +28 -0
  39. package/dist/types/meetings/index.d.ts +3 -1
  40. package/dist/types/metrics/constants.d.ts +1 -0
  41. package/dist/types/reactions/reactions.type.d.ts +1 -0
  42. package/dist/webinar/index.js +1 -1
  43. package/package.json +22 -22
  44. package/src/hashTree/hashTree.ts +17 -0
  45. package/src/hashTree/hashTreeParser.ts +294 -96
  46. package/src/hashTree/types.ts +1 -0
  47. package/src/hashTree/utils.ts +9 -0
  48. package/src/locus-info/index.ts +83 -35
  49. package/src/media/MediaConnectionAwaiter.ts +41 -1
  50. package/src/media/properties.ts +3 -1
  51. package/src/meeting/index.ts +24 -11
  52. package/src/meeting/util.ts +132 -1
  53. package/src/meetings/index.ts +93 -8
  54. package/src/metrics/constants.ts +1 -0
  55. package/src/multistream/mediaRequestManager.ts +1 -1
  56. package/src/reactions/reactions.type.ts +1 -0
  57. package/test/unit/spec/hashTree/hashTree.ts +66 -0
  58. package/test/unit/spec/hashTree/hashTreeParser.ts +942 -110
  59. package/test/unit/spec/locus-info/index.js +88 -17
  60. package/test/unit/spec/media/MediaConnectionAwaiter.ts +41 -1
  61. package/test/unit/spec/media/properties.ts +12 -3
  62. package/test/unit/spec/meeting/index.js +160 -2
  63. package/test/unit/spec/meeting/utils.js +294 -22
  64. package/test/unit/spec/meetings/index.js +594 -17
@@ -210,7 +210,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
210
210
  // in some cases Locus might return us full DTO even when we asked for a delta
211
211
  _loggerProxy.default.logger.info('Locus-info:index#doLocusSync --> got full DTO when we asked for delta');
212
212
  }
213
- meeting.locusInfo.onFullLocus(res.body);
213
+ meeting.locusInfo.onFullLocus('classic Locus sync', res.body);
214
214
  }).catch(function (e) {
215
215
  _loggerProxy.default.logger.info("Locus-info:index#doLocusSync --> getLocusDTO succeeded but failed to handle result, locus parser will resume but not all data may be synced (".concat(e.toString(), ")"));
216
216
  _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_SYNC_HANDLING_FAILED, {
@@ -339,9 +339,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
339
339
  }, {
340
340
  key: "createHashTreeParser",
341
341
  value: function createHashTreeParser(_ref) {
342
- var initialLocus = _ref.initialLocus;
342
+ var initialLocus = _ref.initialLocus,
343
+ metadata = _ref.metadata;
343
344
  return new _hashTreeParser.default({
344
345
  initialLocus: initialLocus,
346
+ metadata: metadata,
345
347
  webexRequest: this.webex.request.bind(this.webex),
346
348
  locusInfoUpdateCallback: this.updateFromHashTree.bind(this),
347
349
  debugId: "HT-".concat(this.meetingId.substring(0, 4))
@@ -358,7 +360,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
358
360
  value: (function () {
359
361
  var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(data) {
360
362
  var _data$locus, _data$locus$links, _data$locus$links$res, _data$locus$links$res2;
361
- var _data$hashTreeMessage, _selfObject$data, selfObject, _data$locus2, _data$locus2$self, _t;
363
+ var _data$hashTreeMessage, _metadataObject$data, metadataObject, _t;
362
364
  return _regenerator.default.wrap(function (_context) {
363
365
  while (1) switch (_context.prev = _context.next) {
364
366
  case 0:
@@ -370,29 +372,28 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
370
372
  _context.next = 4;
371
373
  break;
372
374
  }
373
- // we need the SELF object to be in the received message, because it contains visibleDataSets
375
+ // we need the Metadata object to be in the received message, because it contains visibleDataSets
374
376
  // and these are needed to initialize all the hash trees
375
- selfObject = (_data$hashTreeMessage = data.hashTreeMessage.locusStateElements) === null || _data$hashTreeMessage === void 0 ? void 0 : _data$hashTreeMessage.find(function (el) {
376
- return (0, _utils.isSelf)(el);
377
+ metadataObject = (_data$hashTreeMessage = data.hashTreeMessage.locusStateElements) === null || _data$hashTreeMessage === void 0 ? void 0 : _data$hashTreeMessage.find(function (el) {
378
+ return (0, _utils.isMetadata)(el);
377
379
  });
378
- if (selfObject !== null && selfObject !== void 0 && (_selfObject$data = selfObject.data) !== null && _selfObject$data !== void 0 && _selfObject$data.visibleDataSets) {
380
+ if (metadataObject !== null && metadataObject !== void 0 && (_metadataObject$data = metadataObject.data) !== null && _metadataObject$data !== void 0 && _metadataObject$data.visibleDataSets) {
379
381
  _context.next = 2;
380
382
  break;
381
383
  }
382
- _loggerProxy.default.logger.warn("Locus-info:index#initialSetup --> cannot initialize HashTreeParser, SELF object with visibleDataSets is missing in the message");
383
- throw new Error('SELF object with visibleDataSets is missing in the message');
384
+ _loggerProxy.default.logger.warn("Locus-info:index#initialSetup --> cannot initialize HashTreeParser, Metadata object with visibleDataSets is missing in the message");
385
+ throw new Error('Metadata object with visibleDataSets is missing in the message');
384
386
  case 2:
385
387
  _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from message');
386
388
  // first create the HashTreeParser, but don't initialize it with any data yet
387
- // pass just a fake locus that contains only the visibleDataSets
388
389
  this.hashTreeParser = this.createHashTreeParser({
389
390
  initialLocus: {
390
- locus: {
391
- self: {
392
- visibleDataSets: selfObject.data.visibleDataSets
393
- }
394
- },
391
+ locus: null,
395
392
  dataSets: [] // empty, because they will be populated in initializeFromMessage() call // dataSets: data.hashTreeMessage.dataSets,
393
+ },
394
+ metadata: {
395
+ htMeta: metadataObject.htMeta,
396
+ visibleDataSets: metadataObject.data.visibleDataSets
396
397
  }
397
398
  });
398
399
 
@@ -405,12 +406,12 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
405
406
  case 4:
406
407
  // "classic" Locus case, no hash trees involved
407
408
  this.updateLocusCache(data.locus);
408
- this.onFullLocus(data.locus, undefined);
409
+ this.onFullLocus('classic locus message', data.locus, undefined);
409
410
  case 5:
410
411
  return _context.abrupt("continue", 10);
411
412
  case 6:
412
413
  this.updateLocusCache(data.locus);
413
- this.onFullLocus(data.locus, undefined, data.dataSets);
414
+ this.onFullLocus('join response', data.locus, undefined, data.dataSets, data.metadata);
414
415
  return _context.abrupt("continue", 10);
415
416
  case 7:
416
417
  if (!((_data$locus = data.locus) !== null && _data$locus !== void 0 && (_data$locus$links = _data$locus.links) !== null && _data$locus$links !== void 0 && (_data$locus$links$res = _data$locus$links.resources) !== null && _data$locus$links$res !== void 0 && (_data$locus$links$res2 = _data$locus$links$res.visibleDataSets) !== null && _data$locus$links$res2 !== void 0 && _data$locus$links$res2.url)) {
@@ -419,16 +420,12 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
419
420
  }
420
421
  _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from get-loci-response');
421
422
  // first create the HashTreeParser, but don't initialize it with any data yet
422
- // pass just a fake locus that contains only the visibleDataSets
423
423
  this.hashTreeParser = this.createHashTreeParser({
424
424
  initialLocus: {
425
- locus: {
426
- self: {
427
- visibleDataSets: (_data$locus2 = data.locus) === null || _data$locus2 === void 0 ? void 0 : (_data$locus2$self = _data$locus2.self) === null || _data$locus2$self === void 0 ? void 0 : _data$locus2$self.visibleDataSets
428
- }
429
- },
425
+ locus: null,
430
426
  dataSets: [] // empty, because we don't have them yet
431
- }
427
+ },
428
+ metadata: null // get-loci-response doesn't contain Metadata object
432
429
  });
433
430
 
434
431
  // now initialize all the data
@@ -440,7 +437,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
440
437
  case 9:
441
438
  // "classic" Locus case, no hash trees involved
442
439
  this.updateLocusCache(data.locus);
443
- this.onFullLocus(data.locus, undefined);
440
+ this.onFullLocus('classic get-loci-response', data.locus, undefined);
444
441
  case 10:
445
442
  // Change it to true after it receives it first locus object
446
443
  this.emitChange = true;
@@ -598,6 +595,10 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
598
595
  }
599
596
  }
600
597
  break;
598
+ case _types.ObjectType.metadata:
599
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> metadata object updated to version ".concat(object.htMeta.elementId.version));
600
+ // we don't use hash tree metadata right now for anything, it's mainly used internally by HashTreeParser
601
+ break;
601
602
  default:
602
603
  _loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received unsupported object type ".concat(type));
603
604
  break;
@@ -749,8 +750,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
749
750
  if (this.hashTreeParser) {
750
751
  this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
751
752
  } else {
752
- // eslint-disable-next-line @typescript-eslint/no-shadow
753
753
  var eventType = data.eventType;
754
+ if (eventType === _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
755
+ // this can happen when we get an event before join http response
756
+ // it's OK to just ignore it
757
+ _loggerProxy.default.logger.info("Locus-info:index#parse --> received locus hash tree event before hashTreeParser is created");
758
+ return;
759
+ }
754
760
  var locus = this.getTheLocusToUpdate(data.locus);
755
761
  _loggerProxy.default.logger.info("Locus-info:index#parse --> received locus data: ".concat(eventType));
756
762
  locus.jsSdkMeta = {
@@ -771,14 +777,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
771
777
  case _constants.LOCUSEVENT.PARTICIPANT_DECLINED:
772
778
  case _constants.LOCUSEVENT.FLOOR_GRANTED:
773
779
  case _constants.LOCUSEVENT.FLOOR_RELEASED:
774
- this.onFullLocus(locus, eventType);
780
+ this.onFullLocus("classic locus event ".concat(eventType), locus, eventType);
775
781
  break;
776
782
  case _constants.LOCUSEVENT.DIFFERENCE:
777
783
  this.handleLocusDelta(locus, meeting);
778
784
  break;
779
- case _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED:
780
- this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected classic events"));
781
- break;
782
785
  default:
783
786
  // Why will there be a event with no eventType ????
784
787
  // we may not need this, we can get full locus
@@ -803,32 +806,36 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
803
806
  /**
804
807
  * Function for handling full locus when it's using hash trees (so not the "classic" one).
805
808
  *
809
+ * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
806
810
  * @param {object} locus locus object
811
+ * @param {object} metadata locus hash trees metadata
807
812
  * @param {string} eventType locus event
808
813
  * @param {DataSet[]} dataSets
809
814
  * @returns {void}
810
815
  */
811
816
  }, {
812
817
  key: "onFullLocusWithHashTrees",
813
- value: function onFullLocusWithHashTrees(locus, eventType, dataSets) {
818
+ value: function onFullLocusWithHashTrees(debugText, locus, metadata, eventType, dataSets) {
814
819
  if (!this.hashTreeParser) {
815
- _loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> creating hash tree parser");
816
- _loggerProxy.default.logger.info('Locus-info:index#onFullLocus --> dataSets:', dataSets, ' and locus:', locus);
820
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> creating hash tree parser"));
821
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> dataSets:"), dataSets, ' and locus:', locus, ' and metadata:', metadata);
817
822
  this.hashTreeParser = this.createHashTreeParser({
818
823
  initialLocus: {
819
824
  locus: locus,
820
825
  dataSets: dataSets
821
- }
826
+ },
827
+ metadata: metadata
822
828
  });
823
829
  this.onFullLocusCommon(locus, eventType);
824
830
  } else {
825
831
  // in this case the Locus we're getting is not necessarily the full one
826
832
  // so treat it like if we just got it in any api response
827
833
 
828
- _loggerProxy.default.logger.info('Locus-info:index#onFullLocus --> hash tree parser already exists, handling it like a normal API response');
834
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> hash tree parser already exists, handling it like a normal API response"));
829
835
  this.handleLocusAPIResponse(undefined, {
830
836
  dataSets: dataSets,
831
- locus: locus
837
+ locus: locus,
838
+ metadata: metadata
832
839
  });
833
840
  }
834
841
  }
@@ -836,15 +843,16 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
836
843
  /**
837
844
  * Function for handling full locus when it's the "classic" one (not hash trees)
838
845
  *
846
+ * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
839
847
  * @param {object} locus locus object
840
848
  * @param {string} eventType locus event
841
849
  * @returns {void}
842
850
  */
843
851
  }, {
844
852
  key: "onFullLocusClassic",
845
- value: function onFullLocusClassic(locus, eventType) {
853
+ value: function onFullLocusClassic(debugText, locus, eventType) {
846
854
  if (!this.locusParser.isNewFullLocus(locus)) {
847
- _loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=".concat(eventType));
855
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> ignoring old full locus DTO, eventType=").concat(eventType));
848
856
  return;
849
857
  }
850
858
  this.onFullLocusCommon(locus, eventType);
@@ -852,23 +860,28 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
852
860
 
853
861
  /**
854
862
  * updates the locus with full locus object
863
+ * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
855
864
  * @param {object} locus locus object
856
865
  * @param {string} eventType locus event
857
866
  * @param {DataSet[]} dataSets
867
+ * @param {object} metadata locus hash trees metadata
858
868
  * @returns {object} null
859
869
  * @memberof LocusInfo
860
870
  */
861
871
  }, {
862
872
  key: "onFullLocus",
863
- value: function onFullLocus(locus, eventType, dataSets) {
873
+ value: function onFullLocus(debugText, locus, eventType, dataSets, metadata) {
864
874
  if (!locus) {
865
- _loggerProxy.default.logger.error('Locus-info:index#onFullLocus --> object passed as argument was invalid, continuing.');
875
+ _loggerProxy.default.logger.error("Locus-info:index#onFullLocus (".concat(debugText, ") --> object passed as argument was invalid, continuing."));
866
876
  }
867
877
  if (dataSets) {
878
+ if (!metadata) {
879
+ throw new Error("Locus-info:index#onFullLocus (".concat(debugText, ") --> hash tree metadata is missing with full Locus"));
880
+ }
868
881
  // this is the new hashmap Locus DTO format (only applicable to webinars for now)
869
- this.onFullLocusWithHashTrees(locus, eventType, dataSets);
882
+ this.onFullLocusWithHashTrees(debugText, locus, metadata, eventType, dataSets);
870
883
  } else {
871
- this.onFullLocusClassic(locus, eventType);
884
+ this.onFullLocusClassic(debugText, locus, eventType);
872
885
  }
873
886
  }
874
887