@red-hat-developer-hub/backstage-plugin-bulk-import-backend 6.9.0 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ### Dependencies
2
2
 
3
+ ## 6.10.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 9e15bf7: Updated dependency `prettier` to `3.7.4`.
8
+ - Updated dependencies [9e15bf7]
9
+ - @red-hat-developer-hub/backstage-plugin-bulk-import-common@6.10.0
10
+
11
+ ## 6.9.1
12
+
13
+ ### Patch Changes
14
+
15
+ - @red-hat-developer-hub/backstage-plugin-bulk-import-common@6.9.1
16
+
3
17
  ## 6.9.0
4
18
 
5
19
  ### Patch Changes
@@ -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 \"$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.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;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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,CAAA,CAAA;AAuhDH,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\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.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":";;AAmBA,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;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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,CAAA,CAAA;AAuhDH,MAAA,eAAA,GAAkB,IAAK,CAAA,KAAA,CAAM,OAAO;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"GithubAppManager.cjs.js","sources":["../../src/github/GithubAppManager.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/**\n * Base code taken from upstream https://github.com/backstage/backstage/blob/master/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts\n * due to them not exporting the `GithubAppManager` class. Modifications were made to grab access tokens from all apps scoped to a repository/organization/user\n */\nimport type {\n GithubAppConfig,\n GithubCredentials,\n GithubCredentialType,\n GithubIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\n\nimport { createAppAuth } from '@octokit/auth-app';\nimport { Octokit, type RestEndpointMethodTypes } from '@octokit/rest';\nimport gitUrlParse from 'git-url-parse';\nimport { DateTime } from 'luxon';\n\nimport type {\n AppCredentialFetchResult,\n ExtendedGithubCredentials,\n ExtendedGithubCredentialsProvider,\n} from './types';\n\n/**\n * The Cache and GithubAppManager classes in this file were directly taken from the\n * upstream at https://github.com/backstage/backstage/blob/master/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts\n * as they were not exported but were required when extending the GithubAppCredentialsMux.\n */\n\ntype InstallationData = {\n installationId: number;\n accountLogin?: string;\n suspended: boolean;\n};\n\ntype InstallationTokenData = {\n token: string;\n expiresAt: DateTime;\n repositories?: string[];\n installationAccountLogin?: string;\n};\nclass Cache {\n private readonly tokenCache = new Map<string, InstallationTokenData>();\n\n private isExpired(date: DateTime) {\n return DateTime.local() > date;\n }\n\n async getOrCreateToken(\n key: string,\n supplier: () => Promise<InstallationTokenData>,\n ): Promise<{ accessToken: string; installationAccountLogin?: string }> {\n let existingInstallationData = this.tokenCache.get(key);\n\n if (\n !existingInstallationData ||\n this.isExpired(existingInstallationData.expiresAt)\n ) {\n existingInstallationData = await supplier();\n // Allow 10 minutes grace to account for clock skew\n existingInstallationData.expiresAt =\n existingInstallationData.expiresAt.minus({ minutes: 10 });\n this.tokenCache.set(key, existingInstallationData);\n }\n\n return {\n accessToken: existingInstallationData.token,\n installationAccountLogin:\n existingInstallationData.installationAccountLogin,\n };\n }\n}\n\n/**\n * This accept header is required when calling App APIs in GitHub Enterprise.\n * It has no effect on calls to github.com and can probably be removed entirely\n * once GitHub Apps is out of preview.\n */\nconst HEADERS = {\n Accept: 'application/vnd.github.machine-man-preview+json',\n};\n\n/**\n * GithubAppManager issues and caches tokens for a specific GitHub App.\n */\nclass GithubAppManager {\n private readonly appClient: Octokit;\n private readonly baseUrl?: string;\n private readonly baseAuthConfig: { appId: number; privateKey: string };\n private readonly cache = new Cache();\n private readonly allowedInstallationOwners: string[] | undefined; // undefined allows all installations\n\n constructor(config: GithubAppConfig, baseUrl?: string) {\n this.allowedInstallationOwners = config.allowedInstallationOwners;\n this.baseUrl = baseUrl;\n this.baseAuthConfig = {\n appId: config.appId,\n privateKey: config.privateKey.replace(/\\\\n/gm, '\\n'),\n };\n this.appClient = new Octokit({\n baseUrl,\n headers: HEADERS,\n authStrategy: createAppAuth,\n auth: this.baseAuthConfig,\n });\n }\n getAppId(): number {\n return this.baseAuthConfig.appId;\n }\n\n async getInstallationCredentials(\n host: string,\n ): Promise<\n { accessToken: string | undefined; installationAccountLogin?: string }[]\n > {\n const creds: {\n accessToken: string | undefined;\n installationAccountLogin?: string;\n }[] = [];\n const installationData = await this.getInstallationData();\n let installationDataFiltered: InstallationData[] = [];\n if (this.allowedInstallationOwners) {\n for (const installation of installationData) {\n if (\n installation.accountLogin &&\n !this.allowedInstallationOwners.includes(installation.accountLogin)\n ) {\n continue;\n }\n installationDataFiltered.push(installation);\n }\n } else {\n installationDataFiltered = installationData;\n }\n\n if (installationDataFiltered.length === 0) {\n return Array.of({ accessToken: undefined }); // An empty token allows anonymous access to public repos\n }\n\n for (const installation of installationDataFiltered) {\n const installationId = installation.installationId;\n if (installation.suspended) {\n throw new Error(\n `The GitHub application for ${installationId} is suspended`,\n );\n }\n const cred = await this.cache.getOrCreateToken(\n `${host}-${installationId}`,\n async () => {\n const result =\n await this.appClient.apps.createInstallationAccessToken({\n installation_id: installationId,\n headers: HEADERS,\n });\n\n if (!result) {\n return {\n token: '',\n expiresAt: DateTime.now().plus({ minutes: 1 }),\n repositories: [],\n installationAccountLogin: installation.accountLogin,\n };\n }\n\n let repositoryNames;\n\n if (result.data.repository_selection === 'selected') {\n const installationClient = new Octokit({\n baseUrl: this.baseUrl,\n auth: result.data.token,\n });\n const repos = await installationClient.paginate(\n installationClient.apps.listReposAccessibleToInstallation,\n );\n // The return type of the paginate method is incorrect.\n const repositories: RestEndpointMethodTypes['apps']['listReposAccessibleToInstallation']['response']['data']['repositories'] =\n repos.repositories ?? repos;\n\n repositoryNames = repositories.map(repository => repository.name);\n }\n return {\n token: result.data.token,\n expiresAt: DateTime.fromISO(result.data.expires_at),\n repositories: repositoryNames,\n installationAccountLogin: installation.accountLogin,\n };\n },\n );\n creds.push(cred);\n }\n\n return creds;\n }\n\n getInstallations(): Promise<\n RestEndpointMethodTypes['apps']['listInstallations']['response']['data']\n > {\n return this.appClient.paginate(this.appClient.apps.listInstallations);\n }\n\n private async getInstallationData(): Promise<InstallationData[]> {\n const allInstallations = await this.getInstallations();\n return allInstallations.map(installation => {\n return {\n installationId: installation.id,\n accountLogin: installation.account?.login,\n suspended: Boolean(installation.suspended_by),\n } as InstallationData;\n });\n }\n}\n\n/**\n * Manages all the github apps in the github integration configurations\n */\nexport class GithubAppsCredentialManager {\n private readonly apps: GithubAppManager[];\n\n constructor(config: GithubIntegrationConfig) {\n this.apps =\n config.apps?.map(ac => new GithubAppManager(ac, config.apiBaseUrl)) ?? [];\n }\n\n async getAllInstallations(): Promise<\n RestEndpointMethodTypes['apps']['listInstallations']['response']['data']\n > {\n if (!this.apps.length) {\n return [];\n }\n\n const installs = await Promise.all(\n this.apps.map(app => app.getInstallations()),\n );\n\n return installs.flat();\n }\n\n async getAppToken(host: string): Promise<string | undefined> {\n if (this.apps.length === 0) {\n return undefined;\n }\n\n const results = await Promise.all(\n this.apps.map(app =>\n app.getInstallationCredentials(host).then(\n credentials => ({ credentials, error: undefined }),\n error => ({ credentials: undefined, error }),\n ),\n ),\n );\n\n const result = results.find(\n resultItem =>\n resultItem.credentials &&\n resultItem.credentials!.length !== 0 &&\n resultItem.credentials[0]?.accessToken,\n );\n if (result?.credentials) {\n return result.credentials[0].accessToken;\n }\n\n const errors = results.map(r => r.error);\n const notNotFoundError = errors.find(err => err?.name !== 'NotFoundError');\n if (notNotFoundError) {\n throw notNotFoundError;\n }\n\n return undefined;\n }\n\n /**\n * Returns an array of app access tokens.\n *\n * Some values in the array might not contain a token and will have an error field instead. This will need to be resolved on the user side\n */\n async getAllAppTokens(host: string): Promise<AppCredentialFetchResult[]> {\n if (this.apps.length === 0) return [];\n\n const appCredentials = await Promise.all(\n this.apps.map(app =>\n app.getInstallationCredentials(host).then(\n credentials => ({\n appId: app.getAppId(),\n credentials,\n error: undefined,\n }),\n error => ({ appId: app.getAppId(), credentials: undefined, error }),\n ),\n ),\n );\n const credentials: AppCredentialFetchResult[] = [];\n for (const cred of appCredentials) {\n if (cred.credentials) {\n for (const credElement of cred.credentials) {\n credentials.push({\n appId: cred.appId,\n accessToken: credElement.accessToken,\n installationAccountLogin: credElement.installationAccountLogin,\n });\n }\n } else {\n credentials.push({\n appId: cred.appId,\n error: cred.error,\n });\n }\n }\n return credentials;\n }\n}\n\nexport class CustomSingleInstanceGithubCredentialsProvider\n implements ExtendedGithubCredentialsProvider\n{\n static readonly create: (\n config: GithubIntegrationConfig,\n ) => ExtendedGithubCredentialsProvider = config => {\n return new CustomSingleInstanceGithubCredentialsProvider(\n new GithubAppsCredentialManager(config),\n config.token,\n );\n };\n\n private constructor(\n private readonly githubAppsCredentialManager: GithubAppsCredentialManager,\n private readonly token?: string,\n ) {}\n\n /**\n * Returns {@link GithubCredentials} for a given URL.\n *\n * @remarks\n *\n * Consecutive calls to this method with the same URL will return cached\n * credentials.\n *\n * The shortest lifetime for a token returned is 10 minutes.\n *\n * @example\n * ```ts\n * const { token, headers } = await getCredentials({\n * url: 'github.com/backstage/foobar'\n * })\n * ```\n *\n * @param opts - The organization or repository URL\n * @returns A promise of {@link GithubCredentials}.\n */\n async getCredentials(opts: { url: string }): Promise<GithubCredentials> {\n const parsed = gitUrlParse(opts.url);\n const owner = parsed.owner || parsed.name;\n\n let type: GithubCredentialType = 'app';\n let token = await this.githubAppsCredentialManager.getAppToken(owner);\n if (!token) {\n type = 'token';\n token = this.token;\n }\n\n return {\n headers: token ? { Authorization: `Bearer ${token}` } : undefined,\n token,\n type,\n };\n }\n\n /**\n * Returns {@link ExtendedGithubCredentials[]} for a given URL.\n *\n * @remarks\n *\n * Consecutive calls to this method with the same URL will return cached\n * credentials.\n *\n * The shortest lifetime for a token returned is 10 minutes.\n *\n * Errors may be included in the returned array if the app credentials could not be fetched\n * These need to be dealt with by the user.\n *\n * @example\n * ```ts\n * const credentialList = await getCredentials({\n * url: 'github.com/backstage/foobar'\n * })\n * for (const credential of credentialList){\n * if (credential.type === 'app'){\n * // Deal with the error if it exists\n * if (credentials.error){\n * console.error(`Error generating credential for ${credential.appId}: ${credential.error}`)\n * }\n * else {\n * // Do something with the token\n * }\n * }\n * else{\n * // Do something with the token\n * }\n *\n * }\n * ```\n *\n * @param opts - The organization or repository URL\n * @returns A promise of {@link ExtendedGithubCredentials[]}.\n */\n async getAllCredentials(opts: {\n host: string;\n }): Promise<ExtendedGithubCredentials[]> {\n const appCredentials =\n await this.githubAppsCredentialManager.getAllAppTokens(opts.host);\n\n const credentials: ExtendedGithubCredentials[] = [];\n if (this.token) {\n credentials.push({\n headers: { Authorization: `Bearer ${this.token}` },\n token: this.token,\n type: 'token',\n });\n }\n for (const app of appCredentials) {\n if ('accessToken' in app) {\n credentials.push({\n headers: { Authorization: `Bearer ${app.accessToken}` },\n token: app.accessToken,\n type: 'app',\n appId: app.appId,\n accountLogin: app.installationAccountLogin,\n });\n }\n // Add the app credentials with their errors as well so that user can deal with them\n else {\n credentials.push({\n type: 'app',\n error: app.error,\n appId: app.appId,\n });\n }\n }\n\n return credentials;\n }\n}\n\nexport class CustomGithubCredentialsProvider\n implements ExtendedGithubCredentialsProvider\n{\n static fromIntegrations(integrations: ScmIntegrationRegistry) {\n const credentialsProviders: Map<string, ExtendedGithubCredentialsProvider> =\n new Map<string, ExtendedGithubCredentialsProvider>();\n\n integrations.github.list().forEach(integration => {\n const credentialsProvider =\n CustomSingleInstanceGithubCredentialsProvider.create(\n integration.config,\n );\n credentialsProviders.set(integration.config.host, credentialsProvider);\n });\n return new CustomGithubCredentialsProvider(credentialsProviders);\n }\n\n private constructor(\n private readonly providers: Map<string, ExtendedGithubCredentialsProvider>,\n ) {}\n\n /**\n * Returns {@link GithubCredentials} for a given URL.\n *\n * @remarks\n *\n * Consecutive calls to this method with the same URL will return cached\n * credentials.\n *\n * The shortest lifetime for a token returned is 10 minutes.\n *\n * @example\n * ```ts\n * const { token, headers } = await getCredentials({\n * url: 'https://github.com/backstage/foobar'\n * })\n *\n * const { token, headers } = await getCredentials({\n * url: 'https://github.com/backstage'\n * })\n * ```\n *\n * @param opts - The organization or repository URL\n * @returns A promise of {@link GithubCredentials}.\n */\n async getCredentials(opts: { url: string }): Promise<GithubCredentials> {\n const parsed = new URL(opts.url);\n const provider = this.providers.get(parsed.host);\n\n if (!provider) {\n throw new Error(\n `There is no GitHub integration that matches ${opts.url}. Please add a configuration for an integration.`,\n );\n }\n\n return provider.getCredentials(opts);\n }\n\n async getAllCredentials(opts: {\n host: string;\n }): Promise<ExtendedGithubCredentials[]> {\n const provider = this.providers.get(opts.host);\n\n if (!provider) {\n throw new Error(\n `There is no GitHub integration that matches ${opts.host}. Please add a configuration for an integration.`,\n );\n }\n return provider.getAllCredentials(opts);\n }\n\n async getAllAppInstallations(config: GithubIntegrationConfig) {\n return new GithubAppsCredentialManager(config).getAllInstallations();\n }\n\n async getAppInstallationsForOrg(\n config: GithubIntegrationConfig,\n org: string,\n ) {\n const all = await this.getAllAppInstallations(config);\n return all.filter(install => install.account?.login === org);\n }\n}\n"],"names":["DateTime","Octokit","createAppAuth","credentials","gitUrlParse"],"mappings":";;;;;;;;;;;AAyDA,MAAM,KAAM,CAAA;AAAA,EACO,UAAA,uBAAiB,GAAmC,EAAA;AAAA,EAE7D,UAAU,IAAgB,EAAA;AAChC,IAAO,OAAAA,cAAA,CAAS,OAAU,GAAA,IAAA;AAAA;AAC5B,EAEA,MAAM,gBACJ,CAAA,GAAA,EACA,QACqE,EAAA;AACrE,IAAA,IAAI,wBAA2B,GAAA,IAAA,CAAK,UAAW,CAAA,GAAA,CAAI,GAAG,CAAA;AAEtD,IAAA,IACE,CAAC,wBACD,IAAA,IAAA,CAAK,SAAU,CAAA,wBAAA,CAAyB,SAAS,CACjD,EAAA;AACA,MAAA,wBAAA,GAA2B,MAAM,QAAS,EAAA;AAE1C,MAAA,wBAAA,CAAyB,YACvB,wBAAyB,CAAA,SAAA,CAAU,MAAM,EAAE,OAAA,EAAS,IAAI,CAAA;AAC1D,MAAK,IAAA,CAAA,UAA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BAAkB,IAAI,CAAA;AAAA;AACxC,EAEA,MAAM,uBAAuB,MAAiC,EAAA;AAC5D,IAAA,OAAO,IAAI,2BAAA,CAA4B,MAAM,CAAA,CAAE,mBAAoB,EAAA;AAAA;AACrE,EAEA,MAAM,yBACJ,CAAA,MAAA,EACA,GACA,EAAA;AACA,IAAA,MAAM,GAAM,GAAA,MAAM,IAAK,CAAA,sBAAA,CAAuB,MAAM,CAAA;AACpD,IAAA,OAAO,IAAI,MAAO,CAAA,CAAA,OAAA,KAAW,OAAQ,CAAA,OAAA,EAAS,UAAU,GAAG,CAAA;AAAA;AAE/D;;;;;;"}
1
+ {"version":3,"file":"GithubAppManager.cjs.js","sources":["../../src/github/GithubAppManager.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/**\n * Base code taken from upstream https://github.com/backstage/backstage/blob/master/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts\n * due to them not exporting the `GithubAppManager` class. Modifications were made to grab access tokens from all apps scoped to a repository/organization/user\n */\nimport type {\n GithubAppConfig,\n GithubCredentials,\n GithubCredentialType,\n GithubIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\n\nimport { createAppAuth } from '@octokit/auth-app';\nimport { Octokit, type RestEndpointMethodTypes } from '@octokit/rest';\nimport gitUrlParse from 'git-url-parse';\nimport { DateTime } from 'luxon';\n\nimport type {\n AppCredentialFetchResult,\n ExtendedGithubCredentials,\n ExtendedGithubCredentialsProvider,\n} from './types';\n\n/**\n * The Cache and GithubAppManager classes in this file were directly taken from the\n * upstream at https://github.com/backstage/backstage/blob/master/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts\n * as they were not exported but were required when extending the GithubAppCredentialsMux.\n */\n\ntype InstallationData = {\n installationId: number;\n accountLogin?: string;\n suspended: boolean;\n};\n\ntype InstallationTokenData = {\n token: string;\n expiresAt: DateTime;\n repositories?: string[];\n installationAccountLogin?: string;\n};\nclass Cache {\n private readonly tokenCache = new Map<string, InstallationTokenData>();\n\n private isExpired(date: DateTime) {\n return DateTime.local() > date;\n }\n\n async getOrCreateToken(\n key: string,\n supplier: () => Promise<InstallationTokenData>,\n ): Promise<{ accessToken: string; installationAccountLogin?: string }> {\n let existingInstallationData = this.tokenCache.get(key);\n\n if (\n !existingInstallationData ||\n this.isExpired(existingInstallationData.expiresAt)\n ) {\n existingInstallationData = await supplier();\n // Allow 10 minutes grace to account for clock skew\n existingInstallationData.expiresAt =\n existingInstallationData.expiresAt.minus({ minutes: 10 });\n this.tokenCache.set(key, existingInstallationData);\n }\n\n return {\n accessToken: existingInstallationData.token,\n installationAccountLogin:\n existingInstallationData.installationAccountLogin,\n };\n }\n}\n\n/**\n * This accept header is required when calling App APIs in GitHub Enterprise.\n * It has no effect on calls to github.com and can probably be removed entirely\n * once GitHub Apps is out of preview.\n */\nconst HEADERS = {\n Accept: 'application/vnd.github.machine-man-preview+json',\n};\n\n/**\n * GithubAppManager issues and caches tokens for a specific GitHub App.\n */\nclass GithubAppManager {\n private readonly appClient: Octokit;\n private readonly baseUrl?: string;\n private readonly baseAuthConfig: { appId: number; privateKey: string };\n private readonly cache = new Cache();\n private readonly allowedInstallationOwners: string[] | undefined; // undefined allows all installations\n\n constructor(config: GithubAppConfig, baseUrl?: string) {\n this.allowedInstallationOwners = config.allowedInstallationOwners;\n this.baseUrl = baseUrl;\n this.baseAuthConfig = {\n appId: config.appId,\n privateKey: config.privateKey.replace(/\\\\n/gm, '\\n'),\n };\n this.appClient = new Octokit({\n baseUrl,\n headers: HEADERS,\n authStrategy: createAppAuth,\n auth: this.baseAuthConfig,\n });\n }\n getAppId(): number {\n return this.baseAuthConfig.appId;\n }\n\n async getInstallationCredentials(\n host: string,\n ): Promise<\n { accessToken: string | undefined; installationAccountLogin?: string }[]\n > {\n const creds: {\n accessToken: string | undefined;\n installationAccountLogin?: string;\n }[] = [];\n const installationData = await this.getInstallationData();\n let installationDataFiltered: InstallationData[] = [];\n if (this.allowedInstallationOwners) {\n for (const installation of installationData) {\n if (\n installation.accountLogin &&\n !this.allowedInstallationOwners.includes(installation.accountLogin)\n ) {\n continue;\n }\n installationDataFiltered.push(installation);\n }\n } else {\n installationDataFiltered = installationData;\n }\n\n if (installationDataFiltered.length === 0) {\n return Array.of({ accessToken: undefined }); // An empty token allows anonymous access to public repos\n }\n\n for (const installation of installationDataFiltered) {\n const installationId = installation.installationId;\n if (installation.suspended) {\n throw new Error(\n `The GitHub application for ${installationId} is suspended`,\n );\n }\n const cred = await this.cache.getOrCreateToken(\n `${host}-${installationId}`,\n async () => {\n const result =\n await this.appClient.apps.createInstallationAccessToken({\n installation_id: installationId,\n headers: HEADERS,\n });\n\n if (!result) {\n return {\n token: '',\n expiresAt: DateTime.now().plus({ minutes: 1 }),\n repositories: [],\n installationAccountLogin: installation.accountLogin,\n };\n }\n\n let repositoryNames;\n\n if (result.data.repository_selection === 'selected') {\n const installationClient = new Octokit({\n baseUrl: this.baseUrl,\n auth: result.data.token,\n });\n const repos = await installationClient.paginate(\n installationClient.apps.listReposAccessibleToInstallation,\n );\n // The return type of the paginate method is incorrect.\n const repositories: RestEndpointMethodTypes['apps']['listReposAccessibleToInstallation']['response']['data']['repositories'] =\n repos.repositories ?? repos;\n\n repositoryNames = repositories.map(repository => repository.name);\n }\n return {\n token: result.data.token,\n expiresAt: DateTime.fromISO(result.data.expires_at),\n repositories: repositoryNames,\n installationAccountLogin: installation.accountLogin,\n };\n },\n );\n creds.push(cred);\n }\n\n return creds;\n }\n\n getInstallations(): Promise<\n RestEndpointMethodTypes['apps']['listInstallations']['response']['data']\n > {\n return this.appClient.paginate(this.appClient.apps.listInstallations);\n }\n\n private async getInstallationData(): Promise<InstallationData[]> {\n const allInstallations = await this.getInstallations();\n return allInstallations.map(installation => {\n return {\n installationId: installation.id,\n accountLogin: installation.account?.login,\n suspended: Boolean(installation.suspended_by),\n } as InstallationData;\n });\n }\n}\n\n/**\n * Manages all the github apps in the github integration configurations\n */\nexport class GithubAppsCredentialManager {\n private readonly apps: GithubAppManager[];\n\n constructor(config: GithubIntegrationConfig) {\n this.apps =\n config.apps?.map(ac => new GithubAppManager(ac, config.apiBaseUrl)) ?? [];\n }\n\n async getAllInstallations(): Promise<\n RestEndpointMethodTypes['apps']['listInstallations']['response']['data']\n > {\n if (!this.apps.length) {\n return [];\n }\n\n const installs = await Promise.all(\n this.apps.map(app => app.getInstallations()),\n );\n\n return installs.flat();\n }\n\n async getAppToken(host: string): Promise<string | undefined> {\n if (this.apps.length === 0) {\n return undefined;\n }\n\n const results = await Promise.all(\n this.apps.map(app =>\n app.getInstallationCredentials(host).then(\n credentials => ({ credentials, error: undefined }),\n error => ({ credentials: undefined, error }),\n ),\n ),\n );\n\n const result = results.find(\n resultItem =>\n resultItem.credentials &&\n resultItem.credentials!.length !== 0 &&\n resultItem.credentials[0]?.accessToken,\n );\n if (result?.credentials) {\n return result.credentials[0].accessToken;\n }\n\n const errors = results.map(r => r.error);\n const notNotFoundError = errors.find(err => err?.name !== 'NotFoundError');\n if (notNotFoundError) {\n throw notNotFoundError;\n }\n\n return undefined;\n }\n\n /**\n * Returns an array of app access tokens.\n *\n * Some values in the array might not contain a token and will have an error field instead. This will need to be resolved on the user side\n */\n async getAllAppTokens(host: string): Promise<AppCredentialFetchResult[]> {\n if (this.apps.length === 0) return [];\n\n const appCredentials = await Promise.all(\n this.apps.map(app =>\n app.getInstallationCredentials(host).then(\n credentials => ({\n appId: app.getAppId(),\n credentials,\n error: undefined,\n }),\n error => ({ appId: app.getAppId(), credentials: undefined, error }),\n ),\n ),\n );\n const credentials: AppCredentialFetchResult[] = [];\n for (const cred of appCredentials) {\n if (cred.credentials) {\n for (const credElement of cred.credentials) {\n credentials.push({\n appId: cred.appId,\n accessToken: credElement.accessToken,\n installationAccountLogin: credElement.installationAccountLogin,\n });\n }\n } else {\n credentials.push({\n appId: cred.appId,\n error: cred.error,\n });\n }\n }\n return credentials;\n }\n}\n\nexport class CustomSingleInstanceGithubCredentialsProvider implements ExtendedGithubCredentialsProvider {\n static readonly create: (\n config: GithubIntegrationConfig,\n ) => ExtendedGithubCredentialsProvider = config => {\n return new CustomSingleInstanceGithubCredentialsProvider(\n new GithubAppsCredentialManager(config),\n config.token,\n );\n };\n\n private constructor(\n private readonly githubAppsCredentialManager: GithubAppsCredentialManager,\n private readonly token?: string,\n ) {}\n\n /**\n * Returns {@link GithubCredentials} for a given URL.\n *\n * @remarks\n *\n * Consecutive calls to this method with the same URL will return cached\n * credentials.\n *\n * The shortest lifetime for a token returned is 10 minutes.\n *\n * @example\n * ```ts\n * const { token, headers } = await getCredentials({\n * url: 'github.com/backstage/foobar'\n * })\n * ```\n *\n * @param opts - The organization or repository URL\n * @returns A promise of {@link GithubCredentials}.\n */\n async getCredentials(opts: { url: string }): Promise<GithubCredentials> {\n const parsed = gitUrlParse(opts.url);\n const owner = parsed.owner || parsed.name;\n\n let type: GithubCredentialType = 'app';\n let token = await this.githubAppsCredentialManager.getAppToken(owner);\n if (!token) {\n type = 'token';\n token = this.token;\n }\n\n return {\n headers: token ? { Authorization: `Bearer ${token}` } : undefined,\n token,\n type,\n };\n }\n\n /**\n * Returns {@link ExtendedGithubCredentials[]} for a given URL.\n *\n * @remarks\n *\n * Consecutive calls to this method with the same URL will return cached\n * credentials.\n *\n * The shortest lifetime for a token returned is 10 minutes.\n *\n * Errors may be included in the returned array if the app credentials could not be fetched\n * These need to be dealt with by the user.\n *\n * @example\n * ```ts\n * const credentialList = await getCredentials({\n * url: 'github.com/backstage/foobar'\n * })\n * for (const credential of credentialList){\n * if (credential.type === 'app'){\n * // Deal with the error if it exists\n * if (credentials.error){\n * console.error(`Error generating credential for ${credential.appId}: ${credential.error}`)\n * }\n * else {\n * // Do something with the token\n * }\n * }\n * else{\n * // Do something with the token\n * }\n *\n * }\n * ```\n *\n * @param opts - The organization or repository URL\n * @returns A promise of {@link ExtendedGithubCredentials[]}.\n */\n async getAllCredentials(opts: {\n host: string;\n }): Promise<ExtendedGithubCredentials[]> {\n const appCredentials =\n await this.githubAppsCredentialManager.getAllAppTokens(opts.host);\n\n const credentials: ExtendedGithubCredentials[] = [];\n if (this.token) {\n credentials.push({\n headers: { Authorization: `Bearer ${this.token}` },\n token: this.token,\n type: 'token',\n });\n }\n for (const app of appCredentials) {\n if ('accessToken' in app) {\n credentials.push({\n headers: { Authorization: `Bearer ${app.accessToken}` },\n token: app.accessToken,\n type: 'app',\n appId: app.appId,\n accountLogin: app.installationAccountLogin,\n });\n }\n // Add the app credentials with their errors as well so that user can deal with them\n else {\n credentials.push({\n type: 'app',\n error: app.error,\n appId: app.appId,\n });\n }\n }\n\n return credentials;\n }\n}\n\nexport class CustomGithubCredentialsProvider implements ExtendedGithubCredentialsProvider {\n static fromIntegrations(integrations: ScmIntegrationRegistry) {\n const credentialsProviders: Map<string, ExtendedGithubCredentialsProvider> =\n new Map<string, ExtendedGithubCredentialsProvider>();\n\n integrations.github.list().forEach(integration => {\n const credentialsProvider =\n CustomSingleInstanceGithubCredentialsProvider.create(\n integration.config,\n );\n credentialsProviders.set(integration.config.host, credentialsProvider);\n });\n return new CustomGithubCredentialsProvider(credentialsProviders);\n }\n\n private constructor(\n private readonly providers: Map<string, ExtendedGithubCredentialsProvider>,\n ) {}\n\n /**\n * Returns {@link GithubCredentials} for a given URL.\n *\n * @remarks\n *\n * Consecutive calls to this method with the same URL will return cached\n * credentials.\n *\n * The shortest lifetime for a token returned is 10 minutes.\n *\n * @example\n * ```ts\n * const { token, headers } = await getCredentials({\n * url: 'https://github.com/backstage/foobar'\n * })\n *\n * const { token, headers } = await getCredentials({\n * url: 'https://github.com/backstage'\n * })\n * ```\n *\n * @param opts - The organization or repository URL\n * @returns A promise of {@link GithubCredentials}.\n */\n async getCredentials(opts: { url: string }): Promise<GithubCredentials> {\n const parsed = new URL(opts.url);\n const provider = this.providers.get(parsed.host);\n\n if (!provider) {\n throw new Error(\n `There is no GitHub integration that matches ${opts.url}. Please add a configuration for an integration.`,\n );\n }\n\n return provider.getCredentials(opts);\n }\n\n async getAllCredentials(opts: {\n host: string;\n }): Promise<ExtendedGithubCredentials[]> {\n const provider = this.providers.get(opts.host);\n\n if (!provider) {\n throw new Error(\n `There is no GitHub integration that matches ${opts.host}. Please add a configuration for an integration.`,\n );\n }\n return provider.getAllCredentials(opts);\n }\n\n async getAllAppInstallations(config: GithubIntegrationConfig) {\n return new GithubAppsCredentialManager(config).getAllInstallations();\n }\n\n async getAppInstallationsForOrg(\n config: GithubIntegrationConfig,\n org: string,\n ) {\n const all = await this.getAllAppInstallations(config);\n return all.filter(install => install.account?.login === org);\n }\n}\n"],"names":["DateTime","Octokit","createAppAuth","credentials","gitUrlParse"],"mappings":";;;;;;;;;;;AAyDA,MAAM,KAAM,CAAA;AAAA,EACO,UAAA,uBAAiB,GAAmC,EAAA;AAAA,EAE7D,UAAU,IAAgB,EAAA;AAChC,IAAO,OAAAA,cAAA,CAAS,OAAU,GAAA,IAAA;AAAA;AAC5B,EAEA,MAAM,gBACJ,CAAA,GAAA,EACA,QACqE,EAAA;AACrE,IAAA,IAAI,wBAA2B,GAAA,IAAA,CAAK,UAAW,CAAA,GAAA,CAAI,GAAG,CAAA;AAEtD,IAAA,IACE,CAAC,wBACD,IAAA,IAAA,CAAK,SAAU,CAAA,wBAAA,CAAyB,SAAS,CACjD,EAAA;AACA,MAAA,wBAAA,GAA2B,MAAM,QAAS,EAAA;AAE1C,MAAA,wBAAA,CAAyB,YACvB,wBAAyB,CAAA,SAAA,CAAU,MAAM,EAAE,OAAA,EAAS,IAAI,CAAA;AAC1D,MAAK,IAAA,CAAA,UAAA,CAAW,GAAI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AI,CAAA;AAAA;AACxC,EAEA,MAAM,uBAAuB,MAAiC,EAAA;AAC5D,IAAA,OAAO,IAAI,2BAAA,CAA4B,MAAM,CAAA,CAAE,mBAAoB,EAAA;AAAA;AACrE,EAEA,MAAM,yBACJ,CAAA,MAAA,EACA,GACA,EAAA;AACA,IAAA,MAAM,GAAM,GAAA,MAAM,IAAK,CAAA,sBAAA,CAAuB,MAAM,CAAA;AACpD,IAAA,OAAO,IAAI,MAAO,CAAA,CAAA,OAAA,KAAW,OAAQ,CAAA,OAAA,EAAS,UAAU,GAAG,CAAA;AAAA;AAE/D;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs.js","sources":["../../src/github/types.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 { SerializedError } from '@backstage/errors';\nimport type {\n GithubCredentials,\n GithubCredentialsProvider,\n} from '@backstage/integration';\n\n// From https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations\nexport type GithubOrganization = {\n name: string;\n id: number;\n description?: string;\n url?: string;\n html_url?: string;\n repos_url?: string;\n events_url?: string;\n hooks_url?: string;\n issues_url?: string;\n members_url?: string;\n public_members_url?: string;\n avatar_url?: string;\n public_repos?: number;\n total_private_repos?: number;\n /**\n * Number of internal repositories, accessible to all members in a GH enterprise\n */\n owned_private_repos?: number;\n};\n\nexport type GithubRepository = {\n name: string;\n /**\n * The full name of the repository in the form of owner/repo\n */\n full_name: string;\n /**\n * The API url to the repository\n */\n url: string;\n /**\n * The HTML URL to the repository\n */\n html_url: string;\n /**\n * The default \"main\" branch of the repository to place the `catalog-info.yaml` file into\n */\n default_branch: string;\n /**\n * The date-time the repository was last updated at\n */\n updated_at?: string | null;\n};\n\n/**\n * The type of credentials produced by the credential provider.\n *\n * @public\n */\n\nexport type GithubFetchError =\n | {\n type: 'app';\n appId: number;\n error: SerializedError;\n }\n | {\n type: 'token';\n error: SerializedError;\n };\n\nexport type GithubOrganizationResponse = {\n organizations: GithubOrganization[];\n errors: GithubFetchError[];\n totalCount?: number;\n};\n\nexport type GithubRepositoryResponse = {\n repositories: GithubRepository[];\n errors: GithubFetchError[];\n totalCount?: number;\n};\n\nexport type AppCredentialFetchResult = AppCredential | AppCredentialError;\n\nexport type AppCredential = {\n appId: number;\n accessToken: string | undefined;\n installationAccountLogin?: string;\n};\nexport type AppCredentialError = { appId: number; error: Error };\n\nexport type ExtendedGithubCredentials =\n | GithubCredentials\n | GithubAppCredentials\n | GithubAppError;\n\nexport type GithubAppCredentials = GithubCredentials & {\n type: 'app';\n appId: number;\n accountLogin?: string;\n};\n\nexport type GithubAppError = {\n type: 'app';\n appId: number;\n error: Error;\n};\n\nexport function isGithubAppCredential(\n credential: ExtendedGithubCredentials,\n): credential is GithubAppCredentials {\n return 'appId' in credential && credential.type === 'app';\n}\n\nexport interface ExtendedGithubCredentialsProvider\n extends GithubCredentialsProvider {\n getAllCredentials: (options: {\n host: string;\n }) => Promise<ExtendedGithubCredentials[]>;\n}\n"],"names":[],"mappings":";;AA2HO,SAAS,sBACd,UACoC,EAAA;AACpC,EAAO,OAAA,OAAA,IAAW,UAAc,IAAA,UAAA,CAAW,IAAS,KAAA,KAAA;AACtD;;;;"}
1
+ {"version":3,"file":"types.cjs.js","sources":["../../src/github/types.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 { SerializedError } from '@backstage/errors';\nimport type {\n GithubCredentials,\n GithubCredentialsProvider,\n} from '@backstage/integration';\n\n// From https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations\nexport type GithubOrganization = {\n name: string;\n id: number;\n description?: string;\n url?: string;\n html_url?: string;\n repos_url?: string;\n events_url?: string;\n hooks_url?: string;\n issues_url?: string;\n members_url?: string;\n public_members_url?: string;\n avatar_url?: string;\n public_repos?: number;\n total_private_repos?: number;\n /**\n * Number of internal repositories, accessible to all members in a GH enterprise\n */\n owned_private_repos?: number;\n};\n\nexport type GithubRepository = {\n name: string;\n /**\n * The full name of the repository in the form of owner/repo\n */\n full_name: string;\n /**\n * The API url to the repository\n */\n url: string;\n /**\n * The HTML URL to the repository\n */\n html_url: string;\n /**\n * The default \"main\" branch of the repository to place the `catalog-info.yaml` file into\n */\n default_branch: string;\n /**\n * The date-time the repository was last updated at\n */\n updated_at?: string | null;\n};\n\n/**\n * The type of credentials produced by the credential provider.\n *\n * @public\n */\n\nexport type GithubFetchError =\n | {\n type: 'app';\n appId: number;\n error: SerializedError;\n }\n | {\n type: 'token';\n error: SerializedError;\n };\n\nexport type GithubOrganizationResponse = {\n organizations: GithubOrganization[];\n errors: GithubFetchError[];\n totalCount?: number;\n};\n\nexport type GithubRepositoryResponse = {\n repositories: GithubRepository[];\n errors: GithubFetchError[];\n totalCount?: number;\n};\n\nexport type AppCredentialFetchResult = AppCredential | AppCredentialError;\n\nexport type AppCredential = {\n appId: number;\n accessToken: string | undefined;\n installationAccountLogin?: string;\n};\nexport type AppCredentialError = { appId: number; error: Error };\n\nexport type ExtendedGithubCredentials =\n | GithubCredentials\n | GithubAppCredentials\n | GithubAppError;\n\nexport type GithubAppCredentials = GithubCredentials & {\n type: 'app';\n appId: number;\n accountLogin?: string;\n};\n\nexport type GithubAppError = {\n type: 'app';\n appId: number;\n error: Error;\n};\n\nexport function isGithubAppCredential(\n credential: ExtendedGithubCredentials,\n): credential is GithubAppCredentials {\n return 'appId' in credential && credential.type === 'app';\n}\n\nexport interface ExtendedGithubCredentialsProvider extends GithubCredentialsProvider {\n getAllCredentials: (options: {\n host: string;\n }) => Promise<ExtendedGithubCredentials[]>;\n}\n"],"names":[],"mappings":";;AA2HO,SAAS,sBACd,UACoC,EAAA;AACpC,EAAO,OAAA,OAAA,IAAW,UAAc,IAAA,UAAA,CAAW,IAAS,KAAA,KAAA;AACtD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"GitlabAppManager.cjs.js","sources":["../../src/gitlab/GitlabAppManager.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 */\nimport type {\n GitlabCredentials,\n GitLabIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\n\nimport {\n ExtendedGitlabCredentials,\n ExtendedGitlabCredentialsProvider,\n} from './types';\n\n// For reference\n// https://github.com/backstage/backstage/blob/master/packages/integration/src/gitlab/SingleInstanceGitlabCredentialsProvider.ts\n\nexport class CustomSingleInstanceGitlabCredentialsProvider\n implements ExtendedGitlabCredentialsProvider\n{\n static readonly create: (\n config: GitLabIntegrationConfig,\n ) => ExtendedGitlabCredentialsProvider = config => {\n return new CustomSingleInstanceGitlabCredentialsProvider(config.token);\n };\n\n private constructor(private readonly token?: string) {}\n async getAllCredentials(_opts: {\n host: string;\n }): Promise<ExtendedGitlabCredentials[]> {\n const credentials: ExtendedGitlabCredentials[] = [];\n if (this.token) {\n credentials.push({\n headers: { Authorization: `Bearer ${this.token}` },\n token: this.token,\n });\n }\n return credentials;\n }\n getCredentials(_opts: { url: string }): Promise<GitlabCredentials> {\n throw new Error('Method not implemented.');\n }\n}\n\nexport class CustomGitlabCredentialsProvider\n implements ExtendedGitlabCredentialsProvider\n{\n static fromIntegrations(integrations: ScmIntegrationRegistry) {\n const credentialsProviders: Map<string, ExtendedGitlabCredentialsProvider> =\n new Map<string, ExtendedGitlabCredentialsProvider>();\n\n integrations.gitlab.list().forEach(integration => {\n const credtialsProvider =\n CustomSingleInstanceGitlabCredentialsProvider.create(\n integration.config,\n );\n credentialsProviders.set(integration.config.host, credtialsProvider);\n });\n\n return new CustomGitlabCredentialsProvider(credentialsProviders);\n }\n\n private constructor(\n private readonly providers: Map<string, ExtendedGitlabCredentialsProvider>,\n ) {}\n async getAllCredentials(opts: {\n host: string;\n }): Promise<ExtendedGitlabCredentials[]> {\n const provider = this.providers.get(opts.host);\n\n if (!provider) {\n throw new Error(\n `There is no GitLab integration that matches ${opts.host}. Please add a configuration for an integration.`,\n );\n }\n return provider.getAllCredentials(opts);\n }\n getCredentials(_opts: { url: string }): Promise<GitlabCredentials> {\n throw new Error('Method not implemented.');\n }\n}\n"],"names":[],"mappings":";;AA6BO,MAAM,6CAEb,CAAA;AAAA,EAOU,YAA6B,KAAgB,EAAA;AAAhB,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAAA;AAAiB,EANtD,OAAgB,SAEyB,CAAU,MAAA,KAAA;AACjD,IAAO,OAAA,IAAI,6CAA8C,CAAA,MAAA,CAAO,KAAK,CAAA;AAAA,GACvE;AAAA,EAGA,MAAM,kBAAkB,KAEiB,EAAA;AACvC,IAAA,MAAM,cAA2C,EAAC;AAClD,IAAA,IAAI,KAAK,KAAO,EAAA;AACd,MAAA,WAAA,CAAY,IAAK,CAAA;AAAA,QACf,SAAS,EAAE,aAAA,EAAe,CAAU,OAAA,EAAA,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at, 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 */\nimport type {\n GitlabCredentials,\n GitLabIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\n\nimport {\n ExtendedGitlabCredentials,\n ExtendedGitlabCredentialsProvider,\n} from './types';\n\n// For reference\n// https://github.com/backstage/backstage/blob/master/packages/integration/src/gitlab/SingleInstanceGitlabCredentialsProvider.ts\n\nexport class CustomSingleInstanceGitlabCredentialsProvider implements ExtendedGitlabCredentialsProvider {\n static readonly create: (\n config: GitLabIntegrationConfig,\n ) => ExtendedGitlabCredentialsProvider = config => {\n return new CustomSingleInstanceGitlabCredentialsProvider(config.token);\n };\n\n private constructor(private readonly token?: string) {}\n async getAllCredentials(_opts: {\n host: string;\n }): Promise<ExtendedGitlabCredentials[]> {\n const credentials: ExtendedGitlabCredentials[] = [];\n if (this.token) {\n credentials.push({\n headers: { Authorization: `Bearer ${this.token}` },\n token: this.token,\n });\n }\n return credentials;\n }\n getCredentials(_opts: { url: string }): Promise<GitlabCredentials> {\n throw new Error('Method not implemented.');\n }\n}\n\nexport class CustomGitlabCredentialsProvider implements ExtendedGitlabCredentialsProvider {\n static fromIntegrations(integrations: ScmIntegrationRegistry) {\n const credentialsProviders: Map<string, ExtendedGitlabCredentialsProvider> =\n new Map<string, ExtendedGitlabCredentialsProvider>();\n\n integrations.gitlab.list().forEach(integration => {\n const credtialsProvider =\n CustomSingleInstanceGitlabCredentialsProvider.create(\n integration.config,\n );\n credentialsProviders.set(integration.config.host, credtialsProvider);\n });\n\n return new CustomGitlabCredentialsProvider(credentialsProviders);\n }\n\n private constructor(\n private readonly providers: Map<string, ExtendedGitlabCredentialsProvider>,\n ) {}\n async getAllCredentials(opts: {\n host: string;\n }): Promise<ExtendedGitlabCredentials[]> {\n const provider = this.providers.get(opts.host);\n\n if (!provider) {\n throw new Error(\n `There is no GitLab integration that matches ${opts.host}. Please add a configuration for an integration.`,\n );\n }\n return provider.getAllCredentials(opts);\n }\n getCredentials(_opts: { url: string }): Promise<GitlabCredentials> {\n throw new Error('Method not implemented.');\n }\n}\n"],"names":[],"mappings":";;AA6BO,MAAM,6CAA2F,CAAA;AAAA,EAO9F,YAA6B,KAAgB,EAAA;AAAhB,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAAA;AAAiB,EANtD,OAAgB,SAEyB,CAAU,MAAA,KAAA;AACjD,IAAO,OAAA,IAAI,6CAA8C,CAAA,MAAA,CAAO,KAAK,CAAA;AAAA,GACvE;AAAA,EAGA,MAAM,kBAAkB,KAEiB,EAAA;AACvC,IAAA,MAAM,cAA2C,EAAC;AAClD,IAAA,IAAI,KAAK,KAAO,EAAA;AACd,MAAA,WAAA,CAAY,IAAK,CAAA;AAAA,QACf,SAAS,EAAE,aAAA,EAAe,CAAU,OAAA,EAAA,IAAA,CAAK,KAAK,CAAG,CAAA,EAAA;AAAA,QACjD,OAAO,IAAK,CAAA;AAAA,OACb,CAAA;AAAA;AAEH,IAAO,OAAA,WAAA;AAAA;AACT,EACA,eAAe,KAAoD,EAAA;AACjE,IAAM,MAAA,IAAI,MAAM,yBAAyB,CAAA;AAAA;AAE7C;AAEO,MAAM,+BAA6E,CAAA;AAAA,EAgBhF,YACW,SACjB,EAAA;AADiB,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA;AAAA;AAChB,EAjBH,OAAO,iBAAiB,YAAsC,EAAA;AAC5D,IAAM,MAAA,oBAAA,uBACA,GAA+C,EAAA;AAErD,IAAA,YAAA,CAAa,MAAO,CAAA,IAAA,EAAO,CAAA,OAAA,CAAQ,CAAe,WAAA,KAAA;AAChD,MAAA,MAAM,oBACJ,6CAA8C,CAAA,MAAA;AAAA,QAC5C,WAAY,CAAA;AAAA,OACd;AACF,MAAA,oBAAA,CAAqB,GAAI,CAAA,WAAA,CAAY,MAAO,CAAA,IAAA,EAAM,iBAAiB,CAAA;AAAA,KACpE,CAAA;AAED,IAAO,OAAA,IAAI,gCAAgC,oBAAoB,CAAA;AAAA;AACjE,EAKA,MAAM,kBAAkB,IAEiB,EAAA;AACvC,IAAA,MAAM,QAAW,GAAA,IAAA,CAAK,SAAU,CAAA,GAAA,CAAI,KAAK,IAAI,CAAA;AAE7C,IAAA,IAAI,CAAC,QAAU,EAAA;AACb,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,4CAAA,EAA+C,KAAK,IAAI,CAAA,gDAAA;AAAA,OAC1D;AAAA;AAEF,IAAO,OAAA,QAAA,CAAS,kBAAkB,IAAI,CAAA;AAAA;AACxC,EACA,eAAe,KAAoD,EAAA;AACjE,IAAM,MAAA,IAAI,MAAM,yBAAyB,CAAA;AAAA;AAE7C;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@red-hat-developer-hub/backstage-plugin-bulk-import-backend",
3
- "version": "6.9.0",
3
+ "version": "6.10.0",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -62,7 +62,7 @@
62
62
  "@gitbeaker/rest": "^43.4.0",
63
63
  "@octokit/auth-app": "^6.0.3",
64
64
  "@octokit/rest": "^20.0.2",
65
- "@red-hat-developer-hub/backstage-plugin-bulk-import-common": "^6.9.0",
65
+ "@red-hat-developer-hub/backstage-plugin-bulk-import-common": "^6.10.0",
66
66
  "ajv-formats": "^3.0.1",
67
67
  "eventsource-client": "^1.2.0",
68
68
  "express": "^4.17.1",
@@ -91,7 +91,7 @@
91
91
  "js-yaml-cli": "0.6.0",
92
92
  "msw": "1.3.5",
93
93
  "openapicmd": "2.7.0",
94
- "prettier": "3.6.2",
94
+ "prettier": "3.7.4",
95
95
  "supertest": "6.3.4"
96
96
  },
97
97
  "peerDependencies": {