@webex/plugin-meetings 3.10.0-next.9 → 3.10.0-set-bitrate.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.
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/constants.js +11 -3
- package/dist/constants.js.map +1 -1
- package/dist/hashTree/constants.js +20 -0
- package/dist/hashTree/constants.js.map +1 -0
- package/dist/hashTree/hashTree.js +515 -0
- package/dist/hashTree/hashTree.js.map +1 -0
- package/dist/hashTree/hashTreeParser.js +1266 -0
- package/dist/hashTree/hashTreeParser.js.map +1 -0
- package/dist/hashTree/types.js +22 -0
- package/dist/hashTree/types.js.map +1 -0
- package/dist/hashTree/utils.js +48 -0
- package/dist/hashTree/utils.js.map +1 -0
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +550 -130
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/types.js +7 -0
- package/dist/locus-info/types.js.map +1 -0
- package/dist/meeting/index.js +63 -22
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/util.js +1 -0
- package/dist/meeting/util.js.map +1 -1
- package/dist/meetings/index.js +112 -70
- package/dist/meetings/index.js.map +1 -1
- package/dist/metrics/constants.js +3 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/reachability/clusterReachability.js +44 -358
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/reachability.types.js +14 -1
- package/dist/reachability/reachability.types.js.map +1 -1
- package/dist/reachability/reachabilityPeerConnection.js +445 -0
- package/dist/reachability/reachabilityPeerConnection.js.map +1 -0
- package/dist/types/constants.d.ts +26 -21
- package/dist/types/hashTree/constants.d.ts +8 -0
- package/dist/types/hashTree/hashTree.d.ts +129 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +260 -0
- package/dist/types/hashTree/types.d.ts +27 -0
- package/dist/types/hashTree/utils.d.ts +9 -0
- package/dist/types/locus-info/index.d.ts +97 -80
- package/dist/types/locus-info/types.d.ts +54 -0
- package/dist/types/meeting/index.d.ts +22 -9
- package/dist/types/meetings/index.d.ts +9 -2
- package/dist/types/metrics/constants.d.ts +2 -0
- package/dist/types/reachability/clusterReachability.d.ts +10 -88
- package/dist/types/reachability/reachability.types.d.ts +12 -1
- package/dist/types/reachability/reachabilityPeerConnection.d.ts +111 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +22 -21
- package/src/constants.ts +13 -1
- package/src/hashTree/constants.ts +9 -0
- package/src/hashTree/hashTree.ts +463 -0
- package/src/hashTree/hashTreeParser.ts +1161 -0
- package/src/hashTree/types.ts +32 -0
- package/src/hashTree/utils.ts +42 -0
- package/src/locus-info/index.ts +597 -154
- package/src/locus-info/types.ts +53 -0
- package/src/meeting/index.ts +78 -27
- package/src/meeting/util.ts +1 -0
- package/src/meetings/index.ts +104 -51
- package/src/metrics/constants.ts +2 -0
- package/src/reachability/clusterReachability.ts +50 -347
- package/src/reachability/reachability.types.ts +15 -1
- package/src/reachability/reachabilityPeerConnection.ts +416 -0
- package/test/unit/spec/hashTree/hashTree.ts +655 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +1532 -0
- package/test/unit/spec/hashTree/utils.ts +103 -0
- package/test/unit/spec/locus-info/index.js +795 -16
- package/test/unit/spec/meeting/index.js +120 -20
- package/test/unit/spec/meeting/utils.js +77 -0
- package/test/unit/spec/meetings/index.js +71 -26
- package/test/unit/spec/reachability/clusterReachability.ts +281 -138
package/dist/locus-info/index.js
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
|
|
3
4
|
var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
|
|
5
|
+
var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
6
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
8
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
9
|
+
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
10
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
11
|
var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
|
|
5
12
|
var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
|
|
6
13
|
var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
|
|
7
14
|
var _Array$isArray2 = require("@babel/runtime-corejs2/core-js/array/is-array");
|
|
8
|
-
var
|
|
15
|
+
var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
|
|
9
16
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
10
17
|
_Object$defineProperty(exports, "__esModule", {
|
|
11
18
|
value: true
|
|
12
19
|
});
|
|
13
20
|
exports.default = void 0;
|
|
21
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
22
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
|
|
23
|
+
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
24
|
+
var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
|
|
25
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
14
26
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
|
|
27
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
15
28
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
16
29
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
17
30
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
|
|
@@ -32,11 +45,25 @@ var _mediaSharesUtils = _interopRequireDefault(require("./mediaSharesUtils"));
|
|
|
32
45
|
var _parser = _interopRequireDefault(require("./parser"));
|
|
33
46
|
var _metrics = _interopRequireDefault(require("../metrics"));
|
|
34
47
|
var _constants2 = _interopRequireDefault(require("../metrics/constants"));
|
|
48
|
+
var _hashTreeParser = _interopRequireWildcard(require("../hashTree/hashTreeParser"));
|
|
49
|
+
var _types = require("../hashTree/types");
|
|
50
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
35
51
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && r[_Symbol$iterator] || r["@@iterator"]; if (!t) { if (_Array$isArray2(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
36
52
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
37
53
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
54
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
55
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
38
56
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
39
57
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
58
|
+
// list of top level keys in Locus DTO relevant for Hash Tree DTOs processing
|
|
59
|
+
// it does not contain fields specific to classic Locus DTOs like sequence or baseSequence
|
|
60
|
+
var LocusDtoTopLevelKeys = ['controls', 'fullState', 'host', 'info', 'links', 'mediaShares', 'meetings', 'participants', 'replaces', 'self', 'sequence', 'syncUrl', 'url', 'htMeta' // only exists when hash trees are used
|
|
61
|
+
];
|
|
62
|
+
var LocusObjectStateAfterUpdates = {
|
|
63
|
+
unchanged: 'unchanged',
|
|
64
|
+
removed: 'removed',
|
|
65
|
+
updated: 'updated'
|
|
66
|
+
};
|
|
40
67
|
/**
|
|
41
68
|
* @description LocusInfo extends ChildEmitter to convert locusInfo info a private emitter to parent object
|
|
42
69
|
* @export
|
|
@@ -65,10 +92,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
65
92
|
(0, _defineProperty2.default)(_this, "aclUrl", void 0);
|
|
66
93
|
(0, _defineProperty2.default)(_this, "baseSequence", void 0);
|
|
67
94
|
(0, _defineProperty2.default)(_this, "created", void 0);
|
|
68
|
-
(0, _defineProperty2.default)(_this, "identities", void 0);
|
|
69
|
-
(0, _defineProperty2.default)(_this, "membership", void 0);
|
|
70
95
|
(0, _defineProperty2.default)(_this, "participants", void 0);
|
|
71
|
-
(0, _defineProperty2.default)(_this, "participantsUrl", void 0);
|
|
72
96
|
(0, _defineProperty2.default)(_this, "replaces", void 0);
|
|
73
97
|
(0, _defineProperty2.default)(_this, "scheduledMeeting", void 0);
|
|
74
98
|
(0, _defineProperty2.default)(_this, "sequence", void 0);
|
|
@@ -80,12 +104,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
80
104
|
(0, _defineProperty2.default)(_this, "info", void 0);
|
|
81
105
|
(0, _defineProperty2.default)(_this, "roles", void 0);
|
|
82
106
|
(0, _defineProperty2.default)(_this, "mediaShares", void 0);
|
|
83
|
-
(0, _defineProperty2.default)(_this, "replace", void 0);
|
|
84
107
|
(0, _defineProperty2.default)(_this, "url", void 0);
|
|
85
|
-
(0, _defineProperty2.default)(_this, "
|
|
86
|
-
(0, _defineProperty2.default)(_this, "resources", void 0);
|
|
108
|
+
(0, _defineProperty2.default)(_this, "links", void 0);
|
|
87
109
|
(0, _defineProperty2.default)(_this, "mainSessionLocusCache", void 0);
|
|
88
110
|
(0, _defineProperty2.default)(_this, "self", void 0);
|
|
111
|
+
(0, _defineProperty2.default)(_this, "hashTreeParser", void 0);
|
|
112
|
+
(0, _defineProperty2.default)(_this, "hashTreeObjectId2ParticipantId", void 0);
|
|
113
|
+
// mapping of hash tree object ids to participant ids
|
|
114
|
+
(0, _defineProperty2.default)(_this, "classicVsHashTreeMismatchMetricCounter", 0);
|
|
89
115
|
_this.parsedLocus = {
|
|
90
116
|
states: []
|
|
91
117
|
};
|
|
@@ -95,11 +121,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
95
121
|
_this.meetingId = meetingId;
|
|
96
122
|
_this.updateMeeting = updateMeeting;
|
|
97
123
|
_this.locusParser = new _parser.default();
|
|
124
|
+
_this.hashTreeObjectId2ParticipantId = new _map.default();
|
|
98
125
|
return _this;
|
|
99
126
|
}
|
|
100
127
|
|
|
101
128
|
/**
|
|
102
129
|
* Does a Locus sync. It tries to get the latest delta DTO or if it can't, it falls back to getting the full Locus DTO.
|
|
130
|
+
* WARNING: This function must not be used for hash tree based Locus meetings.
|
|
103
131
|
*
|
|
104
132
|
* @param {Meeting} meeting
|
|
105
133
|
* @param {boolean} isLocusUrlChanged
|
|
@@ -266,17 +294,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
266
294
|
}, {
|
|
267
295
|
key: "init",
|
|
268
296
|
value: function init() {
|
|
269
|
-
var _locus$links, _locus$links2;
|
|
270
297
|
var locus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
271
298
|
this.created = locus.created || null;
|
|
272
299
|
this.scheduledMeeting = locus.meeting || null;
|
|
273
|
-
this.participantsUrl = locus.participantsUrl || null;
|
|
274
300
|
this.replaces = locus.replaces || null;
|
|
275
301
|
this.aclUrl = locus.aclUrl || null;
|
|
276
302
|
this.baseSequence = locus.baseSequence || null;
|
|
277
303
|
this.sequence = locus.sequence || null;
|
|
278
|
-
this.membership = locus.membership || null;
|
|
279
|
-
this.identities = locus.identities || null;
|
|
280
304
|
this.participants = locus.participants || null;
|
|
281
305
|
|
|
282
306
|
/**
|
|
@@ -302,35 +326,400 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
302
326
|
this.updateSelf(locus.self);
|
|
303
327
|
this.updateHostInfo(locus.host);
|
|
304
328
|
this.updateMediaShares(locus.mediaShares);
|
|
305
|
-
this.
|
|
306
|
-
this.updateResources((_locus$links2 = locus.links) === null || _locus$links2 === void 0 ? void 0 : _locus$links2.resources);
|
|
329
|
+
this.updateLinks(locus.links);
|
|
307
330
|
}
|
|
308
331
|
|
|
309
332
|
/**
|
|
310
|
-
*
|
|
333
|
+
* Creates the HashTreeParser instance.
|
|
334
|
+
* @param {Object} initial locus data
|
|
335
|
+
* @returns {void}
|
|
336
|
+
*/
|
|
337
|
+
}, {
|
|
338
|
+
key: "createHashTreeParser",
|
|
339
|
+
value: function createHashTreeParser(_ref) {
|
|
340
|
+
var initialLocus = _ref.initialLocus;
|
|
341
|
+
return new _hashTreeParser.default({
|
|
342
|
+
initialLocus: initialLocus,
|
|
343
|
+
webexRequest: this.webex.request.bind(this.webex),
|
|
344
|
+
locusInfoUpdateCallback: this.updateFromHashTree.bind(this),
|
|
345
|
+
debugId: "HT-".concat(this.meetingId.substring(0, 4))
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* @param {Object} data - data to initialize locus info with. It may be from a join or GET /loci response or from a Mercury event that triggers a creation of meeting object
|
|
311
351
|
* @returns {undefined}
|
|
312
352
|
* @memberof LocusInfo
|
|
313
353
|
*/
|
|
314
354
|
}, {
|
|
315
355
|
key: "initialSetup",
|
|
316
|
-
value: function
|
|
317
|
-
|
|
318
|
-
|
|
356
|
+
value: (function () {
|
|
357
|
+
var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(data) {
|
|
358
|
+
var _data$locus, _data$locus$links, _data$locus$links$res, _data$locus$links$res2;
|
|
359
|
+
var _data$hashTreeMessage, _selfObject$data, selfObject, _data$locus2, _data$locus2$self, _t;
|
|
360
|
+
return _regenerator.default.wrap(function (_context) {
|
|
361
|
+
while (1) switch (_context.prev = _context.next) {
|
|
362
|
+
case 0:
|
|
363
|
+
_t = data.trigger;
|
|
364
|
+
_context.next = _t === 'locus-message' ? 1 : _t === 'join-response' ? 6 : _t === 'get-loci-response' ? 7 : 10;
|
|
365
|
+
break;
|
|
366
|
+
case 1:
|
|
367
|
+
if (!data.hashTreeMessage) {
|
|
368
|
+
_context.next = 4;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
// we need the SELF object to be in the received message, because it contains visibleDataSets
|
|
372
|
+
// and these are needed to initialize all the hash trees
|
|
373
|
+
selfObject = (_data$hashTreeMessage = data.hashTreeMessage.locusStateElements) === null || _data$hashTreeMessage === void 0 ? void 0 : _data$hashTreeMessage.find(function (el) {
|
|
374
|
+
return (0, _hashTreeParser.isSelf)(el);
|
|
375
|
+
});
|
|
376
|
+
if (selfObject !== null && selfObject !== void 0 && (_selfObject$data = selfObject.data) !== null && _selfObject$data !== void 0 && _selfObject$data.visibleDataSets) {
|
|
377
|
+
_context.next = 2;
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
_loggerProxy.default.logger.warn("Locus-info:index#initialSetup --> cannot initialize HashTreeParser, SELF object with visibleDataSets is missing in the message");
|
|
381
|
+
throw new Error('SELF object with visibleDataSets is missing in the message');
|
|
382
|
+
case 2:
|
|
383
|
+
_loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from message');
|
|
384
|
+
// first create the HashTreeParser, but don't initialize it with any data yet
|
|
385
|
+
// pass just a fake locus that contains only the visibleDataSets
|
|
386
|
+
this.hashTreeParser = this.createHashTreeParser({
|
|
387
|
+
initialLocus: {
|
|
388
|
+
locus: {
|
|
389
|
+
self: {
|
|
390
|
+
visibleDataSets: selfObject.data.visibleDataSets
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
dataSets: [] // empty, because they will be populated in initializeFromMessage() call // dataSets: data.hashTreeMessage.dataSets,
|
|
394
|
+
}
|
|
395
|
+
});
|
|
319
396
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
397
|
+
// now handle the message - that should populate all the visible datasets
|
|
398
|
+
_context.next = 3;
|
|
399
|
+
return this.hashTreeParser.initializeFromMessage(data.hashTreeMessage);
|
|
400
|
+
case 3:
|
|
401
|
+
_context.next = 5;
|
|
402
|
+
break;
|
|
403
|
+
case 4:
|
|
404
|
+
// "classic" Locus case, no hash trees involved
|
|
405
|
+
this.updateLocusCache(data.locus);
|
|
406
|
+
this.onFullLocus(data.locus, undefined);
|
|
407
|
+
case 5:
|
|
408
|
+
return _context.abrupt("continue", 10);
|
|
409
|
+
case 6:
|
|
410
|
+
this.updateLocusCache(data.locus);
|
|
411
|
+
this.onFullLocus(data.locus, undefined, data.dataSets);
|
|
412
|
+
return _context.abrupt("continue", 10);
|
|
413
|
+
case 7:
|
|
414
|
+
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)) {
|
|
415
|
+
_context.next = 9;
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
_loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from get-loci-response');
|
|
419
|
+
// first create the HashTreeParser, but don't initialize it with any data yet
|
|
420
|
+
// pass just a fake locus that contains only the visibleDataSets
|
|
421
|
+
this.hashTreeParser = this.createHashTreeParser({
|
|
422
|
+
initialLocus: {
|
|
423
|
+
locus: {
|
|
424
|
+
self: {
|
|
425
|
+
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
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
dataSets: [] // empty, because we don't have them yet
|
|
429
|
+
}
|
|
430
|
+
});
|
|
323
431
|
|
|
432
|
+
// now initialize all the data
|
|
433
|
+
_context.next = 8;
|
|
434
|
+
return this.hashTreeParser.initializeFromGetLociResponse(data.locus);
|
|
435
|
+
case 8:
|
|
436
|
+
_context.next = 10;
|
|
437
|
+
break;
|
|
438
|
+
case 9:
|
|
439
|
+
// "classic" Locus case, no hash trees involved
|
|
440
|
+
this.updateLocusCache(data.locus);
|
|
441
|
+
this.onFullLocus(data.locus, undefined);
|
|
442
|
+
case 10:
|
|
443
|
+
// Change it to true after it receives it first locus object
|
|
444
|
+
this.emitChange = true;
|
|
445
|
+
case 11:
|
|
446
|
+
case "end":
|
|
447
|
+
return _context.stop();
|
|
448
|
+
}
|
|
449
|
+
}, _callee, this);
|
|
450
|
+
}));
|
|
451
|
+
function initialSetup(_x) {
|
|
452
|
+
return _initialSetup.apply(this, arguments);
|
|
453
|
+
}
|
|
454
|
+
return initialSetup;
|
|
455
|
+
}()
|
|
324
456
|
/**
|
|
325
457
|
* Handles HTTP response from Locus API call.
|
|
326
458
|
* @param {Meeting} meeting meeting object
|
|
327
459
|
* @param {LocusApiResponseBody} responseBody body of the http response from Locus API call
|
|
328
460
|
* @returns {void}
|
|
329
461
|
*/
|
|
462
|
+
)
|
|
330
463
|
}, {
|
|
331
464
|
key: "handleLocusAPIResponse",
|
|
332
465
|
value: function handleLocusAPIResponse(meeting, responseBody) {
|
|
333
|
-
this.
|
|
466
|
+
if (this.hashTreeParser) {
|
|
467
|
+
if (!responseBody.dataSets) {
|
|
468
|
+
this.sendClassicVsHashTreeMismatchMetric(meeting, "expected hash tree dataSets in API response but they are missing");
|
|
469
|
+
// continuing as we can still manage without responseBody.dataSets, but this is very suspicious
|
|
470
|
+
}
|
|
471
|
+
_loggerProxy.default.logger.info('Locus-info:index#handleLocusAPIResponse --> passing Locus API response to HashTreeParser: ', responseBody);
|
|
472
|
+
// update the data in our hash trees
|
|
473
|
+
this.hashTreeParser.handleLocusUpdate(responseBody);
|
|
474
|
+
} else {
|
|
475
|
+
if (responseBody.dataSets) {
|
|
476
|
+
this.sendClassicVsHashTreeMismatchMetric(meeting, "unexpected hash tree dataSets in API response");
|
|
477
|
+
}
|
|
478
|
+
// classic Locus delta
|
|
479
|
+
this.handleLocusDelta(responseBody.locus, meeting);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
*
|
|
485
|
+
* @param {HashTreeObject} object data set object
|
|
486
|
+
* @param {any} locus
|
|
487
|
+
* @returns {void}
|
|
488
|
+
*/
|
|
489
|
+
}, {
|
|
490
|
+
key: "updateLocusFromHashTreeObject",
|
|
491
|
+
value: function updateLocusFromHashTreeObject(object, locus) {
|
|
492
|
+
var _this4 = this;
|
|
493
|
+
var type = object.htMeta.elementId.type.toLowerCase();
|
|
494
|
+
var addParticipantObject = function addParticipantObject(obj) {
|
|
495
|
+
if (!locus.participants) {
|
|
496
|
+
locus.participants = [];
|
|
497
|
+
}
|
|
498
|
+
locus.participants.push(obj.data);
|
|
499
|
+
_this4.hashTreeObjectId2ParticipantId.set(obj.htMeta.elementId.id, obj.data.id);
|
|
500
|
+
};
|
|
501
|
+
switch (type) {
|
|
502
|
+
case _types.ObjectType.locus:
|
|
503
|
+
{
|
|
504
|
+
if (!object.data) {
|
|
505
|
+
// not doing anything here, as we need Locus to always be there (at least some fields)
|
|
506
|
+
// and that's already taken care of in updateFromHashTree()
|
|
507
|
+
_loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> LOCUS object removed, version=".concat(object.htMeta.elementId.version));
|
|
508
|
+
return locus;
|
|
509
|
+
}
|
|
510
|
+
// replace the main locus
|
|
511
|
+
|
|
512
|
+
// The Locus object we receive from backend has empty participants array,
|
|
513
|
+
// and may have (although it shouldn't) other fields that are managed by other ObjectTypes
|
|
514
|
+
// like "fullState" or "info", so we're making sure to delete them here
|
|
515
|
+
var locusObjectFromData = object.data;
|
|
516
|
+
(0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
|
|
517
|
+
delete locusObjectFromData[locusDtoKey];
|
|
518
|
+
});
|
|
519
|
+
locus = _objectSpread(_objectSpread({}, locus), locusObjectFromData);
|
|
520
|
+
_loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> LOCUS object updated to version=".concat(object.htMeta.elementId.version));
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
case _types.ObjectType.mediaShare:
|
|
524
|
+
if (object.data) {
|
|
525
|
+
var _object$data$floor, _object$data$floor2, _object$data$floor2$b, _locus$mediaShares;
|
|
526
|
+
_loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> mediaShare id=".concat(object.htMeta.elementId.id, " name='").concat(object.data.name, "' updated ").concat(object.data.name === 'content' ? "floor=".concat((_object$data$floor = object.data.floor) === null || _object$data$floor === void 0 ? void 0 : _object$data$floor.disposition, ", ").concat((_object$data$floor2 = object.data.floor) === null || _object$data$floor2 === void 0 ? void 0 : (_object$data$floor2$b = _object$data$floor2.beneficiary) === null || _object$data$floor2$b === void 0 ? void 0 : _object$data$floor2$b.id) : '', " version=").concat(object.htMeta.elementId.version));
|
|
527
|
+
var existingMediaShare = (_locus$mediaShares = locus.mediaShares) === null || _locus$mediaShares === void 0 ? void 0 : _locus$mediaShares.find(function (ms) {
|
|
528
|
+
return ms.htMeta.elementId.id === object.htMeta.elementId.id;
|
|
529
|
+
});
|
|
530
|
+
if (existingMediaShare) {
|
|
531
|
+
(0, _assign.default)(existingMediaShare, object.data);
|
|
532
|
+
} else {
|
|
533
|
+
locus.mediaShares = locus.mediaShares || [];
|
|
534
|
+
locus.mediaShares.push(object.data);
|
|
535
|
+
}
|
|
536
|
+
} else {
|
|
537
|
+
var _locus$mediaShares2;
|
|
538
|
+
_loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> mediaShare id=".concat(object.htMeta.elementId.id, " removed, version=").concat(object.htMeta.elementId.version));
|
|
539
|
+
locus.mediaShares = (_locus$mediaShares2 = locus.mediaShares) === null || _locus$mediaShares2 === void 0 ? void 0 : _locus$mediaShares2.filter(function (ms) {
|
|
540
|
+
return ms.htMeta.elementId.id !== object.htMeta.elementId.id;
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
break;
|
|
544
|
+
case _types.ObjectType.participant:
|
|
545
|
+
_loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> participant id=".concat(object.htMeta.elementId.id, " ").concat(object.data ? 'updated' : 'removed', " version=").concat(object.htMeta.elementId.version));
|
|
546
|
+
if (object.data) {
|
|
547
|
+
addParticipantObject(object);
|
|
548
|
+
} else {
|
|
549
|
+
var participantId = this.hashTreeObjectId2ParticipantId.get(object.htMeta.elementId.id);
|
|
550
|
+
if (!locus.jsSdkMeta) {
|
|
551
|
+
locus.jsSdkMeta = {
|
|
552
|
+
removedParticipantIds: []
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
locus.jsSdkMeta.removedParticipantIds.push(participantId);
|
|
556
|
+
this.hashTreeObjectId2ParticipantId.delete(object.htMeta.elementId.id);
|
|
557
|
+
}
|
|
558
|
+
break;
|
|
559
|
+
case _types.ObjectType.links:
|
|
560
|
+
case _types.ObjectType.info:
|
|
561
|
+
case _types.ObjectType.fullState:
|
|
562
|
+
case _types.ObjectType.self:
|
|
563
|
+
if (!object.data) {
|
|
564
|
+
// self without data is handled inside HashTreeParser and results in LocusInfoUpdateType.MEETING_ENDED, so we should never get here
|
|
565
|
+
// all other types info, fullstate, etc - Locus should never send them without data
|
|
566
|
+
_loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received ".concat(type, " object without data, this is not expected! version=").concat(object.htMeta.elementId.version));
|
|
567
|
+
} else {
|
|
568
|
+
var _locus$info, _object$data$controls, _object$data$controls2, _object$data$controls3;
|
|
569
|
+
_loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> ".concat(type, " object updated to version ").concat(object.htMeta.elementId.version));
|
|
570
|
+
var locusDtoKey = _types.ObjectTypeToLocusKeyMap[type];
|
|
571
|
+
locus[locusDtoKey] = object.data;
|
|
572
|
+
|
|
573
|
+
/* Hash tree based webinar attendees don't receive a Participant object for themselves from Locus,
|
|
574
|
+
but a lot of existing code in SDK and web app expects a member object for self to exist,
|
|
575
|
+
so whenever SELF changes for a webinar attendee, we copy it into a participant object.
|
|
576
|
+
We can do it, because SELF has always all the same properties as a participant object.
|
|
577
|
+
*/
|
|
578
|
+
if (type === _types.ObjectType.self && (_locus$info = locus.info) !== null && _locus$info !== void 0 && _locus$info.isWebinar && (_object$data$controls = object.data.controls) !== null && _object$data$controls !== void 0 && (_object$data$controls2 = _object$data$controls.role) !== null && _object$data$controls2 !== void 0 && (_object$data$controls3 = _object$data$controls2.roles) !== null && _object$data$controls3 !== void 0 && _object$data$controls3.find(function (r) {
|
|
579
|
+
return r.type === _constants.SELF_ROLES.ATTENDEE && r.hasRole;
|
|
580
|
+
})) {
|
|
581
|
+
_loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> webinar attendee: creating participant object from self");
|
|
582
|
+
addParticipantObject(object);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
break;
|
|
586
|
+
default:
|
|
587
|
+
_loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received unsupported object type ".concat(type));
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
return locus;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Sends a metric when we receive something from Locus that uses hash trees while we
|
|
595
|
+
* expect classic deltas or the other way around.
|
|
596
|
+
* @param {Meeting} meeting
|
|
597
|
+
* @param {string} message
|
|
598
|
+
* @returns {void}
|
|
599
|
+
*/
|
|
600
|
+
}, {
|
|
601
|
+
key: "sendClassicVsHashTreeMismatchMetric",
|
|
602
|
+
value: function sendClassicVsHashTreeMismatchMetric(meeting, message) {
|
|
603
|
+
_loggerProxy.default.logger.warn("Locus-info:index#sendClassicVsHashTreeMismatchMetric --> classic vs hash tree mismatch! ".concat(message));
|
|
604
|
+
|
|
605
|
+
// we don't want to flood the metrics system
|
|
606
|
+
if (this.classicVsHashTreeMismatchMetricCounter < 5) {
|
|
607
|
+
_metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_CLASSIC_VS_HASH_TREE_MISMATCH, {
|
|
608
|
+
correlationId: meeting.correlationId,
|
|
609
|
+
message: message
|
|
610
|
+
});
|
|
611
|
+
this.classicVsHashTreeMismatchMetricCounter += 1;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Handles a hash tree message received from Locus.
|
|
617
|
+
*
|
|
618
|
+
* @param {Meeting} meeting - The meeting object
|
|
619
|
+
* @param {eventType} eventType - The event type
|
|
620
|
+
* @param {HashTreeMessage} message incoming hash tree message
|
|
621
|
+
* @returns {void}
|
|
622
|
+
*/
|
|
623
|
+
}, {
|
|
624
|
+
key: "handleHashTreeMessage",
|
|
625
|
+
value: function handleHashTreeMessage(meeting, eventType, message) {
|
|
626
|
+
if (eventType !== _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
|
|
627
|
+
this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected ").concat(_constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED));
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
this.hashTreeParser.handleMessage(message);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Callback registered with HashTreeParser to receive locus info updates.
|
|
635
|
+
* Updates our locus info based on the data parsed by the hash tree parser.
|
|
636
|
+
*
|
|
637
|
+
* @param {LocusInfoUpdateType} updateType - The type of update received.
|
|
638
|
+
* @param {Object} [data] - Additional data for the update, if applicable.
|
|
639
|
+
* @returns {void}
|
|
640
|
+
*/
|
|
641
|
+
}, {
|
|
642
|
+
key: "updateFromHashTree",
|
|
643
|
+
value: function updateFromHashTree(updateType, data) {
|
|
644
|
+
var _this5 = this;
|
|
645
|
+
switch (updateType) {
|
|
646
|
+
case _hashTreeParser.LocusInfoUpdateType.OBJECTS_UPDATED:
|
|
647
|
+
{
|
|
648
|
+
// initialize our new locus
|
|
649
|
+
var locus = {
|
|
650
|
+
participants: [],
|
|
651
|
+
jsSdkMeta: {
|
|
652
|
+
removedParticipantIds: []
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
// first go over all the updates and check what happens with the main locus object
|
|
657
|
+
var locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.unchanged;
|
|
658
|
+
data.updatedObjects.forEach(function (object) {
|
|
659
|
+
if (object.htMeta.elementId.type.toLowerCase() === _types.ObjectType.locus) {
|
|
660
|
+
if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.updated) {
|
|
661
|
+
var _object$data;
|
|
662
|
+
// this code doesn't supported it right now,
|
|
663
|
+
// cases for "updated" followed by "removed", or multiple "updated" would need more handling
|
|
664
|
+
// but these should never happen
|
|
665
|
+
_loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> received multiple LOCUS objects in one update, this is unexpected!");
|
|
666
|
+
_metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_HASH_TREE_UNSUPPORTED_OPERATION, {
|
|
667
|
+
locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this5.url,
|
|
668
|
+
message: object.data ? 'multiple LOCUS object updates' : 'LOCUS object update followed by removal'
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
if (object.data) {
|
|
672
|
+
locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.updated;
|
|
673
|
+
} else {
|
|
674
|
+
locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.removed;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
// if Locus object is unchanged or removed, we need to keep using the existing locus
|
|
680
|
+
// because the rest of the locusInfo code expects locus to always be present (with at least some of the fields)
|
|
681
|
+
// if it gets updated, we only need to have the fields that are not part of "locus" object (like "info" or "mediaShares")
|
|
682
|
+
// so that when Locus object gets updated, if the new one is missing some field, that field will
|
|
683
|
+
// be removed from our locusInfo
|
|
684
|
+
if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.unchanged || locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.removed) {
|
|
685
|
+
// copy over all of existing locus except participants
|
|
686
|
+
LocusDtoTopLevelKeys.forEach(function (key) {
|
|
687
|
+
if (key !== 'participants') {
|
|
688
|
+
locus[key] = (0, _lodash.cloneDeep)(_this5[key]);
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
} else {
|
|
692
|
+
// initialize only the fields that are not part of main "Locus" object
|
|
693
|
+
// (except participants, which need to stay empty - that means "no participant changes")
|
|
694
|
+
(0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
|
|
695
|
+
if (locusDtoKey !== 'participants') {
|
|
696
|
+
locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this5[locusDtoKey]);
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
_loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> LOCUS object is ".concat(locusObjectStateAfterUpdates, ", all updates: ").concat((0, _stringify.default)(data.updatedObjects.map(function (o) {
|
|
701
|
+
return {
|
|
702
|
+
type: o.htMeta.elementId.type,
|
|
703
|
+
id: o.htMeta.elementId.id,
|
|
704
|
+
hasData: !!o.data
|
|
705
|
+
};
|
|
706
|
+
}))));
|
|
707
|
+
// now apply all the updates from the hash tree onto the locus
|
|
708
|
+
data.updatedObjects.forEach(function (object) {
|
|
709
|
+
locus = _this5.updateLocusFromHashTreeObject(object, locus);
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
// update our locus info with the new locus
|
|
713
|
+
this.onDeltaLocus(locus);
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
case _hashTreeParser.LocusInfoUpdateType.MEETING_ENDED:
|
|
717
|
+
{
|
|
718
|
+
_loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received signal that meeting ended, destroying meeting ".concat(this.meetingId));
|
|
719
|
+
var meeting = this.webex.meetings.meetingCollection.get(this.meetingId);
|
|
720
|
+
this.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.SELF_REMOVED);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
334
723
|
}
|
|
335
724
|
|
|
336
725
|
/**
|
|
@@ -342,37 +731,44 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
342
731
|
}, {
|
|
343
732
|
key: "parse",
|
|
344
733
|
value: function parse(meeting, data) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
734
|
+
if (this.hashTreeParser) {
|
|
735
|
+
this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
|
|
736
|
+
} else {
|
|
737
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
738
|
+
var eventType = data.eventType;
|
|
739
|
+
var locus = this.getTheLocusToUpdate(data.locus);
|
|
740
|
+
_loggerProxy.default.logger.info("Locus-info:index#parse --> received locus data: ".concat(eventType));
|
|
741
|
+
locus.jsSdkMeta = {
|
|
742
|
+
removedParticipantIds: []
|
|
743
|
+
};
|
|
744
|
+
switch (eventType) {
|
|
745
|
+
case _constants.LOCUSEVENT.PARTICIPANT_JOIN:
|
|
746
|
+
case _constants.LOCUSEVENT.PARTICIPANT_LEFT:
|
|
747
|
+
case _constants.LOCUSEVENT.CONTROLS_UPDATED:
|
|
748
|
+
case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_MUTED:
|
|
749
|
+
case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_UNMUTED:
|
|
750
|
+
case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_MUTED:
|
|
751
|
+
case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_UNMUTED:
|
|
752
|
+
case _constants.LOCUSEVENT.SELF_CHANGED:
|
|
753
|
+
case _constants.LOCUSEVENT.PARTICIPANT_UPDATED:
|
|
754
|
+
case _constants.LOCUSEVENT.PARTICIPANT_CONTROLS_UPDATED:
|
|
755
|
+
case _constants.LOCUSEVENT.PARTICIPANT_ROLES_UPDATED:
|
|
756
|
+
case _constants.LOCUSEVENT.PARTICIPANT_DECLINED:
|
|
757
|
+
case _constants.LOCUSEVENT.FLOOR_GRANTED:
|
|
758
|
+
case _constants.LOCUSEVENT.FLOOR_RELEASED:
|
|
759
|
+
this.onFullLocus(locus, eventType);
|
|
760
|
+
break;
|
|
761
|
+
case _constants.LOCUSEVENT.DIFFERENCE:
|
|
762
|
+
this.handleLocusDelta(locus, meeting);
|
|
763
|
+
break;
|
|
764
|
+
case _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED:
|
|
765
|
+
this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected classic events"));
|
|
766
|
+
break;
|
|
767
|
+
default:
|
|
768
|
+
// Why will there be a event with no eventType ????
|
|
769
|
+
// we may not need this, we can get full locus
|
|
770
|
+
this.handleLocusDelta(locus, meeting);
|
|
771
|
+
}
|
|
376
772
|
}
|
|
377
773
|
}
|
|
378
774
|
|
|
@@ -389,26 +785,99 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
389
785
|
return this.emit(scope, eventName, args);
|
|
390
786
|
}
|
|
391
787
|
|
|
788
|
+
/**
|
|
789
|
+
* Function for handling full locus when it's using hash trees (so not the "classic" one).
|
|
790
|
+
*
|
|
791
|
+
* @param {object} locus locus object
|
|
792
|
+
* @param {string} eventType locus event
|
|
793
|
+
* @param {DataSet[]} dataSets
|
|
794
|
+
* @returns {void}
|
|
795
|
+
*/
|
|
796
|
+
}, {
|
|
797
|
+
key: "onFullLocusWithHashTrees",
|
|
798
|
+
value: function onFullLocusWithHashTrees(locus, eventType, dataSets) {
|
|
799
|
+
if (!this.hashTreeParser) {
|
|
800
|
+
_loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> creating hash tree parser");
|
|
801
|
+
_loggerProxy.default.logger.info('Locus-info:index#onFullLocus --> dataSets:', dataSets, ' and locus:', locus);
|
|
802
|
+
this.hashTreeParser = this.createHashTreeParser({
|
|
803
|
+
initialLocus: {
|
|
804
|
+
locus: locus,
|
|
805
|
+
dataSets: dataSets
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
this.onFullLocusCommon(locus, eventType);
|
|
809
|
+
} else {
|
|
810
|
+
// in this case the Locus we're getting is not necessarily the full one
|
|
811
|
+
// so treat it like if we just got it in any api response
|
|
812
|
+
|
|
813
|
+
_loggerProxy.default.logger.info('Locus-info:index#onFullLocus --> hash tree parser already exists, handling it like a normal API response');
|
|
814
|
+
this.handleLocusAPIResponse(undefined, {
|
|
815
|
+
dataSets: dataSets,
|
|
816
|
+
locus: locus
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Function for handling full locus when it's the "classic" one (not hash trees)
|
|
823
|
+
*
|
|
824
|
+
* @param {object} locus locus object
|
|
825
|
+
* @param {string} eventType locus event
|
|
826
|
+
* @returns {void}
|
|
827
|
+
*/
|
|
828
|
+
}, {
|
|
829
|
+
key: "onFullLocusClassic",
|
|
830
|
+
value: function onFullLocusClassic(locus, eventType) {
|
|
831
|
+
if (!this.locusParser.isNewFullLocus(locus)) {
|
|
832
|
+
_loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=".concat(eventType));
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
this.onFullLocusCommon(locus, eventType);
|
|
836
|
+
}
|
|
837
|
+
|
|
392
838
|
/**
|
|
393
839
|
* updates the locus with full locus object
|
|
394
840
|
* @param {object} locus locus object
|
|
395
|
-
* @param {string} eventType
|
|
841
|
+
* @param {string} eventType locus event
|
|
842
|
+
* @param {DataSet[]} dataSets
|
|
396
843
|
* @returns {object} null
|
|
397
844
|
* @memberof LocusInfo
|
|
398
845
|
*/
|
|
399
846
|
}, {
|
|
400
847
|
key: "onFullLocus",
|
|
401
|
-
value: function onFullLocus(locus, eventType) {
|
|
402
|
-
var _locus$jsSdkMeta;
|
|
848
|
+
value: function onFullLocus(locus, eventType, dataSets) {
|
|
403
849
|
if (!locus) {
|
|
404
850
|
_loggerProxy.default.logger.error('Locus-info:index#onFullLocus --> object passed as argument was invalid, continuing.');
|
|
405
851
|
}
|
|
406
|
-
if (
|
|
407
|
-
|
|
408
|
-
|
|
852
|
+
if (dataSets) {
|
|
853
|
+
// this is the new hashmap Locus DTO format (only applicable to webinars for now)
|
|
854
|
+
this.onFullLocusWithHashTrees(locus, eventType, dataSets);
|
|
855
|
+
} else {
|
|
856
|
+
this.onFullLocusClassic(locus, eventType);
|
|
409
857
|
}
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* Common part of handling full locus, used by both classic and hash tree based locus handling
|
|
862
|
+
* @param {object} locus locus object
|
|
863
|
+
* @param {string} eventType locus event
|
|
864
|
+
* @returns {void}
|
|
865
|
+
*/
|
|
866
|
+
}, {
|
|
867
|
+
key: "onFullLocusCommon",
|
|
868
|
+
value: function onFullLocusCommon(locus, eventType) {
|
|
869
|
+
var _this$participants,
|
|
870
|
+
_this6 = this,
|
|
871
|
+
_locus$jsSdkMeta;
|
|
410
872
|
this.scheduledMeeting = locus.meeting || null;
|
|
411
873
|
this.participants = locus.participants;
|
|
874
|
+
(_this$participants = this.participants) === null || _this$participants === void 0 ? void 0 : _this$participants.forEach(function (participant) {
|
|
875
|
+
var _participant$htMeta;
|
|
876
|
+
// participant.htMeta is set only for hash tree based locus
|
|
877
|
+
if ((_participant$htMeta = participant.htMeta) !== null && _participant$htMeta !== void 0 && _participant$htMeta.elementId.id) {
|
|
878
|
+
_this6.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
|
|
879
|
+
}
|
|
880
|
+
});
|
|
412
881
|
var isReplaceMembers = _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
|
|
413
882
|
this.updateLocusInfo(locus);
|
|
414
883
|
this.updateParticipants(locus.participants, (_locus$jsSdkMeta = locus.jsSdkMeta) === null || _locus$jsSdkMeta === void 0 ? void 0 : _locus$jsSdkMeta.removedParticipantIds, isReplaceMembers);
|
|
@@ -479,7 +948,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
479
948
|
}, {
|
|
480
949
|
key: "updateLocusInfo",
|
|
481
950
|
value: function updateLocusInfo(locus) {
|
|
482
|
-
var _locus$self, _locus$self2
|
|
951
|
+
var _locus$self, _locus$self2;
|
|
483
952
|
if (((_locus$self = locus.self) === null || _locus$self === void 0 ? void 0 : _locus$self.reason) === 'MOVED' && ((_locus$self2 = locus.self) === null || _locus$self2 === void 0 ? void 0 : _locus$self2.state) === 'LEFT') {
|
|
484
953
|
// When moved to a breakout session locus sends a message for the previous locus
|
|
485
954
|
// indicating that we have been moved. It isn't helpful to continue parsing this
|
|
@@ -494,17 +963,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
494
963
|
this.updateLocusUrl(locus.url, _controlsUtils.default.isMainSessionDTO(locus));
|
|
495
964
|
this.updateMeetingInfo(locus.info, locus.self);
|
|
496
965
|
this.updateMediaShares(locus.mediaShares);
|
|
497
|
-
this.
|
|
498
|
-
this.updateReplace(locus.replace);
|
|
966
|
+
this.updateReplaces(locus.replaces);
|
|
499
967
|
this.updateSelf(locus.self);
|
|
500
968
|
this.updateAclUrl(locus.aclUrl);
|
|
501
969
|
this.updateBasequence(locus.baseSequence);
|
|
502
970
|
this.updateSequence(locus.sequence);
|
|
503
|
-
this.updateMemberShip(locus.membership);
|
|
504
|
-
this.updateIdentifiers(locus.identities);
|
|
505
971
|
this.updateEmbeddedApps(locus.embeddedApps);
|
|
506
|
-
this.
|
|
507
|
-
this.updateResources((_locus$links4 = locus.links) === null || _locus$links4 === void 0 ? void 0 : _locus$links4.resources);
|
|
972
|
+
this.updateLinks(locus.links);
|
|
508
973
|
this.compareAndUpdate();
|
|
509
974
|
// update which required to compare different objects from locus
|
|
510
975
|
}
|
|
@@ -1053,41 +1518,35 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
1053
1518
|
}
|
|
1054
1519
|
|
|
1055
1520
|
/**
|
|
1056
|
-
*
|
|
1521
|
+
* Updates links and emits appropriate events if services or resources have changed
|
|
1522
|
+
* @param {Object} links
|
|
1057
1523
|
* @returns {undefined}
|
|
1058
1524
|
* @memberof LocusInfo
|
|
1059
1525
|
*/
|
|
1060
1526
|
}, {
|
|
1061
|
-
key: "
|
|
1062
|
-
value: function
|
|
1063
|
-
|
|
1064
|
-
|
|
1527
|
+
key: "updateLinks",
|
|
1528
|
+
value: function updateLinks(links) {
|
|
1529
|
+
var _this$links, _this$links2;
|
|
1530
|
+
var _ref2 = links || {},
|
|
1531
|
+
services = _ref2.services,
|
|
1532
|
+
resources = _ref2.resources;
|
|
1533
|
+
if (services && !(0, _lodash.isEqual)((_this$links = this.links) === null || _this$links === void 0 ? void 0 : _this$links.services, services)) {
|
|
1065
1534
|
this.emitScoped({
|
|
1066
1535
|
file: 'locus-info',
|
|
1067
|
-
function: '
|
|
1536
|
+
function: 'updateLinks'
|
|
1068
1537
|
}, _constants.LOCUSINFO.EVENTS.LINKS_SERVICES, {
|
|
1069
1538
|
services: services
|
|
1070
1539
|
});
|
|
1071
1540
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
/**
|
|
1075
|
-
* @param {Object} resources
|
|
1076
|
-
* @returns {undefined}
|
|
1077
|
-
* @memberof LocusInfo
|
|
1078
|
-
*/
|
|
1079
|
-
}, {
|
|
1080
|
-
key: "updateResources",
|
|
1081
|
-
value: function updateResources(resources) {
|
|
1082
|
-
if (resources && !(0, _lodash.isEqual)(this.resources, resources)) {
|
|
1083
|
-
this.resources = resources;
|
|
1541
|
+
if (resources && !(0, _lodash.isEqual)((_this$links2 = this.links) === null || _this$links2 === void 0 ? void 0 : _this$links2.resources, resources)) {
|
|
1084
1542
|
this.emitScoped({
|
|
1085
1543
|
file: 'locus-info',
|
|
1086
|
-
function: '
|
|
1544
|
+
function: 'updateLinks'
|
|
1087
1545
|
}, _constants.LOCUSINFO.EVENTS.LINKS_RESOURCES, {
|
|
1088
1546
|
resources: resources
|
|
1089
1547
|
});
|
|
1090
1548
|
}
|
|
1549
|
+
this.links = links;
|
|
1091
1550
|
}
|
|
1092
1551
|
|
|
1093
1552
|
/**
|
|
@@ -1245,28 +1704,15 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
1245
1704
|
}
|
|
1246
1705
|
|
|
1247
1706
|
/**
|
|
1248
|
-
* @param {
|
|
1707
|
+
* @param {Object} replaces
|
|
1249
1708
|
* @returns {undefined}
|
|
1250
1709
|
* @memberof LocusInfo
|
|
1251
1710
|
*/
|
|
1252
1711
|
}, {
|
|
1253
|
-
key: "
|
|
1254
|
-
value: function
|
|
1255
|
-
if (
|
|
1256
|
-
this.
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
/**
|
|
1261
|
-
* @param {Object} replace
|
|
1262
|
-
* @returns {undefined}
|
|
1263
|
-
* @memberof LocusInfo
|
|
1264
|
-
*/
|
|
1265
|
-
}, {
|
|
1266
|
-
key: "updateReplace",
|
|
1267
|
-
value: function updateReplace(replace) {
|
|
1268
|
-
if (replace && !(0, _lodash.isEqual)(this.replace, replace)) {
|
|
1269
|
-
this.replace = replace;
|
|
1712
|
+
key: "updateReplaces",
|
|
1713
|
+
value: function updateReplaces(replaces) {
|
|
1714
|
+
if (replaces && !(0, _lodash.isEqual)(this.replaces, replaces)) {
|
|
1715
|
+
this.replaces = replaces;
|
|
1270
1716
|
}
|
|
1271
1717
|
}
|
|
1272
1718
|
|
|
@@ -1525,32 +1971,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
1525
1971
|
}
|
|
1526
1972
|
}
|
|
1527
1973
|
|
|
1528
|
-
/**
|
|
1529
|
-
* @param {Object} membership
|
|
1530
|
-
* @returns {undefined}
|
|
1531
|
-
* @memberof LocusInfo
|
|
1532
|
-
*/
|
|
1533
|
-
}, {
|
|
1534
|
-
key: "updateMemberShip",
|
|
1535
|
-
value: function updateMemberShip(membership) {
|
|
1536
|
-
if (membership && !(0, _lodash.isEqual)(this.membership, membership)) {
|
|
1537
|
-
this.membership = membership;
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
/**
|
|
1542
|
-
* @param {Array} identities
|
|
1543
|
-
* @returns {undefined}
|
|
1544
|
-
* @memberof LocusInfo
|
|
1545
|
-
*/
|
|
1546
|
-
}, {
|
|
1547
|
-
key: "updateIdentifiers",
|
|
1548
|
-
value: function updateIdentifiers(identities) {
|
|
1549
|
-
if (identities && !(0, _lodash.isEqual)(this.identities, identities)) {
|
|
1550
|
-
this.identities = identities;
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
1974
|
/**
|
|
1555
1975
|
* check the locus is main session's one or not, if is main session's, update main session cache
|
|
1556
1976
|
* @param {Object} locus
|
|
@@ -1628,7 +2048,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
1628
2048
|
}, {
|
|
1629
2049
|
key: "updateMainSessionLocusCache",
|
|
1630
2050
|
value: function updateMainSessionLocusCache(mainLocus) {
|
|
1631
|
-
var
|
|
2051
|
+
var _this7 = this;
|
|
1632
2052
|
if (!mainLocus) {
|
|
1633
2053
|
return;
|
|
1634
2054
|
}
|
|
@@ -1637,7 +2057,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
|
1637
2057
|
// shallow merge and do special merge for participants
|
|
1638
2058
|
(0, _lodash.assignWith)(this.mainSessionLocusCache, locusClone, function (objValue, srcValue, key) {
|
|
1639
2059
|
if (key === 'participants') {
|
|
1640
|
-
return
|
|
2060
|
+
return _this7.mergeParticipants(objValue, srcValue);
|
|
1641
2061
|
}
|
|
1642
2062
|
return srcValue || objValue;
|
|
1643
2063
|
});
|