From 0509463266acfcf4fee13349fb9eb97179c5ef53 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Tue, 22 Aug 2017 16:59:46 +0300 Subject: [PATCH] Add "getDirectiveValues" --- types/graphql/UNUSED_FILES.txt | 1 - types/graphql/execution/index.d.ts | 2 ++ types/graphql/execution/values.d.ts | 13 +++++++++++++ types/graphql/index.d.ts | 3 ++- 4 files changed, 17 insertions(+), 2 deletions(-) delete mode 100644 types/graphql/UNUSED_FILES.txt diff --git a/types/graphql/UNUSED_FILES.txt b/types/graphql/UNUSED_FILES.txt deleted file mode 100644 index df0fadfe79..0000000000 --- a/types/graphql/UNUSED_FILES.txt +++ /dev/null @@ -1 +0,0 @@ -execution/values.d.ts \ No newline at end of file diff --git a/types/graphql/execution/index.d.ts b/types/graphql/execution/index.d.ts index be3038be95..82d6bce853 100644 --- a/types/graphql/execution/index.d.ts +++ b/types/graphql/execution/index.d.ts @@ -4,3 +4,5 @@ export { responsePathAsArray, ExecutionResult } from './execute'; + +export { getDirectiveValues } from './values'; diff --git a/types/graphql/execution/values.d.ts b/types/graphql/execution/values.d.ts index 3f6e909ed7..79a0176f8d 100644 --- a/types/graphql/execution/values.d.ts +++ b/types/graphql/execution/values.d.ts @@ -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 }, + variableValues?: { [key: string]: any } +): void | { [key: string]: any }; diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index ee1a95c059..e85060bab5 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -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 // Caleb Meredith @@ -28,6 +28,7 @@ export { execute, defaultFieldResolver, responsePathAsArray, + getDirectiveValues, ExecutionResult, } from './execution';