Skip to content

Commit 660feea

Browse files
committed
fix(GraphQL): Remove graphql peer-dependency. Use it from graphql-compose re-export
1 parent 747c474 commit 660feea

11 files changed

+41
-34
lines changed

src/__mocks__/rootMutationTypeComposer.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import {
2-
GraphQLObjectType,
3-
} from 'graphql';
4-
import { TypeComposer } from 'graphql-compose';
1+
/* @flow */
52

6-
const RootMutation = new GraphQLObjectType({
3+
import { TypeComposer, graphql } from 'graphql-compose';
4+
5+
const RootMutation = new graphql.GraphQLObjectType({
76
name: 'Mutation',
87
fields: {},
98
});

src/__mocks__/rootQueryTypeComposer.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import {
2-
GraphQLObjectType,
3-
} from 'graphql';
4-
import { TypeComposer } from 'graphql-compose';
1+
/* @flow */
52

6-
const RootQuery = new GraphQLObjectType({
3+
import { TypeComposer, graphql } from 'graphql-compose';
4+
5+
const RootQuery = new graphql.GraphQLObjectType({
76
name: 'Query',
87
fields: {},
98
});

src/__mocks__/userTypeComposer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import {
1+
/* @flow */
2+
3+
import { TypeComposer, Resolver, graphql } from 'graphql-compose';
4+
5+
const {
26
GraphQLString,
37
GraphQLObjectType,
48
GraphQLInputObjectType,
59
GraphQLNonNull,
610
GraphQLInt,
7-
} from 'graphql';
8-
import { TypeComposer, Resolver } from 'graphql-compose';
11+
} = graphql;
912

1013
export const UserType = new GraphQLObjectType({
1114
name: 'User',

src/__tests__/composeWithRelay-test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1+
/* @flow */
2+
13
import { expect } from 'chai';
2-
import {
3-
graphql,
4-
GraphQLInterfaceType,
5-
GraphQLSchema,
6-
GraphQLNonNull,
7-
} from 'graphql';
8-
import { TypeComposer } from 'graphql-compose';
4+
import { TypeComposer, graphql } from 'graphql-compose';
95
import { composeWithRelay } from '../composeWithRelay';
106
import { userTypeComposer } from '../__mocks__/userTypeComposer';
117
import { rootQueryTypeComposer } from '../__mocks__/rootQueryTypeComposer';
128
import { rootMutationTypeComposer } from '../__mocks__/rootMutationTypeComposer';
139
import { toGlobalId } from '../globalId';
1410

11+
const { GraphQLInterfaceType, GraphQLSchema, GraphQLNonNull } = graphql;
1512

1613
describe('composeWithRelay', () => {
1714
const userComposer = composeWithRelay(userTypeComposer);

src/__tests__/globalId-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* @flow */
2+
13
import { expect } from 'chai';
24
import { base64, unbase64, toGlobalId, fromGlobalId } from '../globalId';
35

src/__tests__/nodeFieldConfig-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
/* @flow */
2+
13
import { expect } from 'chai';
2-
import {
3-
GraphQLInterfaceType,
4-
GraphQLNonNull,
5-
} from 'graphql';
4+
import { graphql } from 'graphql-compose';
65
import { findByIdResolver, userTypeComposer } from '../__mocks__/userTypeComposer';
76
import { toGlobalId } from '../globalId';
87
import { getNodeFieldConfig } from '../nodeFieldConfig';
98

9+
const { GraphQLInterfaceType, GraphQLNonNull } = graphql;
1010

1111
describe('nodeFieldConfig', () => {
1212
const typeToFindByIdMap = {

src/__tests__/wrapMutationResolver.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
/* @flow */
2+
13
import { expect } from 'chai';
2-
import { GraphQLString, GraphQLID, GraphQLNonNull, getNamedType } from 'graphql';
3-
import { TypeComposer, InputTypeComposer } from 'graphql-compose';
4+
import { TypeComposer, InputTypeComposer, graphql } from 'graphql-compose';
45
import { composeWithRelay } from '../composeWithRelay';
56
import { userTypeComposer } from '../__mocks__/userTypeComposer';
67
import { toGlobalId } from '../globalId';
78

9+
const { GraphQLString, GraphQLID, GraphQLNonNull, getNamedType } = graphql;
10+
811
describe('wrapMutationResolver', () => {
912
composeWithRelay(userTypeComposer);
1013
const fieldConfig = userTypeComposer.getResolver('createOne').getFieldConfig();

src/composeWithRelay.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/* @flow */
22
/* eslint-disable no-use-before-define */
33

4-
import { GraphQLID, GraphQLNonNull } from 'graphql';
5-
import { TypeComposer } from 'graphql-compose';
4+
import { TypeComposer, graphql } from 'graphql-compose';
65
import NodeInterface from './nodeInterface';
76
import wrapMutationResolver from './wrapMutationResolver';
87
import { toGlobalId } from './globalId';
98
import { getNodeFieldConfig } from './nodeFieldConfig';
109

10+
const { GraphQLID, GraphQLNonNull } = graphql;
11+
1112
// all wrapped typeComposers with Relay, stored in this variable
1213
// for futher type resolving via NodeInterface.resolveType method
1314
export const typeMapForNode = {};

src/nodeFieldConfig.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* @flow */
22
/* eslint-disable no-param-reassign, import/prefer-default-export */
3-
4-
import { GraphQLID, GraphQLNonNull } from 'graphql';
5-
import { getProjectionFromAST } from 'graphql-compose';
3+
import { getProjectionFromAST, graphql } from 'graphql-compose';
64
import { fromGlobalId } from './globalId';
75
import NodeInterface from './nodeInterface';
86
import type { TypeMapForNode, GraphQLResolveInfo } from './definition';
97

8+
const { GraphQLID, GraphQLNonNull } = graphql;
9+
1010
// this fieldConfig must be set to RootQuery.node field
1111
export function getNodeFieldConfig(typeMapForNode: TypeMapForNode) {
1212
return {

src/nodeInterface.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* @flow */
22

3-
import { GraphQLID, GraphQLNonNull, GraphQLInterfaceType } from 'graphql';
3+
import { graphql } from 'graphql-compose';
4+
5+
const { GraphQLID, GraphQLNonNull, GraphQLInterfaceType } = graphql;
46

57
const NodeInterface = new GraphQLInterfaceType({
68
name: 'Node',

0 commit comments

Comments
 (0)