Skip to content

Commit

Permalink
[PDE-4118] fix(core): Use node-fetch types in BaseHttpResponse (#736)
Browse files Browse the repository at this point in the history
* add @types/node-fetch and use Headers type

* only repalce headers for BaseHttpResponse

* hopefully reset yarn registry changes

* reversed name<->x key

* fix typescript support for new types package

* check gitignore before copying to tmpDir

* Revert "check gitignore before copying to tmpDir"

This reverts commit 314e719.

---------

Co-authored-by: Raúl Negrón <[email protected]>
  • Loading branch information
rnegron and rnegron authored Jan 30, 2024
1 parent f693a12 commit add8362
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions example-apps/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"jest": "^25.5.3",
"@types/jest": "^25.2.1",
"@types/node": "^13.13.5",
"@types/node-fetch": "^2.6.11",
"rimraf": "^3.0.2",
"typescript": "^4.9.4"
},
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/generators/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const writeForStandaloneTemplate = (gen) => {
devDependencies: {
'@types/jest': '^26.0.23',
'@types/node': '^14',
'@types/node-fetch': '^2.6.11',
rimraf: '^3.0.2',
typescript: '^4.9.4',
},
Expand Down
4 changes: 3 additions & 1 deletion packages/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
// Definitions by: David Brownman <https://davidbrownman.com>

/// <reference types="node" />
/// <reference types="node-fetch" />

import { Agent } from 'http';
import { Headers } from 'node-fetch';

// The EXPORTED OBJECT
export const version: string;
Expand Down Expand Up @@ -101,7 +103,7 @@ export interface HttpRequestOptions {

interface BaseHttpResponse {
status: number;
headers: { [key: string]: string };
headers: Headers;
getHeader(key: string): string | undefined;
throwForStatus(): void;
skipThrowForStatus: boolean;
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"zapier-platform-schema": "15.5.1"
},
"devDependencies": {
"@types/node-fetch": "^2.6.11",
"adm-zip": "0.5.10",
"aws-sdk": "^2.1397.0",
"dicer": "^0.3.1",
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2246,6 +2246,14 @@
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.1.tgz#283f669ff76d7b8260df8ab7a4262cc83d988256"
integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg==

"@types/node-fetch@^2.6.11":
version "2.6.11"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.11.tgz#9b39b78665dae0e82a08f02f4967d62c66f95d24"
integrity sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==
dependencies:
"@types/node" "*"
form-data "^4.0.0"

"@types/node@*":
version "12.12.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.3.tgz#ebfe83507ac506bc3486314a8aa395be66af8d23"
Expand Down

0 comments on commit add8362

Please sign in to comment.