Skip to content

Commit b5f455f

Browse files
committed
Fix build errors
1 parent 21b16c5 commit b5f455f

3 files changed

Lines changed: 22 additions & 40 deletions

File tree

package-lock.json

Lines changed: 8 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@grpc/grpc-js": "1.14.0",
1818
"@grpc/proto-loader": "0.7.13",
19-
"@types/node": "^24.6.2",
19+
"@types/node": "^18.19.129",
2020
"@types/node-fetch": "^2.6.12",
2121
"@types/retry": "^0.12.5",
2222
"apache-arrow": "21.0.0",

src/client.ts

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import * as os from 'os';
44
import * as https from 'https';
55
import * as grpc from '@grpc/grpc-js';
66
import * 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';
811
import { EventEmitter } from 'stream';
912
import { Table, tableFromIPC, tableFromArrays } from 'apache-arrow';
1013
import {
@@ -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

2424
import * as retry from './retry';
2525
import { 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-
561549
export { SpiceClient };

0 commit comments

Comments
 (0)