@webex/plugin-meetings 3.10.0-webex-services-ready.2 → 3.10.0-webex-services-ready.3

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.
@@ -209,7 +209,7 @@ var Breakout = _webexCore.WebexPlugin.extend({
209
209
  sessionId: this.sessionId
210
210
  });
211
211
  },
212
- version: "3.10.0-webex-services-ready.2"
212
+ version: "3.10.0-webex-services-ready.3"
213
213
  });
214
214
  var _default = exports.default = Breakout;
215
215
  //# sourceMappingURL=breakout.js.map
@@ -1109,7 +1109,7 @@ var Breakouts = _webexCore.WebexPlugin.extend({
1109
1109
  this.trigger(_constants.BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
1110
1110
  }
1111
1111
  },
1112
- version: "3.10.0-webex-services-ready.2"
1112
+ version: "3.10.0-webex-services-ready.3"
1113
1113
  });
1114
1114
  var _default = exports.default = Breakouts;
1115
1115
  //# sourceMappingURL=index.js.map
@@ -17,7 +17,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2
17
17
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
18
18
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
19
19
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
20
- var _xxh3Ts = require("xxh3-ts");
20
+ var _xxh = require("xxh3-ts/xxh3");
21
21
  var _constants = require("./constants");
22
22
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && r[_Symbol$iterator] || r["@@iterator"]; if (!t) { if (_Array$isArray(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; } } }; }
23
23
  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; } }
@@ -298,7 +298,7 @@ var HashTree = /*#__PURE__*/function () {
298
298
  offset += 16;
299
299
  });
300
300
  });
301
- this.leafHashes[index] = (0, _xxh3Ts.XXH3_128)(buffer, BigInt(0)).toString(16).padStart(32, '0');
301
+ this.leafHashes[index] = (0, _xxh.XXH3_128)(buffer, BigInt(0)).toString(16).padStart(32, '0');
302
302
  }
303
303
 
304
304
  /**
@@ -321,7 +321,7 @@ var HashTree = /*#__PURE__*/function () {
321
321
  var leftHash = currentLevelHashes[i];
322
322
  var rightHash = i + 1 < currentLevelHashes.length ? currentLevelHashes[i + 1] : leftHash;
323
323
  var input = Buffer.concat([Buffer.from(leftHash, 'hex').subarray(0, 8).reverse(), Buffer.from(leftHash, 'hex').subarray(8, 16).reverse(), Buffer.from(rightHash, 'hex').subarray(0, 8).reverse(), Buffer.from(rightHash, 'hex').subarray(8, 16).reverse()]);
324
- nextLevelHashes.push((0, _xxh3Ts.XXH3_128)(input, BigInt(0)).toString(16).padStart(32, '0'));
324
+ nextLevelHashes.push((0, _xxh.XXH3_128)(input, BigInt(0)).toString(16).padStart(32, '0'));
325
325
  }
326
326
  currentLevelHashes = nextLevelHashes;
327
327
  allHashes.unshift.apply(allHashes, (0, _toConsumableArray2.default)(currentLevelHashes));
