From 4d9acc23e4cafe7f02fea2f9611ff0182c2953f8 Mon Sep 17 00:00:00 2001 From: Gabriele Granello <52770098+gabrielegranello@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:13:20 +0200 Subject: [PATCH 1/5] HouseHold calculated in the API (#70) * fix data types and set perform the calculations in the API * fix lint error * socialRentAdjustment types * fix socialRentAdjustments missing data --------- Co-authored-by: Gabriele Granello --- app/api/route.ts | 4 +- app/components/ui/CalculatorInput.tsx | 4 +- app/data/rentRepo.ts | 36 +++--- app/data/socialRentAdjustmentsRepo.ts | 61 ++++++---- app/models/Household.test.ts | 165 ++++++++++++++++++++++---- app/models/Household.ts | 5 +- app/models/tenure/SocialRent.test.ts | 5 +- app/models/tenure/SocialRent.ts | 11 +- app/models/testClasses.ts | 10 +- 9 files changed, 216 insertions(+), 85 deletions(-) diff --git a/app/api/route.ts b/app/api/route.ts index 5b800bea..5c937093 100644 --- a/app/api/route.ts +++ b/app/api/route.ts @@ -2,6 +2,7 @@ import { NextResponse } from "next/server"; import { api, apiSchema } from "../schemas/apiSchema"; import { calculationSchema } from "../schemas/calculationSchema"; import * as calculationService from "../services/calculationService"; +import calculateFairhold from "@/app/models/testClasses"; export async function POST(req: Request) { try { @@ -14,7 +15,8 @@ export async function POST(req: Request) { input = data; } const householdData = await calculationService.getHouseholdData(input); - return NextResponse.json(householdData); + const processedData = calculateFairhold(householdData); + return NextResponse.json(processedData); } catch (err) { console.log("ERROR: API - ", (err as Error).message); const response = { error: (err as Error).message }; diff --git a/app/components/ui/CalculatorInput.tsx b/app/components/ui/CalculatorInput.tsx index eb4bf8f5..7a22bc71 100644 --- a/app/components/ui/CalculatorInput.tsx +++ b/app/components/ui/CalculatorInput.tsx @@ -3,7 +3,6 @@ import React, { useState } from "react"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; -import calculateFairhold from "@/app/models/testClasses"; import { Household } from "@/app/models/Household"; import Dashboard from "./Dashboard"; import { @@ -49,8 +48,7 @@ const CalculatorInput = () => { body: JSON.stringify(data), // pass the form data to the API }); - const jsonData = await response.json(); - const processedData = calculateFairhold(jsonData); + const processedData = await response.json(); // saved processedData & switch to dashboard view setData(processedData); diff --git a/app/data/rentRepo.ts b/app/data/rentRepo.ts index 8c93db57..314d152b 100644 --- a/app/data/rentRepo.ts +++ b/app/data/rentRepo.ts @@ -1,24 +1,30 @@ import prisma from "./db"; -const getRentByITL3 = async (itl3: string): Promise => { - try { - const result = await prisma.rent.aggregate({ - where: { - itl3: { equals: itl3 }, - }, - _avg: { - monthlyMeanRent: true, - }, - }); +const getRentByITL3 = async (itl3: string): Promise => { + try { + const result = await prisma.rent.aggregate({ + where: { + itl3: { equals: itl3 }, + }, + _avg: { + monthlyMeanRent: true, + }, + }); - const monthlyMeanRent = result._avg.monthlyMeanRent; + const monthlyMeanRent = result._avg.monthlyMeanRent; - return monthlyMeanRent; - } catch (error) { - throw new Error(`Data error: Unable to find monthlyMeanRent for itl3 ${itl3}`); + if (monthlyMeanRent === null) { + throw new Error(`No monthlyMeanRent found for itl3 ${itl3}`); } + + return monthlyMeanRent; + } catch (error) { + throw new Error( + `Data error: Unable to find monthlyMeanRent for itl3 ${itl3}` + ); + } }; export const rentRepo = { - getRentByITL3, + getRentByITL3, }; diff --git a/app/data/socialRentAdjustmentsRepo.ts b/app/data/socialRentAdjustmentsRepo.ts index ad9a7a85..ec40542a 100644 --- a/app/data/socialRentAdjustmentsRepo.ts +++ b/app/data/socialRentAdjustmentsRepo.ts @@ -2,36 +2,51 @@ import prisma from "./db"; export type socialRentAdjustmentTypes = { year: string; - inflation: string; - additional: string; - total: string; + inflation: number; + additional: number; + total: number; }[]; -const getSocialRentAdjustments = async (): Promise => { +const getSocialRentAdjustments = + async (): Promise => { try { - const result = await prisma.socialRentAdjustments.findMany({ - select: { - year: true, - inflation: true, - additional: true, - total: true, - } - }); + const result = await prisma.socialRentAdjustments.findMany({ + select: { + year: true, + inflation: true, + additional: true, + total: true, + }, + }); - const socialRentAdjustments: socialRentAdjustmentTypes = result.map(item => ({ - year: item.year || '', - inflation: item.inflation?.toString() || '', - additional: item.additional?.toString() || '', - total: item.total?.toString() || '', - })); + const socialRentAdjustments: socialRentAdjustmentTypes = result.map( + (item) => { + if ( + item.year === null || + item.inflation === null || + item.additional === null || + item.total === null + ) { + throw new Error( + `Data error: Found null values in socialRentAdjustments` + ); + } + return { + year: item.year, + inflation: item.inflation, + additional: item.additional, + total: item.total, + }; + } + ); - return socialRentAdjustments; - + // Return the array after validation + return socialRentAdjustments; } catch (error) { - throw new Error(`Data error: Unable to find socialRentAdjustments`); + throw new Error(`Data error: unable to find socialRentAdjustments`); } -}; + }; export const socialRentAdjustmentsRepo = { - getSocialRentAdjustments, + getSocialRentAdjustments, }; diff --git a/app/models/Household.test.ts b/app/models/Household.test.ts index 3f9e9866..5e7db2ba 100644 --- a/app/models/Household.test.ts +++ b/app/models/Household.test.ts @@ -1,34 +1,149 @@ import { DEFAULT_FORECAST_PARAMETERS } from "./ForecastParameters"; import { Household } from "./Household"; import { Property } from "./Property"; -import { SocialRentAdjustments } from "./tenure/SocialRent"; +import { socialRentAdjustmentTypes } from "../data/socialRentAdjustmentsRepo"; let property: Property; let household: Household; -const socialRentAdjustments: SocialRentAdjustments = [ - { inflation: 3.3, total: 4.3, year: "2001-02" }, - { inflation: 1.7, total: 2.2, year: "2002-03" }, - { inflation: 1.7, total: 2.2, year: "2003-04" }, - { inflation: 2.8, total: 3.3, year: "2004-05" }, - { inflation: 3.1, total: 3.6, year: "2005-06" }, - { inflation: 2.7, total: 3.2, year: "2006-07" }, - { inflation: 3.6, total: 4.1, year: "2007-08" }, - { inflation: 3.9, total: 4.4, year: "2008-09" }, - { inflation: 5.0, total: 5.5, year: "2009-10" }, - { inflation: -1.4, total: -0.9, year: "2010-11" }, - { inflation: 4.6, total: 5.1, year: "2011-12" }, - { inflation: 5.6, total: 6.1, year: "2012-13" }, - { inflation: 2.6, total: 3.1, year: "2013-14" }, - { inflation: 3.2, total: 3.7, year: "2014-15" }, - { inflation: 1.2, total: 2.2, year: "2015-16" }, - { inflation: NaN, total: -1.0, year: "2016-17" }, - { inflation: NaN, total: -1.0, year: "2017-18" }, - { inflation: NaN, total: -1.0, year: "2018-19" }, - { inflation: NaN, total: -1.0, year: "2019-20" }, - { inflation: 1.7, total: 2.7, year: "2020-21" }, - { inflation: 0.5, total: 1.5, year: "2021-22" }, - { inflation: 3.1, total: 4.1, year: "2022-23" }, - { inflation: 10.1, total: 11.1, year: "2023-24" }, +const socialRentAdjustments: socialRentAdjustmentTypes = [ + { + inflation: 3.3, + total: 4.3, + year: "2001-02", + additional: 0, + }, + { + inflation: 1.7, + total: 2.2, + year: "2002-03", + additional: 0, + }, + { + inflation: 1.7, + total: 2.2, + year: "2003-04", + additional: 0, + }, + { + inflation: 2.8, + total: 3.3, + year: "2004-05", + additional: 0, + }, + { + inflation: 3.1, + total: 3.6, + year: "2005-06", + additional: 0, + }, + { + inflation: 2.7, + total: 3.2, + year: "2006-07", + additional: 0, + }, + { + inflation: 3.6, + total: 4.1, + year: "2007-08", + additional: 0, + }, + { + inflation: 3.9, + total: 4.4, + year: "2008-09", + additional: 0, + }, + { + inflation: 5.0, + total: 5.5, + year: "2009-10", + additional: 0, + }, + { + inflation: -1.4, + total: -0.9, + year: "2010-11", + additional: 0, + }, + { + inflation: 4.6, + total: 5.1, + year: "2011-12", + additional: 0, + }, + { + inflation: 5.6, + total: 6.1, + year: "2012-13", + additional: 0, + }, + { + inflation: 2.6, + total: 3.1, + year: "2013-14", + additional: 0, + }, + { + inflation: 3.2, + total: 3.7, + year: "2014-15", + additional: 0, + }, + { + inflation: 1.2, + total: 2.2, + year: "2015-16", + additional: 0, + }, + { + inflation: NaN, + total: -1.0, + year: "2016-17", + additional: 0, + }, + { + inflation: NaN, + total: -1.0, + year: "2017-18", + additional: 0, + }, + { + inflation: NaN, + total: -1.0, + year: "2018-19", + additional: 0, + }, + { + inflation: NaN, + total: -1.0, + year: "2019-20", + additional: 0, + }, + { + inflation: 1.7, + total: 2.7, + year: "2020-21", + additional: 0, + }, + { + inflation: 0.5, + total: 1.5, + year: "2021-22", + additional: 0, + }, + { + inflation: 3.1, + total: 4.1, + year: "2022-23", + additional: 0, + }, + { + inflation: 10.1, + total: 11.1, + year: "2023-24", + additional: 0, + }, ]; beforeEach(() => { diff --git a/app/models/Household.ts b/app/models/Household.ts index dd07e53e..3cfab411 100644 --- a/app/models/Household.ts +++ b/app/models/Household.ts @@ -4,8 +4,9 @@ import { FairholdLandPurchase } from "./tenure/FairholdLandPurchase"; import { FairholdLandRent } from "./tenure/FairholdLandRent"; import { Fairhold } from "./Fairhold"; import { Property } from "./Property"; -import { SocialRent, SocialRentAdjustments } from "./tenure/SocialRent"; +import { SocialRent } from "./tenure/SocialRent"; import { ForecastParameters } from "./ForecastParameters"; +import { socialRentAdjustmentTypes } from "../data/socialRentAdjustmentsRepo"; const HOUSE_MULTIPLIER = 2.4; @@ -15,7 +16,7 @@ type ConstructorParams = Pick< > & { averageRentYearly: number; socialRentAverageEarning: number; - socialRentAdjustments: SocialRentAdjustments; + socialRentAdjustments: socialRentAdjustmentTypes; housePriceIndex: number; }; diff --git a/app/models/tenure/SocialRent.test.ts b/app/models/tenure/SocialRent.test.ts index ec111224..4884a49f 100644 --- a/app/models/tenure/SocialRent.test.ts +++ b/app/models/tenure/SocialRent.test.ts @@ -1,9 +1,10 @@ -import { SocialRent, SocialRentAdjustments } from "./SocialRent"; +import { SocialRent } from "./SocialRent"; +import { socialRentAdjustmentTypes } from "../../data/socialRentAdjustmentsRepo"; let tenureSocialRent: SocialRent; beforeEach(() => { - const socialRentAdjustments: SocialRentAdjustments = [ + const socialRentAdjustments: socialRentAdjustmentTypes = [ { inflation: 3.3, total: 4.3, diff --git a/app/models/tenure/SocialRent.ts b/app/models/tenure/SocialRent.ts index 11325d1f..1bf2d57e 100644 --- a/app/models/tenure/SocialRent.ts +++ b/app/models/tenure/SocialRent.ts @@ -1,22 +1,15 @@ import { WEEKS_PER_MONTH } from "../constants"; import { BED_WEIGHTS_AND_CAPS, NATIONAL_AVERAGES } from "../constants"; +import { socialRentAdjustmentTypes } from "../../data/socialRentAdjustmentsRepo"; interface SocialRentParams { numberOfBedrooms: number; socialRentAverageEarning: number; - socialRentAdjustments: SocialRentAdjustments; + socialRentAdjustments: socialRentAdjustmentTypes; housePriceIndex: number; landToTotalRatio: number; } -export type SocialRentAdjustments = { - year: string; - inflation: number; - // TODO: Is this optional or required? - additional?: number; - total: number; -}[]; - export class SocialRent { socialRentAverageEarning: number; /** adjustment factors that take into account the increase of living cost */ diff --git a/app/models/testClasses.ts b/app/models/testClasses.ts index eedbb938..25939f2e 100644 --- a/app/models/testClasses.ts +++ b/app/models/testClasses.ts @@ -1,24 +1,24 @@ +import { ValidPostcode } from "../schemas/apiSchema"; import { DEFAULT_FORECAST_PARAMETERS } from "./ForecastParameters"; import { Household } from "./Household"; import { HouseType, Property } from "./Property"; import { MONTHS_PER_YEAR } from "./constants"; -import { SocialRentAdjustments } from "./tenure/SocialRent"; +import { socialRentAdjustmentTypes } from "../data/socialRentAdjustmentsRepo"; // TODO: Share type with backend export interface ResponseData { - postcode: string; + postcode: ValidPostcode; houseType: HouseType; houseBedrooms: number; buildPrice: number; houseAge: number; houseSize: number; - newBuildPricePerMetre: number; averagePrice: number; itl3: string; gdhi: number; averageRentMonthly: number; socialRentAverageEarning: number; - socialRentAdjustments: SocialRentAdjustments; + socialRentAdjustments: socialRentAdjustmentTypes; hpi: number; gasBillYearly: number; } @@ -33,7 +33,7 @@ function calculateFairhold(responseData: ResponseData) { // define the property object const property = new Property({ - postcode: responseData.postcode, + postcode: responseData.postcode.postcode, houseType: responseData.houseType, numberOfBedrooms: responseData.houseBedrooms, age: responseData.houseAge, From 96cd71ad9d11d76df9f6d6e170acd527c6f57bca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:14:07 +0200 Subject: [PATCH 2/5] chore(deps-dev): bump lint-staged from 15.2.8 to 15.2.9 (#77) Bumps [lint-staged](https://github.com/lint-staged/lint-staged) from 15.2.8 to 15.2.9. - [Release notes](https://github.com/lint-staged/lint-staged/releases) - [Changelog](https://github.com/lint-staged/lint-staged/blob/master/CHANGELOG.md) - [Commits](https://github.com/lint-staged/lint-staged/compare/v15.2.8...v15.2.9) --- updated-dependencies: - dependency-name: lint-staged dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 38412152..56ec5a4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "husky": "^9.1.4", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", - "lint-staged": "^15.2.8", + "lint-staged": "^15.2.9", "postcss": "^8", "prettier": "3.3.3", "prisma": "^5.14.0", @@ -6686,9 +6686,9 @@ "dev": true }, "node_modules/lint-staged": { - "version": "15.2.8", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.8.tgz", - "integrity": "sha512-PUWFf2zQzsd9EFU+kM1d7UP+AZDbKFKuj+9JNVTBkhUFhbg4MAt6WfyMMwBfM4lYqd4D2Jwac5iuTu9rVj4zCQ==", + "version": "15.2.9", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.9.tgz", + "integrity": "sha512-BZAt8Lk3sEnxw7tfxM7jeZlPRuT4M68O0/CwZhhaw6eeWu0Lz5eERE3m386InivXB64fp/mDID452h48tvKlRQ==", "dev": true, "dependencies": { "chalk": "~5.3.0", diff --git a/package.json b/package.json index 77be9d92..e10c988e 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "husky": "^9.1.4", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", - "lint-staged": "^15.2.8", + "lint-staged": "^15.2.9", "postcss": "^8", "prettier": "3.3.3", "prisma": "^5.14.0", From ddf9b7c6462c071abf1c0f81a5ef4fa33fae1886 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:15:07 +0200 Subject: [PATCH 3/5] chore(deps-dev): bump @types/react from 18.3.3 to 18.3.4 (#74) Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.3.3 to 18.3.4. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 56ec5a4a..4486b730 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1971,9 +1971,9 @@ "dev": true }, "node_modules/@types/react": { - "version": "18.3.3", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", - "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", + "version": "18.3.4", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.4.tgz", + "integrity": "sha512-J7W30FTdfCxDDjmfRM+/JqLHBIyl7xUIp9kwK637FGmY7+mkSFSe6L4jpZzhj5QMfLssSDP4/i75AKkrdC7/Jw==", "dev": true, "dependencies": { "@types/prop-types": "*", From 4a6af5fdead904dac9f19fcbc54f5fe787955ec6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 09:29:04 +0100 Subject: [PATCH 4/5] chore(deps-dev): bump ts-jest from 29.1.4 to 29.2.5 (#75) Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 29.1.4 to 29.2.5. - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/kulshekhar/ts-jest/compare/v29.1.4...v29.2.5) --- updated-dependencies: - dependency-name: ts-jest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 117 ++++++++++++++++++++++++++++++++-------------- package.json | 2 +- 2 files changed, 84 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4486b730..3117e66b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "prettier": "3.3.3", "prisma": "^5.14.0", "tailwindcss": "^3.4.10", - "ts-jest": "^29.1.4", + "ts-jest": "^29.2.5", "typescript": "^5" } }, @@ -2565,6 +2565,12 @@ "integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==", "dev": true }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true + }, "node_modules/asynciterator.prototype": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz", @@ -3596,6 +3602,21 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.664", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.664.tgz", @@ -4424,6 +4445,36 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -5552,6 +5603,24 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/jake": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", + "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", + "dev": true, + "dependencies": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/javascript-natural-sort": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", @@ -8613,13 +8682,10 @@ "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" }, "node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -8627,18 +8693,6 @@ "node": ">=10" } }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/set-function-length": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.1.tgz", @@ -9317,19 +9371,20 @@ "dev": true }, "node_modules/ts-jest": { - "version": "29.1.4", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.4.tgz", - "integrity": "sha512-YiHwDhSvCiItoAgsKtoLFCuakDzDsJ1DLDnSouTaTmdOcOwIkSzbLXduaQ6M5DRVhuZC/NYaaZ/mtHbWMv/S6Q==", + "version": "29.2.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.5.tgz", + "integrity": "sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==", "dev": true, "dependencies": { - "bs-logger": "0.x", - "fast-json-stable-stringify": "2.x", + "bs-logger": "^0.2.6", + "ejs": "^3.1.10", + "fast-json-stable-stringify": "^2.1.0", "jest-util": "^29.0.0", "json5": "^2.2.3", - "lodash.memoize": "4.x", - "make-error": "1.x", - "semver": "^7.5.3", - "yargs-parser": "^21.0.1" + "lodash.memoize": "^4.1.2", + "make-error": "^1.3.6", + "semver": "^7.6.3", + "yargs-parser": "^21.1.1" }, "bin": { "ts-jest": "cli.js" @@ -9985,12 +10040,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/yaml": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", diff --git a/package.json b/package.json index e10c988e..cb80b76c 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "prettier": "3.3.3", "prisma": "^5.14.0", "tailwindcss": "^3.4.10", - "ts-jest": "^29.1.4", + "ts-jest": "^29.2.5", "typescript": "^5" } } From 0ee8f4f9b2d29b02fb0e5a0f37ca00274bfb8a27 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 09:29:51 +0100 Subject: [PATCH 5/5] chore(deps): bump mathjs from 12.3.2 to 13.1.0 (#73) Bumps [mathjs](https://github.com/josdejong/mathjs) from 12.3.2 to 13.1.0. - [Changelog](https://github.com/josdejong/mathjs/blob/develop/HISTORY.md) - [Commits](https://github.com/josdejong/mathjs/compare/v12.3.2...v13.1.0) --- updated-dependencies: - dependency-name: mathjs dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 41 ++++++++++++++--------------------------- package.json | 2 +- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3117e66b..b1e5699d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@prisma/client": "^5.14.0", "chart.js": "^4.4.3", "dotenv": "^16.4.5", - "mathjs": "^12.3.2", + "mathjs": "^13.1.0", "next": "^14.2.3", "postcode": "^5.1.0", "react": "^18", @@ -636,9 +636,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz", - "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==", + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.4.tgz", + "integrity": "sha512-DSgLeL/FNcpXuzav5wfYvHCGvynXkJbn3Zvc3823AEe9nPwW9IK4UoCSS5yGymmQzN0pCPvivtgS6/8U2kkm1w==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -4566,7 +4566,6 @@ "version": "4.3.7", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", - "dev": true, "engines": { "node": "*" }, @@ -7268,19 +7267,19 @@ } }, "node_modules/mathjs": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-12.3.2.tgz", - "integrity": "sha512-o+HwBVD71MHdYpdScDd6CEcdd6CJOF2eXQJE0kNuIkfTjffPyqoeYdYkzVqimTUr1YgIQkNbL8MakHCZ2Ml7mg==", + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-13.1.0.tgz", + "integrity": "sha512-5BI//cQdcKtDgstJ3QbKYyrWLyUEEHY9ZQgA3laaPyTis+ca8Y7GCxbLFFLYv8nkpOFTIF55FLKoiqQaufj1dQ==", "dependencies": { - "@babel/runtime": "^7.23.9", + "@babel/runtime": "^7.25.4", "complex.js": "^2.1.1", "decimal.js": "^10.4.3", "escape-latex": "^1.2.0", - "fraction.js": "4.3.4", + "fraction.js": "^4.3.7", "javascript-natural-sort": "^0.7.1", "seedrandom": "^3.0.5", "tiny-emitter": "^2.1.0", - "typed-function": "^4.1.1" + "typed-function": "^4.2.1" }, "bin": { "mathjs": "bin/cli.js" @@ -7289,18 +7288,6 @@ "node": ">= 18" } }, - "node_modules/mathjs/node_modules/fraction.js": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.4.tgz", - "integrity": "sha512-pwiTgt0Q7t+GHZA4yaLjObx4vXmmdcS0iSJ19o8d/goUGgItX9UZWKWNnLHehxviD8wU2IWRsnR8cD5+yOJP2Q==", - "engines": { - "node": "*" - }, - "funding": { - "type": "patreon", - "url": "https://github.com/sponsors/rawify" - } - }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -9593,11 +9580,11 @@ } }, "node_modules/typed-function": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.1.1.tgz", - "integrity": "sha512-Pq1DVubcvibmm8bYcMowjVnnMwPVMeh0DIdA8ad8NZY2sJgapANJmiigSUwlt+EgXxpfIv8MWrQXTIzkfYZLYQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.2.1.tgz", + "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==", "engines": { - "node": ">= 14" + "node": ">= 18" } }, "node_modules/typescript": { diff --git a/package.json b/package.json index cb80b76c..d47c3374 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@prisma/client": "^5.14.0", "chart.js": "^4.4.3", "dotenv": "^16.4.5", - "mathjs": "^12.3.2", + "mathjs": "^13.1.0", "next": "^14.2.3", "postcode": "^5.1.0", "react": "^18",