Skip to content

Commit c8750f3

Browse files
n1ru4ldotansimha
andauthored
Support for graphql-js v16 (contra#84)
Co-authored-by: Dotan Simha <[email protected]>
1 parent adba6db commit c8750f3

29 files changed

+1338
-1260
lines changed

.changeset/silver-taxis-complain.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"graphql-helix": minor
3+
---
4+
5+
Added support for GraphQL v16

.changeset/wet-rules-approve.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"graphql-helix": patch
3+
---
4+
5+
fix broken multi part response and SSE response fetching in GraphiQL

.github/workflows/benchmark.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Benchmark
22
on:
3-
pull_request:
3+
push:
44
branches:
55
- master
6+
pull_request: {}
67

78
jobs:
89
bench:

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: GraphQL Helix
1+
name: Tests
22
on:
3-
pull_request:
3+
push:
44
branches:
55
- master
6+
pull_request: {}
67

78
jobs:
89
build:

examples/context/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
"@types/express": "4.17.13",
1010
"@types/express-session": "1.17.4",
1111
"ts-node": "10.2.1",
12-
"typescript": "4.4.3"
12+
"typescript": "4.4.4"
1313
},
1414
"dependencies": {
1515
"express": "4.17.1",
1616
"express-session": "1.17.2",
17-
"graphql": "15.6.0",
17+
"graphql": "16.0.0-experimental-stream-defer.5",
1818
"graphql-helix": "^1.8.4"
1919
}
2020
}

examples/csp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
"@types/express": "4.17.13",
1010
"@types/helmet": "4.0.0",
1111
"ts-node": "10.2.1",
12-
"typescript": "4.4.3"
12+
"typescript": "4.4.4"
1313
},
1414
"dependencies": {
1515
"express": "4.17.1",
16-
"graphql": "15.4.0-experimental-stream-defer.1",
1716
"graphql-helix": "^1.8.4",
17+
"graphql": "16.0.0-experimental-stream-defer.5",
1818
"helmet": "4.6.0"
1919
}
2020
}

examples/error-handling/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
"devDependencies": {
99
"@types/express": "4.17.13",
1010
"ts-node": "10.2.1",
11-
"typescript": "4.4.3"
11+
"typescript": "4.4.4"
1212
},
1313
"dependencies": {
1414
"express": "4.17.1",
15-
"graphql": "15.4.0-experimental-stream-defer.1",
16-
"graphql-helix": "^1.8.4"
15+
"graphql-helix": "^1.8.4",
16+
"graphql": "16.0.0-experimental-stream-defer.5"
1717
}
1818
}

examples/express/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
"devDependencies": {
99
"@types/express": "4.17.13",
1010
"ts-node": "10.2.1",
11-
"typescript": "4.4.3"
11+
"typescript": "4.4.4"
1212
},
1313
"dependencies": {
1414
"express": "4.17.1",
15-
"graphql": "15.4.0-experimental-stream-defer.1",
16-
"graphql-helix": "^1.8.4"
15+
"graphql-helix": "^1.8.4",
16+
"graphql": "16.0.0-experimental-stream-defer.5"
1717
}
1818
}

examples/fastify/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
},
88
"devDependencies": {
99
"ts-node": "10.2.1",
10-
"typescript": "4.4.3"
10+
"typescript": "4.4.4"
1111
},
1212
"dependencies": {
1313
"fastify": "3.21.6",
14-
"graphql": "15.4.0-experimental-stream-defer.1",
15-
"graphql-helix": "^1.8.4"
14+
"graphql-helix": "^1.8.4",
15+
"graphql": "16.0.0-experimental-stream-defer.5"
1616
}
1717
}

examples/file-upload/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
"@types/express": "4.17.13",
1010
"@types/graphql-upload": "8.0.7",
1111
"ts-node": "10.2.1",
12-
"typescript": "4.4.3"
12+
"typescript": "4.4.4"
1313
},
1414
"dependencies": {
1515
"express": "4.17.1",
16-
"graphql": "15.4.0-experimental-stream-defer.1",
1716
"graphql-helix": "^1.8.4",
17+
"graphql": "16.0.0-experimental-stream-defer.5",
1818
"graphql-upload": "^11.0.0"
1919
}
2020
}

examples/graphql-jit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"devDependencies": {
99
"@types/express": "4.17.13",
1010
"ts-node": "10.2.1",
11-
"typescript": "4.4.3"
11+
"typescript": "4.4.4"
1212
},
1313
"dependencies": {
1414
"express": "4.17.1",
15-
"graphql": "15.4.0-experimental-stream-defer.1",
1615
"graphql-helix": "^1.8.4",
16+
"graphql": "16.0.0-experimental-stream-defer.5",
1717
"graphql-jit": "0.5.2",
1818
"tiny-lru": "7.0.6"
1919
}

