@azure/identity 4.1.0-alpha.20240327.2 → 4.1.0-alpha.20240328.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @azure/identity might be problematic. Click here for more details.

package/dist/index.js CHANGED
@@ -1672,6 +1672,27 @@ var RegionalAuthority;
1672
1672
  /** Uses the {@link RegionalAuthority} for the Azure 'usdodcentral' region. */
1673
1673
  RegionalAuthority["GovernmentUSDodCentral"] = "usdodcentral";
1674
1674
  })(RegionalAuthority || (RegionalAuthority = {}));
1675
+ /**
1676
+ * Calculates the correct regional authority based on the supplied value
1677
+ * and the AZURE_REGIONAL_AUTHORITY_NAME environment variable.
1678
+ *
1679
+ * Values will be returned verbatim, except for {@link RegionalAuthority.AutoDiscoverRegion}
1680
+ * which is mapped to a value MSAL can understand.
1681
+ *
1682
+ * @internal
1683
+ */
1684
+ function calculateRegionalAuthority(regionalAuthority) {
1685
+ var _a, _b;
1686
+ let azureRegion = regionalAuthority;
1687
+ if (azureRegion === undefined &&
1688
+ ((_b = (_a = globalThis.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.AZURE_REGIONAL_AUTHORITY_NAME) !== undefined) {
1689
+ azureRegion = process.env.AZURE_REGIONAL_AUTHORITY_NAME;
1690
+ }
1691
+ if (azureRegion === RegionalAuthority.AutoDiscoverRegion) {
1692
+ return "AUTO_DISCOVER";
1693
+ }
1694
+ return azureRegion;
1695
+ }
1675
1696
 
1676
1697
  // Copyright (c) Microsoft Corporation.
1677
1698
  // Licensed under the MIT license.
@@ -1686,7 +1707,7 @@ var RegionalAuthority;
1686
1707
  */
1687
1708
  class MsalNode {
1688
1709
  constructor(options) {
1689
- var _a, _b, _c, _d, _e, _f, _g;
1710
+ var _a, _b, _c, _d, _e, _f;
1690
1711
  this.app = {};
1691
1712
  this.caeApp = {};
1692
1713
  this.requiresConfidential = false;
@@ -1726,10 +1747,7 @@ class MsalNode {
1726
1747
  "`useIdentityPlugin(createNativeBrokerPlugin())` before using `enableBroker`.",
1727
1748
  ].join(" "));
1728
1749
  }
1729
- this.azureRegion = (_g = options.regionalAuthority) !== null && _g !== void 0 ? _g : process.env.AZURE_REGIONAL_AUTHORITY_NAME;
1730
- if (this.azureRegion === RegionalAuthority.AutoDiscoverRegion) {
1731
- this.azureRegion = "AUTO_DISCOVER";
1732
- }
1750
+ this.azureRegion = calculateRegionalAuthority(options.regionalAuthority);
1733
1751
  }
1734
1752
  /**
1735
1753
  * Generates a MSAL configuration that generally works for Node.js