Skip to content

Commit

Permalink
fix(cli): support ApolloEngine loader in TypeScript config (#8368)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlypoly committed Sep 20, 2022
1 parent e6e497a commit 4113b1b
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 60 deletions.
6 changes: 6 additions & 0 deletions .changeset/six-readers-hunt.md
@@ -0,0 +1,6 @@
---
"@graphql-codegen/cli": patch
"@graphql-codegen/plugin-helpers": patch
---

fix(cli): support ApolloEngine loader in TypeScript config
7 changes: 6 additions & 1 deletion packages/graphql-codegen-cli/src/codegen.ts
Expand Up @@ -166,7 +166,12 @@ export async function executeCodegen(input: CodegenContext | Types.Config): Prom

if (
rootSchemas.length === 0 &&
Object.keys(generates).some(filename => !generates[filename].schema || generates[filename].schema.length === 0)
Object.keys(generates).some(
filename =>
!generates[filename].schema ||
(Array.isArray(generates[filename].schema === 'object') &&
(generates[filename].schema as unknown as any[]).length === 0)
)
) {
throw new DetailedError(
'Invalid Codegen Configuration!',
Expand Down
5 changes: 4 additions & 1 deletion packages/utils/plugins-helpers/package.json
Expand Up @@ -50,5 +50,8 @@
"directory": "dist",
"access": "public"
},
"type": "module"
"type": "module",
"devDependencies": {
"@graphql-tools/apollo-engine-loader": "^7.3.13"
}
}
6 changes: 6 additions & 0 deletions packages/utils/plugins-helpers/src/types.ts
@@ -1,6 +1,7 @@
import { GraphQLSchema, DocumentNode } from 'graphql';
import { Source } from '@graphql-tools/utils';
import type { Profiler } from './profiler.js';
import type { ApolloEngineOptions } from '@graphql-tools/apollo-engine-loader';

export namespace Types {
export interface GenerateOptions {
Expand Down Expand Up @@ -177,13 +178,18 @@ export namespace Types {
[globPath: string]: LocalSchemaPathOptions;
}

export interface ApolloEngineSchemaOptions {
'apollo-engine': ApolloEngineOptions;
}

export type SchemaGlobPath = string;
/**
* @description A URL to your GraphQL endpoint, a local path to `.graphql` file, a glob pattern to your GraphQL schema files, or a JavaScript file that exports the schema to generate code from. This can also be an array which specifies multiple schemas to generate code from. You can read more about the supported formats [here](schema-field#available-formats).
*/
export type Schema =
| string
| UrlSchemaWithOptions
| ApolloEngineSchemaOptions
| LocalSchemaPathWithOptions
| SchemaGlobPath
| SchemaWithLoader
Expand Down
83 changes: 25 additions & 58 deletions yarn.lock
Expand Up @@ -1711,14 +1711,14 @@
parse-filepath "^1.0.2"
tslib "~2.4.0"

"@graphql-tools/apollo-engine-loader@^7.3.6":
version "7.3.6"
resolved "https://registry.yarnpkg.com/@graphql-tools/apollo-engine-loader/-/apollo-engine-loader-7.3.6.tgz#a2bd7cbae69975bb8ccd33e7ca4c6a705671dc30"
integrity sha512-r7YU1X9Ce/sr+tPzSuZqVqlK7knGDpiRfB9HB2uVmbm+kPrlISQ0LuamFoT1g1nkfDZUNZn2p18ag512P1aVVw==
"@graphql-tools/apollo-engine-loader@^7.3.13", "@graphql-tools/apollo-engine-loader@^7.3.6":
version "7.3.13"
resolved "https://registry.yarnpkg.com/@graphql-tools/apollo-engine-loader/-/apollo-engine-loader-7.3.13.tgz#090bf03a99a5aaf8580826125346cb7441b54d94"
integrity sha512-fr2TcA9fM+H81ymdtyDaocZ/Ua4Vhhf1IvpQoPpuEUwLorREd86N8VORUEIBvEdJ1b7Bz7NqwL3RnM5m9KXftA==
dependencies:
"@ardatan/sync-fetch" "0.0.1"
"@graphql-tools/utils" "8.9.0"
"@whatwg-node/fetch" "^0.2.4"
"@graphql-tools/utils" "8.12.0"
"@whatwg-node/fetch" "^0.4.0"
tslib "^2.4.0"

"@graphql-tools/batch-execute@8.5.1":
Expand Down Expand Up @@ -1985,13 +1985,20 @@
dependencies:
tslib "~2.3.0"

"@graphql-tools/utils@8.11.0", "@graphql-tools/utils@^8.6.5", "@graphql-tools/utils@^8.8.0", "@graphql-tools/utils@^8.9.0":
"@graphql-tools/utils@8.11.0":
version "8.11.0"
resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.11.0.tgz#764ebf9b371b5f5cb66228267c68bea996cc8c03"
integrity sha512-4lkc+F/hsQTjNnnfFh7lzrhRmRm1y2ARfKA6RD5FbTJO58JadirNbkY5u4lsVEPBZHiivHqAiQ/pIBhGMyEMcQ==
dependencies:
tslib "^2.4.0"

"@graphql-tools/utils@8.12.0", "@graphql-tools/utils@^8.6.5", "@graphql-tools/utils@^8.8.0", "@graphql-tools/utils@^8.9.0":
version "8.12.0"
resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.12.0.tgz#243bc4f5fc2edbc9e8fd1038189e57d837cbe31f"
integrity sha512-TeO+MJWGXjUTS52qfK4R8HiPoF/R7X+qmgtOYd8DTH0l6b+5Y/tlg5aGeUJefqImRq7nvi93Ms40k/Uz4D5CWw==
dependencies:
tslib "^2.4.0"

"@graphql-tools/utils@8.8.0":
version "8.8.0"
resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.8.0.tgz#8332ff80a1da9204ccf514750dd6f5c5cccf17dc"
Expand Down Expand Up @@ -3390,7 +3397,7 @@
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138"
integrity sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==

"@types/json-schema@7.0.9", "@types/json-schema@^7.0.9":
"@types/json-schema@^7.0.9":
version "7.0.9"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d"
integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==
Expand Down Expand Up @@ -3471,16 +3478,16 @@
resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197"
integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==

"@types/node@*", "@types/node@16.11.58", "@types/node@^16.9.2":
version "16.11.58"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.58.tgz#0a3698dee3492617a8d5fe7998d18d7520b63026"
integrity sha512-uMVxJ111wpHzkx/vshZFb6Qni3BOMnlWLq7q9jrwej7Yw/KvjsEbpxCCxw+hLKxexFMc8YmpG8J9tnEe/rKsIg==

"@types/node@18.6.2":
"@types/node@*", "@types/node@18.6.2":
version "18.6.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.6.2.tgz#ffc5f0f099d27887c8d9067b54e55090fcd54126"
integrity sha512-KcfkBq9H4PI6Vpu5B/KoPeuVDAbmi+2mDBqGPGUgoL7yXQtcWGu2vJWmmRkneWK3Rh0nIAX192Aa87AqKHYChQ==

"@types/node@16.11.58", "@types/node@^16.9.2":
version "16.11.58"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.58.tgz#0a3698dee3492617a8d5fe7998d18d7520b63026"
integrity sha512-uMVxJ111wpHzkx/vshZFb6Qni3BOMnlWLq7q9jrwej7Yw/KvjsEbpxCCxw+hLKxexFMc8YmpG8J9tnEe/rKsIg==

"@types/node@^10.1.0":
version "10.17.60"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b"
Expand Down Expand Up @@ -7530,7 +7537,7 @@ graphlib@^2.1.8:
dependencies:
lodash "^4.17.15"

graphql-config@^4.1.0, graphql-config@^4.3.5:
graphql-config@^4.3.5:
version "4.3.5"
resolved "https://registry.yarnpkg.com/graphql-config/-/graphql-config-4.3.5.tgz#bd197ec9c1e86d2696c61332be35b920ba7be700"
integrity sha512-B4jXhHL7j3llCem+ACeo48wvVYhtJxRyt5SfSnvywbRlVYyUzt5ibZV6WJU2Yii2/rcVRIGi7BHDgcAPWdWdJg==
Expand Down Expand Up @@ -7567,41 +7574,6 @@ graphql-jit@0.7.4:
lodash.merge "4.6.2"
lodash.mergewith "4.6.2"

graphql-language-service-interface@2.10.2:
version "2.10.2"
resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-2.10.2.tgz#de9386f699e446320256175e215cdc10ccf9f9b7"
integrity sha512-RKIEBPhRMWdXY3fxRs99XysTDnEgAvNbu8ov/5iOlnkZsWQNzitjtd0O0l1CutQOQt3iXoHde7w8uhCnKL4tcg==
dependencies:
graphql-config "^4.1.0"
graphql-language-service-parser "^1.10.4"
graphql-language-service-types "^1.8.7"
graphql-language-service-utils "^2.7.1"
vscode-languageserver-types "^3.15.1"

graphql-language-service-parser@^1.10.4:
version "1.10.4"
resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-1.10.4.tgz#b2979deefc5c0df571dacd409b2d5fbf1cdf7a9d"
integrity sha512-duDE+0aeKLFVrb9Kf28U84ZEHhHcvTjWIT6dJbIAQJWBaDoht0D4BK9EIhd94I3DtKRc1JCJb2+70y1lvP/hiA==
dependencies:
graphql-language-service-types "^1.8.7"

graphql-language-service-types@^1.8.7:
version "1.8.7"
resolved "https://registry.yarnpkg.com/graphql-language-service-types/-/graphql-language-service-types-1.8.7.tgz#f5e909e6d9334ea2d8d1f7281b695b6f5602c07f"
integrity sha512-LP/Mx0nFBshYEyD0Ny6EVGfacJAGVx+qXtlJP4hLzUdBNOGimfDNtMVIdZANBXHXcM41MDgMHTnyEx2g6/Ttbw==
dependencies:
graphql-config "^4.1.0"
vscode-languageserver-types "^3.15.1"

graphql-language-service-utils@^2.7.1:
version "2.7.1"
resolved "https://registry.yarnpkg.com/graphql-language-service-utils/-/graphql-language-service-utils-2.7.1.tgz#c97c8d744a761480aba7e03e4a42adf28b6fce39"
integrity sha512-Wci5MbrQj+6d7rfvbORrA9uDlfMysBWYaG49ST5TKylNaXYFf3ixFOa74iM1KtM9eidosUbI3E1JlWi0JaidJA==
dependencies:
"@types/json-schema" "7.0.9"
graphql-language-service-types "^1.8.7"
nullthrows "^1.0.0"

graphql-request@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-5.0.0.tgz#7504a807d0e11be11a3c448e900f0cc316aa18ef"
Expand Down Expand Up @@ -7640,7 +7612,7 @@ graphql-ws@^5.4.1:
resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.9.1.tgz#9c0fa48ceb695d61d574ed3ab21b426729e87f2d"
integrity sha512-mL/SWGBwIT9Meq0NlfS55yXXTOeWPMbK7bZBEZhFu46bcGk1coTx2Sdtzxdk+9yHWngD+Fk1PZDWaAutQa9tpw==

graphql@16.6.0, graphql@^16.0.0:
graphql@16.6.0:
version "16.6.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.6.0.tgz#c2dcffa4649db149f6282af726c8c83f1c7c5fdb"
integrity sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==
Expand Down Expand Up @@ -8582,7 +8554,7 @@ jest-resolve@^28.1.3:
resolve.exports "^1.1.0"
slash "^3.0.0"

jest-runner@28.1.3, jest-runner@^28.1.3:
jest-runner@^28.1.3:
version "28.1.3"
resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-28.1.3.tgz#5eee25febd730b4713a2cdfd76bdd5557840f9a1"
integrity sha512-GkMw4D/0USd62OVO0oEgjn23TM+YJa2U2Wu5zz9xsQB1MxWKDOlrnykPxnMsN0tnJllfLPinHTka61u0QhaxBA==
Expand Down Expand Up @@ -10241,7 +10213,7 @@ nth-check@^2.0.1:
dependencies:
boolbase "^1.0.0"

nullthrows@^1.0.0, nullthrows@^1.1.1:
nullthrows@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1"
integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==
Expand Down Expand Up @@ -13073,11 +13045,6 @@ vfile@^5.0.0, vfile@^5.3.0:
unist-util-stringify-position "^3.0.0"
vfile-message "^3.0.0"

vscode-languageserver-types@^3.15.1:
version "3.17.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz#b2c2e7de405ad3d73a883e91989b850170ffc4f2"
integrity sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==

vscode-oniguruma@^1.6.1:
version "1.6.2"
resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz#aeb9771a2f1dbfc9083c8a7fdd9cccaa3f386607"
Expand Down

0 comments on commit 4113b1b

Please sign in to comment.