Persistence-Agnostic Linter
The supported contract is RepositoryInterface + dynamic repository keys. Concrete backends are selected in
module options and must stay swappable. Flag and fix anything that nails the code to one ORM.
Reject these
@InjectRepository(...)/ importingRepositoryfromtypeormin core or feature code.- A module-local
TypeOrmModule.forFeature([...])to register a feature entity. - ORM types (
FindManyOptions,DeepPartial,SaveOptions, TypeORMEntityManager) inrockets-corepublic surface, types, or docs. - The same entity/key registered in two places, or key and class split across files.
Require instead
@InjectDynamicRepository(KEY)+RepositoryInterface<Entity>. Feature/server code imports these from@concepta/rockets-core(it re-exportsInjectDynamicRepository,RepositoryInterface,RepositoryModuleInterface,Where,getDynamicRepositoryToken). Only core/lower packages import from@concepta/rockets-repositorydirectly.- Entity registration through bundles in
resources[]:defineResource()auto-contributes its entity row;defineModuleResource({ entities: [...] })contributes extra rows;userMetadata.entityfor the metadata row. - A single top-level
repository: RepositoryModuleInterface(default adapter) at the module root; per-entityrepositoryoverride only when one table needs a different backend. Norepositories.entities[]block. - For the zod layer: entity generation goes through a
SchemaEntityCompileradapter (e.g.typeOrmZodEntityCompiler), never TypeORM imported directly intorockets-zod.
How to audit
grep -rn "@InjectRepository\|from 'typeorm'\|TypeOrmModule.forFeature" packages/*/src— every hit in core or a feature is a finding (example/sample apps may legitimately pick TypeORM as the concrete adapter).- Confirm each entity is registered exactly once, via a bundle, not a module-local
forFeature. - Confirm
rockets-corebuilds and type-checks with no ORM symbol in its publicindex.ts.
When you fix a violation, migrate it to the dynamic-repository pattern — do not cast around the type. If a real gap blocks the abstraction, stop and ask rather than leaking the ORM.