@webex/plugin-meetings 3.12.0 → 3.13.0-next.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/.sdd/manifest.json +1312 -0
- package/.sdd/templates/.source.json +30 -0
- package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
- package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
- package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
- package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
- package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
- package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
- package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
- package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
- package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
- package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
- package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
- package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
- package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
- package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
- package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
- package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
- package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
- package/.sdd/templates/component-repo/template-map.json +112 -0
- package/AGENTS.md +135 -0
- package/ai-docs/ARCHITECTURE.md +208 -0
- package/ai-docs/CONTRACTS.md +267 -0
- package/ai-docs/DATA_MODEL.md +64 -0
- package/ai-docs/GETTING_STARTED.md +73 -0
- package/ai-docs/GLOSSARY.md +56 -0
- package/ai-docs/REVIEW_CHECKLIST.md +45 -0
- package/ai-docs/RULES.md +79 -0
- package/ai-docs/SECURITY.md +74 -0
- package/ai-docs/SERVICE_STATE.md +59 -0
- package/ai-docs/SPEC_INDEX.md +85 -0
- package/ai-docs/TEST_INDEX.md +45 -0
- package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
- package/ai-docs/patterns/defensive-error-propagation.md +55 -0
- package/ai-docs/patterns/event-scope-emission.md +46 -0
- package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
- package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
- package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
- package/assets/README.md +28 -0
- package/assets/e2ee-0.0.1.js +2 -0
- package/assets/e2ee-0.0.1.wasm +0 -0
- package/dist/aiEnableRequest/index.js +15 -2
- package/dist/aiEnableRequest/index.js.map +1 -1
- package/dist/annotation/index.js +55 -19
- package/dist/annotation/index.js.map +1 -1
- package/dist/assets/e2ee-0.0.1.js +2 -0
- package/dist/assets/e2ee-0.0.1.wasm +0 -0
- 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 +128 -7
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +54 -5
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/constants.js +39 -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 +13 -1
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +1245 -404
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/utils.js +42 -0
- package/dist/hashTree/utils.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +58 -16
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interceptors/locusRetry.js +24 -9
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interpretation/index.js +55 -12
- 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 +4 -1
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +914 -196
- 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/types.js +20 -0
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +229 -166
- 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 +4 -5
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +5 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +1931 -887
- 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 +5 -2
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/util.js +42 -3
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +12 -5
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +322 -129
- 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 +10 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +30 -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 +11 -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 +62 -15
- 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 +32 -4
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +127 -3
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +121 -83
- 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/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/annotation/index.d.ts +19 -0
- package/dist/types/common/errors/webex-errors.d.ts +36 -2
- package/dist/types/config.d.ts +4 -2
- package/dist/types/constants.d.ts +15 -2
- 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 +2 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +230 -18
- package/dist/types/hashTree/utils.d.ts +18 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +151 -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 +66 -49
- package/dist/types/media/properties.d.ts +6 -2
- package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
- package/dist/types/meeting/index.d.ts +247 -13
- package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
- package/dist/types/meeting/request.d.ts +1 -0
- package/dist/types/meeting/util.d.ts +12 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +40 -19
- 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 +1 -0
- package/dist/types/member/types.d.ts +1 -0
- package/dist/types/member/util.d.ts +9 -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 +10 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
- package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
- package/dist/types/multistream/sendSlotManager.d.ts +28 -2
- 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 +3 -0
- package/dist/webinar/index.js +539 -245
- package/dist/webinar/index.js.map +1 -1
- package/package.json +26 -24
- package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
- package/src/aiEnableRequest/index.ts +16 -0
- package/src/annotation/ai-docs/annotation-spec.md +236 -0
- package/src/annotation/index.ts +61 -29
- package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/events.ts +33 -11
- package/src/breakouts/index.ts +145 -3
- package/src/common/errors/webex-errors.ts +56 -3
- package/src/config.ts +8 -3
- package/src/constants.ts +23 -4
- package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
- 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/ai-docs/hash-tree-spec.md +267 -0
- package/src/hashTree/constants.ts +16 -0
- package/src/hashTree/hashTreeParser.ts +1021 -214
- package/src/hashTree/utils.ts +36 -0
- package/src/index.ts +7 -0
- package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
- package/src/interceptors/dataChannelAuthToken.ts +59 -12
- package/src/interceptors/locusRetry.ts +26 -5
- package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
- package/src/interpretation/index.ts +65 -10
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
- package/src/locus-info/controlsUtils.ts +3 -1
- package/src/locus-info/index.ts +907 -184
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/types.ts +33 -1
- package/src/media/MediaConnectionAwaiter.ts +229 -196
- package/src/media/ai-docs/media-spec.md +267 -0
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +8 -3
- package/src/meeting/ai-docs/meeting-spec.md +404 -0
- package/src/meeting/in-meeting-actions.ts +8 -0
- package/src/meeting/index.ts +1237 -254
- package/src/meeting/locusMediaRequest.ts +106 -6
- package/src/meeting/muteState.ts +10 -1
- package/src/meeting/request.ts +11 -0
- package/src/meeting/util.ts +53 -8
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
- package/src/meeting-info/meeting-info-v2.ts +11 -4
- package/src/meetings/ai-docs/meetings-spec.md +296 -0
- package/src/meetings/index.ts +224 -80
- 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/ai-docs/member-spec.md +196 -0
- package/src/member/index.ts +10 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +29 -0
- package/src/members/ai-docs/members-spec.md +256 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/ai-docs/metrics-spec.md +185 -0
- package/src/metrics/constants.ts +11 -0
- package/src/multistream/ai-docs/multistream-spec.md +295 -0
- package/src/multistream/codec/constants.ts +58 -0
- package/src/multistream/mediaRequestManager.ts +119 -28
- package/src/multistream/receiveSlot.ts +18 -0
- package/src/multistream/remoteMediaManager.ts +23 -1
- package/src/multistream/sendSlotManager.ts +112 -4
- package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
- package/src/reachability/ai-docs/reachability-spec.md +261 -0
- package/src/reachability/clusterReachability.ts +3 -2
- package/src/reachability/index.ts +47 -16
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/util.ts +36 -0
- package/src/reactions/ai-docs/reactions-spec.md +198 -0
- package/src/reactions/reactions.type.ts +3 -0
- package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
- package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
- package/src/recording-controller/index.ts +1 -2
- package/src/roap/ai-docs/roap-spec.md +241 -0
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/ai-docs/webinar-spec.md +243 -0
- package/src/webinar/index.ts +333 -73
- package/test/unit/spec/aiEnableRequest/index.ts +86 -0
- package/test/unit/spec/annotation/index.ts +214 -182
- 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 +336 -15
- 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/hashTreeParser.ts +3126 -238
- package/test/unit/spec/hashTree/utils.ts +125 -1
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
- package/test/unit/spec/interceptors/locusRetry.ts +234 -5
- package/test/unit/spec/interpretation/index.ts +119 -4
- package/test/unit/spec/locus-info/controlsUtils.js +172 -57
- package/test/unit/spec/locus-info/index.js +1880 -136
- package/test/unit/spec/locus-info/infoUtils.js +184 -1
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
- package/test/unit/spec/media/index.ts +92 -0
- package/test/unit/spec/media/properties.ts +26 -26
- package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
- package/test/unit/spec/meeting/index.js +3697 -501
- 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 +12 -0
- package/test/unit/spec/meeting/utils.js +206 -16
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
- package/test/unit/spec/meetings/index.js +586 -53
- 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 +7 -0
- package/test/unit/spec/member/util.js +89 -0
- 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 +501 -37
- package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +165 -38
- package/test/unit/spec/reachability/index.ts +128 -46
- package/test/unit/spec/reachability/util.ts +31 -0
- 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 +982 -328
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,14 +36,20 @@ import BEHAVIORAL_METRICS from '../metrics/constants';
|
|
|
34
36
|
import HashTreeParser, {
|
|
35
37
|
DataSet,
|
|
36
38
|
HashTreeMessage,
|
|
39
|
+
LocusInfoUpdate,
|
|
37
40
|
LocusInfoUpdateType,
|
|
38
41
|
Metadata,
|
|
42
|
+
SyncLatencyTracker,
|
|
39
43
|
} from '../hashTree/hashTreeParser';
|
|
40
44
|
import {HashTreeObject, ObjectType, ObjectTypeToLocusKeyMap} from '../hashTree/types';
|
|
41
|
-
import {isMetadata} from '../hashTree/utils';
|
|
42
|
-
import {Links, LocusDTO} from './types';
|
|
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';
|
|
43
50
|
|
|
44
51
|
export type LocusLLMEvent = {
|
|
52
|
+
trackingId?: string;
|
|
45
53
|
data: {
|
|
46
54
|
eventType: typeof LOCUSEVENT.HASH_TREE_DATA_UPDATED;
|
|
47
55
|
stateElementsMessage: HashTreeMessage;
|
|
@@ -68,11 +76,13 @@ const LocusDtoTopLevelKeys = [
|
|
|
68
76
|
'htMeta', // only exists when hash trees are used
|
|
69
77
|
];
|
|
70
78
|
|
|
71
|
-
export type LocusApiResponseBody =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
76
86
|
|
|
77
87
|
const LocusObjectStateAfterUpdates = {
|
|
78
88
|
unchanged: 'unchanged',
|
|
@@ -82,6 +92,90 @@ const LocusObjectStateAfterUpdates = {
|
|
|
82
92
|
|
|
83
93
|
type LocusObjectStateAfterUpdates = Enum<typeof LocusObjectStateAfterUpdates>;
|
|
84
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
|
+
|
|
85
179
|
/**
|
|
86
180
|
* Creates a locus object from the objects received in a hash tree message. It usually will be
|
|
87
181
|
* incomplete, because hash tree messages only contain the parts of locus that have changed,
|
|
@@ -177,7 +271,6 @@ export default class LocusInfo extends EventsScope {
|
|
|
177
271
|
locusParser: any;
|
|
178
272
|
meetingId: any;
|
|
179
273
|
parsedLocus: any;
|
|
180
|
-
updateMeeting: any;
|
|
181
274
|
webex: any;
|
|
182
275
|
aclUrl: any;
|
|
183
276
|
baseSequence: any;
|
|
@@ -198,31 +291,44 @@ export default class LocusInfo extends EventsScope {
|
|
|
198
291
|
links?: Links;
|
|
199
292
|
mainSessionLocusCache: any;
|
|
200
293
|
self: any;
|
|
201
|
-
|
|
294
|
+
hashTreeParsers: Map<string, HashTreeParserEntry>;
|
|
202
295
|
hashTreeObjectId2ParticipantId: Map<number, string>; // mapping of hash tree object ids to participant ids
|
|
203
296
|
classicVsHashTreeMismatchMetricCounter = 0;
|
|
297
|
+
private callbacks: LocusInfoCallbacks;
|
|
298
|
+
private destroyMeetingSuspended = false;
|
|
204
299
|
|
|
205
300
|
/**
|
|
206
301
|
* Constructor
|
|
207
|
-
* @param {
|
|
302
|
+
* @param {Object} callbacks callbacks used by LocusInfo
|
|
303
|
+
* @param {function} callbacks.updateMeeting callback to update the meeting object from an object
|
|
208
304
|
* @param {object} webex
|
|
209
305
|
* @param {string} meetingId
|
|
210
306
|
* @returns {undefined}
|
|
211
307
|
*/
|
|
212
|
-
constructor(
|
|
308
|
+
constructor(callbacks: LocusInfoCallbacks, webex: any, meetingId: any) {
|
|
213
309
|
super();
|
|
214
310
|
this.parsedLocus = {
|
|
215
311
|
states: [],
|
|
216
312
|
};
|
|
313
|
+
this.callbacks = callbacks;
|
|
217
314
|
this.webex = webex;
|
|
218
315
|
this.emitChange = false;
|
|
219
316
|
this.compareAndUpdateFlags = {};
|
|
220
317
|
this.meetingId = meetingId;
|
|
221
|
-
this.updateMeeting = updateMeeting;
|
|
222
318
|
this.locusParser = new LocusDeltaParser();
|
|
319
|
+
this.hashTreeParsers = new Map();
|
|
223
320
|
this.hashTreeObjectId2ParticipantId = new Map();
|
|
224
321
|
}
|
|
225
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Whether this meeting uses hash tree based Locus (as opposed to a classic, delta based Locus).
|
|
325
|
+
*
|
|
326
|
+
* @returns {boolean}
|
|
327
|
+
*/
|
|
328
|
+
isUsingHashTrees(): boolean {
|
|
329
|
+
return this.hashTreeParsers.size > 0;
|
|
330
|
+
}
|
|
331
|
+
|
|
226
332
|
/**
|
|
227
333
|
* 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.
|
|
228
334
|
* WARNING: This function must not be used for hash tree based Locus meetings.
|
|
@@ -230,12 +336,26 @@ export default class LocusInfo extends EventsScope {
|
|
|
230
336
|
* @param {Meeting} meeting
|
|
231
337
|
* @param {boolean} isLocusUrlChanged
|
|
232
338
|
* @param {Locus} locus
|
|
233
|
-
* @
|
|
339
|
+
* @param {Object} [options]
|
|
340
|
+
* @param {boolean} [options.destroyOnTransientFailure=true] controls what happens on a *transient*
|
|
341
|
+
* sync failure (a terminal failure, e.g. a 403 meaning the meeting has ended, always destroys
|
|
342
|
+
* the meeting regardless of this flag). When true, a transient failure destroys the meeting and
|
|
343
|
+
* the returned promise still resolves. When false, the meeting is preserved and the returned
|
|
344
|
+
* promise rejects so the caller can retry.
|
|
345
|
+
* @returns {Promise} resolves once the fetched DTO has been applied; see destroyOnTransientFailure
|
|
346
|
+
* for the failure behavior
|
|
234
347
|
*/
|
|
235
|
-
private doLocusSync(
|
|
348
|
+
private doLocusSync(
|
|
349
|
+
meeting: any,
|
|
350
|
+
isLocusUrlChanged: boolean,
|
|
351
|
+
locus: any,
|
|
352
|
+
{destroyOnTransientFailure = true}: {destroyOnTransientFailure?: boolean} = {}
|
|
353
|
+
) {
|
|
236
354
|
let url;
|
|
237
355
|
let isDelta = false;
|
|
238
356
|
let meetingDestroyed = false;
|
|
357
|
+
// whether the DTO fetch itself failed (as opposed to applying a successfully fetched DTO)
|
|
358
|
+
let fetchFailed = false;
|
|
239
359
|
|
|
240
360
|
if (isLocusUrlChanged) {
|
|
241
361
|
// for the locus url changed case from breakout to main session, we should always do a full sync, in this case, the url from locus is always on main session,
|
|
@@ -256,8 +376,30 @@ export default class LocusInfo extends EventsScope {
|
|
|
256
376
|
} DTO)`
|
|
257
377
|
);
|
|
258
378
|
|
|
259
|
-
//
|
|
260
|
-
meeting
|
|
379
|
+
// Called once the DTO fetch (delta plus any full-sync fallback) has failed and we're giving up.
|
|
380
|
+
// The meeting is destroyed when either the delta-processing path asked for it, or the failure is
|
|
381
|
+
// terminal (e.g. a 403 meaning the meeting has ended) - in both cases there's nothing left to
|
|
382
|
+
// sync or retry, so the trailing catch below swallows the rejection whenever meetingDestroyed is
|
|
383
|
+
// set. On the caller-driven reconnection path a non-terminal failure preserves the meeting and
|
|
384
|
+
// lets the rejection propagate so the caller can retry.
|
|
385
|
+
const onFetchFailure = (error: any, logMessage: string, {terminal = false} = {}) => {
|
|
386
|
+
// terminal failures always destroy the meeting; destroyOnTransientFailure only controls the
|
|
387
|
+
// non-terminal case
|
|
388
|
+
const destroyMeeting = terminal || destroyOnTransientFailure;
|
|
389
|
+
LoggerProxy.logger.info(
|
|
390
|
+
`Locus-info:index#doLocusSync --> ${logMessage}${
|
|
391
|
+
destroyMeeting ? ', destroying the meeting' : ''
|
|
392
|
+
}`
|
|
393
|
+
);
|
|
394
|
+
fetchFailed = true;
|
|
395
|
+
if (destroyMeeting) {
|
|
396
|
+
this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
|
|
397
|
+
meetingDestroyed = true;
|
|
398
|
+
}
|
|
399
|
+
throw error;
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
return meeting.meetingRequest
|
|
261
403
|
.getLocusDTO({url})
|
|
262
404
|
.catch((e) => {
|
|
263
405
|
if (isDelta) {
|
|
@@ -278,26 +420,21 @@ export default class LocusInfo extends EventsScope {
|
|
|
278
420
|
|
|
279
421
|
// Locus sometimes returns 403, for example if meeting has ended, no point trying the fallback to full sync in that case
|
|
280
422
|
if (e.statusCode !== 403) {
|
|
281
|
-
return meeting.meetingRequest.getLocusDTO({url: meeting.locusUrl}).catch((err) =>
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
)
|
|
285
|
-
|
|
286
|
-
meetingDestroyed = true;
|
|
287
|
-
throw err;
|
|
288
|
-
});
|
|
423
|
+
return meeting.meetingRequest.getLocusDTO({url: meeting.locusUrl}).catch((err) =>
|
|
424
|
+
// A 403 from the fallback full sync is also terminal (meeting has ended), so remove the
|
|
425
|
+
// meeting even on the reconnection path instead of preserving it and rejecting.
|
|
426
|
+
onFetchFailure(err, 'fallback full sync failed', {terminal: err.statusCode === 403})
|
|
427
|
+
);
|
|
289
428
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
)
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
);
|
|
429
|
+
|
|
430
|
+
// A 403 means the meeting has ended - this is terminal, so remove the meeting even on the
|
|
431
|
+
// reconnection path (there's nothing to retry) instead of preserving it and rejecting.
|
|
432
|
+
return onFetchFailure(e, 'got 403 from Locus, skipping fallback to full sync', {
|
|
433
|
+
terminal: true,
|
|
434
|
+
});
|
|
297
435
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
throw e;
|
|
436
|
+
|
|
437
|
+
return onFetchFailure(e, 'full sync failed', {terminal: e.statusCode === 403});
|
|
301
438
|
})
|
|
302
439
|
.then((res) => {
|
|
303
440
|
if (isEmpty(res.body)) {
|
|
@@ -328,18 +465,32 @@ export default class LocusInfo extends EventsScope {
|
|
|
328
465
|
meeting.locusInfo.onFullLocus('classic Locus sync', res.body);
|
|
329
466
|
})
|
|
330
467
|
.catch((e) => {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
468
|
+
if (!fetchFailed) {
|
|
469
|
+
// The DTO was fetched successfully but applying it failed. Retrying wouldn't help - it
|
|
470
|
+
// would re-fetch and re-apply the same unprocessable DTO and fail identically - so log and
|
|
471
|
+
// resume (swallow the error) instead of propagating it. Propagating here would make the
|
|
472
|
+
// reconnection flow (which treats a rejection as retryable) retry indefinitely.
|
|
473
|
+
LoggerProxy.logger.info(
|
|
474
|
+
`Locus-info:index#doLocusSync --> getLocusDTO succeeded but failed to handle result, locus parser will resume but not all data may be synced (${e.toString()})`
|
|
475
|
+
);
|
|
334
476
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
477
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.LOCUS_SYNC_HANDLING_FAILED, {
|
|
478
|
+
correlationId: meeting.correlationId,
|
|
479
|
+
url,
|
|
480
|
+
reason: e.message,
|
|
481
|
+
errorName: e.name,
|
|
482
|
+
stack: e.stack,
|
|
483
|
+
code: e.code,
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
if (!destroyOnTransientFailure && !meetingDestroyed) {
|
|
490
|
+
// caller-driven sync (e.g. reconnection): propagate a transient fetch failure so it can be
|
|
491
|
+
// retried. If the meeting was destroyed (terminal failure), there's nothing to retry.
|
|
492
|
+
throw e;
|
|
493
|
+
}
|
|
343
494
|
})
|
|
344
495
|
.finally(() => {
|
|
345
496
|
if (!meetingDestroyed) {
|
|
@@ -350,6 +501,52 @@ export default class LocusInfo extends EventsScope {
|
|
|
350
501
|
});
|
|
351
502
|
}
|
|
352
503
|
|
|
504
|
+
/**
|
|
505
|
+
* Syncs this meeting's Locus state (e.g. after a network reconnection), routing to whichever
|
|
506
|
+
* mechanism the meeting uses (a meeting only ever uses one): hash tree datasets via
|
|
507
|
+
* syncAllHashTreeDatasets() or a standalone Locus DTO fetch for classic meetings.
|
|
508
|
+
* A transient failure preserves the meeting (so the caller can retry); only a terminal failure
|
|
509
|
+
* (e.g. a 403 meaning the meeting has ended) destroys it.
|
|
510
|
+
*
|
|
511
|
+
* The classic path is only needed when Meetings#syncMeetings() can't do its usual
|
|
512
|
+
* getActiveMeetings() fetch (e.g. unverified guests, for whom Locus rejects that call); signed-in
|
|
513
|
+
* users resync classic meetings via getActiveMeetings() and pass canSyncClassicLocus as false.
|
|
514
|
+
*
|
|
515
|
+
* @param {Meeting} meeting
|
|
516
|
+
* @param {Object} options
|
|
517
|
+
* @param {boolean} options.canSyncClassicLocus - whether this sync is allowed to fetch a
|
|
518
|
+
* standalone Locus DTO for classic meetings
|
|
519
|
+
* @param {boolean} options.canSyncHashTree - whether this sync is allowed to sync hash tree
|
|
520
|
+
* datasets for hash tree based meetings
|
|
521
|
+
* @returns {Promise<void>} resolves once the sync (hash tree or classic) completes; for the
|
|
522
|
+
* classic path it rejects only on a transient failure, so the caller can retry (a terminal
|
|
523
|
+
* failure destroys the meeting and resolves)
|
|
524
|
+
*/
|
|
525
|
+
async sync(
|
|
526
|
+
meeting: any,
|
|
527
|
+
{canSyncClassicLocus, canSyncHashTree}: {canSyncClassicLocus: boolean; canSyncHashTree: boolean}
|
|
528
|
+
): Promise<void> {
|
|
529
|
+
if (this.isUsingHashTrees()) {
|
|
530
|
+
// hash tree based meeting: doLocusSync must not be used, sync the hash tree datasets instead
|
|
531
|
+
if (canSyncHashTree) {
|
|
532
|
+
await this.syncAllHashTreeDatasets();
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// classic (non hash tree) meeting: only sync if there's a Locus URL to fetch against, otherwise
|
|
539
|
+
// getLocusDTO() would reject and doLocusSync() would destroy the (e.g. not-yet-joined) meeting
|
|
540
|
+
if (canSyncClassicLocus && meeting.locusUrl) {
|
|
541
|
+
// Pause the parser so in-flight deltas don't race the DTO fetch; doLocusSync() resumes it.
|
|
542
|
+
this.locusParser.pause();
|
|
543
|
+
// destroyOnTransientFailure: false so a transient failure preserves the meeting and rejects,
|
|
544
|
+
// letting the reconnection flow retry instead of tearing the meeting down. A terminal failure
|
|
545
|
+
// (e.g. a 403 meaning the meeting has ended) still destroys the meeting.
|
|
546
|
+
await this.doLocusSync(meeting, false, undefined, {destroyOnTransientFailure: false});
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
353
550
|
/**
|
|
354
551
|
* Apply locus delta data to meeting
|
|
355
552
|
* @param {string} action Locus delta action
|
|
@@ -432,7 +629,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
432
629
|
this.updateControls(locus.controls, locus.self);
|
|
433
630
|
this.updateLocusUrl(locus.url, ControlsUtils.isMainSessionDTO(locus));
|
|
434
631
|
this.updateFullState(locus.fullState);
|
|
435
|
-
this.updateMeetingInfo(locus.info);
|
|
632
|
+
this.updateMeetingInfo(locus.info, locus.self);
|
|
436
633
|
this.updateEmbeddedApps(locus.embeddedApps);
|
|
437
634
|
// self and participants generate sipUrl for 1:1 meeting
|
|
438
635
|
this.updateSelf(locus.self);
|
|
@@ -442,32 +639,88 @@ export default class LocusInfo extends EventsScope {
|
|
|
442
639
|
}
|
|
443
640
|
|
|
444
641
|
/**
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
* @returns {
|
|
642
|
+
* Whether we expect to receive updates over the LLM connection. This is used by hash tree parsers
|
|
643
|
+
* to decide whether to arm heartbeat watchdog timers for LLM data sets.
|
|
644
|
+
* @returns {boolean}
|
|
645
|
+
*/
|
|
646
|
+
private isLlmExpected(): boolean {
|
|
647
|
+
return this.parsedLocus.self?.joinedWith?.state === 'JOINED';
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Creates a HashTreeParser instance for a given locusUrl and stores it in the map.
|
|
652
|
+
* @param {Object} params
|
|
653
|
+
* @param {string} params.locusUrl - the locus URL used as the map key
|
|
654
|
+
* @param {Object} params.initialLocus - initial locus data
|
|
655
|
+
* @param {Object} params.metadata - hash tree metadata
|
|
656
|
+
* @param {string} params.replacedAt - timestamp from Locus indicating when the replacement happened
|
|
657
|
+
* @returns {HashTreeParser} the newly created parser
|
|
448
658
|
*/
|
|
449
659
|
private createHashTreeParser({
|
|
660
|
+
locusUrl,
|
|
450
661
|
initialLocus,
|
|
451
662
|
metadata,
|
|
663
|
+
replacedAt,
|
|
452
664
|
}: {
|
|
665
|
+
locusUrl: string;
|
|
453
666
|
initialLocus: {
|
|
454
667
|
dataSets: Array<DataSet>;
|
|
455
668
|
locus: any;
|
|
456
669
|
};
|
|
457
|
-
metadata: Metadata;
|
|
458
|
-
|
|
459
|
-
|
|
670
|
+
metadata: Metadata | null;
|
|
671
|
+
replacedAt?: string;
|
|
672
|
+
}): HashTreeParser {
|
|
673
|
+
const parser = new HashTreeParser({
|
|
460
674
|
initialLocus,
|
|
461
675
|
metadata,
|
|
462
676
|
webexRequest: this.webex.request.bind(this.webex),
|
|
463
|
-
|
|
464
|
-
|
|
677
|
+
callbacks: {
|
|
678
|
+
locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
|
|
679
|
+
syncLatencyTracker: this.callbacks.syncLatencyTracker,
|
|
680
|
+
isLlmExpected: () => this.isLlmExpected(),
|
|
681
|
+
// Reuse webex-core's tracking-id interceptor sequence (exposed publicly via
|
|
682
|
+
// webexTrackingIdSequenceNumbers) so Locus requests share the client's unified
|
|
683
|
+
// ${sessionId}_${sequence} tracking id space instead of minting an unrelated id. Fall
|
|
684
|
+
// back to a uuid on the rare chance the interceptor hasn't issued any request yet (and so
|
|
685
|
+
// isn't in the map). The value is opaque to the metrics layer and is forced onto the
|
|
686
|
+
// /hashtree and /sync request headers.
|
|
687
|
+
generateTrackingId: () => {
|
|
688
|
+
const interceptor = [...webexTrackingIdSequenceNumbers.keys()].find(
|
|
689
|
+
(candidate) => candidate?.webex === this.webex
|
|
690
|
+
);
|
|
691
|
+
|
|
692
|
+
return `${this.webex.sessionId}_${interceptor ? interceptor.sequence : uuid.v4()}`;
|
|
693
|
+
},
|
|
694
|
+
},
|
|
695
|
+
debugId: `HT-${locusUrl.split('/')?.pop()?.substring(0, 4)}`,
|
|
465
696
|
excludedDataSets: this.webex.config.meetings.locus?.excludedDataSets,
|
|
697
|
+
syncLatencyMeetingId: this.meetingId,
|
|
466
698
|
});
|
|
699
|
+
|
|
700
|
+
// When a new HashTreeParser is created, previous one should be stopped.
|
|
701
|
+
// Locus will only be sending us updates for the current one.
|
|
702
|
+
for (const [existingLocusUrl, existingEntry] of this.hashTreeParsers) {
|
|
703
|
+
if (existingEntry.parser.state !== 'stopped') {
|
|
704
|
+
existingEntry.parser.stop();
|
|
705
|
+
if (replacedAt) {
|
|
706
|
+
existingEntry.replacedAt = replacedAt;
|
|
707
|
+
} else {
|
|
708
|
+
LoggerProxy.logger.warn(
|
|
709
|
+
`Locus-info:index#createHashTreeParser --> no replacedAt timestamp provided for new HashTreeParser with locusUrl ${locusUrl}, replacing ${existingLocusUrl}`
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
this.hashTreeParsers.set(locusUrl, {parser, initializedFromHashTree: false});
|
|
716
|
+
this.hashTreeObjectId2ParticipantId.clear();
|
|
717
|
+
|
|
718
|
+
return parser;
|
|
467
719
|
}
|
|
468
720
|
|
|
469
721
|
/**
|
|
470
722
|
* @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
|
|
723
|
+
* @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)
|
|
471
724
|
* @returns {undefined}
|
|
472
725
|
* @memberof LocusInfo
|
|
473
726
|
*/
|
|
@@ -487,8 +740,10 @@ export default class LocusInfo extends EventsScope {
|
|
|
487
740
|
| {
|
|
488
741
|
trigger: 'get-loci-response';
|
|
489
742
|
locus?: LocusDTO;
|
|
490
|
-
}
|
|
743
|
+
},
|
|
744
|
+
onLocusSynced?: (locus: LocusDTO) => void
|
|
491
745
|
) {
|
|
746
|
+
let initialFullLocus: LocusDTO | null = null;
|
|
492
747
|
switch (data.trigger) {
|
|
493
748
|
case 'locus-message':
|
|
494
749
|
if (data.hashTreeMessage) {
|
|
@@ -513,10 +768,11 @@ export default class LocusInfo extends EventsScope {
|
|
|
513
768
|
'Locus-info:index#initialSetup --> creating HashTreeParser from message'
|
|
514
769
|
);
|
|
515
770
|
// first create the HashTreeParser, but don't initialize it with any data yet
|
|
516
|
-
|
|
771
|
+
const hashTreeParser = this.createHashTreeParser({
|
|
772
|
+
locusUrl: data.hashTreeMessage.locusUrl,
|
|
517
773
|
initialLocus: {
|
|
518
774
|
locus: null,
|
|
519
|
-
dataSets:
|
|
775
|
+
dataSets: data.hashTreeMessage.dataSets,
|
|
520
776
|
},
|
|
521
777
|
metadata: {
|
|
522
778
|
htMeta: metadataObject.htMeta,
|
|
@@ -525,7 +781,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
525
781
|
});
|
|
526
782
|
|
|
527
783
|
// now handle the message - that should populate all the visible datasets
|
|
528
|
-
await
|
|
784
|
+
await hashTreeParser.initializeFromMessage(data.hashTreeMessage);
|
|
529
785
|
} else {
|
|
530
786
|
// "classic" Locus case, no hash trees involved
|
|
531
787
|
this.updateLocusCache(data.locus);
|
|
@@ -535,6 +791,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
535
791
|
case 'join-response':
|
|
536
792
|
this.updateLocusCache(data.locus);
|
|
537
793
|
this.onFullLocus('join response', data.locus, undefined, data.dataSets, data.metadata);
|
|
794
|
+
initialFullLocus = data.locus;
|
|
538
795
|
break;
|
|
539
796
|
case 'get-loci-response':
|
|
540
797
|
if (data.locus?.links?.resources?.visibleDataSets?.url) {
|
|
@@ -542,7 +799,8 @@ export default class LocusInfo extends EventsScope {
|
|
|
542
799
|
'Locus-info:index#initialSetup --> creating HashTreeParser from get-loci-response'
|
|
543
800
|
);
|
|
544
801
|
// first create the HashTreeParser, but don't initialize it with any data yet
|
|
545
|
-
|
|
802
|
+
const hashTreeParser = this.createHashTreeParser({
|
|
803
|
+
locusUrl: data.locus.url as string,
|
|
546
804
|
initialLocus: {
|
|
547
805
|
locus: null,
|
|
548
806
|
dataSets: [], // empty, because we don't have them yet
|
|
@@ -551,52 +809,107 @@ export default class LocusInfo extends EventsScope {
|
|
|
551
809
|
});
|
|
552
810
|
|
|
553
811
|
// now initialize all the data
|
|
554
|
-
await
|
|
812
|
+
await hashTreeParser.initializeFromGetLociResponse(data.locus);
|
|
555
813
|
} else {
|
|
556
814
|
// "classic" Locus case, no hash trees involved
|
|
557
815
|
this.updateLocusCache(data.locus);
|
|
558
816
|
this.onFullLocus('classic get-loci-response', data.locus, undefined);
|
|
817
|
+
initialFullLocus = data.locus || null;
|
|
559
818
|
}
|
|
560
819
|
}
|
|
820
|
+
|
|
821
|
+
if (onLocusSynced) {
|
|
822
|
+
try {
|
|
823
|
+
onLocusSynced(initialFullLocus || this.getCurrentLocusSnapshot());
|
|
824
|
+
} catch (error) {
|
|
825
|
+
LoggerProxy.logger.warn(
|
|
826
|
+
`Locus-info:index#initialSetup --> onLocusSynced callback failed: ${error}`
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
561
831
|
// Change it to true after it receives it first locus object
|
|
562
832
|
this.emitChange = true;
|
|
563
833
|
}
|
|
564
834
|
|
|
835
|
+
/**
|
|
836
|
+
* Builds a full locus DTO snapshot from current internal locus state.
|
|
837
|
+
*
|
|
838
|
+
* @returns {LocusDTO}
|
|
839
|
+
*/
|
|
840
|
+
private getCurrentLocusSnapshot(): LocusDTO {
|
|
841
|
+
const locus: Record<string, any> = {};
|
|
842
|
+
|
|
843
|
+
LocusDtoTopLevelKeys.forEach((key) => {
|
|
844
|
+
const value = (this as Record<string, any>)[key];
|
|
845
|
+
|
|
846
|
+
if (value !== undefined && value !== null) {
|
|
847
|
+
locus[key] = cloneDeep(value);
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
if (!Array.isArray(locus.participants)) {
|
|
852
|
+
locus.participants = [];
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
return locus as LocusDTO;
|
|
856
|
+
}
|
|
857
|
+
|
|
565
858
|
/**
|
|
566
859
|
* Handles HTTP response from Locus API call.
|
|
567
860
|
* @param {Meeting} meeting meeting object
|
|
568
861
|
* @param {LocusApiResponseBody} responseBody body of the http response from Locus API call
|
|
569
862
|
* @returns {void}
|
|
570
863
|
*/
|
|
571
|
-
handleLocusAPIResponse(meeting, responseBody: LocusApiResponseBody): void {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
864
|
+
handleLocusAPIResponse(meeting: any, responseBody: LocusApiResponseBody): void {
|
|
865
|
+
const isWrapped = 'locus' in responseBody;
|
|
866
|
+
const locusUrl = isWrapped ? responseBody.locus?.url : responseBody.url;
|
|
867
|
+
const hashTreeParserEntry = locusUrl && this.hashTreeParsers.get(locusUrl);
|
|
868
|
+
const locus = isWrapped
|
|
869
|
+
? (responseBody as {locus: LocusDTO}).locus
|
|
870
|
+
: (responseBody as LocusDTO);
|
|
871
|
+
|
|
872
|
+
if (this.isUsingHashTrees()) {
|
|
873
|
+
// We are in hash tree mode. Check if we need to create/reactivate a parser for this locusUrl.
|
|
874
|
+
if (!hashTreeParserEntry || hashTreeParserEntry.parser.state === 'stopped') {
|
|
875
|
+
if (!locusUrl) {
|
|
876
|
+
LoggerProxy.logger.warn(
|
|
877
|
+
'Locus-info:index#handleLocusAPIResponse --> API response has no locusUrl, cannot handle hash tree parser switch'
|
|
878
|
+
);
|
|
879
|
+
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
this.handleHashTreeParserSwitchForAPIResponse(locusUrl, locus);
|
|
884
|
+
|
|
885
|
+
return;
|
|
579
886
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
this.sendClassicVsHashTreeMismatchMetric(
|
|
589
|
-
meeting,
|
|
590
|
-
`unexpected hash tree dataSets in API response`
|
|
591
|
-
);
|
|
887
|
+
|
|
888
|
+
// Active parser found - pass the API response to it
|
|
889
|
+
if (isWrapped) {
|
|
890
|
+
// update the data in our hash trees
|
|
891
|
+
hashTreeParserEntry.parser.handleLocusUpdate(responseBody);
|
|
892
|
+
} else {
|
|
893
|
+
// LocusDTO without wrapper - pass it through as if it had no dataSets nor metadata
|
|
894
|
+
hashTreeParserEntry.parser.handleLocusUpdate({locus: responseBody});
|
|
592
895
|
}
|
|
593
|
-
|
|
594
|
-
|
|
896
|
+
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// No hash tree parsers - classic Locus mode
|
|
901
|
+
if (isWrapped && responseBody.dataSets) {
|
|
902
|
+
this.sendClassicVsHashTreeMismatchMetric(
|
|
903
|
+
meeting,
|
|
904
|
+
`unexpected hash tree dataSets in API response`
|
|
905
|
+
);
|
|
595
906
|
}
|
|
907
|
+
|
|
908
|
+
// classic Locus delta
|
|
909
|
+
this.handleLocusDelta(locus, meeting);
|
|
596
910
|
}
|
|
597
911
|
|
|
598
912
|
/**
|
|
599
|
-
*
|
|
600
913
|
* @param {HashTreeObject} object data set object
|
|
601
914
|
* @param {any} locus
|
|
602
915
|
* @returns {void}
|
|
@@ -712,6 +1025,23 @@ export default class LocusInfo extends EventsScope {
|
|
|
712
1025
|
locus.jsSdkMeta.removedParticipantIds.push(participantId);
|
|
713
1026
|
this.hashTreeObjectId2ParticipantId.delete(object.htMeta.elementId.id);
|
|
714
1027
|
}
|
|
1028
|
+
// Create self from the participant if it matches self identity and is being moved.
|
|
1029
|
+
// We need this, because participant update comes in LLM message often before the self update from Mercury.
|
|
1030
|
+
// Other parts of the code detect move only by looking at self, while some other parts of the SDK/webapp code
|
|
1031
|
+
// look at participant for roles etc, so if participant is updated but not self, then it looks like we our lost roles temporarily
|
|
1032
|
+
// (until self is updated)
|
|
1033
|
+
// This will be fixed properly in SPARK-790239
|
|
1034
|
+
if (
|
|
1035
|
+
object.data &&
|
|
1036
|
+
object.data.identity === locus.self?.identity &&
|
|
1037
|
+
object.data.state === 'LEFT' &&
|
|
1038
|
+
object.data.reason === 'MOVED'
|
|
1039
|
+
) {
|
|
1040
|
+
LoggerProxy.logger.info(
|
|
1041
|
+
`Locus-info:index#updateLocusFromHashTreeObject --> FOUND a match for MOVED self in participant object ${object.htMeta.elementId.id}`
|
|
1042
|
+
);
|
|
1043
|
+
Object.assign(locus[ObjectTypeToLocusKeyMap[ObjectType.self]], object.data);
|
|
1044
|
+
}
|
|
715
1045
|
break;
|
|
716
1046
|
case ObjectType.control:
|
|
717
1047
|
if (object.data) {
|
|
@@ -738,14 +1068,22 @@ export default class LocusInfo extends EventsScope {
|
|
|
738
1068
|
if (!object.data) {
|
|
739
1069
|
// self without data is handled inside HashTreeParser and results in LocusInfoUpdateType.MEETING_ENDED, so we should never get here
|
|
740
1070
|
// all other types info, fullstate, etc - Locus should never send them without data
|
|
741
|
-
|
|
742
|
-
|
|
1071
|
+
// but we end up with this method being called without the data for them when the main dataset is removed from visible datasets list
|
|
1072
|
+
LoggerProxy.logger.info(
|
|
1073
|
+
`Locus-info:index#updateLocusFromHashTreeObject --> received ${type} object without data, version=${object.htMeta.elementId.version}`
|
|
743
1074
|
);
|
|
744
1075
|
} else {
|
|
745
1076
|
LoggerProxy.logger.info(
|
|
746
1077
|
`Locus-info:index#updateLocusFromHashTreeObject --> ${type} object updated to version ${object.htMeta.elementId.version}`
|
|
747
1078
|
);
|
|
748
|
-
|
|
1079
|
+
|
|
1080
|
+
if (type === ObjectType.self) {
|
|
1081
|
+
LoggerProxy.logger.info(
|
|
1082
|
+
`Locus-info:index#updateLocusFromHashTreeObject --> self data: removed=${object.data.removed} state=${object.data.state} reason=${object.data.reason}`
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
const locusDtoKey = ObjectTypeToLocusKeyMap[type] as keyof LocusDTO;
|
|
749
1087
|
locus[locusDtoKey] = object.data;
|
|
750
1088
|
|
|
751
1089
|
/* Hash tree based webinar attendees don't receive a Participant object for themselves from Locus,
|
|
@@ -805,6 +1143,176 @@ export default class LocusInfo extends EventsScope {
|
|
|
805
1143
|
}
|
|
806
1144
|
}
|
|
807
1145
|
|
|
1146
|
+
/**
|
|
1147
|
+
* Helper that handles the common logic for reactivating a stopped HashTreeParser when
|
|
1148
|
+
* a newer "replaces" is detected. Used by both the message and API response parser switch methods.
|
|
1149
|
+
*
|
|
1150
|
+
* @param {string} callerName - name of the calling method, used in log messages
|
|
1151
|
+
* @param {string} locusUrl - the locus URL of the stopped parser
|
|
1152
|
+
* @param {HashTreeParserEntry} stoppedEntry - the stopped parser entry
|
|
1153
|
+
* @param {ReplacesInfo} replaces - replacement info extracted from self
|
|
1154
|
+
* @param {Function} resumeCallback - callback to invoke after reactivation to resume the parser
|
|
1155
|
+
* @returns {void}
|
|
1156
|
+
*/
|
|
1157
|
+
private resumeStoppedParser(
|
|
1158
|
+
callerName: string,
|
|
1159
|
+
locusUrl: string,
|
|
1160
|
+
stoppedEntry: HashTreeParserEntry,
|
|
1161
|
+
replaces: ReplacesInfo | undefined,
|
|
1162
|
+
resumeCallback: () => void
|
|
1163
|
+
): void {
|
|
1164
|
+
// this check is just for typescript, it should never happen, replaces should always be defined
|
|
1165
|
+
if (!replaces) {
|
|
1166
|
+
LoggerProxy.logger.info(
|
|
1167
|
+
`Locus-info:index#${callerName} --> received data for stopped HashTreeParser with locusUrl ${locusUrl}, but no replaces info provided, so not re-activating the parser`
|
|
1168
|
+
);
|
|
1169
|
+
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
if (replaces.replacedAt <= (stoppedEntry.replacedAt || '')) {
|
|
1174
|
+
LoggerProxy.logger.info(
|
|
1175
|
+
`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`
|
|
1176
|
+
);
|
|
1177
|
+
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
LoggerProxy.logger.info(
|
|
1182
|
+
`Locus-info:index#${callerName} --> reactivating HashTreeParser for locusUrl=${locusUrl}, which replaces ${replaces.locusUrl}`
|
|
1183
|
+
);
|
|
1184
|
+
|
|
1185
|
+
const replacedEntry = this.hashTreeParsers.get(replaces.locusUrl);
|
|
1186
|
+
|
|
1187
|
+
if (replacedEntry) {
|
|
1188
|
+
replacedEntry.replacedAt = replaces.replacedAt;
|
|
1189
|
+
replacedEntry.parser.stop();
|
|
1190
|
+
} else {
|
|
1191
|
+
LoggerProxy.logger.warn(
|
|
1192
|
+
`Locus-info:index#${callerName} --> the parser that is supposed to be replaced with the currently reactivated parser is not found, locusUrl=${replaces.locusUrl}`
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
stoppedEntry.initializedFromHashTree = false;
|
|
1197
|
+
this.hashTreeObjectId2ParticipantId.clear();
|
|
1198
|
+
|
|
1199
|
+
resumeCallback();
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Handles an API response whose locusUrl doesn't match any active HashTreeParser
|
|
1204
|
+
* (either no entry exists, or the existing entry is stopped).
|
|
1205
|
+
* Creates a new parser or reactivates a stopped one using initializeFromGetLociResponse.
|
|
1206
|
+
*
|
|
1207
|
+
* @param {string} locusUrl - the locus URL from the API response
|
|
1208
|
+
* @param {LocusDTO} locus - the locus DTO from the API response
|
|
1209
|
+
* @returns {void}
|
|
1210
|
+
*/
|
|
1211
|
+
private handleHashTreeParserSwitchForAPIResponse(locusUrl: string, locus: LocusDTO): void {
|
|
1212
|
+
const entry = this.hashTreeParsers.get(locusUrl);
|
|
1213
|
+
|
|
1214
|
+
const replaces = getReplaceInfoFromSelf(
|
|
1215
|
+
locus.self,
|
|
1216
|
+
// @ts-ignore
|
|
1217
|
+
this.webex.internal.device.url
|
|
1218
|
+
);
|
|
1219
|
+
|
|
1220
|
+
if (!entry) {
|
|
1221
|
+
LoggerProxy.logger.info(
|
|
1222
|
+
`Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> no parser for locusUrl ${locusUrl}, creating a new one`
|
|
1223
|
+
);
|
|
1224
|
+
|
|
1225
|
+
const parser = this.createHashTreeParser({
|
|
1226
|
+
locusUrl,
|
|
1227
|
+
initialLocus: {locus: null, dataSets: []},
|
|
1228
|
+
metadata: null,
|
|
1229
|
+
replacedAt: replaces?.replacedAt,
|
|
1230
|
+
});
|
|
1231
|
+
|
|
1232
|
+
parser.initializeFromGetLociResponse(locus);
|
|
1233
|
+
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
if (entry.parser.state !== 'stopped') {
|
|
1238
|
+
LoggerProxy.logger.warn(
|
|
1239
|
+
`Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> unexpected parser state "${entry.parser.state}" for locusUrl ${locusUrl}`
|
|
1240
|
+
);
|
|
1241
|
+
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
this.resumeStoppedParser(
|
|
1246
|
+
'handleHashTreeParserSwitchForAPIResponse',
|
|
1247
|
+
locusUrl,
|
|
1248
|
+
entry,
|
|
1249
|
+
replaces,
|
|
1250
|
+
() => entry.parser.resumeFromApiResponse(locus)
|
|
1251
|
+
);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Checks if the hash tree message should trigger a switch to a different HashTreeParser
|
|
1256
|
+
*
|
|
1257
|
+
* @param {HashTreeMessage} message incoming hash tree message
|
|
1258
|
+
* @returns {boolean} true if the message was handled as a parser switch, false otherwise
|
|
1259
|
+
*/
|
|
1260
|
+
private handleHashTreeParserSwitch(message: HashTreeMessage): boolean {
|
|
1261
|
+
const entry = this.hashTreeParsers.get(message.locusUrl);
|
|
1262
|
+
|
|
1263
|
+
const self = message.locusStateElements?.find((el) => isSelf(el))?.data;
|
|
1264
|
+
const replaces = getReplaceInfoFromSelf(
|
|
1265
|
+
self,
|
|
1266
|
+
// @ts-ignore
|
|
1267
|
+
this.webex.internal.device.url
|
|
1268
|
+
);
|
|
1269
|
+
|
|
1270
|
+
if (!entry) {
|
|
1271
|
+
// Metadata object that contains information about visible datasets is needed to initialize the HashTreeParser,
|
|
1272
|
+
// but it's buried inside the message, we need to find it and pass it to HashTreeParser constructor
|
|
1273
|
+
const metadata = message.locusStateElements?.find((el) => isMetadata(el));
|
|
1274
|
+
|
|
1275
|
+
if (metadata && metadata.data?.visibleDataSets?.length > 0) {
|
|
1276
|
+
LoggerProxy.logger.info(
|
|
1277
|
+
`Locus-info:index#handleHashTreeParserSwitch --> no hash tree parser found for locusUrl ${message.locusUrl}, creating a new one`
|
|
1278
|
+
);
|
|
1279
|
+
|
|
1280
|
+
const parser = this.createHashTreeParser({
|
|
1281
|
+
locusUrl: message.locusUrl,
|
|
1282
|
+
initialLocus: {
|
|
1283
|
+
locus: null,
|
|
1284
|
+
dataSets: message.dataSets,
|
|
1285
|
+
},
|
|
1286
|
+
metadata: {
|
|
1287
|
+
htMeta: metadata.htMeta,
|
|
1288
|
+
visibleDataSets: metadata.data.visibleDataSets,
|
|
1289
|
+
},
|
|
1290
|
+
replacedAt: replaces?.replacedAt,
|
|
1291
|
+
});
|
|
1292
|
+
|
|
1293
|
+
// handle the message with the new parser
|
|
1294
|
+
parser.handleMessage(message);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
return true;
|
|
1298
|
+
}
|
|
1299
|
+
if (entry.parser.state === 'stopped') {
|
|
1300
|
+
// 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
|
|
1301
|
+
// this happens when you move from breakout A -> breakout B -> back to breakout A
|
|
1302
|
+
this.resumeStoppedParser(
|
|
1303
|
+
'handleHashTreeParserSwitch',
|
|
1304
|
+
message.locusUrl,
|
|
1305
|
+
entry,
|
|
1306
|
+
replaces,
|
|
1307
|
+
() => entry.parser.resumeFromMessage(message)
|
|
1308
|
+
);
|
|
1309
|
+
|
|
1310
|
+
return true;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
return false;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
808
1316
|
/**
|
|
809
1317
|
* Handles a hash tree message received from Locus.
|
|
810
1318
|
*
|
|
@@ -823,33 +1331,61 @@ export default class LocusInfo extends EventsScope {
|
|
|
823
1331
|
return;
|
|
824
1332
|
}
|
|
825
1333
|
|
|
826
|
-
this.
|
|
1334
|
+
const parserSwitched = this.handleHashTreeParserSwitch(message);
|
|
1335
|
+
|
|
1336
|
+
if (parserSwitched) {
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
const entry = this.hashTreeParsers.get(message.locusUrl);
|
|
1341
|
+
|
|
1342
|
+
// the check is just for typescript, the case of no entry in hashTreeParsers is handled in handleHashTreeParserSwitch() above
|
|
1343
|
+
if (entry) {
|
|
1344
|
+
entry.parser.handleMessage(message);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* Triggers a sync of all hash tree datasets for all hash tree parsers associated with this meeting.
|
|
1350
|
+
* The syncs are executed sequentially within each parser.
|
|
1351
|
+
*
|
|
1352
|
+
* @param {Object} [options={}] - Options for syncing
|
|
1353
|
+
* @param {boolean} [options.onlyLLM=false] - Whether to sync only LLM based data sets
|
|
1354
|
+
* @returns {Promise<void>}
|
|
1355
|
+
*/
|
|
1356
|
+
async syncAllHashTreeDatasets(options: {onlyLLM?: boolean} = {}): Promise<void> {
|
|
1357
|
+
for (const [, entry] of this.hashTreeParsers) {
|
|
1358
|
+
if (entry.parser) {
|
|
1359
|
+
// eslint-disable-next-line no-await-in-loop
|
|
1360
|
+
await entry.parser.syncAllDatasets(options);
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
827
1363
|
}
|
|
828
1364
|
|
|
829
1365
|
/**
|
|
830
1366
|
* Callback registered with HashTreeParser to receive locus info updates.
|
|
831
1367
|
* Updates our locus info based on the data parsed by the hash tree parser.
|
|
832
1368
|
*
|
|
833
|
-
* @param {
|
|
834
|
-
* @param {
|
|
1369
|
+
* @param {string} locusUrl - the locus URL for which the update is received
|
|
1370
|
+
* @param {LocusInfoUpdate} update - Details about the update.
|
|
835
1371
|
* @returns {void}
|
|
836
1372
|
*/
|
|
837
|
-
private updateFromHashTree(
|
|
838
|
-
updateType
|
|
839
|
-
data?: {updatedObjects: HashTreeObject[]}
|
|
840
|
-
) {
|
|
841
|
-
switch (updateType) {
|
|
1373
|
+
private updateFromHashTree(locusUrl: string, update: LocusInfoUpdate) {
|
|
1374
|
+
switch (update.updateType) {
|
|
842
1375
|
case LocusInfoUpdateType.OBJECTS_UPDATED: {
|
|
843
1376
|
// initialize our new locus
|
|
844
1377
|
let locus: LocusDTO = {
|
|
845
1378
|
participants: [],
|
|
846
|
-
jsSdkMeta: {
|
|
1379
|
+
jsSdkMeta: {
|
|
1380
|
+
removedParticipantIds: [],
|
|
1381
|
+
forceReplaceMembers: false,
|
|
1382
|
+
},
|
|
847
1383
|
};
|
|
848
1384
|
|
|
849
1385
|
// first go over all the updates and check what happens with the main locus object
|
|
850
1386
|
let locusObjectStateAfterUpdates: LocusObjectStateAfterUpdates =
|
|
851
1387
|
LocusObjectStateAfterUpdates.unchanged;
|
|
852
|
-
|
|
1388
|
+
update.updatedObjects.forEach((object) => {
|
|
853
1389
|
if (object.htMeta.elementId.type.toLowerCase() === ObjectType.locus) {
|
|
854
1390
|
if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.updated) {
|
|
855
1391
|
// this code doesn't supported it right now,
|
|
@@ -876,19 +1412,39 @@ export default class LocusInfo extends EventsScope {
|
|
|
876
1412
|
}
|
|
877
1413
|
});
|
|
878
1414
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1415
|
+
const hashTreeParserEntry = this.hashTreeParsers.get(locusUrl);
|
|
1416
|
+
|
|
1417
|
+
if (!hashTreeParserEntry) {
|
|
1418
|
+
LoggerProxy.logger.warn(
|
|
1419
|
+
`Locus-info:index#updateFromHashTree --> no HashTreeParser found for locusUrl ${locusUrl} when trying to apply updates from hash tree`
|
|
1420
|
+
);
|
|
1421
|
+
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
if (!hashTreeParserEntry.initializedFromHashTree) {
|
|
1426
|
+
// this is the first time we're getting an update for this locusUrl,
|
|
1427
|
+
// so it's probably a move to/from breakout. We need to start from a clean state,
|
|
1428
|
+
// so empty locus and we rely on Locus giving us sufficient data in the updates to populate it.
|
|
1429
|
+
LoggerProxy.logger.info(
|
|
1430
|
+
`Locus-info:index#updateFromHashTree --> first INITIAL update for locusUrl ${locusUrl}, starting from empty state`
|
|
1431
|
+
);
|
|
1432
|
+
hashTreeParserEntry.initializedFromHashTree = true;
|
|
1433
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1434
|
+
locus.jsSdkMeta!.forceReplaceMembers = true;
|
|
1435
|
+
} else if (
|
|
1436
|
+
// if Locus object is unchanged or removed, we need to keep using the existing locus
|
|
1437
|
+
// because the rest of the locusInfo code expects locus to always be present (with at least some of the fields)
|
|
1438
|
+
// if it gets updated, we only need to have the fields that are not part of "locus" object (like "info" or "mediaShares")
|
|
1439
|
+
// so that when Locus object gets updated, if the new one is missing some field, that field will
|
|
1440
|
+
// be removed from our locusInfo
|
|
885
1441
|
locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.unchanged ||
|
|
886
1442
|
locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.removed
|
|
887
1443
|
) {
|
|
888
1444
|
// copy over all of existing locus except participants
|
|
889
1445
|
LocusDtoTopLevelKeys.forEach((key) => {
|
|
890
1446
|
if (key !== 'participants') {
|
|
891
|
-
locus[key] = cloneDeep(this[key]);
|
|
1447
|
+
(locus as Record<string, any>)[key] = cloneDeep((this as Record<string, any>)[key]);
|
|
892
1448
|
}
|
|
893
1449
|
});
|
|
894
1450
|
} else {
|
|
@@ -896,14 +1452,16 @@ export default class LocusInfo extends EventsScope {
|
|
|
896
1452
|
// (except participants, which need to stay empty - that means "no participant changes")
|
|
897
1453
|
Object.values(ObjectTypeToLocusKeyMap).forEach((locusDtoKey) => {
|
|
898
1454
|
if (locusDtoKey !== 'participants') {
|
|
899
|
-
locus[locusDtoKey] = cloneDeep(
|
|
1455
|
+
(locus as Record<string, any>)[locusDtoKey] = cloneDeep(
|
|
1456
|
+
(this as Record<string, any>)[locusDtoKey]
|
|
1457
|
+
);
|
|
900
1458
|
}
|
|
901
1459
|
});
|
|
902
1460
|
}
|
|
903
1461
|
|
|
904
1462
|
LoggerProxy.logger.info(
|
|
905
1463
|
`Locus-info:index#updateFromHashTree --> LOCUS object is ${locusObjectStateAfterUpdates}, all updates: ${JSON.stringify(
|
|
906
|
-
|
|
1464
|
+
update.updatedObjects.map((o) => ({
|
|
907
1465
|
type: o.htMeta.elementId.type,
|
|
908
1466
|
id: o.htMeta.elementId.id,
|
|
909
1467
|
hasData: !!o.data,
|
|
@@ -911,7 +1469,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
911
1469
|
)}`
|
|
912
1470
|
);
|
|
913
1471
|
// now apply all the updates from the hash tree onto the locus
|
|
914
|
-
|
|
1472
|
+
update.updatedObjects.forEach((object) => {
|
|
915
1473
|
locus = this.updateLocusFromHashTreeObject(object, locus);
|
|
916
1474
|
});
|
|
917
1475
|
|
|
@@ -930,6 +1488,21 @@ export default class LocusInfo extends EventsScope {
|
|
|
930
1488
|
);
|
|
931
1489
|
this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.SELF_REMOVED);
|
|
932
1490
|
}
|
|
1491
|
+
break;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
case LocusInfoUpdateType.LOCUS_NOT_FOUND: {
|
|
1495
|
+
LoggerProxy.logger.info(
|
|
1496
|
+
`Locus-info:index#updateFromHashTree --> received LOCUS_NOT_FOUND for ${locusUrl}, triggering syncMeetings`
|
|
1497
|
+
);
|
|
1498
|
+
this.webex.meetings
|
|
1499
|
+
.syncMeetings({keepOnlyLocusMeetings: false, skipHashTreeSync: true})
|
|
1500
|
+
.catch((syncError) => {
|
|
1501
|
+
LoggerProxy.logger.error(
|
|
1502
|
+
`Locus-info:index#updateFromHashTree --> syncMeetings failed after LOCUS_NOT_FOUND: ${syncError}`
|
|
1503
|
+
);
|
|
1504
|
+
});
|
|
1505
|
+
break;
|
|
933
1506
|
}
|
|
934
1507
|
}
|
|
935
1508
|
}
|
|
@@ -941,12 +1514,18 @@ export default class LocusInfo extends EventsScope {
|
|
|
941
1514
|
* @memberof LocusInfo
|
|
942
1515
|
*/
|
|
943
1516
|
parse(meeting: any, data: any) {
|
|
944
|
-
if (this.
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
data.
|
|
949
|
-
|
|
1517
|
+
if (this.isUsingHashTrees()) {
|
|
1518
|
+
if (data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS) {
|
|
1519
|
+
// sync meetings response follows the format of "not wrapped" locus API responses,
|
|
1520
|
+
// so has no dataSets nor Metadata
|
|
1521
|
+
this.handleLocusAPIResponse(meeting, {...data.locus});
|
|
1522
|
+
} else {
|
|
1523
|
+
this.handleHashTreeMessage(
|
|
1524
|
+
meeting,
|
|
1525
|
+
data.eventType,
|
|
1526
|
+
data.stateElementsMessage as HashTreeMessage
|
|
1527
|
+
);
|
|
1528
|
+
}
|
|
950
1529
|
} else {
|
|
951
1530
|
const {eventType} = data;
|
|
952
1531
|
|
|
@@ -1011,20 +1590,20 @@ export default class LocusInfo extends EventsScope {
|
|
|
1011
1590
|
* @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
|
|
1012
1591
|
* @param {object} locus locus object
|
|
1013
1592
|
* @param {object} metadata locus hash trees metadata
|
|
1014
|
-
* @param {string} eventType locus event
|
|
1015
1593
|
* @param {DataSet[]} dataSets
|
|
1594
|
+
* @param {string} eventType locus event
|
|
1016
1595
|
* @returns {void}
|
|
1017
1596
|
*/
|
|
1018
1597
|
private onFullLocusWithHashTrees(
|
|
1019
1598
|
debugText: string,
|
|
1020
1599
|
locus: any,
|
|
1021
1600
|
metadata: Metadata,
|
|
1022
|
-
|
|
1023
|
-
|
|
1601
|
+
dataSets: Array<DataSet>,
|
|
1602
|
+
eventType?: string
|
|
1024
1603
|
) {
|
|
1025
|
-
if (!this.
|
|
1604
|
+
if (!this.hashTreeParsers.has(locus.url)) {
|
|
1026
1605
|
LoggerProxy.logger.info(
|
|
1027
|
-
`Locus-info:index#onFullLocus (${debugText}) --> creating hash tree parser`
|
|
1606
|
+
`Locus-info:index#onFullLocus (${debugText}) --> creating hash tree parser for locusUrl=${locus.url}`
|
|
1028
1607
|
);
|
|
1029
1608
|
LoggerProxy.logger.info(
|
|
1030
1609
|
`Locus-info:index#onFullLocus (${debugText}) --> dataSets:`,
|
|
@@ -1034,10 +1613,14 @@ export default class LocusInfo extends EventsScope {
|
|
|
1034
1613
|
' and metadata:',
|
|
1035
1614
|
metadata
|
|
1036
1615
|
);
|
|
1037
|
-
this.
|
|
1616
|
+
this.createHashTreeParser({
|
|
1617
|
+
locusUrl: locus.url,
|
|
1038
1618
|
initialLocus: {locus, dataSets},
|
|
1039
1619
|
metadata,
|
|
1040
1620
|
});
|
|
1621
|
+
// we have a full locus to start with, so we consider Locus info to be "initialized"
|
|
1622
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1623
|
+
this.hashTreeParsers.get(locus.url)!.initializedFromHashTree = true;
|
|
1041
1624
|
this.onFullLocusCommon(locus, eventType);
|
|
1042
1625
|
} else {
|
|
1043
1626
|
// in this case the Locus we're getting is not necessarily the full one
|
|
@@ -1099,7 +1682,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1099
1682
|
);
|
|
1100
1683
|
}
|
|
1101
1684
|
// this is the new hashmap Locus DTO format (only applicable to webinars for now)
|
|
1102
|
-
this.onFullLocusWithHashTrees(debugText, locus, metadata,
|
|
1685
|
+
this.onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType);
|
|
1103
1686
|
} else {
|
|
1104
1687
|
this.onFullLocusClassic(debugText, locus, eventType);
|
|
1105
1688
|
}
|
|
@@ -1116,7 +1699,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1116
1699
|
this.participants = locus.participants;
|
|
1117
1700
|
this.participants?.forEach((participant) => {
|
|
1118
1701
|
// participant.htMeta is set only for hash tree based locus
|
|
1119
|
-
if (participant.htMeta?.elementId.id) {
|
|
1702
|
+
if (typeof participant.htMeta?.elementId.id === 'number') {
|
|
1120
1703
|
this.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
|
|
1121
1704
|
}
|
|
1122
1705
|
});
|
|
@@ -1179,20 +1762,61 @@ export default class LocusInfo extends EventsScope {
|
|
|
1179
1762
|
}
|
|
1180
1763
|
}
|
|
1181
1764
|
|
|
1765
|
+
/**
|
|
1766
|
+
* Makes sure that passed in locus object has a participant object for self.
|
|
1767
|
+
*
|
|
1768
|
+
* @param {LocusDTO} locus The locus object to check and modify if needed
|
|
1769
|
+
* @returns {void}
|
|
1770
|
+
*/
|
|
1771
|
+
ensureSelfParticipantExists(locus: any) {
|
|
1772
|
+
const {self} = locus;
|
|
1773
|
+
|
|
1774
|
+
// sanity check, this should never fail
|
|
1775
|
+
if (!self?.identity || !Array.isArray(locus.participants)) {
|
|
1776
|
+
LoggerProxy.logger.warn(
|
|
1777
|
+
`Locus-info:index#ensureSelfParticipantExists --> locus object is missing required fields, cannot ensure self participant exists. self?.identity="${self?.identity}"`
|
|
1778
|
+
);
|
|
1779
|
+
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
const selfExists = locus.participants.some(
|
|
1784
|
+
(participant) => participant.identity === self.identity
|
|
1785
|
+
);
|
|
1786
|
+
|
|
1787
|
+
if (!selfExists) {
|
|
1788
|
+
locus.participants.push({...self});
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1182
1792
|
/**
|
|
1183
1793
|
* @param {Object} locus
|
|
1184
1794
|
* @returns {undefined}
|
|
1185
1795
|
* @memberof LocusInfo
|
|
1186
1796
|
*/
|
|
1187
1797
|
onDeltaLocus(locus: any) {
|
|
1188
|
-
const isReplaceMembers =
|
|
1798
|
+
const isReplaceMembers =
|
|
1799
|
+
locus.jsSdkMeta?.forceReplaceMembers !== undefined
|
|
1800
|
+
? locus.jsSdkMeta.forceReplaceMembers
|
|
1801
|
+
: ControlsUtils.isNeedReplaceMembers(this.controls, locus.controls);
|
|
1802
|
+
|
|
1803
|
+
if (isReplaceMembers) {
|
|
1804
|
+
// when we're moving between breakouts, Locus sometimes doesn't send us
|
|
1805
|
+
// any participants at all for a few seconds
|
|
1806
|
+
// Web app relies on having at least the self participant always there
|
|
1807
|
+
// so we copy self into participants if it's not there.
|
|
1808
|
+
this.ensureSelfParticipantExists(locus);
|
|
1809
|
+
}
|
|
1189
1810
|
this.mergeParticipants(this.participants, locus.participants);
|
|
1190
|
-
this.updateLocusInfo(locus);
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1811
|
+
const updatesApplied = this.updateLocusInfo(locus);
|
|
1812
|
+
|
|
1813
|
+
if (updatesApplied) {
|
|
1814
|
+
this.updateParticipants(
|
|
1815
|
+
locus.participants,
|
|
1816
|
+
locus.jsSdkMeta?.removedParticipantIds,
|
|
1817
|
+
isReplaceMembers
|
|
1818
|
+
);
|
|
1819
|
+
}
|
|
1196
1820
|
this.isMeetingActive();
|
|
1197
1821
|
}
|
|
1198
1822
|
|
|
@@ -1202,11 +1826,11 @@ export default class LocusInfo extends EventsScope {
|
|
|
1202
1826
|
* @memberof LocusInfo
|
|
1203
1827
|
*/
|
|
1204
1828
|
updateLocusInfo(locus) {
|
|
1205
|
-
if (
|
|
1829
|
+
if (MeetingsUtil.isSelfMovedOrBreakoutEnded(locus)) {
|
|
1206
1830
|
// When moved to a breakout session locus sends a message for the previous locus
|
|
1207
1831
|
// indicating that we have been moved. It isn't helpful to continue parsing this
|
|
1208
1832
|
// as it gets interpreted as if we have left the call
|
|
1209
|
-
return;
|
|
1833
|
+
return false;
|
|
1210
1834
|
}
|
|
1211
1835
|
|
|
1212
1836
|
this.updateControls(locus.controls, locus.self);
|
|
@@ -1226,6 +1850,8 @@ export default class LocusInfo extends EventsScope {
|
|
|
1226
1850
|
this.updateLinks(locus.links);
|
|
1227
1851
|
this.compareAndUpdate();
|
|
1228
1852
|
// update which required to compare different objects from locus
|
|
1853
|
+
|
|
1854
|
+
return true;
|
|
1229
1855
|
}
|
|
1230
1856
|
|
|
1231
1857
|
/**
|
|
@@ -1264,7 +1890,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1264
1890
|
// @ts-ignore
|
|
1265
1891
|
const partner = this.getLocusPartner(this.participants, this.self);
|
|
1266
1892
|
|
|
1267
|
-
this.updateMeeting({partner});
|
|
1893
|
+
this.callbacks.updateMeeting({partner});
|
|
1268
1894
|
|
|
1269
1895
|
// Check if guest user needs to be checked here
|
|
1270
1896
|
|
|
@@ -1285,8 +1911,19 @@ export default class LocusInfo extends EventsScope {
|
|
|
1285
1911
|
options: {
|
|
1286
1912
|
meetingId: this.meetingId,
|
|
1287
1913
|
},
|
|
1914
|
+
payload: {
|
|
1915
|
+
eventData: {
|
|
1916
|
+
joinInProgress: this.destroyMeetingSuspended,
|
|
1917
|
+
},
|
|
1918
|
+
},
|
|
1288
1919
|
});
|
|
1289
1920
|
|
|
1921
|
+
if (this.destroyMeetingSuspended) {
|
|
1922
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
1923
|
+
meetingId: this.meetingId,
|
|
1924
|
+
reason: 'CALL_INACTIVE',
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1290
1927
|
this.emitScoped(
|
|
1291
1928
|
{
|
|
1292
1929
|
file: 'locus-info',
|
|
@@ -1311,7 +1948,18 @@ export default class LocusInfo extends EventsScope {
|
|
|
1311
1948
|
options: {
|
|
1312
1949
|
meetingId: this.meetingId,
|
|
1313
1950
|
},
|
|
1951
|
+
payload: {
|
|
1952
|
+
eventData: {
|
|
1953
|
+
joinInProgress: this.destroyMeetingSuspended,
|
|
1954
|
+
},
|
|
1955
|
+
},
|
|
1314
1956
|
});
|
|
1957
|
+
if (this.destroyMeetingSuspended) {
|
|
1958
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
1959
|
+
meetingId: this.meetingId,
|
|
1960
|
+
reason: 'PARTNER_LEFT',
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1315
1963
|
this.emitScoped(
|
|
1316
1964
|
{
|
|
1317
1965
|
file: 'locus-info',
|
|
@@ -1338,8 +1986,19 @@ export default class LocusInfo extends EventsScope {
|
|
|
1338
1986
|
options: {
|
|
1339
1987
|
meetingId: this.meetingId,
|
|
1340
1988
|
},
|
|
1989
|
+
payload: {
|
|
1990
|
+
eventData: {
|
|
1991
|
+
joinInProgress: this.destroyMeetingSuspended,
|
|
1992
|
+
},
|
|
1993
|
+
},
|
|
1341
1994
|
});
|
|
1342
1995
|
|
|
1996
|
+
if (this.destroyMeetingSuspended) {
|
|
1997
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
1998
|
+
meetingId: this.meetingId,
|
|
1999
|
+
reason: 'SELF_LEFT',
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
1343
2002
|
this.emitScoped(
|
|
1344
2003
|
{
|
|
1345
2004
|
file: 'locus-info',
|
|
@@ -1353,56 +2012,82 @@ export default class LocusInfo extends EventsScope {
|
|
|
1353
2012
|
);
|
|
1354
2013
|
}
|
|
1355
2014
|
} else if (this.parsedLocus.fullState?.type === _MEETING_) {
|
|
1356
|
-
if (
|
|
1357
|
-
this.
|
|
1358
|
-
|
|
2015
|
+
if (this.fullState && MeetingsUtil.isWholeMeetingEnded(this.fullState)) {
|
|
2016
|
+
if (this.destroyMeetingSuspended) {
|
|
2017
|
+
LoggerProxy.logger.info(
|
|
2018
|
+
'Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (MEETING_INACTIVE_TERMINATING) because destroyMeeting is suspended'
|
|
2019
|
+
);
|
|
2020
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
2021
|
+
meetingId: this.meetingId,
|
|
2022
|
+
reason: 'MEETING_INACTIVE_TERMINATING',
|
|
2023
|
+
});
|
|
2024
|
+
} else {
|
|
2025
|
+
LoggerProxy.logger.warn(
|
|
2026
|
+
'Locus-info:index#isMeetingActive --> Meeting is ending due to inactive'
|
|
2027
|
+
);
|
|
2028
|
+
|
|
1359
2029
|
// @ts-ignore
|
|
1360
|
-
this.
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
2030
|
+
this.webex.internal.newMetrics.submitClientEvent({
|
|
2031
|
+
name: 'client.call.remote-ended',
|
|
2032
|
+
options: {
|
|
2033
|
+
meetingId: this.meetingId,
|
|
2034
|
+
},
|
|
2035
|
+
});
|
|
1365
2036
|
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
EVENTS.DESTROY_MEETING,
|
|
1379
|
-
{
|
|
1380
|
-
reason: MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
|
|
1381
|
-
shouldLeave: false,
|
|
1382
|
-
}
|
|
1383
|
-
);
|
|
2037
|
+
this.emitScoped(
|
|
2038
|
+
{
|
|
2039
|
+
file: 'locus-info',
|
|
2040
|
+
function: 'isMeetingActive',
|
|
2041
|
+
},
|
|
2042
|
+
EVENTS.DESTROY_MEETING,
|
|
2043
|
+
{
|
|
2044
|
+
reason: MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
|
|
2045
|
+
shouldLeave: false,
|
|
2046
|
+
}
|
|
2047
|
+
);
|
|
2048
|
+
}
|
|
1384
2049
|
}
|
|
1385
2050
|
// If you are guest and you are removed from the meeting
|
|
1386
2051
|
// You wont get any further events
|
|
1387
2052
|
else if (this.parsedLocus.self && this.parsedLocus.self.removed) {
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
2053
|
+
if (this.destroyMeetingSuspended) {
|
|
2054
|
+
LoggerProxy.logger.info(
|
|
2055
|
+
'Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (SELF_REMOVED) because destroyMeeting is suspended'
|
|
2056
|
+
);
|
|
2057
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
|
|
2058
|
+
meetingId: this.meetingId,
|
|
2059
|
+
reason: 'SELF_REMOVED',
|
|
2060
|
+
});
|
|
2061
|
+
} else {
|
|
2062
|
+
this.emitScoped(
|
|
2063
|
+
{
|
|
2064
|
+
file: 'locus-info',
|
|
2065
|
+
function: 'isMeetingActive',
|
|
2066
|
+
},
|
|
2067
|
+
EVENTS.DESTROY_MEETING,
|
|
2068
|
+
{
|
|
2069
|
+
reason: MEETING_REMOVED_REASON.SELF_REMOVED,
|
|
2070
|
+
shouldLeave: false,
|
|
2071
|
+
}
|
|
2072
|
+
);
|
|
2073
|
+
}
|
|
1400
2074
|
}
|
|
1401
2075
|
} else {
|
|
1402
2076
|
LoggerProxy.logger.warn('Locus-info:index#isMeetingActive --> Meeting Type is unknown.');
|
|
1403
2077
|
}
|
|
1404
2078
|
}
|
|
1405
2079
|
|
|
2080
|
+
/**
|
|
2081
|
+
* Suspends or resumes the emission of DESTROY_MEETING events in certain situations.
|
|
2082
|
+
* Used by joinWithMedia to prevent meeting destruction during retry flows.
|
|
2083
|
+
* @param {boolean} suspend - true to suppress, false to resume
|
|
2084
|
+
* @returns {undefined}
|
|
2085
|
+
* @memberof LocusInfo
|
|
2086
|
+
*/
|
|
2087
|
+
suspendDestroyMeeting(suspend: boolean) {
|
|
2088
|
+
this.destroyMeetingSuspended = suspend;
|
|
2089
|
+
}
|
|
2090
|
+
|
|
1406
2091
|
/**
|
|
1407
2092
|
* checks if the host permissions have changed while in the meeting
|
|
1408
2093
|
* This would be the case if your role as host or moderator has been updated
|
|
@@ -1623,6 +2308,8 @@ export default class LocusInfo extends EventsScope {
|
|
|
1623
2308
|
state,
|
|
1624
2309
|
modifiedBy: current.record.modifiedBy,
|
|
1625
2310
|
lastModified: current.record.lastModified,
|
|
2311
|
+
modifiedByServiceAppName: current.record.modifiedByServiceAppName,
|
|
2312
|
+
modifiedByServiceAppId: current.record.modifiedByServiceAppId,
|
|
1626
2313
|
}
|
|
1627
2314
|
);
|
|
1628
2315
|
}
|
|
@@ -1718,6 +2405,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1718
2405
|
|
|
1719
2406
|
if (hasBreakoutChanged) {
|
|
1720
2407
|
const {breakout} = current;
|
|
2408
|
+
|
|
1721
2409
|
breakout.breakoutMoveId = SelfUtils.getReplacedBreakoutMoveId(
|
|
1722
2410
|
self,
|
|
1723
2411
|
this.webex.internal.device.url
|
|
@@ -1751,7 +2439,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1751
2439
|
if (hasEntryExitToneChanged) {
|
|
1752
2440
|
const {entryExitTone} = current;
|
|
1753
2441
|
|
|
1754
|
-
this.updateMeeting({entryExitTone});
|
|
2442
|
+
this.callbacks.updateMeeting({entryExitTone});
|
|
1755
2443
|
|
|
1756
2444
|
this.emitScoped(
|
|
1757
2445
|
{
|
|
@@ -1770,7 +2458,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1770
2458
|
if (hasVideoEnabledChanged) {
|
|
1771
2459
|
const {videoEnabled} = current;
|
|
1772
2460
|
|
|
1773
|
-
this.updateMeeting({unmuteVideoAllowed: videoEnabled});
|
|
2461
|
+
this.callbacks.updateMeeting({unmuteVideoAllowed: videoEnabled});
|
|
1774
2462
|
|
|
1775
2463
|
this.emitScoped(
|
|
1776
2464
|
{
|
|
@@ -1862,14 +2550,14 @@ export default class LocusInfo extends EventsScope {
|
|
|
1862
2550
|
updateConversationUrl(conversationUrl: string, info: any) {
|
|
1863
2551
|
if (conversationUrl && !isEqual(this.conversationUrl, conversationUrl)) {
|
|
1864
2552
|
this.conversationUrl = conversationUrl;
|
|
1865
|
-
this.updateMeeting({conversationUrl});
|
|
2553
|
+
this.callbacks.updateMeeting({conversationUrl});
|
|
1866
2554
|
} else if (
|
|
1867
2555
|
info &&
|
|
1868
2556
|
info.conversationUrl &&
|
|
1869
2557
|
!isEqual(this.conversationUrl, info.conversationUrl)
|
|
1870
2558
|
) {
|
|
1871
2559
|
this.conversationUrl = info.conversationUrl;
|
|
1872
|
-
this.updateMeeting({conversationUrl: info.conversationUrl});
|
|
2560
|
+
this.callbacks.updateMeeting({conversationUrl: info.conversationUrl});
|
|
1873
2561
|
}
|
|
1874
2562
|
}
|
|
1875
2563
|
|
|
@@ -1931,7 +2619,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1931
2619
|
if (fullState && !isEqual(this.fullState, fullState)) {
|
|
1932
2620
|
const result = FullState.getFullState(this.fullState, fullState);
|
|
1933
2621
|
|
|
1934
|
-
this.updateMeeting(result.current);
|
|
2622
|
+
this.callbacks.updateMeeting(result.current);
|
|
1935
2623
|
|
|
1936
2624
|
if (result.updates.meetingStateChangedTo) {
|
|
1937
2625
|
this.emitScoped(
|
|
@@ -1975,7 +2663,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
1975
2663
|
if (host && !isEqual(this.host, host)) {
|
|
1976
2664
|
const parsedHosts = HostUtils.getHosts(this.host, host);
|
|
1977
2665
|
|
|
1978
|
-
this.updateMeeting(parsedHosts.current);
|
|
2666
|
+
this.callbacks.updateMeeting(parsedHosts.current);
|
|
1979
2667
|
this.parsedLocus.host = parsedHosts.current;
|
|
1980
2668
|
if (parsedHosts.updates.isNewHost) {
|
|
1981
2669
|
this.compareAndUpdateFlags.compareSelfAndHost = true;
|
|
@@ -2005,9 +2693,19 @@ export default class LocusInfo extends EventsScope {
|
|
|
2005
2693
|
*/
|
|
2006
2694
|
updateMeetingInfo(info: object, self?: object) {
|
|
2007
2695
|
const roles = self ? SelfUtils.getRoles(self) : this.parsedLocus.self?.roles || [];
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2696
|
+
const isJoined = SelfUtils.isJoined(self || this.parsedLocus.self);
|
|
2697
|
+
|
|
2698
|
+
// The parsed userDisplayHints depend on info, roles and isJoined, so we must recompute
|
|
2699
|
+
// whenever any of them changes. A common case is self transitioning to JOINED via a delta
|
|
2700
|
+
// that doesn't carry an info section - in that case we fall back to the previously stored
|
|
2701
|
+
// info so the hints get reparsed with the new joined state (e.g. VIEW_THE_PARTICIPANT_LIST).
|
|
2702
|
+
const infoToParse = info || this.info;
|
|
2703
|
+
const infoChanged = info && !isEqual(this.info, info);
|
|
2704
|
+
const rolesChanged = !isEqual(this.roles, roles);
|
|
2705
|
+
const isJoinedChanged = SelfUtils.isJoined(this.parsedLocus.self) !== isJoined;
|
|
2706
|
+
|
|
2707
|
+
if (infoToParse && (infoChanged || rolesChanged || isJoinedChanged)) {
|
|
2708
|
+
const parsedInfo = InfoUtils.getInfos(this.parsedLocus.info, infoToParse, roles, isJoined);
|
|
2011
2709
|
|
|
2012
2710
|
if (parsedInfo.updates.isLocked) {
|
|
2013
2711
|
this.emitScoped(
|
|
@@ -2030,10 +2728,10 @@ export default class LocusInfo extends EventsScope {
|
|
|
2030
2728
|
);
|
|
2031
2729
|
}
|
|
2032
2730
|
|
|
2033
|
-
this.info =
|
|
2731
|
+
this.info = infoToParse;
|
|
2034
2732
|
this.parsedLocus.info = parsedInfo.current;
|
|
2035
2733
|
// Parses the info and adds necessary values
|
|
2036
|
-
this.updateMeeting(parsedInfo.current);
|
|
2734
|
+
this.callbacks.updateMeeting(parsedInfo.current);
|
|
2037
2735
|
|
|
2038
2736
|
this.emitScoped(
|
|
2039
2737
|
{
|
|
@@ -2062,7 +2760,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2062
2760
|
|
|
2063
2761
|
const parsedEmbeddedApps = EmbeddedAppsUtils.parse(embeddedApps);
|
|
2064
2762
|
|
|
2065
|
-
this.updateMeeting({embeddedApps: parsedEmbeddedApps});
|
|
2763
|
+
this.callbacks.updateMeeting({embeddedApps: parsedEmbeddedApps});
|
|
2066
2764
|
|
|
2067
2765
|
this.emitScoped(
|
|
2068
2766
|
{
|
|
@@ -2087,7 +2785,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2087
2785
|
if (mediaShares && (!isEqual(this.mediaShares, mediaShares) || forceUpdate)) {
|
|
2088
2786
|
const parsedMediaShares = MediaSharesUtils.getMediaShares(this.mediaShares, mediaShares);
|
|
2089
2787
|
|
|
2090
|
-
this.updateMeeting(parsedMediaShares.current);
|
|
2788
|
+
this.callbacks.updateMeeting(parsedMediaShares.current);
|
|
2091
2789
|
this.parsedLocus.mediaShares = parsedMediaShares.current;
|
|
2092
2790
|
this.mediaShares = mediaShares;
|
|
2093
2791
|
this.emitScoped(
|
|
@@ -2125,6 +2823,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2125
2823
|
*/
|
|
2126
2824
|
updateSelf(self: any) {
|
|
2127
2825
|
if (self) {
|
|
2826
|
+
const wasLlmExpected = this.isLlmExpected();
|
|
2128
2827
|
// @ts-ignore
|
|
2129
2828
|
const parsedSelves = SelfUtils.getSelves(
|
|
2130
2829
|
this.parsedLocus.self,
|
|
@@ -2133,7 +2832,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2133
2832
|
this.participants // using this.participants instead of locus.participants here, because with delta DTOs locus.participants will only contain a small subset of participants
|
|
2134
2833
|
);
|
|
2135
2834
|
|
|
2136
|
-
this.updateMeeting(parsedSelves.current);
|
|
2835
|
+
this.callbacks.updateMeeting(parsedSelves.current);
|
|
2137
2836
|
this.parsedLocus.self = parsedSelves.current;
|
|
2138
2837
|
|
|
2139
2838
|
const element = this.parsedLocus.states[this.parsedLocus.states.length - 1];
|
|
@@ -2151,7 +2850,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2151
2850
|
);
|
|
2152
2851
|
|
|
2153
2852
|
if (result?.sipUri) {
|
|
2154
|
-
this.updateMeeting(result);
|
|
2853
|
+
this.callbacks.updateMeeting(result);
|
|
2155
2854
|
}
|
|
2156
2855
|
|
|
2157
2856
|
if (parsedSelves.updates.moderatorChanged) {
|
|
@@ -2278,6 +2977,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2278
2977
|
{
|
|
2279
2978
|
muted: parsedSelves.current.remoteMuted,
|
|
2280
2979
|
unmuteAllowed: parsedSelves.current.unmuteAllowed,
|
|
2980
|
+
modifiedBy: parsedSelves.current.modifiedBy ?? null,
|
|
2281
2981
|
}
|
|
2282
2982
|
);
|
|
2283
2983
|
}
|
|
@@ -2291,6 +2991,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2291
2991
|
{
|
|
2292
2992
|
muted: parsedSelves.current.remoteMuted,
|
|
2293
2993
|
unmuteAllowed: parsedSelves.current.unmuteAllowed,
|
|
2994
|
+
modifiedBy: parsedSelves.current.modifiedBy ?? null,
|
|
2294
2995
|
}
|
|
2295
2996
|
);
|
|
2296
2997
|
}
|
|
@@ -2402,6 +3103,15 @@ export default class LocusInfo extends EventsScope {
|
|
|
2402
3103
|
this.parsedLocus.self = parsedSelves.current;
|
|
2403
3104
|
// @ts-ignore
|
|
2404
3105
|
this.self = self;
|
|
3106
|
+
|
|
3107
|
+
// If LLM just became expected (self reported JOINED), some hash tree parsers may have skipped
|
|
3108
|
+
// arming heartbeat watchdog timers for LLM data sets whose messages arrived before this
|
|
3109
|
+
// update. Re-evaluate them now so those watchdogs get armed.
|
|
3110
|
+
if (!wasLlmExpected && this.isLlmExpected()) {
|
|
3111
|
+
this.hashTreeParsers.forEach((entry) => {
|
|
3112
|
+
entry.parser.reevaluateLlmWatchdogs();
|
|
3113
|
+
});
|
|
3114
|
+
}
|
|
2405
3115
|
} else {
|
|
2406
3116
|
this.compareAndUpdateFlags.compareHostAndSelf = false;
|
|
2407
3117
|
}
|
|
@@ -2417,7 +3127,7 @@ export default class LocusInfo extends EventsScope {
|
|
|
2417
3127
|
updateLocusUrl(url: string, isMainLocus = true) {
|
|
2418
3128
|
if (url && this.url !== url) {
|
|
2419
3129
|
this.url = url;
|
|
2420
|
-
this.updateMeeting({locusUrl: url});
|
|
3130
|
+
this.callbacks.updateMeeting({locusUrl: url});
|
|
2421
3131
|
this.emitScoped(
|
|
2422
3132
|
{
|
|
2423
3133
|
file: 'locus-info',
|
|
@@ -2563,4 +3273,17 @@ export default class LocusInfo extends EventsScope {
|
|
|
2563
3273
|
clearMainSessionLocusCache() {
|
|
2564
3274
|
this.mainSessionLocusCache = null;
|
|
2565
3275
|
}
|
|
3276
|
+
|
|
3277
|
+
/**
|
|
3278
|
+
* Cleans up all hash tree parsers and clears internal maps.
|
|
3279
|
+
* @returns {void}
|
|
3280
|
+
* @memberof LocusInfo
|
|
3281
|
+
*/
|
|
3282
|
+
cleanUp() {
|
|
3283
|
+
this.hashTreeParsers.forEach((entry) => {
|
|
3284
|
+
entry.parser.cleanUp();
|
|
3285
|
+
});
|
|
3286
|
+
this.hashTreeParsers.clear();
|
|
3287
|
+
this.hashTreeObjectId2ParticipantId.clear();
|
|
3288
|
+
}
|
|
2566
3289
|
}
|