Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql

Package Overview
Dependencies
Maintainers
3
Versions
260
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

19

error/GraphQLError.js

@@ -22,3 +22,4 @@ 'use strict';

value: originalError.stack,
writable: true
writable: true,
configurable: true
});

@@ -30,3 +31,4 @@ } else if (Error.captureStackTrace) {

value: Error().stack,
writable: true
writable: true,
configurable: true
});

@@ -44,5 +46,7 @@ }

if (!_positions && nodes) {
_positions = nodes.map(function (node) {
return node.loc && node.loc.start;
}).filter(Boolean);
_positions = nodes.filter(function (node) {
return node.loc !== null;
}).map(function (node) {
return node.loc.start;
});
}

@@ -54,5 +58,6 @@ if (_positions && _positions.length === 0) {

var _locations = void 0;
if (_source && _positions) {
var _source2 = _source; // seems here Flow need a const to resolve type.
if (_source2 && _positions) {
_locations = _positions.map(function (pos) {
return (0, _language.getLocation)(_source, pos);
return (0, _language.getLocation)(_source2, pos);
});

@@ -59,0 +64,0 @@ }

@@ -26,4 +26,6 @@ 'use strict';

var _language = require('../language');
var _kinds = require('../language/kinds');
var Kind = _interopRequireWildcard(_kinds);
var _values = require('./values');

@@ -39,2 +41,4 @@

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -99,2 +103,5 @@

// Variables, if provided, must be an object.
(0, _invariant2.default)(!variableValues || typeof variableValues === 'object', 'Variables must be provided as an Object where each property is a ' + 'variable value. Perhaps look to see if an unparsed JSON string ' + 'was provided.');
// If a valid context cannot be created due to incorrect arguments,

@@ -113,3 +120,3 @@ // this will throw an error.

resolve(executeOperation(context, context.operation, rootValue));
}).catch(function (error) {
}).then(undefined, function (error) {
// Errors from sub-fields of a NonNull type may propagate to the top level,

@@ -140,3 +147,3 @@ // at which point we still log the error and null the parent field, which

switch (definition.kind) {
case _language.Kind.OPERATION_DEFINITION:
case Kind.OPERATION_DEFINITION:
if (!operationName && operation) {

@@ -149,3 +156,3 @@ throw new _error.GraphQLError('Must provide operation name if query contains multiple operations.');

break;
case _language.Kind.FRAGMENT_DEFINITION:
case Kind.FRAGMENT_DEFINITION:
fragments[definition.name.value] = definition;

@@ -286,3 +293,3 @@ break;

switch (selection.kind) {
case _language.Kind.FIELD:
case Kind.FIELD:
if (!shouldIncludeNode(exeContext, selection.directives)) {

@@ -297,3 +304,3 @@ continue;

break;
case _language.Kind.INLINE_FRAGMENT:
case Kind.INLINE_FRAGMENT:
if (!shouldIncludeNode(exeContext, selection.directives) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) {

@@ -304,3 +311,3 @@ continue;

break;
case _language.Kind.FRAGMENT_SPREAD:
case Kind.FRAGMENT_SPREAD:
var fragName = selection.name.value;

@@ -502,3 +509,3 @@ if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection.directives)) {

if (isThenable(completed)) {
return completed.catch(function (error) {
return completed.then(undefined, function (error) {
return Promise.reject((0, _error.locatedError)(error, fieldASTs, path));

@@ -505,0 +512,0 @@ });

@@ -60,3 +60,3 @@ 'use strict';

}
}).catch(function (error) {
}).then(undefined, function (error) {
return { errors: [error] };

@@ -63,0 +63,0 @@ });

@@ -291,2 +291,8 @@ 'use strict';

});
Object.defineProperty(exports, 'parseType', {
enumerable: true,
get: function get() {
return _language.parseType;
}
});
Object.defineProperty(exports, 'print', {

@@ -293,0 +299,0 @@ enumerable: true,

@@ -6,3 +6,3 @@ 'use strict';

});
exports.BREAK = exports.visitWithTypeInfo = exports.visitInParallel = exports.visit = exports.Source = exports.print = exports.parseValue = exports.parse = exports.TokenKind = exports.createLexer = exports.Kind = exports.getLocation = undefined;
exports.BREAK = exports.visitWithTypeInfo = exports.visitInParallel = exports.visit = exports.Source = exports.print = exports.parseType = exports.parseValue = exports.parse = exports.TokenKind = exports.createLexer = exports.Kind = exports.getLocation = undefined;

@@ -47,2 +47,8 @@ var _location = require('./location');

});
Object.defineProperty(exports, 'parseType', {
enumerable: true,
get: function get() {
return _parser.parseType;
}
});

@@ -49,0 +55,0 @@ var _printer = require('./printer');

@@ -6,2 +6,3 @@ 'use strict';

});
/**

@@ -8,0 +9,0 @@ * Copyright (c) 2015, Facebook, Inc.

@@ -8,4 +8,5 @@ 'use strict';

exports.parseValue = parseValue;
exports.parseType = parseType;
exports.parseConstValue = parseConstValue;
exports.parseType = parseType;
exports.parseTypeReference = parseTypeReference;
exports.parseNamedType = parseNamedType;

@@ -47,3 +48,4 @@

/**
* Given a string containing a GraphQL value, parse the AST for that value.
* Given a string containing a GraphQL value (ex. `[42]`), parse the AST for
* that value.
* Throws GraphQLError if a syntax error is encountered.

@@ -53,2 +55,4 @@ *

* in isolation of complete GraphQL documents.
*
* Consider providing the results to the utility function: valueFromAST().
*/

