@webex/plugin-meetings 3.11.0 → 3.12.0-metrics-init-fix-2.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/AGENTS.md +9 -0
- package/dist/aiEnableRequest/index.js +197 -0
- package/dist/aiEnableRequest/index.js.map +1 -0
- package/dist/aiEnableRequest/utils.js +36 -0
- package/dist/aiEnableRequest/utils.js.map +1 -0
- package/dist/annotation/index.js +14 -5
- package/dist/annotation/index.js.map +1 -1
- package/dist/breakouts/breakout.js +8 -3
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/events.js +29 -14
- package/dist/breakouts/events.js.map +1 -1
- package/dist/breakouts/index.js +90 -3
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +49 -5
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +8 -3
- package/dist/config.js.map +1 -1
- package/dist/constants.js +60 -11
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/constants.js +11 -1
- package/dist/controls-options-manager/constants.js.map +1 -1
- package/dist/controls-options-manager/index.js +67 -29
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/controls-options-manager/util.js +91 -0
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/hashTree/constants.js +16 -2
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTree.js +18 -0
- package/dist/hashTree/hashTree.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +1655 -538
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/types.js +4 -2
- package/dist/hashTree/types.js.map +1 -1
- package/dist/hashTree/utils.js +52 -0
- package/dist/hashTree/utils.js.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/interceptors/constant.js +12 -0
- package/dist/interceptors/constant.js.map +1 -0
- package/dist/interceptors/dataChannelAuthToken.js +350 -0
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
- package/dist/interceptors/index.js +7 -0
- package/dist/interceptors/index.js.map +1 -1
- package/dist/interceptors/locusRetry.js +23 -8
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interceptors/utils.js +27 -0
- package/dist/interceptors/utils.js.map +1 -0
- package/dist/interpretation/index.js +11 -2
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/interpretation.types.js +7 -0
- package/dist/interpretation/interpretation.types.js.map +1 -0
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/controlsUtils.js +9 -4
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +911 -211
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/infoUtils.js +36 -5
- package/dist/locus-info/infoUtils.js.map +1 -1
- package/dist/locus-info/selfUtils.js +1 -0
- package/dist/locus-info/selfUtils.js.map +1 -1
- package/dist/locus-info/types.js +19 -0
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +72 -3
- package/dist/media/MediaConnectionAwaiter.js.map +1 -1
- package/dist/media/index.js +8 -2
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +8 -7
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +11 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +2276 -1067
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +229 -82
- package/dist/meeting/locusMediaRequest.js.map +1 -1
- package/dist/meeting/muteState.js +10 -1
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +55 -2
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/request.type.js.map +1 -1
- package/dist/meeting/util.js +168 -5
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +2 -2
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +369 -162
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js +6 -1
- package/dist/meetings/meetings.types.js.map +1 -1
- package/dist/meetings/request.js +39 -0
- package/dist/meetings/request.js.map +1 -1
- package/dist/meetings/util.js +116 -18
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +20 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +40 -0
- package/dist/member/util.js.map +1 -1
- package/dist/members/index.js +101 -43
- package/dist/members/index.js.map +1 -1
- package/dist/members/util.js +8 -1
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +12 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/multistream/codec/constants.js +63 -0
- package/dist/multistream/codec/constants.js.map +1 -0
- package/dist/multistream/mediaRequestManager.js +64 -68
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/receiveSlot.js +9 -0
- package/dist/multistream/receiveSlot.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +11 -0
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +116 -2
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +139 -93
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/reachability.types.js +2 -0
- package/dist/reachability/reachability.types.js.map +1 -1
- package/dist/reachability/util.js +45 -0
- package/dist/reachability/util.js.map +1 -1
- package/dist/reactions/reactions.type.js.map +1 -1
- package/dist/reconnection-manager/index.js +0 -1
- package/dist/reconnection-manager/index.js.map +1 -1
- package/dist/recording-controller/index.js +1 -3
- package/dist/recording-controller/index.js.map +1 -1
- package/dist/roap/turnDiscovery.js +8 -1
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/types/aiEnableRequest/index.d.ts +5 -0
- package/dist/types/aiEnableRequest/utils.d.ts +2 -0
- package/dist/types/common/errors/webex-errors.d.ts +32 -2
- package/dist/types/config.d.ts +6 -2
- package/dist/types/constants.d.ts +35 -1
- package/dist/types/controls-options-manager/constants.d.ts +6 -1
- package/dist/types/controls-options-manager/index.d.ts +16 -0
- package/dist/types/hashTree/constants.d.ts +3 -0
- package/dist/types/hashTree/hashTree.d.ts +7 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +315 -30
- package/dist/types/hashTree/types.d.ts +3 -0
- package/dist/types/hashTree/utils.d.ts +24 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/interceptors/constant.d.ts +5 -0
- package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
- package/dist/types/interceptors/index.d.ts +2 -1
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interceptors/utils.d.ts +1 -0
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +126 -15
- package/dist/types/locus-info/infoUtils.d.ts +8 -0
- package/dist/types/locus-info/types.d.ts +28 -1
- package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
- package/dist/types/media/properties.d.ts +8 -3
- package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
- package/dist/types/meeting/index.d.ts +245 -16
- package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
- package/dist/types/meeting/request.d.ts +17 -1
- package/dist/types/meeting/request.type.d.ts +5 -0
- package/dist/types/meeting/util.d.ts +40 -0
- package/dist/types/meetings/index.d.ts +42 -20
- package/dist/types/meetings/meetings.types.d.ts +15 -0
- package/dist/types/meetings/request.d.ts +14 -0
- package/dist/types/member/index.d.ts +2 -0
- package/dist/types/member/types.d.ts +1 -0
- package/dist/types/member/util.d.ts +14 -0
- package/dist/types/members/index.d.ts +15 -2
- package/dist/types/members/util.d.ts +1 -5
- package/dist/types/metrics/constants.d.ts +11 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
- package/dist/types/multistream/sendSlotManager.d.ts +23 -1
- package/dist/types/reachability/clusterReachability.d.ts +3 -3
- package/dist/types/reachability/index.d.ts +10 -3
- package/dist/types/reachability/reachability.types.d.ts +7 -0
- package/dist/types/reachability/util.d.ts +17 -0
- package/dist/types/reactions/reactions.type.d.ts +4 -0
- package/dist/types/webinar/utils.d.ts +6 -0
- package/dist/webinar/index.js +585 -164
- package/dist/webinar/index.js.map +1 -1
- package/dist/webinar/utils.js +25 -0
- package/dist/webinar/utils.js.map +1 -0
- package/package.json +24 -23
- package/src/aiEnableRequest/README.md +84 -0
- package/src/aiEnableRequest/index.ts +186 -0
- package/src/aiEnableRequest/utils.ts +25 -0
- package/src/annotation/index.ts +27 -7
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/events.ts +33 -11
- package/src/breakouts/index.ts +110 -1
- package/src/common/errors/webex-errors.ts +50 -3
- package/src/config.ts +6 -2
- package/src/constants.ts +49 -3
- package/src/controls-options-manager/constants.ts +14 -1
- package/src/controls-options-manager/index.ts +87 -28
- package/src/controls-options-manager/util.ts +81 -1
- package/src/hashTree/constants.ts +17 -0
- package/src/hashTree/hashTree.ts +17 -0
- package/src/hashTree/hashTreeParser.ts +1482 -361
- package/src/hashTree/types.ts +4 -0
- package/src/hashTree/utils.ts +45 -0
- package/src/index.ts +14 -1
- package/src/interceptors/constant.ts +6 -0
- package/src/interceptors/dataChannelAuthToken.ts +246 -0
- package/src/interceptors/index.ts +2 -1
- package/src/interceptors/locusRetry.ts +25 -4
- package/src/interceptors/utils.ts +16 -0
- package/src/interpretation/index.ts +29 -11
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/controlsUtils.ts +14 -1
- package/src/locus-info/index.ts +975 -203
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/selfUtils.ts +1 -0
- package/src/locus-info/types.ts +33 -1
- package/src/media/MediaConnectionAwaiter.ts +62 -5
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +11 -4
- package/src/meeting/in-meeting-actions.ts +20 -0
- package/src/meeting/index.ts +1272 -164
- package/src/meeting/locusMediaRequest.ts +106 -6
- package/src/meeting/muteState.ts +10 -1
- package/src/meeting/request.ts +53 -0
- package/src/meeting/request.type.ts +6 -0
- package/src/meeting/util.ts +207 -7
- package/src/meeting-info/meeting-info-v2.ts +4 -2
- package/src/meetings/index.ts +319 -117
- package/src/meetings/meetings.types.ts +19 -0
- package/src/meetings/request.ts +43 -0
- package/src/meetings/util.ts +117 -4
- package/src/member/index.ts +20 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +41 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/constants.ts +12 -0
- package/src/multistream/codec/constants.ts +58 -0
- package/src/multistream/mediaRequestManager.ts +117 -76
- package/src/multistream/receiveSlot.ts +18 -0
- package/src/multistream/remoteMediaManager.ts +13 -0
- package/src/multistream/sendSlotManager.ts +97 -3
- package/src/reachability/clusterReachability.ts +3 -2
- package/src/reachability/index.ts +56 -16
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/util.ts +36 -0
- package/src/reactions/reactions.type.ts +4 -0
- package/src/reconnection-manager/index.ts +0 -1
- package/src/recording-controller/index.ts +1 -2
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/index.ts +448 -11
- package/src/webinar/utils.ts +16 -0
- package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
- package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
- package/test/unit/spec/annotation/index.ts +69 -7
- package/test/unit/spec/breakouts/breakout.ts +9 -3
- package/test/unit/spec/breakouts/events.ts +120 -2
- package/test/unit/spec/breakouts/index.ts +191 -2
- package/test/unit/spec/common/errors/webex-errors.ts +78 -0
- package/test/unit/spec/controls-options-manager/index.js +244 -29
- package/test/unit/spec/controls-options-manager/util.js +165 -0
- package/test/unit/spec/hashTree/hashTree.ts +66 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +4528 -171
- package/test/unit/spec/hashTree/utils.ts +125 -1
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +406 -0
- package/test/unit/spec/interceptors/locusRetry.ts +205 -4
- package/test/unit/spec/interceptors/utils.ts +75 -0
- package/test/unit/spec/interpretation/index.ts +26 -4
- package/test/unit/spec/locus-info/controlsUtils.js +200 -56
- package/test/unit/spec/locus-info/index.js +1848 -164
- package/test/unit/spec/locus-info/infoUtils.js +184 -1
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
- package/test/unit/spec/media/index.ts +92 -0
- package/test/unit/spec/media/properties.ts +35 -26
- package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
- package/test/unit/spec/meeting/index.js +3706 -405
- package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
- package/test/unit/spec/meeting/muteState.js +81 -0
- package/test/unit/spec/meeting/request.js +82 -0
- package/test/unit/spec/meeting/utils.js +595 -27
- package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
- package/test/unit/spec/meetings/index.js +1138 -86
- package/test/unit/spec/meetings/request.js +141 -0
- package/test/unit/spec/meetings/utils.js +402 -51
- package/test/unit/spec/member/index.js +35 -4
- package/test/unit/spec/member/util.js +154 -27
- package/test/unit/spec/members/index.js +216 -0
- package/test/unit/spec/members/request.js +37 -1
- package/test/unit/spec/members/utils.js +63 -0
- package/test/unit/spec/multistream/mediaRequestManager.ts +503 -122
- package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
- package/test/unit/spec/reachability/index.ts +151 -46
- package/test/unit/spec/reachability/util.ts +31 -0
- package/test/unit/spec/reconnection-manager/index.js +4 -8
- package/test/unit/spec/recording-controller/index.js +9 -8
- package/test/unit/spec/roap/turnDiscovery.ts +20 -0
- package/test/unit/spec/webinar/index.ts +837 -39
- package/test/unit/spec/webinar/utils.ts +39 -0
package/src/locus-info/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import {isEqual, assignWith, cloneDeep, isEmpty} from 'lodash';
|
|
2
|
+
import uuid from 'uuid';
|
|
3
|
+
import {webexTrackingIdSequenceNumbers} from '@webex/webex-core';
|
|
2
4
|
|
|
3
5
|
import LoggerProxy from '../common/logs/logger-proxy';
|
|
4
6
|
import EventsScope from '../common/events/events-scope';
|
|
@@ -34,13 +36,20 @@ import BEHAVIORAL_METRICS from '../metrics/constants';
|
|
|
34
36
|
import HashTreeParser, {
|
|
35
37
|
DataSet,
|
|
36
38
|
HashTreeMessage,
|
|
39
|
+
LocusInfoUpdate,
|
|
37
40
|
LocusInfoUpdateType,
|
|
41
|
+
Metadata,
|
|
42
|
+
SyncLatencyTracker,
|
|
38
43
|
} from '../hashTree/hashTreeParser';
|
|
39
44
|
import {HashTreeObject, ObjectType, ObjectTypeToLocusKeyMap} from '../hashTree/types';
|
|
40
|
-
import {isSelf} from '../hashTree/utils';
|
|
41
|
-
import {Links, LocusDTO,
|
|
45
|
+
import {isMetadata, isSelf} from '../hashTree/utils';
|
|
46
|
+
import {Links, LocusDTO, ReplacesInfo} from './types';
|
|
47
|
+
import MeetingsUtil from '../meetings/util';
|
|
48
|
+
import {MEETING_KEY} from '../meetings/meetings.types';
|
|
49
|
+
import MeetingCollection from '../meetings/collection';
|
|
42
50
|
|
|
43
51
|
export type LocusLLMEvent = {
|
|
52
|
+
trackingId?: string;
|
|
44
53
|
data: {
|
|
45
54
|
eventType: typeof LOCUSEVENT.HASH_TREE_DATA_UPDATED;
|
|
46
55
|
stateElementsMessage: HashTreeMessage;
|
|
@@ -52,6 +61,7 @@ export type LocusLLMEvent = {
|
|
|
52
61
|
const LocusDtoTopLevelKeys = [
|
|
53
62
|
'controls',
|
|
54
63
|
'fullState',
|
|
64
|
+
'embeddedApps',
|
|
55
65
|
'host',
|
|
56
66
|
'info',
|
|
57
67
|
'links',
|
|
@@ -66,10 +76,13 @@ const LocusDtoTopLevelKeys = [
|
|
|
66
76
|
'htMeta', // only exists when hash trees are used
|
|
67
77
|
];
|
|
68
78
|
|
|
69
|
-
export type LocusApiResponseBody =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
export type LocusApiResponseBody =
|
|
80
|
+
| {
|
|
81
|
+
dataSets?: DataSet[];
|
|
82
|
+
locus: LocusDTO; // this LocusDTO here might not be the full one (for example it won't have all the participants, but it should have self)
|
|
83
|
+
metadata?: Metadata;
|
|
84
|
+
}
|
|
85
|
+
| LocusDTO; // when we invoke APIs on the whole Locus like "mute all" backend returns the whole Locus in the response like this
|
|
73
86
|
|
|
74
87
|
const LocusObjectStateAfterUpdates = {
|
|
75
88
|
unchanged: 'unchanged',
|
|
@@ -79,6 +92,173 @@ const LocusObjectStateAfterUpdates = {
|
|
|
79
92
|
|
|
80
93
|
type LocusObjectStateAfterUpdates = Enum<typeof LocusObjectStateAfterUpdates>;
|
|
81
94
|
|
|
95
|
+
export type HashTreeParserEntry = {
|
|
96
|
+
parser: HashTreeParser;
|
|
97
|
+
replacedAt?: string;
|
|
98
|
+
initializedFromHashTree: boolean;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type LocusInfoCallbacks = {
|
|
102
|
+
updateMeeting: (object: any) => void;
|
|
103
|
+
syncLatencyTracker?: SyncLatencyTracker;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Gets the replacement information
|
|
108
|
+
*
|
|
109
|
+
* @param {any} self - "self" object from Locus DTO
|
|
110
|
+
* @param {string} deviceUrl - The URL of the specified device
|
|
111
|
+
* @returns {any} The replace information if available, otherwise undefined
|
|
112
|
+
*/
|
|
113
|
+
function getReplaceInfoFromSelf(self: any, deviceUrl: string): ReplacesInfo | undefined {
|
|
114
|
+
if (self) {
|
|
115
|
+
const device = MeetingsUtil.getThisDevice({self}, deviceUrl);
|
|
116
|
+
|
|
117
|
+
if (device?.replaces?.length > 0) {
|
|
118
|
+
return device.replaces[0];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Finds a meeting by its locus URL in meeting collection. It checks all HashTreeParsers of all meetings in the collection.
|
|
127
|
+
*
|
|
128
|
+
* @param {MeetingCollection} meetingCollection - The collection of meetings to search
|
|
129
|
+
* @param {string} locusUrl - The locus URL to search for
|
|
130
|
+
* @returns {any} The meeting if found, otherwise undefined
|
|
131
|
+
*/
|
|
132
|
+
function findLocusUrlInAnyHashTreeParser(
|
|
133
|
+
meetingCollection: MeetingCollection,
|
|
134
|
+
locusUrl: string
|
|
135
|
+
): any {
|
|
136
|
+
for (const meeting of Object.values(meetingCollection.getAll()) as any[]) {
|
|
137
|
+
if (meeting?.locusInfo?.hashTreeParsers?.has(locusUrl)) {
|
|
138
|
+
return meeting;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Finds a meeting for a given hash tree message.
|
|
147
|
+
*
|
|
148
|
+
* @param {HashTreeMessage} message - The hash tree message to find the meeting for
|
|
149
|
+
* @param {MeetingCollection} meetingCollection - The collection of meetings to search
|
|
150
|
+
* @returns {any} The meeting if found, otherwise undefined
|
|
151
|
+
*/
|
|
152
|
+
export function findMeetingForHashTreeMessage(
|
|
153
|
+
message: HashTreeMessage | undefined,
|
|
154
|
+
meetingCollection: MeetingCollection
|
|
155
|
+
): any {
|
|
156
|
+
if (!message) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
let foundMeeting = findLocusUrlInAnyHashTreeParser(meetingCollection, message.locusUrl);
|
|
160
|
+
|
|
161
|
+
if (foundMeeting) {
|
|
162
|
+
return foundMeeting;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// if we haven't found anything, it may mean that message has a new locusUrl
|
|
166
|
+
// check if it indicates that it replaces some existing current locusUrl (this is indicated in "self")
|
|
167
|
+
const self = message.locusStateElements?.find((el) => isSelf(el))?.data;
|
|
168
|
+
const replaces = getReplaceInfoFromSelf(self, self?.deviceUrl);
|
|
169
|
+
|
|
170
|
+
if (replaces?.locusUrl) {
|
|
171
|
+
foundMeeting = findLocusUrlInAnyHashTreeParser(meetingCollection, replaces.locusUrl);
|
|
172
|
+
|
|
173
|
+
return foundMeeting;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Creates a locus object from the objects received in a hash tree message. It usually will be
|
|
181
|
+
* incomplete, because hash tree messages only contain the parts of locus that have changed,
|
|
182
|
+
* and some updates come separately over Mercury or LLM in separate messages.
|
|
183
|
+
*
|
|
184
|
+
* @param {HashTreeMessage} message hash tree message to created the locus from
|
|
185
|
+
* @returns {Object} the created locus object and metadata if present
|
|
186
|
+
*/
|
|
187
|
+
export function createLocusFromHashTreeMessage(message: HashTreeMessage): {
|
|
188
|
+
locus: LocusDTO;
|
|
189
|
+
metadata?: Metadata;
|
|
190
|
+
} {
|
|
191
|
+
const locus: LocusDTO = {
|
|
192
|
+
participants: [],
|
|
193
|
+
url: message.locusUrl,
|
|
194
|
+
};
|
|
195
|
+
let metadata: Metadata | undefined;
|
|
196
|
+
|
|
197
|
+
if (!message.locusStateElements) {
|
|
198
|
+
return {locus, metadata};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
for (const element of message.locusStateElements) {
|
|
202
|
+
if (!element.data) {
|
|
203
|
+
// eslint-disable-next-line no-continue
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const type = element.htMeta.elementId.type.toLowerCase();
|
|
208
|
+
|
|
209
|
+
switch (type) {
|
|
210
|
+
case ObjectType.locus: {
|
|
211
|
+
// spread locus object data onto the top level, but remove keys managed by other ObjectTypes
|
|
212
|
+
const locusObjectData = {...element.data};
|
|
213
|
+
|
|
214
|
+
Object.values(ObjectTypeToLocusKeyMap).forEach((locusDtoKey) => {
|
|
215
|
+
delete locusObjectData[locusDtoKey];
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
Object.assign(locus, locusObjectData);
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
case ObjectType.participant:
|
|
222
|
+
locus.participants.push(element.data);
|
|
223
|
+
break;
|
|
224
|
+
case ObjectType.mediaShare:
|
|
225
|
+
if (!locus.mediaShares) {
|
|
226
|
+
locus.mediaShares = [];
|
|
227
|
+
}
|
|
228
|
+
locus.mediaShares.push(element.data);
|
|
229
|
+
break;
|
|
230
|
+
case ObjectType.embeddedApp:
|
|
231
|
+
if (!locus.embeddedApps) {
|
|
232
|
+
locus.embeddedApps = [];
|
|
233
|
+
}
|
|
234
|
+
locus.embeddedApps.push(element.data);
|
|
235
|
+
break;
|
|
236
|
+
case ObjectType.control:
|
|
237
|
+
if (!locus.controls) {
|
|
238
|
+
locus.controls = {};
|
|
239
|
+
}
|
|
240
|
+
Object.assign(locus.controls, element.data);
|
|
241
|
+
break;
|
|
242
|
+
case ObjectType.links:
|
|
243
|
+
case ObjectType.info:
|
|
244
|
+
case ObjectType.fullState:
|
|
245
|
+
case ObjectType.self: {
|
|
246
|
+
const locusDtoKey = ObjectTypeToLocusKeyMap[type];
|
|
247
|
+
locus[locusDtoKey] = element.data;
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
case ObjectType.metadata:
|
|
251
|
+
// metadata is not part of Locus DTO
|
|
252
|
+
metadata = {...element.data, htMeta: element.htMeta} as Metadata;
|
|
253
|
+
break;
|
|
254
|
+
default:
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return {locus, metadata};
|
|
260
|
+
}
|
|
261
|
+
|
|
82
262
|
/**
|
|
83
263
|
* @description LocusInfo extends ChildEmitter to convert locusInfo info a private emitter to parent object
|
|
84
264
|
* @export
|
|
@@ -91,7 +271,6 @@ export default class LocusInfo extends EventsScope {
|
|
|
91
271
|
locusParser: any;
|
|
92
272
|
meetingId: any;
|
|
93
273
|
parsedLocus: any;
|
|
94
|
-
updateMeeting: any;
|
|
95
274
|
webex: any;
|
|
96
275
|
aclUrl: any;
|
|
97
276
|
baseSequence: any;
|
|
@@ -112,28 +291,32 @@ export default class LocusInfo extends EventsScope {
|
|
|
112
291
|
links?: Links;
|
|
113
292
|
mainSessionLocusCache: any;
|
|
114
293
|
self: any;
|
|
115
|
-
|
|
294
|
+
hashTreeParsers: Map<string, HashTreeParserEntry>;
|
|
116
295
|
hashTreeObjectId2ParticipantId: Map<number, string>; // mapping of hash tree object ids to participant ids
|
|
117
296
|
classicVsHashTreeMismatchMetricCounter = 0;
|
|
297
|
+
private callbacks: LocusInfoCallbacks;
|
|
298
|
+
private destroyMeetingSuspended = false;
|
|
118
299
|
|
|
119
300
|
/**
|
|
120
301
|
* Constructor
|
|
121
|
-
* @param {
|
|
302
|
+
* @param {Object} callbacks callbacks used by LocusInfo
|
|
303
|
+
* @param {function} callbacks.updateMeeting callback to update the meeting object from an object
|
|
122
304
|
* @param {object} webex
|
|
123
305
|
* @param {string} meetingId
|
|
124
306
|
* @returns {undefined}
|
|
125
307
|
*/
|
|
126
|
-
constructor(
|
|
308
|
+
constructor(callbacks: LocusInfoCallbacks, webex: any, meetingId: any) {
|
|
127
309
|
super();
|
|
128
310
|
this.parsedLocus = {
|
|
129
311
|
states: [],
|
|
130
312
|
};
|
|
313
|
+
this.callbacks = callbacks;
|
|
131
314
|
this.webex = webex;
|
|
132
315
|
this.emitChange = false;
|
|
133
316
|
this.compareAndUpdateFlags = {};
|
|
134
317
|
this.meetingId = meetingId;
|
|
135
|
-
this.updateMeeting = updateMeeting;
|
|
136
318
|
this.locusParser = new LocusDeltaParser();
|
|
319
|
+
this.hashTreeParsers = new Map();
|
|
137
320
|
this.hashTreeObjectId2ParticipantId = new Map();
|
|
138
321
|
}
|
|
139
322
|
|
|
@@ -239,7 +422,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
239
422
|
'Locus-info:index#doLocusSync --> got full DTO when we asked for delta'
|
|
240
423
|
);
|
|
241
424
|
}
|
|
242
|
-
meeting.locusInfo.onFullLocus(res.body);
|
|
425
|
+
meeting.locusInfo.onFullLocus('classic Locus sync', res.body);
|
|
243
426
|
})
|
|
244
427
|
.catch((e) => {
|
|
245
428
|
LoggerProxy.logger.info(
|
|
@@ -346,7 +529,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
346
529
|
this.updateControls(locus.controls, locus.self);
|
|
347
530
|
this.updateLocusUrl(locus.url, ControlsUtils.isMainSessionDTO(locus));
|
|
348
531
|
this.updateFullState(locus.fullState);
|
|
349
|
-
this.updateMeetingInfo(locus.info);
|
|
532
|
+
this.updateMeetingInfo(locus.info, locus.self);
|
|
350
533
|
this.updateEmbeddedApps(locus.embeddedApps);
|
|
351
534
|
// self and participants generate sipUrl for 1:1 meeting
|
|
352
535
|
this.updateSelf(locus.self);
|
|
@@ -356,28 +539,78 @@ export default class LocusInfo extends EventsScope {
|
|
|
356
539
|
}
|
|
357
540
|
|
|
358
541
|
/**
|
|
359
|
-
* Creates
|
|
360
|
-
* @param {Object}
|
|
361
|
-
* @
|
|
542
|
+
* Creates a HashTreeParser instance for a given locusUrl and stores it in the map.
|
|
543
|
+
* @param {Object} params
|
|
544
|
+
* @param {string} params.locusUrl - the locus URL used as the map key
|
|
545
|
+
* @param {Object} params.initialLocus - initial locus data
|
|
546
|
+
* @param {Object} params.metadata - hash tree metadata
|
|
547
|
+
* @param {string} params.replacedAt - timestamp from Locus indicating when the replacement happened
|
|
548
|
+
* @returns {HashTreeParser} the newly created parser
|
|
362
549
|
*/
|
|
363
550
|
private createHashTreeParser({
|
|
551
|
+
locusUrl,
|
|
364
552
|
initialLocus,
|
|
553
|
+
metadata,
|
|
554
|
+
replacedAt,
|
|
365
555
|
}: {
|
|
556
|
+
locusUrl: string;
|
|
366
557
|
initialLocus: {
|
|
367
558
|
dataSets: Array<DataSet>;
|
|
368
559
|
locus: any;
|
|
369
560
|
};
|
|
370
|
-
|
|
371
|
-
|
|
561
|
+
metadata: Metadata | null;
|
|
562
|
+
replacedAt?: string;
|
|
563
|
+
}): HashTreeParser {
|
|
564
|
+
const parser = new HashTreeParser({
|
|
372
565
|
initialLocus,
|
|
566
|
+
metadata,
|
|
373
567
|
webexRequest: this.webex.request.bind(this.webex),
|
|
374
|
-
|
|
375
|
-
|
|
568
|
+
callbacks: {
|
|
569
|
+
locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
|
|
570
|
+
syncLatencyTracker: this.callbacks.syncLatencyTracker,
|
|
571
|
+
// Reuse webex-core's tracking-id interceptor sequence (exposed publicly via
|
|
572
|
+
// webexTrackingIdSequenceNumbers) so Locus requests share the client's unified
|
|
573
|
+
// ${sessionId}_${sequence} tracking id space instead of minting an unrelated id. Fall
|
|
574
|
+
// back to a uuid on the rare chance the interceptor hasn't issued any request yet (and so
|
|
575
|
+
// isn't in the map). The value is opaque to the metrics layer and is forced onto the
|
|
576
|
+
// /hashtree and /sync request headers.
|
|
577
|
+
generateTrackingId: () => {
|
|
578
|
+
const interceptor = [...webexTrackingIdSequenceNumbers.keys()].find(
|
|
579
|
+
(candidate) => candidate?.webex === this.webex
|
|
580
|
+
);
|
|
581
|
+
|
|
582
|
+
return `${this.webex.sessionId}_${interceptor ? interceptor.sequence : uuid.v4()}`;
|
|
583
|
+
},
|
|
584
|
+
},
|
|
585
|
+
debugId: `HT-${locusUrl.split('/')?.pop()?.substring(0, 4)}`,
|
|
586
|
+
excludedDataSets: this.webex.config.meetings.locus?.excludedDataSets,
|
|
587
|
+
syncLatencyMeetingId: this.meetingId,
|
|
376
588
|
});
|
|
589
|
+
|
|
590
|
+
// When a new HashTreeParser is created, previous one should be stopped.
|
|
591
|
+
// Locus will only be sending us updates for the current one.
|
|
592
|
+
for (const [existingLocusUrl, existingEntry] of this.hashTreeParsers) {
|
|
593
|
+
if (existingEntry.parser.state !== 'stopped') {
|
|
594
|
+
existingEntry.parser.stop();
|
|
595
|
+
if (replacedAt) {
|
|
596
|
+
existingEntry.replacedAt = replacedAt;
|
|
597
|
+
} else {
|
|
598
|
+
LoggerProxy.logger.warn(
|
|
599
|
+
`Locus-info:index#createHashTreeParser --> no replacedAt timestamp provided for new HashTreeParser with locusUrl ${locusUrl}, replacing ${existingLocusUrl}`
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
this.hashTreeParsers.set(locusUrl, {parser, initializedFromHashTree: false});
|
|
606
|
+
this.hashTreeObjectId2ParticipantId.clear();
|
|
607
|
+
|
|
608
|
+
return parser;
|
|
377
609
|
}
|
|
378
610
|
|
|
379
611
|
/**
|
|
380
612
|
* @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
|
|
613
|
+
* @param {Function} [onLocusSynced] - optional callback that will be called at the end of initial setup, when locus info is fully synced. It will be called with the full locus snapshot as an argument (which may be null if we haven't received any full locus DTOs during the initial setup, for example in case we receive only hash tree messages without full locus DTOs)
|
|
381
614
|
* @returns {undefined}
|
|
382
615
|
* @memberof LocusInfo
|
|
383
616
|
*/
|
|
@@ -387,6 +620,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
387
620
|
trigger: 'join-response';
|
|
388
621
|
locus: LocusDTO;
|
|
389
622
|
dataSets?: DataSet[];
|
|
623
|
+
metadata?: Metadata;
|
|
390
624
|
}
|
|
391
625
|
| {
|
|
392
626
|
trigger: 'locus-message';
|
|
@@ -396,46 +630,58 @@ export default class LocusInfo extends EventsScope {
|
|
|
396
630
|
| {
|
|
397
631
|
trigger: 'get-loci-response';
|
|
398
632
|
locus?: LocusDTO;
|
|
399
|
-
}
|
|
633
|
+
},
|
|
634
|
+
onLocusSynced?: (locus: LocusDTO) => void
|
|
400
635
|
) {
|
|
636
|
+
let initialFullLocus: LocusDTO | null = null;
|
|
401
637
|
switch (data.trigger) {
|
|
402
638
|
case 'locus-message':
|
|
403
639
|
if (data.hashTreeMessage) {
|
|
404
|
-
// we need the
|
|
640
|
+
// we need the Metadata object to be in the received message, because it contains visibleDataSets
|
|
405
641
|
// and these are needed to initialize all the hash trees
|
|
406
|
-
const
|
|
642
|
+
const metadataObject = data.hashTreeMessage.locusStateElements?.find((el) =>
|
|
643
|
+
isMetadata(el)
|
|
644
|
+
);
|
|
407
645
|
|
|
408
|
-
if (!
|
|
409
|
-
|
|
410
|
-
|
|
646
|
+
if (!metadataObject?.data?.visibleDataSets) {
|
|
647
|
+
// this is a common case (not an error)
|
|
648
|
+
// it happens for example after we leave the meeting and still get some heartbeats or delayed messages
|
|
649
|
+
LoggerProxy.logger.info(
|
|
650
|
+
`Locus-info:index#initialSetup --> cannot initialize HashTreeParser, Metadata object with visibleDataSets is missing in the message`
|
|
411
651
|
);
|
|
412
652
|
|
|
413
|
-
throw
|
|
653
|
+
// throw so that handleLocusEvent() catches it and destroys the partially created meeting object
|
|
654
|
+
throw new Error('Metadata object with visibleDataSets is missing in the message');
|
|
414
655
|
}
|
|
415
656
|
|
|
416
657
|
LoggerProxy.logger.info(
|
|
417
658
|
'Locus-info:index#initialSetup --> creating HashTreeParser from message'
|
|
418
659
|
);
|
|
419
660
|
// first create the HashTreeParser, but don't initialize it with any data yet
|
|
420
|
-
|
|
421
|
-
|
|
661
|
+
const hashTreeParser = this.createHashTreeParser({
|
|
662
|
+
locusUrl: data.hashTreeMessage.locusUrl,
|
|
422
663
|
initialLocus: {
|
|
423
|
-
locus:
|
|
424
|
-
dataSets:
|
|
664
|
+
locus: null,
|
|
665
|
+
dataSets: data.hashTreeMessage.dataSets,
|
|
666
|
+
},
|
|
667
|
+
metadata: {
|
|
668
|
+
htMeta: metadataObject.htMeta,
|
|
669
|
+
visibleDataSets: metadataObject.data.visibleDataSets,
|
|
425
670
|
},
|
|
426
671
|
});
|
|
427
672
|
|
|
428
673
|
// now handle the message - that should populate all the visible datasets
|
|
429
|
-
await
|
|
674
|
+
await hashTreeParser.initializeFromMessage(data.hashTreeMessage);
|
|
430
675
|
} else {
|
|
431
676
|
// "classic" Locus case, no hash trees involved
|
|
432
677
|
this.updateLocusCache(data.locus);
|
|
433
|
-
this.onFullLocus(data.locus, undefined);
|
|
678
|
+
this.onFullLocus('classic locus message', data.locus, undefined);
|
|
434
679
|
}
|
|
435
680
|
break;
|
|
436
681
|
case 'join-response':
|
|
437
682
|
this.updateLocusCache(data.locus);
|
|
438
|
-
this.onFullLocus(data.locus, undefined, data.dataSets);
|
|
683
|
+
this.onFullLocus('join response', data.locus, undefined, data.dataSets, data.metadata);
|
|
684
|
+
initialFullLocus = data.locus;
|
|
439
685
|
break;
|
|
440
686
|
case 'get-loci-response':
|
|
441
687
|
if (data.locus?.links?.resources?.visibleDataSets?.url) {
|
|
@@ -443,61 +689,117 @@ export default class LocusInfo extends EventsScope {
|
|
|
443
689
|
'Locus-info:index#initialSetup --> creating HashTreeParser from get-loci-response'
|
|
444
690
|
);
|
|
445
691
|
// first create the HashTreeParser, but don't initialize it with any data yet
|
|
446
|
-
|
|
447
|
-
|
|
692
|
+
const hashTreeParser = this.createHashTreeParser({
|
|
693
|
+
locusUrl: data.locus.url as string,
|
|
448
694
|
initialLocus: {
|
|
449
|
-
locus:
|
|
695
|
+
locus: null,
|
|
450
696
|
dataSets: [], // empty, because we don't have them yet
|
|
451
697
|
},
|
|
698
|
+
metadata: null, // get-loci-response doesn't contain Metadata object
|
|
452
699
|
});
|
|
453
700
|
|
|
454
701
|
// now initialize all the data
|
|
455
|
-
await
|
|
702
|
+
await hashTreeParser.initializeFromGetLociResponse(data.locus);
|
|
456
703
|
} else {
|
|
457
704
|
// "classic" Locus case, no hash trees involved
|
|
458
705
|
this.updateLocusCache(data.locus);
|
|
459
|
-
this.onFullLocus(data.locus, undefined);
|
|
706
|
+
this.onFullLocus('classic get-loci-response', data.locus, undefined);
|
|
707
|
+
initialFullLocus = data.locus || null;
|
|
460
708
|
}
|
|
461
709
|
}
|
|
710
|
+
|
|
711
|
+
if (onLocusSynced) {
|
|
712
|
+
try {
|
|
713
|
+
onLocusSynced(initialFullLocus || this.getCurrentLocusSnapshot());
|
|
714
|
+
} catch (error) {
|
|
715
|
+
LoggerProxy.logger.warn(
|
|
716
|
+
`Locus-info:index#initialSetup --> onLocusSynced callback failed: ${error}`
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
462
721
|
// Change it to true after it receives it first locus object
|
|
463
722
|
this.emitChange = true;
|
|
464
723
|
}
|
|
465
724
|
|
|
725
|
+
/**
|
|
726
|
+
* Builds a full locus DTO snapshot from current internal locus state.
|
|
727
|
+
*
|
|
728
|
+
* @returns {LocusDTO}
|
|
729
|
+
*/
|
|
730
|
+
private getCurrentLocusSnapshot(): LocusDTO {
|
|
731
|
+
const locus: Record<string, any> = {};
|
|
732
|
+
|
|
733
|
+
LocusDtoTopLevelKeys.forEach((key) => {
|
|
734
|
+
const value = (this as Record<string, any>)[key];
|
|
735
|
+
|
|
736
|
+
if (value !== undefined && value !== null) {
|
|
737
|
+
locus[key] = cloneDeep(value);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
if (!Array.isArray(locus.participants)) {
|
|
742
|
+
locus.participants = [];
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
return locus as LocusDTO;
|
|
746
|
+
}
|
|
747
|
+
|
|
466
748
|
/**
|
|
467
749
|
* Handles HTTP response from Locus API call.
|
|
468
750
|
* @param {Meeting} meeting meeting object
|
|
469
751
|
* @param {LocusApiResponseBody} responseBody body of the http response from Locus API call
|
|
470
752
|
* @returns {void}
|
|
471
753
|
*/
|
|
472
|
-
handleLocusAPIResponse(meeting, responseBody: LocusApiResponseBody): void {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
754
|
+
handleLocusAPIResponse(meeting: any, responseBody: LocusApiResponseBody): void {
|
|
755
|
+
const isWrapped = 'locus' in responseBody;
|
|
756
|
+
const locusUrl = isWrapped ? responseBody.locus?.url : responseBody.url;
|
|
757
|
+
const hashTreeParserEntry = locusUrl && this.hashTreeParsers.get(locusUrl);
|
|
758
|
+
const locus = isWrapped
|
|
759
|
+
? (responseBody as {locus: LocusDTO}).locus
|
|
760
|
+
: (responseBody as LocusDTO);
|
|
761
|
+
|
|
762
|
+
if (this.hashTreeParsers.size > 0) {
|
|
763
|
+
// We are in hash tree mode. Check if we need to create/reactivate a parser for this locusUrl.
|
|
764
|
+
if (!hashTreeParserEntry || hashTreeParserEntry.parser.state === 'stopped') {
|
|
765
|
+
if (!locusUrl) {
|
|
766
|
+
LoggerProxy.logger.warn(
|
|
767
|
+
'Locus-info:index#handleLocusAPIResponse --> API response has no locusUrl, cannot handle hash tree parser switch'
|
|
768
|
+
);
|
|
769
|
+
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
this.handleHashTreeParserSwitchForAPIResponse(locusUrl, locus);
|
|
774
|
+
|
|
775
|
+
return;
|
|
480
776
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
this.sendClassicVsHashTreeMismatchMetric(
|
|
490
|
-
meeting,
|
|
491
|
-
`unexpected hash tree dataSets in API response`
|
|
492
|
-
);
|
|
777
|
+
|
|
778
|
+
// Active parser found - pass the API response to it
|
|
779
|
+
if (isWrapped) {
|
|
780
|
+
// update the data in our hash trees
|
|
781
|
+
hashTreeParserEntry.parser.handleLocusUpdate(responseBody);
|
|
782
|
+
} else {
|
|
783
|
+
// LocusDTO without wrapper - pass it through as if it had no dataSets nor metadata
|
|
784
|
+
hashTreeParserEntry.parser.handleLocusUpdate({locus: responseBody});
|
|
493
785
|
}
|
|
494
|
-
|
|
495
|
-
|
|
786
|
+
|
|
787
|
+
return;
|
|
496
788
|
}
|
|
789
|
+
|
|
790
|
+
// No hash tree parsers - classic Locus mode
|
|
791
|
+
if (isWrapped && responseBody.dataSets) {
|
|
792
|
+
this.sendClassicVsHashTreeMismatchMetric(
|
|
793
|
+
meeting,
|
|
794
|
+
`unexpected hash tree dataSets in API response`
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// classic Locus delta
|
|
799
|
+
this.handleLocusDelta(locus, meeting);
|
|
497
800
|
}
|
|
498
801
|
|
|
499
802
|
/**
|
|
500
|
-
*
|
|
501
803
|
* @param {HashTreeObject} object data set object
|
|
502
804
|
* @param {any} locus
|
|
503
805
|
* @returns {void}
|
|
@@ -571,6 +873,31 @@ export default class LocusInfo extends EventsScope {
|
|
|
571
873
|
);
|
|
572
874
|
}
|
|
573
875
|
break;
|
|
876
|
+
case ObjectType.embeddedApp:
|
|
877
|
+
if (object.data) {
|
|
878
|
+
LoggerProxy.logger.info(
|
|
879
|
+
`Locus-info:index#updateLocusFromHashTreeObject --> embeddedApp id=${object.htMeta.elementId.id} url='${object.data.url}' updated version=${object.htMeta.elementId.version}:`,
|
|
880
|
+
object.data
|
|
881
|
+
);
|
|
882
|
+
const existingEmbeddedApp = locus.embeddedApps?.find(
|
|
883
|
+
(ms) => ms.htMeta.elementId.id === object.htMeta.elementId.id
|
|
884
|
+
);
|
|
885
|
+
|
|
886
|
+
if (existingEmbeddedApp) {
|
|
887
|
+
Object.assign(existingEmbeddedApp, object.data);
|
|
888
|
+
} else {
|
|
889
|
+
locus.embeddedApps = locus.embeddedApps || [];
|
|
890
|
+
locus.embeddedApps.push(object.data);
|
|
891
|
+
}
|
|
892
|
+
} else {
|
|
893
|
+
LoggerProxy.logger.info(
|
|
894
|
+
`Locus-info:index#updateLocusFromHashTreeObject --> embeddedApp id=${object.htMeta.elementId.id} removed, version=${object.htMeta.elementId.version}`
|
|
895
|
+
);
|
|
896
|
+
locus.embeddedApps = locus.embeddedApps?.filter(
|
|
897
|
+
(ms) => ms.htMeta.elementId.id !== object.htMeta.elementId.id
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
break;
|
|
574
901
|
case ObjectType.participant:
|
|
575
902
|
LoggerProxy.logger.info(
|
|
576
903
|
`Locus-info:index#updateLocusFromHashTreeObject --> participant id=${
|
|
@@ -588,6 +915,23 @@ export default class LocusInfo extends EventsScope {
|
|
|
588
915
|
locus.jsSdkMeta.removedParticipantIds.push(participantId);
|
|
589
916
|
this.hashTreeObjectId2ParticipantId.delete(object.htMeta.elementId.id);
|
|
590
917
|
}
|
|
918
|
+
// Create self from the participant if it matches self identity and is being moved.
|
|
919
|
+
// We need this, because participant update comes in LLM message often before the self update from Mercury.
|
|
920
|
+
// Other parts of the code detect move only by looking at self, while some other parts of the SDK/webapp code
|
|
921
|
+
// look at participant for roles etc, so if participant is updated but not self, then it looks like we our lost roles temporarily
|
|
922
|
+
// (until self is updated)
|
|
923
|
+
// This will be fixed properly in SPARK-790239
|
|
924
|
+
if (
|
|
925
|
+
object.data &&
|
|
926
|
+
object.data.identity === locus.self?.identity &&
|
|
927
|
+
object.data.state === 'LEFT' &&
|
|
928
|
+
object.data.reason === 'MOVED'
|
|
929
|
+
) {
|
|
930
|
+
LoggerProxy.logger.info(
|
|
931
|
+
`Locus-info:index#updateLocusFromHashTreeObject --> FOUND a match for MOVED self in participant object ${object.htMeta.elementId.id}`
|
|
932
|
+
);
|
|
933
|
+
Object.assign(locus[ObjectTypeToLocusKeyMap[ObjectType.self]], object.data);
|
|
934
|
+
}
|
|
591
935
|
break;
|
|
592
936
|
case ObjectType.control:
|
|
593
937
|
if (object.data) {
|
|
@@ -614,14 +958,22 @@ export default class LocusInfo extends EventsScope {
|
|
|
614
958
|
if (!object.data) {
|
|
615
959
|
// self without data is handled inside HashTreeParser and results in LocusInfoUpdateType.MEETING_ENDED, so we should never get here
|
|
616
960
|
// all other types info, fullstate, etc - Locus should never send them without data
|
|
617
|
-
|
|
618
|
-
|
|
961
|
+
// but we end up with this method being called without the data for them when the main dataset is removed from visible datasets list
|
|
962
|
+
LoggerProxy.logger.info(
|
|
963
|
+
`Locus-info:index#updateLocusFromHashTreeObject --> received ${type} object without data, version=${object.htMeta.elementId.version}`
|
|
619
964
|
);
|
|
620
965
|
} else {
|
|
621
966
|
LoggerProxy.logger.info(
|
|
622
967
|
`Locus-info:index#updateLocusFromHashTreeObject --> ${type} object updated to version ${object.htMeta.elementId.version}`
|
|
623
968
|
);
|
|
624
|
-
|
|
969
|
+
|
|
970
|
+
if (type === ObjectType.self) {
|
|
971
|
+
LoggerProxy.logger.info(
|
|
972
|
+
`Locus-info:index#updateLocusFromHashTreeObject --> self data: removed=${object.data.removed} state=${object.data.state} reason=${object.data.reason}`
|
|
973
|
+
);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
const locusDtoKey = ObjectTypeToLocusKeyMap[type] as keyof LocusDTO;
|
|
625
977
|
locus[locusDtoKey] = object.data;
|
|
626
978
|
|
|
627
979
|
/* Hash tree based webinar attendees don't receive a Participant object for themselves from Locus,
|
|
@@ -643,6 +995,12 @@ export default class LocusInfo extends EventsScope {
|
|
|
643
995
|
}
|
|
644
996
|
}
|
|
645
997
|
break;
|
|
998
|
+
case ObjectType.metadata:
|
|
999
|
+
LoggerProxy.logger.info(
|
|
1000
|
+
`Locus-info:index#updateLocusFromHashTreeObject --> metadata object updated to version ${object.htMeta.elementId.version}`
|
|
1001
|
+
);
|
|
1002
|
+
// we don't use hash tree metadata right now for anything, it's mainly used internally by HashTreeParser
|
|
1003
|
+
break;
|
|
646
1004
|
default:
|
|
647
1005
|
LoggerProxy.logger.warn(
|
|
648
1006
|
`Locus-info:index#updateLocusFromHashTreeObject --> received unsupported object type ${type}`
|
|
@@ -675,6 +1033,176 @@ export default class LocusInfo extends EventsScope {
|
|
|
675
1033
|
}
|
|
676
1034
|
}
|
|
677
1035
|
|
|
1036
|
+
/**
|
|
1037
|
+
* Helper that handles the common logic for reactivating a stopped HashTreeParser when
|
|
1038
|
+
* a newer "replaces" is detected. Used by both the message and API response parser switch methods.
|
|
1039
|
+
*
|
|
1040
|
+
* @param {string} callerName - name of the calling method, used in log messages
|
|
1041
|
+
* @param {string} locusUrl - the locus URL of the stopped parser
|
|
1042
|
+
* @param {HashTreeParserEntry} stoppedEntry - the stopped parser entry
|
|
1043
|
+
* @param {ReplacesInfo} replaces - replacement info extracted from self
|
|
1044
|
+
* @param {Function} resumeCallback - callback to invoke after reactivation to resume the parser
|
|
1045
|
+
* @returns {void}
|
|
1046
|
+
*/
|
|
1047
|
+
private resumeStoppedParser(
|
|
1048
|
+
callerName: string,
|
|
1049
|
+
locusUrl: string,
|
|
1050
|
+
stoppedEntry: HashTreeParserEntry,
|
|
1051
|
+
replaces: ReplacesInfo | undefined,
|
|
1052
|
+
resumeCallback: () => void
|
|
1053
|
+
): void {
|
|
1054
|
+
// this check is just for typescript, it should never happen, replaces should always be defined
|
|
1055
|
+
if (!replaces) {
|
|
1056
|
+
LoggerProxy.logger.info(
|
|
1057
|
+
`Locus-info:index#${callerName} --> received data for stopped HashTreeParser with locusUrl ${locusUrl}, but no replaces info provided, so not re-activating the parser`
|
|
1058
|
+
);
|
|
1059
|
+
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
if (replaces.replacedAt <= (stoppedEntry.replacedAt || '')) {
|
|
1064
|
+
LoggerProxy.logger.info(
|
|
1065
|
+
`Locus-info:index#${callerName} --> received data for stopped HashTreeParser with locusUrl ${locusUrl}, but replaces info provided is not newer, so not re-activating the parser`
|
|
1066
|
+
);
|
|
1067
|
+
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
LoggerProxy.logger.info(
|
|
1072
|
+
`Locus-info:index#${callerName} --> reactivating HashTreeParser for locusUrl=${locusUrl}, which replaces ${replaces.locusUrl}`
|
|
1073
|
+
);
|
|
1074
|
+
|
|
1075
|
+
const replacedEntry = this.hashTreeParsers.get(replaces.locusUrl);
|
|
1076
|
+
|
|
1077
|
+
if (replacedEntry) {
|
|
1078
|
+
replacedEntry.replacedAt = replaces.replacedAt;
|
|
1079
|
+
replacedEntry.parser.stop();
|
|
1080
|
+
} else {
|
|
1081
|
+
LoggerProxy.logger.warn(
|
|
1082
|
+
`Locus-info:index#${callerName} --> the parser that is supposed to be replaced with the currently reactivated parser is not found, locusUrl=${replaces.locusUrl}`
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
stoppedEntry.initializedFromHashTree = false;
|
|
1087
|
+
this.hashTreeObjectId2ParticipantId.clear();
|
|
1088
|
+
|
|
1089
|
+
resumeCallback();
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Handles an API response whose locusUrl doesn't match any active HashTreeParser
|
|
1094
|
+
* (either no entry exists, or the existing entry is stopped).
|
|
1095
|
+
* Creates a new parser or reactivates a stopped one using initializeFromGetLociResponse.
|
|
1096
|
+
*
|
|
1097
|
+
* @param {string} locusUrl - the locus URL from the API response
|
|
1098
|
+
* @param {LocusDTO} locus - the locus DTO from the API response
|
|
1099
|
+
* @returns {void}
|
|
1100
|
+
*/
|
|
1101
|
+
private handleHashTreeParserSwitchForAPIResponse(locusUrl: string, locus: LocusDTO): void {
|
|
1102
|
+
const entry = this.hashTreeParsers.get(locusUrl);
|
|
1103
|
+
|
|
1104
|
+
const replaces = getReplaceInfoFromSelf(
|
|
1105
|
+
locus.self,
|
|
1106
|
+
// @ts-ignore
|
|
1107
|
+
this.webex.internal.device.url
|
|
1108
|
+
);
|
|
1109
|
+
|
|
1110
|
+
if (!entry) {
|
|
1111
|
+
LoggerProxy.logger.info(
|
|
1112
|
+
`Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> no parser for locusUrl ${locusUrl}, creating a new one`
|
|
1113
|
+
);
|
|
1114
|
+
|
|
1115
|
+
const parser = this.createHashTreeParser({
|
|
1116
|
+
locusUrl,
|
|
1117
|
+
initialLocus: {locus: null, dataSets: []},
|
|
1118
|
+
metadata: null,
|
|
1119
|
+
replacedAt: replaces?.replacedAt,
|
|
1120
|
+
});
|
|
1121
|
+
|
|
1122
|
+
parser.initializeFromGetLociResponse(locus);
|
|
1123
|
+
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
if (entry.parser.state !== 'stopped') {
|
|
1128
|
+
LoggerProxy.logger.warn(
|
|
1129
|
+
`Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> unexpected parser state "${entry.parser.state}" for locusUrl ${locusUrl}`
|
|
1130
|
+
);
|
|
1131
|
+
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
this.resumeStoppedParser(
|
|
1136
|
+
'handleHashTreeParserSwitchForAPIResponse',
|
|
1137
|
+
locusUrl,
|
|
1138
|
+
entry,
|
|
1139
|
+
replaces,
|
|
1140
|
+
() => entry.parser.resumeFromApiResponse(locus)
|
|
1141
|
+
);
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Checks if the hash tree message should trigger a switch to a different HashTreeParser
|
|
1146
|
+
*
|
|
1147
|
+
* @param {HashTreeMessage} message incoming hash tree message
|
|
1148
|
+
* @returns {boolean} true if the message was handled as a parser switch, false otherwise
|
|
1149
|
+
*/
|
|
1150
|
+
private handleHashTreeParserSwitch(message: HashTreeMessage): boolean {
|
|
1151
|
+
const entry = this.hashTreeParsers.get(message.locusUrl);
|
|
1152
|
+
|
|
1153
|
+
const self = message.locusStateElements?.find((el) => isSelf(el))?.data;
|
|
1154
|
+
const replaces = getReplaceInfoFromSelf(
|
|
1155
|
+
self,
|
|
1156
|
+
// @ts-ignore
|
|
1157
|
+
this.webex.internal.device.url
|
|
1158
|
+
);
|
|
1159
|
+
|
|
1160
|
+
if (!entry) {
|
|
1161
|
+
// Metadata object that contains information about visible datasets is needed to initialize the HashTreeParser,
|
|
1162
|
+
// but it's buried inside the message, we need to find it and pass it to HashTreeParser constructor
|
|
1163
|
+
const metadata = message.locusStateElements?.find((el) => isMetadata(el));
|
|
1164
|
+
|
|
1165
|
+
if (metadata && metadata.data?.visibleDataSets?.length > 0) {
|
|
1166
|
+
LoggerProxy.logger.info(
|
|
1167
|
+
`Locus-info:index#handleHashTreeParserSwitch --> no hash tree parser found for locusUrl ${message.locusUrl}, creating a new one`
|
|
1168
|
+
);
|
|
1169
|
+
|
|
1170
|
+
const parser = this.createHashTreeParser({
|
|
1171
|
+
locusUrl: message.locusUrl,
|
|
1172
|
+
initialLocus: {
|
|
1173
|
+
locus: null,
|
|
1174
|
+
dataSets: message.dataSets,
|
|
1175
|
+
},
|
|
1176
|
+
metadata: {
|
|
1177
|
+
htMeta: metadata.htMeta,
|
|
1178
|
+
visibleDataSets: metadata.data.visibleDataSets,
|
|
1179
|
+
},
|
|
1180
|
+
replacedAt: replaces?.replacedAt,
|
|
1181
|
+
});
|
|
1182
|
+
|
|
1183
|
+
// handle the message with the new parser
|
|
1184
|
+
parser.handleMessage(message);
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
return true;
|
|
1188
|
+
}
|
|
1189
|
+
if (entry.parser.state === 'stopped') {
|
|
1190
|
+
// the message matches a stopped parser, we need to check if maybe this is a new "replacement" and we need to re-activate the parser
|
|
1191
|
+
// this happens when you move from breakout A -> breakout B -> back to breakout A
|
|
1192
|
+
this.resumeStoppedParser(
|
|
1193
|
+
'handleHashTreeParserSwitch',
|
|
1194
|
+
message.locusUrl,
|
|
1195
|
+
entry,
|
|
1196
|
+
replaces,
|
|
1197
|
+
() => entry.parser.resumeFromMessage(message)
|
|
1198
|
+
);
|
|
1199
|
+
|
|
1200
|
+
return true;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
return false;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
678
1206
|
/**
|
|
679
1207
|
* Handles a hash tree message received from Locus.
|
|
680
1208
|
*
|
|
@@ -693,33 +1221,61 @@ export default class LocusInfo extends EventsScope {
|
|
|
693
1221
|
return;
|
|
694
1222
|
}
|
|
695
1223
|
|
|
696
|
-
this.
|
|
1224
|
+
const parserSwitched = this.handleHashTreeParserSwitch(message);
|
|
1225
|
+
|
|
1226
|
+
if (parserSwitched) {
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
const entry = this.hashTreeParsers.get(message.locusUrl);
|
|
1231
|
+
|
|
1232
|
+
// the check is just for typescript, the case of no entry in hashTreeParsers is handled in handleHashTreeParserSwitch() above
|
|
1233
|
+
if (entry) {
|
|
1234
|
+
entry.parser.handleMessage(message);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* Triggers a sync of all hash tree datasets for all hash tree parsers associated with this meeting.
|
|
1240
|
+
* The syncs are executed sequentially within each parser.
|
|
1241
|
+
*
|
|
1242
|
+
* @param {Object} [options={}] - Options for syncing
|
|
1243
|
+
* @param {boolean} [options.onlyLLM=false] - Whether to sync only LLM based data sets
|
|
1244
|
+
* @returns {Promise<void>}
|
|
1245
|
+
*/
|
|
1246
|
+
async syncAllHashTreeDatasets(options: {onlyLLM?: boolean} = {}): Promise<void> {
|
|
1247
|
+
for (const [, entry] of this.hashTreeParsers) {
|
|
1248
|
+
if (entry.parser) {
|
|
1249
|
+
// eslint-disable-next-line no-await-in-loop
|
|
1250
|
+
await entry.parser.syncAllDatasets(options);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
697
1253
|
}
|
|
698
1254
|
|
|
699
1255
|
/**
|
|
700
1256
|
* Callback registered with HashTreeParser to receive locus info updates.
|
|
701
1257
|
* Updates our locus info based on the data parsed by the hash tree parser.
|
|
702
1258
|
*
|
|
703
|
-
* @param {
|
|
704
|
-
* @param {
|
|
1259
|
+
* @param {string} locusUrl - the locus URL for which the update is received
|
|
1260
|
+
* @param {LocusInfoUpdate} update - Details about the update.
|
|
705
1261
|
* @returns {void}
|
|
706
1262
|
*/
|
|
707
|
-
private updateFromHashTree(
|
|
708
|
-
updateType
|
|
709
|
-
data?: {updatedObjects: HashTreeObject[]}
|
|
710
|
-
) {
|
|
711
|
-
switch (updateType) {
|
|
1263
|
+
private updateFromHashTree(locusUrl: string, update: LocusInfoUpdate) {
|
|
1264
|
+
switch (update.updateType) {
|
|
712
1265
|
case LocusInfoUpdateType.OBJECTS_UPDATED: {
|
|
713
1266
|
// initialize our new locus
|
|
714
1267
|
let locus: LocusDTO = {
|
|
715
1268
|
participants: [],
|
|
716
|
-
jsSdkMeta: {
|
|
1269
|
+
jsSdkMeta: {
|
|
1270
|
+
removedParticipantIds: [],
|
|
1271
|
+
forceReplaceMembers: false,
|
|
1272
|
+
},
|
|
717
1273
|
};
|
|
718
1274
|
|
|
719
1275
|
// first go over all the updates and check what happens with the main locus object
|
|
720
1276
|
let locusObjectStateAfterUpdates: LocusObjectStateAfterUpdates =
|
|
721
1277
|
LocusObjectStateAfterUpdates.unchanged;
|
|
722
|
-
|
|
1278
|
+
update.updatedObjects.forEach((object) => {
|
|
723
1279
|
if (object.htMeta.elementId.type.toLowerCase() === ObjectType.locus) {
|
|
724
1280
|
if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.updated) {
|
|
725
1281
|
// this code doesn't supported it right now,
|
|
@@ -746,19 +1302,39 @@ export default class LocusInfo extends EventsScope {
|
|
|
746
1302
|
}
|
|
747
1303
|
});
|
|
748
1304
|
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
1305
|
+
const hashTreeParserEntry = this.hashTreeParsers.get(locusUrl);
|
|
1306
|
+
|
|
1307
|
+
if (!hashTreeParserEntry) {
|
|
1308
|
+
LoggerProxy.logger.warn(
|
|
1309
|
+
`Locus-info:index#updateFromHashTree --> no HashTreeParser found for locusUrl ${locusUrl} when trying to apply updates from hash tree`
|
|
1310
|
+
);
|
|
1311
|
+
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
if (!hashTreeParserEntry.initializedFromHashTree) {
|
|
1316
|
+
// this is the first time we're getting an update for this locusUrl,
|
|
1317
|
+
// so it's probably a move to/from breakout. We need to start from a clean state,
|
|
1318
|
+
// so empty locus and we rely on Locus giving us sufficient data in the updates to populate it.
|
|
1319
|
+
LoggerProxy.logger.info(
|
|
1320
|
+
`Locus-info:index#updateFromHashTree --> first INITIAL update for locusUrl ${locusUrl}, starting from empty state`
|
|
1321
|
+
);
|
|
1322
|
+
hashTreeParserEntry.initializedFromHashTree = true;
|
|
1323
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1324
|
+
locus.jsSdkMeta!.forceReplaceMembers = true;
|
|
1325
|
+
} else if (
|
|
1326
|
+
// if Locus object is unchanged or removed, we need to keep using the existing locus
|
|
1327
|
+
// because the rest of the locusInfo code expects locus to always be present (with at least some of the fields)
|
|
1328
|
+
// if it gets updated, we only need to have the fields that are not part of "locus" object (like "info" or "mediaShares")
|
|
1329
|
+
// so that when Locus object gets updated, if the new one is missing some field, that field will
|
|
1330
|
+
// be removed from our locusInfo
|
|
755
1331
|
locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.unchanged ||
|
|
756
1332
|
locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.removed
|
|
757
1333
|
) {
|
|
758
1334
|
// copy over all of existing locus except participants
|
|
759
1335
|
LocusDtoTopLevelKeys.forEach((key) => {
|
|
760
1336
|
if (key !== 'participants') {
|
|
761
|
-
locus[key] = cloneDeep(this[key]);
|
|
1337
|
+
(locus as Record<string, any>)[key] = cloneDeep((this as Record<string, any>)[key]);
|
|
762
1338
|
}
|
|
763
1339
|
});
|
|
764
1340
|
} else {
|
|
@@ -766,14 +1342,16 @@ export default class LocusInfo extends EventsScope {
|
|
|
766
1342
|
// (except participants, which need to stay empty - that means "no participant changes")
|
|
767
1343
|
Object.values(ObjectTypeToLocusKeyMap).forEach((locusDtoKey) => {
|
|
768
1344
|
if (locusDtoKey !== 'participants') {
|
|
769
|
-
locus[locusDtoKey] = cloneDeep(
|
|
1345
|
+
(locus as Record<string, any>)[locusDtoKey] = cloneDeep(
|
|
1346
|
+
(this as Record<string, any>)[locusDtoKey]
|
|
1347
|
+
);
|
|
770
1348
|
}
|
|
771
1349
|
});
|
|
772
1350
|
}
|
|
773
1351
|
|
|
774
1352
|
LoggerProxy.logger.info(
|
|
775
1353
|
`Locus-info:index#updateFromHashTree --> LOCUS object is ${locusObjectStateAfterUpdates}, all updates: ${JSON.stringify(
|
|
776
|
-
|
|
1354
|
+
update.updatedObjects.map((o) => ({
|
|
777
1355
|
type: o.htMeta.elementId.type,
|
|
778
1356
|
id: o.htMeta.elementId.id,
|
|
779
1357
|
hasData: !!o.data,
|
|
@@ -781,7 +1359,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
781
1359
|
)}`
|
|
782
1360
|
);
|
|
783
1361
|
// now apply all the updates from the hash tree onto the locus
|
|
784
|
-
|
|
1362
|
+
update.updatedObjects.forEach((object) => {
|
|
785
1363
|
locus = this.updateLocusFromHashTreeObject(object, locus);
|
|
786
1364
|
});
|
|
787
1365
|
|
|
@@ -792,11 +1370,29 @@ export default class LocusInfo extends EventsScope {
|
|
|
792
1370
|
}
|
|
793
1371
|
|
|
794
1372
|
case LocusInfoUpdateType.MEETING_ENDED: {
|
|
1373
|
+
const meeting = this.webex.meetings.meetingCollection.get(this.meetingId);
|
|
1374
|
+
|
|
1375
|
+
if (meeting) {
|
|
1376
|
+
LoggerProxy.logger.info(
|
|
1377
|
+
`Locus-info:index#updateFromHashTree --> received signal that meeting ended, destroying meeting ${this.meetingId}`
|
|
1378
|
+
);
|
|
1379
|
+
this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.SELF_REMOVED);
|
|
1380
|
+
}
|
|
1381
|
+
break;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
case LocusInfoUpdateType.LOCUS_NOT_FOUND: {
|
|
795
1385
|
LoggerProxy.logger.info(
|
|
796
|
-
`Locus-info:index#updateFromHashTree --> received
|
|
1386
|
+
`Locus-info:index#updateFromHashTree --> received LOCUS_NOT_FOUND for ${locusUrl}, triggering syncMeetings`
|
|
797
1387
|
);
|
|
798
|
-
|
|
799
|
-
|
|
1388
|
+
this.webex.meetings
|
|
1389
|
+
.syncMeetings({keepOnlyLocusMeetings: false, skipHashTreeSync: true})
|
|
1390
|
+
.catch((syncError) => {
|
|
1391
|
+
LoggerProxy.logger.error(
|
|
1392
|
+
`Locus-info:index#updateFromHashTree --> syncMeetings failed after LOCUS_NOT_FOUND: ${syncError}`
|
|
1393
|
+
);
|
|
1394
|
+
});
|
|
1395
|
+
break;
|
|
800
1396
|
}
|
|
801
1397
|
}
|
|
802
1398
|
}
|
|
@@ -808,15 +1404,31 @@ export default class LocusInfo extends EventsScope {
|
|
|
808
1404
|
* @memberof LocusInfo
|
|
809
1405
|
*/
|
|
810
1406
|
parse(meeting: any, data: any) {
|
|
811
|
-
if (this.
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
data.
|
|
816
|
-
|
|
1407
|
+
if (this.hashTreeParsers.size > 0) {
|
|
1408
|
+
if (data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS) {
|
|
1409
|
+
// sync meetings response follows the format of "not wrapped" locus API responses,
|
|
1410
|
+
// so has no dataSets nor Metadata
|
|
1411
|
+
this.handleLocusAPIResponse(meeting, {...data.locus});
|
|
1412
|
+
} else {
|
|
1413
|
+
this.handleHashTreeMessage(
|
|
1414
|
+
meeting,
|
|
1415
|
+
data.eventType,
|
|
1416
|
+
data.stateElementsMessage as HashTreeMessage
|
|
1417
|
+
);
|
|
1418
|
+
}
|
|
817
1419
|
} else {
|
|
818
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
819
1420
|
const {eventType} = data;
|
|
1421
|
+
|
|
1422
|
+
if (eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
|
|
1423
|
+
// this can happen when we get an event before join http response
|
|
1424
|
+
// it's OK to just ignore it
|
|
1425
|
+
LoggerProxy.logger.info(
|
|
1426
|
+
`Locus-info:index#parse --> received locus hash tree event before hashTreeParser is created`
|
|
1427
|
+
);
|
|
1428
|
+
|
|
1429
|
+
return;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
820
1432
|
const locus = this.getTheLocusToUpdate(data.locus);
|
|
821
1433
|
LoggerProxy.logger.info(`Locus-info:index#parse --> received locus data: ${eventType}`);
|
|
822
1434
|
|
|
@@ -837,17 +1449,11 @@ export default class LocusInfo extends EventsScope {
|
|
|
837
1449
|
case LOCUSEVENT.PARTICIPANT_DECLINED:
|
|
838
1450
|
case LOCUSEVENT.FLOOR_GRANTED:
|
|
839
1451
|
case LOCUSEVENT.FLOOR_RELEASED:
|
|
840
|
-
this.onFullLocus(locus, eventType);
|
|
1452
|
+
this.onFullLocus(`classic locus event ${eventType}`, locus, eventType);
|
|
841
1453
|
break;
|
|
842
1454
|
case LOCUSEVENT.DIFFERENCE:
|
|
843
1455
|
this.handleLocusDelta(locus, meeting);
|
|
844
1456
|
break;
|
|
845
|
-
case LOCUSEVENT.HASH_TREE_DATA_UPDATED:
|
|
846
|
-
this.sendClassicVsHashTreeMismatchMetric(
|
|
847
|
-
meeting,
|
|
848
|
-
`got ${eventType}, expected classic events`
|
|
849
|
-
);
|
|
850
|
-
break;
|
|
851
1457
|
|
|
852
1458
|
default:
|
|
853
1459
|
// Why will there be a event with no eventType ????
|
|
@@ -871,46 +1477,64 @@ export default class LocusInfo extends EventsScope {
|
|
|
871
1477
|
/**
|
|
872
1478
|
* Function for handling full locus when it's using hash trees (so not the "classic" one).
|
|
873
1479
|
*
|
|
1480
|
+
* @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
|
|
874
1481
|
* @param {object} locus locus object
|
|
875
|
-
* @param {
|
|
1482
|
+
* @param {object} metadata locus hash trees metadata
|
|
876
1483
|
* @param {DataSet[]} dataSets
|
|
1484
|
+
* @param {string} eventType locus event
|
|
877
1485
|
* @returns {void}
|
|
878
1486
|
*/
|
|
879
|
-
private onFullLocusWithHashTrees(
|
|
880
|
-
|
|
881
|
-
|
|
1487
|
+
private onFullLocusWithHashTrees(
|
|
1488
|
+
debugText: string,
|
|
1489
|
+
locus: any,
|
|
1490
|
+
metadata: Metadata,
|
|
1491
|
+
dataSets: Array<DataSet>,
|
|
1492
|
+
eventType?: string
|
|
1493
|
+
) {
|
|
1494
|
+
if (!this.hashTreeParsers.has(locus.url)) {
|
|
1495
|
+
LoggerProxy.logger.info(
|
|
1496
|
+
`Locus-info:index#onFullLocus (${debugText}) --> creating hash tree parser for locusUrl=${locus.url}`
|
|
1497
|
+
);
|
|
882
1498
|
LoggerProxy.logger.info(
|
|
883
|
-
|
|
1499
|
+
`Locus-info:index#onFullLocus (${debugText}) --> dataSets:`,
|
|
884
1500
|
dataSets,
|
|
885
1501
|
' and locus:',
|
|
886
|
-
locus
|
|
1502
|
+
locus,
|
|
1503
|
+
' and metadata:',
|
|
1504
|
+
metadata
|
|
887
1505
|
);
|
|
888
|
-
this.
|
|
1506
|
+
this.createHashTreeParser({
|
|
1507
|
+
locusUrl: locus.url,
|
|
889
1508
|
initialLocus: {locus, dataSets},
|
|
1509
|
+
metadata,
|
|
890
1510
|
});
|
|
1511
|
+
// we have a full locus to start with, so we consider Locus info to be "initialized"
|
|
1512
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1513
|
+
this.hashTreeParsers.get(locus.url)!.initializedFromHashTree = true;
|
|
891
1514
|
this.onFullLocusCommon(locus, eventType);
|
|
892
1515
|
} else {
|
|
893
1516
|
// in this case the Locus we're getting is not necessarily the full one
|
|
894
1517
|
// so treat it like if we just got it in any api response
|
|
895
1518
|
|
|
896
1519
|
LoggerProxy.logger.info(
|
|
897
|
-
|
|
1520
|
+
`Locus-info:index#onFullLocus (${debugText}) --> hash tree parser already exists, handling it like a normal API response`
|
|
898
1521
|
);
|
|
899
|
-
this.handleLocusAPIResponse(undefined, {dataSets, locus});
|
|
1522
|
+
this.handleLocusAPIResponse(undefined, {dataSets, locus, metadata});
|
|
900
1523
|
}
|
|
901
1524
|
}
|
|
902
1525
|
|
|
903
1526
|
/**
|
|
904
1527
|
* Function for handling full locus when it's the "classic" one (not hash trees)
|
|
905
1528
|
*
|
|
1529
|
+
* @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
|
|
906
1530
|
* @param {object} locus locus object
|
|
907
1531
|
* @param {string} eventType locus event
|
|
908
1532
|
* @returns {void}
|
|
909
1533
|
*/
|
|
910
|
-
private onFullLocusClassic(locus: any, eventType?: string) {
|
|
1534
|
+
private onFullLocusClassic(debugText: string, locus: any, eventType?: string) {
|
|
911
1535
|
if (!this.locusParser.isNewFullLocus(locus)) {
|
|
912
1536
|
LoggerProxy.logger.info(
|
|
913
|
-
`Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=${eventType}`
|
|
1537
|
+
`Locus-info:index#onFullLocus (${debugText}) --> ignoring old full locus DTO, eventType=${eventType}`
|
|
914
1538
|
);
|
|
915
1539
|
|
|
916
1540
|
return;
|
|
@@ -920,24 +1544,37 @@ export default class LocusInfo extends EventsScope {
|
|
|
920
1544
|
|
|
921
1545
|
/**
|
|
922
1546
|
* updates the locus with full locus object
|
|
1547
|
+
* @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
|
|
923
1548
|
* @param {object} locus locus object
|
|
924
1549
|
* @param {string} eventType locus event
|
|
925
1550
|
* @param {DataSet[]} dataSets
|
|
1551
|
+
* @param {object} metadata locus hash trees metadata
|
|
926
1552
|
* @returns {object} null
|
|
927
1553
|
* @memberof LocusInfo
|
|
928
1554
|
*/
|
|
929
|
-
onFullLocus(
|
|
1555
|
+
onFullLocus(
|
|
1556
|
+
debugText: string,
|
|
1557
|
+
locus: any,
|
|
1558
|
+
eventType?: string,
|
|
1559
|
+
dataSets?: Array<DataSet>,
|
|
1560
|
+
metadata?: Metadata
|
|
1561
|
+
) {
|
|
930
1562
|
if (!locus) {
|
|
931
1563
|
LoggerProxy.logger.error(
|
|
932
|
-
|
|
1564
|
+
`Locus-info:index#onFullLocus (${debugText}) --> object passed as argument was invalid, continuing.`
|
|
933
1565
|
);
|
|
934
1566
|
}
|
|
935
1567
|
|
|
936
1568
|
if (dataSets) {
|
|
1569
|
+
if (!metadata) {
|
|
1570
|
+
throw new Error(
|
|
1571
|
+
`Locus-info:index#onFullLocus (${debugText}) --> hash tree metadata is missing with full Locus`
|
|
1572
|
+
);
|
|
1573
|
+
}
|
|
937
1574
|
// this is the new hashmap Locus DTO format (only applicable to webinars for now)
|
|
938
|
-
this.onFullLocusWithHashTrees(locus,
|
|
1575
|
+
this.onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType);
|
|
939
1576
|
} else {
|
|
940
|
-
this.onFullLocusClassic(locus, eventType);
|
|
1577
|
+
this.onFullLocusClassic(debugText, locus, eventType);
|
|
941
1578
|
}
|
|
942
1579
|
}
|
|
943
1580
|
|
|
@@ -952,7 +1589,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
952
1589
|
this.participants = locus.participants;
|
|
953
1590
|
this.participants?.forEach((participant) => {
|
|
954
1591
|
// participant.htMeta is set only for hash tree based locus
|
|
955
|
-
if (participant.htMeta?.elementId.id) {
|
|
1592
|
+
if (typeof participant.htMeta?.elementId.id === 'number') {
|
|
956
1593
|
this.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
|
|
957
1594
|
}
|
|
958
1595
|
});
|
|
@@ -1015,20 +1652,61 @@ export default class LocusInfo extends EventsScope {
|
|
|
1015
1652
|
}
|
|
1016
1653
|
}
|
|
1017
1654
|
|
|
1655
|
+
/**
|
|
1656
|
+
* Makes sure that passed in locus object has a participant object for self.
|
|
1657
|
+
*
|
|
1658
|
+
* @param {LocusDTO} locus The locus object to check and modify if needed
|
|
1659
|
+
* @returns {void}
|
|
1660
|
+
*/
|
|
1661
|
+
ensureSelfParticipantExists(locus: any) {
|
|
1662
|
+
const {self} = locus;
|
|
1663
|
+
|
|
1664
|
+
// sanity check, this should never fail
|
|
1665
|
+
if (!self?.identity || !Array.isArray(locus.participants)) {
|
|
1666
|
+
LoggerProxy.logger.warn(
|
|
1667
|
+
`Locus-info:index#ensureSelfParticipantExists --> locus object is missing required fields, cannot ensure self participant exists. self?.identity="${self?.identity}"`
|
|
1668
|
+
);
|
|
1669
|
+
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
const selfExists = locus.participants.some(
|
|
1674
|
+
(participant) => participant.identity === self.identity
|
|
1675
|
+
);
|
|
1676
|
+
|
|
1677
|
+
if (!selfExists) {
|
|
1678
|
+
locus.participants.push({...self});
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1018
1682
|
/**
|
|
1019
1683
|
* @param {Object} locus
|
|
1020
1684
|
* @returns {undefined}
|
|
1021
1685
|
* @memberof LocusInfo
|
|
1022
1686
|
*/
|
|
1023
1687
|
onDeltaLocus(locus: any) {
|
|
1024
|
-
const isReplaceMembers =
|
|
1688
|
+
const isReplaceMembers =
|
|
1689
|
+
locus.jsSdkMeta?.forceReplaceMembers !== undefined
|
|
1690
|
+
? locus.jsSdkMeta.forceReplaceMembers
|
|
1691
|
+
: ControlsUtils.isNeedReplaceMembers(this.controls, locus.controls);
|
|
1692
|
+
|
|
1693
|
+
if (isReplaceMembers) {
|
|
1694
|
+
// when we're moving between breakouts, Locus sometimes doesn't send us
|
|
1695
|
+
// any participants at all for a few seconds
|
|
1696
|
+
// Web app relies on having at least the self participant always there
|
|
1697
|
+
// so we copy self into participants if it's not there.
|
|
1698
|
+
this.ensureSelfParticipantExists(locus);
|
|
1699
|
+
}
|
|
1025
1700
|
this.mergeParticipants(this.participants, locus.participants);
|
|
1026
|
-
this.updateLocusInfo(locus);
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1701
|
+
const updatesApplied = this.updateLocusInfo(locus);
|
|
1702
|
+
|
|
1703
|
+
if (updatesApplied) {
|
|
1704
|
+
this.updateParticipants(
|
|
1705
|
+
locus.participants,
|
|
1706
|
+
locus.jsSdkMeta?.removedParticipantIds,
|
|
1707
|
+
isReplaceMembers
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1032
1710
|
this.isMeetingActive();
|
|
1033
1711
|
}
|
|
1034
1712
|
|
|
@@ -1038,11 +1716,11 @@ export default class LocusInfo extends EventsScope {
|
|
|
1038
1716
|
* @memberof LocusInfo
|
|
1039
1717
|
*/
|
|
1040
1718
|
updateLocusInfo(locus) {
|
|
1041
|
-
if (
|
|
1719
|
+
if (MeetingsUtil.isSelfMovedOrBreakoutEnded(locus)) {
|
|
1042
1720
|
// When moved to a breakout session locus sends a message for the previous locus
|
|
1043
1721
|
// indicating that we have been moved. It isn't helpful to continue parsing this
|
|
1044
1722
|
// as it gets interpreted as if we have left the call
|
|
1045
|
-
return;
|
|
1723
|
+
return false;
|
|
1046
1724
|
}
|
|
1047
1725
|
|
|
1048
1726
|
this.updateControls(locus.controls, locus.self);
|
|
@@ -1062,6 +1740,8 @@ export default class LocusInfo extends EventsScope {
|
|
|
1062
1740
|
this.updateLinks(locus.links);
|
|
1063
1741
|
this.compareAndUpdate();
|
|
1064
1742
|
// update which required to compare different objects from locus
|
|
1743
|
+
|
|
1744
|
+
return true;
|
|
1065
1745
|
}
|
|
1066
1746
|
|
|
1067
1747
|
/**
|
|
@@ -1100,7 +1780,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1100
1780
|
// @ts-ignore
|
|
1101
1781
|
const partner = this.getLocusPartner(this.participants, this.self);
|
|
1102
1782
|
|
|
1103
|
-
this.updateMeeting({partner});
|
|
1783
|
+
this.callbacks.updateMeeting({partner});
|
|
1104
1784
|
|
|
1105
1785
|
// Check if guest user needs to be checked here
|
|
1106
1786
|
|
|
@@ -1121,8 +1801,19 @@ export default class LocusInfo extends EventsScope {
|
|
|
1121
1801
|
options: {
|
|
1122
1802
|
meetingId: this.meetingId,
|
|
1123
1803
|
},
|
|
1804
|
+
payload: {
|
|
1805
|
+
eventData: {
|
|
1806
|
+
joinInProgress: this.destroyMeetingSuspended,
|
|
1807
|
+
},
|
|
1808
|
+
},
|
|
1124
1809
|
});
|
|
1125
1810
|
|
|
1811
|
+
if (this.destroyMeetingSuspended) {
|
|
1812
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
1813
|
+
meetingId: this.meetingId,
|
|
1814
|
+
reason: 'CALL_INACTIVE',
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1126
1817
|
this.emitScoped(
|
|
1127
1818
|
{
|
|
1128
1819
|
file: 'locus-info',
|
|
@@ -1147,7 +1838,18 @@ export default class LocusInfo extends EventsScope {
|
|
|
1147
1838
|
options: {
|
|
1148
1839
|
meetingId: this.meetingId,
|
|
1149
1840
|
},
|
|
1841
|
+
payload: {
|
|
1842
|
+
eventData: {
|
|
1843
|
+
joinInProgress: this.destroyMeetingSuspended,
|
|
1844
|
+
},
|
|
1845
|
+
},
|
|
1150
1846
|
});
|
|
1847
|
+
if (this.destroyMeetingSuspended) {
|
|
1848
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
1849
|
+
meetingId: this.meetingId,
|
|
1850
|
+
reason: 'PARTNER_LEFT',
|
|
1851
|
+
});
|
|
1852
|
+
}
|
|
1151
1853
|
this.emitScoped(
|
|
1152
1854
|
{
|
|
1153
1855
|
file: 'locus-info',
|
|
@@ -1174,8 +1876,19 @@ export default class LocusInfo extends EventsScope {
|
|
|
1174
1876
|
options: {
|
|
1175
1877
|
meetingId: this.meetingId,
|
|
1176
1878
|
},
|
|
1879
|
+
payload: {
|
|
1880
|
+
eventData: {
|
|
1881
|
+
joinInProgress: this.destroyMeetingSuspended,
|
|
1882
|
+
},
|
|
1883
|
+
},
|
|
1177
1884
|
});
|
|
1178
1885
|
|
|
1886
|
+
if (this.destroyMeetingSuspended) {
|
|
1887
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
1888
|
+
meetingId: this.meetingId,
|
|
1889
|
+
reason: 'SELF_LEFT',
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1179
1892
|
this.emitScoped(
|
|
1180
1893
|
{
|
|
1181
1894
|
file: 'locus-info',
|
|
@@ -1189,77 +1902,82 @@ export default class LocusInfo extends EventsScope {
|
|
|
1189
1902
|
);
|
|
1190
1903
|
}
|
|
1191
1904
|
} else if (this.parsedLocus.fullState?.type === _MEETING_) {
|
|
1192
|
-
if (
|
|
1193
|
-
this.
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
LoggerProxy.logger.warn(
|
|
1199
|
-
'Locus-info:index#isMeetingActive --> Meeting is ending due to inactive or terminating'
|
|
1200
|
-
);
|
|
1201
|
-
|
|
1202
|
-
// @ts-ignore
|
|
1203
|
-
this.webex.internal.newMetrics.submitClientEvent({
|
|
1204
|
-
name: 'client.call.remote-ended',
|
|
1205
|
-
options: {
|
|
1905
|
+
if (this.fullState && MeetingsUtil.isWholeMeetingEnded(this.fullState)) {
|
|
1906
|
+
if (this.destroyMeetingSuspended) {
|
|
1907
|
+
LoggerProxy.logger.info(
|
|
1908
|
+
'Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (MEETING_INACTIVE_TERMINATING) because destroyMeeting is suspended'
|
|
1909
|
+
);
|
|
1910
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
1206
1911
|
meetingId: this.meetingId,
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
},
|
|
1214
|
-
EVENTS.DESTROY_MEETING,
|
|
1215
|
-
{
|
|
1216
|
-
reason: MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
|
|
1217
|
-
shouldLeave: false,
|
|
1218
|
-
}
|
|
1219
|
-
);
|
|
1220
|
-
} else if (this.fullState && this.fullState.removed) {
|
|
1221
|
-
// user has been dropped from a meeting
|
|
1912
|
+
reason: 'MEETING_INACTIVE_TERMINATING',
|
|
1913
|
+
});
|
|
1914
|
+
} else {
|
|
1915
|
+
LoggerProxy.logger.warn(
|
|
1916
|
+
'Locus-info:index#isMeetingActive --> Meeting is ending due to inactive'
|
|
1917
|
+
);
|
|
1222
1918
|
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1919
|
+
// @ts-ignore
|
|
1920
|
+
this.webex.internal.newMetrics.submitClientEvent({
|
|
1921
|
+
name: 'client.call.remote-ended',
|
|
1922
|
+
options: {
|
|
1923
|
+
meetingId: this.meetingId,
|
|
1924
|
+
},
|
|
1925
|
+
});
|
|
1926
|
+
|
|
1927
|
+
this.emitScoped(
|
|
1928
|
+
{
|
|
1929
|
+
file: 'locus-info',
|
|
1930
|
+
function: 'isMeetingActive',
|
|
1931
|
+
},
|
|
1932
|
+
EVENTS.DESTROY_MEETING,
|
|
1933
|
+
{
|
|
1934
|
+
reason: MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
|
|
1935
|
+
shouldLeave: false,
|
|
1936
|
+
}
|
|
1937
|
+
);
|
|
1938
|
+
}
|
|
1241
1939
|
}
|
|
1242
1940
|
// If you are guest and you are removed from the meeting
|
|
1243
1941
|
// You wont get any further events
|
|
1244
1942
|
else if (this.parsedLocus.self && this.parsedLocus.self.removed) {
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1943
|
+
if (this.destroyMeetingSuspended) {
|
|
1944
|
+
LoggerProxy.logger.info(
|
|
1945
|
+
'Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (SELF_REMOVED) because destroyMeeting is suspended'
|
|
1946
|
+
);
|
|
1947
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
1948
|
+
meetingId: this.meetingId,
|
|
1949
|
+
reason: 'SELF_REMOVED',
|
|
1950
|
+
});
|
|
1951
|
+
} else {
|
|
1952
|
+
this.emitScoped(
|
|
1953
|
+
{
|
|
1954
|
+
file: 'locus-info',
|
|
1955
|
+
function: 'isMeetingActive',
|
|
1956
|
+
},
|
|
1957
|
+
EVENTS.DESTROY_MEETING,
|
|
1958
|
+
{
|
|
1959
|
+
reason: MEETING_REMOVED_REASON.SELF_REMOVED,
|
|
1960
|
+
shouldLeave: false,
|
|
1961
|
+
}
|
|
1962
|
+
);
|
|
1963
|
+
}
|
|
1257
1964
|
}
|
|
1258
1965
|
} else {
|
|
1259
1966
|
LoggerProxy.logger.warn('Locus-info:index#isMeetingActive --> Meeting Type is unknown.');
|
|
1260
1967
|
}
|
|
1261
1968
|
}
|
|
1262
1969
|
|
|
1970
|
+
/**
|
|
1971
|
+
* Suspends or resumes the emission of DESTROY_MEETING events in certain situations.
|
|
1972
|
+
* Used by joinWithMedia to prevent meeting destruction during retry flows.
|
|
1973
|
+
* @param {boolean} suspend - true to suppress, false to resume
|
|
1974
|
+
* @returns {undefined}
|
|
1975
|
+
* @memberof LocusInfo
|
|
1976
|
+
*/
|
|
1977
|
+
suspendDestroyMeeting(suspend: boolean) {
|
|
1978
|
+
this.destroyMeetingSuspended = suspend;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1263
1981
|
/**
|
|
1264
1982
|
* checks if the host permissions have changed while in the meeting
|
|
1265
1983
|
* This would be the case if your role as host or moderator has been updated
|
|
@@ -1373,6 +2091,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1373
2091
|
hasMeetingContainerChanged,
|
|
1374
2092
|
hasTranscribeChanged,
|
|
1375
2093
|
hasHesiodLLMIdChanged,
|
|
2094
|
+
hasAiSummaryNotificationChanged,
|
|
1376
2095
|
hasTranscribeSpokenLanguageChanged,
|
|
1377
2096
|
hasManualCaptionChanged,
|
|
1378
2097
|
hasEntryExitToneChanged,
|
|
@@ -1479,6 +2198,8 @@ export default class LocusInfo extends EventsScope {
|
|
|
1479
2198
|
state,
|
|
1480
2199
|
modifiedBy: current.record.modifiedBy,
|
|
1481
2200
|
lastModified: current.record.lastModified,
|
|
2201
|
+
modifiedByServiceAppName: current.record.modifiedByServiceAppName,
|
|
2202
|
+
modifiedByServiceAppId: current.record.modifiedByServiceAppId,
|
|
1482
2203
|
}
|
|
1483
2204
|
);
|
|
1484
2205
|
}
|
|
@@ -1529,6 +2250,19 @@ export default class LocusInfo extends EventsScope {
|
|
|
1529
2250
|
);
|
|
1530
2251
|
}
|
|
1531
2252
|
|
|
2253
|
+
if (hasAiSummaryNotificationChanged) {
|
|
2254
|
+
this.emitScoped(
|
|
2255
|
+
{
|
|
2256
|
+
file: 'locus-info',
|
|
2257
|
+
function: 'updateControls',
|
|
2258
|
+
},
|
|
2259
|
+
LOCUSINFO.EVENTS.CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED,
|
|
2260
|
+
{
|
|
2261
|
+
aiSummaryNotification: current.transcribe.aiSummaryNotification,
|
|
2262
|
+
}
|
|
2263
|
+
);
|
|
2264
|
+
}
|
|
2265
|
+
|
|
1532
2266
|
if (hasTranscribeSpokenLanguageChanged) {
|
|
1533
2267
|
const {spokenLanguage} = current.transcribe;
|
|
1534
2268
|
|
|
@@ -1561,6 +2295,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1561
2295
|
|
|
1562
2296
|
if (hasBreakoutChanged) {
|
|
1563
2297
|
const {breakout} = current;
|
|
2298
|
+
|
|
1564
2299
|
breakout.breakoutMoveId = SelfUtils.getReplacedBreakoutMoveId(
|
|
1565
2300
|
self,
|
|
1566
2301
|
this.webex.internal.device.url
|
|
@@ -1594,7 +2329,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1594
2329
|
if (hasEntryExitToneChanged) {
|
|
1595
2330
|
const {entryExitTone} = current;
|
|
1596
2331
|
|
|
1597
|
-
this.updateMeeting({entryExitTone});
|
|
2332
|
+
this.callbacks.updateMeeting({entryExitTone});
|
|
1598
2333
|
|
|
1599
2334
|
this.emitScoped(
|
|
1600
2335
|
{
|
|
@@ -1613,7 +2348,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1613
2348
|
if (hasVideoEnabledChanged) {
|
|
1614
2349
|
const {videoEnabled} = current;
|
|
1615
2350
|
|
|
1616
|
-
this.updateMeeting({unmuteVideoAllowed: videoEnabled});
|
|
2351
|
+
this.callbacks.updateMeeting({unmuteVideoAllowed: videoEnabled});
|
|
1617
2352
|
|
|
1618
2353
|
this.emitScoped(
|
|
1619
2354
|
{
|
|
@@ -1705,14 +2440,14 @@ export default class LocusInfo extends EventsScope {
|
|
|
1705
2440
|
updateConversationUrl(conversationUrl: string, info: any) {
|
|
1706
2441
|
if (conversationUrl && !isEqual(this.conversationUrl, conversationUrl)) {
|
|
1707
2442
|
this.conversationUrl = conversationUrl;
|
|
1708
|
-
this.updateMeeting({conversationUrl});
|
|
2443
|
+
this.callbacks.updateMeeting({conversationUrl});
|
|
1709
2444
|
} else if (
|
|
1710
2445
|
info &&
|
|
1711
2446
|
info.conversationUrl &&
|
|
1712
2447
|
!isEqual(this.conversationUrl, info.conversationUrl)
|
|
1713
2448
|
) {
|
|
1714
2449
|
this.conversationUrl = info.conversationUrl;
|
|
1715
|
-
this.updateMeeting({conversationUrl: info.conversationUrl});
|
|
2450
|
+
this.callbacks.updateMeeting({conversationUrl: info.conversationUrl});
|
|
1716
2451
|
}
|
|
1717
2452
|
}
|
|
1718
2453
|
|
|
@@ -1774,7 +2509,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1774
2509
|
if (fullState && !isEqual(this.fullState, fullState)) {
|
|
1775
2510
|
const result = FullState.getFullState(this.fullState, fullState);
|
|
1776
2511
|
|
|
1777
|
-
this.updateMeeting(result.current);
|
|
2512
|
+
this.callbacks.updateMeeting(result.current);
|
|
1778
2513
|
|
|
1779
2514
|
if (result.updates.meetingStateChangedTo) {
|
|
1780
2515
|
this.emitScoped(
|
|
@@ -1818,7 +2553,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1818
2553
|
if (host && !isEqual(this.host, host)) {
|
|
1819
2554
|
const parsedHosts = HostUtils.getHosts(this.host, host);
|
|
1820
2555
|
|
|
1821
|
-
this.updateMeeting(parsedHosts.current);
|
|
2556
|
+
this.callbacks.updateMeeting(parsedHosts.current);
|
|
1822
2557
|
this.parsedLocus.host = parsedHosts.current;
|
|
1823
2558
|
if (parsedHosts.updates.isNewHost) {
|
|
1824
2559
|
this.compareAndUpdateFlags.compareSelfAndHost = true;
|
|
@@ -1848,9 +2583,19 @@ export default class LocusInfo extends EventsScope {
|
|
|
1848
2583
|
*/
|
|
1849
2584
|
updateMeetingInfo(info: object, self?: object) {
|
|
1850
2585
|
const roles = self ? SelfUtils.getRoles(self) : this.parsedLocus.self?.roles || [];
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
2586
|
+
const isJoined = SelfUtils.isJoined(self || this.parsedLocus.self);
|
|
2587
|
+
|
|
2588
|
+
// The parsed userDisplayHints depend on info, roles and isJoined, so we must recompute
|
|
2589
|
+
// whenever any of them changes. A common case is self transitioning to JOINED via a delta
|
|
2590
|
+
// that doesn't carry an info section - in that case we fall back to the previously stored
|
|
2591
|
+
// info so the hints get reparsed with the new joined state (e.g. VIEW_THE_PARTICIPANT_LIST).
|
|
2592
|
+
const infoToParse = info || this.info;
|
|
2593
|
+
const infoChanged = info && !isEqual(this.info, info);
|
|
2594
|
+
const rolesChanged = !isEqual(this.roles, roles);
|
|
2595
|
+
const isJoinedChanged = SelfUtils.isJoined(this.parsedLocus.self) !== isJoined;
|
|
2596
|
+
|
|
2597
|
+
if (infoToParse && (infoChanged || rolesChanged || isJoinedChanged)) {
|
|
2598
|
+
const parsedInfo = InfoUtils.getInfos(this.parsedLocus.info, infoToParse, roles, isJoined);
|
|
1854
2599
|
|
|
1855
2600
|
if (parsedInfo.updates.isLocked) {
|
|
1856
2601
|
this.emitScoped(
|
|
@@ -1873,10 +2618,10 @@ export default class LocusInfo extends EventsScope {
|
|
|
1873
2618
|
);
|
|
1874
2619
|
}
|
|
1875
2620
|
|
|
1876
|
-
this.info =
|
|
2621
|
+
this.info = infoToParse;
|
|
1877
2622
|
this.parsedLocus.info = parsedInfo.current;
|
|
1878
2623
|
// Parses the info and adds necessary values
|
|
1879
|
-
this.updateMeeting(parsedInfo.current);
|
|
2624
|
+
this.callbacks.updateMeeting(parsedInfo.current);
|
|
1880
2625
|
|
|
1881
2626
|
this.emitScoped(
|
|
1882
2627
|
{
|
|
@@ -1905,7 +2650,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1905
2650
|
|
|
1906
2651
|
const parsedEmbeddedApps = EmbeddedAppsUtils.parse(embeddedApps);
|
|
1907
2652
|
|
|
1908
|
-
this.updateMeeting({embeddedApps: parsedEmbeddedApps});
|
|
2653
|
+
this.callbacks.updateMeeting({embeddedApps: parsedEmbeddedApps});
|
|
1909
2654
|
|
|
1910
2655
|
this.emitScoped(
|
|
1911
2656
|
{
|
|
@@ -1930,7 +2675,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1930
2675
|
if (mediaShares && (!isEqual(this.mediaShares, mediaShares) || forceUpdate)) {
|
|
1931
2676
|
const parsedMediaShares = MediaSharesUtils.getMediaShares(this.mediaShares, mediaShares);
|
|
1932
2677
|
|
|
1933
|
-
this.updateMeeting(parsedMediaShares.current);
|
|
2678
|
+
this.callbacks.updateMeeting(parsedMediaShares.current);
|
|
1934
2679
|
this.parsedLocus.mediaShares = parsedMediaShares.current;
|
|
1935
2680
|
this.mediaShares = mediaShares;
|
|
1936
2681
|
this.emitScoped(
|
|
@@ -1976,7 +2721,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1976
2721
|
this.participants // using this.participants instead of locus.participants here, because with delta DTOs locus.participants will only contain a small subset of participants
|
|
1977
2722
|
);
|
|
1978
2723
|
|
|
1979
|
-
this.updateMeeting(parsedSelves.current);
|
|
2724
|
+
this.callbacks.updateMeeting(parsedSelves.current);
|
|
1980
2725
|
this.parsedLocus.self = parsedSelves.current;
|
|
1981
2726
|
|
|
1982
2727
|
const element = this.parsedLocus.states[this.parsedLocus.states.length - 1];
|
|
@@ -1994,7 +2739,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1994
2739
|
);
|
|
1995
2740
|
|
|
1996
2741
|
if (result?.sipUri) {
|
|
1997
|
-
this.updateMeeting(result);
|
|
2742
|
+
this.callbacks.updateMeeting(result);
|
|
1998
2743
|
}
|
|
1999
2744
|
|
|
2000
2745
|
if (parsedSelves.updates.moderatorChanged) {
|
|
@@ -2038,6 +2783,19 @@ export default class LocusInfo extends EventsScope {
|
|
|
2038
2783
|
);
|
|
2039
2784
|
}
|
|
2040
2785
|
|
|
2786
|
+
if (parsedSelves.updates.selfIdChanged) {
|
|
2787
|
+
this.emitScoped(
|
|
2788
|
+
{
|
|
2789
|
+
file: 'locus-info',
|
|
2790
|
+
function: 'updateSelf',
|
|
2791
|
+
},
|
|
2792
|
+
LOCUSINFO.EVENTS.SELF_ID_CHANGED,
|
|
2793
|
+
{
|
|
2794
|
+
selfId: parsedSelves.current.selfId,
|
|
2795
|
+
}
|
|
2796
|
+
);
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2041
2799
|
if (parsedSelves.updates.interpretationChanged) {
|
|
2042
2800
|
this.emitScoped(
|
|
2043
2801
|
{
|
|
@@ -2121,6 +2879,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2121
2879
|
{
|
|
2122
2880
|
muted: parsedSelves.current.remoteMuted,
|
|
2123
2881
|
unmuteAllowed: parsedSelves.current.unmuteAllowed,
|
|
2882
|
+
modifiedBy: parsedSelves.current.modifiedBy ?? null,
|
|
2124
2883
|
}
|
|
2125
2884
|
);
|
|
2126
2885
|
}
|
|
@@ -2247,7 +3006,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2247
3006
|
updateLocusUrl(url: string, isMainLocus = true) {
|
|
2248
3007
|
if (url && this.url !== url) {
|
|
2249
3008
|
this.url = url;
|
|
2250
|
-
this.updateMeeting({locusUrl: url});
|
|
3009
|
+
this.callbacks.updateMeeting({locusUrl: url});
|
|
2251
3010
|
this.emitScoped(
|
|
2252
3011
|
{
|
|
2253
3012
|
file: 'locus-info',
|
|
@@ -2393,4 +3152,17 @@ export default class LocusInfo extends EventsScope {
|
|
|
2393
3152
|
clearMainSessionLocusCache() {
|
|
2394
3153
|
this.mainSessionLocusCache = null;
|
|
2395
3154
|
}
|
|
3155
|
+
|
|
3156
|
+
/**
|
|
3157
|
+
* Cleans up all hash tree parsers and clears internal maps.
|
|
3158
|
+
* @returns {void}
|
|
3159
|
+
* @memberof LocusInfo
|
|
3160
|
+
*/
|
|
3161
|
+
cleanUp() {
|
|
3162
|
+
this.hashTreeParsers.forEach((entry) => {
|
|
3163
|
+
entry.parser.cleanUp();
|
|
3164
|
+
});
|
|
3165
|
+
this.hashTreeParsers.clear();
|
|
3166
|
+
this.hashTreeObjectId2ParticipantId.clear();
|
|
3167
|
+
}
|
|
2396
3168
|
}
|