import EventsScope from '../common/events/events-scope'; import { LOCUSEVENT } from '../constants'; import HashTreeParser, { DataSet, HashTreeMessage, Metadata } from '../hashTree/hashTreeParser'; import { HashTreeObject } from '../hashTree/types'; import { Links, LocusDTO } from './types'; export type LocusLLMEvent = { data: { eventType: typeof LOCUSEVENT.HASH_TREE_DATA_UPDATED; stateElementsMessage: HashTreeMessage; }; }; export type LocusApiResponseBody = { dataSets?: DataSet[]; locus: LocusDTO; metadata?: Metadata; }; /** * Creates a locus object from the objects received in a hash tree message. It usually will be * incomplete, because hash tree messages only contain the parts of locus that have changed, * and some updates come separately over Mercury or LLM in separate messages. * * @param {HashTreeMessage} message hash tree message to created the locus from * @returns {Object} the created locus object and metadata if present */ export declare function createLocusFromHashTreeMessage(message: HashTreeMessage): { locus: LocusDTO; metadata?: Metadata; }; /** * @description LocusInfo extends ChildEmitter to convert locusInfo info a private emitter to parent object * @export * @private * @class LocusInfo */ export default class LocusInfo extends EventsScope { compareAndUpdateFlags: any; emitChange: any; locusParser: any; meetingId: any; parsedLocus: any; updateMeeting: any; webex: any; aclUrl: any; baseSequence: any; created: any; participants: any; replaces: any; scheduledMeeting: any; sequence: any; controls: any; conversationUrl: any; embeddedApps: any; fullState: any; host: any; info: any; roles: any; mediaShares: any; url: any; links?: Links; mainSessionLocusCache: any; self: any; hashTreeParser?: HashTreeParser; hashTreeObjectId2ParticipantId: Map; classicVsHashTreeMismatchMetricCounter: number; /** * Constructor * @param {function} updateMeeting callback to update the meeting object from an object * @param {object} webex * @param {string} meetingId * @returns {undefined} */ constructor(updateMeeting: any, webex: any, meetingId: any); /** * 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. * WARNING: This function must not be used for hash tree based Locus meetings. * * @param {Meeting} meeting * @param {boolean} isLocusUrlChanged * @param {Locus} locus * @returns {undefined} */ private doLocusSync; /** * Apply locus delta data to meeting * @param {string} action Locus delta action * @param {Locus} locus * @param {Meeting} meeting * @returns {undefined} */ applyLocusDeltaData(action: string, locus: any, meeting: any): void; /** * Adds locus delta to parser's queue * and registers a function handler * to recieve parsed actions from queue. * @param {Locus} locus * @param {Meeting} meeting * @returns {undefined} */ handleLocusDelta(locus: any, meeting: any): void; /** * @param {Locus} locus * @returns {undefined} * @memberof LocusInfo */ init(locus?: any): void; /** * Creates the HashTreeParser instance. * @param {Object} initial locus data * @returns {void} */ private createHashTreeParser; /** * @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 * @returns {undefined} * @memberof LocusInfo */ initialSetup(data: { trigger: 'join-response'; locus: LocusDTO; dataSets?: DataSet[]; metadata?: Metadata; } | { trigger: 'locus-message'; locus?: LocusDTO; hashTreeMessage?: HashTreeMessage; } | { trigger: 'get-loci-response'; locus?: LocusDTO; }): Promise; /** * Handles HTTP response from Locus API call. * @param {Meeting} meeting meeting object * @param {LocusApiResponseBody} responseBody body of the http response from Locus API call * @returns {void} */ handleLocusAPIResponse(meeting: any, responseBody: LocusApiResponseBody): void; /** * * @param {HashTreeObject} object data set object * @param {any} locus * @returns {void} */ updateLocusFromHashTreeObject(object: HashTreeObject, locus: LocusDTO): LocusDTO; /** * Sends a metric when we receive something from Locus that uses hash trees while we * expect classic deltas or the other way around. * @param {Meeting} meeting * @param {string} message * @returns {void} */ sendClassicVsHashTreeMismatchMetric(meeting: any, message: string): void; /** * Handles a hash tree message received from Locus. * * @param {Meeting} meeting - The meeting object * @param {eventType} eventType - The event type * @param {HashTreeMessage} message incoming hash tree message * @returns {void} */ private handleHashTreeMessage; /** * Callback registered with HashTreeParser to receive locus info updates. * Updates our locus info based on the data parsed by the hash tree parser. * * @param {LocusInfoUpdateType} updateType - The type of update received. * @param {Object} [data] - Additional data for the update, if applicable. * @returns {void} */ private updateFromHashTree; /** * @param {Meeting} meeting * @param {Object} data * @returns {undefined} * @memberof LocusInfo */ parse(meeting: any, data: any): void; /** * @param {String} scope * @param {String} eventName * @param {Array} args * @returns {undefined} * @memberof LocusInfo */ emitScoped(scope?: any, eventName?: string, args?: any): boolean; /** * Function for handling full locus when it's using hash trees (so not the "classic" one). * * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes * @param {object} locus locus object * @param {object} metadata locus hash trees metadata * @param {string} eventType locus event * @param {DataSet[]} dataSets * @returns {void} */ private onFullLocusWithHashTrees; /** * Function for handling full locus when it's the "classic" one (not hash trees) * * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes * @param {object} locus locus object * @param {string} eventType locus event * @returns {void} */ private onFullLocusClassic; /** * updates the locus with full locus object * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes * @param {object} locus locus object * @param {string} eventType locus event * @param {DataSet[]} dataSets * @param {object} metadata locus hash trees metadata * @returns {object} null * @memberof LocusInfo */ onFullLocus(debugText: string, locus: any, eventType?: string, dataSets?: Array, metadata?: Metadata): void; /** * Common part of handling full locus, used by both classic and hash tree based locus handling * @param {object} locus locus object * @param {string} eventType locus event * @returns {void} */ private onFullLocusCommon; /** * @param {String} eventType * @returns {undefined} * @memberof LocusInfo */ handleOneOnOneEvent(eventType: string): void; /** * @param {Object} locus * @returns {undefined} * @memberof LocusInfo */ onDeltaLocus(locus: any): void; /** * @param {Object} locus * @returns {undefined} * @memberof LocusInfo */ updateLocusInfo(locus: any): void; /** * @param {Array} participants * @param {Object} self * @returns {Array} * @memberof LocusInfo */ getLocusPartner(participants: Array, self: any): any; /** * @returns {undefined} * @memberof LocusInfo */ isMeetingActive(): void; /** * checks if the host permissions have changed while in the meeting * This would be the case if your role as host or moderator has been updated * @returns {undefined} * @memberof LocusInfo */ compareAndUpdate(): void; /** * compared the self object to check if the user has host permissions * @returns {undefined} * @memberof LocusInfo */ compareSelfAndHost(): void; /** * update meeting's members * @param {Object} participants new participants object * @param {Array} removedParticipantIds list of removed participants * @param {Boolean} isReplace is replace the whole members * @returns {Array} updatedParticipants * @memberof LocusInfo */ updateParticipants(participants: object, removedParticipantIds?: string[], isReplace?: boolean): void; /** * @param {Object} controls * @param {Object} self * @returns {undefined} * @memberof LocusInfo */ updateControls(controls: object, self: object): void; /** * @param {String} conversationUrl * @param {Object} info * @returns {undefined} * @memberof LocusInfo */ updateConversationUrl(conversationUrl: string, info: any): void; /** * @param {Object} created * @returns {undefined} * @memberof LocusInfo */ updateCreated(created: object): void; /** * Updates links and emits appropriate events if services or resources have changed * @param {Object} links * @returns {undefined} * @memberof LocusInfo */ updateLinks(links?: Links): void; /** * @param {Object} fullState * @returns {undefined} * @memberof LocusInfo */ updateFullState(fullState: object): void; /** * handles when the locus.host is updated * @param {Object} host the locus.host property * @returns {undefined} * @memberof LocusInfo * emits internal event locus_info_update_host */ updateHostInfo(host: object): void; /** * @param {Object} info * @param {Object} self * @returns {undefined} * @memberof LocusInfo */ updateMeetingInfo(info: object, self?: object): void; /** * @param {Object} embeddedApps * @returns {undefined} * @memberof LocusInfo */ updateEmbeddedApps(embeddedApps: object): void; /** * handles when the locus.mediaShares is updated * @param {Object} mediaShares the locus.mediaShares property * @param {boolean} forceUpdate force to update the mediaShares * @returns {undefined} * @memberof LocusInfo * emits internal event locus_info_update_media_shares */ updateMediaShares(mediaShares: object, forceUpdate?: boolean): void; /** * @param {Object} replaces * @returns {undefined} * @memberof LocusInfo */ updateReplaces(replaces: object): void; /** * handles when the locus.self is updated * @param {Object} self the new locus.self * @returns {undefined} * @memberof LocusInfo * emits internal events self_admitted_guest, self_unadmitted_guest, locus_info_update_self */ updateSelf(self: any): void; /** * handles when the locus.url is updated * @param {String} url * @param {Boolean} isMainLocus * @returns {undefined} * emits internal event locus_info_update_url */ updateLocusUrl(url: string, isMainLocus?: boolean): void; /** * @param {String} aclUrl * @returns {undefined} * @memberof LocusInfo */ updateAclUrl(aclUrl: string): void; /** * @param {Number} baseSequence * @returns {undefined} * @memberof LocusInfo */ updateBasequence(baseSequence: number): void; /** * @param {Number} sequence * @returns {undefined} * @memberof LocusInfo */ updateSequence(sequence: number): void; /** * check the locus is main session's one or not, if is main session's, update main session cache * @param {Object} locus * @returns {undefined} * @memberof LocusInfo */ updateLocusCache(locus: any): void; /** * if return from breakout to main session, need to use cached main session DTO since locus won't send the full locus (participants) * if join breakout from main session, main session is not active for the attendee and remove main session locus cache * @param {Object} newLocus * @returns {Object} * @memberof LocusInfo */ getTheLocusToUpdate(newLocus: any): any; /** * merge participants by participant id * @param {Array} participants * @param {Array} sourceParticipants * @returns {Array} merged participants * @memberof LocusInfo */ mergeParticipants(participants: any, sourceParticipants: any): any; /** * need cache main sessions' participants since locus will not send the full list when cohost/host leave breakout * @param {Object} mainLocus * @returns {undefined} * @memberof LocusInfo */ updateMainSessionLocusCache(mainLocus: any): void; /** * clear main session cache * @returns {undefined} * @memberof LocusInfo */ clearMainSessionLocusCache(): void; }