change)
Creates the wire-protocol contract every route and every client
component will import from. Renames server.js → server.ts as a pure
rename (zero bytes of logic changed) so the entry point becomes the
first file tsc type-checks against the real compilerOptions.
shared/types.ts — what's in it and why
- ApiResponse<T> envelope: (ApiOk<T> & T) | ApiErr. Every route
returns one of these; client code narrows on `r.success`.
- One typed "Ok" shape per endpoint, keyed by the actual res.json()
call in the current handler. Walked every src/routes/*.js file
and transcribed the literal keys: hpi, soap, note, hospitalCourse,
review, refined, shortened, questions, narrative+summary, etc.
No inventive renaming — wire stays identical, only the types are
new.
- Critical mismatches the types now prevent at compile time:
/api/refine returns `refined` (not `content` — a past bug)
/api/sick-visit/note (not /api/generate-sick-visit — past bug)
/api/generate-hospital-course returns `hospitalCourse` (not
`narrative` — past bug)
All three were caught and fixed earlier in Playwright; with the
shared types they become compile errors for any future regression.
server.ts
- Pure rename via `git mv`. Body unchanged.
- Compiled dist/server.js diffs against the original server.js by
two lines (TypeScript prepends `"use strict"` and the CommonJS
export marker). No semantic drift.
tsconfig.json tweak
- Include list adds server.ts alongside server.js so tsc doesn't
silently skip the entry point during the intermediate state
where `.js` entries might reappear.
- baseUrl removed (deprecated in TS 6); paths now uses './shared/*'.
package.json
- main: dist/server.js (post-compile entry)
- start: node dist/server.js
- prebuild: rm -rf dist (clean emit every time)
- dev: ts-node-dev for fast TS-aware reloads
The Dockerfile is still unchanged. The deployed prod and e2e
containers still run their baked-in server.js from the previous
image — this migration day has no effect on either until the final
rebuild at the end of day 7.
Next: day 3 renames the 29 route files one-by-one, each adding the
ApiResponse<T> type parameter to its res.json() calls.
76 lines
2.6 KiB
JSON
76 lines
2.6 KiB
JSON
{
|
|
"name": "pediatric-ai-scribe",
|
|
"version": "6.21.0",
|
|
"description": "AI-powered pediatric clinical documentation platform",
|
|
"main": "dist/server.js",
|
|
"scripts": {
|
|
"start": "node dist/server.js",
|
|
"prebuild": "rm -rf dist",
|
|
"build": "tsc",
|
|
"typecheck": "tsc --noEmit",
|
|
"dev": "ts-node-dev --respawn --transpile-only server.ts",
|
|
"test": "node --test test/",
|
|
"e2e": "./scripts/e2e.sh",
|
|
"lint:refs": "node scripts/lint-references.js",
|
|
"maint:check": "node scripts/maintenance.js check",
|
|
"maint:reindex": "node scripts/maintenance.js reindex",
|
|
"migrate": "node-pg-migrate",
|
|
"migrate:up": "node-pg-migrate up",
|
|
"migrate:down": "node-pg-migrate down 1",
|
|
"migrate:status": "node -e \"const{Pool}=require('pg');const p=new Pool({connectionString:process.env.DATABASE_URL});p.query('SELECT id,name,run_on FROM pgmigrations ORDER BY id').then(r=>{console.table(r.rows);p.end();}).catch(e=>{console.error(e.message);process.exit(1);})\"",
|
|
"migrate:new": "node-pg-migrate create"
|
|
},
|
|
"dependencies": {
|
|
"@marp-team/marp-cli": "^4.3.1",
|
|
"@marp-team/marp-core": "^4.3.0",
|
|
"@tiptap/core": "^3.20.4",
|
|
"@tiptap/extension-color": "^3.20.4",
|
|
"@tiptap/extension-link": "^3.20.4",
|
|
"@tiptap/extension-text-align": "^3.20.4",
|
|
"@tiptap/extension-text-style": "^3.20.4",
|
|
"@tiptap/extension-underline": "^3.20.4",
|
|
"@tiptap/starter-kit": "^3.20.4",
|
|
"argon2": "^0.41.1",
|
|
"axios": "^1.7.7",
|
|
"bcryptjs": "^2.4.3",
|
|
"cookie-parser": "^1.4.7",
|
|
"cors": "^2.8.5",
|
|
"dotenv": "^16.4.5",
|
|
"express": "^4.21.0",
|
|
"express-rate-limit": "^7.4.0",
|
|
"helmet": "^8.0.0",
|
|
"jsonwebtoken": "^9.0.2",
|
|
"mammoth": "^1.8.0",
|
|
"multer": "^1.4.5-lts.1",
|
|
"node-pg-migrate": "^7.7.0",
|
|
"nodemailer": "^8.0.5",
|
|
"openai": "^4.73.0",
|
|
"openid-client": "^6.8.2",
|
|
"pdf-parse": "^1.1.1",
|
|
"pg": "^8.13.0",
|
|
"pptxgenjs": "^4.0.1",
|
|
"qrcode": "^1.5.4",
|
|
"speakeasy": "^2.0.0"
|
|
},
|
|
"optionalDependencies": {
|
|
"@aws-sdk/client-bedrock": "^3.700.0",
|
|
"@aws-sdk/client-bedrock-runtime": "^3.700.0",
|
|
"@aws-sdk/client-s3": "^3.700.0",
|
|
"@aws-sdk/client-transcribe-streaming": "^3.1017.0",
|
|
"@aws-sdk/s3-request-presigner": "^3.700.0",
|
|
"@google-cloud/vertexai": "^1.9.0"
|
|
},
|
|
"devDependencies": {
|
|
"@tsconfig/node20": "^20.1.9",
|
|
"@types/bcrypt": "^6.0.0",
|
|
"@types/cookie-parser": "^1.4.10",
|
|
"@types/cors": "^2.8.19",
|
|
"@types/express": "^4.17.25",
|
|
"@types/jsonwebtoken": "^9.0.10",
|
|
"@types/ms": "^2.1.0",
|
|
"@types/multer": "^2.1.0",
|
|
"@types/node": "^25.6.0",
|
|
"ts-node-dev": "^2.0.0",
|
|
"typescript": "^6.0.3"
|
|
}
|
|
}
|