@webex/plugin-meetings 3.11.0 → 3.12.0-metrics-init-fix-3.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/hashTree/types.ts
CHANGED
|
@@ -10,6 +10,8 @@ export const ObjectType = {
|
|
|
10
10
|
fullState: 'fullstate',
|
|
11
11
|
links: 'links',
|
|
12
12
|
control: 'controlentry',
|
|
13
|
+
metadata: 'metadata',
|
|
14
|
+
embeddedApp: 'embeddedapp',
|
|
13
15
|
} as const;
|
|
14
16
|
|
|
15
17
|
export type ObjectType = Enum<typeof ObjectType>;
|
|
@@ -23,7 +25,9 @@ export const ObjectTypeToLocusKeyMap = {
|
|
|
23
25
|
[ObjectType.participant]: 'participants', // note: each object is a single participant in participants array
|
|
24
26
|
[ObjectType.mediaShare]: 'mediaShares', // note: each object is a single mediaShare in mediaShares array
|
|
25
27
|
[ObjectType.control]: 'controls', // note: each object is a single control entry in controls object
|
|
28
|
+
[ObjectType.embeddedApp]: 'embeddedApps', // note: each object is a single embedded app in embeddedApps array
|
|
26
29
|
};
|
|
30
|
+
|
|
27
31
|
export interface HtMeta {
|
|
28
32
|
elementId: {
|
|
29
33
|
type: ObjectType;
|
package/src/hashTree/utils.ts
CHANGED
|
@@ -11,6 +11,15 @@ export function isSelf(object: HashTreeObject) {
|
|
|
11
11
|
return object.htMeta.elementId.type.toLowerCase() === ObjectType.self;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the given hash tree object is of type "Metadata"
|
|
16
|
+
* @param {HashTreeObject} object object to check
|
|
17
|
+
* @returns {boolean} True if the object is of type "Metadata", false otherwise
|
|
18
|
+
*/
|
|
19
|
+
export function isMetadata(object: HashTreeObject) {
|
|
20
|
+
return object.htMeta.elementId.type.toLowerCase() === ObjectType.metadata;
|
|
21
|
+
}
|
|
22
|
+
|
|
14
23
|
/**
|
|
15
24
|
* Analyzes given part of Locus DTO recursively and delete any nested objects that have their own htMeta
|
|
16
25
|
*
|
|
@@ -51,3 +60,39 @@ export const deleteNestedObjectsWithHtMeta = (
|
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
62
|
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Reorders items so that those matching the given priority list come first (in priority order),
|
|
66
|
+
* followed by everything else in their original order.
|
|
67
|
+
*
|
|
68
|
+
* @param {Array<T>} items - The items to reorder
|
|
69
|
+
* @param {string[]} priority - Ordered list of names that should come first
|
|
70
|
+
* @returns {Array<T>} A new array with prioritized items first
|
|
71
|
+
*/
|
|
72
|
+
export function sortByInitPriority<T extends {name: string}>(items: T[], priority: string[]): T[] {
|
|
73
|
+
const prioritized = priority
|
|
74
|
+
.map((name) => items.find((item) => item.name === name))
|
|
75
|
+
.filter(Boolean) as T[];
|
|
76
|
+
const rest = items.filter((item) => !priority.includes(item.name));
|
|
77
|
+
|
|
78
|
+
return [...prioritized, ...rest];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Sleeps for the specified amount of milliseconds
|
|
83
|
+
*
|
|
84
|
+
* @param {number} ms amount of milliseconds to sleep
|
|
85
|
+
* @returns {Promise<void>} A promise that resolves after the specified delay
|
|
86
|
+
*/
|
|
87
|
+
export function sleep(ms: number): Promise<void> {
|
|
88
|
+
if (ms <= 0) {
|
|
89
|
+
return Promise.resolve();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
// start a timer that will resolve the promise after the specified delay
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
resolve();
|
|
96
|
+
}, ms);
|
|
97
|
+
});
|
|
98
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,11 @@ import {registerPlugin} from '@webex/webex-core';
|
|
|
3
3
|
|
|
4
4
|
import Meetings from './meetings';
|
|
5
5
|
import config from './config';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
LocusRetryStatusInterceptor,
|
|
8
|
+
LocusRouteTokenInterceptor,
|
|
9
|
+
DataChannelAuthTokenInterceptor,
|
|
10
|
+
} from './interceptors';
|
|
7
11
|
import CaptchaError from './common/errors/captcha-error';
|
|
8
12
|
import IntentToJoinError from './common/errors/intent-to-join';
|
|
9
13
|
import PasswordError from './common/errors/password-error';
|
|
@@ -25,6 +29,7 @@ registerPlugin('meetings', Meetings, {
|
|
|
25
29
|
interceptors: {
|
|
26
30
|
LocusRetryStatusInterceptor: LocusRetryStatusInterceptor.create,
|
|
27
31
|
LocusRouteTokenInterceptor: LocusRouteTokenInterceptor.create,
|
|
32
|
+
DataChannelAuthTokenInterceptor: DataChannelAuthTokenInterceptor.create,
|
|
28
33
|
},
|
|
29
34
|
});
|
|
30
35
|
|
|
@@ -60,6 +65,12 @@ export * as REACTIONS from './reactions/reactions';
|
|
|
60
65
|
export * as sdkAnnotationTypes from './annotation/annotation.types';
|
|
61
66
|
export * as MeetingInfoV2 from './meeting-info/meeting-info-v2';
|
|
62
67
|
export {type Reaction} from './reactions/reactions.type';
|
|
68
|
+
export {SitePreferenceSelectOption} from './meetings/meetings.types';
|
|
69
|
+
export type {
|
|
70
|
+
FetchSitePreferencesMeViaSiteOptions,
|
|
71
|
+
SitePreferencesResponse,
|
|
72
|
+
} from './meetings/meetings.types';
|
|
73
|
+
export type {Interpreter, InterpreterUsingResource} from './interpretation/interpretation.types';
|
|
63
74
|
|
|
64
75
|
export {
|
|
65
76
|
CaptchaError,
|
|
@@ -80,3 +91,5 @@ export {
|
|
|
80
91
|
export {RemoteMedia} from './multistream/remoteMedia';
|
|
81
92
|
|
|
82
93
|
export {default as TriggerProxy} from './common/events/trigger-proxy';
|
|
94
|
+
|
|
95
|
+
export {getAIEnablementApprover} from './aiEnableRequest/utils';
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {Interceptor} from '@webex/http-core';
|
|
6
|
+
import LLMChannel from '@webex/internal-plugin-llm';
|
|
7
|
+
import LoggerProxy from '../common/logs/logger-proxy';
|
|
8
|
+
import {DATA_CHANNEL_AUTH_HEADER, MAX_RETRY, RETRY_INTERVAL, RETRY_KEY} from './constant';
|
|
9
|
+
import {isJwtTokenExpired} from './utils';
|
|
10
|
+
import {LLM_DEFAULT_SESSION, LLM_PRACTICE_SESSION, LOCUS_URL} from '../constants';
|
|
11
|
+
|
|
12
|
+
const retryCountMap = new Map();
|
|
13
|
+
interface HttpLikeError extends Error {
|
|
14
|
+
statusCode?: number;
|
|
15
|
+
original?: any;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @class
|
|
19
|
+
*/
|
|
20
|
+
export default class DataChannelAuthTokenInterceptor extends Interceptor {
|
|
21
|
+
private _refreshDataChannelToken: (requestUrl?: string) => Promise<string>;
|
|
22
|
+
private _isDataChannelTokenEnabled: () => Promise<boolean>;
|
|
23
|
+
constructor(options) {
|
|
24
|
+
super(options);
|
|
25
|
+
|
|
26
|
+
this._refreshDataChannelToken = options.refreshDataChannelToken;
|
|
27
|
+
this._isDataChannelTokenEnabled = options.isDataChannelTokenEnabled;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @returns {DataChannelAuthTokenInterceptor}
|
|
32
|
+
*/
|
|
33
|
+
static create() {
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
return new DataChannelAuthTokenInterceptor({
|
|
36
|
+
webex: this,
|
|
37
|
+
|
|
38
|
+
isDataChannelTokenEnabled: async () => {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
return this.internal.llm.isDataChannelTokenEnabled();
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
// Route refresh by request URL in two steps:
|
|
44
|
+
// 1) Match active LLM sessions (supports non-default/multiple sessions)
|
|
45
|
+
// 2) If no session matches, resolve locusUrl and refresh via owning meeting
|
|
46
|
+
// If neither route matches, fall back to the default-session refresh.
|
|
47
|
+
refreshDataChannelToken: async (requestUrl?: string) => {
|
|
48
|
+
let sessionId;
|
|
49
|
+
let meeting;
|
|
50
|
+
|
|
51
|
+
if (typeof requestUrl === 'string') {
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
sessionId = this.internal.llm.getSessionIdByDatachannelUrl?.(requestUrl);
|
|
54
|
+
|
|
55
|
+
if (!sessionId) {
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
const locusUrl = this.internal.llm.getLocusUrlByDatachannelUrl?.(requestUrl);
|
|
58
|
+
|
|
59
|
+
if (locusUrl) {
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
meeting = this.meetings?.getMeetingByType?.(LOCUS_URL, locusUrl);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!meeting) {
|
|
66
|
+
// Fallback: registerAndConnect() pre-populates datachannelUrl in
|
|
67
|
+
// connections before calling register(), so getSessionIdByDatachannelUrl
|
|
68
|
+
// above should normally resolve. This scan covers any residual gap
|
|
69
|
+
// where connections are not yet populated (e.g. if setRefreshHandler
|
|
70
|
+
// is called on a session that has no connection entry at all).
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
const allMeetings = this.meetings?.getAllMeetings?.() || {};
|
|
73
|
+
|
|
74
|
+
meeting = Object.values(allMeetings).find((activeMeeting: any) => {
|
|
75
|
+
const info = activeMeeting?.locusInfo?.info || {};
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
(info.practiceSessionDatachannelUrl &&
|
|
79
|
+
LLMChannel.matchesDatachannelRequestUrl(
|
|
80
|
+
requestUrl,
|
|
81
|
+
info.practiceSessionDatachannelUrl
|
|
82
|
+
)) ||
|
|
83
|
+
(info.datachannelUrl &&
|
|
84
|
+
LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl))
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (!sessionId) {
|
|
89
|
+
// @ts-ignore
|
|
90
|
+
const info = meeting?.locusInfo?.info || {};
|
|
91
|
+
|
|
92
|
+
if (
|
|
93
|
+
info.practiceSessionDatachannelUrl &&
|
|
94
|
+
LLMChannel.matchesDatachannelRequestUrl(
|
|
95
|
+
requestUrl,
|
|
96
|
+
info.practiceSessionDatachannelUrl
|
|
97
|
+
)
|
|
98
|
+
) {
|
|
99
|
+
sessionId = LLM_PRACTICE_SESSION;
|
|
100
|
+
} else if (
|
|
101
|
+
info.datachannelUrl &&
|
|
102
|
+
LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl)
|
|
103
|
+
) {
|
|
104
|
+
sessionId = LLM_DEFAULT_SESSION;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let result;
|
|
111
|
+
if (meeting) {
|
|
112
|
+
result = await meeting.refreshDataChannelToken();
|
|
113
|
+
} else {
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
result = await this.internal.llm.refreshDataChannelToken(sessionId);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (!result?.body) {
|
|
119
|
+
throw new Error('DataChannel token refresh returned no payload');
|
|
120
|
+
}
|
|
121
|
+
const {datachannelToken, dataChannelTokenType} = result.body;
|
|
122
|
+
const tokenStoreKey = dataChannelTokenType || sessionId;
|
|
123
|
+
const ownerMeetingId =
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
meeting?.id || this.internal.llm.getOwnerMeetingId?.(tokenStoreKey);
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
this.internal.llm.setDatachannelToken(datachannelToken, tokenStoreKey, ownerMeetingId);
|
|
128
|
+
|
|
129
|
+
return datachannelToken;
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private getRetryKey(options) {
|
|
135
|
+
if (!options[RETRY_KEY]) {
|
|
136
|
+
options[RETRY_KEY] = `${Date.now()}-${Math.random()}`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return options[RETRY_KEY];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Helper function to get header value case insensitively
|
|
143
|
+
private getHeader(headers: Record<string, string>, name: string) {
|
|
144
|
+
const key = Object.keys(headers).find((k) => k.toLowerCase() === name.toLowerCase());
|
|
145
|
+
|
|
146
|
+
return key ? headers[key] : undefined;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Intercepts outgoing requests and refreshes the Data-Channel-Auth-Token
|
|
151
|
+
* if the current JWT token is expired before the request is sent.
|
|
152
|
+
*
|
|
153
|
+
* @param {Object} options - The original request options.
|
|
154
|
+
* @returns {Promise<Object>} Updated request options with refreshed token if needed.
|
|
155
|
+
*/
|
|
156
|
+
async onRequest(options) {
|
|
157
|
+
const token = this.getHeader(options.headers, DATA_CHANNEL_AUTH_HEADER);
|
|
158
|
+
const enabled = await this._isDataChannelTokenEnabled();
|
|
159
|
+
|
|
160
|
+
if (!token || !enabled) {
|
|
161
|
+
return options;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (isJwtTokenExpired(token)) {
|
|
165
|
+
try {
|
|
166
|
+
const newToken = await this._refreshDataChannelToken(options.uri || options.url);
|
|
167
|
+
options.headers[DATA_CHANNEL_AUTH_HEADER] = newToken;
|
|
168
|
+
} catch (e) {
|
|
169
|
+
LoggerProxy.logger.warn(`DataChannelAuthTokenInterceptor: refresh failed: ${e.message}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return options;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Intercept responses and, on 401/403 with `Data-Channel-Auth-Token` header,
|
|
178
|
+
* attempt to refresh the data channel token and retry the original request once.
|
|
179
|
+
*
|
|
180
|
+
* @param {Object} options
|
|
181
|
+
* @param {Object} reason
|
|
182
|
+
* @returns {Promise<HttpResponse>}
|
|
183
|
+
*/
|
|
184
|
+
async onResponseError(options, reason) {
|
|
185
|
+
const token = this.getHeader(options.headers, DATA_CHANNEL_AUTH_HEADER);
|
|
186
|
+
const enabled = await this._isDataChannelTokenEnabled();
|
|
187
|
+
|
|
188
|
+
if (!token || !enabled) {
|
|
189
|
+
return Promise.reject(reason);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (reason.statusCode !== 401 && reason.statusCode !== 403) {
|
|
193
|
+
return Promise.reject(reason);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const key = this.getRetryKey(options);
|
|
197
|
+
const retryCount = retryCountMap.get(key) || 0;
|
|
198
|
+
|
|
199
|
+
if (retryCount >= MAX_RETRY) {
|
|
200
|
+
LoggerProxy.logger.error(`data channel token refresh exceeded max retry (${MAX_RETRY})`);
|
|
201
|
+
retryCountMap.delete(key);
|
|
202
|
+
|
|
203
|
+
return Promise.reject(reason);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
retryCountMap.set(key, retryCount + 1);
|
|
207
|
+
|
|
208
|
+
return this.refreshTokenAndRetryWithDelay(options);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Retry the failed data channel request after a delay.
|
|
213
|
+
* Refreshes the Data-Channel-Auth-Token and re-sends the original request.
|
|
214
|
+
*
|
|
215
|
+
* @param {Object} options - Original request options.
|
|
216
|
+
* @returns {Promise<HttpResponse>} - Resolves on successful retry.
|
|
217
|
+
*/
|
|
218
|
+
refreshTokenAndRetryWithDelay(options) {
|
|
219
|
+
return new Promise((resolve, reject) => {
|
|
220
|
+
setTimeout(async () => {
|
|
221
|
+
const key = this.getRetryKey(options);
|
|
222
|
+
try {
|
|
223
|
+
const newToken = await this._refreshDataChannelToken(options.uri || options.url);
|
|
224
|
+
|
|
225
|
+
options.headers[DATA_CHANNEL_AUTH_HEADER] = newToken;
|
|
226
|
+
|
|
227
|
+
// @ts-ignore
|
|
228
|
+
const res = await this.webex.request(options);
|
|
229
|
+
retryCountMap.delete(key);
|
|
230
|
+
|
|
231
|
+
resolve(res);
|
|
232
|
+
} catch (e) {
|
|
233
|
+
retryCountMap.delete(key);
|
|
234
|
+
|
|
235
|
+
const msg = e?.message || String(e);
|
|
236
|
+
|
|
237
|
+
const err: HttpLikeError = new Error(`DataChannel token refresh failed: ${msg}`);
|
|
238
|
+
err.statusCode = e?.statusCode;
|
|
239
|
+
err.original = e;
|
|
240
|
+
|
|
241
|
+
reject(err);
|
|
242
|
+
}
|
|
243
|
+
}, RETRY_INTERVAL);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import LocusRetryStatusInterceptor from './locusRetry';
|
|
2
2
|
import LocusRouteTokenInterceptor from './locusRouteToken';
|
|
3
|
+
import DataChannelAuthTokenInterceptor from './dataChannelAuthToken';
|
|
3
4
|
|
|
4
|
-
export {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor};
|
|
5
|
+
export {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor, DataChannelAuthTokenInterceptor};
|
|
@@ -18,12 +18,33 @@ export default class LocusRetryStatusInterceptor extends Interceptor {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @param {
|
|
23
|
-
* @
|
|
24
|
-
* @returns {Promise<WebexHttpError>}
|
|
21
|
+
* Check whether a URI is a Locus /hashtree or /sync endpoint.
|
|
22
|
+
* @param {string} uri
|
|
23
|
+
* @returns {boolean}
|
|
25
24
|
*/
|
|
25
|
+
private static isLocusHashtreeOrSync(uri: string): boolean {
|
|
26
|
+
try {
|
|
27
|
+
const {pathname} = new URL(uri);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
pathname.includes('/locus/') &&
|
|
31
|
+
(pathname.endsWith('/hashtree') || pathname.endsWith('/sync'))
|
|
32
|
+
);
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
onResponseError(options, reason) {
|
|
39
|
+
// Don't retry /hashtree or /sync calls for 429 or any 5xx — during a sync storm retries
|
|
40
|
+
// make things worse. The normal sync timers will handle recovery for these endpoints.
|
|
41
|
+
if (
|
|
42
|
+
(reason.statusCode === 429 || reason.statusCode >= 500) &&
|
|
43
|
+
LocusRetryStatusInterceptor.isLocusHashtreeOrSync(options.uri)
|
|
44
|
+
) {
|
|
45
|
+
return Promise.reject(reason);
|
|
46
|
+
}
|
|
47
|
+
|
|
27
48
|
if ((reason.statusCode === 503 || reason.statusCode === 429) && options.uri.includes('locus')) {
|
|
28
49
|
const hasRetriedLocusRequest = rateLimitExpiryTime.get(this);
|
|
29
50
|
const retryAfterTime = options.headers['retry-after'] || 2000;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as jose from 'jose';
|
|
2
|
+
|
|
3
|
+
const EXPIRY_BUFFER = 30 * 1000;
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
6
|
+
export const isJwtTokenExpired = (token: string): boolean => {
|
|
7
|
+
try {
|
|
8
|
+
const payload = jose.decodeJwt(token);
|
|
9
|
+
|
|
10
|
+
if (!payload?.exp) return false;
|
|
11
|
+
|
|
12
|
+
return payload.exp * 1000 < Date.now() + EXPIRY_BUFFER;
|
|
13
|
+
} catch {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {WebexPlugin} from '@webex/webex-core';
|
|
5
5
|
import LoggerProxy from '../common/logs/logger-proxy';
|
|
6
|
-
import {HTTP_VERBS, INTERPRETATION, MEETINGS} from '../constants';
|
|
6
|
+
import {HTTP_VERBS, INTERPRETATION, LOCUSEVENT, MEETINGS} from '../constants';
|
|
7
|
+
import MeetingUtil from '../meeting/util';
|
|
7
8
|
|
|
8
9
|
import SILanguageCollection from './collection';
|
|
10
|
+
import {Interpreter} from './interpretation.types';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* @class SimultaneousInterpretation
|
|
@@ -182,7 +184,9 @@ const SimultaneousInterpretation = WebexPlugin.extend({
|
|
|
182
184
|
* @param {Array} interpreters
|
|
183
185
|
* @returns {Promise}
|
|
184
186
|
*/
|
|
185
|
-
updateInterpreters(interpreters) {
|
|
187
|
+
updateInterpreters(interpreters: Interpreter[]) {
|
|
188
|
+
const meeting = this.webex.meetings.meetingCollection.getByKey('locusUrl', this.locusUrl);
|
|
189
|
+
|
|
186
190
|
return this.request({
|
|
187
191
|
method: HTTP_VERBS.PATCH,
|
|
188
192
|
uri: `${this.locusUrl}/controls`,
|
|
@@ -191,10 +195,16 @@ const SimultaneousInterpretation = WebexPlugin.extend({
|
|
|
191
195
|
interpreters,
|
|
192
196
|
},
|
|
193
197
|
},
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
})
|
|
199
|
+
.then((response) => {
|
|
200
|
+
MeetingUtil.updateLocusFromApiResponse(meeting, response);
|
|
201
|
+
|
|
202
|
+
return response;
|
|
203
|
+
})
|
|
204
|
+
.catch((error) => {
|
|
205
|
+
LoggerProxy.logger.error('Meeting:interpretation#updateInterpreters failed', error);
|
|
206
|
+
throw error;
|
|
207
|
+
});
|
|
198
208
|
},
|
|
199
209
|
/**
|
|
200
210
|
* Change direction of interpretation for an interpreter participant
|
|
@@ -209,6 +219,8 @@ const SimultaneousInterpretation = WebexPlugin.extend({
|
|
|
209
219
|
return Promise.reject(new Error('Missing self participant id'));
|
|
210
220
|
}
|
|
211
221
|
|
|
222
|
+
const meeting = this.webex.meetings.meetingCollection.getByKey('locusUrl', this.locusUrl);
|
|
223
|
+
|
|
212
224
|
return this.request({
|
|
213
225
|
method: HTTP_VERBS.PATCH,
|
|
214
226
|
uri: `${this.locusUrl}/participant/${this.selfParticipantId}/controls`,
|
|
@@ -220,17 +232,23 @@ const SimultaneousInterpretation = WebexPlugin.extend({
|
|
|
220
232
|
order: this.order,
|
|
221
233
|
},
|
|
222
234
|
},
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
235
|
+
})
|
|
236
|
+
.then((response) => {
|
|
237
|
+
MeetingUtil.updateLocusFromApiResponse(meeting, response);
|
|
238
|
+
|
|
239
|
+
return response;
|
|
240
|
+
})
|
|
241
|
+
.catch((error) => {
|
|
242
|
+
LoggerProxy.logger.error('Meeting:interpretation#changeDirection failed', error);
|
|
243
|
+
throw error;
|
|
244
|
+
});
|
|
227
245
|
},
|
|
228
246
|
/**
|
|
229
247
|
* Sets up a listener for handoff requests from mercury
|
|
230
248
|
* @returns {void}
|
|
231
249
|
*/
|
|
232
250
|
listenToHandoffRequests() {
|
|
233
|
-
this.listenTo(this.webex.internal.mercury,
|
|
251
|
+
this.listenTo(this.webex.internal.mercury, `event:${LOCUSEVENT.APPROVAL_REQUEST}`, (event) => {
|
|
234
252
|
if (event?.data?.approval?.resourceType === INTERPRETATION.RESOURCE_TYPE) {
|
|
235
253
|
const {receivers, initiator, actionType, url} = event.data.approval;
|
|
236
254
|
const receiverId = receivers?.[0]?.participantId;
|
|
@@ -26,7 +26,9 @@ ControlsUtils.parse = (controls: any) => {
|
|
|
26
26
|
modifiedBy: ControlsUtils.getId(controls),
|
|
27
27
|
paused: controls.record.paused ? controls.record.paused : false,
|
|
28
28
|
recording: controls.record.recording,
|
|
29
|
-
lastModified: controls.record.meta
|
|
29
|
+
lastModified: controls.record.meta?.lastModified,
|
|
30
|
+
modifiedByServiceAppName: controls.record.meta?.modifiedByServiceAppName,
|
|
31
|
+
modifiedByServiceAppId: controls.record.meta?.modifiedByServiceAppId,
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -42,6 +44,7 @@ ControlsUtils.parse = (controls: any) => {
|
|
|
42
44
|
caption: controls.transcribe.caption,
|
|
43
45
|
spokenLanguage: controls.transcribe.spokenLanguage,
|
|
44
46
|
hesiodLlmId: controls.transcribe.hesiodLlmId,
|
|
47
|
+
aiSummaryNotification: controls.transcribe.aiSummaryNotification,
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -208,6 +211,16 @@ ControlsUtils.getControls = (oldControls: any, newControls: any) => {
|
|
|
208
211
|
!isEqual(previous?.transcribe?.hesiodLlmId, current?.transcribe?.hesiodLlmId) &&
|
|
209
212
|
!!(previous?.transcribe?.hesiodLlmId || current?.transcribe?.hesiodLlmId),
|
|
210
213
|
|
|
214
|
+
hasAiSummaryNotificationChanged:
|
|
215
|
+
current?.transcribe &&
|
|
216
|
+
!isEqual(
|
|
217
|
+
previous?.transcribe?.aiSummaryNotification,
|
|
218
|
+
current?.transcribe?.aiSummaryNotification
|
|
219
|
+
) &&
|
|
220
|
+
!!(
|
|
221
|
+
previous?.transcribe?.aiSummaryNotification || current?.transcribe?.aiSummaryNotification
|
|
222
|
+
),
|
|
223
|
+
|
|
211
224
|
hasTranscribeSpokenLanguageChanged:
|
|
212
225
|
current?.transcribe &&
|
|
213
226
|
!isEqual(previous?.transcribe?.spokenLanguage, current?.transcribe?.spokenLanguage) &&
|