diff --git a/.gitignore b/.gitignore index 28bb2be..c330d96 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ node_modules/ # Source .vscode +.idea dist **/*.css !*.config.js diff --git a/package.json b/package.json index 3a7b34b..ddc3a25 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "kleur": "^4.1.1", "listr": "^0.14.3", "make-error": "^1.3.6", - "node-fetch": "3.0.0-beta.9" + "node-fetch": "^3.3.2" }, "devDependencies": { "@commitlint/cli": "^11.0.0", @@ -85,7 +85,6 @@ "husky": "^4.3.0", "import-sort-cli": "^6.0.0", "import-sort-parser-typescript": "^6.0.0", - "import-sort-style-leboncoin": "^1.0.3", "jest": "^26.4.2", "jest-junit": "^11.1.0", "lint-staged": "^10.4.0", @@ -106,8 +105,7 @@ }, "importSort": { ".ts": { - "parser": "typescript", - "style": "leboncoin" + "parser": "typescript" } }, "oclif": { diff --git a/src/helpers/wti.ts b/src/helpers/wti.ts index 409b947..4dd52d0 100644 --- a/src/helpers/wti.ts +++ b/src/helpers/wti.ts @@ -1,4 +1,4 @@ -import fetch from 'node-fetch'; +import fetch, { BodyInit } from 'node-fetch'; import { getConfig } from '.'; @@ -17,11 +17,9 @@ export type WtiErrorResponse = { export const wtiGet = async (path: string) => { const config = await getConfig(); - const response = await fetch( + return await fetch( `${WTI_API_URL}/${config.project.apiKey}${path}` ); - - return response; }; /** @@ -30,18 +28,16 @@ export const wtiGet = async (path: string) => { * @param path path of the API call * @param data data to be sent in the request body */ -export const wtiPost = async (path: string, data: fetch.BodyInit) => { +export const wtiPost = async (path: string, data: BodyInit) => { const config = await getConfig(); - const response = await fetch( + return await fetch( `${WTI_API_URL}/${config.project.apiKey}${path}`, { method: 'POST', body: data, } ); - - return response; }; /** @@ -50,18 +46,16 @@ export const wtiPost = async (path: string, data: fetch.BodyInit) => { * @param path path of the API call * @param data data to be sent in the request body */ -export const wtiPut = async (path: string, data: fetch.BodyInit) => { +export const wtiPut = async (path: string, data: BodyInit) => { const config = await getConfig(); - const response = await fetch( + return await fetch( `${WTI_API_URL}/${config.project.apiKey}${path}`, { method: 'PUT', body: data, } ); - - return response; }; /** @@ -72,12 +66,10 @@ export const wtiPut = async (path: string, data: fetch.BodyInit) => { export const wtiDelete = async (path: string) => { const config = await getConfig(); - const response = await fetch( + return await fetch( `${WTI_API_URL}/${config.project.apiKey}${path}`, { method: 'DELETE', } ); - - return response; }; diff --git a/yarn.lock b/yarn.lock index ad83243..929277a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2184,10 +2184,10 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -data-uri-to-buffer@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz#594b8973938c5bc2c33046535785341abc4f3636" - integrity sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og== +data-uri-to-buffer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" + integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== data-urls@^2.0.0: version "2.0.0" @@ -2857,10 +2857,13 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" -fetch-blob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-2.1.1.tgz#a54ab0d5ed7ccdb0691db77b6674308b23fb2237" - integrity sha512-Uf+gxPCe1hTOFXwkxYyckn8iUSk6CFXGy5VENZKifovUTZC9eUODWSBhOBS7zICGrAetKzdwLMr85KhIcePMAQ== +fetch-blob@^3.1.2, fetch-blob@^3.1.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" + integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== + dependencies: + node-domexception "^1.0.0" + web-streams-polyfill "^3.0.3" figures@^1.7.0: version "1.7.0" @@ -3020,6 +3023,13 @@ form-data@~2.3.2: combined-stream "^1.0.6" mime-types "^2.1.12" +formdata-polyfill@^4.0.10: + version "4.0.10" + resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" + integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== + dependencies: + fetch-blob "^3.1.2" + fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" @@ -3573,11 +3583,6 @@ import-sort-style-eslint@^6.0.0: eslint "^5.0.0" lodash "^4.17.10" -import-sort-style-leboncoin@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/import-sort-style-leboncoin/-/import-sort-style-leboncoin-1.0.3.tgz#b04b23f60598324e5dd3a3f35907567c4ef80b44" - integrity sha512-n7IbYGctk3OMJrnfHDDzKinwN/xtBUjgIGGe+TD+Rcc7loBZR08ZRJNjM8JPkNwL46NTMTY+9aaiqZn2eyA1Zw== - import-sort-style@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/import-sort-style/-/import-sort-style-6.0.0.tgz#088523f056e5064c34a6426f4733674d81b42e6a" @@ -5006,13 +5011,19 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-fetch@3.0.0-beta.9: - version "3.0.0-beta.9" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.0.0-beta.9.tgz#0a7554cfb824380dd6812864389923c783c80d9b" - integrity sha512-RdbZCEynH2tH46+tj0ua9caUHVWrd/RHnRfvly2EVdqGmI3ndS1Vn/xjm5KuGejDt2RNDQsVRLPNd2QPwcewVg== +node-domexception@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + +node-fetch@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b" + integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== dependencies: - data-uri-to-buffer "^3.0.1" - fetch-blob "^2.1.1" + data-uri-to-buffer "^4.0.0" + fetch-blob "^3.1.4" + formdata-polyfill "^4.0.10" node-int64@^0.4.0: version "0.4.0" @@ -6742,6 +6753,11 @@ walker@^1.0.7, walker@~1.0.5: dependencies: makeerror "1.0.x" +web-streams-polyfill@^3.0.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" + integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== + webidl-conversions@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"