daftari 3.13.1 → 3.15.0

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 (278) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/consolidate/index.d.ts.map +1 -1
  3. package/dist/consolidate/index.js +3 -12
  4. package/dist/consolidate/index.js.map +1 -1
  5. package/dist/distill/cli.d.ts.map +1 -1
  6. package/dist/distill/cli.js +2 -1
  7. package/dist/distill/cli.js.map +1 -1
  8. package/dist/distill/cost.d.ts +3 -3
  9. package/dist/distill/cost.d.ts.map +1 -1
  10. package/dist/distill/index.d.ts.map +1 -1
  11. package/dist/distill/index.js +3 -15
  12. package/dist/distill/index.js.map +1 -1
  13. package/dist/distill/propose.d.ts.map +1 -1
  14. package/dist/distill/propose.js +10 -3
  15. package/dist/distill/propose.js.map +1 -1
  16. package/dist/distill/state.d.ts +12 -0
  17. package/dist/distill/state.d.ts.map +1 -1
  18. package/dist/distill/state.js +16 -6
  19. package/dist/distill/state.js.map +1 -1
  20. package/dist/eval/index.d.ts.map +1 -1
  21. package/dist/eval/index.js +11 -16
  22. package/dist/eval/index.js.map +1 -1
  23. package/dist/eval/llm-openrouter.d.ts +4 -1
  24. package/dist/eval/llm-openrouter.d.ts.map +1 -1
  25. package/dist/eval/llm-openrouter.js +21 -5
  26. package/dist/eval/llm-openrouter.js.map +1 -1
  27. package/dist/eval/transport.d.ts +5 -0
  28. package/dist/eval/transport.d.ts.map +1 -0
  29. package/dist/eval/transport.js +27 -0
  30. package/dist/eval/transport.js.map +1 -0
  31. package/dist/extract/index.d.ts +16 -0
  32. package/dist/extract/index.d.ts.map +1 -0
  33. package/dist/extract/index.js +95 -0
  34. package/dist/extract/index.js.map +1 -0
  35. package/dist/extract/normalize.d.ts +7 -0
  36. package/dist/extract/normalize.d.ts.map +1 -0
  37. package/dist/extract/normalize.js +52 -0
  38. package/dist/extract/normalize.js.map +1 -0
  39. package/dist/extract/office.d.ts +63 -0
  40. package/dist/extract/office.d.ts.map +1 -0
  41. package/dist/extract/office.js +763 -0
  42. package/dist/extract/office.js.map +1 -0
  43. package/dist/extract/pdf.d.ts +16 -0
  44. package/dist/extract/pdf.d.ts.map +1 -0
  45. package/dist/extract/pdf.js +196 -0
  46. package/dist/extract/pdf.js.map +1 -0
  47. package/dist/extract/types.d.ts +55 -0
  48. package/dist/extract/types.d.ts.map +1 -0
  49. package/dist/extract/types.js +47 -0
  50. package/dist/extract/types.js.map +1 -0
  51. package/dist/extract/worker.d.ts +2 -0
  52. package/dist/extract/worker.d.ts.map +1 -0
  53. package/dist/extract/worker.js +57 -0
  54. package/dist/extract/worker.js.map +1 -0
  55. package/dist/integrations/engine.d.ts +174 -3
  56. package/dist/integrations/engine.d.ts.map +1 -1
  57. package/dist/integrations/engine.js +184 -16
  58. package/dist/integrations/engine.js.map +1 -1
  59. package/dist/integrations/google.d.ts +2 -1
  60. package/dist/integrations/google.d.ts.map +1 -1
  61. package/dist/integrations/google.js +12 -117
  62. package/dist/integrations/google.js.map +1 -1
  63. package/dist/integrations/http-json.d.ts +27 -0
  64. package/dist/integrations/http-json.d.ts.map +1 -0
  65. package/dist/integrations/http-json.js +148 -0
  66. package/dist/integrations/http-json.js.map +1 -0
  67. package/dist/integrations/microsoft.d.ts +22 -0
  68. package/dist/integrations/microsoft.d.ts.map +1 -0
  69. package/dist/integrations/microsoft.js +1780 -0
  70. package/dist/integrations/microsoft.js.map +1 -0
  71. package/dist/integrations/microsoft.ui.d.ts +18 -0
  72. package/dist/integrations/microsoft.ui.d.ts.map +1 -0
  73. package/dist/integrations/microsoft.ui.js +131 -0
  74. package/dist/integrations/microsoft.ui.js.map +1 -0
  75. package/dist/integrations/oauth.d.ts.map +1 -1
  76. package/dist/integrations/oauth.js +10 -2
  77. package/dist/integrations/oauth.js.map +1 -1
  78. package/dist/integrations/queue.d.ts +1 -1
  79. package/dist/integrations/queue.d.ts.map +1 -1
  80. package/dist/integrations/queue.js +23 -1
  81. package/dist/integrations/queue.js.map +1 -1
  82. package/dist/integrations/routes.d.ts +26 -0
  83. package/dist/integrations/routes.d.ts.map +1 -1
  84. package/dist/integrations/routes.js +502 -8
  85. package/dist/integrations/routes.js.map +1 -1
  86. package/dist/integrations/runtime.d.ts +14 -2
  87. package/dist/integrations/runtime.d.ts.map +1 -1
  88. package/dist/integrations/runtime.js +39 -7
  89. package/dist/integrations/runtime.js.map +1 -1
  90. package/dist/integrations/state.d.ts +1 -1
  91. package/dist/integrations/state.d.ts.map +1 -1
  92. package/dist/integrations/state.js +48 -8
  93. package/dist/integrations/state.js.map +1 -1
  94. package/dist/integrations/types.d.ts +54 -3
  95. package/dist/integrations/types.d.ts.map +1 -1
  96. package/dist/integrations/types.js +21 -1
  97. package/dist/integrations/types.js.map +1 -1
  98. package/dist/search/watcher.d.ts.map +1 -1
  99. package/dist/search/watcher.js +3 -22
  100. package/dist/search/watcher.js.map +1 -1
  101. package/dist/serve/index.d.ts.map +1 -1
  102. package/dist/serve/index.js +7 -0
  103. package/dist/serve/index.js.map +1 -1
  104. package/dist/sleep/index.d.ts.map +1 -1
  105. package/dist/sleep/index.js +6 -16
  106. package/dist/sleep/index.js.map +1 -1
  107. package/dist/sleep/report.js +1 -1
  108. package/dist/sleep/report.js.map +1 -1
  109. package/dist/sleep/tension-scan.d.ts.map +1 -1
  110. package/dist/sleep/tension-scan.js +0 -0
  111. package/dist/sleep/tension-scan.js.map +1 -1
  112. package/dist/storage/local.d.ts +1 -0
  113. package/dist/storage/local.d.ts.map +1 -1
  114. package/dist/storage/local.js +8 -1
  115. package/dist/storage/local.js.map +1 -1
  116. package/dist/utils/config.d.ts +8 -1
  117. package/dist/utils/config.d.ts.map +1 -1
  118. package/dist/utils/config.js +143 -19
  119. package/dist/utils/config.js.map +1 -1
  120. package/dist/view/pages.d.ts.map +1 -1
  121. package/dist/view/pages.js +11 -0
  122. package/dist/view/pages.js.map +1 -1
  123. package/dist/view/render.d.ts.map +1 -1
  124. package/dist/view/render.js +37 -2
  125. package/dist/view/render.js.map +1 -1
  126. package/package.json +8 -3
  127. package/src/integrations/microsoft/assets/VENDORING.md +109 -0
  128. package/src/integrations/microsoft/assets/glue.js +244 -0
  129. package/src/integrations/microsoft/assets/picker-serializer.js +99 -0
  130. package/src/integrations/microsoft/assets/vendor/msal-browser/app/IPublicClientApplication.mjs +91 -0
  131. package/src/integrations/microsoft/assets/vendor/msal-browser/app/PublicClientApplication.mjs +355 -0
  132. package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/NativeStatusCodes.mjs +15 -0
  133. package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/PlatformAuthDOMHandler.mjs +153 -0
  134. package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +271 -0
  135. package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/PlatformAuthProvider.mjs +95 -0
  136. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/AccountManager.mjs +49 -0
  137. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/AsyncMemoryStorage.mjs +144 -0
  138. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/BrowserCacheManager.mjs +1465 -0
  139. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/CacheHelpers.mjs +45 -0
  140. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/CacheKeys.mjs +32 -0
  141. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/CookieStorage.mjs +94 -0
  142. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/DatabaseStorage.mjs +208 -0
  143. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/EncryptedData.mjs +13 -0
  144. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/LocalStorage.mjs +319 -0
  145. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/MemoryStorage.mjs +48 -0
  146. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/SessionStorage.mjs +46 -0
  147. package/src/integrations/microsoft/assets/vendor/msal-browser/cache/TokenCache.mjs +220 -0
  148. package/src/integrations/microsoft/assets/vendor/msal-browser/config/Configuration.mjs +138 -0
  149. package/src/integrations/microsoft/assets/vendor/msal-browser/controllers/NestedAppAuthController.mjs +483 -0
  150. package/src/integrations/microsoft/assets/vendor/msal-browser/controllers/StandardController.mjs +1532 -0
  151. package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/BrowserCrypto.mjs +354 -0
  152. package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/CryptoOps.mjs +146 -0
  153. package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/PkceGenerator.mjs +63 -0
  154. package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/SignedHttpRequest.mjs +50 -0
  155. package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/TokenBindingKeyManager.mjs +156 -0
  156. package/src/integrations/microsoft/assets/vendor/msal-browser/encode/Base64Decode.mjs +43 -0
  157. package/src/integrations/microsoft/assets/vendor/msal-browser/encode/Base64Encode.mjs +47 -0
  158. package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserAuthError.mjs +26 -0
  159. package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserAuthErrorCodes.mjs +65 -0
  160. package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserConfigurationAuthError.mjs +24 -0
  161. package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserConfigurationAuthErrorCodes.mjs +11 -0
  162. package/src/integrations/microsoft/assets/vendor/msal-browser/error/NativeAuthError.mjs +79 -0
  163. package/src/integrations/microsoft/assets/vendor/msal-browser/error/NativeAuthErrorCodes.mjs +12 -0
  164. package/src/integrations/microsoft/assets/vendor/msal-browser/error/NestedAppAuthError.mjs +25 -0
  165. package/src/integrations/microsoft/assets/vendor/msal-browser/event/EventHandler.mjs +110 -0
  166. package/src/integrations/microsoft/assets/vendor/msal-browser/event/EventMessage.mjs +60 -0
  167. package/src/integrations/microsoft/assets/vendor/msal-browser/event/EventType.mjs +30 -0
  168. package/src/integrations/microsoft/assets/vendor/msal-browser/index.mjs +48 -0
  169. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/BaseInteractionClient.mjs +150 -0
  170. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/HybridSpaAuthorizationCodeClient.mjs +16 -0
  171. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/PlatformAuthInteractionClient.mjs +734 -0
  172. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/PopupClient.mjs +528 -0
  173. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/RedirectClient.mjs +464 -0
  174. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentAuthCodeClient.mjs +85 -0
  175. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentCacheClient.mjs +58 -0
  176. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentIframeClient.mjs +255 -0
  177. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentRefreshClient.mjs +77 -0
  178. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/StandardInteractionClient.mjs +217 -0
  179. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_handler/InteractionHandler.mjs +95 -0
  180. package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_handler/SilentHandler.mjs +71 -0
  181. package/src/integrations/microsoft/assets/vendor/msal-browser/naa/BridgeError.mjs +11 -0
  182. package/src/integrations/microsoft/assets/vendor/msal-browser/naa/BridgeProxy.mjs +152 -0
  183. package/src/integrations/microsoft/assets/vendor/msal-browser/naa/BridgeStatusCode.mjs +18 -0
  184. package/src/integrations/microsoft/assets/vendor/msal-browser/naa/mapping/NestedAppAuthAdapter.mjs +239 -0
  185. package/src/integrations/microsoft/assets/vendor/msal-browser/navigation/NavigationClient.mjs +47 -0
  186. package/src/integrations/microsoft/assets/vendor/msal-browser/network/FetchClient.mjs +153 -0
  187. package/src/integrations/microsoft/assets/vendor/msal-browser/operatingcontext/BaseOperatingContext.mjs +112 -0
  188. package/src/integrations/microsoft/assets/vendor/msal-browser/operatingcontext/NestedAppOperatingContext.mjs +79 -0
  189. package/src/integrations/microsoft/assets/vendor/msal-browser/operatingcontext/StandardOperatingContext.mjs +50 -0
  190. package/src/integrations/microsoft/assets/vendor/msal-browser/packageMetadata.mjs +7 -0
  191. package/src/integrations/microsoft/assets/vendor/msal-browser/popup_relay/constants.mjs +20 -0
  192. package/src/integrations/microsoft/assets/vendor/msal-browser/popup_relay/relayClient.mjs +113 -0
  193. package/src/integrations/microsoft/assets/vendor/msal-browser/protocol/Authorize.mjs +326 -0
  194. package/src/integrations/microsoft/assets/vendor/msal-browser/request/RequestHelpers.mjs +143 -0
  195. package/src/integrations/microsoft/assets/vendor/msal-browser/response/ResponseHandler.mjs +45 -0
  196. package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserPerformanceClient.mjs +126 -0
  197. package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserPerformanceEvents.mjs +133 -0
  198. package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserPerformanceMeasurement.mjs +96 -0
  199. package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserRootPerformanceEvents.mjs +53 -0
  200. package/src/integrations/microsoft/assets/vendor/msal-browser/utils/BrowserConstants.mjs +220 -0
  201. package/src/integrations/microsoft/assets/vendor/msal-browser/utils/BrowserProtocolUtils.mjs +27 -0
  202. package/src/integrations/microsoft/assets/vendor/msal-browser/utils/BrowserUtils.mjs +364 -0
  203. package/src/integrations/microsoft/assets/vendor/msal-browser/utils/Helpers.mjs +19 -0
  204. package/src/integrations/microsoft/assets/vendor/msal-browser/utils/MsalFrameStatsUtils.mjs +38 -0
  205. package/src/integrations/microsoft/assets/vendor/msal-browser/webBrokerBridge/PendingRequestRegistry.mjs +63 -0
  206. package/src/integrations/microsoft/assets/vendor/msal-browser/webBrokerBridge/WebBrokerBridgeError.mjs +38 -0
  207. package/src/integrations/microsoft/assets/vendor/msal-browser/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +57 -0
  208. package/src/integrations/microsoft/assets/vendor/msal-common/account/AccountInfo.mjs +91 -0
  209. package/src/integrations/microsoft/assets/vendor/msal-common/account/AuthToken.mjs +70 -0
  210. package/src/integrations/microsoft/assets/vendor/msal-common/account/CcsCredential.mjs +12 -0
  211. package/src/integrations/microsoft/assets/vendor/msal-common/account/ClientInfo.mjs +43 -0
  212. package/src/integrations/microsoft/assets/vendor/msal-common/account/TokenClaims.mjs +24 -0
  213. package/src/integrations/microsoft/assets/vendor/msal-common/authority/Authority.mjs +988 -0
  214. package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityFactory.mjs +41 -0
  215. package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityMetadata.mjs +158 -0
  216. package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityOptions.mjs +20 -0
  217. package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityType.mjs +16 -0
  218. package/src/integrations/microsoft/assets/vendor/msal-common/authority/CloudInstanceDiscoveryErrorResponse.mjs +12 -0
  219. package/src/integrations/microsoft/assets/vendor/msal-common/authority/CloudInstanceDiscoveryResponse.mjs +12 -0
  220. package/src/integrations/microsoft/assets/vendor/msal-common/authority/OpenIdConfigResponse.mjs +14 -0
  221. package/src/integrations/microsoft/assets/vendor/msal-common/authority/ProtocolMode.mjs +26 -0
  222. package/src/integrations/microsoft/assets/vendor/msal-common/authority/RegionDiscovery.mjs +116 -0
  223. package/src/integrations/microsoft/assets/vendor/msal-common/cache/CacheManager.mjs +1202 -0
  224. package/src/integrations/microsoft/assets/vendor/msal-common/cache/persistence/TokenCacheContext.mjs +29 -0
  225. package/src/integrations/microsoft/assets/vendor/msal-common/cache/utils/AccountEntityUtils.mjs +222 -0
  226. package/src/integrations/microsoft/assets/vendor/msal-common/cache/utils/CacheHelpers.mjs +294 -0
  227. package/src/integrations/microsoft/assets/vendor/msal-common/client/AuthorizationCodeClient.mjs +289 -0
  228. package/src/integrations/microsoft/assets/vendor/msal-common/client/RefreshTokenClient.mjs +262 -0
  229. package/src/integrations/microsoft/assets/vendor/msal-common/client/SilentFlowClient.mjs +142 -0
  230. package/src/integrations/microsoft/assets/vendor/msal-common/config/ClientConfiguration.mjs +111 -0
  231. package/src/integrations/microsoft/assets/vendor/msal-common/constants/AADServerParamKeys.mjs +74 -0
  232. package/src/integrations/microsoft/assets/vendor/msal-common/crypto/DpopProofGenerator.mjs +152 -0
  233. package/src/integrations/microsoft/assets/vendor/msal-common/crypto/ICrypto.mjs +52 -0
  234. package/src/integrations/microsoft/assets/vendor/msal-common/crypto/ITokenBindingKeyManager.mjs +27 -0
  235. package/src/integrations/microsoft/assets/vendor/msal-common/crypto/JoseHeader.mjs +72 -0
  236. package/src/integrations/microsoft/assets/vendor/msal-common/crypto/PopTokenGenerator.mjs +109 -0
  237. package/src/integrations/microsoft/assets/vendor/msal-common/error/AuthError.mjs +31 -0
  238. package/src/integrations/microsoft/assets/vendor/msal-common/error/AuthErrorCodes.mjs +13 -0
  239. package/src/integrations/microsoft/assets/vendor/msal-common/error/CacheError.mjs +44 -0
  240. package/src/integrations/microsoft/assets/vendor/msal-common/error/CacheErrorCodes.mjs +10 -0
  241. package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientAuthError.mjs +26 -0
  242. package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientAuthErrorCodes.mjs +46 -0
  243. package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientConfigurationError.mjs +23 -0
  244. package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientConfigurationErrorCodes.mjs +38 -0
  245. package/src/integrations/microsoft/assets/vendor/msal-common/error/InteractionRequiredAuthError.mjs +73 -0
  246. package/src/integrations/microsoft/assets/vendor/msal-common/error/InteractionRequiredAuthErrorCodes.mjs +53 -0
  247. package/src/integrations/microsoft/assets/vendor/msal-common/error/JoseHeaderError.mjs +24 -0
  248. package/src/integrations/microsoft/assets/vendor/msal-common/error/JoseHeaderErrorCodes.mjs +12 -0
  249. package/src/integrations/microsoft/assets/vendor/msal-common/error/NetworkError.mjs +34 -0
  250. package/src/integrations/microsoft/assets/vendor/msal-common/error/PlatformBrokerError.mjs +48 -0
  251. package/src/integrations/microsoft/assets/vendor/msal-common/error/ServerError.mjs +22 -0
  252. package/src/integrations/microsoft/assets/vendor/msal-common/index-browser.mjs +79 -0
  253. package/src/integrations/microsoft/assets/vendor/msal-common/logger/Logger.mjs +291 -0
  254. package/src/integrations/microsoft/assets/vendor/msal-common/network/INetworkModule.mjs +20 -0
  255. package/src/integrations/microsoft/assets/vendor/msal-common/network/RequestThumbprint.mjs +27 -0
  256. package/src/integrations/microsoft/assets/vendor/msal-common/network/ThrottlingUtils.mjs +91 -0
  257. package/src/integrations/microsoft/assets/vendor/msal-common/packageMetadata.mjs +7 -0
  258. package/src/integrations/microsoft/assets/vendor/msal-common/protocol/Authorize.mjs +239 -0
  259. package/src/integrations/microsoft/assets/vendor/msal-common/protocol/Token.mjs +148 -0
  260. package/src/integrations/microsoft/assets/vendor/msal-common/request/AuthenticationHeaderParser.mjs +63 -0
  261. package/src/integrations/microsoft/assets/vendor/msal-common/request/BaseAuthRequest.mjs +37 -0
  262. package/src/integrations/microsoft/assets/vendor/msal-common/request/RequestParameterBuilder.mjs +529 -0
  263. package/src/integrations/microsoft/assets/vendor/msal-common/request/ScopeSet.mjs +204 -0
  264. package/src/integrations/microsoft/assets/vendor/msal-common/response/ResponseHandler.mjs +432 -0
  265. package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/PerformanceClient.mjs +557 -0
  266. package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/PerformanceEvent.mjs +68 -0
  267. package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/PerformanceEvents.mjs +73 -0
  268. package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/StubPerformanceClient.mjs +61 -0
  269. package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/server/ServerTelemetryManager.mjs +297 -0
  270. package/src/integrations/microsoft/assets/vendor/msal-common/url/UrlString.mjs +164 -0
  271. package/src/integrations/microsoft/assets/vendor/msal-common/utils/ClientAssertionUtils.mjs +21 -0
  272. package/src/integrations/microsoft/assets/vendor/msal-common/utils/Constants.mjs +304 -0
  273. package/src/integrations/microsoft/assets/vendor/msal-common/utils/FunctionWrappers.mjs +95 -0
  274. package/src/integrations/microsoft/assets/vendor/msal-common/utils/ObjectUtils.mjs +27 -0
  275. package/src/integrations/microsoft/assets/vendor/msal-common/utils/ProtocolUtils.mjs +76 -0
  276. package/src/integrations/microsoft/assets/vendor/msal-common/utils/StringUtils.mjs +82 -0
  277. package/src/integrations/microsoft/assets/vendor/msal-common/utils/TimeUtils.mjs +75 -0
  278. package/src/integrations/microsoft/assets/vendor/msal-common/utils/UrlUtils.mjs +128 -0
