22import type { CancellationToken , Disposable , Event , MessageItem } from 'vscode' ;
33import { EventEmitter , window } from 'vscode' ;
44import type { AutolinkReference , DynamicAutolinkReference } from '../../../autolinks/models/autolinks' ;
5- import type {
6- GitSelfManagedHostIntegrationId ,
7- IntegrationIds ,
8- IssuesCloudHostIntegrationId ,
9- } from '../../../constants.integrations' ;
5+ import type { IntegrationIds , IssuesCloudHostIntegrationId } from '../../../constants.integrations' ;
106import { GitCloudHostIntegrationId } from '../../../constants.integrations' ;
117import type { Sources } from '../../../constants.telemetry' ;
128import type { Container } from '../../../container' ;
@@ -41,15 +37,13 @@ export type IntegrationById<T extends IntegrationIds> = T extends IssuesCloudHos
4137 : GitHostIntegration ;
4238export type IntegrationType = 'git' | 'issues' ;
4339
44- export type IntegrationKey =
45- | `${GitCloudHostIntegrationId } `
46- | `${IssuesCloudHostIntegrationId } `
47- | `${GitSelfManagedHostIntegrationId } :${string } `;
48- export type IntegrationKeyById < T extends IntegrationIds > = T extends IssuesCloudHostIntegrationId
49- ? `${IssuesCloudHostIntegrationId } `
50- : T extends GitCloudHostIntegrationId
51- ? `${GitCloudHostIntegrationId } `
52- : `${GitSelfManagedHostIntegrationId } :${string } `;
40+ export type IntegrationKey < T extends IntegrationIds = IntegrationIds > = T extends
41+ | GitCloudHostIntegrationId
42+ | IssuesCloudHostIntegrationId
43+ ? `${T } `
44+ : `${T } :${string } `;
45+
46+ export type IntegrationConnectedKey < T extends IntegrationIds = IntegrationIds > = `connected:${IntegrationKey < T > } `;
5347
5448export type IntegrationResult < T > =
5549 | { value : T ; duration ?: number ; error ?: never }
@@ -81,7 +75,7 @@ export abstract class IntegrationBase<
8175
8276 abstract get authProvider ( ) : IntegrationAuthenticationProviderDescriptor ;
8377 abstract get id ( ) : ID ;
84- protected abstract get key ( ) : IntegrationKeyById < ID > ;
78+ protected abstract get key ( ) : IntegrationKey < ID > ;
8579 abstract get name ( ) : string ;
8680 abstract get domain ( ) : string ;
8781
@@ -104,7 +98,7 @@ export abstract class IntegrationBase<
10498 return [ ] ;
10599 }
106100
107- private get connectedKey ( ) : `connected:${ Integration [ 'key' ] } ` {
101+ private get connectedKey ( ) : IntegrationConnectedKey < ID > {
108102 return `connected:${ this . key } ` ;
109103 }
110104
0 commit comments