Merge remote-tracking branch 'upstream/master' into aadazurecli

This commit is contained in:
Alex Crome
2022-07-13 08:07:58 +01:00
550 changed files with 158161 additions and 204339 deletions
+12
View File
@@ -1,5 +1,17 @@
# @backstage/plugin-adr-backend
## 0.1.2-next.2
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 4e9a90e307: Updated dependency `luxon` to `^3.0.0`.
- Updated dependencies
- @backstage/backend-common@0.14.1-next.3
- @backstage/catalog-client@1.0.4-next.2
- @backstage/integration@1.2.2-next.3
- @backstage/catalog-model@1.1.0-next.3
## 0.1.2-next.1
### Patch Changes
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-adr-backend",
"version": "0.1.2-next.1",
"version": "0.1.2-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -29,22 +29,22 @@
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/catalog-client": "^1.0.4-next.1",
"@backstage/catalog-model": "^1.1.0-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/catalog-client": "^1.0.4-next.2",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/integration": "^1.2.2-next.1",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-adr-common": "^0.1.2-next.1",
"@backstage/plugin-search-common": "^0.3.6-next.0",
"luxon": "^2.0.2",
"luxon": "^3.0.0",
"marked": "^4.0.14",
"winston": "^3.2.1",
"node-fetch": "^2.6.5",
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@types/marked": "^4.0.0",
"@types/supertest": "^2.0.8",
"supertest": "^6.1.3",
+13
View File
@@ -1,5 +1,18 @@
# @backstage/plugin-adr
## 0.1.2-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 511f49ee43: Updated dependency `octokit` to `^2.0.0`.
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
- @backstage/integration-react@1.1.2-next.3
- @backstage/plugin-catalog-react@1.1.2-next.3
- @backstage/plugin-search-react@0.2.2-next.3
## 0.1.2-next.2
### Patch Changes
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-adr",
"version": "0.1.2-next.2",
"version": "0.1.2-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -22,19 +22,19 @@
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/integration-react": "^1.1.2-next.2",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@backstage/integration-react": "^1.1.2-next.3",
"@backstage/plugin-adr-common": "^0.1.2-next.1",
"@backstage/plugin-catalog-react": "^1.1.2-next.2",
"@backstage/plugin-catalog-react": "^1.1.2-next.3",
"@backstage/plugin-search-common": "^0.3.6-next.0",
"@backstage/plugin-search-react": "^0.2.2-next.2",
"@backstage/plugin-search-react": "^0.2.2-next.3",
"@backstage/theme": "^0.2.16-next.1",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
"git-url-parse": "^12.0.0",
"octokit": "^1.7.1",
"octokit": "^2.0.0",
"react-markdown": "^8.0.0",
"react-router-dom": "6.0.0-beta.0",
"react-use": "^17.2.4",
@@ -44,10 +44,10 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.2",
"@backstage/core-app-api": "^1.0.4-next.0",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/core-app-api": "^1.0.4-next.1",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
+8
View File
@@ -1,5 +1,13 @@
# @backstage/plugin-airbrake-backend
## 0.2.7-next.1
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/backend-common@0.14.1-next.3
## 0.2.7-next.0
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-airbrake-backend",
"version": "0.2.7-next.0",
"version": "0.2.7-next.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -22,7 +22,7 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/config": "^1.0.1",
"@types/express": "*",
"express": "^4.17.1",
@@ -33,7 +33,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@types/http-proxy-middleware": "^0.19.3",
"@types/supertest": "^2.0.8",
"supertest": "^6.1.6",
+13
View File
@@ -1,5 +1,18 @@
# @backstage/plugin-airbrake
## 0.3.7-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
- @backstage/test-utils@1.1.2-next.2
- @backstage/catalog-model@1.1.0-next.3
- @backstage/plugin-catalog-react@1.1.2-next.3
- @backstage/dev-utils@1.0.4-next.3
## 0.3.7-next.2
### Patch Changes
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-airbrake",
"version": "0.3.7-next.2",
"version": "0.3.7-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -23,12 +23,12 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/plugin-catalog-react": "^1.1.2-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/plugin-catalog-react": "^1.1.2-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@backstage/theme": "^0.2.16-next.1",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -40,10 +40,10 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/app-defaults": "^1.0.4-next.2",
"@backstage/cli": "^0.18.0-next.2",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/app-defaults": "^1.0.4-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
+11
View File
@@ -1,5 +1,16 @@
# @backstage/plugin-allure
## 0.1.23-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
- @backstage/catalog-model@1.1.0-next.3
- @backstage/plugin-catalog-react@1.1.2-next.3
## 0.1.23-next.2
### Patch Changes
+9 -9
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-allure",
"description": "A Backstage plugin that integrates with Allure",
"version": "0.1.23-next.2",
"version": "0.1.23-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -25,10 +25,10 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/plugin-catalog-react": "^1.1.2-next.2",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@backstage/plugin-catalog-react": "^1.1.2-next.3",
"@backstage/theme": "^0.2.16-next.1",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -40,10 +40,10 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.2",
"@backstage/core-app-api": "^1.0.4-next.0",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/core-app-api": "^1.0.4-next.1",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
+9
View File
@@ -1,5 +1,14 @@
# @backstage/plugin-analytics-module-ga
## 0.1.18-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
## 0.1.18-next.2
### Patch Changes
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-analytics-module-ga",
"version": "0.1.18-next.2",
"version": "0.1.18-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -25,8 +25,8 @@
},
"dependencies": {
"@backstage/config": "^1.0.1",
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@backstage/theme": "^0.2.16-next.1",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -38,10 +38,10 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.2",
"@backstage/core-app-api": "^1.0.4-next.0",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/core-app-api": "^1.0.4-next.1",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
+9
View File
@@ -1,5 +1,14 @@
# @backstage/plugin-apache-airflow
## 0.2.0-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
## 0.2.0-next.2
### Patch Changes
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-apache-airflow",
"version": "0.2.0-next.2",
"version": "0.2.0-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -23,8 +23,8 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
@@ -36,10 +36,10 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.2",
"@backstage/core-app-api": "^1.0.4-next.0",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/core-app-api": "^1.0.4-next.1",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
+14
View File
@@ -1,5 +1,19 @@
# @backstage/plugin-api-docs
## 0.8.7-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- b76eea25ed: Updated dependency `@asyncapi/react-component` to `1.0.0-next.39`.
- 9432a05cf3: Set font colors correctly for descriptions containing HTML
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
- @backstage/catalog-model@1.1.0-next.3
- @backstage/plugin-catalog-react@1.1.2-next.3
- @backstage/plugin-catalog@1.4.0-next.3
## 0.8.7-next.2
### Patch Changes
+10 -10
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-api-docs",
"description": "A Backstage plugin that helps represent API entities in the frontend",
"version": "0.8.7-next.2",
"version": "0.8.7-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -34,11 +34,11 @@
},
"dependencies": {
"@asyncapi/react-component": "1.0.0-next.39",
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/plugin-catalog": "^1.4.0-next.2",
"@backstage/plugin-catalog-react": "^1.1.2-next.2",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@backstage/plugin-catalog": "^1.4.0-next.3",
"@backstage/plugin-catalog-react": "^1.1.2-next.3",
"@backstage/theme": "^0.2.16-next.1",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -57,10 +57,10 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.2",
"@backstage/core-app-api": "^1.0.4-next.0",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/core-app-api": "^1.0.4-next.1",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
@@ -53,6 +53,7 @@ const useStyles = makeStyles(theme => ({
.opblock-summary-operation-id,
.opblock-summary-path,
.opblock-summary-path__deprecated,
.opblock-description-wrapper,
.opblock-external-docs-wrapper,
.opblock-section-header .btn,
.opblock-section-header>label,
@@ -66,7 +67,7 @@ const useStyles = makeStyles(theme => ({
fontFamily: theme.typography.fontFamily,
color: theme.palette.text.primary,
},
[`& .opblock .opblock-section-header,
[`& .opblock .opblock-section-header,
.model-box,
section.models .model-container`]: {
background: theme.palette.background.default,
@@ -75,7 +76,7 @@ const useStyles = makeStyles(theme => ({
.parameter__in`]: {
color: theme.palette.text.disabled,
},
[`& table.model,
[`& table.model,
.parameter__type,
.model.model-title,
.model-title,
@@ -91,7 +92,7 @@ const useStyles = makeStyles(theme => ({
[`& .parameter__name.required:after`]: {
color: theme.palette.warning.dark,
},
[`& table.model,
[`& table.model,
table.model .model,
.opblock-external-docs-wrapper`]: {
fontSize: theme.typography.fontSize,
@@ -104,7 +105,7 @@ const useStyles = makeStyles(theme => ({
color: theme.palette.text.hint,
backgroundColor: theme.palette.background.paper,
},
[`& .opblock-summary-method,
[`& .opblock-summary-method,
.info a`]: {
fontFamily: theme.typography.fontFamily,
},
+10
View File
@@ -1,5 +1,15 @@
# @backstage/plugin-app-backend
## 0.3.34-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 4e9a90e307: Updated dependency `luxon` to `^3.0.0`.
- Updated dependencies
- @backstage/backend-common@0.14.1-next.3
- @backstage/config-loader@1.1.3-next.1
## 0.3.34-next.2
### Patch Changes
+6 -6
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-app-backend",
"description": "A Backstage backend plugin that serves the Backstage frontend app",
"version": "0.3.34-next.2",
"version": "0.3.34-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -33,8 +33,8 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.2",
"@backstage/config-loader": "^1.1.3-next.0",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/config-loader": "^1.1.3-next.1",
"@backstage/config": "^1.0.1",
"@backstage/types": "^1.0.0",
"@types/express": "^4.17.6",
@@ -45,13 +45,13 @@
"helmet": "^5.0.2",
"knex": "^2.0.0",
"lodash": "^4.17.21",
"luxon": "^2.0.2",
"luxon": "^3.0.0",
"winston": "^3.2.1",
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.26-next.2",
"@backstage/cli": "^0.18.0-next.2",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/types": "^1.0.0",
"@types/supertest": "^2.0.8",
"mock-fs": "^5.1.0",
+17
View File
@@ -1,5 +1,22 @@
# @backstage/plugin-auth-backend
## 0.15.0-next.3
### Minor Changes
- fe8e025af5: Allowed post method on /refresh path
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 4e9a90e307: Updated dependency `luxon` to `^3.0.0`.
- 3a014730dc: Add new config option for okta auth server and IDP
- Updated dependencies
- @backstage/backend-common@0.14.1-next.3
- @backstage/catalog-client@1.0.4-next.2
- @backstage/plugin-auth-node@0.2.3-next.2
- @backstage/catalog-model@1.1.0-next.3
## 0.15.0-next.2
### Patch Changes
+9 -9
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-auth-backend",
"description": "A Backstage backend plugin that handles authentication",
"version": "0.15.0-next.2",
"version": "0.15.0-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -33,13 +33,14 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/plugin-auth-node": "^0.2.3-next.1",
"@backstage/backend-common": "^0.14.1-next.2",
"@backstage/catalog-client": "^1.0.4-next.1",
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/plugin-auth-node": "^0.2.3-next.2",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/catalog-client": "^1.0.4-next.2",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/types": "^1.0.0",
"@davidzemon/passport-okta-oauth": "^0.0.5",
"@google-cloud/firestore": "^5.0.2",
"@types/express": "^4.17.6",
"@types/passport": "^1.0.3",
@@ -55,7 +56,7 @@
"jwt-decode": "^3.1.0",
"knex": "^2.0.0",
"lodash": "^4.17.21",
"luxon": "^2.0.2",
"luxon": "^3.0.0",
"minimatch": "^5.0.0",
"morgan": "^1.10.0",
"node-fetch": "^2.6.7",
@@ -68,7 +69,6 @@
"passport-google-oauth20": "^2.0.0",
"passport-microsoft": "^1.0.0",
"passport-oauth2": "^1.6.1",
"passport-okta-oauth": "^0.0.1",
"passport-onelogin-oauth": "^0.0.1",
"passport-saml": "^3.1.2",
"uuid": "^8.0.0",
@@ -76,8 +76,8 @@
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.26-next.2",
"@backstage/cli": "^0.18.0-next.2",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@types/body-parser": "^1.19.0",
"@types/cookie-parser": "^1.4.2",
"@types/express-session": "^1.17.2",
@@ -26,7 +26,7 @@ import {
OAuthRefreshRequest,
OAuthResult,
} from '../../lib/oauth';
import { Strategy as OktaStrategy } from 'passport-okta-oauth';
import { Strategy as OktaStrategy } from '@davidzemon/passport-okta-oauth';
import passport from 'passport';
import {
executeFrameHandlerStrategy,
@@ -55,6 +55,8 @@ type PrivateInfo = {
export type OktaAuthProviderOptions = OAuthProviderOptions & {
audience: string;
authServerId?: string;
idp?: string;
signInResolver?: SignInResolver<OAuthResult>;
authHandler: AuthHandler<OAuthResult>;
resolverContext: AuthResolverContext;
@@ -94,6 +96,8 @@ export class OktaAuthProvider implements OAuthHandlers {
clientSecret: options.clientSecret,
callbackURL: options.callbackUrl,
audience: options.audience,
authServerID: options.authServerId,
idp: options.idp,
passReqToCallback: false,
store: this.store,
response_type: 'code',
@@ -220,6 +224,8 @@ export const okta = createAuthProviderIntegration({
const clientId = envConfig.getString('clientId');
const clientSecret = envConfig.getString('clientSecret');
const audience = envConfig.getString('audience');
const authServerId = envConfig.getOptionalString('authServerId');
const idp = envConfig.getOptionalString('idp');
const customCallbackUrl = envConfig.getOptionalString('callbackUrl');
const callbackUrl =
customCallbackUrl ||
@@ -240,6 +246,8 @@ export const okta = createAuthProviderIntegration({
const provider = new OktaAuthProvider({
audience,
authServerId,
idp,
clientId,
clientSecret,
callbackUrl,
+8
View File
@@ -1,5 +1,13 @@
# @backstage/plugin-auth-node
## 0.2.3-next.2
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/backend-common@0.14.1-next.3
## 0.2.3-next.1
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-auth-node",
"version": "0.2.3-next.1",
"version": "0.2.3-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -23,7 +23,7 @@
"start": "backstage-cli package start"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"jose": "^4.6.0",
@@ -31,7 +31,7 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.1",
"@backstage/cli": "^0.18.0-next.3",
"lodash": "^4.17.21",
"msw": "^0.43.0",
"uuid": "^8.0.0"
+13
View File
@@ -1,5 +1,18 @@
# @backstage/plugin-azure-devops-backend
## 0.3.13-next.1
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- e67c4b7d5a: Adding getProjects endpoint to list out all projects associated with the Azure DevOps organization.
It can be accessed by using this endpoint `{backendUrl}/api/azure-devops/projects`
- Updated dependencies
- @backstage/backend-common@0.14.1-next.3
- @backstage/plugin-azure-devops-common@0.2.4-next.0
## 0.3.13-next.0
### Patch Changes
@@ -12,6 +12,7 @@ import express from 'express';
import { GitRepository } from 'azure-devops-node-api/interfaces/GitInterfaces';
import { GitTag } from '@backstage/plugin-azure-devops-common';
import { Logger } from 'winston';
import { Project } from '@backstage/plugin-azure-devops-common';
import { PullRequest } from '@backstage/plugin-azure-devops-common';
import { PullRequestOptions } from '@backstage/plugin-azure-devops-common';
import { RepoBuild } from '@backstage/plugin-azure-devops-common';
@@ -64,6 +65,8 @@ export class AzureDevOpsApi {
// (undocumented)
getGitTags(projectName: string, repoName: string): Promise<GitTag[]>;
// (undocumented)
getProjects(): Promise<Project[]>;
// (undocumented)
getPullRequests(
projectName: string,
repoName: string,
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-azure-devops-backend",
"version": "0.3.13-next.0",
"version": "0.3.13-next.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -23,9 +23,9 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/config": "^1.0.1",
"@backstage/plugin-azure-devops-common": "^0.2.3",
"@backstage/plugin-azure-devops-common": "^0.2.4-next.0",
"@types/express": "^4.17.6",
"azure-devops-node-api": "^11.0.1",
"express": "^4.17.1",
@@ -35,7 +35,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@types/supertest": "^2.0.8",
"supertest": "^6.1.6",
"msw": "^0.43.0"
@@ -30,6 +30,7 @@ import {
RepoBuild,
Team,
TeamMember,
Project,
} from '@backstage/plugin-azure-devops-common';
import {
GitPullRequest,
@@ -47,7 +48,10 @@ import { TeamMember as AdoTeamMember } from 'azure-devops-node-api/interfaces/co
import { Logger } from 'winston';
import { PolicyEvaluationRecord } from 'azure-devops-node-api/interfaces/PolicyInterfaces';
import { WebApi } from 'azure-devops-node-api';
import { WebApiTeam } from 'azure-devops-node-api/interfaces/CoreInterfaces';
import {
TeamProjectReference,
WebApiTeam,
} from 'azure-devops-node-api/interfaces/CoreInterfaces';
export class AzureDevOpsApi {
public constructor(
@@ -55,6 +59,20 @@ export class AzureDevOpsApi {
private readonly webApi: WebApi,
) {}
public async getProjects(): Promise<Project[]> {
const client = await this.webApi.getCoreApi();
const projectList: TeamProjectReference[] = await client.getProjects();
const projects: Project[] = projectList.map(project => ({
id: project.id,
name: project.name,
description: project.description,
}));
return projects.sort((a, b) =>
a.name && b.name ? a.name.localeCompare(b.name) : 0,
);
}
public async getGitRepository(
projectName: string,
repoName: string,
@@ -63,6 +63,11 @@ export async function createRouter(
res.status(200).json({ status: 'ok' });
});
router.get('/projects', async (_req, res) => {
const projects = await azureDevOpsApi.getProjects();
res.status(200).json(projects);
});
router.get('/repository/:projectName/:repoName', async (req, res) => {
const { projectName, repoName } = req.params;
const gitRepository = await azureDevOpsApi.getGitRepository(
+8
View File
@@ -1,5 +1,13 @@
# @backstage/plugin-azure-devops-common
## 0.2.4-next.0
### Patch Changes
- e67c4b7d5a: Adding getProjects endpoint to list out all projects associated with the Azure DevOps organization.
It can be accessed by using this endpoint `{backendUrl}/api/azure-devops/projects`
## 0.2.3
### Patch Changes
@@ -168,6 +168,15 @@ export enum PolicyTypeId {
Status = 'cbdc66da-9728-4af8-aada-9a5a32e4a226',
}
// Warning: (ae-missing-release-tag) "Project" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type Project = {
id?: string;
name?: string;
description?: string;
};
// Warning: (ae-missing-release-tag) "PullRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-azure-devops-common",
"version": "0.2.3",
"version": "0.2.4-next.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -32,7 +32,7 @@
"clean": "backstage-cli package clean"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.1"
"@backstage/cli": "^0.18.0-next.3"
},
"files": [
"dist"
+6
View File
@@ -288,3 +288,9 @@ export type BuildRun = {
export type BuildRunOptions = {
top?: number;
};
export type Project = {
id?: string;
name?: string;
description?: string;
};
+13
View File
@@ -1,5 +1,18 @@
# @backstage/plugin-azure-devops
## 0.1.23-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 4e9a90e307: Updated dependency `luxon` to `^3.0.0`.
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
- @backstage/catalog-model@1.1.0-next.3
- @backstage/plugin-catalog-react@1.1.2-next.3
- @backstage/plugin-azure-devops-common@0.2.4-next.0
## 0.1.23-next.2
### Patch Changes
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-azure-devops",
"version": "0.1.23-next.2",
"version": "0.1.23-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -30,18 +30,18 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/plugin-azure-devops-common": "^0.2.3",
"@backstage/plugin-catalog-react": "^1.1.2-next.2",
"@backstage/plugin-azure-devops-common": "^0.2.4-next.0",
"@backstage/plugin-catalog-react": "^1.1.2-next.3",
"@backstage/theme": "^0.2.16-next.1",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
"humanize-duration": "^3.27.0",
"luxon": "^2.0.2",
"luxon": "^3.0.0",
"react-router": "6.0.0-beta.0",
"react-use": "^17.2.4"
},
@@ -49,10 +49,10 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.2",
"@backstage/core-app-api": "^1.0.4-next.0",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/core-app-api": "^1.0.4-next.1",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
+11
View File
@@ -1,5 +1,16 @@
# @backstage/plugin-badges
## 0.2.31-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
- @backstage/catalog-model@1.1.0-next.3
- @backstage/plugin-catalog-react@1.1.2-next.3
## 0.2.31-next.2
### Patch Changes
+9 -9
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-badges",
"description": "A Backstage plugin that generates README badges for your entities",
"version": "0.2.31-next.2",
"version": "0.2.31-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -30,11 +30,11 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/plugin-catalog-react": "^1.1.2-next.2",
"@backstage/plugin-catalog-react": "^1.1.2-next.3",
"@backstage/theme": "^0.2.16-next.1",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -46,10 +46,10 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.2",
"@backstage/core-app-api": "^1.0.4-next.0",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/core-app-api": "^1.0.4-next.1",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
+14
View File
@@ -1,5 +1,19 @@
# @backstage/plugin-bazaar
## 0.1.22-next.3
### Patch Changes
- 4e9a90e307: Updated dependency `luxon` to `^3.0.0`.
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
- @backstage/catalog-client@1.0.4-next.2
- @backstage/cli@0.18.0-next.3
- @backstage/catalog-model@1.1.0-next.3
- @backstage/plugin-catalog-react@1.1.2-next.3
- @backstage/plugin-catalog@1.4.0-next.3
## 0.1.22-next.2
### Patch Changes
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-bazaar",
"version": "0.1.22-next.2",
"version": "0.1.22-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -24,20 +24,20 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/catalog-client": "^1.0.4-next.1",
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/cli": "^0.18.0-next.2",
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/plugin-catalog": "^1.4.0-next.2",
"@backstage/plugin-catalog-react": "^1.1.2-next.2",
"@backstage/catalog-client": "^1.0.4-next.2",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@backstage/plugin-catalog": "^1.4.0-next.3",
"@backstage/plugin-catalog-react": "^1.1.2-next.3",
"@date-io/luxon": "1.x",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
"@material-ui/pickers": "^3.3.10",
"@testing-library/jest-dom": "^5.10.1",
"luxon": "^2.0.2",
"luxon": "^3.0.0",
"material-ui-search-bar": "^1.0.0",
"react-hook-form": "^7.13.0",
"react-router-dom": "6.0.0-beta.0",
@@ -47,8 +47,8 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.2",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/dev-utils": "^1.0.4-next.3",
"@testing-library/jest-dom": "^5.10.1",
"cross-fetch": "^3.1.5"
},
@@ -1,5 +1,13 @@
# @backstage/plugin-bitbucket-cloud-common
## 0.1.1-next.1
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/integration@1.2.2-next.3
## 0.1.1-next.0
### Patch Changes
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-bitbucket-cloud-common",
"description": "Common functionalities for bitbucket-cloud plugins",
"version": "0.1.1-next.0",
"version": "0.1.1-next.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -28,11 +28,11 @@
"update-models": "yarn refresh-schema && yarn generate-models && yarn reduce-models"
},
"dependencies": {
"@backstage/integration": "^1.2.2-next.1",
"@backstage/integration": "^1.2.2-next.3",
"cross-fetch": "^3.1.5"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@openapitools/openapi-generator-cli": "^2.4.26",
"msw": "^0.43.0",
"ts-morph": "^15.0.0"
+12
View File
@@ -1,5 +1,17 @@
# @backstage/plugin-bitrise
## 0.1.34-next.3
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 4e9a90e307: Updated dependency `luxon` to `^3.0.0`.
- Updated dependencies
- @backstage/core-plugin-api@1.0.4-next.0
- @backstage/core-components@0.10.0-next.3
- @backstage/catalog-model@1.1.0-next.3
- @backstage/plugin-catalog-react@1.1.2-next.3
## 0.1.34-next.2
### Patch Changes
+10 -10
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-bitrise",
"description": "A Backstage plugin that integrates towards Bitrise",
"version": "0.1.34-next.2",
"version": "0.1.34-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -24,17 +24,17 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/core-components": "^0.10.0-next.2",
"@backstage/core-plugin-api": "^1.0.3",
"@backstage/plugin-catalog-react": "^1.1.2-next.2",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/core-components": "^0.10.0-next.3",
"@backstage/core-plugin-api": "^1.0.4-next.0",
"@backstage/plugin-catalog-react": "^1.1.2-next.3",
"@backstage/theme": "^0.2.16-next.1",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
"cross-fetch": "^3.1.5",
"lodash": "^4.17.21",
"luxon": "^2.0.2",
"luxon": "^3.0.0",
"qs": "^6.9.6",
"react-use": "^17.2.4",
"recharts": "^1.8.5"
@@ -43,10 +43,10 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.2",
"@backstage/core-app-api": "^1.0.4-next.0",
"@backstage/dev-utils": "^1.0.4-next.2",
"@backstage/test-utils": "^1.1.2-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/core-app-api": "^1.0.4-next.1",
"@backstage/dev-utils": "^1.0.4-next.3",
"@backstage/test-utils": "^1.1.2-next.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
@@ -1,5 +1,17 @@
# @backstage/plugin-catalog-backend-module-aws
## 0.1.7-next.2
### Patch Changes
- 72622d9143: Updated dependency `yaml` to `^2.0.0`.
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/backend-common@0.14.1-next.3
- @backstage/integration@1.2.2-next.3
- @backstage/backend-tasks@0.3.3-next.3
- @backstage/catalog-model@1.1.0-next.3
## 0.1.7-next.1
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend-module-aws",
"description": "A Backstage catalog backend module that helps integrate towards AWS",
"version": "0.1.7-next.1",
"version": "0.1.7-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -33,13 +33,13 @@
"start": "backstage-cli package start"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/backend-tasks": "^0.3.3-next.1",
"@backstage/catalog-model": "^1.1.0-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/backend-tasks": "^0.3.3-next.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/integration": "^1.2.2-next.1",
"@backstage/plugin-catalog-backend": "^1.2.1-next.1",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"@backstage/types": "^1.0.0",
"aws-sdk": "^2.840.0",
"lodash": "^4.17.21",
@@ -48,10 +48,10 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@types/lodash": "^4.14.151",
"aws-sdk-mock": "^5.2.1",
"yaml": "^1.9.2"
"yaml": "^2.0.0"
},
"files": [
"dist",
@@ -1,5 +1,17 @@
# @backstage/plugin-catalog-backend-module-azure
## 0.1.5-next.2
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/backend-common@0.14.1-next.3
- @backstage/integration@1.2.2-next.3
- @backstage/backend-tasks@0.3.3-next.3
- @backstage/catalog-model@1.1.0-next.3
## 0.1.5-next.1
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend-module-azure",
"description": "A Backstage catalog backend module that helps integrate towards Azure",
"version": "0.1.5-next.1",
"version": "0.1.5-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -33,13 +33,13 @@
"start": "backstage-cli package start"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/catalog-model": "^1.1.0-next.1",
"@backstage/backend-tasks": "^0.3.3-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/backend-tasks": "^0.3.3-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/integration": "^1.2.2-next.1",
"@backstage/plugin-catalog-backend": "^1.2.1-next.1",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"@backstage/types": "^1.0.0",
"lodash": "^4.17.21",
"msw": "^0.43.0",
@@ -48,8 +48,8 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.26-next.1",
"@backstage/cli": "^0.18.0-next.1",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@types/lodash": "^4.14.151"
},
"files": [
@@ -1,5 +1,16 @@
# @backstage/plugin-catalog-backend-module-bitbucket-cloud
## 0.1.1-next.1
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/integration@1.2.2-next.3
- @backstage/plugin-bitbucket-cloud-common@0.1.1-next.1
- @backstage/backend-tasks@0.3.3-next.3
## 0.1.1-next.0
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend-module-bitbucket-cloud",
"description": "A Backstage catalog backend module that helps integrate towards Bitbucket Cloud",
"version": "0.1.1-next.0",
"version": "0.1.1-next.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -33,18 +33,18 @@
"start": "backstage-cli package start"
},
"dependencies": {
"@backstage/backend-tasks": "^0.3.3-next.1",
"@backstage/backend-tasks": "^0.3.3-next.3",
"@backstage/config": "^1.0.1",
"@backstage/integration": "^1.2.2-next.1",
"@backstage/plugin-bitbucket-cloud-common": "^0.1.1-next.0",
"@backstage/plugin-catalog-backend": "^1.2.1-next.1",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-bitbucket-cloud-common": "^0.1.1-next.1",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"uuid": "^8.0.0",
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/backend-test-utils": "^0.1.26-next.1",
"@backstage/cli": "^0.18.0-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"msw": "^0.43.0"
},
"files": [
@@ -1,5 +1,17 @@
# @backstage/plugin-catalog-backend-module-bitbucket
## 0.2.1-next.2
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/backend-common@0.14.1-next.3
- @backstage/integration@1.2.2-next.3
- @backstage/plugin-bitbucket-cloud-common@0.1.1-next.1
- @backstage/catalog-model@1.1.0-next.3
## 0.2.1-next.1
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend-module-bitbucket",
"description": "A Backstage catalog backend module that helps integrate towards Bitbucket",
"version": "0.2.1-next.1",
"version": "0.2.1-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -33,13 +33,13 @@
"start": "backstage-cli package start"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/catalog-model": "^1.1.0-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/integration": "^1.2.2-next.1",
"@backstage/plugin-bitbucket-cloud-common": "^0.1.1-next.0",
"@backstage/plugin-catalog-backend": "^1.2.1-next.1",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-bitbucket-cloud-common": "^0.1.1-next.1",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"@backstage/types": "^1.0.0",
"lodash": "^4.17.21",
"msw": "^0.43.0",
@@ -47,8 +47,8 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.26-next.1",
"@backstage/cli": "^0.18.0-next.1",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@types/lodash": "^4.14.151"
},
"files": [
@@ -1,5 +1,17 @@
# @backstage/plugin-catalog-backend-module-gerrit
## 0.1.2-next.2
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/backend-common@0.14.1-next.3
- @backstage/integration@1.2.2-next.3
- @backstage/backend-tasks@0.3.3-next.3
- @backstage/catalog-model@1.1.0-next.3
## 0.1.2-next.1
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-catalog-backend-module-gerrit",
"version": "0.1.2-next.1",
"version": "0.1.2-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -28,13 +28,13 @@
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/backend-tasks": "^0.3.3-next.1",
"@backstage/catalog-model": "^1.1.0-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/backend-tasks": "^0.3.3-next.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/integration": "^1.2.2-next.1",
"@backstage/plugin-catalog-backend": "^1.2.1-next.1",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"fs-extra": "10.1.0",
"msw": "^0.43.0",
"node-fetch": "^2.6.7",
@@ -42,8 +42,8 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.26-next.1",
"@backstage/cli": "^0.18.0-next.1",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@types/fs-extra": "^9.0.1"
},
"files": [
@@ -1,5 +1,18 @@
# @backstage/plugin-catalog-backend-module-github
## 0.1.5-next.2
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 0f25116d28: Updated dependency `@octokit/graphql` to `^5.0.0`.
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/backend-common@0.14.1-next.3
- @backstage/integration@1.2.2-next.3
- @backstage/backend-tasks@0.3.3-next.3
- @backstage/catalog-model@1.1.0-next.3
## 0.1.5-next.1
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend-module-github",
"description": "A Backstage catalog backend module that helps integrate towards GitHub",
"version": "0.1.5-next.1",
"version": "0.1.5-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -33,15 +33,15 @@
"start": "backstage-cli package start"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/backend-tasks": "^0.3.3-next.1",
"@backstage/catalog-model": "^1.1.0-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/backend-tasks": "^0.3.3-next.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/integration": "^1.2.2-next.1",
"@backstage/plugin-catalog-backend": "^1.2.1-next.1",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"@backstage/types": "^1.0.0",
"@octokit/graphql": "^4.5.8",
"@octokit/graphql": "^5.0.0",
"lodash": "^4.17.21",
"msw": "^0.43.0",
"node-fetch": "^2.6.7",
@@ -49,8 +49,8 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.26-next.1",
"@backstage/cli": "^0.18.0-next.1",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@types/lodash": "^4.14.151"
},
"files": [
@@ -1,5 +1,17 @@
# @backstage/plugin-catalog-backend-module-gitlab
## 0.1.5-next.2
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/backend-common@0.14.1-next.3
- @backstage/integration@1.2.2-next.3
- @backstage/backend-tasks@0.3.3-next.3
- @backstage/catalog-model@1.1.0-next.3
## 0.1.5-next.1
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend-module-gitlab",
"description": "A Backstage catalog backend module that helps integrate towards GitLab",
"version": "0.1.5-next.1",
"version": "0.1.5-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -33,13 +33,13 @@
"start": "backstage-cli package start"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.1",
"@backstage/catalog-model": "^1.1.0-next.1",
"@backstage/backend-tasks": "^0.3.3-next.1",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/backend-tasks": "^0.3.3-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/integration": "^1.2.2-next.1",
"@backstage/plugin-catalog-backend": "^1.2.1-next.1",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"@backstage/types": "^1.0.0",
"lodash": "^4.17.21",
"msw": "^0.43.0",
@@ -48,8 +48,8 @@
"uuid": "^8.0.0"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.26-next.1",
"@backstage/cli": "^0.18.0-next.1",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@types/lodash": "^4.14.151",
"@types/uuid": "^8.0.0"
},
@@ -1,5 +1,15 @@
# @backstage/plugin-catalog-backend-module-ldap
## 0.5.1-next.2
### Patch Changes
- ddfd566606: Fix mapping between users and groups for FreeIPA when using the LdapOrgProcessor
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/backend-tasks@0.3.3-next.3
- @backstage/catalog-model@1.1.0-next.3
## 0.5.1-next.1
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend-module-ldap",
"description": "A Backstage catalog backend module that helps integrate towards LDAP",
"version": "0.5.1-next.1",
"version": "0.5.1-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -33,11 +33,11 @@
"start": "backstage-cli package start"
},
"dependencies": {
"@backstage/backend-tasks": "^0.3.3-next.1",
"@backstage/catalog-model": "^1.1.0-next.1",
"@backstage/backend-tasks": "^0.3.3-next.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/plugin-catalog-backend": "^1.2.1-next.1",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"@backstage/types": "^1.0.0",
"@types/ldapjs": "^2.2.0",
"ldapjs": "^2.2.0",
@@ -46,7 +46,7 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.18.0-next.1",
"@backstage/cli": "^0.18.0-next.3",
"@types/lodash": "^4.14.151"
},
"files": [
@@ -23,6 +23,7 @@ import { errorString } from './util';
import {
ActiveDirectoryVendor,
DefaultLdapVendor,
FreeIpaVendor,
LdapVendor,
} from './vendors';
@@ -199,6 +200,8 @@ export class LdapClient {
.then(root => {
if (root && root.raw?.forestFunctionality) {
return ActiveDirectoryVendor;
} else if (root && root.raw?.ipaDomainLevel) {
return FreeIpaVendor;
}
return DefaultLdapVendor;
})
@@ -32,7 +32,11 @@ import {
resolveRelations,
} from './read';
import { RecursivePartial } from './util';
import { ActiveDirectoryVendor, DefaultLdapVendor } from './vendors';
import {
ActiveDirectoryVendor,
DefaultLdapVendor,
FreeIpaVendor,
} from './vendors';
function user(data: RecursivePartial<UserEntity>): UserEntity {
return merge(
@@ -195,6 +199,62 @@ describe('readLdapUsers', () => {
new Map([['dn-value', new Set(['x', 'y', 'z'])]]),
);
});
it('transfers all attributes from FreeIPA', async () => {
client.getVendor.mockResolvedValue(FreeIpaVendor);
client.searchStreaming.mockImplementation(async (_dn, _opts, fn) => {
await fn(
searchEntry({
uid: ['uid-value'],
description: ['description-value'],
cn: ['cn-value'],
mail: ['mail-value'],
avatarUrl: ['avatarUrl-value'],
memberOf: ['x', 'y', 'z'],
dn: ['dn-value'],
ipaUniqueID: ['uuid-value'],
}),
);
});
const config: UserConfig = {
dn: 'ddd',
options: {},
map: {
rdn: 'uid',
name: 'uid',
description: 'description',
displayName: 'cn',
email: 'mail',
picture: 'avatarUrl',
memberOf: 'memberOf',
},
};
const { users, userMemberOf } = await readLdapUsers(client, config);
expect(users).toEqual([
expect.objectContaining({
metadata: {
name: 'uid-value',
description: 'description-value',
annotations: {
[LDAP_DN_ANNOTATION]: 'dn-value',
[LDAP_RDN_ANNOTATION]: 'uid-value',
[LDAP_UUID_ANNOTATION]: 'uuid-value',
},
},
spec: {
profile: {
displayName: 'cn-value',
email: 'mail-value',
picture: 'avatarUrl-value',
},
memberOf: [],
},
}),
]);
expect(userMemberOf).toEqual(
new Map([['dn-value', new Set(['x', 'y', 'z'])]]),
);
});
});
describe('readLdapGroups', () => {
@@ -63,6 +63,16 @@ export const ActiveDirectoryVendor: LdapVendor = {
},
};
export const FreeIpaVendor: LdapVendor = {
dnAttributeName: 'dn',
uuidAttributeName: 'ipaUniqueID',
decodeStringAttribute: (entry, name) => {
return decode(entry, name, value => {
return value.toString();
});
},
};
// Decode an attribute to a consumer
function decode(
entry: SearchEntry,
@@ -1,5 +1,15 @@
# @backstage/plugin-catalog-backend-module-msgraph
## 0.4.0-next.2
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/backend-tasks@0.3.3-next.3
- @backstage/catalog-model@1.1.0-next.3
## 0.4.0-next.1
### Minor Changes
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend-module-msgraph",
"description": "A Backstage catalog backend module that helps integrate towards Microsoft Graph",
"version": "0.4.0-next.1",
"version": "0.4.0-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -34,10 +34,10 @@
},
"dependencies": {
"@azure/identity": "^2.1.0",
"@backstage/backend-tasks": "^0.3.3-next.2",
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/backend-tasks": "^0.3.3-next.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/plugin-catalog-backend": "^1.2.1-next.2",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"@microsoft/microsoft-graph-types": "^2.6.0",
"@types/node-fetch": "^2.5.12",
"lodash": "^4.17.21",
@@ -48,9 +48,9 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/backend-common": "^0.14.1-next.2",
"@backstage/backend-test-utils": "^0.1.26-next.2",
"@backstage/cli": "^0.18.0-next.2",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@types/lodash": "^4.14.151",
"msw": "^0.43.0"
},
@@ -1,5 +1,15 @@
# @backstage/plugin-catalog-backend-module-openapi
## 0.1.0-next.2
### Patch Changes
- Updated dependencies
- @backstage/plugin-catalog-backend@1.3.0-next.3
- @backstage/backend-common@0.14.1-next.3
- @backstage/integration@1.2.2-next.3
- @backstage/catalog-model@1.1.0-next.3
## 0.1.0-next.1
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend-module-openapi",
"description": "A Backstage catalog backend module that helps with OpenAPI specifications",
"version": "0.1.0-next.1",
"version": "0.1.0-next.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -34,17 +34,17 @@
},
"dependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
"@backstage/backend-common": "^0.14.1-next.2",
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/integration": "^1.2.2-next.2",
"@backstage/plugin-catalog-backend": "^1.2.1-next.2",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-catalog-backend": "^1.3.0-next.3",
"winston": "^3.2.1",
"yaml": "^2.1.1"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.26-next.2",
"@backstage/cli": "^0.18.0-next.2",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"openapi-types": "^12.0.0"
},
"files": [
+51
View File
@@ -1,5 +1,56 @@
# @backstage/plugin-catalog-backend
## 1.3.0-next.3
### Minor Changes
- 1dd6c22cc8: Added an option to be able to trigger refreshes on entities based on a prestored arbitrary key.
The UrlReaderProcessor, FileReaderProcessor got updated to store the absolute URL of the catalog file as a refresh key. In the format of `<type>:<target>`
The PlaceholderProcessor got updated to store the resolverValues as refreshKeys for the entities.
The custom resolvers will need to be updated to pass in a `CatalogProcessorEmit` function as parameter and they should be updated to emit their refresh processingResults. You can see the updated resolvers in the `PlaceholderProcessor.ts`
```ts
// yamlPlaceholderResolver
...
const { content, url } = await readTextLocation(params);
params.emit(processingResult.refresh(`url:${url}`));
...
```
- 91c1d12123: Export experimental `catalogPlugin` for the new backend system. This export is not considered stable and should not be used in production.
### Patch Changes
- 1e02fe46d6: Fixed bug where catalog metrics weren't being tracked.
- 5f6b847c15: Fix Error Code in Register Component DryRun
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 4e9a90e307: Updated dependency `luxon` to `^3.0.0`.
- 72622d9143: Updated dependency `yaml` to `^2.0.0`.
- fa0533e604: CatalogBuilder supports now subscription to processing engine errors.
```ts
subscribe(options: {
onProcessingError: (event: { unprocessedEntity: Entity, error: Error }) => Promise<void> | void;
});
```
If you want to get notified on errors while processing the entities, you call CatalogBuilder.subscribe
to get notifications with the parameters defined as above.
- 9a6aba1d85: Many symbol declarations have been moved to `@backstage/plugin-catalog-node`. This has no affect on users of this package as they are all re-exported. Modules that build on top of the catalog backend plugin should switch all of their imports to the `@backstage/plugin-catalog-node` package and remove the dependency on `@backstage/plugin-catalog-backend`.
- Updated dependencies
- @backstage/backend-plugin-api@0.1.0-next.0
- @backstage/plugin-catalog-node@1.0.0-next.0
- @backstage/backend-common@0.14.1-next.3
- @backstage/catalog-client@1.0.4-next.2
- @backstage/integration@1.2.2-next.3
- @backstage/plugin-permission-common@0.6.3-next.1
- @backstage/plugin-permission-node@0.6.3-next.2
- @backstage/catalog-model@1.1.0-next.3
## 1.2.1-next.2
### Patch Changes
+52 -125
View File
@@ -5,18 +5,34 @@
```ts
/// <reference types="node" />
import { BackendRegistrable } from '@backstage/backend-plugin-api';
import { CatalogApi } from '@backstage/catalog-client';
import { CatalogEntityDocument } from '@backstage/plugin-catalog-common';
import { CompoundEntityRef } from '@backstage/catalog-model';
import { CatalogProcessor } from '@backstage/plugin-catalog-node';
import { CatalogProcessorCache } from '@backstage/plugin-catalog-node';
import { CatalogProcessorEmit } from '@backstage/plugin-catalog-node';
import { CatalogProcessorEntityResult } from '@backstage/plugin-catalog-node';
import { CatalogProcessorErrorResult } from '@backstage/plugin-catalog-node';
import { CatalogProcessorLocationResult } from '@backstage/plugin-catalog-node';
import { CatalogProcessorParser } from '@backstage/plugin-catalog-node';
import { CatalogProcessorRefreshKeysResult } from '@backstage/plugin-catalog-node';
import { CatalogProcessorRelationResult } from '@backstage/plugin-catalog-node';
import { CatalogProcessorResult } from '@backstage/plugin-catalog-node';
import { ConditionalPolicyDecision } from '@backstage/plugin-permission-common';
import { Conditions } from '@backstage/plugin-permission-node';
import { Config } from '@backstage/config';
import { DeferredEntity } from '@backstage/plugin-catalog-node';
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
import { Entity } from '@backstage/catalog-model';
import { EntityPolicy } from '@backstage/catalog-model';
import { EntityProvider } from '@backstage/plugin-catalog-node';
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
import { EntityProviderMutation } from '@backstage/plugin-catalog-node';
import { EntityRelationSpec } from '@backstage/plugin-catalog-node';
import { GetEntitiesRequest } from '@backstage/catalog-client';
import { JsonValue } from '@backstage/types';
import { LocationEntityV1alpha1 } from '@backstage/catalog-model';
import { LocationSpec } from '@backstage/plugin-catalog-node';
import { Logger } from 'winston';
import { Permission } from '@backstage/plugin-permission-common';
import { PermissionAuthorizer } from '@backstage/plugin-permission-common';
@@ -26,6 +42,7 @@ import { PermissionEvaluator } from '@backstage/plugin-permission-common';
import { PermissionRule } from '@backstage/plugin-permission-node';
import { PluginDatabaseManager } from '@backstage/backend-common';
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import { processingResult } from '@backstage/plugin-catalog-node';
import { Readable } from 'stream';
import { ResourcePermission } from '@backstage/plugin-permission-common';
import { Router } from 'express';
@@ -144,6 +161,13 @@ export class CatalogBuilder {
processingInterval: ProcessingIntervalFunction,
): CatalogBuilder;
setProcessingIntervalSeconds(seconds: number): CatalogBuilder;
// (undocumented)
subscribe(options: {
onProcessingError: (event: {
unprocessedEntity: Entity;
errors: Error[];
}) => Promise<void> | void;
}): void;
}
// @alpha
@@ -199,6 +223,9 @@ export type CatalogEnvironment = {
export type CatalogPermissionRule<TParams extends unknown[] = unknown[]> =
PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
// @alpha
export const catalogPlugin: (option: unknown) => BackendRegistrable;
// @public (undocumented)
export interface CatalogProcessingEngine {
// (undocumented)
@@ -207,79 +234,25 @@ export interface CatalogProcessingEngine {
stop(): Promise<void>;
}
// @public (undocumented)
export type CatalogProcessor = {
getProcessorName(): string;
readLocation?(
location: LocationSpec,
optional: boolean,
emit: CatalogProcessorEmit,
parser: CatalogProcessorParser,
cache: CatalogProcessorCache,
): Promise<boolean>;
preProcessEntity?(
entity: Entity,
location: LocationSpec,
emit: CatalogProcessorEmit,
originLocation: LocationSpec,
cache: CatalogProcessorCache,
): Promise<Entity>;
validateEntityKind?(entity: Entity): Promise<boolean>;
postProcessEntity?(
entity: Entity,
location: LocationSpec,
emit: CatalogProcessorEmit,
cache: CatalogProcessorCache,
): Promise<Entity>;
};
export { CatalogProcessor };
// @public
export interface CatalogProcessorCache {
get<ItemType extends JsonValue>(key: string): Promise<ItemType | undefined>;
set<ItemType extends JsonValue>(key: string, value: ItemType): Promise<void>;
}
export { CatalogProcessorCache };
// @public (undocumented)
export type CatalogProcessorEmit = (generated: CatalogProcessorResult) => void;
export { CatalogProcessorEmit };
// @public (undocumented)
export type CatalogProcessorEntityResult = {
type: 'entity';
entity: Entity;
location: LocationSpec;
};
export { CatalogProcessorEntityResult };
// @public (undocumented)
export type CatalogProcessorErrorResult = {
type: 'error';
error: Error;
location: LocationSpec;
};
export { CatalogProcessorErrorResult };
// @public (undocumented)
export type CatalogProcessorLocationResult = {
type: 'location';
location: LocationSpec;
};
export { CatalogProcessorLocationResult };
// @public
export type CatalogProcessorParser = (options: {
data: Buffer;
location: LocationSpec;
}) => AsyncIterable<CatalogProcessorResult>;
export { CatalogProcessorParser };
// @public (undocumented)
export type CatalogProcessorRelationResult = {
type: 'relation';
relation: EntityRelationSpec;
};
export { CatalogProcessorRefreshKeysResult };
// @public (undocumented)
export type CatalogProcessorResult =
| CatalogProcessorLocationResult
| CatalogProcessorEntityResult
| CatalogProcessorRelationResult
| CatalogProcessorErrorResult;
export { CatalogProcessorRelationResult };
export { CatalogProcessorResult };
// @public (undocumented)
export class CodeOwnersProcessor implements CatalogProcessor {
@@ -387,11 +360,7 @@ export type DefaultCatalogCollatorFactoryOptions = {
catalogClient?: CatalogApi;
};
// @public
export type DeferredEntity = {
entity: Entity;
locationKey?: string;
};
export { DeferredEntity };
// @public
export type EntitiesSearchFilter = {
@@ -412,35 +381,13 @@ export type EntityFilter =
}
| EntitiesSearchFilter;
// @public
export interface EntityProvider {
connect(connection: EntityProviderConnection): Promise<void>;
getProviderName(): string;
}
export { EntityProvider };
// @public
export interface EntityProviderConnection {
applyMutation(mutation: EntityProviderMutation): Promise<void>;
}
export { EntityProviderConnection };
// @public
export type EntityProviderMutation =
| {
type: 'full';
entities: DeferredEntity[];
}
| {
type: 'delta';
added: DeferredEntity[];
removed: DeferredEntity[];
};
export { EntityProviderMutation };
// @public
export type EntityRelationSpec = {
source: CompoundEntityRef;
type: string;
target: CompoundEntityRef;
};
export { EntityRelationSpec };
// @public (undocumented)
export class FileReaderProcessor implements CatalogProcessor {
@@ -480,12 +427,7 @@ export type LocationEntityProcessorOptions = {
integrations: ScmIntegrationRegistry;
};
// @public
export type LocationSpec = {
type: string;
target: string;
presence?: 'optional' | 'required';
};
export { LocationSpec };
// @public (undocumented)
export function locationSpecToLocationEntity(opts: {
@@ -545,7 +487,11 @@ export class PlaceholderProcessor implements CatalogProcessor {
// (undocumented)
getProcessorName(): string;
// (undocumented)
preProcessEntity(entity: Entity, location: LocationSpec): Promise<Entity>;
preProcessEntity(
entity: Entity,
location: LocationSpec,
emit: CatalogProcessorEmit,
): Promise<Entity>;
}
// @public (undocumented)
@@ -567,6 +513,7 @@ export type PlaceholderResolverParams = {
baseUrl: string;
read: PlaceholderResolverRead;
resolveUrl: PlaceholderResolverResolveUrl;
emit: CatalogProcessorEmit;
};
// @public (undocumented)
@@ -581,27 +528,7 @@ export type PlaceholderResolverResolveUrl = (
// @public
export type ProcessingIntervalFunction = () => number;
// @public
export const processingResult: Readonly<{
readonly notFoundError: (
atLocation: LocationSpec,
message: string,
) => CatalogProcessorResult;
readonly inputError: (
atLocation: LocationSpec,
message: string,
) => CatalogProcessorResult;
readonly generalError: (
atLocation: LocationSpec,
message: string,
) => CatalogProcessorResult;
readonly location: (newLocation: LocationSpec) => CatalogProcessorResult;
readonly entity: (
atLocation: LocationSpec,
newEntity: Entity,
) => CatalogProcessorResult;
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
}>;
export { processingResult };
// @public (undocumented)
export class UrlReaderProcessor implements CatalogProcessor {
@@ -0,0 +1,53 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @param { import("knex").Knex } knex
*/
exports.up = async function up(knex) {
await knex.schema.createTable('refresh_keys', table => {
table.comment(
'This table contains relations between entities and keys to trigger refreshes with',
);
table
.text('entity_id')
.notNullable()
.references('entity_id')
.inTable('refresh_state')
.onDelete('CASCADE')
.comment('A reference to the entity that the refresh key is tied to');
table
.text('key')
.notNullable()
.comment(
'A reference to a key which should be used to trigger a refresh on this entity',
);
table.index('entity_id', 'refresh_keys_entity_id_idx');
table.index('key', 'refresh_keys_key_idx');
});
};
/**
* @param { import("knex").Knex } knex
*/
exports.down = async function down(knex) {
await knex.schema.alterTable('refresh_keys', table => {
table.dropIndex([], 'refresh_keys_entity_id_idx');
table.dropIndex([], 'refresh_keys_key_idx');
});
await knex.schema.dropTable('refresh_keys');
};
+16 -14
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-catalog-backend",
"description": "The Backstage backend plugin that provides the Backstage catalog",
"version": "1.2.1-next.2",
"version": "1.3.0-next.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -34,15 +34,17 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/backend-common": "^0.14.1-next.2",
"@backstage/catalog-client": "^1.0.4-next.1",
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/backend-plugin-api": "^0.1.0-next.0",
"@backstage/plugin-catalog-node": "^1.0.0-next.0",
"@backstage/backend-common": "^0.14.1-next.3",
"@backstage/catalog-client": "^1.0.4-next.2",
"@backstage/catalog-model": "^1.1.0-next.3",
"@backstage/config": "^1.0.1",
"@backstage/errors": "^1.1.0-next.0",
"@backstage/integration": "^1.2.2-next.2",
"@backstage/integration": "^1.2.2-next.3",
"@backstage/plugin-catalog-common": "^1.0.4-next.0",
"@backstage/plugin-permission-common": "^0.6.3-next.0",
"@backstage/plugin-permission-node": "^0.6.3-next.1",
"@backstage/plugin-permission-common": "^0.6.3-next.1",
"@backstage/plugin-permission-node": "^0.6.3-next.2",
"@backstage/plugin-scaffolder-common": "^1.1.2-next.0",
"@backstage/plugin-search-common": "^0.3.6-next.0",
"@backstage/types": "^1.0.0",
@@ -57,21 +59,21 @@
"glob": "^7.1.6",
"knex": "^2.0.0",
"lodash": "^4.17.21",
"luxon": "^2.0.2",
"luxon": "^3.0.0",
"node-fetch": "^2.6.7",
"p-limit": "^3.0.2",
"prom-client": "^14.0.1",
"uuid": "^8.0.0",
"winston": "^3.2.1",
"yaml": "^1.9.2",
"yaml": "^2.0.0",
"yn": "^4.0.0",
"zod": "^3.11.6"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.26-next.2",
"@backstage/cli": "^0.18.0-next.2",
"@backstage/plugin-permission-common": "^0.6.3-next.0",
"@backstage/plugin-search-backend-node": "0.6.3-next.1",
"@backstage/backend-test-utils": "^0.1.26-next.3",
"@backstage/cli": "^0.18.0-next.3",
"@backstage/plugin-permission-common": "^0.6.3-next.1",
"@backstage/plugin-search-backend-node": "0.6.3-next.2",
"@types/core-js": "^2.5.4",
"@types/git-url-parse": "^9.0.0",
"@types/lodash": "^4.14.151",
@@ -81,7 +83,7 @@
"msw": "^0.43.0",
"supertest": "^6.1.3",
"wait-for-expect": "^3.0.2",
"luxon": "^2.0.2"
"luxon": "^3.0.0"
},
"files": [
"dist",
@@ -24,6 +24,7 @@ import { DateTime } from 'luxon';
import { applyDatabaseMigrations } from './migrations';
import { DefaultProcessingDatabase } from './DefaultProcessingDatabase';
import {
DbRefreshKeysRow,
DbRefreshStateReferencesRow,
DbRefreshStateRow,
DbRelationsRow,
@@ -98,6 +99,7 @@ describe('Default Processing Database', () => {
resultHash: '',
relations: [],
deferredEntities: [],
refreshKeys: [],
}),
).rejects.toThrow(
`Conflicting write of processing result for ${id} with location key 'undefined'`,
@@ -117,6 +119,7 @@ describe('Default Processing Database', () => {
relations: [],
deferredEntities: [],
locationKey: 'key',
refreshKeys: [],
errors: "['something broke']",
};
const { knex, db } = await createDatabase(databaseId);
@@ -143,6 +146,7 @@ describe('Default Processing Database', () => {
...options,
resultHash: '',
locationKey: 'fail',
refreshKeys: [],
}),
).rejects.toThrow(
`Conflicting write of processing result for ${id} with location key 'fail'`,
@@ -174,6 +178,7 @@ describe('Default Processing Database', () => {
relations: [],
deferredEntities: [],
locationKey: 'key',
refreshKeys: [],
errors: "['something broke']",
}),
);
@@ -228,6 +233,7 @@ describe('Default Processing Database', () => {
resultHash: '',
relations: relations,
deferredEntities: [],
refreshKeys: [],
}),
);
@@ -250,6 +256,7 @@ describe('Default Processing Database', () => {
resultHash: '',
relations: relations,
deferredEntities: [],
refreshKeys: [],
}),
);
@@ -309,6 +316,7 @@ describe('Default Processing Database', () => {
resultHash: '',
relations: [],
deferredEntities,
refreshKeys: [],
}),
);
@@ -400,6 +408,7 @@ describe('Default Processing Database', () => {
processedEntity,
resultHash: '',
relations: [],
refreshKeys: [],
deferredEntities: [
{
entity: {
@@ -465,6 +474,63 @@ describe('Default Processing Database', () => {
},
60_000,
);
it.each(databases.eachSupportedId())(
'stores the refresh keys for the entity',
async databaseId => {
const mockLogger = {
debug: jest.fn(),
error: jest.fn(),
warn: jest.fn(),
};
const { knex, db } = await createDatabase(
databaseId,
mockLogger as unknown as Logger,
);
await insertRefreshStateRow(knex, {
entity_id: id,
entity_ref: 'location:default/fakelocation',
unprocessed_entity: '{}',
processed_entity: '{}',
errors: '[]',
next_update_at: '2021-04-01 13:37:00',
last_discovery_at: '2021-04-01 13:37:00',
});
const deferredEntities = [
{
entity: {
apiVersion: '1',
kind: 'Location',
metadata: {
name: 'next',
},
},
locationKey: 'mock',
},
];
await db.transaction(tx =>
db.updateProcessedEntity(tx, {
id,
processedEntity,
resultHash: '',
relations: [],
deferredEntities,
refreshKeys: [{ key: 'protocol:foo-bar.com' }],
}),
);
const refreshKeys = await knex<DbRefreshKeysRow>('refresh_keys')
.where({ entity_id: id })
.select();
expect(refreshKeys[0]).toEqual({
entity_id: id,
key: 'protocol:foo-bar.com',
});
},
);
});
describe('updateEntityCache', () => {
@@ -33,12 +33,13 @@ import {
UpdateEntityCacheOptions,
ListParentsOptions,
ListParentsResult,
RefreshByKeyOptions,
} from './types';
import { DeferredEntity } from '../processing/types';
import { ProcessingIntervalFunction } from '../processing/refresh';
import { rethrowError, timestampToDateTime } from './conversion';
import { initDatabaseMetrics } from './metrics';
import {
DbRefreshKeysRow,
DbRefreshStateReferencesRow,
DbRefreshStateRow,
DbRelationsRow,
@@ -46,6 +47,7 @@ import {
import { generateStableHash } from './util';
import { isDatabaseConflictError } from '@backstage/backend-common';
import { DeferredEntity } from '@backstage/plugin-catalog-node';
// The number of items that are sent per batch to the database layer, when
// doing .batchInsert calls to knex. This needs to be low enough to not cause
@@ -77,6 +79,7 @@ export class DefaultProcessingDatabase implements ProcessingDatabase {
errors,
relations,
deferredEntities,
refreshKeys,
locationKey,
} = options;
const refreshResult = await tx<DbRefreshStateRow>('refresh_state')
@@ -100,11 +103,12 @@ export class DefaultProcessingDatabase implements ProcessingDatabase {
`Conflicting write of processing result for ${id} with location key '${locationKey}'`,
);
}
const sourceEntityRef = stringifyEntityRef(processedEntity);
// Schedule all deferred entities for future processing.
await this.addUnprocessedEntities(tx, {
entities: deferredEntities,
sourceEntityRef: stringifyEntityRef(processedEntity),
sourceEntityRef,
});
// Delete old relations
@@ -138,6 +142,21 @@ export class DefaultProcessingDatabase implements ProcessingDatabase {
BATCH_SIZE,
);
// Delete old refresh keys
await tx<DbRefreshKeysRow>('refresh_keys')
.where({ entity_id: id })
.delete();
// Insert the refresh keys for the processed entity
await tx.batchInsert(
'refresh_keys',
refreshKeys.map(k => ({
entity_id: id,
key: k.key,
})),
BATCH_SIZE,
);
return {
previous: {
relations: previousRelationRows,
@@ -516,6 +535,25 @@ export class DefaultProcessingDatabase implements ProcessingDatabase {
}
}
async refreshByRefreshKeys(
txOpaque: Transaction,
options: RefreshByKeyOptions,
) {
const tx = txOpaque as Knex.Transaction;
const { keys } = options;
await tx<DbRefreshStateRow>('refresh_state')
.whereIn('entity_id', function selectEntityRefs(tx2) {
tx2
.whereIn('key', keys)
.select({
entity_id: 'refresh_keys.entity_id',
})
.from('refresh_keys');
})
.update({ next_update_at: tx.fn.now() });
}
async transaction<T>(fn: (tx: Transaction) => Promise<T>): Promise<T> {
try {
let result: T | undefined = undefined;
@@ -43,6 +43,11 @@ export type DbRefreshStateRow = {
location_key?: string;
};
export type DbRefreshKeysRow = {
entity_id: string;
key: string;
};
export type DbRefreshStateReferencesRow = {
source_key?: string;
source_entity_ref?: string;
+10 -2
View File
@@ -17,9 +17,12 @@
import { Entity } from '@backstage/catalog-model';
import { JsonObject } from '@backstage/types';
import { DateTime } from 'luxon';
import { EntityRelationSpec } from '../api';
import { DeferredEntity } from '../processing/types';
import {
EntityRelationSpec,
DeferredEntity,
} from '@backstage/plugin-catalog-node';
import { DbRelationsRow } from './tables';
import { RefreshKeyData } from '../processing/types';
/**
* An abstraction for transactions of the underlying database technology.
@@ -38,6 +41,7 @@ export type UpdateProcessedEntityOptions = {
relations: EntityRelationSpec[];
deferredEntities: DeferredEntity[];
locationKey?: string;
refreshKeys: RefreshKeyData[];
};
export type UpdateEntityCacheOptions = {
@@ -81,6 +85,10 @@ export type ReplaceUnprocessedEntitiesOptions =
type: 'delta';
};
export type RefreshByKeyOptions = {
keys: string[];
};
export type RefreshOptions = {
entityRef: string;
};
+20 -1
View File
@@ -20,7 +20,26 @@
* @packageDocumentation
*/
export * from './api';
export type {
DeferredEntity,
LocationSpec,
EntityRelationSpec,
CatalogProcessor,
CatalogProcessorParser,
CatalogProcessorCache,
CatalogProcessorEmit,
CatalogProcessorLocationResult,
CatalogProcessorEntityResult,
CatalogProcessorRelationResult,
CatalogProcessorErrorResult,
CatalogProcessorRefreshKeysResult,
CatalogProcessorResult,
EntityProvider,
EntityProviderConnection,
EntityProviderMutation,
} from '@backstage/plugin-catalog-node';
export { processingResult } from '@backstage/plugin-catalog-node';
export * from './catalog';
export * from './ingestion';
export * from './modules';
@@ -17,7 +17,7 @@
import { Entity } from '@backstage/catalog-model';
import { ConfigReader } from '@backstage/config';
import { DefaultCatalogRulesEnforcer } from './CatalogRules';
import { LocationSpec } from '../api';
import { LocationSpec } from '@backstage/plugin-catalog-node';
const entity = {
user: {
@@ -17,7 +17,7 @@
import { Config } from '@backstage/config';
import { Entity } from '@backstage/catalog-model';
import path from 'path';
import { LocationSpec } from '../api';
import { LocationSpec } from '@backstage/plugin-catalog-node';
/**
* Rules to apply to catalog entities.
@@ -16,7 +16,7 @@
import { Entity } from '@backstage/catalog-model';
import { RecursivePartial } from '../util/RecursivePartial';
import { LocationSpec } from '../api';
import { LocationSpec } from '@backstage/plugin-catalog-node';
/** @public */
export type LocationAnalyzer = {
@@ -17,7 +17,7 @@
import { getVoidLogger } from '@backstage/backend-common';
import { ConfigReader } from '@backstage/config';
import { CodeOwnersProcessor } from './CodeOwnersProcessor';
import { LocationSpec } from '../../api';
import { LocationSpec } from '@backstage/plugin-catalog-node';
const mockCodeOwnersText = () => `
* @acme/team-foo @acme/team-bar
@@ -22,7 +22,7 @@ import {
ScmIntegrations,
} from '@backstage/integration';
import { Logger } from 'winston';
import { CatalogProcessor, LocationSpec } from '../../api';
import { CatalogProcessor, LocationSpec } from '@backstage/plugin-catalog-node';
import { findCodeOwnerByTarget } from './lib';
const ALLOWED_KINDS = ['API', 'Component', 'Domain', 'Resource', 'System'];
@@ -17,7 +17,7 @@
import { Entity } from '@backstage/catalog-model';
import { ConfigReader } from '@backstage/config';
import { ScmIntegrations } from '@backstage/integration';
import { LocationSpec } from '../../api';
import { LocationSpec } from '@backstage/plugin-catalog-node';
import { AnnotateLocationEntityProcessor } from './AnnotateLocationEntityProcessor';
describe('AnnotateLocationEntityProcessor', () => {
@@ -29,7 +29,7 @@ import {
CatalogProcessor,
CatalogProcessorEmit,
LocationSpec,
} from '../../api';
} from '@backstage/plugin-catalog-node';
/** @public */
export class AnnotateLocationEntityProcessor implements CatalogProcessor {
@@ -16,7 +16,7 @@
import { Entity } from '@backstage/catalog-model';
import { ConfigReader } from '@backstage/config';
import { AnnotateScmSlugEntityProcessor } from './AnnotateScmSlugEntityProcessor';
import { LocationSpec } from '../../api';
import { LocationSpec } from '@backstage/plugin-catalog-node';
describe('AnnotateScmSlugEntityProcessor', () => {
describe('github', () => {
@@ -21,7 +21,7 @@ import {
} from '@backstage/integration';
import parseGitUrl from 'git-url-parse';
import { identity, merge, pickBy } from 'lodash';
import { CatalogProcessor, LocationSpec } from '../../api';
import { CatalogProcessor, LocationSpec } from '@backstage/plugin-catalog-node';
const GITHUB_ACTIONS_ANNOTATION = 'github.com/project-slug';
const GITLAB_ACTIONS_ANNOTATION = 'gitlab.com/project-slug';
@@ -53,7 +53,7 @@ import {
CatalogProcessorEmit,
LocationSpec,
processingResult,
} from '../../api';
} from '@backstage/plugin-catalog-node';
/** @public */
export class BuiltinKindsEntityProcessor implements CatalogProcessor {
@@ -17,7 +17,7 @@
import { ConfigReader } from '@backstage/config';
import path from 'path';
import { ConfigLocationEntityProvider } from './ConfigLocationEntityProvider';
import { EntityProviderConnection } from '../../api';
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
describe('ConfigLocationEntityProvider', () => {
it('should apply mutation with the correct paths in the config', async () => {
@@ -17,7 +17,10 @@
import { Config } from '@backstage/config';
import path from 'path';
import { getEntityLocationRef } from '../../processing/util';
import { EntityProvider, EntityProviderConnection } from '../../api';
import {
EntityProvider,
EntityProviderConnection,
} from '@backstage/plugin-catalog-node';
import { locationSpecToLocationEntity } from '../../util/conversion';
export class ConfigLocationEntityProvider implements EntityProvider {
@@ -20,7 +20,10 @@ import { Knex } from 'knex';
import { v4 as uuid } from 'uuid';
import { DbLocationsRow } from '../../database/tables';
import { getEntityLocationRef } from '../../processing/util';
import { EntityProvider, EntityProviderConnection } from '../../api';
import {
EntityProvider,
EntityProviderConnection,
} from '@backstage/plugin-catalog-node';
import { locationSpecToLocationEntity } from '../../util/conversion';
import { LocationInput, LocationStore } from '../../service/types';
@@ -19,7 +19,7 @@ import {
CatalogProcessorEntityResult,
CatalogProcessorErrorResult,
CatalogProcessorResult,
} from '../../api';
} from '@backstage/plugin-catalog-node';
import path from 'path';
import { defaultEntityDataParser } from '../util/parse';
@@ -43,7 +43,10 @@ describe('FileReaderProcessor', () => {
expect(generated.type).toBe('entity');
expect(generated.location).toEqual(spec);
expect(generated.entity).toEqual({ kind: 'Component' });
expect(generated.entity).toEqual({
kind: 'Component',
metadata: { name: 'component-test' },
});
});
it('should fail load from file with error', async () => {
@@ -77,14 +80,24 @@ describe('FileReaderProcessor', () => {
defaultEntityDataParser,
);
expect(emit).toBeCalledTimes(2);
expect(emit.mock.calls[0][0].entity).toEqual({ kind: 'Component' });
expect(emit).toBeCalledTimes(4);
expect(emit.mock.calls[0][0].entity).toEqual({
kind: 'Component',
metadata: { name: 'component-test' },
});
expect(emit.mock.calls[0][0].location).toEqual({
type: 'file',
target: expect.stringMatching(/^[^*]*$/),
});
expect(emit.mock.calls[1][0].entity).toEqual({ kind: 'API' });
expect(emit.mock.calls[1][0].location).toEqual({
expect(emit.mock.calls[1][0].key).toContain('file:');
expect(emit.mock.calls[1][0].key).toContain(
path.join('fileReaderProcessor', 'component.yaml'),
);
expect(emit.mock.calls[2][0].entity).toEqual({
kind: 'API',
metadata: { name: 'api-test' },
});
expect(emit.mock.calls[2][0].location).toEqual({
type: 'file',
target: expect.stringMatching(/^[^*]*$/),
});
@@ -24,10 +24,12 @@ import {
CatalogProcessorParser,
LocationSpec,
processingResult,
} from '../../api';
} from '@backstage/plugin-catalog-node';
const glob = promisify(g);
const LOCATION_TYPE = 'file';
/** @public */
export class FileReaderProcessor implements CatalogProcessor {
getProcessorName(): string {
@@ -40,7 +42,7 @@ export class FileReaderProcessor implements CatalogProcessor {
emit: CatalogProcessorEmit,
parser: CatalogProcessorParser,
): Promise<boolean> {
if (location.type !== 'file') {
if (location.type !== LOCATION_TYPE) {
return false;
}
@@ -50,17 +52,23 @@ export class FileReaderProcessor implements CatalogProcessor {
if (fileMatches.length > 0) {
for (const fileMatch of fileMatches) {
const data = await fs.readFile(fileMatch);
const normalizedFilePath = path.normalize(fileMatch);
// The normalize converts to native slashes; the glob library returns
// forward slashes even on windows
for await (const parseResult of parser({
data: data,
location: {
type: 'file',
target: path.normalize(fileMatch),
type: LOCATION_TYPE,
target: normalizedFilePath,
},
})) {
emit(parseResult);
emit(
processingResult.refresh(
`${LOCATION_TYPE}:${normalizedFilePath}`,
),
);
}
}
} else if (!optional) {
@@ -21,7 +21,7 @@ import {
} from '@backstage/integration';
import path from 'path';
import { toAbsoluteUrl } from './LocationEntityProcessor';
import { LocationSpec } from '../../api';
import { LocationSpec } from '@backstage/plugin-catalog-node';
describe('LocationEntityProcessor', () => {
describe('toAbsoluteUrl', () => {
@@ -22,7 +22,7 @@ import {
CatalogProcessor,
CatalogProcessorEmit,
LocationSpec,
} from '../../api';
} from '@backstage/plugin-catalog-node';
export function toAbsoluteUrl(
integrations: ScmIntegrationRegistry,
@@ -17,6 +17,7 @@ import { UrlReader } from '@backstage/backend-common';
import { Entity } from '@backstage/catalog-model';
import { ConfigReader } from '@backstage/config';
import { ScmIntegrations } from '@backstage/integration';
import { CatalogProcessorResult } from '@backstage/plugin-catalog-node';
import {
jsonPlaceholderResolver,
PlaceholderProcessor,
@@ -51,7 +52,7 @@ describe('PlaceholderProcessor', () => {
integrations,
});
await expect(
processor.preProcessEntity(input, { type: 't', target: 'l' }),
processor.preProcessEntity(input, { type: 't', target: 'l' }, () => {}),
).resolves.toBe(input);
});
@@ -76,6 +77,7 @@ describe('PlaceholderProcessor', () => {
spec: { a: [{ b: { $upper: 'text' } }] },
},
{ type: 'fake', target: 'http://example.com' },
() => {},
),
).resolves.toEqual({
apiVersion: 'a',
@@ -110,7 +112,7 @@ describe('PlaceholderProcessor', () => {
};
await expect(
processor.preProcessEntity(entity, { type: 'a', target: 'b' }),
processor.preProcessEntity(entity, { type: 'a', target: 'b' }, () => {}),
).resolves.toEqual(entity);
expect(read).not.toBeCalled();
@@ -131,7 +133,7 @@ describe('PlaceholderProcessor', () => {
};
await expect(
processor.preProcessEntity(entity, { type: 'a', target: 'b' }),
processor.preProcessEntity(entity, { type: 'a', target: 'b' }, () => {}),
).resolves.toEqual(entity);
expect(read).not.toBeCalled();
@@ -158,6 +160,7 @@ describe('PlaceholderProcessor', () => {
target:
'https://github.com/backstage/backstage/a/b/catalog-info.yaml',
},
() => {},
),
).resolves.toEqual({
apiVersion: 'a',
@@ -194,6 +197,7 @@ describe('PlaceholderProcessor', () => {
target:
'https://github.com/backstage/backstage/a/b/catalog-info.yaml',
},
() => {},
),
).resolves.toEqual({
apiVersion: 'a',
@@ -228,6 +232,7 @@ describe('PlaceholderProcessor', () => {
target:
'https://github.com/backstage/backstage/a/b/catalog-info.yaml',
},
() => {},
),
).resolves.toEqual({
apiVersion: 'a',
@@ -266,6 +271,7 @@ describe('PlaceholderProcessor', () => {
target:
'https://github.com/backstage/backstage/a/b/catalog-info.yaml',
},
() => {},
),
).resolves.toEqual({
apiVersion: 'a',
@@ -303,6 +309,7 @@ describe('PlaceholderProcessor', () => {
type: 'url',
target: './a/b/catalog-info.yaml',
},
() => {},
),
).resolves.toEqual({
apiVersion: 'a',
@@ -343,6 +350,7 @@ describe('PlaceholderProcessor', () => {
type: 'url',
target: './a/b/catalog-info.yaml',
},
() => {},
),
).rejects.toThrow(
/^Placeholder \$text could not form a URL out of \.\/a\/b\/catalog-info\.yaml and \.\.\/c\/catalog-info\.yaml, TypeError \[ERR_INVALID_URL\]/,
@@ -350,6 +358,35 @@ describe('PlaceholderProcessor', () => {
expect(read).not.toBeCalled();
});
it('should emit the resolverValue as a refreshKey', async () => {
read.mockResolvedValue(
Buffer.from(JSON.stringify({ a: ['b', 7] }), 'utf-8'),
);
const processor = new PlaceholderProcessor({
resolvers: {
json: jsonPlaceholderResolver,
},
reader,
integrations,
});
const emitted = new Array<CatalogProcessorResult>();
await processor.preProcessEntity(
{
apiVersion: 'a',
kind: 'k',
metadata: { name: 'n' },
spec: { a: [{ b: { $json: './path-to-file.json' } }] },
},
{ type: 'fake', target: 'http://example.com' },
result => emitted.push(result),
);
expect(emitted[0]).toEqual({
type: 'refresh',
key: 'url:http://example.com/path-to-file.json',
});
});
});
describe('yamlPlaceholderResolver', () => {
@@ -360,6 +397,7 @@ describe('yamlPlaceholderResolver', () => {
baseUrl: 'https://github.com/backstage/backstage/a/b/catalog-info.yaml',
read,
resolveUrl: (url, base) => integrations.resolveUrl({ url, base }),
emit: () => {},
};
beforeEach(() => {
@@ -376,7 +414,7 @@ describe('yamlPlaceholderResolver', () => {
it('rejects invalid yaml', async () => {
read.mockResolvedValue(Buffer.from('a: 1\n----\n', 'utf-8'));
await expect(yamlPlaceholderResolver(params)).rejects.toThrow(
'Placeholder $a found an error in the data at ./file.yaml, YAMLSemanticError: Implicit map keys need to be followed by map values',
/Placeholder \$a found an error in the data at .\/file.yaml, YAMLParseError: Implicit map keys need to be followed by map values at line 2, column 1:\s+a: 1/,
);
});
@@ -405,6 +443,7 @@ describe('jsonPlaceholderResolver', () => {
baseUrl: 'https://github.com/backstage/backstage/a/b/catalog-info.yaml',
read,
resolveUrl: (url, base) => integrations.resolveUrl({ url, base }),
emit: () => {},
};
beforeEach(() => {
@@ -19,7 +19,12 @@ import { Entity } from '@backstage/catalog-model';
import { JsonValue } from '@backstage/types';
import { ScmIntegrationRegistry } from '@backstage/integration';
import yaml from 'yaml';
import { CatalogProcessor, LocationSpec } from '../../api';
import {
CatalogProcessor,
CatalogProcessorEmit,
LocationSpec,
processingResult,
} from '@backstage/plugin-catalog-node';
/** @public */
export type PlaceholderResolverRead = (url: string) => Promise<Buffer>;
@@ -37,6 +42,7 @@ export type PlaceholderResolverParams = {
baseUrl: string;
read: PlaceholderResolverRead;
resolveUrl: PlaceholderResolverResolveUrl;
emit: CatalogProcessorEmit;
};
/** @public */
@@ -66,6 +72,7 @@ export class PlaceholderProcessor implements CatalogProcessor {
async preProcessEntity(
entity: Entity,
location: LocationSpec,
emit: CatalogProcessorEmit,
): Promise<Entity> {
const process = async (data: any): Promise<[any, boolean]> => {
if (!data || !(data instanceof Object)) {
@@ -102,6 +109,7 @@ export class PlaceholderProcessor implements CatalogProcessor {
const resolverKey = keys[0].substr(1);
const resolverValue = data[keys[0]];
const resolver = this.options.resolvers[resolverKey];
if (!resolver || typeof resolverValue !== 'string') {
// If there was no such placeholder resolver or if the value was not a
@@ -134,6 +142,7 @@ export class PlaceholderProcessor implements CatalogProcessor {
baseUrl: location.target,
read,
resolveUrl,
emit,
}),
true,
];
@@ -151,11 +160,13 @@ export class PlaceholderProcessor implements CatalogProcessor {
export async function yamlPlaceholderResolver(
params: PlaceholderResolverParams,
): Promise<JsonValue> {
const text = await readTextLocation(params);
const { content, url } = await readTextLocation(params);
params.emit(processingResult.refresh(`url:${url}`));
let documents: yaml.Document.Parsed[];
try {
documents = yaml.parseAllDocuments(text).filter(d => d);
documents = yaml.parseAllDocuments(content).filter(d => d);
} catch (e) {
throw new Error(
`Placeholder \$${params.key} failed to parse YAML data at ${params.value}, ${e}`,
@@ -182,10 +193,12 @@ export async function yamlPlaceholderResolver(
export async function jsonPlaceholderResolver(
params: PlaceholderResolverParams,
): Promise<JsonValue> {
const text = await readTextLocation(params);
const { content, url } = await readTextLocation(params);
params.emit(processingResult.refresh(`url:${url}`));
try {
return JSON.parse(text);
return JSON.parse(content);
} catch (e) {
throw new Error(
`Placeholder \$${params.key} failed to parse JSON data at ${params.value}, ${e}`,
@@ -196,7 +209,11 @@ export async function jsonPlaceholderResolver(
export async function textPlaceholderResolver(
params: PlaceholderResolverParams,
): Promise<JsonValue> {
return await readTextLocation(params);
const { content, url } = await readTextLocation(params);
params.emit(processingResult.refresh(`url:${url}`));
return content;
}
/*
@@ -205,12 +222,12 @@ export async function textPlaceholderResolver(
async function readTextLocation(
params: PlaceholderResolverParams,
): Promise<string> {
): Promise<{ content: string; url: string }> {
const newUrl = relativeUrl(params);
try {
const data = await params.read(newUrl);
return data.toString('utf-8');
return { content: data.toString('utf-8'), url: newUrl };
} catch (e) {
throw new Error(
`Placeholder \$${params.key} could not read location ${params.value}, ${e}`,
@@ -28,7 +28,7 @@ import {
CatalogProcessorEntityResult,
CatalogProcessorErrorResult,
CatalogProcessorResult,
} from '../../api';
} from '@backstage/plugin-catalog-node';
import { defaultEntityDataParser } from '../util/parse';
import { UrlReaderProcessor } from './UrlReaderProcessor';
@@ -61,7 +61,13 @@ describe('UrlReaderProcessor', () => {
server.use(
rest.get(`${mockApiOrigin}/component.yaml`, (_, res, ctx) =>
res(ctx.set({ ETag: 'my-etag' }), ctx.json({ mock: 'entity' })),
res(
ctx.set({ ETag: 'my-etag' }),
ctx.json({
kind: 'component',
metadata: { name: 'mock-url-entity' },
}),
),
),
);
@@ -74,15 +80,25 @@ describe('UrlReaderProcessor', () => {
mockCache,
);
expect(emitted.length).toBe(1);
expect(emitted.length).toBe(2);
expect(emitted[0]).toEqual({
type: 'entity',
location: spec,
entity: { mock: 'entity' },
entity: { kind: 'component', metadata: { name: 'mock-url-entity' } },
});
expect(emitted[1]).toEqual({
type: 'refresh',
key: 'url:http://localhost/component.yaml',
});
expect(mockCache.set).toBeCalledWith('v1', {
etag: 'my-etag',
value: [{ type: 'entity', location: spec, entity: { mock: 'entity' } }],
value: [
{
type: 'entity',
location: spec,
entity: { kind: 'component', metadata: { name: 'mock-url-entity' } },
},
],
});
expect(mockCache.set).toBeCalledTimes(1);
});
@@ -29,7 +29,7 @@ import {
CatalogProcessorResult,
LocationSpec,
processingResult,
} from '../../api';
} from '@backstage/plugin-catalog-node';
const CACHE_KEY = 'v1';
@@ -93,6 +93,8 @@ export class UrlReaderProcessor implements CatalogProcessor {
value: parseResults as CatalogProcessorEntityResult[],
});
}
emit(processingResult.refresh(`${location.type}:${location.target}`));
} catch (error) {
assertError(error);
const message = `Unable to read ${location.type}, ${error}`;
@@ -1 +1,3 @@
kind: Component
metadata:
name: component-test
@@ -1 +1,3 @@
kind: API
metadata:
name: api-test
@@ -15,7 +15,7 @@
*/
import { parseEntityYaml } from './parse';
import { processingResult } from '../../api';
import { processingResult } from '@backstage/plugin-catalog-node';
const testLoc = {
target: 'my-loc-target',
@@ -156,12 +156,16 @@ describe('parseEntityYaml', () => {
);
// Parse errors are always per document
expect(results).toEqual([
processingResult.generalError(
testLoc,
'YAML error at my-loc-type:my-loc-target, YAMLSemanticError: Plain value cannot start with reserved character `',
),
]);
expect(results.length).toBe(1);
expect(results[0]).toEqual({
type: 'error',
location: testLoc,
error: expect.objectContaining({
message: expect.stringMatching(
/YAML error at my-loc-type:my-loc-target, YAMLParseError: Plain value cannot start with reserved character ` at line 1, column 1:/,
),
}),
});
});
it('should emit parsing errors for individual documents', () => {
@@ -185,7 +189,8 @@ describe('parseEntityYaml', () => {
),
);
expect(results).toEqual([
expect(results.length).toBe(2);
expect(results[0]).toEqual(
processingResult.entity(testLoc, {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
@@ -196,11 +201,16 @@ describe('parseEntityYaml', () => {
type: 'website',
},
}),
processingResult.generalError(
testLoc,
'YAML error at my-loc-type:my-loc-target, YAMLSemanticError: Nested mappings are not allowed in compact mappings',
),
]);
);
expect(results[1]).toEqual({
type: 'error',
location: testLoc,
error: expect.objectContaining({
message: expect.stringMatching(
/YAML error at my-loc-type:my-loc-target, YAMLParseError: Nested mappings are not allowed in compact mappings at line 9, column 19:\s+apiVersion: backstage.io\/v1alpha1/,
),
}),
});
});
it('must be an object at root', () => {
@@ -22,7 +22,7 @@ import {
CatalogProcessorResult,
LocationSpec,
processingResult,
} from '../../api';
} from '@backstage/plugin-catalog-node';
/** @public */
export function* parseEntityYaml(

Some files were not shown because too many files have changed in this diff Show More