mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
Hoist five duplicated helpers into single source modules so each contract evolves in exactly one place: - src/lib/api/read-error.ts — replaces the four hand-rolled copies in the onboarding flow (Welcome / Goals / Source / Baseline). - src/lib/medications/research-mode-types.ts — shared ResearchModeStatus DTO + tri-state gate helper consumed by both the DrugLevelChart and the Settings advanced section. - src/lib/medications/route-guards.ts — assertMedicationOwnership for the eleven medication sub-routes, preserving the 404 leak shape across the privacy boundary. - src/lib/medications/dose-string.ts — unified parseDoseMg + null variant replacing the DrugLevelChart and titration-route parsers. - src/lib/medications/glp1-knowledge.ts — adds findDrugIdByBrand reverse lookup so the brand-to-id pattern stops being open-coded at every chart render. 28 new unit tests across the five helpers.