Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -73,6 +72,8 @@
}
}
},
"files": ["dist"],
"files": [
"dist"
],
"bin": "dist/index.js"
}
3 changes: 1 addition & 2 deletions packages/quicktype-graphql-input/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
11 changes: 6 additions & 5 deletions packages/quicktype-graphql-input/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { iterableFirst, mapFromObject, setMap } from "collection-utils";
import { Kind } from "graphql";
import * as graphql from "graphql/language";
import type {
DirectiveNode,
Expand Down Expand Up @@ -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;
Expand All @@ -180,7 +181,7 @@ function expandSelectionSet(
inType: GQLType,
optional: boolean,
): Selection[] {
return selectionSet.selections
return [...selectionSet.selections]
.reverse()
.map((s) => ({
selection: s,
Expand Down Expand Up @@ -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
Expand All @@ -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];
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/GraphQLIntrospection.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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();
Expand Down