/** * Entity Code Generator * * Generates TypeScript entity files from SchemaAST. * Supports: * - ES Module syntax * - TypeScript types * - Relations with proper decorators * - Indexes * - JSDoc comments for sync-added fields */ import type { SchemaAST } from '../../schema/schemaAST.js'; /** * Options for entity code generation. */ export interface EntityCodeGeneratorOptions { /** Base import path for @uql/core (default: '@uql/core') */ uqlImportPath?: string; /** Whether to add JSDoc with @sync-added for generated fields */ addSyncComments?: boolean; /** Custom class name transformer (default: PascalCase singularized) */ classNameTransformer?: (tableName: string) => string; /** Custom property name transformer (default: camelCase) */ propertyNameTransformer?: (columnName: string) => string; /** Whether to generate relation properties (default: true) */ includeRelations?: boolean; /** Whether to include index decorators (default: true) */ includeIndexes?: boolean; /** Custom singularize function */ singularize?: (name: string) => string; } /** * Generated entity result. */ export interface GeneratedEntity { /** The entity class name */ className: string; /** The table name */ tableName: string; /** The generated TypeScript code */ code: string; /** The suggested file name */ fileName: string; } /** * Generates TypeScript entity code from SchemaAST. */ export declare class EntityCodeGenerator { private readonly ast; private readonly options; constructor(ast: SchemaAST, options?: EntityCodeGeneratorOptions); /** * Generate entities for all tables in the AST. */ generateAll(): GeneratedEntity[]; /** * Generate entity for a specific table. */ generateForTable(tableName: string): GeneratedEntity | undefined; /** * Generate entity code for a table. */ private generateEntity; /** * Build import statements. */ private buildImports; /** * Build entity decorators. */ private buildEntityDecorators; /** * Build field definitions. */ private buildFields; /** * Build a single field definition. */ private buildField; /** * Build Id decorator options. */ private buildIdOptions; /** * Build Field decorator options. */ private buildFieldOptions; /** * Build relation definitions. */ private buildRelations; /** * Build outgoing relation (ManyToOne or OneToOne where this table has FK). */ private buildOutgoingRelation; /** * Build incoming relation (OneToMany where other tables have FK to this). */ private buildIncomingRelation; /** * Get decorator name for relation type. */ private getRelationDecoratorName; /** * Format type for description. */ private formatTypeDescription; /** * Format default value for code. */ private formatDefaultValue; /** * Default class name transformer: table_name -> TableName (PascalCase, singular). */ private defaultClassNameTransformer; /** * Default property name transformer: column_name -> columnName (camelCase). */ private defaultPropertyNameTransformer; /** * Convert to PascalCase (delegates to shared utility). */ private toPascalCase; /** * Convert to camelCase (delegates to shared utility). */ private toCamelCase; /** * Default singularize function (delegates to shared utility). */ private defaultSingularize; } /** * Create an EntityCodeGenerator from SchemaAST. */ export declare function createEntityCodeGenerator(ast: SchemaAST, options?: EntityCodeGeneratorOptions): EntityCodeGenerator; //# sourceMappingURL=entityCodeGenerator.d.ts.map