@backstage/integration 1.5.1 → 1.6.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 +13 -0
- package/dist/index.cjs.js +16 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.esm.js +16 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @backstage/integration
|
|
2
2
|
|
|
3
|
+
## 1.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 443afcf7f567: Added `buildGerritGitilesArchiveUrl()` to construct a Gitiles URL to download an archive.
|
|
8
|
+
Gitiles URL that uses an authenticated prefix (`/a/`) can now be parsed by the integration.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @backstage/config@1.0.8
|
|
14
|
+
- @backstage/errors@1.2.1
|
|
15
|
+
|
|
3
16
|
## 1.5.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -1003,7 +1003,9 @@ function readGerritIntegrationConfigs(configs) {
|
|
|
1003
1003
|
|
|
1004
1004
|
const GERRIT_BODY_PREFIX = ")]}'";
|
|
1005
1005
|
function parseGerritGitilesUrl(config, url) {
|
|
1006
|
-
const
|
|
1006
|
+
const baseUrlParse = new URL(config.gitilesBaseUrl);
|
|
1007
|
+
const urlParse = new URL(url);
|
|
1008
|
+
const urlPath = urlParse.pathname.substring(urlParse.pathname.startsWith("/a/") ? 2 : 0).replace(baseUrlParse.pathname, "");
|
|
1007
1009
|
const parts = urlPath.split("/").filter((p) => !!p);
|
|
1008
1010
|
const projectEndIndex = parts.indexOf("+");
|
|
1009
1011
|
if (projectEndIndex <= 0) {
|
|
@@ -1025,9 +1027,21 @@ function parseGerritGitilesUrl(config, url) {
|
|
|
1025
1027
|
function buildGerritGitilesUrl(config, project, branch, filePath) {
|
|
1026
1028
|
return `${config.gitilesBaseUrl}/${project}/+/refs/heads/${branch}/${lodash.trimStart(filePath, "/")}`;
|
|
1027
1029
|
}
|
|
1030
|
+
function buildGerritGitilesArchiveUrl(config, project, branch, filePath) {
|
|
1031
|
+
const archiveName = filePath === "/" || filePath === "" ? ".tar.gz" : `/${filePath}.tar.gz`;
|
|
1032
|
+
return `${getGitilesAuthenticationUrl(
|
|
1033
|
+
config
|
|
1034
|
+
)}/${project}/+archive/refs/heads/${branch}${archiveName}`;
|
|
1035
|
+
}
|
|
1028
1036
|
function getAuthenticationPrefix(config) {
|
|
1029
1037
|
return config.password ? "/a/" : "/";
|
|
1030
1038
|
}
|
|
1039
|
+
function getGitilesAuthenticationUrl(config) {
|
|
1040
|
+
const parsedUrl = new URL(config.gitilesBaseUrl);
|
|
1041
|
+
return `${parsedUrl.protocol}//${parsedUrl.host}${getAuthenticationPrefix(
|
|
1042
|
+
config
|
|
1043
|
+
)}${parsedUrl.pathname.substring(1)}`;
|
|
1044
|
+
}
|
|
1031
1045
|
function getGerritBranchApiUrl(config, url) {
|
|
1032
1046
|
const { branch, project } = parseGerritGitilesUrl(config, url);
|
|
1033
1047
|
return `${config.baseUrl}${getAuthenticationPrefix(
|
|
@@ -1960,6 +1974,7 @@ exports.GithubAppCredentialsMux = GithubAppCredentialsMux;
|
|
|
1960
1974
|
exports.GithubIntegration = GithubIntegration;
|
|
1961
1975
|
exports.ScmIntegrations = ScmIntegrations;
|
|
1962
1976
|
exports.SingleInstanceGithubCredentialsProvider = SingleInstanceGithubCredentialsProvider;
|
|
1977
|
+
exports.buildGerritGitilesArchiveUrl = buildGerritGitilesArchiveUrl;
|
|
1963
1978
|
exports.defaultScmResolveUrl = defaultScmResolveUrl;
|
|
1964
1979
|
exports.getAzureCommitsUrl = getAzureCommitsUrl;
|
|
1965
1980
|
exports.getAzureDownloadUrl = getAzureDownloadUrl;
|