This is a translator for graysql-orm-loader that will translate the models defined in Waterline to a valid GraphQL schema.
PD: If you want a simpler way to integrate this with a Sails.js application, take a look at sails-hook-graysql.
Install it from npm. Make sure to install its peer-dependencies as well.
$ npm install graysql-orm-waterline
Here is an example using Sails.js and Waterline.
const GraysQL = require('graysql');
const ORMLoader = require('graysql-orm-loader');
const WaterlineTranslator = require('graysql-orm-loader-waterline');
const GQL = new GraysQL();
GQL.use(ORMLoader);
GQL.loadFromORM(new WaterlineTranslator(sails.models));
const Schema = GQL.generateSchema();
Usage example can be found in example directory.
The tests are written with mocha and can be run with the following command:
$ npm test
To get code coverage reports, run the following command:
$ npm run cover