graphql-http
Advanced tools
Comparing version 0.0.5 to 0.1.0
{ | ||
"name": "graphql-http", | ||
"version": "0.0.5", | ||
"version": "0.1.0", | ||
"description": "A GraphQL client for executing GraphQL queries over HTTP.", | ||
"main": "index.dist.js", | ||
"scripts": { | ||
"dev": "babel --watch index.js --out-file index.dist.js" | ||
"test": "eslint lib && jest" | ||
}, | ||
@@ -28,14 +27,12 @@ "repository": { | ||
"dependencies": { | ||
"axios": "^0.11.0" | ||
"isomorphic-fetch": "^2.2.1", | ||
"lodash.merge": "^4.0.0" | ||
}, | ||
"peerDependencies": {}, | ||
"devDependencies": { | ||
"babel-cli": "^6.6.5", | ||
"babel-eslint": "^6.0.0", | ||
"babel-plugin-transform-runtime": "^6.8.0", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"babel-runtime": "^6.6.1", | ||
"eslint": "^2.4.0" | ||
"eslint": "^3.9.0", | ||
"eslint-config-semistandard": "^7.0.0", | ||
"fetch-mock": "^5.5.0", | ||
"jest": "^16.0.2" | ||
} | ||
} |
@@ -8,12 +8,47 @@ # graphql-http | ||
```javascript | ||
import graphQLHTTP from 'graphql-http' | ||
```js | ||
import { GQLClient } from 'graphql-http'; | ||
const client = graphQLHTTP('http://localhost:3000'); | ||
const client = GQLClient('http://localhost:3000', { | ||
// anything passed here is merged with | ||
// the options passed to fetch() | ||
credentials: true, | ||
headers: { | ||
'X-Requested-With': 'XMLHttpRequest' | ||
} | ||
}); | ||
``` | ||
// Queries | ||
let resultPromise = c.query('{ users { id, name }}'); | ||
Queries | ||
// Mutations | ||
let resultPromise = c.mutate('mutation {updateUser}'); | ||
```js | ||
client.query(` | ||
query ($id: RecordID!) { | ||
user(id: $id) { | ||
id | ||
name | ||
} | ||
} | ||
`, { id: 1234 }).then((result) => { | ||
console.log(result.data.user); | ||
// => { id: 1234, name: ... } | ||
}); | ||
``` | ||
Mutations | ||
```js | ||
client.mutate(` | ||
mutation ($id: RecordID!, $name: String!) { | ||
updateUser(input: {id: $id, name: $name}) { | ||
user { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
`, { id: 1234, name: 'Danny' }).then((result) => { | ||
console.log(result.data.user); | ||
// => { id: 1234, name: 'Danny' } | ||
}); | ||
``` |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
9843
4
8
211
54
2
3
+ Addedisomorphic-fetch@^2.2.1
+ Addedlodash.merge@^4.0.0
+ Addedencoding@0.1.13(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addedlodash.merge@4.6.2(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)
- Removedaxios@^0.11.0
- Removedaxios@0.11.1(transitive)
- Removeddebug@2.6.9(transitive)
- Removedfollow-redirects@0.0.7(transitive)
- Removedms@2.0.0(transitive)
- Removedstream-consume@0.1.1(transitive)