UNPKG

nestjs-reverse-engineering

Version:

A powerful TypeScript/NestJS library for database reverse engineering, entity generation, and CRUD operations

160 lines 3.57 kB
import { TableInfo } from '../types/database.types'; import { ReverseEngineeringConfig } from '../types/config.types'; export interface CrudGenerationResult { tablesProcessed: number; filesGenerated: number; outputPaths: string[]; modules: ModuleInfo[]; appModulePath: string; } export interface ModuleInfo { tableName: string; entityName: string; moduleName: string; files: { entity: string; dto: string[]; controller: string; service: string; repository: string; module: string; tests?: string[]; }; } export declare class CrudGenerator { private readonly config; constructor(config: ReverseEngineeringConfig); /** * Helper method to create a file with content */ private createFile; /** * Filter tables based on configuration */ private filterTables; /** * Generate CRUD operations for all tables */ generateCrudForTables(tables: TableInfo[]): Promise<CrudGenerationResult>; /** * Generate CRUD operations for a single table */ private generateCrudForTable; /** * Generate entity or reuse existing entity from entities folder */ private generateOrReuseEntity; /** * Build entity content */ private buildEntityContent; /** * Build column decorators */ private buildColumnDecorators; /** * Build column property */ private buildColumnProperty; /** * Generate DTOs */ private generateDTOs; /** * Build Create DTO content */ private buildCreateDtoContent; /** * Build Update DTO content */ private buildUpdateDtoContent; /** * Build Query DTO content */ private buildQueryDtoContent; /** * Build DTO property decorators */ private buildDtoPropertyDecorators; /** * Build DTO property */ private buildDtoProperty; /** * Generate repository */ private generateRepository; /** * Build repository content */ private buildRepositoryContent; /** * Get the correct import path for entity based on configuration */ private getEntityImportPath; /** * Generate service */ private generateService; /** * Build service content */ private buildServiceContent; /** * Generate controller */ private generateController; /** * Build controller content */ private buildControllerContent; /** * Build CREATE endpoint */ private buildCreateEndpoint; /** * Build FIND ALL endpoint */ private buildFindAllEndpoint; /** * Build FIND ONE endpoint */ private buildFindOneEndpoint; /** * Build UPDATE endpoint */ private buildUpdateEndpoint; /** * Build DELETE endpoint */ private buildDeleteEndpoint; /** * Generate module */ private generateModule; /** * Build module content */ private buildModuleContent; /** * Generate tests */ private generateTests; /** * Update or generate app module with all CRUD modules */ private updateAppModule; /** * Update existing app module */ private updateExistingAppModule; /** * Generate new app module */ private generateNewAppModule; /** * Get TypeScript type from database type */ private getTypeScriptType; } //# sourceMappingURL=crud-generator-new.d.ts.map