@webex/plugin-meetings 3.11.0-next.32 → 3.11.0-next.34
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.
- package/dist/aiEnableRequest/index.js +5 -2
- package/dist/aiEnableRequest/index.js.map +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/constants.js +0 -2
- package/dist/constants.js.map +1 -1
- package/dist/hashTree/constants.js +3 -1
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +148 -94
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +48 -26
- package/dist/locus-info/index.js.map +1 -1
- package/dist/types/constants.d.ts +0 -1
- package/dist/types/hashTree/constants.d.ts +1 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +14 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +1 -1
- package/src/aiEnableRequest/index.ts +7 -1
- package/src/constants.ts +0 -1
- package/src/hashTree/constants.ts +1 -0
- package/src/hashTree/hashTreeParser.ts +140 -73
- package/src/locus-info/index.ts +19 -25
- package/test/unit/spec/aiEnableRequest/index.ts +28 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +307 -0
- package/test/unit/spec/locus-info/index.js +31 -0
|
@@ -15,7 +15,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequ
|
|
|
15
15
|
_Object$defineProperty(exports, "__esModule", {
|
|
16
16
|
value: true
|
|
17
17
|
});
|
|
18
|
-
exports.default = exports.LocusInfoUpdateType = void 0;
|
|
18
|
+
exports.default = exports.MeetingEndedError = exports.LocusInfoUpdateType = void 0;
|
|
19
19
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
20
20
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
21
21
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
@@ -55,7 +55,7 @@ var LocusInfoUpdateType = exports.LocusInfoUpdateType = {
|
|
|
55
55
|
* This error is thrown if we receive information that the meeting has ended while we're processing some hash messages.
|
|
56
56
|
* It's handled internally by HashTreeParser and results in MEETING_ENDED being sent up.
|
|
57
57
|
*/
|
|
58
|
-
var MeetingEndedError = /*#__PURE__*/function (_Error) {
|
|
58
|
+
var MeetingEndedError = exports.MeetingEndedError = /*#__PURE__*/function (_Error) {
|
|
59
59
|
function MeetingEndedError() {
|
|
60
60
|
(0, _classCallCheck2.default)(this, MeetingEndedError);
|
|
61
61
|
return _callSuper(this, MeetingEndedError, arguments);
|
|
@@ -67,6 +67,7 @@ var MeetingEndedError = /*#__PURE__*/function (_Error) {
|
|
|
67
67
|
* If this ever changes, update all the code that relies on this constant.
|
|
68
68
|
*/
|
|
69
69
|
var MetadataDataSetName = _constants2.DataSetNames.SELF;
|
|
70
|
+
var PossibleSentinelMessageDataSetNames = [_constants2.DataSetNames.MAIN, _constants2.DataSetNames.SELF, _constants2.DataSetNames.UNJOINED];
|
|
70
71
|
|
|
71
72
|
/**
|
|
72
73
|
* Parses hash tree eventing locus data
|
|
@@ -249,6 +250,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
249
250
|
}, {
|
|
250
251
|
key: "getAllVisibleDataSetsFromLocus",
|
|
251
252
|
value: function getAllVisibleDataSetsFromLocus() {
|
|
253
|
+
var _this3 = this;
|
|
252
254
|
if (!this.visibleDataSetsUrl) {
|
|
253
255
|
_loggerProxy.default.logger.warn("HashTreeParser#getAllVisibleDataSetsFromLocus --> ".concat(this.debugId, " No visibleDataSetsUrl, cannot get data sets information"));
|
|
254
256
|
return _promise.default.resolve([]);
|
|
@@ -258,6 +260,9 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
258
260
|
uri: this.visibleDataSetsUrl
|
|
259
261
|
}).then(function (response) {
|
|
260
262
|
return response.body.dataSets;
|
|
263
|
+
}).catch(function (error) {
|
|
264
|
+
_this3.checkForSentinelHttpResponse(error);
|
|
265
|
+
throw error;
|
|
261
266
|
});
|
|
262
267
|
}
|
|
263
268
|
|
|
@@ -562,14 +567,14 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
562
567
|
}, {
|
|
563
568
|
key: "isEndMessage",
|
|
564
569
|
value: function isEndMessage(message) {
|
|
565
|
-
var
|
|
566
|
-
|
|
570
|
+
var _this4 = this;
|
|
571
|
+
return message.dataSets.some(function (dataSet) {
|
|
572
|
+
if (dataSet.leafCount === 1 && dataSet.root === _constants2.EMPTY_HASH && (!_this4.dataSets[dataSet.name] || _this4.dataSets[dataSet.name].version < dataSet.version) && PossibleSentinelMessageDataSetNames.includes(dataSet.name.toLowerCase())) {
|
|
573
|
+
// this is a special way for Locus to indicate that this meeting has ended
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
return false;
|
|
567
577
|
});
|
|
568
|
-
if (mainDataSet && mainDataSet.leafCount === 1 && mainDataSet.root === _constants2.EMPTY_HASH && this.dataSets[_constants2.DataSetNames.MAIN].version < mainDataSet.version) {
|
|
569
|
-
// this is a special way for Locus to indicate that this meeting has ended
|
|
570
|
-
return true;
|
|
571
|
-
}
|
|
572
|
-
return false;
|
|
573
578
|
}
|
|
574
579
|
|
|
575
580
|
/**
|
|
@@ -581,7 +586,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
581
586
|
}, {
|
|
582
587
|
key: "handleRootHashHeartBeatMessage",
|
|
583
588
|
value: function handleRootHashHeartBeatMessage(message) {
|
|
584
|
-
var
|
|
589
|
+
var _this5 = this;
|
|
585
590
|
var dataSets = message.dataSets;
|
|
586
591
|
_loggerProxy.default.logger.info("HashTreeParser#handleRootHashMessage --> ".concat(this.debugId, " Received heartbeat root hash message with data sets: ").concat((0, _stringify.default)(dataSets.map(function (_ref2) {
|
|
587
592
|
var name = _ref2.name,
|
|
@@ -596,8 +601,33 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
596
601
|
};
|
|
597
602
|
}))));
|
|
598
603
|
dataSets.forEach(function (dataSet) {
|
|
599
|
-
|
|
600
|
-
|
|
604
|
+
_this5.updateDataSetInfo(dataSet);
|
|
605
|
+
_this5.runSyncAlgorithm(dataSet);
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Asynchronously initializes new visible data sets
|
|
611
|
+
*
|
|
612
|
+
* @param {VisibleDataSetInfo[]} dataSetsRequiringInitialization list of datasets to initialize
|
|
613
|
+
* @returns {void}
|
|
614
|
+
*/
|
|
615
|
+
}, {
|
|
616
|
+
key: "queueInitForNewVisibleDataSets",
|
|
617
|
+
value: function queueInitForNewVisibleDataSets(dataSetsRequiringInitialization) {
|
|
618
|
+
var _this6 = this;
|
|
619
|
+
queueMicrotask(function () {
|
|
620
|
+
_this6.initializeNewVisibleDataSets(dataSetsRequiringInitialization).catch(function (error) {
|
|
621
|
+
if (error instanceof MeetingEndedError) {
|
|
622
|
+
_this6.callLocusInfoUpdateCallback({
|
|
623
|
+
updateType: LocusInfoUpdateType.MEETING_ENDED
|
|
624
|
+
});
|
|
625
|
+
} else {
|
|
626
|
+
_loggerProxy.default.logger.warn("HashTreeParser#queueInitForNewVisibleDataSets --> ".concat(_this6.debugId, " error while initializing new visible datasets: ").concat(dataSetsRequiringInitialization.map(function (ds) {
|
|
627
|
+
return ds.name;
|
|
628
|
+
}).join(', '), ": "), error);
|
|
629
|
+
}
|
|
630
|
+
});
|
|
601
631
|
});
|
|
602
632
|
}
|
|
603
633
|
|
|
@@ -612,8 +642,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
612
642
|
}, {
|
|
613
643
|
key: "handleMetadataUpdate",
|
|
614
644
|
value: function handleMetadataUpdate(metadata, updatedObjects) {
|
|
615
|
-
var _this$dataSets$Metada
|
|
616
|
-
_this4 = this;
|
|
645
|
+
var _this$dataSets$Metada;
|
|
617
646
|
var dataSetsRequiringInitialization = [];
|
|
618
647
|
|
|
619
648
|
// current assumption based on Locus docs is that Metadata object lives always in "self" data set
|
|
@@ -638,9 +667,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
638
667
|
}
|
|
639
668
|
if (dataSetsRequiringInitialization.length > 0) {
|
|
640
669
|
// there are some data sets that we need to initialize asynchronously
|
|
641
|
-
|
|
642
|
-
_this4.initializeNewVisibleDataSets(dataSetsRequiringInitialization);
|
|
643
|
-
});
|
|
670
|
+
this.queueInitForNewVisibleDataSets(dataSetsRequiringInitialization);
|
|
644
671
|
}
|
|
645
672
|
}
|
|
646
673
|
}
|
|
@@ -656,7 +683,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
656
683
|
}, {
|
|
657
684
|
key: "handleLocusUpdate",
|
|
658
685
|
value: function handleLocusUpdate(update) {
|
|
659
|
-
var
|
|
686
|
+
var _this7 = this;
|
|
660
687
|
var dataSets = update.dataSets,
|
|
661
688
|
locus = update.locus,
|
|
662
689
|
metadata = update.metadata;
|
|
@@ -690,9 +717,9 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
690
717
|
|
|
691
718
|
// then process the data in hash trees, if it is a new version, then add it to updatedObjects
|
|
692
719
|
(0, _keys.default)(leafInfo).forEach(function (dataSetName) {
|
|
693
|
-
if (
|
|
694
|
-
if (
|
|
695
|
-
var appliedChangesList =
|
|
720
|
+
if (_this7.dataSets[dataSetName]) {
|
|
721
|
+
if (_this7.dataSets[dataSetName].hashTree) {
|
|
722
|
+
var appliedChangesList = _this7.dataSets[dataSetName].hashTree.putItems(leafInfo[dataSetName].map(function (leaf) {
|
|
696
723
|
return {
|
|
697
724
|
id: leaf.id,
|
|
698
725
|
type: leaf.type,
|
|
@@ -719,10 +746,10 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
719
746
|
});
|
|
720
747
|
} else {
|
|
721
748
|
// no hash tree means that the data set is not visible
|
|
722
|
-
_loggerProxy.default.logger.warn("HashTreeParser#handleLocusUpdate --> ".concat(
|
|
749
|
+
_loggerProxy.default.logger.warn("HashTreeParser#handleLocusUpdate --> ".concat(_this7.debugId, " received leaf data for data set \"").concat(dataSetName, "\" that has no hash tree created, ignoring"));
|
|
723
750
|
}
|
|
724
751
|
} else {
|
|
725
|
-
_loggerProxy.default.logger.warn("HashTreeParser#handleLocusUpdate --> ".concat(
|
|
752
|
+
_loggerProxy.default.logger.warn("HashTreeParser#handleLocusUpdate --> ".concat(_this7.debugId, " received leaf data for unknown data set \"").concat(dataSetName, "\", ignoring"));
|
|
726
753
|
}
|
|
727
754
|
});
|
|
728
755
|
if (updatedObjects.length === 0) {
|
|
@@ -770,7 +797,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
770
797
|
}, {
|
|
771
798
|
key: "checkForVisibleDataSetChanges",
|
|
772
799
|
value: function checkForVisibleDataSetChanges(updatedObjects) {
|
|
773
|
-
var
|
|
800
|
+
var _this8 = this;
|
|
774
801
|
var removedDataSets = [];
|
|
775
802
|
var addedDataSets = [];
|
|
776
803
|
|
|
@@ -779,20 +806,20 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
779
806
|
var _object$data;
|
|
780
807
|
if ((0, _utils.isMetadata)(object) && (_object$data = object.data) !== null && _object$data !== void 0 && _object$data.visibleDataSets) {
|
|
781
808
|
var newVisibleDataSets = object.data.visibleDataSets.filter(function (vds) {
|
|
782
|
-
return !
|
|
809
|
+
return !_this8.isExcludedDataSet(vds.name);
|
|
783
810
|
});
|
|
784
|
-
removedDataSets =
|
|
811
|
+
removedDataSets = _this8.visibleDataSets.filter(function (ds) {
|
|
785
812
|
return !newVisibleDataSets.some(function (nvs) {
|
|
786
813
|
return nvs.name === ds.name;
|
|
787
814
|
});
|
|
788
815
|
});
|
|
789
816
|
addedDataSets = newVisibleDataSets.filter(function (nvs) {
|
|
790
|
-
return
|
|
817
|
+
return _this8.visibleDataSets.every(function (ds) {
|
|
791
818
|
return ds.name !== nvs.name;
|
|
792
819
|
});
|
|
793
820
|
});
|
|
794
821
|
if (removedDataSets.length > 0 || addedDataSets.length > 0) {
|
|
795
|
-
_loggerProxy.default.logger.info("HashTreeParser#checkForVisibleDataSetChanges --> ".concat(
|
|
822
|
+
_loggerProxy.default.logger.info("HashTreeParser#checkForVisibleDataSetChanges --> ".concat(_this8.debugId, " visible data sets change: removed: ").concat(removedDataSets.map(function (ds) {
|
|
796
823
|
return ds.name;
|
|
797
824
|
}).join(', '), ", added: ").concat(addedDataSets.map(function (ds) {
|
|
798
825
|
return ds.name;
|
|
@@ -846,16 +873,16 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
846
873
|
}, {
|
|
847
874
|
key: "processVisibleDataSetChanges",
|
|
848
875
|
value: function processVisibleDataSetChanges(removedDataSets, addedDataSets, updatedObjects) {
|
|
849
|
-
var
|
|
876
|
+
var _this9 = this;
|
|
850
877
|
var dataSetsRequiringInitialization = [];
|
|
851
878
|
|
|
852
879
|
// if a visible data set was removed, we need to tell our client that all objects from it are removed
|
|
853
880
|
var removedObjects = [];
|
|
854
881
|
removedDataSets.forEach(function (ds) {
|
|
855
|
-
var
|
|
856
|
-
if ((
|
|
857
|
-
for (var i = 0; i <
|
|
858
|
-
removedObjects.push.apply(removedObjects, (0, _toConsumableArray2.default)(
|
|
882
|
+
var _this9$dataSets$ds$na;
|
|
883
|
+
if ((_this9$dataSets$ds$na = _this9.dataSets[ds.name]) !== null && _this9$dataSets$ds$na !== void 0 && _this9$dataSets$ds$na.hashTree) {
|
|
884
|
+
for (var i = 0; i < _this9.dataSets[ds.name].hashTree.numLeaves; i += 1) {
|
|
885
|
+
removedObjects.push.apply(removedObjects, (0, _toConsumableArray2.default)(_this9.dataSets[ds.name].hashTree.getLeafData(i).map(function (elementId) {
|
|
859
886
|
return {
|
|
860
887
|
htMeta: {
|
|
861
888
|
elementId: elementId,
|
|
@@ -865,7 +892,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
865
892
|
};
|
|
866
893
|
})));
|
|
867
894
|
}
|
|
868
|
-
|
|
895
|
+
_this9.deleteHashTree(ds.name);
|
|
869
896
|
}
|
|
870
897
|
});
|
|
871
898
|
this.visibleDataSets = this.visibleDataSets.filter(function (vds) {
|
|
@@ -923,7 +950,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
923
950
|
key: "initializeNewVisibleDataSets",
|
|
924
951
|
value: (function () {
|
|
925
952
|
var _initializeNewVisibleDataSets = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(addedDataSets) {
|
|
926
|
-
var
|
|
953
|
+
var _this0 = this;
|
|
927
954
|
var allDataSets, _iterator7, _step7, _loop, _t2;
|
|
928
955
|
return _regenerator.default.wrap(function (_context5) {
|
|
929
956
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -943,20 +970,20 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
943
970
|
dataSetInfo = allDataSets.find(function (d) {
|
|
944
971
|
return d.name === ds.name;
|
|
945
972
|
});
|
|
946
|
-
_loggerProxy.default.logger.info("HashTreeParser#initializeNewVisibleDataSets --> ".concat(
|
|
973
|
+
_loggerProxy.default.logger.info("HashTreeParser#initializeNewVisibleDataSets --> ".concat(_this0.debugId, " initializing data set \"").concat(ds.name, "\""));
|
|
947
974
|
if (dataSetInfo) {
|
|
948
975
|
_context4.next = 1;
|
|
949
976
|
break;
|
|
950
977
|
}
|
|
951
|
-
_loggerProxy.default.logger.warn("HashTreeParser#handleHashTreeMessage --> ".concat(
|
|
978
|
+
_loggerProxy.default.logger.warn("HashTreeParser#handleHashTreeMessage --> ".concat(_this0.debugId, " missing info about data set \"").concat(ds.name, "\" in Locus response from visibleDataSetsUrl"));
|
|
952
979
|
_context4.next = 3;
|
|
953
980
|
break;
|
|
954
981
|
case 1:
|
|
955
982
|
_context4.next = 2;
|
|
956
|
-
return
|
|
983
|
+
return _this0.initializeNewVisibleDataSet(ds, dataSetInfo);
|
|
957
984
|
case 2:
|
|
958
985
|
updates = _context4.sent;
|
|
959
|
-
|
|
986
|
+
_this0.callLocusInfoUpdateCallback(updates);
|
|
960
987
|
case 3:
|
|
961
988
|
case "end":
|
|
962
989
|
return _context4.stop();
|
|
@@ -1008,7 +1035,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1008
1035
|
value: (function () {
|
|
1009
1036
|
var _parseMessage = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(message, debugText) {
|
|
1010
1037
|
var _message$locusStateEl,
|
|
1011
|
-
|
|
1038
|
+
_this1 = this,
|
|
1012
1039
|
_message$locusStateEl2;
|
|
1013
1040
|
var dataSets, visibleDataSetsUrl, isRosterDropped, updatedObjects, dataSetsRequiringInitialization, metadataUpdates, updatedMetadataObjects, _this$checkForVisible2, changeDetected, removedDataSets, addedDataSets;
|
|
1014
1041
|
return _regenerator.default.wrap(function (_context6) {
|
|
@@ -1024,18 +1051,8 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1024
1051
|
// first, update our metadata about the datasets with info from the message
|
|
1025
1052
|
this.visibleDataSetsUrl = visibleDataSetsUrl;
|
|
1026
1053
|
dataSets.forEach(function (dataSet) {
|
|
1027
|
-
return
|
|
1054
|
+
return _this1.updateDataSetInfo(dataSet);
|
|
1028
1055
|
});
|
|
1029
|
-
if (!this.isEndMessage(message)) {
|
|
1030
|
-
_context6.next = 1;
|
|
1031
|
-
break;
|
|
1032
|
-
}
|
|
1033
|
-
_loggerProxy.default.logger.info("HashTreeParser#parseMessage --> ".concat(this.debugId, " received END message"));
|
|
1034
|
-
this.stopAllTimers();
|
|
1035
|
-
return _context6.abrupt("return", {
|
|
1036
|
-
updateType: LocusInfoUpdateType.MEETING_ENDED
|
|
1037
|
-
});
|
|
1038
|
-
case 1:
|
|
1039
1056
|
isRosterDropped = false;
|
|
1040
1057
|
updatedObjects = []; // when we detect new visible datasets, it may be that the metadata about them is not
|
|
1041
1058
|
// available in the message, they will require separate async initialization
|
|
@@ -1051,9 +1068,9 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1051
1068
|
_step8;
|
|
1052
1069
|
try {
|
|
1053
1070
|
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1054
|
-
var
|
|
1071
|
+
var _this1$dataSets$dataS;
|
|
1055
1072
|
var dataSetName = _step8.value;
|
|
1056
|
-
var hashTree = (
|
|
1073
|
+
var hashTree = (_this1$dataSets$dataS = _this1.dataSets[dataSetName]) === null || _this1$dataSets$dataS === void 0 ? void 0 : _this1$dataSets$dataS.hashTree;
|
|
1057
1074
|
if (hashTree && object.data) {
|
|
1058
1075
|
if (hashTree.putItem(object.htMeta.elementId)) {
|
|
1059
1076
|
updatedMetadataObjects.push(object);
|
|
@@ -1077,8 +1094,8 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1077
1094
|
// and hash trees created for the new visible data sets,
|
|
1078
1095
|
// so we can now process all the updates from the message
|
|
1079
1096
|
dataSets.forEach(function (dataSet) {
|
|
1080
|
-
if (
|
|
1081
|
-
var hashTree =
|
|
1097
|
+
if (_this1.dataSets[dataSet.name]) {
|
|
1098
|
+
var hashTree = _this1.dataSets[dataSet.name].hashTree;
|
|
1082
1099
|
if (hashTree) {
|
|
1083
1100
|
var locusStateElementsForThisSet = message.locusStateElements.filter(function (object) {
|
|
1084
1101
|
return object.htMeta.dataSetNames.includes(dataSet.name);
|
|
@@ -1105,16 +1122,16 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1105
1122
|
}
|
|
1106
1123
|
});
|
|
1107
1124
|
} else {
|
|
1108
|
-
_loggerProxy.default.logger.info("Locus-info:index#parseMessage --> ".concat(
|
|
1125
|
+
_loggerProxy.default.logger.info("Locus-info:index#parseMessage --> ".concat(_this1.debugId, " unexpected (not visible) dataSet ").concat(dataSet.name, " received in hash tree message"));
|
|
1109
1126
|
}
|
|
1110
1127
|
}
|
|
1111
1128
|
if (!isRosterDropped) {
|
|
1112
|
-
|
|
1129
|
+
_this1.runSyncAlgorithm(dataSet);
|
|
1113
1130
|
}
|
|
1114
1131
|
});
|
|
1115
1132
|
}
|
|
1116
1133
|
if (!isRosterDropped) {
|
|
1117
|
-
_context6.next =
|
|
1134
|
+
_context6.next = 1;
|
|
1118
1135
|
break;
|
|
1119
1136
|
}
|
|
1120
1137
|
_loggerProxy.default.logger.info("HashTreeParser#parseMessage --> ".concat(this.debugId, " detected roster drop"));
|
|
@@ -1124,12 +1141,10 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1124
1141
|
return _context6.abrupt("return", {
|
|
1125
1142
|
updateType: LocusInfoUpdateType.MEETING_ENDED
|
|
1126
1143
|
});
|
|
1127
|
-
case
|
|
1144
|
+
case 1:
|
|
1128
1145
|
if (dataSetsRequiringInitialization.length > 0) {
|
|
1129
1146
|
// there are some data sets that we need to initialize asynchronously
|
|
1130
|
-
|
|
1131
|
-
_this9.initializeNewVisibleDataSets(dataSetsRequiringInitialization);
|
|
1132
|
-
});
|
|
1147
|
+
this.queueInitForNewVisibleDataSets(dataSetsRequiringInitialization);
|
|
1133
1148
|
}
|
|
1134
1149
|
if (updatedObjects.length === 0) {
|
|
1135
1150
|
_loggerProxy.default.logger.info("HashTreeParser#parseMessage --> ".concat(this.debugId, " No objects updated as a result of received message"));
|
|
@@ -1138,7 +1153,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1138
1153
|
updateType: LocusInfoUpdateType.OBJECTS_UPDATED,
|
|
1139
1154
|
updatedObjects: updatedObjects
|
|
1140
1155
|
});
|
|
1141
|
-
case
|
|
1156
|
+
case 2:
|
|
1142
1157
|
case "end":
|
|
1143
1158
|
return _context6.stop();
|
|
1144
1159
|
}
|
|
@@ -1168,25 +1183,37 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1168
1183
|
if (message.heartbeatIntervalMs) {
|
|
1169
1184
|
this.heartbeatIntervalMs = message.heartbeatIntervalMs;
|
|
1170
1185
|
}
|
|
1171
|
-
if (!(message
|
|
1186
|
+
if (!this.isEndMessage(message)) {
|
|
1172
1187
|
_context7.next = 1;
|
|
1173
1188
|
break;
|
|
1174
1189
|
}
|
|
1190
|
+
_loggerProxy.default.logger.info("HashTreeParser#parseMessage --> ".concat(this.debugId, " received sentinel END MEETING message"));
|
|
1191
|
+
this.stopAllTimers();
|
|
1192
|
+
this.callLocusInfoUpdateCallback({
|
|
1193
|
+
updateType: LocusInfoUpdateType.MEETING_ENDED
|
|
1194
|
+
});
|
|
1195
|
+
_context7.next = 4;
|
|
1196
|
+
break;
|
|
1197
|
+
case 1:
|
|
1198
|
+
if (!(message.locusStateElements === undefined)) {
|
|
1199
|
+
_context7.next = 2;
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1175
1202
|
this.handleRootHashHeartBeatMessage(message);
|
|
1176
1203
|
this.resetHeartbeatWatchdogs(message.dataSets);
|
|
1177
|
-
_context7.next =
|
|
1204
|
+
_context7.next = 4;
|
|
1178
1205
|
break;
|
|
1179
|
-
case 1:
|
|
1180
|
-
_context7.next = 2;
|
|
1181
|
-
return this.parseMessage(message, debugText);
|
|
1182
1206
|
case 2:
|
|
1207
|
+
_context7.next = 3;
|
|
1208
|
+
return this.parseMessage(message, debugText);
|
|
1209
|
+
case 3:
|
|
1183
1210
|
updates = _context7.sent;
|
|
1184
1211
|
// Only reset watchdogs if the meeting hasn't ended
|
|
1185
1212
|
if (updates.updateType !== LocusInfoUpdateType.MEETING_ENDED) {
|
|
1186
1213
|
this.resetHeartbeatWatchdogs(message.dataSets);
|
|
1187
1214
|
}
|
|
1188
1215
|
this.callLocusInfoUpdateCallback(updates);
|
|
1189
|
-
case
|
|
1216
|
+
case 4:
|
|
1190
1217
|
case "end":
|
|
1191
1218
|
return _context7.stop();
|
|
1192
1219
|
}
|
|
@@ -1207,7 +1234,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1207
1234
|
}, {
|
|
1208
1235
|
key: "callLocusInfoUpdateCallback",
|
|
1209
1236
|
value: function callLocusInfoUpdateCallback(updates) {
|
|
1210
|
-
var
|
|
1237
|
+
var _this10 = this;
|
|
1211
1238
|
var updateType = updates.updateType,
|
|
1212
1239
|
updatedObjects = updates.updatedObjects;
|
|
1213
1240
|
if (updateType === LocusInfoUpdateType.OBJECTS_UPDATED && (updatedObjects === null || updatedObjects === void 0 ? void 0 : updatedObjects.length) > 0) {
|
|
@@ -1220,9 +1247,9 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1220
1247
|
version = elementId.version;
|
|
1221
1248
|
|
|
1222
1249
|
// Check all datasets
|
|
1223
|
-
for (var _i2 = 0, _Object$keys3 = (0, _keys.default)(
|
|
1250
|
+
for (var _i2 = 0, _Object$keys3 = (0, _keys.default)(_this10.dataSets); _i2 < _Object$keys3.length; _i2++) {
|
|
1224
1251
|
var dataSetName = _Object$keys3[_i2];
|
|
1225
|
-
var dataSet =
|
|
1252
|
+
var dataSet = _this10.dataSets[dataSetName];
|
|
1226
1253
|
|
|
1227
1254
|
// only visible datasets have hash trees set
|
|
1228
1255
|
if (dataSet !== null && dataSet !== void 0 && dataSet.hashTree) {
|
|
@@ -1231,12 +1258,12 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1231
1258
|
if (object.data) {
|
|
1232
1259
|
// For updates: filter out if any dataset has a higher version
|
|
1233
1260
|
if (existingVersion > version) {
|
|
1234
|
-
_loggerProxy.default.logger.info("HashTreeParser#callLocusInfoUpdateCallback --> ".concat(
|
|
1261
|
+
_loggerProxy.default.logger.info("HashTreeParser#callLocusInfoUpdateCallback --> ".concat(_this10.debugId, " Filtering out update for ").concat(type, ":").concat(id, " v").concat(version, " because dataset \"").concat(dataSetName, "\" has v").concat(existingVersion));
|
|
1235
1262
|
return false;
|
|
1236
1263
|
}
|
|
1237
1264
|
} else if (existingVersion >= version) {
|
|
1238
1265
|
// For removals: filter out if the object still exists in any dataset
|
|
1239
|
-
_loggerProxy.default.logger.info("HashTreeParser#callLocusInfoUpdateCallback --> ".concat(
|
|
1266
|
+
_loggerProxy.default.logger.info("HashTreeParser#callLocusInfoUpdateCallback --> ".concat(_this10.debugId, " Filtering out removal for ").concat(type, ":").concat(id, " v").concat(version, " because dataset \"").concat(dataSetName, "\" still has v").concat(existingVersion));
|
|
1240
1267
|
return false;
|
|
1241
1268
|
}
|
|
1242
1269
|
}
|
|
@@ -1283,7 +1310,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1283
1310
|
key: "performSync",
|
|
1284
1311
|
value: (function () {
|
|
1285
1312
|
var _performSync = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(dataSet, rootHash, reason) {
|
|
1286
|
-
var mismatchedLeavesData, receivedHashes, _yield$this$getHashes, hashes, latestDataSetInfo, mismatchedLeaveIndexes, syncResponse, _t3;
|
|
1313
|
+
var mismatchedLeavesData, receivedHashes, _yield$this$getHashes, hashes, latestDataSetInfo, mismatchedLeaveIndexes, syncResponse, _t3, _t4;
|
|
1287
1314
|
return _regenerator.default.wrap(function (_context8) {
|
|
1288
1315
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1289
1316
|
case 0:
|
|
@@ -1293,6 +1320,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1293
1320
|
}
|
|
1294
1321
|
return _context8.abrupt("return");
|
|
1295
1322
|
case 1:
|
|
1323
|
+
_context8.prev = 1;
|
|
1296
1324
|
_loggerProxy.default.logger.info("HashTreeParser#performSync --> ".concat(this.debugId, " ").concat(reason, ", syncing data set \"").concat(dataSet.name, "\""));
|
|
1297
1325
|
mismatchedLeavesData = {};
|
|
1298
1326
|
if (!(dataSet.leafCount !== 1)) {
|
|
@@ -1347,10 +1375,23 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1347
1375
|
this.handleMessage(syncResponse, 'via sync API');
|
|
1348
1376
|
}
|
|
1349
1377
|
case 10:
|
|
1378
|
+
_context8.next = 12;
|
|
1379
|
+
break;
|
|
1380
|
+
case 11:
|
|
1381
|
+
_context8.prev = 11;
|
|
1382
|
+
_t4 = _context8["catch"](1);
|
|
1383
|
+
if (_t4 instanceof MeetingEndedError) {
|
|
1384
|
+
this.callLocusInfoUpdateCallback({
|
|
1385
|
+
updateType: LocusInfoUpdateType.MEETING_ENDED
|
|
1386
|
+
});
|
|
1387
|
+
} else {
|
|
1388
|
+
_loggerProxy.default.logger.warn("HashTreeParser#performSync --> ".concat(this.debugId, " error during sync for data set \"").concat(dataSet.name, "\":"), _t4);
|
|
1389
|
+
}
|
|
1390
|
+
case 12:
|
|
1350
1391
|
case "end":
|
|
1351
1392
|
return _context8.stop();
|
|
1352
1393
|
}
|
|
1353
|
-
}, _callee7, this, [[2, 4]]);
|
|
1394
|
+
}, _callee7, this, [[1, 11], [2, 4]]);
|
|
1354
1395
|
}));
|
|
1355
1396
|
function performSync(_x0, _x1, _x10) {
|
|
1356
1397
|
return _performSync.apply(this, arguments);
|
|
@@ -1367,7 +1408,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1367
1408
|
}, {
|
|
1368
1409
|
key: "runSyncAlgorithm",
|
|
1369
1410
|
value: function runSyncAlgorithm(receivedDataSet) {
|
|
1370
|
-
var
|
|
1411
|
+
var _this11 = this;
|
|
1371
1412
|
var dataSet = this.dataSets[receivedDataSet.name];
|
|
1372
1413
|
if (!dataSet) {
|
|
1373
1414
|
_loggerProxy.default.logger.warn("HashTreeParser#runSyncAlgorithm --> ".concat(this.debugId, " No data set found for ").concat(receivedDataSet.name, ", skipping sync algorithm"));
|
|
@@ -1398,7 +1439,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1398
1439
|
_context9.next = 1;
|
|
1399
1440
|
break;
|
|
1400
1441
|
}
|
|
1401
|
-
_loggerProxy.default.logger.warn("HashTreeParser#runSyncAlgorithm --> ".concat(
|
|
1442
|
+
_loggerProxy.default.logger.warn("HashTreeParser#runSyncAlgorithm --> ".concat(_this11.debugId, " Data set \"").concat(dataSet.name, "\" no longer has a hash tree, cannot run sync algorithm"));
|
|
1402
1443
|
return _context9.abrupt("return");
|
|
1403
1444
|
case 1:
|
|
1404
1445
|
rootHash = dataSet.hashTree.getRootHash();
|
|
@@ -1407,12 +1448,12 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1407
1448
|
break;
|
|
1408
1449
|
}
|
|
1409
1450
|
_context9.next = 2;
|
|
1410
|
-
return
|
|
1451
|
+
return _this11.performSync(dataSet, rootHash, "Root hash mismatch: received=".concat(dataSet.root, ", ours=").concat(rootHash));
|
|
1411
1452
|
case 2:
|
|
1412
1453
|
_context9.next = 4;
|
|
1413
1454
|
break;
|
|
1414
1455
|
case 3:
|
|
1415
|
-
_loggerProxy.default.logger.info("HashTreeParser#runSyncAlgorithm --> ".concat(
|
|
1456
|
+
_loggerProxy.default.logger.info("HashTreeParser#runSyncAlgorithm --> ".concat(_this11.debugId, " \"").concat(dataSet.name, "\" root hash matching: ").concat(rootHash, ", version=").concat(dataSet.version));
|
|
1416
1457
|
case 4:
|
|
1417
1458
|
case "end":
|
|
1418
1459
|
return _context9.stop();
|
|
@@ -1436,7 +1477,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1436
1477
|
}, {
|
|
1437
1478
|
key: "resetHeartbeatWatchdogs",
|
|
1438
1479
|
value: function resetHeartbeatWatchdogs(receivedDataSets) {
|
|
1439
|
-
var
|
|
1480
|
+
var _this12 = this;
|
|
1440
1481
|
if (!this.heartbeatIntervalMs) {
|
|
1441
1482
|
return;
|
|
1442
1483
|
}
|
|
@@ -1445,7 +1486,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1445
1486
|
try {
|
|
1446
1487
|
var _loop2 = function _loop2() {
|
|
1447
1488
|
var receivedDataSet = _step9.value;
|
|
1448
|
-
var dataSet =
|
|
1489
|
+
var dataSet = _this12.dataSets[receivedDataSet.name];
|
|
1449
1490
|
if (!(dataSet !== null && dataSet !== void 0 && dataSet.hashTree)) {
|
|
1450
1491
|
// eslint-disable-next-line no-continue
|
|
1451
1492
|
return 1; // continue
|
|
@@ -1454,16 +1495,16 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1454
1495
|
clearTimeout(dataSet.heartbeatWatchdogTimer);
|
|
1455
1496
|
dataSet.heartbeatWatchdogTimer = undefined;
|
|
1456
1497
|
}
|
|
1457
|
-
var backoffTime =
|
|
1458
|
-
var delay =
|
|
1498
|
+
var backoffTime = _this12.getWeightedBackoffTime(dataSet.backoff);
|
|
1499
|
+
var delay = _this12.heartbeatIntervalMs + backoffTime;
|
|
1459
1500
|
dataSet.heartbeatWatchdogTimer = setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
1460
1501
|
return _regenerator.default.wrap(function (_context0) {
|
|
1461
1502
|
while (1) switch (_context0.prev = _context0.next) {
|
|
1462
1503
|
case 0:
|
|
1463
1504
|
dataSet.heartbeatWatchdogTimer = undefined;
|
|
1464
|
-
_loggerProxy.default.logger.warn("HashTreeParser#resetHeartbeatWatchdogs --> ".concat(
|
|
1505
|
+
_loggerProxy.default.logger.warn("HashTreeParser#resetHeartbeatWatchdogs --> ".concat(_this12.debugId, " Heartbeat watchdog fired for data set \"").concat(dataSet.name, "\" - no heartbeat received within expected interval, initiating sync"));
|
|
1465
1506
|
_context0.next = 1;
|
|
1466
|
-
return
|
|
1507
|
+
return _this12.performSync(dataSet, dataSet.hashTree.getRootHash(), "heartbeat watchdog expired");
|
|
1467
1508
|
case 1:
|
|
1468
1509
|
case "end":
|
|
1469
1510
|
return _context0.stop();
|
|
@@ -1499,6 +1540,17 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1499
1540
|
}
|
|
1500
1541
|
});
|
|
1501
1542
|
}
|
|
1543
|
+
}, {
|
|
1544
|
+
key: "checkForSentinelHttpResponse",
|
|
1545
|
+
value: function checkForSentinelHttpResponse(error, dataSetName) {
|
|
1546
|
+
var _error$body;
|
|
1547
|
+
var isValidDataSetForSentinel = dataSetName === undefined || PossibleSentinelMessageDataSetNames.includes(dataSetName.toLowerCase());
|
|
1548
|
+
if ((error.statusCode === 409 && ((_error$body = error.body) === null || _error$body === void 0 ? void 0 : _error$body.errorCode) === 2403004 || error.statusCode === 404) && isValidDataSetForSentinel) {
|
|
1549
|
+
_loggerProxy.default.logger.info("HashTreeParser#checkForSentinelHttpResponse --> ".concat(this.debugId, " Received ").concat(error.statusCode, " for data set \"").concat(dataSetName, "\", indicating that the meeting has ended"));
|
|
1550
|
+
this.stopAllTimers();
|
|
1551
|
+
throw new MeetingEndedError();
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1502
1554
|
|
|
1503
1555
|
/**
|
|
1504
1556
|
* Gets the current hashes from the locus for a specific data set.
|
|
@@ -1509,7 +1561,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1509
1561
|
}, {
|
|
1510
1562
|
key: "getHashesFromLocus",
|
|
1511
1563
|
value: function getHashesFromLocus(dataSetName, currentRootHash) {
|
|
1512
|
-
var
|
|
1564
|
+
var _this13 = this;
|
|
1513
1565
|
_loggerProxy.default.logger.info("HashTreeParser#getHashesFromLocus --> ".concat(this.debugId, " Requesting hashes for data set \"").concat(dataSetName, "\""));
|
|
1514
1566
|
var dataSet = this.dataSets[dataSetName];
|
|
1515
1567
|
var url = "".concat(dataSet.url, "/hashtree");
|
|
@@ -1524,16 +1576,17 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1524
1576
|
var hashes = (_response$body = response.body) === null || _response$body === void 0 ? void 0 : _response$body.hashes;
|
|
1525
1577
|
var dataSetFromResponse = (_response$body2 = response.body) === null || _response$body2 === void 0 ? void 0 : _response$body2.dataSet;
|
|
1526
1578
|
if (!hashes || !(0, _isArray.default)(hashes)) {
|
|
1527
|
-
_loggerProxy.default.logger.warn("HashTreeParser#getHashesFromLocus --> ".concat(
|
|
1579
|
+
_loggerProxy.default.logger.warn("HashTreeParser#getHashesFromLocus --> ".concat(_this13.debugId, " Locus returned invalid hashes, response body="), response.body);
|
|
1528
1580
|
throw new Error("Locus returned invalid hashes: ".concat(hashes));
|
|
1529
1581
|
}
|
|
1530
|
-
_loggerProxy.default.logger.info("HashTreeParser#getHashesFromLocus --> ".concat(
|
|
1582
|
+
_loggerProxy.default.logger.info("HashTreeParser#getHashesFromLocus --> ".concat(_this13.debugId, " Received hashes for data set \"").concat(dataSetName, "\": ").concat((0, _stringify.default)(hashes)));
|
|
1531
1583
|
return {
|
|
1532
1584
|
hashes: hashes,
|
|
1533
1585
|
dataSet: dataSetFromResponse
|
|
1534
1586
|
};
|
|
1535
1587
|
}).catch(function (error) {
|
|
1536
|
-
_loggerProxy.default.logger.error("HashTreeParser#getHashesFromLocus --> ".concat(
|
|
1588
|
+
_loggerProxy.default.logger.error("HashTreeParser#getHashesFromLocus --> ".concat(_this13.debugId, " Error ").concat(error.statusCode, " fetching hashes for data set \"").concat(dataSetName, "\":"), error);
|
|
1589
|
+
_this13.checkForSentinelHttpResponse(error, dataSet.name);
|
|
1537
1590
|
throw error;
|
|
1538
1591
|
});
|
|
1539
1592
|
}
|
|
@@ -1548,7 +1601,7 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1548
1601
|
}, {
|
|
1549
1602
|
key: "sendSyncRequestToLocus",
|
|
1550
1603
|
value: function sendSyncRequestToLocus(dataSet, mismatchedLeavesData) {
|
|
1551
|
-
var
|
|
1604
|
+
var _this14 = this;
|
|
1552
1605
|
_loggerProxy.default.logger.info("HashTreeParser#sendSyncRequestToLocus --> ".concat(this.debugId, " Sending sync request for data set \"").concat(dataSet.name, "\""));
|
|
1553
1606
|
var url = "".concat(dataSet.url, "/sync");
|
|
1554
1607
|
var body = {
|
|
@@ -1570,14 +1623,15 @@ var HashTreeParser = /*#__PURE__*/function () {
|
|
|
1570
1623
|
},
|
|
1571
1624
|
body: body
|
|
1572
1625
|
}).then(function (resp) {
|
|
1573
|
-
_loggerProxy.default.logger.info("HashTreeParser#sendSyncRequestToLocus --> ".concat(
|
|
1626
|
+
_loggerProxy.default.logger.info("HashTreeParser#sendSyncRequestToLocus --> ".concat(_this14.debugId, " Sync request succeeded for \"").concat(dataSet.name, "\""));
|
|
1574
1627
|
if (!resp.body || (0, _lodash.isEmpty)(resp.body)) {
|
|
1575
|
-
_loggerProxy.default.logger.info("HashTreeParser#sendSyncRequestToLocus --> ".concat(
|
|
1628
|
+
_loggerProxy.default.logger.info("HashTreeParser#sendSyncRequestToLocus --> ".concat(_this14.debugId, " Got ").concat(resp.statusCode, " with empty body for sync request for data set \"").concat(dataSet.name, "\", data should arrive via messages"));
|
|
1576
1629
|
return null;
|
|
1577
1630
|
}
|
|
1578
1631
|
return resp.body;
|
|
1579
1632
|
}).catch(function (error) {
|
|
1580
|
-
_loggerProxy.default.logger.error("HashTreeParser#sendSyncRequestToLocus --> ".concat(
|
|
1633
|
+
_loggerProxy.default.logger.error("HashTreeParser#sendSyncRequestToLocus --> ".concat(_this14.debugId, " Error ").concat(error.statusCode, " sending sync request for data set \"").concat(dataSet.name, "\":"), error);
|
|
1634
|
+
_this14.checkForSentinelHttpResponse(error, dataSet.name);
|
|
1581
1635
|
throw error;
|
|
1582
1636
|
});
|
|
1583
1637
|
}
|