delete the graphql backend and catalog graphql plugin

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-11-17 11:42:35 +01:00
parent bf65f1c80f
commit 816d331d16
31 changed files with 238 additions and 5058 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-api-docs': patch
---
Add dependency on `graphql-config` to compensate for `graphql-language-service` needing it but not shipping the dep properly
-2
View File
@@ -106,7 +106,6 @@
"@backstage/plugin-catalog-backend-module-unprocessed": "0.3.4",
"@backstage/plugin-catalog-common": "1.0.18",
"@backstage/plugin-catalog-graph": "0.3.0",
"@backstage/plugin-catalog-graphql": "0.4.1",
"@backstage/plugin-catalog-import": "0.10.2",
"@backstage/plugin-catalog-node": "1.5.0",
"@backstage/plugin-catalog-react": "1.9.0",
@@ -158,7 +157,6 @@
"@backstage/plugin-gitops-profiles": "0.3.42",
"@backstage/plugin-gocd": "0.1.32",
"@backstage/plugin-graphiql": "0.3.0",
"@backstage/plugin-graphql-backend": "0.2.1",
"@backstage/plugin-graphql-voyager": "0.1.9",
"@backstage/plugin-home": "0.5.10",
"@backstage/plugin-home-react": "0.1.5",
-1
View File
@@ -49,7 +49,6 @@
"@backstage/plugin-events-backend": "workspace:^",
"@backstage/plugin-events-node": "workspace:^",
"@backstage/plugin-explore-backend": "workspace:^",
"@backstage/plugin-graphql-backend": "workspace:^",
"@backstage/plugin-jenkins-backend": "workspace:^",
"@backstage/plugin-kafka-backend": "workspace:^",
"@backstage/plugin-kubernetes-backend": "workspace:^",
+1
View File
@@ -47,6 +47,7 @@
"@types/react": "^16.13.1 || ^17.0.0",
"graphiql": "3.0.9",
"graphql": "^16.0.0",
"graphql-config": "^5.0.2",
"graphql-ws": "^5.4.1",
"isomorphic-form-data": "^2.0.0",
"react-use": "^17.2.4",
-1
View File
@@ -1 +0,0 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
-711
View File
@@ -1,711 +0,0 @@
# @backstage/plugin-catalog-graphql
## 0.4.1
### Patch Changes
- 6c2b872153: Add official support for React 18.
- Updated dependencies
- @backstage/catalog-model@1.4.3
- @backstage/config@1.1.1
- @backstage/types@1.1.1
## 0.4.1-next.0
### Patch Changes
- 6c2b872153: Add official support for React 18.
- Updated dependencies
- @backstage/catalog-model@1.4.3
- @backstage/config@1.1.1
- @backstage/types@1.1.1
## 0.4.0
### Minor Changes
- 9def1e95ab: This package has been deprecated, consider using [@frontside/backstage-plugin-graphql-backend](https://www.npmjs.com/package/@frontside/backstage-plugin-graphql-backend) instead.
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.4.3
- @backstage/config@1.1.1
- @backstage/types@1.1.1
## 0.3.24-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.4.3-next.0
- @backstage/config@1.1.1-next.0
- @backstage/types@1.1.1
## 0.3.23
### Patch Changes
- Updated dependencies
- @backstage/config@1.1.0
- @backstage/catalog-model@1.4.2
- @backstage/types@1.1.1
## 0.3.23-next.2
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.4.2-next.2
- @backstage/config@1.1.0-next.2
- @backstage/types@1.1.1-next.0
## 0.3.23-next.1
### Patch Changes
- Updated dependencies
- @backstage/config@1.1.0-next.1
- @backstage/catalog-model@1.4.2-next.1
- @backstage/types@1.1.0
## 0.3.23-next.0
### Patch Changes
- Updated dependencies
- @backstage/config@1.1.0-next.0
- @backstage/catalog-model@1.4.2-next.0
- @backstage/types@1.1.0
## 0.3.22
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.4.1
- @backstage/config@1.0.8
- @backstage/types@1.1.0
## 0.3.22-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.4.1-next.0
- @backstage/config@1.0.8
- @backstage/types@1.1.0
## 0.3.21
### Patch Changes
- Updated dependencies
- @backstage/types@1.1.0
- @backstage/catalog-model@1.4.0
- @backstage/config@1.0.8
## 0.3.21-next.1
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.4.0-next.1
- @backstage/config@1.0.7
- @backstage/types@1.0.2
## 0.3.21-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.4.0-next.0
- @backstage/config@1.0.7
- @backstage/types@1.0.2
## 0.3.20
### Patch Changes
- e47e69eadf0: Updated dependency `@apollo/server` to `^4.0.0`.
- e0c6e8b9c3c: Update peer dependencies
- Updated dependencies
- @backstage/catalog-model@1.3.0
- @backstage/config@1.0.7
- @backstage/types@1.0.2
## 0.3.20-next.2
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.3.0-next.0
- @backstage/config@1.0.7
- @backstage/types@1.0.2
## 0.3.20-next.1
### Patch Changes
- e0c6e8b9c3c: Update peer dependencies
- Updated dependencies
- @backstage/catalog-model@1.2.1
- @backstage/config@1.0.7
- @backstage/types@1.0.2
## 0.3.20-next.0
### Patch Changes
- e47e69eadf0: Updated dependency `@apollo/server` to `^4.0.0`.
- Updated dependencies
- @backstage/config@1.0.7
- @backstage/catalog-model@1.2.1
- @backstage/types@1.0.2
## 0.3.19
### Patch Changes
- b990021ddeb: Updated dependency `@graphql-codegen/cli` to `^3.0.0`.
Updated dependency `@graphql-codegen/graphql-modules-preset` to `^3.0.0`.
Updated dependency `@graphql-codegen/typescript` to `^3.0.0`.
Updated dependency `@graphql-codegen/typescript-resolvers` to `^3.0.0`.
- 52b0022dab7: Updated dependency `msw` to `^1.0.0`.
- Updated dependencies
- @backstage/catalog-model@1.2.1
- @backstage/config@1.0.7
- @backstage/types@1.0.2
## 0.3.19-next.1
### Patch Changes
- b990021ddeb: Updated dependency `@graphql-codegen/cli` to `^3.0.0`.
Updated dependency `@graphql-codegen/graphql-modules-preset` to `^3.0.0`.
Updated dependency `@graphql-codegen/typescript` to `^3.0.0`.
Updated dependency `@graphql-codegen/typescript-resolvers` to `^3.0.0`.
- 52b0022dab7: Updated dependency `msw` to `^1.0.0`.
- Updated dependencies
- @backstage/config@1.0.7-next.0
- @backstage/catalog-model@1.2.1-next.1
- @backstage/types@1.0.2
## 0.3.19-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.2.1-next.0
- @backstage/config@1.0.6
- @backstage/types@1.0.2
## 0.3.18
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.2.0
- @backstage/config@1.0.6
- @backstage/types@1.0.2
## 0.3.18-next.1
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.2.0-next.1
- @backstage/config@1.0.6
- @backstage/types@1.0.2
## 0.3.18-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.6-next.0
## 0.3.17
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.5
- @backstage/config@1.0.6
- @backstage/types@1.0.2
## 0.3.17-next.1
### Patch Changes
- Updated dependencies
- @backstage/config@1.0.6-next.0
- @backstage/catalog-model@1.1.5-next.1
- @backstage/types@1.0.2
## 0.3.17-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.5-next.0
- @backstage/config@1.0.5
- @backstage/types@1.0.2
## 0.3.16
### Patch Changes
- 3280711113: Updated dependency `msw` to `^0.49.0`.
- Updated dependencies
- @backstage/types@1.0.2
- @backstage/catalog-model@1.1.4
- @backstage/config@1.0.5
## 0.3.16-next.1
### Patch Changes
- Updated dependencies
- @backstage/types@1.0.2-next.1
- @backstage/config@1.0.5-next.1
- @backstage/catalog-model@1.1.4-next.1
## 0.3.16-next.0
### Patch Changes
- 3280711113: Updated dependency `msw` to `^0.49.0`.
- Updated dependencies
- @backstage/types@1.0.2-next.0
- @backstage/catalog-model@1.1.4-next.0
- @backstage/config@1.0.5-next.0
## 0.3.15
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.3
- @backstage/types@1.0.1
- @backstage/config@1.0.4
## 0.3.15-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.3-next.0
- @backstage/types@1.0.1-next.0
- @backstage/config@1.0.4-next.0
## 0.3.14
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.2
- @backstage/config@1.0.3
- @backstage/types@1.0.0
## 0.3.14-next.2
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.2-next.2
- @backstage/config@1.0.3-next.2
- @backstage/types@1.0.0
## 0.3.14-next.1
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.2-next.1
- @backstage/config@1.0.3-next.1
- @backstage/types@1.0.0
## 0.3.14-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.2-next.0
- @backstage/config@1.0.3-next.0
- @backstage/types@1.0.0
## 0.3.13
### Patch Changes
- d669d89206: Minor API signatures cleanup
- 667d917488: Updated dependency `msw` to `^0.47.0`.
- 87ec2ba4d6: Updated dependency `msw` to `^0.46.0`.
- bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
- Updated dependencies
- @backstage/catalog-model@1.1.1
- @backstage/config@1.0.2
## 0.3.13-next.3
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.1-next.0
- @backstage/config@1.0.2-next.0
## 0.3.13-next.2
### Patch Changes
- 667d917488: Updated dependency `msw` to `^0.47.0`.
- 87ec2ba4d6: Updated dependency `msw` to `^0.46.0`.
## 0.3.13-next.1
### Patch Changes
- d669d89206: Minor API signatures cleanup
## 0.3.13-next.0
### Patch Changes
- bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
## 0.3.12
### Patch Changes
- fa3eeee92d: Updated dependency `@graphql-tools/schema` to `^9.0.0`.
## 0.3.11
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 8006d0f9bf: Updated dependency `msw` to `^0.44.0`.
- Updated dependencies
- @backstage/catalog-model@1.1.0
## 0.3.11-next.1
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/catalog-model@1.1.0-next.3
## 0.3.11-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.1.0-next.0
## 0.3.10
### Patch Changes
- 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
- Updated dependencies
- @backstage/catalog-model@1.0.3
## 0.3.10-next.0
### Patch Changes
- 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
- Updated dependencies
- @backstage/catalog-model@1.0.3-next.0
## 0.3.9
### Patch Changes
- Updated dependencies
- @backstage/config@1.0.1
- @backstage/catalog-model@1.0.2
## 0.3.9-next.0
### Patch Changes
- Updated dependencies
- @backstage/config@1.0.1-next.0
- @backstage/catalog-model@1.0.2-next.0
## 0.3.8
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.0.1
## 0.3.8-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@1.0.1-next.0
## 0.3.7
### Patch Changes
- 02ad19d189: Do not use `metadata.generation` from entity data
- Updated dependencies
- @backstage/catalog-model@1.0.0
- @backstage/config@1.0.0
- @backstage/types@1.0.0
## 0.3.6
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@0.13.0
## 0.3.6-next.0
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@0.13.0-next.0
## 0.3.5
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@0.12.0
## 0.3.4
### Patch Changes
- 68913af4ff: chore(deps): bump `graphql-modules` from 1.4.4 to 2.0.0
- Updated dependencies
- @backstage/catalog-model@0.11.0
## 0.3.3
### Patch Changes
- Fix for the previous release with missing type declarations.
- Updated dependencies
- @backstage/catalog-model@0.10.1
- @backstage/config@0.1.15
- @backstage/types@0.1.3
## 0.3.2
### Patch Changes
- 1ed305728b: Bump `node-fetch` to version 2.6.7 and `cross-fetch` to version 3.1.5
- c77c5c7eb6: Added `backstage.role` to `package.json`
- Updated dependencies
- @backstage/catalog-model@0.10.0
- @backstage/config@0.1.14
- @backstage/types@0.1.2
## 0.3.1
### Patch Changes
- Updated dependencies
- @backstage/config@0.1.13
- @backstage/catalog-model@0.9.10
## 0.3.1-next.0
### Patch Changes
- Updated dependencies
- @backstage/config@0.1.13-next.0
- @backstage/catalog-model@0.9.10-next.0
## 0.3.0
### Minor Changes
- 0fb17da164: chore: bumping dependencies in the GraphQL modules and bringing them up to date with the latest `graphql-modules` library
### Patch Changes
- cf01627a33: Bump graphql versions
- Updated dependencies
- @backstage/config@0.1.12
- @backstage/catalog-model@0.9.9
## 0.2.14
### Patch Changes
- 6b500622d5: Move to using node-fetch internally instead of cross-fetch
## 0.2.13
### Patch Changes
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/catalog-model@0.9.6
## 0.2.12
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.9.0
- @backstage/config@0.1.8
## 0.2.11
### Patch Changes
- Updated dependencies
- @backstage/catalog-model@0.9.0
- @backstage/backend-common@0.8.5
## 0.2.10
### Patch Changes
- Updated dependencies [add62a455]
- Updated dependencies [704875e26]
- @backstage/catalog-model@0.8.0
## 0.2.9
### Patch Changes
- 3be844496: chore: bump `ts-node` versions to 9.1.1
- Updated dependencies [22fd8ce2a]
- Updated dependencies [10c008a3a]
- Updated dependencies [f9fb4a205]
- Updated dependencies [16be1d093]
- @backstage/backend-common@0.8.0
- @backstage/catalog-model@0.7.9
## 0.2.8
### Patch Changes
- Updated dependencies [e0bfd3d44]
- Updated dependencies [38ca05168]
- Updated dependencies [d8b81fd28]
- @backstage/backend-common@0.7.0
- @backstage/catalog-model@0.7.8
- @backstage/config@0.1.5
## 0.2.7
### Patch Changes
- Updated dependencies [8686eb38c]
- Updated dependencies [0434853a5]
- Updated dependencies [8686eb38c]
- @backstage/backend-common@0.6.0
- @backstage/config@0.1.4
## 0.2.6
### Patch Changes
- Updated dependencies [def2307f3]
- Updated dependencies [0b135e7e0]
- Updated dependencies [294a70cab]
- Updated dependencies [0ea032763]
- Updated dependencies [5345a1f98]
- Updated dependencies [09a370426]
- Updated dependencies [a93f42213]
- @backstage/catalog-model@0.7.0
- @backstage/backend-common@0.5.0
## 0.2.5
### Patch Changes
- Updated dependencies [c911061b7]
- Updated dependencies [1d1c2860f]
- Updated dependencies [0e6298f7e]
- Updated dependencies [4eafdec4a]
- Updated dependencies [ac3560b42]
- @backstage/catalog-model@0.6.0
- @backstage/backend-common@0.4.1
## 0.2.4
### Patch Changes
- Updated dependencies [38e24db00]
- Updated dependencies [e3bd9fc2f]
- Updated dependencies [12bbd748c]
- Updated dependencies [83b6e0c1f]
- Updated dependencies [e3bd9fc2f]
- @backstage/backend-common@0.4.0
- @backstage/config@0.1.2
- @backstage/catalog-model@0.5.0
## 0.2.3
### Patch Changes
- Updated dependencies [612368274]
- Updated dependencies [08835a61d]
- Updated dependencies [a9fd599f7]
- Updated dependencies [bcc211a08]
- @backstage/backend-common@0.3.3
- @backstage/catalog-model@0.4.0
## 0.2.2
### Patch Changes
- Updated dependencies [1166fcc36]
- Updated dependencies [bff3305aa]
- Updated dependencies [1185919f3]
- Updated dependencies [b47dce06f]
- @backstage/catalog-model@0.3.0
- @backstage/backend-common@0.3.1
## 0.2.1
### Patch Changes
- Updated dependencies [1722cb53c]
- Updated dependencies [1722cb53c]
- Updated dependencies [7b37e6834]
- Updated dependencies [8e2effb53]
- @backstage/backend-common@0.3.0
## 0.2.0
### Minor Changes
- 28edd7d29: Create backend plugin through CLI
### Patch Changes
- Updated dependencies [3a4236570]
- Updated dependencies [e0be86b6f]
- Updated dependencies [f70a52868]
- Updated dependencies [12b5fe940]
- Updated dependencies [5249594c5]
- Updated dependencies [56e4eb589]
- Updated dependencies [e37c0a005]
- Updated dependencies [a768a07fb]
- Updated dependencies [f00ca3cb8]
- Updated dependencies [6579769df]
- Updated dependencies [5adfc005e]
- Updated dependencies [8c2b76e45]
- Updated dependencies [440a17b39]
- Updated dependencies [fa56f4615]
- Updated dependencies [8afce088a]
- Updated dependencies [b3d57961c]
- Updated dependencies [7bbeb049f]
- @backstage/catalog-model@0.2.0
- @backstage/backend-common@0.2.0
-3
View File
@@ -1,3 +0,0 @@
# Catalog GraphQL Plugin
This package has been deprecated, consider using [@frontside/backstage-plugin-graphql-backend](https://www.npmjs.com/package/@frontside/backstage-plugin-graphql-backend) instead.
-20
View File
@@ -1,20 +0,0 @@
## API Report File for "@backstage/plugin-catalog-graphql"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { Config } from '@backstage/config';
import { Logger } from 'winston';
import { Module } from 'graphql-modules';
// @public (undocumented)
export function createModule(options: ModuleOptions): Promise<Module>;
// @public (undocumented)
export interface ModuleOptions {
// (undocumented)
config: Config;
// (undocumented)
logger: Logger;
}
```
-10
View File
@@ -1,10 +0,0 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: backstage-plugin-catalog-graphql
title: '@backstage/plugin-catalog-graphql'
description: An experimental Backstage catalog GraphQL module
spec:
lifecycle: experimental
type: backstage-backend-plugin
owner: catalog-maintainers
-14
View File
@@ -1,14 +0,0 @@
overwrite: true
generates:
./src/graphql/types.ts:
schema: ./src/schema.js
plugins:
- typescript
- typescript-resolvers
hooks:
afterOneFileWrite:
- eslint --fix
config:
allowParentTypeOverride: true
useIndexSignature: true
defaultMapper: Partial<{T}>
-68
View File
@@ -1,68 +0,0 @@
{
"name": "@backstage/plugin-catalog-graphql",
"description": "Deprecated, consider using @frontside/backstage-plugin-graphql-backend instead",
"version": "0.4.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "backend-plugin"
},
"homepage": "https://backstage.io",
"repository": {
"type": "git",
"url": "https://github.com/backstage/backstage",
"directory": "plugins/catalog-graphql"
},
"keywords": [
"backstage",
"graphql"
],
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack",
"generate:types": "graphql-codegen",
"clean": "backstage-cli package clean"
},
"dependencies": {
"@apollo/client": "^3.0.0",
"@apollo/server": "^4.0.0",
"@backstage/catalog-model": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/types": "workspace:^",
"graphql": "^16.0.0",
"graphql-modules": "^2.0.0",
"graphql-tag": "^2.11.0",
"graphql-type-json": "^0.3.2",
"node-fetch": "^2.6.7",
"winston": "^3.2.1"
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
},
"devDependencies": {
"@backstage/cli": "workspace:^",
"@backstage/test-utils": "workspace:^",
"@graphql-codegen/cli": "^3.0.0",
"@graphql-codegen/graphql-modules-preset": "^3.0.0",
"@graphql-codegen/typescript": "^3.0.0",
"@graphql-codegen/typescript-resolvers": "^3.0.0",
"@graphql-tools/schema": "^9.0.0",
"@types/react": "^16.13.1 || ^17.0.0",
"msw": "^1.0.0"
},
"files": [
"dist"
]
}
@@ -1,314 +0,0 @@
/*
* Copyright 2020 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.
*/
import { createModule } from './module';
import { makeExecutableSchema } from '@graphql-tools/schema';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { ConfigReader } from '@backstage/config';
import { ReaderEntity } from '../service/client';
import { createLogger } from 'winston';
import { setupRequestMockHandlers } from '@backstage/test-utils';
import { gql } from '@apollo/client';
import { Module, createApplication, testkit } from 'graphql-modules';
describe('Catalog Module', () => {
const worker = setupServer();
const mockCatalogBaseUrl = 'http://im.mock';
const mockConfig = new ConfigReader({
backend: {
baseUrl: mockCatalogBaseUrl,
},
});
const createMockApplication = (module: Module) => {
const application = createApplication({
modules: [module],
schemaBuilder(input) {
return makeExecutableSchema({
...input,
inheritResolversFromInterfaces: true,
});
},
});
return application;
};
setupRequestMockHandlers(worker);
describe('Default Entity', () => {
beforeEach(() => {
const mockResponse: ReaderEntity[] = [
{
apiVersion: 'something',
kind: 'Component',
metadata: {
annotations: {},
etag: '123',
labels: {},
name: 'Ben',
namespace: 'Blames',
uid: '123',
},
spec: {
type: 'thing',
lifecycle: 'something',
owner: 'auser',
},
},
];
worker.use(
rest.get(`${mockCatalogBaseUrl}/api/catalog/entities`, (_, res, ctx) =>
res(ctx.status(200), ctx.json(mockResponse)),
),
);
});
it('should call the catalog client when requesting entities', async () => {
const app = createMockApplication(
await createModule({
config: mockConfig,
logger: createLogger(),
}),
);
const result = await testkit.execute(app, {
document: gql`
query {
catalog {
list {
kind
apiVersion
metadata {
name
}
}
}
}
`,
});
const [catalogItem] = result.data?.catalog.list;
expect(catalogItem.kind).toBe('Component');
expect(catalogItem.apiVersion).toBe('something');
expect(catalogItem.metadata.name).toBe('Ben');
});
it('Defaults to empty annotations when none are provided', async () => {
const mockResponse: ReaderEntity[] = [
{
apiVersion: 'something',
kind: 'Component',
metadata: {
annotations: null as any,
etag: '123',
labels: {},
name: 'Ben',
namespace: 'Blames',
uid: '123',
},
spec: {
type: 'thing',
lifecycle: 'something',
owner: 'auser',
},
},
];
worker.use(
rest.get(`${mockCatalogBaseUrl}/api/catalog/entities`, (_, res, ctx) =>
res(ctx.status(200), ctx.json(mockResponse)),
),
);
const app = createMockApplication(
await createModule({
config: mockConfig,
logger: createLogger(),
}),
);
const result = await testkit.execute(app, {
document: gql`
query {
catalog {
list {
metadata {
annotations
}
}
}
}
`,
});
const [catalogItem] = result.data?.catalog.list;
expect(catalogItem.metadata.annotations).toEqual({});
});
it('Defaults to empty labels when none are provided', async () => {
const mockResponse: ReaderEntity[] = [
{
apiVersion: 'something',
kind: 'Component',
metadata: {
annotations: {},
etag: '123',
labels: null as any,
name: 'Ben',
namespace: 'Blames',
uid: '123',
},
spec: {
type: 'thing',
lifecycle: 'something',
owner: 'auser',
},
},
];
worker.use(
rest.get(`${mockCatalogBaseUrl}/api/catalog/entities`, (_, res, ctx) =>
res(ctx.status(200), ctx.json(mockResponse)),
),
);
const app = createMockApplication(
await createModule({
config: mockConfig,
logger: createLogger(),
}),
);
const result = await testkit.execute(app, {
document: gql`
query {
catalog {
list {
metadata {
labels
}
}
}
}
`,
});
const [catalogItem] = result.data?.catalog.list;
expect(catalogItem.metadata.labels).toEqual({});
});
it('Returns the correct record from the annotation dictionary', async () => {
const mockResponse: ReaderEntity[] = [
{
apiVersion: 'something',
kind: 'Component',
metadata: {
annotations: { lob: 'bloben' },
etag: '123',
labels: {},
name: 'Ben',
namespace: 'Blames',
uid: '123',
},
spec: {
type: 'thing',
lifecycle: 'something',
owner: 'auser',
},
},
];
worker.use(
rest.get(`${mockCatalogBaseUrl}/api/catalog/entities`, (_, res, ctx) =>
res(ctx.status(200), ctx.json(mockResponse)),
),
);
const app = createMockApplication(
await createModule({
config: mockConfig,
logger: createLogger(),
}),
);
const result = await testkit.execute(app, {
document: gql`
query {
catalog {
list {
metadata {
test: annotation(name: "lob")
}
}
}
}
`,
});
const [catalogItem] = result.data?.catalog.list;
expect(catalogItem.metadata.test).toEqual('bloben');
});
it('Returns the correct record from the labels dictionary', async () => {
const mockResponse: ReaderEntity[] = [
{
apiVersion: 'something',
kind: 'Component',
metadata: {
annotations: {},
etag: '123',
labels: { lob2: 'bloben' },
name: 'Ben',
namespace: 'Blames',
uid: '123',
},
spec: {
type: 'thing',
lifecycle: 'something',
owner: 'auser',
},
},
];
worker.use(
rest.get(`${mockCatalogBaseUrl}/api/catalog/entities`, (_, res, ctx) =>
res(ctx.status(200), ctx.json(mockResponse)),
),
);
const app = createMockApplication(
await createModule({
config: mockConfig,
logger: createLogger(),
}),
);
const result = await testkit.execute(app, {
document: gql`
query {
catalog {
list {
metadata {
test: label(name: "lob2")
}
}
}
}
`,
});
const [catalogItem] = result.data?.catalog.list;
expect(catalogItem.metadata.test).toEqual('bloben');
});
});
});
@@ -1,106 +0,0 @@
/*
* Copyright 2020 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.
*/
import { Logger } from 'winston';
import {
createModule as createGraphQLModule,
Module,
gql,
} from 'graphql-modules';
import { Resolvers, CatalogQuery } from './types';
import { Config } from '@backstage/config';
import { CatalogClient } from '../service/client';
import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';
import { Entity } from '@backstage/catalog-model';
import typeDefs from '../schema';
/** @public */
export interface ModuleOptions {
logger: Logger;
config: Config;
}
/** @public */
export async function createModule(options: ModuleOptions): Promise<Module> {
const catalogClient = new CatalogClient(
options.config.getString('backend.baseUrl'),
);
const resolvers: Resolvers = {
JSON: GraphQLJSON,
JSONObject: GraphQLJSONObject,
DefaultEntitySpec: {
raw: rootValue => {
const { entity } = rootValue as { entity: Entity };
return entity.spec ?? null;
},
},
Query: {
catalog: () => ({} as CatalogQuery),
},
CatalogQuery: {
list: async () => {
return await catalogClient.list();
},
},
CatalogEntity: {
metadata: entity => ({ ...entity.metadata!, entity }),
spec: entity => ({ ...entity.spec!, entity }),
},
EntityMetadata: {
__resolveType: rootValue => {
const {
entity: { kind },
} = rootValue as { entity: Entity };
switch (kind) {
case 'Component':
return 'ComponentMetadata';
case 'Template':
return 'TemplateMetadata';
default:
return 'DefaultEntityMetadata';
}
},
annotation: (e, { name }) => e.annotations?.[name] ?? null,
labels: e => e.labels ?? {},
annotations: e => e.annotations ?? {},
label: (e, { name }) => e.labels?.[name] ?? null,
},
EntitySpec: {
__resolveType: rootValue => {
const {
entity: { kind },
} = rootValue as { entity: Entity };
switch (kind) {
case 'Component':
return 'ComponentEntitySpec';
case 'Template':
return 'TemplateEntitySpec';
default:
return 'DefaultEntitySpec';
}
},
},
};
return createGraphQLModule({
id: 'plugin-catalog-graphql',
typeDefs: gql(typeDefs),
resolvers,
});
}
@@ -1,544 +0,0 @@
/*
* 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.
*/
import {
GraphQLResolveInfo,
GraphQLScalarType,
GraphQLScalarTypeConfig,
} from 'graphql';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = {
[K in keyof T]: T[K];
};
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
[SubKey in K]?: Maybe<T[SubKey]>;
};
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
[SubKey in K]: Maybe<T[SubKey]>;
};
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export type RequireFields<T, K extends keyof T> = {
[X in Exclude<keyof T, K>]?: T[X];
} & { [P in K]-?: NonNullable<T[P]> };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
JSON: any;
JSONObject: any;
};
export type CatalogEntity = {
__typename?: 'CatalogEntity';
apiVersion: Scalars['String'];
kind: Scalars['String'];
metadata?: Maybe<EntityMetadata>;
spec: EntitySpec;
};
export type CatalogQuery = {
__typename?: 'CatalogQuery';
list: Array<CatalogEntity>;
};
export type ComponentEntitySpec = {
__typename?: 'ComponentEntitySpec';
lifecycle: Scalars['String'];
owner: Scalars['String'];
type: Scalars['String'];
};
export type ComponentMetadata = EntityMetadata & {
__typename?: 'ComponentMetadata';
annotation?: Maybe<Scalars['JSON']>;
annotations: Scalars['JSONObject'];
etag: Scalars['String'];
label?: Maybe<Scalars['JSON']>;
labels: Scalars['JSONObject'];
name: Scalars['String'];
relationships?: Maybe<Scalars['String']>;
uid: Scalars['String'];
};
export type ComponentMetadataAnnotationArgs = {
name: Scalars['String'];
};
export type ComponentMetadataLabelArgs = {
name: Scalars['String'];
};
export type DefaultEntityMetadata = EntityMetadata & {
__typename?: 'DefaultEntityMetadata';
annotation?: Maybe<Scalars['JSON']>;
annotations: Scalars['JSONObject'];
etag: Scalars['String'];
label?: Maybe<Scalars['JSON']>;
labels: Scalars['JSONObject'];
name: Scalars['String'];
uid: Scalars['String'];
};
export type DefaultEntityMetadataAnnotationArgs = {
name: Scalars['String'];
};
export type DefaultEntityMetadataLabelArgs = {
name: Scalars['String'];
};
export type DefaultEntitySpec = {
__typename?: 'DefaultEntitySpec';
raw?: Maybe<Scalars['JSONObject']>;
};
export type EntityMetadata = {
annotation?: Maybe<Scalars['JSON']>;
annotations: Scalars['JSONObject'];
etag: Scalars['String'];
label?: Maybe<Scalars['JSON']>;
labels: Scalars['JSONObject'];
name: Scalars['String'];
uid: Scalars['String'];
};
export type EntityMetadataAnnotationArgs = {
name: Scalars['String'];
};
export type EntityMetadataLabelArgs = {
name: Scalars['String'];
};
export type EntitySpec =
| ComponentEntitySpec
| DefaultEntitySpec
| TemplateEntitySpec;
export type Query = {
__typename?: 'Query';
catalog: CatalogQuery;
};
export type TemplateEntitySpec = {
__typename?: 'TemplateEntitySpec';
path?: Maybe<Scalars['String']>;
schema: Scalars['JSONObject'];
templater: Scalars['String'];
type: Scalars['String'];
};
export type TemplateMetadata = EntityMetadata & {
__typename?: 'TemplateMetadata';
annotation?: Maybe<Scalars['JSON']>;
annotations: Scalars['JSONObject'];
etag: Scalars['String'];
label?: Maybe<Scalars['JSON']>;
labels: Scalars['JSONObject'];
name: Scalars['String'];
uid: Scalars['String'];
updatedBy?: Maybe<Scalars['String']>;
};
export type TemplateMetadataAnnotationArgs = {
name: Scalars['String'];
};
export type TemplateMetadataLabelArgs = {
name: Scalars['String'];
};
export type WithIndex<TObject> = TObject & Record<string, any>;
export type ResolversObject<TObject> = WithIndex<TObject>;
export type ResolverTypeWrapper<T> = Promise<T> | T;
export type ResolverWithResolve<TResult, TParent, TContext, TArgs> = {
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
};
export type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> =
| ResolverFn<TResult, TParent, TContext, TArgs>
| ResolverWithResolve<TResult, TParent, TContext, TArgs>;
export type ResolverFn<TResult, TParent, TContext, TArgs> = (
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo,
) => Promise<TResult> | TResult;
export type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo,
) => AsyncIterable<TResult> | Promise<AsyncIterable<TResult>>;
export type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo,
) => TResult | Promise<TResult>;
export interface SubscriptionSubscriberObject<
TResult,
TKey extends string,
TParent,
TContext,
TArgs,
> {
subscribe: SubscriptionSubscribeFn<
{ [key in TKey]: TResult },
TParent,
TContext,
TArgs
>;
resolve?: SubscriptionResolveFn<
TResult,
{ [key in TKey]: TResult },
TContext,
TArgs
>;
}
export interface SubscriptionResolverObject<TResult, TParent, TContext, TArgs> {
subscribe: SubscriptionSubscribeFn<any, TParent, TContext, TArgs>;
resolve: SubscriptionResolveFn<TResult, any, TContext, TArgs>;
}
export type SubscriptionObject<
TResult,
TKey extends string,
TParent,
TContext,
TArgs,
> =
| SubscriptionSubscriberObject<TResult, TKey, TParent, TContext, TArgs>
| SubscriptionResolverObject<TResult, TParent, TContext, TArgs>;
export type SubscriptionResolver<
TResult,
TKey extends string,
TParent = {},
TContext = {},
TArgs = {},
> =
| ((
...args: any[]
) => SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>)
| SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>;
export type TypeResolveFn<TTypes, TParent = {}, TContext = {}> = (
parent: TParent,
context: TContext,
info: GraphQLResolveInfo,
) => Maybe<TTypes> | Promise<Maybe<TTypes>>;
export type IsTypeOfResolverFn<T = {}, TContext = {}> = (
obj: T,
context: TContext,
info: GraphQLResolveInfo,
) => boolean | Promise<boolean>;
export type NextResolverFn<T> = () => Promise<T>;
export type DirectiveResolverFn<
TResult = {},
TParent = {},
TContext = {},
TArgs = {},
> = (
next: NextResolverFn<TResult>,
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo,
) => TResult | Promise<TResult>;
/** Mapping between all available schema types and the resolvers types */
export type ResolversTypes = ResolversObject<{
Boolean: ResolverTypeWrapper<Partial<Scalars['Boolean']>>;
CatalogEntity: ResolverTypeWrapper<
Partial<
Omit<CatalogEntity, 'spec'> & { spec: ResolversTypes['EntitySpec'] }
>
>;
CatalogQuery: ResolverTypeWrapper<Partial<CatalogQuery>>;
ComponentEntitySpec: ResolverTypeWrapper<Partial<ComponentEntitySpec>>;
ComponentMetadata: ResolverTypeWrapper<Partial<ComponentMetadata>>;
DefaultEntityMetadata: ResolverTypeWrapper<Partial<DefaultEntityMetadata>>;
DefaultEntitySpec: ResolverTypeWrapper<Partial<DefaultEntitySpec>>;
EntityMetadata:
| ResolversTypes['ComponentMetadata']
| ResolversTypes['DefaultEntityMetadata']
| ResolversTypes['TemplateMetadata'];
EntitySpec: Partial<
| ResolversTypes['ComponentEntitySpec']
| ResolversTypes['DefaultEntitySpec']
| ResolversTypes['TemplateEntitySpec']
>;
Int: ResolverTypeWrapper<Partial<Scalars['Int']>>;
JSON: ResolverTypeWrapper<Partial<Scalars['JSON']>>;
JSONObject: ResolverTypeWrapper<Partial<Scalars['JSONObject']>>;
Query: ResolverTypeWrapper<{}>;
String: ResolverTypeWrapper<Partial<Scalars['String']>>;
TemplateEntitySpec: ResolverTypeWrapper<Partial<TemplateEntitySpec>>;
TemplateMetadata: ResolverTypeWrapper<Partial<TemplateMetadata>>;
}>;
/** Mapping between all available schema types and the resolvers parents */
export type ResolversParentTypes = ResolversObject<{
Boolean: Partial<Scalars['Boolean']>;
CatalogEntity: Partial<
Omit<CatalogEntity, 'spec'> & { spec: ResolversParentTypes['EntitySpec'] }
>;
CatalogQuery: Partial<CatalogQuery>;
ComponentEntitySpec: Partial<ComponentEntitySpec>;
ComponentMetadata: Partial<ComponentMetadata>;
DefaultEntityMetadata: Partial<DefaultEntityMetadata>;
DefaultEntitySpec: Partial<DefaultEntitySpec>;
EntityMetadata:
| ResolversParentTypes['ComponentMetadata']
| ResolversParentTypes['DefaultEntityMetadata']
| ResolversParentTypes['TemplateMetadata'];
EntitySpec: Partial<
| ResolversParentTypes['ComponentEntitySpec']
| ResolversParentTypes['DefaultEntitySpec']
| ResolversParentTypes['TemplateEntitySpec']
>;
Int: Partial<Scalars['Int']>;
JSON: Partial<Scalars['JSON']>;
JSONObject: Partial<Scalars['JSONObject']>;
Query: {};
String: Partial<Scalars['String']>;
TemplateEntitySpec: Partial<TemplateEntitySpec>;
TemplateMetadata: Partial<TemplateMetadata>;
}>;
export type CatalogEntityResolvers<
ContextType = any,
ParentType = ResolversParentTypes['CatalogEntity'],
> = ResolversObject<{
apiVersion?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
kind?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
metadata?: Resolver<
Maybe<ResolversTypes['EntityMetadata']>,
ParentType,
ContextType
>;
spec?: Resolver<ResolversTypes['EntitySpec'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
}>;
export type CatalogQueryResolvers<
ContextType = any,
ParentType = ResolversParentTypes['CatalogQuery'],
> = ResolversObject<{
list?: Resolver<
Array<ResolversTypes['CatalogEntity']>,
ParentType,
ContextType
>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
}>;
export type ComponentEntitySpecResolvers<
ContextType = any,
ParentType = ResolversParentTypes['ComponentEntitySpec'],
> = ResolversObject<{
lifecycle?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
owner?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
type?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
}>;
export type ComponentMetadataResolvers<
ContextType = any,
ParentType = ResolversParentTypes['ComponentMetadata'],
> = ResolversObject<{
annotation?: Resolver<
Maybe<ResolversTypes['JSON']>,
ParentType,
ContextType,
RequireFields<ComponentMetadataAnnotationArgs, 'name'>
>;
annotations?: Resolver<ResolversTypes['JSONObject'], ParentType, ContextType>;
etag?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
label?: Resolver<
Maybe<ResolversTypes['JSON']>,
ParentType,
ContextType,
RequireFields<ComponentMetadataLabelArgs, 'name'>
>;
labels?: Resolver<ResolversTypes['JSONObject'], ParentType, ContextType>;
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
relationships?: Resolver<
Maybe<ResolversTypes['String']>,
ParentType,
ContextType
>;
uid?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
}>;
export type DefaultEntityMetadataResolvers<
ContextType = any,
ParentType = ResolversParentTypes['DefaultEntityMetadata'],
> = ResolversObject<{
annotation?: Resolver<
Maybe<ResolversTypes['JSON']>,
ParentType,
ContextType,
RequireFields<DefaultEntityMetadataAnnotationArgs, 'name'>
>;
annotations?: Resolver<ResolversTypes['JSONObject'], ParentType, ContextType>;
etag?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
label?: Resolver<
Maybe<ResolversTypes['JSON']>,
ParentType,
ContextType,
RequireFields<DefaultEntityMetadataLabelArgs, 'name'>
>;
labels?: Resolver<ResolversTypes['JSONObject'], ParentType, ContextType>;
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
uid?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
}>;
export type DefaultEntitySpecResolvers<
ContextType = any,
ParentType = ResolversParentTypes['DefaultEntitySpec'],
> = ResolversObject<{
raw?: Resolver<Maybe<ResolversTypes['JSONObject']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
}>;
export type EntityMetadataResolvers<
ContextType = any,
ParentType = ResolversParentTypes['EntityMetadata'],
> = ResolversObject<{
__resolveType: TypeResolveFn<
'ComponentMetadata' | 'DefaultEntityMetadata' | 'TemplateMetadata',
ParentType,
ContextType
>;
annotation?: Resolver<
Maybe<ResolversTypes['JSON']>,
ParentType,
ContextType,
RequireFields<EntityMetadataAnnotationArgs, 'name'>
>;
annotations?: Resolver<ResolversTypes['JSONObject'], ParentType, ContextType>;
etag?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
label?: Resolver<
Maybe<ResolversTypes['JSON']>,
ParentType,
ContextType,
RequireFields<EntityMetadataLabelArgs, 'name'>
>;
labels?: Resolver<ResolversTypes['JSONObject'], ParentType, ContextType>;
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
uid?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
}>;
export type EntitySpecResolvers<
ContextType = any,
ParentType = ResolversParentTypes['EntitySpec'],
> = ResolversObject<{
__resolveType: TypeResolveFn<
'ComponentEntitySpec' | 'DefaultEntitySpec' | 'TemplateEntitySpec',
ParentType,
ContextType
>;
}>;
export interface JsonScalarConfig
extends GraphQLScalarTypeConfig<ResolversTypes['JSON'], any> {
name: 'JSON';
}
export interface JsonObjectScalarConfig
extends GraphQLScalarTypeConfig<ResolversTypes['JSONObject'], any> {
name: 'JSONObject';
}
export type QueryResolvers<
ContextType = any,
ParentType = ResolversParentTypes['Query'],
> = ResolversObject<{
catalog?: Resolver<ResolversTypes['CatalogQuery'], ParentType, ContextType>;
}>;
export type TemplateEntitySpecResolvers<
ContextType = any,
ParentType = ResolversParentTypes['TemplateEntitySpec'],
> = ResolversObject<{
path?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
schema?: Resolver<ResolversTypes['JSONObject'], ParentType, ContextType>;
templater?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
type?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
}>;
export type TemplateMetadataResolvers<
ContextType = any,
ParentType = ResolversParentTypes['TemplateMetadata'],
> = ResolversObject<{
annotation?: Resolver<
Maybe<ResolversTypes['JSON']>,
ParentType,
ContextType,
RequireFields<TemplateMetadataAnnotationArgs, 'name'>
>;
annotations?: Resolver<ResolversTypes['JSONObject'], ParentType, ContextType>;
etag?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
label?: Resolver<
Maybe<ResolversTypes['JSON']>,
ParentType,
ContextType,
RequireFields<TemplateMetadataLabelArgs, 'name'>
>;
labels?: Resolver<ResolversTypes['JSONObject'], ParentType, ContextType>;
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
uid?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
updatedBy?: Resolver<
Maybe<ResolversTypes['String']>,
ParentType,
ContextType
>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
}>;
export type Resolvers<ContextType = any> = ResolversObject<{
CatalogEntity?: CatalogEntityResolvers<ContextType>;
CatalogQuery?: CatalogQueryResolvers<ContextType>;
ComponentEntitySpec?: ComponentEntitySpecResolvers<ContextType>;
ComponentMetadata?: ComponentMetadataResolvers<ContextType>;
DefaultEntityMetadata?: DefaultEntityMetadataResolvers<ContextType>;
DefaultEntitySpec?: DefaultEntitySpecResolvers<ContextType>;
EntityMetadata?: EntityMetadataResolvers<ContextType>;
EntitySpec?: EntitySpecResolvers<ContextType>;
JSON?: GraphQLScalarType;
JSONObject?: GraphQLScalarType;
Query?: QueryResolvers<ContextType>;
TemplateEntitySpec?: TemplateEntitySpecResolvers<ContextType>;
TemplateMetadata?: TemplateMetadataResolvers<ContextType>;
}>;
-23
View File
@@ -1,23 +0,0 @@
/*
* Copyright 2020 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.
*/
/**
* An experimental Backstage catalog GraphQL module
*
* @packageDocumentation
*/
export * from './graphql/module';
-104
View File
@@ -1,104 +0,0 @@
/*
* Copyright 2020 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.
*/
const schema = /* GraphQL */ `
scalar JSON
scalar JSONObject
interface EntityMetadata {
name: String!
annotations: JSONObject!
annotation(name: String!): JSON
labels: JSONObject!
label(name: String!): JSON
uid: String!
etag: String!
}
type DefaultEntityMetadata implements EntityMetadata {
name: String!
annotations: JSONObject!
annotation(name: String!): JSON
labels: JSONObject!
label(name: String!): JSON
uid: String!
etag: String!
}
type ComponentMetadata implements EntityMetadata {
name: String!
annotations: JSONObject!
annotation(name: String!): JSON
labels: JSONObject!
label(name: String!): JSON
uid: String!
etag: String!
# mock field to prove extensions working
relationships: String
}
type TemplateMetadata implements EntityMetadata {
name: String!
annotations: JSONObject!
annotation(name: String!): JSON
labels: JSONObject!
label(name: String!): JSON
uid: String!
etag: String!
# mock field to prove extensions working
updatedBy: String
}
# TODO: move this definition into plugin-scaffolder-graphql
type TemplateEntitySpec {
type: String!
path: String
schema: JSONObject!
templater: String!
}
type ComponentEntitySpec {
type: String!
lifecycle: String!
owner: String!
}
type DefaultEntitySpec {
raw: JSONObject
}
union EntitySpec =
DefaultEntitySpec
| TemplateEntitySpec
| ComponentEntitySpec
type CatalogEntity {
apiVersion: String!
kind: String!
metadata: EntityMetadata
spec: EntitySpec!
}
type CatalogQuery {
list: [CatalogEntity!]!
}
type Query {
catalog: CatalogQuery!
}
`;
export default schema;
@@ -1,56 +0,0 @@
/*
* Copyright 2020 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.
*/
import { CatalogClient } from './client';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { setupRequestMockHandlers } from '@backstage/test-utils';
describe('Catalog GraphQL Module', () => {
const worker = setupServer();
setupRequestMockHandlers(worker);
const baseUrl = 'http://localhost:1234';
it('will return the entities', async () => {
const expectedResponse = [{ id: 'something' }];
worker.use(
rest.get(`${baseUrl}/api/catalog/entities`, (_, res, ctx) =>
res(ctx.status(200), ctx.json(expectedResponse)),
),
);
const client = new CatalogClient(baseUrl);
const response = await client.list();
expect(response).toEqual(expectedResponse);
});
it('throws an error with the text', async () => {
const expectedResponse = 'something broke';
worker.use(
rest.get(`${baseUrl}/api/catalog/entities`, (_, res, ctx) =>
res(ctx.status(500), ctx.text(expectedResponse)),
),
);
const client = new CatalogClient(baseUrl);
await expect(() => client.list()).rejects.toThrow(expectedResponse);
});
});
@@ -1,47 +0,0 @@
/*
* Copyright 2020 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.
*/
import { Entity, EntityMeta } from '@backstage/catalog-model';
import fetch from 'node-fetch';
export interface ReaderEntityMeta extends EntityMeta {
uid: string;
etag: string;
namespace: string;
annotations: Record<string, string>;
labels: Record<string, string>;
}
export interface ReaderEntity extends Entity {
metadata: ReaderEntityMeta;
}
export class CatalogClient {
constructor(private baseUrl: string) {}
async list(): Promise<ReaderEntity[]> {
const res = await fetch(`${this.baseUrl}/api/catalog/entities`);
if (!res.ok) {
// todo(blam): need some better way to handle errors here
// experiment with throwing the input errors etc and having graphql versions of that
throw new Error(await res.text());
}
const entities = (await res.json()) as ReaderEntity[];
return entities;
}
}
-16
View File
@@ -1,16 +0,0 @@
/*
* Copyright 2020 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.
*/
export {};
-1
View File
@@ -1 +0,0 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
-902
View File
@@ -1,902 +0,0 @@
# @backstage/plugin-graphql-backend
## 0.2.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.9
- @backstage/plugin-catalog-graphql@0.4.1
- @backstage/config@1.1.1
## 0.2.1-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.9-next.2
## 0.2.1-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.9-next.1
- @backstage/config@1.1.1
- @backstage/plugin-catalog-graphql@0.4.1-next.0
## 0.2.1-next.0
### Patch Changes
- Updated dependencies
- @backstage/plugin-catalog-graphql@0.4.1-next.0
- @backstage/backend-common@0.19.9-next.0
- @backstage/config@1.1.1
## 0.2.0
### Minor Changes
- 9def1e95ab: This package has been deprecated, consider using [@frontside/backstage-plugin-graphql-backend](https://www.npmjs.com/package/@frontside/backstage-plugin-graphql-backend) instead.
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.8
- @backstage/plugin-catalog-graphql@0.4.0
- @backstage/config@1.1.1
## 0.1.44-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.8-next.2
- @backstage/config@1.1.1-next.0
- @backstage/plugin-catalog-graphql@0.3.24-next.0
## 0.1.43-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.7-next.1
- @backstage/config@1.1.0
- @backstage/plugin-catalog-graphql@0.3.23
## 0.1.43-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.7-next.0
- @backstage/config@1.1.0
- @backstage/plugin-catalog-graphql@0.3.23
## 0.1.41
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.5
- @backstage/config@1.1.0
- @backstage/plugin-catalog-graphql@0.3.23
## 0.1.41-next.3
### Patch Changes
- Updated dependencies
- @backstage/config@1.1.0-next.2
- @backstage/backend-common@0.19.5-next.3
- @backstage/plugin-catalog-graphql@0.3.23-next.2
## 0.1.41-next.2
### Patch Changes
- Updated dependencies
- @backstage/config@1.1.0-next.1
- @backstage/backend-common@0.19.5-next.2
- @backstage/plugin-catalog-graphql@0.3.23-next.1
## 0.1.41-next.1
### Patch Changes
- Updated dependencies
- @backstage/config@1.1.0-next.0
- @backstage/backend-common@0.19.5-next.1
- @backstage/plugin-catalog-graphql@0.3.23-next.0
## 0.1.40-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.4-next.0
- @backstage/config@1.0.8
- @backstage/plugin-catalog-graphql@0.3.22
## 0.1.38
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.2
- @backstage/config@1.0.8
- @backstage/plugin-catalog-graphql@0.3.22
## 0.1.38-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.2-next.2
## 0.1.38-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.2-next.1
- @backstage/config@1.0.8
- @backstage/plugin-catalog-graphql@0.3.22
## 0.1.38-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.2-next.0
- @backstage/config@1.0.8
- @backstage/plugin-catalog-graphql@0.3.22
## 0.1.37
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.1
- @backstage/config@1.0.8
- @backstage/plugin-catalog-graphql@0.3.22
## 0.1.37-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.1-next.0
- @backstage/config@1.0.8
- @backstage/plugin-catalog-graphql@0.3.22-next.0
## 0.1.36
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.0
- @backstage/config@1.0.8
- @backstage/plugin-catalog-graphql@0.3.21
## 0.1.36-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.0-next.2
- @backstage/config@1.0.7
- @backstage/plugin-catalog-graphql@0.3.21-next.1
## 0.1.36-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.19.0-next.1
- @backstage/plugin-catalog-graphql@0.3.21-next.0
- @backstage/config@1.0.7
## 0.1.36-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.6-next.0
- @backstage/config@1.0.7
- @backstage/plugin-catalog-graphql@0.3.20
## 0.1.35
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.5
- @backstage/config@1.0.7
- @backstage/plugin-catalog-graphql@0.3.20
## 0.1.35-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.5-next.1
- @backstage/config@1.0.7
- @backstage/plugin-catalog-graphql@0.3.20
## 0.1.35-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.5-next.0
- @backstage/config@1.0.7
- @backstage/plugin-catalog-graphql@0.3.20
## 0.1.34
### Patch Changes
- e47e69eadf0: Updated dependency `@apollo/server` to `^4.0.0`.
- Updated dependencies
- @backstage/backend-common@0.18.4
- @backstage/plugin-catalog-graphql@0.3.20
- @backstage/config@1.0.7
## 0.1.34-next.3
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.4-next.2
- @backstage/config@1.0.7
- @backstage/plugin-catalog-graphql@0.3.20-next.2
## 0.1.34-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.4-next.2
- @backstage/config@1.0.7
- @backstage/plugin-catalog-graphql@0.3.20-next.1
## 0.1.34-next.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-catalog-graphql@0.3.20-next.1
- @backstage/backend-common@0.18.4-next.1
- @backstage/config@1.0.7
## 0.1.34-next.0
### Patch Changes
- e47e69eadf0: Updated dependency `@apollo/server` to `^4.0.0`.
- Updated dependencies
- @backstage/plugin-catalog-graphql@0.3.20-next.0
- @backstage/backend-common@0.18.4-next.0
- @backstage/config@1.0.7
## 0.1.33
### Patch Changes
- 52b0022dab7: Updated dependency `msw` to `^1.0.0`.
- Updated dependencies
- @backstage/backend-common@0.18.3
- @backstage/plugin-catalog-graphql@0.3.19
- @backstage/config@1.0.7
## 0.1.33-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.3-next.2
- @backstage/config@1.0.7-next.0
- @backstage/plugin-catalog-graphql@0.3.19-next.1
## 0.1.33-next.1
### Patch Changes
- 52b0022dab7: Updated dependency `msw` to `^1.0.0`.
- Updated dependencies
- @backstage/plugin-catalog-graphql@0.3.19-next.1
- @backstage/backend-common@0.18.3-next.1
- @backstage/config@1.0.7-next.0
## 0.1.33-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.3-next.0
- @backstage/config@1.0.6
- @backstage/plugin-catalog-graphql@0.3.19-next.0
## 0.1.32
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.2
- @backstage/config@1.0.6
- @backstage/plugin-catalog-graphql@0.3.18
## 0.1.32-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.2-next.2
- @backstage/config@1.0.6
- @backstage/plugin-catalog-graphql@0.3.18-next.1
## 0.1.32-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.2-next.1
- @backstage/config@1.0.6
- @backstage/plugin-catalog-graphql@0.3.18-next.0
## 0.1.32-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.2-next.0
- @backstage/plugin-catalog-graphql@0.3.18-next.0
## 0.1.30
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.0
- @backstage/config@1.0.6
- @backstage/plugin-catalog-graphql@0.3.17
## 0.1.30-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.0-next.1
- @backstage/config@1.0.6-next.0
- @backstage/plugin-catalog-graphql@0.3.17-next.1
## 0.1.30-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.18.0-next.0
- @backstage/config@1.0.6-next.0
- @backstage/plugin-catalog-graphql@0.3.17-next.1
## 0.1.30-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.17.0
- @backstage/config@1.0.5
- @backstage/plugin-catalog-graphql@0.3.17-next.0
## 0.1.29
### Patch Changes
- 3280711113: Updated dependency `msw` to `^0.49.0`.
- Updated dependencies
- @backstage/backend-common@0.17.0
- @backstage/plugin-catalog-graphql@0.3.16
- @backstage/config@1.0.5
## 0.1.29-next.3
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.17.0-next.3
- @backstage/config@1.0.5-next.1
- @backstage/plugin-catalog-graphql@0.3.16-next.1
## 0.1.29-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.17.0-next.2
- @backstage/config@1.0.5-next.1
- @backstage/plugin-catalog-graphql@0.3.16-next.1
## 0.1.29-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.17.0-next.1
- @backstage/config@1.0.5-next.1
- @backstage/plugin-catalog-graphql@0.3.16-next.1
## 0.1.29-next.0
### Patch Changes
- 3280711113: Updated dependency `msw` to `^0.49.0`.
- Updated dependencies
- @backstage/backend-common@0.16.1-next.0
- @backstage/plugin-catalog-graphql@0.3.16-next.0
- @backstage/config@1.0.5-next.0
## 0.1.28
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.16.0
- @backstage/config@1.0.4
- @backstage/plugin-catalog-graphql@0.3.15
## 0.1.28-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.16.0-next.1
- @backstage/config@1.0.4-next.0
- @backstage/plugin-catalog-graphql@0.3.15-next.0
## 0.1.28-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.16.0-next.0
- @backstage/config@1.0.4-next.0
- @backstage/plugin-catalog-graphql@0.3.15-next.0
## 0.1.27
### Patch Changes
- 2d3a5f09ab: Use `response.json` rather than `response.send` where appropriate, as outlined in `SECURITY.md`
- Updated dependencies
- @backstage/backend-common@0.15.2
- @backstage/plugin-catalog-graphql@0.3.14
- @backstage/config@1.0.3
## 0.1.27-next.2
### Patch Changes
- 2d3a5f09ab: Use `response.json` rather than `response.send` where appropriate, as outlined in `SECURITY.md`
- Updated dependencies
- @backstage/backend-common@0.15.2-next.2
- @backstage/config@1.0.3-next.2
- @backstage/plugin-catalog-graphql@0.3.14-next.2
## 0.1.27-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.15.2-next.1
- @backstage/config@1.0.3-next.1
- @backstage/plugin-catalog-graphql@0.3.14-next.1
## 0.1.27-next.0
### Patch Changes
- Updated dependencies
- @backstage/plugin-catalog-graphql@0.3.14-next.0
- @backstage/backend-common@0.15.2-next.0
- @backstage/config@1.0.3-next.0
## 0.1.26
### Patch Changes
- d669d89206: Minor API signatures cleanup
- 60b85d8ade: Updated dependency `helmet` to `^6.0.0`.
Please note that these policies are no longer applied by default:
helmet.contentSecurityPolicy no longer sets block-all-mixed-content directive by default
helmet.expectCt is no longer set by default. It can, however, be explicitly enabled. It will be removed in Helmet 7.
- 667d917488: Updated dependency `msw` to `^0.47.0`.
- 87ec2ba4d6: Updated dependency `msw` to `^0.46.0`.
- bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
- Updated dependencies
- @backstage/backend-common@0.15.1
- @backstage/config@1.0.2
- @backstage/plugin-catalog-graphql@0.3.13
## 0.1.26-next.3
### Patch Changes
- Updated dependencies
- @backstage/config@1.0.2-next.0
- @backstage/backend-common@0.15.1-next.3
- @backstage/plugin-catalog-graphql@0.3.13-next.3
## 0.1.26-next.2
### Patch Changes
- 667d917488: Updated dependency `msw` to `^0.47.0`.
- 87ec2ba4d6: Updated dependency `msw` to `^0.46.0`.
- Updated dependencies
- @backstage/backend-common@0.15.1-next.2
- @backstage/plugin-catalog-graphql@0.3.13-next.2
## 0.1.26-next.1
### Patch Changes
- d669d89206: Minor API signatures cleanup
- 60b85d8ade: Updated dependency `helmet` to `^6.0.0`.
Please note that these policies are no longer applied by default:
helmet.contentSecurityPolicy no longer sets block-all-mixed-content directive by default
helmet.expectCt is no longer set by default. It can, however, be explicitly enabled. It will be removed in Helmet 7.
- Updated dependencies
- @backstage/backend-common@0.15.1-next.1
- @backstage/plugin-catalog-graphql@0.3.13-next.1
## 0.1.26-next.0
### Patch Changes
- bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
- Updated dependencies
- @backstage/backend-common@0.15.1-next.0
- @backstage/plugin-catalog-graphql@0.3.13-next.0
## 0.1.25
### Patch Changes
- fa3eeee92d: Updated dependency `@graphql-tools/schema` to `^9.0.0`.
- Updated dependencies
- @backstage/backend-common@0.15.0
- @backstage/plugin-catalog-graphql@0.3.12
## 0.1.25-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.15.0-next.0
## 0.1.24
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- 8006d0f9bf: Updated dependency `msw` to `^0.44.0`.
- Updated dependencies
- @backstage/backend-common@0.14.1
- @backstage/plugin-catalog-graphql@0.3.11
## 0.1.24-next.1
### Patch Changes
- a70869e775: Updated dependency `msw` to `^0.43.0`.
- Updated dependencies
- @backstage/backend-common@0.14.1-next.3
- @backstage/plugin-catalog-graphql@0.3.11-next.1
## 0.1.24-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.14.1-next.0
- @backstage/plugin-catalog-graphql@0.3.11-next.0
## 0.1.23
### Patch Changes
- 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
- Updated dependencies
- @backstage/backend-common@0.14.0
- @backstage/plugin-catalog-graphql@0.3.10
## 0.1.23-next.2
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.14.0-next.2
## 0.1.23-next.1
### Patch Changes
- 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
- Updated dependencies
- @backstage/backend-common@0.13.6-next.1
- @backstage/plugin-catalog-graphql@0.3.10-next.0
## 0.1.23-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.13.6-next.0
## 0.1.22
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.13.3
- @backstage/config@1.0.1
- @backstage/plugin-catalog-graphql@0.3.9
## 0.1.22-next.1
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.13.3-next.2
- @backstage/config@1.0.1-next.0
- @backstage/plugin-catalog-graphql@0.3.9-next.0
## 0.1.22-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.13.3-next.0
## 0.1.21
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.13.2
- @backstage/plugin-catalog-graphql@0.3.8
## 0.1.21-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.13.2-next.0
- @backstage/plugin-catalog-graphql@0.3.8-next.0
## 0.1.20
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.13.1
- @backstage/plugin-catalog-graphql@0.3.7
- @backstage/config@1.0.0
## 0.1.19
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.13.0
- @backstage/plugin-catalog-graphql@0.3.6
## 0.1.19-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.13.0-next.0
- @backstage/plugin-catalog-graphql@0.3.6-next.0
## 0.1.18
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.12.0
- @backstage/plugin-catalog-graphql@0.3.5
## 0.1.17
### Patch Changes
- 68913af4ff: chore(deps): bump `graphql-modules` from 1.4.4 to 2.0.0
- Updated dependencies
- @backstage/backend-common@0.11.0
- @backstage/plugin-catalog-graphql@0.3.4
## 0.1.16
### Patch Changes
- Fix for the previous release with missing type declarations.
- Updated dependencies
- @backstage/backend-common@0.10.9
- @backstage/config@0.1.15
- @backstage/plugin-catalog-graphql@0.3.3
## 0.1.15
### Patch Changes
- c77c5c7eb6: Added `backstage.role` to `package.json`
- 0107c9aa08: chore(deps): bump `helmet` from 4.4.1 to 5.0.2
- Updated dependencies
- @backstage/backend-common@0.10.8
- @backstage/plugin-catalog-graphql@0.3.2
- @backstage/config@0.1.14
## 0.1.14
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.10.7
## 0.1.14-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.10.7-next.0
## 0.1.13
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.10.6
## 0.1.13-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.10.6-next.0
## 0.1.12
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.10.4
- @backstage/config@0.1.13
- @backstage/plugin-catalog-graphql@0.3.1
## 0.1.12-next.0
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.10.4-next.0
- @backstage/config@0.1.13-next.0
- @backstage/plugin-catalog-graphql@0.3.1-next.0
## 0.1.11
### Patch Changes
- 0fb17da164: chore: bumping dependencies in the GraphQL modules and bringing them up to date with the latest `graphql-modules` library
- Updated dependencies
- @backstage/config@0.1.12
- @backstage/backend-common@0.10.3
- @backstage/plugin-catalog-graphql@0.3.0
## 0.1.10
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.10.0
## 0.1.9
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.9.0
- @backstage/config@0.1.8
- @backstage/plugin-catalog-graphql@0.2.12
## 0.1.8
### Patch Changes
- Updated dependencies [3be844496]
- Updated dependencies [22fd8ce2a]
- Updated dependencies [f9fb4a205]
- @backstage/plugin-catalog-graphql@0.2.9
- @backstage/backend-common@0.8.0
## 0.1.7
### Patch Changes
- Updated dependencies [e0bfd3d44]
- Updated dependencies [38ca05168]
- Updated dependencies [d8b81fd28]
- @backstage/backend-common@0.7.0
- @backstage/config@0.1.5
- @backstage/plugin-catalog-graphql@0.2.8
## 0.1.6
### Patch Changes
- Updated dependencies [8686eb38c]
- Updated dependencies [0434853a5]
- Updated dependencies [8686eb38c]
- @backstage/backend-common@0.6.0
- @backstage/config@0.1.4
- @backstage/plugin-catalog-graphql@0.2.7
## 0.1.5
### Patch Changes
- Updated dependencies [0b135e7e0]
- Updated dependencies [294a70cab]
- Updated dependencies [0ea032763]
- Updated dependencies [5345a1f98]
- Updated dependencies [09a370426]
- @backstage/backend-common@0.5.0
- @backstage/plugin-catalog-graphql@0.2.6
## 0.1.4
### Patch Changes
- Updated dependencies [38e24db00]
- Updated dependencies [e3bd9fc2f]
- Updated dependencies [12bbd748c]
- Updated dependencies [e3bd9fc2f]
- @backstage/backend-common@0.4.0
- @backstage/config@0.1.2
- @backstage/plugin-catalog-graphql@0.2.4
## 0.1.3
### Patch Changes
- Updated dependencies [1722cb53c]
- Updated dependencies [1722cb53c]
- Updated dependencies [7b37e6834]
- Updated dependencies [8e2effb53]
- @backstage/backend-common@0.3.0
- @backstage/plugin-catalog-graphql@0.2.1
## 0.1.2
### Patch Changes
- Updated dependencies [28edd7d29]
- Updated dependencies [5249594c5]
- Updated dependencies [56e4eb589]
- Updated dependencies [e37c0a005]
- Updated dependencies [f00ca3cb8]
- Updated dependencies [6579769df]
- Updated dependencies [8c2b76e45]
- Updated dependencies [440a17b39]
- Updated dependencies [8afce088a]
- Updated dependencies [7bbeb049f]
- @backstage/plugin-catalog-graphql@0.2.0
- @backstage/backend-common@0.2.0
-3
View File
@@ -1,3 +0,0 @@
# GraphQL Backend
This package has been deprecated, consider using [@frontside/backstage-plugin-graphql-backend](https://www.npmjs.com/package/@frontside/backstage-plugin-graphql-backend) instead.
-20
View File
@@ -1,20 +0,0 @@
## API Report File for "@backstage/plugin-graphql-backend"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { Config } from '@backstage/config';
import express from 'express';
import { Logger } from 'winston';
// @public (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @public (undocumented)
export interface RouterOptions {
// (undocumented)
config: Config;
// (undocumented)
logger: Logger;
}
```
-10
View File
@@ -1,10 +0,0 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: backstage-plugin-graphql-backend
title: '@backstage/plugin-graphql-backend'
description: An experimental Backstage backend plugin for GraphQL
spec:
lifecycle: experimental
type: backstage-backend-plugin
owner: maintainers
-61
View File
@@ -1,61 +0,0 @@
{
"name": "@backstage/plugin-graphql-backend",
"description": "Deprecated, consider using @frontside/backstage-plugin-graphql-backend instead",
"version": "0.2.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "backend-plugin"
},
"homepage": "https://backstage.io",
"repository": {
"type": "git",
"url": "https://github.com/backstage/backstage",
"directory": "plugins/graphql-backend"
},
"keywords": [
"backstage",
"graphql"
],
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack",
"clean": "backstage-cli package clean"
},
"dependencies": {
"@apollo/server": "^4.0.0",
"@backstage/backend-common": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/plugin-catalog-graphql": "workspace:^",
"@graphql-tools/schema": "^9.0.0",
"@types/express": "^4.17.6",
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"graphql": "^16.0.0",
"graphql-modules": "^2.0.0",
"helmet": "^6.0.0",
"reflect-metadata": "^0.1.13",
"winston": "^3.2.1",
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/cli": "workspace:^",
"@types/supertest": "^2.0.8",
"msw": "^1.0.0",
"supertest": "^6.1.3"
},
"files": [
"dist",
"schema.gql"
]
}
View File
-23
View File
@@ -1,23 +0,0 @@
/*
* Copyright 2020 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.
*/
/**
* An experimental Backstage backend plugin for GraphQL
*
* @packageDocumentation
*/
export * from './service/router';
@@ -1,35 +0,0 @@
/*
* Copyright 2020 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.
*/
import { createRouter } from './router';
import supertest from 'supertest';
import { ConfigReader } from '@backstage/config';
import { createLogger } from 'winston';
import express from 'express';
describe('Router', () => {
describe('/health', () => {
it('should return ok', async () => {
const config = new ConfigReader({ backend: { baseUrl: 'lol' } });
const router = await createRouter({ config, logger: createLogger() });
const app = express().use(router);
const { body } = await supertest(app).get('/health');
expect(body).toEqual({ status: 'ok' });
});
});
});
@@ -1,78 +0,0 @@
/*
* Copyright 2020 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.
*/
import { errorHandler } from '@backstage/backend-common';
import express from 'express';
import Router from 'express-promise-router';
import { Logger } from 'winston';
import { createApplication } from 'graphql-modules';
import { ApolloServer } from '@apollo/server';
import { expressMiddleware } from '@apollo/server/express4';
import { createModule as createCatalogModule } from '@backstage/plugin-catalog-graphql';
import { Config } from '@backstage/config';
import helmet from 'helmet';
import { makeExecutableSchema } from '@graphql-tools/schema';
/** @public */
export interface RouterOptions {
logger: Logger;
config: Config;
}
/** @public */
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {
const catalogModule = await createCatalogModule(options);
const { createSchemaForApollo } = createApplication({
modules: [catalogModule],
schemaBuilder(input) {
return makeExecutableSchema({
...input,
inheritResolversFromInterfaces: true,
});
},
});
const server = new ApolloServer({
schema: createSchemaForApollo(),
logger: options.logger,
introspection: true,
});
await server.start();
const router = Router();
router.get('/health', (_, response) => {
response.json({ status: 'ok' });
});
if (process.env.NODE_ENV === 'development')
router.use(
helmet.contentSecurityPolicy({
directives: {
defaultSrc: ["'self'", "'unsafe-inline'", 'http://*'],
},
}),
);
router.use(expressMiddleware(server));
router.use(errorHandler());
return router;
}
-17
View File
@@ -1,17 +0,0 @@
/*
* Copyright 2020 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.
*/
export {};
+232 -1868
View File
File diff suppressed because it is too large Load Diff