UNPKG

1.71 kBTypeScriptView Raw
1import { ASTNode, print } from 'graphql';
2import { Operation } from '../core';
3export interface Printer {
4 (node: ASTNode, originalPrint: typeof print): string;
5}
6export interface UriFunction {
7 (operation: Operation): string;
8}
9export interface Body {
10 query?: string;
11 operationName?: string;
12 variables?: Record<string, any>;
13 extensions?: Record<string, any>;
14}
15export interface HttpOptions {
16 uri?: string | UriFunction;
17 includeExtensions?: boolean;
18 fetch?: WindowOrWorkerGlobalScope['fetch'];
19 headers?: Record<string, string>;
20 preserveHeaderCase?: boolean;
21 credentials?: string;
22 fetchOptions?: any;
23 useGETForQueries?: boolean;
24 includeUnusedVariables?: boolean;
25 print?: Printer;
26}
27export interface HttpQueryOptions {
28 includeQuery?: boolean;
29 includeExtensions?: boolean;
30 preserveHeaderCase?: boolean;
31}
32export interface HttpConfig {
33 http?: HttpQueryOptions;
34 options?: any;
35 headers?: Record<string, string>;
36 credentials?: any;
37}
38export declare const fallbackHttpConfig: {
39 http: HttpQueryOptions;
40 headers: {
41 accept: string;
42 'content-type': string;
43 };
44 options: {
45 method: string;
46 };
47};
48export declare const defaultPrinter: Printer;
49export declare function selectHttpOptionsAndBody(operation: Operation, fallbackConfig: HttpConfig, ...configs: Array<HttpConfig>): {
50 options: HttpConfig & Record<string, any>;
51 body: Body;
52};
53export declare function selectHttpOptionsAndBodyInternal(operation: Operation, printer: Printer, ...configs: HttpConfig[]): {
54 options: HttpConfig & Record<string, any>;
55 body: Body;
56};
57//# sourceMappingURL=selectHttpOptionsAndBody.d.ts.map
\No newline at end of file