Distribución y consumo
cd emafhirnpm installnpm run build # tsup → dist/npm test # vitesttsup genera ESM con types, splitting y treeshake activos. Configurado
con 6 entry points (los 6 subpaths exportados):
dist/├── index.{js,d.ts}├── auth/index.{js,d.ts}├── search/index.{js,d.ts}├── types/index.{js,d.ts}├── sdc/index.{js,d.ts}└── validators/index.{js,d.ts}Target: ES2022, ESM-only.
Versionado
Sección titulada «Versionado»Semver. Versión actual 0.6.0. Mantiene CHANGELOG.md desde 0.2.0.
Cada bump corresponde a una serie de decisiones formales registradas en
docs/decisions.md (formato F{NNN}).
| Versión | Hito |
|---|---|
| 0.2.x | 35 tipos handcrafted + ResourceTypeMap |
| 0.5.x | helpers (ref, transaction, search) + auth strategies |
| 0.6.0 | Wave 1: EmaFhirClient + ProfileResolver runtime + meta-inject + validators + opt-in $translate |
Publicación
Sección titulada «Publicación»Hoy se distribuye como GitHub dependency consumida directamente desde
github:emahealth/emafhir. El consumidor pin-ea el tag o branch en su
package.json:
{ "dependencies": { "emafhir": "github:emahealth/emafhir#v0.6.0" }}Consumidores
Sección titulada «Consumidores»| Producto | Estado | Cliente que usa |
|---|---|---|
| emaclinic | Migrado a Wave 1 | createEmaClient({ tenant, supabase }) |
| emalab | Pendiente Wave 3 | createClient() legacy |
| emavault | Pendiente Wave 3 | createClient() legacy |
| emawell | Pendiente Wave 3 | createClient() legacy |
Cuando un producto migra:
- Bump de versión del SDK en su
package.json. - Agregar peer dep
@supabase/supabase-js >= 2.49. - Cambiar
createClient(...)→createEmaClient({ tenant, supabase }). - Verificar tests con tenant context real.
npm test # unit tests (vitest, sin red)npm run test:integration # smoke tests contra Aidbox edge (gated)Los smoke tests requieren las siguientes env vars; si faltan, CI los omite silenciosamente:
TEST_AIDBOX_URLTEST_AIDBOX_CLIENT_IDTEST_AIDBOX_CLIENT_SECRETTEST_TENANT_IDTEST_TENANT_COUNTRYTEST_SUPABASE_URLTEST_SUPABASE_KEYGitHub Actions corre en cada PR:
npm installnpm run build(tsup)npm test(unit suite, sin red)
Los smoke tests Aidbox quedan en un job separado, gated por secrets
disponibles solo en la rama main y en releases.
Coverage
Sección titulada «Coverage»Sin reportes formales hoy. Estimado ~70% basado en LOC test vs LOC src
(10+ test files / 3K LOC core). Plan: agregar vitest --coverage a CI
en una iteración futura.