Socket
Socket
Sign inDemoInstall

@xialvjun/tiny-graphql-client

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.6 to 0.0.7

es/index.js

49

package.json
{
"name": "@xialvjun/tiny-graphql-client",
"version": "0.0.6",
"description": "a tiny, simple and customable graphql client, only support `query` and `mutation` now.",
"version": "0.0.7",
"description":
"a tiny, simple and customable graphql client, only support `query` and `mutation` now.",
"repository": "github:xialvjun/tiny-graphql-client",
"keywords": ["graphql", "client", "simple", "tiny"],
"----------------": "----------------",
"peerDependencies": {},
"devDependencies": {
"rimraf": "^2.6.2",
"typescript": "^2.8.3"
},
"dependencies": {},
"================": "================",
"author": "xialvjun@live.com",
"license": "MIT",
"++++++++++++++++": "++++++++++++++++",
"files": ["src/", "es/", "lib/", "dist/", "types/"],
"-esnext": "esnext_source_code_not_ts",
"module": "es/index.js",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"-unpkg": "dist/index.js",
"-jsdelivr": "dist/index.js",
"types": "types/index.d.ts",
"################": "################",
"scripts": {
"build": "tsc",
"build":
"npm run build:es && npm run build:lib && npm run build:dist && npm run build:types",
"build:es": "rimraf -r es && tsc --outDir es --module es6",
"build:lib": "rimraf -r lib && tsc --outDir lib --module commonjs",
"build:dist": "rimraf -r dist && echo not_implemented",
"build:types":
"rimraf -r types && tsc --outDir types --declaration --emitDeclarationOnly",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/xialvjun/tiny-graphql-client.git"
},
"keywords": [
"graphql",
"client",
"simple",
"tiny"
],
"author": "xialvjun@live.com",
"license": "MIT",
"devDependencies": {
"typescript": "^2.8.3"
}
}

@@ -1,5 +0,9 @@

### a tiny, simple and customable graphql client
# tiny-graphql-client
A tiny, simple and customable graphql client, only support `query` and `mutation` now.
#### examples
## Install
`npm i @xialvjun/tiny-graphql-client` or `yarn add @xialvjun/tiny-graphql-client`
## examples
**extra_headers**

@@ -57,4 +61,18 @@

const client = create_client(your_custom_send_function);
client.register_fragment(`fragment person_fragment on Person { name, age }`);
client.run(`query me { me { ...person_fragment } }`).then(r => r.json()).then(r => console.log(r.data.me));
client.register_fragment(`
fragment person_fragment on Person {
id, name, age
}`);
client.register_fragment(`
fragment book_fragment on Book {
id, title, cover
author { ...person_fragment }
}`);
// and even nested fragments
client.run(`
query book($id: $ID!) {
book(id: $id) { ...book_fragment }
}`, { id: '123456789' })
.then(r => r.json())
.then(r => console.log(r.data.book));
```

@@ -61,0 +79,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc