From d5ccceea68630094e51ea13afa78f7a345bc7027 Mon Sep 17 00:00:00 2001 From: Jan Kumer Date: Tue, 30 Jul 2024 09:50:32 +0200 Subject: [PATCH] Upgrade axios to 0.21.1 as peerDependency And fix code for its new types --- package-lock.json | 96 ++++++++++++------------------------- package.json | 2 +- src/utils/Cache.ts | 2 +- src/utils/cancelRequests.ts | 9 +++- 4 files changed, 39 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index f1cd57e7..bf614654 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "@turf/helpers": "^6.1.4", "@types/proj4": "^2.5.2", "@types/xml2js": "^0.4.4", - "axios": "^0.18.1", + "axios": "^0.21.1", "moment": "^2.24.0", "polygon-clipping": "^0.14.3", "proj4": "^2.9.0", @@ -5774,14 +5774,12 @@ "dev": true }, "node_modules/axios": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz", - "integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==", - "deprecated": "Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410", + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "peer": true, "dependencies": { - "follow-redirects": "1.5.10", - "is-buffer": "^2.0.2" + "follow-redirects": "^1.14.0" } }, "node_modules/axios-mock-adapter": { @@ -8232,29 +8230,6 @@ "url": "https://opencollective.com/date-fns" } }, - "node_modules/debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "peer": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "peer": true - }, "node_modules/decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", @@ -10605,15 +10580,23 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], "peer": true, - "dependencies": { - "debug": "=3.1.0" - }, "engines": { "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } } }, "node_modules/for-each": { @@ -12457,6 +12440,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true, "engines": { "node": ">=4" } @@ -26773,13 +26757,12 @@ "dev": true }, "axios": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz", - "integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==", + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "peer": true, "requires": { - "follow-redirects": "1.5.10", - "is-buffer": "^2.0.2" + "follow-redirects": "^1.14.0" } }, "axios-mock-adapter": { @@ -28779,23 +28762,6 @@ "integrity": "sha512-qJgn99xxKnFgB1qL4jpxU7Q2t0LOn1p8KMIveef3UZD7kqjT3tpFNNdXJelEHhE+rUgffriXriw/sOSU+cS1Hw==", "dev": true }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "peer": true, - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "peer": true - } - } - }, "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", @@ -30641,13 +30607,10 @@ } }, "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", - "peer": true, - "requires": { - "debug": "=3.1.0" - } + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "peer": true }, "for-each": { "version": "0.3.3", @@ -32078,7 +32041,8 @@ "is-buffer": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true }, "is-builtin-module": { "version": "3.2.1", diff --git a/package.json b/package.json index 6b092041..48ca9dd8 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "@turf/helpers": "^6.1.4", "@types/proj4": "^2.5.2", "@types/xml2js": "^0.4.4", - "axios": "^0.18.1", + "axios": "^0.21.1", "moment": "^2.24.0", "polygon-clipping": "^0.14.3", "proj4": "^2.9.0", diff --git a/src/utils/Cache.ts b/src/utils/Cache.ts index 40a31ca8..dbe96da3 100644 --- a/src/utils/Cache.ts +++ b/src/utils/Cache.ts @@ -1,4 +1,4 @@ -import { AxiosRequestConfig, AxiosResponse } from 'axios'; +import { AxiosRequestConfig, AxiosResponse, ResponseType } from 'axios'; export type CacheTargets = CacheTarget[]; export enum CacheTarget { diff --git a/src/utils/cancelRequests.ts b/src/utils/cancelRequests.ts index 566942dd..64a0dac6 100644 --- a/src/utils/cancelRequests.ts +++ b/src/utils/cancelRequests.ts @@ -1,4 +1,9 @@ -import axios, { CancelTokenSource, AxiosRequestConfig, CancelToken as CancelTokenAxios } from 'axios'; +import axios, { + CancelTokenSource, + AxiosRequestConfig, + CancelToken as CancelTokenAxios, + ResponseType, +} from 'axios'; import { CacheConfig, removeCacheableRequestsInProgress } from './cacheHandlers'; import { getDefaultRequestsConfig } from './defaultReqsConfig'; @@ -8,7 +13,7 @@ export type RequestConfiguration = { timeout?: number | null; cancelToken?: CancelToken; cache?: CacheConfig; - responseType?: string; + responseType?: ResponseType; rewriteUrlFunc?: (url: string) => string; };