UNPKG

odata-active-record-core

Version:

Core Active Record implementation for OData - The easiest way to interact with OData APIs

152 lines 4.52 kB
import type { IEntitySchema } from 'odata-active-record-contracts'; /** * Interface Generator for OData Active Record * Automatically generates TypeScript interfaces from entity schemas */ export declare class InterfaceGenerator { private generatedInterfaces; /** * Generate an interface from an entity schema */ generateInterface(entityName: string, schema: IEntitySchema<any>, options?: { format?: 'typescript' | 'javascript' | 'jsx'; useTypes?: boolean; useJSDoc?: boolean; }): string; /** * Generate interfaces for multiple entities */ generateInterfaces(entities: Record<string, IEntitySchema<any>>, options?: { format?: 'typescript' | 'javascript' | 'jsx'; useTypes?: boolean; useJSDoc?: boolean; }): string; /** * Generate interfaces from namespace entities */ generateFromNamespace(namespace: any): string; /** * Generate a complete file with all interfaces */ generateFile(entities: Record<string, IEntitySchema<any>>, options?: { fileName?: string; format?: 'typescript' | 'javascript' | 'jsx'; addImports?: boolean; addExports?: boolean; addComments?: boolean; useTypes?: boolean; useJSDoc?: boolean; }): string; /** * Generate interfaces with additional utility types */ generateWithUtilities(entities: Record<string, IEntitySchema<any>>, options?: { includeInputTypes?: boolean; includeUpdateTypes?: boolean; includePartialTypes?: boolean; includeQueryTypes?: boolean; format?: 'typescript' | 'javascript' | 'jsx'; useTypes?: boolean; useJSDoc?: boolean; }): string; /** * Generate input types (for create operations) */ private generateInputTypes; /** * Generate update types (for update operations) */ private generateUpdateTypes; /** * Generate partial types (for partial updates) */ private generatePartialTypes; /** * Generate query types (for where clauses) */ private generateQueryTypes; /** * Get TypeScript type from field definition */ private getTypeScriptType; /** * Generate field comment from field definition */ private generateFieldComment; /** * Get field description for JSDoc */ private getFieldDescription; /** * Format entity name to interface name */ private formatInterfaceName; /** * Get all generated interfaces */ getAllGeneratedInterfaces(): Map<string, string>; /** * Clear generated interfaces */ clearGeneratedInterfaces(): void; } /** * CLI-friendly interface generator */ export declare class CLIInterfaceGenerator extends InterfaceGenerator { /** * Generate interfaces from command line arguments */ generateFromCLI(args: { input?: string; output?: string; entities?: Record<string, IEntitySchema<any>>; options?: any; }): string; /** * Generate and save to file */ generateAndSave(entities: Record<string, IEntitySchema<any>>, outputPath: string, options?: any): void; } /** * Utility functions for easy interface generation */ export declare const InterfaceUtils: { /** * Quick interface generation from a single entity */ quickGenerate(entityName: string, schema: IEntitySchema<any>, options?: { format?: "typescript" | "javascript" | "jsx"; useTypes?: boolean; useJSDoc?: boolean; }): string; /** * Generate interfaces from namespace */ fromNamespace(namespace: any, options?: { format?: "typescript" | "javascript" | "jsx"; useTypes?: boolean; useJSDoc?: boolean; }): string; /** * Generate complete file */ generateFile(entities: Record<string, IEntitySchema<any>>, options?: { fileName?: string; format?: "typescript" | "javascript" | "jsx"; addImports?: boolean; addExports?: boolean; addComments?: boolean; useTypes?: boolean; useJSDoc?: boolean; }): string; /** * Generate with all utilities */ generateWithAll(entities: Record<string, IEntitySchema<any>>, options?: { format?: "typescript" | "javascript" | "jsx"; useTypes?: boolean; useJSDoc?: boolean; }): string; }; //# sourceMappingURL=interface-generator.d.ts.map