How to use @apollographql/apollo-tools - 5 common examples

To help you get started, we’ve selected a few @apollographql/apollo-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 apollographql / apollo-server / packages / apollo-server-core / src / ApolloServer.ts View on Github external
graphId: this.engineServiceId,
              ...(graphVariant && { graphVariant }),
            }
          : undefined;

      return gateway.load({ engine: engineConfig }).then(config => {
        this.requestOptions.executor = config.executor;
        return config.schema;
      });
    }

    let constructedSchema;
    if (schema) {
      constructedSchema = schema;
    } else if (modules) {
      const { schema, errors } = buildServiceDefinition(modules);
      if (errors && errors.length > 0) {
        throw new Error(errors.map(error => error.message).join('\n\n'));
      }
      constructedSchema = schema!;
    } else {
      if (!typeDefs) {
        throw Error(
          'Apollo Server requires either an existing schema, modules or typeDefs',
        );
      }

      const augmentedTypeDefs = Array.isArray(typeDefs) ? typeDefs : [typeDefs];

      // We augment the typeDefs with the @cacheControl directive and associated
      // scope enum, so makeExecutableSchema won't fail SDL validation
github apollographql / apollo-server / v3 / src / index.ts View on Github external
// Plugins will be instantiated if they aren't already, and this.plugins
    // is populated accordingly.
    this.ensurePluginInstantiation(this.config.plugins);

    // TODO(AS3) Make it possible to disable introspection.
    // TODO(AS3) Cache Control
    // TODO(AS3) Global cache implementation config.
    // TODO(AS3) Persisted Queries
    // TODO(AS3) Apollo Graph Manager

    if (! this.config.modules) {
      throw new Error("TODO: No modules were specified.");
    }

    const { schema, errors } = buildServiceDefinition(this.config.modules);
    if (errors && errors.length > 0) {
      throw new Error(errors.map(error => error.message).join('\n\n'));
    }

    if (!schema) {
      throw new Error("TODO: No schema.");
    }

    this.schemaDerivedData = this.generateSchemaDerivedData(schema);
  }
github apollographql / apollo-tooling / packages / apollo-language-server / src / fileSet.ts View on Github external
constructor({
    rootURI,
    includes,
    excludes,
    configURI
  }: {
    rootURI: URI;
    includes: string[];
    excludes: string[];
    configURI?: URI;
  }) {
    invariant(rootURI, `Must provide "rootURI".`);
    invariant(includes, `Must provide "includes".`);
    invariant(excludes, `Must provide "excludes".`);

    this.rootURI = rootURI;
    this.includes = includes;
    this.excludes = excludes;
  }
github apollographql / apollo-tooling / packages / apollo-language-server / src / fileSet.ts View on Github external
constructor({
    rootURI,
    includes,
    excludes,
    configURI
  }: {
    rootURI: URI;
    includes: string[];
    excludes: string[];
    configURI?: URI;
  }) {
    invariant(rootURI, `Must provide "rootURI".`);
    invariant(includes, `Must provide "includes".`);
    invariant(excludes, `Must provide "excludes".`);

    this.rootURI = rootURI;
    this.includes = includes;
    this.excludes = excludes;
  }
github apollographql / apollo-tooling / packages / apollo-language-server / src / fileSet.ts View on Github external
constructor({
    rootURI,
    includes,
    excludes,
    configURI
  }: {
    rootURI: URI;
    includes: string[];
    excludes: string[];
    configURI?: URI;
  }) {
    invariant(rootURI, `Must provide "rootURI".`);
    invariant(includes, `Must provide "includes".`);
    invariant(excludes, `Must provide "excludes".`);

    this.rootURI = rootURI;
    this.includes = includes;
    this.excludes = excludes;
  }

@apollographql/apollo-tools

MIT
Latest version published 3 years ago

Package Health Score

77 / 100
Full package analysis