# egraphql-fetch

> Thin symmetrically encrypted GraphQL client powered by fetch

Latest version **0.2.0** (published 2017-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install egraphql-fetch
pnpm add egraphql-fetch
yarn add egraphql-fetch
bun add egraphql-fetch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-01-18 |
| First published | 2017-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Martin Heidegger |
| Maintainers | leichtgewicht |
| Keywords | graphql, client, fetch, request, query, mutation |

## Links

- npm: https://www.npmjs.com/package/egraphql-fetch
- Repository: https://github.com/martinheidegger/egraphql-fetch
- Issues: https://github.com/martinheidegger/egraphql-fetch/issues
- npm.io page: https://npm.io/package/egraphql-fetch

## Dependencies (3)

- [101](https://npm.io/package/101.md) ^1.5.0
- [simple-random](https://npm.io/package/simple-random.md) ^1.0.3
- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^2.2.1

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2017-01-18
- 0.1.0 — 2017-01-18
- 0.0.8 — 2017-01-16
- 0.0.7 — 2017-01-15
- 0.0.6 — 2017-01-07
- 0.0.5 — 2017-01-06
- 0.0.4 — 2017-01-06
- 0.0.3 — 2017-01-05
- 0.0.2 — 2017-01-05
- 0.0.1 — 2017-01-05

## README

# graphql-fetch [![Build Status](https://travis-ci.org/martinheidegger/egraphql-fetch.svg?branch=master)](https://travis-ci.org/martinheidegger/egraphql-fetch) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
Thin, **symmetrically encrypted**, GraphQL client powered by fetch.

_(Based on the great work of [tjmehta](https://github.com/tjmehta) and compatible with [graphql-fetch](https://github.com/tjmehta/graphql-fetch))_

# Installation
```bash
npm i --save egraphql-fetch
```

# Usage
```js
var fetch = require('graphql-fetch')(
  'http://domain.com/graphql',
  'keyId', //         ... ID for the key (could be user-name)
  'secretKey', //     ... Secret Key to encrypt the data (could be password)
  // cipherAlgorithm, ... Cipher algorithm used to encrypt the request (default: aes256)
  // cipherPad        ... Padding to make traffic guessing harder (defaults: 1024)
)

var query = `
  query q (id: String!) {
    user(id: $id) {
      id,
      email,
      name
    }
  }
`
var queryVars = {
  id: 'abcdef'
}
var opts = {
  // custom fetch options
}

/**
 * @param  {Query} query graphql query
 * @param  {Object} [vars]  graphql query args, optional
 * @param  {Object} [opts]  fetch options, optional
 */
fetch(query, queryVars, opts).then(function (results) {
  if (results.errors) {
    //...
    return
  }
  var user = result.data.user
  //...
})
```

# Notes
* Uses [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) under the hood, which makes `fetch`, `Headers`, `Request`, and `Response` globally available.

# License
MIT

---
_Source: https://npm.io/package/egraphql-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
