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

graphql-client

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-client - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

10

index.js

@@ -34,10 +34,2 @@ function highlightQuery (query, errors) {

function GraphqlError(query, errors) {
var e = new Error(errors.map(function (e) { return e.message }).join('\n') + '\n' + highlightQuery(query, errors))
e.originalErrors = errors
return e
}
module.exports = function (params) {

@@ -70,3 +62,3 @@ require('isomorphic-fetch')

if (body.errors && body.errors.length) {
throw new GraphqlError(query, body.errors)
body.highlightQuery = highlightQuery(query, body.errors)
}

@@ -73,0 +65,0 @@

4

package.json
{
"name": "graphql-client",
"version": "1.1.0",
"version": "2.0.0",
"description": "",

@@ -17,4 +17,4 @@ "main": "index.js",

"dependencies": {
"isomorphic-fetch": "2.2.1"
"isomorphic-fetch": "^2.2.1"
}
}

@@ -19,3 +19,3 @@ # Simple GraphQL Client

headers: {
Authentication: 'Bearer ' + token
Authorization: 'Bearer ' + token
}

@@ -30,3 +30,9 @@ })

```javascript
var query = `
var variables = {
query: "Search Query",
limit: 100,
from: 200
}
client.query(`
query search ($query: String, $from: Int, $limit: Int) {

@@ -40,13 +46,5 @@ search(query: $query, from: $from, limit: $limit) {

}
}`
var variables = {
query: "Search Query",
limit: 100,
from: 200
}
client.query(query, variables, function optionalCallback(req, res) {
if(res.headers.get('x-powered-by') === 'Express') {
throw new Error("Don't want conten served from express")
}`, variables, function(req, res) {
if(res.status === 401) {
throw new Error('Not authorized')
}

@@ -53,0 +51,0 @@ })

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