examples/graphql-modules/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"devDependencies": {
99
"@types/express": "4.17.13",
1010
"ts-node": "10.2.1",
11-
"typescript": "4.4.3"
11+
"typescript": "4.4.4"
1212
},
1313
"dependencies": {
1414
"express": "4.17.1",
15-
"graphql": "15.4.0-experimental-stream-defer.1",
1615
"graphql-helix": "^1.8.4",
16+
"graphql": "16.0.0-experimental-stream-defer.5",
1717
"graphql-modules": "1.4.4"
1818
}
1919
}

examples/graphql-ws/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"devDependencies": {
99
"@types/express": "4.17.13",
1010
"ts-node": "10.2.1",
11-
"typescript": "4.4.3",
11+
"typescript": "4.4.4",
1212
"@types/ws": "7.4.7"
1313
},
1414
"dependencies": {
1515
"express": "4.17.1",
16-
"graphql": "15.4.0-experimental-stream-defer.1",
1716
"graphql-helix": "^1.8.4",
17+
"graphql": "16.0.0-experimental-stream-defer.5",
1818
"graphql-ws": "5.5.0",
1919
"ws": "8.2.2"
2020
}

examples/http/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
},
88
"devDependencies": {
99
"ts-node": "10.2.1",
10-
"typescript": "4.4.3"
10+
"typescript": "4.4.4"
1111
},
1212
"dependencies": {
13-
"graphql": "15.4.0-experimental-stream-defer.1",
14-
"graphql-helix": "^1.8.4"
13+
"graphql-helix": "^1.8.4",
14+
"graphql": "16.0.0-experimental-stream-defer.5"
1515
}
1616
}

examples/koa/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"@types/koa": "2.13.4",
1010
"@types/koa-bodyparser": "4.3.3",
1111
"ts-node": "10.2.1",
12-
"typescript": "4.4.3"
12+
"typescript": "4.4.4"
1313
},
1414
"dependencies": {
15-
"graphql": "15.4.0-experimental-stream-defer.1",
1615
"graphql-helix": "1.8.4",
16+
"graphql": "16.0.0-experimental-stream-defer.5",
1717
"koa": "2.13.1",
1818
"koa-bodyparser": "4.3.0"
1919
}

examples/live-queries/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"devDependencies": {
99
"@types/express": "4.17.13",
1010
"ts-node": "10.2.1",
11-
"typescript": "4.4.3"
11+
"typescript": "4.4.4"
1212
},
1313
"dependencies": {
1414
"@n1ru4l/in-memory-live-query-store": "0.7.1",
1515
"@n1ru4l/graphql-live-query": "0.8.1",
1616
"express": "4.17.1",
17-
"graphql": "15.4.0-experimental-stream-defer.1",
18-
"graphql-helix": "^1.8.4"
17+
"graphql-helix": "^1.8.4",
18+
"graphql": "16.0.0-experimental-stream-defer.5"
1919
}
2020
}

examples/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"start": "next dev"
77
},
88
"dependencies": {
9-
"graphql": "15.4.0-experimental-stream-defer.1",
9+
"graphql": "16.0.0-experimental-stream-defer.5",
1010
"graphql-helix": "^1.7.0",
1111
"next": "11.1.2",
1212
"react": "17.0.2",

examples/persisted-queries/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
"devDependencies": {
99
"@types/express": "4.17.13",
1010
"ts-node": "10.2.1",
11-
"typescript": "4.4.3"
11+
"typescript": "4.4.4"
1212
},
1313
"dependencies": {
1414
"express": "4.17.1",
15-
"graphql": "15.4.0-experimental-stream-defer.1",
16-
"graphql-helix": "^1.8.4"
15+
"graphql-helix": "^1.8.4",
16+
"graphql": "16.0.0-experimental-stream-defer.5"
1717
}
1818
}

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"lint": "eslint --ext .ts,.tsx .",
2222
"update-examples": "node scripts/update-examples",
2323
"loadtest:start-server": "node ./benchmark/server.js",
24-
"web": "yarn workspace @graphql-helix/website dev"
24+
"web": "yarn workspace @graphql-helix/website dev",
25+
"postinstall": "patch-package"
2526
},
2627
"husky": {
2728
"hooks": {
@@ -53,9 +54,10 @@
5354
"husky": "7.0.2",
5455
"lint-staged": "11.1.2",
5556
"prettier": "2.4.1",
57+
"patch-package": "6.4.7",
5658
"wait-on": "6.0.0"
5759
},
5860
"resolutions": {
59-
"graphql": "15.4.0-experimental-stream-defer.1"
61+
"graphql": "16.0.0-experimental-stream-defer.5"
6062
}
6163
}

