Use graphql-ast-tools

This commit is contained in:
Chi Vinh Le
2017-12-05 19:25:32 +01:00
parent 001beb7a5b
commit 04ae844a1a
3 changed files with 10 additions and 3 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
import reduceDocument, {createTypeGetter} from '../graphql/reduceDocument';
import {transformDocument, createTypeGetter} from 'graphql-ast-tools';
import {addTypenameToDocument} from 'apollo-client/queries/queryTransform';
/**
@@ -10,7 +10,7 @@ export function createGraphQLService(registry, {
introspectionData,
optimize = false,
}) {
const reduceOptions = {
const transformOptions = {
typeGetter: optimize && introspectionData ? createTypeGetter(introspectionData) : null,
// Use shared fragment map.
@@ -27,7 +27,7 @@ export function createGraphQLService(registry, {
document = registry.resolveFragments(document);
if (optimize) {
document = reduceDocument(document, reduceOptions);
document = transformDocument(document, transformOptions);
}
// We also add typenames to the document which apollo would usually do,
+1
View File
@@ -107,6 +107,7 @@
"fs-extra": "^4.0.1",
"gql-merge": "^0.0.4",
"graphql": "^0.9.1",
"graphql-ast-tools": "^0.1.5",
"graphql-docs": "0.2.0",
"graphql-errors": "^2.1.0",
"graphql-redis-subscriptions": "1.3.0",
+6
View File
@@ -3519,6 +3519,12 @@ graphql-anywhere@^3.0.1:
version "3.1.0"
resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-3.1.0.tgz#3ea0d8e8646b5cee68035016a9a7557c15c21e96"
graphql-ast-tools@^0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/graphql-ast-tools/-/graphql-ast-tools-0.1.5.tgz#840c8027b71d60b560482d08e70988e5bc91da90"
dependencies:
apollo-utilities "^1.0.3"
graphql-docs@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/graphql-docs/-/graphql-docs-0.2.0.tgz#cf803f9c9d354fa03e89073d74e419261a5bfa74"