Comparing version 0.4.4 to 0.4.5
@@ -24,3 +24,3 @@ | ||
* | ||
* "Selections" are the statements that can appear legally and at | ||
* "Selections" are the definitions that can appear legally and at | ||
* single level of the query. These include: | ||
@@ -133,23 +133,27 @@ * 1) field references e.g "a" | ||
var errors = []; | ||
var operations = {}; | ||
var operation; | ||
var fragments = {}; | ||
documentAST.definitions.forEach(function (statement) { | ||
switch (statement.kind) { | ||
documentAST.definitions.forEach(function (definition) { | ||
switch (definition.kind) { | ||
case _language.Kind.OPERATION_DEFINITION: | ||
operations[statement.name ? statement.name.value : ''] = statement; | ||
if (!operationName && operation) { | ||
throw new _error.GraphQLError('Must provide operation name if query contains multiple operations.'); | ||
} | ||
if (!operationName || definition.name.value === operationName) { | ||
operation = definition; | ||
} | ||
break; | ||
case _language.Kind.FRAGMENT_DEFINITION: | ||
fragments[statement.name.value] = statement; | ||
fragments[definition.name.value] = definition; | ||
break; | ||
default: | ||
throw new _error.GraphQLError('GraphQL cannot execute a request containing a ' + statement.kind + '.', statement); | ||
throw new _error.GraphQLError('GraphQL cannot execute a request containing a ' + definition.kind + '.', definition); | ||
} | ||
}); | ||
if (!operationName && _Object$keys(operations).length !== 1) { | ||
throw new _error.GraphQLError('Must provide operation name if query contains multiple operations.'); | ||
} | ||
var opName = operationName || _Object$keys(operations)[0]; | ||
var operation = operations[opName]; | ||
if (!operation) { | ||
throw new _error.GraphQLError('Unknown operation named "' + opName + '".'); | ||
if (!operationName) { | ||
throw new _error.GraphQLError('Unknown operation named "' + operationName + '".'); | ||
} else { | ||
throw new _error.GraphQLError('Must provide an operation.'); | ||
} | ||
} | ||
@@ -250,4 +254,8 @@ var variableValues = (0, _values.getVariableValues)(schema, operation.variableDefinitions || [], rawVariableValues || {}); | ||
* the passed in map of fields, and returns it at the end. | ||
* | ||
* CollectFields requires the "runtime type" of an object. For a field which | ||
* returns and Interface or Union type, the "runtime type" will be the actual | ||
* Object type returned by that field. | ||
*/ | ||
function collectFields(exeContext, type, selectionSet, fields, visitedFragmentNames) { | ||
function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFragmentNames) { | ||
for (var i = 0; i < selectionSet.selections.length; i++) { | ||
@@ -267,6 +275,6 @@ var selection = selectionSet.selections[i]; | ||
case _language.Kind.INLINE_FRAGMENT: | ||
if (!shouldIncludeNode(exeContext, selection.directives) || !doesFragmentConditionMatch(exeContext, selection, type)) { | ||
if (!shouldIncludeNode(exeContext, selection.directives) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) { | ||
continue; | ||
} | ||
collectFields(exeContext, type, selection.selectionSet, fields, visitedFragmentNames); | ||
collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames); | ||
break; | ||
@@ -280,6 +288,6 @@ case _language.Kind.FRAGMENT_SPREAD: | ||
var fragment = exeContext.fragments[fragName]; | ||
if (!fragment || !shouldIncludeNode(exeContext, fragment.directives) || !doesFragmentConditionMatch(exeContext, fragment, type)) { | ||
if (!fragment || !shouldIncludeNode(exeContext, fragment.directives) || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) { | ||
continue; | ||
} | ||
collectFields(exeContext, type, fragment.selectionSet, fields, visitedFragmentNames); | ||
collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames); | ||
break; | ||
@@ -399,20 +407,23 @@ } | ||
// If an error occurs while calling the field `resolve` function, ensure that | ||
// it is wrapped as a GraphQLError with locations. Log this error and return | ||
// null if allowed, otherwise throw the error so the parent field can handle | ||
// it. | ||
// Get the resolve function, regardless of if it's result is normal | ||
// or abrupt (error). | ||
var result = resolveOrError(resolveFn, source, args, info); | ||
return completeValueCatchingError(exeContext, returnType, fieldASTs, info, result); | ||
} | ||
// Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField` | ||
// function. Returns the result of resolveFn or the abrupt-return Error object. | ||
function resolveOrError(resolveFn, source, args, info) { | ||
try { | ||
var result = resolveFn(source, args, info); | ||
return resolveFn(source, args, info); | ||
} catch (error) { | ||
var reportedError = (0, _error.locatedError)(error, fieldASTs); | ||
if (returnType instanceof _typeDefinition.GraphQLNonNull) { | ||
throw reportedError; | ||
} | ||
exeContext.errors.push(reportedError); | ||
return null; | ||
// Sometimes a non-error is thrown, wrap it as an Error for a | ||
// consistent interface. | ||
return error instanceof Error ? error : new Error(error); | ||
} | ||
return completeValueCatchingError(exeContext, returnType, fieldASTs, info, result); | ||
} | ||
// This is a small wrapper around completeValue which detects and logs errors | ||
// in the execution context. | ||
function completeValueCatchingError(exeContext, returnType, fieldASTs, info, result) { | ||
@@ -430,2 +441,4 @@ // If the field type is non-nullable, then it is resolved without any | ||
if (isThenable(completed)) { | ||
// If `completeValue` returned a rejected promise, log the rejection | ||
// error and resolve to null. | ||
// Note: we don't rely on a `catch` method, but we do expect "thenable" | ||
@@ -440,2 +453,4 @@ // to take a second callback for the error case. | ||
} catch (error) { | ||
// If `completeValue` returned abruptly (threw an error), log the error | ||
// and return null. | ||
exeContext.errors.push(error); | ||
@@ -465,8 +480,11 @@ return null; | ||
function completeValue(exeContext, returnType, fieldASTs, info, result) { | ||
// If result is a Promise, resolve it, if the Promise is rejected, construct | ||
// a GraphQLError with proper locations. | ||
// If result is a Promise, apply-lift over completeValue. | ||
if (isThenable(result)) { | ||
return result.then(function (resolved) { | ||
return result.then( | ||
// Once resolved to a value, complete that value. | ||
function (resolved) { | ||
return completeValue(exeContext, returnType, fieldASTs, info, resolved); | ||
}, function (error) { | ||
}, | ||
// If rejected, create a located error, and continue to reject. | ||
function (error) { | ||
return _Promise.reject((0, _error.locatedError)(error, fieldASTs)); | ||
@@ -476,2 +494,7 @@ }); | ||
// If result is an Error, throw a located error. | ||
if (result instanceof Error) { | ||
throw (0, _error.locatedError)(result, fieldASTs); | ||
} | ||
// If field type is NonNull, complete for inner type, and throw field error | ||
@@ -520,15 +543,15 @@ // if result is null. | ||
// Field type must be Object, Interface or Union and expect sub-selections. | ||
var objectType; | ||
var runtimeType; | ||
if (returnType instanceof _typeDefinition.GraphQLObjectType) { | ||
objectType = returnType; | ||
runtimeType = returnType; | ||
} else if ((0, _typeDefinition.isAbstractType)(returnType)) { | ||
var abstractType = returnType; | ||
objectType = abstractType.getObjectType(result, info); | ||
if (objectType && !abstractType.isPossibleType(objectType)) { | ||
throw new _error.GraphQLError('Runtime Object type "' + objectType + '" is not a possible type ' + ('for "' + abstractType + '".'), fieldASTs); | ||
runtimeType = abstractType.getObjectType(result, info); | ||
if (runtimeType && !abstractType.isPossibleType(runtimeType)) { | ||
throw new _error.GraphQLError('Runtime Object type "' + runtimeType + '" is not a possible type ' + ('for "' + abstractType + '".'), fieldASTs); | ||
} | ||
} | ||
if (!objectType) { | ||
if (!runtimeType) { | ||
return null; | ||
@@ -540,4 +563,4 @@ } | ||
// than continuing execution. | ||
if (objectType.isTypeOf && !objectType.isTypeOf(result, info)) { | ||
throw new _error.GraphQLError('Expected value of type "' + objectType + '" but got: ' + result + '.', fieldASTs); | ||
if (runtimeType.isTypeOf && !runtimeType.isTypeOf(result, info)) { | ||
throw new _error.GraphQLError('Expected value of type "' + runtimeType + '" but got: ' + result + '.', fieldASTs); | ||
} | ||
@@ -551,7 +574,7 @@ | ||
if (selectionSet) { | ||
subFieldASTs = collectFields(exeContext, objectType, selectionSet, subFieldASTs, visitedFragmentNames); | ||
subFieldASTs = collectFields(exeContext, runtimeType, selectionSet, subFieldASTs, visitedFragmentNames); | ||
} | ||
} | ||
return executeFields(exeContext, objectType, result, subFieldASTs); | ||
return executeFields(exeContext, runtimeType, result, subFieldASTs); | ||
} | ||
@@ -558,0 +581,0 @@ |
@@ -96,10 +96,11 @@ | ||
} | ||
if ((0, _utilitiesIsValidJSValue.isValidJSValue)(input, type)) { | ||
var inputType = type; | ||
if ((0, _utilitiesIsValidJSValue.isValidJSValue)(input, inputType)) { | ||
if ((0, _jsutilsIsNullish2['default'])(input)) { | ||
var defaultValue = definitionAST.defaultValue; | ||
if (defaultValue) { | ||
return (0, _utilitiesValueFromAST.valueFromAST)(defaultValue, type); | ||
return (0, _utilitiesValueFromAST.valueFromAST)(defaultValue, inputType); | ||
} | ||
} | ||
return coerceValue(type, input); | ||
return coerceValue(inputType, input); | ||
} | ||
@@ -106,0 +107,0 @@ if ((0, _jsutilsIsNullish2['default'])(input)) { |
@@ -111,3 +111,2 @@ /* / | ||
var charCodeAt = String.prototype.charCodeAt; | ||
var fromCharCode = String.fromCharCode; | ||
var slice = String.prototype.slice; | ||
@@ -122,2 +121,13 @@ | ||
function printCharCode(code) { | ||
return( | ||
// NaN/undefined represents access beyond the end of the file. | ||
isNaN(code) ? '<EOF>' : | ||
// Trust JSON for ASCII. | ||
code < 0x007F ? JSON.stringify(String.fromCharCode(code)) : | ||
// Otherwise print the escaped form. | ||
'"\\u' + ('00' + code.toString(16).toUpperCase()).slice(-4) + '"' | ||
); | ||
} | ||
/** | ||
@@ -135,3 +145,2 @@ * Gets the next token from the source starting at the given position. | ||
var position = positionAfterWhitespace(body, fromPosition); | ||
var code = charCodeAt.call(body, position); | ||
@@ -142,2 +151,9 @@ if (position >= bodyLength) { | ||
var code = charCodeAt.call(body, position); | ||
// SourceCharacter | ||
if (code < 0x0020 && code !== 0x0009 && code !== 0x000A && code !== 0x000D) { | ||
throw (0, _error.syntaxError)(source, position, 'Invalid character ' + printCharCode(code) + '.'); | ||
} | ||
switch (code) { | ||
@@ -210,3 +226,3 @@ // ! | ||
throw (0, _error.syntaxError)(source, position, 'Unexpected character "' + fromCharCode(code) + '".'); | ||
throw (0, _error.syntaxError)(source, position, 'Unexpected character ' + printCharCode(code) + '.'); | ||
} | ||
@@ -224,16 +240,22 @@ | ||
var code = charCodeAt.call(body, position); | ||
// Skip whitespace | ||
if (code === 32 || // space | ||
code === 44 || // comma | ||
code === 160 || // '\xa0' | ||
code === 0x2028 || // line separator | ||
code === 0x2029 || // paragraph separator | ||
code > 8 && code < 14 // whitespace | ||
) { | ||
++position; | ||
// Skip comments | ||
} else if (code === 35) { | ||
// Skip Ignored | ||
if ( | ||
// BOM | ||
code === 0xFEFF || | ||
// White Space | ||
code === 0x0009 || // tab | ||
code === 0x0020 || // space | ||
// Line Terminator | ||
code === 0x000A || // new line | ||
code === 0x000D || // carriage return | ||
// Comma | ||
code === 0x002C) { | ||
++position; | ||
// Skip comments | ||
} else if (code === 35) { | ||
// # | ||
++position; | ||
while (position < bodyLength && (code = charCodeAt.call(body, position)) && code !== 10 && code !== 13 && code !== 0x2028 && code !== 0x2029) { | ||
while (position < bodyLength && (code = charCodeAt.call(body, position)) !== null && ( | ||
// SourceCharacter but not LineTerminator | ||
code > 0x001F || code === 0x0009) && code !== 0x000A && code !== 0x000D) { | ||
++position; | ||
@@ -270,3 +292,3 @@ } | ||
if (code >= 48 && code <= 57) { | ||
throw (0, _error.syntaxError)(source, position, 'Invalid number, unexpected digit after 0: "' + fromCharCode(code) + '".'); | ||
throw (0, _error.syntaxError)(source, position, 'Invalid number, unexpected digit after 0: ' + printCharCode(code) + '.'); | ||
} | ||
@@ -316,3 +338,3 @@ } else { | ||
} | ||
throw (0, _error.syntaxError)(source, position, 'Invalid number, expected digit but got: ' + (code ? '"' + fromCharCode(code) + '"' : 'EOF') + '.'); | ||
throw (0, _error.syntaxError)(source, position, 'Invalid number, expected digit but got: ' + printCharCode(code) + '.'); | ||
} | ||
@@ -329,6 +351,15 @@ | ||
var chunkStart = position; | ||
var code; | ||
var code = 0; | ||
var value = ''; | ||
while (position < body.length && (code = charCodeAt.call(body, position)) && code !== 34 && code !== 10 && code !== 13 && code !== 0x2028 && code !== 0x2029) { | ||
while (position < body.length && (code = charCodeAt.call(body, position)) !== null && | ||
// not LineTerminator | ||
code !== 0x000A && code !== 0x000D && | ||
// not Quote (") | ||
code !== 34) { | ||
// SourceCharacter | ||
if (code < 0x0020 && code !== 0x0009) { | ||
throw (0, _error.syntaxError)(source, position, 'Invalid character within String: ' + printCharCode(code) + '.'); | ||
} | ||
++position; | ||
@@ -357,11 +388,12 @@ if (code === 92) { | ||
case 117: | ||
// u | ||
var charCode = uniCharCode(charCodeAt.call(body, position + 1), charCodeAt.call(body, position + 2), charCodeAt.call(body, position + 3), charCodeAt.call(body, position + 4)); | ||
if (charCode < 0) { | ||
throw (0, _error.syntaxError)(source, position, 'Bad character escape sequence.'); | ||
throw (0, _error.syntaxError)(source, position, 'Invalid character escape sequence: ' + ('\\u' + body.slice(position + 1, position + 5) + '.')); | ||
} | ||
value += fromCharCode(charCode); | ||
value += String.fromCharCode(charCode); | ||
position += 4; | ||
break; | ||
default: | ||
throw (0, _error.syntaxError)(source, position, 'Bad character escape sequence.'); | ||
throw (0, _error.syntaxError)(source, position, 'Invalid character escape sequence: \\' + String.fromCharCode(code) + '.'); | ||
} | ||
@@ -374,2 +406,3 @@ ++position; | ||
if (code !== 34) { | ||
// quote (") | ||
throw (0, _error.syntaxError)(source, position, 'Unterminated string.'); | ||
@@ -420,4 +453,4 @@ } | ||
var end = position + 1; | ||
var code; | ||
while (end !== bodyLength && (code = charCodeAt.call(body, end)) && (code === 95 || // _ | ||
var code = 0; | ||
while (end !== bodyLength && (code = charCodeAt.call(body, end)) !== null && (code === 95 || // _ | ||
code >= 48 && code <= 57 || // 0-9 | ||
@@ -424,0 +457,0 @@ code >= 65 && code <= 90 || // A-Z |
@@ -427,6 +427,5 @@ /** | ||
expect(parser, _lexer.TokenKind.BRACE_L); | ||
var fieldNames = {}; | ||
var fields = []; | ||
while (!skip(parser, _lexer.TokenKind.BRACE_R)) { | ||
fields.push(parseObjectField(parser, isConst, fieldNames)); | ||
fields.push(parseObjectField(parser, isConst)); | ||
} | ||
@@ -443,12 +442,7 @@ return { | ||
*/ | ||
function parseObjectField(parser, isConst, fieldNames) { | ||
function parseObjectField(parser, isConst) { | ||
var start = parser.token.start; | ||
var name = parseName(parser); | ||
if (fieldNames.hasOwnProperty(name.value)) { | ||
throw (0, _error.syntaxError)(parser.source, start, 'Duplicate input object field ' + name.value + '.'); | ||
} | ||
fieldNames[name.value] = true; | ||
return { | ||
kind: _kinds.OBJECT_FIELD, | ||
name: name, | ||
name: parseName(parser), | ||
value: (expect(parser, _lexer.TokenKind.COLON), parseValueLiteral(parser, isConst)), | ||
@@ -455,0 +449,0 @@ loc: loc(parser, start) |
{ | ||
"name": "graphql", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "A Query Language and Runtime which can target any service.", | ||
@@ -53,3 +53,3 @@ "contributors": [ | ||
"eslint-plugin-babel": "^2.1.1", | ||
"flow-bin": "0.14.0", | ||
"flow-bin": "0.16.0", | ||
"isparta": "3.0.3", | ||
@@ -56,0 +56,0 @@ "minimist": "1.1.3", |
@@ -298,2 +298,3 @@ | ||
}); | ||
(0, _jsutilsInvariant2['default'])(!field.hasOwnProperty('isDeprecated'), type + '.' + fieldName + ' should provide "deprecationReason" instead ' + 'of "isDeprecated".'); | ||
(0, _jsutilsInvariant2['default'])(isOutputType(field.type), type + '.' + fieldName + ' field type must be Output Type but ' + ('got: ' + field.type + '.')); | ||
@@ -608,2 +609,3 @@ if (!field.args) { | ||
(0, _jsutilsInvariant2['default'])(isPlainObj(value), type + '.' + valueName + ' must refer to an object with a "value" key ' + ('representing an internal value but got: ' + value + '.')); | ||
(0, _jsutilsInvariant2['default'])(!value.hasOwnProperty('isDeprecated'), type + '.' + valueName + ' should provide "deprecationReason" instead ' + 'of "isDeprecated".'); | ||
value.name = valueName; | ||
@@ -610,0 +612,0 @@ if ((0, _jsutilsIsNullish2['default'])(value.value)) { |
@@ -35,3 +35,3 @@ /* weak */ | ||
name: '__Schema', | ||
description: 'A GraphQL Schema defines the capabilities of a GraphQL ' + 'server. It exposes all available types and directives on ' + 'the server, as well as the entry points for query and ' + 'mutation operations.', | ||
description: 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' + 'exposes all available types and directives on the server, as well as ' + 'the entry points for query and mutation operations.', | ||
fields: function fields() { | ||
@@ -77,2 +77,3 @@ return { | ||
name: '__Directive', | ||
description: 'A Directives provides a way to describe alternate runtime execution and ' + 'type validation behavior in a GraphQL document.' + '\n\nIn some cases, you need to provide options to alter GraphQL’s ' + 'execution behavior in ways field arguments will not suffice, such as ' + 'conditionally including or skipping a field. Directives provide this by ' + 'describing additional information to the executor.', | ||
fields: function fields() { | ||
@@ -97,2 +98,3 @@ return { | ||
name: '__Type', | ||
description: 'The fundamental unit of any GraphQL Schema is the type. There are ' + 'many kinds of types in GraphQL as represented by the `__TypeKind` enum.' + '\n\nDepending on the kind of a type, certain fields describe ' + 'information about that type. Scalar types provide no information ' + 'beyond a name and description, while Enum types provide their values. ' + 'Object and Interface types provide the fields they describe. Abstract ' + 'types, Union and Interface, provide the Object types possible ' + 'at runtime. List and NonNull types compose other types.', | ||
fields: function fields() { | ||
@@ -201,2 +203,3 @@ return { | ||
name: '__Field', | ||
description: 'Object and Interface types are described by a list of Fields, each of ' + 'which has a name, potentially a list of arguments, and a return type.', | ||
fields: function fields() { | ||
@@ -228,2 +231,3 @@ return { | ||
name: '__InputValue', | ||
description: 'Arguments provided to Fields or Directives and the input fields of an ' + 'InputObject are represented as Input Values which describe their type ' + 'and optionally a default value.', | ||
fields: function fields() { | ||
@@ -236,2 +240,3 @@ return { | ||
type: _scalars.GraphQLString, | ||
description: 'A GraphQL-formatted string representing the default value for this ' + 'input value.', | ||
resolve: function resolve(inputVal) { | ||
@@ -247,2 +252,3 @@ return inputVal.defaultValue == null ? null : (0, _languagePrinter.print)((0, _utilitiesAstFromValue.astFromValue)(inputVal.defaultValue, inputVal)); | ||
name: '__EnumValue', | ||
description: 'One possible value for a given Enum. Enum values are unique values, not ' + 'a placeholder for a string or numeric value. However an Enum value is ' + 'returned in a JSON response as a string.', | ||
fields: { | ||
@@ -277,3 +283,3 @@ name: { type: new _definition.GraphQLNonNull(_scalars.GraphQLString) }, | ||
name: '__TypeKind', | ||
description: 'An enum describing what kind of type a given __Type is', | ||
description: 'An enum describing what kind of type a given `__Type` is.', | ||
values: { | ||
@@ -280,0 +286,0 @@ SCALAR: { |
@@ -37,2 +37,3 @@ | ||
name: 'Int', | ||
description: 'The `Int` scalar type represents non-fractional signed whole numeric ' + 'values. Int can represent values between -(2^53 - 1) and 2^53 - 1 since ' + 'represented in JSON as double-precision floating point numbers specified' + 'by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).', | ||
serialize: coerceInt, | ||
@@ -59,2 +60,3 @@ parseValue: coerceInt, | ||
name: 'Float', | ||
description: 'The `Float` scalar type represents signed double-precision fractional ' + 'values as specified by ' + '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ', | ||
serialize: coerceFloat, | ||
@@ -70,2 +72,3 @@ parseValue: coerceFloat, | ||
name: 'String', | ||
description: 'The `String` scalar type represents textual data, represented as UTF-8 ' + 'character sequences. The String type is most often used by GraphQL to ' + 'represent free-form human-readable text.', | ||
serialize: String, | ||
@@ -81,2 +84,3 @@ parseValue: String, | ||
name: 'Boolean', | ||
description: 'The `Boolean` scalar type represents `true` or `false`.', | ||
serialize: Boolean, | ||
@@ -92,2 +96,3 @@ parseValue: Boolean, | ||
name: 'ID', | ||
description: 'The `ID` scalar type represents a unique identifier, often used to ' + 'refetch an object or as key for a cache. The ID type appears in a JSON ' + 'response as a String; however, it is not intended to be human-readable. ' + 'When expected as an input type, any string (such as `"4"`) or integer ' + '(such as `4`) input value will be accepted as an ID.', | ||
serialize: String, | ||
@@ -94,0 +99,0 @@ parseValue: String, |
@@ -35,4 +35,2 @@ /** | ||
var _languageAst = require('../language/ast'); | ||
var _type = require('../type'); | ||
@@ -39,0 +37,0 @@ |
@@ -32,2 +32,4 @@ | ||
var _languageKinds = require('../../language/kinds'); | ||
function unknownArgMessage(argName, fieldName, type) { | ||
@@ -52,3 +54,3 @@ return 'Unknown argument "' + argName + '" on field "' + fieldName + '" of ' + ('type "' + type + '".'); | ||
var argumentOf = ancestors[ancestors.length - 1]; | ||
if (argumentOf.kind === 'Field') { | ||
if (argumentOf.kind === _languageKinds.FIELD) { | ||
var fieldDef = context.getFieldDef(); | ||
@@ -65,3 +67,3 @@ if (fieldDef) { | ||
} | ||
} else if (argumentOf.kind === 'Directive') { | ||
} else if (argumentOf.kind === _languageKinds.DIRECTIVE) { | ||
var directive = context.getDirective(); | ||
@@ -68,0 +70,0 @@ if (directive) { |
@@ -21,2 +21,4 @@ | ||
var _languageKinds = require('../../language/kinds'); | ||
function anonOperationNotAloneMessage() { | ||
@@ -38,3 +40,3 @@ return 'This anonymous operation must be the only defined operation.'; | ||
operationCount = node.definitions.filter(function (definition) { | ||
return definition.kind === 'OperationDefinition'; | ||
return definition.kind === _languageKinds.OPERATION_DEFINITION; | ||
}).length; | ||
@@ -41,0 +43,0 @@ }, |
@@ -104,6 +104,10 @@ | ||
// Spec Section: "Input Object Field Uniqueness" | ||
var _rulesUniqueInputFieldNames = require('./rules/UniqueInputFieldNames'); | ||
/** | ||
* This set includes all validation rules defined by the GraphQL spec. | ||
*/ | ||
var specifiedRules = [_rulesUniqueOperationNames.UniqueOperationNames, _rulesLoneAnonymousOperation.LoneAnonymousOperation, _rulesKnownTypeNames.KnownTypeNames, _rulesFragmentsOnCompositeTypes.FragmentsOnCompositeTypes, _rulesVariablesAreInputTypes.VariablesAreInputTypes, _rulesScalarLeafs.ScalarLeafs, _rulesFieldsOnCorrectType.FieldsOnCorrectType, _rulesUniqueFragmentNames.UniqueFragmentNames, _rulesKnownFragmentNames.KnownFragmentNames, _rulesNoUnusedFragments.NoUnusedFragments, _rulesPossibleFragmentSpreads.PossibleFragmentSpreads, _rulesNoFragmentCycles.NoFragmentCycles, _rulesNoUndefinedVariables.NoUndefinedVariables, _rulesNoUnusedVariables.NoUnusedVariables, _rulesKnownDirectives.KnownDirectives, _rulesKnownArgumentNames.KnownArgumentNames, _rulesUniqueArgumentNames.UniqueArgumentNames, _rulesArgumentsOfCorrectType.ArgumentsOfCorrectType, _rulesProvidedNonNullArguments.ProvidedNonNullArguments, _rulesDefaultValuesOfCorrectType.DefaultValuesOfCorrectType, _rulesVariablesInAllowedPosition.VariablesInAllowedPosition, _rulesOverlappingFieldsCanBeMerged.OverlappingFieldsCanBeMerged]; | ||
var specifiedRules = [_rulesUniqueOperationNames.UniqueOperationNames, _rulesLoneAnonymousOperation.LoneAnonymousOperation, _rulesKnownTypeNames.KnownTypeNames, _rulesFragmentsOnCompositeTypes.FragmentsOnCompositeTypes, _rulesVariablesAreInputTypes.VariablesAreInputTypes, _rulesScalarLeafs.ScalarLeafs, _rulesFieldsOnCorrectType.FieldsOnCorrectType, _rulesUniqueFragmentNames.UniqueFragmentNames, _rulesKnownFragmentNames.KnownFragmentNames, _rulesNoUnusedFragments.NoUnusedFragments, _rulesPossibleFragmentSpreads.PossibleFragmentSpreads, _rulesNoFragmentCycles.NoFragmentCycles, _rulesNoUndefinedVariables.NoUndefinedVariables, _rulesNoUnusedVariables.NoUnusedVariables, _rulesKnownDirectives.KnownDirectives, _rulesKnownArgumentNames.KnownArgumentNames, _rulesUniqueArgumentNames.UniqueArgumentNames, _rulesArgumentsOfCorrectType.ArgumentsOfCorrectType, _rulesProvidedNonNullArguments.ProvidedNonNullArguments, _rulesDefaultValuesOfCorrectType.DefaultValuesOfCorrectType, _rulesVariablesInAllowedPosition.VariablesInAllowedPosition, _rulesOverlappingFieldsCanBeMerged.OverlappingFieldsCanBeMerged, _rulesUniqueInputFieldNames.UniqueInputFieldNames]; | ||
exports.specifiedRules = specifiedRules; |
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
292497
73
7744