@azure/msal-node 2.11.1 → 2.13.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 (200) hide show
  1. package/dist/cache/ITokenCache.d.ts +15 -15
  2. package/dist/cache/NodeStorage.cjs +425 -423
  3. package/dist/cache/NodeStorage.cjs.map +1 -1
  4. package/dist/cache/NodeStorage.d.ts +193 -193
  5. package/dist/cache/NodeStorage.mjs +423 -423
  6. package/dist/cache/TokenCache.cjs +267 -265
  7. package/dist/cache/TokenCache.cjs.map +1 -1
  8. package/dist/cache/TokenCache.d.ts +90 -90
  9. package/dist/cache/TokenCache.mjs +265 -265
  10. package/dist/cache/distributed/DistributedCachePlugin.cjs +28 -26
  11. package/dist/cache/distributed/DistributedCachePlugin.cjs.map +1 -1
  12. package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
  13. package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
  14. package/dist/cache/distributed/ICacheClient.d.ts +17 -17
  15. package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
  16. package/dist/cache/serializer/Deserializer.cjs +169 -167
  17. package/dist/cache/serializer/Deserializer.cjs.map +1 -1
  18. package/dist/cache/serializer/Deserializer.d.ts +42 -42
  19. package/dist/cache/serializer/Deserializer.mjs +167 -167
  20. package/dist/cache/serializer/Serializer.cjs +139 -137
  21. package/dist/cache/serializer/Serializer.cjs.map +1 -1
  22. package/dist/cache/serializer/Serializer.d.ts +39 -39
  23. package/dist/cache/serializer/Serializer.mjs +137 -137
  24. package/dist/cache/serializer/SerializerTypes.d.ts +102 -102
  25. package/dist/client/ClientApplication.cjs +336 -334
  26. package/dist/client/ClientApplication.cjs.map +1 -1
  27. package/dist/client/ClientApplication.d.ts +143 -143
  28. package/dist/client/ClientApplication.mjs +334 -334
  29. package/dist/client/ClientAssertion.cjs +149 -143
  30. package/dist/client/ClientAssertion.cjs.map +1 -1
  31. package/dist/client/ClientAssertion.d.ts +55 -55
  32. package/dist/client/ClientAssertion.mjs +143 -143
  33. package/dist/client/ClientCredentialClient.cjs +196 -194
  34. package/dist/client/ClientCredentialClient.cjs.map +1 -1
  35. package/dist/client/ClientCredentialClient.d.ts +33 -33
  36. package/dist/client/ClientCredentialClient.mjs +194 -194
  37. package/dist/client/ConfidentialClientApplication.cjs +170 -169
  38. package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
  39. package/dist/client/ConfidentialClientApplication.d.ts +58 -58
  40. package/dist/client/ConfidentialClientApplication.mjs +168 -169
  41. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  42. package/dist/client/DeviceCodeClient.cjs +209 -207
  43. package/dist/client/DeviceCodeClient.cjs.map +1 -1
  44. package/dist/client/DeviceCodeClient.d.ts +53 -53
  45. package/dist/client/DeviceCodeClient.mjs +207 -207
  46. package/dist/client/IConfidentialClientApplication.d.ts +39 -39
  47. package/dist/client/IPublicClientApplication.d.ts +42 -42
  48. package/dist/client/ManagedIdentityApplication.cjs +86 -84
  49. package/dist/client/ManagedIdentityApplication.cjs.map +1 -1
  50. package/dist/client/ManagedIdentityApplication.d.ts +30 -30
  51. package/dist/client/ManagedIdentityApplication.mjs +84 -84
  52. package/dist/client/ManagedIdentityClient.cjs +62 -60
  53. package/dist/client/ManagedIdentityClient.cjs.map +1 -1
  54. package/dist/client/ManagedIdentityClient.d.ts +27 -27
  55. package/dist/client/ManagedIdentityClient.mjs +60 -60
  56. package/dist/client/ManagedIdentitySources/AppService.cjs +47 -45
  57. package/dist/client/ManagedIdentitySources/AppService.cjs.map +1 -1
  58. package/dist/client/ManagedIdentitySources/AppService.d.ts +17 -17
  59. package/dist/client/ManagedIdentitySources/AppService.mjs +46 -46
  60. package/dist/client/ManagedIdentitySources/AzureArc.cjs +161 -120
  61. package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +1 -1
  62. package/dist/client/ManagedIdentitySources/AzureArc.d.ts +27 -23
  63. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  64. package/dist/client/ManagedIdentitySources/AzureArc.mjs +155 -122
  65. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  66. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +124 -122
  67. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +1 -1
  68. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +30 -30
  69. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +122 -122
  70. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  71. package/dist/client/ManagedIdentitySources/CloudShell.cjs +40 -38
  72. package/dist/client/ManagedIdentitySources/CloudShell.cjs.map +1 -1
  73. package/dist/client/ManagedIdentitySources/CloudShell.d.ts +16 -16
  74. package/dist/client/ManagedIdentitySources/CloudShell.mjs +39 -39
  75. package/dist/client/ManagedIdentitySources/Imds.cjs +45 -43
  76. package/dist/client/ManagedIdentitySources/Imds.cjs.map +1 -1
  77. package/dist/client/ManagedIdentitySources/Imds.d.ts +12 -12
  78. package/dist/client/ManagedIdentitySources/Imds.mjs +44 -44
  79. package/dist/client/ManagedIdentitySources/ServiceFabric.cjs +56 -54
  80. package/dist/client/ManagedIdentitySources/ServiceFabric.cjs.map +1 -1
  81. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +17 -17
  82. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +55 -55
  83. package/dist/client/OnBehalfOfClient.cjs +204 -202
  84. package/dist/client/OnBehalfOfClient.cjs.map +1 -1
  85. package/dist/client/OnBehalfOfClient.d.ts +47 -47
  86. package/dist/client/OnBehalfOfClient.mjs +202 -202
  87. package/dist/client/PublicClientApplication.cjs +240 -229
  88. package/dist/client/PublicClientApplication.cjs.map +1 -1
  89. package/dist/client/PublicClientApplication.d.ts +72 -71
  90. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  91. package/dist/client/PublicClientApplication.mjs +240 -231
  92. package/dist/client/PublicClientApplication.mjs.map +1 -1
  93. package/dist/client/UsernamePasswordClient.cjs +97 -95
  94. package/dist/client/UsernamePasswordClient.cjs.map +1 -1
  95. package/dist/client/UsernamePasswordClient.d.ts +25 -25
  96. package/dist/client/UsernamePasswordClient.mjs +95 -95
  97. package/dist/config/Configuration.cjs +108 -106
  98. package/dist/config/Configuration.cjs.map +1 -1
  99. package/dist/config/Configuration.d.ts +131 -131
  100. package/dist/config/Configuration.mjs +106 -106
  101. package/dist/config/ManagedIdentityId.cjs +50 -48
  102. package/dist/config/ManagedIdentityId.cjs.map +1 -1
  103. package/dist/config/ManagedIdentityId.d.ts +11 -11
  104. package/dist/config/ManagedIdentityId.mjs +48 -48
  105. package/dist/config/ManagedIdentityRequestParameters.cjs +30 -28
  106. package/dist/config/ManagedIdentityRequestParameters.cjs.map +1 -1
  107. package/dist/config/ManagedIdentityRequestParameters.d.ts +11 -11
  108. package/dist/config/ManagedIdentityRequestParameters.mjs +28 -28
  109. package/dist/crypto/CryptoProvider.cjs +91 -89
  110. package/dist/crypto/CryptoProvider.cjs.map +1 -1
  111. package/dist/crypto/CryptoProvider.d.ts +62 -62
  112. package/dist/crypto/CryptoProvider.mjs +89 -89
  113. package/dist/crypto/GuidGenerator.cjs +24 -22
  114. package/dist/crypto/GuidGenerator.cjs.map +1 -1
  115. package/dist/crypto/GuidGenerator.d.ts +14 -14
  116. package/dist/crypto/GuidGenerator.mjs +22 -22
  117. package/dist/crypto/HashUtils.cjs +19 -13
  118. package/dist/crypto/HashUtils.cjs.map +1 -1
  119. package/dist/crypto/HashUtils.d.ts +8 -8
  120. package/dist/crypto/HashUtils.mjs +13 -13
  121. package/dist/crypto/PkceGenerator.cjs +55 -49
  122. package/dist/crypto/PkceGenerator.cjs.map +1 -1
  123. package/dist/crypto/PkceGenerator.d.ts +22 -22
  124. package/dist/crypto/PkceGenerator.mjs +49 -49
  125. package/dist/error/ManagedIdentityError.cjs +43 -41
  126. package/dist/error/ManagedIdentityError.cjs.map +1 -1
  127. package/dist/error/ManagedIdentityError.d.ts +30 -30
  128. package/dist/error/ManagedIdentityError.mjs +41 -41
  129. package/dist/error/ManagedIdentityErrorCodes.cjs +26 -24
  130. package/dist/error/ManagedIdentityErrorCodes.cjs.map +1 -1
  131. package/dist/error/ManagedIdentityErrorCodes.d.ts +22 -22
  132. package/dist/error/ManagedIdentityErrorCodes.mjs +24 -24
  133. package/dist/error/NodeAuthError.cjs +97 -95
  134. package/dist/error/NodeAuthError.cjs.map +1 -1
  135. package/dist/error/NodeAuthError.d.ts +73 -73
  136. package/dist/error/NodeAuthError.mjs +95 -95
  137. package/dist/index.cjs +3 -1
  138. package/dist/index.cjs.map +1 -1
  139. package/dist/index.d.ts +45 -45
  140. package/dist/index.mjs +1 -1
  141. package/dist/internals.cjs +6 -8
  142. package/dist/internals.cjs.map +1 -1
  143. package/dist/internals.d.ts +6 -6
  144. package/dist/internals.mjs +4 -8
  145. package/dist/internals.mjs.map +1 -1
  146. package/dist/network/HttpClient.cjs +288 -281
  147. package/dist/network/HttpClient.cjs.map +1 -1
  148. package/dist/network/HttpClient.d.ts +25 -25
  149. package/dist/network/HttpClient.mjs +281 -281
  150. package/dist/network/HttpClientWithRetries.cjs +36 -34
  151. package/dist/network/HttpClientWithRetries.cjs.map +1 -1
  152. package/dist/network/HttpClientWithRetries.d.ts +11 -11
  153. package/dist/network/HttpClientWithRetries.mjs +34 -34
  154. package/dist/network/ILoopbackClient.d.ts +10 -10
  155. package/dist/network/LoopbackClient.cjs +87 -77
  156. package/dist/network/LoopbackClient.cjs.map +1 -1
  157. package/dist/network/LoopbackClient.d.ts +21 -21
  158. package/dist/network/LoopbackClient.d.ts.map +1 -1
  159. package/dist/network/LoopbackClient.mjs +81 -77
  160. package/dist/network/LoopbackClient.mjs.map +1 -1
  161. package/dist/packageMetadata.cjs +6 -4
  162. package/dist/packageMetadata.cjs.map +1 -1
  163. package/dist/packageMetadata.d.ts +2 -2
  164. package/dist/packageMetadata.mjs +4 -4
  165. package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
  166. package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
  167. package/dist/request/ClientCredentialRequest.d.ts +14 -14
  168. package/dist/request/DeviceCodeRequest.d.ts +15 -15
  169. package/dist/request/InteractiveRequest.d.ts +22 -22
  170. package/dist/request/ManagedIdentityRequest.d.ts +8 -8
  171. package/dist/request/ManagedIdentityRequestParams.d.ts +9 -9
  172. package/dist/request/OnBehalfOfRequest.d.ts +14 -14
  173. package/dist/request/RefreshTokenRequest.d.ts +17 -17
  174. package/dist/request/SignOutRequest.d.ts +5 -5
  175. package/dist/request/SilentFlowRequest.d.ts +16 -16
  176. package/dist/request/UsernamePasswordRequest.d.ts +19 -19
  177. package/dist/response/ManagedIdentityTokenResponse.d.ts +34 -34
  178. package/dist/retry/IHttpRetryPolicy.d.ts +5 -5
  179. package/dist/retry/LinearRetryPolicy.cjs +42 -40
  180. package/dist/retry/LinearRetryPolicy.cjs.map +1 -1
  181. package/dist/retry/LinearRetryPolicy.d.ts +11 -11
  182. package/dist/retry/LinearRetryPolicy.mjs +40 -40
  183. package/dist/utils/Constants.cjs +138 -136
  184. package/dist/utils/Constants.cjs.map +1 -1
  185. package/dist/utils/Constants.d.ts +141 -141
  186. package/dist/utils/Constants.mjs +136 -136
  187. package/dist/utils/EncodingUtils.cjs +46 -44
  188. package/dist/utils/EncodingUtils.cjs.map +1 -1
  189. package/dist/utils/EncodingUtils.d.ts +26 -26
  190. package/dist/utils/EncodingUtils.mjs +44 -44
  191. package/dist/utils/NetworkUtils.cjs +40 -38
  192. package/dist/utils/NetworkUtils.cjs.map +1 -1
  193. package/dist/utils/NetworkUtils.d.ts +5 -5
  194. package/dist/utils/NetworkUtils.mjs +38 -38
  195. package/package.json +2 -2
  196. package/src/client/ConfidentialClientApplication.ts +3 -3
  197. package/src/client/ManagedIdentitySources/AzureArc.ts +80 -25
  198. package/src/client/PublicClientApplication.ts +13 -1
  199. package/src/network/LoopbackClient.ts +6 -0
  200. package/src/packageMetadata.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClientWithRetries.cjs","sources":["../../src/network/HttpClientWithRetries.ts"],"sourcesContent":[null],"names":["HttpMethod","HeaderNames"],"mappings":";;;;;;;AAAA;;;AAGG;MAWU,qBAAqB,CAAA;IAI9B,WACI,CAAA,mBAAmC,EACnC,WAA6B,EAAA;AAE7B,QAAA,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AAC/C,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;KAClC;AAEO,IAAA,MAAM,6BAA6B,CACvC,UAAsB,EACtB,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,IAAI,UAAU,KAAKA,oBAAU,CAAC,GAAG,EAAE;YAC/B,OAAO,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACrE,SAAA;AAAM,aAAA;YACH,OAAO,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACtE,SAAA;KACJ;AAEO,IAAA,MAAM,uBAAuB,CACjC,UAAsB,EACtB,GAAW,EACX,OAA+B,EAAA;;AAG/B,QAAA,IAAI,QAAQ,GACR,MAAM,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAEvE,IAAI,YAAY,GAAW,CAAC,CAAC;QAC7B,OACI,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAChC,QAAQ,CAAC,MAAM,EACf,YAAY,EACZ,QAAQ,CAAC,OAAO,CAACC,sBAAW,CAAC,WAAW,CAAC,CAC5C,EACH;AACE,YAAA,QAAQ,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAC/C,UAAU,EACV,GAAG,EACH,OAAO,CACV,CAAC;AACF,YAAA,YAAY,EAAE,CAAC;AAClB,SAAA;AAED,QAAA,OAAO,QAAQ,CAAC;KACnB;AAEM,IAAA,MAAM,mBAAmB,CAC5B,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,uBAAuB,CAACD,oBAAU,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;KACrE;AAEM,IAAA,MAAM,oBAAoB,CAC7B,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,uBAAuB,CAACA,oBAAU,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;KACtE;AACJ;;;;"}
