@azure/msal-node 3.8.4 → 5.0.0-beta.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 (313) hide show
  1. package/README.md +2 -1
  2. package/dist/cache/CacheHelpers.d.ts.map +1 -1
  3. package/dist/cache/CacheHelpers.mjs +4 -5
  4. package/dist/cache/CacheHelpers.mjs.map +1 -1
  5. package/dist/cache/NodeStorage.d.ts.map +1 -1
  6. package/dist/cache/NodeStorage.mjs +17 -18
  7. package/dist/cache/NodeStorage.mjs.map +1 -1
  8. package/dist/cache/TokenCache.d.ts.map +1 -1
  9. package/dist/cache/TokenCache.mjs +15 -15
  10. package/dist/cache/TokenCache.mjs.map +1 -1
  11. package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  12. package/dist/cache/distributed/DistributedCachePlugin.mjs +3 -3
  13. package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
  14. package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
  15. package/dist/cache/serializer/Deserializer.mjs +3 -5
  16. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  17. package/dist/cache/serializer/Serializer.d.ts.map +1 -1
  18. package/dist/cache/serializer/Serializer.mjs +1 -3
  19. package/dist/cache/serializer/Serializer.mjs.map +1 -1
  20. package/dist/cache/serializer/SerializerTypes.d.ts +0 -2
  21. package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -1
  22. package/dist/client/BaseClient.d.ts +42 -0
  23. package/dist/client/BaseClient.d.ts.map +1 -0
  24. package/dist/client/BaseClient.mjs +68 -0
  25. package/dist/client/BaseClient.mjs.map +1 -0
  26. package/dist/client/ClientApplication.d.ts.map +1 -1
  27. package/dist/client/ClientApplication.mjs +33 -43
  28. package/dist/client/ClientApplication.mjs.map +1 -1
  29. package/dist/client/ClientAssertion.d.ts.map +1 -1
  30. package/dist/client/ClientAssertion.mjs +6 -5
  31. package/dist/client/ClientAssertion.mjs.map +1 -1
  32. package/dist/client/ClientCredentialClient.d.ts +4 -2
  33. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  34. package/dist/client/ClientCredentialClient.mjs +23 -21
  35. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  36. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  37. package/dist/client/ConfidentialClientApplication.mjs +10 -9
  38. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  39. package/dist/client/DeviceCodeClient.d.ts +3 -1
  40. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  41. package/dist/client/DeviceCodeClient.mjs +21 -19
  42. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  43. package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
  44. package/dist/client/ManagedIdentityApplication.mjs +7 -6
  45. package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
  46. package/dist/client/ManagedIdentityClient.mjs +1 -1
  47. package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  48. package/dist/client/ManagedIdentitySources/AppService.mjs +3 -3
  49. package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
  50. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  51. package/dist/client/ManagedIdentitySources/AzureArc.mjs +8 -8
  52. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  53. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  54. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +12 -11
  55. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  56. package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  57. package/dist/client/ManagedIdentitySources/CloudShell.mjs +3 -3
  58. package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
  59. package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  60. package/dist/client/ManagedIdentitySources/Imds.mjs +3 -3
  61. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
  62. package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  63. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +3 -3
  64. package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
  65. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  66. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +4 -4
  67. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
  68. package/dist/client/OnBehalfOfClient.d.ts +3 -1
  69. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  70. package/dist/client/OnBehalfOfClient.mjs +19 -18
  71. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  72. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  73. package/dist/client/PublicClientApplication.mjs +15 -14
  74. package/dist/client/PublicClientApplication.mjs.map +1 -1
  75. package/dist/client/UsernamePasswordClient.d.ts +3 -1
  76. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  77. package/dist/client/UsernamePasswordClient.mjs +8 -7
  78. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  79. package/dist/config/Configuration.d.ts +2 -19
  80. package/dist/config/Configuration.d.ts.map +1 -1
  81. package/dist/config/Configuration.mjs +18 -25
  82. package/dist/config/Configuration.mjs.map +1 -1
  83. package/dist/config/ManagedIdentityId.mjs +1 -1
  84. package/dist/config/ManagedIdentityRequestParameters.mjs +3 -3
  85. package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
  86. package/dist/crypto/CryptoProvider.d.ts.map +1 -1
  87. package/dist/crypto/CryptoProvider.mjs +5 -3
  88. package/dist/crypto/CryptoProvider.mjs.map +1 -1
  89. package/dist/crypto/GuidGenerator.mjs +1 -1
  90. package/dist/crypto/HashUtils.mjs +1 -1
  91. package/dist/crypto/PkceGenerator.d.ts.map +1 -1
  92. package/dist/crypto/PkceGenerator.mjs +6 -4
  93. package/dist/crypto/PkceGenerator.mjs.map +1 -1
  94. package/dist/error/ClientAuthErrorCodes.d.ts +8 -0
  95. package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -0
  96. package/dist/error/ClientAuthErrorCodes.mjs +16 -0
  97. package/dist/error/ClientAuthErrorCodes.mjs.map +1 -0
  98. package/dist/error/ManagedIdentityError.mjs +1 -1
  99. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  100. package/dist/error/NodeAuthError.mjs +1 -1
  101. package/dist/index.d.ts +15 -11
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.mjs +20 -8
  104. package/dist/index.mjs.map +1 -1
  105. package/dist/internals.mjs +1 -1
  106. package/dist/network/HttpClient.d.ts +53 -40
  107. package/dist/network/HttpClient.d.ts.map +1 -1
  108. package/dist/network/HttpClient.mjs +149 -315
  109. package/dist/network/HttpClient.mjs.map +1 -1
  110. package/dist/network/HttpClientWithRetries.mjs +3 -3
  111. package/dist/network/HttpClientWithRetries.mjs.map +1 -1
  112. package/dist/network/LoopbackClient.d.ts.map +1 -1
  113. package/dist/network/LoopbackClient.mjs +3 -3
  114. package/dist/network/LoopbackClient.mjs.map +1 -1
  115. package/dist/packageMetadata.d.ts +1 -1
  116. package/dist/packageMetadata.d.ts.map +1 -1
  117. package/dist/packageMetadata.mjs +2 -2
  118. package/dist/protocol/Authorize.d.ts.map +1 -1
  119. package/dist/protocol/Authorize.mjs +6 -6
  120. package/dist/protocol/Authorize.mjs.map +1 -1
  121. package/dist/request/AuthorizationCodeRequest.d.ts +3 -2
  122. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
  123. package/dist/request/AuthorizationUrlRequest.d.ts +3 -3
  124. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
  125. package/dist/request/ClientCredentialRequest.d.ts +4 -4
  126. package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
  127. package/dist/request/CommonClientCredentialRequest.d.ts +17 -0
  128. package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -0
  129. package/dist/request/CommonDeviceCodeRequest.d.ts +21 -0
  130. package/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -0
  131. package/dist/request/CommonOnBehalfOfRequest.d.ts +13 -0
  132. package/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
  133. package/dist/request/CommonUsernamePasswordRequest.d.ts +19 -0
  134. package/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
  135. package/dist/request/DeviceCodeRequest.d.ts +3 -2
  136. package/dist/request/DeviceCodeRequest.d.ts.map +1 -1
  137. package/dist/request/InteractiveRequest.d.ts +1 -1
  138. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  139. package/dist/request/ManagedIdentityRequest.d.ts +1 -1
  140. package/dist/request/ManagedIdentityRequest.d.ts.map +1 -1
  141. package/dist/request/OnBehalfOfRequest.d.ts +2 -3
  142. package/dist/request/OnBehalfOfRequest.d.ts.map +1 -1
  143. package/dist/request/RefreshTokenRequest.d.ts +3 -2
  144. package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
  145. package/dist/request/SilentFlowRequest.d.ts +3 -2
  146. package/dist/request/SilentFlowRequest.d.ts.map +1 -1
  147. package/dist/request/UsernamePasswordRequest.d.ts +4 -3
  148. package/dist/request/UsernamePasswordRequest.d.ts.map +1 -1
  149. package/dist/response/ManagedIdentityTokenResponse.d.ts +2 -2
  150. package/dist/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
  151. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
  152. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  153. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +9 -9
  154. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs.map +1 -1
  155. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  156. package/dist/retry/IHttpRetryPolicy.d.ts +1 -1
  157. package/dist/retry/IHttpRetryPolicy.d.ts.map +1 -1
  158. package/dist/retry/ImdsRetryPolicy.d.ts +1 -1
  159. package/dist/retry/ImdsRetryPolicy.d.ts.map +1 -1
  160. package/dist/retry/ImdsRetryPolicy.mjs +11 -11
  161. package/dist/retry/ImdsRetryPolicy.mjs.map +1 -1
  162. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  163. package/dist/utils/Constants.d.ts +2 -9
  164. package/dist/utils/Constants.d.ts.map +1 -1
  165. package/dist/utils/Constants.mjs +4 -12
  166. package/dist/utils/Constants.mjs.map +1 -1
  167. package/dist/utils/EncodingUtils.d.ts.map +1 -1
  168. package/dist/utils/EncodingUtils.mjs +5 -5
  169. package/dist/utils/EncodingUtils.mjs.map +1 -1
  170. package/dist/utils/TimeUtils.mjs +1 -1
  171. package/lib/msal-node.cjs +5378 -6289
  172. package/lib/msal-node.cjs.map +1 -1
  173. package/lib/types/cache/CacheHelpers.d.ts.map +1 -1
  174. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  175. package/lib/types/cache/TokenCache.d.ts.map +1 -1
  176. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  177. package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
  178. package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
  179. package/lib/types/cache/serializer/SerializerTypes.d.ts +0 -2
  180. package/lib/types/cache/serializer/SerializerTypes.d.ts.map +1 -1
  181. package/lib/types/client/BaseClient.d.ts +42 -0
  182. package/lib/types/client/BaseClient.d.ts.map +1 -0
  183. package/lib/types/client/ClientApplication.d.ts.map +1 -1
  184. package/lib/types/client/ClientAssertion.d.ts.map +1 -1
  185. package/lib/types/client/ClientCredentialClient.d.ts +4 -2
  186. package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
  187. package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
  188. package/lib/types/client/DeviceCodeClient.d.ts +3 -1
  189. package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
  190. package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
  191. package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  192. package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  193. package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  194. package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  195. package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  196. package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  197. package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  198. package/lib/types/client/OnBehalfOfClient.d.ts +3 -1
  199. package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
  200. package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
  201. package/lib/types/client/UsernamePasswordClient.d.ts +3 -1
  202. package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
  203. package/lib/types/config/Configuration.d.ts +2 -19
  204. package/lib/types/config/Configuration.d.ts.map +1 -1
  205. package/lib/types/crypto/CryptoProvider.d.ts.map +1 -1
  206. package/lib/types/crypto/PkceGenerator.d.ts.map +1 -1
  207. package/lib/types/error/ClientAuthErrorCodes.d.ts +8 -0
  208. package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -0
  209. package/lib/types/index.d.ts +15 -11
  210. package/lib/types/index.d.ts.map +1 -1
  211. package/lib/types/network/HttpClient.d.ts +53 -40
  212. package/lib/types/network/HttpClient.d.ts.map +1 -1
  213. package/lib/types/network/LoopbackClient.d.ts.map +1 -1
  214. package/lib/types/packageMetadata.d.ts +1 -1
  215. package/lib/types/packageMetadata.d.ts.map +1 -1
  216. package/lib/types/protocol/Authorize.d.ts.map +1 -1
  217. package/lib/types/request/AuthorizationCodeRequest.d.ts +3 -2
  218. package/lib/types/request/AuthorizationCodeRequest.d.ts.map +1 -1
  219. package/lib/types/request/AuthorizationUrlRequest.d.ts +3 -3
  220. package/lib/types/request/AuthorizationUrlRequest.d.ts.map +1 -1
  221. package/lib/types/request/ClientCredentialRequest.d.ts +4 -4
  222. package/lib/types/request/ClientCredentialRequest.d.ts.map +1 -1
  223. package/lib/types/request/CommonClientCredentialRequest.d.ts +17 -0
  224. package/lib/types/request/CommonClientCredentialRequest.d.ts.map +1 -0
  225. package/lib/types/request/CommonDeviceCodeRequest.d.ts +21 -0
  226. package/lib/types/request/CommonDeviceCodeRequest.d.ts.map +1 -0
  227. package/lib/types/request/CommonOnBehalfOfRequest.d.ts +13 -0
  228. package/lib/types/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
  229. package/lib/types/request/CommonUsernamePasswordRequest.d.ts +19 -0
  230. package/lib/types/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
  231. package/lib/types/request/DeviceCodeRequest.d.ts +3 -2
  232. package/lib/types/request/DeviceCodeRequest.d.ts.map +1 -1
  233. package/lib/types/request/InteractiveRequest.d.ts +1 -1
  234. package/lib/types/request/InteractiveRequest.d.ts.map +1 -1
  235. package/lib/types/request/ManagedIdentityRequest.d.ts +1 -1
  236. package/lib/types/request/ManagedIdentityRequest.d.ts.map +1 -1
  237. package/lib/types/request/OnBehalfOfRequest.d.ts +2 -3
  238. package/lib/types/request/OnBehalfOfRequest.d.ts.map +1 -1
  239. package/lib/types/request/RefreshTokenRequest.d.ts +3 -2
  240. package/lib/types/request/RefreshTokenRequest.d.ts.map +1 -1
  241. package/lib/types/request/SilentFlowRequest.d.ts +3 -2
  242. package/lib/types/request/SilentFlowRequest.d.ts.map +1 -1
  243. package/lib/types/request/UsernamePasswordRequest.d.ts +4 -3
  244. package/lib/types/request/UsernamePasswordRequest.d.ts.map +1 -1
  245. package/lib/types/response/ManagedIdentityTokenResponse.d.ts +2 -2
  246. package/lib/types/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
  247. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
  248. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  249. package/lib/types/retry/IHttpRetryPolicy.d.ts +1 -1
  250. package/lib/types/retry/IHttpRetryPolicy.d.ts.map +1 -1
  251. package/lib/types/retry/ImdsRetryPolicy.d.ts +1 -1
  252. package/lib/types/retry/ImdsRetryPolicy.d.ts.map +1 -1
  253. package/lib/types/utils/Constants.d.ts +2 -9
  254. package/lib/types/utils/Constants.d.ts.map +1 -1
  255. package/lib/types/utils/EncodingUtils.d.ts.map +1 -1
  256. package/package.json +4 -6
  257. package/src/cache/CacheHelpers.ts +3 -5
  258. package/src/cache/NodeStorage.ts +19 -16
  259. package/src/cache/TokenCache.ts +18 -14
  260. package/src/cache/distributed/DistributedCachePlugin.ts +2 -1
  261. package/src/cache/serializer/Deserializer.ts +7 -9
  262. package/src/cache/serializer/Serializer.ts +0 -2
  263. package/src/cache/serializer/SerializerTypes.ts +0 -2
  264. package/src/client/BaseClient.ts +158 -0
  265. package/src/client/ClientApplication.ts +50 -57
  266. package/src/client/ClientAssertion.ts +5 -6
  267. package/src/client/ClientCredentialClient.ts +32 -25
  268. package/src/client/ConfidentialClientApplication.ts +13 -13
  269. package/src/client/DeviceCodeClient.ts +33 -21
  270. package/src/client/ManagedIdentityApplication.ts +10 -7
  271. package/src/client/ManagedIdentitySources/AppService.ts +4 -2
  272. package/src/client/ManagedIdentitySources/AzureArc.ts +14 -8
  273. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +18 -9
  274. package/src/client/ManagedIdentitySources/CloudShell.ts +4 -2
  275. package/src/client/ManagedIdentitySources/Imds.ts +4 -2
  276. package/src/client/ManagedIdentitySources/MachineLearning.ts +4 -2
  277. package/src/client/ManagedIdentitySources/ServiceFabric.ts +6 -3
  278. package/src/client/OnBehalfOfClient.ts +27 -21
  279. package/src/client/PublicClientApplication.ts +16 -16
  280. package/src/client/UsernamePasswordClient.ts +14 -8
  281. package/src/config/Configuration.ts +19 -48
  282. package/src/config/ManagedIdentityRequestParameters.ts +2 -2
  283. package/src/crypto/CryptoProvider.ts +5 -3
  284. package/src/crypto/PkceGenerator.ts +6 -4
  285. package/src/error/ClientAuthErrorCodes.ts +12 -0
  286. package/src/index.ts +5 -19
  287. package/src/network/HttpClient.ts +168 -457
  288. package/src/network/HttpClientWithRetries.ts +2 -2
  289. package/src/network/LoopbackClient.ts +2 -3
  290. package/src/packageMetadata.ts +1 -1
  291. package/src/protocol/Authorize.ts +8 -10
  292. package/src/request/AuthorizationCodeRequest.ts +2 -2
  293. package/src/request/AuthorizationUrlRequest.ts +2 -3
  294. package/src/request/ClientCredentialRequest.ts +3 -7
  295. package/src/request/CommonClientCredentialRequest.ts +29 -0
  296. package/src/request/CommonDeviceCodeRequest.ts +30 -0
  297. package/src/request/CommonOnBehalfOfRequest.ts +21 -0
  298. package/src/request/CommonUsernamePasswordRequest.ts +24 -0
  299. package/src/request/DeviceCodeRequest.ts +2 -5
  300. package/src/request/InteractiveRequest.ts +1 -4
  301. package/src/request/ManagedIdentityRequest.ts +1 -1
  302. package/src/request/OnBehalfOfRequest.ts +1 -3
  303. package/src/request/RefreshTokenRequest.ts +2 -2
  304. package/src/request/SilentFlowRequest.ts +3 -5
  305. package/src/request/UsernamePasswordRequest.ts +3 -3
  306. package/src/response/ManagedIdentityTokenResponse.ts +2 -2
  307. package/src/retry/DefaultManagedIdentityRetryPolicy.ts +9 -8
  308. package/src/retry/IHttpRetryPolicy.ts +1 -1
  309. package/src/retry/ImdsRetryPolicy.ts +11 -10
  310. package/src/utils/Constants.ts +2 -11
  311. package/src/utils/EncodingUtils.ts +8 -4
  312. package/dist/utils/NetworkUtils.mjs +0 -43
  313. package/dist/utils/NetworkUtils.mjs.map +0 -1
@@ -1,53 +1,66 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- import { INetworkModule, NetworkRequestOptions, NetworkResponse, LoggerOptions } from "@azure/msal-common/node";
4
- import http from "http";
5
- import https from "https";
1
+ import { INetworkModule, NetworkRequestOptions, NetworkResponse } from "@azure/msal-common/node";
6
2
  /**
7
- * This class implements the API for network requests.
3
+ * HTTP client implementation using Node.js native fetch API.
4
+ *
5
+ * This class provides a clean interface for making HTTP requests using the modern
6
+ * fetch API available in Node.js 18+. It replaces the previous implementation that
7
+ * relied on custom proxy handling and the legacy http/https modules.
8
8
  */
9
9
  export declare class HttpClient implements INetworkModule {
10
- private proxyUrl;
11
- private customAgentOptions;
12
- private logger;
13
- private isPiiEnabled;
14
- constructor(proxyUrl?: string, customAgentOptions?: http.AgentOptions | https.AgentOptions, loggerOptions?: LoggerOptions);
15
10
  /**
16
- * Http Get request
17
- * @param url
18
- * @param options
11
+ * Sends an HTTP GET request to the specified URL.
12
+ *
13
+ * This method handles GET requests with optional timeout support. The timeout
14
+ * is implemented using AbortController, which provides a clean way to cancel
15
+ * fetch requests that take too long to complete.
16
+ *
17
+ * @param url - The target URL for the GET request
18
+ * @param options - Optional request configuration including headers
19
+ * @param timeout - Optional timeout in milliseconds. If specified, the request
20
+ * will be aborted if it doesn't complete within this time
21
+ * @returns Promise that resolves to a NetworkResponse containing headers, body, and status
22
+ * @throws {AuthError} When the request times out or response parsing fails
23
+ * @throws {NetworkError} When the network request fails
19
24
  */
20
25
  sendGetRequestAsync<T>(url: string, options?: NetworkRequestOptions, timeout?: number): Promise<NetworkResponse<T>>;
21
26
  /**
22
- * Http Post request
23
- * @param url
24
- * @param options
27
+ * Sends an HTTP POST request to the specified URL.
28
+ *
29
+ * This method handles POST requests with request body support. Currently,
30
+ * timeout functionality is not exposed for POST requests, but the underlying
31
+ * implementation supports it through the shared sendRequest method.
32
+ *
33
+ * @param url - The target URL for the POST request
34
+ * @param options - Optional request configuration including headers and body
35
+ * @returns Promise that resolves to a NetworkResponse containing headers, body, and status
36
+ * @throws {AuthError} When the request times out or response parsing fails
37
+ * @throws {NetworkError} When the network request fails
25
38
  */
26
39
  sendPostRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
27
- private networkRequestViaProxy;
28
- private networkRequestViaHttps;
29
40
  /**
30
- * Check if extra parsing is needed on the repsonse from the server
31
- * @param statusCode {number} the status code of the response from the server
32
- * @param statusMessage {string | undefined} the status message of the response from the server
33
- * @param headers {Record<string, string>} the headers of the response from the server
34
- * @param body {string} the body from the response of the server
35
- * @returns {Object} JSON parsed body or error object
41
+ * Core HTTP request implementation using native fetch API.
42
+ *
43
+ * This method handles GET and POST HTTP requests with comprehensive
44
+ * timeout support and error handling. The timeout mechanism works as follows:
45
+ *
46
+ * 1. An AbortController is created for each request
47
+ * 2. If a timeout is specified, setTimeout is used to call abort() after the delay
48
+ * 3. The abort signal is passed to fetch, which will reject the promise if aborted
49
+ * 4. Cleanup occurs in both success and error cases to prevent timer leaks
50
+ *
51
+ * Error handling priority:
52
+ * 1. Timeout errors (AbortError) are converted to "Request timeout" messages
53
+ * 2. Network/connection errors are wrapped with "Network request failed" prefix
54
+ * 3. JSON parsing errors are wrapped with "Failed to parse response" prefix
55
+ *
56
+ * @param url - The target URL for the request
57
+ * @param method - HTTP method (GET or POST)
58
+ * @param options - Optional request configuration (headers, body)
59
+ * @param timeout - Optional timeout in milliseconds for request cancellation
60
+ * @returns Promise resolving to NetworkResponse with parsed JSON body
61
+ * @throws {AuthError} For timeouts or JSON parsing errors
62
+ * @throws {NetworkError} For network failures
36
63
  */
37
- private parseBody;
38
- /**
39
- * Helper function to log a formatted message containing URLs, with PII-aware sanitization
40
- * @param label {string} the label for the log message
41
- * @param urlString {string} the URL to log
42
- */
43
- private logUrlWithPiiAwareness;
44
- /**
45
- * Helper function to determine if a request should be destroyed based on status code and response body.
46
- * Checks if the response is an error and not part of the device code flow (authorization_pending).
47
- * @param statusCode {number} the status code of the response
48
- * @param networkResponse {NetworkResponse<T>} the network response object
49
- * @returns {boolean} true if the request should be destroyed, false otherwise
50
- */
51
- private shouldDestroyRequest;
64
+ private sendRequest;
52
65
  }
53
66
  //# sourceMappingURL=HttpClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../src/network/HttpClient.ts"],"names":[],"mappings":";;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;;;;;;;;;;;;;OAcG;IACG,mBAAmB,CAAC,CAAC,EACvB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,qBAAqB,EAC/B,OAAO,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAI9B;;;;;;;;;;;;OAYG;IACG,oBAAoB,CAAC,CAAC,EACxB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,qBAAqB,GAChC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAI9B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;YACW,WAAW;CAoF5B"}
@@ -1,337 +1,171 @@
1
- /*! @azure/msal-node v3.8.4 2025-12-04 */
1
+ /*! @azure/msal-node v5.0.0-beta.0 2025-12-05 */
2
2
  'use strict';
3
- import { HttpStatus, Logger } from '@azure/msal-common/node';
4
- import { ProxyStatus, Constants, HttpMethod } from '../utils/Constants.mjs';
5
- import { NetworkUtils } from '../utils/NetworkUtils.mjs';
6
- import { name, version } from '../packageMetadata.mjs';
7
- import http from 'http';
8
- import https from 'https';
3
+ import { createAuthError, ClientAuthErrorCodes, createNetworkError } from '@azure/msal-common/node';
4
+ import { HttpMethod } from '../utils/Constants.mjs';
9
5
 
