apollo-codegen
Advanced tools
Comparing version 0.9.7 to 0.9.8
@@ -271,10 +271,3 @@ 'use strict'; | ||
groupedFieldSet[responseName].push([parentType, { | ||
responseName: responseName, | ||
fieldName: fieldName, | ||
args: argumentsFromAST(selection.arguments), | ||
type: field.type, | ||
directives: selection.directives, | ||
selectionSet: selection.selectionSet | ||
}]); | ||
groupedFieldSet[responseName].push([parentType, { responseName: responseName, fieldName: fieldName, type: field.type, directives: selection.directives, selectionSet: selection.selectionSet }]); | ||
} | ||
@@ -407,6 +400,5 @@ break; | ||
var fieldName = firstField.fieldName; | ||
var args = firstField.args; | ||
var type = firstField.type; | ||
var field = { responseName: responseName, fieldName: fieldName, args: args, type: type }; | ||
var field = { responseName: responseName, fieldName: fieldName, type: type }; | ||
@@ -730,20 +722,2 @@ var isConditional = fieldSet.some(function (_ref3) { | ||
function argumentsFromAST(args) { | ||
return args.map(function (arg) { | ||
var kind = arg.value.kind; | ||
if (kind === 'Variable') { | ||
return { | ||
kind: kind, | ||
name: arg.name.value, | ||
variableName: arg.value.name.value | ||
}; | ||
} else { | ||
return { | ||
name: arg.name.value, | ||
value: (0, _graphql2.valueFromValueNode)(arg.value) | ||
}; | ||
} | ||
}); | ||
} | ||
function printIR(_ref5) { | ||
@@ -750,0 +724,0 @@ var fields = _ref5.fields; |
@@ -51,3 +51,3 @@ 'use strict'; | ||
var _values3 = require('./values'); | ||
var _strings = require('./strings'); | ||
@@ -117,3 +117,3 @@ var _types = require('./types'); | ||
generator.withIndent(function () { | ||
(0, _values3.multilineString)(generator, source); | ||
(0, _strings.multilineString)(generator, source); | ||
}); | ||
@@ -221,3 +221,3 @@ } | ||
generator.withIndent(function () { | ||
(0, _values3.multilineString)(generator, source); | ||
(0, _strings.multilineString)(generator, source); | ||
}); | ||
@@ -394,3 +394,2 @@ } | ||
var fieldName = _ref13.fieldName; | ||
var fieldArgs = _ref13.args; | ||
var type = _ref13.type; | ||
@@ -403,4 +402,4 @@ var isOptional = _ref13.isOptional; | ||
var fieldInitArgs = (0, _printing.join)(['responseName: "' + responseName + '"', responseName != fieldName ? 'fieldName: "' + fieldName + '"' : null, fieldArgs && fieldArgs.length && 'arguments: ' + dictionaryFromArguments(fieldArgs)], ', '); | ||
var args = ['for: Field(' + fieldInitArgs + ')']; | ||
var fieldArgs = (0, _printing.join)(['responseName: "' + responseName + '"', responseName != fieldName ? 'fieldName: "' + fieldName + '"' : null], ', '); | ||
var args = ['for: Field(' + fieldArgs + ')']; | ||
@@ -410,12 +409,2 @@ generator.printOnNewline(propertyName + ' = try reader.' + methodName + '(' + (0, _printing.join)(args, ', ') + ')'); | ||
function dictionaryFromArguments(args) { | ||
return (0, _printing.wrap)('[', (0, _printing.join)(args.map(function (arg) { | ||
if (arg.kind === 'Variable') { | ||
return '"' + arg.name + '": reader.variables["' + arg.variableName + '"]'; | ||
} else { | ||
return '"' + arg.name + '": ' + (0, _values3.literalFromValue)(arg.value); | ||
} | ||
}), ', '), ']'); | ||
} | ||
function propertiesFromFields(context, fields) { | ||
@@ -422,0 +411,0 @@ return fields.map(function (field) { |
@@ -6,3 +6,2 @@ 'use strict'; | ||
}); | ||
exports.valueFromValueNode = valueFromValueNode; | ||
exports.isTypeProperSuperTypeOf = isTypeProperSuperTypeOf; | ||
@@ -14,21 +13,2 @@ exports.getOperationRootType = getOperationRootType; | ||
function valueFromValueNode(valueNode) { | ||
var kind = valueNode.kind; | ||
if (kind === 'IntValue' || kind === 'FloatValue') { | ||
return Number(valueNode.value); | ||
} else if (kind === 'NullValue') { | ||
return null; | ||
} else if (kind === 'ListValue') { | ||
return valueNode.values.map(valueFromValueNode); | ||
} else if (kind === 'ObjectValue') { | ||
return valueNode.fields.reduce(function (object, field) { | ||
object[field.name.value] = valueFromValueNode(field.value); | ||
return object; | ||
}, {}); | ||
} else { | ||
return valueNode.value; | ||
} | ||
} | ||
function isTypeProperSuperTypeOf(schema, maybeSuperType, subType) { | ||
@@ -35,0 +15,0 @@ return (0, _graphql.isEqualType)(maybeSuperType, subType) || (0, _graphql.isAbstractType)(maybeSuperType) && schema.isPossibleType(maybeSuperType, subType); |
{ | ||
"name": "apollo-codegen", | ||
"version": "0.9.7", | ||
"version": "0.9.8", | ||
"description": "Generate API code or type annotations based on a GraphQL schema and query documents", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
422491
73
8133