@microsoft/vscode-azext-azureauth 6.0.0-alpha.7 → 6.0.0-alpha.8

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.
@@ -40,6 +40,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.VSCodeAzureSubscriptionProvider = void 0;
41
41
  const vscode = __importStar(require("vscode"));
42
42
  const AzureSubscriptionProviderRequestOptions_1 = require("../contracts/AzureSubscriptionProviderRequestOptions"); // eslint-disable-line @typescript-eslint/no-unused-vars -- It is used in the doc comments
43
+ const configuredAzureEnv_1 = require("../utils/configuredAzureEnv");
43
44
  const dedupeSubscriptions_1 = require("../utils/dedupeSubscriptions");
44
45
  const CaselessMap_1 = require("../utils/map/CaselessMap");
45
46
  const TwoKeyCaselessMap_1 = require("../utils/map/TwoKeyCaselessMap");
@@ -71,6 +72,13 @@ class VSCodeAzureSubscriptionProvider extends AzureSubscriptionProviderBase_1.Az
71
72
  if (e.affectsConfiguration(`${ConfigPrefix}.${SelectedSubscriptionsConfigKey}`)) {
72
73
  this.fireRefreshSuggestedIfNeeded({ reason: 'subscriptionFilterChange' });
73
74
  }
75
+ else if (e.affectsConfiguration(configuredAzureEnv_1.CustomCloudConfigurationSection)) {
76
+ this.accountCache.clear();
77
+ this.tenantCache.clear();
78
+ this.subscriptionCache.clear();
79
+ this.log('Cleared all caches due to cloud environment change');
80
+ this.fireRefreshSuggestedIfNeeded({ reason: 'cloudChange' });
81
+ }
74
82
  });
75
83
  return super.onRefreshSuggested(callback, thisArg, disposables);
76
84
  }
@@ -37,14 +37,14 @@ var __importStar = (this && this.__importStar) || (function () {
37
37
  };
38
38
  })();
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.ExtendedEnvironment = void 0;
40
+ exports.ExtendedEnvironment = exports.CustomCloudConfigurationSection = void 0;
41
41
  exports.getConfiguredAzureEnv = getConfiguredAzureEnv;
42
42
  exports.setConfiguredAzureEnv = setConfiguredAzureEnv;
43
43
  exports.getConfiguredAuthProviderId = getConfiguredAuthProviderId;
44
44
  const azureEnv = __importStar(require("@azure/ms-rest-azure-env")); // This package is so small that it's not worth lazy loading
45
45
  const vscode = __importStar(require("vscode"));
46
46
  // These strings come from https://github.com/microsoft/vscode/blob/eac16e9b63a11885b538db3e0b533a02a2fb8143/extensions/microsoft-authentication/package.json#L40-L99
47
- const CustomCloudConfigurationSection = 'microsoft-sovereign-cloud';
47
+ exports.CustomCloudConfigurationSection = 'microsoft-sovereign-cloud';
48
48
  const CloudEnvironmentSettingName = 'environment';
49
49
  const CustomEnvironmentSettingName = 'customEnvironment';
50
50
  var CloudEnvironmentSettingValue;
@@ -70,7 +70,7 @@ exports.ExtendedEnvironment = ExtendedEnvironment;
70
70
  * @returns The configured Azure environment from the settings in the built-in authentication provider extension
71
71
  */