@@ -65,2 +69,21 @@ function parseValue(source, options) {

/**
* Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for
* that type.
* Throws GraphQLError if a syntax error is encountered.
*
* This is useful within tools that operate upon GraphQL Types directly and
* in isolation of complete GraphQL documents.
*
* Consider providing the results to the utility function: typeFromAST().
*/
function parseType(source, options) {
var sourceObj = typeof source === 'string' ? new _source.Source(source) : source;
var lexer = (0, _lexer.createLexer)(sourceObj, options || {});
expect(lexer, _lexer.TokenKind.SOF);
var type = parseTypeReference(lexer);
expect(lexer, _lexer.TokenKind.EOF);
return type;
}
/**
* Converts a name lex token into a name parse node.

@@ -205,3 +228,3 @@ */

variable: parseVariable(lexer),
type: (expect(lexer, _lexer.TokenKind.COLON), parseType(lexer)),
type: (expect(lexer, _lexer.TokenKind.COLON), parseTypeReference(lexer)),
defaultValue: skip(lexer, _lexer.TokenKind.EQUALS) ? parseValueLiteral(lexer, true) : null,

@@ -521,7 +544,7 @@ loc: loc(lexer, start)

*/
function parseType(lexer) {
function parseTypeReference(lexer) {
var start = lexer.token;
var type = void 0;
if (skip(lexer, _lexer.TokenKind.BRACKET_L)) {
type = parseType(lexer);
type = parseTypeReference(lexer);
expect(lexer, _lexer.TokenKind.BRACKET_R);

@@ -692,3 +715,3 @@ type = {

expect(lexer, _lexer.TokenKind.COLON);
var type = parseType(lexer);
var type = parseTypeReference(lexer);
var directives = parseDirectives(lexer);

@@ -722,3 +745,3 @@ return {

expect(lexer, _lexer.TokenKind.COLON);
var type = parseType(lexer);
var type = parseTypeReference(lexer);
var defaultValue = null;

@@ -725,0 +748,0 @@ if (skip(lexer, _lexer.TokenKind.EQUALS)) {

@@ -1,1 +0,1 @@

{"name":"graphql","version":"0.7.0","description":"A Query Language and Runtime which can target any service.","contributors":["Lee Byron <lee@leebyron.com> (http://leebyron.com/)","Nicholas Schrock <schrockn@fb.com>","Daniel Schafer <dschafer@fb.com>"],"license":"BSD-3-Clause","main":"index.js","homepage":"https://github.com/graphql/graphql-js","bugs":{"url":"https://github.com/graphql/graphql-js/issues"},"repository":{"type":"git","url":"http://github.com/graphql/graphql-js.git"},"dependencies":{"iterall":"1.0.2"}}
{"name":"graphql","version":"0.7.1","description":"A Query Language and Runtime which can target any service.","contributors":["Lee Byron <lee@leebyron.com> (http://leebyron.com/)","Nicholas Schrock <schrockn@fb.com>","Daniel Schafer <dschafer@fb.com>"],"license":"BSD-3-Clause","main":"index.js","homepage":"https://github.com/graphql/graphql-js","bugs":{"url":"https://github.com/graphql/graphql-js/issues"},"repository":{"type":"git","url":"http://github.com/graphql/graphql-js.git"},"dependencies":{"iterall":"1.0.2"}}
# GraphQL.js
This is a technical preview of the JavaScript reference implementation for
GraphQL, a query language created by Facebook for describing data requirements
on complex application data models.
The JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook.

@@ -12,36 +10,7 @@ [![npm version](https://badge.fury.io/js/graphql.svg)](http://badge.fury.io/js/graphql)

See more complete documentation at http://graphql.org/ and
http://graphql.org/docs/api-reference-graphql/.
http://graphql.org/graphql-js/.
For questions, ask [Stack Overflow](http://stackoverflow.com/questions/tagged/graphql).
Looking for help? Find resources [from the community](http://graphql.org/community/).
For discussion, join [#graphql on Discord](http://join.reactiflux.com/).
## Technical Preview Contents
This technical preview contains a [draft specification for GraphQL]
(https://github.com/facebook/graphql) and a reference implementation in
JavaScript that implements that draft, GraphQL.js.
The reference implementation provides base libraries in JavaScript that would
provide the basis for full GraphQL implementations and tools. It is not a fully
standalone GraphQL server that a client developer could use to start
manipulating and querying data. Most importantly, it provides no mapping to a
functioning, production-ready backend. The only "backend" we have targeted for
this early preview are in-memory stubs in test cases.
We are releasing this now because after GraphQL was first discussed publicly,
many engineers used this information to implement the parts of the system that
we discussed publicly. We want to support those engineers by providing both a
formal specification and a reference implementation for the system as a whole.
To that end, the target audience is not the client developer, but those who have
built or are actively interested in building their own GraphQL implementations and
tools. Critically, we also want feedback on the system and to incorporate that
feedback in our final release.
In order to be broadly adopted, GraphQL will have to target a wide
variety of backends, frameworks, and languages, which will necessitate a
collaborative effort across projects and organizations. This technical preview
marks the beginning of that process.
## Getting Started

@@ -48,0 +17,0 @@

@@ -275,6 +275,7 @@ 'use strict';

var fieldConfig = fieldMap[fieldName];
(0, _invariant2.default)(!fieldConfig.hasOwnProperty('isDeprecated'), type.name + '.' + fieldName + ' should provide "deprecationReason" instead ' + 'of "isDeprecated".');
var field = _extends({}, fieldConfig, {
isDeprecated: Boolean(fieldConfig.deprecationReason),
name: fieldName
});
(0, _invariant2.default)(!field.hasOwnProperty('isDeprecated'), type.name + '.' + fieldName + ' should provide "deprecationReason" instead ' + 'of "isDeprecated".');
(0, _invariant2.default)(isOutputType(field.type), type.name + '.' + fieldName + ' field type must be Output Type but ' + ('got: ' + String(field.type) + '.'));

@@ -523,2 +524,3 @@ var argsConfig = fieldConfig.args;

description: value.description,
isDeprecated: Boolean(value.deprecationReason),
deprecationReason: value.deprecationReason,

@@ -525,0 +527,0 @@ value: (0, _isNullish2.default)(value.value) ? valueName : value.value

@@ -337,3 +337,3 @@ 'use strict';

resolve: function resolve(field) {
return !(0, _isNullish2.default)(field.deprecationReason);
return field.isDeprecated;
}

@@ -377,3 +377,3 @@ },

resolve: function resolve(enumValue) {
return !(0, _isNullish2.default)(enumValue.deprecationReason);
return enumValue.isDeprecated;
}

@@ -380,0 +380,0 @@ },

@@ -10,4 +10,8 @@ 'use strict';

var _language = require('../language');
var _kinds = require('../language/kinds');
var Kind = _interopRequireWildcard(_kinds);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
// As per the GraphQL Spec, Integers are only treated as valid when a valid

@@ -32,2 +36,5 @@ // 32-bit signed integer, providing the broadest support across platforms.

function coerceInt(value) {
if (value === '') {
throw new TypeError('Int cannot represent non 32-bit signed integer value: (empty string)');
}
var num = Number(value);

@@ -46,3 +53,3 @@ if (num === num && num <= MAX_INT && num >= MIN_INT) {

parseLiteral: function parseLiteral(ast) {
if (ast.kind === _language.Kind.INT) {
if (ast.kind === Kind.INT) {
var num = parseInt(ast.value, 10);

@@ -58,2 +65,5 @@ if (num <= MAX_INT && num >= MIN_INT) {

function coerceFloat(value) {
if (value === '') {
throw new TypeError('Float cannot represent non numeric value: (empty string)');
}
var num = Number(value);

@@ -72,3 +82,3 @@ if (num === num) {

parseLiteral: function parseLiteral(ast) {
return ast.kind === _language.Kind.FLOAT || ast.kind === _language.Kind.INT ? parseFloat(ast.value) : null;
return ast.kind === Kind.FLOAT || ast.kind === Kind.INT ? parseFloat(ast.value) : null;
}

@@ -83,3 +93,3 @@ });

parseLiteral: function parseLiteral(ast) {
return ast.kind === _language.Kind.STRING ? ast.value : null;
return ast.kind === Kind.STRING ? ast.value : null;
}

@@ -94,3 +104,3 @@ });

parseLiteral: function parseLiteral(ast) {
return ast.kind === _language.Kind.BOOLEAN ? ast.value : null;
return ast.kind === Kind.BOOLEAN ? ast.value : null;
}

@@ -105,4 +115,4 @@ });

parseLiteral: function parseLiteral(ast) {
return ast.kind === _language.Kind.STRING || ast.kind === _language.Kind.INT ? ast.value : null;
return ast.kind === Kind.STRING || ast.kind === Kind.INT ? ast.value : null;
}
});

@@ -205,3 +205,3 @@ 'use strict';

if (type instanceof _definition.GraphQLObjectType || type instanceof _definition.GraphQLInterfaceType || type instanceof _definition.GraphQLInputObjectType) {
if (type instanceof _definition.GraphQLObjectType || type instanceof _definition.GraphQLInterfaceType) {
(function () {

@@ -223,2 +223,12 @@ var fieldMap = type.getFields();

if (type instanceof _definition.GraphQLInputObjectType) {
(function () {
var fieldMap = type.getFields();
Object.keys(fieldMap).forEach(function (fieldName) {
var field = fieldMap[fieldName];
reducedMap = typeMapReducer(reducedMap, field.type);
});
})();
}
return reducedMap;

@@ -225,0 +235,0 @@ }

@@ -42,3 +42,3 @@ 'use strict';

if (type.ofType.name) {
return ['Expected "' + type.ofType.name + '!", found null.'];
return ['Expected "' + String(type.ofType.name) + '!", found null.'];
}

@@ -45,0 +45,0 @@ return ['Expected non-null value, found null.'];

@@ -50,3 +50,3 @@ 'use strict';

if (type.ofType.name) {
return ['Expected "' + type.ofType.name + '!", found null.'];
return ['Expected "' + String(type.ofType.name) + '!", found null.'];
}

@@ -53,0 +53,0 @@ return ['Expected non-null value, found null.'];

@@ -55,3 +55,3 @@ 'use strict';

// If superType is non-null, maybeSubType must also be nullable.
// If superType is non-null, maybeSubType must also be non-null.
if (superType instanceof _definition.GraphQLNonNull) {

@@ -63,3 +63,3 @@ if (maybeSubType instanceof _definition.GraphQLNonNull) {

} else if (maybeSubType instanceof _definition.GraphQLNonNull) {
// If superType is nullable, maybeSubType may be non-null.
// If superType is nullable, maybeSubType may be non-null or nullable.
return isTypeSubTypeOf(schema, maybeSubType.ofType, superType);

@@ -66,0 +66,0 @@ }

@@ -38,3 +38,3 @@ 'use strict';

* A GraphQL document is only valid if all fields selected are defined by the
* parent type, or are an allowed meta field such as __typenamme
* parent type, or are an allowed meta field such as __typename.
*/

@@ -41,0 +41,0 @@

@@ -489,3 +489,3 @@ 'use strict';

var typeCondition = selection.typeCondition;
var inlineFragmentType = typeCondition ? (0, _typeFromAST.typeFromAST)(context.getSchema(), selection.typeCondition) : parentType;
var inlineFragmentType = typeCondition ? (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition) : parentType;
_collectFieldsAndFragmentNames(context, inlineFragmentType, selection.selectionSet, astAndDefs, fragmentNames);

@@ -492,0 +492,0 @@ break;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc