@backstage/integration 1.7.2-next.0 → 1.8.0-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 +20 -0
- package/dist/index.cjs.js +33 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +60 -1
- package/dist/index.esm.js +30 -19
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1225,6 +1225,21 @@ declare function getGerritRequestOptions(config: GerritIntegrationConfig): {
|
|
|
1225
1225
|
*/
|
|
1226
1226
|
declare function parseGerritJsonResponse(response: Response): Promise<unknown>;
|
|
1227
1227
|
|
|
1228
|
+
/**
|
|
1229
|
+
* Given a URL pointing to a file, returns a URL
|
|
1230
|
+
* for editing the contents of the data.
|
|
1231
|
+
*
|
|
1232
|
+
* @remarks
|
|
1233
|
+
*
|
|
1234
|
+
* Converts
|
|
1235
|
+
* from: https://gitea.com/a/b/src/branchname/path/to/c.yaml
|
|
1236
|
+
* or: https://gitea.com/a/b/_edit/branchname/path/to/c.yaml
|
|
1237
|
+
*
|
|
1238
|
+
* @param url - A URL pointing to a file
|
|
1239
|
+
* @param config - The relevant provider config
|
|
1240
|
+
* @public
|
|
1241
|
+
*/
|
|
1242
|
+
declare function getGiteaEditContentsUrl(config: GiteaIntegrationConfig, url: string): string;
|
|
1228
1243
|
/**
|
|
1229
1244
|
* Given a URL pointing to a file, returns an api URL
|
|
1230
1245
|
* for fetching the contents of the data.
|
|
@@ -1240,6 +1255,36 @@ declare function parseGerritJsonResponse(response: Response): Promise<unknown>;
|
|
|
1240
1255
|
* @public
|
|
1241
1256
|
*/
|
|
1242
1257
|
declare function getGiteaFileContentsUrl(config: GiteaIntegrationConfig, url: string): string;
|
|
1258
|
+
/**
|
|
1259
|
+
* Given a URL pointing to a repository/path, returns a URL
|
|
1260
|
+
* for archive contents of the repository.
|
|
1261
|
+
*
|
|
1262
|
+
* @remarks
|
|
1263
|
+
*
|
|
1264
|
+
* Converts
|
|
1265
|
+
* from: https://gitea.com/a/b/src/branchname
|
|
1266
|
+
* or: https://gitea.com/api/v1/repos/a/b/archive/branchname.tar.gz
|
|
1267
|
+
*
|
|
1268
|
+
* @param url - A URL pointing to a repository/path
|
|
1269
|
+
* @param config - The relevant provider config
|
|
1270
|
+
* @public
|
|
1271
|
+
*/
|
|
1272
|
+
declare function getGiteaArchiveUrl(config: GiteaIntegrationConfig, url: string): string;
|
|
1273
|
+
/**
|
|
1274
|
+
* Given a URL pointing to a repository branch, returns a URL
|
|
1275
|
+
* for latest commit information.
|
|
1276
|
+
*
|
|
1277
|
+
* @remarks
|
|
1278
|
+
*
|
|
1279
|
+
* Converts
|
|
1280
|
+
* from: https://gitea.com/a/b/src/branchname
|
|
1281
|
+
* or: https://gitea.com/api/v1/repos/a/b/git/commits/branchname
|
|
1282
|
+
*
|
|
1283
|
+
* @param url - A URL pointing to a repository branch
|
|
1284
|
+
* @param config - The relevant provider config
|
|
1285
|
+
* @public
|
|
1286
|
+
*/
|
|
1287
|
+
declare function getGiteaLatestCommitUrl(config: GiteaIntegrationConfig, url: string): string;
|
|
1243
1288
|
/**
|
|
1244
1289
|
* Return request headers for a Gitea provider.
|
|
1245
1290
|
*
|
|
@@ -1249,6 +1294,20 @@ declare function getGiteaFileContentsUrl(config: GiteaIntegrationConfig, url: st
|
|
|
1249
1294
|
declare function getGiteaRequestOptions(config: GiteaIntegrationConfig): {
|
|
1250
1295
|
headers?: Record<string, string>;
|
|
1251
1296
|
};
|
|
1297
|
+
/**
|
|
1298
|
+
* Return parsed git url properties.
|
|
1299
|
+
*
|
|
1300
|
+
* @param config - A Gitea provider config
|
|
1301
|
+
* @param url - A URL pointing to a repository
|
|
1302
|
+
* @public
|
|
1303
|
+
*/
|
|
1304
|
+
declare function parseGiteaUrl(config: GiteaIntegrationConfig, url: string): {
|
|
1305
|
+
url: string;
|
|
1306
|
+
owner: string;
|
|
1307
|
+
name: string;
|
|
1308
|
+
ref: string;
|
|
1309
|
+
path: string;
|
|
1310
|
+
};
|
|
1252
1311
|
|
|
1253
1312
|
/**
|
|
1254
1313
|
* The type of credentials produced by the credential provider.
|
|
@@ -1578,4 +1637,4 @@ declare class ScmIntegrations implements ScmIntegrationRegistry {
|
|
|
1578
1637
|
resolveEditUrl(url: string): string;
|
|
1579
1638
|
}
|
|
1580
1639
|
|
|
1581
|
-
export { AwsS3Integration, AwsS3IntegrationConfig, AzureClientSecretCredential, AzureCredentialBase, AzureDevOpsCredential, AzureDevOpsCredentialKind, AzureDevOpsCredentialLike, AzureDevOpsCredentialType, AzureDevOpsCredentials, AzureDevOpsCredentialsProvider, AzureIntegration, AzureIntegrationConfig, AzureManagedIdentityCredential, BitbucketCloudIntegration, BitbucketCloudIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, BitbucketServerIntegration, BitbucketServerIntegrationConfig, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GerritIntegrationConfig, GitHubIntegration, GitHubIntegrationConfig, GitLabIntegration, GitLabIntegrationConfig, GiteaIntegration, GiteaIntegrationConfig, GithubAppConfig, GithubAppCredentialsMux, GithubCredentialType, GithubCredentials, GithubCredentialsProvider, GithubIntegration, GithubIntegrationConfig, GitlabCredentials, GitlabCredentialsProvider, GoogleGcsIntegrationConfig, IntegrationsByType, PersonalAccessTokenCredential, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, ScmIntegrationsFactory, ScmIntegrationsGroup, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, 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 };
|
|
1640
|
+
export { AwsS3Integration, AwsS3IntegrationConfig, AzureClientSecretCredential, AzureCredentialBase, AzureDevOpsCredential, AzureDevOpsCredentialKind, AzureDevOpsCredentialLike, AzureDevOpsCredentialType, AzureDevOpsCredentials, AzureDevOpsCredentialsProvider, AzureIntegration, AzureIntegrationConfig, AzureManagedIdentityCredential, BitbucketCloudIntegration, BitbucketCloudIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, BitbucketServerIntegration, BitbucketServerIntegrationConfig, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GerritIntegrationConfig, GitHubIntegration, GitHubIntegrationConfig, GitLabIntegration, GitLabIntegrationConfig, GiteaIntegration, GiteaIntegrationConfig, GithubAppConfig, GithubAppCredentialsMux, GithubCredentialType, GithubCredentials, GithubCredentialsProvider, GithubIntegration, GithubIntegrationConfig, GitlabCredentials, GitlabCredentialsProvider, GoogleGcsIntegrationConfig, IntegrationsByType, PersonalAccessTokenCredential, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, ScmIntegrationsFactory, ScmIntegrationsGroup, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, 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, getGiteaArchiveUrl, getGiteaEditContentsUrl, getGiteaFileContentsUrl, getGiteaLatestCommitUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, parseGiteaUrl, 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
|
@@ -1415,26 +1415,20 @@ function readGiteaConfig(config) {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
|
|
1417
1417
|
function getGiteaEditContentsUrl(config, url) {
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
const baseUrl = (_a = config.baseUrl) != null ? _a : `https://${config.host}`;
|
|
1421
|
-
const [_blank, owner, name, _src, _branch, ref, ...path] = url.replace(baseUrl, "").split("/");
|
|
1422
|
-
const pathWithoutSlash = path.join("/").replace(/^\//, "");
|
|
1423
|
-
return `${baseUrl}/${owner}/${name}/_edit/${ref}/${pathWithoutSlash}`;
|
|
1424
|
-
} catch (e) {
|
|
1425
|
-
throw new Error(`Incorrect URL: ${url}, ${e}`);
|
|
1426
|
-
}
|
|
1418
|
+
const giteaUrl = parseGiteaUrl(config, url);
|
|
1419
|
+
return `${giteaUrl.url}/${giteaUrl.owner}/${giteaUrl.name}/_edit/${giteaUrl.ref}/${giteaUrl.path}`;
|
|
1427
1420
|
}
|
|
1428
1421
|
function getGiteaFileContentsUrl(config, url) {
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1422
|
+
const giteaUrl = parseGiteaUrl(config, url);
|
|
1423
|
+
return `${giteaUrl.url}/api/v1/repos/${giteaUrl.owner}/${giteaUrl.name}/contents/${giteaUrl.path}?ref=${giteaUrl.ref}`;
|
|
1424
|
+
}
|
|
1425
|
+
function getGiteaArchiveUrl(config, url) {
|
|
1426
|
+
const giteaUrl = parseGiteaUrl(config, url);
|
|
1427
|
+
return `${giteaUrl.url}/api/v1/repos/${giteaUrl.owner}/${giteaUrl.name}/archive/${giteaUrl.ref}.tar.gz`;
|
|
1428
|
+
}
|
|
1429
|
+
function getGiteaLatestCommitUrl(config, url) {
|
|
1430
|
+
const giteaUrl = parseGiteaUrl(config, url);
|
|
1431
|
+
return `${giteaUrl.url}/api/v1/repos/${giteaUrl.owner}/${giteaUrl.name}/git/commits/${giteaUrl.ref}`;
|
|
1438
1432
|
}
|
|
1439
1433
|
function getGiteaRequestOptions(config) {
|
|
1440
1434
|
const headers = {};
|
|
@@ -1453,6 +1447,23 @@ function getGiteaRequestOptions(config) {
|
|
|
1453
1447
|
headers
|
|
1454
1448
|
};
|
|
1455
1449
|
}
|
|
1450
|
+
function parseGiteaUrl(config, url) {
|
|
1451
|
+
var _a;
|
|
1452
|
+
const baseUrl = (_a = config.baseUrl) != null ? _a : `https://${config.host}`;
|
|
1453
|
+
try {
|
|
1454
|
+
const [_blank, owner, name, _src, _branch, ref, ...path] = url.replace(baseUrl, "").split("/");
|
|
1455
|
+
const pathWithoutSlash = path.join("/").replace(/^\//, "");
|
|
1456
|
+
return {
|
|
1457
|
+
url: baseUrl,
|
|
1458
|
+
owner,
|
|
1459
|
+
name,
|
|
1460
|
+
ref,
|
|
1461
|
+
path: pathWithoutSlash
|
|
1462
|
+
};
|
|
1463
|
+
} catch (e) {
|
|
1464
|
+
throw new Error(`Incorrect URL: ${url}, ${e}`);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1456
1467
|
|
|
1457
1468
|
var __defProp$6 = Object.defineProperty;
|
|
1458
1469
|
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -2208,5 +2219,5 @@ class ScmIntegrations {
|
|
|
2208
2219
|
}
|
|
2209
2220
|
}
|
|
2210
2221
|
|
|
2211
|
-
export { AwsS3Integration, AzureIntegration, BitbucketCloudIntegration, BitbucketIntegration, BitbucketServerIntegration, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GitHubIntegration, GitLabIntegration, GiteaIntegration, GithubAppCredentialsMux, GithubIntegration, ScmIntegrations, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, 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 };
|
|
2222
|
+
export { AwsS3Integration, AzureIntegration, BitbucketCloudIntegration, BitbucketIntegration, BitbucketServerIntegration, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GitHubIntegration, GitLabIntegration, GiteaIntegration, GithubAppCredentialsMux, GithubIntegration, ScmIntegrations, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, 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, getGiteaArchiveUrl, getGiteaEditContentsUrl, getGiteaFileContentsUrl, getGiteaLatestCommitUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, parseGiteaUrl, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
|
|
2212
2223
|
//# sourceMappingURL=index.esm.js.map
|