From 1fb616c5f5398c905936df23f2431a08f7305882 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 27 Jul 2020 15:36:28 +0200 Subject: [PATCH 01/80] feat(gql): added some experimentation around graphql modules --- plugins/bogus-graphql/.eslintrc.js | 3 + plugins/bogus-graphql/README.md | 13 ++ plugins/bogus-graphql/package.json | 44 +++++ plugins/bogus-graphql/scripts/mock-data.sh | 2 + plugins/bogus-graphql/src/graphql/module.ts | 47 +++++ plugins/bogus-graphql/src/index.ts | 19 ++ plugins/bogus-graphql/src/schema.gql | 3 + plugins/bogus-graphql/src/setupTests.ts | 18 ++ plugins/catalog-graphql/.eslintrc.js | 3 + plugins/catalog-graphql/README.md | 13 ++ plugins/catalog-graphql/package.json | 44 +++++ plugins/catalog-graphql/scripts/mock-data.sh | 2 + plugins/catalog-graphql/src/graphql/module.ts | 82 +++++++++ plugins/catalog-graphql/src/index.ts | 19 ++ plugins/catalog-graphql/src/schema.gql | 25 +++ plugins/catalog-graphql/src/setupTests.ts | 18 ++ plugins/graphql/package.json | 3 + plugins/graphql/src/schema.gql | 11 -- plugins/graphql/src/service/router.ts | 12 +- yarn.lock | 166 +++++++++++++++++- 20 files changed, 528 insertions(+), 19 deletions(-) create mode 100644 plugins/bogus-graphql/.eslintrc.js create mode 100644 plugins/bogus-graphql/README.md create mode 100644 plugins/bogus-graphql/package.json create mode 100755 plugins/bogus-graphql/scripts/mock-data.sh create mode 100644 plugins/bogus-graphql/src/graphql/module.ts create mode 100644 plugins/bogus-graphql/src/index.ts create mode 100644 plugins/bogus-graphql/src/schema.gql create mode 100644 plugins/bogus-graphql/src/setupTests.ts create mode 100644 plugins/catalog-graphql/.eslintrc.js create mode 100644 plugins/catalog-graphql/README.md create mode 100644 plugins/catalog-graphql/package.json create mode 100755 plugins/catalog-graphql/scripts/mock-data.sh create mode 100644 plugins/catalog-graphql/src/graphql/module.ts create mode 100644 plugins/catalog-graphql/src/index.ts create mode 100644 plugins/catalog-graphql/src/schema.gql create mode 100644 plugins/catalog-graphql/src/setupTests.ts diff --git a/plugins/bogus-graphql/.eslintrc.js b/plugins/bogus-graphql/.eslintrc.js new file mode 100644 index 0000000000..16a033dbc6 --- /dev/null +++ b/plugins/bogus-graphql/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: [require.resolve('@backstage/cli/config/eslint.backend')], +}; diff --git a/plugins/bogus-graphql/README.md b/plugins/bogus-graphql/README.md new file mode 100644 index 0000000000..3f85ec766e --- /dev/null +++ b/plugins/bogus-graphql/README.md @@ -0,0 +1,13 @@ +# graphql + +Welcome to the graphql backend plugin! + +_This plugin was created through the Backstage CLI_ + +## Getting started + +Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/graphql](http://localhost:3000/graphql). + +You can also serve the plugin in isolation by running `yarn start` in the plugin directory. +This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. +It is only meant for local development, and the setup for it can be found inside the [/dev](/dev) directory. diff --git a/plugins/bogus-graphql/package.json b/plugins/bogus-graphql/package.json new file mode 100644 index 0000000000..a5a439a701 --- /dev/null +++ b/plugins/bogus-graphql/package.json @@ -0,0 +1,44 @@ +{ + "name": "@backstage/plugin-bogus-graphql", + "version": "0.1.1-alpha.16", + "main": "src/index.ts", + "types": "src/index.ts", + "license": "Apache-2.0", + "private": true, + "publishConfig": { + "access": "public", + "main": "dist/index.esm.js", + "types": "dist/index.d.ts" + }, + "scripts": { + "start": "backstage-cli backend:dev", + "build": "backstage-cli backend:build", + "lint": "backstage-cli lint", + "test": "backstage-cli test", + "prepack": "backstage-cli prepack", + "postpack": "backstage-cli postpack", + "clean": "backstage-cli clean", + "mock-data": "./scripts/mock-data.sh" + }, + "dependencies": { + "@backstage/backend-common": "^0.1.1-alpha.16", + "@graphql-modules/core": "^0.7.17", + "@types/express": "^4.17.6", + "@types/whatwg-fetch": "^0.0.33", + "graphql": "^15.3.0", + "node-fetch": "^2.6.0", + "whatwg-fetch": "^2.0.0", + "winston": "^3.2.1", + "yn": "^4.0.0" + }, + "devDependencies": { + "@backstage/cli": "^0.1.1-alpha.16", + "@types/supertest": "^2.0.8", + "eslint-plugin-graphql": "^4.0.0", + "msw": "^0.19.5", + "supertest": "^4.0.2" + }, + "files": [ + "dist" + ] +} diff --git a/plugins/bogus-graphql/scripts/mock-data.sh b/plugins/bogus-graphql/scripts/mock-data.sh new file mode 100755 index 0000000000..ff30921715 --- /dev/null +++ b/plugins/bogus-graphql/scripts/mock-data.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo "use this script to load your service with some mock data if needed!" diff --git a/plugins/bogus-graphql/src/graphql/module.ts b/plugins/bogus-graphql/src/graphql/module.ts new file mode 100644 index 0000000000..f247686ea8 --- /dev/null +++ b/plugins/bogus-graphql/src/graphql/module.ts @@ -0,0 +1,47 @@ +/* + * Copyright 2020 Spotify AB + * + * 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 fs from 'fs'; +import path from 'path'; +import { GraphQLModule } from '@graphql-modules/core'; + +export interface ModuleOptions { + logger: Logger; +} + +export async function createModule( + options: ModuleOptions, +): Promise { + const typeDefs = await fs.promises.readFile( + path.resolve(__dirname, '..', 'schema.gql'), + 'utf-8', + ); + + const resolvers = { + EntityMetadata: { + uppercaseName: metadata => metadata.name.toUpperCase(), + }, + }; + + const module = new GraphQLModule({ + typeDefs, + resolvers, + logger: options.logger as any, + }); + + return module; +} diff --git a/plugins/bogus-graphql/src/index.ts b/plugins/bogus-graphql/src/index.ts new file mode 100644 index 0000000000..dd6508f88a --- /dev/null +++ b/plugins/bogus-graphql/src/index.ts @@ -0,0 +1,19 @@ +/* + * Copyright 2020 Spotify AB + * + * 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. + */ + +require('whatwg-fetch'); + +export * from './graphql/module'; diff --git a/plugins/bogus-graphql/src/schema.gql b/plugins/bogus-graphql/src/schema.gql new file mode 100644 index 0000000000..74c0853a92 --- /dev/null +++ b/plugins/bogus-graphql/src/schema.gql @@ -0,0 +1,3 @@ +type EntityMetadata { + uppercaseName: String +} diff --git a/plugins/bogus-graphql/src/setupTests.ts b/plugins/bogus-graphql/src/setupTests.ts new file mode 100644 index 0000000000..ac41ef995a --- /dev/null +++ b/plugins/bogus-graphql/src/setupTests.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * 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. + */ +require('whatwg-fetch'); + +export {}; diff --git a/plugins/catalog-graphql/.eslintrc.js b/plugins/catalog-graphql/.eslintrc.js new file mode 100644 index 0000000000..16a033dbc6 --- /dev/null +++ b/plugins/catalog-graphql/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: [require.resolve('@backstage/cli/config/eslint.backend')], +}; diff --git a/plugins/catalog-graphql/README.md b/plugins/catalog-graphql/README.md new file mode 100644 index 0000000000..3f85ec766e --- /dev/null +++ b/plugins/catalog-graphql/README.md @@ -0,0 +1,13 @@ +# graphql + +Welcome to the graphql backend plugin! + +_This plugin was created through the Backstage CLI_ + +## Getting started + +Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/graphql](http://localhost:3000/graphql). + +You can also serve the plugin in isolation by running `yarn start` in the plugin directory. +This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. +It is only meant for local development, and the setup for it can be found inside the [/dev](/dev) directory. diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json new file mode 100644 index 0000000000..57fade9654 --- /dev/null +++ b/plugins/catalog-graphql/package.json @@ -0,0 +1,44 @@ +{ + "name": "@backstage/plugin-catalog-graphql", + "version": "0.1.1-alpha.16", + "main": "src/index.ts", + "types": "src/index.ts", + "license": "Apache-2.0", + "private": true, + "publishConfig": { + "access": "public", + "main": "dist/index.esm.js", + "types": "dist/index.d.ts" + }, + "scripts": { + "start": "backstage-cli backend:dev", + "build": "backstage-cli backend:build", + "lint": "backstage-cli lint", + "test": "backstage-cli test", + "prepack": "backstage-cli prepack", + "postpack": "backstage-cli postpack", + "clean": "backstage-cli clean", + "mock-data": "./scripts/mock-data.sh" + }, + "dependencies": { + "@backstage/backend-common": "^0.1.1-alpha.16", + "@graphql-modules/core": "^0.7.17", + "@types/express": "^4.17.6", + "@types/whatwg-fetch": "^0.0.33", + "graphql": "^15.3.0", + "node-fetch": "^2.6.0", + "whatwg-fetch": "^2.0.0", + "winston": "^3.2.1", + "yn": "^4.0.0" + }, + "devDependencies": { + "@backstage/cli": "^0.1.1-alpha.16", + "@types/supertest": "^2.0.8", + "eslint-plugin-graphql": "^4.0.0", + "msw": "^0.19.5", + "supertest": "^4.0.2" + }, + "files": [ + "dist" + ] +} diff --git a/plugins/catalog-graphql/scripts/mock-data.sh b/plugins/catalog-graphql/scripts/mock-data.sh new file mode 100755 index 0000000000..ff30921715 --- /dev/null +++ b/plugins/catalog-graphql/scripts/mock-data.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo "use this script to load your service with some mock data if needed!" diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts new file mode 100644 index 0000000000..65239d27db --- /dev/null +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -0,0 +1,82 @@ +/* + * Copyright 2020 Spotify AB + * + * 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 fetch from 'node-fetch'; +import fs from 'fs'; +import path from 'path'; +import { GraphQLModule } from '@graphql-modules/core'; + +export interface ModuleOptions { + logger: Logger; +} + +// function wrapLogger(logger: Logger) { +// return { +// log: (msg: string | Error, ...extra: any[]) => +// logger.info(String(msg), ...extra), +// debug: (msg: string | Error, ...extra: any[]) => +// logger.info(String(msg), ...extra), +// info: (msg: string | Error, ...extra: any[]) => +// logger.info(String(msg), ...extra), +// error: (msg: string | Error, ...extra: any[]) => +// logger.info(String(msg), ...extra), +// clientError: (msg: string | Error, ...extra: any[]) => +// logger.info(String(msg), ...extra), +// warn: (msg: string | Error, ...extra: any[]) => +// logger.info(String(msg), ...extra), +// }; +// } + +class CatalogClient { + async list() { + const res = await fetch('http://localhost:7000/catalog/entities'); + if (!res.ok) { + throw new Error(`NOPE, ${await res.text()}`); + } + + return res.json(); + } +} + +export async function createModule( + options: ModuleOptions, +): Promise { + const typeDefs = await fs.promises.readFile( + path.resolve(__dirname, '..', 'schema.gql'), + 'utf-8', + ); + + const catalogClient = new CatalogClient(); + + const resolvers = { + Query: { + catalog: () => true, + }, + CatalogQuery: { + list: () => catalogClient.list(), + }, + CatalogEntity: () => ({}), + }; + + const module = new GraphQLModule({ + typeDefs, + resolvers, + logger: options.logger as any, + }); + + return module; +} diff --git a/plugins/catalog-graphql/src/index.ts b/plugins/catalog-graphql/src/index.ts new file mode 100644 index 0000000000..dd6508f88a --- /dev/null +++ b/plugins/catalog-graphql/src/index.ts @@ -0,0 +1,19 @@ +/* + * Copyright 2020 Spotify AB + * + * 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. + */ + +require('whatwg-fetch'); + +export * from './graphql/module'; diff --git a/plugins/catalog-graphql/src/schema.gql b/plugins/catalog-graphql/src/schema.gql new file mode 100644 index 0000000000..ea92d4e04f --- /dev/null +++ b/plugins/catalog-graphql/src/schema.gql @@ -0,0 +1,25 @@ +type EntityMetadataAnnotation { + key: String! + value: String! +} + +type EntityMetadata { + name: String! + namespace: String + annotation(name: String): EntityMetadataAnnotation + annotations: [EntityMetadataAnnotation!]! +} + +type CatalogEntity { + apiVersion: String + kind: String! + metadata: EntityMetadata +} + +type CatalogQuery { + list: [CatalogEntity!]! +} + +type Query { + catalog: CatalogQuery! +} diff --git a/plugins/catalog-graphql/src/setupTests.ts b/plugins/catalog-graphql/src/setupTests.ts new file mode 100644 index 0000000000..ac41ef995a --- /dev/null +++ b/plugins/catalog-graphql/src/setupTests.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * 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. + */ +require('whatwg-fetch'); + +export {}; diff --git a/plugins/graphql/package.json b/plugins/graphql/package.json index 42f3dc9046..269ebe71f5 100644 --- a/plugins/graphql/package.json +++ b/plugins/graphql/package.json @@ -22,6 +22,9 @@ }, "dependencies": { "@backstage/backend-common": "^0.1.1-alpha.16", + "@backstage/plugin-catalog-graphql": "^0.1.1-alpha.16", + "@backstage/plugin-bogus-graphql": "^0.1.1-alpha.16", + "@graphql-modules/core": "^0.7.17", "@types/express": "^4.17.6", "apollo-server": "^2.16.0", "apollo-server-express": "^2.16.0", diff --git a/plugins/graphql/src/schema.gql b/plugins/graphql/src/schema.gql index 5568182f7f..e69de29bb2 100644 --- a/plugins/graphql/src/schema.gql +++ b/plugins/graphql/src/schema.gql @@ -1,11 +0,0 @@ -type CatalogEntity { - id: String -} - -type CatalogQuery { - list: [CatalogEntity!]! -} - -type Query { - catalog: CatalogQuery! -} diff --git a/plugins/graphql/src/service/router.ts b/plugins/graphql/src/service/router.ts index 09ab5270b7..e12f3770dd 100644 --- a/plugins/graphql/src/service/router.ts +++ b/plugins/graphql/src/service/router.ts @@ -20,7 +20,10 @@ import Router from 'express-promise-router'; import { Logger } from 'winston'; import fs from 'fs'; import path from 'path'; +import { GraphQLModule } from '@graphql-modules/core'; import { ApolloServer } from 'apollo-server-express'; +import { createModule as createCatalogModule } from '@backstage/plugin-catalog-graphql'; +import { createModule as createBogusModule } from '@backstage/plugin-bogus-graphql'; export interface RouterOptions { logger: Logger; @@ -34,7 +37,14 @@ export async function createRouter( 'utf-8', ); - const server = new ApolloServer({ typeDefs, logger: options.logger }); + const catalogModule = await createCatalogModule(options); + const bogusModule = await createBogusModule(options); + const { schema } = new GraphQLModule({ + imports: [catalogModule, bogusModule], + typeDefs, + }); + + const server = new ApolloServer({ schema, logger: options.logger }); const router = Router(); const apolloMiddlware = server.getMiddleware({ path: '/' }); diff --git a/yarn.lock b/yarn.lock index a31c2a75ae..55d8356bed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1229,6 +1229,47 @@ unique-filename "^1.1.1" which "^1.3.1" +"@graphql-modules/core@^0.7.17": + version "0.7.17" + resolved "https://registry.npmjs.org/@graphql-modules/core/-/core-0.7.17.tgz#ae9bbf44894509664bc0b6fcdd9b6cf3d99bcd00" + integrity sha512-hGJa1VIsIHTKJ0Hc5gJfFrdhHAF1Vm+LWYeMNC5mPbVd/IZA1wVSpdLDjjliylLI6GnVRu1YreS2gXvFNXPJFA== + dependencies: + "@graphql-modules/di" "0.7.17" + "@graphql-toolkit/common" "0.10.6" + "@graphql-toolkit/schema-merging" "0.10.6" + apollo-server-caching "0.5.1" + deepmerge "4.2.2" + graphql-tools "5.0.0" + tslib "2.0.0" + +"@graphql-modules/di@0.7.17": + version "0.7.17" + resolved "https://registry.npmjs.org/@graphql-modules/di/-/di-0.7.17.tgz#049f93f204a6d90b7ee4e047a0654c6056f28065" + integrity sha512-Lq5sd/3RO+bNb8wVnAg43LWbwrqD57D0AVEqZlqiTwUj1f0mITtQdGMRN7g2sG79U7ngoaQx8VK/IiKh8E1OFQ== + dependencies: + events "3.1.0" + tslib "2.0.0" + +"@graphql-toolkit/common@0.10.6": + version "0.10.6" + resolved "https://registry.npmjs.org/@graphql-toolkit/common/-/common-0.10.6.tgz#43591fd3478ab27ec95bf39d5a8afdd17f0ac2fd" + integrity sha512-rrH/KPheh/wCZzqUmNayBHd+aNWl/751C4iTL/327TzONdAVrV7ZQOyEkpGLW6YEFWPIlWxNkaBoEALIjCxTGg== + dependencies: + aggregate-error "3.0.1" + camel-case "4.1.1" + graphql-tools "5.0.0" + lodash "4.17.15" + +"@graphql-toolkit/schema-merging@0.10.6": + version "0.10.6" + resolved "https://registry.npmjs.org/@graphql-toolkit/schema-merging/-/schema-merging-0.10.6.tgz#9f57a349621a4377a3431a0320221d9aa6a9d982" + integrity sha512-BNABgYaNCw4Li3EiH/x7oDpkN+ml3M0SWqjnsW1Pf2NcyfGlv033Bda+O/q4XYtseZ0OOOh52GLXtUgwyPFb8A== + dependencies: + "@graphql-toolkit/common" "0.10.6" + deepmerge "4.2.2" + graphql-tools "5.0.0" + tslib "1.11.1" + "@graphql-tools/delegate@6.0.15": version "6.0.15" resolved "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-6.0.15.tgz#9e060bfc31fe7735bd5b2b401e98dea3fa5d3b25" @@ -4472,6 +4513,20 @@ dependencies: "@types/node" "*" +"@types/whatwg-fetch@^0.0.33": + version "0.0.33" + resolved "https://registry.npmjs.org/@types/whatwg-fetch/-/whatwg-fetch-0.0.33.tgz#19c0d2863c8cb2380f21a1c736b79cbf7895bb13" + integrity sha1-GcDShjyMsjgPIaHHNrecv3iVuxM= + dependencies: + "@types/whatwg-streams" "*" + +"@types/whatwg-streams@*": + version "3.2.1" + resolved "https://registry.npmjs.org/@types/whatwg-streams/-/whatwg-streams-3.2.1.tgz#225009a823e8b44be12569a24e60374ccdabe29e" + integrity sha512-Syv05sRL25b8cC8tqgXSQgLZZmqGq2GO+NafrtHbjPJccP6gWBXmHvo2Trw3AWXQ4QLIkVuOB7uStCuhzswyiw== + dependencies: + whatwg-streams "*" + "@types/whatwg-streams@^0.0.7": version "0.0.7" resolved "https://registry.npmjs.org/@types/whatwg-streams/-/whatwg-streams-0.0.7.tgz#28bfe73dc850562296367249c4b32a50db81e9d3" @@ -5056,7 +5111,16 @@ apollo-graphql@^0.5.0: apollo-env "^0.6.5" lodash.sortby "^4.7.0" -apollo-link@^1.2.14: +apollo-link-http-common@^0.2.14: + version "0.2.16" + resolved "https://registry.npmjs.org/apollo-link-http-common/-/apollo-link-http-common-0.2.16.tgz#756749dafc732792c8ca0923f9a40564b7c59ecc" + integrity sha512-2tIhOIrnaF4UbQHf7kjeQA/EmSorB7+HyJIIrUjJOKBgnXwuexi8aMecRlqTIDWcyVXCeqLhUnztMa6bOH/jTg== + dependencies: + apollo-link "^1.2.14" + ts-invariant "^0.4.0" + tslib "^1.9.3" + +apollo-link@^1.2.12, apollo-link@^1.2.14: version "1.2.14" resolved "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.14.tgz#3feda4b47f9ebba7f4160bef8b977ba725b684d9" integrity sha512-p67CMEFP7kOG1JZ0ZkYZwRDa369w5PIjtMjvrQd/HnIV8FRsHRqLqK+oAZQnFa1DDdZtOtHTi+aMIW6EatC2jg== @@ -5066,6 +5130,13 @@ apollo-link@^1.2.14: tslib "^1.9.3" zen-observable-ts "^0.8.21" +apollo-server-caching@0.5.1: + version "0.5.1" + resolved "https://registry.npmjs.org/apollo-server-caching/-/apollo-server-caching-0.5.1.tgz#5cd0536ad5473abb667cc82b59bc56b96fb35db6" + integrity sha512-L7LHZ3k9Ao5OSf2WStvQhxdsNVplRQi7kCAPfqf9Z3GBEnQ2uaL0EgO0hSmtVHfXTbk5CTRziMT1Pe87bXrFIw== + dependencies: + lru-cache "^5.0.0" + apollo-server-caching@^0.5.2: version "0.5.2" resolved "https://registry.npmjs.org/apollo-server-caching/-/apollo-server-caching-0.5.2.tgz#bef5d5e0d48473a454927a66b7bb947a0b6eb13e" @@ -5171,6 +5242,16 @@ apollo-tracing@^0.11.1: apollo-server-env "^2.4.5" apollo-server-plugin-base "^0.9.1" +apollo-upload-client@^13.0.0: + version "13.0.0" + resolved "https://registry.npmjs.org/apollo-upload-client/-/apollo-upload-client-13.0.0.tgz#146d1ddd85d711fcac8ca97a72d3ca6787f2b71b" + integrity sha512-lJ9/bk1BH1lD15WhWRha2J3+LrXrPIX5LP5EwiOUHv8PCORp4EUrcujrA3rI5hZeZygrTX8bshcuMdpqpSrvtA== + dependencies: + "@babel/runtime" "^7.9.2" + apollo-link "^1.2.12" + apollo-link-http-common "^0.2.14" + extract-files "^8.0.0" + apollo-utilities@^1.0.1, apollo-utilities@^1.3.0: version "1.3.4" resolved "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz#6129e438e8be201b6c55b0f13ce49d2c7175c9cf" @@ -5954,6 +6035,11 @@ bluebird@3.7.2, bluebird@^3.3.5, bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5 resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== +bluebird@~1.0.0: + version "1.0.8" + resolved "https://registry.npmjs.org/bluebird/-/bluebird-1.0.8.tgz#851c7825e6cce59e4b43dde95d574b88675463fc" + integrity sha1-hRx4JebM5Z5LQ93pXVdLiGdUY/w= + bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: version "4.11.8" resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" @@ -7885,6 +7971,11 @@ deep-equal@^1.0.1, deep-equal@^1.1.1: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" +deep-equal@~0.1.0: + version "0.1.2" + resolved "https://registry.npmjs.org/deep-equal/-/deep-equal-0.1.2.tgz#b246c2b80a570a47c11be1d9bd1070ec878b87ce" + integrity sha1-skbCuApXCkfBG+HZvRBw7IeLh84= + deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" @@ -7905,7 +7996,7 @@ deep-object-diff@^1.1.0: resolved "https://registry.npmjs.org/deep-object-diff/-/deep-object-diff-1.1.0.tgz#d6fabf476c2ed1751fc94d5ca693d2ed8c18bc5a" integrity sha512-b+QLs5vHgS+IoSNcUE4n9HP2NwcHj7aqnJWsjPtuG75Rh5TOaGt0OjAYInh77d5T16V5cRDC+Pw/6ZZZiETBGw== -deepmerge@^4.2.2: +deepmerge@4.2.2, deepmerge@^4.2.2: version "4.2.2" resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== @@ -7959,6 +8050,11 @@ define-property@^2.0.2: is-descriptor "^1.0.2" isobject "^3.0.1" +defined@~0.0.0: + version "0.0.0" + resolved "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz#f35eea7d705e933baf13b2f03b3f83d921403b3e" + integrity sha1-817qfXBekzuvE7LwOz+D2SFAOz4= + del@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" @@ -9007,7 +9103,7 @@ eventemitter3@^4.0.0: resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.0.tgz#d65176163887ee59f386d64c82610b696a4a74eb" integrity sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg== -events@^3.0.0: +events@3.1.0, events@^3.0.0: version "3.1.0" resolved "https://registry.npmjs.org/events/-/events-3.1.0.tgz#84279af1b34cb75aa88bf5ff291f6d0bd9b31a59" integrity sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg== @@ -9225,6 +9321,11 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +extract-files@^8.0.0: + version "8.1.0" + resolved "https://registry.npmjs.org/extract-files/-/extract-files-8.1.0.tgz#46a0690d0fe77411a2e3804852adeaa65cd59288" + integrity sha512-PTGtfthZK79WUMk+avLmwx3NGdU8+iVFXC2NMGxKsn0MnihOG2lvumj+AZo8CTwTrwjXDgZ5tztbRlEdRjBonQ== + extract-zip@1.7.0: version "1.7.0" resolved "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz#556cc3ae9df7f452c493a0cfb51cc30277940927" @@ -10367,6 +10468,20 @@ graphql-tag@^2.9.2: resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.10.4.tgz#2f301a98219be8b178a6453bb7e33b79b66d8f83" integrity sha512-O7vG5BT3w6Sotc26ybcvLKNTdfr4GfsIVMD+LdYqXCeJIYPRyp8BIsDOUtxw7S1PYvRw5vH3278J2EDezR6mfA== +graphql-tools@5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/graphql-tools/-/graphql-tools-5.0.0.tgz#67281c834a0e29f458adba8018f424816fa627e9" + integrity sha512-5zn3vtn//382b7G3Wzz3d5q/sh+f7tVrnxeuhTMTJ7pWJijNqLxH7VEzv8VwXCq19zAzHYEosFHfXiK7qzvk7w== + dependencies: + apollo-link "^1.2.14" + apollo-upload-client "^13.0.0" + deprecated-decorator "^0.1.6" + form-data "^3.0.0" + iterall "^1.3.0" + node-fetch "^2.6.0" + tslib "^1.11.1" + uuid "^7.0.3" + graphql-tools@^4.0.0: version "4.0.8" resolved "https://registry.npmjs.org/graphql-tools/-/graphql-tools-4.0.8.tgz#e7fb9f0d43408fb0878ba66b522ce871bafe9d30" @@ -11867,7 +11982,7 @@ istanbul-reports@^3.0.2: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -iterall@^1.1.3, iterall@^1.2.1, iterall@^1.2.2: +iterall@^1.1.3, iterall@^1.2.1, iterall@^1.2.2, iterall@^1.3.0: version "1.3.0" resolved "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea" integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg== @@ -12508,6 +12623,11 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= + jsonparse@^1.2.0: version "1.3.1" resolved "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" @@ -17135,6 +17255,13 @@ restore-cursor@^3.1.0: onetime "^5.1.0" signal-exit "^3.0.2" +resumer@~0.0.0: + version "0.0.0" + resolved "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" + integrity sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k= + dependencies: + through "~2.3.4" + ret@~0.1.10: version "0.1.15" resolved "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -18664,6 +18791,18 @@ tapable@^1.0.0, tapable@^1.1.3: resolved "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== +tape@~2.3.2: + version "2.3.3" + resolved "https://registry.npmjs.org/tape/-/tape-2.3.3.tgz#2e7ce0a31df09f8d6851664a71842e0ca5057af7" + integrity sha1-Lnzgox3wn41oUWZKcYQuDKUFevc= + dependencies: + deep-equal "~0.1.0" + defined "~0.0.0" + inherits "~2.0.1" + jsonify "~0.0.0" + resumer "~0.0.0" + through "~2.3.4" + tar-fs@^1.16.3: version "1.16.3" resolved "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz#966a628841da2c4010406a82167cbd5e0c72d509" @@ -18906,7 +19045,7 @@ through2@^3.0.0: dependencies: readable-stream "2 || 3" -through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8, through@~2.3, through@~2.3.1: +through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8, through@~2.3, through@~2.3.1, through@~2.3.4: version "2.3.8" resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= @@ -19207,16 +19346,21 @@ tslib@1.10.0: resolved "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: +tslib@1.11.1, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.11.1" resolved "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== -tslib@^2.0.0, tslib@~2.0.0: +tslib@2.0.0, tslib@^2.0.0, tslib@~2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/tslib/-/tslib-2.0.0.tgz#18d13fc2dce04051e20f074cc8387fd8089ce4f3" integrity sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g== +tslib@^1.11.1: + version "1.13.0" + resolved "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" + integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== + tsutils@^3.17.1: version "3.17.1" resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" @@ -20084,6 +20228,14 @@ whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0, whatwg-mimetype@^2.3.0: resolved "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== +whatwg-streams@*: + version "0.1.1" + resolved "https://registry.npmjs.org/whatwg-streams/-/whatwg-streams-0.1.1.tgz#dd5575c965bce13da76dc0dd495629a87572e74e" + integrity sha1-3VV1yWW84T2nbcDdSVYpqHVy504= + dependencies: + bluebird "~1.0.0" + tape "~2.3.2" + whatwg-url@^6.4.1: version "6.5.0" resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" From 7811b086ebb4d9081ac4cd26d627228b5015c5c2 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 4 Aug 2020 09:46:56 +0200 Subject: [PATCH 02/80] chore(gql): added some nice stuff with the graphql context --- plugins/catalog-graphql/codegen.yml | 15 + plugins/catalog-graphql/package.json | 5 +- .../catalog-graphql/src/generated-models.ts | 288 ++++++++++++++++++ plugins/catalog-graphql/src/graphql/module.ts | 1 + plugins/catalog-graphql/src/index.ts | 2 - plugins/catalog-graphql/src/setupTests.ts | 2 - 6 files changed, 308 insertions(+), 5 deletions(-) create mode 100644 plugins/catalog-graphql/codegen.yml create mode 100644 plugins/catalog-graphql/src/generated-models.ts diff --git a/plugins/catalog-graphql/codegen.yml b/plugins/catalog-graphql/codegen.yml new file mode 100644 index 0000000000..c9e0173256 --- /dev/null +++ b/plugins/catalog-graphql/codegen.yml @@ -0,0 +1,15 @@ +overwrite: true +schema: ./src/schema.gql # You can use .js files as well +require: + - ts-node/register/transpile-only # required if you're using TS-Node +generates: + ./src/generated-models.ts: + plugins: + - typescript + - typescript-resolvers + + hooks: + afterOneFileWrite: + - prettier --write + config: + contextType: '@graphql-modules/core#ModuleContext' diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 57fade9654..8c478e767b 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -22,12 +22,15 @@ }, "dependencies": { "@backstage/backend-common": "^0.1.1-alpha.16", + "@graphql-codegen/cli": "^1.17.7", + "@graphql-codegen/typescript": "^1.17.7", + "@graphql-codegen/typescript-resolvers": "^1.17.7", "@graphql-modules/core": "^0.7.17", "@types/express": "^4.17.6", "@types/whatwg-fetch": "^0.0.33", "graphql": "^15.3.0", "node-fetch": "^2.6.0", - "whatwg-fetch": "^2.0.0", + "ts-node": "^8.10.2", "winston": "^3.2.1", "yn": "^4.0.0" }, diff --git a/plugins/catalog-graphql/src/generated-models.ts b/plugins/catalog-graphql/src/generated-models.ts new file mode 100644 index 0000000000..f0f7f2f372 --- /dev/null +++ b/plugins/catalog-graphql/src/generated-models.ts @@ -0,0 +1,288 @@ +/* + * Copyright 2020 Spotify AB + * + * 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 } from 'graphql'; +import { ModuleContext } from '@graphql-modules/core'; + +export type Maybe = T | null; +export type Exact = { + [K in keyof T]: T[K]; +}; +export type RequireFields = { + [X in Exclude]?: T[X]; +} & + { [P in K]-?: NonNullable }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; +}; + +export type EntityMetadataAnnotation = { + __typename?: 'EntityMetadataAnnotation'; + key: Scalars['String']; + value: Scalars['String']; +}; + +export type EntityMetadata = { + __typename?: 'EntityMetadata'; + name: Scalars['String']; + namespace?: Maybe; + annotation?: Maybe; + annotations: Array; +}; + +export type EntityMetadataAnnotationArgs = { + name?: Maybe; +}; + +export type CatalogEntity = { + __typename?: 'CatalogEntity'; + apiVersion?: Maybe; + kind: Scalars['String']; + metadata?: Maybe; +}; + +export type CatalogQuery = { + __typename?: 'CatalogQuery'; + list: Array; +}; + +export type Query = { + __typename?: 'Query'; + catalog: CatalogQuery; +}; + +export type ResolverTypeWrapper = Promise | T; + +export type LegacyStitchingResolver = { + fragment: string; + resolve: ResolverFn; +}; + +export type NewStitchingResolver = { + selectionSet: string; + resolve: ResolverFn; +}; +export type StitchingResolver = + | LegacyStitchingResolver + | NewStitchingResolver; +export type Resolver = + | ResolverFn + | StitchingResolver; + +export type ResolverFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => Promise | TResult; + +export type SubscriptionSubscribeFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => AsyncIterator | Promise>; + +export type SubscriptionResolveFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => TResult | Promise; + +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 { + subscribe: SubscriptionSubscribeFn; + resolve: SubscriptionResolveFn; +} + +export type SubscriptionObject< + TResult, + TKey extends string, + TParent, + TContext, + TArgs +> = + | SubscriptionSubscriberObject + | SubscriptionResolverObject; + +export type SubscriptionResolver< + TResult, + TKey extends string, + TParent = {}, + TContext = {}, + TArgs = {} +> = + | (( + ...args: any[] + ) => SubscriptionObject) + | SubscriptionObject; + +export type TypeResolveFn = ( + parent: TParent, + context: TContext, + info: GraphQLResolveInfo, +) => Maybe | Promise>; + +export type IsTypeOfResolverFn = ( + obj: T, + info: GraphQLResolveInfo, +) => boolean | Promise; + +export type NextResolverFn = () => Promise; + +export type DirectiveResolverFn< + TResult = {}, + TParent = {}, + TContext = {}, + TArgs = {} +> = ( + next: NextResolverFn, + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => TResult | Promise; + +/** Mapping between all available schema types and the resolvers types */ +export type ResolversTypes = { + EntityMetadataAnnotation: ResolverTypeWrapper; + String: ResolverTypeWrapper; + EntityMetadata: ResolverTypeWrapper; + CatalogEntity: ResolverTypeWrapper; + CatalogQuery: ResolverTypeWrapper; + Query: ResolverTypeWrapper<{}>; + Boolean: ResolverTypeWrapper; +}; + +/** Mapping between all available schema types and the resolvers parents */ +export type ResolversParentTypes = { + EntityMetadataAnnotation: EntityMetadataAnnotation; + String: Scalars['String']; + EntityMetadata: EntityMetadata; + CatalogEntity: CatalogEntity; + CatalogQuery: CatalogQuery; + Query: {}; + Boolean: Scalars['Boolean']; +}; + +export type EntityMetadataAnnotationResolvers< + ContextType = ModuleContext, + ParentType extends ResolversParentTypes['EntityMetadataAnnotation'] = ResolversParentTypes['EntityMetadataAnnotation'] +> = { + key?: Resolver; + value?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}; + +export type EntityMetadataResolvers< + ContextType = ModuleContext, + ParentType extends ResolversParentTypes['EntityMetadata'] = ResolversParentTypes['EntityMetadata'] +> = { + name?: Resolver; + namespace?: Resolver< + Maybe, + ParentType, + ContextType + >; + annotation?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; + annotations?: Resolver< + Array, + ParentType, + ContextType + >; + __isTypeOf?: IsTypeOfResolverFn; +}; + +export type CatalogEntityResolvers< + ContextType = ModuleContext, + ParentType extends ResolversParentTypes['CatalogEntity'] = ResolversParentTypes['CatalogEntity'] +> = { + apiVersion?: Resolver< + Maybe, + ParentType, + ContextType + >; + kind?: Resolver; + metadata?: Resolver< + Maybe, + ParentType, + ContextType + >; + __isTypeOf?: IsTypeOfResolverFn; +}; + +export type CatalogQueryResolvers< + ContextType = ModuleContext, + ParentType extends ResolversParentTypes['CatalogQuery'] = ResolversParentTypes['CatalogQuery'] +> = { + list?: Resolver< + Array, + ParentType, + ContextType + >; + __isTypeOf?: IsTypeOfResolverFn; +}; + +export type QueryResolvers< + ContextType = ModuleContext, + ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query'] +> = { + catalog?: Resolver; +}; + +export type Resolvers = { + EntityMetadataAnnotation?: EntityMetadataAnnotationResolvers; + EntityMetadata?: EntityMetadataResolvers; + CatalogEntity?: CatalogEntityResolvers; + CatalogQuery?: CatalogQueryResolvers; + Query?: QueryResolvers; +}; + +/** + * @deprecated + * Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config. + */ +export type IResolvers = Resolvers; diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index 65239d27db..7648b7d302 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -19,6 +19,7 @@ import fetch from 'node-fetch'; import fs from 'fs'; import path from 'path'; import { GraphQLModule } from '@graphql-modules/core'; +import { QueryResolvers } from './types'; export interface ModuleOptions { logger: Logger; diff --git a/plugins/catalog-graphql/src/index.ts b/plugins/catalog-graphql/src/index.ts index dd6508f88a..2e3f1c1fe2 100644 --- a/plugins/catalog-graphql/src/index.ts +++ b/plugins/catalog-graphql/src/index.ts @@ -14,6 +14,4 @@ * limitations under the License. */ -require('whatwg-fetch'); - export * from './graphql/module'; diff --git a/plugins/catalog-graphql/src/setupTests.ts b/plugins/catalog-graphql/src/setupTests.ts index ac41ef995a..1485402d0d 100644 --- a/plugins/catalog-graphql/src/setupTests.ts +++ b/plugins/catalog-graphql/src/setupTests.ts @@ -13,6 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('whatwg-fetch'); - export {}; From 9bd1db1ed161621cde965bee0244a6a85a2c63a6 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 5 Aug 2020 07:26:44 +0200 Subject: [PATCH 03/80] chore(gql): removing old graphql things --- plugins/bogus-graphql/.eslintrc.js | 3 -- plugins/bogus-graphql/README.md | 13 ------ plugins/bogus-graphql/package.json | 44 ------------------- plugins/bogus-graphql/scripts/mock-data.sh | 2 - plugins/bogus-graphql/src/graphql/module.ts | 47 --------------------- plugins/bogus-graphql/src/index.ts | 19 --------- plugins/bogus-graphql/src/schema.gql | 3 -- plugins/bogus-graphql/src/setupTests.ts | 18 -------- 8 files changed, 149 deletions(-) delete mode 100644 plugins/bogus-graphql/.eslintrc.js delete mode 100644 plugins/bogus-graphql/README.md delete mode 100644 plugins/bogus-graphql/package.json delete mode 100755 plugins/bogus-graphql/scripts/mock-data.sh delete mode 100644 plugins/bogus-graphql/src/graphql/module.ts delete mode 100644 plugins/bogus-graphql/src/index.ts delete mode 100644 plugins/bogus-graphql/src/schema.gql delete mode 100644 plugins/bogus-graphql/src/setupTests.ts diff --git a/plugins/bogus-graphql/.eslintrc.js b/plugins/bogus-graphql/.eslintrc.js deleted file mode 100644 index 16a033dbc6..0000000000 --- a/plugins/bogus-graphql/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: [require.resolve('@backstage/cli/config/eslint.backend')], -}; diff --git a/plugins/bogus-graphql/README.md b/plugins/bogus-graphql/README.md deleted file mode 100644 index 3f85ec766e..0000000000 --- a/plugins/bogus-graphql/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# graphql - -Welcome to the graphql backend plugin! - -_This plugin was created through the Backstage CLI_ - -## Getting started - -Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/graphql](http://localhost:3000/graphql). - -You can also serve the plugin in isolation by running `yarn start` in the plugin directory. -This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. -It is only meant for local development, and the setup for it can be found inside the [/dev](/dev) directory. diff --git a/plugins/bogus-graphql/package.json b/plugins/bogus-graphql/package.json deleted file mode 100644 index a5a439a701..0000000000 --- a/plugins/bogus-graphql/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@backstage/plugin-bogus-graphql", - "version": "0.1.1-alpha.16", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", - "private": true, - "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" - }, - "scripts": { - "start": "backstage-cli backend:dev", - "build": "backstage-cli backend:build", - "lint": "backstage-cli lint", - "test": "backstage-cli test", - "prepack": "backstage-cli prepack", - "postpack": "backstage-cli postpack", - "clean": "backstage-cli clean", - "mock-data": "./scripts/mock-data.sh" - }, - "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.16", - "@graphql-modules/core": "^0.7.17", - "@types/express": "^4.17.6", - "@types/whatwg-fetch": "^0.0.33", - "graphql": "^15.3.0", - "node-fetch": "^2.6.0", - "whatwg-fetch": "^2.0.0", - "winston": "^3.2.1", - "yn": "^4.0.0" - }, - "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.16", - "@types/supertest": "^2.0.8", - "eslint-plugin-graphql": "^4.0.0", - "msw": "^0.19.5", - "supertest": "^4.0.2" - }, - "files": [ - "dist" - ] -} diff --git a/plugins/bogus-graphql/scripts/mock-data.sh b/plugins/bogus-graphql/scripts/mock-data.sh deleted file mode 100755 index ff30921715..0000000000 --- a/plugins/bogus-graphql/scripts/mock-data.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo "use this script to load your service with some mock data if needed!" diff --git a/plugins/bogus-graphql/src/graphql/module.ts b/plugins/bogus-graphql/src/graphql/module.ts deleted file mode 100644 index f247686ea8..0000000000 --- a/plugins/bogus-graphql/src/graphql/module.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2020 Spotify AB - * - * 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 fs from 'fs'; -import path from 'path'; -import { GraphQLModule } from '@graphql-modules/core'; - -export interface ModuleOptions { - logger: Logger; -} - -export async function createModule( - options: ModuleOptions, -): Promise { - const typeDefs = await fs.promises.readFile( - path.resolve(__dirname, '..', 'schema.gql'), - 'utf-8', - ); - - const resolvers = { - EntityMetadata: { - uppercaseName: metadata => metadata.name.toUpperCase(), - }, - }; - - const module = new GraphQLModule({ - typeDefs, - resolvers, - logger: options.logger as any, - }); - - return module; -} diff --git a/plugins/bogus-graphql/src/index.ts b/plugins/bogus-graphql/src/index.ts deleted file mode 100644 index dd6508f88a..0000000000 --- a/plugins/bogus-graphql/src/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2020 Spotify AB - * - * 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. - */ - -require('whatwg-fetch'); - -export * from './graphql/module'; diff --git a/plugins/bogus-graphql/src/schema.gql b/plugins/bogus-graphql/src/schema.gql deleted file mode 100644 index 74c0853a92..0000000000 --- a/plugins/bogus-graphql/src/schema.gql +++ /dev/null @@ -1,3 +0,0 @@ -type EntityMetadata { - uppercaseName: String -} diff --git a/plugins/bogus-graphql/src/setupTests.ts b/plugins/bogus-graphql/src/setupTests.ts deleted file mode 100644 index ac41ef995a..0000000000 --- a/plugins/bogus-graphql/src/setupTests.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2020 Spotify AB - * - * 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. - */ -require('whatwg-fetch'); - -export {}; From de1ddc1096d7253b952aca10fca064433f6b3d86 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 5 Aug 2020 07:27:07 +0200 Subject: [PATCH 04/80] chore(gql): pass through the config for the catalog client --- plugins/graphql/package.json | 2 +- plugins/graphql/src/service/router.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/graphql/package.json b/plugins/graphql/package.json index bc5004c580..8c90c74440 100644 --- a/plugins/graphql/package.json +++ b/plugins/graphql/package.json @@ -21,8 +21,8 @@ }, "dependencies": { "@backstage/backend-common": "^0.1.1-alpha.16", + "@backstage/config": "^0.1.1-alpha.16", "@backstage/plugin-catalog-graphql": "^0.1.1-alpha.16", - "@backstage/plugin-bogus-graphql": "^0.1.1-alpha.16", "@graphql-modules/core": "^0.7.17", "@types/express": "^4.17.6", "apollo-server": "^2.16.0", diff --git a/plugins/graphql/src/service/router.ts b/plugins/graphql/src/service/router.ts index 6845bb366e..784b801b86 100644 --- a/plugins/graphql/src/service/router.ts +++ b/plugins/graphql/src/service/router.ts @@ -23,7 +23,7 @@ import path from 'path'; import { GraphQLModule } from '@graphql-modules/core'; import { ApolloServer } from 'apollo-server-express'; import { createModule as createCatalogModule } from '@backstage/plugin-catalog-graphql'; -import { createModule as createBogusModule } from '@backstage/plugin-bogus-graphql'; +import { Config } from '@backstage/config'; const schemaPath = path.resolve( require.resolve('@backstage/plugin-graphql-backend/package.json'), @@ -32,6 +32,7 @@ const schemaPath = path.resolve( export interface RouterOptions { logger: Logger; + config: Config; } export async function createRouter( @@ -40,9 +41,8 @@ export async function createRouter( const typeDefs = await fs.promises.readFile(schemaPath, 'utf-8'); const catalogModule = await createCatalogModule(options); - const bogusModule = await createBogusModule(options); const { schema } = new GraphQLModule({ - imports: [catalogModule, bogusModule], + imports: [catalogModule], typeDefs, }); From b9c21c6fbaeedd5ea3de4295736b8c5e18d9e961 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 5 Aug 2020 07:27:32 +0200 Subject: [PATCH 05/80] chore(gql): tidying up the graphql code --- plugins/catalog-graphql/.gitignore | 1 + plugins/catalog-graphql/codegen.yml | 11 +- plugins/catalog-graphql/package.json | 3 + .../catalog-graphql/src/generated-models.ts | 288 ------------------ plugins/catalog-graphql/src/graphql/module.ts | 61 ++-- plugins/catalog-graphql/src/schema.gql | 2 +- plugins/catalog-graphql/src/service/client.ts | 30 ++ 7 files changed, 68 insertions(+), 328 deletions(-) create mode 100644 plugins/catalog-graphql/.gitignore delete mode 100644 plugins/catalog-graphql/src/generated-models.ts create mode 100644 plugins/catalog-graphql/src/service/client.ts diff --git a/plugins/catalog-graphql/.gitignore b/plugins/catalog-graphql/.gitignore new file mode 100644 index 0000000000..5a5538170a --- /dev/null +++ b/plugins/catalog-graphql/.gitignore @@ -0,0 +1 @@ +src/graphql/types.ts diff --git a/plugins/catalog-graphql/codegen.yml b/plugins/catalog-graphql/codegen.yml index c9e0173256..ebdb34a938 100644 --- a/plugins/catalog-graphql/codegen.yml +++ b/plugins/catalog-graphql/codegen.yml @@ -1,15 +1,16 @@ overwrite: true -schema: ./src/schema.gql # You can use .js files as well +schema: ./src/schema.gql require: - - ts-node/register/transpile-only # required if you're using TS-Node + - ts-node/register/transpile-only generates: - ./src/generated-models.ts: + ./src/graphql/types.ts: plugins: - typescript - typescript-resolvers - hooks: afterOneFileWrite: - - prettier --write + - eslint --fix config: contextType: '@graphql-modules/core#ModuleContext' + useIndexSignature: true + defaultMapper: Partial<{T}> diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 8c478e767b..8a0c0474f6 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -17,11 +17,14 @@ "test": "backstage-cli test", "prepack": "backstage-cli prepack", "postpack": "backstage-cli postpack", + "postinstall": "graphql-codegen", "clean": "backstage-cli clean", "mock-data": "./scripts/mock-data.sh" }, "dependencies": { "@backstage/backend-common": "^0.1.1-alpha.16", + "@backstage/catalog-model": "^0.1.1-alpha.16", + "@backstage/config": "^0.1.1-alpha.16", "@graphql-codegen/cli": "^1.17.7", "@graphql-codegen/typescript": "^1.17.7", "@graphql-codegen/typescript-resolvers": "^1.17.7", diff --git a/plugins/catalog-graphql/src/generated-models.ts b/plugins/catalog-graphql/src/generated-models.ts deleted file mode 100644 index f0f7f2f372..0000000000 --- a/plugins/catalog-graphql/src/generated-models.ts +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright 2020 Spotify AB - * - * 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 } from 'graphql'; -import { ModuleContext } from '@graphql-modules/core'; - -export type Maybe = T | null; -export type Exact = { - [K in keyof T]: T[K]; -}; -export type RequireFields = { - [X in Exclude]?: T[X]; -} & - { [P in K]-?: NonNullable }; -/** All built-in and custom scalars, mapped to their actual values */ -export type Scalars = { - ID: string; - String: string; - Boolean: boolean; - Int: number; - Float: number; -}; - -export type EntityMetadataAnnotation = { - __typename?: 'EntityMetadataAnnotation'; - key: Scalars['String']; - value: Scalars['String']; -}; - -export type EntityMetadata = { - __typename?: 'EntityMetadata'; - name: Scalars['String']; - namespace?: Maybe; - annotation?: Maybe; - annotations: Array; -}; - -export type EntityMetadataAnnotationArgs = { - name?: Maybe; -}; - -export type CatalogEntity = { - __typename?: 'CatalogEntity'; - apiVersion?: Maybe; - kind: Scalars['String']; - metadata?: Maybe; -}; - -export type CatalogQuery = { - __typename?: 'CatalogQuery'; - list: Array; -}; - -export type Query = { - __typename?: 'Query'; - catalog: CatalogQuery; -}; - -export type ResolverTypeWrapper = Promise | T; - -export type LegacyStitchingResolver = { - fragment: string; - resolve: ResolverFn; -}; - -export type NewStitchingResolver = { - selectionSet: string; - resolve: ResolverFn; -}; -export type StitchingResolver = - | LegacyStitchingResolver - | NewStitchingResolver; -export type Resolver = - | ResolverFn - | StitchingResolver; - -export type ResolverFn = ( - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => Promise | TResult; - -export type SubscriptionSubscribeFn = ( - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => AsyncIterator | Promise>; - -export type SubscriptionResolveFn = ( - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => TResult | Promise; - -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 { - subscribe: SubscriptionSubscribeFn; - resolve: SubscriptionResolveFn; -} - -export type SubscriptionObject< - TResult, - TKey extends string, - TParent, - TContext, - TArgs -> = - | SubscriptionSubscriberObject - | SubscriptionResolverObject; - -export type SubscriptionResolver< - TResult, - TKey extends string, - TParent = {}, - TContext = {}, - TArgs = {} -> = - | (( - ...args: any[] - ) => SubscriptionObject) - | SubscriptionObject; - -export type TypeResolveFn = ( - parent: TParent, - context: TContext, - info: GraphQLResolveInfo, -) => Maybe | Promise>; - -export type IsTypeOfResolverFn = ( - obj: T, - info: GraphQLResolveInfo, -) => boolean | Promise; - -export type NextResolverFn = () => Promise; - -export type DirectiveResolverFn< - TResult = {}, - TParent = {}, - TContext = {}, - TArgs = {} -> = ( - next: NextResolverFn, - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => TResult | Promise; - -/** Mapping between all available schema types and the resolvers types */ -export type ResolversTypes = { - EntityMetadataAnnotation: ResolverTypeWrapper; - String: ResolverTypeWrapper; - EntityMetadata: ResolverTypeWrapper; - CatalogEntity: ResolverTypeWrapper; - CatalogQuery: ResolverTypeWrapper; - Query: ResolverTypeWrapper<{}>; - Boolean: ResolverTypeWrapper; -}; - -/** Mapping between all available schema types and the resolvers parents */ -export type ResolversParentTypes = { - EntityMetadataAnnotation: EntityMetadataAnnotation; - String: Scalars['String']; - EntityMetadata: EntityMetadata; - CatalogEntity: CatalogEntity; - CatalogQuery: CatalogQuery; - Query: {}; - Boolean: Scalars['Boolean']; -}; - -export type EntityMetadataAnnotationResolvers< - ContextType = ModuleContext, - ParentType extends ResolversParentTypes['EntityMetadataAnnotation'] = ResolversParentTypes['EntityMetadataAnnotation'] -> = { - key?: Resolver; - value?: Resolver; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type EntityMetadataResolvers< - ContextType = ModuleContext, - ParentType extends ResolversParentTypes['EntityMetadata'] = ResolversParentTypes['EntityMetadata'] -> = { - name?: Resolver; - namespace?: Resolver< - Maybe, - ParentType, - ContextType - >; - annotation?: Resolver< - Maybe, - ParentType, - ContextType, - RequireFields - >; - annotations?: Resolver< - Array, - ParentType, - ContextType - >; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type CatalogEntityResolvers< - ContextType = ModuleContext, - ParentType extends ResolversParentTypes['CatalogEntity'] = ResolversParentTypes['CatalogEntity'] -> = { - apiVersion?: Resolver< - Maybe, - ParentType, - ContextType - >; - kind?: Resolver; - metadata?: Resolver< - Maybe, - ParentType, - ContextType - >; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type CatalogQueryResolvers< - ContextType = ModuleContext, - ParentType extends ResolversParentTypes['CatalogQuery'] = ResolversParentTypes['CatalogQuery'] -> = { - list?: Resolver< - Array, - ParentType, - ContextType - >; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type QueryResolvers< - ContextType = ModuleContext, - ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query'] -> = { - catalog?: Resolver; -}; - -export type Resolvers = { - EntityMetadataAnnotation?: EntityMetadataAnnotationResolvers; - EntityMetadata?: EntityMetadataResolvers; - CatalogEntity?: CatalogEntityResolvers; - CatalogQuery?: CatalogQueryResolvers; - Query?: QueryResolvers; -}; - -/** - * @deprecated - * Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config. - */ -export type IResolvers = Resolvers; diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index 7648b7d302..1fc13d7950 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -15,43 +15,28 @@ */ import { Logger } from 'winston'; -import fetch from 'node-fetch'; import fs from 'fs'; import path from 'path'; import { GraphQLModule } from '@graphql-modules/core'; -import { QueryResolvers } from './types'; +import { Resolvers, CatalogEntity, CatalogQuery } from './types'; +import { Entity } from '@backstage/catalog-model'; +import { Config } from '@backstage/config'; +import { CatalogClient } from '../service/client'; export interface ModuleOptions { logger: Logger; + config: Config; } -// function wrapLogger(logger: Logger) { -// return { -// log: (msg: string | Error, ...extra: any[]) => -// logger.info(String(msg), ...extra), -// debug: (msg: string | Error, ...extra: any[]) => -// logger.info(String(msg), ...extra), -// info: (msg: string | Error, ...extra: any[]) => -// logger.info(String(msg), ...extra), -// error: (msg: string | Error, ...extra: any[]) => -// logger.info(String(msg), ...extra), -// clientError: (msg: string | Error, ...extra: any[]) => -// logger.info(String(msg), ...extra), -// warn: (msg: string | Error, ...extra: any[]) => -// logger.info(String(msg), ...extra), -// }; -// } - -class CatalogClient { - async list() { - const res = await fetch('http://localhost:7000/catalog/entities'); - if (!res.ok) { - throw new Error(`NOPE, ${await res.text()}`); - } - - return res.json(); - } -} +const parseToCatalogEntities = (e: Entity): CatalogEntity => ({ + ...e, + metadata: { + ...e.metadata, + annotations: Object.entries( + e.metadata.annotations ?? {}, + ).map(([key, value]) => ({ key, value })), + }, +}); export async function createModule( options: ModuleOptions, @@ -61,16 +46,24 @@ export async function createModule( 'utf-8', ); - const catalogClient = new CatalogClient(); + const catalogClient = new CatalogClient( + options.config.getString('backend.baseUrl'), + ); - const resolvers = { + const resolvers: Resolvers = { Query: { - catalog: () => true, + catalog: () => ({} as CatalogQuery), }, CatalogQuery: { - list: () => catalogClient.list(), + list: async () => { + const list = await catalogClient.list(); + return list.map(parseToCatalogEntities); + }, + }, + EntityMetadata: { + annotation: (e, { name }) => + e.annotations?.find(a => a.key === name) ?? null, }, - CatalogEntity: () => ({}), }; const module = new GraphQLModule({ diff --git a/plugins/catalog-graphql/src/schema.gql b/plugins/catalog-graphql/src/schema.gql index ea92d4e04f..b28f796855 100644 --- a/plugins/catalog-graphql/src/schema.gql +++ b/plugins/catalog-graphql/src/schema.gql @@ -7,7 +7,7 @@ type EntityMetadata { name: String! namespace: String annotation(name: String): EntityMetadataAnnotation - annotations: [EntityMetadataAnnotation!]! + annotations: [EntityMetadataAnnotation!] } type CatalogEntity { diff --git a/plugins/catalog-graphql/src/service/client.ts b/plugins/catalog-graphql/src/service/client.ts new file mode 100644 index 0000000000..091a8a8cc0 --- /dev/null +++ b/plugins/catalog-graphql/src/service/client.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Spotify AB + * + * 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 } from '@backstage/catalog-model'; +import fetch from 'node-fetch'; + +export class CatalogClient { + constructor(private baseUrl: string) {} + async list(): Promise { + const res = await fetch(`${this.baseUrl}/catalog/entities`); + if (!res.ok) { + throw new Error(`NOPE, ${await res.text()}`); + } + + return await (res.json() as Promise); + } +} From 11de4c5f4bfa082384dab2951d9c8d7cbb7e02f7 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 5 Aug 2020 07:27:51 +0200 Subject: [PATCH 06/80] gotcha(gql): if you just import the type the config library doesnt work :shrug: --- packages/backend/src/index.ts | 1 - packages/backend/src/plugins/graphql.ts | 8 +- yarn.lock | 981 +++++++++++++++++++++--- 3 files changed, 881 insertions(+), 109 deletions(-) diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 3fccfe9c59..d22e1088a7 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -88,7 +88,6 @@ async function main() { const configs = await loadConfig({ shouldReadSecrets: true }); const configReader = ConfigReader.fromConfigs(configs); const createEnv = makeCreateEnv(configs); - const healthcheckEnv = useHotMemoize(module, () => createEnv('healthcheck')); const catalogEnv = useHotMemoize(module, () => createEnv('catalog')); const scaffolderEnv = useHotMemoize(module, () => createEnv('scaffolder')); diff --git a/packages/backend/src/plugins/graphql.ts b/packages/backend/src/plugins/graphql.ts index 0f9b167d19..d52e28f9cb 100644 --- a/packages/backend/src/plugins/graphql.ts +++ b/packages/backend/src/plugins/graphql.ts @@ -30,10 +30,14 @@ */ import { createRouter } from '@backstage/plugin-graphql-backend'; -import type { PluginEnvironment } from '../types'; +import { PluginEnvironment } from '../types'; -export default async function createPlugin({ logger }: PluginEnvironment) { +export default async function createPlugin({ + logger, + config, +}: PluginEnvironment) { return await createRouter({ logger, + config, }); } diff --git a/yarn.lock b/yarn.lock index 9e463417b4..36a360c119 100644 --- a/yarn.lock +++ b/yarn.lock @@ -77,6 +77,28 @@ invariant "^2.2.4" semver "^5.5.0" +"@babel/core@^7.0.0": + version "7.11.1" + resolved "https://registry.npmjs.org/@babel/core/-/core-7.11.1.tgz#2c55b604e73a40dc21b0e52650b11c65cf276643" + integrity sha512-XqF7F6FWQdKGGWAzGELL+aCO1p+lRY5Tj5/tbT3St1G8NaH70jhhDIKknIZaDans0OQBG5wRAldROLHSt44BgQ== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/generator" "^7.11.0" + "@babel/helper-module-transforms" "^7.11.0" + "@babel/helpers" "^7.10.4" + "@babel/parser" "^7.11.1" + "@babel/template" "^7.10.4" + "@babel/traverse" "^7.11.0" + "@babel/types" "^7.11.0" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.1" + json5 "^2.1.2" + lodash "^4.17.19" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + "@babel/core@^7.1.0", "@babel/core@^7.4.4", "@babel/core@^7.4.5", "@babel/core@^7.7.5": version "7.9.6" resolved "https://registry.npmjs.org/@babel/core/-/core-7.9.6.tgz#d9aa1f580abf3b2286ef40b6904d390904c63376" @@ -108,6 +130,15 @@ jsesc "^2.5.1" source-map "^0.5.0" +"@babel/generator@^7.11.0", "@babel/generator@^7.5.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.11.0.tgz#4b90c78d8c12825024568cbe83ee6c9af193585c" + integrity sha512-fEm3Uzw7Mc9Xi//qU20cBKatTfs2aOtKqmvy/Vm7RkJEGFQ4xc9myCfbXxqK//ZS8MR/ciOHw6meGASJuKmDfQ== + dependencies: + "@babel/types" "^7.11.0" + jsesc "^2.5.1" + source-map "^0.5.0" + "@babel/generator@^7.9.6": version "7.9.6" resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.9.6.tgz#5408c82ac5de98cda0d77d8124e99fa1f2170a43" @@ -307,6 +338,19 @@ "@babel/types" "^7.10.5" lodash "^4.17.19" +"@babel/helper-module-transforms@^7.11.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz#b16f250229e47211abdd84b34b64737c2ab2d359" + integrity sha512-02EVu8COMuTRO1TAzdMtpBPbe6aQ1w/8fePD2YgQmxZU4gpNWaL9gK3Jp7dxlkUlUCJOTaSeA+Hrm1BRQwqIhg== + dependencies: + "@babel/helper-module-imports" "^7.10.4" + "@babel/helper-replace-supers" "^7.10.4" + "@babel/helper-simple-access" "^7.10.4" + "@babel/helper-split-export-declaration" "^7.11.0" + "@babel/template" "^7.10.4" + "@babel/types" "^7.11.0" + lodash "^4.17.19" + "@babel/helper-module-transforms@^7.9.0": version "7.9.0" resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz#43b34dfe15961918707d247327431388e9fe96e5" @@ -405,6 +449,13 @@ "@babel/template" "^7.8.3" "@babel/types" "^7.8.3" +"@babel/helper-skip-transparent-expression-wrappers@^7.11.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.11.0.tgz#eec162f112c2f58d3af0af125e3bb57665146729" + integrity sha512-0XIdiQln4Elglgjbwo9wuJpL/K7AGCY26kmEt0+pRP0TAj4jjyNq1MjoRvikrTVqKcx4Gysxt4cXvVFXP/JO2Q== + dependencies: + "@babel/types" "^7.11.0" + "@babel/helper-split-export-declaration@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.4.tgz#2c70576eaa3b5609b24cb99db2888cc3fc4251d1" @@ -412,6 +463,13 @@ dependencies: "@babel/types" "^7.10.4" +"@babel/helper-split-export-declaration@^7.11.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz#f8a491244acf6a676158ac42072911ba83ad099f" + integrity sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg== + dependencies: + "@babel/types" "^7.11.0" + "@babel/helper-split-export-declaration@^7.8.3": version "7.8.3" resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz#31a9f30070f91368a7182cf05f831781065fc7a9" @@ -439,6 +497,15 @@ "@babel/traverse" "^7.10.4" "@babel/types" "^7.10.4" +"@babel/helpers@^7.10.4": + version "7.10.4" + resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.10.4.tgz#2abeb0d721aff7c0a97376b9e1f6f65d7a475044" + integrity sha512-L2gX/XeUONeEbI78dXSrJzGdz4GQ+ZTA/aazfUsFaWjSe95kiCuOZ5HsXvkiw3iwF+mFHSRUfJU8t6YavocdXA== + dependencies: + "@babel/template" "^7.10.4" + "@babel/traverse" "^7.10.4" + "@babel/types" "^7.10.4" + "@babel/helpers@^7.9.6": version "7.9.6" resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.9.6.tgz#092c774743471d0bb6c7de3ad465ab3d3486d580" @@ -466,16 +533,21 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/parser@7.10.5", "@babel/parser@^7.10.4", "@babel/parser@^7.10.5": + version "7.10.5" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.10.5.tgz#e7c6bf5a7deff957cec9f04b551e2762909d826b" + integrity sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ== + +"@babel/parser@^7.0.0", "@babel/parser@^7.11.0", "@babel/parser@^7.11.1": + version "7.11.1" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.11.1.tgz#d91a387990b21e5d20047b336bb19b0553f02ff5" + integrity sha512-u9QMIRdKVF7hfEkb3nu2LgZDIzCQPv+yHD9Eg6ruoJLjkrQ9fFz4IBSlF/9XwoNri9+2F1IY+dYuOfZrXq8t3w== + "@babel/parser@^7.1.0", "@babel/parser@^7.7.5", "@babel/parser@^7.8.6", "@babel/parser@^7.9.6": version "7.9.6" resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.9.6.tgz#3b1bbb30dabe600cd72db58720998376ff653bc7" integrity sha512-AoeIEJn8vt+d/6+PXDRPaksYhnlbMIiejioBZvvMQsOjW/JYK6k/0dKnvvP3EhK5GfMBWDPtrxRtegWdAcdq9Q== -"@babel/parser@^7.10.4", "@babel/parser@^7.10.5": - version "7.10.5" - resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.10.5.tgz#e7c6bf5a7deff957cec9f04b551e2762909d826b" - integrity sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ== - "@babel/plugin-proposal-async-generator-functions@^7.10.4": version "7.10.5" resolved "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.5.tgz#3491cabf2f7c179ab820606cec27fed15e0e8558" @@ -485,7 +557,7 @@ "@babel/helper-remap-async-to-generator" "^7.10.4" "@babel/plugin-syntax-async-generators" "^7.8.0" -"@babel/plugin-proposal-class-properties@^7.10.4": +"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.10.4.tgz#a33bf632da390a59c7a8c570045d1115cd778807" integrity sha512-vhwkEROxzcHGNu2mzUC0OFFNXdZ4M23ib8aRRcJSsW8BZK9pQMD7QB7csl97NBbgGZO7ZyHUyKDnxzOaP4IrCg== @@ -533,6 +605,15 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-numeric-separator" "^7.10.4" +"@babel/plugin-proposal-object-rest-spread@^7.0.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.11.0.tgz#bd81f95a1f746760ea43b6c2d3d62b11790ad0af" + integrity sha512-wzch41N4yztwoRw0ak+37wxwJM2oiIiy6huGCoqkvSTA9acYWcPfn9Y4aJqmFFJ70KTJUu29f3DQ43uJ9HXzEA== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-object-rest-spread" "^7.8.0" + "@babel/plugin-transform-parameters" "^7.10.4" + "@babel/plugin-proposal-object-rest-spread@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.10.4.tgz#50129ac216b9a6a55b3853fdd923e74bf553a4c0" @@ -604,7 +685,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-class-properties@^7.10.4": +"@babel/plugin-syntax-class-properties@^7.0.0", "@babel/plugin-syntax-class-properties@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.10.4.tgz#6644e6a0baa55a61f9e3231f6c9eeb6ee46c124c" integrity sha512-GCSBF7iUle6rNugfURwNmCGG3Z/2+opxAMLs1nND4bhEG5PuxTIggDBoeYYSujAlLtsupzOHYJQgPS3pivwXIA== @@ -625,6 +706,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" +"@babel/plugin-syntax-flow@^7.0.0", "@babel/plugin-syntax-flow@^7.10.4": + version "7.10.4" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.10.4.tgz#53351dd7ae01995e567d04ce42af1a6e0ba846a6" + integrity sha512-yxQsX1dJixF4qEEdzVbst3SZQ58Nrooz8NV9Z9GL4byTE25BvJgl5lf0RECUf0fh28rZBb/RYTWn/eeKwCMrZQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-flow@^7.8.3": version "7.8.3" resolved "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.8.3.tgz#f2c883bd61a6316f2c89380ae5122f923ba4527f" @@ -639,7 +727,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.10.4": +"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.10.4.tgz#39abaae3cbf710c4373d8429484e6ba21340166c" integrity sha512-KCg9mio9jwiARCB7WAcQ7Y1q+qicILjoK8LP/VkPkEKaf5dkaZZK1EcTe91a3JJlZ3qy6L5s9X52boEYi8DM9g== @@ -674,7 +762,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-object-rest-spread@^7.8.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== @@ -702,7 +790,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-arrow-functions@^7.10.4": +"@babel/plugin-transform-arrow-functions@^7.0.0", "@babel/plugin-transform-arrow-functions@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.10.4.tgz#e22960d77e697c74f41c501d44d73dbf8a6a64cd" integrity sha512-9J/oD1jV0ZCBcgnoFWFq1vJd4msoKb/TCpGNFyyLt0zABdcvgK3aYikZ8HjzB14c26bc7E3Q1yugpwGy2aTPNA== @@ -718,13 +806,20 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/helper-remap-async-to-generator" "^7.10.4" -"@babel/plugin-transform-block-scoped-functions@^7.10.4": +"@babel/plugin-transform-block-scoped-functions@^7.0.0", "@babel/plugin-transform-block-scoped-functions@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.10.4.tgz#1afa595744f75e43a91af73b0d998ecfe4ebc2e8" integrity sha512-WzXDarQXYYfjaV1szJvN3AD7rZgZzC1JtjJZ8dMHUyiK8mxPRahynp14zzNjU3VkPqPsO38CzxiWO1c9ARZ8JA== dependencies: "@babel/helper-plugin-utils" "^7.10.4" +"@babel/plugin-transform-block-scoping@^7.0.0": + version "7.11.1" + resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.11.1.tgz#5b7efe98852bef8d652c0b28144cd93a9e4b5215" + integrity sha512-00dYeDE0EVEHuuM+26+0w/SCL0BH2Qy7LwHuI4Hi4MH5gkC8/AqMN5uWFJIsoXZrAphiMm1iXzBw6L2T+eA0ew== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-transform-block-scoping@^7.10.4": version "7.10.5" resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.10.5.tgz#b81b8aafefbfe68f0f65f7ef397b9ece68a6037d" @@ -732,7 +827,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-classes@^7.10.4": +"@babel/plugin-transform-classes@^7.0.0", "@babel/plugin-transform-classes@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.10.4.tgz#405136af2b3e218bc4a1926228bc917ab1a0adc7" integrity sha512-2oZ9qLjt161dn1ZE0Ms66xBncQH4In8Sqw1YWgBUZuGVJJS5c0OFZXL6dP2MRHrkU/eKhWg8CzFJhRQl50rQxA== @@ -746,14 +841,14 @@ "@babel/helper-split-export-declaration" "^7.10.4" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.10.4": +"@babel/plugin-transform-computed-properties@^7.0.0", "@babel/plugin-transform-computed-properties@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.10.4.tgz#9ded83a816e82ded28d52d4b4ecbdd810cdfc0eb" integrity sha512-JFwVDXcP/hM/TbyzGq3l/XWGut7p46Z3QvqFMXTfk6/09m7xZHJUN9xHfsv7vqqD4YnfI5ueYdSJtXqqBLyjBw== dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-destructuring@^7.10.4": +"@babel/plugin-transform-destructuring@^7.0.0", "@babel/plugin-transform-destructuring@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.10.4.tgz#70ddd2b3d1bea83d01509e9bb25ddb3a74fc85e5" integrity sha512-+WmfvyfsyF603iPa6825mq6Qrb7uLjTOsa3XOFzlYcYDHSS4QmpOWOL0NNBY5qMbvrcf3tq0Cw+v4lxswOBpgA== @@ -791,6 +886,14 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4" +"@babel/plugin-transform-flow-strip-types@^7.0.0": + version "7.10.4" + resolved "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.10.4.tgz#c497957f09e86e3df7296271e9eb642876bf7788" + integrity sha512-XTadyuqNst88UWBTdLjM+wEY7BFnY2sYtPyAidfC7M/QaZnSuIZpMvLxqGT7phAcnGyWh/XQFLKcGf04CnvxSQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-flow" "^7.10.4" + "@babel/plugin-transform-flow-strip-types@^7.9.0": version "7.9.0" resolved "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.9.0.tgz#8a3538aa40434e000b8f44a3c5c9ac7229bd2392" @@ -799,14 +902,14 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-flow" "^7.8.3" -"@babel/plugin-transform-for-of@^7.10.4": +"@babel/plugin-transform-for-of@^7.0.0", "@babel/plugin-transform-for-of@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.10.4.tgz#c08892e8819d3a5db29031b115af511dbbfebae9" integrity sha512-ItdQfAzu9AlEqmusA/65TqJ79eRcgGmpPPFvBnGILXZH975G0LNjP1yjHvGgfuCxqrPPueXOPe+FsvxmxKiHHQ== dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-function-name@^7.10.4": +"@babel/plugin-transform-function-name@^7.0.0", "@babel/plugin-transform-function-name@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.10.4.tgz#6a467880e0fc9638514ba369111811ddbe2644b7" integrity sha512-OcDCq2y5+E0dVD5MagT5X+yTRbcvFjDI2ZVAottGH6tzqjx/LKpgkUepu3hp/u4tZBzxxpNGwLsAvGBvQ2mJzg== @@ -814,14 +917,14 @@ "@babel/helper-function-name" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-literals@^7.10.4": +"@babel/plugin-transform-literals@^7.0.0", "@babel/plugin-transform-literals@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.10.4.tgz#9f42ba0841100a135f22712d0e391c462f571f3c" integrity sha512-Xd/dFSTEVuUWnyZiMu76/InZxLTYilOSr1UlHV+p115Z/Le2Fi1KXkJUYz0b42DfndostYlPub3m8ZTQlMaiqQ== dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-member-expression-literals@^7.10.4": +"@babel/plugin-transform-member-expression-literals@^7.0.0", "@babel/plugin-transform-member-expression-literals@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.10.4.tgz#b1ec44fcf195afcb8db2c62cd8e551c881baf8b7" integrity sha512-0bFOvPyAoTBhtcJLr9VcwZqKmSjFml1iVxvPL0ReomGU53CX53HsM4h2SzckNdkQcHox1bpAqzxBI1Y09LlBSw== @@ -837,7 +940,7 @@ "@babel/helper-plugin-utils" "^7.10.4" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-commonjs@^7.10.4": +"@babel/plugin-transform-modules-commonjs@^7.0.0", "@babel/plugin-transform-modules-commonjs@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.10.4.tgz#66667c3eeda1ebf7896d41f1f16b17105a2fbca0" integrity sha512-Xj7Uq5o80HDLlW64rVfDBhao6OX89HKUmb+9vWYaLXBZOma4gA6tw4Ni1O5qVDoZWUV0fxMYA0aYzOawz0l+1w== @@ -889,7 +992,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-object-super@^7.10.4": +"@babel/plugin-transform-object-super@^7.0.0", "@babel/plugin-transform-object-super@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.10.4.tgz#d7146c4d139433e7a6526f888c667e314a093894" integrity sha512-5iTw0JkdRdJvr7sY0vHqTpnruUpTea32JHmq/atIWqsnNussbRzjEDyWep8UNztt1B5IusBYg8Irb0bLbiEBCQ== @@ -897,7 +1000,7 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/helper-replace-supers" "^7.10.4" -"@babel/plugin-transform-parameters@^7.10.4": +"@babel/plugin-transform-parameters@^7.0.0", "@babel/plugin-transform-parameters@^7.10.4": version "7.10.5" resolved "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.10.5.tgz#59d339d58d0b1950435f4043e74e2510005e2c4a" integrity sha512-xPHwUj5RdFV8l1wuYiu5S9fqWGM2DrYc24TMvUiRrPVm+SM3XeqU9BcokQX/kEUe+p2RBwy+yoiR1w/Blq6ubw== @@ -905,7 +1008,7 @@ "@babel/helper-get-function-arity" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-property-literals@^7.10.4": +"@babel/plugin-transform-property-literals@^7.0.0", "@babel/plugin-transform-property-literals@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.10.4.tgz#f6fe54b6590352298785b83edd815d214c42e3c0" integrity sha512-ofsAcKiUxQ8TY4sScgsGeR2vJIsfrzqvFb9GvJ5UdXDzl+MyYCaBj/FGzXuv7qE0aJcjWMILny1epqelnFlz8g== @@ -919,7 +1022,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-react-display-name@^7.10.4": +"@babel/plugin-transform-react-display-name@^7.0.0", "@babel/plugin-transform-react-display-name@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.10.4.tgz#b5795f4e3e3140419c3611b7a2a3832b9aef328d" integrity sha512-Zd4X54Mu9SBfPGnEcaGcOrVAYOtjT2on8QZkLKEq1S/tHexG39d9XXGZv19VfRrDjPJzFmPfTAqOQS1pfFOujw== @@ -951,7 +1054,7 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-jsx" "^7.10.4" -"@babel/plugin-transform-react-jsx@^7.10.4": +"@babel/plugin-transform-react-jsx@^7.0.0", "@babel/plugin-transform-react-jsx@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.10.4.tgz#673c9f913948764a4421683b2bef2936968fddf2" integrity sha512-L+MfRhWjX0eI7Js093MM6MacKU4M6dnCRa/QPDwYMxjljzSCzzlzKzj9Pk4P3OtrPcxr2N3znR419nr3Xw+65A== @@ -983,13 +1086,21 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-shorthand-properties@^7.10.4": +"@babel/plugin-transform-shorthand-properties@^7.0.0", "@babel/plugin-transform-shorthand-properties@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.10.4.tgz#9fd25ec5cdd555bb7f473e5e6ee1c971eede4dd6" integrity sha512-AC2K/t7o07KeTIxMoHneyX90v3zkm5cjHJEokrPEAGEy3UCp8sLKfnfOIGdZ194fyN4wfX/zZUWT9trJZ0qc+Q== dependencies: "@babel/helper-plugin-utils" "^7.10.4" +"@babel/plugin-transform-spread@^7.0.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.11.0.tgz#fa84d300f5e4f57752fe41a6d1b3c554f13f17cc" + integrity sha512-UwQYGOqIdQJe4aWNyS7noqAnN2VbaczPLiEtln+zPowRNlD+79w3oi2TWfYe0eZgd+gjZCbsydN7lzWysDt+gw== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-skip-transparent-expression-wrappers" "^7.11.0" + "@babel/plugin-transform-spread@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.10.4.tgz#4e2c85ea0d6abaee1b24dcfbbae426fe8d674cff" @@ -1005,7 +1116,7 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/helper-regex" "^7.10.4" -"@babel/plugin-transform-template-literals@^7.10.4": +"@babel/plugin-transform-template-literals@^7.0.0", "@babel/plugin-transform-template-literals@^7.10.4": version "7.10.5" resolved "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.10.5.tgz#78bc5d626a6642db3312d9d0f001f5e7639fde8c" integrity sha512-V/lnPGIb+KT12OQikDvgSuesRX14ck5FfJXt6+tXhdkJ+Vsd0lDCVtF6jcB4rNClYFzaB2jusZ+lNISDk2mMMw== @@ -1186,6 +1297,36 @@ "@babel/parser" "^7.8.6" "@babel/types" "^7.8.6" +"@babel/traverse@7.10.5", "@babel/traverse@^7.10.4": + version "7.10.5" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.5.tgz#77ce464f5b258be265af618d8fddf0536f20b564" + integrity sha512-yc/fyv2gUjPqzTz0WHeRJH2pv7jA9kA7mBX2tXl/x5iOE81uaVPuGPtaYk7wmkx4b67mQ7NqI8rmT2pF47KYKQ== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/generator" "^7.10.5" + "@babel/helper-function-name" "^7.10.4" + "@babel/helper-split-export-declaration" "^7.10.4" + "@babel/parser" "^7.10.5" + "@babel/types" "^7.10.5" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.19" + +"@babel/traverse@^7.0.0", "@babel/traverse@^7.11.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.11.0.tgz#9b996ce1b98f53f7c3e4175115605d56ed07dd24" + integrity sha512-ZB2V+LskoWKNpMq6E5UUCrjtDUh5IOTAyIl0dTjIEoXum/iKWkoIEKIRDnUucO6f+2FzNkE0oD4RLKoPIufDtg== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/generator" "^7.11.0" + "@babel/helper-function-name" "^7.10.4" + "@babel/helper-split-export-declaration" "^7.11.0" + "@babel/parser" "^7.11.0" + "@babel/types" "^7.11.0" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.19" + "@babel/traverse@^7.1.0", "@babel/traverse@^7.7.4", "@babel/traverse@^7.8.6", "@babel/traverse@^7.9.6": version "7.9.6" resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.6.tgz#5540d7577697bf619cc57b92aa0f1c231a94f442" @@ -1201,20 +1342,14 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/traverse@^7.10.4": +"@babel/types@7.10.5", "@babel/types@^7.10.4", "@babel/types@^7.10.5": version "7.10.5" - resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.5.tgz#77ce464f5b258be265af618d8fddf0536f20b564" - integrity sha512-yc/fyv2gUjPqzTz0WHeRJH2pv7jA9kA7mBX2tXl/x5iOE81uaVPuGPtaYk7wmkx4b67mQ7NqI8rmT2pF47KYKQ== + resolved "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz#d88ae7e2fde86bfbfe851d4d81afa70a997b5d15" + integrity sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q== dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.10.5" - "@babel/helper-function-name" "^7.10.4" - "@babel/helper-split-export-declaration" "^7.10.4" - "@babel/parser" "^7.10.5" - "@babel/types" "^7.10.5" - debug "^4.1.0" - globals "^11.1.0" + "@babel/helper-validator-identifier" "^7.10.4" lodash "^4.17.19" + to-fast-properties "^2.0.0" "@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0", "@babel/types@^7.9.5", "@babel/types@^7.9.6": version "7.9.6" @@ -1225,10 +1360,10 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" -"@babel/types@^7.10.4", "@babel/types@^7.10.5": - version "7.10.5" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz#d88ae7e2fde86bfbfe851d4d81afa70a997b5d15" - integrity sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q== +"@babel/types@^7.11.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz#2ae6bf1ba9ae8c3c43824e5861269871b206e90d" + integrity sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA== dependencies: "@babel/helper-validator-identifier" "^7.10.4" lodash "^4.17.19" @@ -1479,6 +1614,119 @@ unique-filename "^1.1.1" which "^1.3.1" +"@graphql-codegen/cli@^1.17.7": + version "1.17.7" + resolved "https://registry.npmjs.org/@graphql-codegen/cli/-/cli-1.17.7.tgz#4ba45106403a3aca36585bf04f0169fda38ac9df" + integrity sha512-T9b4r7WkA+VfW8nsAjOWFoFbtpfFAAjPQM6q/8aPg6Ny3rwwefH8UDVa3P3QSfdIYl2qKnBk1FG2mNjBCUYKsg== + dependencies: + "@graphql-codegen/core" "1.17.7" + "@graphql-codegen/plugin-helpers" "1.17.7" + "@graphql-tools/apollo-engine-loader" "^6.0.0" + "@graphql-tools/code-file-loader" "^6.0.0" + "@graphql-tools/git-loader" "^6.0.0" + "@graphql-tools/github-loader" "^6.0.0" + "@graphql-tools/graphql-file-loader" "^6.0.0" + "@graphql-tools/json-file-loader" "^6.0.0" + "@graphql-tools/load" "^6.0.0" + "@graphql-tools/prisma-loader" "^6.0.0" + "@graphql-tools/url-loader" "^6.0.0" + "@graphql-tools/utils" "^6.0.0" + ansi-escapes "4.3.1" + camel-case "4.1.1" + chalk "4.1.0" + chokidar "3.4.1" + common-tags "1.8.0" + constant-case "3.0.3" + cosmiconfig "7.0.0" + debounce "1.2.0" + dependency-graph "0.9.0" + detect-indent "6.0.0" + glob "7.1.6" + graphql-config "^3.0.2" + indent-string "4.0.0" + inquirer "7.3.3" + is-glob "4.0.1" + json-to-pretty-yaml "1.2.2" + listr "0.14.3" + listr-update-renderer "0.5.0" + log-symbols "4.0.0" + lower-case "2.0.1" + minimatch "3.0.4" + mkdirp "1.0.4" + pascal-case "3.1.1" + request "2.88.2" + string-env-interpolation "1.0.1" + ts-log "2.1.4" + tslib "^2.0.0" + upper-case "2.0.1" + valid-url "1.0.9" + wrap-ansi "7.0.0" + yargs "15.4.1" + +"@graphql-codegen/core@1.17.7": + version "1.17.7" + resolved "https://registry.npmjs.org/@graphql-codegen/core/-/core-1.17.7.tgz#9f2f5798ec1c551827aa4ce6417d58cf48cd2a92" + integrity sha512-KfVoNtGCHvj/oN22Yl7ljPC9LkxvAAGDVPilYjJa3GjcT6YvF5k+ijyZ3GMjU8belN3g04Ls/WpKUsWA6HpkiQ== + dependencies: + "@graphql-codegen/plugin-helpers" "1.17.7" + "@graphql-tools/merge" "^6.0.0" + "@graphql-tools/utils" "^6.0.0" + tslib "~2.0.0" + +"@graphql-codegen/plugin-helpers@1.17.7": + version "1.17.7" + resolved "https://registry.npmjs.org/@graphql-codegen/plugin-helpers/-/plugin-helpers-1.17.7.tgz#5903105fda9470aafefe9da29e3a6fb3a52b8376" + integrity sha512-LsXS0s/ZOACZXa3W29ekcaQLzP8TsYzow6nIjW6rtkWX5T0EDooBQbDn1cdLdlpenqbUU+vtONwR6Qqc6hrq2Q== + dependencies: + "@graphql-tools/utils" "^6.0.0" + camel-case "4.1.1" + common-tags "1.8.0" + constant-case "3.0.3" + import-from "3.0.0" + lodash "~4.17.15" + lower-case "2.0.1" + param-case "3.0.3" + pascal-case "3.1.1" + tslib "~2.0.0" + upper-case "2.0.1" + +"@graphql-codegen/typescript-resolvers@^1.17.7": + version "1.17.7" + resolved "https://registry.npmjs.org/@graphql-codegen/typescript-resolvers/-/typescript-resolvers-1.17.7.tgz#fe912db2abeab36daf747108607d09bbc97b82fa" + integrity sha512-TFi7P8xSymFLj46HA8o/eLHPsY2X4z/maID+2rSaIYi+7IXVn2aHgvhFpvmmjIuCEdRvVH5Gdss7i7hwbaxW6w== + dependencies: + "@graphql-codegen/plugin-helpers" "1.17.7" + "@graphql-codegen/typescript" "1.17.7" + "@graphql-codegen/visitor-plugin-common" "1.17.7" + "@graphql-tools/utils" "^6.0.0" + auto-bind "~4.0.0" + tslib "~2.0.0" + +"@graphql-codegen/typescript@1.17.7", "@graphql-codegen/typescript@^1.17.7": + version "1.17.7" + resolved "https://registry.npmjs.org/@graphql-codegen/typescript/-/typescript-1.17.7.tgz#35d92da76d4e07b612ab1ac0bd9726fbaac1fb0d" + integrity sha512-itjssTRBIvZgoNwzz/mhDkaeZvoMqHaeN+PDqev+6gY+RDDGcr9fsEm/SLm9nOpBWZCAHFVc9u7wHlSPhbYGtw== + dependencies: + "@graphql-codegen/plugin-helpers" "1.17.7" + "@graphql-codegen/visitor-plugin-common" "1.17.7" + auto-bind "~4.0.0" + tslib "~2.0.0" + +"@graphql-codegen/visitor-plugin-common@1.17.7": + version "1.17.7" + resolved "https://registry.npmjs.org/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-1.17.7.tgz#3158ca4fc7d45a0f5a6ad0706061015eae481d9e" + integrity sha512-z5WvYqgCgPAAuMJMOE0e0nEicdaQRm59/vP+yYihKQmwrASzPlqa1BUiGDnfrPcCooB9fEUHB+cQb3gt9GRfEg== + dependencies: + "@graphql-codegen/plugin-helpers" "1.17.7" + "@graphql-tools/relay-operation-optimizer" "6.0.15" + array.prototype.flatmap "1.2.3" + auto-bind "~4.0.0" + dependency-graph "0.9.0" + graphql-tag "2.11.0" + parse-filepath "1.0.2" + pascal-case "3.1.1" + tslib "~2.0.0" + "@graphql-modules/core@^0.7.17": version "0.7.17" resolved "https://registry.npmjs.org/@graphql-modules/core/-/core-0.7.17.tgz#ae9bbf44894509664bc0b6fcdd9b6cf3d99bcd00" @@ -1520,6 +1768,25 @@ graphql-tools "5.0.0" tslib "1.11.1" +"@graphql-tools/apollo-engine-loader@^6.0.0": + version "6.0.15" + resolved "https://registry.npmjs.org/@graphql-tools/apollo-engine-loader/-/apollo-engine-loader-6.0.15.tgz#05ceca3ba024b5fbd4ac4366cf0cfc88e0fd7ef4" + integrity sha512-9SwaZZPr03dZh3rqmpw6GG2S+SzSuBCfYgx/cY37TPPB+wTJjBzZSzRGrC8hsUlbGLF7Qzq7rFYxfl0zGYpxXg== + dependencies: + "@graphql-tools/utils" "6.0.15" + cross-fetch "3.0.5" + tslib "~2.0.0" + +"@graphql-tools/code-file-loader@^6.0.0": + version "6.0.15" + resolved "https://registry.npmjs.org/@graphql-tools/code-file-loader/-/code-file-loader-6.0.15.tgz#d4c04b6493ac658da13bb115e7ed6821e2c687f1" + integrity sha512-Z4RLnJzlHWHbfe/yRFLqWuqxd6//dSxj/87FiOwN2GR+o/7I0N7ppZIAsLleVDM0LghDO+Nnt1cacNAEmTd0Fw== + dependencies: + "@graphql-tools/graphql-tag-pluck" "6.0.15" + "@graphql-tools/utils" "6.0.15" + fs-extra "9.0.1" + tslib "~2.0.0" + "@graphql-tools/delegate@6.0.15": version "6.0.15" resolved "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-6.0.15.tgz#9e060bfc31fe7735bd5b2b401e98dea3fa5d3b25" @@ -1530,6 +1797,23 @@ "@graphql-tools/utils" "6.0.15" tslib "~2.0.0" +"@graphql-tools/git-loader@^6.0.0": + version "6.0.15" + resolved "https://registry.npmjs.org/@graphql-tools/git-loader/-/git-loader-6.0.15.tgz#b9c70e332943372f50c7ef4e1161a65d5bdac08e" + integrity sha512-Tt33twi6oe++Hk+CeEl8A6DxETunwLG9EOkdHglxIKFn5k6yt8sd2hninwGjj8uyceC6CpeChN6jkF6Hg3N7fA== + dependencies: + "@graphql-tools/graphql-tag-pluck" "6.0.15" + "@graphql-tools/utils" "6.0.15" + +"@graphql-tools/github-loader@^6.0.0": + version "6.0.15" + resolved "https://registry.npmjs.org/@graphql-tools/github-loader/-/github-loader-6.0.15.tgz#2faccd5d20de87fba4762aa0e33659edd924da54" + integrity sha512-JYZp+u84JHJUB84dAlAHVgCxWtots6qtqMeENHPgNnpkci0cYKHAw+Mna3rZCEXR+9m4QKkM6K35U9cHODc6BA== + dependencies: + "@graphql-tools/graphql-tag-pluck" "6.0.15" + "@graphql-tools/utils" "6.0.15" + cross-fetch "3.0.5" + "@graphql-tools/graphql-file-loader@^6.0.0": version "6.0.15" resolved "https://registry.npmjs.org/@graphql-tools/graphql-file-loader/-/graphql-file-loader-6.0.15.tgz#e186b8147397bd7510e1b3318f5d3f7d365fc4e1" @@ -1540,6 +1824,18 @@ fs-extra "9.0.1" tslib "~2.0.0" +"@graphql-tools/graphql-tag-pluck@6.0.15": + version "6.0.15" + resolved "https://registry.npmjs.org/@graphql-tools/graphql-tag-pluck/-/graphql-tag-pluck-6.0.15.tgz#0e519202bc21faf068a22528b2e10d196e181aa6" + integrity sha512-d27PwoTIz3mQumnFtWjn60dulpePvWG6D8itPTGgl75H7LNpIdKPYlLTTcPcFsfWiFb4yIgg6/oarU8pJfRAsw== + dependencies: + "@babel/parser" "7.10.5" + "@babel/traverse" "7.10.5" + "@babel/types" "7.10.5" + "@graphql-tools/utils" "6.0.15" + optionalDependencies: + vue-template-compiler "^2.6.11" + "@graphql-tools/import@6.0.15": version "6.0.15" resolved "https://registry.npmjs.org/@graphql-tools/import/-/import-6.0.15.tgz#d6a9d3b6199a1e07d80d8021635d317b2c190c6f" @@ -1581,6 +1877,25 @@ "@graphql-tools/utils" "6.0.15" tslib "~2.0.0" +"@graphql-tools/prisma-loader@^6.0.0": + version "6.0.15" + resolved "https://registry.npmjs.org/@graphql-tools/prisma-loader/-/prisma-loader-6.0.15.tgz#9d67046cc577f0f9028d56a0ff29ac454ded5165" + integrity sha512-jitPrrJgR5RV0F557dLubHQ5XeID9Kc9G/Owp/ux2CPRJRoagm/4rudlA4LbE87vzO2EGKUJiYsFRHlTZuCqAg== + dependencies: + "@graphql-tools/url-loader" "6.0.15" + "@graphql-tools/utils" "6.0.15" + fs-extra "9.0.1" + prisma-yml "1.34.10" + tslib "~2.0.0" + +"@graphql-tools/relay-operation-optimizer@6.0.15": + version "6.0.15" + resolved "https://registry.npmjs.org/@graphql-tools/relay-operation-optimizer/-/relay-operation-optimizer-6.0.15.tgz#f991499c54945cb8fa2396bb5292252fbda0a773" + integrity sha512-Y4h2kclKh5HvyvmoxeZiDhqdhMKfLKamOYx6UVpFsbeKb6Tt9RCNPVhpa+YToXxUXl0PvjhxZWeQ4lZY0GE0ug== + dependencies: + "@graphql-tools/utils" "6.0.15" + relay-compiler "10.0.0" + "@graphql-tools/schema@6.0.15": version "6.0.15" resolved "https://registry.npmjs.org/@graphql-tools/schema/-/schema-6.0.15.tgz#b016f9f36820342982887a291baa7e7d11b039ae" @@ -1589,7 +1904,7 @@ "@graphql-tools/utils" "6.0.15" tslib "~2.0.0" -"@graphql-tools/url-loader@^6.0.0": +"@graphql-tools/url-loader@6.0.15", "@graphql-tools/url-loader@^6.0.0": version "6.0.15" resolved "https://registry.npmjs.org/@graphql-tools/url-loader/-/url-loader-6.0.15.tgz#3ad621ed75c03fbc0ea08d2560f379a053c4035f" integrity sha512-/iGuK7J9yCECYMYQJqKNWnz4ytPHppkxh4YS5Ud9QPDNl488e+eInyNbkdiWcFGyZ4KHqEnXSDdRFg3mFNrMnw== @@ -5284,6 +5599,16 @@ ajv-keywords@^3.1.0, ajv-keywords@^3.4.1: resolved "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== +ajv@5: + version "5.5.2" + resolved "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" + integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.2, ajv@^6.5.5, ajv@^6.7.0: version "6.12.2" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz#c629c5eced17baf314437918d2da88c99d5958cd" @@ -5311,18 +5636,18 @@ ansi-colors@^3.0.0, ansi-colors@^3.2.1: resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== -ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: - version "3.2.0" - resolved "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" - integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== - -ansi-escapes@^4.2.1, ansi-escapes@^4.3.0: +ansi-escapes@4.3.1, ansi-escapes@^4.2.1, ansi-escapes@^4.3.0: version "4.3.1" resolved "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" integrity sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA== dependencies: type-fest "^0.11.0" +ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: + version "3.2.0" + resolved "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== + ansi-html@0.0.7: version "0.0.7" resolved "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" @@ -5758,7 +6083,7 @@ array.prototype.flat@^1.2.1, array.prototype.flat@^1.2.3: define-properties "^1.1.3" es-abstract "^1.17.0-next.1" -array.prototype.flatmap@^1.2.1: +array.prototype.flatmap@1.2.3, array.prototype.flatmap@^1.2.1: version "1.2.3" resolved "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.2.3.tgz#1c13f84a178566042dd63de4414440db9222e443" integrity sha512-OOEk+lkePcg+ODXIpvuU9PAryCikCJyo7GlDG1upleEpQRx6mzL9puEBkozQ5iAx20KV0l3DbyQwqciJtqe5Pg== @@ -5895,6 +6220,11 @@ atob@^2.1.2: resolved "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== +auto-bind@~4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/auto-bind/-/auto-bind-4.0.0.tgz#e3589fc6c2da8f7ca43ba9f84fa52a744fc997fb" + integrity sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ== + autoprefixer@^9.7.2: version "9.7.4" resolved "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.7.4.tgz#f8bf3e06707d047f0641d87aee8cfb174b2a5378" @@ -6140,6 +6470,11 @@ babel-plugin-syntax-jsx@^6.18.0: resolved "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" integrity sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY= +babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" + integrity sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ== + babel-plugin-transform-inline-consecutive-adds@^0.4.3: version "0.4.3" resolved "https://registry.npmjs.org/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.4.3.tgz#323d47a3ea63a83a7ac3c811ae8e6941faf2b0d1" @@ -6215,6 +6550,39 @@ babel-preset-current-node-syntax@^0.1.2: "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" "@babel/plugin-syntax-optional-chaining" "^7.8.3" +babel-preset-fbjs@^3.3.0: + version "3.3.0" + resolved "https://registry.npmjs.org/babel-preset-fbjs/-/babel-preset-fbjs-3.3.0.tgz#a6024764ea86c8e06a22d794ca8b69534d263541" + integrity sha512-7QTLTCd2gwB2qGoi5epSULMHugSVgpcVt5YAeiFO9ABLrutDQzKfGwzxgZHLpugq8qMdg/DhRZDZ5CLKxBkEbw== + dependencies: + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-syntax-class-properties" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + "@babel/plugin-transform-arrow-functions" "^7.0.0" + "@babel/plugin-transform-block-scoped-functions" "^7.0.0" + "@babel/plugin-transform-block-scoping" "^7.0.0" + "@babel/plugin-transform-classes" "^7.0.0" + "@babel/plugin-transform-computed-properties" "^7.0.0" + "@babel/plugin-transform-destructuring" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-for-of" "^7.0.0" + "@babel/plugin-transform-function-name" "^7.0.0" + "@babel/plugin-transform-literals" "^7.0.0" + "@babel/plugin-transform-member-expression-literals" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/plugin-transform-object-super" "^7.0.0" + "@babel/plugin-transform-parameters" "^7.0.0" + "@babel/plugin-transform-property-literals" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0" + "@babel/plugin-transform-spread" "^7.0.0" + "@babel/plugin-transform-template-literals" "^7.0.0" + babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0" + babel-preset-jest@^26.0.0: version "26.0.0" resolved "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-26.0.0.tgz#1eac82f513ad36c4db2e9263d7c485c825b1faa6" @@ -6614,6 +6982,11 @@ buffer-crc32@~0.2.3: resolved "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI= +buffer-equal-constant-time@1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= + buffer-fill@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" @@ -6925,6 +7298,14 @@ chalk@2.4.2, chalk@^2.0.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4. escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@4.1.0, chalk@^4.0.0, chalk@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chalk@^1.0.0, chalk@^1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -6944,14 +7325,6 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^4.0.0: - version "4.1.0" - resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - char-regex@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -6987,6 +7360,21 @@ check-types@^11.1.1: resolved "https://registry.npmjs.org/check-types/-/check-types-11.1.2.tgz#86a7c12bf5539f6324eb0e70ca8896c0e38f3e2f" integrity sha512-tzWzvgePgLORb9/3a0YenggReLKAIb2owL03H2Xdoe5pKcUyWRSEQ8xfCar8t2SIAuEDwtmx2da1YB52YuHQMQ== +chokidar@3.4.1, chokidar@^3.2.2, chokidar@^3.3.0, chokidar@^3.3.1: + version "3.4.1" + resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.4.1.tgz#e905bdecf10eaa0a0b1db0c664481cc4cbc22ba1" + integrity sha512-TQTJyr2stihpC4Sya9hs2Xh+O2wf+igjL36Y75xx2WdHuiICcn/XJza46Jwt0eT5hVpQOzo3FpY3cj3RVYLX0g== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.4.0" + optionalDependencies: + fsevents "~2.1.2" + chokidar@^2.0.4, chokidar@^2.1.8: version "2.1.8" resolved "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917" @@ -7006,21 +7394,6 @@ chokidar@^2.0.4, chokidar@^2.1.8: optionalDependencies: fsevents "^1.2.7" -chokidar@^3.2.2, chokidar@^3.3.0, chokidar@^3.3.1: - version "3.4.1" - resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.4.1.tgz#e905bdecf10eaa0a0b1db0c664481cc4cbc22ba1" - integrity sha512-TQTJyr2stihpC4Sya9hs2Xh+O2wf+igjL36Y75xx2WdHuiICcn/XJza46Jwt0eT5hVpQOzo3FpY3cj3RVYLX0g== - dependencies: - anymatch "~3.1.1" - braces "~3.0.2" - glob-parent "~5.1.0" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.4.0" - optionalDependencies: - fsevents "~2.1.2" - chownr@^1.0.1, chownr@^1.1.1, chownr@^1.1.2: version "1.1.4" resolved "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -7147,6 +7520,11 @@ cli-width@^2.0.0: resolved "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= +cli-width@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" + integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== + clipboard@^2.0.0: version "2.0.6" resolved "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz#52921296eec0fdf77ead1749421b21c968647376" @@ -7525,6 +7903,15 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0: resolved "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= +constant-case@3.0.3: + version "3.0.3" + resolved "https://registry.npmjs.org/constant-case/-/constant-case-3.0.3.tgz#ac910a99caf3926ac5112f352e3af599d8c5fc0a" + integrity sha512-FXtsSnnrFYpzDmvwDGQW+l8XK3GV1coLyBN0eBz16ZUzGaZcT2ANVCJmLeuw2GQgxKHQIe9e0w2dzkSfaRlUmA== + dependencies: + no-case "^3.0.3" + tslib "^1.10.0" + upper-case "^2.0.1" + constants-browserify@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" @@ -7712,7 +8099,7 @@ core-js-pure@^3.0.0, core-js-pure@^3.0.1: resolved "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.6.4.tgz#4bf1ba866e25814f149d4e9aaa08c36173506e3a" integrity sha512-epIhRLkXdgv32xIUFaaAry2wdxZYBi6bgM7cB136dzzXXa+dFyRLTZeLUJxnd8ShrmyVXBub63n2NHo2JAt8Cw== -core-js@^2.4.0, core-js@^2.5.7, core-js@^2.6.5: +core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.7, core-js@^2.6.5: version "2.6.11" resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== @@ -7759,6 +8146,17 @@ cosmiconfig@6.0.0, cosmiconfig@^6.0.0: path-type "^4.0.0" yaml "^1.7.2" +cosmiconfig@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3" + integrity sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.2.1" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.10.0" + cosmiconfig@^5.0.0, cosmiconfig@^5.1.0, cosmiconfig@^5.2.1: version "5.2.1" resolved "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" @@ -7815,6 +8213,14 @@ cross-env@^7.0.0: dependencies: cross-spawn "^7.0.1" +cross-fetch@2.2.2: + version "2.2.2" + resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-2.2.2.tgz#a47ff4f7fc712daba8f6a695a11c948440d45723" + integrity sha1-pH/09/xxLauo9qaVoRyUhEDUVyM= + dependencies: + node-fetch "2.1.2" + whatwg-fetch "2.0.4" + cross-fetch@3.0.5: version "3.0.5" resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.0.5.tgz#2739d2981892e7ab488a7ad03b92df2816e03f4c" @@ -8291,7 +8697,12 @@ dateformat@^3.0.0: resolved "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debounce@^1.2.0: +de-indent@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" + integrity sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0= + +debounce@1.2.0, debounce@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/debounce/-/debounce-1.2.0.tgz#44a540abc0ea9943018dc0eaa95cce87f65cd131" integrity sha512-mYtLl1xfZLi1m4RtQYlZgJUNQjl4ZxVnHzIR8nLLgi4q1YT8o/WM+MK/f8yfcc9s5Ir5zRaPZyZU6xs1Syoocg== @@ -8512,6 +8923,11 @@ depd@~1.1.2: resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= +dependency-graph@0.9.0: + version "0.9.0" + resolved "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.9.0.tgz#11aed7e203bc8b00f48356d92db27b265c445318" + integrity sha512-9YLIBURXj4DJMFALxXw9K3Y3rwb5Fk0X5/8ipCzaN84+gKxoHK43tVKRNakCQbiEx07E8Uwhuq21BpUagFhZ8w== + deprecated-decorator@^0.1.6: version "0.1.6" resolved "https://registry.npmjs.org/deprecated-decorator/-/deprecated-decorator-0.1.6.tgz#00966317b7a12fe92f3cc831f7583af329b86c37" @@ -8540,6 +8956,11 @@ detect-file@^1.0.0: resolved "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= +detect-indent@6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz#0abd0f549f69fc6659a254fe96786186b6f528fd" + integrity sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA== + detect-indent@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" @@ -8877,6 +9298,11 @@ dotenv-webpack@^1.7.0: dependencies: dotenv-defaults "^1.0.2" +dotenv@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/dotenv/-/dotenv-4.0.0.tgz#864ef1379aced55ce6f95debecdce179f7a0cd1d" + integrity sha1-hk7xN5rO1Vzm+V3r7NzhefegzR0= + dotenv@^6.2.0: version "6.2.0" resolved "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064" @@ -8915,6 +9341,13 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +ecdsa-sig-formatter@1.0.11: + version "1.0.11" + resolved "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" + integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== + dependencies: + safe-buffer "^5.0.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -9774,6 +10207,11 @@ fast-deep-equal@2.0.1, fast-deep-equal@^2.0.1: resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= +fast-deep-equal@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" + integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ= + fast-deep-equal@^3.0.0, fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -9875,6 +10313,25 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +fbjs-css-vars@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" + integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ== + +fbjs@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/fbjs/-/fbjs-1.0.0.tgz#52c215e0883a3c86af2a7a776ed51525ae8e0a5a" + integrity sha512-MUgcMEJaFhCaF1QtWGnmq9ZDRAzECTCRAF7O6UZIlAlkTs1SasiX9aP0Iw7wfD2mJ7wDTNfg2w7u5fSCwJk1OA== + dependencies: + core-js "^2.4.1" + fbjs-css-vars "^1.0.0" + isomorphic-fetch "^2.1.1" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.18" + fd-slicer@~1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" @@ -10889,6 +11346,13 @@ graphql-language-service@^3.0.0: graphql-language-service-interface "^2.4.0" graphql-language-service-types "^1.6.0" +graphql-request@^1.5.0: + version "1.8.2" + resolved "https://registry.npmjs.org/graphql-request/-/graphql-request-1.8.2.tgz#398d10ae15c585676741bde3fc01d5ca948f8fbe" + integrity sha512-dDX2M+VMsxXFCmUX0Vo0TopIZIX4ggzOtiCsThgtrKR4niiaagsGTDIHj3fsOMFETpa064vzovI+4YV4QnMbcg== + dependencies: + cross-fetch "2.2.2" + graphql-subscriptions@^1.0.0: version "1.1.0" resolved "https://registry.npmjs.org/graphql-subscriptions/-/graphql-subscriptions-1.1.0.tgz#5f2fa4233eda44cf7570526adfcf3c16937aef11" @@ -10896,6 +11360,11 @@ graphql-subscriptions@^1.0.0: dependencies: iterall "^1.2.1" +graphql-tag@2.11.0: + version "2.11.0" + resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.11.0.tgz#1deb53a01c46a7eb401d6cb59dec86fa1cccbffd" + integrity sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA== + graphql-tag@^2.9.2: version "2.10.4" resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.10.4.tgz#2f301a98219be8b178a6453bb7e33b79b66d8f83" @@ -11112,7 +11581,7 @@ hastscript@^5.0.0: property-information "^5.0.0" space-separated-tokens "^1.0.0" -he@^1.2.0: +he@^1.1.0, he@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -11460,7 +11929,7 @@ https-browserify@^1.0.0: resolved "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -https-proxy-agent@^2.2.3: +https-proxy-agent@^2.2.1, https-proxy-agent@^2.2.3: version "2.2.4" resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== @@ -11574,6 +12043,11 @@ immutable@>=3.8.2, immutable@^3.8.2: resolved "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" integrity sha1-wkOZUUVbs5kT2vKBN28VMOEErfM= +immutable@~3.7.6: + version "3.7.6" + resolved "https://registry.npmjs.org/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" + integrity sha1-E7TTyxK++hVIKib+Gy665kAHHks= + import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" @@ -11596,7 +12070,7 @@ import-fresh@^2.0.0: caller-path "^2.0.0" resolve-from "^3.0.0" -import-fresh@^3.0.0, import-fresh@^3.1.0: +import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1: version "3.2.1" resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== @@ -11644,6 +12118,11 @@ imurmurhash@^0.1.4: resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= +indent-string@4.0.0, indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== + indent-string@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" @@ -11656,11 +12135,6 @@ indent-string@^3.0.0: resolved "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= -indent-string@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" - integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== - indexes-of@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" @@ -11759,6 +12233,25 @@ inquirer@7.0.4: strip-ansi "^5.1.0" through "^2.3.6" +inquirer@7.3.3: + version "7.3.3" + resolved "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003" + integrity sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA== + dependencies: + ansi-escapes "^4.2.1" + chalk "^4.1.0" + cli-cursor "^3.1.0" + cli-width "^3.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.19" + mute-stream "0.0.8" + run-async "^2.4.0" + rxjs "^6.6.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + through "^2.3.6" + inquirer@^6.2.0: version "6.5.2" resolved "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" @@ -12262,7 +12755,7 @@ is-ssh@^1.3.0: dependencies: protocols "^1.1.0" -is-stream@^1.1.0: +is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= @@ -12382,6 +12875,14 @@ isobject@^4.0.0: resolved "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0" integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA== +isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" + integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk= + dependencies: + node-fetch "^1.0.1" + whatwg-fetch ">=0.10.0" + isstream@~0.1.2: version "0.1.2" resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -12897,6 +13398,14 @@ js-tokens@^3.0.2: resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= +js-yaml@^3.10.0: + version "3.14.0" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" + integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + js-yaml@^3.13.1, js-yaml@^3.8.3: version "3.13.1" resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" @@ -13010,6 +13519,11 @@ json-schema-merge-allof@^0.6.0: json-schema-compare "^0.2.2" lodash "^4.17.4" +json-schema-traverse@^0.3.0: + version "0.3.1" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -13030,11 +13544,26 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= +json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + integrity sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8= + dependencies: + jsonify "~0.0.0" + json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= +json-to-pretty-yaml@1.2.2: + version "1.2.2" + resolved "https://registry.npmjs.org/json-to-pretty-yaml/-/json-to-pretty-yaml-1.2.2.tgz#f4cd0bd0a5e8fe1df25aaf5ba118b099fd992d5b" + integrity sha1-9M0L0KXo/h3yWq9boRiwmf2ZLVs= + dependencies: + remedial "^1.0.7" + remove-trailing-spaces "^1.0.6" + json3@^3.3.2: version "3.3.3" resolved "https://registry.npmjs.org/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81" @@ -13092,6 +13621,22 @@ jsonpointer@^4.0.1: resolved "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" integrity sha1-T9kss04OnbPInIYi7PUfm5eMbLk= +jsonwebtoken@^8.1.0: + version "8.5.1" + resolved "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz#00e71e0b8df54c2121a1f26137df2280673bcc0d" + integrity sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w== + dependencies: + jws "^3.2.2" + lodash.includes "^4.3.0" + lodash.isboolean "^3.0.3" + lodash.isinteger "^4.0.4" + lodash.isnumber "^3.0.3" + lodash.isplainobject "^4.0.6" + lodash.isstring "^4.0.1" + lodash.once "^4.0.0" + ms "^2.1.1" + semver "^5.6.0" + jsprim@^1.2.2: version "1.4.1" resolved "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -13179,6 +13724,23 @@ jsx-ast-utils@^2.2.1, jsx-ast-utils@^2.2.3: array-includes "^3.0.3" object.assign "^4.1.0" +jwa@^1.4.1: + version "1.4.1" + resolved "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz#743c32985cb9e98655530d53641b66c8645b039a" + integrity sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA== + dependencies: + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^3.2.2: + version "3.2.2" + resolved "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304" + integrity sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA== + dependencies: + jwa "^1.4.1" + safe-buffer "^5.0.1" + jwt-decode@2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/jwt-decode/-/jwt-decode-2.2.0.tgz#7d86bd56679f58ce6a84704a657dd392bba81a79" @@ -13416,7 +13978,7 @@ listr-silent-renderer@^1.1.1: resolved "https://registry.npmjs.org/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" integrity sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4= -listr-update-renderer@^0.5.0: +listr-update-renderer@0.5.0, listr-update-renderer@^0.5.0: version "0.5.0" resolved "https://registry.npmjs.org/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz#4ea8368548a7b8aecb7e06d8c95cb45ae2ede6a2" integrity sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA== @@ -13611,17 +14173,47 @@ lodash.get@^4.4.2: resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= +lodash.includes@^4.3.0: + version "4.3.0" + resolved "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f" + integrity sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8= + +lodash.isboolean@^3.0.3: + version "3.0.3" + resolved "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6" + integrity sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY= + +lodash.isinteger@^4.0.4: + version "4.0.4" + resolved "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343" + integrity sha1-YZwK89A/iwTDH1iChAt3sRzWg0M= + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" integrity sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc= +lodash.isnumber@^3.0.3: + version "3.0.3" + resolved "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc" + integrity sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w= + +lodash.isplainobject@^4.0.6: + version "4.0.6" + resolved "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + integrity sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs= + +lodash.isstring@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" + integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE= + lodash.memoize@4.x, lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= -lodash.once@^4.1.1: +lodash.once@^4.0.0, lodash.once@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" integrity sha1-DdOXEhPHxW34gJd9UEyI+0cal6w= @@ -13671,7 +14263,7 @@ lodash@4.17.15: resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.4, lodash@^4.2.1: +lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.4, lodash@^4.2.1, lodash@~4.17.15: version "4.17.19" resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== @@ -13683,6 +14275,13 @@ log-symbols@3.0.0, log-symbols@^3.0.0: dependencies: chalk "^2.4.2" +log-symbols@4.0.0, log-symbols@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" + integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== + dependencies: + chalk "^4.0.0" + log-symbols@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" @@ -13690,13 +14289,6 @@ log-symbols@^1.0.2: dependencies: chalk "^1.0.0" -log-symbols@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" - integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== - dependencies: - chalk "^4.0.0" - log-update@^2.3.0: version "2.3.0" resolved "https://registry.npmjs.org/log-update/-/log-update-2.3.0.tgz#88328fd7d1ce7938b29283746f0b1bc126b24708" @@ -13752,7 +14344,7 @@ loud-rejection@^1.0.0: currently-unhandled "^0.4.1" signal-exit "^3.0.0" -lower-case@^2.0.1: +lower-case@2.0.1, lower-case@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/lower-case/-/lower-case-2.0.1.tgz#39eeb36e396115cc05e29422eaea9e692c9408c7" integrity sha512-LiWgfDLLb1dwbFQZsSglpRj+1ctGnayXz3Uv0/WO8n558JycT5fg6zkNcnW0G68Nn0aEldTFeEfmjCfmqry/rQ== @@ -14346,7 +14938,7 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@1.x, mkdirp@^1.0.3, mkdirp@^1.0.4: +mkdirp@*, mkdirp@1.0.4, mkdirp@1.x, mkdirp@^1.0.3, mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== @@ -14592,11 +15184,24 @@ node-fetch-npm@^2.0.2: json-parse-better-errors "^1.0.0" safe-buffer "^5.1.1" +node-fetch@2.1.2: + version "2.1.2" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5" + integrity sha1-q4hOjn5X44qUR1POxwb3iNF2i7U= + node-fetch@2.6.0, node-fetch@^2.1.2, node-fetch@^2.2.0, node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== +node-fetch@^1.0.1: + version "1.7.3" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + node-forge@0.9.0: version "0.9.0" resolved "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579" @@ -14942,6 +15547,11 @@ nth-check@^1.0.2, nth-check@~1.0.1: dependencies: boolbase "~1.0.0" +nullthrows@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1" + integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw== + num2fraction@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" @@ -15432,7 +16042,7 @@ parallel-transform@^1.1.0: inherits "^2.0.3" readable-stream "^2.1.5" -param-case@^3.0.3: +param-case@3.0.3, param-case@^3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/param-case/-/param-case-3.0.3.tgz#4be41f8399eff621c56eebb829a5e451d9801238" integrity sha512-VWBVyimc1+QrzappRs7waeN2YmoZFCGXWASRYX1/rGHtXqEcrGEIDm+jqIwFa2fRXNgQEwrxaYuIrX0WcAguTA== @@ -15471,7 +16081,7 @@ parse-entities@^1.1.0, parse-entities@^1.1.2: is-decimal "^1.0.0" is-hexadecimal "^1.0.0" -parse-filepath@^1.0.1: +parse-filepath@1.0.2, parse-filepath@^1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz#a632127f53aaf3d15876f5872f3ffac763d6c891" integrity sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE= @@ -15553,7 +16163,7 @@ parseurl@^1.3.2, parseurl@~1.3.2, parseurl@~1.3.3: resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== -pascal-case@^3.1.1: +pascal-case@3.1.1, pascal-case@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.1.tgz#5ac1975133ed619281e88920973d2cd1f279de5f" integrity sha512-XIeHKqIrsquVTQL2crjq3NfJUxmdLasn3TYOU0VBM+UX2a6ztAWBlJQBePLGY7VHW8+2dRadeIPK5+KImwTxQA== @@ -16527,6 +17137,35 @@ pretty-hrtime@^1.0.3: resolved "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" integrity sha1-t+PqQkNaTJsnWdmeDyAesZWALuE= +prisma-json-schema@0.1.3: + version "0.1.3" + resolved "https://registry.npmjs.org/prisma-json-schema/-/prisma-json-schema-0.1.3.tgz#6c302db8f464f8b92e8694d3f7dd3f41ac9afcbe" + integrity sha512-XZrf2080oR81mY8/OC8al68HiwBm0nXlFE727JIia0ZbNqwuV4MyRYk6E0+OIa6/9KEYxZrcAmoBs3EW1cCvnA== + +prisma-yml@1.34.10: + version "1.34.10" + resolved "https://registry.npmjs.org/prisma-yml/-/prisma-yml-1.34.10.tgz#0ef1ad3a125f54f200289cba56bdd9597f17f410" + integrity sha512-N9on+Cf/XQKFGUULk/681tnpfqiZ19UBTurFMm+/9rnml37mteDaFr2k8yz+K8Gt2xpEJ7kBu7ikG5PrXI1uoA== + dependencies: + ajv "5" + bluebird "^3.5.1" + chalk "^2.3.0" + debug "^3.1.0" + dotenv "^4.0.0" + fs-extra "^7.0.0" + graphql-request "^1.5.0" + http-proxy-agent "^2.1.0" + https-proxy-agent "^2.2.1" + isomorphic-fetch "^2.2.1" + js-yaml "^3.10.0" + json-stable-stringify "^1.0.1" + jsonwebtoken "^8.1.0" + lodash "^4.17.4" + prisma-json-schema "0.1.3" + replaceall "^0.1.6" + scuid "^1.0.2" + yaml-ast-parser "^0.0.40" + prismjs@^1.8.4: version "1.19.0" resolved "https://registry.npmjs.org/prismjs/-/prismjs-1.19.0.tgz#713afbd45c3baca4b321569f2df39e17e729d4dc" @@ -16604,6 +17243,13 @@ promise.series@^0.2.0: resolved "https://registry.npmjs.org/promise.series/-/promise.series-0.2.0.tgz#2cc7ebe959fc3a6619c04ab4dbdc9e452d864bbd" integrity sha1-LMfr6Vn8OmYZwEq029yeRS2GS70= +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== + dependencies: + asap "~2.0.3" + promise@^8.0.3: version "8.1.0" resolved "https://registry.npmjs.org/promise/-/promise-8.1.0.tgz#697c25c3dfe7435dd79fcd58c38a135888eaf05e" @@ -17666,6 +18312,36 @@ relateurl@^0.2.7: resolved "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk= +relay-compiler@10.0.0: + version "10.0.0" + resolved "https://registry.npmjs.org/relay-compiler/-/relay-compiler-10.0.0.tgz#04d50d8ec53e3f683bc379b756cf0542a76105af" + integrity sha512-EVBMcMCiP+waOPR2930cNCCsac1sNhfQayzS+bOEMz2Lls5Bx7grhaadkBZLTEdCHQ1kf7lrsmcMDqj9mxABFw== + dependencies: + "@babel/core" "^7.0.0" + "@babel/generator" "^7.5.0" + "@babel/parser" "^7.0.0" + "@babel/runtime" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + babel-preset-fbjs "^3.3.0" + chalk "^4.0.0" + fb-watchman "^2.0.0" + fbjs "^1.0.0" + glob "^7.1.1" + immutable "~3.7.6" + nullthrows "^1.1.1" + relay-runtime "10.0.0" + signedsource "^1.0.0" + yargs "^15.3.1" + +relay-runtime@10.0.0: + version "10.0.0" + resolved "https://registry.npmjs.org/relay-runtime/-/relay-runtime-10.0.0.tgz#cfceb0f8453b39a385d63093f2dbf1702ddc02b3" + integrity sha512-QEpFwEjvGgWgQ0MPJyrZKggaCoGMKwxPQx7NwYl4FcMmxZcicc8wk6vI1iTxl0tsPKgW/YG8FgueQR+X7ZtZqw== + dependencies: + "@babel/runtime" "^7.0.0" + fbjs "^1.0.0" + remark-parse@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz#4c077f9e499044d1d5c13f80d7a98cf7b9285d95" @@ -17687,11 +18363,21 @@ remark-parse@^5.0.0: vfile-location "^2.0.0" xtend "^4.0.1" +remedial@^1.0.7: + version "1.0.8" + resolved "https://registry.npmjs.org/remedial/-/remedial-1.0.8.tgz#a5e4fd52a0e4956adbaf62da63a5a46a78c578a0" + integrity sha512-/62tYiOe6DzS5BqVsNpH/nkGlX45C/Sp6V+NtiN6JQNS1Viay7cWkazmRkrQrdFj2eshDe96SIQNIoMxqhzBOg== + remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= +remove-trailing-spaces@^1.0.6: + version "1.0.7" + resolved "https://registry.npmjs.org/remove-trailing-spaces/-/remove-trailing-spaces-1.0.7.tgz#491f04e11d98880714d12429b0d0938cbe030ae6" + integrity sha512-wjM17CJ2kk0SgoGyJ7ZMzRRCuTq+V8YhMwpZ5XEWX0uaked2OUq6utvHXGNBQrfkUzUUABFMyxlKn+85hMv4dg== + renderkid@^2.0.1: version "2.0.3" resolved "https://registry.npmjs.org/renderkid/-/renderkid-2.0.3.tgz#380179c2ff5ae1365c522bf2fcfcff01c5b74149" @@ -17734,6 +18420,11 @@ replace-in-file@^6.0.0: glob "^7.1.6" yargs "^15.3.1" +replaceall@^0.1.6: + version "0.1.6" + resolved "https://registry.npmjs.org/replaceall/-/replaceall-0.1.6.tgz#81d81ac7aeb72d7f5c4942adf2697a3220688d8e" + integrity sha1-gdgax663LX9cSUKt8ml6MiBojY4= + request-progress@3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz#4ca754081c7fec63f505e4faa825aa06cd669dbe" @@ -17757,7 +18448,7 @@ request-promise-native@^1.0.5, request-promise-native@^1.0.8: stealthy-require "^1.1.1" tough-cookie "^2.3.3" -request@^2.85.0, request@^2.87.0, request@^2.88.0, request@^2.88.2: +request@2.88.2, request@^2.85.0, request@^2.87.0, request@^2.88.0, request@^2.88.2: version "2.88.2" resolved "https://registry.npmjs.org/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -18109,6 +18800,13 @@ rxjs@^6.5.2: dependencies: tslib "^1.9.0" +rxjs@^6.6.0: + version "6.6.2" + resolved "https://registry.npmjs.org/rxjs/-/rxjs-6.6.2.tgz#8096a7ac03f2cc4fe5860ef6e572810d9e01c0d2" + integrity sha512-BHdBMVoWC2sL26w//BCu3YzKT4s2jip/WhwsGEDmeKYBhKDZeYezVUnHatYB7L85v5xs0BAQmg6BEYJEKxBabg== + dependencies: + tslib "^1.9.0" + safe-buffer@5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -18211,6 +18909,11 @@ screenfull@^5.0.0: resolved "https://registry.npmjs.org/screenfull/-/screenfull-5.0.2.tgz#b9acdcf1ec676a948674df5cd0ff66b902b0bed7" integrity sha512-cCF2b+L/mnEiORLN5xSAz6H3t18i2oHh9BA8+CQlAh5DRw2+NFAGQJOSYbcGw8B2k04g/lVvFcfZ83b3ysH5UQ== +scuid@^1.0.2: + version "1.1.0" + resolved "https://registry.npmjs.org/scuid/-/scuid-1.1.0.tgz#d3f9f920956e737a60f72d0e4ad280bf324d5dab" + integrity sha512-MuCAyrGZcTLfQoH2XoBlQ8C6bzwN88XT/0slOGz0pn8+gIP85BOAfYa44ZXQUTOwRwPU0QvgU+V+OSajl/59Xg== + select-hose@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" @@ -18367,7 +19070,7 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.4: +setimmediate@^1.0.4, setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= @@ -18485,6 +19188,11 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== +signedsource@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/signedsource/-/signedsource-1.0.0.tgz#1ddace4981798f93bd833973803d80d52e93ad6a" + integrity sha1-HdrOSYF5j5O9gzlzgD2A1S6TrWo= + simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" @@ -19977,7 +20685,12 @@ ts-loader@^7.0.4: micromatch "^4.0.0" semver "^6.0.0" -ts-node@^8.6.2: +ts-log@2.1.4: + version "2.1.4" + resolved "https://registry.npmjs.org/ts-log/-/ts-log-2.1.4.tgz#063c5ad1cbab5d49d258d18015963489fb6fb59a" + integrity sha512-P1EJSoyV+N3bR/IWFeAqXzKPZwHpnLY6j7j58mAvewHRipo+BQM2Y1f9Y9BjEQznKwgqqZm7H8iuixmssU7tYQ== + +ts-node@^8.10.2, ts-node@^8.6.2: version "8.10.2" resolved "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d" integrity sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA== @@ -20126,6 +20839,11 @@ typescript@^3.9.3: resolved "https://registry.npmjs.org/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== +ua-parser-js@^0.7.18: + version "0.7.21" + resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz#853cf9ce93f642f67174273cc34565ae6f308777" + integrity sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ== + uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" resolved "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" @@ -20369,6 +21087,13 @@ update-notifier@^4.0.0: semver-diff "^3.1.1" xdg-basedir "^4.0.0" +upper-case@2.0.1, upper-case@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/upper-case/-/upper-case-2.0.1.tgz#6214d05e235dc817822464ccbae85822b3d8665f" + integrity sha512-laAsbea9SY5osxrv7S99vH9xAaJKrw5Qpdh4ENRLcaxipjKsiaBwiAsxfa8X5mObKNTQPsupSq0J/VIxsSJe3A== + dependencies: + tslib "^1.10.0" + uri-js@^4.2.2: version "4.2.2" resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" @@ -20641,6 +21366,14 @@ vscode-languageserver-types@^3.15.1: resolved "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de" integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ== +vue-template-compiler@^2.6.11: + version "2.6.11" + resolved "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz#c04704ef8f498b153130018993e56309d4698080" + integrity sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA== + dependencies: + de-indent "^1.0.2" + he "^1.1.0" + w3c-hr-time@^1.0.1, w3c-hr-time@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" @@ -20875,15 +21608,20 @@ whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3, whatwg-encoding@^1.0.5: dependencies: iconv-lite "0.4.24" +whatwg-fetch@2.0.4, whatwg-fetch@^2.0.0, whatwg-fetch@^2.0.4: + version "2.0.4" + resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" + integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== + whatwg-fetch@3.0.0, whatwg-fetch@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== -whatwg-fetch@^2.0.0, whatwg-fetch@^2.0.4: - version "2.0.4" - resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" - integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== +whatwg-fetch@>=0.10.0: + version "3.3.1" + resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.3.1.tgz#6c1acf37dec176b0fd6bc9a74b616bec2f612935" + integrity sha512-faXTmGDcLuEPBpJwb5LQfyxvubKiE+RlbmmweFGKjvIPFj4uHTTfdtTIkdTRhC6OSH9S9eyYbx8kZ0UEaQqYTA== whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0, whatwg-mimetype@^2.3.0: version "2.3.0" @@ -21027,6 +21765,15 @@ worker-rpc@^0.1.0: dependencies: microevent.ts "~0.1.1" +wrap-ansi@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -21259,12 +22006,17 @@ yallist@^4.0.0: resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +yaml-ast-parser@^0.0.40: + version "0.0.40" + resolved "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.40.tgz#08536d4e73d322b1c9ce207ab8dd70e04d20ae6e" + integrity sha1-CFNtTnPTIrHJziB6uN1w4E0grm4= + yaml@*, yaml@^1.10.0, yaml@^1.7.2, yaml@^1.9.2: version "1.10.0" resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg== -yargs-parser@18.x, yargs-parser@^18.1.1: +yargs-parser@18.x, yargs-parser@^18.1.1, yargs-parser@^18.1.2: version "18.1.3" resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== @@ -21303,6 +22055,23 @@ yargs-parser@^3.2.0: camelcase "^3.0.0" lodash.assign "^4.1.0" +yargs@15.4.1: + version "15.4.1" + resolved "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + yargs@^13.3.0, yargs@^13.3.2: version "13.3.2" resolved "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" From f21b65561bf8163a0fce03ffdd8928232877cdb9 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 6 Aug 2020 10:37:39 +0200 Subject: [PATCH 07/80] chore(gql): fixing dependencies now there is a new release --- plugins/catalog-graphql/package.json | 10 +++++----- yarn.lock | 12 +++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 8a0c0474f6..f64ba1404e 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-graphql", - "version": "0.1.1-alpha.16", + "version": "0.1.1-alpha.17", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -22,9 +22,9 @@ "mock-data": "./scripts/mock-data.sh" }, "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.16", - "@backstage/catalog-model": "^0.1.1-alpha.16", - "@backstage/config": "^0.1.1-alpha.16", + "@backstage/backend-common": "^0.1.1-alpha.17", + "@backstage/catalog-model": "^0.1.1-alpha.17", + "@backstage/config": "^0.1.1-alpha.17", "@graphql-codegen/cli": "^1.17.7", "@graphql-codegen/typescript": "^1.17.7", "@graphql-codegen/typescript-resolvers": "^1.17.7", @@ -38,7 +38,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.16", + "@backstage/cli": "^0.1.1-alpha.17", "@types/supertest": "^2.0.8", "eslint-plugin-graphql": "^4.0.0", "msw": "^0.19.5", diff --git a/yarn.lock b/yarn.lock index bbb0a0d3c9..8305285e7e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8898,17 +8898,15 @@ depd@~1.1.2: resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= -<<<<<<< HEAD -dependency-graph@0.9.0: - version "0.9.0" - resolved "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.9.0.tgz#11aed7e203bc8b00f48356d92db27b265c445318" - integrity sha512-9YLIBURXj4DJMFALxXw9K3Y3rwb5Fk0X5/8ipCzaN84+gKxoHK43tVKRNakCQbiEx07E8Uwhuq21BpUagFhZ8w== -======= depd@~2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== ->>>>>>> 24ed336579226fc628f7f6ba38c0bb27f430b257 + +dependency-graph@0.9.0: + version "0.9.0" + resolved "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.9.0.tgz#11aed7e203bc8b00f48356d92db27b265c445318" + integrity sha512-9YLIBURXj4DJMFALxXw9K3Y3rwb5Fk0X5/8ipCzaN84+gKxoHK43tVKRNakCQbiEx07E8Uwhuq21BpUagFhZ8w== deprecated-decorator@^0.1.6: version "0.1.6" From 3bc0ff4dfbf22c3f603aabdea951726769ccbc95 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 6 Aug 2020 10:38:06 +0200 Subject: [PATCH 08/80] chore(gql): make catalog-gql non-private --- plugins/catalog-graphql/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index f64ba1404e..205e35aba6 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -4,7 +4,6 @@ "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, "publishConfig": { "access": "public", "main": "dist/index.esm.js", From e93e414fdd8150dc6dc1515d0475e3aeca996f3d Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 6 Aug 2020 14:46:00 +0200 Subject: [PATCH 09/80] chore(gql): fixing build issues --- plugins/catalog-graphql/package.json | 1 - plugins/graphql/README.md | 12 +--- plugins/graphql/package.json | 3 +- plugins/graphql/src/index.ts | 2 - plugins/graphql/src/run.ts | 33 ---------- .../graphql/src/service/standaloneServer.ts | 62 ------------------ plugins/graphql/src/setupTests.ts | 1 - yarn.lock | 63 ++----------------- 8 files changed, 9 insertions(+), 168 deletions(-) delete mode 100644 plugins/graphql/src/run.ts delete mode 100644 plugins/graphql/src/service/standaloneServer.ts diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 205e35aba6..6f3c2c9aaa 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -29,7 +29,6 @@ "@graphql-codegen/typescript-resolvers": "^1.17.7", "@graphql-modules/core": "^0.7.17", "@types/express": "^4.17.6", - "@types/whatwg-fetch": "^0.0.33", "graphql": "^15.3.0", "node-fetch": "^2.6.0", "ts-node": "^8.10.2", diff --git a/plugins/graphql/README.md b/plugins/graphql/README.md index 3f85ec766e..d5eef26169 100644 --- a/plugins/graphql/README.md +++ b/plugins/graphql/README.md @@ -1,13 +1,3 @@ # graphql -Welcome to the graphql backend plugin! - -_This plugin was created through the Backstage CLI_ - -## Getting started - -Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/graphql](http://localhost:3000/graphql). - -You can also serve the plugin in isolation by running `yarn start` in the plugin directory. -This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. -It is only meant for local development, and the setup for it can be found inside the [/dev](/dev) directory. +## TODO diff --git a/plugins/graphql/package.json b/plugins/graphql/package.json index 0cc85d2513..f640c6267b 100644 --- a/plugins/graphql/package.json +++ b/plugins/graphql/package.json @@ -30,7 +30,8 @@ "express": "^4.17.1", "express-promise-router": "^3.0.3", "graphql": "^15.3.0", - "whatwg-fetch": "^2.0.0", + "node-fetch": "^2.6.0", + "reflect-metadata": "^0.1.13", "winston": "^3.2.1", "yn": "^4.0.0" }, diff --git a/plugins/graphql/src/index.ts b/plugins/graphql/src/index.ts index f12e894c84..7612c392a2 100644 --- a/plugins/graphql/src/index.ts +++ b/plugins/graphql/src/index.ts @@ -14,6 +14,4 @@ * limitations under the License. */ -require('whatwg-fetch'); - export * from './service/router'; diff --git a/plugins/graphql/src/run.ts b/plugins/graphql/src/run.ts deleted file mode 100644 index b96989e4b8..0000000000 --- a/plugins/graphql/src/run.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2020 Spotify AB - * - * 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 { getRootLogger } from '@backstage/backend-common'; -import yn from 'yn'; -import { startStandaloneServer } from './service/standaloneServer'; - -const port = process.env.PLUGIN_PORT ? Number(process.env.PLUGIN_PORT) : 7000; -const enableCors = yn(process.env.PLUGIN_CORS, { default: false }); -const logger = getRootLogger(); - -startStandaloneServer({ port, enableCors, logger }).catch(err => { - logger.error(err); - process.exit(1); -}); - -process.on('SIGINT', () => { - logger.info('CTRL+C pressed; exiting.'); - process.exit(0); -}); diff --git a/plugins/graphql/src/service/standaloneServer.ts b/plugins/graphql/src/service/standaloneServer.ts deleted file mode 100644 index 0f772a583f..0000000000 --- a/plugins/graphql/src/service/standaloneServer.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2020 Spotify AB - * - * 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. - */ -/* - * Copyright 2020 Spotify AB - * - * 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 { createServiceBuilder } from '@backstage/backend-common'; -import { Server } from 'http'; -import { Logger } from 'winston'; -import { createRouter } from './router'; - -export interface ServerOptions { - port: number; - enableCors: boolean; - logger: Logger; -} - -export async function startStandaloneServer( - options: ServerOptions, -): Promise { - const logger = options.logger.child({ service: 'graphql-backend' }); - logger.debug('Starting application server...'); - const router = await createRouter({ - logger, - }); - - const service = createServiceBuilder(module) - .enableCors({ origin: 'http://localhost:3000' }) - .addRouter('/graphql', router); - - return await service.start().catch(err => { - logger.error(err); - process.exit(1); - }); -} - -module.hot?.accept(); diff --git a/plugins/graphql/src/setupTests.ts b/plugins/graphql/src/setupTests.ts index ac41ef995a..ba33cf996b 100644 --- a/plugins/graphql/src/setupTests.ts +++ b/plugins/graphql/src/setupTests.ts @@ -13,6 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('whatwg-fetch'); export {}; diff --git a/yarn.lock b/yarn.lock index 8305285e7e..ecfbbfa4ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5174,20 +5174,6 @@ dependencies: "@types/node" "*" -"@types/whatwg-fetch@^0.0.33": - version "0.0.33" - resolved "https://registry.npmjs.org/@types/whatwg-fetch/-/whatwg-fetch-0.0.33.tgz#19c0d2863c8cb2380f21a1c736b79cbf7895bb13" - integrity sha1-GcDShjyMsjgPIaHHNrecv3iVuxM= - dependencies: - "@types/whatwg-streams" "*" - -"@types/whatwg-streams@*": - version "3.2.1" - resolved "https://registry.npmjs.org/@types/whatwg-streams/-/whatwg-streams-3.2.1.tgz#225009a823e8b44be12569a24e60374ccdabe29e" - integrity sha512-Syv05sRL25b8cC8tqgXSQgLZZmqGq2GO+NafrtHbjPJccP6gWBXmHvo2Trw3AWXQ4QLIkVuOB7uStCuhzswyiw== - dependencies: - whatwg-streams "*" - "@types/whatwg-streams@^0.0.7": version "0.0.7" resolved "https://registry.npmjs.org/@types/whatwg-streams/-/whatwg-streams-0.0.7.tgz#28bfe73dc850562296367249c4b32a50db81e9d3" @@ -6749,11 +6735,6 @@ bluebird@3.7.2, bluebird@^3.3.5, bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5 resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bluebird@~1.0.0: - version "1.0.8" - resolved "https://registry.npmjs.org/bluebird/-/bluebird-1.0.8.tgz#851c7825e6cce59e4b43dde95d574b88675463fc" - integrity sha1-hRx4JebM5Z5LQ93pXVdLiGdUY/w= - bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: version "4.11.8" resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" @@ -8767,11 +8748,6 @@ deep-equal@^1.0.1, deep-equal@^1.1.1: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" -deep-equal@~0.1.0: - version "0.1.2" - resolved "https://registry.npmjs.org/deep-equal/-/deep-equal-0.1.2.tgz#b246c2b80a570a47c11be1d9bd1070ec878b87ce" - integrity sha1-skbCuApXCkfBG+HZvRBw7IeLh84= - deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" @@ -8846,11 +8822,6 @@ define-property@^2.0.2: is-descriptor "^1.0.2" isobject "^3.0.1" -defined@~0.0.0: - version "0.0.0" - resolved "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz#f35eea7d705e933baf13b2f03b3f83d921403b3e" - integrity sha1-817qfXBekzuvE7LwOz+D2SFAOz4= - del@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" @@ -18113,6 +18084,11 @@ redux@^4.0.4: loose-envify "^1.4.0" symbol-observable "^1.2.0" +reflect-metadata@^0.1.13: + version "0.1.13" + resolved "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" + integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== + refractor@^2.4.1: version "2.10.1" resolved "https://registry.npmjs.org/refractor/-/refractor-2.10.1.tgz#166c32f114ed16fd96190ad21d5193d3afc7d34e" @@ -18490,13 +18466,6 @@ restore-cursor@^3.1.0: onetime "^5.1.0" signal-exit "^3.0.2" -resumer@~0.0.0: - version "0.0.0" - resolved "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" - integrity sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k= - dependencies: - through "~2.3.4" - ret@~0.1.10: version "0.1.15" resolved "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -20065,18 +20034,6 @@ tapable@^1.0.0, tapable@^1.1.3: resolved "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== -tape@~2.3.2: - version "2.3.3" - resolved "https://registry.npmjs.org/tape/-/tape-2.3.3.tgz#2e7ce0a31df09f8d6851664a71842e0ca5057af7" - integrity sha1-Lnzgox3wn41oUWZKcYQuDKUFevc= - dependencies: - deep-equal "~0.1.0" - defined "~0.0.0" - inherits "~2.0.1" - jsonify "~0.0.0" - resumer "~0.0.0" - through "~2.3.4" - tar-fs@^1.16.3: version "1.16.3" resolved "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz#966a628841da2c4010406a82167cbd5e0c72d509" @@ -20319,7 +20276,7 @@ through2@^3.0.0: dependencies: readable-stream "2 || 3" -through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8, through@~2.3, through@~2.3.1, through@~2.3.4: +through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8, through@~2.3, through@~2.3.1: version "2.3.8" resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= @@ -21532,14 +21489,6 @@ whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0, whatwg-mimetype@^2.3.0: resolved "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== -whatwg-streams@*: - version "0.1.1" - resolved "https://registry.npmjs.org/whatwg-streams/-/whatwg-streams-0.1.1.tgz#dd5575c965bce13da76dc0dd495629a87572e74e" - integrity sha1-3VV1yWW84T2nbcDdSVYpqHVy504= - dependencies: - bluebird "~1.0.0" - tape "~2.3.2" - whatwg-url@^6.4.1: version "6.5.0" resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" From 679cc1c72b2cc5d9a897cf1e139a5605943e4322 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 6 Aug 2020 15:22:58 +0200 Subject: [PATCH 10/80] chore(gql): add todo --- plugins/catalog-graphql/src/service/client.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/catalog-graphql/src/service/client.ts b/plugins/catalog-graphql/src/service/client.ts index 091a8a8cc0..eddae2f396 100644 --- a/plugins/catalog-graphql/src/service/client.ts +++ b/plugins/catalog-graphql/src/service/client.ts @@ -22,6 +22,8 @@ export class CatalogClient { async list(): Promise { const res = await fetch(`${this.baseUrl}/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(`NOPE, ${await res.text()}`); } From 06626e171ff9ad5c6e5fca2eba6e6ea11603ec52 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 6 Aug 2020 15:36:21 +0200 Subject: [PATCH 11/80] chore(gql): fixing the actual build issue --- plugins/catalog-graphql/package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 6f3c2c9aaa..fec113f545 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -28,7 +28,6 @@ "@graphql-codegen/typescript": "^1.17.7", "@graphql-codegen/typescript-resolvers": "^1.17.7", "@graphql-modules/core": "^0.7.17", - "@types/express": "^4.17.6", "graphql": "^15.3.0", "node-fetch": "^2.6.0", "ts-node": "^8.10.2", @@ -39,6 +38,7 @@ "@backstage/cli": "^0.1.1-alpha.17", "@types/supertest": "^2.0.8", "eslint-plugin-graphql": "^4.0.0", + "@types/express": "^4.17.7", "msw": "^0.19.5", "supertest": "^4.0.2" }, diff --git a/yarn.lock b/yarn.lock index ecfbbfa4ea..a862980d7c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4458,7 +4458,7 @@ "@types/qs" "*" "@types/range-parser" "*" -"@types/express@*", "@types/express@^4.17.6": +"@types/express@*", "@types/express@^4.17.6", "@types/express@^4.17.7": version "4.17.7" resolved "https://registry.npmjs.org/@types/express/-/express-4.17.7.tgz#42045be6475636d9801369cd4418ef65cdb0dd59" integrity sha512-dCOT5lcmV/uC2J9k0rPafATeeyz+99xTt54ReX11/LObZgfzJqZNcW27zGhYyX+9iSEGXGt5qLPwRSvBZcLvtQ== From e0bbbae89816e14251fddd84500d6b79984542d1 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 6 Aug 2020 16:02:28 +0200 Subject: [PATCH 12/80] feat(gql): move out the generation into a one time command --- plugins/catalog-graphql/.gitignore | 1 - plugins/catalog-graphql/package.json | 2 +- plugins/catalog-graphql/src/graphql/types.ts | 209 +++++++++++++++++++ 3 files changed, 210 insertions(+), 2 deletions(-) delete mode 100644 plugins/catalog-graphql/.gitignore create mode 100644 plugins/catalog-graphql/src/graphql/types.ts diff --git a/plugins/catalog-graphql/.gitignore b/plugins/catalog-graphql/.gitignore deleted file mode 100644 index 5a5538170a..0000000000 --- a/plugins/catalog-graphql/.gitignore +++ /dev/null @@ -1 +0,0 @@ -src/graphql/types.ts diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index fec113f545..cb8f900bff 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -16,7 +16,7 @@ "test": "backstage-cli test", "prepack": "backstage-cli prepack", "postpack": "backstage-cli postpack", - "postinstall": "graphql-codegen", + "generate:types": "graphql-codegen", "clean": "backstage-cli clean", "mock-data": "./scripts/mock-data.sh" }, diff --git a/plugins/catalog-graphql/src/graphql/types.ts b/plugins/catalog-graphql/src/graphql/types.ts new file mode 100644 index 0000000000..567e19c8bb --- /dev/null +++ b/plugins/catalog-graphql/src/graphql/types.ts @@ -0,0 +1,209 @@ +/* + * Copyright 2020 Spotify AB + * + * 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 } from 'graphql'; +import { ModuleContext } from '@graphql-modules/core'; + +export type Maybe = T | null; +export type Exact = { [K in keyof T]: T[K] }; +export type RequireFields = { [X in Exclude]?: T[X] } & { [P in K]-?: NonNullable }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; +}; + +export type EntityMetadataAnnotation = { + __typename?: 'EntityMetadataAnnotation'; + key: Scalars['String']; + value: Scalars['String']; +}; + +export type EntityMetadata = { + __typename?: 'EntityMetadata'; + name: Scalars['String']; + namespace?: Maybe; + annotation?: Maybe; + annotations?: Maybe>; +}; + + +export type EntityMetadataAnnotationArgs = { + name?: Maybe; +}; + +export type CatalogEntity = { + __typename?: 'CatalogEntity'; + apiVersion?: Maybe; + kind: Scalars['String']; + metadata?: Maybe; +}; + +export type CatalogQuery = { + __typename?: 'CatalogQuery'; + list: Array; +}; + +export type Query = { + __typename?: 'Query'; + catalog: CatalogQuery; +}; + +export type WithIndex = TObject & Record; +export type ResolversObject = WithIndex; + +export type ResolverTypeWrapper = Promise | T; + + +export type LegacyStitchingResolver = { + fragment: string; + resolve: ResolverFn; +}; + +export type NewStitchingResolver = { + selectionSet: string; + resolve: ResolverFn; +}; +export type StitchingResolver = LegacyStitchingResolver | NewStitchingResolver; +export type Resolver = + | ResolverFn + | StitchingResolver; + +export type ResolverFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo +) => Promise | TResult; + +export type SubscriptionSubscribeFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo +) => AsyncIterator | Promise>; + +export type SubscriptionResolveFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo +) => TResult | Promise; + +export interface SubscriptionSubscriberObject { + subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>; + resolve?: SubscriptionResolveFn; +} + +export interface SubscriptionResolverObject { + subscribe: SubscriptionSubscribeFn; + resolve: SubscriptionResolveFn; +} + +export type SubscriptionObject = + | SubscriptionSubscriberObject + | SubscriptionResolverObject; + +export type SubscriptionResolver = + | ((...args: any[]) => SubscriptionObject) + | SubscriptionObject; + +export type TypeResolveFn = ( + parent: TParent, + context: TContext, + info: GraphQLResolveInfo +) => Maybe | Promise>; + +export type IsTypeOfResolverFn = (obj: T, info: GraphQLResolveInfo) => boolean | Promise; + +export type NextResolverFn = () => Promise; + +export type DirectiveResolverFn = ( + next: NextResolverFn, + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo +) => TResult | Promise; + +/** Mapping between all available schema types and the resolvers types */ +export type ResolversTypes = ResolversObject<{ + EntityMetadataAnnotation: ResolverTypeWrapper>; + String: ResolverTypeWrapper>; + EntityMetadata: ResolverTypeWrapper>; + CatalogEntity: ResolverTypeWrapper>; + CatalogQuery: ResolverTypeWrapper>; + Query: ResolverTypeWrapper<{}>; + Boolean: ResolverTypeWrapper>; +}>; + +/** Mapping between all available schema types and the resolvers parents */ +export type ResolversParentTypes = ResolversObject<{ + EntityMetadataAnnotation: Partial; + String: Partial; + EntityMetadata: Partial; + CatalogEntity: Partial; + CatalogQuery: Partial; + Query: {}; + Boolean: Partial; +}>; + +export type EntityMetadataAnnotationResolvers = ResolversObject<{ + key?: Resolver; + value?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type EntityMetadataResolvers = ResolversObject<{ + name?: Resolver; + namespace?: Resolver, ParentType, ContextType>; + annotation?: Resolver, ParentType, ContextType, RequireFields>; + annotations?: Resolver>, ParentType, ContextType>; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type CatalogEntityResolvers = ResolversObject<{ + apiVersion?: Resolver, ParentType, ContextType>; + kind?: Resolver; + metadata?: Resolver, ParentType, ContextType>; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type CatalogQueryResolvers = ResolversObject<{ + list?: Resolver, ParentType, ContextType>; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type QueryResolvers = ResolversObject<{ + catalog?: Resolver; +}>; + +export type Resolvers = ResolversObject<{ + EntityMetadataAnnotation?: EntityMetadataAnnotationResolvers; + EntityMetadata?: EntityMetadataResolvers; + CatalogEntity?: CatalogEntityResolvers; + CatalogQuery?: CatalogQueryResolvers; + Query?: QueryResolvers; +}>; + + +/** + * @deprecated + * Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config. + */ +export type IResolvers = Resolvers; From b72f136c3657325a02b9c7b4831961747eafcdfd Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 6 Aug 2020 16:21:57 +0200 Subject: [PATCH 13/80] test(gql): added some mock tests for now --- .../src/service/client.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugins/catalog-graphql/src/service/client.test.ts diff --git a/plugins/catalog-graphql/src/service/client.test.ts b/plugins/catalog-graphql/src/service/client.test.ts new file mode 100644 index 0000000000..e249bf1c15 --- /dev/null +++ b/plugins/catalog-graphql/src/service/client.test.ts @@ -0,0 +1,23 @@ +/* + * Copyright 2020 Spotify AB + * + * 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'; + +describe('Catalog GraphQL Module', () => { + it('create a new client', () => { + void new CatalogClient('http://localhost:1234'); + expect(true).toBe(true); + }); +}); From 0fe6f44c17c0a472976308ecbc879c7bad03f75f Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 10:32:18 +0200 Subject: [PATCH 14/80] chore(gql/catalog): updating the version deps after new buymp --- plugins/catalog-graphql/package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index cb8f900bff..7c8b73a943 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-graphql", - "version": "0.1.1-alpha.17", + "version": "0.1.1-alpha.18", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -21,9 +21,9 @@ "mock-data": "./scripts/mock-data.sh" }, "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.17", - "@backstage/catalog-model": "^0.1.1-alpha.17", - "@backstage/config": "^0.1.1-alpha.17", + "@backstage/backend-common": "^0.1.1-alpha.18", + "@backstage/catalog-model": "^0.1.1-alpha.18", + "@backstage/config": "^0.1.1-alpha.18", "@graphql-codegen/cli": "^1.17.7", "@graphql-codegen/typescript": "^1.17.7", "@graphql-codegen/typescript-resolvers": "^1.17.7", @@ -35,7 +35,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.17", + "@backstage/cli": "^0.1.1-alpha.18", "@types/supertest": "^2.0.8", "eslint-plugin-graphql": "^4.0.0", "@types/express": "^4.17.7", From 219fa73ad0b8603d60982f496e5aca8474f93e72 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 10:51:46 +0200 Subject: [PATCH 15/80] feat(gql/catlaog): Tidying up the resolver for the annotations --- plugins/catalog-graphql/package.json | 3 +- plugins/catalog-graphql/src/graphql/module.ts | 23 +++++--------- plugins/catalog-graphql/src/schema.gql | 6 ++-- yarn.lock | 31 ++++++------------- 4 files changed, 22 insertions(+), 41 deletions(-) diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 7c8b73a943..be5c585186 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -29,6 +29,7 @@ "@graphql-codegen/typescript-resolvers": "^1.17.7", "@graphql-modules/core": "^0.7.17", "graphql": "^15.3.0", + "graphql-type-json": "^0.3.2", "node-fetch": "^2.6.0", "ts-node": "^8.10.2", "winston": "^3.2.1", @@ -36,9 +37,9 @@ }, "devDependencies": { "@backstage/cli": "^0.1.1-alpha.18", + "@types/express": "^4.17.7", "@types/supertest": "^2.0.8", "eslint-plugin-graphql": "^4.0.0", - "@types/express": "^4.17.7", "msw": "^0.19.5", "supertest": "^4.0.2" }, diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index 1fc13d7950..2f9df09408 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -18,26 +18,16 @@ import { Logger } from 'winston'; import fs from 'fs'; import path from 'path'; import { GraphQLModule } from '@graphql-modules/core'; -import { Resolvers, CatalogEntity, CatalogQuery } from './types'; -import { Entity } from '@backstage/catalog-model'; +import { Resolvers, CatalogQuery } from './types'; import { Config } from '@backstage/config'; import { CatalogClient } from '../service/client'; +import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json'; export interface ModuleOptions { logger: Logger; config: Config; } -const parseToCatalogEntities = (e: Entity): CatalogEntity => ({ - ...e, - metadata: { - ...e.metadata, - annotations: Object.entries( - e.metadata.annotations ?? {}, - ).map(([key, value]) => ({ key, value })), - }, -}); - export async function createModule( options: ModuleOptions, ): Promise { @@ -51,18 +41,19 @@ export async function createModule( ); const resolvers: Resolvers = { + JSON: GraphQLJSON, + JSONObject: GraphQLJSONObject, Query: { catalog: () => ({} as CatalogQuery), }, CatalogQuery: { list: async () => { - const list = await catalogClient.list(); - return list.map(parseToCatalogEntities); + return await catalogClient.list(); }, }, EntityMetadata: { - annotation: (e, { name }) => - e.annotations?.find(a => a.key === name) ?? null, + annotations: e => e.annotations, + annotation: (e, { name }) => e.annotations[name] ?? null, }, }; diff --git a/plugins/catalog-graphql/src/schema.gql b/plugins/catalog-graphql/src/schema.gql index b28f796855..5b2ee51db0 100644 --- a/plugins/catalog-graphql/src/schema.gql +++ b/plugins/catalog-graphql/src/schema.gql @@ -1,3 +1,6 @@ +scalar JSON +scalar JSONObject + type EntityMetadataAnnotation { key: String! value: String! @@ -6,8 +9,7 @@ type EntityMetadataAnnotation { type EntityMetadata { name: String! namespace: String - annotation(name: String): EntityMetadataAnnotation - annotations: [EntityMetadataAnnotation!] + annotations: JSONObject } type CatalogEntity { diff --git a/yarn.lock b/yarn.lock index 83b287dd4a..e967be54ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10379,7 +10379,6 @@ file-loader@^4.2.0: "file-saver@github:eligrey/FileSaver.js#1.3.8": version "1.3.8" - uid e865e37af9f9947ddcced76b549e27dc45c1cb2e resolved "https://codeload.github.com/eligrey/FileSaver.js/tar.gz/e865e37af9f9947ddcced76b549e27dc45c1cb2e" file-system-cache@^1.0.5: @@ -11376,6 +11375,11 @@ graphql-tools@^4.0.0: iterall "^1.1.3" uuid "^3.1.0" +graphql-type-json@^0.3.2: + version "0.3.2" + resolved "https://registry.npmjs.org/graphql-type-json/-/graphql-type-json-0.3.2.tgz#f53a851dbfe07bd1c8157d24150064baab41e115" + integrity sha512-J+vjof74oMlCWXSvt0DOf2APEdZOCdubEvGDUAlqH//VBYcOYsGgRW7Xzorr44LvkjiuvecWc8fChxuZZbChtg== + graphql-upload@^8.0.2: version "8.1.0" resolved "https://registry.npmjs.org/graphql-upload/-/graphql-upload-8.1.0.tgz#6d0ab662db5677a68bfb1f2c870ab2544c14939a" @@ -13586,7 +13590,6 @@ jsonpointer@^4.0.1: resolved "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" integrity sha1-T9kss04OnbPInIYi7PUfm5eMbLk= -<<<<<<< HEAD jsonwebtoken@^8.1.0: version "8.5.1" resolved "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz#00e71e0b8df54c2121a1f26137df2280673bcc0d" @@ -13602,7 +13605,7 @@ jsonwebtoken@^8.1.0: lodash.once "^4.0.0" ms "^2.1.1" semver "^5.6.0" -======= + jspdf-autotable@3.5.3: version "3.5.3" resolved "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.5.3.tgz#2f73adb07f340e7dbf22950e3e6c8bf853991479" @@ -13614,12 +13617,11 @@ jspdf@1.5.3: integrity sha512-J9X76xnncMw+wIqb15HeWfPMqPwYxSpPY8yWPJ7rAZN/ZDzFkjCSZObryCyUe8zbrVRNiuCnIeQteCzMn7GnWw== dependencies: canvg "1.5.3" - file-saver "github:eligrey/FileSaver.js#1.3.8" + file-saver eligrey/FileSaver.js#1.3.8 html2canvas "1.0.0-alpha.12" omggif "1.0.7" promise-polyfill "8.1.0" stackblur-canvas "2.2.0" ->>>>>>> f225b094e4651d478fa5925ef498fdbdab6ca353 jsprim@^1.2.2: version "1.4.1" @@ -16072,9 +16074,6 @@ parse-entities@^1.1.0, parse-entities@^1.1.2: is-decimal "^1.0.0" is-hexadecimal "^1.0.0" -<<<<<<< HEAD -parse-filepath@1.0.2, parse-filepath@^1.0.1: -======= parse-entities@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz#53c6eb5b9314a1f4ec99fa0fdf7ce01ecda0cbe8" @@ -16087,8 +16086,7 @@ parse-entities@^2.0.0: is-decimal "^1.0.0" is-hexadecimal "^1.0.0" -parse-filepath@^1.0.1: ->>>>>>> f225b094e4651d478fa5925ef498fdbdab6ca353 +parse-filepath@1.0.2, parse-filepath@^1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz#a632127f53aaf3d15876f5872f3ffac763d6c891" integrity sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE= @@ -17149,7 +17147,6 @@ pretty-hrtime@^1.0.3: resolved "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" integrity sha1-t+PqQkNaTJsnWdmeDyAesZWALuE= -<<<<<<< HEAD prisma-json-schema@0.1.3: version "0.1.3" resolved "https://registry.npmjs.org/prisma-json-schema/-/prisma-json-schema-0.1.3.tgz#6c302db8f464f8b92e8694d3f7dd3f41ac9afcbe" @@ -17179,16 +17176,10 @@ prisma-yml@1.34.10: scuid "^1.0.2" yaml-ast-parser "^0.0.40" -prismjs@^1.8.4: - version "1.19.0" - resolved "https://registry.npmjs.org/prismjs/-/prismjs-1.19.0.tgz#713afbd45c3baca4b321569f2df39e17e729d4dc" - integrity sha512-IVFtbW9mCWm9eOIaEkNyo2Vl4NnEifis2GQ7/MLRG5TQe6t+4Sj9J5QWI9i3v+SS43uZBlCAOn+zYTVYQcPXJw== -======= prismjs@^1.20.0, prismjs@^1.8.4, prismjs@~1.20.0: version "1.20.0" resolved "https://registry.npmjs.org/prismjs/-/prismjs-1.20.0.tgz#9b685fc480a3514ee7198eac6a3bf5024319ff03" integrity sha512-AEDjSrVNkynnw6A+B1DsFkd6AVdTnp+/WoUixFRULlCLZVRZlVQMVWio/16jv7G1FscUxQxOQhWwApgbnxr6kQ== ->>>>>>> f225b094e4651d478fa5925ef498fdbdab6ca353 optionalDependencies: clipboard "^2.0.0" @@ -18481,11 +18472,7 @@ request-promise-native@^1.0.5, request-promise-native@^1.0.8: stealthy-require "^1.1.1" tough-cookie "^2.3.3" -<<<<<<< HEAD -request@2.88.2, request@^2.85.0, request@^2.87.0, request@^2.88.0, request@^2.88.2: -======= -request@^2.55.0, request@^2.85.0, request@^2.87.0, request@^2.88.0, request@^2.88.2: ->>>>>>> f225b094e4651d478fa5925ef498fdbdab6ca353 +request@2.88.2, request@^2.55.0, request@^2.85.0, request@^2.87.0, request@^2.88.0, request@^2.88.2: version "2.88.2" resolved "https://registry.npmjs.org/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== From f5eb812847a903d1e1381e59630c8e534dc34053 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 11:00:55 +0200 Subject: [PATCH 16/80] chore(gql/catalog): Added some more metadata fields to the catalog entities --- plugins/catalog-graphql/src/schema.gql | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/catalog-graphql/src/schema.gql b/plugins/catalog-graphql/src/schema.gql index 5b2ee51db0..02abffa09e 100644 --- a/plugins/catalog-graphql/src/schema.gql +++ b/plugins/catalog-graphql/src/schema.gql @@ -8,14 +8,19 @@ type EntityMetadataAnnotation { type EntityMetadata { name: String! - namespace: String + namespace: String! annotations: JSONObject + annotation(name: String): JSON + labels: JSONObject + uid: String! + etag: String! + generation: Int! } type CatalogEntity { - apiVersion: String + apiVersion: String! kind: String! - metadata: EntityMetadata + metadata: EntityMetadata! } type CatalogQuery { From 4d4ead15c4f3e168e29b0896b83a1a3352c5b345 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 11:09:30 +0200 Subject: [PATCH 17/80] chore(gql/catalog): making the client alittle more readabke --- plugins/catalog-graphql/src/service/client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/catalog-graphql/src/service/client.ts b/plugins/catalog-graphql/src/service/client.ts index eddae2f396..f7bc5ccffe 100644 --- a/plugins/catalog-graphql/src/service/client.ts +++ b/plugins/catalog-graphql/src/service/client.ts @@ -27,6 +27,7 @@ export class CatalogClient { throw new Error(`NOPE, ${await res.text()}`); } - return await (res.json() as Promise); + const entities: Entity[] = await res.json(); + return entities; } } From 8e1cb1ca0be466c3f1a1849e37c591a536aeae8a Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 11:37:30 +0200 Subject: [PATCH 18/80] feat(gql/catalog): Fixing some of the query issues --- plugins/catalog-graphql/src/graphql/module.ts | 10 ++- plugins/catalog-graphql/src/graphql/types.ts | 74 ++++++++++++------- plugins/catalog-graphql/src/schema.gql | 12 +-- plugins/catalog-graphql/src/service/client.ts | 18 ++++- 4 files changed, 74 insertions(+), 40 deletions(-) diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index 2f9df09408..6deb2a3aad 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -48,7 +48,15 @@ export async function createModule( }, CatalogQuery: { list: async () => { - return await catalogClient.list(); + const catalogEntries = await catalogClient.list(); + return catalogEntries.map(entity => ({ + ...entity, + metadata: { + ...entity.metadata, + annotations: entity.metadata.annotations ?? {}, + labels: entity.metadata.labels ?? {}, + }, + })); }, }, EntityMetadata: { diff --git a/plugins/catalog-graphql/src/graphql/types.ts b/plugins/catalog-graphql/src/graphql/types.ts index 567e19c8bb..7294f749ad 100644 --- a/plugins/catalog-graphql/src/graphql/types.ts +++ b/plugins/catalog-graphql/src/graphql/types.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { GraphQLResolveInfo } from 'graphql'; +import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; import { ModuleContext } from '@graphql-modules/core'; export type Maybe = T | null; @@ -26,32 +26,40 @@ export type Scalars = { Boolean: boolean; Int: number; Float: number; + JSON: any; + JSONObject: any; }; -export type EntityMetadataAnnotation = { - __typename?: 'EntityMetadataAnnotation'; - key: Scalars['String']; - value: Scalars['String']; -}; + export type EntityMetadata = { __typename?: 'EntityMetadata'; name: Scalars['String']; - namespace?: Maybe; - annotation?: Maybe; - annotations?: Maybe>; + namespace: Scalars['String']; + annotations: Scalars['JSONObject']; + annotation?: Maybe; + labels: Scalars['JSONObject']; + label?: Maybe; + uid: Scalars['String']; + etag: Scalars['String']; + generation: Scalars['Int']; }; export type EntityMetadataAnnotationArgs = { - name?: Maybe; + name: Scalars['String']; +}; + + +export type EntityMetadataLabelArgs = { + name: Scalars['String']; }; export type CatalogEntity = { __typename?: 'CatalogEntity'; - apiVersion?: Maybe; + apiVersion: Scalars['String']; kind: Scalars['String']; - metadata?: Maybe; + metadata: EntityMetadata; }; export type CatalogQuery = { @@ -143,9 +151,11 @@ export type DirectiveResolverFn>; - String: ResolverTypeWrapper>; + JSON: ResolverTypeWrapper>; + JSONObject: ResolverTypeWrapper>; EntityMetadata: ResolverTypeWrapper>; + String: ResolverTypeWrapper>; + Int: ResolverTypeWrapper>; CatalogEntity: ResolverTypeWrapper>; CatalogQuery: ResolverTypeWrapper>; Query: ResolverTypeWrapper<{}>; @@ -154,33 +164,42 @@ export type ResolversTypes = ResolversObject<{ /** Mapping between all available schema types and the resolvers parents */ export type ResolversParentTypes = ResolversObject<{ - EntityMetadataAnnotation: Partial; - String: Partial; + JSON: Partial; + JSONObject: Partial; EntityMetadata: Partial; + String: Partial; + Int: Partial; CatalogEntity: Partial; CatalogQuery: Partial; Query: {}; Boolean: Partial; }>; -export type EntityMetadataAnnotationResolvers = ResolversObject<{ - key?: Resolver; - value?: Resolver; - __isTypeOf?: IsTypeOfResolverFn; -}>; +export interface JsonScalarConfig extends GraphQLScalarTypeConfig { + name: 'JSON'; +} + +export interface JsonObjectScalarConfig extends GraphQLScalarTypeConfig { + name: 'JSONObject'; +} export type EntityMetadataResolvers = ResolversObject<{ name?: Resolver; - namespace?: Resolver, ParentType, ContextType>; - annotation?: Resolver, ParentType, ContextType, RequireFields>; - annotations?: Resolver>, ParentType, ContextType>; + namespace?: Resolver; + annotations?: Resolver; + annotation?: Resolver, ParentType, ContextType, RequireFields>; + labels?: Resolver; + label?: Resolver, ParentType, ContextType, RequireFields>; + uid?: Resolver; + etag?: Resolver; + generation?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }>; export type CatalogEntityResolvers = ResolversObject<{ - apiVersion?: Resolver, ParentType, ContextType>; + apiVersion?: Resolver; kind?: Resolver; - metadata?: Resolver, ParentType, ContextType>; + metadata?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }>; @@ -194,7 +213,8 @@ export type QueryResolvers; export type Resolvers = ResolversObject<{ - EntityMetadataAnnotation?: EntityMetadataAnnotationResolvers; + JSON?: GraphQLScalarType; + JSONObject?: GraphQLScalarType; EntityMetadata?: EntityMetadataResolvers; CatalogEntity?: CatalogEntityResolvers; CatalogQuery?: CatalogQueryResolvers; diff --git a/plugins/catalog-graphql/src/schema.gql b/plugins/catalog-graphql/src/schema.gql index 02abffa09e..bb8e5bcc87 100644 --- a/plugins/catalog-graphql/src/schema.gql +++ b/plugins/catalog-graphql/src/schema.gql @@ -1,17 +1,13 @@ scalar JSON scalar JSONObject -type EntityMetadataAnnotation { - key: String! - value: String! -} - type EntityMetadata { name: String! namespace: String! - annotations: JSONObject - annotation(name: String): JSON - labels: JSONObject + annotations: JSONObject! + annotation(name: String!): JSON + labels: JSONObject! + label(name: String!): JSON uid: String! etag: String! generation: Int! diff --git a/plugins/catalog-graphql/src/service/client.ts b/plugins/catalog-graphql/src/service/client.ts index f7bc5ccffe..05e73b88b8 100644 --- a/plugins/catalog-graphql/src/service/client.ts +++ b/plugins/catalog-graphql/src/service/client.ts @@ -14,20 +14,30 @@ * limitations under the License. */ -import { Entity } from '@backstage/catalog-model'; +import { Entity, EntityMeta } from '@backstage/catalog-model'; import fetch from 'node-fetch'; +import { JsonObject } from '@backstage/config'; +export interface ReaderEntityMeta extends EntityMeta { + uid: string; + etag: string; + generation: number; + namespace: string; +} +export interface ReaderEntity extends Entity { + metadata: JsonObject & ReaderEntityMeta; +} export class CatalogClient { constructor(private baseUrl: string) {} - async list(): Promise { + async list(): Promise { const res = await fetch(`${this.baseUrl}/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(`NOPE, ${await res.text()}`); + throw new Error(await res.text()); } - const entities: Entity[] = await res.json(); + const entities: ReaderEntity[] = await res.json(); return entities; } } From 042599d882ff3d10d1022fd854ba734d0dae3ca4 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 11:42:07 +0200 Subject: [PATCH 19/80] feat(gql/catalog): implement the label resolver --- plugins/catalog-graphql/src/graphql/module.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index 6deb2a3aad..772e472d1b 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -60,8 +60,8 @@ export async function createModule( }, }, EntityMetadata: { - annotations: e => e.annotations, - annotation: (e, { name }) => e.annotations[name] ?? null, + annotation: (e, { name }) => e.annotations?.[name] ?? null, + label: (e, { name }) => e.labels?.[name] ?? null, }, }; From be1c5267081fa7e37e48b337888d326cc5120881 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 11:43:44 +0200 Subject: [PATCH 20/80] chore(gql/catalog): removing the mock-data stuff --- plugins/graphql/package.json | 3 +-- plugins/graphql/scripts/mock-data.sh | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100755 plugins/graphql/scripts/mock-data.sh diff --git a/plugins/graphql/package.json b/plugins/graphql/package.json index 2b6d9a40e7..f98c21f2c7 100644 --- a/plugins/graphql/package.json +++ b/plugins/graphql/package.json @@ -16,8 +16,7 @@ "test": "backstage-cli test", "prepack": "backstage-cli prepack", "postpack": "backstage-cli postpack", - "clean": "backstage-cli clean", - "mock-data": "./scripts/mock-data.sh" + "clean": "backstage-cli clean" }, "dependencies": { "@backstage/backend-common": "^0.1.1-alpha.18", diff --git a/plugins/graphql/scripts/mock-data.sh b/plugins/graphql/scripts/mock-data.sh deleted file mode 100755 index ff30921715..0000000000 --- a/plugins/graphql/scripts/mock-data.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo "use this script to load your service with some mock data if needed!" From 8fc45676bf14c9d4389a7fb8934aa7712e0935e6 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 11:46:54 +0200 Subject: [PATCH 21/80] chore(gql/catalog): fixing bundling of graphql asse --- plugins/catalog-graphql/package.json | 3 ++- plugins/catalog-graphql/src/graphql/module.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index be5c585186..d339119901 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -44,6 +44,7 @@ "supertest": "^4.0.2" }, "files": [ - "dist" + "dist", + "schema.gql" ] } diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index 772e472d1b..eb4c550819 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -28,13 +28,15 @@ export interface ModuleOptions { config: Config; } +const schemaPath = path.resolve( + require.resolve('@backstage/plugin-graphql-backend/package.json'), + '../schema.gql', +); + export async function createModule( options: ModuleOptions, ): Promise { - const typeDefs = await fs.promises.readFile( - path.resolve(__dirname, '..', 'schema.gql'), - 'utf-8', - ); + const typeDefs = await fs.promises.readFile(schemaPath, 'utf-8'); const catalogClient = new CatalogClient( options.config.getString('backend.baseUrl'), From c8060220e1842805c25e63cbe42f28b25509579b Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 11:47:31 +0200 Subject: [PATCH 22/80] chore(gql/catalog): actually read --- plugins/catalog-graphql/src/graphql/module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index eb4c550819..967df97662 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -29,7 +29,7 @@ export interface ModuleOptions { } const schemaPath = path.resolve( - require.resolve('@backstage/plugin-graphql-backend/package.json'), + require.resolve('@backstage/plugin-catalog-graphql/package.json'), '../schema.gql', ); From fc85bb41ddb9c09b468597033a92050a82a79d65 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 11:52:05 +0200 Subject: [PATCH 23/80] chore(gql/catalog): removing the mock data scripts for catalog-graph l --- plugins/catalog-graphql/package.json | 3 +-- plugins/catalog-graphql/scripts/mock-data.sh | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100755 plugins/catalog-graphql/scripts/mock-data.sh diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index d339119901..28e72cefd3 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -17,8 +17,7 @@ "prepack": "backstage-cli prepack", "postpack": "backstage-cli postpack", "generate:types": "graphql-codegen", - "clean": "backstage-cli clean", - "mock-data": "./scripts/mock-data.sh" + "clean": "backstage-cli clean" }, "dependencies": { "@backstage/backend-common": "^0.1.1-alpha.18", diff --git a/plugins/catalog-graphql/scripts/mock-data.sh b/plugins/catalog-graphql/scripts/mock-data.sh deleted file mode 100755 index ff30921715..0000000000 --- a/plugins/catalog-graphql/scripts/mock-data.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo "use this script to load your service with some mock data if needed!" From c4911612b1a07738cb747f4ad626ec6a66f442fa Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 14:21:10 +0200 Subject: [PATCH 24/80] chore(gql/catalog): updating the return types from the catalog api --- plugins/catalog-graphql/src/graphql/module.ts | 10 +--------- plugins/catalog-graphql/src/service/client.ts | 2 ++ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index 967df97662..3068b3b129 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -50,15 +50,7 @@ export async function createModule( }, CatalogQuery: { list: async () => { - const catalogEntries = await catalogClient.list(); - return catalogEntries.map(entity => ({ - ...entity, - metadata: { - ...entity.metadata, - annotations: entity.metadata.annotations ?? {}, - labels: entity.metadata.labels ?? {}, - }, - })); + return await catalogClient.list(); }, }, EntityMetadata: { diff --git a/plugins/catalog-graphql/src/service/client.ts b/plugins/catalog-graphql/src/service/client.ts index 05e73b88b8..8af97a89b1 100644 --- a/plugins/catalog-graphql/src/service/client.ts +++ b/plugins/catalog-graphql/src/service/client.ts @@ -23,6 +23,8 @@ export interface ReaderEntityMeta extends EntityMeta { etag: string; generation: number; namespace: string; + annotations: Record; + labels: Record; } export interface ReaderEntity extends Entity { metadata: JsonObject & ReaderEntityMeta; From 9bcc1bcb288a030c3d2e8ed3ad3fae06a439a9fe Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 16:11:21 +0200 Subject: [PATCH 25/80] chore(catalog/gql): move the catalog schema out of src --- plugins/catalog-graphql/{src => }/schema.gql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugins/catalog-graphql/{src => }/schema.gql (100%) diff --git a/plugins/catalog-graphql/src/schema.gql b/plugins/catalog-graphql/schema.gql similarity index 100% rename from plugins/catalog-graphql/src/schema.gql rename to plugins/catalog-graphql/schema.gql From 10e4dc991f197322cfad0c9ecca35cd770de98cc Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 16:12:15 +0200 Subject: [PATCH 26/80] chore(catalog/gql): fixing csp for playground --- plugins/graphql/package.json | 1 + plugins/graphql/src/service/router.ts | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/graphql/package.json b/plugins/graphql/package.json index f98c21f2c7..6f8ff50c1a 100644 --- a/plugins/graphql/package.json +++ b/plugins/graphql/package.json @@ -29,6 +29,7 @@ "express": "^4.17.1", "express-promise-router": "^3.0.3", "graphql": "^15.3.0", + "helmet": "^4.0.0", "node-fetch": "^2.6.0", "reflect-metadata": "^0.1.13", "winston": "^3.2.1", diff --git a/plugins/graphql/src/service/router.ts b/plugins/graphql/src/service/router.ts index 784b801b86..cd926da3a2 100644 --- a/plugins/graphql/src/service/router.ts +++ b/plugins/graphql/src/service/router.ts @@ -24,6 +24,7 @@ import { GraphQLModule } from '@graphql-modules/core'; import { ApolloServer } from 'apollo-server-express'; import { createModule as createCatalogModule } from '@backstage/plugin-catalog-graphql'; import { Config } from '@backstage/config'; +import helmet from 'helmet'; const schemaPath = path.resolve( require.resolve('@backstage/plugin-graphql-backend/package.json'), @@ -41,15 +42,29 @@ export async function createRouter( const typeDefs = await fs.promises.readFile(schemaPath, 'utf-8'); const catalogModule = await createCatalogModule(options); + const { schema } = new GraphQLModule({ imports: [catalogModule], typeDefs, }); - const server = new ApolloServer({ schema, logger: options.logger }); + const server = new ApolloServer({ + schema, + logger: options.logger, + }); + const router = Router(); const apolloMiddlware = server.getMiddleware({ path: '/' }); + + router.use( + helmet.contentSecurityPolicy({ + directives: { + defaultSrc: ["'self'", "'unsafe-inline'", 'http://*'], + }, + }), + ); + router.use(apolloMiddlware); router.get('/health', (_, response) => { From e01952279e1a5e4ce45b80a028509e30bb657259 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 16:12:35 +0200 Subject: [PATCH 27/80] chore(catalog): yarn lock --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index e967be54ca..7dfa9e500f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10377,7 +10377,7 @@ file-loader@^4.2.0: loader-utils "^1.2.3" schema-utils "^2.5.0" -"file-saver@github:eligrey/FileSaver.js#1.3.8": +file-saver@eligrey/FileSaver.js#1.3.8: version "1.3.8" resolved "https://codeload.github.com/eligrey/FileSaver.js/tar.gz/e865e37af9f9947ddcced76b549e27dc45c1cb2e" From 90579b9089ca4111ba81316d2985e8eb283fdc44 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 18:50:08 +0200 Subject: [PATCH 28/80] feat(gql/catalog): Reduce the amount of duplication a little for unions --- plugins/catalog-graphql/codegen.yml | 2 +- plugins/catalog-graphql/schema.gql | 38 +++++++++- plugins/catalog-graphql/src/graphql/module.ts | 54 +++++++++++++- plugins/catalog-graphql/src/graphql/types.ts | 72 +++++++++++++++++-- 4 files changed, 156 insertions(+), 10 deletions(-) diff --git a/plugins/catalog-graphql/codegen.yml b/plugins/catalog-graphql/codegen.yml index ebdb34a938..a4f3abcbe4 100644 --- a/plugins/catalog-graphql/codegen.yml +++ b/plugins/catalog-graphql/codegen.yml @@ -1,5 +1,5 @@ overwrite: true -schema: ./src/schema.gql +schema: ./schema.gql require: - ts-node/register/transpile-only generates: diff --git a/plugins/catalog-graphql/schema.gql b/plugins/catalog-graphql/schema.gql index bb8e5bcc87..813b2840a6 100644 --- a/plugins/catalog-graphql/schema.gql +++ b/plugins/catalog-graphql/schema.gql @@ -1,9 +1,43 @@ scalar JSON scalar JSONObject -type EntityMetadata { +interface EntityMetadata { + name: String! + annotations: JSONObject! + annotation(name: String!): JSON + labels: JSONObject! + label(name: String!): JSON + uid: String! + etag: String! + generation: Int! +} + +type ComponentMetadata implements EntityMetadata { + name: String! + annotations: JSONObject! + annotation(name: String!): JSON + labels: JSONObject! + label(name: String!): JSON + uid: String! + etag: String! + generation: Int! + relationships: String! +} + +type TemplateMetadata implements EntityMetadata { + name: String! + annotations: JSONObject! + annotation(name: String!): JSON + labels: JSONObject! + label(name: String!): JSON + uid: String! + etag: String! + generation: Int! + updatedBy: String! +} + +type DefaultEntityMetadata implements EntityMetadata { name: String! - namespace: String! annotations: JSONObject! annotation(name: String!): JSON labels: JSONObject! diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index 3068b3b129..f66ff5073e 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -17,8 +17,14 @@ import { Logger } from 'winston'; import fs from 'fs'; import path from 'path'; +import { makeExecutableSchema } from 'apollo-server'; import { GraphQLModule } from '@graphql-modules/core'; -import { Resolvers, CatalogQuery } from './types'; +import { + Resolvers, + CatalogQuery, + CatalogEntityTypes, + EntityMetadataResolvers, +} from './types'; import { Config } from '@backstage/config'; import { CatalogClient } from '../service/client'; import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json'; @@ -33,6 +39,19 @@ const schemaPath = path.resolve( '../schema.gql', ); +const getSpecTypenameForEntity = (e: { kind?: string }) => { + switch (e.kind) { + case 'Component': + return 'ComponentEntity'; + case 'Location': + return 'LocationEntity'; + case 'Template': + return 'TemplateEntity'; + default: + return null; + } +}; + export async function createModule( options: ModuleOptions, ): Promise { @@ -53,15 +72,46 @@ export async function createModule( return await catalogClient.list(); }, }, + ComponentMetadata: { + relationships: () => 'boop', + }, + TemplateMetadata: { + updatedBy: () => 'blam', + }, + CatalogEntity: { + metadata: e => ({ ...e.metadata!, catalogEntity: e }), + }, EntityMetadata: { + __resolveType: (obj: any) => { + const kind = obj.catalogEntity!.kind; + switch (kind) { + case 'Component': + return 'ComponentMetadata'; + case 'Template': + return 'TemplateMetadata'; + default: + return 'DefaultEntityMetadata'; + } + }, annotation: (e, { name }) => e.annotations?.[name] ?? null, + labels: e => e ?? {}, + annotations: e => e ?? {}, label: (e, { name }) => e.labels?.[name] ?? null, }, }; - const module = new GraphQLModule({ + const schema = makeExecutableSchema({ typeDefs, resolvers, + inheritResolversFromInterfaces: true, + resolverValidationOptions: { + allowResolversNotInSchema: true, + }, + }); + + const module = new GraphQLModule({ + resolverValidationOptions: {}, + extraSchemas: [schema], logger: options.logger as any, }); diff --git a/plugins/catalog-graphql/src/graphql/types.ts b/plugins/catalog-graphql/src/graphql/types.ts index 7294f749ad..e2b10ec6a2 100644 --- a/plugins/catalog-graphql/src/graphql/types.ts +++ b/plugins/catalog-graphql/src/graphql/types.ts @@ -33,9 +33,7 @@ export type Scalars = { export type EntityMetadata = { - __typename?: 'EntityMetadata'; name: Scalars['String']; - namespace: Scalars['String']; annotations: Scalars['JSONObject']; annotation?: Maybe; labels: Scalars['JSONObject']; @@ -55,6 +53,39 @@ export type EntityMetadataLabelArgs = { name: Scalars['String']; }; +export type ComponentMetadata = EntityMetadata & { + __typename?: 'ComponentMetadata'; + relationships: Scalars['String']; +}; + +export type TemplateMetadata = EntityMetadata & { + __typename?: 'TemplateMetadata'; + updatedBy: Scalars['String']; +}; + +export type DefaultEntityMetadata = EntityMetadata & { + __typename?: 'DefaultEntityMetadata'; + name: Scalars['String']; + annotations: Scalars['JSONObject']; + annotation?: Maybe; + labels: Scalars['JSONObject']; + label?: Maybe; + uid: Scalars['String']; + etag: Scalars['String']; + generation: Scalars['Int']; + updatedBy: Scalars['String']; +}; + + +export type DefaultEntityMetadataAnnotationArgs = { + name: Scalars['String']; +}; + + +export type DefaultEntityMetadataLabelArgs = { + name: Scalars['String']; +}; + export type CatalogEntity = { __typename?: 'CatalogEntity'; apiVersion: Scalars['String']; @@ -153,9 +184,12 @@ export type DirectiveResolverFn>; JSONObject: ResolverTypeWrapper>; - EntityMetadata: ResolverTypeWrapper>; + EntityMetadata: ResolversTypes['ComponentMetadata'] | ResolversTypes['TemplateMetadata'] | ResolversTypes['DefaultEntityMetadata']; String: ResolverTypeWrapper>; Int: ResolverTypeWrapper>; + ComponentMetadata: ResolverTypeWrapper>; + TemplateMetadata: ResolverTypeWrapper>; + DefaultEntityMetadata: ResolverTypeWrapper>; CatalogEntity: ResolverTypeWrapper>; CatalogQuery: ResolverTypeWrapper>; Query: ResolverTypeWrapper<{}>; @@ -166,9 +200,12 @@ export type ResolversTypes = ResolversObject<{ export type ResolversParentTypes = ResolversObject<{ JSON: Partial; JSONObject: Partial; - EntityMetadata: Partial; + EntityMetadata: ResolversParentTypes['ComponentMetadata'] | ResolversParentTypes['TemplateMetadata'] | ResolversParentTypes['DefaultEntityMetadata']; String: Partial; Int: Partial; + ComponentMetadata: Partial; + TemplateMetadata: Partial; + DefaultEntityMetadata: Partial; CatalogEntity: Partial; CatalogQuery: Partial; Query: {}; @@ -184,8 +221,8 @@ export interface JsonObjectScalarConfig extends GraphQLScalarTypeConfig = ResolversObject<{ + __resolveType: TypeResolveFn<'ComponentMetadata' | 'TemplateMetadata' | 'DefaultEntityMetadata', ParentType, ContextType>; name?: Resolver; - namespace?: Resolver; annotations?: Resolver; annotation?: Resolver, ParentType, ContextType, RequireFields>; labels?: Resolver; @@ -193,6 +230,28 @@ export type EntityMetadataResolvers; etag?: Resolver; generation?: Resolver; +}>; + +export type ComponentMetadataResolvers = ResolversObject<{ + relationships?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type TemplateMetadataResolvers = ResolversObject<{ + updatedBy?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type DefaultEntityMetadataResolvers = ResolversObject<{ + name?: Resolver; + annotations?: Resolver; + annotation?: Resolver, ParentType, ContextType, RequireFields>; + labels?: Resolver; + label?: Resolver, ParentType, ContextType, RequireFields>; + uid?: Resolver; + etag?: Resolver; + generation?: Resolver; + updatedBy?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }>; @@ -216,6 +275,9 @@ export type Resolvers = ResolversObject<{ JSON?: GraphQLScalarType; JSONObject?: GraphQLScalarType; EntityMetadata?: EntityMetadataResolvers; + ComponentMetadata?: ComponentMetadataResolvers; + TemplateMetadata?: TemplateMetadataResolvers; + DefaultEntityMetadata?: DefaultEntityMetadataResolvers; CatalogEntity?: CatalogEntityResolvers; CatalogQuery?: CatalogQueryResolvers; Query?: QueryResolvers; From eb3ed5c0f883973e8e86a4d08156ef417f96529d Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 12 Aug 2020 01:45:47 +0200 Subject: [PATCH 29/80] feat(gql/catalog): working on making the schema nice --- plugins/catalog-graphql/codegen.yml | 7 +- plugins/catalog-graphql/package.json | 2 + plugins/catalog-graphql/schema.gql | 62 --- plugins/catalog-graphql/src/graphql/module.ts | 75 ++- plugins/catalog-graphql/src/graphql/types.ts | 434 +++++++++++++++--- 5 files changed, 403 insertions(+), 177 deletions(-) delete mode 100644 plugins/catalog-graphql/schema.gql diff --git a/plugins/catalog-graphql/codegen.yml b/plugins/catalog-graphql/codegen.yml index a4f3abcbe4..bb50b68101 100644 --- a/plugins/catalog-graphql/codegen.yml +++ b/plugins/catalog-graphql/codegen.yml @@ -1,9 +1,7 @@ overwrite: true -schema: ./schema.gql -require: - - ts-node/register/transpile-only generates: ./src/graphql/types.ts: + schema: ./src/schema.js plugins: - typescript - typescript-resolvers @@ -11,6 +9,7 @@ generates: afterOneFileWrite: - eslint --fix config: - contextType: '@graphql-modules/core#ModuleContext' + contextType: "@graphql-modules/core#ModuleContext" + allowParentTypeOverride: true useIndexSignature: true defaultMapper: Partial<{T}> diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 28e72cefd3..83e88e1d25 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -27,7 +27,9 @@ "@graphql-codegen/typescript": "^1.17.7", "@graphql-codegen/typescript-resolvers": "^1.17.7", "@graphql-modules/core": "^0.7.17", + "apollo-server": "^2.16.1", "graphql": "^15.3.0", + "graphql-tag": "^2.11.0", "graphql-type-json": "^0.3.2", "node-fetch": "^2.6.0", "ts-node": "^8.10.2", diff --git a/plugins/catalog-graphql/schema.gql b/plugins/catalog-graphql/schema.gql deleted file mode 100644 index 813b2840a6..0000000000 --- a/plugins/catalog-graphql/schema.gql +++ /dev/null @@ -1,62 +0,0 @@ -scalar JSON -scalar JSONObject - -interface EntityMetadata { - name: String! - annotations: JSONObject! - annotation(name: String!): JSON - labels: JSONObject! - label(name: String!): JSON - uid: String! - etag: String! - generation: Int! -} - -type ComponentMetadata implements EntityMetadata { - name: String! - annotations: JSONObject! - annotation(name: String!): JSON - labels: JSONObject! - label(name: String!): JSON - uid: String! - etag: String! - generation: Int! - relationships: String! -} - -type TemplateMetadata implements EntityMetadata { - name: String! - annotations: JSONObject! - annotation(name: String!): JSON - labels: JSONObject! - label(name: String!): JSON - uid: String! - etag: String! - generation: Int! - updatedBy: String! -} - -type DefaultEntityMetadata implements EntityMetadata { - name: String! - annotations: JSONObject! - annotation(name: String!): JSON - labels: JSONObject! - label(name: String!): JSON - uid: String! - etag: String! - generation: Int! -} - -type CatalogEntity { - apiVersion: String! - kind: String! - metadata: EntityMetadata! -} - -type CatalogQuery { - list: [CatalogEntity!]! -} - -type Query { - catalog: CatalogQuery! -} diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index f66ff5073e..c2266001b9 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -15,47 +15,23 @@ */ import { Logger } from 'winston'; -import fs from 'fs'; -import path from 'path'; import { makeExecutableSchema } from 'apollo-server'; import { GraphQLModule } from '@graphql-modules/core'; -import { - Resolvers, - CatalogQuery, - CatalogEntityTypes, - EntityMetadataResolvers, -} from './types'; +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'; export interface ModuleOptions { logger: Logger; config: Config; } -const schemaPath = path.resolve( - require.resolve('@backstage/plugin-catalog-graphql/package.json'), - '../schema.gql', -); - -const getSpecTypenameForEntity = (e: { kind?: string }) => { - switch (e.kind) { - case 'Component': - return 'ComponentEntity'; - case 'Location': - return 'LocationEntity'; - case 'Template': - return 'TemplateEntity'; - default: - return null; - } -}; - export async function createModule( options: ModuleOptions, ): Promise { - const typeDefs = await fs.promises.readFile(schemaPath, 'utf-8'); + const typeDefs = require('../schema'); const catalogClient = new CatalogClient( options.config.getString('backend.baseUrl'), @@ -64,6 +40,12 @@ export async function createModule( const resolvers: Resolvers = { JSON: GraphQLJSON, JSONObject: GraphQLJSONObject, + DefaultEntitySpec: { + raw: rootValue => { + const { entity } = rootValue as { entity: Entity }; + return entity.spec ?? null; + }, + }, Query: { catalog: () => ({} as CatalogQuery), }, @@ -72,18 +54,15 @@ export async function createModule( return await catalogClient.list(); }, }, - ComponentMetadata: { - relationships: () => 'boop', - }, - TemplateMetadata: { - updatedBy: () => 'blam', - }, CatalogEntity: { - metadata: e => ({ ...e.metadata!, catalogEntity: e }), + metadata: entity => ({ ...entity.metadata!, entity }), + spec: entity => ({ ...entity.spec!, entity }), }, EntityMetadata: { - __resolveType: (obj: any) => { - const kind = obj.catalogEntity!.kind; + __resolveType: rootValue => { + const { + entity: { kind }, + } = rootValue as { entity: Entity }; switch (kind) { case 'Component': return 'ComponentMetadata'; @@ -94,23 +73,35 @@ export async function createModule( } }, annotation: (e, { name }) => e.annotations?.[name] ?? null, - labels: e => e ?? {}, - annotations: e => e ?? {}, + 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'; + } + }, + }, }; const schema = makeExecutableSchema({ typeDefs, resolvers, inheritResolversFromInterfaces: true, - resolverValidationOptions: { - allowResolversNotInSchema: true, - }, }); const module = new GraphQLModule({ - resolverValidationOptions: {}, extraSchemas: [schema], logger: options.logger as any, }); diff --git a/plugins/catalog-graphql/src/graphql/types.ts b/plugins/catalog-graphql/src/graphql/types.ts index e2b10ec6a2..446a1f9f46 100644 --- a/plugins/catalog-graphql/src/graphql/types.ts +++ b/plugins/catalog-graphql/src/graphql/types.ts @@ -13,12 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; +import { + GraphQLResolveInfo, + GraphQLScalarType, + GraphQLScalarTypeConfig, +} from 'graphql'; import { ModuleContext } from '@graphql-modules/core'; export type Maybe = T | null; -export type Exact = { [K in keyof T]: T[K] }; -export type RequireFields = { [X in Exclude]?: T[X] } & { [P in K]-?: NonNullable }; +export type Exact = { + [K in keyof T]: T[K]; +}; +export type Omit = Pick>; +export type RequireFields = { + [X in Exclude]?: T[X]; +} & + { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -30,8 +40,6 @@ export type Scalars = { JSONObject: any; }; - - export type EntityMetadata = { name: Scalars['String']; annotations: Scalars['JSONObject']; @@ -43,26 +51,14 @@ export type EntityMetadata = { generation: Scalars['Int']; }; - export type EntityMetadataAnnotationArgs = { name: Scalars['String']; }; - export type EntityMetadataLabelArgs = { name: Scalars['String']; }; -export type ComponentMetadata = EntityMetadata & { - __typename?: 'ComponentMetadata'; - relationships: Scalars['String']; -}; - -export type TemplateMetadata = EntityMetadata & { - __typename?: 'TemplateMetadata'; - updatedBy: Scalars['String']; -}; - export type DefaultEntityMetadata = EntityMetadata & { __typename?: 'DefaultEntityMetadata'; name: Scalars['String']; @@ -73,24 +69,97 @@ export type DefaultEntityMetadata = EntityMetadata & { uid: Scalars['String']; etag: Scalars['String']; generation: Scalars['Int']; - updatedBy: Scalars['String']; }; - export type DefaultEntityMetadataAnnotationArgs = { name: Scalars['String']; }; - export type DefaultEntityMetadataLabelArgs = { name: Scalars['String']; }; +export type ComponentMetadata = EntityMetadata & { + __typename?: 'ComponentMetadata'; + name: Scalars['String']; + annotations: Scalars['JSONObject']; + annotation?: Maybe; + labels: Scalars['JSONObject']; + label?: Maybe; + uid: Scalars['String']; + etag: Scalars['String']; + generation: Scalars['Int']; + relationships?: Maybe; +}; + +export type ComponentMetadataAnnotationArgs = { + name: Scalars['String']; +}; + +export type ComponentMetadataLabelArgs = { + name: Scalars['String']; +}; + +export type TemplateMetadata = EntityMetadata & { + __typename?: 'TemplateMetadata'; + name: Scalars['String']; + annotations: Scalars['JSONObject']; + annotation?: Maybe; + labels: Scalars['JSONObject']; + label?: Maybe; + uid: Scalars['String']; + etag: Scalars['String']; + generation: Scalars['Int']; + updatedBy?: Maybe; +}; + +export type TemplateMetadataAnnotationArgs = { + name: Scalars['String']; +}; + +export type TemplateMetadataLabelArgs = { + name: Scalars['String']; +}; + +export type TemplateEntitySpec = { + __typename?: 'TemplateEntitySpec'; + type: Scalars['String']; + path?: Maybe; + schema: Scalars['JSONObject']; + templater: Scalars['String']; +}; + +export type ComponentEntitySpec = { + __typename?: 'ComponentEntitySpec'; + title: Scalars['String']; + lifecycle: Scalars['String']; + owner: Scalars['String']; +}; + +export type LocationEntitySpec = { + __typename?: 'LocationEntitySpec'; + type: Scalars['String']; + target?: Maybe; + targets: Array; +}; + +export type DefaultEntitySpec = { + __typename?: 'DefaultEntitySpec'; + raw?: Maybe; +}; + +export type EntitySpec = + | DefaultEntitySpec + | TemplateEntitySpec + | LocationEntitySpec + | ComponentEntitySpec; + export type CatalogEntity = { __typename?: 'CatalogEntity'; apiVersion: Scalars['String']; kind: Scalars['String']; - metadata: EntityMetadata; + metadata?: Maybe; + spec: EntitySpec; }; export type CatalogQuery = { @@ -108,7 +177,6 @@ export type ResolversObject = WithIndex; export type ResolverTypeWrapper = Promise | T; - export type LegacyStitchingResolver = { fragment: string; resolve: ResolverFn; @@ -118,7 +186,9 @@ export type NewStitchingResolver = { selectionSet: string; resolve: ResolverFn; }; -export type StitchingResolver = LegacyStitchingResolver | NewStitchingResolver; +export type StitchingResolver = + | LegacyStitchingResolver + | NewStitchingResolver; export type Resolver = | ResolverFn | StitchingResolver; @@ -127,26 +197,42 @@ export type ResolverFn = ( parent: TParent, args: TArgs, context: TContext, - info: GraphQLResolveInfo + info: GraphQLResolveInfo, ) => Promise | TResult; export type SubscriptionSubscribeFn = ( parent: TParent, args: TArgs, context: TContext, - info: GraphQLResolveInfo + info: GraphQLResolveInfo, ) => AsyncIterator | Promise>; export type SubscriptionResolveFn = ( parent: TParent, args: TArgs, context: TContext, - info: GraphQLResolveInfo + info: GraphQLResolveInfo, ) => TResult | Promise; -export interface SubscriptionSubscriberObject { - subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>; - resolve?: SubscriptionResolveFn; +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 { @@ -154,43 +240,82 @@ export interface SubscriptionResolverObject { resolve: SubscriptionResolveFn; } -export type SubscriptionObject = +export type SubscriptionObject< + TResult, + TKey extends string, + TParent, + TContext, + TArgs +> = | SubscriptionSubscriberObject | SubscriptionResolverObject; -export type SubscriptionResolver = - | ((...args: any[]) => SubscriptionObject) +export type SubscriptionResolver< + TResult, + TKey extends string, + TParent = {}, + TContext = {}, + TArgs = {} +> = + | (( + ...args: any[] + ) => SubscriptionObject) | SubscriptionObject; export type TypeResolveFn = ( parent: TParent, context: TContext, - info: GraphQLResolveInfo + info: GraphQLResolveInfo, ) => Maybe | Promise>; -export type IsTypeOfResolverFn = (obj: T, info: GraphQLResolveInfo) => boolean | Promise; +export type IsTypeOfResolverFn = ( + obj: T, + info: GraphQLResolveInfo, +) => boolean | Promise; export type NextResolverFn = () => Promise; -export type DirectiveResolverFn = ( +export type DirectiveResolverFn< + TResult = {}, + TParent = {}, + TContext = {}, + TArgs = {} +> = ( next: NextResolverFn, parent: TParent, args: TArgs, context: TContext, - info: GraphQLResolveInfo + info: GraphQLResolveInfo, ) => TResult | Promise; /** Mapping between all available schema types and the resolvers types */ export type ResolversTypes = ResolversObject<{ JSON: ResolverTypeWrapper>; JSONObject: ResolverTypeWrapper>; - EntityMetadata: ResolversTypes['ComponentMetadata'] | ResolversTypes['TemplateMetadata'] | ResolversTypes['DefaultEntityMetadata']; + EntityMetadata: + | ResolversTypes['DefaultEntityMetadata'] + | ResolversTypes['ComponentMetadata'] + | ResolversTypes['TemplateMetadata']; String: ResolverTypeWrapper>; Int: ResolverTypeWrapper>; + DefaultEntityMetadata: ResolverTypeWrapper>; ComponentMetadata: ResolverTypeWrapper>; TemplateMetadata: ResolverTypeWrapper>; - DefaultEntityMetadata: ResolverTypeWrapper>; - CatalogEntity: ResolverTypeWrapper>; + TemplateEntitySpec: ResolverTypeWrapper>; + ComponentEntitySpec: ResolverTypeWrapper>; + LocationEntitySpec: ResolverTypeWrapper>; + DefaultEntitySpec: ResolverTypeWrapper>; + EntitySpec: Partial< + | ResolversTypes['DefaultEntitySpec'] + | ResolversTypes['TemplateEntitySpec'] + | ResolversTypes['LocationEntitySpec'] + | ResolversTypes['ComponentEntitySpec'] + >; + CatalogEntity: ResolverTypeWrapper< + Partial< + Omit & { spec: ResolversTypes['EntitySpec'] } + > + >; CatalogQuery: ResolverTypeWrapper>; Query: ResolverTypeWrapper<{}>; Boolean: ResolverTypeWrapper>; @@ -200,74 +325,241 @@ export type ResolversTypes = ResolversObject<{ export type ResolversParentTypes = ResolversObject<{ JSON: Partial; JSONObject: Partial; - EntityMetadata: ResolversParentTypes['ComponentMetadata'] | ResolversParentTypes['TemplateMetadata'] | ResolversParentTypes['DefaultEntityMetadata']; + EntityMetadata: + | ResolversParentTypes['DefaultEntityMetadata'] + | ResolversParentTypes['ComponentMetadata'] + | ResolversParentTypes['TemplateMetadata']; String: Partial; Int: Partial; + DefaultEntityMetadata: Partial; ComponentMetadata: Partial; TemplateMetadata: Partial; - DefaultEntityMetadata: Partial; - CatalogEntity: Partial; + TemplateEntitySpec: Partial; + ComponentEntitySpec: Partial; + LocationEntitySpec: Partial; + DefaultEntitySpec: Partial; + EntitySpec: Partial< + | ResolversParentTypes['DefaultEntitySpec'] + | ResolversParentTypes['TemplateEntitySpec'] + | ResolversParentTypes['LocationEntitySpec'] + | ResolversParentTypes['ComponentEntitySpec'] + >; + CatalogEntity: Partial< + Omit & { spec: ResolversParentTypes['EntitySpec'] } + >; CatalogQuery: Partial; Query: {}; Boolean: Partial; }>; -export interface JsonScalarConfig extends GraphQLScalarTypeConfig { +export interface JsonScalarConfig + extends GraphQLScalarTypeConfig { name: 'JSON'; } -export interface JsonObjectScalarConfig extends GraphQLScalarTypeConfig { +export interface JsonObjectScalarConfig + extends GraphQLScalarTypeConfig { name: 'JSONObject'; } -export type EntityMetadataResolvers = ResolversObject<{ - __resolveType: TypeResolveFn<'ComponentMetadata' | 'TemplateMetadata' | 'DefaultEntityMetadata', ParentType, ContextType>; +export type EntityMetadataResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['EntityMetadata'] +> = ResolversObject<{ + __resolveType: TypeResolveFn< + 'DefaultEntityMetadata' | 'ComponentMetadata' | 'TemplateMetadata', + ParentType, + ContextType + >; name?: Resolver; annotations?: Resolver; - annotation?: Resolver, ParentType, ContextType, RequireFields>; + annotation?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; labels?: Resolver; - label?: Resolver, ParentType, ContextType, RequireFields>; + label?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; uid?: Resolver; etag?: Resolver; generation?: Resolver; }>; -export type ComponentMetadataResolvers = ResolversObject<{ - relationships?: Resolver; - __isTypeOf?: IsTypeOfResolverFn; -}>; - -export type TemplateMetadataResolvers = ResolversObject<{ - updatedBy?: Resolver; - __isTypeOf?: IsTypeOfResolverFn; -}>; - -export type DefaultEntityMetadataResolvers = ResolversObject<{ +export type DefaultEntityMetadataResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['DefaultEntityMetadata'] +> = ResolversObject<{ name?: Resolver; annotations?: Resolver; - annotation?: Resolver, ParentType, ContextType, RequireFields>; + annotation?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; labels?: Resolver; - label?: Resolver, ParentType, ContextType, RequireFields>; + label?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; uid?: Resolver; etag?: Resolver; generation?: Resolver; - updatedBy?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }>; -export type CatalogEntityResolvers = ResolversObject<{ +export type ComponentMetadataResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['ComponentMetadata'] +> = ResolversObject<{ + name?: Resolver; + annotations?: Resolver; + annotation?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; + labels?: Resolver; + label?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; + uid?: Resolver; + etag?: Resolver; + generation?: Resolver; + relationships?: Resolver< + Maybe, + ParentType, + ContextType + >; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type TemplateMetadataResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['TemplateMetadata'] +> = ResolversObject<{ + name?: Resolver; + annotations?: Resolver; + annotation?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; + labels?: Resolver; + label?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; + uid?: Resolver; + etag?: Resolver; + generation?: Resolver; + updatedBy?: Resolver< + Maybe, + ParentType, + ContextType + >; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type TemplateEntitySpecResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['TemplateEntitySpec'] +> = ResolversObject<{ + type?: Resolver; + path?: Resolver, ParentType, ContextType>; + schema?: Resolver; + templater?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type ComponentEntitySpecResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['ComponentEntitySpec'] +> = ResolversObject<{ + title?: Resolver; + lifecycle?: Resolver; + owner?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type LocationEntitySpecResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['LocationEntitySpec'] +> = ResolversObject<{ + type?: Resolver; + target?: Resolver, ParentType, ContextType>; + targets?: Resolver, ParentType, ContextType>; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type DefaultEntitySpecResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['DefaultEntitySpec'] +> = ResolversObject<{ + raw?: Resolver, ParentType, ContextType>; + __isTypeOf?: IsTypeOfResolverFn; +}>; + +export type EntitySpecResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['EntitySpec'] +> = ResolversObject<{ + __resolveType: TypeResolveFn< + | 'DefaultEntitySpec' + | 'TemplateEntitySpec' + | 'LocationEntitySpec' + | 'ComponentEntitySpec', + ParentType, + ContextType + >; +}>; + +export type CatalogEntityResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['CatalogEntity'] +> = ResolversObject<{ apiVersion?: Resolver; kind?: Resolver; - metadata?: Resolver; + metadata?: Resolver< + Maybe, + ParentType, + ContextType + >; + spec?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }>; -export type CatalogQueryResolvers = ResolversObject<{ - list?: Resolver, ParentType, ContextType>; +export type CatalogQueryResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['CatalogQuery'] +> = ResolversObject<{ + list?: Resolver< + Array, + ParentType, + ContextType + >; __isTypeOf?: IsTypeOfResolverFn; }>; -export type QueryResolvers = ResolversObject<{ +export type QueryResolvers< + ContextType = ModuleContext, + ParentType = ResolversParentTypes['Query'] +> = ResolversObject<{ catalog?: Resolver; }>; @@ -275,15 +567,19 @@ export type Resolvers = ResolversObject<{ JSON?: GraphQLScalarType; JSONObject?: GraphQLScalarType; EntityMetadata?: EntityMetadataResolvers; + DefaultEntityMetadata?: DefaultEntityMetadataResolvers; ComponentMetadata?: ComponentMetadataResolvers; TemplateMetadata?: TemplateMetadataResolvers; - DefaultEntityMetadata?: DefaultEntityMetadataResolvers; + TemplateEntitySpec?: TemplateEntitySpecResolvers; + ComponentEntitySpec?: ComponentEntitySpecResolvers; + LocationEntitySpec?: LocationEntitySpecResolvers; + DefaultEntitySpec?: DefaultEntitySpecResolvers; + EntitySpec?: EntitySpecResolvers; CatalogEntity?: CatalogEntityResolvers; CatalogQuery?: CatalogQueryResolvers; Query?: QueryResolvers; }>; - /** * @deprecated * Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config. From ce2ed89e57c8e978a62fbb77f423ad1bcde79ace Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 12 Aug 2020 01:47:09 +0200 Subject: [PATCH 30/80] feat(gql/catalog): to remove the duplication in the schema thanks to the limitations on implements, let's create the schema using javascript Trust me, i've tried getting this to work with a typescript file, but it just would not work with the import export keywords which are needed to satisfy typescript config. couldn't get it to transpile anything properly. so thought screw it for now --- packages/backend-common/src/gql.ts | 17 ++++++ packages/backend-common/src/index.ts | 1 + plugins/catalog-graphql/src/schema.js | 87 +++++++++++++++++++++++++++ yarn.lock | 65 +++++++++++++++++++- 4 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 packages/backend-common/src/gql.ts create mode 100644 plugins/catalog-graphql/src/schema.js diff --git a/packages/backend-common/src/gql.ts b/packages/backend-common/src/gql.ts new file mode 100644 index 0000000000..ca6b9c7f55 --- /dev/null +++ b/packages/backend-common/src/gql.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2020 Spotify AB + * + * 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 const gql = (s: TemplateStringsArray, ...args: any[]) => + s.map((ss, i) => `${ss}${args[i] || ''}`).join(''); diff --git a/packages/backend-common/src/index.ts b/packages/backend-common/src/index.ts index a3f57ed9df..4b9518c6bc 100644 --- a/packages/backend-common/src/index.ts +++ b/packages/backend-common/src/index.ts @@ -20,3 +20,4 @@ export * from './logging'; export * from './middleware'; export * from './service'; export * from './hot'; +export * from './gql'; diff --git a/plugins/catalog-graphql/src/schema.js b/plugins/catalog-graphql/src/schema.js new file mode 100644 index 0000000000..473aad97f5 --- /dev/null +++ b/plugins/catalog-graphql/src/schema.js @@ -0,0 +1,87 @@ +/* + * Copyright 2020 Spotify AB + * + * 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 EntityMetadataFields = /* GraphQL */ ` + name: String! + annotations: JSONObject! + annotation(name: String!): JSON + labels: JSONObject! + label(name: String!): JSON + uid: String! + etag: String! + generation: Int! +`; + +const EntityMetadata = /* GraphQL */ ` + scalar JSON + scalar JSONObject + + interface EntityMetadata { + ${EntityMetadataFields} + } + + type DefaultEntityMetadata implements EntityMetadata { + ${EntityMetadataFields} + } + + type ComponentMetadata implements EntityMetadata { + ${EntityMetadataFields} + # mock field to prove extensions working + relationships: String + } + + type TemplateMetadata implements EntityMetadata { + ${EntityMetadataFields} + # mock field to prove extensions working + updatedBy: String + } + + 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! + } +`; + +module.exports = EntityMetadata; diff --git a/yarn.lock b/yarn.lock index 7dfa9e500f..b4c5a4fe49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4460,7 +4460,7 @@ "@types/qs" "*" "@types/range-parser" "*" -"@types/express@*", "@types/express@^4.17.6", "@types/express@^4.17.7": +"@types/express@*", "@types/express@4.17.7", "@types/express@^4.17.6", "@types/express@^4.17.7": version "4.17.7" resolved "https://registry.npmjs.org/@types/express/-/express-4.17.7.tgz#42045be6475636d9801369cd4418ef65cdb0dd59" integrity sha512-dCOT5lcmV/uC2J9k0rPafATeeyz+99xTt54ReX11/LObZgfzJqZNcW27zGhYyX+9iSEGXGt5qLPwRSvBZcLvtQ== @@ -5843,6 +5843,34 @@ apollo-server-core@^2.16.0: subscriptions-transport-ws "^0.9.11" ws "^6.0.0" +apollo-server-core@^2.16.1: + version "2.16.1" + resolved "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.16.1.tgz#5b5b8245ab9c0cb6c2367ec19ab855dea6ccea3a" + integrity sha512-nuwn5ZBbmzPwDetb3FgiFFJlNK7ZBFg8kis/raymrjd3eBGdNcOyMTJDl6J9673X9Xqp+dXQmFYDW/G3G8S1YA== + dependencies: + "@apollographql/apollo-tools" "^0.4.3" + "@apollographql/graphql-playground-html" "1.6.26" + "@types/graphql-upload" "^8.0.0" + "@types/ws" "^7.0.0" + apollo-cache-control "^0.11.1" + apollo-datasource "^0.7.2" + apollo-engine-reporting "^2.3.0" + apollo-server-caching "^0.5.2" + apollo-server-env "^2.4.5" + apollo-server-errors "^2.4.2" + apollo-server-plugin-base "^0.9.1" + apollo-server-types "^0.5.1" + apollo-tracing "^0.11.1" + fast-json-stable-stringify "^2.0.0" + graphql-extensions "^0.12.4" + graphql-tag "^2.9.2" + graphql-tools "^4.0.0" + graphql-upload "^8.0.2" + loglevel "^1.6.7" + sha.js "^2.4.11" + subscriptions-transport-ws "^0.9.11" + ws "^6.0.0" + apollo-server-env@^2.4.5: version "2.4.5" resolved "https://registry.npmjs.org/apollo-server-env/-/apollo-server-env-2.4.5.tgz#73730b4f0439094a2272a9d0caa4079d4b661d5f" @@ -5878,6 +5906,28 @@ apollo-server-express@^2.16.0: subscriptions-transport-ws "^0.9.16" type-is "^1.6.16" +apollo-server-express@^2.16.1: + version "2.16.1" + resolved "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.16.1.tgz#7438bca590ef8577d24d20ba0b6d582c120c0146" + integrity sha512-Oq5YNcaMYnRk6jDmA9LWf8oSd2KHDVe7jQ4wtooAvG9FVUD+FaFBgSkytXHMvtifQh2wdF07Ri8uDLMz6IQjTw== + dependencies: + "@apollographql/graphql-playground-html" "1.6.26" + "@types/accepts" "^1.3.5" + "@types/body-parser" "1.19.0" + "@types/cors" "^2.8.4" + "@types/express" "4.17.7" + accepts "^1.3.5" + apollo-server-core "^2.16.1" + apollo-server-types "^0.5.1" + body-parser "^1.18.3" + cors "^2.8.4" + express "^4.17.1" + graphql-subscriptions "^1.0.0" + graphql-tools "^4.0.0" + parseurl "^1.3.2" + subscriptions-transport-ws "^0.9.16" + type-is "^1.6.16" + apollo-server-plugin-base@^0.9.1: version "0.9.1" resolved "https://registry.npmjs.org/apollo-server-plugin-base/-/apollo-server-plugin-base-0.9.1.tgz#a62ae9ab4e89790fd4cc5d123bb616da34e8e5fb" @@ -5905,6 +5955,17 @@ apollo-server@^2.16.0: graphql-subscriptions "^1.0.0" graphql-tools "^4.0.0" +apollo-server@^2.16.1: + version "2.16.1" + resolved "https://registry.npmjs.org/apollo-server/-/apollo-server-2.16.1.tgz#edc319606eb29f73132239bdc005dd88ac40a142" + integrity sha512-oy9NVRzGwlpQ+W1DwLKRH+KASmodSYpvYIRY5DMAZtGqNmT2zOCpbIZVjBt23SuPB5NhIhhE4ROzoObRv3zy5w== + dependencies: + apollo-server-core "^2.16.1" + apollo-server-express "^2.16.1" + express "^4.0.0" + graphql-subscriptions "^1.0.0" + graphql-tools "^4.0.0" + apollo-tracing@^0.11.1: version "0.11.1" resolved "https://registry.npmjs.org/apollo-tracing/-/apollo-tracing-0.11.1.tgz#3e3a4ce4b21e57dcc57b10bbd539db243b752606" @@ -11340,7 +11401,7 @@ graphql-subscriptions@^1.0.0: dependencies: iterall "^1.2.1" -graphql-tag@2.11.0: +graphql-tag@2.11.0, graphql-tag@^2.11.0: version "2.11.0" resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.11.0.tgz#1deb53a01c46a7eb401d6cb59dec86fa1cccbffd" integrity sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA== From 3600b0216fc27b6c730001f99cf231c34cbd4014 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 12 Aug 2020 02:10:46 +0200 Subject: [PATCH 31/80] chore: reverting code --- packages/backend-common/src/gql.ts | 17 ----------------- packages/backend-common/src/index.ts | 1 - 2 files changed, 18 deletions(-) delete mode 100644 packages/backend-common/src/gql.ts diff --git a/packages/backend-common/src/gql.ts b/packages/backend-common/src/gql.ts deleted file mode 100644 index ca6b9c7f55..0000000000 --- a/packages/backend-common/src/gql.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2020 Spotify AB - * - * 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 const gql = (s: TemplateStringsArray, ...args: any[]) => - s.map((ss, i) => `${ss}${args[i] || ''}`).join(''); diff --git a/packages/backend-common/src/index.ts b/packages/backend-common/src/index.ts index 4b9518c6bc..a3f57ed9df 100644 --- a/packages/backend-common/src/index.ts +++ b/packages/backend-common/src/index.ts @@ -20,4 +20,3 @@ export * from './logging'; export * from './middleware'; export * from './service'; export * from './hot'; -export * from './gql'; From 56d93dcb52105642d0398491331d79f6a8898710 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 14 Aug 2020 13:57:40 +0200 Subject: [PATCH 32/80] chore(gql/catalog): types as ts --- plugins/catalog-graphql/codegen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-graphql/codegen.yml b/plugins/catalog-graphql/codegen.yml index 4a5795eb9e..e100277942 100644 --- a/plugins/catalog-graphql/codegen.yml +++ b/plugins/catalog-graphql/codegen.yml @@ -1,6 +1,6 @@ overwrite: true generates: - ./src/graphql/types.d.ts: + ./src/graphql/types.ts: schema: ./src/schema.js plugins: - typescript From a09e949b6f9ff9d8efee1a24b37d7a7fc1a29af5 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 14 Aug 2020 14:00:39 +0200 Subject: [PATCH 33/80] chore(gql/catalog): fixing dependencies --- plugins/catalog-graphql/package.json | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 83e88e1d25..79277bdc2b 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -6,7 +6,7 @@ "license": "Apache-2.0", "publishConfig": { "access": "public", - "main": "dist/index.esm.js", + "main": "dist/index.cjs.js", "types": "dist/index.d.ts" }, "scripts": { @@ -20,26 +20,25 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.18", "@backstage/catalog-model": "^0.1.1-alpha.18", + "@backstage/backend-common": "^0.1.1-alpha.18", "@backstage/config": "^0.1.1-alpha.18", - "@graphql-codegen/cli": "^1.17.7", - "@graphql-codegen/typescript": "^1.17.7", - "@graphql-codegen/typescript-resolvers": "^1.17.7", "@graphql-modules/core": "^0.7.17", "apollo-server": "^2.16.1", "graphql": "^15.3.0", "graphql-tag": "^2.11.0", "graphql-type-json": "^0.3.2", "node-fetch": "^2.6.0", - "ts-node": "^8.10.2", - "winston": "^3.2.1", - "yn": "^4.0.0" + "winston": "^3.2.1" }, "devDependencies": { "@backstage/cli": "^0.1.1-alpha.18", "@types/express": "^4.17.7", "@types/supertest": "^2.0.8", + "@graphql-codegen/cli": "^1.17.7", + "@graphql-codegen/typescript": "^1.17.7", + "@graphql-codegen/typescript-resolvers": "^1.17.7", + "ts-node": "^8.10.2", "eslint-plugin-graphql": "^4.0.0", "msw": "^0.19.5", "supertest": "^4.0.2" From 9b3236f47edba427ca35a3cef48586bdf0467694 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 14 Aug 2020 14:37:17 +0200 Subject: [PATCH 34/80] chore(gql/catalog): fixing some code review comments --- plugins/catalog-graphql/package.json | 3 +- plugins/graphql/package.json | 4 +- plugins/graphql/src/service/router.ts | 17 ++++--- yarn.lock | 71 --------------------------- 4 files changed, 13 insertions(+), 82 deletions(-) diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 79277bdc2b..5531c23ade 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -44,7 +44,6 @@ "supertest": "^4.0.2" }, "files": [ - "dist", - "schema.gql" + "dist" ] } diff --git a/plugins/graphql/package.json b/plugins/graphql/package.json index 6f8ff50c1a..35aac33451 100644 --- a/plugins/graphql/package.json +++ b/plugins/graphql/package.json @@ -24,8 +24,8 @@ "@backstage/plugin-catalog-graphql": "^0.1.1-alpha.18", "@graphql-modules/core": "^0.7.17", "@types/express": "^4.17.6", - "apollo-server": "^2.16.0", - "apollo-server-express": "^2.16.0", + "apollo-server": "^2.16.1", + "apollo-server-express": "^2.16.1", "express": "^4.17.1", "express-promise-router": "^3.0.3", "graphql": "^15.3.0", diff --git a/plugins/graphql/src/service/router.ts b/plugins/graphql/src/service/router.ts index cd926da3a2..a06f696533 100644 --- a/plugins/graphql/src/service/router.ts +++ b/plugins/graphql/src/service/router.ts @@ -51,19 +51,22 @@ export async function createRouter( const server = new ApolloServer({ schema, logger: options.logger, + introspection: true, + playground: process.env.NODE_ENV === 'development', }); const router = Router(); const apolloMiddlware = server.getMiddleware({ path: '/' }); - router.use( - helmet.contentSecurityPolicy({ - directives: { - defaultSrc: ["'self'", "'unsafe-inline'", 'http://*'], - }, - }), - ); + if (process.env.NODE_ENV === 'development') + router.use( + helmet.contentSecurityPolicy({ + directives: { + defaultSrc: ["'self'", "'unsafe-inline'", 'http://*'], + }, + }), + ); router.use(apolloMiddlware); diff --git a/yarn.lock b/yarn.lock index dec603d9db..e15dd3bed6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4703,16 +4703,6 @@ "@types/qs" "*" "@types/serve-static" "*" -"@types/express@4.17.4": - version "4.17.4" - resolved "https://registry.npmjs.org/@types/express/-/express-4.17.4.tgz#e78bf09f3f530889575f4da8a94cd45384520aac" - integrity sha512-DO1L53rGqIDUEvOjJKmbMEQ5Z+BM2cIEPy/eV3En+s166Gz+FeuzRerxcab757u/U4v4XF4RYrZPmqKa+aY/2w== - dependencies: - "@types/body-parser" "*" - "@types/express-serve-static-core" "*" - "@types/qs" "*" - "@types/serve-static" "*" - "@types/fs-capacitor@*": version "2.0.0" resolved "https://registry.npmjs.org/@types/fs-capacitor/-/fs-capacitor-2.0.0.tgz#17113e25817f584f58100fb7a08eed288b81956e" @@ -6091,34 +6081,6 @@ apollo-server-caching@^0.5.2: dependencies: lru-cache "^5.0.0" -apollo-server-core@^2.16.0: - version "2.16.0" - resolved "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.16.0.tgz#56b367db49f97b7da03b29cef89b63d9ed14ee0c" - integrity sha512-mnvg2cPvsQtjFXIqIhEAbPqGyiSXDSbiBgNQ8rY8g7r2eRMhHKZePqGF03gP1/w87yVaSDRAZBDk6o+jiBXjVQ== - dependencies: - "@apollographql/apollo-tools" "^0.4.3" - "@apollographql/graphql-playground-html" "1.6.26" - "@types/graphql-upload" "^8.0.0" - "@types/ws" "^7.0.0" - apollo-cache-control "^0.11.1" - apollo-datasource "^0.7.2" - apollo-engine-reporting "^2.3.0" - apollo-server-caching "^0.5.2" - apollo-server-env "^2.4.5" - apollo-server-errors "^2.4.2" - apollo-server-plugin-base "^0.9.1" - apollo-server-types "^0.5.1" - apollo-tracing "^0.11.1" - fast-json-stable-stringify "^2.0.0" - graphql-extensions "^0.12.4" - graphql-tag "^2.9.2" - graphql-tools "^4.0.0" - graphql-upload "^8.0.2" - loglevel "^1.6.7" - sha.js "^2.4.11" - subscriptions-transport-ws "^0.9.11" - ws "^6.0.0" - apollo-server-core@^2.16.1: version "2.16.1" resolved "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.16.1.tgz#5b5b8245ab9c0cb6c2367ec19ab855dea6ccea3a" @@ -6160,28 +6122,6 @@ apollo-server-errors@^2.4.2: resolved "https://registry.npmjs.org/apollo-server-errors/-/apollo-server-errors-2.4.2.tgz#1128738a1d14da989f58420896d70524784eabe5" integrity sha512-FeGxW3Batn6sUtX3OVVUm7o56EgjxDlmgpTLNyWcLb0j6P8mw9oLNyAm3B+deHA4KNdNHO5BmHS2g1SJYjqPCQ== -apollo-server-express@^2.16.0: - version "2.16.0" - resolved "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.16.0.tgz#3474a7f7eb868a2a847a364839147f8d7f26454a" - integrity sha512-mBIvKcF8gApj7wbmqe0A4Tsy+Pw66mI6cmtD912bG59KhUBveSCZ21dDlRSvnXUyK+GOo2ItwcUEtmks+Z2Pqw== - dependencies: - "@apollographql/graphql-playground-html" "1.6.26" - "@types/accepts" "^1.3.5" - "@types/body-parser" "1.19.0" - "@types/cors" "^2.8.4" - "@types/express" "4.17.4" - accepts "^1.3.5" - apollo-server-core "^2.16.0" - apollo-server-types "^0.5.1" - body-parser "^1.18.3" - cors "^2.8.4" - express "^4.17.1" - graphql-subscriptions "^1.0.0" - graphql-tools "^4.0.0" - parseurl "^1.3.2" - subscriptions-transport-ws "^0.9.16" - type-is "^1.6.16" - apollo-server-express@^2.16.1: version "2.16.1" resolved "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.16.1.tgz#7438bca590ef8577d24d20ba0b6d582c120c0146" @@ -6220,17 +6160,6 @@ apollo-server-types@^0.5.1: apollo-server-caching "^0.5.2" apollo-server-env "^2.4.5" -apollo-server@^2.16.0: - version "2.16.0" - resolved "https://registry.npmjs.org/apollo-server/-/apollo-server-2.16.0.tgz#fa30e29b78e8cb70b2c81d0f7b96953beb3d4baf" - integrity sha512-zbEe0FSqatqE6bmIfq/o1/Hsqc596ZOwZM/L8Ttwa4ucQ1ybqf1ZejSYu6ehFEj1G6rOBY1ttVKkIllcErK4GQ== - dependencies: - apollo-server-core "^2.16.0" - apollo-server-express "^2.16.0" - express "^4.0.0" - graphql-subscriptions "^1.0.0" - graphql-tools "^4.0.0" - apollo-server@^2.16.1: version "2.16.1" resolved "https://registry.npmjs.org/apollo-server/-/apollo-server-2.16.1.tgz#edc319606eb29f73132239bdc005dd88ac40a142" From e4d5628cf4fded262ab1e94860ae98f54e46d0ca Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 14 Aug 2020 14:50:01 +0200 Subject: [PATCH 35/80] docs(catalog/grqphql): updating docs --- plugins/catalog-graphql/README.md | 14 ++++++-------- plugins/graphql/README.md | 6 +++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/plugins/catalog-graphql/README.md b/plugins/catalog-graphql/README.md index 3f85ec766e..cec3204c52 100644 --- a/plugins/catalog-graphql/README.md +++ b/plugins/catalog-graphql/README.md @@ -1,13 +1,11 @@ -# graphql +# Catalog GraphQL Plugin -Welcome to the graphql backend plugin! +## Getting Started -_This plugin was created through the Backstage CLI_ +This is the Catalog GraphQL plugin. -## Getting started +It provides the `catalog` part of the GraphQL schema. -Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/graphql](http://localhost:3000/graphql). +To register it with the GraphQL backend, be sure to follow the [Gettting Started](../graphql/README.md#getting-started) guide of the GraphQL plugin. -You can also serve the plugin in isolation by running `yarn start` in the plugin directory. -This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. -It is only meant for local development, and the setup for it can be found inside the [/dev](/dev) directory. +