@backstage/plugin-catalog-import 0.11.1-next.0 → 0.12.0-next.1
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 +11 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.esm.js +4 -4
- package/dist/alpha.esm.js.map +1 -1
- package/dist/api/CatalogImportClient.esm.js +4 -6
- package/dist/api/CatalogImportClient.esm.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/plugin.esm.js +4 -4
- package/dist/plugin.esm.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-import
|
|
2
2
|
|
|
3
|
+
## 0.12.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4f92394: Migrate from identityApi to fetchApi in frontend plugins.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/plugin-catalog-react@1.12.1-next.0
|
|
13
|
+
|
|
3
14
|
## 0.11.1-next.0
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createApiFactory, discoveryApiRef,
|
|
1
|
+
import { createApiFactory, discoveryApiRef, fetchApiRef, configApiRef } from '@backstage/core-plugin-api';
|
|
2
2
|
import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api';
|
|
3
3
|
import { createPageExtension, createApiExtension, createPlugin } from '@backstage/frontend-plugin-api';
|
|
4
4
|
import { scmAuthApiRef, scmIntegrationsApiRef } from '@backstage/integration-react';
|
|
@@ -21,7 +21,7 @@ const catalogImportApi = createApiExtension({
|
|
|
21
21
|
deps: {
|
|
22
22
|
discoveryApi: discoveryApiRef,
|
|
23
23
|
scmAuthApi: scmAuthApiRef,
|
|
24
|
-
|
|
24
|
+
fetchApi: fetchApiRef,
|
|
25
25
|
scmIntegrationsApi: scmIntegrationsApiRef,
|
|
26
26
|
catalogApi: catalogApiRef,
|
|
27
27
|
configApi: configApiRef
|
|
@@ -29,7 +29,7 @@ const catalogImportApi = createApiExtension({
|
|
|
29
29
|
factory: ({
|
|
30
30
|
discoveryApi,
|
|
31
31
|
scmAuthApi,
|
|
32
|
-
|
|
32
|
+
fetchApi,
|
|
33
33
|
scmIntegrationsApi,
|
|
34
34
|
catalogApi,
|
|
35
35
|
configApi
|
|
@@ -37,7 +37,7 @@ const catalogImportApi = createApiExtension({
|
|
|
37
37
|
discoveryApi,
|
|
38
38
|
scmAuthApi,
|
|
39
39
|
scmIntegrationsApi,
|
|
40
|
-
|
|
40
|
+
fetchApi,
|
|
41
41
|
catalogApi,
|
|
42
42
|
configApi
|
|
43
43
|
})
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {\n configApiRef,\n createApiFactory,\n discoveryApiRef,\n
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {\n configApiRef,\n createApiFactory,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n createApiExtension,\n createPageExtension,\n createPlugin,\n} from '@backstage/frontend-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport React from 'react';\nimport { CatalogImportClient, catalogImportApiRef } from './api';\nimport { rootRouteRef } from './plugin';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\n\n// TODO: It's currently possible to override the import page with a custom one. We need to decide\n// whether this type of override is typically done with an input or by overriding the entire extension.\nconst catalogImportPage = createPageExtension({\n defaultPath: '/catalog-import',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: () =>\n import('./components/ImportPage').then(m =>\n compatWrapper(<m.ImportPage />),\n ),\n});\n\nconst catalogImportApi = createApiExtension({\n factory: createApiFactory({\n api: catalogImportApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmAuthApi: scmAuthApiRef,\n fetchApi: fetchApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n catalogApi: catalogApiRef,\n configApi: configApiRef,\n },\n factory: ({\n discoveryApi,\n scmAuthApi,\n fetchApi,\n scmIntegrationsApi,\n catalogApi,\n configApi,\n }) =>\n new CatalogImportClient({\n discoveryApi,\n scmAuthApi,\n scmIntegrationsApi,\n fetchApi,\n catalogApi,\n configApi,\n }),\n }),\n});\n\n/** @alpha */\nexport default createPlugin({\n id: 'catalog-import',\n extensions: [catalogImportApi, catalogImportPage],\n routes: {\n importPage: convertLegacyRouteRef(rootRouteRef),\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AA0CA,MAAM,oBAAoB,mBAAoB,CAAA;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|
|
8
8
|
discoveryApi;
|
|
9
|
-
|
|
9
|
+
fetchApi;
|
|
10
10
|
scmAuthApi;
|
|
11
11
|
scmIntegrationsApi;
|
|
12
12
|
catalogApi;
|
|
@@ -14,7 +14,7 @@ class CatalogImportClient {
|
|
|
14
14
|
constructor(options) {
|
|
15
15
|
this.discoveryApi = options.discoveryApi;
|
|
16
16
|
this.scmAuthApi = options.scmAuthApi;
|
|
17
|
-
this.
|
|
17
|
+
this.fetchApi = options.fetchApi;
|
|
18
18
|
this.scmIntegrationsApi = options.scmIntegrationsApi;
|
|
19
19
|
this.catalogApi = options.catalogApi;
|
|
20
20
|
this.configApi = options.configApi;
|
|
@@ -125,13 +125,11 @@ For more information, read an [overview of the Backstage software catalog](https
|
|
|
125
125
|
}
|
|
126
126
|
// TODO: this could be part of the catalog api
|
|
127
127
|
async analyzeLocation(options) {
|
|
128
|
-
const
|
|
129
|
-
const response = await fetch(
|
|
128
|
+
const response = await this.fetchApi.fetch(
|
|
130
129
|
`${await this.discoveryApi.getBaseUrl("catalog")}/analyze-location`,
|
|
131
130
|
{
|
|
132
131
|
headers: {
|
|
133
|
-
"Content-Type": "application/json"
|
|
134
|
-
...token && { Authorization: `Bearer ${token}` }
|
|
132
|
+
"Content-Type": "application/json"
|
|
135
133
|
},
|
|
136
134
|
method: "POST",
|
|
137
135
|
body: JSON.stringify({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogImportClient.esm.js","sources":["../../src/api/CatalogImportClient.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 { CatalogApi } from '@backstage/catalog-client';\nimport {\n ConfigApi,\n DiscoveryApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport {\n GithubIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { ScmAuthApi } from '@backstage/integration-react';\nimport { Octokit } from '@octokit/rest';\nimport { Base64 } from 'js-base64';\nimport { AnalyzeResult, CatalogImportApi } from './CatalogImportApi';\nimport YAML from 'yaml';\nimport { getGithubIntegrationConfig } from './GitHub';\nimport { getBranchName, getCatalogFilename } from '../components/helpers';\nimport { AnalyzeLocationResponse } from '@backstage/plugin-catalog-common';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\n\n/**\n * The default implementation of the {@link CatalogImportApi}.\n *\n * @public\n */\nexport class CatalogImportClient implements CatalogImportApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n private readonly scmAuthApi: ScmAuthApi;\n private readonly scmIntegrationsApi: ScmIntegrationRegistry;\n private readonly catalogApi: CatalogApi;\n private readonly configApi: ConfigApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n scmAuthApi: ScmAuthApi;\n identityApi: IdentityApi;\n scmIntegrationsApi: ScmIntegrationRegistry;\n catalogApi: CatalogApi;\n configApi: ConfigApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.scmAuthApi = options.scmAuthApi;\n this.identityApi = options.identityApi;\n this.scmIntegrationsApi = options.scmIntegrationsApi;\n this.catalogApi = options.catalogApi;\n this.configApi = options.configApi;\n }\n\n async analyzeUrl(url: string): Promise<AnalyzeResult> {\n if (\n new URL(url).pathname.match(/\\.ya?ml$/) ||\n new URL(url).searchParams.get('path')?.match(/.ya?ml$/)\n ) {\n const location = await this.catalogApi.addLocation({\n type: 'url',\n target: url,\n dryRun: true,\n });\n\n return {\n type: 'locations',\n locations: [\n {\n exists: location.exists,\n target: location.location.target,\n entities: location.entities.map(e => ({\n kind: e.kind,\n namespace: e.metadata.namespace ?? 'default',\n name: e.metadata.name,\n })),\n },\n ],\n };\n }\n\n const ghConfig = getGithubIntegrationConfig(this.scmIntegrationsApi, url);\n if (!ghConfig) {\n const other = this.scmIntegrationsApi.byUrl(url);\n const catalogFilename = getCatalogFilename(this.configApi);\n\n if (other) {\n throw new Error(\n `The ${other.title} integration only supports full URLs to ${catalogFilename} files. Did you try to pass in the URL of a directory instead?`,\n );\n }\n throw new Error(\n `This URL was not recognized as a valid GitHub URL because there was no configured integration that matched the given host name. You could try to paste the full URL to a ${catalogFilename} file instead.`,\n );\n }\n\n const analyzation = await this.analyzeLocation({\n repo: url,\n });\n\n if (analyzation.existingEntityFiles.length > 0) {\n const locations = analyzation.existingEntityFiles.reduce<\n Record<\n string,\n {\n target: string;\n exists?: boolean;\n entities: CompoundEntityRef[];\n }\n >\n >((state, curr) => {\n state[curr.location.target] = {\n target: curr.location.target,\n exists: curr.isRegistered,\n entities: [\n ...(curr.location.target in state\n ? state[curr.location.target].entities\n : []),\n {\n name: curr.entity.metadata.name,\n namespace: curr.entity.metadata.namespace ?? 'default',\n kind: curr.entity.kind,\n },\n ],\n };\n return state;\n }, {});\n return {\n type: 'locations',\n locations: Object.values(locations),\n };\n }\n\n return {\n type: 'repository',\n integrationType: 'github',\n url: url,\n generatedEntities: analyzation.generateEntities.map(x => x.entity),\n };\n }\n\n async preparePullRequest(): Promise<{\n title: string;\n body: string;\n }> {\n const appTitle =\n this.configApi.getOptionalString('app.title') ?? 'Backstage';\n const appBaseUrl = this.configApi.getString('app.baseUrl');\n const catalogFilename = getCatalogFilename(this.configApi);\n\n return {\n title: `Add ${catalogFilename} config file`,\n body: `This pull request adds a **Backstage entity metadata file** \\\nto this repository so that the component can be added to the \\\n[${appTitle} software catalog](${appBaseUrl}).\\n\\nAfter this pull request is merged, \\\nthe component will become available.\\n\\nFor more information, read an \\\n[overview of the Backstage software catalog](https://backstage.io/docs/features/software-catalog/).`,\n };\n }\n\n async submitPullRequest(options: {\n repositoryUrl: string;\n fileContent: string;\n title: string;\n body: string;\n }): Promise<{ link: string; location: string }> {\n const { repositoryUrl, fileContent, title, body } = options;\n const parseData = YAML.parse(fileContent);\n\n const validationResponse = await this.catalogApi.validateEntity(\n parseData,\n `url:${repositoryUrl}`,\n );\n if (!validationResponse.valid) {\n throw new Error(validationResponse.errors[0].message);\n }\n const ghConfig = getGithubIntegrationConfig(\n this.scmIntegrationsApi,\n repositoryUrl,\n );\n\n if (ghConfig) {\n return await this.submitGitHubPrToRepo({\n ...ghConfig,\n repositoryUrl,\n fileContent,\n title,\n body,\n });\n }\n throw new Error('unimplemented!');\n }\n\n // TODO: this could be part of the catalog api\n private async analyzeLocation(options: {\n repo: string;\n }): Promise<AnalyzeLocationResponse> {\n const { token } = await this.identityApi.getCredentials();\n const response = await fetch(\n `${await this.discoveryApi.getBaseUrl('catalog')}/analyze-location`,\n {\n headers: {\n 'Content-Type': 'application/json',\n ...(token && { Authorization: `Bearer ${token}` }),\n },\n method: 'POST',\n body: JSON.stringify({\n location: { type: 'url', target: options.repo },\n ...(this.configApi.getOptionalString(\n 'catalog.import.entityFilename',\n ) && {\n catalogFilename: this.configApi.getOptionalString(\n 'catalog.import.entityFilename',\n ),\n }),\n }),\n },\n ).catch(e => {\n throw new Error(`Failed to generate entity definitions, ${e.message}`);\n });\n if (!response.ok) {\n throw new Error(\n `Failed to generate entity definitions. Received http response ${response.status}: ${response.statusText}`,\n );\n }\n\n const payload = await response.json();\n return payload;\n }\n\n // TODO: extract this function and implement for non-github\n private async submitGitHubPrToRepo(options: {\n owner: string;\n repo: string;\n title: string;\n body: string;\n fileContent: string;\n repositoryUrl: string;\n githubIntegrationConfig: GithubIntegrationConfig;\n }): Promise<{ link: string; location: string }> {\n const {\n owner,\n repo,\n title,\n body,\n fileContent,\n repositoryUrl,\n githubIntegrationConfig,\n } = options;\n\n const { token } = await this.scmAuthApi.getCredentials({\n url: repositoryUrl,\n additionalScope: {\n repoWrite: true,\n },\n });\n\n const octo = new Octokit({\n auth: token,\n baseUrl: githubIntegrationConfig.apiBaseUrl,\n });\n\n const branchName = getBranchName(this.configApi);\n const fileName = getCatalogFilename(this.configApi);\n\n const repoData = await octo.repos\n .get({\n owner,\n repo,\n })\n .catch(e => {\n throw new Error(formatHttpErrorMessage(\"Couldn't fetch repo data\", e));\n });\n\n const parentRef = await octo.git\n .getRef({\n owner,\n repo,\n ref: `heads/${repoData.data.default_branch}`,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\"Couldn't fetch default branch data\", e),\n );\n });\n\n await octo.git\n .createRef({\n owner,\n repo,\n ref: `refs/heads/${branchName}`,\n sha: parentRef.data.object.sha,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a new branch with name '${branchName}'`,\n e,\n ),\n );\n });\n\n await octo.repos\n .createOrUpdateFileContents({\n owner,\n repo,\n path: fileName,\n message: title,\n content: Base64.encode(fileContent),\n branch: branchName,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a commit with ${fileName} file added`,\n e,\n ),\n );\n });\n\n const pullRequestResponse = await octo.pulls\n .create({\n owner,\n repo,\n title,\n head: branchName,\n body,\n base: repoData.data.default_branch,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a pull request for ${branchName} branch`,\n e,\n ),\n );\n });\n\n return {\n link: pullRequestResponse.data.html_url,\n location: `https://${githubIntegrationConfig.host}/${owner}/${repo}/blob/${repoData.data.default_branch}/${fileName}`,\n };\n }\n}\n\nfunction formatHttpErrorMessage(\n message: string,\n error: { status: number; message: string },\n) {\n return `${message}, received http response status code ${error.status}: ${error.message}`;\n}\n"],"names":[],"mappings":";;;;;;AAyCO,MAAM,mBAAgD,CAAA;AAAA,EAC1C,YAAA,CAAA;AAAA,EACA,WAAA,CAAA;AAAA,EACA,UAAA,CAAA;AAAA,EACA,kBAAA,CAAA;AAAA,EACA,UAAA,CAAA;AAAA,EACA,SAAA,CAAA;AAAA,EAEjB,YAAY,OAOT,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CAAA,qCAAA,EAAwC,MAAM,MAAM,CAAA,EAAA,EAAK,MAAM,OAAO,CAAA,CAAA,CAAA;AACzF;;;;"}
|
|
1
|
+
{"version":3,"file":"CatalogImportClient.esm.js","sources":["../../src/api/CatalogImportClient.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 { CatalogApi } from '@backstage/catalog-client';\nimport { ConfigApi, DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport {\n GithubIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { ScmAuthApi } from '@backstage/integration-react';\nimport { Octokit } from '@octokit/rest';\nimport { Base64 } from 'js-base64';\nimport { AnalyzeResult, CatalogImportApi } from './CatalogImportApi';\nimport YAML from 'yaml';\nimport { getGithubIntegrationConfig } from './GitHub';\nimport { getBranchName, getCatalogFilename } from '../components/helpers';\nimport { AnalyzeLocationResponse } from '@backstage/plugin-catalog-common';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\n\n/**\n * The default implementation of the {@link CatalogImportApi}.\n *\n * @public\n */\nexport class CatalogImportClient implements CatalogImportApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n private readonly scmAuthApi: ScmAuthApi;\n private readonly scmIntegrationsApi: ScmIntegrationRegistry;\n private readonly catalogApi: CatalogApi;\n private readonly configApi: ConfigApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n scmAuthApi: ScmAuthApi;\n fetchApi: FetchApi;\n scmIntegrationsApi: ScmIntegrationRegistry;\n catalogApi: CatalogApi;\n configApi: ConfigApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.scmAuthApi = options.scmAuthApi;\n this.fetchApi = options.fetchApi;\n this.scmIntegrationsApi = options.scmIntegrationsApi;\n this.catalogApi = options.catalogApi;\n this.configApi = options.configApi;\n }\n\n async analyzeUrl(url: string): Promise<AnalyzeResult> {\n if (\n new URL(url).pathname.match(/\\.ya?ml$/) ||\n new URL(url).searchParams.get('path')?.match(/.ya?ml$/)\n ) {\n const location = await this.catalogApi.addLocation({\n type: 'url',\n target: url,\n dryRun: true,\n });\n\n return {\n type: 'locations',\n locations: [\n {\n exists: location.exists,\n target: location.location.target,\n entities: location.entities.map(e => ({\n kind: e.kind,\n namespace: e.metadata.namespace ?? 'default',\n name: e.metadata.name,\n })),\n },\n ],\n };\n }\n\n const ghConfig = getGithubIntegrationConfig(this.scmIntegrationsApi, url);\n if (!ghConfig) {\n const other = this.scmIntegrationsApi.byUrl(url);\n const catalogFilename = getCatalogFilename(this.configApi);\n\n if (other) {\n throw new Error(\n `The ${other.title} integration only supports full URLs to ${catalogFilename} files. Did you try to pass in the URL of a directory instead?`,\n );\n }\n throw new Error(\n `This URL was not recognized as a valid GitHub URL because there was no configured integration that matched the given host name. You could try to paste the full URL to a ${catalogFilename} file instead.`,\n );\n }\n\n const analyzation = await this.analyzeLocation({\n repo: url,\n });\n\n if (analyzation.existingEntityFiles.length > 0) {\n const locations = analyzation.existingEntityFiles.reduce<\n Record<\n string,\n {\n target: string;\n exists?: boolean;\n entities: CompoundEntityRef[];\n }\n >\n >((state, curr) => {\n state[curr.location.target] = {\n target: curr.location.target,\n exists: curr.isRegistered,\n entities: [\n ...(curr.location.target in state\n ? state[curr.location.target].entities\n : []),\n {\n name: curr.entity.metadata.name,\n namespace: curr.entity.metadata.namespace ?? 'default',\n kind: curr.entity.kind,\n },\n ],\n };\n return state;\n }, {});\n return {\n type: 'locations',\n locations: Object.values(locations),\n };\n }\n\n return {\n type: 'repository',\n integrationType: 'github',\n url: url,\n generatedEntities: analyzation.generateEntities.map(x => x.entity),\n };\n }\n\n async preparePullRequest(): Promise<{\n title: string;\n body: string;\n }> {\n const appTitle =\n this.configApi.getOptionalString('app.title') ?? 'Backstage';\n const appBaseUrl = this.configApi.getString('app.baseUrl');\n const catalogFilename = getCatalogFilename(this.configApi);\n\n return {\n title: `Add ${catalogFilename} config file`,\n body: `This pull request adds a **Backstage entity metadata file** \\\nto this repository so that the component can be added to the \\\n[${appTitle} software catalog](${appBaseUrl}).\\n\\nAfter this pull request is merged, \\\nthe component will become available.\\n\\nFor more information, read an \\\n[overview of the Backstage software catalog](https://backstage.io/docs/features/software-catalog/).`,\n };\n }\n\n async submitPullRequest(options: {\n repositoryUrl: string;\n fileContent: string;\n title: string;\n body: string;\n }): Promise<{ link: string; location: string }> {\n const { repositoryUrl, fileContent, title, body } = options;\n const parseData = YAML.parse(fileContent);\n\n const validationResponse = await this.catalogApi.validateEntity(\n parseData,\n `url:${repositoryUrl}`,\n );\n if (!validationResponse.valid) {\n throw new Error(validationResponse.errors[0].message);\n }\n const ghConfig = getGithubIntegrationConfig(\n this.scmIntegrationsApi,\n repositoryUrl,\n );\n\n if (ghConfig) {\n return await this.submitGitHubPrToRepo({\n ...ghConfig,\n repositoryUrl,\n fileContent,\n title,\n body,\n });\n }\n throw new Error('unimplemented!');\n }\n\n // TODO: this could be part of the catalog api\n private async analyzeLocation(options: {\n repo: string;\n }): Promise<AnalyzeLocationResponse> {\n const response = await this.fetchApi\n .fetch(\n `${await this.discoveryApi.getBaseUrl('catalog')}/analyze-location`,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n body: JSON.stringify({\n location: { type: 'url', target: options.repo },\n ...(this.configApi.getOptionalString(\n 'catalog.import.entityFilename',\n ) && {\n catalogFilename: this.configApi.getOptionalString(\n 'catalog.import.entityFilename',\n ),\n }),\n }),\n },\n )\n .catch(e => {\n throw new Error(`Failed to generate entity definitions, ${e.message}`);\n });\n if (!response.ok) {\n throw new Error(\n `Failed to generate entity definitions. Received http response ${response.status}: ${response.statusText}`,\n );\n }\n\n const payload = await response.json();\n return payload;\n }\n\n // TODO: extract this function and implement for non-github\n private async submitGitHubPrToRepo(options: {\n owner: string;\n repo: string;\n title: string;\n body: string;\n fileContent: string;\n repositoryUrl: string;\n githubIntegrationConfig: GithubIntegrationConfig;\n }): Promise<{ link: string; location: string }> {\n const {\n owner,\n repo,\n title,\n body,\n fileContent,\n repositoryUrl,\n githubIntegrationConfig,\n } = options;\n\n const { token } = await this.scmAuthApi.getCredentials({\n url: repositoryUrl,\n additionalScope: {\n repoWrite: true,\n },\n });\n\n const octo = new Octokit({\n auth: token,\n baseUrl: githubIntegrationConfig.apiBaseUrl,\n });\n\n const branchName = getBranchName(this.configApi);\n const fileName = getCatalogFilename(this.configApi);\n\n const repoData = await octo.repos\n .get({\n owner,\n repo,\n })\n .catch(e => {\n throw new Error(formatHttpErrorMessage(\"Couldn't fetch repo data\", e));\n });\n\n const parentRef = await octo.git\n .getRef({\n owner,\n repo,\n ref: `heads/${repoData.data.default_branch}`,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\"Couldn't fetch default branch data\", e),\n );\n });\n\n await octo.git\n .createRef({\n owner,\n repo,\n ref: `refs/heads/${branchName}`,\n sha: parentRef.data.object.sha,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a new branch with name '${branchName}'`,\n e,\n ),\n );\n });\n\n await octo.repos\n .createOrUpdateFileContents({\n owner,\n repo,\n path: fileName,\n message: title,\n content: Base64.encode(fileContent),\n branch: branchName,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a commit with ${fileName} file added`,\n e,\n ),\n );\n });\n\n const pullRequestResponse = await octo.pulls\n .create({\n owner,\n repo,\n title,\n head: branchName,\n body,\n base: repoData.data.default_branch,\n })\n .catch(e => {\n throw new Error(\n formatHttpErrorMessage(\n `Couldn't create a pull request for ${branchName} branch`,\n e,\n ),\n );\n });\n\n return {\n link: pullRequestResponse.data.html_url,\n location: `https://${githubIntegrationConfig.host}/${owner}/${repo}/blob/${repoData.data.default_branch}/${fileName}`,\n };\n }\n}\n\nfunction formatHttpErrorMessage(\n message: string,\n error: { status: number; message: string },\n) {\n return `${message}, received http response status code ${error.status}: ${error.message}`;\n}\n"],"names":[],"mappings":";;;;;;AAqCO,MAAM,mBAAgD,CAAA;AAAA,EAC1C,YAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EACA,UAAA,CAAA;AAAA,EACA,kBAAA,CAAA;AAAA,EACA,UAAA,CAAA;AAAA,EACA,SAAA,CAAA;AAAA,EAEjB,YAAY,OAOT,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,aAAa,OAAQ,CAAA,UAAA,CAAA;AAC1B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA,CAAA;AACxB,IAAA,IAAA,CAAK,qBAAqB,OAAQ,CAAA,kBAAA,CAAA;AAClC,IAAA,IAAA,CAAK,aAAa,OAAQ,CAAA,UAAA,CAAA;AAC1B,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA,CAAA;AAAA,GAC3B;AAAA,EAEA,MAAM,WAAW,GAAqC,EAAA;AACpD,IAAA,IACE,IAAI,GAAI,CAAA,GAAG,EAAE,QAAS,CAAA,KAAA,CAAM,UAAU,CACtC,IAAA,IAAI,GAAI,CAAA,GAAG,EAAE,YAAa,CAAA,GAAA,CAAI,MAAM,CAAG,EAAA,KAAA,CAAM,SAAS,CACtD,EAAA;AACA,MAAA,MAAM,QAAW,GAAA,MAAM,IAAK,CAAA,UAAA,CAAW,WAAY,CAAA;AAAA,QACjD,IAAM,EAAA,KAAA;AAAA,QACN,MAAQ,EAAA,GAAA;AAAA,QACR,MAAQ,EAAA,IAAA;AAAA,OACT,CAAA,CAAA;AAED,MAAO,OAAA;AAAA,QACL,IAAM,EAAA,WAAA;AAAA,Q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AAA,EAAW,uBAAwB,CAAA,IAAI,CAAI,CAAA,EAAA,KAAK,CAAI,CAAA,EAAA,IAAI,CAAS,MAAA,EAAA,QAAA,CAAS,IAAK,CAAA,cAAc,IAAI,QAAQ,CAAA,CAAA;AAAA,KACrH,CAAA;AAAA,GACF;AACF,CAAA;AAEA,SAAS,sBAAA,CACP,SACA,KACA,EAAA;AACA,EAAA,OAAO,GAAG,OAAO,CAAA,qCAAA,EAAwC,MAAM,MAAM,CAAA,EAAA,EAAK,MAAM,OAAO,CAAA,CAAA,CAAA;AACzF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
5
|
-
import { DiscoveryApi,
|
|
5
|
+
import { DiscoveryApi, FetchApi, ConfigApi } from '@backstage/core-plugin-api';
|
|
6
6
|
import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
|
|
7
7
|
import { InfoCardVariants } from '@backstage/core-components';
|
|
8
8
|
import { TextFieldProps } from '@material-ui/core/TextField/TextField';
|
|
@@ -131,7 +131,7 @@ interface CatalogImportApi {
|
|
|
131
131
|
*/
|
|
132
132
|
declare class CatalogImportClient implements CatalogImportApi {
|
|
133
133
|
private readonly discoveryApi;
|
|
134
|
-
private readonly
|
|
134
|
+
private readonly fetchApi;
|
|
135
135
|
private readonly scmAuthApi;
|
|
136
136
|
private readonly scmIntegrationsApi;
|
|
137
137
|
private readonly catalogApi;
|
|
@@ -139,7 +139,7 @@ declare class CatalogImportClient implements CatalogImportApi {
|
|
|
139
139
|
constructor(options: {
|
|
140
140
|
discoveryApi: DiscoveryApi;
|
|
141
141
|
scmAuthApi: ScmAuthApi;
|
|
142
|
-
|
|
142
|
+
fetchApi: FetchApi;
|
|
143
143
|
scmIntegrationsApi: ScmIntegrationRegistry;
|
|
144
144
|
catalogApi: CatalogApi;
|
|
145
145
|
configApi: ConfigApi;
|
package/dist/plugin.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRouteRef, createPlugin, createApiFactory, discoveryApiRef,
|
|
1
|
+
import { createRouteRef, createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, configApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
2
2
|
import { scmAuthApiRef, scmIntegrationsApiRef } from '@backstage/integration-react';
|
|
3
3
|
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
4
4
|
import { catalogImportApiRef } from './api/CatalogImportApi.esm.js';
|
|
@@ -15,7 +15,7 @@ const catalogImportPlugin = createPlugin({
|
|
|
15
15
|
deps: {
|
|
16
16
|
discoveryApi: discoveryApiRef,
|
|
17
17
|
scmAuthApi: scmAuthApiRef,
|
|
18
|
-
|
|
18
|
+
fetchApi: fetchApiRef,
|
|
19
19
|
scmIntegrationsApi: scmIntegrationsApiRef,
|
|
20
20
|
catalogApi: catalogApiRef,
|
|
21
21
|
configApi: configApiRef
|
|
@@ -23,7 +23,7 @@ const catalogImportPlugin = createPlugin({
|
|
|
23
23
|
factory: ({
|
|
24
24
|
discoveryApi,
|
|
25
25
|
scmAuthApi,
|
|
26
|
-
|
|
26
|
+
fetchApi,
|
|
27
27
|
scmIntegrationsApi,
|
|
28
28
|
catalogApi,
|
|
29
29
|
configApi
|
|
@@ -31,7 +31,7 @@ const catalogImportPlugin = createPlugin({
|
|
|
31
31
|
discoveryApi,
|
|
32
32
|
scmAuthApi,
|
|
33
33
|
scmIntegrationsApi,
|
|
34
|
-
|
|
34
|
+
fetchApi,
|
|
35
35
|
catalogApi,
|
|
36
36
|
configApi
|
|
37
37
|
})
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 {\n configApiRef,\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n createRouteRef,\n discoveryApiRef,\n
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 {\n configApiRef,\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n createRouteRef,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { catalogImportApiRef, CatalogImportClient } from './api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'catalog-import',\n});\n\n/**\n * A plugin that helps the user in importing projects and YAML files into the\n * catalog.\n *\n * @public\n */\nexport const catalogImportPlugin = createPlugin({\n id: 'catalog-import',\n apis: [\n createApiFactory({\n api: catalogImportApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmAuthApi: scmAuthApiRef,\n fetchApi: fetchApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n catalogApi: catalogApiRef,\n configApi: configApiRef,\n },\n factory: ({\n discoveryApi,\n scmAuthApi,\n fetchApi,\n scmIntegrationsApi,\n catalogApi,\n configApi,\n }) =>\n new CatalogImportClient({\n discoveryApi,\n scmAuthApi,\n scmIntegrationsApi,\n fetchApi,\n catalogApi,\n configApi,\n }),\n }),\n ],\n routes: {\n importPage: rootRouteRef,\n },\n});\n\n/**\n * The page for importing projects and YAML files into the catalog.\n *\n * @public\n */\nexport const CatalogImportPage = catalogImportPlugin.provide(\n createRoutableExtension({\n name: 'CatalogImportPage',\n component: () => import('./components/ImportPage').then(m => m.ImportPage),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;;AAgCO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,gBAAA;AACN,CAAC,EAAA;AAQM,MAAM,sBAAsB,YAAa,CAAA;AAAA,EAC9C,EAAI,EAAA,gBAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,mBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,UAAY,EAAA,aAAA;AAAA,QACZ,QAAU,EAAA,WAAA;AAAA,QACV,kBAAoB,EAAA,qBAAA;AAAA,QACpB,UAAY,EAAA,aAAA;AAAA,QACZ,SAAW,EAAA,YAAA;AAAA,OACb;AAAA,MACA,SAAS,CAAC;AAAA,QACR,YAAA;AAAA,QACA,UAAA;AAAA,QACA,QAAA;AAAA,QACA,kBAAA;AAAA,QACA,UAAA;AAAA,QACA,SAAA;AAAA,OACF,KACE,IAAI,mBAAoB,CAAA;AAAA,QACtB,YAAA;AAAA,QACA,UAAA;AAAA,QACA,kBAAA;AAAA,QACA,QAAA;AAAA,QACA,UAAA;AAAA,QACA,SAAA;AAAA,OACD,CAAA;AAAA,KACJ,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,UAAY,EAAA,YAAA;AAAA,GACd;AACF,CAAC,EAAA;AAOM,MAAM,oBAAoB,mBAAoB,CAAA,OAAA;AAAA,EACnD,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,mBAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,sCAAyB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,UAAU,CAAA;AAAA,IACzE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-import",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0-next.1",
|
|
4
4
|
"description": "A Backstage plugin the helps you import entities into your catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin"
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"yaml": "^2.0.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@backstage/cli": "^0.26.
|
|
77
|
+
"@backstage/cli": "^0.26.7-next.1",
|
|
78
78
|
"@backstage/core-app-api": "^1.12.5",
|
|
79
79
|
"@backstage/dev-utils": "^1.0.33-next.0",
|
|
80
|
-
"@backstage/plugin-catalog": "^1.20.1-next.
|
|
80
|
+
"@backstage/plugin-catalog": "^1.20.1-next.1",
|
|
81
81
|
"@backstage/test-utils": "^1.5.6-next.0",
|
|
82
82
|
"@testing-library/dom": "^10.0.0",
|
|
83
83
|
"@testing-library/jest-dom": "^6.0.0",
|