@@ -1 +1 @@
1
- {"version":3,"names":["_xxh3Ts","require","_constants","_createForOfIteratorHelper","r","e","t","_Symbol","_Symbol$iterator","_Array$isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","return","_arrayLikeToArray","toString","slice","constructor","name","_Array$from","test","Array","HashTree","leafData","numLeaves","_classCallCheck2","default","_defineProperty2","Error","concat","leafHashes","fill","EMPTY_HASH","leaves","map","putItems","_createClass2","key","_putItemInternal","item","put","index","id","type","existingItem","version","putItem","_this$_putItemInterna","computeLeafHash","items","_this","results","changedLeafIndexes","_set","forEach","_this$_putItemInterna2","push","add","_removeItemInternal","removed","_keys","removeItem","_this$_removeItemInte","removeItems","_this2","_this2$_removeItemInt","updateItems","itemUpdates","_this3","_ref","operation","_this3$_removeItemInt","_this3$_putItemIntern","leafContent","totalItemsCount","reduce","count","buffer","Buffer","alloc","offset","itemTypes","sort","_values","b","writeBigInt64LE","BigInt","XXH3_128","padStart","computeTreeHashes","currentLevelHashes","_toConsumableArray2","allHashes","nextLevelHashes","i","leftHash","rightHash","input","from","subarray","reverse","unshift","apply","getHashes","getRootHash","getLeafCount","getTotalItemCount","_iterator","_step","leaf","_i","_Object$keys2","err","getLeafData","leafIndex","_i2","_Object$keys3","resize","newNumLeaves","allItems","_iterator2","_step2","_i3","_Object$keys4","diffHashes","externalHashes","differingLeafIndexes","externalLeafHashesStart","ownLeafHash","externalLeafHash","_default","exports"],"sources":["hashTree.ts"],"sourcesContent":["import {XXH3_128} from 'xxh3-ts';\nimport {EMPTY_HASH} from './constants';\nimport {ObjectType} from './types';\n\nexport type LeafDataItem = {\n type: ObjectType;\n id: number;\n version: number;\n};\n\n/**\n * HashTree is a data structure that organizes items into leaves based on their IDs,\n */\nclass HashTree {\n leaves: Array<Record<string, Record<number, LeafDataItem>>>;\n\n leafHashes: Array<string>;\n readonly numLeaves: number;\n\n /**\n * Constructs a new HashTree.\n * @param {LeafDataItem[]} leafData Initial data to populate the tree.\n * @param {number} numLeaves The number of leaf nodes in the tree. Must be 0 or a power of 2.\n * @throws {Error} If numLeaves is not 0 or a power of 2.\n */\n constructor(leafData: LeafDataItem[], numLeaves: number) {\n // eslint-disable-next-line no-bitwise\n if ((numLeaves & (numLeaves - 1)) !== 0) {\n throw new Error(`Number of leaves must be a power of 2, saw ${numLeaves}`);\n }\n\n this.numLeaves = numLeaves;\n this.leafHashes = new Array(numLeaves).fill(EMPTY_HASH);\n\n this.leaves = new Array(numLeaves).fill(null).map(() => {\n return {};\n });\n\n if (leafData) {\n this.putItems(leafData);\n }\n }\n\n /**\n * Internal logic for adding or updating an item, without computing the leaf hash.\n * @param {LeafDataItem} item The item to add or update.\n * @returns {{put: boolean, index: (number|null)}} Object indicating if put and the leaf index.\n * @private\n */\n private _putItemInternal(item: LeafDataItem): {put: boolean; index: number | null} {\n if (this.numLeaves === 0) {\n return {put: false, index: null}; // Cannot add to a tree with 0 leaves\n }\n\n const index = item.id % this.numLeaves;\n\n if (!this.leaves[index][item.type]) {\n this.leaves[index][item.type] = {};\n }\n\n const existingItem = this.leaves[index][item.type][item.id];\n\n if (!existingItem || existingItem.version < item.version) {\n this.leaves[index][item.type][item.id] = item;\n\n return {put: true, index};\n }\n\n return {put: false, index: null};\n }\n\n /**\n * Adds or updates a single item in the hash tree.\n * @param {LeafDataItem} item The item to add or update.\n * @returns {boolean} True if the item was added or updated, false otherwise (e.g., older version or tree has 0 leaves).\n */\n putItem(item: LeafDataItem): boolean {\n const {put, index} = this._putItemInternal(item);\n\n if (put && index !== null) {\n this.computeLeafHash(index);\n }\n\n return put;\n }\n\n /**\n * Adds or updates multiple items in the hash tree.\n * @param {LeafDataItem[]} items The array of items to add or update.\n * @returns {boolean[]} An array of booleans indicating success for each item.\n */\n putItems(items: LeafDataItem[]): boolean[] {\n if (this.numLeaves === 0 && items.length > 0) {\n // Cannot add items to a tree with 0 leaves.\n return items.map(() => false);\n }\n const results: boolean[] = [];\n const changedLeafIndexes = new Set<number>();\n\n items.forEach((item) => {\n const {put, index} = this._putItemInternal(item);\n results.push(put);\n if (put && index !== null) {\n changedLeafIndexes.add(index);\n }\n });\n\n changedLeafIndexes.forEach((index) => {\n this.computeLeafHash(index);\n });\n\n return results;\n }\n\n /**\n * Internal logic for removing an item, without computing the leaf hash.\n * @param {LeafDataItem} item The item to remove.\n * @returns {{removed: boolean, index: (number|null)}} Object indicating if removed and the leaf index.\n * @private\n */\n private _removeItemInternal(item: LeafDataItem): {removed: boolean; index: number | null} {\n if (this.numLeaves === 0) {\n return {removed: false, index: null};\n }\n\n const index = item.id % this.numLeaves;\n\n if (\n this.leaves[index] &&\n this.leaves[index][item.type] &&\n this.leaves[index][item.type][item.id]\n ) {\n const existingItem = this.leaves[index][item.type][item.id];\n if (\n existingItem.id === item.id &&\n existingItem.type === item.type &&\n existingItem.version <= item.version\n ) {\n delete this.leaves[index][item.type][item.id];\n if (Object.keys(this.leaves[index][item.type]).length === 0) {\n delete this.leaves[index][item.type];\n }\n\n return {removed: true, index};\n }\n }\n\n return {removed: false, index: null};\n }\n\n /**\n * Removes a single item from the hash tree.\n * The removal is based on matching type, id, and the provided item's version\n * being greater than or equal to the existing item's version.\n * @param {LeafDataItem} item The item to remove.\n * @returns {boolean} True if the item was removed, false otherwise.\n */\n removeItem(item: LeafDataItem): boolean {\n const {removed, index} = this._removeItemInternal(item);\n\n if (removed && index !== null) {\n this.computeLeafHash(index);\n }\n\n return removed;\n }\n\n /**\n * Removes multiple items from the hash tree.\n * @param {LeafDataItem[]} items The array of items to remove.\n * @returns {boolean[]} An array of booleans indicating success for each item.\n */\n removeItems(items: LeafDataItem[]): boolean[] {\n if (this.numLeaves === 0 && items.length > 0) {\n return items.map(() => false);\n }\n\n const results: boolean[] = [];\n const changedLeafIndexes = new Set<number>();\n\n items.forEach((item) => {\n const {removed, index} = this._removeItemInternal(item);\n results.push(removed);\n if (removed && index !== null) {\n changedLeafIndexes.add(index);\n }\n });\n\n changedLeafIndexes.forEach((index) => {\n this.computeLeafHash(index);\n });\n\n return results;\n }\n\n /**\n * Updates multiple items in the hash tree.\n * This method can handle both updating and removing items based on the `operation` flag.\n *\n * @param {object[]} itemUpdates An array of objects containing `operation` flag and the `item` to update.\n * @returns {boolean[]} An array of booleans indicating success for each operation.\n */\n updateItems(itemUpdates: {operation: 'update' | 'remove'; item: LeafDataItem}[]): boolean[] {\n if (this.numLeaves === 0 && itemUpdates.length > 0) {\n return itemUpdates.map(() => false);\n }\n\n const results: boolean[] = [];\n const changedLeafIndexes = new Set<number>();\n\n itemUpdates.forEach(({operation, item}) => {\n if (operation === 'remove') {\n const {removed, index} = this._removeItemInternal(item);\n results.push(removed);\n if (removed && index !== null) {\n changedLeafIndexes.add(index);\n }\n } else {\n const {put, index} = this._putItemInternal(item);\n results.push(put);\n if (put && index !== null) {\n changedLeafIndexes.add(index);\n }\n }\n });\n\n changedLeafIndexes.forEach((index) => {\n this.computeLeafHash(index);\n });\n\n return results;\n }\n\n /**\n * Computes the hash for a specific leaf.\n * The hash is based on the sorted items within the leaf.\n * @param {number} index The index of the leaf to compute the hash for.\n * @returns {void}\n */\n computeLeafHash(index: number) {\n if (index < 0 || index >= this.numLeaves) {\n // nothing to do\n return;\n }\n const leafContent = this.leaves[index];\n\n const totalItemsCount = Object.keys(leafContent).reduce((count, type) => {\n return count + Object.keys(leafContent[type]).length;\n }, 0);\n const buffer = Buffer.alloc(totalItemsCount * 16);\n\n let offset = 0;\n\n // iterate through the item types lexicographically\n const itemTypes = Object.keys(leafContent).sort();\n itemTypes.forEach((type) => {\n // iterate through the items of this type in ascending order of ID\n const items = Object.values(leafContent[type]).sort(\n (a: LeafDataItem, b: LeafDataItem) => a.id - b.id\n );\n\n // add all the items id and version to the hasher\n items.forEach((item: LeafDataItem) => {\n buffer.writeBigInt64LE(BigInt(item.id), offset);\n buffer.writeBigInt64LE(BigInt(item.version), offset + 8);\n\n offset += 16;\n });\n });\n\n this.leafHashes[index] = XXH3_128(buffer, BigInt(0)).toString(16).padStart(32, '0');\n }\n\n /**\n * Computes all internal and leaf node hashes of the tree.\n * Internal node hashes are computed bottom-up from the leaf hashes.\n * @returns {string[]} An array of hash strings, with internal node hashes first, followed by leaf hashes.\n * Returns `[EMPTY_HASH]` if the tree has 0 leaves.\n */\n computeTreeHashes(): string[] {\n if (this.numLeaves === 0) {\n return [EMPTY_HASH];\n }\n\n let currentLevelHashes = [...this.leafHashes];\n const allHashes = [];\n\n while (currentLevelHashes.length > 1) {\n const nextLevelHashes: string[] = [];\n for (let i = 0; i < currentLevelHashes.length; i += 2) {\n const leftHash = currentLevelHashes[i];\n const rightHash = i + 1 < currentLevelHashes.length ? currentLevelHashes[i + 1] : leftHash;\n\n const input = Buffer.concat([\n Buffer.from(leftHash, 'hex').subarray(0, 8).reverse(),\n Buffer.from(leftHash, 'hex').subarray(8, 16).reverse(),\n Buffer.from(rightHash, 'hex').subarray(0, 8).reverse(),\n Buffer.from(rightHash, 'hex').subarray(8, 16).reverse(),\n ]);\n\n nextLevelHashes.push(XXH3_128(input, BigInt(0)).toString(16).padStart(32, '0'));\n }\n currentLevelHashes = nextLevelHashes;\n allHashes.unshift(...currentLevelHashes);\n }\n\n return [...allHashes, ...this.leafHashes];\n }\n\n /**\n * Returns all hashes in the tree (internal nodes then leaf nodes).\n * @returns {string[]} An array of hash strings.\n */\n getHashes(): string[] {\n return this.computeTreeHashes();\n }\n\n /**\n * Computes and returns the hash value of the root node.\n * @returns {string} The root hash of the entire tree. Returns `EMPTY_HASH` if the tree has 0 leaves.\n */\n getRootHash(): string {\n if (this.numLeaves === 0) {\n return EMPTY_HASH;\n }\n\n return this.computeTreeHashes()[0];\n }\n\n /**\n * Gets the number of leaves in the tree.\n * @returns {number} The number of leaves.\n */\n getLeafCount(): number {\n return this.numLeaves;\n }\n\n /**\n * Calculates the total number of items stored in the tree.\n * @returns {number} The total number of items.\n */\n getTotalItemCount(): number {\n let count = 0;\n for (const leaf of this.leaves) {\n for (const type of Object.keys(leaf)) {\n count += Object.keys(leaf[type]).length;\n }\n }\n\n return count;\n }\n\n /**\n * Retrieves all data items from a specific leaf.\n * @param {number} leafIndex The index of the leaf.\n * @returns {LeafDataItem[]} An array of LeafDataItem in the specified leaf, sorted by ID,\n * or an empty array if the index is invalid or leaf is empty.\n */\n getLeafData(leafIndex: number): LeafDataItem[] {\n if (leafIndex < 0 || leafIndex >= this.numLeaves) {\n return [];\n }\n const leafContent = this.leaves[leafIndex];\n const items: LeafDataItem[] = [];\n for (const type of Object.keys(leafContent)) {\n items.push(...Object.values(leafContent[type]));\n }\n // Optionally sort them if a specific order is required, e.g., by ID\n items.sort((a, b) => a.id - b.id);\n\n return items;\n }\n\n /**\n * Resizes the HashTree to have a new number of leaf nodes, redistributing all existing items.\n * @param {number} newNumLeaves The new number of leaf nodes (must be 0 or a power of 2).\n * @returns {boolean} true if the tree was resized, false if the size didn't change.\n * @throws {Error} if newNumLeaves is not 0 or a power of 2.\n */\n resize(newNumLeaves: number): boolean {\n // eslint-disable-next-line no-bitwise\n if (newNumLeaves < 0 || (newNumLeaves !== 0 && (newNumLeaves & (newNumLeaves - 1)) !== 0)) {\n throw new Error('New number of leaves must be 0 or a power of 2');\n }\n\n if (newNumLeaves === this.numLeaves) {\n return false;\n }\n\n const allItems: LeafDataItem[] = [];\n for (const leaf of this.leaves) {\n for (const type of Object.keys(leaf)) {\n allItems.push(...Object.values(leaf[type]));\n }\n }\n\n // Re-initialize\n // eslint-disable-next-line no-extra-semi\n (this as any).numLeaves = newNumLeaves; // Type assertion to update readonly property\n this.leafHashes = new Array(newNumLeaves).fill(EMPTY_HASH);\n this.leaves = new Array(newNumLeaves).fill(null).map(() => ({}));\n\n if (newNumLeaves > 0) {\n this.putItems(allItems); // Re-add items which will be re-assigned to leaves and re-hashed\n }\n\n return true;\n }\n\n /**\n * Compares the tree's leaf hashes with an external set of hashes and returns the indices of differing leaf nodes.\n * The externalHashes array is expected to contain all node hashes (internal followed by leaves),\n * similar to the output of getHashes().\n * @param {string[]} externalHashes An array of hash strings (internal node hashes then leaf hashes).\n * @returns {number[]} An array of indices of the leaf nodes that have different hashes.\n */\n diffHashes(externalHashes: string[]): number[] {\n if (this.numLeaves === 0) {\n // If this tree is empty, its hash is EMPTY_HASH.\n // It differs if externalHashes is not a single EMPTY_HASH.\n if (externalHashes && externalHashes.length === 1 && externalHashes[0] === EMPTY_HASH) {\n return []; // No differences\n }\n // An empty tree has no leaves to differ, so return an empty array\n // as no specific leaf indexes are different.\n\n return [];\n }\n\n // We are interested in comparing the leaf hashes part.\n // The externalHashes array should also have its leaf hashes at the end.\n const differingLeafIndexes: number[] = [];\n // Calculate where the leaf hashes would start in the externalHashes array,\n // assuming it has the same number of leaves as this tree.\n const externalLeafHashesStart = externalHashes.length - this.numLeaves;\n\n if (externalLeafHashesStart < 0) {\n // externalHashes is too short to contain a complete set of leaf hashes\n // corresponding to this tree's numLeaves.\n // In this case, consider all of this tree's leaves as \"different\".\n for (let i = 0; i < this.numLeaves; i += 1) {\n differingLeafIndexes.push(i);\n }\n\n return differingLeafIndexes;\n }\n\n // Compare each leaf hash\n for (let i = 0; i < this.numLeaves; i += 1) {\n const ownLeafHash = this.leafHashes[i];\n // externalLeafHash might be undefined if externalHashes is shorter than expected\n // but externalLeafHashesStart was non-negative, implying a structural mismatch.\n const externalLeafHash = externalHashes[externalLeafHashesStart + i];\n if (ownLeafHash !== externalLeafHash) {\n differingLeafIndexes.push(i);\n }\n }\n\n return differingLeafIndexes;\n }\n}\n\nexport default HashTree;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAAuC,SAAAE,2BAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,yBAAAC,OAAA,IAAAH,CAAA,CAAAI,gBAAA,KAAAJ,CAAA,qBAAAE,CAAA,QAAAG,cAAA,CAAAL,CAAA,MAAAE,CAAA,GAAAI,2BAAA,CAAAN,CAAA,MAAAC,CAAA,IAAAD,CAAA,uBAAAA,CAAA,CAAAO,MAAA,IAAAL,CAAA,KAAAF,C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;QACA,KAAK,IAAIjC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,IAAI,CAACtE,SAAS,EAAEsE,CAAC,IAAI,CAAC,EAAE;UAC1CgC,oBAAoB,CAACtE,IAAI,CAACsC,CAAC,CAAC;QAC9B;QAEA,OAAOgC,oBAAoB;MAC7B;;MAEA;MACA,KAAK,IAAIhC,GAAC,GAAG,CAAC,EAAEA,GAAC,GAAG,IAAI,CAACtE,SAAS,EAAEsE,GAAC,IAAI,CAAC,EAAE;QAC1C,IAAMkC,WAAW,GAAG,IAAI,CAAClG,UAAU,CAACgE,GAAC,CAAC;QACtC;QACA;QACA,IAAMmC,gBAAgB,GAAGJ,cAAc,CAACE,uBAAuB,GAAGjC,GAAC,CAAC;QACpE,IAAIkC,WAAW,KAAKC,gBAAgB,EAAE;UACpCH,oBAAoB,CAACtE,IAAI,CAACsC,GAAC,CAAC;QAC9B;MACF;MAEA,OAAOgC,oBAAoB;IAC7B;EAAC;AAAA;AAAA,IAAAI,QAAA,GAAAC,OAAA,CAAAzG,OAAA,GAGYJ,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["_xxh","require","_constants","_createForOfIteratorHelper","r","e","t","_Symbol","_Symbol$iterator","_Array$isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","return","_arrayLikeToArray","toString","slice","constructor","name","_Array$from","test","Array","HashTree","leafData","numLeaves","_classCallCheck2","default","_defineProperty2","Error","concat","leafHashes","fill","EMPTY_HASH","leaves","map","putItems","_createClass2","key","_putItemInternal","item","put","index","id","type","existingItem","version","putItem","_this$_putItemInterna","computeLeafHash","items","_this","results","changedLeafIndexes","_set","forEach","_this$_putItemInterna2","push","add","_removeItemInternal","removed","_keys","removeItem","_this$_removeItemInte","removeItems","_this2","_this2$_removeItemInt","updateItems","itemUpdates","_this3","_ref","operation","_this3$_removeItemInt","_this3$_putItemIntern","leafContent","totalItemsCount","reduce","count","buffer","Buffer","alloc","offset","itemTypes","sort","_values","b","writeBigInt64LE","BigInt","XXH3_128","padStart","computeTreeHashes","currentLevelHashes","_toConsumableArray2","allHashes","nextLevelHashes","i","leftHash","rightHash","input","from","subarray","reverse","unshift","apply","getHashes","getRootHash","getLeafCount","getTotalItemCount","_iterator","_step","leaf","_i","_Object$keys2","err","getLeafData","leafIndex","_i2","_Object$keys3","resize","newNumLeaves","allItems","_iterator2","_step2","_i3","_Object$keys4","diffHashes","externalHashes","differingLeafIndexes","externalLeafHashesStart","ownLeafHash","externalLeafHash","_default","exports"],"sources":["hashTree.ts"],"sourcesContent":["import {XXH3_128} from 'xxh3-ts/xxh3';\nimport {EMPTY_HASH} from './constants';\nimport {ObjectType} from './types';\n\nexport type LeafDataItem = {\n type: ObjectType;\n id: number;\n version: number;\n};\n\n/**\n * HashTree is a data structure that organizes items into leaves based on their IDs,\n */\nclass HashTree {\n leaves: Array<Record<string, Record<number, LeafDataItem>>>;\n\n leafHashes: Array<string>;\n readonly numLeaves: number;\n\n /**\n * Constructs a new HashTree.\n * @param {LeafDataItem[]} leafData Initial data to populate the tree.\n * @param {number} numLeaves The number of leaf nodes in the tree. Must be 0 or a power of 2.\n * @throws {Error} If numLeaves is not 0 or a power of 2.\n */\n constructor(leafData: LeafDataItem[], numLeaves: number) {\n // eslint-disable-next-line no-bitwise\n if ((numLeaves & (numLeaves - 1)) !== 0) {\n throw new Error(`Number of leaves must be a power of 2, saw ${numLeaves}`);\n }\n\n this.numLeaves = numLeaves;\n this.leafHashes = new Array(numLeaves).fill(EMPTY_HASH);\n\n this.leaves = new Array(numLeaves).fill(null).map(() => {\n return {};\n });\n\n if (leafData) {\n this.putItems(leafData);\n }\n }\n\n /**\n * Internal logic for adding or updating an item, without computing the leaf hash.\n * @param {LeafDataItem} item The item to add or update.\n * @returns {{put: boolean, index: (number|null)}} Object indicating if put and the leaf index.\n * @private\n */\n private _putItemInternal(item: LeafDataItem): {put: boolean; index: number | null} {\n if (this.numLeaves === 0) {\n return {put: false, index: null}; // Cannot add to a tree with 0 leaves\n }\n\n const index = item.id % this.numLeaves;\n\n if (!this.leaves[index][item.type]) {\n this.leaves[index][item.type] = {};\n }\n\n const existingItem = this.leaves[index][item.type][item.id];\n\n if (!existingItem || existingItem.version < item.version) {\n this.leaves[index][item.type][item.id] = item;\n\n return {put: true, index};\n }\n\n return {put: false, index: null};\n }\n\n /**\n * Adds or updates a single item in the hash tree.\n * @param {LeafDataItem} item The item to add or update.\n * @returns {boolean} True if the item was added or updated, false otherwise (e.g., older version or tree has 0 leaves).\n */\n putItem(item: LeafDataItem): boolean {\n const {put, index} = this._putItemInternal(item);\n\n if (put && index !== null) {\n this.computeLeafHash(index);\n }\n\n return put;\n }\n\n /**\n * Adds or updates multiple items in the hash tree.\n * @param {LeafDataItem[]} items The array of items to add or update.\n * @returns {boolean[]} An array of booleans indicating success for each item.\n */\n putItems(items: LeafDataItem[]): boolean[] {\n if (this.numLeaves === 0 && items.length > 0) {\n // Cannot add items to a tree with 0 leaves.\n return items.map(() => false);\n }\n const results: boolean[] = [];\n const changedLeafIndexes = new Set<number>();\n\n items.forEach((item) => {\n const {put, index} = this._putItemInternal(item);\n results.push(put);\n if (put && index !== null) {\n changedLeafIndexes.add(index);\n }\n });\n\n changedLeafIndexes.forEach((index) => {\n this.computeLeafHash(index);\n });\n\n return results;\n }\n\n /**\n * Internal logic for removing an item, without computing the leaf hash.\n * @param {LeafDataItem} item The item to remove.\n * @returns {{removed: boolean, index: (number|null)}} Object indicating if removed and the leaf index.\n * @private\n */\n private _removeItemInternal(item: LeafDataItem): {removed: boolean; index: number | null} {\n if (this.numLeaves === 0) {\n return {removed: false, index: null};\n }\n\n const index = item.id % this.numLeaves;\n\n if (\n this.leaves[index] &&\n this.leaves[index][item.type] &&\n this.leaves[index][item.type][item.id]\n ) {\n const existingItem = this.leaves[index][item.type][item.id];\n if (\n existingItem.id === item.id &&\n existingItem.type === item.type &&\n existingItem.version <= item.version\n ) {\n delete this.leaves[index][item.type][item.id];\n if (Object.keys(this.leaves[index][item.type]).length === 0) {\n delete this.leaves[index][item.type];\n }\n\n return {removed: true, index};\n }\n }\n\n return {removed: false, index: null};\n }\n\n /**\n * Removes a single item from the hash tree.\n * The removal is based on matching type, id, and the provided item's version\n * being greater than or equal to the existing item's version.\n * @param {LeafDataItem} item The item to remove.\n * @returns {boolean} True if the item was removed, false otherwise.\n */\n removeItem(item: LeafDataItem): boolean {\n const {removed, index} = this._removeItemInternal(item);\n\n if (removed && index !== null) {\n this.computeLeafHash(index);\n }\n\n return removed;\n }\n\n /**\n * Removes multiple items from the hash tree.\n * @param {LeafDataItem[]} items The array of items to remove.\n * @returns {boolean[]} An array of booleans indicating success for each item.\n */\n removeItems(items: LeafDataItem[]): boolean[] {\n if (this.numLeaves === 0 && items.length > 0) {\n return items.map(() => false);\n }\n\n const results: boolean[] = [];\n const changedLeafIndexes = new Set<number>();\n\n items.forEach((item) => {\n const {removed, index} = this._removeItemInternal(item);\n results.push(removed);\n if (removed && index !== null) {\n changedLeafIndexes.add(index);\n }\n });\n\n changedLeafIndexes.forEach((index) => {\n this.computeLeafHash(index);\n });\n\n return results;\n }\n\n /**\n * Updates multiple items in the hash tree.\n * This method can handle both updating and removing items based on the `operation` flag.\n *\n * @param {object[]} itemUpdates An array of objects containing `operation` flag and the `item` to update.\n * @returns {boolean[]} An array of booleans indicating success for each operation.\n */\n updateItems(itemUpdates: {operation: 'update' | 'remove'; item: LeafDataItem}[]): boolean[] {\n if (this.numLeaves === 0 && itemUpdates.length > 0) {\n return itemUpdates.map(() => false);\n }\n\n const results: boolean[] = [];\n const changedLeafIndexes = new Set<number>();\n\n itemUpdates.forEach(({operation, item}) => {\n if (operation === 'remove') {\n const {removed, index} = this._removeItemInternal(item);\n results.push(removed);\n if (removed && index !== null) {\n changedLeafIndexes.add(index);\n }\n } else {\n const {put, index} = this._putItemInternal(item);\n results.push(put);\n if (put && index !== null) {\n changedLeafIndexes.add(index);\n }\n }\n });\n\n changedLeafIndexes.forEach((index) => {\n this.computeLeafHash(index);\n });\n\n return results;\n }\n\n /**\n * Computes the hash for a specific leaf.\n * The hash is based on the sorted items within the leaf.\n * @param {number} index The index of the leaf to compute the hash for.\n * @returns {void}\n */\n computeLeafHash(index: number) {\n if (index < 0 || index >= this.numLeaves) {\n // nothing to do\n return;\n }\n const leafContent = this.leaves[index];\n\n const totalItemsCount = Object.keys(leafContent).reduce((count, type) => {\n return count + Object.keys(leafContent[type]).length;\n }, 0);\n const buffer = Buffer.alloc(totalItemsCount * 16);\n\n let offset = 0;\n\n // iterate through the item types lexicographically\n const itemTypes = Object.keys(leafContent).sort();\n itemTypes.forEach((type) => {\n // iterate through the items of this type in ascending order of ID\n const items = Object.values(leafContent[type]).sort(\n (a: LeafDataItem, b: LeafDataItem) => a.id - b.id\n );\n\n // add all the items id and version to the hasher\n items.forEach((item: LeafDataItem) => {\n buffer.writeBigInt64LE(BigInt(item.id), offset);\n buffer.writeBigInt64LE(BigInt(item.version), offset + 8);\n\n offset += 16;\n });\n });\n\n this.leafHashes[index] = XXH3_128(buffer, BigInt(0)).toString(16).padStart(32, '0');\n }\n\n /**\n * Computes all internal and leaf node hashes of the tree.\n * Internal node hashes are computed bottom-up from the leaf hashes.\n * @returns {string[]} An array of hash strings, with internal node hashes first, followed by leaf hashes.\n * Returns `[EMPTY_HASH]` if the tree has 0 leaves.\n */\n computeTreeHashes(): string[] {\n if (this.numLeaves === 0) {\n return [EMPTY_HASH];\n }\n\n let currentLevelHashes = [...this.leafHashes];\n const allHashes = [];\n\n while (currentLevelHashes.length > 1) {\n const nextLevelHashes: string[] = [];\n for (let i = 0; i < currentLevelHashes.length; i += 2) {\n const leftHash = currentLevelHashes[i];\n const rightHash = i + 1 < currentLevelHashes.length ? currentLevelHashes[i + 1] : leftHash;\n\n const input = Buffer.concat([\n Buffer.from(leftHash, 'hex').subarray(0, 8).reverse(),\n Buffer.from(leftHash, 'hex').subarray(8, 16).reverse(),\n Buffer.from(rightHash, 'hex').subarray(0, 8).reverse(),\n Buffer.from(rightHash, 'hex').subarray(8, 16).reverse(),\n ]);\n\n nextLevelHashes.push(XXH3_128(input, BigInt(0)).toString(16).padStart(32, '0'));\n }\n currentLevelHashes = nextLevelHashes;\n allHashes.unshift(...currentLevelHashes);\n }\n\n return [...allHashes, ...this.leafHashes];\n }\n\n /**\n * Returns all hashes in the tree (internal nodes then leaf nodes).\n * @returns {string[]} An array of hash strings.\n */\n getHashes(): string[] {\n return this.computeTreeHashes();\n }\n\n /**\n * Computes and returns the hash value of the root node.\n * @returns {string} The root hash of the entire tree. Returns `EMPTY_HASH` if the tree has 0 leaves.\n */\n getRootHash(): string {\n if (this.numLeaves === 0) {\n return EMPTY_HASH;\n }\n\n return this.computeTreeHashes()[0];\n }\n\n /**\n * Gets the number of leaves in the tree.\n * @returns {number} The number of leaves.\n */\n getLeafCount(): number {\n return this.numLeaves;\n }\n\n /**\n * Calculates the total number of items stored in the tree.\n * @returns {number} The total number of items.\n */\n getTotalItemCount(): number {\n let count = 0;\n for (const leaf of this.leaves) {\n for (const type of Object.keys(leaf)) {\n count += Object.keys(leaf[type]).length;\n }\n }\n\n return count;\n }\n\n /**\n * Retrieves all data items from a specific leaf.\n * @param {number} leafIndex The index of the leaf.\n * @returns {LeafDataItem[]} An array of LeafDataItem in the specified leaf, sorted by ID,\n * or an empty array if the index is invalid or leaf is empty.\n */\n getLeafData(leafIndex: number): LeafDataItem[] {\n if (leafIndex < 0 || leafIndex >= this.numLeaves) {\n return [];\n }\n const leafContent = this.leaves[leafIndex];\n const items: LeafDataItem[] = [];\n for (const type of Object.keys(leafContent)) {\n items.push(...Object.values(leafContent[type]));\n }\n // Optionally sort them if a specific order is required, e.g., by ID\n items.sort((a, b) => a.id - b.id);\n\n return items;\n }\n\n /**\n * Resizes the HashTree to have a new number of leaf nodes, redistributing all existing items.\n * @param {number} newNumLeaves The new number of leaf nodes (must be 0 or a power of 2).\n * @returns {boolean} true if the tree was resized, false if the size didn't change.\n * @throws {Error} if newNumLeaves is not 0 or a power of 2.\n */\n resize(newNumLeaves: number): boolean {\n // eslint-disable-next-line no-bitwise\n if (newNumLeaves < 0 || (newNumLeaves !== 0 && (newNumLeaves & (newNumLeaves - 1)) !== 0)) {\n throw new Error('New number of leaves must be 0 or a power of 2');\n }\n\n if (newNumLeaves === this.numLeaves) {\n return false;\n }\n\n const allItems: LeafDataItem[] = [];\n for (const leaf of this.leaves) {\n for (const type of Object.keys(leaf)) {\n allItems.push(...Object.values(leaf[type]));\n }\n }\n\n // Re-initialize\n // eslint-disable-next-line no-extra-semi\n (this as any).numLeaves = newNumLeaves; // Type assertion to update readonly property\n this.leafHashes = new Array(newNumLeaves).fill(EMPTY_HASH);\n this.leaves = new Array(newNumLeaves).fill(null).map(() => ({}));\n\n if (newNumLeaves > 0) {\n this.putItems(allItems); // Re-add items which will be re-assigned to leaves and re-hashed\n }\n\n return true;\n }\n\n /**\n * Compares the tree's leaf hashes with an external set of hashes and returns the indices of differing leaf nodes.\n * The externalHashes array is expected to contain all node hashes (internal followed by leaves),\n * similar to the output of getHashes().\n * @param {string[]} externalHashes An array of hash strings (internal node hashes then leaf hashes).\n * @returns {number[]} An array of indices of the leaf nodes that have different hashes.\n */\n diffHashes(externalHashes: string[]): number[] {\n if (this.numLeaves === 0) {\n // If this tree is empty, its hash is EMPTY_HASH.\n // It differs if externalHashes is not a single EMPTY_HASH.\n if (externalHashes && externalHashes.length === 1 && externalHashes[0] === EMPTY_HASH) {\n return []; // No differences\n }\n // An empty tree has no leaves to differ, so return an empty array\n // as no specific leaf indexes are different.\n\n return [];\n }\n\n // We are interested in comparing the leaf hashes part.\n // The externalHashes array should also have its leaf hashes at the end.\n const differingLeafIndexes: number[] = [];\n // Calculate where the leaf hashes would start in the externalHashes array,\n // assuming it has the same number of leaves as this tree.\n const externalLeafHashesStart = externalHashes.length - this.numLeaves;\n\n if (externalLeafHashesStart < 0) {\n // externalHashes is too short to contain a complete set of leaf hashes\n // corresponding to this tree's numLeaves.\n // In this case, consider all of this tree's leaves as \"different\".\n for (let i = 0; i < this.numLeaves; i += 1) {\n differingLeafIndexes.push(i);\n }\n\n return differingLeafIndexes;\n }\n\n // Compare each leaf hash\n for (let i = 0; i < this.numLeaves; i += 1) {\n const ownLeafHash = this.leafHashes[i];\n // externalLeafHash might be undefined if externalHashes is shorter than expected\n // but externalLeafHashesStart was non-negative, implying a structural mismatch.\n const externalLeafHash = externalHashes[externalLeafHashesStart + i];\n if (ownLeafHash !== externalLeafHash) {\n differingLeafIndexes.push(i);\n }\n }\n\n return differingLeafIndexes;\n }\n}\n\nexport default HashTree;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAAuC,SAAAE,2BAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,yBAAAC,OAAA,IAAAH,CAAA,CAAAI,gBAAA,KAAAJ,CAAA,qBAAAE,CAAA,QAAAG,cAAA,CAAAL,CAAA,MAAAE,CAAA,GAAAI,2BAAA,CAAAN,CAAA,MAAAC,CAAA,IAAAD,CAAA,uBAAAA,CAAA,CAAAO,MAAA,IAAAL,CAAA,KAAAF,CAAA,GAAAE,CAAA,OAAAM,EAAA,MAAAC,CAAA,YAAAA,EAAA,eAAAC,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAA,EAAA,WAAAH,EAAA,IAAAR,CAAA,CAAAO,MAAA,KAAAK,IAAA,WAAAA,IAAA,MAAAC,KAAA,EAAAb,CAAA,CAAAQ,EAAA,UAAAP,CAAA,WAAAA,EAAAD,CAAA,UAAAA,CAAA,KAAAc,CAAA,EAAAL,CAAA,gBAAAM,SAAA,iJAAAC,CAAA,EAAAC,CAAA,OAAAC,CAAA,gBAAAR,CAAA,WAAAA,EAAA,IAAAR,CAAA,GAAAA,CAAA,CAAAiB,IAAA,CAAAnB,CAAA,MAAAW,CAAA,WAAAA,EAAA,QAAAX,CAAA,GAAAE,CAAA,CAAAkB,IAAA,WAAAH,CAAA,GAA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B,CAACtE,IAAI,CAACsC,GAAC,CAAC;QAC9B;MACF;MAEA,OAAOgC,oBAAoB;IAC7B;EAAC;AAAA;AAAA,IAAAI,QAAA,GAAAC,OAAA,CAAAzG,OAAA,GAGYJ,QAAQ","ignoreList":[]}
@@ -372,7 +372,7 @@ var SimultaneousInterpretation = _webexCore.WebexPlugin.extend({
372
372
  throw error;
373
373
  });
374
374
  },
375
- version: "3.10.0-webex-services-ready.2"
375
+ version: "3.10.0-webex-services-ready.3"
376
376
  });
377
377
  var _default = exports.default = SimultaneousInterpretation;
378
378
  //# sourceMappingURL=index.js.map
@@ -18,7 +18,7 @@ var SILanguage = _webexCore.WebexPlugin.extend({
18
18
  languageCode: 'number',
19
19
  languageName: 'string'
20
20
  },
21
- version: "3.10.0-webex-services-ready.2"
21
+ version: "3.10.0-webex-services-ready.3"
22
22
  });
