@microsoft/vscode-azext-azureauth 4.0.2 → 4.0.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.0.3 - 2024-12-20
4
+ * [#1862](https://github.com/microsoft/vscode-azuretools/pull/1862) Display account name on duplicate tenant picks
5
+
3
6
  ## 4.0.2 - 2024-12-19
4
7
 
5
8
  * [#1861](https://github.com/microsoft/vscode-azuretools/pull/1861) Remove unecessary if statement
@@ -42,15 +42,20 @@ function pickTenant(subscriptionProvider) {
42
42
  function getPicks(subscriptionProvider) {
43
43
  return __awaiter(this, void 0, void 0, function* () {
44
44
  const unauthenticatedTenants = yield (0, getUnauthenticatedTenants_1.getUnauthenticatedTenants)(subscriptionProvider);
45
+ const duplicateTenants = new Set(unauthenticatedTenants
46
+ .filter((tenant, index, self) => index !== self.findIndex(t => t.tenantId === tenant.tenantId))
47
+ .map(tenant => tenant.tenantId));
48
+ const isDuplicate = (tenantId) => duplicateTenants.has(tenantId);
45
49
  const picks = unauthenticatedTenants
46
50
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
47
51
  .sort((a, b) => (a.displayName).localeCompare(b.displayName))
48
52
  .map(tenant => {
49
- var _a, _b, _c;
53
+ var _a, _b;
50
54
  return ({
51
55
  label: (_a = tenant.displayName) !== null && _a !== void 0 ? _a : '',
52
- description: (_b = tenant.tenantId) !== null && _b !== void 0 ? _b : '',
53
- detail: (_c = tenant.defaultDomain) !== null && _c !== void 0 ? _c : '',
56
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
57
+ description: `${tenant.tenantId}${isDuplicate(tenant.tenantId) ? ` (${tenant.account.label})` : ''}`,
58
+ detail: (_b = tenant.defaultDomain) !== null && _b !== void 0 ? _b : '',
54
59
  tenant,
55
60
  });
56
61
  });
@@ -1,6 +1,6 @@
1
- import type { TenantIdDescription } from "@azure/arm-resources-subscriptions";
2
1
  import type { AzureSubscriptionProvider } from "../AzureSubscriptionProvider";
2
+ import type { AzureTenant } from "../AzureTenant";
3
3
  /**
4
4
  * @returns list of tenants that VS Code doesn't have sessions for
5
5
  */
6
- export declare function getUnauthenticatedTenants(subscriptionProvider: AzureSubscriptionProvider): Promise<TenantIdDescription[]>;
6
+ export declare function getUnauthenticatedTenants(subscriptionProvider: AzureSubscriptionProvider): Promise<AzureTenant[]>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@microsoft/vscode-azext-azureauth",
3
3
  "author": "Microsoft Corporation",
4
- "version": "4.0.2",
4
+ "version": "4.0.3",
5
5
  "description": "Azure authentication helpers for Visual Studio Code",
6
6
  "tags": [
7
7
  "azure",