How to use the graphql-tools.introspectSchema function in graphql-tools

To help you get started, we’ve selected a few graphql-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github netlify / cli / src / functions-templates / js / graphql-gateway / graphql-gateway.js View on Github external
async function getSchema(endpoint) {
  // you can't use relative URLs within Netlify Functions so need a base URL
  // process.env.URL is one of many build env variables:
  // https://www.netlify.com/docs/continuous-deployment/#build-environment-variables
  // Netlify Dev only supports URL and DEPLOY URL for now
  const uri = process.env.URL + "/.netlify/functions/" + endpoint;
  const link = createHttpLink({ uri, fetch });
  const schema = await introspectSchema(link);
  const executableSchema = makeRemoteExecutableSchema({ schema, link });
  return executableSchema;
}
github jakelowen / nextjs_hasura_magic_login / utils / stitching.js View on Github external
const getRemoteSchema = async (uri, headers, linkOverRide = null) => {
  const link = makeHttpAndWsLink(uri, headers);
  if (linkOverRide) {
    return makeRemoteExecutableSchema({
      schema: await introspectSchema(linkOverRide),
      link,
    });
  }
  return makeRemoteExecutableSchema({
    schema: await introspectSchema(link),
    link,
  });
};
github MerlinLabs / moleculer-graphql / src / Gateway / createRemoteSchema.js View on Github external
export async function createRemoteSchema({ broker, service }: RemoteSchemaOptions) {
  const link = new MoleculerLink({ broker, service: service.name });
  const schema = await introspectSchema(link);
  return makeRemoteExecutableSchema({ schema, link });
}
github suciuvlad / graphql-microservices-example / services / main-service / src / index.ts View on Github external
const createMovieServiceSchema = async () => {
      const schema = await introspectSchema(movieServiceLink);

      return makeRemoteExecutableSchema({
        schema,
        link: movieServiceLink
      });
    };
github TimurRK / nestjs-example / src / graphql / stitching / stitching.service.ts View on Github external
private async getApiSchema(apiLink: string): Promise {
    try {
      const httpLink = new HttpLink({
        uri: apiLink,
        fetch,
      });

      const retryLink = this.retryLink().concat(httpLink);
      const link = this.contextLink().concat(retryLink);

      const coreIntrospect = await introspectSchema(link);

      return makeRemoteExecutableSchema({
        schema: coreIntrospect,
        link,
      });
    } catch (error) {
      this.logger.error(error);
      return null;
    }
  }
github kriswep / graphql-microservices / service-gateway / src / remoteSchema / user.js View on Github external
export default async () => {
  const link = new HttpLink({ uri: userUrl, fetch });

  const schema = await introspectSchema(link);

  return makeRemoteExecutableSchema({
    schema,
    link,
  });
};
github jakedohm / gridsome-source-craftql / index.js View on Github external
async getRemoteExecutableSchema(uri, token) {
    const http = new HttpLink({ uri, fetch })
    const link = setContext(() => ({
      headers: {
        Authorization: `bearer ${token}`,
      },
    })).concat(http)
    const remoteSchema = await introspectSchema(link)

    return makeRemoteExecutableSchema({
      schema: remoteSchema,
      link,
    })
  }