graphql-fields
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -32,7 +32,5 @@ 'use strict'; | ||
function getArguments(ast) { | ||
function getArguments(ast, info) { | ||
return ast.arguments.map(function (argument) { | ||
var argumentValue = argument.value.kind !== 'ListValue' ? argument.value.value : argument.value.values.map(function (value) { | ||
return value.value; | ||
}); | ||
var argumentValue = getArgumentValue(argument.value, info); | ||
return _defineProperty({}, argument.name.value, { | ||
@@ -45,2 +43,17 @@ kind: argument.value.kind, | ||
function getArgumentValue(arg, info) { | ||
switch (arg.kind) { | ||
case 'Variable': | ||
return info.variableValues[arg.name.value]; | ||
case 'ListValue': | ||
return arg.values.map(function (argument) { | ||
return getArgumentValue(argument, info); | ||
}); | ||
default: | ||
return arg.value; | ||
} | ||
} | ||
function getDirectiveValue(directive, info) { | ||
@@ -113,3 +126,3 @@ var arg = directive.arguments[0]; // only arg on an include or skip directive is "if" | ||
_extends(flattened[name], { | ||
__arguments: getArguments(a) | ||
__arguments: getArguments(a, info) | ||
}); | ||
@@ -116,0 +129,0 @@ } |
# Changelog | ||
## 2.0.2 (2019-02-28) | ||
### Fixed | ||
- process arguments passed as variables | ||
## 2.0.1 (2018-12-04) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "graphql-fields", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Turns GraphQLResolveInfo into a map of the requested fields", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11024
118