23
23
  var _default = exports.default = SILanguage;
24
24
  //# sourceMappingURL=siLanguage.js.map
@@ -92,10 +92,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
92
92
  (0, _defineProperty2.default)(_this, "aclUrl", void 0);
93
93
  (0, _defineProperty2.default)(_this, "baseSequence", void 0);
94
94
  (0, _defineProperty2.default)(_this, "created", void 0);
95
- (0, _defineProperty2.default)(_this, "identities", void 0);
96
- (0, _defineProperty2.default)(_this, "membership", void 0);
97
95
  (0, _defineProperty2.default)(_this, "participants", void 0);
98
- (0, _defineProperty2.default)(_this, "participantsUrl", void 0);
99
96
  (0, _defineProperty2.default)(_this, "replaces", void 0);
100
97
  (0, _defineProperty2.default)(_this, "scheduledMeeting", void 0);
101
98
  (0, _defineProperty2.default)(_this, "sequence", void 0);
@@ -107,7 +104,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
107
104
  (0, _defineProperty2.default)(_this, "info", void 0);
108
105
  (0, _defineProperty2.default)(_this, "roles", void 0);
109
106
  (0, _defineProperty2.default)(_this, "mediaShares", void 0);
110
- (0, _defineProperty2.default)(_this, "replace", void 0);
111
107
  (0, _defineProperty2.default)(_this, "url", void 0);
