31 Jan 2022
generates:
./generated/cartql.json:
schema: https://api.cartql.com
plugins:
- introspection
./generated/graphcms.json:
schema: https://api-eu-central-1.graphcms.com/v2/ckrvra12f06pb01z82dn2ebd4/master
plugins:
- introspection
const { buildClientSchema } = require("graphql");
const cartqlIntrospectionResult = require("./generated/cartql.json");
const graphcmsIntrospectionResult = require("./generated/graphcms.json");
const cartQLSchema = buildClientSchema(cartqlIntrospectionResult);
const graphcmsSchema = buildClientSchema(graphcmsIntrospectionResult);
const createRemoteSchema = async ({ schema, url, ...rest }) => {
const executor = async ({ document, variables }) => {
const query = typeof document === "string" ? document : print(document);
return await rawRequest(url, query, variables);
};
return wrapSchema({
schema,
executor,
...rest,
});
};