Skip to content

Commit

Permalink
#2505 - Upgrade Axios Package (#2598)
Browse files Browse the repository at this point in the history
- Upgraded Axios to 1.6.2 version;
- Replaced FileUploadProgressEventArgs by AxiosProgressEvent;
- Tested the application modules to see if any issued with the upgrade;
- Waiting for the merge to check that the security issues related will
be resolved.
  • Loading branch information
andrepestana-aot authored Dec 15, 2023
1 parent 2a344f2 commit 9e4db8b
Show file tree
Hide file tree
Showing 17 changed files with 114 additions and 87 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 11 additions & 30 deletions sources/packages/backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sources/packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@nestjs/terminus": "^10.1.1",
"@nestjs/typeorm": "^9.0.0",
"@types/ssh2-sftp-client": "^5.3.1",
"axios": "^0.27.2",
"axios": "^1.6.2",
"bull": "^4.10.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
Expand Down
6 changes: 3 additions & 3 deletions sources/packages/forms/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sources/packages/forms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"typescript": "^4.3.5"
},
"dependencies": {
"axios": "^0.21.2",
"axios": "^1.6.2",
"dotenv": "^10.0.0"
}
}
}
57 changes: 48 additions & 9 deletions sources/packages/web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sources/packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@mdi/js": "^5.9.55",
"@types/vuelidate": "^0.7.13",
"@vee-validate/rules": "^4.0.4",
"axios": "^0.21.2",
"axios": "^1.6.2",
"class-transformer": "^0.5.1",
"core-js": "^3.8.3",
"dayjs": "^1.10.7",
Expand Down Expand Up @@ -67,4 +67,4 @@
"vue-cli-plugin-vuetify": "~2.4.8",
"vue3-jest": "^27.0.0-alpha.1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {
OFFERING_VALIDATION_CSV_CONTENT_FORMAT_ERROR,
} from "@/constants";
import { DATE_ONLY_ISO_FORMAT, useFormatters } from "@/composables";
import { FileUploadProgressEventArgs } from "@/services/http/common/FileUploadProgressEvent";
import { OfferingSummaryPurpose } from "@/types/contracts/OfferingSummaryPurpose";
import { AxiosProgressEvent } from "axios";

export class EducationProgramOfferingService {
// Share Instance
Expand Down Expand Up @@ -297,7 +297,7 @@ export class EducationProgramOfferingService {
async offeringBulkInsert(
file: Blob,
validationOnly: boolean,
onUploadProgress: (progressEvent: FileUploadProgressEventArgs) => void,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
): Promise<OfferingsUploadBulkInsert[]> {
try {
await ApiClient.EducationProgramOffering.offeringBulkInsert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import {
ScholasticStandingSubmittedDetailsAPIOutDTO,
} from "@/services/http/dto";
import { ApplicationBulkWithdrawal } from "@/types/contracts/institution/ScholasticStanding";
import { FileUploadProgressEventArgs } from "./http/common/FileUploadProgressEvent";
import {
APPLICATION_WITHDRAWAL_VALIDATION_ERROR,
APPLICATION_WITHDRAWAL_INVALID_TEXT_FILE_ERROR,
APPLICATION_WITHDRAWAL_TEXT_CONTENT_FORMAT_ERROR,
} from "@/constants";
import { ApiProcessError } from "@/types";
import { AxiosProgressEvent } from "axios";

/**
* Client service layer for Scholastic standing.
Expand Down Expand Up @@ -86,7 +86,7 @@ export class ScholasticStandingService {
async applicationBulkWithdrawal(
file: Blob,
validationOnly: boolean,
onUploadProgress: (progressEvent: FileUploadProgressEventArgs) => void,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
): Promise<ApplicationBulkWithdrawal[]> {
try {
await ApiClient.ScholasticStandingApi.applicationBulkWithdrawal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import {
EducationProgramOfferingBasicDataAPIInDTO,
EducationProgramOfferingSummaryViewAPIOutDTO,
} from "@/services/http/dto";
import { AxiosRequestConfig } from "axios";
import { AxiosProgressEvent, AxiosRequestConfig } from "axios";
import ApiClient from "./ApiClient";
import { FileUploadProgressEventArgs } from "@/services/http/common/FileUploadProgressEvent";
import { OfferingSummaryPurpose } from "@/types/contracts/OfferingSummaryPurpose";

export class EducationProgramOfferingApi extends HttpBaseClient {
Expand Down Expand Up @@ -285,7 +284,7 @@ export class EducationProgramOfferingApi extends HttpBaseClient {
async offeringBulkInsert(
file: Blob,
validationOnly: boolean,
onUploadProgress: (progressEvent: FileUploadProgressEventArgs) => void,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
): Promise<void> {
const formData = new FormData();
formData.append("file", file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {
ScholasticStandingDataAPIInDTO,
ScholasticStandingSubmittedDetailsAPIOutDTO,
} from "@/services/http/dto";
import { FileUploadProgressEventArgs } from "./common/FileUploadProgressEvent";
import { AxiosRequestConfig } from "axios";
import { AxiosProgressEvent, AxiosRequestConfig } from "axios";
import ApiClient from "./ApiClient";

/**
Expand Down Expand Up @@ -56,7 +55,7 @@ export class ScholasticStandingApi extends HttpBaseClient {
async applicationBulkWithdrawal(
file: Blob,
validationOnly: boolean,
onUploadProgress: (progressEvent: FileUploadProgressEventArgs) => void,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
): Promise<void> {
const formData = new FormData();
formData.append("file", file);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export default abstract class HttpBaseClient {
* @param error error to be inspect.
*/
protected handleAPICustomError(error: unknown): never {
const axiosError = error as AxiosError;
const axiosError = error as AxiosError<ApiProcessError>;
if (axiosError.isAxiosError && axiosError.response?.data) {
throw new ApiProcessError(
axiosError.response.data.message,
Expand Down
Loading

0 comments on commit 9e4db8b

Please sign in to comment.