112
108
  (0, _defineProperty2.default)(_this, "links", void 0);
113
109
  (0, _defineProperty2.default)(_this, "mainSessionLocusCache", void 0);
@@ -301,13 +297,10 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
301
297
  var locus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
302
298
  this.created = locus.created || null;
303
299
  this.scheduledMeeting = locus.meeting || null;
304
- this.participantsUrl = locus.participantsUrl || null;
305
300
  this.replaces = locus.replaces || null;
306
301
  this.aclUrl = locus.aclUrl || null;
307
302
  this.baseSequence = locus.baseSequence || null;
308
303
  this.sequence = locus.sequence || null;
309
- this.membership = locus.membership || null;
310
- this.identities = locus.identities || null;
311
304
  this.participants = locus.participants || null;
312
305
 
313
306
  /**
@@ -496,7 +489,15 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
496
489
  }, {
497
490
  key: "updateLocusFromHashTreeObject",
498
491
  value: function updateLocusFromHashTreeObject(object, locus) {
492
+ var _this4 = this;
499
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
+ };
500
501
  switch (type) {
501
502
  case _types.ObjectType.locus:
502
503
  {
@@ -543,13 +544,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
543
544
  case _types.ObjectType.participant:
544
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));
545
546
  if (object.data) {
546
- if (!locus.participants) {
547
- locus.participants = [];
548
- }
549
- var participantObject = object.data;
550
- participantObject.htMeta = object.htMeta;
551
- locus.participants.push(participantObject);
552
- this.hashTreeObjectId2ParticipantId.set(object.htMeta.elementId.id, participantObject.id);
547
+ addParticipantObject(object);
553
548
  } else {
554
549
  var participantId = this.hashTreeObjectId2ParticipantId.get(object.htMeta.elementId.id);
555
550
  if (!locus.jsSdkMeta) {
@@ -570,9 +565,22 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
570
565
  // all other types info, fullstate, etc - Locus should never send them without data
571
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));
572
567
  } else {
568
+ var _locus$info, _object$data$controls, _object$data$controls2, _object$data$controls3;
573
569
  _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> ".concat(type, " object updated to version ").concat(object.htMeta.elementId.version));
574
570
  var locusDtoKey = _types.ObjectTypeToLocusKeyMap[type];
575
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
+ }
576
584
  }
577
585
  break;
578
586
  default:
@@ -633,7 +641,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
633
641
  }, {
634
642
  key: "updateFromHashTree",
635
643
  value: function updateFromHashTree(updateType, data) {
636
- var _this4 = this;
644
+ var _this5 = this;
637
645
  switch (updateType) {
638
646
  case _hashTreeParser.LocusInfoUpdateType.OBJECTS_UPDATED:
639
647
  {
@@ -656,7 +664,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
656
664
  // but these should never happen
657
665
  _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> received multiple LOCUS objects in one update, this is unexpected!");
658
666
  _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_HASH_TREE_UNSUPPORTED_OPERATION, {
659
- locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this4.url,
667
+ locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this5.url,
660
668
  message: object.data ? 'multiple LOCUS object updates' : 'LOCUS object update followed by removal'
661
669
  });
662
670
  }
@@ -677,7 +685,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
677
685
  // copy over all of existing locus except participants
678
686
  LocusDtoTopLevelKeys.forEach(function (key) {
679
687
  if (key !== 'participants') {
680
- locus[key] = (0, _lodash.cloneDeep)(_this4[key]);
688
+ locus[key] = (0, _lodash.cloneDeep)(_this5[key]);
681
689
  }
682
690
  });
683
691
  } else {
@@ -685,7 +693,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
685
693
  // (except participants, which need to stay empty - that means "no participant changes")
686
694
  (0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
687
695
  if (locusDtoKey !== 'participants') {
688
- locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this4[locusDtoKey]);
696
+ locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this5[locusDtoKey]);
689
697
  }
690
698
  });
691
699
  }
@@ -698,7 +706,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
698
706
  }))));
699
707
  // now apply all the updates from the hash tree onto the locus
700
708
  data.updatedObjects.forEach(function (object) {
701
- locus = _this4.updateLocusFromHashTreeObject(object, locus);
709
+ locus = _this5.updateLocusFromHashTreeObject(object, locus);
702
710
  });
703
711
 
704
712
  // update our locus info with the new locus
@@ -859,7 +867,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
859
867
  key: "onFullLocusCommon",
860
868
  value: function onFullLocusCommon(locus, eventType) {
861
869
  var _this$participants,
862
- _this5 = this,
870
+ _this6 = this,
863
871
  _locus$jsSdkMeta;
864
872
  this.scheduledMeeting = locus.meeting || null;
865
873
  this.participants = locus.participants;
@@ -867,7 +875,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
867
875
  var _participant$htMeta;
868
876
  // participant.htMeta is set only for hash tree based locus
869
877
  if ((_participant$htMeta = participant.htMeta) !== null && _participant$htMeta !== void 0 && _participant$htMeta.elementId.id) {
870
- _this5.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
878
+ _this6.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
871
879
  }
872
880
  });
873
881
  var isReplaceMembers = _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
@@ -955,14 +963,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
955
963
  this.updateLocusUrl(locus.url, _controlsUtils.default.isMainSessionDTO(locus));
956
964
  this.updateMeetingInfo(locus.info, locus.self);
957
965
  this.updateMediaShares(locus.mediaShares);
958
- this.updateParticipantsUrl(locus.participantsUrl);
959
- this.updateReplace(locus.replace);
966
+ this.updateReplaces(locus.replaces);
960
967
  this.updateSelf(locus.self);
961
968
  this.updateAclUrl(locus.aclUrl);
962
969
  this.updateBasequence(locus.baseSequence);
963
970
  this.updateSequence(locus.sequence);
964
- this.updateMemberShip(locus.membership);
965
- this.updateIdentifiers(locus.identities);
966
971
  this.updateEmbeddedApps(locus.embeddedApps);
967
972
  this.updateLinks(locus.links);
968
973
  this.compareAndUpdate();
@@ -1699,28 +1704,15 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1699
1704
  }
1700
1705
 
1701
1706
  /**
1702
- * @param {String} participantsUrl
1707
+ * @param {Object} replaces
1703
1708
  * @returns {undefined}
1704
1709
  * @memberof LocusInfo
1705
1710
  */
