@intent-driven/importer-nestjs-typeorm
v0.3.3
Published
NestJS + TypeORM AST → IDF ontology (entities + intents + roles)
Maintainers
Readme
@intent-driven/importer-nestjs-typeorm
NestJS + TypeORM AST → IDF ontology.
import { importNestjsTypeorm } from "@intent-driven/importer-nestjs-typeorm";
const ontology = await importNestjsTypeorm({
src: "./src",
guardsToRoles: true, // default
});Через CLI:
idf import nestjs-typeorm --src ./src --out src/domains/api/ontology.jsЧто покрывает (v0.2)
- TypeORM:
@Entity,@Column,@PrimaryGeneratedColumn,@PrimaryColumn@CreateDateColumn,@UpdateDateColumn,@DeleteDateColumn,@VersionColumn@ManyToOne,@OneToMany,@OneToOne,@ManyToMany+@JoinColumn,@JoinTable@Column({type:'enum', enum: SomeEnum})— cross-file enum resolution →valueLabels+enumValues
- Nest:
@Controller(prefix)(string + object form)@Get/@Post/@Put/@Patch/@Delete@Param/@Body/@Queryв method signature →intent.parameters(с markerspathParam/bodyParam/queryParam)@Body() dto: CreateOrderDto— cross-file DTO field extraction
- Guards → roles:
@UseGuards+@Roles→intent.forRoles+ auto-createontology.roles*Approval*Guard→intent.lifecycle.requiresApprovalstub
- Cross-file resolver: relative imports + tsconfig
compilerOptions.paths(TS path-mapping)
Skip-list для non-entity endpoints
Auth/webhook/health/search-style endpoints автоматически пропускаются (no garbage create_search / create_login / create_webhook intents). Default skip-list:
- Auth:
login,logout,register,signup,signin,signout,auth,oauth,token,me,session(s) - Webhooks:
webhook(s),callback(s) - Common actions:
search,export,import,upload,download,notify,subscribe,unsubscribe,refresh,validate,verify,reset - Meta:
health,healthz,ready(z),live(ness),version,info,metadata,metrics,ping,status - Generic:
feedback,contact,support,resource
Skipped intents эмитят warning non_entity_skipped в _meta.warnings.
Опции:
await importNestjsTypeorm({
src: "./src",
nonEntityPaths: ["foo", "bar"], // расширить default skip-list
includeNonEntity: true, // override: включить все intents
});Limitations (v0.2)
- Validation rules (
@IsEmail,@MinLength,@Min,@Max, etc.) ignored — отложено в v0.3 - DTO inheritance (
extends BaseDto) — only own properties + warning - Nested DTO depth > 1 — placeholder + warning
- node_modules import resolution — warning
unresolved_import(не resolve'им) - Polymorphic
@TableInheritance+@ChildEntity— v0.3 - ManyToMany bridge-table →
role.scope.via— v0.3 - TS utility types (
Pick,Partial,Omit) — warning + fallback
License
MIT.