1
+ {"version":3,"file":"HttpClientWithRetries.cjs","sources":["../../src/network/HttpClientWithRetries.ts"],"sourcesContent":[null],"names":["HttpMethod","HeaderNames"],"mappings":";;;;;;;;;AAAA;;;AAGG;MAWU,qBAAqB,CAAA;IAI9B,WACI,CAAA,mBAAmC,EACnC,WAA6B,EAAA;AAE7B,QAAA,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AAC/C,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;KAClC;AAEO,IAAA,MAAM,6BAA6B,CACvC,UAAsB,EACtB,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,IAAI,UAAU,KAAKA,oBAAU,CAAC,GAAG,EAAE;YAC/B,OAAO,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACrE,SAAA;AAAM,aAAA;YACH,OAAO,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACtE,SAAA;KACJ;AAEO,IAAA,MAAM,uBAAuB,CACjC,UAAsB,EACtB,GAAW,EACX,OAA+B,EAAA;;AAG/B,QAAA,IAAI,QAAQ,GACR,MAAM,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAEvE,IAAI,YAAY,GAAW,CAAC,CAAC;QAC7B,OACI,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAChC,QAAQ,CAAC,MAAM,EACf,YAAY,EACZ,QAAQ,CAAC,OAAO,CAACC,sBAAW,CAAC,WAAW,CAAC,CAC5C,EACH;AACE,YAAA,QAAQ,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAC/C,UAAU,EACV,GAAG,EACH,OAAO,CACV,CAAC;AACF,YAAA,YAAY,EAAE,CAAC;AAClB,SAAA;AAED,QAAA,OAAO,QAAQ,CAAC;KACnB;AAEM,IAAA,MAAM,mBAAmB,CAC5B,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,uBAAuB,CAACD,oBAAU,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;KACrE;AAEM,IAAA,MAAM,oBAAoB,CAC7B,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,uBAAuB,CAACA,oBAAU,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;KACtE;AACJ;;;;"}
@@ -1,12 +1,12 @@
1
- import { INetworkModule, NetworkRequestOptions, NetworkResponse } from "@azure/msal-common";
2
- import { IHttpRetryPolicy } from "../retry/IHttpRetryPolicy";
3
- export declare class HttpClientWithRetries implements INetworkModule {
4
- private httpClientNoRetries;
5
- private retryPolicy;
6
- constructor(httpClientNoRetries: INetworkModule, retryPolicy: IHttpRetryPolicy);
7
- private sendNetworkRequestAsyncHelper;
8
- private sendNetworkRequestAsync;
9
- sendGetRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
10
- sendPostRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
11
- }
1
+ import { INetworkModule, NetworkRequestOptions, NetworkResponse } from "@azure/msal-common";
2
+ import { IHttpRetryPolicy } from "../retry/IHttpRetryPolicy";
3
+ export declare class HttpClientWithRetries implements INetworkModule {
4
+ private httpClientNoRetries;
5
+ private retryPolicy;
6
+ constructor(httpClientNoRetries: INetworkModule, retryPolicy: IHttpRetryPolicy);
7
+ private sendNetworkRequestAsyncHelper;
8
+ private sendNetworkRequestAsync;
9
+ sendGetRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
10
+ sendPostRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
11
+ }
12
12
  //# sourceMappingURL=HttpClientWithRetries.d.ts.map
