# neutron-graph

> A small GraphQL Query generator

Latest version **3.5.0** (published 2018-10-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install neutron-graph
pnpm add neutron-graph
yarn add neutron-graph
bun add neutron-graph
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.5.0 |
| Published | 2018-10-01 |
| First published | 2016-12-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Paul Bailey |
| Maintainers | pizzapanther |
| Keywords | graphql, graphene |

## Links

- npm: https://www.npmjs.com/package/neutron-graph
- Repository: https://github.com/pizzapanther/pizzapanther.github.io
- Homepage: https://github.com/pizzapanther/pizzapanther.github.io/tree/master/libs/neutron-graph
- Issues: https://github.com/pizzapanther/pizzapanther.github.io/issues
- npm.io page: https://npm.io/package/neutron-graph

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 3.5.0 (latest) — 2018-10-01
- 3.4.0 — 2017-12-15
- 3.3.0 — 2017-11-26
- 3.2.0 — 2017-11-26
- 3.1.0 — 2017-10-21
- 3.0.3 — 2017-10-21
- 3.0.2 — 2017-10-21
- 3.0.1 — 2017-10-21
- 3.0.0 — 2017-10-21
- 2.2.0 — 2017-08-21
- 2.1.0 — 2017-07-30
- 2.0.0 — 2017-07-21
- 1.0.1 — 2017-07-16
- 1.0.0 — 2017-07-03
- 0.5.2 — 2017-06-09
- … 10 more at https://npm.io/package/neutron-graph/versions

## README

# Neutron-Graph
A small GraphQL Query generator

## Requirements

- Promise based HTTP client (Default: Axios or $http for Angular)
- ES6 style Promises (Default: Promise or $q for Angular)

## ES5 Usage

Usage:

```javascript
var neutron_graph = require('neutron-graph');
GraphAPI = neutron_graph.default('/graphql', {http: $http, promise: $q});

var query = {
  allSchedules {
    filters: {user_RemoteUserId: 5},
    edges: {node: ['id', 'sunday', 'monday']}
  }
};

GraphAPI().data_graph().query(query).submit().then(function(response) {
  console.log(response.data.allSchedules.nodes());
}).catch(function(error) {
  console.log(error);
});
```

## ES6 Usage

```javascript
import DataGraph from 'neutron-graph';

var verses;
var GraphAPI = DataGraph('/data-graph');

var query = {
  allVerses: {
    filters: {book_Slug: 'my-book', chapter: 2},
    edges: {node: ['text', 'verse']}
  }
};

GraphAPI().query(query).submit().then(function (result) {
  verses = result.data.allVerses.nodes();
}).catch(function (error) {
  console.error(error);
});
```

## API

### Chaining

```javascript
var GraphAPI = DataGraph('/data-graph');
var promise = GraphAPI().query(query1).query(query2).get(query3).submit();
```

Result will contain an attribute for each node name.

Example: `result.data.AllVerses, result.data.AllChapters, result.data.Chapter`

### Query Methods

|Name|Description|
|------|-----------|
|query()|Query that contains multiple results|
|get()|Query by ID. Supply base64 `{id}` or `{name, id}` to generate id|


### QueryResult Attributes

|Name|Description|
|------|-----------|
|data|DataTransformer objects named by node names|
|query|original text query generated|
|response|original response object|


### DataTransformer Methods and Attributes

|Name|Description|
|------|-----------|
|data|original data|
|nodes()|list data extracted from edges list and node object|
|first()|get first node and return it|
|last()|get last node and return it|

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