@webex/plugin-meetings 3.12.0-next.171 → 3.12.0-next.173

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.
Files changed (36) hide show
  1. package/dist/aiEnableRequest/index.js +1 -1
  2. package/dist/annotation/index.js +53 -17
  3. package/dist/annotation/index.js.map +1 -1
  4. package/dist/breakouts/breakout.js +1 -1
  5. package/dist/breakouts/index.js +35 -9
  6. package/dist/breakouts/index.js.map +1 -1
  7. package/dist/interceptors/dataChannelAuthToken.js +41 -59
  8. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  9. package/dist/interpretation/index.js +1 -1
  10. package/dist/interpretation/siLanguage.js +1 -1
  11. package/dist/meeting/index.js +327 -292
  12. package/dist/meeting/index.js.map +1 -1
  13. package/dist/meeting/util.js +5 -1
  14. package/dist/meeting/util.js.map +1 -1
  15. package/dist/meetings/index.js +4 -1
  16. package/dist/meetings/index.js.map +1 -1
  17. package/dist/types/annotation/index.d.ts +19 -0
  18. package/dist/types/meeting/index.d.ts +46 -12
  19. package/dist/types/meeting/util.d.ts +3 -1
  20. package/dist/webinar/index.js +298 -255
  21. package/dist/webinar/index.js.map +1 -1
  22. package/package.json +13 -13
  23. package/src/annotation/index.ts +55 -25
  24. package/src/breakouts/index.ts +33 -11
  25. package/src/interceptors/dataChannelAuthToken.ts +48 -77
  26. package/src/meeting/index.ts +296 -289
  27. package/src/meeting/util.ts +2 -2
  28. package/src/meetings/index.ts +2 -1
  29. package/src/webinar/index.ts +168 -188
  30. package/test/unit/spec/annotation/index.ts +214 -182
  31. package/test/unit/spec/breakouts/index.ts +126 -25
  32. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
  33. package/test/unit/spec/meeting/index.js +939 -705
  34. package/test/unit/spec/meeting/utils.js +16 -2
  35. package/test/unit/spec/meetings/index.js +5 -0
  36. package/test/unit/spec/webinar/index.ts +886 -718
@@ -3,11 +3,13 @@
3
3
  */
4
4
 
5
5
  import {Interceptor} from '@webex/http-core';
6
+
7
+ // @ts-ignore - internal-plugin-llm types
6
8
  import LLMChannel from '@webex/internal-plugin-llm';
7
9
  import LoggerProxy from '../common/logs/logger-proxy';
10
+ import Meeting from '../meeting';
8
11
  import {DATA_CHANNEL_AUTH_HEADER, MAX_RETRY, RETRY_INTERVAL, RETRY_KEY} from './constant';
9
12
  import {isJwtTokenExpired} from './utils';
10
- import {LLM_DEFAULT_SESSION, LLM_PRACTICE_SESSION, LOCUS_URL} from '../constants';
11
13
 
12
14
  const retryCountMap = new Map();
13
15
  interface HttpLikeError extends Error {
@@ -40,93 +42,62 @@ export default class DataChannelAuthTokenInterceptor extends Interceptor {
40
42
  return this.internal.llm.isDataChannelTokenEnabled();
41
43
  },
42
44
 
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.
45
+ // Route refresh by request URL:
46
+ // 1) Find the LLM channel that matches the request URL
47
+ // 2) If found, use its refresh handler
48
+ // 3) If no channel matches, fall back to finding the meeting by locusUrl
47
49
  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);
50
+ // @ts-ignore
51
+ const channel = this.internal.llm.getChannelByDatachannelUrl(requestUrl);
54
52
 
55
- if (!sessionId) {
56
- // @ts-ignore
57
- const locusUrl = this.internal.llm.getLocusUrlByDatachannelUrl?.(requestUrl);
53
+ if (channel) {
54
+ // Channel found - use its refresh handler
55
+ const result = await channel.refreshDataChannelToken();
58
56
 
59
- if (locusUrl) {
60
- // @ts-ignore
61
- meeting = this.meetings?.getMeetingByType?.(LOCUS_URL, locusUrl);
62
- }
57
+ if (!result?.body) {
58
+ throw new Error('DataChannel token refresh returned no payload');
63
59
  }
64
60
 
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
- }
61
+ const {datachannelToken} = result.body;
62
+ channel.setDatachannelToken(datachannelToken);
63
+
64
+ return datachannelToken;
108
65
  }
109
66
 
110
- let result;
67
+ // No channel found - fallback to finding meeting by matching datachannel URLs
68
+ // @ts-ignore
69
+ const allMeetings: Record<string, Meeting> = this.meetings?.getAllMeetings() || {};
70
+
71
+ const meeting = Object.values(allMeetings).find((activeMeeting) => {
72
+ const info = activeMeeting?.locusInfo?.info || {};
73
+
74
+ return (
75
+ (info.practiceSessionDatachannelUrl &&
76
+ LLMChannel.matchesDatachannelRequestUrl(
77
+ requestUrl,
78
+ info.practiceSessionDatachannelUrl
79
+ )) ||
80
+ (info.datachannelUrl &&
81
+ LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl))
82
+ );
83
+ });
84
+
111
85
  if (meeting) {
112
- result = await meeting.refreshDataChannelToken();
113
- } else {
114
- // @ts-ignore
115
- result = await this.internal.llm.refreshDataChannelToken(sessionId);
116
- }
86
+ const result = await meeting.refreshDataChannelToken();
87
+
88
+ if (!result?.body) {
89
+ throw new Error('DataChannel token refresh returned no payload');
90
+ }
117
91
 
118
- if (!result?.body) {
119
- throw new Error('DataChannel token refresh returned no payload');
92
+ const {datachannelToken} = result.body;
93
+
94
+ // Store token on the meeting's LLM channel if available
95
+ meeting.setLLMChannelDataToken(datachannelToken);
96
+
97
+ return datachannelToken;
120
98
  }
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
99
 
129
- return datachannelToken;
100
+ throw new Error('No LLM channel or meeting found for request URL');
130
101
  },
131
102
  });
132
103
  }