packages/core/lib/process-request.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,14 @@ export const processRequest = async <TContext = {}, TRootValue = {}>(
133133
rootValue = rootValueFactory ? await rootValueFactory(executionContext) : ({} as TRootValue);
134134

135135
if (operation.operation === "subscription") {
136-
const result = await subscribe(schema, document, rootValue, context, variableValues, operationName);
136+
const result = await subscribe({
137+
schema,
138+
document,
139+
rootValue,
140+
context,
141+
variableValues,
142+
operationName,
143+
});
137144

138145
// If errors are encountered while subscribing to the operation, an execution result
139146
// instead of an AsyncIterable.
@@ -190,7 +197,14 @@ export const processRequest = async <TContext = {}, TRootValue = {}>(
190197
}
191198
}
192199
} else {
193-
const result = await execute(schema, document, rootValue, context, variableValues, operationName);
200+
const result = await execute({
201+
schema,
202+
document,
203+
rootValue,
204+
context,
205+
variableValues,
206+
operationName,
207+
});
194208

195209
// Operations that use @defer, @stream and @live will return an `AsyncIterable` instead of an
196210
// execution result.

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"glob": "7.2.0",
5151
"globby": "12.0.2",
5252
"got": "11.8.2",
53-
"graphql": "15.4.0-experimental-stream-defer.1",
53+
"graphql": "16.0.0-experimental-stream-defer.5",
5454
"husky": "7.0.2",
5555
"jest": "27.2.1",
5656
"lint-staged": "11.1.2",
@@ -59,10 +59,10 @@
5959
"replacestream": "4.0.3",
6060
"ts-jest": "27.0.5",
6161
"ts-node": "10.2.1",
62-
"typescript": "4.4.3"
62+
"typescript": "4.4.4"
6363
},
6464
"peerDependencies": {
65-
"graphql": "^15.3.0"
65+
"graphql": "^15.3.0 || ^16.0.0"
6666
},
6767
"denoify": {
6868
"replacer": "scripts/denoify-replacer.js"

packages/core/test/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const schema = new GraphQLSchema({
7979
type: GraphQLInt,
8080
args: {
8181
to: {
82-
type: GraphQLNonNull(GraphQLInt),
82+
type: new GraphQLNonNull(GraphQLInt),
8383
},
8484
},
8585
subscribe: async function* (_root, args) {

packages/deno/process-request.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
OperationDefinitionNode,
1111
ValidationRule,
1212
ExecutionResult,
13-
} from "https://cdn.skypack.dev/graphql@15.4.0-experimental-stream-defer.1?dts";
13+
} from "https://cdn.skypack.dev/graphql@16.0.0-experimental-stream-defer.5?dts";
1414
import { stopAsyncIteration, isAsyncIterable, isHttpMethod } from "./util/index.ts";
1515
import { HttpError } from "./errors.ts";
1616
import { ExecutionContext, ExecutionPatchResult, MultipartResponse, ProcessRequestOptions, ProcessRequestResult } from "./types.ts";
@@ -133,7 +133,14 @@ export const processRequest = async <TContext = {}, TRootValue = {}>(
133133
rootValue = rootValueFactory ? await rootValueFactory(executionContext) : ({} as TRootValue);
134134

135135
if (operation.operation === "subscription") {
136-
const result = await subscribe(schema, document, rootValue, context, variableValues, operationName);
136+
const result = await subscribe({
137+
schema,
138+
document,
139+
rootValue,
140+
context,
141+
variableValues,
142+
operationName,
143+
});
137144

138145
// If errors are encountered while subscribing to the operation, an execution result
139146
// instead of an AsyncIterable.
@@ -190,7 +197,14 @@ export const processRequest = async <TContext = {}, TRootValue = {}>(
190197
}
191198
}
192199
} else {
193-
const result = await execute(schema, document, rootValue, context, variableValues, operationName);
200+
const result = await execute({
201+
schema,
202+
document,
203+
rootValue,
204+
context,
205+
variableValues,
206+
operationName,
207+
});
194208

195209
// Operations that use @defer, @stream and @live will return an `AsyncIterable` instead of an
196210
// execution result.

packages/deno/render-graphiql.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/deno/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
GraphQLSchema,
66
OperationDefinitionNode,
77
ValidationRule,
8-
} from "https://cdn.skypack.dev/graphql@15.4.0-experimental-stream-defer.1?dts";
8+
} from "https://cdn.skypack.dev/graphql@16.0.0-experimental-stream-defer.5?dts";
99

1010
export interface ExecutionPatchResult<
1111
TData = { [key: string]: any },

0 commit comments

Comments
 (0)