@backstage/integration 1.12.0-next.0 → 1.12.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 +46 -0
- package/config.d.ts +5 -0
- package/dist/awsCodeCommit/config.esm.js +5 -9
- package/dist/awsCodeCommit/config.esm.js.map +1 -1
- package/dist/gerrit/config.esm.js +2 -2
- package/dist/gerrit/config.esm.js.map +1 -1
- package/dist/harness/core.esm.js +1 -1
- package/dist/harness/core.esm.js.map +1 -1
- package/dist/index.cjs.js +8 -31
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +8 -40
- package/dist/index.esm.js +0 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
- package/dist/github/deprecated.esm.js +0 -20
- package/dist/github/deprecated.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @backstage/integration
|
|
2
2
|
|
|
3
|
+
## 1.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- be1014d: **BREAKING** Removed deprecated code from when casing was changed from `GitHub` to `Github` nearly two years ago. The following items have been removed:
|
|
8
|
+
|
|
9
|
+
- `getGitHubFileFetchUrl` (use `getGithubFileFetchUrl` instead)
|
|
10
|
+
- `GitHubIntegrationConfig` (use `GithubIntegrationConfig` instead)
|
|
11
|
+
- `GitHubIntegration` (use `GithubIntegration` instead)
|
|
12
|
+
- `readGitHubIntegrationConfig` (use `readGithubIntegrationConfig` instead)
|
|
13
|
+
- `readGitHubIntegrationConfigs` (use `readGithubIntegrationConfigs` instead)
|
|
14
|
+
- `replaceGitHubUrlType` (use `replaceGithubUrlType` instead)
|
|
15
|
+
|
|
16
|
+
- 395b973: Implemented `readTree` for Harness provider to support TechDocs functionality
|
|
17
|
+
- 662dce8: **BREAKING**: `gitilesBaseUrl` is now mandatory for the Gerrit integration. The
|
|
18
|
+
ability to override this requirement using the `DISABLE_GERRIT_GITILES_REQUIREMENT`
|
|
19
|
+
environment variable has been removed.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 509e08c: Updated function for getHarnessEditContentsUrl
|
|
24
|
+
- 23ee9ab: Fix AWS CodeCommit integration by allowing to change the host
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @backstage/config@1.2.0
|
|
27
|
+
- @backstage/errors@1.2.4
|
|
28
|
+
|
|
29
|
+
## 1.12.0-next.1
|
|
30
|
+
|
|
31
|
+
### Minor Changes
|
|
32
|
+
|
|
33
|
+
- be1014d: **BREAKING** Removed deprecated code from when casing was changed from `GitHub` to `Github` nearly two years ago. The following items have been removed:
|
|
34
|
+
|
|
35
|
+
- `getGitHubFileFetchUrl` (use `getGithubFileFetchUrl` instead)
|
|
36
|
+
- `GitHubIntegrationConfig` (use `GithubIntegrationConfig` instead)
|
|
37
|
+
- `GitHubIntegration` (use `GithubIntegration` instead)
|
|
38
|
+
- `readGitHubIntegrationConfig` (use `readGithubIntegrationConfig` instead)
|
|
39
|
+
- `readGitHubIntegrationConfigs` (use `readGithubIntegrationConfigs` instead)
|
|
40
|
+
- `replaceGitHubUrlType` (use `replaceGithubUrlType` instead)
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- 23ee9ab: Fix AWS CodeCommit integration by allowing to change the host
|
|
45
|
+
- Updated dependencies
|
|
46
|
+
- @backstage/config@1.2.0
|
|
47
|
+
- @backstage/errors@1.2.4
|
|
48
|
+
|
|
3
49
|
## 1.12.0-next.0
|
|
4
50
|
|
|
5
51
|
### Minor Changes
|
package/config.d.ts
CHANGED
|
@@ -151,6 +151,11 @@ export interface Config {
|
|
|
151
151
|
* @visibility frontend
|
|
152
152
|
*/
|
|
153
153
|
baseUrl?: string;
|
|
154
|
+
/**
|
|
155
|
+
* The gitiles base url.
|
|
156
|
+
* @visibility frontend
|
|
157
|
+
*/
|
|
158
|
+
gitilesBaseUrl: string;
|
|
154
159
|
/**
|
|
155
160
|
* The base url for cloning repos.
|
|
156
161
|
* @visibility frontend
|
|
@@ -4,23 +4,19 @@ function readAwsCodeCommitIntegrationConfig(config) {
|
|
|
4
4
|
const secretAccessKey = config.getOptionalString("secretAccessKey")?.trim();
|
|
5
5
|
const roleArn = config.getOptionalString("roleArn");
|
|
6
6
|
const externalId = config.getOptionalString("externalId");
|
|
7
|
-
const
|
|
7
|
+
const region = config.getString("region");
|
|
8
|
+
const host = config.getOptionalString("host") || `${region}.${AMAZON_AWS_CODECOMMIT_HOST}`;
|
|
8
9
|
return {
|
|
9
10
|
host,
|
|
10
11
|
accessKeyId,
|
|
11
12
|
secretAccessKey,
|
|
12
13
|
roleArn,
|
|
13
|
-
externalId
|
|
14
|
+
externalId,
|
|
15
|
+
region
|
|
14
16
|
};
|
|
15
17
|
}
|
|
16
18
|
function readAwsCodeCommitIntegrationConfigs(configs) {
|
|
17
|
-
|
|
18
|
-
if (!result.some((c) => c.host === AMAZON_AWS_CODECOMMIT_HOST)) {
|
|
19
|
-
result.push({
|
|
20
|
-
host: AMAZON_AWS_CODECOMMIT_HOST
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
19
|
+
return configs.map(readAwsCodeCommitIntegrationConfig);
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
export { readAwsCodeCommitIntegrationConfig, readAwsCodeCommitIntegrationConfigs };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.esm.js","sources":["../../src/awsCodeCommit/config.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\nconst AMAZON_AWS_CODECOMMIT_HOST = 'console.aws.amazon.com';\n\n/**\n * The configuration parameters for a single AWS CodeCommit provider.\n *\n * @public\n */\nexport type AwsCodeCommitIntegrationConfig = {\n /**\n * Host, git host derived from region\n */\n host: string;\n\n /**\n * (Optional) User access key id\n */\n accessKeyId?: string;\n\n /**\n * (Optional) User secret access key\n */\n secretAccessKey?: string;\n\n /**\n * (Optional) ARN of role to be assumed\n */\n roleArn?: string;\n\n /**\n * (Optional) External ID to use when assuming role\n */\n externalId?: string;\n};\n\n/**\n * Reads a single Aws CodeCommit integration config.\n *\n * @param config - The config object of a single integration\n * @public\n */\n\nexport function readAwsCodeCommitIntegrationConfig(\n config: Config,\n): AwsCodeCommitIntegrationConfig {\n const accessKeyId = config.getOptionalString('accessKeyId');\n const secretAccessKey = config.getOptionalString('secretAccessKey')?.trim();\n const roleArn = config.getOptionalString('roleArn');\n const externalId = config.getOptionalString('externalId');\n const
|
|
1
|
+
{"version":3,"file":"config.esm.js","sources":["../../src/awsCodeCommit/config.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\nconst AMAZON_AWS_CODECOMMIT_HOST = 'console.aws.amazon.com';\n\n/**\n * The configuration parameters for a single AWS CodeCommit provider.\n *\n * @public\n */\nexport type AwsCodeCommitIntegrationConfig = {\n /**\n * Host, git host derived from region\n */\n host: string;\n\n /**\n * (Optional) User access key id\n */\n accessKeyId?: string;\n\n /**\n * (Optional) User secret access key\n */\n secretAccessKey?: string;\n\n /**\n * (Optional) ARN of role to be assumed\n */\n roleArn?: string;\n\n /**\n * (Optional) External ID to use when assuming role\n */\n externalId?: string;\n\n /**\n * region to use for AWS (default: us-east-1)\n */\n region: string;\n};\n\n/**\n * Reads a single Aws CodeCommit integration config.\n *\n * @param config - The config object of a single integration\n * @public\n */\n\nexport function readAwsCodeCommitIntegrationConfig(\n config: Config,\n): AwsCodeCommitIntegrationConfig {\n const accessKeyId = config.getOptionalString('accessKeyId');\n const secretAccessKey = config.getOptionalString('secretAccessKey')?.trim();\n const roleArn = config.getOptionalString('roleArn');\n const externalId = config.getOptionalString('externalId');\n const region = config.getString('region');\n const host =\n config.getOptionalString('host') ||\n `${region}.${AMAZON_AWS_CODECOMMIT_HOST}`;\n\n return {\n host,\n accessKeyId,\n secretAccessKey,\n roleArn,\n externalId,\n region,\n };\n}\n\n/**\n * Reads a set of AWS CodeCommit integration configs, and inserts some defaults for\n * public Amazon AWS if not specified.\n *\n * @param configs - The config objects of the integrations\n * @public\n */\nexport function readAwsCodeCommitIntegrationConfigs(\n configs: Config[],\n): AwsCodeCommitIntegrationConfig[] {\n return configs.map(readAwsCodeCommitIntegrationConfig);\n}\n"],"names":[],"mappings":"AAkBA,MAAM,0BAA6B,GAAA,wBAAA,CAAA;AA8C5B,SAAS,mCACd,MACgC,EAAA;AAChC,EAAM,MAAA,WAAA,GAAc,MAAO,CAAA,iBAAA,CAAkB,aAAa,CAAA,CAAA;AAC1D,EAAA,MAAM,eAAkB,GAAA,MAAA,CAAO,iBAAkB,CAAA,iBAAiB,GAAG,IAAK,EAAA,CAAA;AAC1E,EAAM,MAAA,OAAA,GAAU,MAAO,CAAA,iBAAA,CAAkB,SAAS,CAAA,CAAA;AAClD,EAAM,MAAA,UAAA,GAAa,MAAO,CAAA,iBAAA,CAAkB,YAAY,CAAA,CAAA;AACxD,EAAM,MAAA,MAAA,GAAS,MAAO,CAAA,SAAA,CAAU,QAAQ,CAAA,CAAA;AACxC,EAAM,MAAA,IAAA,GACJ,OAAO,iBAAkB,CAAA,MAAM,KAC/B,CAAG,EAAA,MAAM,IAAI,0BAA0B,CAAA,CAAA,CAAA;AAEzC,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,GACF,CAAA;AACF,CAAA;AASO,SAAS,oCACd,OACkC,EAAA;AAClC,EAAO,OAAA,OAAA,CAAQ,IAAI,kCAAkC,CAAA,CAAA;AACvD;;;;"}
|
|
@@ -5,7 +5,7 @@ function readGerritIntegrationConfig(config) {
|
|
|
5
5
|
const host = config.getString("host");
|
|
6
6
|
let baseUrl = config.getOptionalString("baseUrl");
|
|
7
7
|
let cloneUrl = config.getOptionalString("cloneUrl");
|
|
8
|
-
let gitilesBaseUrl = config.
|
|
8
|
+
let gitilesBaseUrl = config.getString("gitilesBaseUrl");
|
|
9
9
|
const username = config.getOptionalString("username");
|
|
10
10
|
const password = config.getOptionalString("password")?.trim();
|
|
11
11
|
if (!isValidHost(host)) {
|
|
@@ -20,7 +20,7 @@ function readGerritIntegrationConfig(config) {
|
|
|
20
20
|
throw new Error(
|
|
21
21
|
`Invalid Gerrit integration config, '${cloneUrl}' is not a valid cloneUrl`
|
|
22
22
|
);
|
|
23
|
-
} else if (
|
|
23
|
+
} else if (!isValidUrl(gitilesBaseUrl)) {
|
|
24
24
|
throw new Error(
|
|
25
25
|
`Invalid Gerrit integration config, '${gitilesBaseUrl}' is not a valid gitilesBaseUrl`
|
|
26
26
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.esm.js","sources":["../../src/gerrit/config.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { trimEnd } from 'lodash';\nimport { isValidHost, isValidUrl } from '../helpers';\n\n/**\n * The configuration parameters for a single Gerrit API provider.\n *\n * @public\n */\nexport type GerritIntegrationConfig = {\n /**\n * The host of the target that this matches on, e.g. \"gerrit-review.com\"\n */\n host: string;\n\n /**\n * The optional base URL of the Gerrit instance. It is assumed that https\n * is used and that the base path is \"/\" on the host. If that is not the\n * case set the complete base url to the gerrit instance, e.g.\n * \"https://gerrit-review.com/gerrit\". This is the url that you would open\n * in a browser.\n */\n baseUrl?: string;\n\n /**\n * The optional base url to use for cloning a repository. If not set the\n * baseUrl will be used.\n */\n cloneUrl?: string;\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"config.esm.js","sources":["../../src/gerrit/config.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { trimEnd } from 'lodash';\nimport { isValidHost, isValidUrl } from '../helpers';\n\n/**\n * The configuration parameters for a single Gerrit API provider.\n *\n * @public\n */\nexport type GerritIntegrationConfig = {\n /**\n * The host of the target that this matches on, e.g. \"gerrit-review.com\"\n */\n host: string;\n\n /**\n * The optional base URL of the Gerrit instance. It is assumed that https\n * is used and that the base path is \"/\" on the host. If that is not the\n * case set the complete base url to the gerrit instance, e.g.\n * \"https://gerrit-review.com/gerrit\". This is the url that you would open\n * in a browser.\n */\n baseUrl?: string;\n\n /**\n * The optional base url to use for cloning a repository. If not set the\n * baseUrl will be used.\n */\n cloneUrl?: string;\n\n /**\n * Base url for Gitiles. This is needed for creating a valid\n * user-friendly url that can be used for browsing the content of the\n * provider.\n */\n gitilesBaseUrl: string;\n\n /**\n * The username to use for requests to gerrit.\n */\n username?: string;\n\n /**\n * The password or http token to use for authentication.\n */\n password?: string;\n};\n\n/**\n * Reads a single Gerrit integration config.\n *\n * @param config - The config object of a single integration\n *\n * @public\n */\nexport function readGerritIntegrationConfig(\n config: Config,\n): GerritIntegrationConfig {\n const host = config.getString('host');\n let baseUrl = config.getOptionalString('baseUrl');\n let cloneUrl = config.getOptionalString('cloneUrl');\n let gitilesBaseUrl = config.getString('gitilesBaseUrl');\n const username = config.getOptionalString('username');\n const password = config.getOptionalString('password')?.trim();\n\n if (!isValidHost(host)) {\n throw new Error(\n `Invalid Gerrit integration config, '${host}' is not a valid host`,\n );\n } else if (baseUrl && !isValidUrl(baseUrl)) {\n throw new Error(\n `Invalid Gerrit integration config, '${baseUrl}' is not a valid baseUrl`,\n );\n } else if (cloneUrl && !isValidUrl(cloneUrl)) {\n throw new Error(\n `Invalid Gerrit integration config, '${cloneUrl}' is not a valid cloneUrl`,\n );\n } else if (!isValidUrl(gitilesBaseUrl)) {\n throw new Error(\n `Invalid Gerrit integration config, '${gitilesBaseUrl}' is not a valid gitilesBaseUrl`,\n );\n }\n if (baseUrl) {\n baseUrl = trimEnd(baseUrl, '/');\n } else {\n baseUrl = `https://${host}`;\n }\n if (gitilesBaseUrl) {\n gitilesBaseUrl = trimEnd(gitilesBaseUrl, '/');\n } else {\n gitilesBaseUrl = `https://${host}`;\n }\n if (cloneUrl) {\n cloneUrl = trimEnd(cloneUrl, '/');\n } else {\n cloneUrl = baseUrl;\n }\n\n return {\n host,\n baseUrl,\n cloneUrl,\n gitilesBaseUrl,\n username,\n password,\n };\n}\n\n/**\n * Reads a set of Gerrit integration configs.\n *\n * @param configs - All of the integration config objects\n *\n * @public\n */\nexport function readGerritIntegrationConfigs(\n configs: Config[],\n): GerritIntegrationConfig[] {\n return configs.map(readGerritIntegrationConfig);\n}\n"],"names":[],"mappings":";;;AAuEO,SAAS,4BACd,MACyB,EAAA;AACzB,EAAM,MAAA,IAAA,GAAO,MAAO,CAAA,SAAA,CAAU,MAAM,CAAA,CAAA;AACpC,EAAI,IAAA,OAAA,GAAU,MAAO,CAAA,iBAAA,CAAkB,SAAS,CAAA,CAAA;AAChD,EAAI,IAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA,CAAA;AAClD,EAAI,IAAA,cAAA,GAAiB,MAAO,CAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA;AACtD,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA,CAAA;AACpD,EAAA,MAAM,QAAW,GAAA,MAAA,CAAO,iBAAkB,CAAA,UAAU,GAAG,IAAK,EAAA,CAAA;AAE5D,EAAI,IAAA,CAAC,WAAY,CAAA,IAAI,CAAG,EAAA;AACtB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,uCAAuC,IAAI,CAAA,qBAAA,CAAA;AAAA,KAC7C,CAAA;AAAA,GACS,MAAA,IAAA,OAAA,IAAW,CAAC,UAAA,CAAW,OAAO,CAAG,EAAA;AAC1C,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,uCAAuC,OAAO,CAAA,wBAAA,CAAA;AAAA,KAChD,CAAA;AAAA,GACS,MAAA,IAAA,QAAA,IAAY,CAAC,UAAA,CAAW,QAAQ,CAAG,EAAA;AAC5C,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,uCAAuC,QAAQ,CAAA,yBAAA,CAAA;AAAA,KACjD,CAAA;AAAA,GACS,MAAA,IAAA,CAAC,UAAW,CAAA,cAAc,CAAG,EAAA;AACtC,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,uCAAuC,cAAc,CAAA,+BAAA,CAAA;AAAA,KACvD,CAAA;AAAA,GACF;AACA,EAAA,IAAI,OAAS,EAAA;AACX,IAAU,OAAA,GAAA,OAAA,CAAQ,SAAS,GAAG,CAAA,CAAA;AAAA,GACzB,MAAA;AACL,IAAA,OAAA,GAAU,WAAW,IAAI,CAAA,CAAA,CAAA;AAAA,GAC3B;AACA,EAAA,IAAI,cAAgB,EAAA;AAClB,IAAiB,cAAA,GAAA,OAAA,CAAQ,gBAAgB,GAAG,CAAA,CAAA;AAAA,GACvC,MAAA;AACL,IAAA,cAAA,GAAiB,WAAW,IAAI,CAAA,CAAA,CAAA;AAAA,GAClC;AACA,EAAA,IAAI,QAAU,EAAA;AACZ,IAAW,QAAA,GAAA,OAAA,CAAQ,UAAU,GAAG,CAAA,CAAA;AAAA,GAC3B,MAAA;AACL,IAAW,QAAA,GAAA,OAAA,CAAA;AAAA,GACb;AAEA,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,cAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,GACF,CAAA;AACF,CAAA;AASO,SAAS,6BACd,OAC2B,EAAA;AAC3B,EAAO,OAAA,OAAA,CAAQ,IAAI,2BAA2B,CAAA,CAAA;AAChD;;;;"}
|
package/dist/harness/core.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function getHarnessEditContentsUrl(config, url) {
|
|
2
2
|
const parsedUrl = parseHarnessUrl(config, url);
|
|
3
|
-
return `${parsedUrl.baseUrl}/ng/account/${parsedUrl.accountId}/module/code/orgs/${parsedUrl.orgName}/projects/${parsedUrl.projectName}/${parsedUrl.repoName}/files/${parsedUrl.branch}/~/${parsedUrl.path}`;
|
|
3
|
+
return `${parsedUrl.baseUrl}/ng/account/${parsedUrl.accountId}/module/code/orgs/${parsedUrl.orgName}/projects/${parsedUrl.projectName}/repos/${parsedUrl.repoName}/files/${parsedUrl.branch}/~/${parsedUrl.path}`;
|
|
4
4
|
}
|
|
5
5
|
function getHarnessFileContentsUrl(config, url) {
|
|
6
6
|
const parsedUrl = parseHarnessUrl(config, url);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.esm.js","sources":["../../src/harness/core.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { HarnessIntegrationConfig } from './config';\n\n/**\n * Given a URL pointing to a file, returns a URL\n * for editing the contents of the data.\n *\n * @remarks\n *\n * Converts\n * from: https://app.harness.io/a/b/src/branchname/path/to/c.yaml\n * or: https://app.harness.io/a/b/_edit/branchname/path/to/c.yaml\n *\n * @param url - A URL pointing to a file\n * @param config - The relevant provider config\n * @public\n */\nexport function getHarnessEditContentsUrl(\n config: HarnessIntegrationConfig,\n url: string,\n) {\n const parsedUrl = parseHarnessUrl(config, url);\n return `${parsedUrl.baseUrl}/ng/account/${parsedUrl.accountId}/module/code/orgs/${parsedUrl.orgName}/projects/${parsedUrl.projectName}/${parsedUrl.repoName}/files/${parsedUrl.branch}/~/${parsedUrl.path}`;\n}\n\n/**\n * Given a file path URL,\n * it returns an API URL which returns the contents of the file .\n * @remarks\n *\n * Converts\n * from: https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/all-apis.yaml\n * to: https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/+/content/all-apis.yaml?routingId=accountId&include_commit=false&ref=refMain\n *\n * @param url - A URL pointing to a file\n * @param config - The relevant provider config\n * @public\n */\nexport function getHarnessFileContentsUrl(\n config: HarnessIntegrationConfig,\n url: string,\n) {\n const parsedUrl = parseHarnessUrl(config, url);\n return `${parsedUrl.baseUrl}/gateway/code/api/v1/repos/${parsedUrl.accountId}/${parsedUrl.orgName}/${parsedUrl.projectName}/${parsedUrl.repoName}/+/raw/${parsedUrl.path}?routingId=${parsedUrl.accountId}&git_ref=refs/heads/${parsedUrl.refString}`;\n}\n\n/**\n * Given a URL pointing to a repository/path, returns a URL\n * for archive contents of the repository.\n *\n * @remarks\n *\n * Converts\n * from: https://qa.harness.io/ng/account/accountId/module/code/orgs/orgId/projects/projectName/repos/repoName/files/branch/~/fileName\n * to: https://qa.harness.io/gateway/code/api/v1/repos/accountId/orgId/projectName/repoName/+/archive/branch.zip?routingId=accountId\n *\n * @param url - A URL pointing to a repository/path\n * @param config - The relevant provider config\n * @public\n */\nexport function getHarnessArchiveUrl(\n config: HarnessIntegrationConfig,\n url: string,\n) {\n const parsedUrl = parseHarnessUrl(config, url);\n return `${parsedUrl.baseUrl}/gateway/code/api/v1/repos/${parsedUrl.accountId}/${parsedUrl.orgName}/${parsedUrl.projectName}/${parsedUrl.repoName}/+/archive/${parsedUrl.branch}.zip?routingId=${parsedUrl.accountId}`;\n}\n\n/**\n * Given a URL pointing to a repository branch, returns a URL\n * for latest commit information.\n *\n * @remarks\n *\n * Converts\n * from: https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projectName/repos/repoName/files/branchName\n * to: https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projectName/repoName/+/content?routingId=accountId&include_commit=true&git_ref=refs/heads/branchName\n *\n * @param url - A URL pointing to a repository branch\n * @param config - The relevant provider config\n * @public\n */\nexport function getHarnessLatestCommitUrl(\n config: HarnessIntegrationConfig,\n url: string,\n) {\n const parsedUrl = parseHarnessUrl(config, url);\n return `${parsedUrl.baseUrl}/gateway/code/api/v1/repos/${parsedUrl.accountId}/${parsedUrl.orgName}/${parsedUrl.projectName}/${parsedUrl.repoName}/+/content?routingId=${parsedUrl.accountId}&include_commit=true&git_ref=refs/heads/${parsedUrl.branch}`;\n}\n\n/**\n * Return request headers for a Harness Code provider.\n *\n * @param config - A Harness Code provider config\n * @public\n */\nexport function getHarnessRequestOptions(config: HarnessIntegrationConfig): {\n headers?: Record<string, string>;\n} {\n const headers: Record<string, string> = {};\n const { token, apiKey } = config;\n\n if (apiKey) {\n headers['x-api-key'] = apiKey;\n } else if (token) {\n headers.Authorization = `Bearer ${token}`;\n }\n\n return {\n headers,\n };\n}\n\n/**\n * Return parsed git url properties.\n *\n * @param config - A Harness provider config\n * @param url - A URL pointing to a repository\n * @public\n */\nexport function parseHarnessUrl(\n config: HarnessIntegrationConfig,\n url: string,\n): {\n baseUrl: string;\n accountId: string;\n orgName: string;\n projectName: string;\n refString: string;\n repoName: string;\n path: string;\n refDashStr: string;\n branch: string;\n} {\n const baseUrl = `https://${config.host}`;\n try {\n const pathUrl = new URL(url);\n const pathSegments = pathUrl.pathname\n .split('/')\n .filter(segment => segment !== '');\n const urlParts = pathUrl.pathname.split('/');\n const [\n _ng,\n _account,\n accountId,\n _module,\n _moduleName,\n _org,\n orgName,\n _projects,\n projectName,\n _repos,\n repoName,\n _files,\n _ref,\n _branch,\n ..._path\n ] = pathSegments;\n const refAndPath = urlParts.slice(\n urlParts.findIndex(i => i === 'files' || i === 'edit') + 1,\n );\n const refIndex = refAndPath.findIndex(item => item === '~');\n const refString = refAndPath.slice(0, refIndex).join('/');\n const pathWithoutSlash =\n refIndex !== -1\n ? refAndPath\n .slice(refIndex + 1)\n .join('/')\n .replace(/^\\//, '')\n : '';\n return {\n baseUrl: baseUrl,\n accountId: accountId,\n orgName: orgName,\n projectName: projectName,\n refString: refString,\n path: pathWithoutSlash,\n repoName: repoName,\n refDashStr: refAndPath.slice(0, refIndex).join('-'),\n branch:\n refIndex !== -1\n ? refAndPath.slice(0, refIndex).join('/')\n : refAndPath.join('/'),\n };\n } catch (e) {\n throw new Error(`Incorrect URL: ${url}, ${e}`);\n }\n}\n"],"names":[],"mappings":"AA+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AM,CAAA,CAAA,eAAA,EAAkB,GAAG,CAAA,EAAA,EAAK,CAAC,CAAE,CAAA,CAAA,CAAA;AAAA,GAC/C;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"core.esm.js","sources":["../../src/harness/core.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { HarnessIntegrationConfig } from './config';\n\n/**\n * Given a URL pointing to a file, returns a URL\n * for editing the contents of the data.\n *\n * @remarks\n *\n * Converts\n * from: https://app.harness.io/a/b/src/branchname/path/to/c.yaml\n * or: https://app.harness.io/a/b/_edit/branchname/path/to/c.yaml\n *\n * @param url - A URL pointing to a file\n * @param config - The relevant provider config\n * @public\n */\nexport function getHarnessEditContentsUrl(\n config: HarnessIntegrationConfig,\n url: string,\n) {\n const parsedUrl = parseHarnessUrl(config, url);\n return `${parsedUrl.baseUrl}/ng/account/${parsedUrl.accountId}/module/code/orgs/${parsedUrl.orgName}/projects/${parsedUrl.projectName}/repos/${parsedUrl.repoName}/files/${parsedUrl.branch}/~/${parsedUrl.path}`;\n}\n\n/**\n * Given a file path URL,\n * it returns an API URL which returns the contents of the file .\n * @remarks\n *\n * Converts\n * from: https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/all-apis.yaml\n * to: https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/+/content/all-apis.yaml?routingId=accountId&include_commit=false&ref=refMain\n *\n * @param url - A URL pointing to a file\n * @param config - The relevant provider config\n * @public\n */\nexport function getHarnessFileContentsUrl(\n config: HarnessIntegrationConfig,\n url: string,\n) {\n const parsedUrl = parseHarnessUrl(config, url);\n return `${parsedUrl.baseUrl}/gateway/code/api/v1/repos/${parsedUrl.accountId}/${parsedUrl.orgName}/${parsedUrl.projectName}/${parsedUrl.repoName}/+/raw/${parsedUrl.path}?routingId=${parsedUrl.accountId}&git_ref=refs/heads/${parsedUrl.refString}`;\n}\n\n/**\n * Given a URL pointing to a repository/path, returns a URL\n * for archive contents of the repository.\n *\n * @remarks\n *\n * Converts\n * from: https://qa.harness.io/ng/account/accountId/module/code/orgs/orgId/projects/projectName/repos/repoName/files/branch/~/fileName\n * to: https://qa.harness.io/gateway/code/api/v1/repos/accountId/orgId/projectName/repoName/+/archive/branch.zip?routingId=accountId\n *\n * @param url - A URL pointing to a repository/path\n * @param config - The relevant provider config\n * @public\n */\nexport function getHarnessArchiveUrl(\n config: HarnessIntegrationConfig,\n url: string,\n) {\n const parsedUrl = parseHarnessUrl(config, url);\n return `${parsedUrl.baseUrl}/gateway/code/api/v1/repos/${parsedUrl.accountId}/${parsedUrl.orgName}/${parsedUrl.projectName}/${parsedUrl.repoName}/+/archive/${parsedUrl.branch}.zip?routingId=${parsedUrl.accountId}`;\n}\n\n/**\n * Given a URL pointing to a repository branch, returns a URL\n * for latest commit information.\n *\n * @remarks\n *\n * Converts\n * from: https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projectName/repos/repoName/files/branchName\n * to: https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projectName/repoName/+/content?routingId=accountId&include_commit=true&git_ref=refs/heads/branchName\n *\n * @param url - A URL pointing to a repository branch\n * @param config - The relevant provider config\n * @public\n */\nexport function getHarnessLatestCommitUrl(\n config: HarnessIntegrationConfig,\n url: string,\n) {\n const parsedUrl = parseHarnessUrl(config, url);\n return `${parsedUrl.baseUrl}/gateway/code/api/v1/repos/${parsedUrl.accountId}/${parsedUrl.orgName}/${parsedUrl.projectName}/${parsedUrl.repoName}/+/content?routingId=${parsedUrl.accountId}&include_commit=true&git_ref=refs/heads/${parsedUrl.branch}`;\n}\n\n/**\n * Return request headers for a Harness Code provider.\n *\n * @param config - A Harness Code provider config\n * @public\n */\nexport function getHarnessRequestOptions(config: HarnessIntegrationConfig): {\n headers?: Record<string, string>;\n} {\n const headers: Record<string, string> = {};\n const { token, apiKey } = config;\n\n if (apiKey) {\n headers['x-api-key'] = apiKey;\n } else if (token) {\n headers.Authorization = `Bearer ${token}`;\n }\n\n return {\n headers,\n };\n}\n\n/**\n * Return parsed git url properties.\n *\n * @param config - A Harness provider config\n * @param url - A URL pointing to a repository\n * @public\n */\nexport function parseHarnessUrl(\n config: HarnessIntegrationConfig,\n url: string,\n): {\n baseUrl: string;\n accountId: string;\n orgName: string;\n projectName: string;\n refString: string;\n repoName: string;\n path: string;\n refDashStr: string;\n branch: string;\n} {\n const baseUrl = `https://${config.host}`;\n try {\n const pathUrl = new URL(url);\n const pathSegments = pathUrl.pathname\n .split('/')\n .filter(segment => segment !== '');\n const urlParts = pathUrl.pathname.split('/');\n const [\n _ng,\n _account,\n accountId,\n _module,\n _moduleName,\n _org,\n orgName,\n _projects,\n projectName,\n _repos,\n repoName,\n _files,\n _ref,\n _branch,\n ..._path\n ] = pathSegments;\n const refAndPath = urlParts.slice(\n urlParts.findIndex(i => i === 'files' || i === 'edit') + 1,\n );\n const refIndex = refAndPath.findIndex(item => item === '~');\n const refString = refAndPath.slice(0, refIndex).join('/');\n const pathWithoutSlash =\n refIndex !== -1\n ? refAndPath\n .slice(refIndex + 1)\n .join('/')\n .replace(/^\\//, '')\n : '';\n return {\n baseUrl: baseUrl,\n accountId: accountId,\n orgName: orgName,\n projectName: projectName,\n refString: refString,\n path: pathWithoutSlash,\n repoName: repoName,\n refDashStr: refAndPath.slice(0, refIndex).join('-'),\n branch:\n refIndex !== -1\n ? refAndPath.slice(0, refIndex).join('/')\n : refAndPath.join('/'),\n };\n } catch (e) {\n throw new Error(`Incorrect URL: ${url}, ${e}`);\n }\n}\n"],"names":[],"mappings":"AA+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M,CAAA,CAAA,eAAA,EAAkB,GAAG,CAAA,EAAA,EAAK,CAAC,CAAE,CAAA,CAAA,CAAA;AAAA,GAC/C;AACF;;;;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -155,23 +155,19 @@ function readAwsCodeCommitIntegrationConfig(config) {
|
|
|
155
155
|
const secretAccessKey = config.getOptionalString("secretAccessKey")?.trim();
|
|
156
156
|
const roleArn = config.getOptionalString("roleArn");
|
|
157
157
|
const externalId = config.getOptionalString("externalId");
|
|
158
|
-
const
|
|
158
|
+
const region = config.getString("region");
|
|
159
|
+
const host = config.getOptionalString("host") || `${region}.${AMAZON_AWS_CODECOMMIT_HOST}`;
|
|
159
160
|
return {
|
|
160
161
|
host,
|
|
161
162
|
accessKeyId,
|
|
162
163
|
secretAccessKey,
|
|
163
164
|
roleArn,
|
|
164
|
-
externalId
|
|
165
|
+
externalId,
|
|
166
|
+
region
|
|
165
167
|
};
|
|
166
168
|
}
|
|
167
169
|
function readAwsCodeCommitIntegrationConfigs(configs) {
|
|
168
|
-
|
|
169
|
-
if (!result.some((c) => c.host === AMAZON_AWS_CODECOMMIT_HOST)) {
|
|
170
|
-
result.push({
|
|
171
|
-
host: AMAZON_AWS_CODECOMMIT_HOST
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
return result;
|
|
170
|
+
return configs.map(readAwsCodeCommitIntegrationConfig);
|
|
175
171
|
}
|
|
176
172
|
|
|
177
173
|
class AwsCodeCommitIntegration {
|
|
@@ -1210,7 +1206,7 @@ function readGerritIntegrationConfig(config) {
|
|
|
1210
1206
|
const host = config.getString("host");
|
|
1211
1207
|
let baseUrl = config.getOptionalString("baseUrl");
|
|
1212
1208
|
let cloneUrl = config.getOptionalString("cloneUrl");
|
|
1213
|
-
let gitilesBaseUrl = config.
|
|
1209
|
+
let gitilesBaseUrl = config.getString("gitilesBaseUrl");
|
|
1214
1210
|
const username = config.getOptionalString("username");
|
|
1215
1211
|
const password = config.getOptionalString("password")?.trim();
|
|
1216
1212
|
if (!isValidHost(host)) {
|
|
@@ -1225,7 +1221,7 @@ function readGerritIntegrationConfig(config) {
|
|
|
1225
1221
|
throw new Error(
|
|
1226
1222
|
`Invalid Gerrit integration config, '${cloneUrl}' is not a valid cloneUrl`
|
|
1227
1223
|
);
|
|
1228
|
-
} else if (
|
|
1224
|
+
} else if (!isValidUrl(gitilesBaseUrl)) {
|
|
1229
1225
|
throw new Error(
|
|
1230
1226
|
`Invalid Gerrit integration config, '${gitilesBaseUrl}' is not a valid gitilesBaseUrl`
|
|
1231
1227
|
);
|
|
@@ -1876,20 +1872,6 @@ function replaceGithubUrlType(url, type) {
|
|
|
1876
1872
|
);
|
|
1877
1873
|
}
|
|
1878
1874
|
|
|
1879
|
-
const getGitHubFileFetchUrl = getGithubFileFetchUrl;
|
|
1880
|
-
class GitHubIntegration extends GithubIntegration {
|
|
1881
|
-
static factory = GithubIntegration.factory;
|
|
1882
|
-
constructor(integrationConfig) {
|
|
1883
|
-
super(integrationConfig);
|
|
1884
|
-
}
|
|
1885
|
-
get config() {
|
|
1886
|
-
return super.config;
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1889
|
-
const readGitHubIntegrationConfig = readGithubIntegrationConfig;
|
|
1890
|
-
const readGitHubIntegrationConfigs = readGithubIntegrationConfigs;
|
|
1891
|
-
const replaceGitHubUrlType = replaceGithubUrlType;
|
|
1892
|
-
|
|
1893
1875
|
const GITLAB_HOST = "gitlab.com";
|
|
1894
1876
|
const GITLAB_API_BASE_URL = "https://gitlab.com/api/v4";
|
|
1895
1877
|
function readGitLabIntegrationConfig(config) {
|
|
@@ -2112,7 +2094,7 @@ function readHarnessConfig(config) {
|
|
|
2112
2094
|
|
|
2113
2095
|
function getHarnessEditContentsUrl(config, url) {
|
|
2114
2096
|
const parsedUrl = parseHarnessUrl(config, url);
|
|
2115
|
-
return `${parsedUrl.baseUrl}/ng/account/${parsedUrl.accountId}/module/code/orgs/${parsedUrl.orgName}/projects/${parsedUrl.projectName}/${parsedUrl.repoName}/files/${parsedUrl.branch}/~/${parsedUrl.path}`;
|
|
2097
|
+
return `${parsedUrl.baseUrl}/ng/account/${parsedUrl.accountId}/module/code/orgs/${parsedUrl.orgName}/projects/${parsedUrl.projectName}/repos/${parsedUrl.repoName}/files/${parsedUrl.branch}/~/${parsedUrl.path}`;
|
|
2116
2098
|
}
|
|
2117
2099
|
function getHarnessFileContentsUrl(config, url) {
|
|
2118
2100
|
const parsedUrl = parseHarnessUrl(config, url);
|
|
@@ -2311,7 +2293,6 @@ exports.DefaultAzureDevOpsCredentialsProvider = DefaultAzureDevOpsCredentialsPro
|
|
|
2311
2293
|
exports.DefaultGithubCredentialsProvider = DefaultGithubCredentialsProvider;
|
|
2312
2294
|
exports.DefaultGitlabCredentialsProvider = DefaultGitlabCredentialsProvider;
|
|
2313
2295
|
exports.GerritIntegration = GerritIntegration;
|
|
2314
|
-
exports.GitHubIntegration = GitHubIntegration;
|
|
2315
2296
|
exports.GitLabIntegration = GitLabIntegration;
|
|
2316
2297
|
exports.GiteaIntegration = GiteaIntegration;
|
|
2317
2298
|
exports.GithubAppCredentialsMux = GithubAppCredentialsMux;
|
|
@@ -2342,7 +2323,6 @@ exports.getGerritCloneRepoUrl = getGerritCloneRepoUrl;
|
|
|
2342
2323
|
exports.getGerritFileContentsApiUrl = getGerritFileContentsApiUrl;
|
|
2343
2324
|
exports.getGerritProjectsApiUrl = getGerritProjectsApiUrl;
|
|
2344
2325
|
exports.getGerritRequestOptions = getGerritRequestOptions;
|
|
2345
|
-
exports.getGitHubFileFetchUrl = getGitHubFileFetchUrl;
|
|
2346
2326
|
exports.getGitHubRequestOptions = getGitHubRequestOptions;
|
|
2347
2327
|
exports.getGitLabFileFetchUrl = getGitLabFileFetchUrl;
|
|
2348
2328
|
exports.getGitLabIntegrationRelativePath = getGitLabIntegrationRelativePath;
|
|
@@ -2375,8 +2355,6 @@ exports.readBitbucketServerIntegrationConfig = readBitbucketServerIntegrationCon
|
|
|
2375
2355
|
exports.readBitbucketServerIntegrationConfigs = readBitbucketServerIntegrationConfigs;
|
|
2376
2356
|
exports.readGerritIntegrationConfig = readGerritIntegrationConfig;
|
|
2377
2357
|
exports.readGerritIntegrationConfigs = readGerritIntegrationConfigs;
|
|
2378
|
-
exports.readGitHubIntegrationConfig = readGitHubIntegrationConfig;
|
|
2379
|
-
exports.readGitHubIntegrationConfigs = readGitHubIntegrationConfigs;
|
|
2380
2358
|
exports.readGitLabIntegrationConfig = readGitLabIntegrationConfig;
|
|
2381
2359
|
exports.readGitLabIntegrationConfigs = readGitLabIntegrationConfigs;
|
|
2382
2360
|
exports.readGiteaConfig = readGiteaConfig;
|
|
@@ -2384,7 +2362,6 @@ exports.readGithubIntegrationConfig = readGithubIntegrationConfig;
|
|
|
2384
2362
|
exports.readGithubIntegrationConfigs = readGithubIntegrationConfigs;
|
|
2385
2363
|
exports.readGoogleGcsIntegrationConfig = readGoogleGcsIntegrationConfig;
|
|
2386
2364
|
exports.readHarnessConfig = readHarnessConfig;
|
|
2387
|
-
exports.replaceGitHubUrlType = replaceGitHubUrlType;
|
|
2388
2365
|
exports.replaceGitLabUrlType = replaceGitLabUrlType;
|
|
2389
2366
|
exports.replaceGithubUrlType = replaceGithubUrlType;
|
|
2390
2367
|
//# sourceMappingURL=index.cjs.js.map
|