@coralproject/graphql-anywhere-optimized
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -27,3 +27,4 @@ import { DocumentNode } from 'graphql'; | ||
fragmentMatcher?: FragmentMatcher; | ||
includeAll?: boolean; | ||
}; | ||
export declare function graphql(resolver: Resolver, document: DocumentNode, rootValue?: any, contextValue?: any, variableValues?: VariableMap, execOptions?: ExecOptions, transformOptions?: TransformDocumentOptions): any; |
@@ -20,5 +20,7 @@ "use strict"; | ||
var fragmentMatcher = execOptions.fragmentMatcher || (function () { return true; }); | ||
var includeAll = !!execOptions.includeAll; | ||
var variables = variableValues || {}; | ||
var execContext = { | ||
contextValue: contextValue, | ||
variableValues: variableValues, | ||
variableValues: variables, | ||
resultMapper: resultMapper, | ||
@@ -28,3 +30,3 @@ resolver: resolver, | ||
}; | ||
var resolved = graphql_ast_tools_1.transformDocument(document, __assign({}, transformOptions, { variables: variableValues || {} })); | ||
var resolved = graphql_ast_tools_1.transformDocument(document, __assign({}, transformOptions, { variables: includeAll ? undefined : variables })); | ||
var mainDefinition = getFromAST_1.getMainDefinition(resolved); | ||
@@ -31,0 +33,0 @@ return executeSelectionSet(mainDefinition.selectionSet, rootValue, execContext); |
{ | ||
"name": "@coralproject/graphql-anywhere-optimized", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Fork of graphql-anywhere with custom optimizations", | ||
@@ -5,0 +5,0 @@ "main": "./lib/src/index.js", |
@@ -18,3 +18,2 @@ import { | ||
DirectiveInfo, | ||
shouldInclude, | ||
getDirectiveInfoFromField, | ||
@@ -46,3 +45,3 @@ } from './directives'; | ||
export type ResultMapper = (values: {[fieldName: string]: any}, rootValue: any) => any; | ||
export type ResultMapper = (values: { [fieldName: string]: any }, rootValue: any) => any; | ||
export type FragmentMatcher = (rootValue: any, typeCondition: string, context: any) => boolean; | ||
@@ -67,2 +66,3 @@ | ||
fragmentMatcher?: FragmentMatcher; | ||
includeAll?: boolean; | ||
}; | ||
@@ -93,5 +93,11 @@ | ||
// If set ignore skip and if directives. | ||
const includeAll = !!execOptions.includeAll; | ||
// Default to {} when passing in falsy values. | ||
const variables = variableValues || {}; | ||
const execContext: ExecContext = { | ||
contextValue, | ||
variableValues, | ||
variableValues: variables, | ||
resultMapper, | ||
@@ -105,3 +111,4 @@ resolver, | ||
...transformOptions, | ||
variables: variableValues || {}, | ||
// Passing variables will resolve @skip and @include directives. | ||
variables: includeAll ? undefined : variables, | ||
}); | ||
@@ -245,2 +252,1 @@ | ||
} | ||
Sorry, the diff of this file is not supported yet
71891
1042