/** * Relation handling code generation for CRUD services. * * These functions are the canonical source of truth for the relation-mapping * logic used in the EJS template (api-crud-data-access.service.ts__tmpl__). * The template contains identical copies of these functions so EJS can * execute them without external imports. Any change here MUST be mirrored * in the template, and vice versa. */ export interface ModelField { name: string; type: string; kind?: string; isId?: boolean; isList: boolean; isOptional: boolean; isVirtual?: boolean; isReadOnly?: boolean; hasDefaultValue?: boolean; default?: unknown; relationName?: string; relationFromFields?: string[]; relationToFields?: string[]; relationOnDelete?: string; relationOnUpdate?: string; isGenerated?: boolean; isUpdatedAt?: boolean; documentation?: string; } export interface ModelLike { fields: ModelField[]; } export interface VirtualRelationField { name: string; type: string; isList: boolean; isOptional: boolean; isVirtual: boolean; relationName: string; relatedField: string; } export interface ForeignKeyRelationField { fieldName: string; relationName: string; isRequired: boolean; isList: boolean; } export declare function getRelationFields(model: ModelLike): ModelField[]; export declare function getVirtualRelationFields(model: ModelLike): VirtualRelationField[]; export declare function getForeignKeyRelationFields(model: ModelLike): ForeignKeyRelationField[]; export declare function generateRelationHandling(model: ModelLike, operation: 'create' | 'update'): string;