From add8362ae15cc4938bb39e49173c8681de5ea0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Negr=C3=B3n?= Date: Tue, 30 Jan 2024 10:24:29 -0400 Subject: [PATCH] [PDE-4118] fix(core): Use node-fetch types in BaseHttpResponse (#736) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 314e71985bc1b2af7e84111de75e88b92af2baa7. --------- Co-authored-by: Raúl Negrón --- example-apps/typescript/package.json | 1 + packages/cli/src/generators/index.js | 1 + packages/core/index.d.ts | 4 +++- packages/core/package.json | 1 + yarn.lock | 8 ++++++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/example-apps/typescript/package.json b/example-apps/typescript/package.json index ea62a98c1..c5f443def 100644 --- a/example-apps/typescript/package.json +++ b/example-apps/typescript/package.json @@ -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" }, diff --git a/packages/cli/src/generators/index.js b/packages/cli/src/generators/index.js index 15c2183bc..01b823b69 100644 --- a/packages/cli/src/generators/index.js +++ b/packages/cli/src/generators/index.js @@ -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', }, diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts index 17a7bcd99..c0af0154c 100644 --- a/packages/core/index.d.ts +++ b/packages/core/index.d.ts @@ -3,8 +3,10 @@ // Definitions by: David Brownman /// +/// import { Agent } from 'http'; +import { Headers } from 'node-fetch'; // The EXPORTED OBJECT export const version: string; @@ -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; diff --git a/packages/core/package.json b/packages/core/package.json index 4ae10b275..e6230219f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 9cfb3e85d..9e57afafe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"