From 10b01839a77953b250dd9a1fa9a8a6d3039dfc7e Mon Sep 17 00:00:00 2001 From: omsaggau Date: Thu, 9 Nov 2023 10:03:00 +0100 Subject: [PATCH] Upgrade axios (#2205) * Change so npm i only updates to latest patch and not minor * Set excact webpack version * Upgrade axios * Fix axios import * Use new get params format --- package-lock.json | 154 ++++++++++-------- package.json | 2 +- src/main/resources/assets/js/app/map.es6 | 2 +- .../react4xp/_entries/ArticleArchive.jsx | 20 ++- .../relatedFactPage/relatedFactPage.ts | 7 +- .../parts/relatedFactPage/relatedFactPage.jsx | 32 ++-- 6 files changed, 117 insertions(+), 100 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4d12525f9..6f456c901 100644 --- a/package-lock.json +++ b/package-lock.json @@ -68,7 +68,7 @@ "@typescript-eslint/eslint-plugin": "~5.62.0", "@typescript-eslint/parser": "~5.62.0", "autoprefixer": "~10.4.16", - "axios": "~0.27.2", + "axios": "~1.6.0", "babel-loader": "~9.1.3", "babel-preset-env": "~1.7.0", "cross-env": "~7.0.3", @@ -3561,9 +3561,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.3.tgz", - "integrity": "sha512-CS2rOaoQ/eAgAfcTfq6amKG7bsN+EMcgGY4FAFQdvSj2y1ixvOZTUA9mOtCai7E1SYu283XNw7urKK30nP3wkQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.4.tgz", + "integrity": "sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw==", "dev": true }, "node_modules/@types/hoist-non-react-statics": { @@ -4659,13 +4659,14 @@ } }, "node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dev": true, "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/babel": { @@ -5056,6 +5057,14 @@ "node": ">=10" } }, + "node_modules/babel-plugin-macros/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "engines": { + "node": ">= 6" + } + }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.6.tgz", @@ -5866,9 +5875,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001554", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001554.tgz", - "integrity": "sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==", + "version": "1.0.30001559", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001559.tgz", + "integrity": "sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==", "dev": true, "funding": [ { @@ -6125,9 +6134,9 @@ } }, "node_modules/core-js-compat": { - "version": "3.33.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.33.1.tgz", - "integrity": "sha512-6pYKNOgD/j/bkC5xS5IIg6bncid3rfrI42oBH1SQJbsmYPKF7rhzcFzYCcxYMmNQQ0rCEB8WqpW7QHndOggaeQ==", + "version": "3.33.2", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.33.2.tgz", + "integrity": "sha512-axfo+wxFVxnqf8RvxTzoAlzW4gRoacrHeoFlc9n0x50+7BEyZL/Rt3hicaED1/CEd7I6tPCPVUYcJwCMO5XUYw==", "dev": true, "dependencies": { "browserslist": "^4.22.1" @@ -6790,9 +6799,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.567", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.567.tgz", - "integrity": "sha512-8KR114CAYQ4/r5EIEsOmOMqQ9j0MRbJZR3aXD/KFA8RuKzyoUB4XrUCg+l8RUGqTVQgKNIgTpjaG8YHRPAbX2w==", + "version": "1.4.571", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.571.tgz", + "integrity": "sha512-Sc+VtKwKCDj3f/kLBjdyjMpNzoZsU6WuL/wFb6EH8USmHEcebxRXcRrVpOpayxd52tuey4RUDpUsw5OS5LhJqg==", "dev": true }, "node_modules/emoji-regex": { @@ -9153,9 +9162,9 @@ } }, "node_modules/jiti": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.20.0.tgz", - "integrity": "sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", "dev": true, "bin": { "jiti": "bin/jiti.js" @@ -10869,15 +10878,6 @@ } } }, - "node_modules/postcss-load-config/node_modules/yaml": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", - "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", - "dev": true, - "engines": { - "node": ">= 14" - } - }, "node_modules/postcss-loader": { "version": "7.3.3", "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-7.3.3.tgz", @@ -11428,10 +11428,16 @@ "node": ">=0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "engines": { "node": ">=6" @@ -15000,11 +15006,12 @@ "dev": true }, "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", + "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", + "dev": true, "engines": { - "node": ">= 6" + "node": ">= 14" } }, "node_modules/yocto-queue": { @@ -17454,9 +17461,9 @@ } }, "@types/estree": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.3.tgz", - "integrity": "sha512-CS2rOaoQ/eAgAfcTfq6amKG7bsN+EMcgGY4FAFQdvSj2y1ixvOZTUA9mOtCai7E1SYu283XNw7urKK30nP3wkQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.4.tgz", + "integrity": "sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw==", "dev": true }, "@types/hoist-non-react-statics": { @@ -18297,13 +18304,14 @@ "dev": true }, "axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dev": true, "requires": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "babel": { @@ -18617,6 +18625,11 @@ "path-type": "^4.0.0", "yaml": "^1.10.0" } + }, + "yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==" } } }, @@ -19311,9 +19324,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001554", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001554.tgz", - "integrity": "sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==", + "version": "1.0.30001559", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001559.tgz", + "integrity": "sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==", "dev": true }, "case-sensitive-paths-webpack-plugin": { @@ -19504,9 +19517,9 @@ "integrity": "sha512-XeBzWI6QL3nJQiHmdzbAOiMYqjrb7hwU7A39Qhvd/POSa/t9E1AeZyEZx3fNvp/vtM8zXwhoL0FsiS0hD0pruQ==" }, "core-js-compat": { - "version": "3.33.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.33.1.tgz", - "integrity": "sha512-6pYKNOgD/j/bkC5xS5IIg6bncid3rfrI42oBH1SQJbsmYPKF7rhzcFzYCcxYMmNQQ0rCEB8WqpW7QHndOggaeQ==", + "version": "3.33.2", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.33.2.tgz", + "integrity": "sha512-axfo+wxFVxnqf8RvxTzoAlzW4gRoacrHeoFlc9n0x50+7BEyZL/Rt3hicaED1/CEd7I6tPCPVUYcJwCMO5XUYw==", "dev": true, "requires": { "browserslist": "^4.22.1" @@ -19969,9 +19982,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.567", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.567.tgz", - "integrity": "sha512-8KR114CAYQ4/r5EIEsOmOMqQ9j0MRbJZR3aXD/KFA8RuKzyoUB4XrUCg+l8RUGqTVQgKNIgTpjaG8YHRPAbX2w==", + "version": "1.4.571", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.571.tgz", + "integrity": "sha512-Sc+VtKwKCDj3f/kLBjdyjMpNzoZsU6WuL/wFb6EH8USmHEcebxRXcRrVpOpayxd52tuey4RUDpUsw5OS5LhJqg==", "dev": true }, "emoji-regex": { @@ -21682,9 +21695,9 @@ } }, "jiti": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.20.0.tgz", - "integrity": "sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", "dev": true }, "joycon": { @@ -22959,14 +22972,6 @@ "requires": { "lilconfig": "^2.0.5", "yaml": "^2.1.1" - }, - "dependencies": { - "yaml": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", - "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", - "dev": true - } } }, "postcss-loader": { @@ -23322,10 +23327,16 @@ "integrity": "sha512-qYNxyMj1JeW54i/EWEFsM1cVwxJbtgPp8+0Wg9XjNaK6VE/c4oRi6PNu5p7w1mNXEIQIjV5Wwn8v8Gz82/QzdQ==", "dev": true }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true }, "q-i": { @@ -25801,9 +25812,10 @@ "dev": true }, "yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==" + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", + "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", + "dev": true }, "yocto-queue": { "version": "0.1.0", diff --git a/package.json b/package.json index c299541df..fe586485e 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "@typescript-eslint/eslint-plugin": "~5.62.0", "@typescript-eslint/parser": "~5.62.0", "autoprefixer": "~10.4.16", - "axios": "~0.27.2", + "axios": "~1.6.0", "babel-loader": "~9.1.3", "babel-preset-env": "~1.7.0", "cross-env": "~7.0.3", diff --git a/src/main/resources/assets/js/app/map.es6 b/src/main/resources/assets/js/app/map.es6 index 823187bda..ff63b2b47 100644 --- a/src/main/resources/assets/js/app/map.es6 +++ b/src/main/resources/assets/js/app/map.es6 @@ -1,7 +1,7 @@ // Only used in map and menuDropdown parts import $ from 'jquery' -import * as axios from 'axios' +import axios from 'axios' import Highcharts from 'highcharts' import A11y from 'highcharts/modules/accessibility' diff --git a/src/main/resources/react4xp/_entries/ArticleArchive.jsx b/src/main/resources/react4xp/_entries/ArticleArchive.jsx index 384a04e2f..eb4302d6f 100644 --- a/src/main/resources/react4xp/_entries/ArticleArchive.jsx +++ b/src/main/resources/react4xp/_entries/ArticleArchive.jsx @@ -4,7 +4,8 @@ import { Container, Row, Col } from 'react-bootstrap' import { ChevronDown } from 'react-feather' import { default as groupBy } from 'ramda/es/groupBy' import PropTypes from 'prop-types' -import { get } from 'axios' +import axios from 'axios' + function ArticleArchive(props) { const { title, @@ -28,14 +29,15 @@ function ArticleArchive(props) { function fetchArticles() { setLoading(true) - get(articleArchiveService, { - params: { - start: articles.length, - count: 15, - language: language, - pageId: pageId, - }, - }) + axios + .get(articleArchiveService, { + params: { + start: articles.length, + count: 15, + language: language, + pageId: pageId, + }, + }) .then((res) => { if (res.data.articles.length) { setArticles((prev) => [...prev, ...res.data.articles]) diff --git a/src/main/resources/services/relatedFactPage/relatedFactPage.ts b/src/main/resources/services/relatedFactPage/relatedFactPage.ts index 1d0c41aad..9fd7ce5e3 100644 --- a/src/main/resources/services/relatedFactPage/relatedFactPage.ts +++ b/src/main/resources/services/relatedFactPage/relatedFactPage.ts @@ -7,9 +7,10 @@ import { export const get = (req: XP.Request): XP.Response => { const start: number = Number(req.params.start) ? Number(req.params.start) : 0 const count: number = Number(req.params.count) ? Number(req.params.count) : 10 - const partConfig: RelatedFactPageConfig | undefined = req.params.partConfig - ? (JSON.parse(req.params.partConfig) as RelatedFactPageConfig) - : undefined + const partConfig: RelatedFactPageConfig = { + inputType: req.params['partConfig[inputType]'], + contentIdList: req.params['partConfig[contentIdList]'], + } const result: RelatedFactPages = parseRelatedFactPageData(partConfig, start, count) diff --git a/src/main/resources/site/parts/relatedFactPage/relatedFactPage.jsx b/src/main/resources/site/parts/relatedFactPage/relatedFactPage.jsx index 988569595..43ac47709 100644 --- a/src/main/resources/site/parts/relatedFactPage/relatedFactPage.jsx +++ b/src/main/resources/site/parts/relatedFactPage/relatedFactPage.jsx @@ -1,7 +1,7 @@ import React, { useState, useRef, useEffect } from 'react' import { PictureCard, Button } from '@statisticsnorway/ssb-component-library' import PropTypes from 'prop-types' -import { get } from 'axios' +import axios from 'axios' function RelatedBoxes(props) { const { @@ -31,13 +31,14 @@ function RelatedBoxes(props) { function fetchAllRelatedFactPages() { setLoading(true) - get(relatedFactPageServiceUrl, { - params: { - start: relatedFactPages.length, - count: total - relatedFactPages.length, - partConfig, - }, - }) + axios + .get(relatedFactPageServiceUrl, { + params: { + start: relatedFactPages.length, + count: total - relatedFactPages.length, + partConfig, + }, + }) .then((res) => { if (res.data.relatedFactPages.length) { setRelatedFactPages((prev) => [...prev, ...res.data.relatedFactPages]) @@ -51,13 +52,14 @@ function RelatedBoxes(props) { function fetchFirstRelatedFactPages() { setLoading(true) - get(relatedFactPageServiceUrl, { - params: { - start: 0, - count: 4, - partConfig, - }, - }) + axios + .get(relatedFactPageServiceUrl, { + params: { + start: 0, + count: 4, + partConfig, + }, + }) .then((res) => { if (res.data.relatedFactPages.length) { setRelatedFactPages(res.data.relatedFactPages)