@@ -11,7 +11,6 @@ import { resolveRequestDocument } from './resolveRequestDocument.js'
11
11
import type {
12
12
BatchRequestDocument ,
13
13
FetchOptions ,
14
- GraphQLClientRequestHeaders ,
15
14
GraphQLClientResponse ,
16
15
HTTPMethodInput ,
17
16
JsonSerializer ,
@@ -37,7 +36,7 @@ import type { TypedDocumentNode } from '@graphql-typed-document-node/core'
37
36
/**
38
37
* Convert the given headers configuration into a plain object.
39
38
*/
40
- const resolveHeaders = ( headers ?: GraphQLClientRequestHeaders ) : Record < string , string > => {
39
+ const resolveHeaders = ( headers ?: HeadersInit ) : Record < string , string > => {
41
40
let oHeaders : Record < string , string > = { }
42
41
if ( headers ) {
43
42
if ( headers instanceof Headers ) {
@@ -124,7 +123,7 @@ interface RequestVerbParams<V extends Variables = Variables> {
124
123
fetch : Fetch
125
124
fetchOptions : FetchOptions
126
125
variables ?: V
127
- headers ?: GraphQLClientRequestHeaders
126
+ headers ?: HeadersInit
128
127
operationName ?: string
129
128
middleware ?: RequestMiddleware < V >
130
129
}
@@ -297,11 +296,11 @@ class GraphQLClient {
297
296
* Send GraphQL documents in batch to the server.
298
297
*/
299
298
// prettier-ignore
300
- batchRequests < T extends BatchResult , V extends Variables = Variables > ( documents : BatchRequestDocument < V > [ ] , requestHeaders ?: GraphQLClientRequestHeaders ) : Promise < T >
299
+ batchRequests < T extends BatchResult , V extends Variables = Variables > ( documents : BatchRequestDocument < V > [ ] , requestHeaders ?: HeadersInit ) : Promise < T >
301
300
// prettier-ignore
302
301
batchRequests < T extends BatchResult , V extends Variables = Variables > ( options : BatchRequestsOptions < V > ) : Promise < T >
303
302
// prettier-ignore
304
- batchRequests < T extends BatchResult , V extends Variables = Variables > ( documentsOrOptions : BatchRequestDocument < V > [ ] | BatchRequestsOptions < V > , requestHeaders ?: GraphQLClientRequestHeaders ) : Promise < T > {
303
+ batchRequests < T extends BatchResult , V extends Variables = Variables > ( documentsOrOptions : BatchRequestDocument < V > [ ] | BatchRequestsOptions < V > , requestHeaders ?: HeadersInit ) : Promise < T > {
305
304
const batchRequestOptions = parseBatchRequestArgs < V > ( documentsOrOptions , requestHeaders )
306
305
const { headers, ...fetchOptions } = this . requestConfig
307
306
@@ -343,7 +342,7 @@ class GraphQLClient {
343
342
} )
344
343
}
345
344
346
- setHeaders ( headers : GraphQLClientRequestHeaders ) : GraphQLClient {
345
+ setHeaders ( headers : HeadersInit ) : GraphQLClient {
347
346
this . requestConfig . headers = headers
348
347
return this
349
348
}
@@ -378,7 +377,7 @@ const makeRequest = async <T = unknown, V extends Variables = Variables>(params:
378
377
url : string
379
378
query : string | string [ ]
380
379
variables ?: V
381
- headers ?: GraphQLClientRequestHeaders
380
+ headers ?: HeadersInit
382
381
operationName ?: string
383
382
fetch : Fetch
384
383
method ?: HTTPMethodInput
@@ -431,13 +430,13 @@ const makeRequest = async <T = unknown, V extends Variables = Variables>(params:
431
430
432
431
// prettier-ignore
433
432
interface RawRequestMethod {
434
- < T , V extends Variables = Variables > ( query : string , variables ?: V , requestHeaders ?: GraphQLClientRequestHeaders ) : Promise < GraphQLClientResponse < T > >
433
+ < T , V extends Variables = Variables > ( query : string , variables ?: V , requestHeaders ?: HeadersInit ) : Promise < GraphQLClientResponse < T > >
435
434
< T , V extends Variables = Variables > ( options : RawRequestOptions < V > ) : Promise < GraphQLClientResponse < T > >
436
435
}
437
436
438
437
// prettier-ignore
439
438
type RawRequestMethodArgs < V extends Variables > =
440
- | [ query : string , variables ?: V , requestHeaders ?: GraphQLClientRequestHeaders ]
439
+ | [ query : string , variables ?: V , requestHeaders ?: HeadersInit ]
441
440
| [ RawRequestOptions < V > ]
442
441
443
442
// prettier-ignore
@@ -563,12 +562,12 @@ type BatchResult = [Result, ...Result[]]
563
562
564
563
// prettier-ignore
565
564
interface BatchRequests {
566
- < T extends BatchResult , V extends Variables = Variables > ( url : string , documents : BatchRequestDocument < V > [ ] , requestHeaders ?: GraphQLClientRequestHeaders ) : Promise < T >
565
+ < T extends BatchResult , V extends Variables = Variables > ( url : string , documents : BatchRequestDocument < V > [ ] , requestHeaders ?: HeadersInit ) : Promise < T >
567
566
< T extends BatchResult , V extends Variables = Variables > ( options : BatchRequestsExtendedOptions < V > ) : Promise < T >
568
567
}
569
568
570
569
type BatchRequestsArgs =
571
- | [ url : string , documents : BatchRequestDocument [ ] , requestHeaders ?: GraphQLClientRequestHeaders ]
570
+ | [ url : string , documents : BatchRequestDocument [ ] , requestHeaders ?: HeadersInit ]
572
571
| [ options : BatchRequestsExtendedOptions ]
573
572
574
573
const parseBatchRequestsArgsExtended = ( args : BatchRequestsArgs ) : BatchRequestsExtendedOptions => {
@@ -674,7 +673,6 @@ export {
674
673
BatchRequestsOptions ,
675
674
ClientError ,
676
675
GraphQLClient ,
677
- GraphQLClientRequestHeaders ,
678
676
rawRequest ,
679
677
RawRequestExtendedOptions ,
680
678
RawRequestOptions ,
0 commit comments