|
| 1 | +[WIP] graphql-compose-aws |
| 2 | +====================== |
| 3 | + |
| 4 | +[](https://www.npmjs.com/package/graphql-compose-aws) |
| 5 | +[](http://www.npmtrends.com/graphql-compose-aws) |
| 6 | +[](https://travis-ci.org/graphql-compose/graphql-compose-aws) |
| 7 | +[](http://commitizen.github.io/cz-cli/) |
| 8 | +[](https://github.com/semantic-release/semantic-release) |
| 9 | +[](https://greenkeeper.io/) |
| 10 | + |
| 11 | +This module expose AWS SDK API via GraphQL. |
| 12 | + |
| 13 | +## AWS SDK GraphQL |
| 14 | + |
| 15 | +Supported all AWS SDK versions that support official [aws-sdk](https://github.com/aws/aws-sdk-js) client. Internally it parses api schema files and generates all available methods with params and descriptions to GraphQL Field Config Map. You may put this config map to any GraphQL Schema. |
| 16 | + |
| 17 | +```js |
| 18 | +import { GraphQLSchema, GraphQLObjectType } from 'graphql'; |
| 19 | +import elasticsearch from 'elasticsearch'; |
| 20 | +import { elasticApiFieldConfig } from 'graphql-compose-aws'; |
| 21 | + |
| 22 | +const schema = new GraphQLSchema({ |
| 23 | + query: new GraphQLObjectType({ |
| 24 | + name: 'Query', |
| 25 | + fields: { |
| 26 | + elastic50: elasticApiFieldConfig( |
| 27 | + // you may provide existed Elastic Client instance |
| 28 | + new elasticsearch.Client({ |
| 29 | + host: 'http://localhost:9200', |
| 30 | + apiVersion: '5.0', |
| 31 | + }) |
| 32 | + ), |
| 33 | + |
| 34 | + // or may provide just config |
| 35 | + elastic24: elasticApiFieldConfig({ |
| 36 | + host: 'http://user:pass@localhost:9200', |
| 37 | + apiVersion: '2.4', |
| 38 | + }), |
| 39 | + |
| 40 | + elastic17: elasticApiFieldConfig({ |
| 41 | + host: 'http://user:pass@localhost:9200', |
| 42 | + apiVersion: '1.7', |
| 43 | + }), |
| 44 | + }, |
| 45 | + }), |
| 46 | +}); |
| 47 | +``` |
| 48 | + |
| 49 | +Full [code example](https://github.com/graphql-compose/graphql-compose-aws/tree/master/examples/) |
| 50 | + |
| 51 | +Live demo of [Introspection of AWS SDK API via Graphiql](https://graphql-compose.herokuapp.com/aws/) |
| 52 | + |
| 53 | +## Installation |
| 54 | +``` |
| 55 | +yarn add graphql graphql-compose aws-sdk graphql-compose-aws |
| 56 | +// or |
| 57 | +npm install graphql graphql-compose aws-sdk graphql-compose-aws --save |
| 58 | +``` |
| 59 | +Modules `graphql`, `graphql-compose`, `aws-sdk` are in `peerDependencies`, so should be installed explicitly in your app. |
| 60 | + |
| 61 | +## Screenshots |
| 62 | + |
| 63 | +### API proxy: Raw search method |
| 64 | +<img width="1316" alt="screen shot 2017-03-07 at 22 26 17" src="https://cloud.githubusercontent.com/assets/1946920/23859886/61066f40-082f-11e7-89d0-8443aa2ae930.png"> |
| 65 | + |
| 66 | +### API proxy: Getting several raw elastic metric in one request |
| 67 | +<img width="1314" alt="screen shot 2017-03-07 at 22 34 01" src="https://cloud.githubusercontent.com/assets/1946920/23859892/65e71744-082f-11e7-8c1a-cafeb87e08e6.png"> |
| 68 | + |
| 69 | +### Mapping: Relay Cursor Connection |
| 70 | +<img width="1411" alt="screen shot 2017-03-22 at 19 34 09" src="https://cloud.githubusercontent.com/assets/1946920/24200219/a058c220-0f36-11e7-9cf1-38394052f922.png"> |
| 71 | + |
| 72 | +### Mapping: Generated GraphQL Types and Documentation |
| 73 | +<img width="1703" alt="screen shot 2017-03-22 at 19 33 24" src="https://cloud.githubusercontent.com/assets/1946920/24200220/a05944b6-0f36-11e7-9919-39b7001af203.png"> |
| 74 | + |
| 75 | + |
| 76 | +## License |
| 77 | +[MIT](https://github.com/graphql-compose/graphql-compose-aws/blob/master/LICENSE.md) |
0 commit comments