graphql-modules
Version:
Create reusable, maintainable, testable and extendable GraphQL modules
31 lines (30 loc) • 1.05 kB
TypeScript
import { DocumentNode, ExecutionResult, GraphQLSchema } from 'graphql';
import { Application } from './types';
export interface ApolloRequestContext {
document: DocumentNode;
operationName?: string | null;
context?: any;
schema: GraphQLSchema;
request: {
variables?: {
[name: string]: any;
} | null;
};
}
export interface ApolloGatewayLoadResult {
executor: ApolloExecutor;
}
export type ApolloExecutor = (requestContext: ApolloRequestContext) => Promise<ExecutionResult>;
export interface ApolloGatewayInterface {
onSchemaLoadOrUpdate(callback: (schemaContext: {
apiSchema: GraphQLSchema;
coreSupergraphSdl: string;
}) => void): () => void;
load(): Promise<ApolloGatewayLoadResult>;
stop(): Promise<void>;
}
export declare function apolloGatewayCreator({ schema, typeDefs, createExecution, }: {
schema: Application['schema'];
typeDefs: Application['typeDefs'];
createExecution: Application['createExecution'];
}): Application['createApolloGateway'];