@webex/plugin-meetings 3.12.0-task-refactor.1 → 3.12.0-webex-services-ready.2

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 (302) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +197 -0
  3. package/dist/aiEnableRequest/index.js.map +1 -0
  4. package/dist/aiEnableRequest/utils.js +36 -0
  5. package/dist/aiEnableRequest/utils.js.map +1 -0
  6. package/dist/annotation/index.js +14 -5
  7. package/dist/annotation/index.js.map +1 -1
  8. package/dist/breakouts/breakout.js +8 -3
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/index.js +26 -2
  11. package/dist/breakouts/index.js.map +1 -1
  12. package/dist/common/errors/webex-errors.js +49 -5
  13. package/dist/common/errors/webex-errors.js.map +1 -1
  14. package/dist/config.js +9 -3
  15. package/dist/config.js.map +1 -1
  16. package/dist/constants.js +59 -10
  17. package/dist/constants.js.map +1 -1
  18. package/dist/controls-options-manager/constants.js +11 -1
  19. package/dist/controls-options-manager/constants.js.map +1 -1
  20. package/dist/controls-options-manager/index.js +67 -29
  21. package/dist/controls-options-manager/index.js.map +1 -1
  22. package/dist/controls-options-manager/util.js +91 -0
  23. package/dist/controls-options-manager/util.js.map +1 -1
  24. package/dist/hashTree/constants.js +34 -0
  25. package/dist/hashTree/constants.js.map +1 -0
  26. package/dist/hashTree/hashTree.js +533 -0
  27. package/dist/hashTree/hashTree.js.map +1 -0
  28. package/dist/hashTree/hashTreeParser.js +2068 -36
  29. package/dist/hashTree/hashTreeParser.js.map +1 -1
  30. package/dist/hashTree/types.js +13 -3
  31. package/dist/hashTree/types.js.map +1 -1
  32. package/dist/hashTree/utils.js +111 -0
  33. package/dist/hashTree/utils.js.map +1 -0
  34. package/dist/index.js +18 -2
  35. package/dist/index.js.map +1 -1
  36. package/dist/interceptors/constant.js +12 -0
  37. package/dist/interceptors/constant.js.map +1 -0
  38. package/dist/interceptors/dataChannelAuthToken.js +350 -0
  39. package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
  40. package/dist/interceptors/index.js +7 -0
  41. package/dist/interceptors/index.js.map +1 -1
  42. package/dist/interceptors/locusRetry.js +23 -8
  43. package/dist/interceptors/locusRetry.js.map +1 -1
  44. package/dist/interceptors/locusRouteToken.js +27 -5
  45. package/dist/interceptors/locusRouteToken.js.map +1 -1
  46. package/dist/interceptors/utils.js +27 -0
  47. package/dist/interceptors/utils.js.map +1 -0
  48. package/dist/interpretation/index.js +11 -2
  49. package/dist/interpretation/index.js.map +1 -1
  50. package/dist/interpretation/interpretation.types.js +7 -0
  51. package/dist/interpretation/interpretation.types.js.map +1 -0
  52. package/dist/interpretation/siLanguage.js +1 -1
  53. package/dist/locus-info/controlsUtils.js +11 -4
  54. package/dist/locus-info/controlsUtils.js.map +1 -1
  55. package/dist/locus-info/index.js +896 -277
  56. package/dist/locus-info/index.js.map +1 -1
  57. package/dist/locus-info/infoUtils.js +36 -5
  58. package/dist/locus-info/infoUtils.js.map +1 -1
  59. package/dist/locus-info/selfUtils.js +1 -0
  60. package/dist/locus-info/selfUtils.js.map +1 -1
  61. package/dist/locus-info/types.js +19 -0
  62. package/dist/locus-info/types.js.map +1 -1
  63. package/dist/media/MediaConnectionAwaiter.js +72 -3
  64. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  65. package/dist/media/index.js +8 -2
  66. package/dist/media/index.js.map +1 -1
  67. package/dist/media/properties.js +5 -2
  68. package/dist/media/properties.js.map +1 -1
  69. package/dist/meeting/in-meeting-actions.js +11 -1
  70. package/dist/meeting/in-meeting-actions.js.map +1 -1
  71. package/dist/meeting/index.js +2075 -1096
  72. package/dist/meeting/index.js.map +1 -1
  73. package/dist/meeting/locusMediaRequest.js +229 -82
  74. package/dist/meeting/locusMediaRequest.js.map +1 -1
  75. package/dist/meeting/muteState.js +10 -1
  76. package/dist/meeting/muteState.js.map +1 -1
  77. package/dist/meeting/request.js +55 -2
  78. package/dist/meeting/request.js.map +1 -1
  79. package/dist/meeting/request.type.js.map +1 -1
  80. package/dist/meeting/util.js +168 -5
  81. package/dist/meeting/util.js.map +1 -1
  82. package/dist/meeting-info/meeting-info-v2.js +2 -2
  83. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  84. package/dist/meetings/index.js +369 -173
  85. package/dist/meetings/index.js.map +1 -1
  86. package/dist/meetings/meetings.types.js +6 -1
  87. package/dist/meetings/meetings.types.js.map +1 -1
  88. package/dist/meetings/request.js +39 -0
  89. package/dist/meetings/request.js.map +1 -1
  90. package/dist/meetings/util.js +127 -25
  91. package/dist/meetings/util.js.map +1 -1
  92. package/dist/member/index.js +20 -0
  93. package/dist/member/index.js.map +1 -1
  94. package/dist/member/types.js.map +1 -1
  95. package/dist/member/util.js +40 -0
  96. package/dist/member/util.js.map +1 -1
  97. package/dist/members/index.js +101 -43
  98. package/dist/members/index.js.map +1 -1
  99. package/dist/members/util.js +8 -1
  100. package/dist/members/util.js.map +1 -1
  101. package/dist/metrics/constants.js +11 -1
  102. package/dist/metrics/constants.js.map +1 -1
  103. package/dist/multistream/codec/constants.js +63 -0
  104. package/dist/multistream/codec/constants.js.map +1 -0
  105. package/dist/multistream/mediaRequestManager.js +64 -68
  106. package/dist/multistream/mediaRequestManager.js.map +1 -1
  107. package/dist/multistream/receiveSlot.js +9 -0
  108. package/dist/multistream/receiveSlot.js.map +1 -1
  109. package/dist/multistream/remoteMediaManager.js +11 -0
  110. package/dist/multistream/remoteMediaManager.js.map +1 -1
  111. package/dist/multistream/sendSlotManager.js +116 -2
  112. package/dist/multistream/sendSlotManager.js.map +1 -1
  113. package/dist/reachability/clusterReachability.js +171 -18
  114. package/dist/reachability/clusterReachability.js.map +1 -1
  115. package/dist/reachability/index.js +142 -94
  116. package/dist/reachability/index.js.map +1 -1
  117. package/dist/reachability/reachability.types.js +2 -0
  118. package/dist/reachability/reachability.types.js.map +1 -1
  119. package/dist/reachability/reachabilityPeerConnection.js +1 -1
  120. package/dist/reachability/reachabilityPeerConnection.js.map +1 -1
  121. package/dist/reachability/util.js +45 -0
  122. package/dist/reachability/util.js.map +1 -1
  123. package/dist/reactions/reactions.type.js.map +1 -1
  124. package/dist/reconnection-manager/index.js +0 -1
  125. package/dist/reconnection-manager/index.js.map +1 -1
  126. package/dist/recording-controller/index.js +1 -3
  127. package/dist/recording-controller/index.js.map +1 -1
  128. package/dist/types/aiEnableRequest/index.d.ts +5 -0
  129. package/dist/types/aiEnableRequest/utils.d.ts +2 -0
  130. package/dist/types/common/browser-detection.d.ts +1 -0
  131. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  132. package/dist/types/common/events/events-scope.d.ts +1 -0
  133. package/dist/types/common/events/events.d.ts +1 -0
  134. package/dist/types/config.d.ts +7 -2
  135. package/dist/types/constants.d.ts +35 -1
  136. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  137. package/dist/types/controls-options-manager/index.d.ts +16 -0
  138. package/dist/types/hashTree/constants.d.ts +11 -0
  139. package/dist/types/hashTree/hashTree.d.ts +136 -0
  140. package/dist/types/hashTree/hashTreeParser.d.ts +392 -14
  141. package/dist/types/hashTree/types.d.ts +20 -0
  142. package/dist/types/hashTree/utils.d.ts +40 -0
  143. package/dist/types/index.d.ts +4 -0
  144. package/dist/types/interceptors/constant.d.ts +5 -0
  145. package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
  146. package/dist/types/interceptors/index.d.ts +2 -1
  147. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  148. package/dist/types/interceptors/locusRouteToken.d.ts +2 -0
  149. package/dist/types/interceptors/utils.d.ts +1 -0
  150. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  151. package/dist/types/locus-info/index.d.ts +116 -51
  152. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  153. package/dist/types/locus-info/types.d.ts +48 -12
  154. package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
  155. package/dist/types/media/properties.d.ts +3 -1
  156. package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
  157. package/dist/types/meeting/index.d.ts +196 -15
  158. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  159. package/dist/types/meeting/request.d.ts +17 -1
  160. package/dist/types/meeting/request.type.d.ts +5 -0
  161. package/dist/types/meeting/util.d.ts +40 -0
  162. package/dist/types/meeting-info/util.d.ts +1 -0
  163. package/dist/types/meeting-info/utilv2.d.ts +1 -0
  164. package/dist/types/meetings/index.d.ts +34 -20
  165. package/dist/types/meetings/meetings.types.d.ts +15 -0
  166. package/dist/types/meetings/request.d.ts +14 -0
  167. package/dist/types/member/index.d.ts +2 -0
  168. package/dist/types/member/types.d.ts +5 -4
  169. package/dist/types/member/util.d.ts +14 -0
  170. package/dist/types/members/index.d.ts +15 -2
  171. package/dist/types/members/util.d.ts +1 -5
  172. package/dist/types/metrics/constants.d.ts +10 -0
  173. package/dist/types/multistream/codec/constants.d.ts +7 -0
  174. package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
  175. package/dist/types/multistream/sendSlotManager.d.ts +23 -1
  176. package/dist/types/reachability/clusterReachability.d.ts +33 -6
  177. package/dist/types/reachability/index.d.ts +10 -3
  178. package/dist/types/reachability/reachability.types.d.ts +7 -0
  179. package/dist/types/reachability/util.d.ts +17 -0
  180. package/dist/types/reactions/reactions.type.d.ts +4 -0
  181. package/dist/types/recording-controller/util.d.ts +5 -5
  182. package/dist/types/roap/index.d.ts +1 -1
  183. package/dist/types/webinar/utils.d.ts +6 -0
  184. package/dist/webinar/index.js +585 -164
  185. package/dist/webinar/index.js.map +1 -1
  186. package/dist/webinar/utils.js +25 -0
  187. package/dist/webinar/utils.js.map +1 -0
  188. package/package.json +26 -24
  189. package/src/aiEnableRequest/README.md +84 -0
  190. package/src/aiEnableRequest/index.ts +186 -0
  191. package/src/aiEnableRequest/utils.ts +25 -0
  192. package/src/annotation/index.ts +27 -7
  193. package/src/breakouts/breakout.ts +3 -1
  194. package/src/breakouts/index.ts +31 -0
  195. package/src/common/errors/webex-errors.ts +50 -3
  196. package/src/config.ts +7 -2
  197. package/src/constants.ts +49 -3
  198. package/src/controls-options-manager/constants.ts +14 -1
  199. package/src/controls-options-manager/index.ts +87 -28
  200. package/src/controls-options-manager/util.ts +81 -1
  201. package/src/hashTree/constants.ts +26 -0
  202. package/src/hashTree/hashTree.ts +480 -0
  203. package/src/hashTree/hashTreeParser.ts +1911 -29
  204. package/src/hashTree/types.ts +24 -1
  205. package/src/hashTree/utils.ts +98 -0
  206. package/src/index.ts +14 -1
  207. package/src/interceptors/constant.ts +6 -0
  208. package/src/interceptors/dataChannelAuthToken.ts +246 -0
  209. package/src/interceptors/index.ts +2 -1
  210. package/src/interceptors/locusRetry.ts +25 -4
  211. package/src/interceptors/locusRouteToken.ts +22 -5
  212. package/src/interceptors/utils.ts +16 -0
  213. package/src/interpretation/index.ts +29 -11
  214. package/src/interpretation/interpretation.types.ts +11 -0
  215. package/src/locus-info/controlsUtils.ts +20 -1
  216. package/src/locus-info/index.ts +958 -250
  217. package/src/locus-info/infoUtils.ts +41 -6
  218. package/src/locus-info/selfUtils.ts +1 -0
  219. package/src/locus-info/types.ts +51 -12
  220. package/src/media/MediaConnectionAwaiter.ts +62 -5
  221. package/src/media/index.ts +10 -1
  222. package/src/media/properties.ts +4 -1
  223. package/src/meeting/in-meeting-actions.ts +20 -0
  224. package/src/meeting/index.ts +1025 -146
  225. package/src/meeting/locusMediaRequest.ts +106 -6
  226. package/src/meeting/muteState.ts +10 -1
  227. package/src/meeting/request.ts +53 -0
  228. package/src/meeting/request.type.ts +6 -0
  229. package/src/meeting/util.ts +207 -7
  230. package/src/meeting-info/meeting-info-v2.ts +4 -2
  231. package/src/meetings/index.ts +307 -132
  232. package/src/meetings/meetings.types.ts +19 -0
  233. package/src/meetings/request.ts +43 -0
  234. package/src/meetings/util.ts +127 -13
  235. package/src/member/index.ts +20 -0
  236. package/src/member/types.ts +1 -0
  237. package/src/member/util.ts +41 -0
  238. package/src/members/index.ts +70 -7
  239. package/src/members/util.ts +12 -4
  240. package/src/metrics/constants.ts +11 -0
  241. package/src/multistream/codec/constants.ts +58 -0
  242. package/src/multistream/mediaRequestManager.ts +117 -76
  243. package/src/multistream/receiveSlot.ts +18 -0
  244. package/src/multistream/remoteMediaManager.ts +13 -0
  245. package/src/multistream/sendSlotManager.ts +97 -3
  246. package/src/reachability/clusterReachability.ts +156 -29
  247. package/src/reachability/index.ts +62 -17
  248. package/src/reachability/reachability.types.ts +11 -0
  249. package/src/reachability/reachabilityPeerConnection.ts +3 -1
  250. package/src/reachability/util.ts +36 -0
  251. package/src/reactions/reactions.type.ts +4 -0
  252. package/src/reconnection-manager/index.ts +0 -1
  253. package/src/recording-controller/index.ts +1 -2
  254. package/src/webinar/index.ts +448 -11
  255. package/src/webinar/utils.ts +16 -0
  256. package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
  257. package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
  258. package/test/unit/spec/annotation/index.ts +69 -7
  259. package/test/unit/spec/breakouts/breakout.ts +9 -3
  260. package/test/unit/spec/breakouts/index.ts +49 -0
  261. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  262. package/test/unit/spec/controls-options-manager/index.js +244 -29
  263. package/test/unit/spec/controls-options-manager/util.js +165 -0
  264. package/test/unit/spec/hashTree/hashTree.ts +721 -0
  265. package/test/unit/spec/hashTree/hashTreeParser.ts +5328 -0
  266. package/test/unit/spec/hashTree/utils.ts +264 -0
  267. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +406 -0
  268. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  269. package/test/unit/spec/interceptors/locusRouteToken.ts +44 -0
  270. package/test/unit/spec/interceptors/utils.ts +75 -0
  271. package/test/unit/spec/interpretation/index.ts +26 -4
  272. package/test/unit/spec/locus-info/controlsUtils.js +222 -52
  273. package/test/unit/spec/locus-info/index.js +2000 -171
  274. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  275. package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
  276. package/test/unit/spec/media/index.ts +92 -0
  277. package/test/unit/spec/media/properties.ts +12 -3
  278. package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
  279. package/test/unit/spec/meeting/index.js +2925 -209
  280. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  281. package/test/unit/spec/meeting/muteState.js +81 -0
  282. package/test/unit/spec/meeting/request.js +82 -0
  283. package/test/unit/spec/meeting/utils.js +595 -27
  284. package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
  285. package/test/unit/spec/meetings/index.js +1214 -75
  286. package/test/unit/spec/meetings/request.js +141 -0
  287. package/test/unit/spec/meetings/utils.js +453 -52
  288. package/test/unit/spec/member/index.js +35 -4
  289. package/test/unit/spec/member/util.js +154 -27
  290. package/test/unit/spec/members/index.js +216 -0
  291. package/test/unit/spec/members/request.js +37 -1
  292. package/test/unit/spec/members/utils.js +63 -0
  293. package/test/unit/spec/multistream/mediaRequestManager.ts +503 -122
  294. package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
  295. package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
  296. package/test/unit/spec/reachability/clusterReachability.ts +125 -1
  297. package/test/unit/spec/reachability/index.ts +154 -49
  298. package/test/unit/spec/reachability/util.ts +31 -0
  299. package/test/unit/spec/reconnection-manager/index.js +4 -8
  300. package/test/unit/spec/recording-controller/index.js +9 -8
  301. package/test/unit/spec/webinar/index.ts +837 -39
  302. package/test/unit/spec/webinar/utils.ts +39 -0
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_webexCore","require","_meetings","_interopRequireDefault","_config","_interceptors","_captchaError","_intentToJoin","_passwordError","_permission","_joinWebinarError","_reclaimHostRoleErrors","_meeting","_utilv","_joinMeeting","_webexErrors","_mediaHelpers","_CONSTANTS","_interopRequireWildcard","exports","CONSTANTS","_REACTIONS","REACTIONS","_sdkAnnotationTypes","sdkAnnotationTypes","_MeetingInfoV","MeetingInfoV2","_remoteMedia","_triggerProxy","e","t","_WeakMap","r","n","__esModule","o","i","f","__proto__","default","_typeof","has","get","set","_t","hasOwnProperty","call","_Object$defineProperty","_Object$getOwnPropertyDescriptor","registerPlugin","Meetings","config","interceptors","LocusRetryStatusInterceptor","create","LocusRouteTokenInterceptor","_default"],"sources":["index.ts"],"sourcesContent":["/* eslint-env browser */\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Meetings from './meetings';\nimport config from './config';\nimport {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor} from './interceptors';\nimport CaptchaError from './common/errors/captcha-error';\nimport IntentToJoinError from './common/errors/intent-to-join';\nimport PasswordError from './common/errors/password-error';\nimport PermissionError from './common/errors/permission';\nimport JoinWebinarError from './common/errors/join-webinar-error';\nimport {\n ReclaimHostEmptyWrongKeyError,\n ReclaimHostIsHostAlreadyError,\n ReclaimHostNotAllowedError,\n ReclaimHostNotSupportedError,\n} from './common/errors/reclaim-host-role-errors';\nimport Meeting from './meeting';\nimport MeetingInfoUtil from './meeting-info/utilv2';\nimport JoinMeetingError from './common/errors/join-meeting';\nimport {SdpResponseTimeoutError} from './common/errors/webex-errors';\n\nregisterPlugin('meetings', Meetings, {\n config,\n interceptors: {\n LocusRetryStatusInterceptor: LocusRetryStatusInterceptor.create,\n LocusRouteTokenInterceptor: LocusRouteTokenInterceptor.create,\n },\n});\n\nexport {\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n RemoteStreamEventNames,\n type ServerMuteReason,\n LocalMicrophoneStreamEventNames,\n LocalCameraStreamEventNames,\n LocalMicrophoneStream,\n LocalCameraStream,\n createMicrophoneStream,\n createCameraStream,\n createCameraAndMicrophoneStreams,\n createDisplayStream,\n createDisplayStreamWithAudio,\n createDisplayMedia,\n FacingMode,\n DisplaySurface,\n PresetCameraConstraints,\n type VideoContentHint,\n type StreamState,\n} from '@webex/media-helpers';\n\nexport default Meetings;\n\nexport * as CONSTANTS from './constants';\nexport * as REACTIONS from './reactions/reactions';\nexport * as sdkAnnotationTypes from './annotation/annotation.types';\nexport * as MeetingInfoV2 from './meeting-info/meeting-info-v2';\nexport {type Reaction} from './reactions/reactions.type';\n\nexport {\n CaptchaError,\n IntentToJoinError,\n JoinMeetingError,\n PasswordError,\n PermissionError,\n ReclaimHostIsHostAlreadyError,\n ReclaimHostNotAllowedError,\n ReclaimHostNotSupportedError,\n ReclaimHostEmptyWrongKeyError,\n Meeting,\n MeetingInfoUtil,\n JoinWebinarError,\n SdpResponseTimeoutError,\n};\n\nexport {RemoteMedia} from './multistream/remoteMedia';\n\nexport {default as TriggerProxy} from './common/events/trigger-proxy';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,cAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,WAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,iBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,sBAAA,GAAAV,OAAA;AAMA,IAAAW,QAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,MAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,YAAA,GAAAX,sBAAA,CAAAF,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A,CAAAnB,CAAA,EAAAe,EAAA,OAAAR,CAAA,CAAAM,GAAA,IAAAN,CAAA,CAAAO,GAAA,IAAAR,CAAA,CAAAE,CAAA,EAAAO,EAAA,EAAAR,CAAA,IAAAC,CAAA,CAAAO,EAAA,IAAAf,CAAA,CAAAe,EAAA,WAAAP,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAjFtE;;AAsBA,IAAAmB,yBAAc,EAAC,UAAU,EAAEC,iBAAQ,EAAE;EACnCC,MAAM,EAANA,eAAM;EACNC,YAAY,EAAE;IACZC,2BAA2B,EAAEA,yCAA2B,CAACC,MAAM;IAC/DC,0BAA0B,EAAEA,wCAA0B,CAACD;EACzD;AACF,CAAC,CAAC;AAAC,IAAAE,QAAA,GAAArC,OAAA,CAAAoB,OAAA,GA2BYW,iBAAQ","ignoreList":[]}
1
+ {"version":3,"names":["_webexCore","require","_meetings","_interopRequireDefault","_config","_interceptors","_captchaError","_intentToJoin","_passwordError","_permission","_joinWebinarError","_reclaimHostRoleErrors","_meeting","_utilv","_joinMeeting","_webexErrors","_mediaHelpers","_CONSTANTS","_interopRequireWildcard","exports","CONSTANTS","_REACTIONS","REACTIONS","_sdkAnnotationTypes","sdkAnnotationTypes","_MeetingInfoV","MeetingInfoV2","_meetings2","_remoteMedia","_triggerProxy","_utils","e","t","_WeakMap","r","n","__esModule","o","i","f","__proto__","default","_typeof","has","get","set","_t","hasOwnProperty","call","_Object$defineProperty","_Object$getOwnPropertyDescriptor","registerPlugin","Meetings","config","interceptors","LocusRetryStatusInterceptor","create","LocusRouteTokenInterceptor","DataChannelAuthTokenInterceptor","_default"],"sources":["index.ts"],"sourcesContent":["/* eslint-env browser */\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Meetings from './meetings';\nimport config from './config';\nimport {\n LocusRetryStatusInterceptor,\n LocusRouteTokenInterceptor,\n DataChannelAuthTokenInterceptor,\n} from './interceptors';\nimport CaptchaError from './common/errors/captcha-error';\nimport IntentToJoinError from './common/errors/intent-to-join';\nimport PasswordError from './common/errors/password-error';\nimport PermissionError from './common/errors/permission';\nimport JoinWebinarError from './common/errors/join-webinar-error';\nimport {\n ReclaimHostEmptyWrongKeyError,\n ReclaimHostIsHostAlreadyError,\n ReclaimHostNotAllowedError,\n ReclaimHostNotSupportedError,\n} from './common/errors/reclaim-host-role-errors';\nimport Meeting from './meeting';\nimport MeetingInfoUtil from './meeting-info/utilv2';\nimport JoinMeetingError from './common/errors/join-meeting';\nimport {SdpResponseTimeoutError} from './common/errors/webex-errors';\n\nregisterPlugin('meetings', Meetings, {\n config,\n interceptors: {\n LocusRetryStatusInterceptor: LocusRetryStatusInterceptor.create,\n LocusRouteTokenInterceptor: LocusRouteTokenInterceptor.create,\n DataChannelAuthTokenInterceptor: DataChannelAuthTokenInterceptor.create,\n },\n});\n\nexport {\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n RemoteStreamEventNames,\n type ServerMuteReason,\n LocalMicrophoneStreamEventNames,\n LocalCameraStreamEventNames,\n LocalMicrophoneStream,\n LocalCameraStream,\n createMicrophoneStream,\n createCameraStream,\n createCameraAndMicrophoneStreams,\n createDisplayStream,\n createDisplayStreamWithAudio,\n createDisplayMedia,\n FacingMode,\n DisplaySurface,\n PresetCameraConstraints,\n type VideoContentHint,\n type StreamState,\n} from '@webex/media-helpers';\n\nexport default Meetings;\n\nexport * as CONSTANTS from './constants';\nexport * as REACTIONS from './reactions/reactions';\nexport * as sdkAnnotationTypes from './annotation/annotation.types';\nexport * as MeetingInfoV2 from './meeting-info/meeting-info-v2';\nexport {type Reaction} from './reactions/reactions.type';\nexport {SitePreferenceSelectOption} from './meetings/meetings.types';\nexport type {\n FetchSitePreferencesMeViaSiteOptions,\n SitePreferencesResponse,\n} from './meetings/meetings.types';\nexport type {Interpreter, InterpreterUsingResource} from './interpretation/interpretation.types';\n\nexport {\n CaptchaError,\n IntentToJoinError,\n JoinMeetingError,\n PasswordError,\n PermissionError,\n ReclaimHostIsHostAlreadyError,\n ReclaimHostNotAllowedError,\n ReclaimHostNotSupportedError,\n ReclaimHostEmptyWrongKeyError,\n Meeting,\n MeetingInfoUtil,\n JoinWebinarError,\n SdpResponseTimeoutError,\n};\n\nexport {RemoteMedia} from './multistream/remoteMedia';\n\nexport {default as TriggerProxy} from './common/events/trigger-proxy';\n\nexport {getAIEnablementApprover} from './aiEnableRequest/utils';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAKA,IAAAK,aAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,cAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,WAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,iBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,sBAAA,GAAAV,OAAA;AAMA,IAAAW,QAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,MAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,YAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AAWA,IAAAe,aAAA,GAAAf,OAAA;AAuB8B,IAAAgB,UAAA,GAAAC,uBAAA,CAAAjB,OAAA;AAAAkB,OA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,CAAA,CAAAO,GAAA,IAAAR,CAAA,CAAAE,CAAA,EAAAO,EAAA,EAAAR,CAAA,IAAAC,CAAA,CAAAO,EAAA,IAAAf,CAAA,CAAAe,EAAA,WAAAP,CAAA,KAAAR,CAAA,EAAAC,CAAA;AA9FhE;;AA0BA,IAAAmB,yBAAc,EAAC,UAAU,EAAEC,iBAAQ,EAAE;EACnCC,MAAM,EAANA,eAAM;EACNC,YAAY,EAAE;IACZC,2BAA2B,EAAEA,yCAA2B,CAACC,MAAM;IAC/DC,0BAA0B,EAAEA,wCAA0B,CAACD,MAAM;IAC7DE,+BAA+B,EAAEA,6CAA+B,CAACF;EACnE;AACF,CAAC,CAAC;AAAC,IAAAG,QAAA,GAAAxC,OAAA,CAAAsB,OAAA,GA2BYW,iBAAQ","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.RETRY_KEY = exports.RETRY_INTERVAL = exports.MAX_RETRY = exports.DATA_CHANNEL_AUTH_HEADER = void 0;
8
+ var DATA_CHANNEL_AUTH_HEADER = exports.DATA_CHANNEL_AUTH_HEADER = 'Data-Channel-Auth-Token';
9
+ var MAX_RETRY = exports.MAX_RETRY = 1;
10
+ var RETRY_INTERVAL = exports.RETRY_INTERVAL = 2000;
11
+ var RETRY_KEY = exports.RETRY_KEY = '_dcRetryKey';
12
+ //# sourceMappingURL=constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DATA_CHANNEL_AUTH_HEADER","exports","MAX_RETRY","RETRY_INTERVAL","RETRY_KEY"],"sources":["constant.ts"],"sourcesContent":["const DATA_CHANNEL_AUTH_HEADER = 'Data-Channel-Auth-Token';\nconst MAX_RETRY = 1;\nconst RETRY_INTERVAL = 2000;\nconst RETRY_KEY = '_dcRetryKey';\n\nexport {DATA_CHANNEL_AUTH_HEADER, MAX_RETRY, RETRY_INTERVAL, RETRY_KEY};\n"],"mappings":";;;;;;;AAAA,IAAMA,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,yBAAyB;AAC1D,IAAME,SAAS,GAAAD,OAAA,CAAAC,SAAA,GAAG,CAAC;AACnB,IAAMC,cAAc,GAAAF,OAAA,CAAAE,cAAA,GAAG,IAAI;AAC3B,IAAMC,SAAS,GAAAH,OAAA,CAAAG,SAAA,GAAG,aAAa","ignoreList":[]}
@@ -0,0 +1,350 @@
1
+ "use strict";
2
+
3
+ var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
5
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
+ _Object$defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.default = void 0;
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
13
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
14
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
15
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
17
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
18
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
19
+ var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
20
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
21
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
22
+ var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
23
+ var _httpCore = require("@webex/http-core");
24
+ var _internalPluginLlm = _interopRequireDefault(require("@webex/internal-plugin-llm"));
25
+ var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
26
+ var _constant = require("./constant");
27
+ var _utils = require("./utils");
28
+ var _constants = require("../constants");
29
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
30
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*!
31
+ * Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
32
+ */
33
+ var retryCountMap = new _map.default();
34
+ /**
35
+ * @class
36
+ */
37
+ var DataChannelAuthTokenInterceptor = exports.default = /*#__PURE__*/function (_Interceptor) {
38
+ function DataChannelAuthTokenInterceptor(options) {
39
+ var _this;
40
+ (0, _classCallCheck2.default)(this, DataChannelAuthTokenInterceptor);
41
+ _this = _callSuper(this, DataChannelAuthTokenInterceptor, [options]);
42
+ (0, _defineProperty2.default)(_this, "_refreshDataChannelToken", void 0);
43
+ (0, _defineProperty2.default)(_this, "_isDataChannelTokenEnabled", void 0);
44
+ _this._refreshDataChannelToken = options.refreshDataChannelToken;
45
+ _this._isDataChannelTokenEnabled = options.isDataChannelTokenEnabled;
46
+ return _this;
47
+ }
48
+
49
+ /**
50
+ * @returns {DataChannelAuthTokenInterceptor}
51
+ */
52
+ (0, _inherits2.default)(DataChannelAuthTokenInterceptor, _Interceptor);
53
+ return (0, _createClass2.default)(DataChannelAuthTokenInterceptor, [{
54
+ key: "getRetryKey",
55
+ value: function getRetryKey(options) {
56
+ if (!options[_constant.RETRY_KEY]) {
57
+ options[_constant.RETRY_KEY] = "".concat((0, _now.default)(), "-").concat(Math.random());
58
+ }
59
+ return options[_constant.RETRY_KEY];
60
+ }
61
+
62
+ // Helper function to get header value case insensitively
63
+ }, {
64
+ key: "getHeader",
65
+ value: function getHeader(headers, name) {
66
+ var key = (0, _keys.default)(headers).find(function (k) {
67
+ return k.toLowerCase() === name.toLowerCase();
68
+ });
69
+ return key ? headers[key] : undefined;
70
+ }
71
+
72
+ /**
73
+ * Intercepts outgoing requests and refreshes the Data-Channel-Auth-Token
74
+ * if the current JWT token is expired before the request is sent.
75
+ *
76
+ * @param {Object} options - The original request options.
77
+ * @returns {Promise<Object>} Updated request options with refreshed token if needed.
78
+ */
79
+ }, {
80
+ key: "onRequest",
81
+ value: (function () {
82
+ var _onRequest = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(options) {
83
+ var token, enabled, newToken, _t;
84
+ return _regenerator.default.wrap(function (_context) {
85
+ while (1) switch (_context.prev = _context.next) {
86
+ case 0:
87
+ token = this.getHeader(options.headers, _constant.DATA_CHANNEL_AUTH_HEADER);
88
+ _context.next = 1;
89
+ return this._isDataChannelTokenEnabled();
90
+ case 1:
91
+ enabled = _context.sent;
92
+ if (!(!token || !enabled)) {
93
+ _context.next = 2;
94
+ break;
95
+ }
96
+ return _context.abrupt("return", options);
97
+ case 2:
98
+ if (!(0, _utils.isJwtTokenExpired)(token)) {
99
+ _context.next = 6;
100
+ break;
101
+ }
102
+ _context.prev = 3;
103
+ _context.next = 4;
104
+ return this._refreshDataChannelToken(options.uri || options.url);
105
+ case 4:
106
+ newToken = _context.sent;
107
+ options.headers[_constant.DATA_CHANNEL_AUTH_HEADER] = newToken;
108
+ _context.next = 6;
109
+ break;
110
+ case 5:
111
+ _context.prev = 5;
112
+ _t = _context["catch"](3);
113
+ _loggerProxy.default.logger.warn("DataChannelAuthTokenInterceptor: refresh failed: ".concat(_t.message));
114
+ case 6:
115
+ return _context.abrupt("return", options);
116
+ case 7:
117
+ case "end":
118
+ return _context.stop();
119
+ }
120
+ }, _callee, this, [[3, 5]]);
121
+ }));
122
+ function onRequest(_x) {
123
+ return _onRequest.apply(this, arguments);
124
+ }
125
+ return onRequest;
126
+ }()
127
+ /**
128
+ * Intercept responses and, on 401/403 with `Data-Channel-Auth-Token` header,
129
+ * attempt to refresh the data channel token and retry the original request once.
130
+ *
131
+ * @param {Object} options
132
+ * @param {Object} reason
133
+ * @returns {Promise<HttpResponse>}
134
+ */
135
+ )
136
+ }, {
137
+ key: "onResponseError",
138
+ value: (function () {
139
+ var _onResponseError = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(options, reason) {
140
+ var token, enabled, key, retryCount;
141
+ return _regenerator.default.wrap(function (_context2) {
142
+ while (1) switch (_context2.prev = _context2.next) {
143
+ case 0:
144
+ token = this.getHeader(options.headers, _constant.DATA_CHANNEL_AUTH_HEADER);
145
+ _context2.next = 1;
146
+ return this._isDataChannelTokenEnabled();
147
+ case 1:
148
+ enabled = _context2.sent;
149
+ if (!(!token || !enabled)) {
150
+ _context2.next = 2;
151
+ break;
152
+ }
153
+ return _context2.abrupt("return", _promise.default.reject(reason));
154
+ case 2:
155
+ if (!(reason.statusCode !== 401 && reason.statusCode !== 403)) {
156
+ _context2.next = 3;
157
+ break;
158
+ }
159
+ return _context2.abrupt("return", _promise.default.reject(reason));
160
+ case 3:
161
+ key = this.getRetryKey(options);
162
+ retryCount = retryCountMap.get(key) || 0;
163
+ if (!(retryCount >= _constant.MAX_RETRY)) {
164
+ _context2.next = 4;
165
+ break;
166
+ }
167
+ _loggerProxy.default.logger.error("data channel token refresh exceeded max retry (".concat(_constant.MAX_RETRY, ")"));
168
+ retryCountMap.delete(key);
169
+ return _context2.abrupt("return", _promise.default.reject(reason));
170
+ case 4:
171
+ retryCountMap.set(key, retryCount + 1);
172
+ return _context2.abrupt("return", this.refreshTokenAndRetryWithDelay(options));
173
+ case 5:
174
+ case "end":
175
+ return _context2.stop();
176
+ }
177
+ }, _callee2, this);
178
+ }));
179
+ function onResponseError(_x2, _x3) {
180
+ return _onResponseError.apply(this, arguments);
181
+ }
182
+ return onResponseError;
183
+ }()
184
+ /**
185
+ * Retry the failed data channel request after a delay.
186
+ * Refreshes the Data-Channel-Auth-Token and re-sends the original request.
187
+ *
188
+ * @param {Object} options - Original request options.
189
+ * @returns {Promise<HttpResponse>} - Resolves on successful retry.
190
+ */
191
+ )
192
+ }, {
193
+ key: "refreshTokenAndRetryWithDelay",
194
+ value: function refreshTokenAndRetryWithDelay(options) {
195
+ var _this2 = this;
196
+ return new _promise.default(function (resolve, reject) {
197
+ setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
198
+ var key, newToken, res, msg, err, _t2;
199
+ return _regenerator.default.wrap(function (_context3) {
200
+ while (1) switch (_context3.prev = _context3.next) {
201
+ case 0:
202
+ key = _this2.getRetryKey(options);
203
+ _context3.prev = 1;
204
+ _context3.next = 2;
205
+ return _this2._refreshDataChannelToken(options.uri || options.url);
206
+ case 2:
207
+ newToken = _context3.sent;
208
+ options.headers[_constant.DATA_CHANNEL_AUTH_HEADER] = newToken;
209
+
210
+ // @ts-ignore
211
+ _context3.next = 3;
212
+ return _this2.webex.request(options);
213
+ case 3:
214
+ res = _context3.sent;
215
+ retryCountMap.delete(key);
216
+ resolve(res);
217
+ _context3.next = 5;
218
+ break;
219
+ case 4:
220
+ _context3.prev = 4;
221
+ _t2 = _context3["catch"](1);
222
+ retryCountMap.delete(key);
223
+ msg = (_t2 === null || _t2 === void 0 ? void 0 : _t2.message) || String(_t2);
224
+ err = new Error("DataChannel token refresh failed: ".concat(msg));
225
+ err.statusCode = _t2 === null || _t2 === void 0 ? void 0 : _t2.statusCode;
226
+ err.original = _t2;
227
+ reject(err);
228
+ case 5:
229
+ case "end":
230
+ return _context3.stop();
231
+ }
232
+ }, _callee3, null, [[1, 4]]);
233
+ })), _constant.RETRY_INTERVAL);
234
+ });
235
+ }
236
+ }], [{
237
+ key: "create",
238
+ value: function create() {
239
+ var _this3 = this;
240
+ // @ts-ignore
241
+ return new DataChannelAuthTokenInterceptor({
242
+ webex: this,
243
+ isDataChannelTokenEnabled: function () {
244
+ var _isDataChannelTokenEnabled = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
245
+ return _regenerator.default.wrap(function (_context4) {
246
+ while (1) switch (_context4.prev = _context4.next) {
247
+ case 0:
248
+ return _context4.abrupt("return", _this3.internal.llm.isDataChannelTokenEnabled());
249
+ case 1:
250
+ case "end":
251
+ return _context4.stop();
252
+ }
253
+ }, _callee4);
254
+ }));
255
+ function isDataChannelTokenEnabled() {
256
+ return _isDataChannelTokenEnabled.apply(this, arguments);
257
+ }
258
+ return isDataChannelTokenEnabled;
259
+ }(),
260
+ // Route refresh by request URL in two steps:
261
+ // 1) Match active LLM sessions (supports non-default/multiple sessions)
262
+ // 2) If no session matches, resolve locusUrl and refresh via owning meeting
263
+ // If neither route matches, fall back to the default-session refresh.
264
+ refreshDataChannelToken: function () {
265
+ var _refreshDataChannelToken = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(requestUrl) {
266
+ var _result, _meeting2, _this3$internal$llm$g3, _this3$internal$llm3;
267
+ var sessionId, meeting, _this3$internal$llm$g, _this3$internal$llm, _this3$internal$llm$g2, _this3$internal$llm2, locusUrl, _this3$meetings, _this3$meetings$getMe, _this3$meetings2, _this3$meetings2$getA, allMeetings, _meeting, _meeting$locusInfo, info, result, _result$body, datachannelToken, dataChannelTokenType, tokenStoreKey, ownerMeetingId;
268
+ return _regenerator.default.wrap(function (_context5) {
269
+ while (1) switch (_context5.prev = _context5.next) {
270
+ case 0:
271
+ if (typeof requestUrl === 'string') {
272
+ // @ts-ignore
273
+ sessionId = (_this3$internal$llm$g = (_this3$internal$llm = _this3.internal.llm).getSessionIdByDatachannelUrl) === null || _this3$internal$llm$g === void 0 ? void 0 : _this3$internal$llm$g.call(_this3$internal$llm, requestUrl);
274
+ if (!sessionId) {
275
+ // @ts-ignore
276
+ locusUrl = (_this3$internal$llm$g2 = (_this3$internal$llm2 = _this3.internal.llm).getLocusUrlByDatachannelUrl) === null || _this3$internal$llm$g2 === void 0 ? void 0 : _this3$internal$llm$g2.call(_this3$internal$llm2, requestUrl);
277
+ if (locusUrl) {
278
+ // @ts-ignore
279
+ meeting = (_this3$meetings = _this3.meetings) === null || _this3$meetings === void 0 ? void 0 : (_this3$meetings$getMe = _this3$meetings.getMeetingByType) === null || _this3$meetings$getMe === void 0 ? void 0 : _this3$meetings$getMe.call(_this3$meetings, _constants.LOCUS_URL, locusUrl);
280
+ }
281
+ }
282
+ if (!meeting) {
283
+ // Fallback: registerAndConnect() pre-populates datachannelUrl in
284
+ // connections before calling register(), so getSessionIdByDatachannelUrl
285
+ // above should normally resolve. This scan covers any residual gap
286
+ // where connections are not yet populated (e.g. if setRefreshHandler
287
+ // is called on a session that has no connection entry at all).
288
+ // @ts-ignore
289
+ allMeetings = ((_this3$meetings2 = _this3.meetings) === null || _this3$meetings2 === void 0 ? void 0 : (_this3$meetings2$getA = _this3$meetings2.getAllMeetings) === null || _this3$meetings2$getA === void 0 ? void 0 : _this3$meetings2$getA.call(_this3$meetings2)) || {};
290
+ meeting = (0, _values.default)(allMeetings).find(function (activeMeeting) {
291
+ var _activeMeeting$locusI;
292
+ var info = (activeMeeting === null || activeMeeting === void 0 ? void 0 : (_activeMeeting$locusI = activeMeeting.locusInfo) === null || _activeMeeting$locusI === void 0 ? void 0 : _activeMeeting$locusI.info) || {};
293
+ return info.practiceSessionDatachannelUrl && _internalPluginLlm.default.matchesDatachannelRequestUrl(requestUrl, info.practiceSessionDatachannelUrl) || info.datachannelUrl && _internalPluginLlm.default.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl);
294
+ });
295
+ if (!sessionId) {
296
+ // @ts-ignore
297
+ info = ((_meeting = meeting) === null || _meeting === void 0 ? void 0 : (_meeting$locusInfo = _meeting.locusInfo) === null || _meeting$locusInfo === void 0 ? void 0 : _meeting$locusInfo.info) || {};
298
+ if (info.practiceSessionDatachannelUrl && _internalPluginLlm.default.matchesDatachannelRequestUrl(requestUrl, info.practiceSessionDatachannelUrl)) {
299
+ sessionId = _constants.LLM_PRACTICE_SESSION;
300
+ } else if (info.datachannelUrl && _internalPluginLlm.default.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl)) {
301
+ sessionId = _constants.LLM_DEFAULT_SESSION;
302
+ }
303
+ }
304
+ }
305
+ }
306
+ if (!meeting) {
307
+ _context5.next = 2;
308
+ break;
309
+ }
310
+ _context5.next = 1;
311
+ return meeting.refreshDataChannelToken();
312
+ case 1:
313
+ result = _context5.sent;
314
+ _context5.next = 4;
315
+ break;
316
+ case 2:
317
+ _context5.next = 3;
318
+ return _this3.internal.llm.refreshDataChannelToken(sessionId);
319
+ case 3:
320
+ result = _context5.sent;
321
+ case 4:
322
+ if ((_result = result) !== null && _result !== void 0 && _result.body) {
323
+ _context5.next = 5;
324
+ break;
325
+ }
326
+ throw new Error('DataChannel token refresh returned no payload');
327
+ case 5:
328
+ _result$body = result.body, datachannelToken = _result$body.datachannelToken, dataChannelTokenType = _result$body.dataChannelTokenType;
329
+ tokenStoreKey = dataChannelTokenType || sessionId;
330
+ ownerMeetingId =
331
+ // @ts-ignore
332
+ ((_meeting2 = meeting) === null || _meeting2 === void 0 ? void 0 : _meeting2.id) || ((_this3$internal$llm$g3 = (_this3$internal$llm3 = _this3.internal.llm).getOwnerMeetingId) === null || _this3$internal$llm$g3 === void 0 ? void 0 : _this3$internal$llm$g3.call(_this3$internal$llm3, tokenStoreKey)); // @ts-ignore
333
+ _this3.internal.llm.setDatachannelToken(datachannelToken, tokenStoreKey, ownerMeetingId);
334
+ return _context5.abrupt("return", datachannelToken);
335
+ case 6:
336
+ case "end":
337
+ return _context5.stop();
338
+ }
339
+ }, _callee5);
340
+ }));
341
+ function refreshDataChannelToken(_x4) {
342
+ return _refreshDataChannelToken.apply(this, arguments);
343
+ }
344
+ return refreshDataChannelToken;
345
+ }()
346
+ });
347
+ }
348
+ }]);
349
+ }(_httpCore.Interceptor);
350
+ //# sourceMappingURL=dataChannelAuthToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_httpCore","require","_internalPluginLlm","_interopRequireDefault","_loggerProxy","_constant","_utils","_constants","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","retryCountMap","_map","DataChannelAuthTokenInterceptor","exports","_Interceptor","options","_this","_classCallCheck2","_defineProperty2","_refreshDataChannelToken","refreshDataChannelToken","_isDataChannelTokenEnabled","isDataChannelTokenEnabled","_inherits2","_createClass2","key","value","getRetryKey","RETRY_KEY","concat","_now","Math","random","getHeader","headers","name","_keys","find","k","toLowerCase","undefined","_onRequest","_asyncToGenerator2","_regenerator","mark","_callee","token","enabled","newToken","_t","wrap","_context","prev","next","DATA_CHANNEL_AUTH_HEADER","sent","abrupt","isJwtTokenExpired","uri","url","LoggerProxy","logger","warn","message","stop","onRequest","_x","arguments","_onResponseError","_callee2","reason","retryCount","_context2","_promise","reject","statusCode","get","MAX_RETRY","error","delete","set","refreshTokenAndRetryWithDelay","onResponseError","_x2","_x3","_this2","resolve","setTimeout","_callee3","res","msg","err","_t2","_context3","webex","request","String","Error","original","RETRY_INTERVAL","create","_this3","_callee4","_context4","internal","llm","_callee5","requestUrl","_result","_meeting2","_this3$internal$llm$g3","_this3$internal$llm3","sessionId","meeting","_this3$internal$llm$g","_this3$internal$llm","_this3$internal$llm$g2","_this3$internal$llm2","locusUrl","_this3$meetings","_this3$meetings$getMe","_this3$meetings2","_this3$meetings2$getA","allMeetings","_meeting","_meeting$locusInfo","info","result","_result$body","datachannelToken","dataChannelTokenType","tokenStoreKey","ownerMeetingId","_context5","getSessionIdByDatachannelUrl","getLocusUrlByDatachannelUrl","meetings","getMeetingByType","LOCUS_URL","getAllMeetings","_values","activeMeeting","_activeMeeting$locusI","locusInfo","practiceSessionDatachannelUrl","LLMChannel","matchesDatachannelRequestUrl","datachannelUrl","LLM_PRACTICE_SESSION","LLM_DEFAULT_SESSION","body","id","getOwnerMeetingId","setDatachannelToken","_x4","Interceptor"],"sources":["dataChannelAuthToken.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\nimport LLMChannel from '@webex/internal-plugin-llm';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {DATA_CHANNEL_AUTH_HEADER, MAX_RETRY, RETRY_INTERVAL, RETRY_KEY} from './constant';\nimport {isJwtTokenExpired} from './utils';\nimport {LLM_DEFAULT_SESSION, LLM_PRACTICE_SESSION, LOCUS_URL} from '../constants';\n\nconst retryCountMap = new Map();\ninterface HttpLikeError extends Error {\n statusCode?: number;\n original?: any;\n}\n/**\n * @class\n */\nexport default class DataChannelAuthTokenInterceptor extends Interceptor {\n private _refreshDataChannelToken: (requestUrl?: string) => Promise<string>;\n private _isDataChannelTokenEnabled: () => Promise<boolean>;\n constructor(options) {\n super(options);\n\n this._refreshDataChannelToken = options.refreshDataChannelToken;\n this._isDataChannelTokenEnabled = options.isDataChannelTokenEnabled;\n }\n\n /**\n * @returns {DataChannelAuthTokenInterceptor}\n */\n static create() {\n // @ts-ignore\n return new DataChannelAuthTokenInterceptor({\n webex: this,\n\n isDataChannelTokenEnabled: async () => {\n // @ts-ignore\n return this.internal.llm.isDataChannelTokenEnabled();\n },\n\n // Route refresh by request URL in two steps:\n // 1) Match active LLM sessions (supports non-default/multiple sessions)\n // 2) If no session matches, resolve locusUrl and refresh via owning meeting\n // If neither route matches, fall back to the default-session refresh.\n refreshDataChannelToken: async (requestUrl?: string) => {\n let sessionId;\n let meeting;\n\n if (typeof requestUrl === 'string') {\n // @ts-ignore\n sessionId = this.internal.llm.getSessionIdByDatachannelUrl?.(requestUrl);\n\n if (!sessionId) {\n // @ts-ignore\n const locusUrl = this.internal.llm.getLocusUrlByDatachannelUrl?.(requestUrl);\n\n if (locusUrl) {\n // @ts-ignore\n meeting = this.meetings?.getMeetingByType?.(LOCUS_URL, locusUrl);\n }\n }\n\n if (!meeting) {\n // Fallback: registerAndConnect() pre-populates datachannelUrl in\n // connections before calling register(), so getSessionIdByDatachannelUrl\n // above should normally resolve. This scan covers any residual gap\n // where connections are not yet populated (e.g. if setRefreshHandler\n // is called on a session that has no connection entry at all).\n // @ts-ignore\n const allMeetings = this.meetings?.getAllMeetings?.() || {};\n\n meeting = Object.values(allMeetings).find((activeMeeting: any) => {\n const info = activeMeeting?.locusInfo?.info || {};\n\n return (\n (info.practiceSessionDatachannelUrl &&\n LLMChannel.matchesDatachannelRequestUrl(\n requestUrl,\n info.practiceSessionDatachannelUrl\n )) ||\n (info.datachannelUrl &&\n LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl))\n );\n });\n\n if (!sessionId) {\n // @ts-ignore\n const info = meeting?.locusInfo?.info || {};\n\n if (\n info.practiceSessionDatachannelUrl &&\n LLMChannel.matchesDatachannelRequestUrl(\n requestUrl,\n info.practiceSessionDatachannelUrl\n )\n ) {\n sessionId = LLM_PRACTICE_SESSION;\n } else if (\n info.datachannelUrl &&\n LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl)\n ) {\n sessionId = LLM_DEFAULT_SESSION;\n }\n }\n }\n }\n\n let result;\n if (meeting) {\n result = await meeting.refreshDataChannelToken();\n } else {\n // @ts-ignore\n result = await this.internal.llm.refreshDataChannelToken(sessionId);\n }\n\n if (!result?.body) {\n throw new Error('DataChannel token refresh returned no payload');\n }\n const {datachannelToken, dataChannelTokenType} = result.body;\n const tokenStoreKey = dataChannelTokenType || sessionId;\n const ownerMeetingId =\n // @ts-ignore\n meeting?.id || this.internal.llm.getOwnerMeetingId?.(tokenStoreKey);\n // @ts-ignore\n this.internal.llm.setDatachannelToken(datachannelToken, tokenStoreKey, ownerMeetingId);\n\n return datachannelToken;\n },\n });\n }\n\n private getRetryKey(options) {\n if (!options[RETRY_KEY]) {\n options[RETRY_KEY] = `${Date.now()}-${Math.random()}`;\n }\n\n return options[RETRY_KEY];\n }\n\n // Helper function to get header value case insensitively\n private getHeader(headers: Record<string, string>, name: string) {\n const key = Object.keys(headers).find((k) => k.toLowerCase() === name.toLowerCase());\n\n return key ? headers[key] : undefined;\n }\n\n /**\n * Intercepts outgoing requests and refreshes the Data-Channel-Auth-Token\n * if the current JWT token is expired before the request is sent.\n *\n * @param {Object} options - The original request options.\n * @returns {Promise<Object>} Updated request options with refreshed token if needed.\n */\n async onRequest(options) {\n const token = this.getHeader(options.headers, DATA_CHANNEL_AUTH_HEADER);\n const enabled = await this._isDataChannelTokenEnabled();\n\n if (!token || !enabled) {\n return options;\n }\n\n if (isJwtTokenExpired(token)) {\n try {\n const newToken = await this._refreshDataChannelToken(options.uri || options.url);\n options.headers[DATA_CHANNEL_AUTH_HEADER] = newToken;\n } catch (e) {\n LoggerProxy.logger.warn(`DataChannelAuthTokenInterceptor: refresh failed: ${e.message}`);\n }\n }\n\n return options;\n }\n\n /**\n * Intercept responses and, on 401/403 with `Data-Channel-Auth-Token` header,\n * attempt to refresh the data channel token and retry the original request once.\n *\n * @param {Object} options\n * @param {Object} reason\n * @returns {Promise<HttpResponse>}\n */\n async onResponseError(options, reason) {\n const token = this.getHeader(options.headers, DATA_CHANNEL_AUTH_HEADER);\n const enabled = await this._isDataChannelTokenEnabled();\n\n if (!token || !enabled) {\n return Promise.reject(reason);\n }\n\n if (reason.statusCode !== 401 && reason.statusCode !== 403) {\n return Promise.reject(reason);\n }\n\n const key = this.getRetryKey(options);\n const retryCount = retryCountMap.get(key) || 0;\n\n if (retryCount >= MAX_RETRY) {\n LoggerProxy.logger.error(`data channel token refresh exceeded max retry (${MAX_RETRY})`);\n retryCountMap.delete(key);\n\n return Promise.reject(reason);\n }\n\n retryCountMap.set(key, retryCount + 1);\n\n return this.refreshTokenAndRetryWithDelay(options);\n }\n\n /**\n * Retry the failed data channel request after a delay.\n * Refreshes the Data-Channel-Auth-Token and re-sends the original request.\n *\n * @param {Object} options - Original request options.\n * @returns {Promise<HttpResponse>} - Resolves on successful retry.\n */\n refreshTokenAndRetryWithDelay(options) {\n return new Promise((resolve, reject) => {\n setTimeout(async () => {\n const key = this.getRetryKey(options);\n try {\n const newToken = await this._refreshDataChannelToken(options.uri || options.url);\n\n options.headers[DATA_CHANNEL_AUTH_HEADER] = newToken;\n\n // @ts-ignore\n const res = await this.webex.request(options);\n retryCountMap.delete(key);\n\n resolve(res);\n } catch (e) {\n retryCountMap.delete(key);\n\n const msg = e?.message || String(e);\n\n const err: HttpLikeError = new Error(`DataChannel token refresh failed: ${msg}`);\n err.statusCode = e?.statusCode;\n err.original = e;\n\n reject(err);\n }\n }, RETRY_INTERVAL);\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAAkF,SAAAO,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAA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A9B,MAAI,CAACG,QAAQ,CAACC,GAAG,CAACgD,mBAAmB,CAACxB,gBAAgB,EAAEE,aAAa,EAAEC,cAAc,CAAC;kBAAC,OAAAC,SAAA,CAAA7E,MAAA,WAEhFyE,gBAAgB;gBAAA;gBAAA;kBAAA,OAAAI,SAAA,CAAArE,IAAA;cAAA;YAAA,GAAA0C,QAAA;UAAA,CACxB;UAAA,SAnFDtF,uBAAuBA,CAAAsI,GAAA;YAAA,OAAAvI,wBAAA,CAAAd,KAAA,OAAA8D,SAAA;UAAA;UAAA,OAAvB/C,uBAAuB;QAAA;MAoFzB,CAAC,CAAC;IACJ;EAAC;AAAA,EAhH0DuI,qBAAW","ignoreList":[]}
@@ -5,6 +5,12 @@ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequ
5
5
  _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ _Object$defineProperty(exports, "DataChannelAuthTokenInterceptor", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _dataChannelAuthToken.default;
12
+ }
13
+ });
8
14
  _Object$defineProperty(exports, "LocusRetryStatusInterceptor", {
9
15
  enumerable: true,
10
16
  get: function get() {
@@ -19,4 +25,5 @@ _Object$defineProperty(exports, "LocusRouteTokenInterceptor", {
19
25
  });
20
26
  var _locusRetry = _interopRequireDefault(require("./locusRetry"));
21
27
  var _locusRouteToken = _interopRequireDefault(require("./locusRouteToken"));
28
+ var _dataChannelAuthToken = _interopRequireDefault(require("./dataChannelAuthToken"));
22
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_locusRetry","_interopRequireDefault","require","_locusRouteToken"],"sources":["index.ts"],"sourcesContent":["import LocusRetryStatusInterceptor from './locusRetry';\nimport LocusRouteTokenInterceptor from './locusRouteToken';\n\nexport {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_locusRetry","_interopRequireDefault","require","_locusRouteToken","_dataChannelAuthToken"],"sources":["index.ts"],"sourcesContent":["import LocusRetryStatusInterceptor from './locusRetry';\nimport LocusRouteTokenInterceptor from './locusRouteToken';\nimport DataChannelAuthTokenInterceptor from './dataChannelAuthToken';\n\nexport {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor, DataChannelAuthTokenInterceptor};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAH,sBAAA,CAAAC,OAAA","ignoreList":[]}
@@ -31,14 +31,12 @@ var LocusRetryStatusInterceptor = exports.default = /*#__PURE__*/function (_Inte
31
31
  (0, _inherits2.default)(LocusRetryStatusInterceptor, _Interceptor);
32
32
  return (0, _createClass2.default)(LocusRetryStatusInterceptor, [{
33
33
  key: "onResponseError",
34
- value:
35
- /**
36
- * Handle response errors
37
- * @param {Object} options
38
- * @param {WebexHttpError} reason
39
- * @returns {Promise<WebexHttpError>}
40
- */
41
- function onResponseError(options, reason) {
34
+ value: function onResponseError(options, reason) {
35
+ // Don't retry /hashtree or /sync calls for 429 or any 5xx — during a sync storm retries
36
+ // make things worse. The normal sync timers will handle recovery for these endpoints.
37
+ if ((reason.statusCode === 429 || reason.statusCode >= 500) && LocusRetryStatusInterceptor.isLocusHashtreeOrSync(options.uri)) {
38
+ return _promise.default.reject(reason);
39
+ }
42
40
  if ((reason.statusCode === 503 || reason.statusCode === 429) && options.uri.includes('locus')) {
43
41
  var hasRetriedLocusRequest = rateLimitExpiryTime.get(this);
44
42
  var retryAfterTime = options.headers['retry-after'] || 2000;
@@ -87,6 +85,23 @@ var LocusRetryStatusInterceptor = exports.default = /*#__PURE__*/function (_Inte
87
85
  webex: this
88
86
  });
89
87
  }
88
+
89
+ /**
90
+ * Check whether a URI is a Locus /hashtree or /sync endpoint.
91
+ * @param {string} uri
92
+ * @returns {boolean}
93
+ */
94
+ }, {
95
+ key: "isLocusHashtreeOrSync",
96
+ value: function isLocusHashtreeOrSync(uri) {
97
+ try {
98
+ var _URL = new URL(uri),
99
+ pathname = _URL.pathname;
100
+ return pathname.includes('/locus/') && (pathname.endsWith('/hashtree') || pathname.endsWith('/sync'));
101
+ } catch (_unused) {
102
+ return false;
103
+ }
104
+ }
90
105
  }]);
91
106
  }(_httpCore.Interceptor);
92
107
  //# sourceMappingURL=locusRetry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_httpCore","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","rateLimitExpiryTime","_weakMap","LocusRetryStatusInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onResponseError","options","reason","statusCode","uri","includes","hasRetriedLocusRequest","get","retryAfterTime","headers","set","_promise","reject","handleRetryRequestLocusServiceError","_this","resolve","timeout","setTimeout","clearTimeout","webex","request","method","body","then","catch","create","Interceptor"],"sources":["locusRetry.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\nconst rateLimitExpiryTime = new WeakMap();\n/**\n * @class\n */\nexport default class LocusRetryStatusInterceptor extends Interceptor {\n /**\n * @returns {LocusRetryStatusInterceptor}\n */\n static create() {\n // @ts-ignore\n return new LocusRetryStatusInterceptor({webex: this});\n }\n\n /**\n * Handle response errors\n * @param {Object} options\n * @param {WebexHttpError} reason\n * @returns {Promise<WebexHttpError>}\n */\n onResponseError(options, reason) {\n if ((reason.statusCode === 503 || reason.statusCode === 429) && options.uri.includes('locus')) {\n const hasRetriedLocusRequest = rateLimitExpiryTime.get(this);\n const retryAfterTime = options.headers['retry-after'] || 2000;\n\n if (hasRetriedLocusRequest) {\n rateLimitExpiryTime.set(this, false);\n\n return Promise.reject(options);\n }\n rateLimitExpiryTime.set(this, true);\n\n return this.handleRetryRequestLocusServiceError(options, retryAfterTime);\n }\n\n return Promise.reject(reason);\n }\n\n /**\n * Handle retries for locus service unavailable errors\n * @param {Object} options associated with the request\n * @param {number} retryAfterTime retry after time in milliseconds\n * @returns {Promise}\n */\n handleRetryRequestLocusServiceError(options, retryAfterTime) {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n clearTimeout(timeout);\n\n // @ts-ignore\n this.webex\n .request({\n method: options.method,\n uri: options.uri,\n body: options.body,\n })\n .then(resolve)\n .catch(reject);\n }, retryAfterTime);\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAA6C,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAN,kBAAA,CAAAG,OAAA,iCAAAV,CAAA,aAAAM,yBAAA,YAAAA,0BAAA,aAAAN,CAAA,UAJ7C;AACA;AACA;AAIA,IAAMc,mBAAmB,GAAG,IAAAC,QAAA,CAAAX,OAAA,CAAY,CAAC;AACzC;AACA;AACA;AAFA,IAGqBY,2BAA2B,GAAAC,OAAA,CAAAb,OAAA,0BAAAc,YAAA;EAAA,SAAAF,4BAAA;IAAA,IAAAG,gBAAA,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/BC,YAAY,CAACF,OAAO,CAAC;;UAErB;UACAF,KAAI,CAACK,KAAK,CACPC,OAAO,CAAC;YACPC,MAAM,EAAEpB,OAAO,CAACoB,MAAM;YACtBjB,GAAG,EAAEH,OAAO,CAACG,GAAG;YAChBkB,IAAI,EAAErB,OAAO,CAACqB;UAChB,CAAC,CAAC,CACDC,IAAI,CAACR,OAAO,CAAC,CACbS,KAAK,CAACZ,MAAM,CAAC;QAClB,CAAC,EAAEJ,cAAc,CAAC;MACpB,CAAC,CAAC;IACJ;EAAC;IAAAV,GAAA;IAAAC,KAAA;IAtDD;AACF;AACA;IACE,SAAO0B,MAAMA,CAAA,EAAG;MACd;MACA,OAAO,IAAIlC,2BAA2B,CAAC;QAAC4B,KAAK,EAAE;MAAI,CAAC,CAAC;IACvD;EAAC;AAAA,EAPsDO,qBAAW","ignoreList":[]}
1
+ {"version":3,"names":["_httpCore","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","rateLimitExpiryTime","_weakMap","LocusRetryStatusInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onResponseError","options","reason","statusCode","isLocusHashtreeOrSync","uri","_promise","reject","includes","hasRetriedLocusRequest","get","retryAfterTime","headers","set","handleRetryRequestLocusServiceError","_this","resolve","timeout","setTimeout","clearTimeout","webex","request","method","body","then","catch","create","_URL","URL","pathname","endsWith","_unused","Interceptor"],"sources":["locusRetry.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\nconst rateLimitExpiryTime = new WeakMap();\n/**\n * @class\n */\nexport default class LocusRetryStatusInterceptor extends Interceptor {\n /**\n * @returns {LocusRetryStatusInterceptor}\n */\n static create() {\n // @ts-ignore\n return new LocusRetryStatusInterceptor({webex: this});\n }\n\n /**\n * Check whether a URI is a Locus /hashtree or /sync endpoint.\n * @param {string} uri\n * @returns {boolean}\n */\n private static isLocusHashtreeOrSync(uri: string): boolean {\n try {\n const {pathname} = new URL(uri);\n\n return (\n pathname.includes('/locus/') &&\n (pathname.endsWith('/hashtree') || pathname.endsWith('/sync'))\n );\n } catch {\n return false;\n }\n }\n\n onResponseError(options, reason) {\n // Don't retry /hashtree or /sync calls for 429 or any 5xx — during a sync storm retries\n // make things worse. The normal sync timers will handle recovery for these endpoints.\n if (\n (reason.statusCode === 429 || reason.statusCode >= 500) &&\n LocusRetryStatusInterceptor.isLocusHashtreeOrSync(options.uri)\n ) {\n return Promise.reject(reason);\n }\n\n if ((reason.statusCode === 503 || reason.statusCode === 429) && options.uri.includes('locus')) {\n const hasRetriedLocusRequest = rateLimitExpiryTime.get(this);\n const retryAfterTime = options.headers['retry-after'] || 2000;\n\n if (hasRetriedLocusRequest) {\n rateLimitExpiryTime.set(this, false);\n\n return Promise.reject(options);\n }\n rateLimitExpiryTime.set(this, true);\n\n return this.handleRetryRequestLocusServiceError(options, retryAfterTime);\n }\n\n return Promise.reject(reason);\n }\n\n /**\n * Handle retries for locus service unavailable errors\n * @param {Object} options associated with the request\n * @param {number} retryAfterTime retry after time in milliseconds\n * @returns {Promise}\n */\n handleRetryRequestLocusServiceError(options, retryAfterTime) {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n clearTimeout(timeout);\n\n // @ts-ignore\n this.webex\n .request({\n method: options.method,\n uri: options.uri,\n body: options.body,\n })\n .then(resolve)\n .catch(reject);\n }, retryAfterTime);\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAA6C,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAA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GAAA;IAAAC,KAAA,EAKA,SAAeK,qBAAqBA,CAACC,GAAW,EAAW;MACzD,IAAI;QACF,IAAAsB,IAAA,GAAmB,IAAIC,GAAG,CAACvB,GAAG,CAAC;UAAxBwB,QAAQ,GAAAF,IAAA,CAARE,QAAQ;QAEf,OACEA,QAAQ,CAACrB,QAAQ,CAAC,SAAS,CAAC,KAC3BqB,QAAQ,CAACC,QAAQ,CAAC,WAAW,CAAC,IAAID,QAAQ,CAACC,QAAQ,CAAC,OAAO,CAAC,CAAC;MAElE,CAAC,CAAC,OAAAC,OAAA,EAAM;QACN,OAAO,KAAK;MACd;IACF;EAAC;AAAA,EAzBsDC,qBAAW","ignoreList":[]}
@@ -7,6 +7,7 @@ _Object$defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.default = void 0;
10
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
10
11
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
12
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
@@ -14,7 +15,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
14
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
15
16
  var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
16
17
  var _httpCore = require("@webex/http-core");
17
- var _lodash = require("lodash");
18
18
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
19
19
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*!
20
20
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
@@ -38,6 +38,22 @@ var LocusRouteTokenInterceptor = exports.default = /*#__PURE__*/function (_Inter
38
38
  var _url$match;
39
39
  return url === null || url === void 0 ? void 0 : (_url$match = url.match(LOCUS_ID_REGEX)) === null || _url$match === void 0 ? void 0 : _url$match[1];
40
40
  }
41
+ }, {
42
+ key: "getLocusIdByResponseBody",
43
+ value: function getLocusIdByResponseBody(body) {
44
+ var _body$locus, _body$locus$url, _body$locus$url$match;
45
+ return body === null || body === void 0 ? void 0 : (_body$locus = body.locus) === null || _body$locus === void 0 ? void 0 : (_body$locus$url = _body$locus.url) === null || _body$locus$url === void 0 ? void 0 : (_body$locus$url$match = _body$locus$url.match(LOCUS_ID_REGEX)) === null || _body$locus$url$match === void 0 ? void 0 : _body$locus$url$match[1];
46
+ }
47
+
48
+ // Helper function to get header value case insensitively
49
+ }, {
50
+ key: "getHeader",
51
+ value: function getHeader(headers, name) {
52
+ var key = (0, _keys.default)(headers).find(function (k) {
53
+ return k.toLowerCase() === name.toLowerCase();
54
+ });
55
+ return key ? headers[key] : undefined;
56
+ }
41
57
 
42
58
  /**
43
59
  * @param {Object} options
@@ -47,10 +63,12 @@ var LocusRouteTokenInterceptor = exports.default = /*#__PURE__*/function (_Inter
47
63
  }, {
48
64
  key: "onResponse",
49
65
  value: function onResponse(options, response) {
50
- var locusId = this.getLocusIdByRequestUrl(options.uri);
66
+ var locusId = this.getLocusIdByResponseBody(response.body) || this.getLocusIdByRequestUrl(options.uri);
51
67
  if (locusId) {
52
- var hasRouteToken = (0, _lodash.has)(response.headers, X_CISCO_PART_ROUTE_TOKEN);
53
- var token = response.headers[X_CISCO_PART_ROUTE_TOKEN];
68
+ var hasRouteToken = (0, _keys.default)(response.headers).some(function (key) {
69
+ return key.toLowerCase() === X_CISCO_PART_ROUTE_TOKEN.toLowerCase();
70
+ });
71
+ var token = this.getHeader(response.headers, X_CISCO_PART_ROUTE_TOKEN);
54
72
  if (hasRouteToken) {
55
73
  this.updateToken(locusId, token);
56
74
  }
@@ -84,7 +102,11 @@ var LocusRouteTokenInterceptor = exports.default = /*#__PURE__*/function (_Inter
84
102
  }, {
85
103
  key: "updateToken",
86
104
  value: function updateToken(locusId, token) {
87
- ROUTE_TOKEN[locusId] = token;
105
+ if (token === 'null' || token === null) {
106
+ delete ROUTE_TOKEN[locusId];
107
+ } else {
108
+ ROUTE_TOKEN[locusId] = token;
109
+ }
88
110
  }
89
111
 
90
112
  /**