Skip to content

Commit c8d5e0d

Browse files
committed
fix(wrap): GraphQL v14 support
1 parent 61f040c commit c8d5e0d

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.changeset/good-beds-sparkle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-tools/wrap': patch
3+
---
4+
5+
Fix GraphQL v14 support

packages/wrap/src/transforms/MoveRootField.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ export class MoveRootField implements Transform {
2828
public transformSchema(schema: GraphQLSchema, _subschemaConfig: Record<string, any>): GraphQLSchema {
2929
const rootTypeMap = getRootTypeMap(schema);
3030
const newRootFieldsMap: Record<OperationTypeNode, GraphQLFieldConfigMap<any, any>> = {
31-
query: rootTypeMap.get(OperationTypeNode.QUERY)?.toConfig()?.fields || {},
32-
mutation: rootTypeMap.get(OperationTypeNode.MUTATION)?.toConfig()?.fields || {},
33-
subscription: rootTypeMap.get(OperationTypeNode.SUBSCRIPTION)?.toConfig()?.fields || {},
31+
query: rootTypeMap.get('query' as OperationTypeNode)?.toConfig()?.fields || {},
32+
mutation: rootTypeMap.get('mutation' as OperationTypeNode)?.toConfig()?.fields || {},
33+
subscription: rootTypeMap.get('subscription' as OperationTypeNode)?.toConfig()?.fields || {},
3434
};
3535
for (const operation in this.from) {
3636
const removedFields = this.from[operation as OperationTypeNode];

packages/wrap/tests/moveRootField.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('MoveRootField', () => {
1818
transforms: [
1919
new MoveRootField({
2020
query: {
21-
foo: OperationTypeNode.MUTATION,
21+
foo: 'mutation' as OperationTypeNode,
2222
},
2323
mutation: {},
2424
subscription: {},
@@ -60,7 +60,7 @@ describe('MoveRootField', () => {
6060
transforms: [
6161
new MoveRootField({
6262
query: {
63-
foo: OperationTypeNode.MUTATION,
63+
foo: 'mutation' as OperationTypeNode,
6464
},
6565
mutation: {},
6666
subscription: {},

0 commit comments

Comments
 (0)