72
72
  function getConfiguredAzureEnv() {
73
- const authProviderConfig = vscode.workspace.getConfiguration(CustomCloudConfigurationSection);
73
+ const authProviderConfig = vscode.workspace.getConfiguration(exports.CustomCloudConfigurationSection);
74
74
  const environmentSettingValue = authProviderConfig.get(CloudEnvironmentSettingName);
75
75
  if (environmentSettingValue === CloudEnvironmentSettingValue.ChinaCloud) {
76
76
  return new ExtendedEnvironment(azureEnv.Environment.ChinaCloud, false);
@@ -83,7 +83,7 @@ function getConfiguredAzureEnv() {
83
83
  if (customCloud) {
84
84
  return new ExtendedEnvironment(customCloud, true);
85
85
  }
86
- throw new Error(vscode.l10n.t('The custom cloud choice is not configured. Please configure the setting `{0}.{1}`.', CustomCloudConfigurationSection, CustomEnvironmentSettingName));
86
+ throw new Error(vscode.l10n.t('The custom cloud choice is not configured. Please configure the setting `{0}.{1}`.', exports.CustomCloudConfigurationSection, CustomEnvironmentSettingName));
87
87
  }
88
88
  return new ExtendedEnvironment(azureEnv.Environment.AzureCloud, false);
89
89
  }
@@ -96,7 +96,7 @@ function getConfiguredAzureEnv() {
96
96
  * @param target (Optional) The configuration target to use, by default {@link vscode.ConfigurationTarget.Global}.
97
97
  */
98
98
  async function setConfiguredAzureEnv(cloud, target = vscode.ConfigurationTarget.Global) {
99
- const authProviderConfig = vscode.workspace.getConfiguration(CustomCloudConfigurationSection);
99
+ const authProviderConfig = vscode.workspace.getConfiguration(exports.CustomCloudConfigurationSection);
100
100
  if (typeof cloud === 'undefined' || !cloud) {
101
101
  // Use public cloud implicitly--set `environment` setting to `undefined`
102
102
  await authProviderConfig.update(CloudEnvironmentSettingName, undefined, target);
@@ -108,5 +108,5 @@ export interface RefreshSuggestedEvent {
108
108
  /**
109
109
  * The reason a refresh was suggested.
110
110
  */
111
- reason: 'sessionChange' | 'subscriptionFilterChange';
111
+ reason: 'sessionChange' | 'subscriptionFilterChange' | 'cloudChange';
112
112
  }
@@ -4,6 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as vscode from 'vscode';
6
6
  import { DefaultOptions, getCoalescenceKey } from '../contracts/AzureSubscriptionProviderRequestOptions'; // eslint-disable-line @typescript-eslint/no-unused-vars -- It is used in the doc comments
7
+ import { CustomCloudConfigurationSection } from '../utils/configuredAzureEnv';
7
8
  import { dedupeSubscriptions } from '../utils/dedupeSubscriptions';
8
9
  import { CaselessMap } from '../utils/map/CaselessMap';
9
10
  import { TwoKeyCaselessMap } from '../utils/map/TwoKeyCaselessMap';
@@ -35,6 +36,13 @@ export class VSCodeAzureSubscriptionProvider extends AzureSubscriptionProviderBa
35
36
  if (e.affectsConfiguration(`${ConfigPrefix}.${SelectedSubscriptionsConfigKey}`)) {
36
37
  this.fireRefreshSuggestedIfNeeded({ reason: 'subscriptionFilterChange' });
37
38
  }
39
+ else if (e.affectsConfiguration(CustomCloudConfigurationSection)) {
40
+ this.accountCache.clear();
41
+ this.tenantCache.clear();
42
+ this.subscriptionCache.clear();
43
+ this.log('Cleared all caches due to cloud environment change');
44
+ this.fireRefreshSuggestedIfNeeded({ reason: 'cloudChange' });
45
+ }
38
46
  });
39
47
  return super.onRefreshSuggested(callback, thisArg, disposables);
40
48
  }
@@ -1,5 +1,6 @@
1
1
  import * as azureEnv from '@azure/ms-rest-azure-env';
2
2
  import * as vscode from 'vscode';
3
+ export declare const CustomCloudConfigurationSection = "microsoft-sovereign-cloud";
3
4
  export declare class ExtendedEnvironment extends azureEnv.Environment {
4
5
  readonly isCustomCloud: boolean;
5
6
  constructor(parameters: azureEnv.EnvironmentParameters, isCustomCloud: boolean);
@@ -5,7 +5,7 @@
5
5
  import * as azureEnv from '@azure/ms-rest-azure-env'; // This package is so small that it's not worth lazy loading
6
6
  import * as vscode from 'vscode';
7
7
  // These strings come from https://github.com/microsoft/vscode/blob/eac16e9b63a11885b538db3e0b533a02a2fb8143/extensions/microsoft-authentication/package.json#L40-L99
8
- const CustomCloudConfigurationSection = 'microsoft-sovereign-cloud';
8
+ export const CustomCloudConfigurationSection = 'microsoft-sovereign-cloud';
9
9
  const CloudEnvironmentSettingName = 'environment';
10
10
  const CustomEnvironmentSettingName = 'customEnvironment';
11
11
  var CloudEnvironmentSettingValue;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@microsoft/vscode-azext-azureauth",
3
3
  "author": "Microsoft Corporation",
4
- "version": "6.0.0-alpha.7",
4
+ "version": "6.0.0-alpha.8",
5
5
  "description": "Azure authentication helpers for Visual Studio Code",
6
6
  "tags": [
7
7
  "azure",