How to use the ember-graphql-adapter/generator.generate function in ember-graphql-adapter

To help you get started, we’ve selected a few ember-graphql-adapter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alphasights / ember-graphql-adapter / addon / compiler.js View on Github external
compile(model, store, options) {
    options = options || {};

    let operationType = options['operationType']; // TODO: Must be query or mutation
    let operationName = options['operationName'];
    let operation = new Operation(operationType, operationName);

    let rootFieldQuery = options['rootFieldQuery'] || {};
    let rootFieldName = options['rootFieldName'] || model.modelName;
    let rootFieldAlias = options['rootFieldAlias'];
    let rootField = new Field(rootFieldName, rootFieldAlias, ArgumentSet.fromQuery(rootFieldQuery));

    Parser.parse(model, store, operation, rootField, options);

    return Generator.generate(operation);
  }
};