@backstage/integration 1.5.0-next.0 → 1.5.1-next.0
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 +28 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ type AzureIntegrationConfig = {
|
|
|
193
193
|
* Authenticate using a client secret that was generated for an App Registration.
|
|
194
194
|
* @public
|
|
195
195
|
*/
|
|
196
|
-
type
|
|
196
|
+
type AzureClientSecretCredential = {
|
|
197
197
|
/**
|
|
198
198
|
* The Azure Active Directory tenant
|
|
199
199
|
*/
|
|
@@ -211,7 +211,7 @@ type ClientSecret = {
|
|
|
211
211
|
* Authenticate using a managed identity available at the deployment environment.
|
|
212
212
|
* @public
|
|
213
213
|
*/
|
|
214
|
-
type
|
|
214
|
+
type AzureManagedIdentityCredential = {
|
|
215
215
|
/**
|
|
216
216
|
* The clientId
|
|
217
217
|
*/
|
|
@@ -221,7 +221,7 @@ type ManagedIdentity = {
|
|
|
221
221
|
* Credential used to authenticate to Azure Active Directory.
|
|
222
222
|
* @public
|
|
223
223
|
*/
|
|
224
|
-
type AzureCredential =
|
|
224
|
+
type AzureCredential = AzureClientSecretCredential | AzureManagedIdentityCredential;
|
|
225
225
|
/**
|
|
226
226
|
* Reads a single Azure integration config.
|
|
227
227
|
*
|
|
@@ -1475,4 +1475,4 @@ declare class ScmIntegrations implements ScmIntegrationRegistry {
|
|
|
1475
1475
|
resolveEditUrl(url: string): string;
|
|
1476
1476
|
}
|
|
1477
1477
|
|
|
1478
|
-
export { AwsS3Integration, AwsS3IntegrationConfig, AzureCredential, AzureIntegration, AzureIntegrationConfig, BitbucketCloudIntegration, BitbucketCloudIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, BitbucketServerIntegration, BitbucketServerIntegrationConfig,
|
|
1478
|
+
export { AwsS3Integration, AwsS3IntegrationConfig, AzureClientSecretCredential, AzureCredential, AzureIntegration, AzureIntegrationConfig, AzureManagedIdentityCredential, BitbucketCloudIntegration, BitbucketCloudIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, BitbucketServerIntegration, BitbucketServerIntegrationConfig, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GerritIntegrationConfig, GitHubIntegration, GitHubIntegrationConfig, GitLabIntegration, GitLabIntegrationConfig, GiteaIntegration, GiteaIntegrationConfig, GithubAppConfig, GithubAppCredentialsMux, GithubCredentialType, GithubCredentials, GithubCredentialsProvider, GithubIntegration, GithubIntegrationConfig, GitlabCredentials, GitlabCredentialsProvider, GoogleGcsIntegrationConfig, IntegrationsByType, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, ScmIntegrationsFactory, ScmIntegrationsGroup, SingleInstanceGithubCredentialsProvider, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaFileContentsUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
|
package/dist/index.esm.js
CHANGED
|
@@ -335,11 +335,11 @@ _ref = new WeakMap();
|
|
|
335
335
|
_baseUrl = new WeakMap();
|
|
336
336
|
|
|
337
337
|
const AZURE_HOST = "dev.azure.com";
|
|
338
|
-
const
|
|
338
|
+
const isAzureClientSecretCredential = (credential) => {
|
|
339
339
|
const clientSecretCredential = credential;
|
|
340
340
|
return Object.keys(credential).length === 3 && clientSecretCredential.clientId !== void 0 && clientSecretCredential.clientSecret !== void 0 && clientSecretCredential.tenantId !== void 0;
|
|
341
341
|
};
|
|
342
|
-
const
|
|
342
|
+
const isAzureManagedIdentityCredential = (credential) => {
|
|
343
343
|
return Object.keys(credential).length === 1 && credential.clientId !== void 0;
|
|
344
344
|
};
|
|
345
345
|
function readAzureIntegrationConfig(config) {
|
|
@@ -356,7 +356,7 @@ function readAzureIntegrationConfig(config) {
|
|
|
356
356
|
`Invalid Azure integration config, '${host}' is not a valid host`
|
|
357
357
|
);
|
|
358
358
|
}
|
|
359
|
-
if (credential && !
|
|
359
|
+
if (credential && !isAzureClientSecretCredential(credential) && !isAzureManagedIdentityCredential(credential)) {
|
|
360
360
|
throw new Error(
|
|
361
361
|
`Invalid Azure integration config, credential is not valid`
|
|
362
362
|
);
|
|
@@ -452,7 +452,7 @@ async function getAzureRequestOptions(config, additionalHeaders) {
|
|
|
452
452
|
const headers = additionalHeaders ? { ...additionalHeaders } : {};
|
|
453
453
|
const { token, credential } = config;
|
|
454
454
|
if (credential) {
|
|
455
|
-
if (
|
|
455
|
+
if (isAzureClientSecretCredential(credential)) {
|
|
456
456
|
const servicePrincipal = new ClientSecretCredential(
|
|
457
457
|
credential.tenantId,
|
|
458
458
|
credential.clientId,
|
|
@@ -460,7 +460,7 @@ async function getAzureRequestOptions(config, additionalHeaders) {
|
|
|
460
460
|
);
|
|
461
461
|
const accessToken = await servicePrincipal.getToken(azureDevOpsScope);
|
|
462
462
|
headers.Authorization = `Bearer ${accessToken.token}`;
|
|
463
|
-
} else if (
|
|
463
|
+
} else if (isAzureManagedIdentityCredential(credential)) {
|
|
464
464
|
const managedIdentity = new ManagedIdentityCredential(
|
|
465
465
|
credential.clientId
|
|
466
466
|
);
|