@graphql-mesh/transport-sqlite
Version:
16 lines (15 loc) • 625 B
JavaScript
import { createDefaultExecutor, } from '@graphql-mesh/transport-common';
import { mapMaybePromise } from '@graphql-tools/utils';
import { loadGraphQLSchemaFromOptions } from '@omnigraph/sqlite';
export default {
getSubgraphExecutor({ cwd, transportEntry }) {
const loaderOpts = { cwd };
if (transportEntry.options.type === 'infile') {
loaderOpts.infile = transportEntry.location;
}
else {
loaderOpts.db = transportEntry.location;
}
return mapMaybePromise(loadGraphQLSchemaFromOptions(loaderOpts), schema => createDefaultExecutor(schema));
},
};