@@ -4,7 +4,10 @@ import * as os from 'os';
44import * as https from 'https' ;
55import * as grpc from '@grpc/grpc-js' ;
66import * as protoLoader from '@grpc/proto-loader' ;
7- import fetch , { Headers } from 'node-fetch' ;
7+ import fetch , {
8+ Headers ,
9+ RequestInit as NodeFetchRequestInit ,
10+ } from 'node-fetch' ;
811import { EventEmitter } from 'stream' ;
912import { Table , tableFromIPC , tableFromArrays } from 'apache-arrow' ;
1013import {
@@ -16,10 +19,7 @@ import {
1619 Ticket ,
1720 getIpcMessage ,
1821} from './flight' ;
19- import {
20- RefreshOverrides ,
21- type SpiceClientConfig ,
22- } from './interfaces' ;
22+ import { RefreshOverrides , type SpiceClientConfig } from './interfaces' ;
2323
2424import * as retry from './retry' ;
2525import { getUserAgent } from './user-agent' ;
@@ -199,7 +199,7 @@ class SpiceClient {
199199 } ) ;
200200
201201 const arrow = grpc . loadPackageDefinition ( packageDefinition ) . arrow as any ;
202-
202+
203203 if ( ! arrow ?. flight ?. protocol ?. FlightService ) {
204204 throw new Error ( 'Invalid proto file structure' ) ;
205205 }
@@ -334,7 +334,7 @@ class SpiceClient {
334334
335335 let schema : Buffer | undefined ;
336336 const chunks : Buffer [ ] = [ ] ;
337-
337+
338338 resultStream . on ( 'data' , ( response : FlightData ) => {
339339 const ipcMessage = getIpcMessage ( response ) ;
340340 chunks . push ( ipcMessage ) ;
@@ -494,7 +494,7 @@ class SpiceClient {
494494 undefined ,
495495 body ,
496496 ) ;
497-
497+
498498 if ( response . status !== 201 ) {
499499 const responseText = await response . text ( ) ;
500500 throw new Error (
@@ -510,9 +510,10 @@ class SpiceClient {
510510 body ?: string ,
511511 customHeaders ?: { [ key : string ] : string } ,
512512 ) {
513- const url = params && Object . keys ( params ) . length
514- ? `${ this . _httpUrl } ${ path } ?${ new URLSearchParams ( params ) } `
515- : `${ this . _httpUrl } ${ path } ` ;
513+ const url =
514+ params && Object . keys ( params ) . length
515+ ? `${ this . _httpUrl } ${ path } ?${ new URLSearchParams ( params ) } `
516+ : `${ this . _httpUrl } ${ path } ` ;
516517
517518 const headers = new Headers ( [
518519 [ 'Content-Type' , 'application/json' ] ,
@@ -531,7 +532,7 @@ class SpiceClient {
531532 headers . set ( 'X-API-Key' , this . _apiKey ) ;
532533 }
533534
534- const fetchOptions : RequestInit = {
535+ const fetchOptions : NodeFetchRequestInit = {
535536 headers,
536537 method,
537538 body,
@@ -545,17 +546,4 @@ class SpiceClient {
545546 }
546547}
547548
548- export { SpiceClient } ;
549- body ,
550- } ) ;
551- } else {
552- return fetch ( url , {
553- headers : new Headers ( headers ) ,
554- method,
555- body,
556- } ) ;
557- }
558- }
559- }
560-
561549export { SpiceClient } ;
0 commit comments