@@ -0,0 +1,364 @@
1
+ /*! @azure/msal-browser v5.20.0 2026-08-28 */
2
+ 'use strict';
3
+ import { RequestParameterBuilder, UrlUtils, UrlString, ProtocolUtils } from '../../msal-common/index-browser.mjs';
4
+ export { invoke, invokeAsync } from '../../msal-common/index-browser.mjs';
5
+ import { WaitForBridgeLateResponse } from '../telemetry/BrowserPerformanceEvents.mjs';
6
+ import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
7
+ import { base64Decode } from '../encode/Base64Decode.mjs';
8
+ import { InteractionType, BrowserCacheLocation } from './BrowserConstants.mjs';
9
+ import { createNewGuid } from '../crypto/BrowserCrypto.mjs';
10
+ import { createBrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.mjs';
11
+ import { timedOut, emptyResponse, noStateInHash, unableToParseState, interactionInProgressCancelled, redirectBridgeEmptyResponse, blockIframeReload, redirectInIframe, blockNestedPopups, nonBrowserEnvironment, uninitializedPublicClientApplication } from '../error/BrowserAuthErrorCodes.mjs';
12
+ import { inMemRedirectUnavailable } from '../error/BrowserConfigurationAuthErrorCodes.mjs';
13
+
14
+ /*
15
+ * Copyright (c) Microsoft Corporation. All rights reserved.
16
+ * Licensed under the MIT License.
17
+ */
18
+ /**
19
+ * Extracts and parses the authentication response from URL (hash and/or query string).
20
+ * This is a shared utility used across multiple components in msal-browser.
21
+ *
22
+ * @returns {Object} An object containing the parsed state information and URL parameters.
23
+ * @returns {URLSearchParams} params - The parsed URL parameters from the payload.
24
+ * @returns {string} payload - The combined query string and hash content.
25
+ * @returns {string} urlHash - The original URL hash.
26
+ * @returns {string} urlQuery - The original URL query string.
27
+ * @returns {LibraryStateObject} libraryState - The decoded library state from the state parameter.
28
+ *
29
+ * @throws {AuthError} If no authentication payload is found in the URL.
30
+ * @throws {AuthError} If the state parameter is missing.
31
+ * @throws {AuthError} If the state is missing required 'id' or 'meta' attributes.
32
+ */
33
+ function parseAuthResponseFromUrl() {
34
+ // Extract both hash and query string to support hybrid response format
35
+ const urlHash = window.location.hash;
36
+ const urlQuery = window.location.search;
37
+ // Determine which part contains the auth response by checking for 'state' parameter
38
+ let hasResponseInHash = false;
39
+ let hasResponseInQuery = false;
40
+ let payload = "";
41
+ let params = undefined;
42
+ if (urlHash && urlHash.length > 1) {
43
+ const hashContent = urlHash.charAt(0) === "#" ? urlHash.substring(1) : urlHash;
44
+ const hashParams = new URLSearchParams(hashContent);
45
+ if (hashParams.has("state")) {
46
+ hasResponseInHash = true;
47
+ payload = hashContent;
48
+ params = hashParams;
49
+ }
50
+ }
51
+ if (urlQuery && urlQuery.length > 1) {
52
+ const queryContent = urlQuery.charAt(0) === "?" ? urlQuery.substring(1) : urlQuery;
53
+ const queryParams = new URLSearchParams(queryContent);
54
+ if (queryParams.has("state")) {
55
+ hasResponseInQuery = true;
56
+ payload = queryContent;
57
+ params = queryParams;
58
+ }
59
+ }
60
+ // If response is in both, combine them (hybrid format)
61
+ if (hasResponseInHash && hasResponseInQuery) {
62
+ const queryContent = urlQuery.charAt(0) === "?" ? urlQuery.substring(1) : urlQuery;
63
+ const hashContent = urlHash.charAt(0) === "#" ? urlHash.substring(1) : urlHash;
64
+ payload = `${queryContent}${hashContent}`;
65
+ params = new URLSearchParams(payload);
66
+ }
67
+ /*
68
+ * Called by the redirect-bridge entry point before any request context exists,
69
+ * so correlationId is intentionally empty for the throws below.
70
+ */
71
+ if (!payload || !params) {
72
+ throw createBrowserAuthError(emptyResponse, "");
73
+ }
74
+ const state = params.get("state");
75
+ if (!state) {
76
+ throw createBrowserAuthError(noStateInHash, "");
77
+ }
78
+ const { libraryState } = ProtocolUtils.parseRequestState(base64Decode, state, "");
79
+ const { id, meta } = libraryState;
80
+ if (!id || !meta) {
81
+ throw createBrowserAuthError(unableToParseState, "", "missing_library_state");
82
+ }
83
+ return {
84
+ params,
85
+ payload,
86
+ urlHash,
87
+ urlQuery,
88
+ hasResponseInHash,
89
+ hasResponseInQuery,
90
+ libraryState: {
91
+ id,
92
+ meta,
93
+ },
94
+ };
95
+ }
96
+ /**
97
+ * Clears hash from window url.
98
+ */
99
+ function clearHash(contentWindow) {
100
+ // Office.js sets history.replaceState to null
101
+ contentWindow.location.hash = "";
102
+ if (typeof contentWindow.history.replaceState === "function") {
103
+ // Full removes "#" from url
104
+ contentWindow.history.replaceState(null, "", `${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`);
105
+ }
106
+ }
107
+ /**
108
+ * Strips both hash and query string from the given window's URL by replacing
109
+ * with origin + pathname only. Used to remove auth response parameters
110
+ * (auth code, state, etc.) before the window is closed or navigated away.
111
+ */
112
+ function clearAuthResponseFromUrl(contentWindow) {
113
+ if (typeof contentWindow.history?.replaceState === "function") {
114
+ contentWindow.history.replaceState(null, "", `${contentWindow.location.origin}${contentWindow.location.pathname}`);
115
+ }
116
+ }
117
+ /**
118
+ * Replaces current hash with hash from provided url
119
+ */
120
+ function replaceHash(url) {
121
+ const urlParts = url.split("#");
122
+ urlParts.shift(); // Remove part before the hash
123
+ window.location.hash = urlParts.length > 0 ? urlParts.join("#") : "";
124
+ }
125
+ /**
126
+ * Returns boolean of whether the current window is in an iframe or not.
127
+ */
128
+ function isInIframe() {
129
+ return window.parent !== window;
130
+ }
131
+ /**
132
+ * Returns boolean of whether or not the current window is a popup opened by msal
133
+ */
134
+ function isInPopup() {
135
+ if (isInIframe()) {
136
+ return false;
137
+ }
138
+ try {
139
+ const { libraryState } = parseAuthResponseFromUrl();
140
+ const { meta } = libraryState;
141
+ return meta["interactionType"] === InteractionType.Popup;
142
+ }
143
+ catch (e) {
144
+ // If parsing fails (no state, invalid URL, etc.), we're not in a popup
145
+ return false;
146
+ }
147
+ }
148
+ /**
149
+ * Await a response from a redirect bridge using BroadcastChannel.
150
+ * This unified function works for both popup and iframe scenarios by listening on a
151
+ * BroadcastChannel for the server payload.
152
+ *
153
+ * @param timeoutMs - Timeout in milliseconds.
154
+ * @param logger - Logger instance for logging monitoring events.
155
+ * @param browserCrypto - Browser crypto instance for decoding state.
156
+ * @param request - The authorization or end session request.
157
+ * @returns Promise<string> - Resolves with the response string (query or hash) from the window.
158
+ */
159
+ // Track the active bridge monitor to allow cancellation when overriding interactions
160
+ let activeBridgeMonitor = null;
161
+ /**
162
+ * Cancels the pending bridge response monitor if one exists.
163
+ * This is called when overrideInteractionInProgress is used to cancel
164
+ * any pending popup interaction before starting a new one.
165
+ */
166
+ function cancelPendingBridgeResponse(logger, correlationId) {
167
+ if (activeBridgeMonitor) {
168
+ logger.verbose("18y01k", correlationId);
169
+ clearTimeout(activeBridgeMonitor.timeoutId);
170
+ activeBridgeMonitor.channel.close();
171
+ activeBridgeMonitor.reject(createBrowserAuthError(interactionInProgressCancelled, ""));
172
+ activeBridgeMonitor = null;
173
+ }
174
+ }
175
+ /** @internal */
176
+ async function waitForBridgeResponse(timeoutMs, logger, request, performanceClient, experimentalConfig) {
177
+ return new Promise((resolve, reject) => {
178
+ logger.verbose("1rf6em", request.correlationId);
179
+ const correlationId = request.correlationId;
180
+ performanceClient.addFields({
181
+ redirectBridgeTimeoutMs: timeoutMs,
182
+ lateResponseExperimentEnabled: experimentalConfig?.iframeTimeoutTelemetry || false,
183
+ }, correlationId);
184
+ const { libraryState } = ProtocolUtils.parseRequestState(base64Decode, request.state || "", request.correlationId);
185
+ const channel = new BroadcastChannel(libraryState.id);
186
+ let responseString = undefined;
187
+ let timedOut$1 = false;
188
+ let lateTimeoutId;
189
+ let lateMeasurement;
190
+ const timeoutId = window.setTimeout(() => {
191
+ // Clear the active monitor
192
+ activeBridgeMonitor = null;
193
+ if (experimentalConfig?.iframeTimeoutTelemetry) {
194
+ lateMeasurement = performanceClient.startMeasurement(WaitForBridgeLateResponse, correlationId);
195
+ timedOut$1 = true;
196
+ lateTimeoutId = window.setTimeout(() => {
197
+ lateMeasurement?.end({ success: false });
198
+ clearTimeout(lateTimeoutId);
199
+ channel.close();
200
+ }, 60000); // 60s late response timeout to allow for telemetry of late responses
201
+ }
202
+ else {
203
+ channel.close();
204
+ }
205
+ reject(createBrowserAuthError(timedOut, "", "redirect_bridge_timeout"));
206
+ }, timeoutMs);
207
+ // Track this monitor so it can be cancelled if needed
208
+ activeBridgeMonitor = {
209
+ timeoutId,
210
+ channel,
211
+ reject,
212
+ };
213
+ channel.onmessage = (event) => {
214
+ responseString = event.data.payload;
215
+ const messageVersion = event?.data && typeof event.data.v === "number"
216
+ ? event.data.v
217
+ : undefined;
218
+ if (timedOut$1) {
219
+ lateMeasurement?.end({
220
+ success: responseString ? true : false,
221
+ });
222
+ clearTimeout(lateTimeoutId);
223
+ channel.close();
224
+ return;
225
+ }
226
+ performanceClient.addFields({
227
+ redirectBridgeMessageVersion: messageVersion,
228
+ }, correlationId);
229
+ // Clear the active monitor
230
+ activeBridgeMonitor = null;
231
+ clearTimeout(timeoutId);
232
+ channel.close();
233
+ if (responseString) {
234
+ resolve(responseString);
235
+ }
236
+ else {
237
+ reject(createBrowserAuthError(redirectBridgeEmptyResponse, correlationId));
238
+ }
239
+ };
240
+ });
241
+ }
242
+ // #endregion
243
+ /**
244
+ * Returns current window URL as redirect uri
245
+ */
246
+ function getCurrentUri() {
247
+ return typeof window !== "undefined" && window.location
248
+ ? window.location.href.split("?")[0].split("#")[0]
249
+ : "";
250
+ }
251
+ /**
252
+ * Gets the homepage url for the current window location.
253
+ */
254
+ function getHomepage(correlationId) {
255
+ const currentUrl = new UrlString(window.location.href, correlationId || "");
256
+ const urlComponents = currentUrl.getUrlComponents();
257
+ return `${urlComponents.Protocol}//${urlComponents.HostNameAndPort}/`;
258
+ }
259
+ /**
260
+ * Throws error if we have completed an auth and are
261
+ * attempting another auth request inside an iframe.
262
+ */
263
+ function blockReloadInHiddenIframes() {
264
+ const isResponseHash = UrlUtils.getDeserializedResponse(window.location.hash);
265
+ // return an error if called from the hidden iframe created by the msal js silent calls
266
+ if (isResponseHash && isInIframe()) {
267
+ throw createBrowserAuthError(blockIframeReload, "");
268
+ }
269
+ }
270
+ /**
271
+ * Block redirect operations in iframes unless explicitly allowed
272
+ * @param interactionType Interaction type for the request
273
+ * @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
274
+ */
275
+ function blockRedirectInIframe(allowRedirectInIframe) {
276
+ if (isInIframe() && !allowRedirectInIframe) {
277
+ // If we are not in top frame, we shouldn't redirect. This is also handled by the service.
278
+ throw createBrowserAuthError(redirectInIframe, "");
279
+ }
280
+ }
281
+ /**
282
+ * Block redirectUri loaded in popup from calling AcquireToken APIs
283
+ */
284
+ function blockAcquireTokenInPopups() {
285
+ // Popups opened by msal popup APIs are given a name that starts with "msal."
286
+ if (isInPopup()) {
287
+ throw createBrowserAuthError(blockNestedPopups, "");
288
+ }
289
+ }
290
+ /**
291
+ * Throws error if token requests are made in non-browser environment
292
+ * @param isBrowserEnvironment Flag indicating if environment is a browser.
293
+ */
294
+ function blockNonBrowserEnvironment() {
295
+ if (typeof window === "undefined") {
296
+ throw createBrowserAuthError(nonBrowserEnvironment, "");
297
+ }
298
+ }
299
+ /**
300
+ * Throws error if initialize hasn't been called
301
+ * @param initialized
302
+ */
303
+ function blockAPICallsBeforeInitialize(initialized) {
304
+ if (!initialized) {
305
+ throw createBrowserAuthError(uninitializedPublicClientApplication, "");
306
+ }
307
+ }
308
+ /**
309
+ * Helper to validate app environment before making an auth request
310
+ * @param initialized
311
+ */
312
+ function preflightCheck(initialized) {
313
+ // Block request if not in browser environment
314
+ blockNonBrowserEnvironment();
315
+ // Block auth requests inside a hidden iframe
316
+ blockReloadInHiddenIframes();
317
+ // Block redirectUri opened in a popup from calling MSAL APIs
318
+ blockAcquireTokenInPopups();
319
+ // Block token acquisition before initialize has been called
320
+ blockAPICallsBeforeInitialize(initialized);
321
+ }
322
+ /**
323
+ * Helper to validate app environment before making redirect request
324
+ * @param initialized
325
+ * @param config
326
+ * @internal
327
+ */
328
+ function redirectPreflightCheck(initialized, config) {
329
+ preflightCheck(initialized);
330
+ blockRedirectInIframe(config.system.allowRedirectInIframe);
331
+ // Block redirects if memory storage is enabled
332
+ if (config.cache.cacheLocation === BrowserCacheLocation.MemoryStorage) {
333
+ throw createBrowserConfigurationAuthError(inMemRedirectUnavailable, "");
334
+ }
335
+ }
336
+ /**
337
+ * Adds a preconnect link element to the header which begins DNS resolution and SSL connection in anticipation of the /token request
338
+ * @param loginDomain Authority domain, including https protocol e.g. https://login.microsoftonline.com
339
+ * @returns
340
+ */
341
+ function preconnect(authority) {
342
+ const link = document.createElement("link");
343
+ link.rel = "preconnect";
344
+ link.href = new URL(authority).origin;
345
+ link.crossOrigin = "anonymous";
346
+ document.head.appendChild(link);
347
+ // The browser will close connection if not used within a few seconds, remove element from the header after 10s
348
+ window.setTimeout(() => {
349
+ try {
350
+ document.head.removeChild(link);
351
+ }
352
+ catch { }
353
+ }, 10000); // 10s Timeout
354
+ }
355
+ /**
356
+ * Wrapper function that creates a UUID v7 from the current timestamp.
357
+ * @returns {string}
358
+ */
359
+ function createGuid() {
360
+ return createNewGuid();
361
+ }
362
+ const buildMergedClaims = RequestParameterBuilder.buildMergedClaims;
363
+
364
+ export { blockAPICallsBeforeInitialize, blockAcquireTokenInPopups, blockNonBrowserEnvironment, blockRedirectInIframe, blockReloadInHiddenIframes, buildMergedClaims, cancelPendingBridgeResponse, clearAuthResponseFromUrl, clearHash, createGuid, getCurrentUri, getHomepage, isInIframe, isInPopup, parseAuthResponseFromUrl, preconnect, preflightCheck, redirectPreflightCheck, replaceHash, waitForBridgeResponse };
@@ -0,0 +1,19 @@
1
+ /*! @azure/msal-browser v5.20.0 2026-08-28 */
2
+ 'use strict';
3
+ /*
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Licensed under the MIT License.
6
+ */
7
+ /**
8
+ * Utility function to remove an element from an array in place.
9
+ * @param array - The array from which to remove the element.
10
+ * @param element - The element to remove from the array.
11
+ */
12
+ function removeElementFromArray(array, element) {
13
+ const index = array.indexOf(element);
14
+ if (index > -1) {
15
+ array.splice(index, 1);
16
+ }
17
+ }
18
+
19
+ export { removeElementFromArray };
@@ -0,0 +1,38 @@
1
+ /*! @azure/msal-browser v5.20.0 2026-08-28 */
2
+ 'use strict';
3
+ /*
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Licensed under the MIT License.
6
+ */
7
+ /**
8
+ * Get network information for telemetry purposes. This is only supported in Chromium-based browsers.
9
+ * @returns Network connection information, or an empty object if not available.
10
+ */
11
+ function getNetworkInfo() {
12
+ if (typeof window === "undefined" || !window.navigator) {
13
+ return {};
14
+ }
15
+ const connection = "connection" in window.navigator
16
+ ? window.navigator.connection
17
+ : undefined;
18
+ return {
19
+ effectiveType: connection?.effectiveType,
20
+ rtt: connection?.rtt,
21
+ };
22
+ }
23
+ function collectInstanceStats(currentClientId, performanceEvent, logger, correlationId) {
24
+ const frameInstances =
25
+ // @ts-ignore
26
+ window.msal?.clientIds || [];
27
+ const msalInstanceCount = frameInstances.length;
28
+ const sameClientIdInstanceCount = frameInstances.filter((i) => i === currentClientId).length;
29
+ if (sameClientIdInstanceCount > 1) {
30
+ logger.warning("1e88vg", correlationId);
31
+ }
32
+ performanceEvent.add({
33
+ msalInstanceCount: msalInstanceCount,
34
+ sameClientIdInstanceCount: sameClientIdInstanceCount,
35
+ });
36
+ }
37
+
38
+ export { collectInstanceStats, getNetworkInfo };
@@ -0,0 +1,63 @@
1
+ /*! @azure/msal-browser v5.20.0 2026-08-28 */
2
+ 'use strict';
3
+ /*
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Licensed under the MIT License.
6
+ */
7
+ /**
8
+ * Correlates outbound requests with inbound responses by `requestId`.
9
+ */
10
+ class PendingRequestRegistry {
11
+ constructor() {
12
+ this.pending = new Map();
13
+ }
14
+ /**
15
+ * Register a pending request. Returns a promise that resolves when a
16
+ * response with the matching `requestId` arrives, or rejects if the
17
+ * caller invokes `reject` for that id.
18
+ */
19
+ register(requestId) {
20
+ return new Promise((resolve, reject) => {
21
+ this.pending.set(requestId, { resolve, reject });
22
+ });
23
+ }
24
+ /** Resolve a pending request. No-op if `requestId` isn't registered. */
25
+ resolve(requestId, response) {
26
+ const entry = this.pending.get(requestId);
27
+ if (entry === undefined) {
28
+ return;
29
+ }
30
+ this.pending.delete(requestId);
31
+ entry.resolve(response);
32
+ }
33
+ /** Reject a pending request. No-op if `requestId` isn't registered. */
34
+ reject(requestId, reason) {
35
+ const entry = this.pending.get(requestId);
36
+ if (entry === undefined) {
37
+ return;
38
+ }
39
+ this.pending.delete(requestId);
40
+ entry.reject(reason);
41
+ }
42
+ /** True if `requestId` has an in-flight registration. */
43
+ has(requestId) {
44
+ return this.pending.has(requestId);
45
+ }
46
+ /**
47
+ * Register, then invoke `send` synchronously. If `send` throws, the
48
+ * pending entry is cleared and the promise rejects with the thrown
49
+ * error.
50
+ */
51
+ async sendAndAwait(message, send) {
52
+ const promise = this.register(message.requestId);
53
+ try {
54
+ send(message);
55
+ }
56
+ catch (err) {
57
+ this.reject(message.requestId, err);
58
+ }
59
+ return promise;
60
+ }
61
+ }
62
+
63
+ export { PendingRequestRegistry };
@@ -0,0 +1,38 @@
1
+ /*! @azure/msal-browser v5.20.0 2026-08-28 */
2
+ 'use strict';
3
+ /*
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Licensed under the MIT License.
6
+ */
7
+ /**
8
+ * Unified error taxonomy shared by NAA and PWB.
9
+ *
10
+ * Each code maps to exactly one of the four base MSAL error classes
11
+ * (`AuthError`, `ClientAuthError`, `ServerError`,
12
+ * `InteractionRequiredAuthError`) via `toAuthError` in
13
+ * `./WebBrokerBridgeErrorMap`.
14
+ */
15
+ const WebBrokerBridgeErrorCode = {
16
+ /* Interaction / auth outcomes */
17
+ UserInteractionRequired: "user_interaction_required",
18
+ UserCanceled: "user_canceled",
19
+ /* Environment / connectivity */
20
+ NoNetwork: "no_network",
21
+ AccountUnavailable: "account_unavailable",
22
+ BridgeDisabled: "bridge_disabled",
23
+ BridgeUnavailable: "bridge_unavailable",
24
+ /* Server-side outcomes */
25
+ TransientError: "transient_error",
26
+ PersistentError: "persistent_error",
27
+ /* Broker-channel failures */
28
+ BridgeTimeout: "bridge_timeout",
29
+ BridgeHandshakeFailed: "bridge_handshake_failed",
30
+ BridgeConnectionReset: "bridge_connection_reset",
31
+ BridgeResponseInvalid: "bridge_response_invalid",
32
+ PopupWillRedirect: "popup_will_redirect",
33
+ ShrGenerationError: "shr_generation_error",
34
+ /* Fallback */
35
+ Unknown: "unknown",
36
+ };
37
+
38
+ export { WebBrokerBridgeErrorCode };
@@ -0,0 +1,57 @@
1
+ /*! @azure/msal-browser v5.20.0 2026-08-28 */
2
+ 'use strict';
3
+ import { AuthError, ClientAuthError, ClientAuthErrorCodes, ServerError, InteractionRequiredAuthError } from '../../msal-common/index-browser.mjs';
4
+ import { WebBrokerBridgeErrorCode } from './WebBrokerBridgeError.mjs';
5
+
6
+ /*
7
+ * Copyright (c) Microsoft Corporation. All rights reserved.
8
+ * Licensed under the MIT License.
9
+ */
10
+ /**
11
+ * Lift a normalized `WebBrokerBridgeError` to one of the four base
12
+ * MSAL error classes. Callers are responsible for lowering
13
+ * transport-specific errors into `WebBrokerBridgeError` before calling
14
+ * this function.
15
+ */
16
+ function toAuthError(err) {
17
+ const correlationId = err.correlationId ?? "";
18
+ switch (err.code) {
19
+ case WebBrokerBridgeErrorCode.UserInteractionRequired:
20
+ return new InteractionRequiredAuthError(err.innerErrorCode || "", correlationId, err.description, err.subError);
21
+ case WebBrokerBridgeErrorCode.TransientError:
22
+ case WebBrokerBridgeErrorCode.PersistentError:
23
+ return new ServerError(err.innerErrorCode || "", correlationId, err.description, err.subError);
24
+ case WebBrokerBridgeErrorCode.UserCanceled:
25
+ return new ClientAuthError(ClientAuthErrorCodes.userCanceled, correlationId);
26
+ case WebBrokerBridgeErrorCode.NoNetwork:
27
+ return new ClientAuthError(ClientAuthErrorCodes.noNetworkConnectivity, correlationId);
28
+ case WebBrokerBridgeErrorCode.AccountUnavailable:
29
+ return new ClientAuthError(ClientAuthErrorCodes.noAccountFound, correlationId);
30
+ case WebBrokerBridgeErrorCode.BridgeDisabled:
31
+ return new ClientAuthError(ClientAuthErrorCodes.nestedAppAuthBridgeDisabled, correlationId);
32
+ case WebBrokerBridgeErrorCode.BridgeUnavailable:
33
+ /*
34
+ * NAA parity: pass through inner code when the broker supplied
35
+ * one, otherwise fall back to the disabled code.
36
+ */
37
+ return new ClientAuthError(err.innerErrorCode ||
38
+ ClientAuthErrorCodes.nestedAppAuthBridgeDisabled, correlationId, err.description);
39
+ /*
40
+ * PWB broker-channel failures. The common code doubles as the
41
+ * concrete errorCode on AuthError so the original error identity
42
+ * can be recovered by round-tripping the string.
43
+ */
44
+ case WebBrokerBridgeErrorCode.BridgeTimeout:
45
+ case WebBrokerBridgeErrorCode.BridgeHandshakeFailed:
46
+ case WebBrokerBridgeErrorCode.BridgeConnectionReset:
47
+ case WebBrokerBridgeErrorCode.BridgeResponseInvalid:
48
+ case WebBrokerBridgeErrorCode.PopupWillRedirect:
49
+ case WebBrokerBridgeErrorCode.ShrGenerationError:
50
+ return new AuthError(err.code, correlationId, err.description, err.subError);
51
+ case WebBrokerBridgeErrorCode.Unknown:
52
+ default:
53
+ return new AuthError(err.innerErrorCode || "unknown_error", correlationId, err.description || "An unknown error occurred", err.subError);
54
+ }
55
+ }
56
+
57
+ export { toAuthError };
@@ -0,0 +1,91 @@
1
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
2
+ 'use strict';
3
+ import { isKmsi } from './AuthToken.mjs';
4
+
5
+ /*
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License.
8
+ */
9
+ /**
10
+ * Returns true if tenantId matches the utid portion of homeAccountId
11
+ * @param tenantId
12
+ * @param homeAccountId
13
+ * @returns
14
+ */
15
+ function tenantIdMatchesHomeTenant(tenantId, homeAccountId) {
16
+ return (!!tenantId &&
17
+ !!homeAccountId &&
18
+ tenantId === homeAccountId.split(".")[1]);
19
+ }
20
+ /**
21
+ * Build tenant profile
22
+ * @param homeAccountId - Home account identifier for this account object
23
+ * @param localAccountId - Local account identifer for this account object
24
+ * @param tenantId - Full tenant or organizational id that this account belongs to
25
+ * @param nativeAccountId - Native account identifier for this tenant
26
+ * @param idTokenClaims - Claims from the ID token
27
+ * @returns
28
+ */
29
+ function buildTenantProfile(homeAccountId, localAccountId, tenantId, nativeAccountId, idTokenClaims) {
30
+ if (idTokenClaims) {
31
+ const { oid, sub, tid, name, tfp, acr, preferred_username, upn, login_hint, } = idTokenClaims;
32
+ /**
33
+ * Since there is no way to determine if the authority is AAD or B2C, we exhaust all the possible claims that can serve as tenant ID with the following precedence:
34
+ * tid - TenantID claim that identifies the tenant that issued the token in AAD. Expected in all AAD ID tokens, not present in B2C ID Tokens.
35
+ * tfp - Trust Framework Policy claim that identifies the policy that was used to authenticate the user. Functions as tenant for B2C scenarios.
36
+ * acr - Authentication Context Class Reference claim used only with older B2C policies. Fallback in case tfp is not present, but likely won't be present anyway.
37
+ */
38
+ const tenantId = tid || tfp || acr || "";
39
+ return {
40
+ tenantId: tenantId,
41
+ localAccountId: oid || sub || "",
42
+ name: name,
43
+ username: preferred_username || upn || "",
44
+ loginHint: login_hint,
45
+ isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
46
+ upn: upn,
47
+ ...(nativeAccountId && { nativeAccountId }),
48
+ };
49
+ }
50
+ else {
51
+ return {
52
+ tenantId,
53
+ localAccountId,
54
+ username: "",
55
+ isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
56
+ ...(nativeAccountId && { nativeAccountId }),
57
+ };
58
+ }
59
+ }
60
+ /**
61
+ * Replaces account info that varies by tenant profile sourced from the ID token claims passed in with the tenant-specific account info
62
+ * @param baseAccountInfo
63
+ * @param idTokenClaims
64
+ * @returns
65
+ */
66
+ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenClaims, idTokenSecret) {
67
+ let updatedAccountInfo = baseAccountInfo;
68
+ // Tenant Profile overrides passed in account info
69
+ if (tenantProfile) {
70
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
71
+ const { isHomeTenant, ...tenantProfileOverride } = tenantProfile;
72
+ updatedAccountInfo = { ...baseAccountInfo, ...tenantProfileOverride };
73
+ }
74
+ // ID token claims override passed in account info and tenant profile
75
+ if (idTokenClaims) {
76
+ // Ignore isHomeTenant which is a utility property of tenant profile but not required in base account info
77
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
78
+ const { isHomeTenant, ...claimsSourcedTenantProfile } = buildTenantProfile(baseAccountInfo.homeAccountId, baseAccountInfo.localAccountId, baseAccountInfo.tenantId, updatedAccountInfo.nativeAccountId, idTokenClaims);
79
+ updatedAccountInfo = {
80
+ ...updatedAccountInfo,
81
+ ...claimsSourcedTenantProfile,
82
+ idTokenClaims: idTokenClaims,
83
+ idToken: idTokenSecret,
84
+ kmsi: isKmsi(idTokenClaims),
85
+ };
86
+ return updatedAccountInfo;
87
+ }
88
+ return updatedAccountInfo;
89
+ }
90
+
91
+ export { buildTenantProfile, tenantIdMatchesHomeTenant, updateAccountTenantProfileData };