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