|
1 | 1 | import type { RemotesConfig } from '../../config'; |
| 2 | +import type { CloudSelfHostedIntegrationId } from '../../constants.integrations'; |
2 | 3 | import { SelfHostedIntegrationId } from '../../constants.integrations'; |
3 | 4 | import type { Container } from '../../container'; |
4 | 5 | import type { ConfiguredIntegrationDescriptor } from '../../plus/integrations/authentication/models'; |
@@ -76,7 +77,10 @@ const builtInProviders: RemoteProviders = [ |
76 | 77 | }, |
77 | 78 | ]; |
78 | 79 |
|
79 | | -const cloudRemotesMap: { [key: string]: typeof GitHubRemote | typeof GitLabRemote | typeof BitbucketServerRemote } = { |
| 80 | +const cloudRemotesMap: Record< |
| 81 | + CloudSelfHostedIntegrationId, |
| 82 | + typeof GitHubRemote | typeof GitLabRemote | typeof BitbucketServerRemote |
| 83 | +> = { |
80 | 84 | [SelfHostedIntegrationId.CloudGitHubEnterprise]: GitHubRemote, |
81 | 85 | [SelfHostedIntegrationId.CloudGitLabSelfHosted]: GitLabRemote, |
82 | 86 | [SelfHostedIntegrationId.BitbucketServer]: BitbucketServerRemote, |
@@ -111,10 +115,11 @@ export function loadRemoteProviders( |
111 | 115 |
|
112 | 116 | if (configuredIntegrations?.length) { |
113 | 117 | for (const ci of configuredIntegrations) { |
114 | | - if (isCloudSelfHostedIntegrationId(ci.integrationId) && ci.domain) { |
| 118 | + const integrationId = ci.integrationId; |
| 119 | + if (isCloudSelfHostedIntegrationId(integrationId) && ci.domain) { |
115 | 120 | const matcher = ci.domain.toLocaleLowerCase(); |
116 | 121 | const providerCreator = (_container: Container, domain: string, path: string): RemoteProvider => |
117 | | - new cloudRemotesMap[ci.integrationId](domain, path); |
| 122 | + new cloudRemotesMap[integrationId](domain, path); |
118 | 123 | const provider = { |
119 | 124 | custom: false, |
120 | 125 | matcher: matcher, |
|
0 commit comments