import type { RequestDocument, Variables } from '../helpers/types.js'; export type BatchRequestDocument = { document: RequestDocument; variables?: V; }; export interface BatchRequestsOptions { documents: BatchRequestDocument[]; requestHeaders?: HeadersInit; signal?: RequestInit['signal']; } export interface BatchRequestsExtendedOptions extends BatchRequestsOptions { url: string; } /** * Send a batch of GraphQL Document to the GraphQL server for execution. * * @example * * ```ts * // You can pass a raw string * * await batchRequests('https://foo.bar/graphql', [ * { * query: ` * { * query { * users * } * }` * }, * { * query: ` * { * query { * users * } * }` * }]) * * // You can also pass a GraphQL DocumentNode as query. Convenient if you * // are using graphql-tag package. * * import gql from 'graphql-tag' * * await batchRequests('https://foo.bar/graphql', [{ query: gql`...` }]) * ``` */ export declare const batchRequests: BatchRequests; type BatchRequestsArgs = [url: string, documents: BatchRequestDocument[], requestHeaders?: HeadersInit] | [options: BatchRequestsExtendedOptions]; export declare const parseBatchRequestsArgsExtended: (args: BatchRequestsArgs) => BatchRequestsExtendedOptions; interface BatchRequests { (url: string, documents: BatchRequestDocument[], requestHeaders?: HeadersInit): Promise; (options: BatchRequestsExtendedOptions): Promise; } export type BatchResult = [Result, ...Result[]]; interface Result { data: Data; } export declare const parseBatchRequestArgs: (documentsOrOptions: BatchRequestDocument[] | BatchRequestsOptions, requestHeaders?: HeadersInit) => BatchRequestsOptions; export {}; //# sourceMappingURL=batchRequests.d.ts.map