UNPKG

2.17 kBTypeScriptView Raw
1import { Operation } from 'apollo-link';
2import { InvariantError } from 'ts-invariant';
3export declare type ServerError = Error & {
4 response: Response;
5 result: Record<string, any>;
6 statusCode: number;
7};
8export declare type ServerParseError = Error & {
9 response: Response;
10 statusCode: number;
11 bodyText: string;
12};
13export declare type ClientParseError = InvariantError & {
14 parseError: Error;
15};
16export interface HttpQueryOptions {
17 includeQuery?: boolean;
18 includeExtensions?: boolean;
19}
20export interface HttpConfig {
21 http?: HttpQueryOptions;
22 options?: any;
23 headers?: any;
24 credentials?: any;
25}
26export interface UriFunction {
27 (operation: Operation): string;
28}
29export interface Body {
30 query?: string;
31 operationName?: string;
32 variables?: Record<string, any>;
33 extensions?: Record<string, any>;
34}
35export interface HttpOptions {
36 uri?: string | UriFunction;
37 includeExtensions?: boolean;
38 fetch?: WindowOrWorkerGlobalScope['fetch'];
39 headers?: any;
40 credentials?: string;
41 fetchOptions?: any;
42}
43export declare const fallbackHttpConfig: {
44 http: HttpQueryOptions;
45 headers: {
46 accept: string;
47 'content-type': string;
48 };
49 options: {
50 method: string;
51 };
52};
53export declare const throwServerError: (response: any, result: any, message: any) => never;
54export declare const parseAndCheckHttpResponse: (operations: any) => (response: Response) => Promise<any>;
55export declare const checkFetcher: (fetcher: (input: RequestInfo, init?: RequestInit) => Promise<Response>) => void;
56export declare const createSignalIfSupported: () => {
57 controller: any;
58 signal: any;
59};
60export declare const selectHttpOptionsAndBody: (operation: Operation, fallbackConfig: HttpConfig, ...configs: HttpConfig[]) => {
61 options: HttpConfig & Record<string, any>;
62 body: Body;
63};
64export declare const serializeFetchParameter: (p: any, label: any) => any;
65export declare const selectURI: (operation: any, fallbackURI?: string | ((operation: Operation) => string)) => any;
66//# sourceMappingURL=index.d.ts.map
\No newline at end of file