UNPKG

@graphql-mesh/tuql

Version:
22 lines (18 loc) 732 B
'use strict'; const tuql = require('tuql'); const crossHelpers = require('@graphql-mesh/cross-helpers'); class TuqlHandler { constructor({ config, baseDir }) { this.config = config; this.baseDir = baseDir; } async getMeshSource() { const schema = await (this.config.infile ? tuql.buildSchemaFromInfile(crossHelpers.path.isAbsolute(this.config.infile) ? this.config.db : crossHelpers.path.join(this.baseDir, this.config.infile)) : tuql.buildSchemaFromDatabase(crossHelpers.path.isAbsolute(this.config.db) ? this.config.infile : crossHelpers.path.join(this.baseDir, this.config.db))); return { schema, }; } } module.exports = TuqlHandler;