@red-hat-developer-hub/backstage-plugin-bulk-import-backend 6.4.1 → 6.5.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 +12 -0
- package/dist/generated/openapidocument.cjs.js +6 -0
- package/dist/generated/openapidocument.cjs.js.map +1 -1
- package/dist/gitlab/gitlabApiService.cjs.js +21 -7
- package/dist/gitlab/gitlabApiService.cjs.js.map +1 -1
- package/dist/service/handlers/import/execute-template.cjs.js +4 -2
- package/dist/service/handlers/import/execute-template.cjs.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
### Dependencies
|
|
2
2
|
|
|
3
|
+
## 6.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ace9761: Fix failing repo list table when GitLab token is bad.
|
|
8
|
+
|
|
9
|
+
## 6.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 8c33ce4: Enable GitLab frontend support. Restore previously removed approval tool parameters in the backend.
|
|
14
|
+
|
|
3
15
|
## 6.4.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -591,6 +591,9 @@ const OPENAPI = `
|
|
|
591
591
|
"type": "string",
|
|
592
592
|
"default": "main"
|
|
593
593
|
}
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
"$ref": "#/components/parameters/approvalToolParam"
|
|
594
597
|
}
|
|
595
598
|
],
|
|
596
599
|
"responses": {
|
|
@@ -633,6 +636,9 @@ const OPENAPI = `
|
|
|
633
636
|
"schema": {
|
|
634
637
|
"type": "string"
|
|
635
638
|
}
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"$ref": "#/components/parameters/approvalToolParam"
|
|
636
642
|
}
|
|
637
643
|
],
|
|
638
644
|
"responses": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapidocument.cjs.js","sources":["../../src/generated/openapidocument.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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\n// eslint-disable\n// prettier-ignore\nconst OPENAPI = `\n{\n \"openapi\": \"3.1.0\",\n \"info\": {\n \"version\": \"1.0\",\n \"title\": \"Bulk Import Backend\",\n \"description\": \"The Bulk Import Backend APIs allow users to bulk import repositories into the Backstage catalog from remote sources such as Git.\"\n },\n \"servers\": [\n {\n \"url\": \"{protocol}://{host}:{port}/{basePath}\",\n \"variables\": {\n \"protocol\": {\n \"enum\": [\n \"http\",\n \"https\"\n ],\n \"default\": \"http\"\n },\n \"host\": {\n \"default\": \"localhost\"\n },\n \"port\": {\n \"default\": \"7007\"\n },\n \"basePath\": {\n \"default\": \"api/bulk-import\"\n }\n }\n }\n ],\n \"paths\": {\n \"/ping\": {\n \"get\": {\n \"operationId\": \"ping\",\n \"summary\": \"Check the health of the Bulk Import backend router\",\n \"tags\": [\n \"Management\"\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"The backend router for the Bulk Import backend is up and running\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"status\": {\n \"enum\": [\n \"ok\"\n ]\n }\n }\n },\n \"example\": {\n \"status\": \"ok\"\n }\n }\n }\n }\n }\n }\n },\n \"/organizations\": {\n \"get\": {\n \"operationId\": \"findAllOrganizations\",\n \"summary\": \"Fetch Organizations accessible by Backstage Github Integrations\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Organization\"\n ],\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Organization list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/OrganizationList\"\n },\n \"examples\": {\n \"multipleRepos\": {\n \"$ref\": \"#/components/examples/multipleOrgs\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no Organization is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/OrganizationList\"\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/orgListErrors\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/organizations/{organizationName}/repositories\": {\n \"get\": {\n \"operationId\": \"findRepositoriesByOrganization\",\n \"summary\": \"Fetch Repositories in the specified GitHub organization, provided it is accessible by any of the configured GitHub Integrations.\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Organization\"\n ],\n \"parameters\": [\n {\n \"in\": \"path\",\n \"name\": \"organizationName\",\n \"description\": \"Organization name\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"in\": \"query\",\n \"name\": \"checkImportStatus\",\n \"description\": \"whether to return import status. Note that this might incur a performance penalty because the import status is computed for each repository.\",\n \"schema\": {\n \"type\": \"boolean\",\n \"default\": \"false\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Org Repository list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/RepositoryList\"\n },\n \"examples\": {\n \"multipleRepos\": {\n \"$ref\": \"#/components/examples/multipleRepos\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no Org Repository is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/RepositoryList\"\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/repositoryListErrors\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/repositories\": {\n \"get\": {\n \"operationId\": \"findAllRepositories\",\n \"summary\": \"Fetch Organization Repositories accessible by Backstage Github Integrations\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Repository\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"checkImportStatus\",\n \"description\": \"whether to return import status. Note that this might incur a performance penalty because the import status is computed for each repository.\",\n \"schema\": {\n \"type\": \"boolean\",\n \"default\": \"false\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Repository list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/RepositoryList\"\n },\n \"examples\": {\n \"multipleRepos\": {\n \"$ref\": \"#/components/examples/multipleRepos\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no repository is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/RepositoryList\"\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/repositoryListErrors\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/imports\": {\n \"get\": {\n \"operationId\": \"findAllImports\",\n \"summary\": \"Fetch Import Jobs\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/apiVersionHeaderParam\"\n },\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParamDeprecated\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParamDeprecated\"\n },\n {\n \"$ref\": \"#/components/parameters/pageQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizeQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sortOrderQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sortColumnQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Import Job list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"oneOf\": [\n {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/SourceImport\"\n }\n },\n {\n \"$ref\": \"#/components/schemas/ImportJobListV2\"\n }\n ]\n },\n \"examples\": {\n \"twoImports\": {\n \"$ref\": \"#/components/examples/twoImports\"\n },\n \"multipleImportJobsV2\": {\n \"$ref\": \"#/components/examples/multipleImportJobsV2\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no Import Job is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"oneOf\": [\n {\n \"type\": \"string\",\n \"description\": \"Generic error\"\n },\n {\n \"$ref\": \"#/components/schemas/ImportJobListV2\"\n }\n ]\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/importJobListErrors\"\n }\n }\n }\n }\n }\n }\n },\n \"post\": {\n \"operationId\": \"createImportJobs\",\n \"summary\": \"Submit Import Jobs\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"dryRun\",\n \"description\": \"whether to perform a dry-run to check if entity name collisions would occur in the catalog\",\n \"schema\": {\n \"type\": \"boolean\",\n \"default\": \"false\"\n }\n }\n ],\n \"requestBody\": {\n \"description\": \"List of Import jobs to create\",\n \"required\": true,\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/ImportRequest\"\n }\n },\n \"examples\": {\n \"multipleImportRequests\": {\n \"$ref\": \"#/components/examples/multipleImportRequests\"\n }\n }\n }\n }\n },\n \"responses\": {\n \"202\": {\n \"description\": \"Import Jobs request was submitted successfully to the API. Check the status in each item of the response body list to see their individual status.\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Import\"\n }\n },\n \"examples\": {\n \"twoImports\": {\n \"$ref\": \"#/components/examples/twoImportJobs\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/task-imports\": {\n \"get\": {\n \"operationId\": \"findAllTaskImports\",\n \"summary\": \"Fetch Import Jobs\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/apiVersionHeaderParam\"\n },\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParamDeprecated\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParamDeprecated\"\n },\n {\n \"$ref\": \"#/components/parameters/pageQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizeQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sortOrderQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sortColumnQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Import Job list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"oneOf\": [\n {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/SourceImport\"\n }\n },\n {\n \"$ref\": \"#/components/schemas/ImportJobListV2\"\n }\n ]\n },\n \"examples\": {\n \"twoImports\": {\n \"$ref\": \"#/components/examples/twoImports\"\n },\n \"multipleImportJobsV2\": {\n \"$ref\": \"#/components/examples/multipleImportJobsV2\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no Import Job is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"oneOf\": [\n {\n \"type\": \"string\",\n \"description\": \"Generic error\"\n },\n {\n \"$ref\": \"#/components/schemas/ImportJobListV2\"\n }\n ]\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/importJobListErrors\"\n }\n }\n }\n }\n }\n }\n },\n \"post\": {\n \"operationId\": \"createTaskImportJobs\",\n \"summary\": \"Execute a scaffolder template for a list of repositories\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"requestBody\": {\n \"description\": \"The template to execute and the repositories to run it against.\",\n \"required\": true,\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/ImportRequest\"\n }\n }\n }\n }\n },\n \"responses\": {\n \"202\": {\n \"description\": \"Import Jobs request was submitted successfully to the API. Check the status in each item of the response body list to see their individual status.\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Import\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/task-import/by-repo\": {\n \"get\": {\n \"operationId\": \"findTaskImportStatusByRepo\",\n \"summary\": \"Get Import Status by repository\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"repo\",\n \"description\": \"the full URL to the repo\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"in\": \"query\",\n \"name\": \"defaultBranch\",\n \"description\": \"the name of the default branch\",\n \"schema\": {\n \"type\": \"string\",\n \"default\": \"main\"\n }\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Import Job status was determined successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Import\"\n },\n \"examples\": {\n \"singleImportStatusForRepo\": {\n \"$ref\": \"#/components/examples/singleImportStatusForRepo\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error\"\n }\n }\n },\n \"delete\": {\n \"operationId\": \"deleteTaskImportByRepo\",\n \"summary\": \"Delete stored scaffolder task records for a specific repository\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"repo\",\n \"description\": \"the full URL to the repo\",\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"responses\": {\n \"204\": {\n \"description\": \"Repository was deleted successfully with no errors\"\n },\n \"500\": {\n \"description\": \"Generic error\"\n }\n }\n }\n },\n \"/import/by-repo\": {\n \"get\": {\n \"operationId\": \"findImportStatusByRepo\",\n \"summary\": \"Get Import Status by repository\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"repo\",\n \"description\": \"the full URL to the repo\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"in\": \"query\",\n \"name\": \"defaultBranch\",\n \"description\": \"the name of the default branch\",\n \"schema\": {\n \"type\": \"string\",\n \"default\": \"main\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Import Job status was determined successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Import\"\n },\n \"examples\": {\n \"singleImportStatusForRepo\": {\n \"$ref\": \"#/components/examples/singleImportStatusForRepo\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error\"\n }\n }\n },\n \"delete\": {\n \"operationId\": \"deleteImportByRepo\",\n \"summary\": \"Delete Import by repository\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"repo\",\n \"description\": \"the full URL to the repo\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"in\": \"query\",\n \"name\": \"defaultBranch\",\n \"description\": \"the name of the default branch\",\n \"schema\": {\n \"type\": \"string\",\n \"default\": \"main\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"204\": {\n \"description\": \"Import Job was successfully delete with no errors\"\n },\n \"500\": {\n \"description\": \"Generic error\"\n }\n }\n }\n }\n },\n \"components\": {\n \"parameters\": {\n \"apiVersionHeaderParam\": {\n \"in\": \"header\",\n \"name\": \"api-version\",\n \"description\": \"API version.\\\\n\\\\n## Changelog\\\\n\\\\n### v1 (default)\\\\nInitial version\\\\n#### Deprecations\\\\n* GET /imports\\\\n * Deprecation of 'pagePerIntegration' and 'sizePerIntegration' query parameters and introduction of new 'page' and 'size' parameters\\\\n * 'page' takes precedence over 'pagePerIntegration' if both are passed\\\\n * 'size' takes precedence over 'sizePerIntegration' if both are passed\\\\n\\\\n### v2\\\\n#### Breaking changes\\\\n* GET /imports\\\\n * Query parameters:\\\\n * 'pagePerIntegration' is ignored in favor of 'page'\\\\n * 'sizePerIntegration' is ignored in favor of 'size'\\\\n * Response structure changed to include pagination info: instead of returning a simple list of Imports, the response is now an object containing the following fields:\\\\n * 'imports': the list of Imports\\\\n * 'page': the page requested\\\\n * 'size': the requested number of Imports requested per page\\\\n * 'totalCount': the total count of Imports\\\\n\",\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"v1\",\n \"v2\"\n ],\n \"default\": \"v1\"\n }\n },\n \"pagePerIntegrationQueryParam\": {\n \"in\": \"query\",\n \"name\": \"pagePerIntegration\",\n \"description\": \"the page number for each Integration\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 1\n }\n },\n \"sizePerIntegrationQueryParam\": {\n \"in\": \"query\",\n \"name\": \"sizePerIntegration\",\n \"description\": \"the number of items per Integration to return per page\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 20\n }\n },\n \"pagePerIntegrationQueryParamDeprecated\": {\n \"in\": \"query\",\n \"name\": \"pagePerIntegration\",\n \"description\": \"the page number for each Integration. **Deprecated**. Use the 'page' query parameter instead.\",\n \"deprecated\": true,\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 1\n }\n },\n \"sortColumnQueryParam\": {\n \"in\": \"query\",\n \"name\": \"sortColumn\",\n \"description\": \"The allowed values for sorting columns:\\\\n- repository.name: Sort by repository name.\\\\n- repository.organization: Sort by organization URL.\\\\n- repository.url: Sort by repository URL.\\\\n- lastUpdate: Sort by the last time the catalog-info.yaml was updated.\\\\n- status: Sort by the status of the catalog-info.yaml.\\\\n\",\n \"required\": false,\n \"schema\": {\n \"enum\": [\n \"repository.name\",\n \"repository.organization\",\n \"repository.url\",\n \"lastUpdate\",\n \"status\"\n ],\n \"default\": \"repository.name\"\n }\n },\n \"sortOrderQueryParam\": {\n \"in\": \"query\",\n \"name\": \"sortOrder\",\n \"description\": \"The order of sorting asc for ascending or desc for descending\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"asc\",\n \"desc\"\n ],\n \"default\": \"asc\"\n }\n },\n \"sizePerIntegrationQueryParamDeprecated\": {\n \"in\": \"query\",\n \"name\": \"sizePerIntegration\",\n \"description\": \"the number of items per Integration to return per page. **Deprecated**. Use the 'size' query parameter instead.\",\n \"deprecated\": true,\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 20\n }\n },\n \"searchQueryParam\": {\n \"in\": \"query\",\n \"name\": \"search\",\n \"description\": \"returns only the items that match the search string\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n \"pageQueryParam\": {\n \"in\": \"query\",\n \"name\": \"page\",\n \"description\": \"the requested page number\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 1\n }\n },\n \"sizeQueryParam\": {\n \"in\": \"query\",\n \"name\": \"size\",\n \"description\": \"the number of items to return per page\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 20\n }\n },\n \"approvalToolParam\": {\n \"in\": \"query\",\n \"name\": \"approvalTool\",\n \"description\": \"the approvalTool to use\",\n \"schema\": {\n \"type\": \"string\",\n \"default\": \"GIT\"\n }\n }\n },\n \"schemas\": {\n \"OrganizationList\": {\n \"title\": \"Organization List\",\n \"type\": \"object\",\n \"properties\": {\n \"organizations\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Organization\"\n }\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"totalCount\": {\n \"type\": \"integer\"\n },\n \"pagePerIntegration\": {\n \"type\": \"integer\"\n },\n \"sizePerIntegration\": {\n \"type\": \"integer\"\n }\n }\n },\n \"Organization\": {\n \"title\": \"Organization\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"unique identifier\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"organization name\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"organization description\"\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"organization URL\"\n },\n \"totalRepoCount\": {\n \"type\": \"number\",\n \"description\": \"total number of repositories in this Organization\"\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"RepositoryList\": {\n \"title\": \"Repository List\",\n \"type\": \"object\",\n \"properties\": {\n \"repositories\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Repository\"\n }\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"totalCount\": {\n \"type\": \"integer\"\n },\n \"pagePerIntegration\": {\n \"type\": \"integer\"\n },\n \"sizePerIntegration\": {\n \"type\": \"integer\"\n }\n }\n },\n \"Repository\": {\n \"title\": \"Repository\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"unique identifier\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"repository name\"\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"repository URL\"\n },\n \"organization\": {\n \"type\": \"string\",\n \"description\": \"organization which the repository is part of\"\n },\n \"importStatus\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/components/schemas/ImportStatus\"\n },\n {\n \"$ref\": \"#/components/schemas/TaskImportStatus\"\n }\n ]\n },\n \"defaultBranch\": {\n \"type\": \"string\",\n \"description\": \"default branch\"\n },\n \"lastUpdate\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"ApprovalTool\": {\n \"type\": \"string\",\n \"enum\": [\n \"GIT\",\n \"SERVICENOW\",\n \"GITLAB\"\n ]\n },\n \"TaskImportStatus\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Import Job status\",\n \"enum\": [\n \"TASK_CANCELLED\",\n \"TASK_COMPLETED\",\n \"TASK_FAILED\",\n \"TASK_OPEN\",\n \"TASK_PROCESSING\",\n \"TASK_SKIPPED\",\n \"TASK_FETCH_FAILED\"\n ]\n },\n \"ImportStatus\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Import Job status\",\n \"enum\": [\n \"ADDED\",\n \"WAIT_PR_APPROVAL\",\n \"PR_ERROR\",\n null\n ]\n },\n \"ImportJobListV2\": {\n \"title\": \"Import Job List\",\n \"type\": \"object\",\n \"properties\": {\n \"imports\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/SourceImport\"\n }\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"totalCount\": {\n \"type\": \"integer\"\n },\n \"page\": {\n \"type\": \"integer\"\n },\n \"size\": {\n \"type\": \"integer\"\n }\n }\n },\n \"Import\": {\n \"title\": \"Import Job\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/components/schemas/ImportStatus\"\n },\n {\n \"$ref\": \"#/components/schemas/TaskImportStatus\"\n }\n ]\n },\n \"task\": {\n \"type\": \"object\",\n \"properties\": {\n \"taskId\": {\n \"type\": \"string\"\n }\n }\n },\n \"tasks\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"taskId\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"catalogEntityName\": {\n \"type\": \"string\",\n \"description\": \"Specified entity name in the catalog. Filled only in response for dry-run import requests.\"\n },\n \"lastUpdate\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"approvalTool\": {\n \"$ref\": \"#/components/schemas/ApprovalTool\"\n },\n \"repository\": {\n \"$ref\": \"#/components/schemas/Repository\"\n },\n \"gitlab\": {\n \"type\": \"object\",\n \"description\": \"GitLab details. Applicable if approvalTool is gitlab.\",\n \"properties\": {\n \"pullRequest\": {\n \"$ref\": \"#/components/schemas/PullRequest\"\n }\n }\n },\n \"github\": {\n \"type\": \"object\",\n \"description\": \"GitHub details. Applicable if approvalTool is git.\",\n \"properties\": {\n \"pullRequest\": {\n \"$ref\": \"#/components/schemas/PullRequest\"\n }\n }\n }\n }\n },\n \"PullRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"url\": {\n \"type\": \"string\",\n \"description\": \"URL of the Pull Request\"\n },\n \"number\": {\n \"type\": \"number\",\n \"description\": \"Pull Request number\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"title of the Pull Request\"\n },\n \"body\": {\n \"type\": \"string\",\n \"description\": \"body of the Pull Request\"\n },\n \"catalogInfoContent\": {\n \"type\": \"string\",\n \"description\": \"content of the catalog-info.yaml as fetched from the Pull Request.\"\n },\n \"status\": {\n \"type\": \"string\",\n \"enum\": [\n \"WAIT_PR_APPROVAL\",\n \"PR_MERGED\",\n \"PR_ERROR\"\n ]\n }\n }\n },\n \"SourceImport\": {\n \"title\": \"Import Job with source it originates from\",\n \"allOf\": [\n {\n \"$ref\": \"#/components/schemas/Import\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"source\": {\n \"$ref\": \"#/components/schemas/Source\"\n }\n }\n }\n ]\n },\n \"Source\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Import Source:\\\\n * 'config' - Import from static catalog location configuration in 'app-config'\\\\n * 'location' - Import of user registered entities using locations endpoint\\\\n * 'integration' - Import using a GitHub integration\\\\n * null - Import source is unknown\\\\n\",\n \"enum\": [\n \"config\",\n \"location\",\n \"integration\",\n null\n ]\n },\n \"ImportRequest\": {\n \"title\": \"Import Job request\",\n \"type\": \"object\",\n \"required\": [\n \"repository\"\n ],\n \"properties\": {\n \"approvalTool\": {\n \"$ref\": \"#/components/schemas/ApprovalTool\"\n },\n \"catalogEntityName\": {\n \"type\": \"string\",\n \"description\": \"Expected Entity name in the catalog. Relevant only if the 'dryRun' query parameter is set to 'true'.\"\n },\n \"codeOwnersFileAsEntityOwner\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the CODEOWNERS file will be used as entity owner. Only relevant for dry-run requests. If set to 'false', the corresponding dry-run check will be skipped.\"\n },\n \"repository\": {\n \"type\": \"object\",\n \"required\": [\n \"url\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"repository name\"\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"repository URL\"\n },\n \"organization\": {\n \"type\": \"string\",\n \"description\": \"organization which the repository is part of\"\n },\n \"defaultBranch\": {\n \"type\": \"string\",\n \"description\": \"default branch\"\n }\n }\n },\n \"catalogInfoContent\": {\n \"type\": \"string\",\n \"description\": \"content of the catalog-info.yaml to include in the import Pull Request.\"\n },\n \"gitlab\": {\n \"type\": \"object\",\n \"description\": \"GitLab details. Applicable if approvalTool is gitlab.\",\n \"properties\": {\n \"pullRequest\": {\n \"$ref\": \"#/components/schemas/PullRequest\"\n }\n }\n },\n \"github\": {\n \"type\": \"object\",\n \"description\": \"GitHub details. Applicable if approvalTool is git.\",\n \"properties\": {\n \"pullRequest\": {\n \"$ref\": \"#/components/schemas/PullRequest\"\n }\n }\n }\n }\n },\n \"ScaffolderTask\": {\n \"title\": \"Scaffolder Task\",\n \"type\": \"object\",\n \"properties\": {\n \"taskId\": {\n \"type\": \"string\"\n },\n \"repositoryId\": {\n \"type\": \"number\"\n },\n \"locations\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"securitySchemes\": {\n \"BearerAuth\": {\n \"type\": \"http\",\n \"scheme\": \"bearer\",\n \"bearerFormat\": \"JWT\",\n \"description\": \"Backstage Permissions Framework JWT\"\n }\n },\n \"examples\": {\n \"multipleOrgs\": {\n \"summary\": \"Multiple organizations\",\n \"value\": {\n \"errors\": [],\n \"organizations\": [\n {\n \"id\": \"unique-org-id-1\",\n \"name\": \"pet-org\",\n \"url\": \"https://github.com/pet-org\",\n \"description\": \"A great Pet Org\",\n \"totalRepoCount\": 10\n },\n {\n \"id\": \"unique-org-id-2\",\n \"name\": \"org-zero\",\n \"url\": \"https://ghe.example.com/org-zero\",\n \"totalRepoCount\": 0\n },\n {\n \"id\": \"unique-id-2\",\n \"name\": \"org-one\",\n \"url\": \"https://ghe.example.com/org-one\",\n \"description\": \"Org One description\",\n \"totalRepoCount\": 1234\n }\n ]\n }\n },\n \"orgListErrors\": {\n \"summary\": \"Errors when listing organizations\",\n \"value\": {\n \"errors\": [\n \"Github App with ID 2 failed spectacularly\"\n ],\n \"organizations\": []\n }\n },\n \"multipleRepos\": {\n \"summary\": \"Multiple repositories\",\n \"value\": {\n \"errors\": [],\n \"repositories\": [\n {\n \"id\": \"unique-id-1\",\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\",\n \"importStatus\": \"WAIT_PR_APPROVAL\",\n \"defaultBranch\": \"main\"\n },\n {\n \"id\": \"unique-id-2\",\n \"name\": \"project-zero\",\n \"url\": \"https://ghe.example.com/my-other-org/project-zero\",\n \"organization\": \"my-other-org\",\n \"importStatus\": \"PR_REJECTED\",\n \"defaultBranch\": \"dev\"\n },\n {\n \"id\": \"unique-id-2\",\n \"name\": \"project-one\",\n \"defaultBranch\": \"trunk\",\n \"url\": \"https://ghe.example.com/my-other-org-2/project-one\",\n \"organization\": \"my-other-org-2\"\n }\n ]\n }\n },\n \"repositoryListErrors\": {\n \"summary\": \"Errors when listing repositories\",\n \"value\": {\n \"errors\": [\n \"Github App with ID 2 failed spectacularly\"\n ],\n \"repositories\": []\n }\n },\n \"twoImports\": {\n \"summary\": \"Two import job requests (V1)\",\n \"value\": [\n {\n \"id\": \"bulk-import-id-1\",\n \"status\": \"WAIT_PR_APPROVAL\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app/pull/1\",\n \"number\": 1\n }\n }\n },\n {\n \"id\": \"bulk-import-id-2\",\n \"status\": \"PR_REJECTED\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app-test\",\n \"url\": \"https://github.com/my-org/pet-app-test\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app-test/pull/10\",\n \"number\": 10\n }\n }\n }\n ]\n },\n \"multipleImportJobsV2\": {\n \"summary\": \"Two import job requests (V2)\",\n \"value\": {\n \"errors\": [],\n \"page\": 1,\n \"size\": 2,\n \"totalCount\": 10,\n \"imports\": [\n {\n \"id\": \"bulk-import-id-1\",\n \"status\": \"WAIT_PR_APPROVAL\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app/pull/1\",\n \"number\": 1\n }\n }\n },\n {\n \"id\": \"bulk-import-id-2\",\n \"status\": \"PR_REJECTED\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app-test\",\n \"url\": \"https://github.com/my-org/pet-app-test\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app-test/pull/10\",\n \"number\": 10\n }\n }\n }\n ]\n }\n },\n \"importJobListErrors\": {\n \"summary\": \"Errors when listing import jobs\",\n \"value\": {\n \"errors\": [\n \"Github App with ID xyz-123 failed spectacularly\"\n ],\n \"imports\": []\n }\n },\n \"twoImportJobs\": {\n \"summary\": \"Two import jobs\",\n \"value\": [\n {\n \"id\": \"bulk-import-id-1\",\n \"status\": \"WAIT_PR_APPROVAL\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app/pull/1\",\n \"number\": 1\n }\n }\n },\n {\n \"id\": \"bulk-import-id-2\",\n \"status\": \"PR_REJECTED\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app-test\",\n \"url\": \"https://github.com/my-org/pet-app-test\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app-test/pull/10\",\n \"number\": 10\n }\n }\n }\n ]\n },\n \"singleImportStatusForRepo\": {\n \"summary\": \"Single import job status for given repo\",\n \"value\": {\n \"id\": \"bulk-import-id-1\",\n \"status\": \"WAIT_PR_APPROVAL\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app/pull/1\",\n \"number\": 1\n }\n }\n }\n },\n \"multipleImportRequests\": {\n \"summary\": \"Multiple import requests\",\n \"value\": [\n {\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\",\n \"defaultBranch\": \"main\"\n },\n \"github\": {\n \"pullRequest\": {\n \"title\": \"Add default catalog-info.yaml to import to Red Hat Developer Hub\"\n }\n }\n },\n {\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"project-zero\",\n \"url\": \"https://ghe.example.com/my-other-org/project-zero\",\n \"organization\": \"my-other-org\",\n \"defaultBranch\": \"dev\"\n },\n \"github\": {\n \"pullRequest\": {\n \"title\": \"Add custom catalog-info.yaml to import to Red Hat Developer Hub\",\n \"body\": \"This pull request adds a **Backstage entity metadata file** to this repository so that the component can be added to the Red Hat Developer Hub software catalog.\\\\n\\\\nAfter this pull request is merged, the component will become available.\\\\n\\\\nFor more information, read an [overview of the Backstage software catalog](https://backstage.io/docs/features/software-catalog/).\"\n }\n },\n \"catalogInfoContent\": \"apiVersion: backstage.io/v1alpha1\\\\nkind: Component\\\\nmetadata:\\\\n name: project-zero\\\\n annotations:\\\\n github.com/project-slug: my-other-org/project-zero\\\\n acme.com/custom-annotation: my-value\\\\nspec:\\\\n type: other\\\\n lifecycle: unknown\\\\n owner: my-other-org\"\n }\n ]\n }\n }\n }\n}`\nexport const openApiDocument = JSON.parse(OPENAPI);\n"],"names":[],"mappings":";;AAkBA,MAAM,OAAU,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAAA;AAihDH,MAAA,eAAA,GAAkB,IAAK,CAAA,KAAA,CAAM,OAAO;;;;"}
|
|
1
|
+
{"version":3,"file":"openapidocument.cjs.js","sources":["../../src/generated/openapidocument.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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\n// eslint-disable\n// prettier-ignore\nconst OPENAPI = `\n{\n \"openapi\": \"3.1.0\",\n \"info\": {\n \"version\": \"1.0\",\n \"title\": \"Bulk Import Backend\",\n \"description\": \"The Bulk Import Backend APIs allow users to bulk import repositories into the Backstage catalog from remote sources such as Git.\"\n },\n \"servers\": [\n {\n \"url\": \"{protocol}://{host}:{port}/{basePath}\",\n \"variables\": {\n \"protocol\": {\n \"enum\": [\n \"http\",\n \"https\"\n ],\n \"default\": \"http\"\n },\n \"host\": {\n \"default\": \"localhost\"\n },\n \"port\": {\n \"default\": \"7007\"\n },\n \"basePath\": {\n \"default\": \"api/bulk-import\"\n }\n }\n }\n ],\n \"paths\": {\n \"/ping\": {\n \"get\": {\n \"operationId\": \"ping\",\n \"summary\": \"Check the health of the Bulk Import backend router\",\n \"tags\": [\n \"Management\"\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"The backend router for the Bulk Import backend is up and running\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"status\": {\n \"enum\": [\n \"ok\"\n ]\n }\n }\n },\n \"example\": {\n \"status\": \"ok\"\n }\n }\n }\n }\n }\n }\n },\n \"/organizations\": {\n \"get\": {\n \"operationId\": \"findAllOrganizations\",\n \"summary\": \"Fetch Organizations accessible by Backstage Github Integrations\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Organization\"\n ],\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Organization list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/OrganizationList\"\n },\n \"examples\": {\n \"multipleRepos\": {\n \"$ref\": \"#/components/examples/multipleOrgs\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no Organization is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/OrganizationList\"\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/orgListErrors\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/organizations/{organizationName}/repositories\": {\n \"get\": {\n \"operationId\": \"findRepositoriesByOrganization\",\n \"summary\": \"Fetch Repositories in the specified GitHub organization, provided it is accessible by any of the configured GitHub Integrations.\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Organization\"\n ],\n \"parameters\": [\n {\n \"in\": \"path\",\n \"name\": \"organizationName\",\n \"description\": \"Organization name\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"in\": \"query\",\n \"name\": \"checkImportStatus\",\n \"description\": \"whether to return import status. Note that this might incur a performance penalty because the import status is computed for each repository.\",\n \"schema\": {\n \"type\": \"boolean\",\n \"default\": \"false\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Org Repository list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/RepositoryList\"\n },\n \"examples\": {\n \"multipleRepos\": {\n \"$ref\": \"#/components/examples/multipleRepos\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no Org Repository is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/RepositoryList\"\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/repositoryListErrors\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/repositories\": {\n \"get\": {\n \"operationId\": \"findAllRepositories\",\n \"summary\": \"Fetch Organization Repositories accessible by Backstage Github Integrations\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Repository\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"checkImportStatus\",\n \"description\": \"whether to return import status. Note that this might incur a performance penalty because the import status is computed for each repository.\",\n \"schema\": {\n \"type\": \"boolean\",\n \"default\": \"false\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Repository list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/RepositoryList\"\n },\n \"examples\": {\n \"multipleRepos\": {\n \"$ref\": \"#/components/examples/multipleRepos\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no repository is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/RepositoryList\"\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/repositoryListErrors\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/imports\": {\n \"get\": {\n \"operationId\": \"findAllImports\",\n \"summary\": \"Fetch Import Jobs\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/apiVersionHeaderParam\"\n },\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParamDeprecated\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParamDeprecated\"\n },\n {\n \"$ref\": \"#/components/parameters/pageQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizeQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sortOrderQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sortColumnQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Import Job list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"oneOf\": [\n {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/SourceImport\"\n }\n },\n {\n \"$ref\": \"#/components/schemas/ImportJobListV2\"\n }\n ]\n },\n \"examples\": {\n \"twoImports\": {\n \"$ref\": \"#/components/examples/twoImports\"\n },\n \"multipleImportJobsV2\": {\n \"$ref\": \"#/components/examples/multipleImportJobsV2\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no Import Job is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"oneOf\": [\n {\n \"type\": \"string\",\n \"description\": \"Generic error\"\n },\n {\n \"$ref\": \"#/components/schemas/ImportJobListV2\"\n }\n ]\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/importJobListErrors\"\n }\n }\n }\n }\n }\n }\n },\n \"post\": {\n \"operationId\": \"createImportJobs\",\n \"summary\": \"Submit Import Jobs\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"dryRun\",\n \"description\": \"whether to perform a dry-run to check if entity name collisions would occur in the catalog\",\n \"schema\": {\n \"type\": \"boolean\",\n \"default\": \"false\"\n }\n }\n ],\n \"requestBody\": {\n \"description\": \"List of Import jobs to create\",\n \"required\": true,\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/ImportRequest\"\n }\n },\n \"examples\": {\n \"multipleImportRequests\": {\n \"$ref\": \"#/components/examples/multipleImportRequests\"\n }\n }\n }\n }\n },\n \"responses\": {\n \"202\": {\n \"description\": \"Import Jobs request was submitted successfully to the API. Check the status in each item of the response body list to see their individual status.\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Import\"\n }\n },\n \"examples\": {\n \"twoImports\": {\n \"$ref\": \"#/components/examples/twoImportJobs\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/task-imports\": {\n \"get\": {\n \"operationId\": \"findAllTaskImports\",\n \"summary\": \"Fetch Import Jobs\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/apiVersionHeaderParam\"\n },\n {\n \"$ref\": \"#/components/parameters/pagePerIntegrationQueryParamDeprecated\"\n },\n {\n \"$ref\": \"#/components/parameters/sizePerIntegrationQueryParamDeprecated\"\n },\n {\n \"$ref\": \"#/components/parameters/pageQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sizeQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sortOrderQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/sortColumnQueryParam\"\n },\n {\n \"$ref\": \"#/components/parameters/searchQueryParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Import Job list was fetched successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"oneOf\": [\n {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/SourceImport\"\n }\n },\n {\n \"$ref\": \"#/components/schemas/ImportJobListV2\"\n }\n ]\n },\n \"examples\": {\n \"twoImports\": {\n \"$ref\": \"#/components/examples/twoImports\"\n },\n \"multipleImportJobsV2\": {\n \"$ref\": \"#/components/examples/multipleImportJobsV2\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error when there are errors and no Import Job is returned\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"oneOf\": [\n {\n \"type\": \"string\",\n \"description\": \"Generic error\"\n },\n {\n \"$ref\": \"#/components/schemas/ImportJobListV2\"\n }\n ]\n },\n \"examples\": {\n \"repositoryListErrors\": {\n \"$ref\": \"#/components/examples/importJobListErrors\"\n }\n }\n }\n }\n }\n }\n },\n \"post\": {\n \"operationId\": \"createTaskImportJobs\",\n \"summary\": \"Execute a scaffolder template for a list of repositories\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"requestBody\": {\n \"description\": \"The template to execute and the repositories to run it against.\",\n \"required\": true,\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/ImportRequest\"\n }\n }\n }\n }\n },\n \"responses\": {\n \"202\": {\n \"description\": \"Import Jobs request was submitted successfully to the API. Check the status in each item of the response body list to see their individual status.\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Import\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"/task-import/by-repo\": {\n \"get\": {\n \"operationId\": \"findTaskImportStatusByRepo\",\n \"summary\": \"Get Import Status by repository\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"repo\",\n \"description\": \"the full URL to the repo\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"in\": \"query\",\n \"name\": \"defaultBranch\",\n \"description\": \"the name of the default branch\",\n \"schema\": {\n \"type\": \"string\",\n \"default\": \"main\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Import Job status was determined successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Import\"\n },\n \"examples\": {\n \"singleImportStatusForRepo\": {\n \"$ref\": \"#/components/examples/singleImportStatusForRepo\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error\"\n }\n }\n },\n \"delete\": {\n \"operationId\": \"deleteTaskImportByRepo\",\n \"summary\": \"Delete stored scaffolder task records for a specific repository\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"repo\",\n \"description\": \"the full URL to the repo\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"204\": {\n \"description\": \"Repository was deleted successfully with no errors\"\n },\n \"500\": {\n \"description\": \"Generic error\"\n }\n }\n }\n },\n \"/import/by-repo\": {\n \"get\": {\n \"operationId\": \"findImportStatusByRepo\",\n \"summary\": \"Get Import Status by repository\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"repo\",\n \"description\": \"the full URL to the repo\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"in\": \"query\",\n \"name\": \"defaultBranch\",\n \"description\": \"the name of the default branch\",\n \"schema\": {\n \"type\": \"string\",\n \"default\": \"main\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"Import Job status was determined successfully with no errors\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Import\"\n },\n \"examples\": {\n \"singleImportStatusForRepo\": {\n \"$ref\": \"#/components/examples/singleImportStatusForRepo\"\n }\n }\n }\n }\n },\n \"500\": {\n \"description\": \"Generic error\"\n }\n }\n },\n \"delete\": {\n \"operationId\": \"deleteImportByRepo\",\n \"summary\": \"Delete Import by repository\",\n \"security\": [\n {\n \"BearerAuth\": []\n }\n ],\n \"tags\": [\n \"Import\"\n ],\n \"parameters\": [\n {\n \"in\": \"query\",\n \"name\": \"repo\",\n \"description\": \"the full URL to the repo\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"in\": \"query\",\n \"name\": \"defaultBranch\",\n \"description\": \"the name of the default branch\",\n \"schema\": {\n \"type\": \"string\",\n \"default\": \"main\"\n }\n },\n {\n \"$ref\": \"#/components/parameters/approvalToolParam\"\n }\n ],\n \"responses\": {\n \"204\": {\n \"description\": \"Import Job was successfully delete with no errors\"\n },\n \"500\": {\n \"description\": \"Generic error\"\n }\n }\n }\n }\n },\n \"components\": {\n \"parameters\": {\n \"apiVersionHeaderParam\": {\n \"in\": \"header\",\n \"name\": \"api-version\",\n \"description\": \"API version.\\\\n\\\\n## Changelog\\\\n\\\\n### v1 (default)\\\\nInitial version\\\\n#### Deprecations\\\\n* GET /imports\\\\n * Deprecation of 'pagePerIntegration' and 'sizePerIntegration' query parameters and introduction of new 'page' and 'size' parameters\\\\n * 'page' takes precedence over 'pagePerIntegration' if both are passed\\\\n * 'size' takes precedence over 'sizePerIntegration' if both are passed\\\\n\\\\n### v2\\\\n#### Breaking changes\\\\n* GET /imports\\\\n * Query parameters:\\\\n * 'pagePerIntegration' is ignored in favor of 'page'\\\\n * 'sizePerIntegration' is ignored in favor of 'size'\\\\n * Response structure changed to include pagination info: instead of returning a simple list of Imports, the response is now an object containing the following fields:\\\\n * 'imports': the list of Imports\\\\n * 'page': the page requested\\\\n * 'size': the requested number of Imports requested per page\\\\n * 'totalCount': the total count of Imports\\\\n\",\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"v1\",\n \"v2\"\n ],\n \"default\": \"v1\"\n }\n },\n \"pagePerIntegrationQueryParam\": {\n \"in\": \"query\",\n \"name\": \"pagePerIntegration\",\n \"description\": \"the page number for each Integration\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 1\n }\n },\n \"sizePerIntegrationQueryParam\": {\n \"in\": \"query\",\n \"name\": \"sizePerIntegration\",\n \"description\": \"the number of items per Integration to return per page\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 20\n }\n },\n \"pagePerIntegrationQueryParamDeprecated\": {\n \"in\": \"query\",\n \"name\": \"pagePerIntegration\",\n \"description\": \"the page number for each Integration. **Deprecated**. Use the 'page' query parameter instead.\",\n \"deprecated\": true,\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 1\n }\n },\n \"sortColumnQueryParam\": {\n \"in\": \"query\",\n \"name\": \"sortColumn\",\n \"description\": \"The allowed values for sorting columns:\\\\n- repository.name: Sort by repository name.\\\\n- repository.organization: Sort by organization URL.\\\\n- repository.url: Sort by repository URL.\\\\n- lastUpdate: Sort by the last time the catalog-info.yaml was updated.\\\\n- status: Sort by the status of the catalog-info.yaml.\\\\n\",\n \"required\": false,\n \"schema\": {\n \"enum\": [\n \"repository.name\",\n \"repository.organization\",\n \"repository.url\",\n \"lastUpdate\",\n \"status\"\n ],\n \"default\": \"repository.name\"\n }\n },\n \"sortOrderQueryParam\": {\n \"in\": \"query\",\n \"name\": \"sortOrder\",\n \"description\": \"The order of sorting asc for ascending or desc for descending\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"asc\",\n \"desc\"\n ],\n \"default\": \"asc\"\n }\n },\n \"sizePerIntegrationQueryParamDeprecated\": {\n \"in\": \"query\",\n \"name\": \"sizePerIntegration\",\n \"description\": \"the number of items per Integration to return per page. **Deprecated**. Use the 'size' query parameter instead.\",\n \"deprecated\": true,\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 20\n }\n },\n \"searchQueryParam\": {\n \"in\": \"query\",\n \"name\": \"search\",\n \"description\": \"returns only the items that match the search string\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n \"pageQueryParam\": {\n \"in\": \"query\",\n \"name\": \"page\",\n \"description\": \"the requested page number\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 1\n }\n },\n \"sizeQueryParam\": {\n \"in\": \"query\",\n \"name\": \"size\",\n \"description\": \"the number of items to return per page\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 20\n }\n },\n \"approvalToolParam\": {\n \"in\": \"query\",\n \"name\": \"approvalTool\",\n \"description\": \"the approvalTool to use\",\n \"schema\": {\n \"type\": \"string\",\n \"default\": \"GIT\"\n }\n }\n },\n \"schemas\": {\n \"OrganizationList\": {\n \"title\": \"Organization List\",\n \"type\": \"object\",\n \"properties\": {\n \"organizations\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Organization\"\n }\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"totalCount\": {\n \"type\": \"integer\"\n },\n \"pagePerIntegration\": {\n \"type\": \"integer\"\n },\n \"sizePerIntegration\": {\n \"type\": \"integer\"\n }\n }\n },\n \"Organization\": {\n \"title\": \"Organization\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"unique identifier\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"organization name\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"organization description\"\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"organization URL\"\n },\n \"totalRepoCount\": {\n \"type\": \"number\",\n \"description\": \"total number of repositories in this Organization\"\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"RepositoryList\": {\n \"title\": \"Repository List\",\n \"type\": \"object\",\n \"properties\": {\n \"repositories\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Repository\"\n }\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"totalCount\": {\n \"type\": \"integer\"\n },\n \"pagePerIntegration\": {\n \"type\": \"integer\"\n },\n \"sizePerIntegration\": {\n \"type\": \"integer\"\n }\n }\n },\n \"Repository\": {\n \"title\": \"Repository\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"unique identifier\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"repository name\"\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"repository URL\"\n },\n \"organization\": {\n \"type\": \"string\",\n \"description\": \"organization which the repository is part of\"\n },\n \"importStatus\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/components/schemas/ImportStatus\"\n },\n {\n \"$ref\": \"#/components/schemas/TaskImportStatus\"\n }\n ]\n },\n \"defaultBranch\": {\n \"type\": \"string\",\n \"description\": \"default branch\"\n },\n \"lastUpdate\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"ApprovalTool\": {\n \"type\": \"string\",\n \"enum\": [\n \"GIT\",\n \"SERVICENOW\",\n \"GITLAB\"\n ]\n },\n \"TaskImportStatus\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Import Job status\",\n \"enum\": [\n \"TASK_CANCELLED\",\n \"TASK_COMPLETED\",\n \"TASK_FAILED\",\n \"TASK_OPEN\",\n \"TASK_PROCESSING\",\n \"TASK_SKIPPED\",\n \"TASK_FETCH_FAILED\"\n ]\n },\n \"ImportStatus\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Import Job status\",\n \"enum\": [\n \"ADDED\",\n \"WAIT_PR_APPROVAL\",\n \"PR_ERROR\",\n null\n ]\n },\n \"ImportJobListV2\": {\n \"title\": \"Import Job List\",\n \"type\": \"object\",\n \"properties\": {\n \"imports\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/SourceImport\"\n }\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"totalCount\": {\n \"type\": \"integer\"\n },\n \"page\": {\n \"type\": \"integer\"\n },\n \"size\": {\n \"type\": \"integer\"\n }\n }\n },\n \"Import\": {\n \"title\": \"Import Job\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/components/schemas/ImportStatus\"\n },\n {\n \"$ref\": \"#/components/schemas/TaskImportStatus\"\n }\n ]\n },\n \"task\": {\n \"type\": \"object\",\n \"properties\": {\n \"taskId\": {\n \"type\": \"string\"\n }\n }\n },\n \"tasks\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"taskId\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"catalogEntityName\": {\n \"type\": \"string\",\n \"description\": \"Specified entity name in the catalog. Filled only in response for dry-run import requests.\"\n },\n \"lastUpdate\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"approvalTool\": {\n \"$ref\": \"#/components/schemas/ApprovalTool\"\n },\n \"repository\": {\n \"$ref\": \"#/components/schemas/Repository\"\n },\n \"gitlab\": {\n \"type\": \"object\",\n \"description\": \"GitLab details. Applicable if approvalTool is gitlab.\",\n \"properties\": {\n \"pullRequest\": {\n \"$ref\": \"#/components/schemas/PullRequest\"\n }\n }\n },\n \"github\": {\n \"type\": \"object\",\n \"description\": \"GitHub details. Applicable if approvalTool is git.\",\n \"properties\": {\n \"pullRequest\": {\n \"$ref\": \"#/components/schemas/PullRequest\"\n }\n }\n }\n }\n },\n \"PullRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"url\": {\n \"type\": \"string\",\n \"description\": \"URL of the Pull Request\"\n },\n \"number\": {\n \"type\": \"number\",\n \"description\": \"Pull Request number\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"title of the Pull Request\"\n },\n \"body\": {\n \"type\": \"string\",\n \"description\": \"body of the Pull Request\"\n },\n \"catalogInfoContent\": {\n \"type\": \"string\",\n \"description\": \"content of the catalog-info.yaml as fetched from the Pull Request.\"\n },\n \"status\": {\n \"type\": \"string\",\n \"enum\": [\n \"WAIT_PR_APPROVAL\",\n \"PR_MERGED\",\n \"PR_ERROR\"\n ]\n }\n }\n },\n \"SourceImport\": {\n \"title\": \"Import Job with source it originates from\",\n \"allOf\": [\n {\n \"$ref\": \"#/components/schemas/Import\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"source\": {\n \"$ref\": \"#/components/schemas/Source\"\n }\n }\n }\n ]\n },\n \"Source\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Import Source:\\\\n * 'config' - Import from static catalog location configuration in 'app-config'\\\\n * 'location' - Import of user registered entities using locations endpoint\\\\n * 'integration' - Import using a GitHub integration\\\\n * null - Import source is unknown\\\\n\",\n \"enum\": [\n \"config\",\n \"location\",\n \"integration\",\n null\n ]\n },\n \"ImportRequest\": {\n \"title\": \"Import Job request\",\n \"type\": \"object\",\n \"required\": [\n \"repository\"\n ],\n \"properties\": {\n \"approvalTool\": {\n \"$ref\": \"#/components/schemas/ApprovalTool\"\n },\n \"catalogEntityName\": {\n \"type\": \"string\",\n \"description\": \"Expected Entity name in the catalog. Relevant only if the 'dryRun' query parameter is set to 'true'.\"\n },\n \"codeOwnersFileAsEntityOwner\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the CODEOWNERS file will be used as entity owner. Only relevant for dry-run requests. If set to 'false', the corresponding dry-run check will be skipped.\"\n },\n \"repository\": {\n \"type\": \"object\",\n \"required\": [\n \"url\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"repository name\"\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"repository URL\"\n },\n \"organization\": {\n \"type\": \"string\",\n \"description\": \"organization which the repository is part of\"\n },\n \"defaultBranch\": {\n \"type\": \"string\",\n \"description\": \"default branch\"\n }\n }\n },\n \"catalogInfoContent\": {\n \"type\": \"string\",\n \"description\": \"content of the catalog-info.yaml to include in the import Pull Request.\"\n },\n \"gitlab\": {\n \"type\": \"object\",\n \"description\": \"GitLab details. Applicable if approvalTool is gitlab.\",\n \"properties\": {\n \"pullRequest\": {\n \"$ref\": \"#/components/schemas/PullRequest\"\n }\n }\n },\n \"github\": {\n \"type\": \"object\",\n \"description\": \"GitHub details. Applicable if approvalTool is git.\",\n \"properties\": {\n \"pullRequest\": {\n \"$ref\": \"#/components/schemas/PullRequest\"\n }\n }\n }\n }\n },\n \"ScaffolderTask\": {\n \"title\": \"Scaffolder Task\",\n \"type\": \"object\",\n \"properties\": {\n \"taskId\": {\n \"type\": \"string\"\n },\n \"repositoryId\": {\n \"type\": \"number\"\n },\n \"locations\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"securitySchemes\": {\n \"BearerAuth\": {\n \"type\": \"http\",\n \"scheme\": \"bearer\",\n \"bearerFormat\": \"JWT\",\n \"description\": \"Backstage Permissions Framework JWT\"\n }\n },\n \"examples\": {\n \"multipleOrgs\": {\n \"summary\": \"Multiple organizations\",\n \"value\": {\n \"errors\": [],\n \"organizations\": [\n {\n \"id\": \"unique-org-id-1\",\n \"name\": \"pet-org\",\n \"url\": \"https://github.com/pet-org\",\n \"description\": \"A great Pet Org\",\n \"totalRepoCount\": 10\n },\n {\n \"id\": \"unique-org-id-2\",\n \"name\": \"org-zero\",\n \"url\": \"https://ghe.example.com/org-zero\",\n \"totalRepoCount\": 0\n },\n {\n \"id\": \"unique-id-2\",\n \"name\": \"org-one\",\n \"url\": \"https://ghe.example.com/org-one\",\n \"description\": \"Org One description\",\n \"totalRepoCount\": 1234\n }\n ]\n }\n },\n \"orgListErrors\": {\n \"summary\": \"Errors when listing organizations\",\n \"value\": {\n \"errors\": [\n \"Github App with ID 2 failed spectacularly\"\n ],\n \"organizations\": []\n }\n },\n \"multipleRepos\": {\n \"summary\": \"Multiple repositories\",\n \"value\": {\n \"errors\": [],\n \"repositories\": [\n {\n \"id\": \"unique-id-1\",\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\",\n \"importStatus\": \"WAIT_PR_APPROVAL\",\n \"defaultBranch\": \"main\"\n },\n {\n \"id\": \"unique-id-2\",\n \"name\": \"project-zero\",\n \"url\": \"https://ghe.example.com/my-other-org/project-zero\",\n \"organization\": \"my-other-org\",\n \"importStatus\": \"PR_REJECTED\",\n \"defaultBranch\": \"dev\"\n },\n {\n \"id\": \"unique-id-2\",\n \"name\": \"project-one\",\n \"defaultBranch\": \"trunk\",\n \"url\": \"https://ghe.example.com/my-other-org-2/project-one\",\n \"organization\": \"my-other-org-2\"\n }\n ]\n }\n },\n \"repositoryListErrors\": {\n \"summary\": \"Errors when listing repositories\",\n \"value\": {\n \"errors\": [\n \"Github App with ID 2 failed spectacularly\"\n ],\n \"repositories\": []\n }\n },\n \"twoImports\": {\n \"summary\": \"Two import job requests (V1)\",\n \"value\": [\n {\n \"id\": \"bulk-import-id-1\",\n \"status\": \"WAIT_PR_APPROVAL\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app/pull/1\",\n \"number\": 1\n }\n }\n },\n {\n \"id\": \"bulk-import-id-2\",\n \"status\": \"PR_REJECTED\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app-test\",\n \"url\": \"https://github.com/my-org/pet-app-test\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app-test/pull/10\",\n \"number\": 10\n }\n }\n }\n ]\n },\n \"multipleImportJobsV2\": {\n \"summary\": \"Two import job requests (V2)\",\n \"value\": {\n \"errors\": [],\n \"page\": 1,\n \"size\": 2,\n \"totalCount\": 10,\n \"imports\": [\n {\n \"id\": \"bulk-import-id-1\",\n \"status\": \"WAIT_PR_APPROVAL\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app/pull/1\",\n \"number\": 1\n }\n }\n },\n {\n \"id\": \"bulk-import-id-2\",\n \"status\": \"PR_REJECTED\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app-test\",\n \"url\": \"https://github.com/my-org/pet-app-test\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app-test/pull/10\",\n \"number\": 10\n }\n }\n }\n ]\n }\n },\n \"importJobListErrors\": {\n \"summary\": \"Errors when listing import jobs\",\n \"value\": {\n \"errors\": [\n \"Github App with ID xyz-123 failed spectacularly\"\n ],\n \"imports\": []\n }\n },\n \"twoImportJobs\": {\n \"summary\": \"Two import jobs\",\n \"value\": [\n {\n \"id\": \"bulk-import-id-1\",\n \"status\": \"WAIT_PR_APPROVAL\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app/pull/1\",\n \"number\": 1\n }\n }\n },\n {\n \"id\": \"bulk-import-id-2\",\n \"status\": \"PR_REJECTED\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app-test\",\n \"url\": \"https://github.com/my-org/pet-app-test\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app-test/pull/10\",\n \"number\": 10\n }\n }\n }\n ]\n },\n \"singleImportStatusForRepo\": {\n \"summary\": \"Single import job status for given repo\",\n \"value\": {\n \"id\": \"bulk-import-id-1\",\n \"status\": \"WAIT_PR_APPROVAL\",\n \"errors\": [],\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\"\n },\n \"github\": {\n \"pullRequest\": {\n \"url\": \"https://github.com/my-org/pet-app/pull/1\",\n \"number\": 1\n }\n }\n }\n },\n \"multipleImportRequests\": {\n \"summary\": \"Multiple import requests\",\n \"value\": [\n {\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"pet-app\",\n \"url\": \"https://github.com/my-org/pet-app\",\n \"organization\": \"my-org\",\n \"defaultBranch\": \"main\"\n },\n \"github\": {\n \"pullRequest\": {\n \"title\": \"Add default catalog-info.yaml to import to Red Hat Developer Hub\"\n }\n }\n },\n {\n \"approvalTool\": \"GIT\",\n \"repository\": {\n \"name\": \"project-zero\",\n \"url\": \"https://ghe.example.com/my-other-org/project-zero\",\n \"organization\": \"my-other-org\",\n \"defaultBranch\": \"dev\"\n },\n \"github\": {\n \"pullRequest\": {\n \"title\": \"Add custom catalog-info.yaml to import to Red Hat Developer Hub\",\n \"body\": \"This pull request adds a **Backstage entity metadata file** to this repository so that the component can be added to the Red Hat Developer Hub software catalog.\\\\n\\\\nAfter this pull request is merged, the component will become available.\\\\n\\\\nFor more information, read an [overview of the Backstage software catalog](https://backstage.io/docs/features/software-catalog/).\"\n }\n },\n \"catalogInfoContent\": \"apiVersion: backstage.io/v1alpha1\\\\nkind: Component\\\\nmetadata:\\\\n name: project-zero\\\\n annotations:\\\\n github.com/project-slug: my-other-org/project-zero\\\\n acme.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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAAA;AAuhDH,MAAA,eAAA,GAAkB,IAAK,CAAA,KAAA,CAAM,OAAO;;;;"}
|
|
@@ -228,14 +228,28 @@ class GitlabApiService {
|
|
|
228
228
|
this.integrations,
|
|
229
229
|
{
|
|
230
230
|
dataFetcher: async (gitlab) => {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
try {
|
|
232
|
+
const username = (await gitlab.Users.showCurrentUser()).username;
|
|
233
|
+
if (username) {
|
|
234
|
+
allAccessibleUsernames.add(username);
|
|
235
|
+
}
|
|
236
|
+
} catch (err) {
|
|
237
|
+
loggingUtils.logErrorIfNeeded(
|
|
238
|
+
this.logger,
|
|
239
|
+
"failed to fetch gitlab current user",
|
|
240
|
+
err
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
const allGroups = await gitlab.Groups.all({
|
|
245
|
+
allAvailable: false
|
|
246
|
+
});
|
|
247
|
+
allGroups.map((org) => org.path)?.forEach(
|
|
248
|
+
(orgName) => allAccessibleTokenOrgs.add(orgName)
|
|
249
|
+
);
|
|
250
|
+
} catch (err) {
|
|
251
|
+
loggingUtils.logErrorIfNeeded(this.logger, "failed to fetch gitlab groups", err);
|
|
234
252
|
}
|
|
235
|
-
const allGroups = await gitlab.Groups.all({
|
|
236
|
-
allAvailable: false
|
|
237
|
-
});
|
|
238
|
-
allGroups.map((org) => org.path)?.forEach((orgName) => allAccessibleTokenOrgs.add(orgName));
|
|
239
253
|
return {};
|
|
240
254
|
}
|
|
241
255
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlabApiService.cjs.js","sources":["../../src/gitlab/gitlabApiService.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 type {\n CacheService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport type { Config } from '@backstage/config';\nimport {\n GitLabIntegrationConfig,\n ScmIntegrations,\n} from '@backstage/integration';\n\nimport { Gitlab } from '@gitbeaker/rest';\nimport gitUrlParse from 'git-url-parse';\n\nimport { getBranchName, getCatalogFilename } from '../catalog/catalogUtils';\nimport {\n computeTotalCount,\n extractLocationOwnerMap,\n logErrorIfNeeded,\n} from '../helpers';\nimport {\n DefaultPageNumber,\n DefaultPageSize,\n} from '../service/handlers/handlers';\nimport { CustomGitlabCredentialsProvider } from './GitlabAppManager';\nimport {\n ExtendedGitlabCredentials,\n GitlabFetchError,\n GitlabOrganization,\n GitlabOrganizationResponse,\n GitlabRepository,\n GitlabRepositoryResponse,\n} from './types';\nimport { buildGitlab } from './utils/glUtils';\nimport { addGitlabTokenGroups } from './utils/orgUtils';\nimport { closePRWithComment, findOpenPRForBranch } from './utils/prUtils';\nimport {\n addGitlabTokenOrgRepositories,\n addGitlabTokenRepositories,\n createOrUpdateFileInBranch,\n fileExistsInDefaultBranch,\n ValidatedRepo,\n} from './utils/repoUtils';\nimport {\n executeFunctionOnFirstSuccessfulIntegration,\n fetchFromAllIntegrations,\n getCredentialsForConfig,\n} from './utils/utils';\n\nexport class GitlabApiService {\n private readonly logger: LoggerService;\n private readonly integrations: ScmIntegrations;\n private readonly gitlabCredentialsProvider: CustomGitlabCredentialsProvider;\n private readonly config: Config;\n // Cache for storing ETags (used for efficient caching of unchanged data returned by GitHub)\n private readonly cache: CacheService;\n constructor(\n logger: LoggerService,\n config: Config,\n cacheService: CacheService,\n ) {\n this.logger = logger;\n this.config = config;\n this.integrations = ScmIntegrations.fromConfig(config);\n this.gitlabCredentialsProvider =\n CustomGitlabCredentialsProvider.fromIntegrations(this.integrations);\n this.cache = cacheService;\n }\n\n async getRepositoryFromIntegrations(repoUrl: string): Promise<{\n repository?: GitlabRepository;\n errors?: GitlabFetchError[];\n }> {\n const gitUrl = gitUrlParse(repoUrl);\n\n const glConfig = this.integrations.gitlab.byUrl(repoUrl)?.config;\n if (!glConfig) {\n throw new Error(\n `No Gitlab integration config found for repo ${repoUrl}. Please add a configuration entry under 'integrations.gitlab`,\n );\n }\n\n const credentials = await getCredentialsForConfig(\n this.gitlabCredentialsProvider,\n glConfig,\n );\n let repository: GitlabRepository | undefined = undefined;\n for (const credential of credentials) {\n const glKit = buildGitlab(\n {\n logger: this.logger,\n cache: this.cache,\n },\n { credential, owner: gitUrl.owner },\n glConfig.baseUrl,\n );\n const repo = await glKit.Projects.show(`${gitUrl.owner}/${gitUrl.name}`);\n if (!repo) {\n continue;\n }\n repository = {\n name: repo.name,\n full_name: repo.path_with_namespace,\n url: repo._links.self,\n html_url: repo.web_url,\n default_branch: repo.default_branch,\n updated_at: repo.updated_at,\n };\n break;\n }\n\n return {\n repository,\n errors: [],\n };\n }\n\n async getOrganizationsFromIntegrations(\n search?: string,\n pageNumber: number = DefaultPageNumber,\n pageSize: number = DefaultPageSize,\n ): Promise<GitlabOrganizationResponse> {\n const groups = new Map<string, GitlabOrganization>();\n const result = await fetchFromAllIntegrations(\n {\n logger: this.logger,\n cache: this.cache,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n dataFetcher: async (\n glApi: InstanceType<typeof Gitlab<false>>,\n credential: ExtendedGitlabCredentials,\n glConfig: GitLabIntegrationConfig,\n ) => {\n const dataFetchErrors = new Map<number, GitlabFetchError>();\n const resp = await addGitlabTokenGroups(\n {\n logger: this.logger,\n },\n glApi,\n credential,\n {\n search,\n groups,\n pageNumber,\n pageSize,\n errors: dataFetchErrors,\n },\n );\n this.logger.debug(\n `Got ${resp.totalCount} groups(s) for ${glConfig.host}`,\n );\n return {\n result: resp.totalCount ?? 0,\n errors: Array.from(dataFetchErrors.values()),\n };\n },\n },\n );\n\n const groupList = Array.from(groups.values());\n const totalCount = computeTotalCount(groupList, result.data, pageSize);\n return {\n organizations: groupList,\n errors: Array.from(result.errors?.values() ?? []),\n totalCount,\n };\n }\n\n async getOrgRepositoriesFromIntegrations(\n orgName: string,\n search?: string,\n pageNumber: number = DefaultPageNumber,\n pageSize: number = DefaultPageSize,\n ): Promise<GitlabRepositoryResponse> {\n const orgRepositories = new Map<string, GitlabRepository>();\n const result = await fetchFromAllIntegrations(\n {\n logger: this.logger,\n cache: this.cache,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n dataFetcher: async (\n glApi: InstanceType<typeof Gitlab<false>>,\n credential: ExtendedGitlabCredentials,\n glConfig: GitLabIntegrationConfig,\n ) => {\n const dataFetchErrors = new Map<number, GitlabFetchError>();\n const resp = await addGitlabTokenOrgRepositories(\n {\n logger: this.logger,\n },\n glApi,\n credential,\n orgName,\n orgRepositories,\n dataFetchErrors,\n {\n search,\n pageNumber,\n pageSize,\n },\n );\n this.logger.debug(\n `Got ${resp.totalCount} org repo(s) for ${glConfig.host}`,\n );\n return {\n stopFetchingData: true,\n result: resp.totalCount ?? 0,\n errors: Array.from(dataFetchErrors.values()),\n };\n },\n },\n );\n\n const repoList = Array.from(orgRepositories.values());\n const totalCount = computeTotalCount(repoList, result.data, pageSize);\n return {\n repositories: repoList,\n errors: Array.from(result.errors?.values() ?? []),\n totalCount,\n };\n }\n\n /**\n * Returns GitlabRepositoryResponse containing:\n * - a list of unique repositories the gitlab integrations have access to\n * - a list of errors encountered by each token (if any exist)\n */\n async getRepositoriesFromIntegrations(\n search?: string,\n pageNumber: number = DefaultPageNumber,\n pageSize: number = DefaultPageSize,\n ): Promise<GitlabRepositoryResponse> {\n const repositories = new Map<string, GitlabRepository>();\n const result = await fetchFromAllIntegrations(\n {\n logger: this.logger,\n cache: this.cache,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n dataFetcher: async (\n glApi: InstanceType<typeof Gitlab<false>>,\n credential: ExtendedGitlabCredentials,\n glConfig: GitLabIntegrationConfig,\n ) => {\n const dataFetchErrors = new Map<number, GitlabFetchError>();\n const resp = await addGitlabTokenRepositories(\n {\n logger: this.logger,\n },\n glApi,\n credential,\n repositories,\n dataFetchErrors,\n {\n search,\n pageNumber,\n pageSize,\n },\n );\n this.logger.debug(\n `Got ${resp.totalCount} repo(s) for ${glConfig.host}`,\n );\n return {\n result: resp.totalCount ?? 0,\n errors: Array.from(dataFetchErrors.values()),\n };\n },\n },\n );\n\n const repoList = Array.from(repositories.values());\n const totalCount = computeTotalCount(repoList, result.data, pageSize);\n return {\n repositories: repoList,\n errors: Array.from(result.errors?.values() ?? []),\n totalCount,\n };\n }\n\n async filterLocationsAccessibleFromIntegrations(\n locationUrls: string[],\n ): Promise<string[]> {\n const locationGitOwnerMap = extractLocationOwnerMap(locationUrls);\n\n const allAccessibleTokenOrgs = new Set<string>();\n const allAccessibleUsernames = new Set<string>();\n await fetchFromAllIntegrations(\n {\n logger: this.logger,\n cache: this.cache,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n dataFetcher: async (gitlab: InstanceType<typeof Gitlab<false>>) => {\n // find authenticated gitlab owner...\n const username = (await gitlab.Users.showCurrentUser()).username;\n if (username) {\n allAccessibleUsernames.add(username);\n }\n // ... along with orgs accessible from the token auth\n\n const allGroups = await gitlab.Groups.all<false, 'offset'>({\n allAvailable: false,\n });\n allGroups\n .map(org => org.path)\n ?.forEach((orgName: string) => allAccessibleTokenOrgs.add(orgName));\n return {};\n },\n },\n );\n\n return locationUrls.filter(loc => {\n if (!locationGitOwnerMap.has(loc)) {\n return false;\n }\n const owner = locationGitOwnerMap.get(loc)!;\n return (\n allAccessibleTokenOrgs.has(owner) || allAccessibleUsernames.has(owner)\n );\n });\n }\n\n async findImportOpenPr(\n logger: LoggerService,\n input: {\n repoUrl: string;\n includeCatalogInfoContent?: boolean;\n },\n ): Promise<{\n prNum?: number;\n prUrl?: string;\n prTitle?: string;\n prBody?: string;\n prCatalogInfoContent?: string;\n lastUpdate?: string;\n }> {\n const glConfig = this.integrations.gitlab.byUrl(input.repoUrl)?.config;\n if (!glConfig) {\n throw new Error(`Could not find GL integration from ${input.repoUrl}`);\n }\n\n const gitUrl = gitUrlParse(input.repoUrl);\n const owner = gitUrl.organization;\n const repo = gitUrl.name;\n\n const credentials = await this.gitlabCredentialsProvider.getAllCredentials({\n host: glConfig.host,\n });\n if (credentials.length === 0) {\n throw new Error(`No credentials for GL integration`);\n }\n\n const branchName = getBranchName(this.config);\n for (const credential of credentials) {\n const glKit = buildGitlab(\n {\n logger: this.logger,\n cache: this.cache,\n },\n { credential, owner },\n glConfig.baseUrl,\n );\n try {\n return await findOpenPRForBranch(\n logger,\n this.config,\n glKit,\n owner,\n repo,\n branchName,\n input.includeCatalogInfoContent,\n );\n } catch (error: any) {\n logErrorIfNeeded(this.logger, 'Error fetching pull requests', error);\n }\n }\n return {};\n }\n\n async submitPrToRepo(\n logger: LoggerService,\n input: {\n repoUrl: string;\n gitUrl: gitUrlParse.GitUrl;\n defaultBranch?: string;\n prTitle: string;\n prBody: string;\n catalogInfoContent: string;\n },\n ): Promise<{\n prUrl?: string;\n prNumber?: number;\n hasChanges?: boolean;\n lastUpdate?: string;\n errors?: string[];\n }> {\n const fileName = getCatalogFilename(this.config);\n const errors: any[] = [];\n\n const result = await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ): Promise<{\n successful: boolean;\n result?: {\n prUrl?: string;\n prNumber?: number;\n hasChanges?: boolean;\n lastUpdate?: string;\n };\n }> => {\n const { owner, repo, branchName } = validatedRepo;\n try {\n // Check if there is already a catalogInfo in the default branch\n const catalogInfoFileExists = await fileExistsInDefaultBranch(\n logger,\n gitlab,\n owner,\n repo,\n fileName,\n input.defaultBranch,\n );\n if (catalogInfoFileExists) {\n // No need to create a PR => component will be imported as is\n return {\n successful: true,\n result: {\n hasChanges: false,\n },\n };\n }\n\n const existingPrForBranch = await findOpenPRForBranch(\n logger,\n this.config,\n gitlab,\n owner,\n repo,\n branchName,\n );\n\n const repoData = await gitlab.Projects.show(`${owner}/${repo}`);\n\n const parentRef = await gitlab.Branches.show(\n `${owner}/${repo}`,\n repoData.default_branch,\n ); // This might not be neccesarry\n\n if (existingPrForBranch.prNum) {\n await createOrUpdateFileInBranch(\n gitlab,\n owner,\n repo,\n branchName,\n fileName,\n input.catalogInfoContent,\n );\n const pullRequestResponse = await gitlab.MergeRequests.edit(\n `${owner}/${repo}`,\n existingPrForBranch.prNum,\n {\n description: input.prBody,\n title: input.prTitle,\n targetBranch: repoData.default_branch,\n },\n );\n return {\n successful: true,\n result: {\n prNumber: existingPrForBranch.prNum,\n prUrl: pullRequestResponse.web_url,\n lastUpdate: pullRequestResponse.updated_at,\n },\n };\n }\n\n try {\n await gitlab.Branches.show(`${owner}/${repo}`, branchName);\n } catch (error: any) {\n if (error.cause.response.status === 404) {\n await gitlab.Branches.create(\n `${owner}/${repo}`,\n branchName,\n parentRef.name,\n );\n } else {\n throw error;\n }\n }\n\n // Might not be able to do this in the gitlab api\n // This is if the branch exists, but there wasn't a PR yet\n // if (branchExists) {\n // // update it in case it is outdated compared to the base branch\n // try {\n // await octo.repos.merge({\n // owner: owner,\n // repo: repo,\n // base: branchName,\n // head: repoData.data.default_branch,\n // });\n // } catch (error: any) {\n // logErrorIfNeeded(\n // this.logger,\n // `Could not merge default branch ${repoData.data.default_branch} into import branch ${branchName}`,\n // error,\n // );\n // }\n // }\n\n await createOrUpdateFileInBranch(\n gitlab,\n owner,\n repo,\n branchName,\n fileName,\n input.catalogInfoContent,\n );\n\n const pullRequestResponse = await gitlab.MergeRequests.create(\n `${owner}/${repo}`,\n branchName,\n repoData.default_branch,\n input.prTitle,\n {\n description: input.prBody,\n },\n );\n return {\n successful: true,\n result: {\n prNumber: pullRequestResponse.iid,\n prUrl: pullRequestResponse.web_url,\n lastUpdate: pullRequestResponse.updated_at,\n hasChanges: true,\n },\n };\n } catch (e: any) {\n logErrorIfNeeded(\n this.logger,\n `Couldn't create PR in ${input.repoUrl}`,\n e,\n );\n errors.push(e.message);\n return { successful: false };\n }\n },\n },\n );\n\n if (result) {\n return result;\n }\n\n logger.warn(\n `Tried all possible Gitlab credentials, but could not create PR in ${input.repoUrl}. Please try again later...`,\n );\n\n return {\n errors: errors,\n };\n }\n\n async hasFileInRepo(input: {\n repoUrl: string;\n defaultBranch?: string;\n fileName: string;\n }) {\n const fileExists = await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ) => {\n const { owner, repo } = validatedRepo;\n const exists = await fileExistsInDefaultBranch(\n this.logger,\n gitlab,\n owner,\n repo,\n input.fileName,\n input.defaultBranch,\n );\n if (exists === undefined) {\n return { successful: false };\n }\n return { successful: true, result: exists };\n },\n },\n );\n\n if (fileExists === undefined) {\n throw new Error(\n `Could not determine if repo at ${input.repoUrl} already has a file named ${input.fileName} in its default branch (${input.defaultBranch})`,\n );\n }\n\n return fileExists;\n }\n\n async closeImportPR(\n logger: LoggerService,\n input: {\n repoUrl: string;\n gitUrl: gitUrlParse.GitUrl;\n comment: string;\n },\n ) {\n await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ) => {\n const { owner, repo, branchName } = validatedRepo;\n try {\n const existingPrForBranch = await findOpenPRForBranch(\n logger,\n this.config,\n gitlab,\n owner,\n repo,\n branchName,\n );\n if (existingPrForBranch.prNum) {\n await closePRWithComment(\n gitlab,\n owner,\n repo,\n existingPrForBranch.prNum,\n input.comment,\n );\n }\n return { successful: true };\n } catch (e: any) {\n logErrorIfNeeded(\n this.logger,\n `Couldn't close PR in ${input.repoUrl}`,\n e,\n );\n return { successful: false };\n }\n },\n },\n );\n }\n\n async deleteImportBranch(input: {\n repoUrl: string;\n gitUrl: gitUrlParse.GitUrl;\n }) {\n await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ) => {\n const { owner, repo, branchName } = validatedRepo;\n try {\n await gitlab.Branches.remove(`${owner}/${repo}`, branchName);\n return { successful: true };\n } catch (e: any) {\n logErrorIfNeeded(\n this.logger,\n `Couldn't close import PR and/or delete import branch in ${input.repoUrl}`,\n e,\n );\n return { successful: false };\n }\n },\n },\n );\n }\n\n async isRepoEmpty(input: { repoUrl: string }) {\n return await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ) => {\n const { owner, repo } = validatedRepo;\n const resp = await gitlab.Repositories.allContributors(\n `${owner}/${repo}`,\n {\n showExpanded: true,\n },\n );\n return { successful: true, result: resp?.data?.length < 1 };\n },\n },\n );\n }\n\n async getPullRequest(\n repoUrl: string,\n pullRequestNumber: number,\n ): Promise<{\n title?: string;\n body?: string;\n merged?: boolean;\n lastUpdated?: string;\n prSha?: string;\n prBranch?: string;\n }> {\n const glConfig = this.integrations.gitlab.byUrl(repoUrl)?.config;\n if (!glConfig) {\n this.logger.error(\n `No Gitlab integration config found for repo ${repoUrl}`,\n );\n return {};\n }\n\n const gitUrl = gitUrlParse(repoUrl);\n const owner = gitUrl.owner;\n const repo = gitUrl.name;\n\n const credentials = await this.gitlabCredentialsProvider.getAllCredentials({\n host: glConfig.host,\n });\n\n if (credentials.length === 0) {\n this.logger.error(`No credentials for GL integration`);\n return {};\n }\n\n for (const credential of credentials) {\n const glKit = buildGitlab(\n {\n logger: this.logger,\n cache: this.cache,\n },\n { credential, owner },\n glConfig.baseUrl,\n );\n\n try {\n const pr = await glKit.MergeRequests.show(\n `${owner}/${repo}`,\n pullRequestNumber,\n );\n\n return {\n title: pr.title,\n body: pr.description || undefined,\n merged: pr.state === 'merged',\n lastUpdated: pr.updated_at,\n prSha: pr.sha,\n prBranch: pr.source_branch,\n };\n } catch (error: any) {\n this.logger.error(\n `Error fetching pull request ${pullRequestNumber} from ${repoUrl}`,\n error,\n );\n }\n }\n\n return {};\n }\n\n async getCatalogInfoFile(\n logger: LoggerService,\n input: {\n repoUrl: string;\n prNumber: number;\n prHeadSha: string;\n },\n ): Promise<string | undefined> {\n const glConfig = this.integrations.gitlab.byUrl(input.repoUrl)?.config;\n if (!glConfig) {\n logger.error(\n `No Gitlab integration config found for repo ${input.repoUrl}`,\n );\n return undefined;\n }\n\n const gitUrl = gitUrlParse(input.repoUrl);\n const owner = gitUrl.owner;\n const repo = gitUrl.name;\n\n const credentials = await this.gitlabCredentialsProvider.getAllCredentials({\n host: glConfig.host,\n });\n\n if (credentials.length === 0) {\n logger.error(`No credentials for GL integration`);\n return undefined;\n }\n\n for (const credential of credentials) {\n const glKit = buildGitlab(\n {\n logger: this.logger,\n cache: this.cache,\n },\n { credential, owner },\n glConfig.baseUrl,\n );\n\n try {\n const file = await glKit.RepositoryFiles.show(\n `${owner}/${repo}`,\n getCatalogFilename(this.config),\n input.prHeadSha,\n );\n\n if (file) {\n const content = Buffer.from(file.content, 'base64').toString('utf-8');\n return content;\n }\n } catch (error: any) {\n if (error.cause?.response?.status === 404) {\n logger.warn(\n `catalog-info.yaml not found in PR ${input.prNumber} of ${input.repoUrl}`,\n );\n return undefined;\n }\n logger.error(\n `Error fetching catalog-info.yaml from PR ${input.prNumber} of ${input.repoUrl}`,\n error,\n );\n return undefined;\n }\n }\n\n return undefined;\n }\n}\n"],"names":["ScmIntegrations","CustomGitlabCredentialsProvider","gitUrlParse","getCredentialsForConfig","buildGitlab","DefaultPageNumber","DefaultPageSize","fetchFromAllIntegrations","addGitlabTokenGroups","computeTotalCount","addGitlabTokenOrgRepositories","addGitlabTokenRepositories","extractLocationOwnerMap","getBranchName","findOpenPRForBranch","logErrorIfNeeded","getCatalogFilename","executeFunctionOnFirstSuccessfulIntegration","fileExistsInDefaultBranch","createOrUpdateFileInBranch","pullRequestResponse","closePRWithComment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgEO,MAAM,gBAAiB,CAAA;AAAA,EACX,MAAA;AAAA,EACA,YAAA;AAAA,EACA,yBAAA;AAAA,EACA,MAAA;AAAA;AAAA,EAEA,KAAA;AAAA,EACjB,WAAA,CACE,MACA,EAAA,MAAA,EACA,YACA,EAAA;AACA,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA;AACd,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA;AACd,IAAK,IAAA,CAAA,YAAA,GAAeA,2BAAgB,CAAA,UAAA,CAAW,MAAM,CAAA;AACrD,IAAA,IAAA,CAAK,yBACH,GAAAC,gDAAA,CAAgC,gBAAiB,CAAA,IAAA,CAAK,YAAY,CAAA;AACpE,IAAA,IAAA,CAAK,KAAQ,GAAA,YAAA;AAAA;AACf,EAEA,MAAM,8BAA8B,OAGjC,EAAA;AACD,IAAM,MAAA,MAAA,GAASC,6BAAY,OAAO,CAAA;AAElC,IAAA,MAAM,WAAW,IAAK,CAAA,YAAA,CAAa,MAAO,CAAA,KAAA,CAAM,OAAO,CAAG,EAAA,MAAA;AAC1D,IAAA,IAAI,CAAC,QAAU,EAAA;AACb,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,+CAA+C,OAAO,CAAA,6DAAA;AAAA,OACxD;AAAA;AAGF,IAAA,MAAM,cAAc,MAAMC,6BAAA;AAAA,MACxB,IAAK,CAAA,yBAAA;AAAA,MACL;AAAA,KACF;AACA,IAAA,IAAI,UAA2C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,EAAA;AAAA,QACpB,QAAS,CAAA;AAAA,OACX;AAEA,MAAI,IAAA;AACF,QAAM,MAAA,IAAA,GAAO,MAAM,KAAA,CAAM,eAAgB,CAAA,IAAA;AAAA,UACvC,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,UAChBY,+BAAA,CAAmB,KAAK,MAAM,CAAA;AAAA,UAC9B,KAAM,CAAA;AAAA,SACR;AAEA,QAAA,IAAI,IAAM,EAAA;AACR,UAAM,MAAA,OAAA,GAAU,OAAO,IAAK,CAAA,IAAA,CAAK,SAAS,QAAQ,CAAA,CAAE,SAAS,OAAO,CAAA;AACpE,UAAO,OAAA,OAAA;AAAA;AACT,eACO,KAAY,EAAA;AACnB,QAAA,IAAI,KAAM,CAAA,KAAA,EAAO,QAAU,EAAA,MAAA,KAAW,GAAK,EAAA;AACzC,UAAO,MAAA,CAAA,IAAA;AAAA,YACL,CAAqC,kCAAA,EAAA,KAAA,CAAM,QAAQ,CAAA,IAAA,EAAO,MAAM,OAAO,CAAA;AAAA,WACzE;AACA,UAAO,OAAA,SAAA;AAAA;AAET,QAAO,MAAA,CAAA,KAAA;AAAA,UACL,CAA4C,yCAAA,EAAA,KAAA,CAAM,QAAQ,CAAA,IAAA,EAAO,MAAM,OAAO,CAAA,CAAA;AAAA,UAC9E;AAAA,SACF;AACA,QAAO,OAAA,SAAA;AAAA;AACT;AAGF,IAAO,OAAA,SAAA;AAAA;AAEX;;;;"}
|
|
1
|
+
{"version":3,"file":"gitlabApiService.cjs.js","sources":["../../src/gitlab/gitlabApiService.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 type {\n CacheService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport type { Config } from '@backstage/config';\nimport {\n GitLabIntegrationConfig,\n ScmIntegrations,\n} from '@backstage/integration';\n\nimport { Gitlab } from '@gitbeaker/rest';\nimport gitUrlParse from 'git-url-parse';\n\nimport { getBranchName, getCatalogFilename } from '../catalog/catalogUtils';\nimport {\n computeTotalCount,\n extractLocationOwnerMap,\n logErrorIfNeeded,\n} from '../helpers';\nimport {\n DefaultPageNumber,\n DefaultPageSize,\n} from '../service/handlers/handlers';\nimport { CustomGitlabCredentialsProvider } from './GitlabAppManager';\nimport {\n ExtendedGitlabCredentials,\n GitlabFetchError,\n GitlabOrganization,\n GitlabOrganizationResponse,\n GitlabRepository,\n GitlabRepositoryResponse,\n} from './types';\nimport { buildGitlab } from './utils/glUtils';\nimport { addGitlabTokenGroups } from './utils/orgUtils';\nimport { closePRWithComment, findOpenPRForBranch } from './utils/prUtils';\nimport {\n addGitlabTokenOrgRepositories,\n addGitlabTokenRepositories,\n createOrUpdateFileInBranch,\n fileExistsInDefaultBranch,\n ValidatedRepo,\n} from './utils/repoUtils';\nimport {\n executeFunctionOnFirstSuccessfulIntegration,\n fetchFromAllIntegrations,\n getCredentialsForConfig,\n} from './utils/utils';\n\nexport class GitlabApiService {\n private readonly logger: LoggerService;\n private readonly integrations: ScmIntegrations;\n private readonly gitlabCredentialsProvider: CustomGitlabCredentialsProvider;\n private readonly config: Config;\n // Cache for storing ETags (used for efficient caching of unchanged data returned by GitHub)\n private readonly cache: CacheService;\n constructor(\n logger: LoggerService,\n config: Config,\n cacheService: CacheService,\n ) {\n this.logger = logger;\n this.config = config;\n this.integrations = ScmIntegrations.fromConfig(config);\n this.gitlabCredentialsProvider =\n CustomGitlabCredentialsProvider.fromIntegrations(this.integrations);\n this.cache = cacheService;\n }\n\n async getRepositoryFromIntegrations(repoUrl: string): Promise<{\n repository?: GitlabRepository;\n errors?: GitlabFetchError[];\n }> {\n const gitUrl = gitUrlParse(repoUrl);\n\n const glConfig = this.integrations.gitlab.byUrl(repoUrl)?.config;\n if (!glConfig) {\n throw new Error(\n `No Gitlab integration config found for repo ${repoUrl}. Please add a configuration entry under 'integrations.gitlab`,\n );\n }\n\n const credentials = await getCredentialsForConfig(\n this.gitlabCredentialsProvider,\n glConfig,\n );\n let repository: GitlabRepository | undefined = undefined;\n for (const credential of credentials) {\n const glKit = buildGitlab(\n {\n logger: this.logger,\n cache: this.cache,\n },\n { credential, owner: gitUrl.owner },\n glConfig.baseUrl,\n );\n const repo = await glKit.Projects.show(`${gitUrl.owner}/${gitUrl.name}`);\n if (!repo) {\n continue;\n }\n repository = {\n name: repo.name,\n full_name: repo.path_with_namespace,\n url: repo._links.self,\n html_url: repo.web_url,\n default_branch: repo.default_branch,\n updated_at: repo.updated_at,\n };\n break;\n }\n\n return {\n repository,\n errors: [],\n };\n }\n\n async getOrganizationsFromIntegrations(\n search?: string,\n pageNumber: number = DefaultPageNumber,\n pageSize: number = DefaultPageSize,\n ): Promise<GitlabOrganizationResponse> {\n const groups = new Map<string, GitlabOrganization>();\n const result = await fetchFromAllIntegrations(\n {\n logger: this.logger,\n cache: this.cache,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n dataFetcher: async (\n glApi: InstanceType<typeof Gitlab<false>>,\n credential: ExtendedGitlabCredentials,\n glConfig: GitLabIntegrationConfig,\n ) => {\n const dataFetchErrors = new Map<number, GitlabFetchError>();\n const resp = await addGitlabTokenGroups(\n {\n logger: this.logger,\n },\n glApi,\n credential,\n {\n search,\n groups,\n pageNumber,\n pageSize,\n errors: dataFetchErrors,\n },\n );\n this.logger.debug(\n `Got ${resp.totalCount} groups(s) for ${glConfig.host}`,\n );\n return {\n result: resp.totalCount ?? 0,\n errors: Array.from(dataFetchErrors.values()),\n };\n },\n },\n );\n\n const groupList = Array.from(groups.values());\n const totalCount = computeTotalCount(groupList, result.data, pageSize);\n return {\n organizations: groupList,\n errors: Array.from(result.errors?.values() ?? []),\n totalCount,\n };\n }\n\n async getOrgRepositoriesFromIntegrations(\n orgName: string,\n search?: string,\n pageNumber: number = DefaultPageNumber,\n pageSize: number = DefaultPageSize,\n ): Promise<GitlabRepositoryResponse> {\n const orgRepositories = new Map<string, GitlabRepository>();\n const result = await fetchFromAllIntegrations(\n {\n logger: this.logger,\n cache: this.cache,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n dataFetcher: async (\n glApi: InstanceType<typeof Gitlab<false>>,\n credential: ExtendedGitlabCredentials,\n glConfig: GitLabIntegrationConfig,\n ) => {\n const dataFetchErrors = new Map<number, GitlabFetchError>();\n const resp = await addGitlabTokenOrgRepositories(\n {\n logger: this.logger,\n },\n glApi,\n credential,\n orgName,\n orgRepositories,\n dataFetchErrors,\n {\n search,\n pageNumber,\n pageSize,\n },\n );\n this.logger.debug(\n `Got ${resp.totalCount} org repo(s) for ${glConfig.host}`,\n );\n return {\n stopFetchingData: true,\n result: resp.totalCount ?? 0,\n errors: Array.from(dataFetchErrors.values()),\n };\n },\n },\n );\n\n const repoList = Array.from(orgRepositories.values());\n const totalCount = computeTotalCount(repoList, result.data, pageSize);\n return {\n repositories: repoList,\n errors: Array.from(result.errors?.values() ?? []),\n totalCount,\n };\n }\n\n /**\n * Returns GitlabRepositoryResponse containing:\n * - a list of unique repositories the gitlab integrations have access to\n * - a list of errors encountered by each token (if any exist)\n */\n async getRepositoriesFromIntegrations(\n search?: string,\n pageNumber: number = DefaultPageNumber,\n pageSize: number = DefaultPageSize,\n ): Promise<GitlabRepositoryResponse> {\n const repositories = new Map<string, GitlabRepository>();\n const result = await fetchFromAllIntegrations(\n {\n logger: this.logger,\n cache: this.cache,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n dataFetcher: async (\n glApi: InstanceType<typeof Gitlab<false>>,\n credential: ExtendedGitlabCredentials,\n glConfig: GitLabIntegrationConfig,\n ) => {\n const dataFetchErrors = new Map<number, GitlabFetchError>();\n const resp = await addGitlabTokenRepositories(\n {\n logger: this.logger,\n },\n glApi,\n credential,\n repositories,\n dataFetchErrors,\n {\n search,\n pageNumber,\n pageSize,\n },\n );\n this.logger.debug(\n `Got ${resp.totalCount} repo(s) for ${glConfig.host}`,\n );\n return {\n result: resp.totalCount ?? 0,\n errors: Array.from(dataFetchErrors.values()),\n };\n },\n },\n );\n\n const repoList = Array.from(repositories.values());\n const totalCount = computeTotalCount(repoList, result.data, pageSize);\n return {\n repositories: repoList,\n errors: Array.from(result.errors?.values() ?? []),\n totalCount,\n };\n }\n\n async filterLocationsAccessibleFromIntegrations(\n locationUrls: string[],\n ): Promise<string[]> {\n const locationGitOwnerMap = extractLocationOwnerMap(locationUrls);\n\n const allAccessibleTokenOrgs = new Set<string>();\n const allAccessibleUsernames = new Set<string>();\n await fetchFromAllIntegrations(\n {\n logger: this.logger,\n cache: this.cache,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n dataFetcher: async (gitlab: InstanceType<typeof Gitlab<false>>) => {\n // find authenticated gitlab owner...\n try {\n const username = (await gitlab.Users.showCurrentUser()).username;\n if (username) {\n allAccessibleUsernames.add(username);\n }\n } catch (err) {\n logErrorIfNeeded(\n this.logger,\n 'failed to fetch gitlab current user',\n err,\n );\n }\n\n // ... along with orgs accessible from the token auth\n try {\n const allGroups = await gitlab.Groups.all<false, 'offset'>({\n allAvailable: false,\n });\n allGroups\n .map(org => org.path)\n ?.forEach((orgName: string) =>\n allAccessibleTokenOrgs.add(orgName),\n );\n } catch (err) {\n logErrorIfNeeded(this.logger, 'failed to fetch gitlab groups', err);\n }\n\n return {};\n },\n },\n );\n\n return locationUrls.filter(loc => {\n if (!locationGitOwnerMap.has(loc)) {\n return false;\n }\n const owner = locationGitOwnerMap.get(loc)!;\n return (\n allAccessibleTokenOrgs.has(owner) || allAccessibleUsernames.has(owner)\n );\n });\n }\n\n async findImportOpenPr(\n logger: LoggerService,\n input: {\n repoUrl: string;\n includeCatalogInfoContent?: boolean;\n },\n ): Promise<{\n prNum?: number;\n prUrl?: string;\n prTitle?: string;\n prBody?: string;\n prCatalogInfoContent?: string;\n lastUpdate?: string;\n }> {\n const glConfig = this.integrations.gitlab.byUrl(input.repoUrl)?.config;\n if (!glConfig) {\n throw new Error(`Could not find GL integration from ${input.repoUrl}`);\n }\n\n const gitUrl = gitUrlParse(input.repoUrl);\n const owner = gitUrl.organization;\n const repo = gitUrl.name;\n\n const credentials = await this.gitlabCredentialsProvider.getAllCredentials({\n host: glConfig.host,\n });\n if (credentials.length === 0) {\n throw new Error(`No credentials for GL integration`);\n }\n\n const branchName = getBranchName(this.config);\n for (const credential of credentials) {\n const glKit = buildGitlab(\n {\n logger: this.logger,\n cache: this.cache,\n },\n { credential, owner },\n glConfig.baseUrl,\n );\n try {\n return await findOpenPRForBranch(\n logger,\n this.config,\n glKit,\n owner,\n repo,\n branchName,\n input.includeCatalogInfoContent,\n );\n } catch (error: any) {\n logErrorIfNeeded(this.logger, 'Error fetching pull requests', error);\n }\n }\n return {};\n }\n\n async submitPrToRepo(\n logger: LoggerService,\n input: {\n repoUrl: string;\n gitUrl: gitUrlParse.GitUrl;\n defaultBranch?: string;\n prTitle: string;\n prBody: string;\n catalogInfoContent: string;\n },\n ): Promise<{\n prUrl?: string;\n prNumber?: number;\n hasChanges?: boolean;\n lastUpdate?: string;\n errors?: string[];\n }> {\n const fileName = getCatalogFilename(this.config);\n const errors: any[] = [];\n\n const result = await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ): Promise<{\n successful: boolean;\n result?: {\n prUrl?: string;\n prNumber?: number;\n hasChanges?: boolean;\n lastUpdate?: string;\n };\n }> => {\n const { owner, repo, branchName } = validatedRepo;\n try {\n // Check if there is already a catalogInfo in the default branch\n const catalogInfoFileExists = await fileExistsInDefaultBranch(\n logger,\n gitlab,\n owner,\n repo,\n fileName,\n input.defaultBranch,\n );\n if (catalogInfoFileExists) {\n // No need to create a PR => component will be imported as is\n return {\n successful: true,\n result: {\n hasChanges: false,\n },\n };\n }\n\n const existingPrForBranch = await findOpenPRForBranch(\n logger,\n this.config,\n gitlab,\n owner,\n repo,\n branchName,\n );\n\n const repoData = await gitlab.Projects.show(`${owner}/${repo}`);\n\n const parentRef = await gitlab.Branches.show(\n `${owner}/${repo}`,\n repoData.default_branch,\n ); // This might not be neccesarry\n\n if (existingPrForBranch.prNum) {\n await createOrUpdateFileInBranch(\n gitlab,\n owner,\n repo,\n branchName,\n fileName,\n input.catalogInfoContent,\n );\n const pullRequestResponse = await gitlab.MergeRequests.edit(\n `${owner}/${repo}`,\n existingPrForBranch.prNum,\n {\n description: input.prBody,\n title: input.prTitle,\n targetBranch: repoData.default_branch,\n },\n );\n return {\n successful: true,\n result: {\n prNumber: existingPrForBranch.prNum,\n prUrl: pullRequestResponse.web_url,\n lastUpdate: pullRequestResponse.updated_at,\n },\n };\n }\n\n try {\n await gitlab.Branches.show(`${owner}/${repo}`, branchName);\n } catch (error: any) {\n if (error.cause.response.status === 404) {\n await gitlab.Branches.create(\n `${owner}/${repo}`,\n branchName,\n parentRef.name,\n );\n } else {\n throw error;\n }\n }\n\n // Might not be able to do this in the gitlab api\n // This is if the branch exists, but there wasn't a PR yet\n // if (branchExists) {\n // // update it in case it is outdated compared to the base branch\n // try {\n // await octo.repos.merge({\n // owner: owner,\n // repo: repo,\n // base: branchName,\n // head: repoData.data.default_branch,\n // });\n // } catch (error: any) {\n // logErrorIfNeeded(\n // this.logger,\n // `Could not merge default branch ${repoData.data.default_branch} into import branch ${branchName}`,\n // error,\n // );\n // }\n // }\n\n await createOrUpdateFileInBranch(\n gitlab,\n owner,\n repo,\n branchName,\n fileName,\n input.catalogInfoContent,\n );\n\n const pullRequestResponse = await gitlab.MergeRequests.create(\n `${owner}/${repo}`,\n branchName,\n repoData.default_branch,\n input.prTitle,\n {\n description: input.prBody,\n },\n );\n return {\n successful: true,\n result: {\n prNumber: pullRequestResponse.iid,\n prUrl: pullRequestResponse.web_url,\n lastUpdate: pullRequestResponse.updated_at,\n hasChanges: true,\n },\n };\n } catch (e: any) {\n logErrorIfNeeded(\n this.logger,\n `Couldn't create PR in ${input.repoUrl}`,\n e,\n );\n errors.push(e.message);\n return { successful: false };\n }\n },\n },\n );\n\n if (result) {\n return result;\n }\n\n logger.warn(\n `Tried all possible Gitlab credentials, but could not create PR in ${input.repoUrl}. Please try again later...`,\n );\n\n return {\n errors: errors,\n };\n }\n\n async hasFileInRepo(input: {\n repoUrl: string;\n defaultBranch?: string;\n fileName: string;\n }) {\n const fileExists = await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ) => {\n const { owner, repo } = validatedRepo;\n const exists = await fileExistsInDefaultBranch(\n this.logger,\n gitlab,\n owner,\n repo,\n input.fileName,\n input.defaultBranch,\n );\n if (exists === undefined) {\n return { successful: false };\n }\n return { successful: true, result: exists };\n },\n },\n );\n\n if (fileExists === undefined) {\n throw new Error(\n `Could not determine if repo at ${input.repoUrl} already has a file named ${input.fileName} in its default branch (${input.defaultBranch})`,\n );\n }\n\n return fileExists;\n }\n\n async closeImportPR(\n logger: LoggerService,\n input: {\n repoUrl: string;\n gitUrl: gitUrlParse.GitUrl;\n comment: string;\n },\n ) {\n await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ) => {\n const { owner, repo, branchName } = validatedRepo;\n try {\n const existingPrForBranch = await findOpenPRForBranch(\n logger,\n this.config,\n gitlab,\n owner,\n repo,\n branchName,\n );\n if (existingPrForBranch.prNum) {\n await closePRWithComment(\n gitlab,\n owner,\n repo,\n existingPrForBranch.prNum,\n input.comment,\n );\n }\n return { successful: true };\n } catch (e: any) {\n logErrorIfNeeded(\n this.logger,\n `Couldn't close PR in ${input.repoUrl}`,\n e,\n );\n return { successful: false };\n }\n },\n },\n );\n }\n\n async deleteImportBranch(input: {\n repoUrl: string;\n gitUrl: gitUrlParse.GitUrl;\n }) {\n await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ) => {\n const { owner, repo, branchName } = validatedRepo;\n try {\n await gitlab.Branches.remove(`${owner}/${repo}`, branchName);\n return { successful: true };\n } catch (e: any) {\n logErrorIfNeeded(\n this.logger,\n `Couldn't close import PR and/or delete import branch in ${input.repoUrl}`,\n e,\n );\n return { successful: false };\n }\n },\n },\n );\n }\n\n async isRepoEmpty(input: { repoUrl: string }) {\n return await executeFunctionOnFirstSuccessfulIntegration(\n {\n logger: this.logger,\n cache: this.cache,\n config: this.config,\n gitlabCredentialsProvider: this.gitlabCredentialsProvider,\n },\n this.integrations,\n {\n repoUrl: input.repoUrl,\n fn: async (\n validatedRepo: ValidatedRepo,\n gitlab: InstanceType<typeof Gitlab<false>>,\n ) => {\n const { owner, repo } = validatedRepo;\n const resp = await gitlab.Repositories.allContributors(\n `${owner}/${repo}`,\n {\n showExpanded: true,\n },\n );\n return { successful: true, result: resp?.data?.length < 1 };\n },\n },\n );\n }\n\n async getPullRequest(\n repoUrl: string,\n pullRequestNumber: number,\n ): Promise<{\n title?: string;\n body?: string;\n merged?: boolean;\n lastUpdated?: string;\n prSha?: string;\n prBranch?: string;\n }> {\n const glConfig = this.integrations.gitlab.byUrl(repoUrl)?.config;\n if (!glConfig) {\n this.logger.error(\n `No Gitlab integration config found for repo ${repoUrl}`,\n );\n return {};\n }\n\n const gitUrl = gitUrlParse(repoUrl);\n const owner = gitUrl.owner;\n const repo = gitUrl.name;\n\n const credentials = await this.gitlabCredentialsProvider.getAllCredentials({\n host: glConfig.host,\n });\n\n if (credentials.length === 0) {\n this.logger.error(`No credentials for GL integration`);\n return {};\n }\n\n for (const credential of credentials) {\n const glKit = buildGitlab(\n {\n logger: this.logger,\n cache: this.cache,\n },\n { credential, owner },\n glConfig.baseUrl,\n );\n\n try {\n const pr = await glKit.MergeRequests.show(\n `${owner}/${repo}`,\n pullRequestNumber,\n );\n\n return {\n title: pr.title,\n body: pr.description || undefined,\n merged: pr.state === 'merged',\n lastUpdated: pr.updated_at,\n prSha: pr.sha,\n prBranch: pr.source_branch,\n };\n } catch (error: any) {\n this.logger.error(\n `Error fetching pull request ${pullRequestNumber} from ${repoUrl}`,\n error,\n );\n }\n }\n\n return {};\n }\n\n async getCatalogInfoFile(\n logger: LoggerService,\n input: {\n repoUrl: string;\n prNumber: number;\n prHeadSha: string;\n },\n ): Promise<string | undefined> {\n const glConfig = this.integrations.gitlab.byUrl(input.repoUrl)?.config;\n if (!glConfig) {\n logger.error(\n `No Gitlab integration config found for repo ${input.repoUrl}`,\n );\n return undefined;\n }\n\n const gitUrl = gitUrlParse(input.repoUrl);\n const owner = gitUrl.owner;\n const repo = gitUrl.name;\n\n const credentials = await this.gitlabCredentialsProvider.getAllCredentials({\n host: glConfig.host,\n });\n\n if (credentials.length === 0) {\n logger.error(`No credentials for GL integration`);\n return undefined;\n }\n\n for (const credential of credentials) {\n const glKit = buildGitlab(\n {\n logger: this.logger,\n cache: this.cache,\n },\n { credential, owner },\n glConfig.baseUrl,\n );\n\n try {\n const file = await glKit.RepositoryFiles.show(\n `${owner}/${repo}`,\n getCatalogFilename(this.config),\n input.prHeadSha,\n );\n\n if (file) {\n const content = Buffer.from(file.content, 'base64').toString('utf-8');\n return content;\n }\n } catch (error: any) {\n if (error.cause?.response?.status === 404) {\n logger.warn(\n `catalog-info.yaml not found in PR ${input.prNumber} of ${input.repoUrl}`,\n );\n return undefined;\n }\n logger.error(\n `Error fetching catalog-info.yaml from PR ${input.prNumber} of ${input.repoUrl}`,\n error,\n );\n return undefined;\n }\n }\n\n return undefined;\n }\n}\n"],"names":["ScmIntegrations","CustomGitlabCredentialsProvider","gitUrlParse","getCredentialsForConfig","buildGitlab","DefaultPageNumber","DefaultPageSize","fetchFromAllIntegrations","addGitlabTokenGroups","computeTotalCount","addGitlabTokenOrgRepositories","addGitlabTokenRepositories","extractLocationOwnerMap","logErrorIfNeeded","getBranchName","findOpenPRForBranch","getCatalogFilename","executeFunctionOnFirstSuccessfulIntegration","fileExistsInDefaultBranch","createOrUpdateFileInBranch","pullRequestResponse","closePRWithComment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgEO,MAAM,gBAAiB,CAAA;AAAA,EACX,MAAA;AAAA,EACA,YAAA;AAAA,EACA,yBAAA;AAAA,EACA,MAAA;AAAA;AAAA,EAEA,KAAA;AAAA,EACjB,WAAA,CACE,MACA,EAAA,MAAA,EACA,YACA,EAAA;AACA,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA;AACd,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA;AACd,IAAK,IAAA,CAAA,YAAA,GAAeA,2BAAgB,CAAA,UAAA,CAAW,MAAM,CAAA;AACrD,IAAA,IAAA,CAAK,yBACH,GAAAC,gDAAA,CAAgC,gBAAiB,CAAA,IAAA,CAAK,YAAY,CAAA;AACpE,IAAA,IAAA,CAAK,KAAQ,GAAA,YAAA;AAAA;AACf,EAEA,MAAM,8BA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;AAAA,YACL,CAAqC,kCAAA,EAAA,KAAA,CAAM,QAAQ,CAAA,IAAA,EAAO,MAAM,OAAO,CAAA;AAAA,WACzE;AACA,UAAO,OAAA,SAAA;AAAA;AAET,QAAO,MAAA,CAAA,KAAA;AAAA,UACL,CAA4C,yCAAA,EAAA,KAAA,CAAM,QAAQ,CAAA,IAAA,EAAO,MAAM,OAAO,CAAA,CAAA;AAAA,UAC9E;AAAA,SACF;AACA,QAAO,OAAA,SAAA;AAAA;AACT;AAGF,IAAO,OAAA,SAAA;AAAA;AAEX;;;;"}
|
|
@@ -195,13 +195,15 @@ const createTaskImportJobs = async (templateRef, discovery, logger, auth, config
|
|
|
195
195
|
result.push(updatedImport);
|
|
196
196
|
} else {
|
|
197
197
|
try {
|
|
198
|
-
const
|
|
198
|
+
const gitProviderHost = new URL(importReq.repository.url).hostname;
|
|
199
|
+
const normalizedUrl = `${gitProviderHost}?owner=${owner}&repo=${repoName}`;
|
|
199
200
|
const scaffolderOptions = {
|
|
200
201
|
name: repoName,
|
|
201
202
|
organization: owner,
|
|
202
203
|
repoUrl: normalizedUrl,
|
|
203
204
|
branchName: `bulk-import-catalog-entity`,
|
|
204
|
-
targetBranchName: importReq.repository.defaultBranch
|
|
205
|
+
targetBranchName: importReq.repository.defaultBranch,
|
|
206
|
+
gitProviderHost
|
|
205
207
|
};
|
|
206
208
|
const { taskId, status, createdAt } = await executeTask(scaffolderOptions);
|
|
207
209
|
const repositoryId = await repositoryDao.insertRepository(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-template.cjs.js","sources":["../../../../src/service/handlers/import/execute-template.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 AuthService,\n DiscoveryService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\n\nimport { fetchEventSource } from '@microsoft/fetch-event-source';\nimport gitUrlParse from 'git-url-parse';\n\nimport { getCatalogFilename } from '../../../catalog/catalogUtils';\nimport {\n RepositoryDao,\n ScaffolderTaskDao,\n TaskLocationsDao,\n} from '../../../database/repositoryDao';\nimport { Components } from '../../../generated/openapi';\nimport { GithubApiService } from '../../../github';\nimport { HandlerResponse } from '../handlers';\n\ninterface ScaffolderEvent {\n id: number;\n isTaskRecoverable: boolean;\n taskId: string;\n body: {\n message: string;\n stepId?: string;\n status?: string;\n [key: string]: any;\n };\n type: 'log' | 'completion' | 'error';\n createdAt: string;\n error?: any;\n}\n\nasync function* getEvents(\n taskId: string,\n scaffolderUrl: string,\n token: string,\n logger: LoggerService,\n) {\n const url = `${scaffolderUrl}/v2/tasks/${taskId}/eventstream`;\n\n const queue: ScaffolderEvent[] = [];\n let resolver: ((event: ScaffolderEvent) => void) | undefined;\n\n const handleEvent = (data: any) => {\n logger.info('Received event:', data);\n if (resolver) {\n resolver(data);\n resolver = undefined;\n } else {\n queue.push(data);\n }\n };\n\n const controller = new AbortController();\n\n fetchEventSource(url, {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${token}`,\n },\n signal: controller.signal,\n onopen: async response => {\n logger.info('SSE connection opened', { status: response.status });\n },\n onmessage: event => {\n try {\n const data: ScaffolderEvent = JSON.parse(event.data);\n handleEvent(data);\n } catch (err) {\n logger.error('==== Failed to parse SSE event', err);\n }\n },\n onclose: () => {\n logger.info('SSE connection closed');\n },\n onerror: err => {\n logger.error('==== SSE error', err);\n handleEvent({\n type: 'error',\n error: err,\n id: -1,\n isTaskRecoverable: false,\n taskId,\n body: { message: err?.message ?? '' },\n createdAt: new Date().toISOString(),\n });\n controller.abort();\n },\n }).catch(err => logger.error('==== fetchEventSource failed', err));\n\n const nextEvent = (): Promise<ScaffolderEvent> =>\n new Promise(resolve => {\n resolver = resolve;\n });\n\n while (true) {\n const event: ScaffolderEvent =\n queue.length > 0 ? queue.shift()! : await nextEvent();\n\n yield event;\n\n if (event.type === 'completion' || event.type === 'error') {\n controller.abort();\n break;\n }\n }\n}\n\nasync function processTaskEvents(\n taskId: string,\n scaffolderUrl: string,\n token: string,\n logger: LoggerService,\n taskLocationsDao: TaskLocationsDao,\n) {\n try {\n for await (const event of getEvents(taskId, scaffolderUrl, token, logger)) {\n if (event.type === 'log') {\n const message = event.body.message;\n const match = message.match(/Registering (.*) in the catalog/);\n if (match?.[1]) {\n await taskLocationsDao.addTaskLocation(taskId, match[1]);\n }\n }\n }\n } catch (e) {\n logger.error(`==== Failed to process events for task ${taskId}`, e);\n }\n}\n\nconst handlePullRequestUpdate = async (\n importReq: Components.Schemas.ImportRequest,\n logger: LoggerService,\n config: Config,\n githubApiService: GithubApiService,\n): Promise<Components.Schemas.Import> => {\n const url = importReq.repository.url;\n const owner = importReq.repository.organization;\n const repoName = importReq.repository.name;\n const prUrl = importReq.github?.pullRequest?.url;\n const prNumber = importReq.github?.pullRequest?.number;\n const prTitle = importReq.github?.pullRequest?.title;\n const prBody = importReq.github?.pullRequest?.body;\n const catalogInfoContent = importReq.catalogInfoContent;\n\n const result: Components.Schemas.Import = {\n repository: {\n organization: owner,\n url: url,\n name: repoName,\n },\n github: {\n pullRequest: {\n url: prUrl,\n number: prNumber,\n title: prTitle,\n body: prBody,\n catalogInfoContent: catalogInfoContent,\n },\n },\n approvalTool: importReq.approvalTool,\n };\n\n try {\n if (prNumber && prTitle && prBody) {\n await githubApiService.updatePullRequest(url, prNumber, prTitle, prBody);\n\n const prInfo = await githubApiService.getPullRequest(url, prNumber);\n\n // Update catalog info content in the pull request\n const gitUrl = gitUrlParse(url);\n const fileName = getCatalogFilename(config);\n if (catalogInfoContent && prInfo.prBranch) {\n await githubApiService.createOrUpdateFileInBranch(\n gitUrl.owner,\n gitUrl.name,\n prInfo.prBranch,\n fileName,\n catalogInfoContent,\n );\n }\n } else {\n logger.warn(`prNumber is undefined, skipping updatePullRequest`);\n }\n } catch (err) {\n logger.error(`Failed to update pull request ${prUrl}`, err);\n result.status = 'PR_ERROR';\n result.errors = [err];\n return result;\n }\n\n result.status = 'WAIT_PR_APPROVAL';\n return result;\n};\n\nexport const createTaskImportJobs = async (\n templateRef: string,\n discovery: DiscoveryService,\n logger: LoggerService,\n auth: AuthService,\n config: Config,\n repositoryDao: RepositoryDao,\n taskDao: ScaffolderTaskDao,\n taskLocationsDao: TaskLocationsDao,\n importRequests: Components.Schemas.ImportRequest[],\n githubApiService: GithubApiService,\n): Promise<\n HandlerResponse<Components.Schemas.Import[] | { errors: string[] }>\n> => {\n if (importRequests.length === 0) {\n logger.debug('Missing import requests from request body');\n return {\n statusCode: 400,\n responseBody: [],\n };\n }\n\n const result: Components.Schemas.Import[] = [];\n\n const scaffolderUrl = await discovery.getBaseUrl('scaffolder');\n const { token } = await auth.getPluginRequestToken({\n onBehalfOf: await auth.getOwnServiceCredentials(),\n targetPluginId: 'scaffolder',\n });\n\n const executeTask = async (\n values: Record<string, any>,\n ): Promise<{ taskId: string; status: string; createdAt: string }> => {\n const response = await fetch(`${scaffolderUrl}/v2/tasks`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n templateRef: `${templateRef}`,\n values: {\n repoUrl: values.repoUrl,\n owner: values.owner,\n ...values,\n },\n secrets: {},\n }),\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to start scaffolder task: ${response.status} ${response.statusText}`,\n );\n }\n\n const data = await response.json();\n const taskResp = await fetch(`${scaffolderUrl}/v2/tasks/${data.id}`, {\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n\n const task = await taskResp.json();\n return { taskId: data.id, status: task.status, createdAt: task.createdAt };\n };\n\n for (const importReq of importRequests) {\n const url = importReq.repository.url;\n const owner = importReq.repository.organization;\n const repoName = importReq.repository.name;\n if (importReq.github?.pullRequest?.url) {\n const updatedImport = await handlePullRequestUpdate(\n importReq,\n logger,\n config,\n githubApiService,\n );\n result.push(updatedImport);\n } else {\n try {\n // Create new task\n const normalizedUrl = `${new URL(importReq.repository.url).hostname}?owner=${owner}&repo=${repoName}`;\n\n const scaffolderOptions = {\n name: repoName,\n organization: owner,\n repoUrl: normalizedUrl,\n branchName: `bulk-import-catalog-entity`,\n targetBranchName: importReq.repository.defaultBranch,\n };\n const { taskId, status, createdAt } =\n await executeTask(scaffolderOptions);\n\n const repositoryId = await repositoryDao.insertRepository(\n url,\n taskId,\n importReq.approvalTool ?? 'GIT',\n );\n await taskDao.insertTask({\n repositoryId,\n scaffolderOptions,\n taskId,\n executedAt: new Date(),\n });\n result.push({\n repository: {\n organization: owner,\n url,\n name: repoName,\n },\n status:\n `TASK_${status.toLocaleUpperCase()}` as Components.Schemas.TaskImportStatus,\n task: { taskId },\n lastUpdate: createdAt,\n approvalTool: importReq.approvalTool,\n });\n\n processTaskEvents(\n taskId,\n scaffolderUrl,\n token,\n logger,\n taskLocationsDao,\n );\n } catch (error: any) {\n logger.error(`Error processing import request for ${url}`, error);\n result.push({\n repository: {\n organization: owner,\n url,\n name: repoName,\n },\n status: 'TASK_FAILED',\n errors: [error.message],\n approvalTool: importReq.approvalTool,\n });\n }\n }\n }\n\n if (result.some(r => r.errors)) {\n return {\n statusCode: 202,\n responseBody: { errors: result.flatMap(r => r.errors || []) },\n };\n }\n\n return {\n statusCode: 202,\n responseBody: result,\n };\n};\n"],"names":["fetchEventSource","gitUrlParse","getCatalogFilename"],"mappings":";;;;;;;;;;AAmDA,gBAAgB,SACd,CAAA,MAAA,EACA,aACA,EAAA,KAAA,EACA,MACA,EAAA;AACA,EAAA,MAAM,GAAM,GAAA,CAAA,EAAG,aAAa,CAAA,UAAA,EAAa,MAAM,CAAA,YAAA,CAAA;AAE/C,EAA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MAAA,IAAU,EAAE,CAAE;AAAA,KAC9D;AAAA;AAGF,EAAO,OAAA;AAAA,IACL,UAAY,EAAA,GAAA;AAAA,IACZ,YAAc,EAAA;AAAA,GAChB;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"execute-template.cjs.js","sources":["../../../../src/service/handlers/import/execute-template.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 AuthService,\n DiscoveryService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\n\nimport { fetchEventSource } from '@microsoft/fetch-event-source';\nimport gitUrlParse from 'git-url-parse';\n\nimport { getCatalogFilename } from '../../../catalog/catalogUtils';\nimport {\n RepositoryDao,\n ScaffolderTaskDao,\n TaskLocationsDao,\n} from '../../../database/repositoryDao';\nimport { Components } from '../../../generated/openapi';\nimport { GithubApiService } from '../../../github';\nimport { HandlerResponse } from '../handlers';\n\ninterface ScaffolderEvent {\n id: number;\n isTaskRecoverable: boolean;\n taskId: string;\n body: {\n message: string;\n stepId?: string;\n status?: string;\n [key: string]: any;\n };\n type: 'log' | 'completion' | 'error';\n createdAt: string;\n error?: any;\n}\n\nasync function* getEvents(\n taskId: string,\n scaffolderUrl: string,\n token: string,\n logger: LoggerService,\n) {\n const url = `${scaffolderUrl}/v2/tasks/${taskId}/eventstream`;\n\n const queue: ScaffolderEvent[] = [];\n let resolver: ((event: ScaffolderEvent) => void) | undefined;\n\n const handleEvent = (data: any) => {\n logger.info('Received event:', data);\n if (resolver) {\n resolver(data);\n resolver = undefined;\n } else {\n queue.push(data);\n }\n };\n\n const controller = new AbortController();\n\n fetchEventSource(url, {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${token}`,\n },\n signal: controller.signal,\n onopen: async response => {\n logger.info('SSE connection opened', { status: response.status });\n },\n onmessage: event => {\n try {\n const data: ScaffolderEvent = JSON.parse(event.data);\n handleEvent(data);\n } catch (err) {\n logger.error('==== Failed to parse SSE event', err);\n }\n },\n onclose: () => {\n logger.info('SSE connection closed');\n },\n onerror: err => {\n logger.error('==== SSE error', err);\n handleEvent({\n type: 'error',\n error: err,\n id: -1,\n isTaskRecoverable: false,\n taskId,\n body: { message: err?.message ?? '' },\n createdAt: new Date().toISOString(),\n });\n controller.abort();\n },\n }).catch(err => logger.error('==== fetchEventSource failed', err));\n\n const nextEvent = (): Promise<ScaffolderEvent> =>\n new Promise(resolve => {\n resolver = resolve;\n });\n\n while (true) {\n const event: ScaffolderEvent =\n queue.length > 0 ? queue.shift()! : await nextEvent();\n\n yield event;\n\n if (event.type === 'completion' || event.type === 'error') {\n controller.abort();\n break;\n }\n }\n}\n\nasync function processTaskEvents(\n taskId: string,\n scaffolderUrl: string,\n token: string,\n logger: LoggerService,\n taskLocationsDao: TaskLocationsDao,\n) {\n try {\n for await (const event of getEvents(taskId, scaffolderUrl, token, logger)) {\n if (event.type === 'log') {\n const message = event.body.message;\n const match = message.match(/Registering (.*) in the catalog/);\n if (match?.[1]) {\n await taskLocationsDao.addTaskLocation(taskId, match[1]);\n }\n }\n }\n } catch (e) {\n logger.error(`==== Failed to process events for task ${taskId}`, e);\n }\n}\n\nconst handlePullRequestUpdate = async (\n importReq: Components.Schemas.ImportRequest,\n logger: LoggerService,\n config: Config,\n githubApiService: GithubApiService,\n): Promise<Components.Schemas.Import> => {\n const url = importReq.repository.url;\n const owner = importReq.repository.organization;\n const repoName = importReq.repository.name;\n const prUrl = importReq.github?.pullRequest?.url;\n const prNumber = importReq.github?.pullRequest?.number;\n const prTitle = importReq.github?.pullRequest?.title;\n const prBody = importReq.github?.pullRequest?.body;\n const catalogInfoContent = importReq.catalogInfoContent;\n\n const result: Components.Schemas.Import = {\n repository: {\n organization: owner,\n url: url,\n name: repoName,\n },\n github: {\n pullRequest: {\n url: prUrl,\n number: prNumber,\n title: prTitle,\n body: prBody,\n catalogInfoContent: catalogInfoContent,\n },\n },\n approvalTool: importReq.approvalTool,\n };\n\n try {\n if (prNumber && prTitle && prBody) {\n await githubApiService.updatePullRequest(url, prNumber, prTitle, prBody);\n\n const prInfo = await githubApiService.getPullRequest(url, prNumber);\n\n // Update catalog info content in the pull request\n const gitUrl = gitUrlParse(url);\n const fileName = getCatalogFilename(config);\n if (catalogInfoContent && prInfo.prBranch) {\n await githubApiService.createOrUpdateFileInBranch(\n gitUrl.owner,\n gitUrl.name,\n prInfo.prBranch,\n fileName,\n catalogInfoContent,\n );\n }\n } else {\n logger.warn(`prNumber is undefined, skipping updatePullRequest`);\n }\n } catch (err) {\n logger.error(`Failed to update pull request ${prUrl}`, err);\n result.status = 'PR_ERROR';\n result.errors = [err];\n return result;\n }\n\n result.status = 'WAIT_PR_APPROVAL';\n return result;\n};\n\nexport const createTaskImportJobs = async (\n templateRef: string,\n discovery: DiscoveryService,\n logger: LoggerService,\n auth: AuthService,\n config: Config,\n repositoryDao: RepositoryDao,\n taskDao: ScaffolderTaskDao,\n taskLocationsDao: TaskLocationsDao,\n importRequests: Components.Schemas.ImportRequest[],\n githubApiService: GithubApiService,\n): Promise<\n HandlerResponse<Components.Schemas.Import[] | { errors: string[] }>\n> => {\n if (importRequests.length === 0) {\n logger.debug('Missing import requests from request body');\n return {\n statusCode: 400,\n responseBody: [],\n };\n }\n\n const result: Components.Schemas.Import[] = [];\n\n const scaffolderUrl = await discovery.getBaseUrl('scaffolder');\n const { token } = await auth.getPluginRequestToken({\n onBehalfOf: await auth.getOwnServiceCredentials(),\n targetPluginId: 'scaffolder',\n });\n\n const executeTask = async (\n values: Record<string, any>,\n ): Promise<{ taskId: string; status: string; createdAt: string }> => {\n const response = await fetch(`${scaffolderUrl}/v2/tasks`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n templateRef: `${templateRef}`,\n values: {\n repoUrl: values.repoUrl,\n owner: values.owner,\n ...values,\n },\n secrets: {},\n }),\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to start scaffolder task: ${response.status} ${response.statusText}`,\n );\n }\n\n const data = await response.json();\n const taskResp = await fetch(`${scaffolderUrl}/v2/tasks/${data.id}`, {\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n\n const task = await taskResp.json();\n return { taskId: data.id, status: task.status, createdAt: task.createdAt };\n };\n\n for (const importReq of importRequests) {\n const url = importReq.repository.url;\n const owner = importReq.repository.organization;\n const repoName = importReq.repository.name;\n if (importReq.github?.pullRequest?.url) {\n const updatedImport = await handlePullRequestUpdate(\n importReq,\n logger,\n config,\n githubApiService,\n );\n result.push(updatedImport);\n } else {\n try {\n // Create new task\n const gitProviderHost = new URL(importReq.repository.url).hostname;\n const normalizedUrl = `${gitProviderHost}?owner=${owner}&repo=${repoName}`;\n\n const scaffolderOptions = {\n name: repoName,\n organization: owner,\n repoUrl: normalizedUrl,\n branchName: `bulk-import-catalog-entity`,\n targetBranchName: importReq.repository.defaultBranch,\n gitProviderHost,\n };\n const { taskId, status, createdAt } =\n await executeTask(scaffolderOptions);\n\n const repositoryId = await repositoryDao.insertRepository(\n url,\n taskId,\n importReq.approvalTool ?? 'GIT',\n );\n await taskDao.insertTask({\n repositoryId,\n scaffolderOptions,\n taskId,\n executedAt: new Date(),\n });\n result.push({\n repository: {\n organization: owner,\n url,\n name: repoName,\n },\n status:\n `TASK_${status.toLocaleUpperCase()}` as Components.Schemas.TaskImportStatus,\n task: { taskId },\n lastUpdate: createdAt,\n approvalTool: importReq.approvalTool,\n });\n\n processTaskEvents(\n taskId,\n scaffolderUrl,\n token,\n logger,\n taskLocationsDao,\n );\n } catch (error: any) {\n logger.error(`Error processing import request for ${url}`, error);\n result.push({\n repository: {\n organization: owner,\n url,\n name: repoName,\n },\n status: 'TASK_FAILED',\n errors: [error.message],\n approvalTool: importReq.approvalTool,\n });\n }\n }\n }\n\n if (result.some(r => r.errors)) {\n return {\n statusCode: 202,\n responseBody: { errors: result.flatMap(r => r.errors || []) },\n };\n }\n\n return {\n statusCode: 202,\n responseBody: result,\n };\n};\n"],"names":["fetchEventSource","gitUrlParse","getCatalogFilename"],"mappings":";;;;;;;;;;AAmDA,gBAAgB,SACd,CAAA,MAAA,EACA,aACA,EAAA,KAAA,EACA,MACA,EAAA;AACA,EAAA,MAAM,GAAM,GAAA,CAAA,EAAG,aAAa,CAAA,UAAA,EAAa,MAAM,CAAA,YAAA,CAAA;AAE/C,EAAA,MAAM,QAA2B,EAAC;AAClC,EAAI,IAAA,QAAA;AAEJ,EAAM,MAAA,WAAA,GAAc,CAAC,IAAc,KAAA;AACjC,IAAO,MAAA,CAAA,IAAA,CAAK,mBAAmB,IAAI,CAAA;AACnC,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,QAAA,CAAS,IAAI,CAAA;AACb,MAAW,QAAA,GAAA,SAAA;AAAA,KACN,MAAA;AACL,MAAA,KAAA,CAAM,KAAK,IAAI,CAAA;AAAA;AACjB,GACF;AAEA,EAAM,MAAA,UAAA,GAAa,IAAI,eAAgB,EAAA;AAEvC,EAAAA,iCAAA,CAAiB,GAAK,EAAA;AAAA,IACpB,MAAQ,EAAA,KAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,aAAA,EAAe,UAAU,KAAK,CAAA;AAAA,KAChC;AAAA,IACA,QAAQ,UAAW,CAAA,MAAA;AAAA,IACnB,MAAA,EAAQ,OAAM,QAAY,KAAA;AACxB,MAAA,MAAA,CAAO,KAAK,uBAAyB,EAAA,EAAE,MAAQ,EAAA,QAAA,CAAS,QAAQ,CAAA;AAAA,KAClE;AAAA,IACA,WAAW,CAAS,KAAA,KAAA;AAClB,MAAI,IAAA;AACF,QAAA,MAAM,I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