Skip to content

Commit

Permalink
feat: updated axios dependency to 1.2.x. (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
b4rtaz authored Dec 15, 2022
1 parent 439d6e5 commit 2dcf75f
Show file tree
Hide file tree
Showing 14 changed files with 121 additions and 59 deletions.
7 changes: 7 additions & 0 deletions .changeset/rare-teachers-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@moralisweb3/api-utils': patch
'@moralisweb3/common-core': patch
'@moralisweb3/next': patch
---

Updated `axios` dependency to 1.2.x.
2 changes: 1 addition & 1 deletion demos/express-proxy/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PORT = 1337;
PORT = 4000;

# Your Moralis Api key, that can be found in the dashboard. Keep this secret!
MORALIS_API_KEY = ''
2 changes: 1 addition & 1 deletion demos/express-proxy/public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const endpointWeights = () => {
};

const getEvmNativeBalance = () => {
handleEvmProxyCall('0x992eCcC191D6F74E8Be187ed6B6AC196b08314f7/balance?chain=0x4');
handleEvmProxyCall('0x992eCcC191D6F74E8Be187ed6B6AC196b08314f7/balance?chain=0x5');
};

// solana api proxy calls
Expand Down
10 changes: 3 additions & 7 deletions demos/express-proxy/src/middlewares/errorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MoralisError, isMoralisError } from '@moralisweb3/common-core';
import { NextFunction, Request, Response } from 'express';
import { AxiosError } from 'axios';
import { AxiosError, isAxiosError } from 'axios';

const makeMoralisErrorMessage = (error: MoralisError) => {
let message = error.message || 'Unknown error';
Expand Down Expand Up @@ -41,14 +41,10 @@ export function errorHandler(
} else if (isAxiosError(error)) {
res.status(error.response?.status || 500).json({
data: error.response?.data || 'Unknown error',
method: error.config.method?.toUpperCase(),
url: error.config.url,
method: error.config?.method?.toUpperCase(),
url: error.config?.url,
});
} else {
res.status(500).json({ error: error.message });
}
}

function isAxiosError<Type>(error: Error | AxiosError<Type>): error is AxiosError<Type> {
return 'isAxiosError' in error && error.isAxiosError;
}
2 changes: 1 addition & 1 deletion demos/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@moralisweb3/next": "^2.9.0",
"axios": "^0.27.2",
"axios": "^1.2.1",
"ethers": "5.6.9",
"moralis": "^2.9.0",
"next": "12.2.5",
Expand Down
2 changes: 1 addition & 1 deletion demos/parse-server-migration-react-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@walletconnect/web3-provider": "^1.8.0",
"@web3auth/web3auth": "^2.0.2",
"assert": "^2.0.0",
"axios": "^0.27.2",
"axios": "^1.2.1",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
Expand Down
2 changes: 1 addition & 1 deletion demos/parse-server-migration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@moralisweb3/eslint-config": "^1.0.1",
"@typescript-eslint/eslint-plugin": "^5.45.1",
"@typescript-eslint/parser": "^5.45.1",
"axios": "^0.27.2",
"axios": "^1.2.1",
"eslint": "^8.29.0",
"eslint-plugin-etc": "^2.0.2",
"eslint-plugin-import": "^2.26.0",
Expand Down
10 changes: 3 additions & 7 deletions demos/parse-server/src/middlewares/errorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isMoralisError, MoralisError } from '@moralisweb3/common-core';
import { NextFunction, Request, Response } from 'express';
import { AxiosError } from 'axios';
import { AxiosError, isAxiosError } from 'axios';

const makeMoralisErrorMessage = (error: MoralisError) => {
let message = error.message || 'Unknown error';
Expand Down Expand Up @@ -41,14 +41,10 @@ export function errorHandler(
} else if (isAxiosError(error)) {
res.status(error.response?.status || 500).json({
data: error.response?.data || 'Unknown error',
method: error.config.method?.toUpperCase(),
url: error.config.url,
method: error.config?.method?.toUpperCase(),
url: error.config?.url,
});
} else {
res.status(500).json({ error: error.message });
}
}

function isAxiosError<Type>(error: Error | AxiosError<Type>): error is AxiosError<Type> {
return 'isAxiosError' in error && error.isAxiosError;
}
2 changes: 1 addition & 1 deletion packages/apiUtils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"dependencies": {
"@moralisweb3/common-core": "^2.9.0",
"@moralisweb3/common-evm-utils": "^2.9.0",
"axios": "^0.27.2"
"axios": "^1.2.1"
}
}
2 changes: 1 addition & 1 deletion packages/common/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"typescript": "^4.9.3"
},
"dependencies": {
"axios": "^0.27.2",
"axios": "^1.2.1",
"eventemitter3": "^4.0.7",
"typed-emitter": "^2.1.0"
}
Expand Down
5 changes: 3 additions & 2 deletions packages/create-moralis-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
},
"devDependencies": {
"@types/ejs": "3.1.1",
"axios": "^1.2.0",
"axios": "^1.2.1",
"chalk": "^5.0.1",
"copyfiles": "2.4.1",
"ejs": "^3.1.8",
"fs-extra": "^10.1.0",
"inquirer": "^8.0.0",
"lodash": "^4.17.21",
"ora": "^5.4.1"
"ora": "^5.4.1",
"ts-node-dev": "^2.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@moralisweb3/next": "^2.7.4",
"axios": "^0.27.2",
"axios": "^1.2.1",
"eslint": "^8.22.0",
"ethers": "5.6.9",
"moralis": "^2.7.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@moralisweb3/common-auth-utils": "^2.9.0",
"@moralisweb3/evm-api": "^2.9.0",
"@moralisweb3/sol-api": "^2.9.0",
"axios": "^0.27.2",
"axios": "^1.2.1",
"moralis": "^2.9.0",
"swr": "^1.3.0"
},
Expand Down
Loading

1 comment on commit 2dcf75f

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage

Title Lines Statements Branches Functions
api-utils Coverage: 25%
26.34% (49/186) 19.14% (9/47) 22.85% (8/35)
auth Coverage: 90%
92.77% (77/83) 81.81% (18/22) 90% (18/20)
evm-api Coverage: 100%
100% (80/80) 66.66% (6/9) 100% (48/48)
common-evm-utils Coverage: 64%
64.99% (947/1457) 19.43% (123/633) 35.8% (203/567)
sol-api Coverage: 96%
96.66% (29/30) 66.66% (6/9) 91.66% (11/12)
common-sol-utils Coverage: 74%
73.77% (135/183) 60% (12/20) 65.67% (44/67)
common-streams-utils Coverage: 93%
93.13% (787/845) 85.96% (196/228) 84.14% (276/328)
streams Coverage: 87%
86.82% (402/463) 67.6% (48/71) 84.52% (71/84)

Please sign in to comment.