Comparing version 0.4.9 to 0.4.10
@@ -19,2 +19,17 @@ | ||
* tooling step, and a server runtime step. | ||
* | ||
* schema: | ||
* The GraphQL type system to use when validating and executing a query. | ||
* requestString: | ||
* A GraphQL language formatted string representing the requested operation. | ||
* rootValue: | ||
* The value provided as the first argument to resolver functions on the top | ||
* level type (e.g. the query object type). | ||
* variableValues: | ||
* A mapping of variable name to runtime value to use for all variables | ||
* defined in the requestString. | ||
* operationName: | ||
* The name of the operation to use if requestString contains multiple | ||
* possible operations. Can be omitted if requestString contains only | ||
* one operation. | ||
*/ | ||
@@ -21,0 +36,0 @@ 'use strict'; |
{ | ||
"name": "graphql", | ||
"version": "0.4.9", | ||
"version": "0.4.10", | ||
"description": "A Query Language and Runtime which can target any service.", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -609,11 +609,12 @@ | ||
(0, _jsutilsInvariant2['default'])(!value.hasOwnProperty('isDeprecated'), type + '.' + valueName + ' should provide "deprecationReason" instead ' + 'of "isDeprecated".'); | ||
value.name = valueName; | ||
if ((0, _jsutilsIsNullish2['default'])(value.value)) { | ||
value.value = valueName; | ||
} | ||
return value; | ||
return { | ||
name: valueName, | ||
description: value.description, | ||
deprecationReason: value.deprecationReason, | ||
value: (0, _jsutilsIsNullish2['default'])(value.value) ? valueName : value.value | ||
}; | ||
}); | ||
} | ||
/* <T> */ | ||
/* <T> */ /* T */ | ||
@@ -787,2 +788,2 @@ /** | ||
*/ | ||
/* <T> */ /* <T> */ /* T */ /* T */ /* <T> */ /* <T> */ /* <T> */ /* <T> */ /* T */ /* <T> */ /* T */ | ||
/* <T> */ /* <T> */ /* T */ /* T */ /* <T> */ /* <T> */ /* <T> */ /* <T> */ /* T */ /* <T> */ |
@@ -33,6 +33,6 @@ | ||
this.description = config.description; | ||
this.args = config.args; | ||
this.onOperation = config.onOperation; | ||
this.onFragment = config.onFragment; | ||
this.onField = config.onField; | ||
this.args = config.args || []; | ||
this.onOperation = Boolean(config.onOperation); | ||
this.onFragment = Boolean(config.onFragment); | ||
this.onField = Boolean(config.onField); | ||
}; | ||
@@ -39,0 +39,0 @@ |
@@ -62,7 +62,18 @@ | ||
(0, _jsutilsInvariant2['default'])(typeof config === 'object', 'Must provide configuration object.'); | ||
(0, _jsutilsInvariant2['default'])(config.query instanceof _definition.GraphQLObjectType, 'Schema query must be Object Type but got: ' + config.query + '.'); | ||
this._queryType = config.query; | ||
(0, _jsutilsInvariant2['default'])(!config.mutation || config.mutation instanceof _definition.GraphQLObjectType, 'Schema mutation must be Object Type if provided but ' + ('got: ' + config.mutation + '.')); | ||
this._mutationType = config.mutation; | ||
(0, _jsutilsInvariant2['default'])(!config.subscription || config.subscription instanceof _definition.GraphQLObjectType, 'Schema subscription must be Object Type if provided but ' + ('got: ' + config.subscription + '.')); | ||
this._schemaConfig = config; | ||
this._subscriptionType = config.subscription; | ||
(0, _jsutilsInvariant2['default'])(!config.directives || Array.isArray(config.directives) && config.directives.every(function (directive) { | ||
return directive instanceof _directives.GraphQLDirective; | ||
}), 'Schema directives must be Array<GraphQLDirective> if provided but ' + ('got: ' + config.directives + '.')); | ||
// Provide `@include() and `@skip()` directives by default. | ||
this._directives = config.directives || [_directives.GraphQLIncludeDirective, _directives.GraphQLSkipDirective]; | ||
// Build type map now to detect any errors within this schema. | ||
@@ -85,3 +96,3 @@ this._typeMap = [this.getQueryType(), this.getMutationType(), this.getSubscriptionType(), _introspection.__Schema].reduce(typeMapReducer, {}); | ||
value: function getQueryType() { | ||
return this._schemaConfig.query; | ||
return this._queryType; | ||
} | ||
@@ -91,3 +102,3 @@ }, { | ||
value: function getMutationType() { | ||
return this._schemaConfig.mutation; | ||
return this._mutationType; | ||
} | ||
@@ -97,3 +108,3 @@ }, { | ||
value: function getSubscriptionType() { | ||
return this._schemaConfig.subscription; | ||
return this._subscriptionType; | ||
} | ||
@@ -113,3 +124,3 @@ }, { | ||
value: function getDirectives() { | ||
return this._directives || (this._directives = [_directives.GraphQLIncludeDirective, _directives.GraphQLSkipDirective]); | ||
return this._directives; | ||
} | ||
@@ -116,0 +127,0 @@ }, { |
@@ -51,2 +51,4 @@ | ||
var _typeDirectives = require('../type/directives'); | ||
var _typeIntrospection = require('../type/introspection'); | ||
@@ -216,3 +218,4 @@ | ||
return { | ||
description: valueIntrospection.description | ||
description: valueIntrospection.description, | ||
deprecationReason: valueIntrospection.deprecationReason | ||
}; | ||
@@ -239,2 +242,3 @@ }) | ||
description: fieldIntrospection.description, | ||
deprecationReason: fieldIntrospection.deprecationReason, | ||
type: getOutputType(fieldIntrospection.type), | ||
@@ -252,13 +256,27 @@ args: buildInputValueDefMap(fieldIntrospection.args), | ||
return inputValue.name; | ||
}, function (inputValue) { | ||
var description = inputValue.description; | ||
var type = getInputType(inputValue.type); | ||
var defaultValue = inputValue.defaultValue ? (0, _valueFromAST.valueFromAST)((0, _languageParser.parseValue)(inputValue.defaultValue), type) : null; | ||
return { description: description, type: type, defaultValue: defaultValue }; | ||
}, buildInputValue); | ||
} | ||
function buildInputValue(inputValueIntrospection) { | ||
var type = getInputType(inputValueIntrospection.type); | ||
var defaultValue = inputValueIntrospection.defaultValue ? (0, _valueFromAST.valueFromAST)((0, _languageParser.parseValue)(inputValueIntrospection.defaultValue), type) : null; | ||
return { | ||
name: inputValueIntrospection.name, | ||
description: inputValueIntrospection.description, | ||
type: type, | ||
defaultValue: defaultValue | ||
}; | ||
} | ||
function buildDirective(directiveIntrospection) { | ||
return new _typeDirectives.GraphQLDirective({ | ||
name: directiveIntrospection.name, | ||
description: directiveIntrospection.description, | ||
args: directiveIntrospection.args.map(buildInputValue), | ||
onOperation: directiveIntrospection.onOperation, | ||
onFragment: directiveIntrospection.onFragment, | ||
onField: directiveIntrospection.onField | ||
}); | ||
} | ||
// TODO: deprecation | ||
// TODO: directives | ||
// Iterate through all types, getting the type definition for each, ensuring | ||
@@ -271,14 +289,19 @@ // that any type not directly referenced by a field will get created. | ||
// Get the root Query, Mutation, and Subscription types. | ||
var queryType = getType(schemaIntrospection.queryType); | ||
var mutationType = schemaIntrospection.mutationType ? getType(schemaIntrospection.mutationType) : null; | ||
var subscriptionType = schemaIntrospection.subscriptionType ? getType(schemaIntrospection.subscriptionType) : null; | ||
var queryType = getObjectType(schemaIntrospection.queryType); | ||
var mutationType = schemaIntrospection.mutationType ? getObjectType(schemaIntrospection.mutationType) : null; | ||
var subscriptionType = schemaIntrospection.subscriptionType ? getObjectType(schemaIntrospection.subscriptionType) : null; | ||
// Get the directives supported by Introspection, assuming empty-set if | ||
// directives were not queried for. | ||
var directives = schemaIntrospection.directives ? schemaIntrospection.directives.map(buildDirective) : []; | ||
// Then produce and return a Schema with these types. | ||
var schema = new _typeSchema.GraphQLSchema({ | ||
return new _typeSchema.GraphQLSchema({ | ||
query: queryType, | ||
mutation: mutationType, | ||
subscription: subscriptionType | ||
subscription: subscriptionType, | ||
directives: directives | ||
}); | ||
return schema; | ||
} |
@@ -142,2 +142,13 @@ | ||
} | ||
}); | ||
// Concatenates multiple AST together. | ||
var _concatAST = require('./concatAST'); | ||
Object.defineProperty(exports, 'concatAST', { | ||
enumerable: true, | ||
get: function get() { | ||
return _concatAST.concatAST; | ||
} | ||
}); |
@@ -16,4 +16,4 @@ | ||
}); | ||
var introspectionQuery = '\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n args {\n ...InputValue\n }\n onOperation\n onFragment\n onField\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n fields {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n'; | ||
var introspectionQuery = '\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n args {\n ...InputValue\n }\n onOperation\n onFragment\n onField\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n'; | ||
exports.introspectionQuery = introspectionQuery; |
@@ -35,6 +35,14 @@ | ||
function UniqueInputFieldNames() { | ||
var knownNameStack = []; | ||
var knownNames = _Object$create(null); | ||
return { | ||
ObjectValue: function ObjectValue() { | ||
knownNames = _Object$create(null); | ||
ObjectValue: { | ||
enter: function enter() { | ||
knownNameStack.push(knownNames); | ||
knownNames = _Object$create(null); | ||
}, | ||
leave: function leave() { | ||
knownNames = knownNameStack.pop(); | ||
} | ||
}, | ||
@@ -41,0 +49,0 @@ ObjectField: function ObjectField(node) { |
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
298675
74
7883