1706
1711
  }, {
1707
- key: "updateParticipantsUrl",
1708
- value: function updateParticipantsUrl(participantsUrl) {
1709
- if (participantsUrl && !(0, _lodash.isEqual)(this.participantsUrl, participantsUrl)) {
1710
- this.participantsUrl = participantsUrl;
1711
- }
1712
- }
1713
-
1714
- /**
1715
- * @param {Object} replace
1716
- * @returns {undefined}
1717
- * @memberof LocusInfo
1718
- */
1719
- }, {
1720
- key: "updateReplace",
1721
- value: function updateReplace(replace) {
1722
- if (replace && !(0, _lodash.isEqual)(this.replace, replace)) {
1723
- this.replace = replace;
1712
+ key: "updateReplaces",
1713
+ value: function updateReplaces(replaces) {
1714
+ if (replaces && !(0, _lodash.isEqual)(this.replaces, replaces)) {
1715
+ this.replaces = replaces;
1724
1716
  }
1725
1717
  }
1726
1718
 
@@ -1979,32 +1971,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1979
1971
  }
1980
1972
  }
1981
1973
 
1982
- /**
1983
- * @param {Object} membership
1984
- * @returns {undefined}
1985
- * @memberof LocusInfo
1986
- */
1987
- }, {
1988
- key: "updateMemberShip",
1989
- value: function updateMemberShip(membership) {
1990
- if (membership && !(0, _lodash.isEqual)(this.membership, membership)) {
1991
- this.membership = membership;
1992
- }
1993
- }
1994
-
1995
- /**
1996
- * @param {Array} identities
1997
- * @returns {undefined}
1998
- * @memberof LocusInfo
1999
- */
2000
- }, {
2001
- key: "updateIdentifiers",
2002
- value: function updateIdentifiers(identities) {
2003
- if (identities && !(0, _lodash.isEqual)(this.identities, identities)) {
2004
- this.identities = identities;
2005
- }
2006
- }
2007
-
2008
1974
  /**
2009
1975
  * check the locus is main session's one or not, if is main session's, update main session cache
2010
1976
  * @param {Object} locus
@@ -2082,7 +2048,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2082
2048
  }, {
2083
2049
  key: "updateMainSessionLocusCache",
2084
2050
  value: function updateMainSessionLocusCache(mainLocus) {
2085
- var _this6 = this;
2051
+ var _this7 = this;
2086
2052
  if (!mainLocus) {
2087
2053
  return;
2088
2054
  }
@@ -2091,7 +2057,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2091
2057
  // shallow merge and do special merge for participants
2092
2058
  (0, _lodash.assignWith)(this.mainSessionLocusCache, locusClone, function (objValue, srcValue, key) {
2093
2059
  if (key === 'participants') {
2094
- return _this6.mergeParticipants(objValue, srcValue);
2060
+ return _this7.mergeParticipants(objValue, srcValue);
2095
2061
  }
2096
2062
  return srcValue || objValue;
2097
2063
  });