@@ -1,41 +1,41 @@
1
- /*! @azure/msal-node v2.11.1 2024-07-16 */
1
+ /*! @azure/msal-node v2.13.0 2024-08-13 */
2
2
  'use strict';
3
3
  import { HeaderNames } from '@azure/msal-common';
4
4
  import { HttpMethod } from '../utils/Constants.mjs';
5
5
 
6
- /*
7
- * Copyright (c) Microsoft Corporation. All rights reserved.
8
- * Licensed under the MIT License.
9
- */
10
- class HttpClientWithRetries {
11
- constructor(httpClientNoRetries, retryPolicy) {
12
- this.httpClientNoRetries = httpClientNoRetries;
13
- this.retryPolicy = retryPolicy;
14
- }
15
- async sendNetworkRequestAsyncHelper(httpMethod, url, options) {
16
- if (httpMethod === HttpMethod.GET) {
17
- return this.httpClientNoRetries.sendGetRequestAsync(url, options);
18
- }
19
- else {
20
- return this.httpClientNoRetries.sendPostRequestAsync(url, options);
21
- }
22
- }
23
- async sendNetworkRequestAsync(httpMethod, url, options) {
24
- // the underlying network module (custom or HttpClient) will make the call
25
- let response = await this.sendNetworkRequestAsyncHelper(httpMethod, url, options);
26
- let currentRetry = 0;
27
- while (await this.retryPolicy.pauseForRetry(response.status, currentRetry, response.headers[HeaderNames.RETRY_AFTER])) {
28
- response = await this.sendNetworkRequestAsyncHelper(httpMethod, url, options);
29
- currentRetry++;
30
- }
31
- return response;
32
- }
33
- async sendGetRequestAsync(url, options) {
34
- return this.sendNetworkRequestAsync(HttpMethod.GET, url, options);
35
- }
36
- async sendPostRequestAsync(url, options) {
37
- return this.sendNetworkRequestAsync(HttpMethod.POST, url, options);
38
- }
6
+ /*
7
+ * Copyright (c) Microsoft Corporation. All rights reserved.
8
+ * Licensed under the MIT License.
9
+ */
10
+ class HttpClientWithRetries {
11
+ constructor(httpClientNoRetries, retryPolicy) {
12
+ this.httpClientNoRetries = httpClientNoRetries;
13
+ this.retryPolicy = retryPolicy;
14
+ }
15
+ async sendNetworkRequestAsyncHelper(httpMethod, url, options) {
16
+ if (httpMethod === HttpMethod.GET) {
17
+ return this.httpClientNoRetries.sendGetRequestAsync(url, options);
18
+ }
19
+ else {
20
+ return this.httpClientNoRetries.sendPostRequestAsync(url, options);
21
+ }
22
+ }
23
+ async sendNetworkRequestAsync(httpMethod, url, options) {
24
+ // the underlying network module (custom or HttpClient) will make the call
25
+ let response = await this.sendNetworkRequestAsyncHelper(httpMethod, url, options);
26
+ let currentRetry = 0;
27
+ while (await this.retryPolicy.pauseForRetry(response.status, currentRetry, response.headers[HeaderNames.RETRY_AFTER])) {
28
+ response = await this.sendNetworkRequestAsyncHelper(httpMethod, url, options);
29
+ currentRetry++;
30
+ }
31
+ return response;
32
+ }
33
+ async sendGetRequestAsync(url, options) {
34
+ return this.sendNetworkRequestAsync(HttpMethod.GET, url, options);
35
+ }
36
+ async sendPostRequestAsync(url, options) {
37
+ return this.sendNetworkRequestAsync(HttpMethod.POST, url, options);
38
+ }
39
39
  }
40
40
 
41
41
  export { HttpClientWithRetries };
@@ -1,11 +1,11 @@
1
- import { ServerAuthorizationCodeResponse } from "@azure/msal-common";
2
- /**
3
- * Interface for LoopbackClient allowing to replace the default loopback server with a custom implementation.
4
- * @public
5
- */
6
- export interface ILoopbackClient {
7
- listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<ServerAuthorizationCodeResponse>;
8
- getRedirectUri(): string;
9
- closeServer(): void;
10
- }
1
+ import { ServerAuthorizationCodeResponse } from "@azure/msal-common";
2
+ /**
3
+ * Interface for LoopbackClient allowing to replace the default loopback server with a custom implementation.
4
+ * @public
5
+ */
6
+ export interface ILoopbackClient {
7
+ listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<ServerAuthorizationCodeResponse>;
8
+ getRedirectUri(): string;
9
+ closeServer(): void;
10
+ }
11
11
  //# sourceMappingURL=ILoopbackClient.d.ts.map
@@ -1,88 +1,98 @@
1
- /*! @azure/msal-node v2.11.1 2024-07-16 */
1
+ /*! @azure/msal-node v2.13.0 2024-08-13 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
+ Object.defineProperty(exports, '__esModule', { value: true });
6
+
5
7
  var msalCommon = require('@azure/msal-common');
6
8
  var http = require('http');
7
9
  var NodeAuthError = require('../error/NodeAuthError.cjs');
8
10
  var Constants = require('../utils/Constants.cjs');
9
11
 
10
- /*
11
- * Copyright (c) Microsoft Corporation. All rights reserved.
12
- * Licensed under the MIT License.
13
- */
14
- class LoopbackClient {
15
- /**
16
- * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
17
- * @param successTemplate
18
- * @param errorTemplate
19
- * @returns
20
- */
21
- async listenForAuthCode(successTemplate, errorTemplate) {
22
- if (this.server) {
23
- throw NodeAuthError.NodeAuthError.createLoopbackServerAlreadyExistsError();
24
- }
25
- return new Promise((resolve, reject) => {
26
- this.server = http.createServer((req, res) => {
27
- const url = req.url;
28
- if (!url) {
29
- res.end(errorTemplate ||
30
- "Error occurred loading redirectUrl");
31
- reject(NodeAuthError.NodeAuthError.createUnableToLoadRedirectUrlError());
32
- return;
33
- }
34
- else if (url === msalCommon.Constants.FORWARD_SLASH) {
35
- res.end(successTemplate ||
36
- "Auth code was successfully acquired. You can close this window now.");
37
- return;
38
- }
39
- const redirectUri = this.getRedirectUri();
40
- const parsedUrl = new URL(url, redirectUri);
41
- const authCodeResponse = msalCommon.UrlUtils.getDeserializedResponse(parsedUrl.search) || {};
42
- if (authCodeResponse.code) {
43
- res.writeHead(msalCommon.HttpStatus.REDIRECT, {
44
- location: redirectUri,
45
- }); // Prevent auth code from being saved in the browser history
46
- res.end();
47
- }
48
- resolve(authCodeResponse);
49
- });
50
- this.server.listen(0); // Listen on any available port
51
- });
52
- }
53
- /**
54
- * Get the port that the loopback server is running on
55
- * @returns
56
- */
57
- getRedirectUri() {
58
- if (!this.server || !this.server.listening) {
59
- throw NodeAuthError.NodeAuthError.createNoLoopbackServerExistsError();
60
- }
61
- const address = this.server.address();
62
- if (!address || typeof address === "string" || !address.port) {
63
- this.closeServer();
64
- throw NodeAuthError.NodeAuthError.createInvalidLoopbackAddressTypeError();
65
- }
66
- const port = address && address.port;
67
- return `${Constants.Constants.HTTP_PROTOCOL}${Constants.Constants.LOCALHOST}:${port}`;
68
- }
69
- /**
70
- * Close the loopback server
71
- */
72
- closeServer() {
73
- if (this.server) {
74
- // Only stops accepting new connections, server will close once open/idle connections are closed.
75
- this.server.close();
76
- if (typeof this.server.closeAllConnections === "function") {
77
- /*
78
- * Close open/idle connections. This API is available in Node versions 18.2 and higher
79
- */
80
- this.server.closeAllConnections();
81
- }
82
- this.server.unref();
83
- this.server = undefined;
84
- }
85
- }
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
15
+
16
+ /*
17
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18
+ * Licensed under the MIT License.
19
+ */
20
+ class LoopbackClient {
21
+ /**
22
+ * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
23
+ * @param successTemplate
24
+ * @param errorTemplate
25
+ * @returns
26
+ */
27
+ async listenForAuthCode(successTemplate, errorTemplate) {
28
+ if (this.server) {
29
+ throw NodeAuthError.NodeAuthError.createLoopbackServerAlreadyExistsError();
30
+ }
31
+ return new Promise((resolve, reject) => {
32
+ this.server = http__default["default"].createServer((req, res) => {
33
+ const url = req.url;
34
+ if (!url) {
35
+ res.end(errorTemplate ||
36
+ "Error occurred loading redirectUrl");
37
+ reject(NodeAuthError.NodeAuthError.createUnableToLoadRedirectUrlError());
38
+ return;
39
+ }
40
+ else if (url === msalCommon.Constants.FORWARD_SLASH) {
41
+ res.end(successTemplate ||
42
+ "Auth code was successfully acquired. You can close this window now.");
43
+ return;
44
+ }
45
+ const redirectUri = this.getRedirectUri();
46
+ const parsedUrl = new URL(url, redirectUri);
47
+ const authCodeResponse = msalCommon.UrlUtils.getDeserializedResponse(parsedUrl.search) || {};
48
+ if (authCodeResponse.code) {
49
+ res.writeHead(msalCommon.HttpStatus.REDIRECT, {
50
+ location: redirectUri,
51
+ }); // Prevent auth code from being saved in the browser history
52
+ res.end();
53
+ }
54
+ if (authCodeResponse.error) {
55
+ res.end(errorTemplate ||
56
+ `Error occurred: ${authCodeResponse.error}`);
57
+ }
58
+ resolve(authCodeResponse);
59
+ });
60
+ this.server.listen(0); // Listen on any available port
61
+ });
62
+ }
63
+ /**
64
+ * Get the port that the loopback server is running on
65
+ * @returns
66
+ */
67
+ getRedirectUri() {
68
+ if (!this.server || !this.server.listening) {
69
+ throw NodeAuthError.NodeAuthError.createNoLoopbackServerExistsError();
70
+ }
71
+ const address = this.server.address();
72
+ if (!address || typeof address === "string" || !address.port) {
73
+ this.closeServer();
74
+ throw NodeAuthError.NodeAuthError.createInvalidLoopbackAddressTypeError();
75
+ }
76
+ const port = address && address.port;
77
+ return `${Constants.Constants.HTTP_PROTOCOL}${Constants.Constants.LOCALHOST}:${port}`;
78
+ }
79
+ /**
80
+ * Close the loopback server
81
+ */
82
+ closeServer() {
83
+ if (this.server) {
84
+ // Only stops accepting new connections, server will close once open/idle connections are closed.
85
+ this.server.close();
86
+ if (typeof this.server.closeAllConnections === "function") {
87
+ /*
88
+ * Close open/idle connections. This API is available in Node versions 18.2 and higher
89
+ */
90
+ this.server.closeAllConnections();
91
+ }
92
+ this.server.unref();
93
+ this.server = undefined;
94
+ }
95
+ }
86
96
  }
87
97
 
88
98
  exports.LoopbackClient = LoopbackClient;
@@ -1 +1 @@
1
- {"version":3,"file":"LoopbackClient.cjs","sources":["../../src/network/LoopbackClient.ts"],"sourcesContent":[null],"names":["NodeAuthError","CommonConstants","UrlUtils","HttpStatus","Constants"],"mappings":";;;;;;;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MAAM,CAAC,mBAAmB,EAAE,CAAC;AACrC,aAAA;AACD,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;AACpB,YAAA,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3B,SAAA;KACJ;AACJ;;;;"}
@@ -1,22 +1,22 @@
1
- import { ServerAuthorizationCodeResponse } from "@azure/msal-common";
2
- import { ILoopbackClient } from "./ILoopbackClient.js";
3
- export declare class LoopbackClient implements ILoopbackClient {
4
- private server;
5
- /**
6
- * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
7
- * @param successTemplate
8
- * @param errorTemplate
9
- * @returns
10
- */
11
- listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<ServerAuthorizationCodeResponse>;
12
- /**
13
- * Get the port that the loopback server is running on
14
- * @returns
15
- */
16
- getRedirectUri(): string;
17
- /**
18
- * Close the loopback server
19
- */
20
- closeServer(): void;
21
- }
1
+ import { ServerAuthorizationCodeResponse } from "@azure/msal-common";
2
+ import { ILoopbackClient } from "./ILoopbackClient.js";
3
+ export declare class LoopbackClient implements ILoopbackClient {
4
+ private server;
5
+ /**
6
+ * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
7
+ * @param successTemplate
8
+ * @param errorTemplate
9
+ * @returns
10
+ */
11
+ listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<ServerAuthorizationCodeResponse>;
12
+ /**
13
+ * Get the port that the loopback server is running on
14
+ * @returns
15
+ */
16
+ getRedirectUri(): string;
17
+ /**
18
+ * Close the loopback server
19
+ */
20
+ closeServer(): void;
21
+ }
22
22
  //# sourceMappingURL=LoopbackClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LoopbackClient.d.ts","sourceRoot":"","sources":["../../src/network/LoopbackClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,+BAA+B,EAGlC,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBAAa,cAAe,YAAW,eAAe;IAClD,OAAO,CAAC,MAAM,CAA0B;IAExC;;;;;OAKG;IACG,iBAAiB,CACnB,eAAe,CAAC,EAAE,MAAM,EACxB,aAAa,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,+BAA+B,CAAC;IA+C3C;;;OAGG;IACH,cAAc,IAAI,MAAM;IAgBxB;;OAEG;IACH,WAAW,IAAI,IAAI;CAetB"}
1
+ {"version":3,"file":"LoopbackClient.d.ts","sourceRoot":"","sources":["../../src/network/LoopbackClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,+BAA+B,EAGlC,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBAAa,cAAe,YAAW,eAAe;IAClD,OAAO,CAAC,MAAM,CAA0B;IAExC;;;;;OAKG;IACG,iBAAiB,CACnB,eAAe,CAAC,EAAE,MAAM,EACxB,aAAa,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,+BAA+B,CAAC;IAqD3C;;;OAGG;IACH,cAAc,IAAI,MAAM;IAgBxB;;OAEG;IACH,WAAW,IAAI,IAAI;CAetB"}
@@ -1,86 +1,90 @@
1
- /*! @azure/msal-node v2.11.1 2024-07-16 */
1
+ /*! @azure/msal-node v2.13.0 2024-08-13 */
2
2
  'use strict';
3
3
  import { Constants, UrlUtils, HttpStatus } from '@azure/msal-common';
4
4
  import http from 'http';
5
5
  import { NodeAuthError } from '../error/NodeAuthError.mjs';
6
6
  import { Constants as Constants$1 } from '../utils/Constants.mjs';
7
7
 
8
- /*
9
- * Copyright (c) Microsoft Corporation. All rights reserved.
10
- * Licensed under the MIT License.
11
- */
12
- class LoopbackClient {
13
- /**
14
- * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
15
- * @param successTemplate
16
- * @param errorTemplate
17
- * @returns
18
- */
19
- async listenForAuthCode(successTemplate, errorTemplate) {
20
- if (this.server) {
21
- throw NodeAuthError.createLoopbackServerAlreadyExistsError();
22
- }
23
- return new Promise((resolve, reject) => {
24
- this.server = http.createServer((req, res) => {
25
- const url = req.url;
26
- if (!url) {
27
- res.end(errorTemplate ||
28
- "Error occurred loading redirectUrl");
29
- reject(NodeAuthError.createUnableToLoadRedirectUrlError());
30
- return;
31
- }
32
- else if (url === Constants.FORWARD_SLASH) {
33
- res.end(successTemplate ||
34
- "Auth code was successfully acquired. You can close this window now.");
35
- return;
36
- }
37
- const redirectUri = this.getRedirectUri();
38
- const parsedUrl = new URL(url, redirectUri);
39
- const authCodeResponse = UrlUtils.getDeserializedResponse(parsedUrl.search) || {};
40
- if (authCodeResponse.code) {
41
- res.writeHead(HttpStatus.REDIRECT, {
42
- location: redirectUri,
43
- }); // Prevent auth code from being saved in the browser history
44
- res.end();
45
- }
46
- resolve(authCodeResponse);
47
- });
48
- this.server.listen(0); // Listen on any available port
49
- });
50
- }
51
- /**
52
- * Get the port that the loopback server is running on
53
- * @returns
54
- */
55
- getRedirectUri() {
56
- if (!this.server || !this.server.listening) {
57
- throw NodeAuthError.createNoLoopbackServerExistsError();
58
- }
59
- const address = this.server.address();
60
- if (!address || typeof address === "string" || !address.port) {
61
- this.closeServer();
62
- throw NodeAuthError.createInvalidLoopbackAddressTypeError();
63
- }
64
- const port = address && address.port;
65
- return `${Constants$1.HTTP_PROTOCOL}${Constants$1.LOCALHOST}:${port}`;
66
- }
67
- /**
68
- * Close the loopback server
69
- */
70
- closeServer() {
71
- if (this.server) {
72
- // Only stops accepting new connections, server will close once open/idle connections are closed.
73
- this.server.close();
74
- if (typeof this.server.closeAllConnections === "function") {
75
- /*
76
- * Close open/idle connections. This API is available in Node versions 18.2 and higher
77
- */
78
- this.server.closeAllConnections();
79
- }
80
- this.server.unref();
81
- this.server = undefined;
82
- }
83
- }
8
+ /*
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License.
11
+ */
12
+ class LoopbackClient {
13
+ /**
14
+ * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
15
+ * @param successTemplate
16
+ * @param errorTemplate
17
+ * @returns
18
+ */
19
+ async listenForAuthCode(successTemplate, errorTemplate) {
20
+ if (this.server) {
21
+ throw NodeAuthError.createLoopbackServerAlreadyExistsError();
22
+ }
23
+ return new Promise((resolve, reject) => {
24
+ this.server = http.createServer((req, res) => {
25
+ const url = req.url;
26
+ if (!url) {
27
+ res.end(errorTemplate ||
28
+ "Error occurred loading redirectUrl");
29
+ reject(NodeAuthError.createUnableToLoadRedirectUrlError());
30
+ return;
31
+ }
32
+ else if (url === Constants.FORWARD_SLASH) {
33
+ res.end(successTemplate ||
34
+ "Auth code was successfully acquired. You can close this window now.");
35
+ return;
36
+ }
37
+ const redirectUri = this.getRedirectUri();
38
+ const parsedUrl = new URL(url, redirectUri);
39
+ const authCodeResponse = UrlUtils.getDeserializedResponse(parsedUrl.search) || {};
40
+ if (authCodeResponse.code) {
41
+ res.writeHead(HttpStatus.REDIRECT, {
42
+ location: redirectUri,
43
+ }); // Prevent auth code from being saved in the browser history
44
+ res.end();
45
+ }
46
+ if (authCodeResponse.error) {
47
+ res.end(errorTemplate ||
48
+ `Error occurred: ${authCodeResponse.error}`);
49
+ }
50
+ resolve(authCodeResponse);
51
+ });
52
+ this.server.listen(0); // Listen on any available port
53
+ });
54
+ }
55
+ /**
56
+ * Get the port that the loopback server is running on
57
+ * @returns
58
+ */
59
+ getRedirectUri() {
60
+ if (!this.server || !this.server.listening) {
61
+ throw NodeAuthError.createNoLoopbackServerExistsError();
62
+ }
63
+ const address = this.server.address();
64
+ if (!address || typeof address === "string" || !address.port) {
65
+ this.closeServer();
66
+ throw NodeAuthError.createInvalidLoopbackAddressTypeError();
67
+ }
68
+ const port = address && address.port;
69
+ return `${Constants$1.HTTP_PROTOCOL}${Constants$1.LOCALHOST}:${port}`;
70
+ }
71
+ /**
72
+ * Close the loopback server
73
+ */
74
+ closeServer() {
75
+ if (this.server) {
76
+ // Only stops accepting new connections, server will close once open/idle connections are closed.
77
+ this.server.close();
78
+ if (typeof this.server.closeAllConnections === "function") {
79
+ /*
80
+ * Close open/idle connections. This API is available in Node versions 18.2 and higher
81
+ */
82
+ this.server.closeAllConnections();
83
+ }
84
+ this.server.unref();
85
+ this.server = undefined;
86
+ }
87
+ }
84
88
  }
85
89
 
86
90
  export { LoopbackClient };
@@ -1 +1 @@
1
- {"version":3,"file":"LoopbackClient.mjs","sources":["../../src/network/LoopbackClient.ts"],"sourcesContent":[null],"names":["CommonConstants","Constants"],"mappings":";;;;;;;AAAA;;;AAGG;MAaU,cAAc,CAAA;AAGvB;;;;;AAKG;AACH,IAAA,MAAM,iBAAiB,CACnB,eAAwB,EACxB,aAAsB,EAAA;QAEtB,IAAI,IAAI,CAAC,MAAM,EAAE;AACb,YAAA,MAAM,aAAa,CAAC,sCAAsC,EAAE,CAAC;AAChE,SAAA;QAED,OAAO,IAAI,OAAO,CACd,CAAC,OAAO,EAAE,MAAM,KAAI;AAChB,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAC3B,CAAC,GAAyB,EAAE,GAAwB,KAAI;AACpD,gBAAA,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;gBACpB,IAAI,CAAC,GAAG,EAAE;oBACN,GAAG,CAAC,GAAG,CACH,aAAa;AACT,wBAAA,oCAAoC,CAC3C,CAAC;AACF,oBAAA,MAAM,CACF,aAAa,CAAC,kCAAkC,EAAE,CACrD,CAAC;oBACF,OAAO;AACV,iBAAA;AAAM,qBAAA,IAAI,GAAG,KAAKA,SAAe,CAAC,aAAa,EAAE;oBAC9C,GAAG,CAAC,GAAG,CACH,eAAe;AACX,wBAAA,qEAAqE,CAC5E,CAAC;oBACF,OAAO;AACV,iBAAA;AAED,gBAAA,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;gBAC1C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAC5C,gBAAA,MAAM,gBAAgB,G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AAK,UAAU,EAAE;AACvD;;AAEG;AACH,gBAAA,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;AACrC,aAAA;AACD,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;AACpB,YAAA,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3B,SAAA;KACJ;AACJ;;;;"}
1
+ {"version":3,"file":"LoopbackClient.mjs","sources":["../../src/network/LoopbackClient.ts"],"sourcesContent":[null],"names":["CommonConstants","Constants"],"mappings":";;;;;;;AAAA;;;AAGG;MAaU,cAAc,CAAA;AAGvB;;;;;AAKG;AACH,IAAA,MAAM,iBAAiB,CACnB,eAAwB,EACxB,aAAsB,EAAA;QAEtB,IAAI,IAAI,CAAC,MAAM,EAAE;AACb,YAAA,MAAM,aAAa,CAAC,sCAAsC,EAAE,CAAC;AAChE,SAAA;QAED,OAAO,IAAI,OAAO,CACd,CAAC,OAAO,EAAE,MAAM,KAAI;AAChB,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAC3B,CAAC,GAAyB,EAAE,GAAwB,KAAI;AACpD,gBAAA,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;gBACpB,IAAI,CAAC,GAAG,EAAE;oBACN,GAAG,CAAC,GAAG,CACH,aAAa;AACT,wBAAA,oCAAoC,CAC3C,CAAC;AACF,oBAAA,MAAM,CACF,aAAa,CAAC,kCAAkC,EAAE,CACrD,CAAC;oBACF,OAAO;AACV,iBAAA;AAAM,qBAAA,IAAI,GAAG,KAAKA,SAAe,CAAC,aAAa,EAAE;oBAC9C,GAAG,CAAC,GAAG,CACH,eAAe;AACX,wBAAA,qEAAqE,CAC5E,CAAC;oBACF,OAAO;AACV,iBAAA;AAED,gBAAA,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;gBAC1C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAC5C,gB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CAAC;KACrE;AAED;;AAEG;IACH,WAAW,GAAA;QACP,IAAI,IAAI,CAAC,MAAM,EAAE;;AAEb,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAEpB,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,KAAK,UAAU,EAAE;AACvD;;AAEG;AACH,gBAAA,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;AACrC,aAAA;AACD,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;AACpB,YAAA,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3B,SAAA;KACJ;AACJ;;;;"}
@@ -1,10 +1,12 @@
1
- /*! @azure/msal-node v2.11.1 2024-07-16 */
1
+ /*! @azure/msal-node v2.13.0 2024-08-13 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /* eslint-disable header/header */
6
- const name = "@azure/msal-node";
7
- const version = "2.11.1";
5
+ Object.defineProperty(exports, '__esModule', { value: true });
6
+
7
+ /* eslint-disable header/header */
8
+ const name = "@azure/msal-node";
9
+ const version = "2.13.0";
8
10
 
9
11
  exports.name = name;
10
12
  exports.version = version;
@@ -1 +1 @@
1
- {"version":3,"file":"packageMetadata.cjs","sources":["../src/packageMetadata.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;AACO,MAAM,IAAI,GAAG,mBAAmB;AAChC,MAAM,OAAO,GAAG;;;;;"}
1
+ {"version":3,"file":"packageMetadata.cjs","sources":["../src/packageMetadata.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;AACO,MAAM,IAAI,GAAG,mBAAmB;AAChC,MAAM,OAAO,GAAG;;;;;"}
@@ -1,3 +1,3 @@
1
- export declare const name = "@azure/msal-node";
2
- export declare const version = "2.11.1";
1
+ export declare const name = "@azure/msal-node";
2
+ export declare const version = "2.13.0";
3
3
  //# sourceMappingURL=packageMetadata.d.ts.map
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-node v2.11.1 2024-07-16 */
1
+ /*! @azure/msal-node v2.13.0 2024-08-13 */
2
2
  'use strict';
3
- /* eslint-disable header/header */
4
- const name = "@azure/msal-node";
5
- const version = "2.11.1";
3
+ /* eslint-disable header/header */
4
+ const name = "@azure/msal-node";
5
+ const version = "2.13.0";
6
6
 
7
7
  export { name, version };
8
8
  //# sourceMappingURL=packageMetadata.mjs.map