UNPKG

@graphql-tools/federation

Version:

Useful tools to create and manipulate GraphQL schemas.

36 lines (35 loc) 1.8 kB
import { DocumentNode, GraphQLSchema } from 'graphql'; import { SubschemaConfig } from '@graphql-tools/delegate'; import { HTTPExecutorOptions } from '@graphql-tools/executor-http'; import { MergeFieldConfigCandidate, ValidationLevel } from '@graphql-tools/stitch'; import { type Executor } from '@graphql-tools/utils'; export declare function ensureSupergraphSDLAst(supergraphSdl: string | DocumentNode): DocumentNode; export interface FederationSubschemaConfig extends Omit<SubschemaConfig, 'executor' | 'name'> { executor: Executor; name: string; endpoint: string; } export interface GetStitchingOptionsFromSupergraphSdlOpts { supergraphSdl: string | DocumentNode; httpExecutorOpts?: Partial<HTTPExecutorOptions>; onSubschemaConfig?: (subschemaConfig: FederationSubschemaConfig) => void; batch?: boolean; } export declare function getStitchingOptionsFromSupergraphSdl(opts: GetStitchingOptionsFromSupergraphSdlOpts): { subschemas: SubschemaConfig<any, any, any, Record<string, any>>[]; typeDefs: DocumentNode; assumeValid: boolean; assumeValidSDL: boolean; typeMergingOptions: { useNonNullableFieldOnConflict: boolean; validationSettings: { validationLevel: ValidationLevel; }; fieldConfigMerger: (candidates: MergeFieldConfigCandidate<Record<string, any>>[]) => import("graphql").GraphQLFieldConfig<any, Record<string, any>, any>; }; }; export interface GetStitchedSchemaFromSupergraphSdlOpts extends GetStitchingOptionsFromSupergraphSdlOpts { supergraphSdl: string | DocumentNode; onStitchingOptions?(opts: ReturnType<typeof getStitchingOptionsFromSupergraphSdl>): void; } export declare function getStitchedSchemaFromSupergraphSdl(opts: GetStitchedSchemaFromSupergraphSdlOpts): GraphQLSchema;