@syncorix/clinical-types
v1.2.1
Published
Canonical shared types for the Doyen clinical platform — pharmacy API DTOs + BFF↔FE contract. Single source of truth consumed by the BFF (clinical-ai-system) and the frontend (doyen-pharma). Neither side maintains its own mirror.
Downloads
513
Readme
@syncorix/clinical-types
Canonical shared types for the Doyen clinical platform. Single source of truth — the BFF (clinical-ai-system) and the frontend (doyen-pharma) both import this package. Neither side maintains its own mirror.
Modules
| Import path | Contents |
|---|---|
| @syncorix/clinical-types/pharmacy | Pharmacy API DTOs — the BFF↔pharmacy contract (request/response shapes, notification + lifecycle enums). |
| @syncorix/clinical-types/contract | BFF↔frontend contract — every type that crosses the BFF→FE boundary. |
| @syncorix/clinical-types | Barrel — re-exports both as namespaces (pharmacy, contract). |
import type { TreatmentMedicationItem } from '@syncorix/clinical-types/contract';
import type { CreateNotificationInput } from '@syncorix/clinical-types/pharmacy';Why this package exists
Before this package there were three drifting copies of the same types:
apps/bff/src/services/pharmacy/types.ts(BFF)docs/frontend-contract.ts(a hand-maintained "contract" doc)doyen-pharma/src/lib/types/Bff.types.ts(the FE's byte-for-byte mirror)
They drifted. The 2026-05-20 audit (docs/audit-2026-05-20-api-fe-drift.md) found
enum mismatches, a wrong-host TLS reference, and fields the FE rendered as
fallbacks because its mirror was stale. This package collapses all three into one.
Consuming it
BFF (clinical-ai-system) — workspace dependency
Already wired. apps/bff has "@syncorix/clinical-types": "workspace:*". The
BFF runs on tsx, which resolves the package's exports straight to source
.ts — no build step needed for local dev.
Frontend (doyen-pharma) — npm dependency
// doyen-pharma/package.json
"dependencies": {
"@syncorix/clinical-types": "^1.0.0"
}Then delete src/lib/types/Bff.types.ts and repoint every import:
// before
import type { TreatmentMedicationItem } from '@/lib/types/Bff.types';
// after
import type { TreatmentMedicationItem } from '@syncorix/clinical-types/contract';The published package ships built dist/ (.d.ts + .js) via publishConfig,
so any FE bundler consumes it without extra transpile config.
Publishing
pnpm --filter @syncorix/clinical-types build # tsc → dist/
npm publish # uses publishConfig (dist/ exports)prepublishOnly runs the build automatically. The package is scoped
(@syncorix) and publishConfig.access is public — same as
@syncorix/clinical-plugin, published to npmjs.org. Publishing requires being
a member of the @syncorix npm org (npm login first).
Versioning
Semver on the type contract:
- patch — comment / doc-hint change, no shape change
- minor — additive (new optional field, new enum member, new type)
- major — breaking (removed/renamed field, narrowed type, changed enum)
Bump package.json version and the CONTRACT_VERSION constant in
src/contract.ts together. Both BFF and FE adopt a new version in the same
release cycle.
