Skip to content

Commit

Permalink
upgrade axios and update types
Browse files Browse the repository at this point in the history
  • Loading branch information
janpaepke authored and edorivai committed Feb 19, 2024
1 parent b68e5bb commit 779c98b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"lint": "yarn lint:eslint:fix && yarn lint:prettier"
},
"dependencies": {
"axios": "^0.27.2",
"axios": "^1.6.2",
"ruply": "^1.0.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/communication/NetworkClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import https from 'https';
import { type SecureContextOptions } from 'tls';

import axios, { type AxiosInstance, type AxiosRequestConfig, type AxiosRequestHeaders, type AxiosResponse } from 'axios';
import axios, { type AxiosInstance, type AxiosRequestConfig, type AxiosResponse, type RawAxiosRequestHeaders } from 'axios';

import { run } from 'ruply';
import type Page from '../data/page/Page';
Expand Down Expand Up @@ -236,7 +236,7 @@ export default class NetworkClient {

async delete<R>(pathname: string, context?: Context & IdempotencyParameter): Promise<R | true> {
// Take the idempotency key from the context, if any.
let headers: AxiosRequestHeaders | undefined = undefined;
let headers: RawAxiosRequestHeaders | undefined = undefined;
if (context?.idempotencyKey != undefined) {
const { idempotencyKey, ...rest } = context;
headers = { [idempotencyHeaderName]: idempotencyKey };
Expand Down
4 changes: 2 additions & 2 deletions src/communication/makeRetrying.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { randomBytes } from 'crypto';

import axios, { type AxiosError, type AxiosInstance, type AxiosRequestConfig, type AxiosResponse, Method } from 'axios';
import axios, { type InternalAxiosRequestConfig, type AxiosRequestConfig, type AxiosError, type AxiosInstance, type AxiosResponse, type Method } from 'axios';

/**
* The name of the property in the request configuration which indicates which attempt this is. `0` for the initial
Expand Down Expand Up @@ -97,7 +97,7 @@ export default function makeRetrying(axiosInstance: AxiosInstance) {
}
// Set the attempt (in the request configuration).
config[attemptIndex] = (config[attemptIndex] ?? -1) + 1;
return config;
return config as InternalAxiosRequestConfig;
});
// Intercept any erroneous responses, and consider doing another attempt.
axiosInstance.interceptors.response.use(undefined, error => {
Expand Down
24 changes: 15 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1844,13 +1844,14 @@ [email protected]:
fast-deep-equal "^3.1.3"
is-buffer "^2.0.3"

axios@^0.27.2:
version "0.27.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==
axios@^1.6.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.2.tgz#de67d42c755b571d3e698df1b6504cde9b0ee9f2"
integrity sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==
dependencies:
follow-redirects "^1.14.9"
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

babel-jest@^24.9.0:
version "24.9.0"
Expand Down Expand Up @@ -3110,10 +3111,10 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787"
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==

follow-redirects@^1.14.9:
version "1.15.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
follow-redirects@^1.15.0:
version "1.15.3"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a"
integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==

for-each@^0.3.3:
version "0.3.3"
Expand Down Expand Up @@ -5251,6 +5252,11 @@ propagate@^2.0.0:
resolved "https://registry.yarnpkg.com/propagate/-/propagate-2.0.1.tgz#40cdedab18085c792334e64f0ac17256d38f9a45"
integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==

proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

psl@^1.1.28:
version "1.9.0"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7"
Expand Down

0 comments on commit 779c98b

Please sign in to comment.