From 7047ba69cfe6b5990fcd57bafd00d7877e66b9d6 Mon Sep 17 00:00:00 2001 From: "Jacob Nardella (Swofty)" Date: Sun, 15 Nov 2026 21:35:36 +1100 Subject: [PATCH 1/7] build(deps): add the @monashcoding packages --- packages/db/package.json | 2 + packages/ingest/package.json | 1 + packages/scraper/package.json | 1 + packages/webapp/package.json | 15 +- pnpm-lock.yaml | 559 ++++++++++++++++++++++++++-------- 5 files changed, 455 insertions(+), 123 deletions(-) diff --git a/packages/db/package.json b/packages/db/package.json index d10d6bf..5506a77 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -17,12 +17,14 @@ "test": "node --test 'src/*.test.ts'" }, "dependencies": { + "@monashcoding/db": "0.2.0", "@monmap/scraper": "workspace:*", "dotenv": "^18.0.6", "drizzle-orm": "0.45.4", "postgres": "^3.4.9" }, "devDependencies": { + "@monashcoding/tsconfig": "0.2.0", "drizzle-kit": "^0.31.11" } } diff --git a/packages/ingest/package.json b/packages/ingest/package.json index d3aa3ca..f7ba638 100644 --- a/packages/ingest/package.json +++ b/packages/ingest/package.json @@ -17,6 +17,7 @@ "drizzle-orm": "0.45.4" }, "devDependencies": { + "@monashcoding/tsconfig": "0.2.0", "tsx": "^4.23.15" } } diff --git a/packages/scraper/package.json b/packages/scraper/package.json index 2b2f784..c772d93 100644 --- a/packages/scraper/package.json +++ b/packages/scraper/package.json @@ -13,6 +13,7 @@ "typecheck": "tsc --noEmit" }, "devDependencies": { + "@monashcoding/tsconfig": "0.2.0", "tsx": "^4.23.15" } } diff --git a/packages/webapp/package.json b/packages/webapp/package.json index df9ac94..8d4b05e 100644 --- a/packages/webapp/package.json +++ b/packages/webapp/package.json @@ -23,17 +23,20 @@ "@base-ui/react": "^1.8.0", "@dagrejs/dagre": "^3.1.1", "@dnd-kit/core": "^6.3.1", + "@monashcoding/analytics": "0.2.0", + "@monashcoding/auth": "0.2.0", + "@monashcoding/server": "0.2.0", "@monmap/db": "workspace:*", - "@next/third-parties": "^16.4.2", + "@next/third-parties": "^16.4.6", "@xyflow/react": "^12.12.0", - "better-auth": "^1.7.7", + "better-auth": "^1.7.25", "boring-avatars": "2.0.4", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "dotenv": "^18.0.6", "drizzle-orm": "0.45.4", - "jose": "^6.2.12", + "jose": "^6.2.17", "lucide-react": "^1.53.0", "next": "16.4.3", "next-themes": "^0.4.6", @@ -44,9 +47,12 @@ "react-dom": "^19.3.0", "sonner": "^2.0.8", "tailwind-merge": "^3.7.0", - "tw-animate-css": "^1.4.0" + "tw-animate-css": "^1.4.0", + "zod": "^4.6.7" }, "devDependencies": { + "@monashcoding/lint": "0.2.0", + "@monashcoding/tsconfig": "0.2.0", "@next/bundle-analyzer": "^16.4.0", "@tailwindcss/postcss": "^4.3.3", "@types/node": "^24.19.1", @@ -54,6 +60,7 @@ "@types/react-dom": "^19.3.0", "eslint": "^9.39.5", "eslint-config-next": "16.3.8", + "oxlint": "1.93.0", "postcss": "^8.5.29", "prettier": "^3.9.9", "prettier-plugin-tailwindcss": "^0.8.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bab82c3..e68079e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,6 +29,9 @@ importers: packages/db: dependencies: + '@monashcoding/db': + specifier: 0.2.0 + version: 0.2.0(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9))(postgres@3.4.9) '@monmap/scraper': specifier: workspace:* version: link:../scraper @@ -42,6 +45,9 @@ importers: specifier: ^3.4.9 version: 3.4.9 devDependencies: + '@monashcoding/tsconfig': + specifier: 0.2.0 + version: 0.2.0 drizzle-kit: specifier: ^0.31.11 version: 0.31.11 @@ -58,12 +64,18 @@ importers: specifier: 0.45.4 version: 0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9) devDependencies: + '@monashcoding/tsconfig': + specifier: 0.2.0 + version: 0.2.0 tsx: specifier: ^4.23.15 version: 4.23.15 packages/scraper: devDependencies: + '@monashcoding/tsconfig': + specifier: 0.2.0 + version: 0.2.0 tsx: specifier: ^4.23.15 version: 4.23.15 @@ -79,18 +91,27 @@ importers: '@dnd-kit/core': specifier: ^6.3.1 version: 6.3.1(react-dom@19.3.0(react@19.3.0))(react@19.3.0) + '@monashcoding/analytics': + specifier: 0.2.0 + version: 0.2.0(posthog-js@1.438.3(@types/react@19.3.0)(react@19.3.0))(posthog-node@5.55.1)(react@19.3.0) + '@monashcoding/auth': + specifier: 0.2.0 + version: 0.2.0(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react@19.3.0) + '@monashcoding/server': + specifier: 0.2.0 + version: 0.2.0 '@monmap/db': specifier: workspace:* version: link:../db '@next/third-parties': - specifier: ^16.4.2 - version: 16.4.2(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react@19.3.0) + specifier: ^16.4.6 + version: 16.4.6(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react@19.3.0) '@xyflow/react': specifier: ^12.12.0 version: 12.12.0(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(immer@11.1.4)(react-dom@19.3.0(react@19.3.0))(react@19.3.0) better-auth: - specifier: ^1.7.7 - version: 1.7.7(@opentelemetry/api@1.9.1)(drizzle-kit@0.31.11)(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9))(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react-dom@19.3.0(react@19.3.0))(react@19.3.0) + specifier: ^1.7.25 + version: 1.7.25(@opentelemetry/api@1.9.1)(drizzle-kit@0.31.11)(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9))(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react-dom@19.3.0(react@19.3.0))(react@19.3.0) boring-avatars: specifier: 2.0.4 version: 2.0.4(react-dom@19.3.0(react@19.3.0))(react@19.3.0) @@ -110,8 +131,8 @@ importers: specifier: 0.45.4 version: 0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9) jose: - specifier: ^6.2.12 - version: 6.2.12 + specifier: ^6.2.17 + version: 6.2.17 lucide-react: specifier: ^1.53.0 version: 1.53.0(@types/react@19.3.0)(react@19.3.0) @@ -145,7 +166,16 @@ importers: tw-animate-css: specifier: ^1.4.0 version: 1.4.0 + zod: + specifier: ^4.6.7 + version: 4.6.7 devDependencies: + '@monashcoding/lint': + specifier: 0.2.0 + version: 0.2.0(oxlint@1.93.0) + '@monashcoding/tsconfig': + specifier: 0.2.0 + version: 0.2.0 '@next/bundle-analyzer': specifier: ^16.4.0 version: 16.4.0 @@ -167,6 +197,9 @@ importers: eslint-config-next: specifier: 16.3.8 version: 16.3.8(@typescript-eslint/parser@8.71.0(eslint@9.39.5(jiti@2.7.0))(typescript@6.0.3))(eslint@9.39.5(jiti@2.7.0))(typescript@6.0.3) + oxlint: + specifier: 1.93.0 + version: 1.93.0 postcss: specifier: ^8.5.29 version: 8.5.29 @@ -287,13 +320,13 @@ packages: '@types/react': optional: true - '@better-auth/core@1.7.7': - resolution: {integrity: sha512-srgFzHEjB2WWlokFz1i4BfG41sNhsA105Pukgqu6RrEh5A+LSkzf1mCHydVipkjt9l5qswtBMi7IL6ouHbZL4Q==} + '@better-auth/core@1.7.25': + resolution: {integrity: sha512-L20SJSCpgKQIiZHZZBP28gvvqwkQ+IJxFwtNEeC4PSWBG1/yu5VckGGAoiieUBOcR/OZNHXW+lPFWcgQHK4ZYQ==} peerDependencies: - '@better-auth/utils': 0.4.2 - '@better-fetch/fetch': 1.3.2 + '@better-auth/utils': ^0.4.2 || ^0.5.0 + '@better-fetch/fetch': 1.3.3 '@opentelemetry/api': ^1.9.0 - better-call: 1.4.0 + better-call: ~1.4.5 jose: ^6.1.0 kysely: ^0.28.5 || ^0.29.0 nanostores: ^1.0.1 @@ -301,47 +334,47 @@ packages: '@opentelemetry/api': optional: true - '@better-auth/drizzle-adapter@1.7.7': - resolution: {integrity: sha512-qon0U94PR5FQysuyGoAlGVQpIIiNg5dtDpwjE63sN/HjoRWZadZzHPcS9mn7JsJyQZK6iTNhd7LD0AaXt2f78w==} + '@better-auth/drizzle-adapter@1.7.25': + resolution: {integrity: sha512-zQvK6PnUUeD3m5B6U/tHUYCRNtvdq2nZ1aT5jV+jdTt4JUpkt0CATYHf1BrXFt0Y9b0vIeCyVk7QjpF5oxJE9w==} peerDependencies: - '@better-auth/core': ^1.7.7 - '@better-auth/utils': 0.4.2 + '@better-auth/core': ^1.7.25 + '@better-auth/utils': ^0.4.2 || ^0.5.0 drizzle-orm: 0.45.4 peerDependenciesMeta: drizzle-orm: optional: true - '@better-auth/kysely-adapter@1.7.7': - resolution: {integrity: sha512-9FONOCgOcrQI9wJ5v1oDGIg9sT7pa9RjZZQ4fsCTudo8R87SrIGNUvUxDFTJhZvUblvFfGaIBR9Vb8LA+8bqLQ==} + '@better-auth/kysely-adapter@1.7.25': + resolution: {integrity: sha512-G/HT0Xg+ZIwAu2W2jUaWkUgAD/R6wws+RYsZ8aBX+JMn8ngSdzVC9brjfJ8JZNaTcm9E0XgfUp8uiZk5CTbVYQ==} peerDependencies: - '@better-auth/core': ^1.7.7 - '@better-auth/utils': 0.4.2 + '@better-auth/core': ^1.7.25 + '@better-auth/utils': ^0.4.2 || ^0.5.0 kysely: ^0.28.17 || ^0.29.0 peerDependenciesMeta: kysely: optional: true - '@better-auth/memory-adapter@1.7.7': - resolution: {integrity: sha512-FqKFEe+b5tXXV0gRbyirca+qXgMpLOeJ8Wk19yykb/scQKy0WJ4k22WzEV3TTPctQV9DZhwCXPlDtQhnlOv5Gg==} + '@better-auth/memory-adapter@1.7.25': + resolution: {integrity: sha512-yn6XdL3FAR0u1qmyZtzpbQl4ZTdxQ9liym6AamiT2Rtu7S3OAwz1ivqpQIAQY4o6aXi/MrCqOlnqXScJCqO+2g==} peerDependencies: - '@better-auth/core': ^1.7.7 - '@better-auth/utils': 0.4.2 + '@better-auth/core': ^1.7.25 + '@better-auth/utils': ^0.4.2 || ^0.5.0 - '@better-auth/mongo-adapter@1.7.7': - resolution: {integrity: sha512-ZnVDuRrXqbf0oHphrEN27oTImNH5NTO26dtWatq5cXyYAsH7goof9QIoTOmxTbBxUQahKBw9T6+9h6n+RtOE+g==} + '@better-auth/mongo-adapter@1.7.25': + resolution: {integrity: sha512-cEErkz3eTTN8Wxgq5PJbF9UN93ypH6EJSVjw+bOFvn6v6RkPzKxwA3kvqsETsM0WVUfnl4zc0J1Np6MhxrJN0g==} peerDependencies: - '@better-auth/core': ^1.7.7 - '@better-auth/utils': 0.4.2 + '@better-auth/core': ^1.7.25 + '@better-auth/utils': ^0.4.2 || ^0.5.0 mongodb: ^6.0.0 || ^7.0.0 peerDependenciesMeta: mongodb: optional: true - '@better-auth/prisma-adapter@1.7.7': - resolution: {integrity: sha512-4YcnrcVdvWiAZw0sZl63tWUClPXg5r3QsLn7C2sG7kKEBY06zOng0ibecyxRBixKq1zE1ceHuEUqez5Rhi+nQA==} + '@better-auth/prisma-adapter@1.7.25': + resolution: {integrity: sha512-s3qr9juC+g53/vNWWn5QqqZywg1EiCwfg+E884GRM6Ves+zp8lREjlXAo0E9Sshz5rcw9rxzJDJY7G/vlxhVEA==} peerDependencies: - '@better-auth/core': ^1.7.7 - '@better-auth/utils': 0.4.2 + '@better-auth/core': ^1.7.25 + '@better-auth/utils': ^0.4.2 || ^0.5.0 '@prisma/client': ^5.0.0 || ^6.0.0 || ^7.0.0 prisma: ^5.0.0 || ^6.0.0 || ^7.0.0 peerDependenciesMeta: @@ -350,21 +383,18 @@ packages: prisma: optional: true - '@better-auth/telemetry@1.7.7': - resolution: {integrity: sha512-PaRA6i+kAioVYmza2gHPcdrxP0hAotph4KV9hft2GeNJq+AZXDiBu3FuLM9HxvcmiZeUT74Vufqd9ypmB8veTA==} + '@better-auth/telemetry@1.7.25': + resolution: {integrity: sha512-O5RqANZISVLX4/lpsRvNjKWqbiZPErJKpnFg1mzrUxhDnROEKniaQdlm+vdxXcxVC5RClh9hrJG7oXVGDHQHnQ==} peerDependencies: - '@better-auth/core': ^1.7.7 - '@better-auth/utils': 0.4.2 - '@better-fetch/fetch': 1.3.2 - - '@better-auth/utils@0.4.2': - resolution: {integrity: sha512-AUxrvu+HaaODsUyzDxFgwd/8RZ1yZaYo42LXKSrU2oGgR38pS1ij8nqQKNgtTWoYGpNevNXtCfgTy6loHveW9A==} + '@better-auth/core': ^1.7.25 + '@better-auth/utils': ^0.4.2 || ^0.5.0 + '@better-fetch/fetch': 1.3.3 - '@better-auth/utils@0.5.0': - resolution: {integrity: sha512-BL8W4EfIZFwlu0r54m3v1ztjDhu6dDe/amLTm0xybmbZaNgYUqhD3SjpAsnq0q8YD6/ki4iwIgxJNLP/N3TxiA==} + '@better-auth/utils@0.5.1': + resolution: {integrity: sha512-WETqw5vQ52uQ/xwWR4E8rTgT6fDEr/wnS+otDNkBCa/69281FCF32OKDdQUcahMCnjsvqXBNiEvAQHFB0EVRRg==} - '@better-fetch/fetch@1.3.2': - resolution: {integrity: sha512-Gs7n99b5tqUC6cQAPbV0uED3IraHB6xQbHLQ/C3l7ZFafHScOx9pQ+DYmP5blbLFShVWLqxNUlI9wi4xU/X+ow==} + '@better-fetch/fetch@1.3.3': + resolution: {integrity: sha512-U6SlDt/GUWtK2JAxS/NhdoYTEim+EL1G5byz2TUj83KjLZBUpYzb5SmX0aXaCnbGkAjFKnV/o/0+cyXMbEcqqg==} '@dagrejs/dagre@3.1.1': resolution: {integrity: sha512-zroZB1dFOFiGgv4Xcrn1DckB1o4aOikPqD2NDQPV0WM//CXGcS6xiD0rNkqHmw6FEg4tabt4nxPLwgCWT+Vb2A==} @@ -1122,6 +1152,57 @@ packages: '@jridgewell/trace-mapping@0.3.31': resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + '@monashcoding/analytics@0.2.0': + resolution: {integrity: sha512-HAHscBwFfNQtF96RWRY284xZeaL5eJnbqkFrJAdUwtXoC8y/F/niYZ0L1oyIxDkUUpCi0WR5Z2jWUxhJ+2ZNqg==} + peerDependencies: + posthog-js: '>=1.200.0' + posthog-node: '>=5' + react: '>=18' + peerDependenciesMeta: + posthog-js: + optional: true + posthog-node: + optional: true + react: + optional: true + + '@monashcoding/auth@0.2.0': + resolution: {integrity: sha512-j5b6MZOObIaRdGrkKjjFoA5J0AvDpzSkYd5TYNqnFzPW2KWlUscLFipzaB3eTx0Mztm6MwZsuznSOU9akgZ34w==} + peerDependencies: + express: '>=4' + next: '>=15' + react: '>=18' + peerDependenciesMeta: + express: + optional: true + next: + optional: true + react: + optional: true + + '@monashcoding/db@0.2.0': + resolution: {integrity: sha512-Mp/ofeeKvx+1nZp5SM3O2/UYWcuSBr4cyvCV3J6MDXc0GbQ07tCI5KsBeqMrHkfF7i06To0TTNHe/GE5AlNXbA==} + hasBin: true + peerDependencies: + drizzle-orm: 0.45.4 + postgres: '>=3.4.5' + + '@monashcoding/lint@0.2.0': + resolution: {integrity: sha512-1mI8gZyFgtcjJjsmfwnrR3LbKuQi2ampt9ZcAvVZnXen6INujxojCdgOzV0AaVs8VP6Dh4mVwVZZW5XgnJrMJQ==} + peerDependencies: + oxlint: 1.93.0 + + '@monashcoding/server@0.2.0': + resolution: {integrity: sha512-be3TkGK6QXpyCWIQP8ABCxUAEpQLRaj3tgtkw3IhoKVZ1ZAe+0Pr/0eaZbmA1N+HGP6Tct06zr8EjvD8306uqQ==} + peerDependencies: + express: '>=4' + peerDependenciesMeta: + express: + optional: true + + '@monashcoding/tsconfig@0.2.0': + resolution: {integrity: sha512-Rzs0CSBj2O7JkTYyiUxmrbL/KdYSau+XhDe1J9Nqnvf3magJFDipE0hczTbtU8IApAlfPSf7PTq//+xUDMAyBg==} + '@napi-rs/wasm-runtime@1.2.4': resolution: {integrity: sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g==} engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} @@ -1190,8 +1271,8 @@ packages: cpu: [x64] os: [win32] - '@next/third-parties@16.4.2': - resolution: {integrity: sha512-R6Nh33bi2vWJ+s3G1HV2dVpkYmgKIRuukFTPEE+c8JbZWglzfxST8gVjVQKR0t4TgpObsNi57mliQEuZrVFDuQ==} + '@next/third-parties@16.4.6': + resolution: {integrity: sha512-Pp2FLFGkiy6FwLcuVTK1U/TNoZuC/+MK31wcp+MAM4dwjoGKufF3RxvgtnTlkBI14Oq1HSyeBqEw0KVoSsZlmg==} peerDependencies: next: ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 react: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0 @@ -1224,9 +1305,131 @@ packages: resolution: {integrity: sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q==} engines: {node: '>=8.0.0'} - '@opentelemetry/semantic-conventions@1.43.0': - resolution: {integrity: sha512-eSYWTm620tTk45EKSedaUL8MFYI8hW164hIXsgIHyxu3VobUB3fFCu5t0hQby6OoWRPsG1KkKUG2M5UadiLiVg==} - engines: {node: '>=14'} + '@oxlint/binding-android-arm-eabi@1.93.0': + resolution: {integrity: sha512-KKw70pbD5Pvq3G2lJ+WQ71XPMjCmg37rkSe2+mDqCRP3PoTSdDMuEi4UOnE8JBtyNM7bek61EC2s0Jt7S7u+Sg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxlint/binding-android-arm64@1.93.0': + resolution: {integrity: sha512-fvr1fTUZGelwRxKDt64pf28aL1WaWgviwz3X+E/FcRYvrlEahH0NECRz/c1SY+K+KWmZk5uAf6h1kQnyBkp/2A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxlint/binding-darwin-arm64@1.93.0': + resolution: {integrity: sha512-VdvSN9JRf4Es6ZzoAdvEeh8tgKdw8L4H82WmA8MMPVfPdZGCwE/nI27Z1HrRHYQhPxOh4kmnxQEioSUFrOvDaw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxlint/binding-darwin-x64@1.93.0': + resolution: {integrity: sha512-QR1V890Ml0YGRG0F/iV0K9igG+pOhe+VWd+aZnxY849rRHZf3F2gEoQks5+GVHf105X9Mh/6HdShTP5juekG2g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxlint/binding-freebsd-x64@1.93.0': + resolution: {integrity: sha512-jDfIbi30zZaKi+rTvig3sge+Xhi8pFFSgHxb0jzovc4qh8ETm/irKV9c7N/JsuwnYc5sbvf4IC8w1vQQ0IL+BA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxlint/binding-linux-arm-gnueabihf@1.93.0': + resolution: {integrity: sha512-qtxZ714ND/koFgVH00QgxlzZiIbRPmguaPhnHRU5DFFtrtEdOrSnZD4U/H2AzXrXkZ59eQbMBnJwbum5XohrIQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm-musleabihf@1.93.0': + resolution: {integrity: sha512-5pJ9NjMvH7WMUqXB6bTTOSemBm39w2cod27Hu3+Yom/GhbTeNXlYcpDx1o4CgBP6fhp0YHG66TNdVaUm6sHjsA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm64-gnu@1.93.0': + resolution: {integrity: sha512-pRf+7jtbt2fHE23SX7qBxRgnBZicUgsoCK1PVIjnOk+t3a6UBkpt/GrKI99WlxsKUxftz/5nv/kfKvScmYywkw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-arm64-musl@1.93.0': + resolution: {integrity: sha512-zM8Fd/K8sqGvsBcJBZ3oVZ3ctGWbszA08IaGt5gFFF5RcunppAI/ZnAXbouABvnWeJ//S44KKlfPZnDDbeiphg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxlint/binding-linux-ppc64-gnu@1.93.0': + resolution: {integrity: sha512-7qKCnvhZKDXJG2pdbLazd2hw4FxjJHbZOFrrbzyy5PdHfPLH9vnNUa1le01A8uItZuYKPBPncH+HCoEiFT4SgA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-riscv64-gnu@1.93.0': + resolution: {integrity: sha512-2pgulxC6G8V5wE750NJE/fRkf9aO6i6yoj10wyaR2EdiNtan4OemsOtsQ0ZTXGdY8Q3IoTmlND3GYvjJsvikYg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-riscv64-musl@1.93.0': + resolution: {integrity: sha512-yWsn6Gg2PnGG5jlyDz5+pHGiMTMiy4adaa4WRMzDgzB8efaShk1JMmTHIBSVLQMh0tYXRs4CN5uJCO79r4Mi4g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@oxlint/binding-linux-s390x-gnu@1.93.0': + resolution: {integrity: sha512-WCn5plwp/ezS2RDPQKp0/EXEVRr9/dDexUdRKmsMFqzNM5xBSZ1wbsi3PuMk1VfkMRnI5BuazCsziCWMXRDOlw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-x64-gnu@1.93.0': + resolution: {integrity: sha512-F2CGjb9LAkzH+IYTZSzd1klQ1vk5z6Utjax64WeLByCkYXbVDbsun+Oy2hLfW2MDSKCvW+jwy/9ld0EPgdeu+A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-x64-musl@1.93.0': + resolution: {integrity: sha512-plf5DE2objcG8Tf7mXRuRa8tT8rzDkpjqXQtKoGsKHWkpgsialbON1+cCtoSEUTVbQUjXvuAm8vV9+3rR0yCBw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxlint/binding-openharmony-arm64@1.93.0': + resolution: {integrity: sha512-Kp2yJrKvoTe9FfKdO/xwLNUbs2bYTMKx0+aoQD1s0h/Tx0kSgtHSdGmrk8tTKdluosjFbo88qYRIaNIX43AfFw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxlint/binding-win32-arm64-msvc@1.93.0': + resolution: {integrity: sha512-vigjcHCFsR6KjnWTEVfaCxcMYapEuaK9FZa1MpewwQ1S+Xud3v0okfkj1RySsD6RF1NRHIjSlQSalTnKIaj3nA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxlint/binding-win32-ia32-msvc@1.93.0': + resolution: {integrity: sha512-0Ot3BEe/AAr2/uQhe55r8CmPlperYk2mQmxdutOru7oU0kir6IiEVHb1TG3GORRlfra97lPHVDLhgmihiKzLrg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxlint/binding-win32-x64-msvc@1.93.0': + resolution: {integrity: sha512-ZzzIIVs/Qkm8trUWYKF0OYub5ALlv50/3gsEZbKAvWgz+yNJX6uRmQ8ySPXU2Q0/Y9m4JCOjhpmC8XUYbPHX5Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@oxlint/plugins@1.93.0': + resolution: {integrity: sha512-bKWQI1g9jn8bWUZsvhbOLfgva576Fbp1KwoTNSUCMdT9tlTAvQS2JkifX1UrhPPdyN4GHvM20HhvIMqqU1yotQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} '@petamoriken/float16@3.9.3': resolution: {integrity: sha512-8awtpHXCx/bNpFt4mt2xdkgtgVvKqty8VbjHI/WWWQuEw+KLzFot3f4+LkQY9YmOtq7A5GdOnqoIC8Pdygjk2g==} @@ -1850,12 +2053,12 @@ packages: engines: {node: '>=6.0.0'} hasBin: true - better-auth@1.7.7: - resolution: {integrity: sha512-Zhgxi/c5ylmfB/sX+nwnBbsFf/j6k0L8DvL6CJXZSrXgxc5pPMC/e7j812zNd4L4B4ELmdURCPw3X8nAOUdcjw==} + better-auth@1.7.25: + resolution: {integrity: sha512-OglRnzasyXpZHMceZBW76tQRbS6lSJhqkxm0l/7db1qJ415ecD1YkKHgOUCvmPbVDLJiB4/fumD2vw2hf+1VCQ==} peerDependencies: '@lynx-js/react': '*' '@prisma/client': ^5.0.0 || ^6.0.0 || ^7.0.0 - '@sveltejs/kit': ^2.0.0 + '@sveltejs/kit': ^2.0.0 || ^3.0.0 '@tanstack/react-start': ^1.0.0 '@tanstack/solid-start': ^1.0.0 drizzle-kit: '>=0.31.4 || >=1.0.0-beta.1' @@ -1909,8 +2112,8 @@ packages: vue: optional: true - better-call@1.4.0: - resolution: {integrity: sha512-bBKOT4vv1kZLDgxVePdilk/Jwkn+dtRRsmi3DzHcDP+WnswyVl6dR59l2HEeP/0cB+bDoopASAesWDPIdd/zZA==} + better-call@1.4.5: + resolution: {integrity: sha512-GVOWfn3pjEfUXn6GrfGf2h7tPAqj1oMLFBWBEswJrSkDKcLk6TIcjV0zexibcZZ0c5N1mkLMsPFopXWzWj/gDQ==} peerDependencies: zod: ^4.0.0 peerDependenciesMeta: @@ -2745,8 +2948,8 @@ packages: resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==} hasBin: true - jose@6.2.12: - resolution: {integrity: sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==} + jose@6.2.17: + resolution: {integrity: sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==} js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -3030,6 +3233,19 @@ packages: resolution: {integrity: sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==} engines: {node: '>= 0.4'} + oxlint@1.93.0: + resolution: {integrity: sha512-19JMsQFX+YvEbcUTFQxjTwhvs0Ibg0D6CFneSLgpwnACWcY/6LjhpGpkPodh0T5aIT1pjMTLlYaeBFzaVgugTA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + oxlint-tsgolint: '>=7.0.2005' + vite-plus: '*' + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + vite-plus: + optional: true + p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -3284,8 +3500,8 @@ packages: engines: {node: '>=10'} hasBin: true - set-cookie-parser@3.1.3: - resolution: {integrity: sha512-xletSdAI5efyVJjsatBbzDkXl3M/Zmad3xfnQe7ZXuBB0yNwW7C2WFsNGjdRNfZunmNHQuX79xs/ACMTLCdcew==} + set-cookie-parser@3.2.2: + resolution: {integrity: sha512-df017qMeYuXo4emL09nlyMpi2i2MtEIKS/6jtXH3vmjFgIRsOi852/5RmhJ4EkvN3ZF8jXadM/EkTPXgc8yPIw==} set-function-length@1.2.2: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} @@ -3620,8 +3836,8 @@ packages: peerDependencies: zod: ^3.25.0 || ^4.0.0 - zod@4.6.5: - resolution: {integrity: sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==} + zod@4.6.7: + resolution: {integrity: sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==} zustand@4.5.7: resolution: {integrity: sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==} @@ -3769,64 +3985,59 @@ snapshots: optionalDependencies: '@types/react': 19.3.0 - '@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5)': + '@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5)': dependencies: - '@better-auth/utils': 0.4.2 - '@better-fetch/fetch': 1.3.2 - '@opentelemetry/semantic-conventions': 1.43.0 + '@better-auth/utils': 0.5.1 + '@better-fetch/fetch': 1.3.3 '@standard-schema/spec': 1.1.0 - better-call: 1.4.0(zod@4.6.5) - jose: 6.2.12 + better-call: 1.4.5(zod@4.6.7) + jose: 6.2.17 kysely: 0.29.6 nanostores: 1.5.5 - zod: 4.6.5 + zod: 4.6.7 optionalDependencies: '@opentelemetry/api': 1.9.1 - '@better-auth/drizzle-adapter@1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2)(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9))': + '@better-auth/drizzle-adapter@1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1)(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9))': dependencies: - '@better-auth/core': 1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5) - '@better-auth/utils': 0.4.2 + '@better-auth/core': 1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5) + '@better-auth/utils': 0.5.1 optionalDependencies: drizzle-orm: 0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9) - '@better-auth/kysely-adapter@1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2)(kysely@0.29.6)': + '@better-auth/kysely-adapter@1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1)(kysely@0.29.6)': dependencies: - '@better-auth/core': 1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5) - '@better-auth/utils': 0.4.2 + '@better-auth/core': 1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5) + '@better-auth/utils': 0.5.1 optionalDependencies: kysely: 0.29.6 - '@better-auth/memory-adapter@1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2)': + '@better-auth/memory-adapter@1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1)': dependencies: - '@better-auth/core': 1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5) - '@better-auth/utils': 0.4.2 + '@better-auth/core': 1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5) + '@better-auth/utils': 0.5.1 - '@better-auth/mongo-adapter@1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2)': + '@better-auth/mongo-adapter@1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1)': dependencies: - '@better-auth/core': 1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5) - '@better-auth/utils': 0.4.2 + '@better-auth/core': 1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5) + '@better-auth/utils': 0.5.1 - '@better-auth/prisma-adapter@1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2)': + '@better-auth/prisma-adapter@1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1)': dependencies: - '@better-auth/core': 1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5) - '@better-auth/utils': 0.4.2 + '@better-auth/core': 1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5) + '@better-auth/utils': 0.5.1 - '@better-auth/telemetry@1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)': + '@better-auth/telemetry@1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)': dependencies: - '@better-auth/core': 1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5) - '@better-auth/utils': 0.4.2 - '@better-fetch/fetch': 1.3.2 + '@better-auth/core': 1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5) + '@better-auth/utils': 0.5.1 + '@better-fetch/fetch': 1.3.3 - '@better-auth/utils@0.4.2': + '@better-auth/utils@0.5.1': dependencies: '@noble/hashes': 2.4.0 - '@better-auth/utils@0.5.0': - dependencies: - '@noble/hashes': 2.4.0 - - '@better-fetch/fetch@1.3.2': {} + '@better-fetch/fetch@1.3.3': {} '@dagrejs/dagre@3.1.1': dependencies: @@ -4324,6 +4535,37 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 + '@monashcoding/analytics@0.2.0(posthog-js@1.438.3(@types/react@19.3.0)(react@19.3.0))(posthog-node@5.55.1)(react@19.3.0)': + optionalDependencies: + posthog-js: 1.438.3(@types/react@19.3.0)(react@19.3.0) + posthog-node: 5.55.1 + react: 19.3.0 + + '@monashcoding/auth@0.2.0(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react@19.3.0)': + dependencies: + jose: 6.2.17 + zod: 4.6.7 + optionalDependencies: + next: 16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0) + react: 19.3.0 + + '@monashcoding/db@0.2.0(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9))(postgres@3.4.9)': + dependencies: + drizzle-orm: 0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9) + postgres: 3.4.9 + zod: 4.6.7 + + '@monashcoding/lint@0.2.0(oxlint@1.93.0)': + dependencies: + '@oxlint/plugins': 1.93.0 + oxlint: 1.93.0 + + '@monashcoding/server@0.2.0': + dependencies: + zod: 4.6.7 + + '@monashcoding/tsconfig@0.2.0': {} + '@napi-rs/wasm-runtime@1.2.4(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)': dependencies: '@emnapi/core': 1.10.0 @@ -4371,7 +4613,7 @@ snapshots: '@next/swc-win32-x64-msvc@16.4.3': optional: true - '@next/third-parties@16.4.2(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react@19.3.0)': + '@next/third-parties@16.4.6(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react@19.3.0)': dependencies: next: 16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0) react: 19.3.0 @@ -4398,7 +4640,64 @@ snapshots: '@opentelemetry/api@1.9.1': optional: true - '@opentelemetry/semantic-conventions@1.43.0': {} + '@oxlint/binding-android-arm-eabi@1.93.0': + optional: true + + '@oxlint/binding-android-arm64@1.93.0': + optional: true + + '@oxlint/binding-darwin-arm64@1.93.0': + optional: true + + '@oxlint/binding-darwin-x64@1.93.0': + optional: true + + '@oxlint/binding-freebsd-x64@1.93.0': + optional: true + + '@oxlint/binding-linux-arm-gnueabihf@1.93.0': + optional: true + + '@oxlint/binding-linux-arm-musleabihf@1.93.0': + optional: true + + '@oxlint/binding-linux-arm64-gnu@1.93.0': + optional: true + + '@oxlint/binding-linux-arm64-musl@1.93.0': + optional: true + + '@oxlint/binding-linux-ppc64-gnu@1.93.0': + optional: true + + '@oxlint/binding-linux-riscv64-gnu@1.93.0': + optional: true + + '@oxlint/binding-linux-riscv64-musl@1.93.0': + optional: true + + '@oxlint/binding-linux-s390x-gnu@1.93.0': + optional: true + + '@oxlint/binding-linux-x64-gnu@1.93.0': + optional: true + + '@oxlint/binding-linux-x64-musl@1.93.0': + optional: true + + '@oxlint/binding-openharmony-arm64@1.93.0': + optional: true + + '@oxlint/binding-win32-arm64-msvc@1.93.0': + optional: true + + '@oxlint/binding-win32-ia32-msvc@1.93.0': + optional: true + + '@oxlint/binding-win32-x64-msvc@1.93.0': + optional: true + + '@oxlint/plugins@1.93.0': {} '@petamoriken/float16@3.9.3': optional: true @@ -4981,25 +5280,25 @@ snapshots: baseline-browser-mapping@2.11.28: {} - better-auth@1.7.7(@opentelemetry/api@1.9.1)(drizzle-kit@0.31.11)(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9))(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react-dom@19.3.0(react@19.3.0))(react@19.3.0): - dependencies: - '@better-auth/core': 1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5) - '@better-auth/drizzle-adapter': 1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2)(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9)) - '@better-auth/kysely-adapter': 1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2)(kysely@0.29.6) - '@better-auth/memory-adapter': 1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2) - '@better-auth/mongo-adapter': 1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2) - '@better-auth/prisma-adapter': 1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2) - '@better-auth/telemetry': 1.7.7(@better-auth/core@1.7.7(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2)(@opentelemetry/api@1.9.1)(better-call@1.4.0(zod@4.6.5))(jose@6.2.12)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.2) - '@better-auth/utils': 0.4.2 - '@better-fetch/fetch': 1.3.2 + better-auth@1.7.25(@opentelemetry/api@1.9.1)(drizzle-kit@0.31.11)(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9))(next@16.4.3(@babel/core@7.29.7)(@opentelemetry/api@1.9.1)(@types/node@24.19.1)(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(react-dom@19.3.0(react@19.3.0))(react@19.3.0): + dependencies: + '@better-auth/core': 1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5) + '@better-auth/drizzle-adapter': 1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1)(drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9)) + '@better-auth/kysely-adapter': 1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1)(kysely@0.29.6) + '@better-auth/memory-adapter': 1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1) + '@better-auth/mongo-adapter': 1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1) + '@better-auth/prisma-adapter': 1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1) + '@better-auth/telemetry': 1.7.25(@better-auth/core@1.7.25(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3)(@opentelemetry/api@1.9.1)(better-call@1.4.5(zod@4.6.7))(jose@6.2.17)(kysely@0.29.6)(nanostores@1.5.5))(@better-auth/utils@0.5.1)(@better-fetch/fetch@1.3.3) + '@better-auth/utils': 0.5.1 + '@better-fetch/fetch': 1.3.3 '@noble/ciphers': 2.4.0 '@noble/hashes': 2.4.0 - better-call: 1.4.0(zod@4.6.5) + better-call: 1.4.5(zod@4.6.7) defu: 6.1.7 - jose: 6.2.12 + jose: 6.2.17 kysely: 0.29.6 nanostores: 1.5.5 - zod: 4.6.5 + zod: 4.6.7 optionalDependencies: drizzle-kit: 0.31.11 drizzle-orm: 0.45.4(@opentelemetry/api@1.9.1)(gel@2.2.0)(kysely@0.29.6)(postgres@3.4.9) @@ -5009,14 +5308,14 @@ snapshots: transitivePeerDependencies: - '@opentelemetry/api' - better-call@1.4.0(zod@4.6.5): + better-call@1.4.5(zod@4.6.7): dependencies: - '@better-auth/utils': 0.5.0 - '@better-fetch/fetch': 1.3.2 + '@better-auth/utils': 0.5.1 + '@better-fetch/fetch': 1.3.3 rou3: 0.9.2 - set-cookie-parser: 3.1.3 + set-cookie-parser: 3.2.2 optionalDependencies: - zod: 4.6.5 + zod: 4.6.7 boring-avatars@2.0.4(react-dom@19.3.0(react@19.3.0))(react@19.3.0): dependencies: @@ -5557,8 +5856,8 @@ snapshots: '@babel/parser': 7.29.9 eslint: 9.39.5(jiti@2.7.0) hermes-parser: 0.25.1 - zod: 4.6.5 - zod-validation-error: 4.0.2(zod@4.6.5) + zod: 4.6.7 + zod-validation-error: 4.0.2(zod@4.6.7) transitivePeerDependencies: - supports-color @@ -5980,7 +6279,7 @@ snapshots: jiti@2.7.0: {} - jose@6.2.12: {} + jose@6.2.17: {} js-tokens@4.0.0: {} @@ -6238,6 +6537,28 @@ snapshots: object-keys: 1.1.1 safe-push-apply: 1.0.0 + oxlint@1.93.0: + optionalDependencies: + '@oxlint/binding-android-arm-eabi': 1.93.0 + '@oxlint/binding-android-arm64': 1.93.0 + '@oxlint/binding-darwin-arm64': 1.93.0 + '@oxlint/binding-darwin-x64': 1.93.0 + '@oxlint/binding-freebsd-x64': 1.93.0 + '@oxlint/binding-linux-arm-gnueabihf': 1.93.0 + '@oxlint/binding-linux-arm-musleabihf': 1.93.0 + '@oxlint/binding-linux-arm64-gnu': 1.93.0 + '@oxlint/binding-linux-arm64-musl': 1.93.0 + '@oxlint/binding-linux-ppc64-gnu': 1.93.0 + '@oxlint/binding-linux-riscv64-gnu': 1.93.0 + '@oxlint/binding-linux-riscv64-musl': 1.93.0 + '@oxlint/binding-linux-s390x-gnu': 1.93.0 + '@oxlint/binding-linux-x64-gnu': 1.93.0 + '@oxlint/binding-linux-x64-musl': 1.93.0 + '@oxlint/binding-openharmony-arm64': 1.93.0 + '@oxlint/binding-win32-arm64-msvc': 1.93.0 + '@oxlint/binding-win32-ia32-msvc': 1.93.0 + '@oxlint/binding-win32-x64-msvc': 1.93.0 + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 @@ -6426,7 +6747,7 @@ snapshots: semver@7.8.5: {} - set-cookie-parser@3.1.3: {} + set-cookie-parser@3.2.2: {} set-function-length@1.2.2: dependencies: @@ -6860,11 +7181,11 @@ snapshots: yocto-queue@0.1.0: {} - zod-validation-error@4.0.2(zod@4.6.5): + zod-validation-error@4.0.2(zod@4.6.7): dependencies: - zod: 4.6.5 + zod: 4.6.7 - zod@4.6.5: {} + zod@4.6.7: {} zustand@4.5.7(@types/react@19.3.0)(immer@11.1.4)(react@19.3.0): dependencies: From 5c0ec1f0c8b299c3b0338bde9fa11d2c8ac38ced Mon Sep 17 00:00:00 2001 From: "Jacob Nardella (Swofty)" Date: Sun, 15 Nov 2026 21:35:36 +1100 Subject: [PATCH 2/7] refactor(webapp): read the environment once and log through createLogger --- packages/webapp/lib/db/entity-stats.ts | 17 +++++++++++--- packages/webapp/lib/db/reviews.ts | 3 ++- packages/webapp/lib/env-public.ts | 17 ++++++++++++++ packages/webapp/lib/env.ts | 32 ++++++++++++++++++++++++++ packages/webapp/lib/log.ts | 4 ++++ packages/webapp/lib/views/visitor.ts | 4 +++- 6 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 packages/webapp/lib/env-public.ts create mode 100644 packages/webapp/lib/env.ts create mode 100644 packages/webapp/lib/log.ts diff --git a/packages/webapp/lib/db/entity-stats.ts b/packages/webapp/lib/db/entity-stats.ts index 57a9d7b..4b38acf 100644 --- a/packages/webapp/lib/db/entity-stats.ts +++ b/packages/webapp/lib/db/entity-stats.ts @@ -10,7 +10,10 @@ */ import { sql, type SQL } from "drizzle-orm" +import { defineJob } from "@monashcoding/server" + import { getDb } from "./client.ts" +import { logger } from "../log.ts" import type { EntityKind } from "../handbook/links.ts" import { viewDay } from "../views/visitor.ts" @@ -154,6 +157,16 @@ function arrayOf(value: SQL): SQL { return sql`(CASE WHEN jsonb_typeof(${value}) = 'array' THEN ${value} ELSE '[]' END)` } +// Never overlaps itself in this process, and logs a failure instead +// of throwing (CONVENTIONS server.jobs). +const refreshJob = defineJob({ + name: "entity-stats-refresh", + logger, + run: async () => { + await refreshEntityStats() + }, +}) + let nextCheck = 0 /** @@ -164,7 +177,5 @@ let nextCheck = 0 export function refreshEntityStatsIfStale(): void { if (Date.now() < nextCheck) return nextCheck = Date.now() + CHECK_MS - refreshEntityStats().catch((err) => { - console.error("entity_stats refresh failed", err) - }) + void refreshJob.run() } diff --git a/packages/webapp/lib/db/reviews.ts b/packages/webapp/lib/db/reviews.ts index 26a71d9..aba34a3 100644 --- a/packages/webapp/lib/db/reviews.ts +++ b/packages/webapp/lib/db/reviews.ts @@ -13,6 +13,7 @@ import { createHmac, randomBytes } from "node:crypto" import { review, reviewAuthorBan } from "@monmap/db" import { and, eq, gt, isNull, sql, type SQL } from "drizzle-orm" +import { env } from "../env.ts" import { getDb } from "./client.ts" import { containsPattern } from "./like.ts" import { REVIEW_AXES, type ReviewKind } from "../reviews/axes.ts" @@ -538,7 +539,7 @@ export interface AdminReview extends PublicReview { */ let tagKey: string | null = null function authorTagKey(): string { - tagKey ??= process.env.REVIEW_TAG_SECRET || randomBytes(32).toString("hex") + tagKey ??= env.REVIEW_TAG_SECRET || randomBytes(32).toString("hex") return tagKey } diff --git a/packages/webapp/lib/env-public.ts b/packages/webapp/lib/env-public.ts new file mode 100644 index 0000000..3b834f5 --- /dev/null +++ b/packages/webapp/lib/env-public.ts @@ -0,0 +1,17 @@ +/* + * The NEXT_PUBLIC_* values, which the bundler inlines at build time. + * Each must be written out as `process.env.NEXT_PUBLIC_X` for that to + * happen, so this file cannot go through defineEnv's lookup by name. + * Safe to import from client components. + */ + +/** The central MAC auth origin the browser signs in against. */ +export const PUBLIC_AUTH_URL = + process.env.NEXT_PUBLIC_AUTH_URL || "https://auth.monashcoding.com" + +/** The public origin of this site, or undefined in local dev. */ +export const PUBLIC_SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || undefined + +/** The PostHog project token. Analytics stays off without it. */ +export const PUBLIC_POSTHOG_TOKEN = + process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN || undefined diff --git a/packages/webapp/lib/env.ts b/packages/webapp/lib/env.ts new file mode 100644 index 0000000..a54d5b5 --- /dev/null +++ b/packages/webapp/lib/env.ts @@ -0,0 +1,32 @@ +/* + * The server environment, read once (CONVENTIONS server.env). Values + * come from the monorepo-root `.env`, which next.config.mjs loads + * before the server boots. Browser code reads lib/env-public.ts. + */ +import { defineEnv, env as e } from "@monashcoding/server" +import { z } from "zod" + +export const env = defineEnv({ + // Runtime only: `next build` imports the routes without a database. + // lib/db/client.ts throws on first use when it is missing. + DATABASE_URL: z.string().optional(), + // The webapp's pool size. Keep it under Postgres max_connections. + DB_POOL_MAX: e.integer(10), + // TLS to Postgres. Unset: required for every host except localhost. + // Set `disable` when the database is on a private Docker network. + DATABASE_SSL: z.enum(["require", "verify-full", "disable"]).optional(), + + // Central MAC auth. @monashcoding/auth reads the same two variables. + AUTH_URL: e.url().default("https://auth.monashcoding.com"), + JWT_AUDIENCE: z.string().default("mac-suite"), + + // PostHog. The token is inlined into the client bundle at build time + // and read again here by the server at runtime. + NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN: z.string().optional(), + NEXT_PUBLIC_POSTHOG_HOST: z.string().optional(), + + // Reviews. REVIEW_ADMIN_EMAILS and CLASSIFIER_* are read per call in + // lib/reviews/admin.ts and lib/reviews/classifier.ts. + REVIEW_TAG_SECRET: z.string().optional(), + VIEW_KEY_SECRET: z.string().optional(), +}) diff --git a/packages/webapp/lib/log.ts b/packages/webapp/lib/log.ts new file mode 100644 index 0000000..ad32761 --- /dev/null +++ b/packages/webapp/lib/log.ts @@ -0,0 +1,4 @@ +import { createLogger } from "@monashcoding/server" + +/** One JSON line per event on stdout (CONVENTIONS server.log). */ +export const logger = createLogger("monmap") diff --git a/packages/webapp/lib/views/visitor.ts b/packages/webapp/lib/views/visitor.ts index f3334b0..1bc86f4 100644 --- a/packages/webapp/lib/views/visitor.ts +++ b/packages/webapp/lib/views/visitor.ts @@ -8,9 +8,11 @@ */ import { createHmac, randomBytes } from "node:crypto" +import { env } from "../env.ts" + // Without VIEW_KEY_SECRET each server process picks a random key, so a // restart counts a returning visitor again on that day. -const SECRET = process.env.VIEW_KEY_SECRET || randomBytes(32).toString("hex") +const SECRET = env.VIEW_KEY_SECRET || randomBytes(32).toString("hex") /** Today in Melbourne as YYYY-MM-DD: a view day follows Monash's day. */ export function viewDay(now: Date = new Date()): string { From a209f2a3c6799bfabd5031f48aea58015ea1d870 Mon Sep 17 00:00:00 2001 From: "Jacob Nardella (Swofty)" Date: Sun, 15 Nov 2026 21:35:36 +1100 Subject: [PATCH 3/7] refactor(db): connect and migrate through @monashcoding/db --- .env.example | 14 ++++--- packages/db/package.json | 2 +- packages/db/src/env.ts | 13 +++++++ packages/db/src/index.ts | 45 +++++++++++----------- packages/db/src/migrate.ts | 15 ++++++++ packages/ingest/src/apply-overrides.ts | 5 ++- packages/ingest/src/backfill-curriculum.ts | 5 ++- packages/ingest/src/eval-curriculum.ts | 5 ++- packages/ingest/src/index.ts | 10 ++--- packages/webapp/lib/db/client.ts | 19 +++++---- 10 files changed, 86 insertions(+), 47 deletions(-) create mode 100644 packages/db/src/migrate.ts diff --git a/.env.example b/.env.example index f055250..fd4bd53 100644 --- a/.env.example +++ b/.env.example @@ -6,6 +6,10 @@ DATABASE_URL=postgres://localhost:5432/monmap # Optional: the webapp's connection pool size (default 10). Keep it under # Postgres max_connections. DB_POOL_MAX= +# Optional: TLS to Postgres (require, verify-full or disable). Unset, +# every host except localhost must serve TLS (@monashcoding/db). Set +# `disable` when the database is on a private Docker network. +DATABASE_SSL= # ---- Public site origin ---- # Canonical URLs, sitemap, robots.txt and OG image URLs resolve from this @@ -17,11 +21,11 @@ NEXT_PUBLIC_SITE_URL=https://monmap.monashcoding.com # ---- Central MAC auth (auth.monashcoding.com) ---- # MonMap consumes the central MAC identity service; it does NOT run its # own auth server or hold OAuth secrets. Server code verifies EdDSA JWTs -# locally against the service's JWKS (packages/webapp/lib/mac-auth.ts). +# locally against the service's JWKS (@monashcoding/auth). # # AUTH_URL — read server-side (JWT issuer + JWKS endpoint). -# NEXT_PUBLIC_AUTH_URL — same value, exposed to the browser so the Better -# Auth react client points sign-in/out at the service. +# NEXT_PUBLIC_AUTH_URL — same value, exposed to the browser so the auth +# client points sign-in/out at the service. # JWT_AUDIENCE — expected `aud` claim on MAC tokens. AUTH_URL=https://auth.monashcoding.com NEXT_PUBLIC_AUTH_URL=https://auth.monashcoding.com @@ -30,8 +34,8 @@ JWT_AUDIENCE=mac-suite # ---- PostHog ---- # Public project token (safe to ship to the browser — PostHog API tokens # are write-only for capture). Used by both -# packages/webapp/lib/analytics.ts (the one posthog.init) and -# packages/webapp/lib/posthog-server.ts; same value either side. Both +# packages/webapp/lib/analytics.ts (the browser) and +# packages/webapp/lib/analytics-server.ts; same value either side. Both # send nothing outside production. NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN= # Server-side host. The browser reaches PostHog through the /ingest diff --git a/packages/db/package.json b/packages/db/package.json index 5506a77..ef180c3 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -11,7 +11,7 @@ }, "scripts": { "generate": "drizzle-kit generate", - "migrate": "drizzle-kit migrate", + "migrate": "node src/migrate.ts", "studio": "drizzle-kit studio", "typecheck": "tsc --noEmit", "test": "node --test 'src/*.test.ts'" diff --git a/packages/db/src/env.ts b/packages/db/src/env.ts index bb56cb8..8e9e0bf 100644 --- a/packages/db/src/env.ts +++ b/packages/db/src/env.ts @@ -14,3 +14,16 @@ export const DATABASE_URL = (() => { if (!url) throw new Error("DATABASE_URL is not set in root .env"); return url; })(); + +/** + * TLS to Postgres: `require`, `verify-full` or `disable`. Unset, + * `@monashcoding/db` requires TLS for every host except localhost. + */ +export const DATABASE_SSL = (() => { + const mode = process.env.DATABASE_SSL; + if (!mode) return undefined; + if (mode === "require" || mode === "verify-full" || mode === "disable") { + return mode; + } + throw new Error("DATABASE_SSL must be require, verify-full or disable"); +})(); diff --git a/packages/db/src/index.ts b/packages/db/src/index.ts index 57a02bc..b7ca7fb 100644 --- a/packages/db/src/index.ts +++ b/packages/db/src/index.ts @@ -1,5 +1,5 @@ import { drizzle } from "drizzle-orm/postgres-js"; -import postgres, { type Options } from "postgres"; +import { createDb as createMacDb, type SslMode } from "@monashcoding/db"; import * as schema from "./schema.ts"; export * from "./schema.ts"; @@ -10,38 +10,39 @@ export * from "./overrides.ts"; export type Database = ReturnType; export interface CreateDbOptions { - /** Override postgres-js pool options. */ - pool?: Options>; + /** Pool size. Defaults to `DB_POOL_MAX`, then 10. */ + max?: number; + /** + * TLS to Postgres. Unset, `@monashcoding/db` requires TLS for every + * host except localhost; pass `disable` for a database on a private + * network that does not serve TLS. + */ + ssl?: SslMode; } /** * Build a Drizzle client bound to a Postgres connection string. * - * We pass `casing: "snake_case"` to match drizzle.config.ts — schema - * fields are camel-cased in TS, snake-cased in the DB. + * The connection comes from `@monashcoding/db`: it names itself + * `monmap` on the server, picks the TLS mode and recycles idle + * sockets. Statements are not prepared: Drizzle runs every query + * through postgres.js `unsafe()`, which never prepares. * - * Pool defaults suit a long-lived process that talks to Postgres - * directly (the self-hosted webapp and the ingest CLI): up to 10 - * connections, idle sockets kept for 5 minutes and each connection - * replaced after an hour. Pass `{ pool }` to tune. - * - * Statements are not prepared. Drizzle runs every query through - * postgres.js `unsafe()`, which never prepares whatever the pool says, - * so `prepare: true` here would have no effect. Do not force it on: - * the variable-length IN and VALUES lists would fill postgres.js's - * per-connection statement cache, which it never evicts. + * The Drizzle client is built here, not taken from the package, + * because the schema needs `casing: "snake_case"` (fields are + * camel-cased in TS, snake-cased in the DB, matching + * drizzle.config.ts) and the package's client has no casing option. */ export function createDb( url: string, options: CreateDbOptions = {}, ): ReturnType> { - const sql = postgres(url, { - max: 10, - prepare: false, - idle_timeout: 300, - max_lifetime: 60 * 60, - connect_timeout: 10, - ...options.pool, + const { sql } = createMacDb({ + app: "monmap", + schema, + url, + ...(options.max === undefined ? {} : { max: options.max }), + ...(options.ssl === undefined ? {} : { ssl: options.ssl }), }); return drizzle(sql, { schema, casing: "snake_case" }); } diff --git a/packages/db/src/migrate.ts b/packages/db/src/migrate.ts new file mode 100644 index 0000000..ee46b29 --- /dev/null +++ b/packages/db/src/migrate.ts @@ -0,0 +1,15 @@ +import { resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import { runMigrations } from "@monashcoding/db"; +import { DATABASE_SSL, DATABASE_URL } from "./env.ts"; + +// Apply the pending migrations in ../drizzle to DATABASE_URL, on one +// connection. Same ledger (drizzle.__drizzle_migrations) as +// `drizzle-kit migrate`, which this replaces. +await runMigrations({ + app: "monmap", + migrationsFolder: resolve(fileURLToPath(import.meta.url), "../../drizzle"), + url: DATABASE_URL, + ...(DATABASE_SSL === undefined ? {} : { ssl: DATABASE_SSL }), +}); +console.log("Migrations applied."); diff --git a/packages/ingest/src/apply-overrides.ts b/packages/ingest/src/apply-overrides.ts index 322369d..c970767 100644 --- a/packages/ingest/src/apply-overrides.ts +++ b/packages/ingest/src/apply-overrides.ts @@ -15,7 +15,7 @@ import { extractRequirementGroups, units, } from "@monmap/db"; -import { DATABASE_URL } from "@monmap/db/env"; +import { DATABASE_SSL, DATABASE_URL } from "@monmap/db/env"; import { loadCurriculumOverrides } from "./overrides.ts"; import { foldPlaceholderUnits } from "./parse.ts"; @@ -28,7 +28,8 @@ console.log( ); const db = createDb(DATABASE_URL, { - pool: { max: 2, idle_timeout: 0, prepare: false }, + max: 2, + ssl: DATABASE_SSL, }); const rows = await db diff --git a/packages/ingest/src/backfill-curriculum.ts b/packages/ingest/src/backfill-curriculum.ts index 571b765..263bd1b 100644 --- a/packages/ingest/src/backfill-curriculum.ts +++ b/packages/ingest/src/backfill-curriculum.ts @@ -32,7 +32,7 @@ import { units, unitYearLinks, } from "@monmap/db"; -import { DATABASE_URL } from "@monmap/db/env"; +import { DATABASE_SSL, DATABASE_URL } from "@monmap/db/env"; import { extractCourseAosRefs, extractUnitYearLinks, @@ -51,7 +51,8 @@ if (yearFlag !== -1 && !/^\d{4}$/.test(onlyYear ?? "")) const overrides = loadCurriculumOverrides(); const db = createDb(DATABASE_URL, { - pool: { max: 2, idle_timeout: 0, prepare: false }, + max: 2, + ssl: DATABASE_SSL, }); const rows = await db diff --git a/packages/ingest/src/eval-curriculum.ts b/packages/ingest/src/eval-curriculum.ts index a0008e0..bb667b5 100644 --- a/packages/ingest/src/eval-curriculum.ts +++ b/packages/ingest/src/eval-curriculum.ts @@ -41,7 +41,7 @@ import { units, type RequirementGroup, } from "@monmap/db"; -import { DATABASE_URL } from "@monmap/db/env"; +import { DATABASE_SSL, DATABASE_URL } from "@monmap/db/env"; import { loadCurriculumOverrides } from "./overrides.ts"; const outFlag = process.argv.indexOf("--out"); @@ -52,7 +52,8 @@ const onlyYear = yearFlag !== -1 ? process.argv[yearFlag + 1] : undefined; const overrides = loadCurriculumOverrides(); const db = createDb(DATABASE_URL, { - pool: { max: 2, idle_timeout: 0, prepare: false }, + max: 2, + ssl: DATABASE_SSL, }); const legacyAuto = (groups: readonly RequirementGroup[]): Set => { diff --git a/packages/ingest/src/index.ts b/packages/ingest/src/index.ts index 263e6f4..599aacd 100644 --- a/packages/ingest/src/index.ts +++ b/packages/ingest/src/index.ts @@ -2,7 +2,7 @@ import { readdir } from "node:fs/promises"; import { join, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { createDb } from "@monmap/db"; -import { DATABASE_URL } from "@monmap/db/env"; +import { DATABASE_SSL, DATABASE_URL } from "@monmap/db/env"; import { ingest } from "./ingest.ts"; function parseArgs(argv: readonly string[]): { year: string; allYears: boolean; dataDir: string } { @@ -24,11 +24,11 @@ function parseArgs(argv: readonly string[]): { year: string; allYears: boolean; } const args = parseArgs(process.argv.slice(2)); -// Ingest is a long-running CLI doing bulk inserts — opt out of the -// serverless-tuned defaults from `createDb` and use a larger pool with -// no idle reaping. +// Ingest is a long-running CLI doing bulk inserts, on a small pool of +// its own. const db = createDb(DATABASE_URL, { - pool: { max: 4, idle_timeout: 0, prepare: false }, + max: 4, + ssl: DATABASE_SSL, }); const years = args.allYears diff --git a/packages/webapp/lib/db/client.ts b/packages/webapp/lib/db/client.ts index c36ecc8..d59d13c 100644 --- a/packages/webapp/lib/db/client.ts +++ b/packages/webapp/lib/db/client.ts @@ -1,5 +1,7 @@ import { createDb, type Database } from "@monmap/db" +import { env } from "../env.ts" + // DATABASE_URL is loaded from the monorepo-root `.env` by // `next.config.mjs` before the Node process boots. See CLAUDE.md §1. @@ -9,16 +11,17 @@ let cached: Database | null = null * One Drizzle client per Node process. Next.js can hot-reload server * modules in dev; caching on the global avoids proliferating pg pools. * - * The webapp is a long-lived Node server that talks to Postgres - * directly, which is what `createDb`'s pool defaults are for. The pool - * size comes from `DB_POOL_MAX` (default 10), so it can follow Postgres - * `max_connections`. Statements are not prepared; `createDb` says why. + * The connection comes from `@monashcoding/db` through `createDb` in + * `@monmap/db`. The pool size comes from `DB_POOL_MAX` (default 10), + * so it can follow Postgres `max_connections`, and the TLS mode from + * `DATABASE_SSL`. */ export function getDb(): Database { if (cached) return cached - const url = process.env.DATABASE_URL - if (!url) throw new Error("DATABASE_URL is not set in root .env") - const max = Number(process.env.DB_POOL_MAX) || 10 - cached = createDb(url, { pool: { max } }) + if (!env.DATABASE_URL) throw new Error("DATABASE_URL is not set in root .env") + cached = createDb(env.DATABASE_URL, { + max: env.DB_POOL_MAX, + ssl: env.DATABASE_SSL, + }) return cached } From 6ceb45e245189d54675c9d17065c83423d8696db Mon Sep 17 00:00:00 2001 From: "Jacob Nardella (Swofty)" Date: Sun, 15 Nov 2026 21:35:50 +1100 Subject: [PATCH 4/7] refactor(webapp): use @monashcoding/auth and @monashcoding/analytics The token verifier, the session lookup, the browser auth client, the PostHog client, the identify bridge and the /ingest proxy now come from the packages. Auth and analytics move together because the identify bridge reads the session from the new auth client. --- CLAUDE.md | 4 +- packages/webapp/README.md | 2 +- packages/webapp/app/actions.ts | 8 +- packages/webapp/app/ingest/[...path]/route.ts | 68 +----- packages/webapp/app/layout.tsx | 11 +- packages/webapp/app/plans/new-plan-button.tsx | 4 +- packages/webapp/app/plans/plan-card.tsx | 8 +- packages/webapp/app/review-actions.ts | 4 +- packages/webapp/components/analytics.tsx | 21 ++ .../webapp/components/anonymous-badge.tsx | 4 +- packages/webapp/components/app-header.tsx | 36 ++-- .../components/google-sign-in-button.tsx | 14 +- .../webapp/components/planner/aos-picker.tsx | 6 +- .../components/planner/course-picker.tsx | 4 +- .../components/planner/planner-context.tsx | 4 +- .../webapp/components/planner/unit-card.tsx | 4 +- .../components/planner/unit-search-dialog.tsx | 4 +- .../webapp/components/planner/wam-context.tsx | 4 +- .../webapp/components/posthog-identify.tsx | 34 --- .../components/reviews/reviews-client.tsx | 10 +- packages/webapp/eslint.config.mjs | 9 +- packages/webapp/lib/analytics-server.ts | 16 ++ packages/webapp/lib/analytics.ts | 131 ++++-------- packages/webapp/lib/auth-client.ts | 32 ++- packages/webapp/lib/auth-server.ts | 77 ++----- packages/webapp/lib/ingest-proxy.test.ts | 124 ----------- packages/webapp/lib/ingest-proxy.ts | 116 ---------- packages/webapp/lib/mac-auth.test.ts | 202 ------------------ packages/webapp/lib/mac-auth.ts | 91 -------- packages/webapp/lib/posthog-server.ts | 38 ---- 30 files changed, 186 insertions(+), 904 deletions(-) create mode 100644 packages/webapp/components/analytics.tsx delete mode 100644 packages/webapp/components/posthog-identify.tsx create mode 100644 packages/webapp/lib/analytics-server.ts delete mode 100644 packages/webapp/lib/ingest-proxy.test.ts delete mode 100644 packages/webapp/lib/ingest-proxy.ts delete mode 100644 packages/webapp/lib/mac-auth.test.ts delete mode 100644 packages/webapp/lib/mac-auth.ts delete mode 100644 packages/webapp/lib/posthog-server.ts diff --git a/CLAUDE.md b/CLAUDE.md index 3549445..c935be8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -91,8 +91,8 @@ than gray. - Client code sends PostHog events only through `lib/analytics.ts`. An eslint rule blocks direct `posthog-js` imports. -- Server code sends events only through `captureServer` in - `lib/posthog-server.ts`. +- Server code sends events only through `serverAnalytics` in + `lib/analytics-server.ts`. - No event, property or label may carry an email, a name, a plan name or a grade. - Page views for the `/search` sorts are counted in Postgres, not PostHog. diff --git a/packages/webapp/README.md b/packages/webapp/README.md index 647ffde..b98f3e2 100644 --- a/packages/webapp/README.md +++ b/packages/webapp/README.md @@ -12,7 +12,7 @@ reviews. It is a Next.js app in the monorepo. - Analytics: client code sends PostHog events only through `lib/analytics.ts` (an eslint rule enforces it), which loads posthog-js on demand. Server code sends them only through - `captureServer` in `lib/posthog-server.ts`. Neither sends anything + `serverAnalytics.capture` in `lib/analytics-server.ts`. Neither sends anything outside production, and no event carries an email, a name, a plan name or a grade. - Page views for the /search sorts are counted in Postgres, not diff --git a/packages/webapp/app/actions.ts b/packages/webapp/app/actions.ts index 884c765..b31c46f 100644 --- a/packages/webapp/app/actions.ts +++ b/packages/webapp/app/actions.ts @@ -1,7 +1,9 @@ "use server" -import { getClaims, getCurrentUser } from "@/lib/auth-server" -import { captureServer } from "@/lib/posthog-server" +import { getClaims } from "@monashcoding/auth/next" + +import { getCurrentUser } from "@/lib/auth-server" +import { serverAnalytics } from "@/lib/analytics-server" import { cleanGradeCode, cleanMark, @@ -132,7 +134,7 @@ export async function createBlankPlanAction( cleanPlanName(formData?.get("name")?.toString()) ?? "Default plan" const state = defaultState(year, null, 3) const plan = await createUserPlan(u.id, name, state) - await captureServer(u.id, "plan_created_server", { handbook_year: year }) + await serverAnalytics.capture(u.id, "plan_created_server", { handbook_year: year }) redirect(`/?plan=${plan.id}`) } diff --git a/packages/webapp/app/ingest/[...path]/route.ts b/packages/webapp/app/ingest/[...path]/route.ts index 06f68a2..59607bf 100644 --- a/packages/webapp/app/ingest/[...path]/route.ts +++ b/packages/webapp/app/ingest/[...path]/route.ts @@ -1,69 +1,21 @@ /** - * Same-origin proxy for PostHog (`api_host: "/ingest"` in - * lib/analytics.ts), so ad blockers that block PostHog's + * Same-origin proxy for PostHog (`api_host: "/ingest"`, the default in + * `@monashcoding/analytics`), so ad blockers that block PostHog's * hosts don't drop analytics. * * This is a route handler, not a next.config rewrite, because a rewrite * forwards every request header. That includes the shared * `.monashcoding.com` session cookie, which signs its holder in to every - * MAC app. This handler forwards a short allowlist of headers, never a - * cookie, and drops PostHog's set-cookie. The path and header rules - * live in lib/ingest-proxy.ts. + * MAC app. The package's handler forwards a short allowlist of headers, + * never a cookie, drops PostHog's set-cookie, and only reaches the + * paths posthog-js calls. */ +import { createIngestHandler } from "@monashcoding/analytics/ingest" -import { - BodyTooLarge, - capBody, - forwardRequestHeaders, - forwardResponseHeaders, - ingestTarget, - MAX_BODY, -} from "@/lib/ingest-proxy" +const handler = createIngestHandler() export const dynamic = "force-dynamic" -async function proxy(req: Request): Promise { - const url = new URL(req.url) - const target = ingestTarget(url.pathname, url.search) - if (!target) return new Response(null, { status: 404 }) - if (Number(req.headers.get("content-length")) > MAX_BODY) { - return new Response(null, { status: 413 }) - } - const body = req.method === "GET" || req.method === "HEAD" ? null : req.body - - // Node's fetch needs `duplex` to stream a request body; the DOM - // RequestInit type does not list it yet. - const init: RequestInit & { duplex: "half" } = { - method: req.method, - headers: forwardRequestHeaders(req.headers), - // posthog-js sends gzip or base64 bodies; stream the bytes through - // with a cap instead of buffering them. - body: body?.pipeThrough(capBody(MAX_BODY)), - duplex: "half", - cache: "no-store", - // Set before the body is read, so it bounds the upload too. - signal: AbortSignal.timeout(10_000), - // A redirect to another host must not be fetched from the server. - redirect: "manual", - } - - let upstream: Response - try { - upstream = await fetch(target, init) - } catch (e) { - const tooLarge = e instanceof Error && e.cause instanceof BodyTooLarge - return new Response(null, { status: tooLarge ? 413 : 502 }) - } - if (upstream.status >= 300 && upstream.status < 400) { - return new Response(null, { status: 502 }) - } - - return new Response(upstream.body, { - status: upstream.status, - headers: forwardResponseHeaders(upstream.headers), - }) -} - -export const GET = proxy -export const POST = proxy -export const OPTIONS = proxy +export const GET = handler +export const POST = handler +export const OPTIONS = handler diff --git a/packages/webapp/app/layout.tsx b/packages/webapp/app/layout.tsx index c640761..93302bb 100644 --- a/packages/webapp/app/layout.tsx +++ b/packages/webapp/app/layout.tsx @@ -1,9 +1,8 @@ import type { Metadata, Viewport } from "next" import { Poppins } from "next/font/google" -import { GoogleAnalytics } from "@next/third-parties/google" import "./globals.css" -import { PostHogIdentify } from "@/components/posthog-identify" +import { Analytics } from "@/components/analytics" import { ThemeProvider } from "@/components/theme-provider" import { Toaster } from "@/components/ui/sonner" import { siteUrl } from "@/lib/seo" @@ -17,9 +16,6 @@ const poppins = Poppins({ variable: "--font-sans", }) -// Public by design (it ships in every page), so it lives in code, not .env. -const GA_MEASUREMENT_ID = "G-6QWVWW0NLG" - const SITE_DESCRIPTION = "Plan your Monash degree: drag units into semesters, check prerequisites and track your WAM. Read student reviews and see requisite maps for every Monash unit and course." @@ -121,7 +117,7 @@ export default function RootLayout({ > - + {children} {/* Below 601px sonner uses mobileOffset; the toasts then clear the 48px Progress button. globals.css covers 601-767px. */} @@ -132,9 +128,6 @@ export default function RootLayout({ mobileOffset={{ bottom: 80 }} /> - {/* Page views only, Loads in dev too; filter - localhost out by hostname in the GA reports. */} -