runHttpQuery.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. import { Request, ValueOrPromise } from 'apollo-server-env';
  2. import { default as GraphQLOptions } from './graphqlOptions';
  3. import { WithRequired, GraphQLExecutionResult } from 'apollo-server-types';
  4. export 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. }
  10. export interface ApolloServerHttpResponse {
  11. headers?: Record<string, string>;
  12. }
  13. export interface HttpQueryResponse {
  14. graphqlResponse: string;
  15. responseInit: ApolloServerHttpResponse;
  16. }
  17. export 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. }
  27. export declare function throwHttpGraphQLError<E extends Error>(statusCode: number, errors: Array<E>, options?: Pick<GraphQLOptions, 'debug' | 'formatError'>, extensions?: GraphQLExecutionResult['extensions']): never;
  28. export declare function runHttpQuery(handlerArguments: Array<any>, request: HttpQueryRequest): Promise<HttpQueryResponse>;
  29. export declare function processHTTPRequest<TContext>(options: WithRequired<GraphQLOptions<TContext>, 'cache' | 'plugins'> & {
  30. context: TContext;
  31. }, httpRequest: HttpQueryRequest): Promise<HttpQueryResponse>;
  32. export declare function cloneObject<T extends Object>(object: T): T;
  33. //# sourceMappingURL=runHttpQuery.d.ts.map