UNPKG

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