Add "getDirectiveValues"

This commit is contained in:
Ivan Goncharov
2017-08-22 16:59:46 +03:00
parent 288dd9b309
commit 0509463266
4 changed files with 17 additions and 2 deletions

View File

@@ -1 +0,0 @@
execution/values.d.ts

View File

@@ -4,3 +4,5 @@ export {
responsePathAsArray,
ExecutionResult
} from './execute';
export { getDirectiveValues } from './values';

View File

@@ -23,3 +23,16 @@ export function getArgumentValues(
node: FieldNode | DirectiveNode,
variableValues?: { [key: string]: any }
): { [key: string]: any };
/**
* Prepares an object map of argument values given a directive definition
* and a AST node which may contain directives. Optionally also accepts a map
* of variable values.
*
* If the directive does not exist on the node, returns undefined.
*/
export function getDirectiveValues(
directiveDef: GraphQLDirective,
node: { directives?: Array<DirectiveNode> },
variableValues?: { [key: string]: any }
): void | { [key: string]: any };

View File

@@ -1,4 +1,4 @@
// Type definitions for graphql 0.10
// Type definitions for graphql 0.11
// Project: https://www.npmjs.com/package/graphql
// Definitions by: TonyYang <https://github.com/TonyPythoneer>
// Caleb Meredith <https://github.com/calebmer>
@@ -28,6 +28,7 @@ export {
execute,
defaultFieldResolver,
responsePathAsArray,
getDirectiveValues,
ExecutionResult,
} from './execution';