UNPKG

@graphql-mesh/tuql

Version:
20 lines (17 loc) 685 B
import { buildSchemaFromInfile, buildSchemaFromDatabase } from 'tuql'; import { path } from '@graphql-mesh/cross-helpers'; class TuqlHandler { constructor({ config, baseDir }) { this.config = config; this.baseDir = baseDir; } async getMeshSource() { const schema = await (this.config.infile ? buildSchemaFromInfile(path.isAbsolute(this.config.infile) ? this.config.db : path.join(this.baseDir, this.config.infile)) : buildSchemaFromDatabase(path.isAbsolute(this.config.db) ? this.config.infile : path.join(this.baseDir, this.config.db))); return { schema, }; } } export default TuqlHandler;