2.6 KiB
2.6 KiB
Update Strategy
When the DSL changes, regeneration must preserve the default auth-enabled runtime rather than falling back to CRUD-only output.
domain/*.dsl remains the single required source of truth for regeneration. DTOs, API contracts, and React Admin resources must be re-derived from it on every run. Optional overrides in overrides/api-overrides.dsl and overrides/ui-overrides.dsl may be applied after derivation, but they must never duplicate or redefine the domain model.
Regeneration must not resurrect or depend on supplemental DTO/API/UI DSL inputs. Every derived layer must be recalculated from domain/*.dsl plus optional non-duplicating overrides only.
Required regeneration sequence
- Regenerate
prisma/schema.prisma. - Run
npx prisma migrate dev. - Regenerate NestJS entity modules, DTOs, controllers, and services.
- Regenerate backend auth infrastructure:
AuthModule- guards
- decorators
- typed authenticated principal
- typed config validation
- CRUD RBAC decorations
- Regenerate React Admin resources.
- Regenerate frontend auth infrastructure:
src/config/env.tssrc/auth/keycloak.tssrc/auth/authProvider.ts- authenticated
dataProvider.ts App.tsxauth wiringmain.tsxinit-before-render flow
- Regenerate backend and frontend
.env.examplefiles so the auth env contract stays in sync. - Regenerate root/package
.gitignorefiles so local-only artifacts remain out of git after regeneration. - Regenerate the root-level Keycloak realm import artifact. The repository default example filename is
toir-realm.json, but the generator must allow a project-specific equivalent. - Re-run post-generation validation, including:
- gitignore coverage for dependency, build, env, coverage, and tsbuildinfo artifacts
- auth dependency checks
- fail-fast env checks
- token-claim based identity with no
loadUserProfile()//accountdependency /healthpublic check- unauthenticated protected route ->
401 - insufficient role ->
403 - natural-key
_sort=idmapping checks - realm-template validation
Guardrails
- Regeneration must not strip auth back out of the project.
- Auth remains outside the DSL grammar, but it is part of the default generated runtime.
- If a DSL change affects entities or routes, the generator must re-apply the default CRUD RBAC rules automatically.
- If a DSL change affects runtime topology or naming, the generator must keep backend/frontend env examples, CORS rules, and the generated realm import artifact aligned with the generated app.