diff --git a/.nvmrc b/.nvmrc index 6bfa05c..8ec90ff 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1,2 +1,2 @@ -v16 +v18 @doist:registry=https://npm.pkg.github.com/ diff --git a/package-lock.json b/package-lock.json index 670c024..344a804 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "3.0.1", "license": "MIT", "dependencies": { - "axios": "^0.27.0", - "axios-case-converter": "^0.11.0", + "axios": "^1.0.0", + "axios-case-converter": "^1.0.0", "axios-retry": "^3.1.9", "runtypes": "^6.5.0", "ts-custom-error": "^3.2.0", @@ -19,7 +19,6 @@ "devDependencies": { "@doist/eslint-config": "8.1.3", "@doist/prettier-config": "3.0.5", - "@types/axios": "0.14.0", "@types/jest": "29.4.0", "@types/uuid": "8.3.4", "@typescript-eslint/eslint-plugin": "5.54.1", @@ -1306,16 +1305,6 @@ "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", "dev": true }, - "node_modules/@types/axios": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz", - "integrity": "sha1-7CMA++fX3d1+udOr+HmZlkyvzkY=", - "deprecated": "This is a stub types definition for axios (https://github.com/mzabriskie/axios). axios provides its own type definitions, so you don't need @types/axios installed!", - "dev": true, - "dependencies": { - "axios": "*" - } - }, "node_modules/@types/babel__core": { "version": "7.20.0", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", @@ -2101,18 +2090,19 @@ } }, "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.1.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz", + "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==", "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/axios-case-converter": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/axios-case-converter/-/axios-case-converter-0.11.1.tgz", - "integrity": "sha512-i5hrkBg7SE9jsm2Q+ClznR5DsKcYXChH6Cc3Rhx2p4gdIfJwvvO5/ATcAg/vN2UVzGE2B1eR1O4VuEGkICdJdQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/axios-case-converter/-/axios-case-converter-1.1.0.tgz", + "integrity": "sha512-XmeffqomjVRhYRXQdw7FaeJhFUvsqt0oXMzfPDaZE1ibBkZ8zeAdgMYBGYlMegXUjpzg48pKZ+SLkz6RH2yYkA==", "dependencies": { "camel-case": "^4.1.1", "header-case": "^2.0.3", @@ -2120,7 +2110,7 @@ "tslib": "^2.3.0" }, "peerDependencies": { - "axios": ">=0.23.0 <2.0.0" + "axios": ">=1.0.0 <2.0.0" } }, "node_modules/axios-retry": { @@ -6559,6 +6549,11 @@ "dev": true, "peer": true }, + "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==" + }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -8957,15 +8952,6 @@ "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", "dev": true }, - "@types/axios": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz", - "integrity": "sha1-7CMA++fX3d1+udOr+HmZlkyvzkY=", - "dev": true, - "requires": { - "axios": "*" - } - }, "@types/babel__core": { "version": "7.20.0", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", @@ -9599,18 +9585,19 @@ "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.1.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz", + "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==", "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" } }, "axios-case-converter": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/axios-case-converter/-/axios-case-converter-0.11.1.tgz", - "integrity": "sha512-i5hrkBg7SE9jsm2Q+ClznR5DsKcYXChH6Cc3Rhx2p4gdIfJwvvO5/ATcAg/vN2UVzGE2B1eR1O4VuEGkICdJdQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/axios-case-converter/-/axios-case-converter-1.1.0.tgz", + "integrity": "sha512-XmeffqomjVRhYRXQdw7FaeJhFUvsqt0oXMzfPDaZE1ibBkZ8zeAdgMYBGYlMegXUjpzg48pKZ+SLkz6RH2yYkA==", "requires": { "camel-case": "^4.1.1", "header-case": "^2.0.3", @@ -12935,6 +12922,11 @@ } } }, + "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==" + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", diff --git a/package.json b/package.json index c1b2f97..18507f3 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^0.27.0", - "axios-case-converter": "^0.11.0", + "axios": "^1.0.0", + "axios-case-converter": "^1.0.0", "axios-retry": "^3.1.9", "runtypes": "^6.5.0", "ts-custom-error": "^3.2.0", @@ -34,7 +34,6 @@ "devDependencies": { "@doist/eslint-config": "8.1.3", "@doist/prettier-config": "3.0.5", - "@types/axios": "0.14.0", "@types/jest": "29.4.0", "@types/uuid": "8.3.4", "@typescript-eslint/eslint-plugin": "5.54.1", diff --git a/src/restClient.axios.test.ts b/src/restClient.axios.test.ts index 5cb1a2a..35897dd 100644 --- a/src/restClient.axios.test.ts +++ b/src/restClient.axios.test.ts @@ -11,7 +11,9 @@ describe('axios tests without mocking', () => { params: { ids: ['12345', '56789'], }, - paramsSerializer, + paramsSerializer: { + serialize: paramsSerializer, + }, }) expect(requestUri).toEqual('https://api.todoist.com/rest/v2/tasks?ids=12345%2C56789') }) diff --git a/src/restClient.test.ts b/src/restClient.test.ts index fcc87a3..fb63deb 100644 --- a/src/restClient.test.ts +++ b/src/restClient.test.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line import/no-named-as-default import Axios, { AxiosStatic, AxiosResponse, AxiosError } from 'axios' import { request, isSuccess, paramsSerializer } from './restClient' import { TodoistRequestError } from './types/errors' @@ -120,7 +121,9 @@ describe('restClient', () => { expect(axiosMock.get).toBeCalledTimes(1) expect(axiosMock.get).toBeCalledWith(DEFAULT_ENDPOINT, { params: undefined, - paramsSerializer, + paramsSerializer: { + serialize: paramsSerializer, + }, }) }) @@ -136,7 +139,9 @@ describe('restClient', () => { expect(axiosMock.get).toBeCalledTimes(1) expect(axiosMock.get).toBeCalledWith(DEFAULT_ENDPOINT, { params: DEFAULT_PAYLOAD, - paramsSerializer, + paramsSerializer: { + serialize: paramsSerializer, + }, }) }) diff --git a/src/restClient.ts b/src/restClient.ts index ac836eb..9312508 100644 --- a/src/restClient.ts +++ b/src/restClient.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line import/no-named-as-default import Axios, { AxiosResponse, AxiosError } from 'axios' import applyCaseMiddleware from 'axios-case-converter' import { TodoistRequestError } from './types/errors' @@ -105,7 +106,9 @@ export async function request( case 'GET': return await axiosClient.get(relativePath, { params: payload, - paramsSerializer, + paramsSerializer: { + serialize: paramsSerializer, + }, }) case 'POST': return await axiosClient.post(relativePath, payload)