diff --git a/ui/.env.development b/ui/.env.development new file mode 100644 index 00000000..f680f4b1 --- /dev/null +++ b/ui/.env.development @@ -0,0 +1 @@ +AUTH_CLIENT_ID=dashboard \ No newline at end of file diff --git a/ui/components/portfolio-position-row.tsx b/ui/components/portfolio-position-row.tsx index e10ad1aa..594da6cd 100644 --- a/ui/components/portfolio-position-row.tsx +++ b/ui/components/portfolio-position-row.tsx @@ -1,4 +1,4 @@ -import { components } from "@/lib/api/v1"; +import { components, SchemaPortfolioPosition } from "@/lib/api/v1"; import { classNames, shorten } from "@/lib/util"; import { ArrowDownIcon, @@ -9,7 +9,7 @@ import FormattedCurrency from "./formatted-currency"; import FormattedPercentage from "./formatted-percentage"; interface PortfolioPositionRowProps { - position: components["schemas"]["PortfolioPosition"]; + position: SchemaPortfolioPosition; } export default function PortfolioPositionRow({ diff --git a/ui/lib/api/index.ts b/ui/lib/api/index.ts index 5ffa935d..d0ad241c 100644 --- a/ui/lib/api/index.ts +++ b/ui/lib/api/index.ts @@ -2,7 +2,7 @@ import { decode } from "next-auth/jwt"; import { cookies } from "next/headers"; import createClient, { Middleware } from "openapi-fetch"; import type { paths } from "./v1"; -export * from "./types"; +export * from "./v1"; const authMiddleware: Middleware = { async onRequest({ request }) { @@ -13,7 +13,7 @@ const authMiddleware: Middleware = { : "authjs.session-token"; // Retrieve our frontend auth cookie that contains the encrypted frontend // token - const cookie = cookies().get(cookieName); + const cookie = (await cookies()).get(cookieName); // Decode/decrypt the token to access the backend API token const token = await decode({ diff --git a/ui/lib/api/types.ts b/ui/lib/api/types.ts deleted file mode 100644 index 47870007..00000000 --- a/ui/lib/api/types.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { components } from "./v1"; - -export type Portfolio = components["schemas"]["Portfolio"]; -export type PortfolioEvent = components["schemas"]["PortfolioEvent"]; -export type PortfolioPosition = components["schemas"]["PortfolioPosition"]; -export type PortfolioSnapshot = components["schemas"]["PortfolioSnapshot"]; -export type Security = components["schemas"]["Security"]; -export type Currency = components["schemas"]["Currency"]; diff --git a/ui/lib/api/v1.d.ts b/ui/lib/api/v1.ts similarity index 95% rename from ui/lib/api/v1.d.ts rename to ui/lib/api/v1.ts index 2f0c11dd..48e48f19 100644 --- a/ui/lib/api/v1.d.ts +++ b/ui/lib/api/v1.ts @@ -305,6 +305,18 @@ export interface components { headers: never; pathItems: never; } +export type SchemaCurrency = components['schemas']['Currency']; +export type SchemaGoogleProtobufAny = components['schemas']['GoogleProtobufAny']; +export type SchemaListPortfolioTransactionsResponse = components['schemas']['ListPortfolioTransactionsResponse']; +export type SchemaListPortfoliosResponse = components['schemas']['ListPortfoliosResponse']; +export type SchemaListSecuritiesResponse = components['schemas']['ListSecuritiesResponse']; +export type SchemaListedSecurity = components['schemas']['ListedSecurity']; +export type SchemaPortfolio = components['schemas']['Portfolio']; +export type SchemaPortfolioEvent = components['schemas']['PortfolioEvent']; +export type SchemaPortfolioPosition = components['schemas']['PortfolioPosition']; +export type SchemaPortfolioSnapshot = components['schemas']['PortfolioSnapshot']; +export type SchemaSecurity = components['schemas']['Security']; +export type SchemaStatus = components['schemas']['Status']; export type $defs = Record; export interface operations { PortfolioService_ListPortfolios: { diff --git a/ui/lib/currency.ts b/ui/lib/currency.ts index 5e26d33d..8bbbff13 100644 --- a/ui/lib/currency.ts +++ b/ui/lib/currency.ts @@ -1,4 +1,4 @@ -import { Currency } from "@/lib/api"; +import { SchemaCurrency } from "@/lib/api"; /** * This function returns a currency value to a decimal. Internally, @@ -10,7 +10,7 @@ import { Currency } from "@/lib/api"; * @param currency the currency to convert * @returns a decimal representation */ -export function toDecimal(currency?: Currency): number { +export function toDecimal(currency?: SchemaCurrency): number { if ( currency == undefined || currency.value == undefined || diff --git a/ui/package-lock.json b/ui/package-lock.json index c474f156..637d542b 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -14,7 +14,7 @@ "dayjs": "^1.11.12", "inter-ui": "^4.0.2", "negotiator": "^0.6.3", - "next": "^15.0.0-rc.0", + "next": "^15.1.1-canary.17", "next-auth": "^5.0.0-beta.20", "next-intl": "^3.17.3", "openapi-fetch": "^0.13.0", @@ -29,7 +29,7 @@ "eslint": "^9.0.0", "eslint-config-next": "14.2.17", "eslint-config-prettier": "^9.1.0", - "openapi-typescript": "^7.3.0", + "openapi-typescript": "^7.4.0", "postcss": "^8", "prettier": "^3.3.3", "prettier-plugin-classnames": "^0.7.2", @@ -980,9 +980,9 @@ } }, "node_modules/@next/env": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.0.2.tgz", - "integrity": "sha512-c0Zr0ModK5OX7D4ZV8Jt/wqoXtitLNPwUfG9zElCZztdaZyNVnN40rDXVZ/+FGuR4CcNV5AEfM6N8f+Ener7Dg==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.1.1-canary.17.tgz", + "integrity": "sha512-/ga9OiVgqhY58424C/1SPNTnePepdUAq/c3a3XRo603iK8hrwaFdIs3Teql0sagOCavWZbbQ1tCGNGdgA0oIRg==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { @@ -996,9 +996,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.0.2.tgz", - "integrity": "sha512-GK+8w88z+AFlmt+ondytZo2xpwlfAR8U6CRwXancHImh6EdGfHMIrTSCcx5sOSBei00GyLVL0ioo1JLKTfprgg==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.1-canary.17.tgz", + "integrity": "sha512-h0Ksbbh25uue/N0Phz8mg+PcY044hwwyBYny52Q/wGyDmQVK38ZrnZKf5iomC5LzrBXQ/PEXSB/AE2NTpuCKaQ==", "cpu": [ "arm64" ], @@ -1012,9 +1012,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.0.2.tgz", - "integrity": "sha512-KUpBVxIbjzFiUZhiLIpJiBoelqzQtVZbdNNsehhUn36e2YzKHphnK8eTUW1s/4aPy5kH/UTid8IuVbaOpedhpw==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.1.1-canary.17.tgz", + "integrity": "sha512-1qWxVuSPjiqlAj+ZY5VjWHgEpEUjr/tTSLnh2VdpFZB65cVCX4czBv7sEm6nxbikpaWxnhTzBl/9fa9UTtxq1A==", "cpu": [ "x64" ], @@ -1028,9 +1028,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.0.2.tgz", - "integrity": "sha512-9J7TPEcHNAZvwxXRzOtiUvwtTD+fmuY0l7RErf8Yyc7kMpE47MIQakl+3jecmkhOoIyi/Rp+ddq7j4wG6JDskQ==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.1.1-canary.17.tgz", + "integrity": "sha512-OlJUJ4LjuzgYOxRRSaCYtAwoMXaxAaSwRReSO5CgX6qOK6dMSWTrujqUKDtk1/psYB83y0cslhVK9yiJ88jqbw==", "cpu": [ "arm64" ], @@ -1044,9 +1044,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.0.2.tgz", - "integrity": "sha512-BjH4ZSzJIoTTZRh6rG+a/Ry4SW0HlizcPorqNBixBWc3wtQtj4Sn9FnRZe22QqrPnzoaW0ctvSz4FaH4eGKMww==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.1.1-canary.17.tgz", + "integrity": "sha512-yk8ATON6c0Ga+LBe7dleR91r4io97mwG2VJkWjW9tN8eCyDXslvbFMbahtrEZ1uQGXxEI9W1Na+bwgRV8AucqA==", "cpu": [ "arm64" ], @@ -1060,9 +1060,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.0.2.tgz", - "integrity": "sha512-i3U2TcHgo26sIhcwX/Rshz6avM6nizrZPvrDVDY1bXcLH1ndjbO8zuC7RoHp0NSK7wjJMPYzm7NYL1ksSKFreA==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.1.1-canary.17.tgz", + "integrity": "sha512-CN1t98mku/UKLbipKguiJIqyOEYL4GivP6GjCzp2scxvpUjqk5e6HhIksxLqweJYyzeLpK9EL0ujQrkiIoMObQ==", "cpu": [ "x64" ], @@ -1076,9 +1076,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.0.2.tgz", - "integrity": "sha512-AMfZfSVOIR8fa+TXlAooByEF4OB00wqnms1sJ1v+iu8ivwvtPvnkwdzzFMpsK5jA2S9oNeeQ04egIWVb4QWmtQ==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.1.1-canary.17.tgz", + "integrity": "sha512-cNrQuTlGXwHw2h2iFLTZmbrl0yLbFX87Ojq65czf+VR7lzKUpdzNmgF2cK6QLEuT9EM5VzsnU1zDsBq941Sang==", "cpu": [ "x64" ], @@ -1092,9 +1092,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.0.2.tgz", - "integrity": "sha512-JkXysDT0/hEY47O+Hvs8PbZAeiCQVxKfGtr4GUpNAhlG2E0Mkjibuo8ryGD29Qb5a3IOnKYNoZlh/MyKd2Nbww==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.1.1-canary.17.tgz", + "integrity": "sha512-9Qa1jlLiinfiY7NtnOze5PSa4SVunJ1LfXqPXiVi0SYYdYykL8vM3pKiIGoktLpgW6NCQt0VkjXfoBn/z/s/UA==", "cpu": [ "arm64" ], @@ -1108,9 +1108,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.0.2.tgz", - "integrity": "sha512-foaUL0NqJY/dX0Pi/UcZm5zsmSk5MtP/gxx3xOPyREkMFN+CTjctPfu3QaqrQHinaKdPnMWPJDKt4VjDfTBe/Q==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.1.1-canary.17.tgz", + "integrity": "sha512-cwVCyNXlpo2PZEZNdgr+fI8vro2Bqf2IEUGDhtpftVQI3c2myCGlBW7+wa+T7hn28WnFMrsTcezr5lPh8SK8Ww==", "cpu": [ "x64" ], @@ -1369,12 +1369,12 @@ "license": "Apache-2.0" }, "node_modules/@swc/helpers": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.13.tgz", - "integrity": "sha512-UoKGxQ3r5kYI9dALKJapMmuK+1zWM/H17Z1+iwnNmzcJRnfFuevZs375TA5rW31pu4BS4NoSy1fRsexDXfWn5w==", + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", "license": "Apache-2.0", "dependencies": { - "tslib": "^2.4.0" + "tslib": "^2.8.0" } }, "node_modules/@tailwindcss/forms": { @@ -4472,14 +4472,14 @@ } }, "node_modules/next": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/next/-/next-15.0.2.tgz", - "integrity": "sha512-rxIWHcAu4gGSDmwsELXacqAPUk+j8dV/A9cDF5fsiCMpkBDYkO2AEaL1dfD+nNmDiU6QMCFN8Q30VEKapT9UHQ==", + "version": "15.1.1-canary.17", + "resolved": "https://registry.npmjs.org/next/-/next-15.1.1-canary.17.tgz", + "integrity": "sha512-J66cEt76VfLe8UM6daVfW6vbGrb2Ss290n2TqPmt7wNP1zw/bzifwqZOCK/52ezZKQQyTpA9K4xQN34tu7kkkA==", "license": "MIT", "dependencies": { - "@next/env": "15.0.2", + "@next/env": "15.1.1-canary.17", "@swc/counter": "0.1.3", - "@swc/helpers": "0.5.13", + "@swc/helpers": "0.5.15", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", @@ -4489,25 +4489,25 @@ "next": "dist/bin/next" }, "engines": { - "node": ">=18.18.0" + "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "15.0.2", - "@next/swc-darwin-x64": "15.0.2", - "@next/swc-linux-arm64-gnu": "15.0.2", - "@next/swc-linux-arm64-musl": "15.0.2", - "@next/swc-linux-x64-gnu": "15.0.2", - "@next/swc-linux-x64-musl": "15.0.2", - "@next/swc-win32-arm64-msvc": "15.0.2", - "@next/swc-win32-x64-msvc": "15.0.2", + "@next/swc-darwin-arm64": "15.1.1-canary.17", + "@next/swc-darwin-x64": "15.1.1-canary.17", + "@next/swc-linux-arm64-gnu": "15.1.1-canary.17", + "@next/swc-linux-arm64-musl": "15.1.1-canary.17", + "@next/swc-linux-x64-gnu": "15.1.1-canary.17", + "@next/swc-linux-x64-musl": "15.1.1-canary.17", + "@next/swc-win32-arm64-msvc": "15.1.1-canary.17", + "@next/swc-win32-x64-msvc": "15.1.1-canary.17", "sharp": "^0.33.5" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.41.2", "babel-plugin-react-compiler": "*", - "react": "^18.2.0 || 19.0.0-rc-02c0e824-20241028", - "react-dom": "^18.2.0 || 19.0.0-rc-02c0e824-20241028", + "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "peerDependenciesMeta": { @@ -6190,9 +6190,9 @@ } }, "node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "license": "0BSD" }, "node_modules/type-check": { diff --git a/ui/package.json b/ui/package.json index 0d1cb3ef..86930125 100644 --- a/ui/package.json +++ b/ui/package.json @@ -7,12 +7,11 @@ "build": "next build", "start": "next start", "lint": "next lint", - "generate:types": "openapi-typescript ../openapi.yaml -o lib/api/v1.d.ts", + "generate:types": "openapi-typescript ../openapi.yaml -o lib/api/v1.ts --root-types", "predev": "npm run generate:types", "prebuild": "npm run generate:types" }, "dependencies": { - "next": "^15.0.0-rc.0", "react": "^19.0.0", "react-dom": "^19.0.0", "@headlessui/react": "^2.1.2", @@ -21,6 +20,7 @@ "dayjs": "^1.11.12", "inter-ui": "^4.0.2", "negotiator": "^0.6.3", + "next": "^15.1.1-canary.17", "next-auth": "^5.0.0-beta.20", "next-intl": "^3.17.3", "openapi-fetch": "^0.13.0", @@ -33,7 +33,7 @@ "eslint": "^9.0.0", "eslint-config-next": "14.2.17", "eslint-config-prettier": "^9.1.0", - "openapi-typescript": "^7.3.0", + "openapi-typescript": "^7.4.0", "postcss": "^8", "prettier": "^3.3.3", "prettier-plugin-classnames": "^0.7.2",