import type { GatewayExecutor } from '@apollo/server-gateway-interface'; import { type KeyValueCache } from '@apollo/utils.keyvaluecache'; import type { Logger } from '@apollo/utils.logger'; import type { WithRequired } from '@apollo/utils.withrequired'; import { type Resolvable } from './utils/resolvable.js'; import { type DocumentNode, type FormattedExecutionResult, type GraphQLFieldResolver, type GraphQLFormattedError, type GraphQLSchema, type ParseOptions, type TypedQueryDocumentNode, type ValidationRule } from 'graphql'; import type { ExecuteOperationOptions, VariableValues } from './externalTypes/graphql.js'; import type { ApolloConfig, ApolloServerOptions, ApolloServerPlugin, BaseContext, ContextThunk, DocumentStore, GraphQLRequest, GraphQLResponse, HTTPGraphQLHead, HTTPGraphQLRequest, HTTPGraphQLResponse, LandingPage, PersistedQueryOptions } from './externalTypes/index.js'; import type { GraphQLExperimentalIncrementalExecutionResults } from './incrementalDeliveryPolyfill.js'; import { SchemaManager } from './utils/schemaManager.js'; export type SchemaDerivedData = { schema: GraphQLSchema; documentStore: DocumentStore | null; documentStoreKeyPrefix: string; }; type RunningServerState = { schemaManager: SchemaManager; landingPage: LandingPage | null; }; type ServerState = { phase: 'initialized'; schemaManager: SchemaManager; } | { phase: 'starting'; barrier: Resolvable; schemaManager: SchemaManager; startedInBackground: boolean; } | { phase: 'failed to start'; error: Error; } | ({ phase: 'started'; drainServers: (() => Promise) | null; toDispose: (() => Promise)[]; toDisposeLast: (() => Promise)[]; } & RunningServerState) | ({ phase: 'draining'; barrier: Resolvable; } & RunningServerState) | { phase: 'stopping'; barrier: Resolvable; } | { phase: 'stopped'; stopError: Error | null; }; export interface ApolloServerInternals { state: ServerState; gatewayExecutor: GatewayExecutor | null; dangerouslyDisableValidation?: boolean; formatError?: (formattedError: GraphQLFormattedError, error: unknown) => GraphQLFormattedError; includeStacktraceInErrorResponses: boolean; persistedQueries?: WithRequired; nodeEnv: string; allowBatchedHttpRequests: boolean; apolloConfig: ApolloConfig; plugins: ApolloServerPlugin[]; parseOptions: ParseOptions; stopOnTerminationSignals: boolean | undefined; csrfPreventionRequestHeaders: string[] | null; rootValue?: ((parsedQuery: DocumentNode) => unknown) | unknown; validationRules: Array; fieldResolver?: GraphQLFieldResolver; status400ForVariableCoercionErrors?: boolean; __testing_incrementalExecutionResults?: GraphQLExperimentalIncrementalExecutionResults; stringifyResult: (value: FormattedExecutionResult) => string | Promise; } export declare class ApolloServer { private internals; readonly cache: KeyValueCache; readonly logger: Logger; constructor(config: ApolloServerOptions); start(): Promise; startInBackgroundHandlingStartupErrorsByLoggingAndFailingAllRequests(): void; private _start; private maybeRegisterTerminationSignalHandlers; private _ensureStarted; assertStarted(expressionForError: string): void; private logStartupError; private static constructSchema; private static generateSchemaDerivedData; stop(): Promise; private addDefaultPlugins; addPlugin(plugin: ApolloServerPlugin): void; executeHTTPGraphQLRequest({ httpGraphQLRequest, context, }: { httpGraphQLRequest: HTTPGraphQLRequest; context: ContextThunk; }): Promise; private errorResponse; private prefersHTML; executeOperation, TVariables extends VariableValues = VariableValues>(this: ApolloServer, request: Omit, 'query'> & { query?: string | DocumentNode | TypedQueryDocumentNode; }): Promise>; executeOperation, TVariables extends VariableValues = VariableValues>(request: Omit, 'query'> & { query?: string | DocumentNode | TypedQueryDocumentNode; }, options?: ExecuteOperationOptions): Promise>; } export declare function internalExecuteOperation({ server, graphQLRequest, internals, schemaDerivedData, sharedResponseHTTPGraphQLHead, }: { server: ApolloServer; graphQLRequest: GraphQLRequest; internals: ApolloServerInternals; schemaDerivedData: SchemaDerivedData; sharedResponseHTTPGraphQLHead: HTTPGraphQLHead | null; }, options: ExecuteOperationOptions): Promise; export type ImplicitlyInstallablePlugin = ApolloServerPlugin & { __internal_installed_implicitly__: boolean; }; export declare function isImplicitlyInstallablePlugin(p: ApolloServerPlugin): p is ImplicitlyInstallablePlugin; export declare const MEDIA_TYPES: { APPLICATION_JSON: string; APPLICATION_JSON_GRAPHQL_CALLBACK: string; APPLICATION_GRAPHQL_RESPONSE_JSON: string; MULTIPART_MIXED_NO_DEFER_SPEC: string; MULTIPART_MIXED_EXPERIMENTAL: string; TEXT_HTML: string; }; export declare function chooseContentTypeForSingleResultResponse(head: HTTPGraphQLHead): string | null; export {}; //# sourceMappingURL=ApolloServer.d.ts.map