nestjs-reverse-engineering
Version:
A powerful TypeScript/NestJS library for database reverse engineering, entity generation, and CRUD operations
158 lines • 3.52 kB
TypeScript
import { TableInfo, DatabaseDialect } from '../types/database.types';
export interface CrudGenerationOptions {
outputPath: string;
dialect: DatabaseDialect;
framework: 'nestjs' | 'express' | 'fastify';
includeValidation: boolean;
includeSwagger: boolean;
includePagination: boolean;
includeFiltering: boolean;
includeSorting: boolean;
includeRelations: boolean;
generateTests: boolean;
authGuards: boolean;
useTypeORM: boolean;
useDTO: boolean;
moduleName?: string;
}
export interface CrudGenerationResult {
tablesProcessed: number;
filesGenerated: number;
outputPaths: string[];
modules: ModuleInfo[];
}
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 options;
constructor(options?: Partial<CrudGenerationOptions>);
/**
* Helper method to create a file with content
*/
private createFile;
/**
* Generate CRUD operations for all tables
*/
generateCrudForTables(tables: TableInfo[]): Promise<CrudGenerationResult>;
/**
* Generate CRUD operations for a single table
*/
private generateCrudForTable;
/**
* Generate entity file
*/
private generateEntity;
/**
* 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;
/**
* 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;
/**
* Generate app module with all CRUD modules
*/
private generateAppModule;
/**
* Get TypeScript type from database type
*/
private getTypeScriptType;
}
//# sourceMappingURL=crud-generator.d.ts.map