Skip to content

Commit b3d09d6

Browse files
committed
fix: upgrade to graphql@^15.0.0
1 parent 32c75aa commit b3d09d6

12 files changed

+161
-178
lines changed

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -633,13 +633,10 @@ const {loading, error, data} = useQuery<QueryData, QueryVariables>(query, {
633633
Annotates this way:
634634
635635
```js
636-
const {
637-
loading,
638-
error,
639-
data,
640-
}: QueryRenderProps<QueryData, QueryVariables> = useQuery(query, {
641-
variables: ({ id }: QueryVariables),
642-
})
636+
const { loading, error, data }: QueryRenderProps<QueryData, QueryVariables> =
637+
useQuery(query, {
638+
variables: ({ id }: QueryVariables),
639+
})
643640
```
644641
645642
## `external as <type annotation or import statement>`

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"@types/chai-as-promised": "^7.1.2",
100100
"@types/fs-extra": "^8.0.1",
101101
"@types/graphql": "^14.5.0",
102-
"@types/jscodeshift": "^0.6.3",
102+
"@types/jscodeshift": "^0.7.1",
103103
"@types/lodash": "^4.14.149",
104104
"@types/mocha": "^9.0.0",
105105
"@types/node": "^16.10.2",
@@ -108,6 +108,7 @@
108108
"@typescript-eslint/eslint-plugin": "^4.32.0",
109109
"@typescript-eslint/parser": "^4.32.0",
110110
"@typescript-eslint/typescript-estree": "^4.32.0",
111+
"ast-types": "^0.12.1",
111112
"babel-eslint": "^10.0.1",
112113
"babel-plugin-istanbul": "^6.0.0",
113114
"chai": "^4.3.4",
@@ -134,7 +135,7 @@
134135
"dependencies": {
135136
"@babel/runtime": "^7.15.4",
136137
"fs-extra": "^8.1.0",
137-
"graphql": "^14.6.0",
138+
"graphql": "^15.0.0",
138139
"graphql-tag": "^2.10.1",
139140
"jscodeshift-add-imports": "^1.0.3",
140141
"jscodeshift-choose-parser": "^1.0.0",

pnpm-lock.yaml

Lines changed: 15 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/internal/analyzeSchema.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as graphql from 'graphql'
55
import superagent from 'superagent'
66
import getConfigDirectives, { ConfigDirectives } from './getConfigDirectives'
77
import { execFileSync } from 'child_process'
8-
import { getIntrospectionQuery } from 'graphql/utilities/introspectionQuery'
8+
import { getIntrospectionQuery } from 'graphql'
99
import * as fs from 'fs'
1010
import * as path from 'path'
1111

@@ -198,10 +198,10 @@ function analyzeTypes(
198198
enumValues,
199199
config: getDescriptionDirectives(type),
200200
interfaces: interfaces
201-
? interfaces.map(iface => convertIntrospectionType(iface))
201+
? interfaces.map((iface) => convertIntrospectionType(iface))
202202
: null,
203203
possibleTypes: possibleTypes
204-
? possibleTypes.map(type => convertIntrospectionType(type))
204+
? possibleTypes.map((type) => convertIntrospectionType(type))
205205
: null,
206206
}
207207
}
@@ -232,10 +232,10 @@ function analyzeTypes(
232232
const type = types[name]
233233
const { fields, inputFields, interfaces, possibleTypes } = type
234234
if (interfaces) {
235-
type.interfaces = interfaces.map(type => resolveType(type))
235+
type.interfaces = interfaces.map((type) => resolveType(type))
236236
}
237237
if (possibleTypes) {
238-
type.possibleTypes = possibleTypes.map(type => resolveType(type))
238+
type.possibleTypes = possibleTypes.map((type) => resolveType(type))
239239
}
240240
if (fields) {
241241
for (const name in fields) {
@@ -281,13 +281,9 @@ export async function getIntrospectionData({
281281
if (schema) introspection = await graphql.execute(schema, introspectionQuery)
282282
else if (server) {
283283
introspection = (
284-
await superagent
285-
.post(server)
286-
.type('json')
287-
.accept('json')
288-
.send({
289-
query: introspectionQuery,
290-
})
284+
await superagent.post(server).type('json').accept('json').send({
285+
query: introspectionQuery,
286+
})
291287
).body
292288
} else {
293289
throw new Error('schemaFile or server must be configured')

src/internal/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ export function applyConfigDefaults(config: Config): DefaultedConfig {
109109
}
110110

111111
for (const key in config) {
112-
if (config.hasOwnProperty(key) && !result.hasOwnProperty(key)) {
112+
if (
113+
Object.prototype.hasOwnProperty.call(config, key) &&
114+
!Object.prototype.hasOwnProperty.call(result, key)
115+
) {
113116
throw new Error(`invalid config option: ${key}`)
114117
}
115118
}

0 commit comments

Comments
 (0)