document optimizations v2

This commit is contained in:
Chi Vinh Le
2017-12-07 18:41:46 +01:00
parent f96146bfd9
commit 7072aa013b
6 changed files with 32 additions and 29 deletions
@@ -0,0 +1,23 @@
import graphql from '@coralproject/graphql-anywhere-optimized';
import {createTypeGetter} from 'graphql-ast-tools';
import introspectionData from './introspection.json';
// User typeGetter to get more optimized documents.
const typeGetter = createTypeGetter(introspectionData);
// Use global fragment cache for transformed fragments.
const fragmentMap = {};
export default (...args) => {
while (args.length < 7) {
args.push(undefined);
}
const transformOptions = {
typeGetter,
fragmentMap,
};
args[6] = transformOptions;
return graphql(...args);
};