graphql-query-factory
Advanced tools
Comparing version 1.0.22 to 1.0.23
@@ -26,3 +26,3 @@ ### Todo | ||
#### Version <= 1.0 | ||
#### Version == 1.0.x | ||
* [x] `lib`: make batchQueryExecute loop over original after target array is completed (currently truncates after initial execution) | ||
@@ -36,3 +36,3 @@ * [x] `lib`: Fix issue with string literals in built query stirngs | ||
#### Version == 2.0 | ||
#### Version == 1.1.x | ||
* [ ] `docs`: Add output source in README towards bottom of file (so doesn't obscure example) | ||
@@ -47,3 +47,3 @@ * [ ] `docs`: Add CLI screenshot and graphcool screenshot to [graphql-query-factory-test](https://github.com/alechp/graphql-query-factory-test) | ||
#### Version >= 2.0 | ||
#### Version == 1.2.x | ||
* [ ] `lib`: Flow errors fixed | ||
@@ -50,0 +50,0 @@ * [ ] `lib`: create flow-typed libdef for graphql-query-factory |
{ | ||
"name": "graphql-query-factory", | ||
"version": "1.0.22", | ||
"version": "1.0.23", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
181
readme.md
@@ -5,4 +5,4 @@ # GraphQL Query Batcher | ||
## Status | ||
* `factory` included as of 1.20.0 (shim around builder and batcher) | ||
* `batcher` included as of 1.20.0 (executes array of queries) | ||
* `factory` included as of 1.0.20 (shim around builder and batcher) | ||
* `batcher` included as of 1.0.20 (executes array of queries) | ||
* `builder` updated (this builds query strings from query/mutation and variables) | ||
@@ -19,2 +19,7 @@ | ||
### Configuration (Environment Variables) | ||
When using `factory` or `batcher` you must include two environment variables: | ||
* `GQL_SIMPLE_ENDPOINT` | ||
* `GQL_AUTH_TOKEN` | ||
### Examples | ||
@@ -66,22 +71,164 @@ > All of these examples can be seen at [graphql-query-factory-test](https://github.com/alechp/graphql-query-factory-test) | ||
#### Visual of data being saved to GraphQL database | ||
### Output | ||
> The following output is generated by the example project, [graphql-query-factory-test](https://github.com/alechp/graphql-query-factory-test) | ||
#### Data being saved to Graph.cool | ||
 | ||
#### builder | ||
``` | ||
mutation { | ||
createContent( | ||
markup: "markupA" | ||
raw: "rawA" | ||
) { | ||
markup | ||
raw | ||
} | ||
},mutation { | ||
createContent( | ||
markup: "markupB" | ||
raw: "rawB" | ||
) { | ||
markup | ||
raw | ||
} | ||
},mutation { | ||
createContent( | ||
markup: "markupC" | ||
raw: "rawC" | ||
) { | ||
markup | ||
raw | ||
} | ||
},mutation { | ||
createContent( | ||
markup: "markupD" | ||
raw: "rawD" | ||
) { | ||
markup | ||
raw | ||
} | ||
},mutation { | ||
createContent( | ||
markup: "markupE" | ||
raw: "rawE" | ||
) { | ||
markup | ||
raw | ||
} | ||
},mutation { | ||
createContent( | ||
markup: "markupF" | ||
raw: "rawF" | ||
) { | ||
markup | ||
raw | ||
} | ||
},mutation { | ||
createContent( | ||
markup: "markupG" | ||
raw: "rawG" | ||
) { | ||
markup | ||
raw | ||
} | ||
} | ||
``` | ||
##### Configuration (Environment Variables) | ||
#### batcher | ||
```json | ||
[ | ||
{ | ||
"createContent": { | ||
"markup": "markupA", | ||
"raw": "rawA" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupB", | ||
"raw": "rawB" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupC", | ||
"raw": "rawC" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupD", | ||
"raw": "rawD" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupE", | ||
"raw": "rawE" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupF", | ||
"raw": "rawF" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupG", | ||
"raw": "rawG" | ||
} | ||
} | ||
] | ||
``` | ||
When using `factory` or `batcher` you must include two environment variables: | ||
* `GQL_SIMPLE_ENDPOINT` | ||
* `GQL_AUTH_TOKEN` | ||
#### factory | ||
If you don't already have a method for this, you can: | ||
1. Create `.env` file in your root directory | ||
2. `npm install dotenv -S` | ||
3. add `require('dotenv').config()` at entry point (i.e. index/main) of your project | ||
4. define variables like so: | ||
```json | ||
[ | ||
{ | ||
"createContent": { | ||
"markup": "markupA", | ||
"raw": "rawA" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupB", | ||
"raw": "rawB" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupC", | ||
"raw": "rawC" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupD", | ||
"raw": "rawD" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupE", | ||
"raw": "rawE" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupF", | ||
"raw": "rawF" | ||
} | ||
}, | ||
{ | ||
"createContent": { | ||
"markup": "markupG", | ||
"raw": "rawG" | ||
} | ||
} | ||
] | ||
``` | ||
GQL_SIMPLE_ENDPOINT=http://api.endpoint.goes.here/12345 | ||
GQL_AUTH_TOKEN=longobscuretoken1290239809 | ||
``` | ||
^ note that there's no quotation marks |
138281
232