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

graphql

Package Overview
Dependencies
Maintainers
3
Versions
259
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.4.1 to 0.4.2

84

error/GraphQLError.js

@@ -30,3 +30,3 @@

// A flow bug keeps us from declaring nodes as an array of Node
nodes, /* Node */stack) {
nodes, /* Node */stack, source, positions) {
_classCallCheck(this, GraphQLError);

@@ -36,47 +36,53 @@

this.message = message;
Object.defineProperty(this, 'stack', { value: stack || message });
Object.defineProperty(this, 'nodes', { value: nodes });
}
// Note: flow does not yet know about Object.defineProperty with `get`.
return GraphQLError;
})(Error);
// Note: flow does not yet know about Object.defineProperty with `get`.
Object.defineProperty(this, 'source', {
get: function get() {
if (source) {
return source;
}
if (nodes && nodes.length > 0) {
var node = nodes[0];
return node && node.loc && node.loc.source;
}
}
});
exports.GraphQLError = GraphQLError;
Object.defineProperty(GraphQLError.prototype, 'source', {
get: function get() {
var nodes = this.nodes;
if (nodes && nodes.length > 0) {
var node = nodes[0];
return node && node.loc && node.loc.source;
}
}
});
Object.defineProperty(this, 'positions', {
get: function get() {
if (positions) {
return positions;
}
if (nodes) {
var nodePositions = nodes.map(function (node) {
return node.loc && node.loc.start;
});
if (nodePositions.some(function (p) {
return p;
})) {
return nodePositions;
}
}
}
});
Object.defineProperty(GraphQLError.prototype, 'positions', {
get: function get() {
var nodes = this.nodes;
if (nodes) {
var positions = nodes.map(function (node) {
return node.loc && node.loc.start;
});
if (positions.some(function (p) {
return p;
})) {
return positions;
Object.defineProperty(this, 'locations', {
get: function get() {
var _this = this;
if (this.positions && this.source) {
return this.positions.map(function (pos) {
return (0, _language.getLocation)(_this.source, pos);
});
}
}
}
});
}
});
Object.defineProperty(GraphQLError.prototype, 'locations', {
get: function get() {
var positions = this.positions;
var source = this.source;
if (positions && source) {
return positions.map(function (pos) {
return (0, _language.getLocation)(source, pos);
});
}
}
});
return GraphQLError;
})(Error);
exports.GraphQLError = GraphQLError;

@@ -29,7 +29,3 @@

var location = (0, _languageLocation.getLocation)(source, position);
var error = new _GraphQLError.GraphQLError('Syntax Error ' + source.name + ' (' + location.line + ':' + location.column + ') ' + description + '\n\n' + highlightSourceAtLocation(source, location));
error.nodes = null;
error.positions = [position];
error.locations = [location];
error.source = source;
var error = new _GraphQLError.GraphQLError('Syntax Error ' + source.name + ' (' + location.line + ':' + location.column + ') ' + description + '\n\n' + highlightSourceAtLocation(source, location), undefined, undefined, source, [position]);
return error;

@@ -36,0 +32,0 @@ }

{
"name": "graphql",
"version": "0.4.1",
"version": "0.4.2",
"description": "A Query Language and Runtime which can target any service.",

@@ -5,0 +5,0 @@ "contributors": [

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