UNPKG

1.61 kBTypeScriptView Raw
1import { Request, ValueOrPromise } from 'apollo-server-env';
2import { default as GraphQLOptions } from './graphqlOptions';
3import { WithRequired, GraphQLExecutionResult } from 'apollo-server-types';
4export interface HttpQueryRequest {
5 method: string;
6 query: Record<string, any> | Array<Record<string, any>>;
7 options: GraphQLOptions | ((...args: Array<any>) => ValueOrPromise<GraphQLOptions>);
8 request: Pick<Request, 'url' | 'method' | 'headers'>;
9}
10export interface ApolloServerHttpResponse {
11 headers?: Record<string, string>;
12}
13export interface HttpQueryResponse {
14 graphqlResponse: string;
15 responseInit: ApolloServerHttpResponse;
16}
17export declare class HttpQueryError extends Error {
18 statusCode: number;
19 isGraphQLError: boolean;
20 headers?: {
21 [key: string]: string;
22 };
23 constructor(statusCode: number, message: string, isGraphQLError?: boolean, headers?: {
24 [key: string]: string;
25 });
26}
27export declare function throwHttpGraphQLError<E extends Error>(statusCode: number, errors: Array<E>, options?: Pick<GraphQLOptions, 'debug' | 'formatError'>, extensions?: GraphQLExecutionResult['extensions']): never;
28export declare function runHttpQuery(handlerArguments: Array<any>, request: HttpQueryRequest): Promise<HttpQueryResponse>;
29export declare function processHTTPRequest<TContext>(options: WithRequired<GraphQLOptions<TContext>, 'cache' | 'plugins'> & {
30 context: TContext;
31}, httpRequest: HttpQueryRequest): Promise<HttpQueryResponse>;
32export declare function cloneObject<T extends Object>(object: T): T;
33//# sourceMappingURL=runHttpQuery.d.ts.map
\No newline at end of file