Skip to content

Commit 66e9dfc

Browse files
authored
Support GraphQL v17 (#13254)
Add `graphql` v17 as a valid peer dependency. Updates the core tests to run against both GraphQL 16 and GraphQL 17. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Extended peer dependency support to include GraphQL v17 * Expanded testing infrastructure for GraphQL v16 compatibility <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent ec68620 commit 66e9dfc

8 files changed

Lines changed: 41 additions & 10 deletions

File tree

.changeset/great-apricots-reply.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@apollo/client": patch
3+
---
4+
5+
Add support for `graphql` v17 as a valid peer dependency.

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ workflows:
165165
[
166166
"Core Tests",
167167
"Core Tests - RxJS min version",
168+
"Core Tests - GraphQL 16",
168169
"ReactDOM 17",
169170
"ReactDOM 18",
170171
"ReactDOM 19",

config/jest.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ const tsRxJSMinConfig = {
8484
},
8585
};
8686

87+
const tsGraphql16Config = {
88+
...tsStandardConfig,
89+
displayName: "Core Tests - GraphQL 16",
90+
moduleNameMapper: {
91+
...tsStandardConfig.moduleNameMapper,
92+
"^graphql$": "graphql-16",
93+
},
94+
};
95+
8796
// For both React (Jest) "projects", ignore core tests (.ts files) as they
8897
// do not import React, to avoid running them twice.
8998
const standardReact19Config = {
@@ -125,6 +134,7 @@ export default {
125134
projects: [
126135
tsStandardConfig,
127136
tsRxJSMinConfig,
137+
tsGraphql16Config,
128138
standardReact17Config,
129139
standardReact18Config,
130140
standardReact19Config,

package-lock.json

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

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
}
131131
},
132132
"peerDependencies": {
133-
"graphql": "^16.0.0",
133+
"graphql": "^16.0.0 || ^17.0.0",
134134
"graphql-ws": "^5.5.5 || ^6.0.3",
135135
"react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc",
136136
"react-dom": "^17.0.0 || ^18.0.0 || >=19.0.0-rc",
@@ -213,7 +213,8 @@
213213
"expect-type": "1.1.0",
214214
"fetch-mock": "9.11.0",
215215
"globals": "15.14.0",
216-
"graphql": "16.9.0",
216+
"graphql": "17.0.0-rc.0",
217+
"graphql-16": "npm:graphql@16.14.1",
217218
"graphql-17-alpha2": "npm:graphql@17.0.0-alpha.2",
218219
"graphql-17-alpha9": "npm:graphql@17.0.0-alpha.9",
219220
"graphql-ws": "6.0.8",

src/core/__tests__/ObservableQuery.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ describe("ObservableQuery", () => {
6161
},
6262
};
6363

64-
const error = new GraphQLError("is offline.", undefined, null, null, [
65-
"people_one",
66-
]);
64+
const error = new GraphQLError("is offline.", { path: ["people_one"] });
6765
const wrappedError = new CombinedGraphQLErrors({
6866
data: dataOne,
6967
errors: [error],

src/testing/internal/incremental/executeSchemaGraphQL17Alpha2.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type {
2+
DocumentNode as DocumentNodeAlpha2,
23
FormattedExecutionResult,
34
FormattedInitialIncrementalExecutionResult,
45
FormattedSubsequentIncrementalExecutionResult,
@@ -20,7 +21,7 @@ export async function* executeSchemaGraphQL17Alpha2(
2021
> {
2122
const result = await experimentalExecuteIncrementally({
2223
schema,
23-
document,
24+
document: document as DocumentNodeAlpha2,
2425
rootValue,
2526
});
2627

src/testing/internal/incremental/executeSchemaGraphQL17Alpha9.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type {
2+
DocumentNode as DocumentNodeAlpha9,
23
FormattedExecutionResult,
34
FormattedInitialIncrementalExecutionResult,
45
FormattedSubsequentIncrementalExecutionResult,
@@ -21,7 +22,7 @@ export async function* executeSchemaGraphQL17Alpha9(
2122
> {
2223
const result = await experimentalExecuteIncrementally({
2324
schema,
24-
document,
25+
document: document as DocumentNodeAlpha9,
2526
rootValue,
2627
enableEarlyExecution,
2728
});

0 commit comments

Comments
 (0)