Skip to content

Commit c099605

Browse files
committed
Rename config integration descriptor
(#3901, #3922)
1 parent fad5b92 commit c099605

File tree

5 files changed

+14
-20
lines changed

5 files changed

+14
-20
lines changed

src/constants.storage.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,9 @@ export type GlobalStorage = {
8989
[key in `jira:${string}:projects`]: Stored<StoredJiraProject[] | undefined>;
9090
};
9191

92-
export type StoredIntegrationConfigurations = Record<
93-
string,
94-
StoredConfiguredProviderAuthenticationDescriptor[] | undefined
95-
>;
92+
export type StoredIntegrationConfigurations = Record<string, StoredConfiguredIntegrationDescriptor[] | undefined>;
9693

97-
export interface StoredConfiguredProviderAuthenticationDescriptor {
94+
export interface StoredConfiguredIntegrationDescriptor {
9895
cloud: boolean;
9996
integrationId: IntegrationId;
10097
domain?: string;

src/git/remotes/remoteProviders.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { RemotesConfig } from '../../config';
22
import { SelfHostedIntegrationId } from '../../constants.integrations';
33
import type { Container } from '../../container';
4-
import type { ConfiguredProviderAuthenticationDescriptor } from '../../plus/integrations/authentication/models';
4+
import type { ConfiguredIntegrationDescriptor } from '../../plus/integrations/authentication/models';
55
import { Logger } from '../../system/logger';
66
import { configuration } from '../../system/vscode/configuration';
77
import { AzureDevOpsRemote } from './azure-devops';
@@ -77,7 +77,7 @@ const builtInProviders: RemoteProviders = [
7777

7878
export function loadRemoteProviders(
7979
cfg: RemotesConfig[] | null | undefined,
80-
configuredIntegrations?: ConfiguredProviderAuthenticationDescriptor[],
80+
configuredIntegrations?: ConfiguredIntegrationDescriptor[],
8181
): RemoteProviders {
8282
const providers: RemoteProviders = [];
8383

src/plus/integrations/authentication/integrationAuthentication.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@ import { authentication, EventEmitter, window } from 'vscode';
33
import { wrapForForcedInsecureSSL } from '@env/fetch';
44
import type { IntegrationId } from '../../../constants.integrations';
55
import { HostingIntegrationId, IssueIntegrationId, SelfHostedIntegrationId } from '../../../constants.integrations';
6-
import type {
7-
IntegrationAuthenticationKeys,
8-
StoredConfiguredProviderAuthenticationDescriptor,
9-
} from '../../../constants.storage';
6+
import type { IntegrationAuthenticationKeys, StoredConfiguredIntegrationDescriptor } from '../../../constants.storage';
107
import type { Sources } from '../../../constants.telemetry';
118
import type { Container } from '../../../container';
129
import { gate } from '../../../system/decorators/gate';
1310
import { debug, log } from '../../../system/decorators/log';
1411
import type { DeferredEventExecutor } from '../../../system/event';
1512
import { isSelfHostedIntegrationId, supportedIntegrationIds } from '../providers/models';
16-
import type { ConfiguredProviderAuthenticationDescriptor, ProviderAuthenticationSession } from './models';
13+
import type { ConfiguredIntegrationDescriptor, ProviderAuthenticationSession } from './models';
1714
import { isSupportedCloudIntegrationId } from './models';
1815

1916
const maxSmallIntegerV8 = 2 ** 30 - 1; // Max number that can be stored in V8's smis (small integers)
@@ -506,7 +503,7 @@ class BuiltInAuthenticationProvider extends LocalIntegrationAuthenticationProvid
506503

507504
export class IntegrationAuthenticationService implements Disposable {
508505
private readonly providers = new Map<IntegrationId, IntegrationAuthenticationProvider>();
509-
private _configured?: Map<IntegrationId, ConfiguredProviderAuthenticationDescriptor[]>;
506+
private _configured?: Map<IntegrationId, ConfiguredIntegrationDescriptor[]>;
510507

511508
constructor(private readonly container: Container) {}
512509

@@ -515,7 +512,7 @@ export class IntegrationAuthenticationService implements Disposable {
515512
this.providers.clear();
516513
}
517514

518-
get configured(): Map<IntegrationId, ConfiguredProviderAuthenticationDescriptor[]> {
515+
get configured(): Map<IntegrationId, ConfiguredIntegrationDescriptor[]> {
519516
if (this._configured == null) {
520517
this._configured = new Map();
521518
const storedConfigured = this.container.storage.get('integrations:configured');
@@ -534,7 +531,7 @@ export class IntegrationAuthenticationService implements Disposable {
534531

535532
private async storeConfigured() {
536533
// We need to convert the map to a record to store
537-
const configured: Record<string, StoredConfiguredProviderAuthenticationDescriptor[]> = {};
534+
const configured: Record<string, StoredConfiguredIntegrationDescriptor[]> = {};
538535
for (const [id, descriptors] of this.configured) {
539536
configured[id] = descriptors.map(d => ({
540537
...d,
@@ -549,7 +546,7 @@ export class IntegrationAuthenticationService implements Disposable {
549546
await this.container.storage.store('integrations:configured', configured);
550547
}
551548

552-
async addConfigured(descriptor: ConfiguredProviderAuthenticationDescriptor) {
549+
async addConfigured(descriptor: ConfiguredIntegrationDescriptor) {
553550
const descriptors = this.configured.get(descriptor.integrationId) ?? [];
554551
// Only add if one does not exist
555552
if (descriptors.some(d => d.domain === descriptor.domain && d.integrationId === descriptor.integrationId)) {
@@ -560,7 +557,7 @@ export class IntegrationAuthenticationService implements Disposable {
560557
await this.storeConfigured();
561558
}
562559

563-
async removeConfigured(descriptor: Pick<ConfiguredProviderAuthenticationDescriptor, 'integrationId' | 'domain'>) {
560+
async removeConfigured(descriptor: Pick<ConfiguredIntegrationDescriptor, 'integrationId' | 'domain'>) {
564561
const descriptors = this.configured.get(descriptor.integrationId);
565562
if (descriptors == null) return;
566563
const index = descriptors.findIndex(

src/plus/integrations/authentication/models.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface ProviderAuthenticationSession extends AuthenticationSession {
1414
readonly expiresAt?: Date;
1515
}
1616

17-
export interface ConfiguredProviderAuthenticationDescriptor {
17+
export interface ConfiguredIntegrationDescriptor {
1818
readonly cloud: boolean;
1919
readonly integrationId: IntegrationId;
2020
readonly domain?: string;

src/plus/integrations/integrationService.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { configuration } from '../../system/vscode/configuration';
2121
import { openUrl } from '../../system/vscode/utils';
2222
import type { SubscriptionChangeEvent } from '../gk/account/subscriptionService';
2323
import type { IntegrationAuthenticationService } from './authentication/integrationAuthentication';
24-
import type { ConfiguredProviderAuthenticationDescriptor } from './authentication/models';
24+
import type { ConfiguredIntegrationDescriptor } from './authentication/models';
2525
import {
2626
CloudIntegrationAuthenticationUriPathPrefix,
2727
getSupportedCloudIntegrationIds,
@@ -949,7 +949,7 @@ export class IntegrationService implements Disposable {
949949
return isSelfHostedIntegrationId(id) ? (`${id}:${domain}` as const) : id;
950950
}
951951

952-
getConfiguredIntegrationDescriptors(id?: IntegrationId): ConfiguredProviderAuthenticationDescriptor[] {
952+
getConfiguredIntegrationDescriptors(id?: IntegrationId): ConfiguredIntegrationDescriptor[] {
953953
const configured = this.authenticationService.configured;
954954
if (id != null) return configured.get(id) ?? [];
955955
const results = [];

0 commit comments

Comments
 (0)