Comparing version 0.4.5 to 0.4.6
@@ -140,3 +140,3 @@ | ||
} | ||
if (!operationName || definition.name.value === operationName) { | ||
if (!operationName || definition.name && definition.name.value === operationName) { | ||
operation = definition; | ||
@@ -329,3 +329,7 @@ } | ||
function doesFragmentConditionMatch(exeContext, fragment, type) { | ||
var conditionalType = (0, _utilitiesTypeFromAST.typeFromAST)(exeContext.schema, fragment.typeCondition); | ||
var typeConditionAST = fragment.typeCondition; | ||
if (!typeConditionAST) { | ||
return true; | ||
} | ||
var conditionalType = (0, _utilitiesTypeFromAST.typeFromAST)(exeContext.schema, typeConditionAST); | ||
if (conditionalType === type) { | ||
@@ -332,0 +336,0 @@ return true; |
@@ -130,3 +130,3 @@ /** | ||
* - SelectionSet | ||
* - OperationType Name VariableDefinitions? Directives? SelectionSet | ||
* - OperationType Name? VariableDefinitions? Directives? SelectionSet | ||
* | ||
@@ -150,6 +150,10 @@ * OperationType : one of query mutation | ||
var operation = operationToken.value; | ||
var name; | ||
if (peek(parser, _lexer.TokenKind.NAME)) { | ||
name = parseName(parser); | ||
} | ||
return { | ||
kind: _kinds.OPERATION_DEFINITION, | ||
operation: operation, | ||
name: parseName(parser), | ||
name: name, | ||
variableDefinitions: parseVariableDefinitions(parser), | ||
@@ -275,3 +279,3 @@ directives: parseDirectives(parser), | ||
* | ||
* InlineFragment : ... on TypeCondition Directives? SelectionSet | ||
* InlineFragment : ... TypeCondition? Directives? SelectionSet | ||
*/ | ||
@@ -281,16 +285,20 @@ function parseFragment(parser) { | ||
expect(parser, _lexer.TokenKind.SPREAD); | ||
if (parser.token.value === 'on') { | ||
advance(parser); | ||
if (peek(parser, _lexer.TokenKind.NAME) && parser.token.value !== 'on') { | ||
return { | ||
kind: _kinds.INLINE_FRAGMENT, | ||
typeCondition: parseNamedType(parser), | ||
kind: _kinds.FRAGMENT_SPREAD, | ||
name: parseFragmentName(parser), | ||
directives: parseDirectives(parser), | ||
selectionSet: parseSelectionSet(parser), | ||
loc: loc(parser, start) | ||
}; | ||
} | ||
var typeCondition = null; | ||
if (parser.token.value === 'on') { | ||
advance(parser); | ||
typeCondition = parseNamedType(parser); | ||
} | ||
return { | ||
kind: _kinds.FRAGMENT_SPREAD, | ||
name: parseFragmentName(parser), | ||
kind: _kinds.INLINE_FRAGMENT, | ||
typeCondition: typeCondition, | ||
directives: parseDirectives(parser), | ||
selectionSet: parseSelectionSet(parser), | ||
loc: loc(parser, start) | ||
@@ -297,0 +305,0 @@ }; |
@@ -90,3 +90,3 @@ /** | ||
var selectionSet = _ref6.selectionSet; | ||
return '... on ' + typeCondition + ' ' + wrap('', join(directives, ' '), ' ') + selectionSet; | ||
return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' '); | ||
}, | ||
@@ -93,0 +93,0 @@ |
{ | ||
"name": "graphql", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"description": "A Query Language and Runtime which can target any service.", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -38,3 +38,3 @@ | ||
operation = definition; | ||
} else if (definition.name.value === operationName) { | ||
} else if (definition.name && definition.name.value === operationName) { | ||
return definition; | ||
@@ -41,0 +41,0 @@ } |
@@ -27,2 +27,13 @@ | ||
// Gets the target Operation from a Document | ||
var _getOperationAST = require('./getOperationAST'); | ||
Object.defineProperty(exports, 'getOperationAST', { | ||
enumerable: true, | ||
get: function get() { | ||
return _getOperationAST.getOperationAST; | ||
} | ||
}); | ||
// Build a GraphQLSchema from an introspection result. | ||
@@ -29,0 +40,0 @@ |
@@ -141,3 +141,4 @@ | ||
case Kind.FRAGMENT_DEFINITION: | ||
type = (0, _typeFromAST.typeFromAST)(schema, node.typeCondition); | ||
var typeConditionAST = node.typeCondition; | ||
type = typeConditionAST ? (0, _typeFromAST.typeFromAST)(schema, typeConditionAST) : this.getType(); | ||
this._typeStack.push(type); | ||
@@ -144,0 +145,0 @@ break; |
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
293179
7765