10
6
  /*
11
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
8
  * Licensed under the MIT License.
13
9
  */
14
10
  /**
15
- * This class implements the API for network requests.
11
+ * HTTP client implementation using Node.js native fetch API.
12
+ *
13
+ * This class provides a clean interface for making HTTP requests using the modern
14
+ * fetch API available in Node.js 18+. It replaces the previous implementation that
15
+ * relied on custom proxy handling and the legacy http/https modules.
16
16
  */
17
17
  class HttpClient {
18
- constructor(proxyUrl, customAgentOptions, loggerOptions) {
19
- this.networkRequestViaProxy = (httpMethod, destinationUrlString, options, timeout) => {
20
- const destinationUrl = new URL(destinationUrlString);
21
- const proxyUrl = new URL(this.proxyUrl);
22
- // "method: connect" must be used to establish a connection to the proxy
23
- const headers = options?.headers || {};
24
- const tunnelRequestOptions = {
25
- host: proxyUrl.hostname,
26
- port: proxyUrl.port,
27
- method: "CONNECT",
28
- path: destinationUrl.hostname,
29
- headers: headers,
30
- };
31
- if (this.customAgentOptions &&
32
- Object.keys(this.customAgentOptions).length) {
33
- tunnelRequestOptions.agent = new http.Agent(this.customAgentOptions);
34
- }
35
- // compose a request string for the socket
36
- let postRequestStringContent = "";
37
- if (httpMethod === HttpMethod.POST) {
38
- const body = options?.body || "";
39
- postRequestStringContent =
40
- "Content-Type: application/x-www-form-urlencoded\r\n" +
41
- `Content-Length: ${body.length}\r\n` +
42
- `\r\n${body}`;
43
- }
44
- else {
45
- // optional timeout is only for get requests (regionDiscovery, for example)
46
- if (timeout) {
47
- tunnelRequestOptions.timeout = timeout;
48
- }
49
- }
50
- const outgoingRequestString = `${httpMethod.toUpperCase()} ${destinationUrl.href} HTTP/1.1\r\n` +
51
- `Host: ${destinationUrl.host}\r\n` +
52
- "Connection: close\r\n" +
53
- postRequestStringContent +
54
- "\r\n";
55
- return new Promise((resolve, reject) => {
56
- const request = http.request(tunnelRequestOptions);
57
- if (timeout) {
58
- request.on("timeout", () => {
59
- this.logUrlWithPiiAwareness(`Request timeout after ${timeout}ms for URL`, destinationUrlString);
60
- request.destroy();
61
- reject(new Error(`Request time out after ${timeout}ms`));
62
- });
63
- }
64
- request.end();
65
- // establish connection to the proxy
66
- request.on("connect", (response, socket) => {
67
- const proxyStatusCode = response?.statusCode || ProxyStatus.SERVER_ERROR;
68
- if (proxyStatusCode < ProxyStatus.SUCCESS_RANGE_START ||
69
- proxyStatusCode > ProxyStatus.SUCCESS_RANGE_END) {
70
- request.destroy();
71
- socket.destroy();
72
- reject(new Error(`Error connecting to proxy. Http status code: ${response.statusCode}. Http status message: ${response?.statusMessage || "Unknown"}`));
73
- }
74
- // make a request over an HTTP tunnel
75
- socket.write(outgoingRequestString);
76
- const data = [];
77
- socket.on("data", (chunk) => {
78
- data.push(chunk);
79
- });
80
- socket.on("end", () => {
81
- // combine all received buffer streams into one buffer, and then into a string
82
- const dataString = Buffer.concat([...data]).toString();
83
- // separate each line into it's own entry in an arry
84
- const dataStringArray = dataString.split("\r\n");
85
- // the first entry will contain the statusCode and statusMessage
86
- const httpStatusCode = parseInt(dataStringArray[0].split(" ")[1]);
87
- // remove "HTTP/1.1" and the status code to get the status message
88
- const statusMessage = dataStringArray[0]
89
- .split(" ")
90
- .slice(2)
91
- .join(" ");
92
- // the last entry will contain the body
93
- const body = dataStringArray[dataStringArray.length - 1];
94
- // everything in between the first and last entries are the headers
95
- const headersArray = dataStringArray.slice(1, dataStringArray.length - 2);
96
- // build an object out of all the headers
97
- const entries = new Map();
98
- headersArray.forEach((header) => {
99
- /**
100
- * the header might look like "Content-Length: 1531", but that is just a string
101
- * it needs to be converted to a key/value pair
102
- * split the string at the first instance of ":"
103
- * there may be more than one ":" if the value of the header is supposed to be a JSON object
104
- */
105
- const headerKeyValue = header.split(new RegExp(/:\s(.*)/s));
106
- const headerKey = headerKeyValue[0];
107
- let headerValue = headerKeyValue[1];
108
- // check if the value of the header is supposed to be a JSON object
109
- try {
110
- const object = JSON.parse(headerValue);
111
- // if it is, then convert it from a string to a JSON object
112
- if (object && typeof object === "object") {
113
- headerValue = object;
114
- }
115
- }
116
- catch (e) {
117
- // otherwise, leave it as a string
118
- }
119
- entries.set(headerKey, headerValue);
120
- });
121
- const headers = Object.fromEntries(entries);
122
- const parsedHeaders = headers;
123
- const networkResponse = NetworkUtils.getNetworkResponse(parsedHeaders, this.parseBody(httpStatusCode, statusMessage, parsedHeaders, body), httpStatusCode);
124
- if (this.shouldDestroyRequest(httpStatusCode, networkResponse)) {
125
- request.destroy();
126
- }
127
- resolve(networkResponse);
128
- });
129
- socket.on("error", (chunk) => {
130
- request.destroy();
131
- socket.destroy();
132
- reject(new Error(chunk.toString()));
133
- });
134
- });
135
- request.on("error", (chunk) => {
136
- this.logger.error(`HttpClient - Proxy request error: ${chunk.toString()}`, "");
137
- this.logUrlWithPiiAwareness("Destination URL", destinationUrlString);
138
- this.logUrlWithPiiAwareness("Proxy URL", this.proxyUrl);
139
- this.logger.error(`HttpClient - Method: ${httpMethod}`, "");
140
- this.logger.errorPii(`HttpClient - Headers: ${JSON.stringify(headers)}`, "");
141
- request.destroy();
142
- reject(new Error(chunk.toString()));
143
- });
144
- });
145
- };
146
- this.networkRequestViaHttps = (httpMethod, urlString, options, timeout) => {
147
- const isPostRequest = httpMethod === HttpMethod.POST;
148
- const body = options?.body || "";
149
- const url = new URL(urlString);
150
- const headers = options?.headers || {};
151
- const customOptions = {
152
- method: httpMethod,
153
- headers: headers,
154
- ...NetworkUtils.urlToHttpOptions(url),
155
- };
156
- if (this.customAgentOptions &&
157
- Object.keys(this.customAgentOptions).length) {
158
- customOptions.agent = new https.Agent(this.customAgentOptions);
159
- }
160
- if (isPostRequest) {
161
- // needed for post request to work
162
- customOptions.headers = {
163
- ...customOptions.headers,
164
- "Content-Length": body.length,
165
- };
166
- }
167
- else {
168
- // optional timeout is only for get requests (regionDiscovery, for example)
169
- if (timeout) {
170
- customOptions.timeout = timeout;
171
- }
172
- }
173
- return new Promise((resolve, reject) => {
174
- let request;
175
- // managed identity sources use http instead of https
176
- if (customOptions.protocol === "http:") {
177
- request = http.request(customOptions);
178
- }
179
- else {
180
- request = https.request(customOptions);
181
- }
182
- if (isPostRequest) {
183
- request.write(body);
184
- }
185
- if (timeout) {
186
- request.on("timeout", () => {
187
- this.logUrlWithPiiAwareness(`HTTPS request timeout after ${timeout}ms for URL`, urlString);
188
- request.destroy();
189
- reject(new Error(`Request time out after ${timeout}ms`));
190
- });
191
- }
192
- request.end();
193
- request.on("response", (response) => {
194
- const headers = response.headers;
195
- const statusCode = response.statusCode;
196
- const statusMessage = response.statusMessage;
197
- const data = [];
198
- response.on("data", (chunk) => {
199
- data.push(chunk);
200
- });
201
- response.on("end", () => {
202
- // combine all received buffer streams into one buffer, and then into a string
203
- const body = Buffer.concat([...data]).toString();
204
- const parsedHeaders = headers;
205
- const networkResponse = NetworkUtils.getNetworkResponse(parsedHeaders, this.parseBody(statusCode, statusMessage, parsedHeaders, body), statusCode);
206
- if (this.shouldDestroyRequest(statusCode, networkResponse)) {
207
- request.destroy();
208
- }
209
- resolve(networkResponse);
210
- });
211
- });
212
- request.on("error", (chunk) => {
213
- this.logger.error(`HttpClient - HTTPS request error: ${chunk.toString()}`, "");
214
- this.logUrlWithPiiAwareness("URL", urlString);
215
- this.logger.error(`HttpClient - Method: ${httpMethod}`, "");
216
- this.logger.errorPii(`HttpClient - Headers: ${JSON.stringify(headers)}`, "");
217
- request.destroy();
218
- reject(new Error(chunk.toString()));
219
- });
220
- });
221
- };
222
- /**
223
- * Check if extra parsing is needed on the repsonse from the server
224
- * @param statusCode {number} the status code of the response from the server
225
- * @param statusMessage {string | undefined} the status message of the response from the server
226
- * @param headers {Record<string, string>} the headers of the response from the server
227
- * @param body {string} the body from the response of the server
228
- * @returns {Object} JSON parsed body or error object
229
- */
230
- this.parseBody = (statusCode, statusMessage, headers, body) => {
231
- /*
232
- * Informational responses (100 – 199)
233
- * Successful responses (200 – 299)
234
- * Redirection messages (300 – 399)
235
- * Client error responses (400 – 499)
236
- * Server error responses (500 – 599)
237
- */
238
- let parsedBody;
239
- try {
240
- parsedBody = JSON.parse(body);
241
- }
242
- catch (error) {
243
- let errorType;
244
- let errorDescriptionHelper;
245
- if (statusCode >= HttpStatus.CLIENT_ERROR_RANGE_START &&
246
- statusCode <= HttpStatus.CLIENT_ERROR_RANGE_END) {
247
- errorType = "client_error";
248
- errorDescriptionHelper = "A client";
249
- }
250
- else if (statusCode >= HttpStatus.SERVER_ERROR_RANGE_START &&
251
- statusCode <= HttpStatus.SERVER_ERROR_RANGE_END) {
252
- errorType = "server_error";
253
- errorDescriptionHelper = "A server";
254
- }
255
- else {
256
- errorType = "unknown_error";
257
- errorDescriptionHelper = "An unknown";
258
- }
259
- parsedBody = {
260
- error: errorType,
261
- error_description: `${errorDescriptionHelper} error occured.\nHttp status code: ${statusCode}\nHttp status message: ${statusMessage || "Unknown"}\nHeaders: ${JSON.stringify(headers)}`,
262
- };
263
- }
264
- return parsedBody;
265
- };
266
- /**
267
- * Helper function to log a formatted message containing URLs, with PII-aware sanitization
268
- * @param label {string} the label for the log message
269
- * @param urlString {string} the URL to log
270
- */
271
- this.logUrlWithPiiAwareness = (label, urlString) => {
272
- if (this.isPiiEnabled) {
273
- this.logger.errorPii(`HttpClient - ${label}: ${urlString}`, "");
274
- }
275
- else {
276
- let urlHelper;
277
- try {
278
- const url = new URL(urlString);
279
- urlHelper = `${url.protocol}//${url.host}${url.pathname}`;
280
- }
281
- catch {
282
- urlHelper = urlString.split("?")[0] || "unknown";
283
- }
284
- this.logger.error(`HttpClient - ${label}: ${urlHelper} [Enable PII logging to see additional details]`, "");
285
- }
286
- };
287
- /**
288
- * Helper function to determine if a request should be destroyed based on status code and response body.
289
- * Checks if the response is an error and not part of the device code flow (authorization_pending).
290
- * @param statusCode {number} the status code of the response
291
- * @param networkResponse {NetworkResponse<T>} the network response object
292
- * @returns {boolean} true if the request should be destroyed, false otherwise
293
- */
294
- this.shouldDestroyRequest = (statusCode, networkResponse) => {
295
- return ((statusCode < HttpStatus.SUCCESS_RANGE_START ||
296
- statusCode > HttpStatus.SUCCESS_RANGE_END) &&
297
- // do not destroy the request for the device code flow
298
- !(networkResponse.body &&
299
- typeof networkResponse.body === "object" &&
300
- "error" in networkResponse.body &&
301
- networkResponse.body.error ===
302
- Constants.AUTHORIZATION_PENDING));
303
- };
304
- this.proxyUrl = proxyUrl || "";
305
- this.customAgentOptions = customAgentOptions || {};
306
- this.logger = new Logger(loggerOptions || {}, name, version);
307
- this.isPiiEnabled = this.logger.isPiiLoggingEnabled();
308
- }
309
18
  /**
310
- * Http Get request
311
- * @param url
312
- * @param options
19
+ * Sends an HTTP GET request to the specified URL.
20
+ *
21
+ * This method handles GET requests with optional timeout support. The timeout
22
+ * is implemented using AbortController, which provides a clean way to cancel
23
+ * fetch requests that take too long to complete.
24
+ *
25
+ * @param url - The target URL for the GET request
26
+ * @param options - Optional request configuration including headers
27
+ * @param timeout - Optional timeout in milliseconds. If specified, the request
28
+ * will be aborted if it doesn't complete within this time
29
+ * @returns Promise that resolves to a NetworkResponse containing headers, body, and status
30
+ * @throws {AuthError} When the request times out or response parsing fails
31
+ * @throws {NetworkError} When the network request fails
313
32
  */
314
33
  async sendGetRequestAsync(url, options, timeout) {
315
- if (this.proxyUrl) {
316
- return this.networkRequestViaProxy(HttpMethod.GET, url, options, timeout);
317
- }
318
- else {
319
- return this.networkRequestViaHttps(HttpMethod.GET, url, options, timeout);
320
- }
34
+ return this.sendRequest(url, HttpMethod.GET, options, timeout);
321
35
  }
322
36
  /**
323
- * Http Post request
324
- * @param url
325
- * @param options
37
+ * Sends an HTTP POST request to the specified URL.
38
+ *
39
+ * This method handles POST requests with request body support. Currently,
40
+ * timeout functionality is not exposed for POST requests, but the underlying
41
+ * implementation supports it through the shared sendRequest method.
42
+ *
43
+ * @param url - The target URL for the POST request
44
+ * @param options - Optional request configuration including headers and body
45
+ * @returns Promise that resolves to a NetworkResponse containing headers, body, and status
46
+ * @throws {AuthError} When the request times out or response parsing fails
47
+ * @throws {NetworkError} When the network request fails
326
48
  */
327
49
  async sendPostRequestAsync(url, options) {
328
- if (this.proxyUrl) {
329
- return this.networkRequestViaProxy(HttpMethod.POST, url, options);
50
+ return this.sendRequest(url, HttpMethod.POST, options);
51
+ }
52
+ /**
53
+ * Core HTTP request implementation using native fetch API.
54
+ *
55
+ * This method handles GET and POST HTTP requests with comprehensive
56
+ * timeout support and error handling. The timeout mechanism works as follows:
57
+ *
58
+ * 1. An AbortController is created for each request
59
+ * 2. If a timeout is specified, setTimeout is used to call abort() after the delay
60
+ * 3. The abort signal is passed to fetch, which will reject the promise if aborted
61
+ * 4. Cleanup occurs in both success and error cases to prevent timer leaks
62
+ *
63
+ * Error handling priority:
64
+ * 1. Timeout errors (AbortError) are converted to "Request timeout" messages
65
+ * 2. Network/connection errors are wrapped with "Network request failed" prefix
66
+ * 3. JSON parsing errors are wrapped with "Failed to parse response" prefix
67
+ *
68
+ * @param url - The target URL for the request
69
+ * @param method - HTTP method (GET or POST)
70
+ * @param options - Optional request configuration (headers, body)
71
+ * @param timeout - Optional timeout in milliseconds for request cancellation
72
+ * @returns Promise resolving to NetworkResponse with parsed JSON body
73
+ * @throws {AuthError} For timeouts or JSON parsing errors
74
+ * @throws {NetworkError} For network failures
75
+ */
76
+ async sendRequest(url, method, options, timeout) {
77
+ /*
78
+ * Setup timeout mechanism using AbortController
79
+ * This provides a standard way to cancel fetch requests
80
+ */
81
+ const controller = new AbortController();
82
+ let timeoutId;
83
+ /*
84
+ * Configure timeout if specified
85
+ * The setTimeout will trigger abort() if the request takes too long
86
+ */
87
+ if (timeout) {
88
+ timeoutId = setTimeout(() => {
89
+ // Calling abort() will cause fetch to reject with AbortError
90
+ controller.abort();
91
+ }, timeout);
92
+ }
93
+ const fetchOptions = {
94
+ method: method,
95
+ headers: getFetchHeaders(options),
96
+ signal: controller.signal, // Enable cancellation via AbortController
97
+ };
98
+ if (method === HttpMethod.POST) {
99
+ fetchOptions.body = options?.body || "";
330
100
  }
331
- else {
332
- return this.networkRequestViaHttps(HttpMethod.POST, url, options);
101
+ let response;
102
+ try {
103
+ response = await fetch(url, fetchOptions);
333
104
  }
105
+ catch (error) {
106
+ // Clean up timeout to prevent memory leaks
107
+ if (timeoutId) {
108
+ clearTimeout(timeoutId);
109
+ }
110
+ if (error instanceof Error && error.name === "AbortError") {
111
+ throw createAuthError(ClientAuthErrorCodes.networkError, "Request timeout");
112
+ }
113
+ const baseAuthError = createAuthError(ClientAuthErrorCodes.networkError, `Network request failed: ${error instanceof Error ? error.message : "unknown"}`);
114
+ throw createNetworkError(baseAuthError, undefined, undefined, error instanceof Error ? error : undefined);
115
+ }
116
+ // Clean up timeout to prevent memory leaks
117
+ if (timeoutId) {
118
+ clearTimeout(timeoutId);
119
+ }
120
+ try {
121
+ return {
122
+ headers: getHeaderDict(response.headers),
123
+ body: (await response.json()),
124
+ status: response.status,
125
+ };
126
+ }
127
+ catch (error) {
128
+ throw createAuthError(ClientAuthErrorCodes.tokenParsingError, `Failed to parse response: ${error instanceof Error ? error.message : "unknown"}`);
129
+ }
130
+ }
131
+ }
132
+ /**
133
+ * Converts a fetch Headers object to a plain JavaScript object.
134
+ *
135
+ * The fetch API returns headers as a Headers object with methods like get(), has(),
136
+ * etc. However, the rest of the MSAL codebase expects headers as a simple key-value
137
+ * object. This function performs that conversion.
138
+ *
139
+ * @param headers - The Headers object returned by fetch response
140
+ * @returns A plain object with header names as keys and values as strings
141
+ */
142
+ function getHeaderDict(headers) {
143
+ const headerDict = {};
144
+ headers.forEach((value, key) => {
145
+ headerDict[key] = value;
146
+ });
147
+ return headerDict;
148
+ }
149
+ /**
150
+ * Converts NetworkRequestOptions headers to a fetch-compatible Headers object.
151
+ *
152
+ * The MSAL library uses plain objects for headers in NetworkRequestOptions,
153
+ * but the fetch API expects either a Headers object, plain object, or array
154
+ * of arrays. Using the Headers constructor provides better compatibility
155
+ * and validation.
156
+ *
157
+ * @param options - Optional NetworkRequestOptions containing headers
158
+ * @returns A Headers object ready for use with fetch API
159
+ */
160
+ function getFetchHeaders(options) {
161
+ const headers = new Headers();
162
+ if (!(options && options.headers)) {
163
+ return headers;
334
164
  }
165
+ Object.entries(options.headers).forEach(([key, value]) => {
166
+ headers.append(key, value);
167
+ });
168
+ return headers;
335
169
  }
336
170
 
337
171
  export { HttpClient };
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClient.mjs","sources":["../../src/network/HttpClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAAA;;;AAGG;AAgBH;;AAEG;MACU,UAAU,CAAA;AAMnB,IAAA,WAAA,CACI,QAAiB,EACjB,kBAA2D,EAC3D,aAA6B,EAAA;QAoDzB,IAAsB,CAAA,sBAAA,GAAG,CAC7B,UAAkB,EAClB,oBAA4B,EAC5B,OAA+B,EAC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C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAE9C,OAAO,CAAC,OAAO,CAAC,CAAC,KAAa,EAAE,GAAW,KAAI;AAC3C,QAAA,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC5B,KAAC,CAAC,CAAC;AAEH,IAAA,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;;;;;AAUG;AACH,SAAS,eAAe,CAAC,OAA+B,EAAA;AACpD,IAAA,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,IAAI,EAAE,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;AAC/B,QAAA,OAAO,OAAO,CAAC;AAClB,KAAA;AAED,IAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AACrD,QAAA,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC/B,KAAC,CAAC,CAAC;AAEH,IAAA,OAAO,OAAO,CAAC;AACnB;;;;"}
@@ -1,6 +1,6 @@
1
- /*! @azure/msal-node v3.8.4 2025-12-04 */
1
+ /*! @azure/msal-node v5.0.0-beta.0 2025-12-05 */
2
2
  'use strict';
3
- import { HeaderNames } from '@azure/msal-common/node';
3
+ import { Constants } from '@azure/msal-common/node';
4
4
  import { HttpMethod } from '../utils/Constants.mjs';
5
5
 
6
6
  /*
@@ -28,7 +28,7 @@ class HttpClientWithRetries {
28
28
  this.retryPolicy.isNewRequest = true;
29
29
  }
30
30
  let currentRetry = 0;
31
- while (await this.retryPolicy.pauseForRetry(response.status, currentRetry, this.logger, response.headers[HeaderNames.RETRY_AFTER])) {
31
+ while (await this.retryPolicy.pauseForRetry(response.status, currentRetry, this.logger, response.headers[Constants.HeaderNames.RETRY_AFTER])) {
32
32
  response = await this.sendNetworkRequestAsyncHelper(httpMethod, url, options);
33
33
  currentRetry++;
34
34
  }