diff --git a/package-lock.json b/package-lock.json index 06837b485..c84ce94ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "command-line-args": "^5.2.1", "command-line-usage": "^7.0.1", "cross-fetch": "^4.0.0", - "graphql": "^0.11.7", + "graphql": "^16.11.0", "lodash": "^4.17.21", "moment": "^2.30.1", "quicktype-core": "20.0.12", @@ -40,7 +40,6 @@ "@tsconfig/node18": "^1.0.1", "@types/command-line-args": "^5.2.0", "@types/command-line-usage": "^5.0.4", - "@types/graphql": "^0.11.7", "@types/lodash": "^4.17.0", "@types/semver": "^7.5.0", "@types/shelljs": "^0.8.15", @@ -652,11 +651,6 @@ "@types/node": "*" } }, - "node_modules/@types/graphql": { - "version": "0.11.8", - "dev": true, - "license": "MIT" - }, "node_modules/@types/is-url": { "version": "1.2.32", "resolved": "https://registry.npmjs.org/@types/is-url/-/is-url-1.2.32.tgz", @@ -2924,10 +2918,12 @@ "license": "MIT" }, "node_modules/graphql": { - "version": "0.11.7", + "version": "16.11.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.11.0.tgz", + "integrity": "sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==", "license": "MIT", - "dependencies": { - "iterall": "1.1.3" + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } }, "node_modules/has": { @@ -3532,6 +3528,8 @@ }, "node_modules/iterall": { "version": "1.1.3", + "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.1.3.tgz", + "integrity": "sha512-Cu/kb+4HiNSejAPhSaN1VukdNTTi/r4/e+yykqjlG/IW+1gZH5b4+Bq3whDX4tvbYugta3r8KTMUiqT3fIGxuQ==", "license": "MIT" }, "node_modules/jackspeak": { @@ -5946,15 +5944,24 @@ "license": "Apache-2.0", "dependencies": { "collection-utils": "^1.0.1", - "graphql": "^0.11.7", + "graphql": "^16.11.0", "quicktype-core": "file:../quicktype-core" }, "devDependencies": { - "@types/graphql": "^0.11.7", "@types/node": "~22.14.0", "typescript": "~5.8.3" } }, + "packages/quicktype-graphql-input/node_modules/graphql": { + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-0.11.7.tgz", + "integrity": "sha512-x7uDjyz8Jx+QPbpCFCMQ8lltnQa4p4vSYHx6ADe8rVYRTdsyhCJbvSty5DAsLVmU6cGakl+r8HQYolKHxk/tiw==", + "deprecated": "No longer supported; please update to a newer version. Details: https://github.com/graphql/graphql-js#version-support", + "license": "MIT", + "dependencies": { + "iterall": "1.1.3" + } + }, "packages/quicktype-typescript-input": { "version": "18.0.15", "license": "Apache-2.0", diff --git a/package.json b/package.json index fb19d8882..35d88d65f 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "command-line-args": "^5.2.1", "command-line-usage": "^7.0.1", "cross-fetch": "^4.0.0", - "graphql": "^0.11.7", + "graphql": "^16.11.0", "lodash": "^4.17.21", "moment": "^2.30.1", "quicktype-core": "20.0.12", @@ -47,7 +47,6 @@ "@tsconfig/node18": "^1.0.1", "@types/command-line-args": "^5.2.0", "@types/command-line-usage": "^5.0.4", - "@types/graphql": "^0.11.7", "@types/lodash": "^4.17.0", "@types/semver": "^7.5.0", "@types/shelljs": "^0.8.15", @@ -73,6 +72,8 @@ } } }, - "files": ["dist"], + "files": [ + "dist" + ], "bin": "dist/index.js" } diff --git a/packages/quicktype-graphql-input/package.json b/packages/quicktype-graphql-input/package.json index 6a95cf3dd..9da4b2c76 100644 --- a/packages/quicktype-graphql-input/package.json +++ b/packages/quicktype-graphql-input/package.json @@ -13,11 +13,10 @@ "dependencies": { "quicktype-core": "file:../quicktype-core", "collection-utils": "^1.0.1", - "graphql": "^0.11.7" + "graphql": "^16.11.0" }, "devDependencies": { "@types/node": "~22.14.0", - "@types/graphql": "^0.11.7", "typescript": "~5.8.3" }, "files": ["dist"] diff --git a/packages/quicktype-graphql-input/src/index.ts b/packages/quicktype-graphql-input/src/index.ts index 7bce8160c..e069135b4 100644 --- a/packages/quicktype-graphql-input/src/index.ts +++ b/packages/quicktype-graphql-input/src/index.ts @@ -1,4 +1,5 @@ import { iterableFirst, mapFromObject, setMap } from "collection-utils"; +import { Kind } from "graphql"; import * as graphql from "graphql/language"; import type { DirectiveNode, @@ -159,7 +160,7 @@ function makeScalar(builder: TypeBuilder, ft: GQLType): TypeRef { } } -function hasOptionalDirectives(directives?: DirectiveNode[]): boolean { +function hasOptionalDirectives(directives?: readonly DirectiveNode[]): boolean { if (!directives) return false; for (const d of directives) { const name = d.name.value; @@ -180,7 +181,7 @@ function expandSelectionSet( inType: GQLType, optional: boolean, ): Selection[] { - return selectionSet.selections + return [...selectionSet.selections] .reverse() .map((s) => ({ selection: s, @@ -366,7 +367,7 @@ class GQLQuery { if (!nextItem) break; const { selection, optional, inType } = nextItem; switch (selection.kind) { - case "Field": + case Kind.FIELD: const fieldName = selection.name.value; const givenName = selection.alias ? selection.alias.value @@ -383,7 +384,7 @@ class GQLQuery { builder.makeClassProperty(fieldType, optional), ); break; - case "FragmentSpread": { + case Kind.FRAGMENT_SPREAD: { const fragment = this.getFragment(selection.name.value); const fragmentType = this._schema.types[fragment.typeCondition.name.value]; @@ -398,7 +399,7 @@ class GQLQuery { break; } - case "InlineFragment": { + case Kind.INLINE_FRAGMENT: { // FIXME: support type conditions with discriminated unions const fragmentType = selection.typeCondition ? this._schema.types[selection.typeCondition.name.value] diff --git a/src/GraphQLIntrospection.ts b/src/GraphQLIntrospection.ts index db2093a0a..b30c77938 100644 --- a/src/GraphQLIntrospection.ts +++ b/src/GraphQLIntrospection.ts @@ -1,6 +1,6 @@ import { exceptionToString } from "@glideapps/ts-necessities"; import fetch from "cross-fetch"; -import { introspectionQuery } from "graphql"; +import { getIntrospectionQuery } from "graphql"; import { panic } from "quicktype-core"; @@ -37,7 +37,7 @@ export async function introspectServer( const response = await fetch(url, { method, headers: headers, - body: JSON.stringify({ query: introspectionQuery }), + body: JSON.stringify({ query: getIntrospectionQuery() }), }); result = await response.json();