import { z } from "zod"; import { type Cone, type EntityIndex, type EntityJson, type EntityProp, type EntityPropNode, type EntitySubsetRow, type RelationProp, type SubsetQuery } from "../types/types"; export declare class Entity { id: string; parentId?: string; table: string; title: string; cone?: Cone; names: { parentFs: string; fs: string; module: string; }; props: EntityProp[]; propsDict: { [key: string]: EntityProp; }; relations: { [key: string]: RelationProp; }; indexes: EntityIndex[]; subsets: { [key: string]: string[]; }; subsetsInternal: { [key: string]: string[]; }; types: { [name: string]: z.ZodTypeAny; }; enums: { [enumId: string]: z.ZodEnum>>; }; enumLabels: { [enumId: string]: { [key: string]: string; }; }; enumCones: { [enumId: string]: Cone; }; subsetCones: { [subsetKey: string]: Cone; }; constructor({ id, parentId, table, title, cone, props, indexes, subsets, enums }: EntityJson); /** * 쿼리용 서브셋 필드를 반환합니다 (subsets + subsetsInternal 합침) */ getSubsetFieldsForQuery(subsetKey: string): string[]; /** * 주어진 이름(subsetKey)의 subset을 실제로 가져오는 Puri 코드 구현체 string을 반환합니다. */ getPuriSubsetQuery(subsetKey: string): string; /** * *.entity.json의 subset에 들어있는 필드 배열을 받아서, * Puri의 SelectObject 타입으로 변환합니다. * * 예: ["users.id", "parent.id", "parent.name"] * → { id: "users.id", parent: { id: "parent.id", name: "parent.name" } } * * 언더바가 아닌 중첩 객체로 변환함에 유의하세요. * 이렇게 중첩 객체로 변환하여 select에 넘겨주면 ParseSelectObject 타입이 join된 객체의 타입을 잘 잡아줄 수 있습니다. * 즉, enhancer에서 row를 받았을 때 hydrate된 객체 자체의 nullity와 그 안쪽 필드의 nullity가 fk nullable 여부에 따라 잘 추론됩니다. */ private buildNestedSelectObject; /** * JSON.stringify와 유사한 일을 합니다. * 다만 주어진 객체를 JSON이 아닌 TypeScript 객체 리터럴 스트링으로 만들어줍니다. * key에 따옴표가 없어요. * 출력 예시: * ```typescript * { * id: "users.id", * parent: { * id: "parent.id", * name: "parent.name", * }, * } * ``` * @param obj 변환할 객체 * @param indent 들여쓰기 레벨 * @param withBraces true면 중괄호 포함, false면 내용만 반환 */ private stringifyNestedSelectObject; getPuriLoaderQuery(subsetKey: string): string; getSubsetQuery(subsetKey: string): SubsetQuery; resolveSubsetQuery(prefix: string, fields: string[], isAlreadyOuterJoined?: boolean): SubsetQuery; fieldExprsToPropNodes(fieldExprs: string[], entity?: Entity): EntityPropNode[]; getFieldExprs(prefix?: string, maxDepth?: number, froms?: string[]): string[]; /** * Relation prop이 현재 테이블에 FK 컬럼을 생성하는지 확인 *(BelongsToOne 또는 OneToOne(hasJoinColumn=true)인 경우 FK 생성) */ private hasForeignKey; getTableColumns(): { name: string; type: string; }[]; /** * Entity에 정의된 모든 vector 타입 컬럼 반환 */ getVectorColumns(): EntityProp[]; /** * 특정 vector 컬럼 반환 * @param columnName - 컬럼명 (생략 시 첫 번째 vector 컬럼) */ getVectorColumn(columnName?: string): EntityProp | undefined; /** * 필터링 가능한 props 반환 * * - 일반 prop * - FK를 생성하는 relation (BelongsToOne, OneToOne with hasJoinColumn) * → {name}_id 형태의 가상 integer prop으로 변환 */ getFilterableProps(): EntityProp[]; registerModulePaths(): Promise; registerTableSpecs(): void; toJson(): EntityJson; save(): Promise; /** * 템플릿 cone 메타데이터를 생성합니다. * * LLM을 사용하지 않고 faker-mappings.ts를 활용하여 기본 cone을 생성합니다. * stub entity 생성 시 자동으로 호출되어 최소한의 cone 메타데이터를 제공합니다. * * @param locale - 생성 시 사용할 locale (기본값: Sonamu.config.i18n.defaultLocale 또는 "ko") */ generateTemplateCones(locale?: "ko" | "en" | "ja"): Promise; /** * LLM을 사용하여 cone 메타데이터를 생성합니다. * * @param options.preserveExisting - 기존 cone 보존 여부 (기본값: true) * @param options.onlyEmpty - fixtureHint가 없는 cone만 생성 (기본값: false) * @param options.locale - 생성 시 사용할 locale (기본값: "ko") */ generateCones(options?: { preserveExisting?: boolean; onlyEmpty?: boolean; locale?: "ko" | "en" | "ja"; }): Promise; /** * 기존 cone들을 수집합니다 (entity, props, enums, subsets). * * @returns 키가 "entity:id", "prop:name", "enum:enumId", "subset:key" 형식인 cone 맵 */ private collectExistingCones; /** * 생성된 cone들을 Entity에 적용합니다. * * @param result - LLM으로 생성된 cone 결과 */ private applyCones; getSubsetRows(_subsets?: { [key: string]: string[]; }, _subsetsInternal?: { [key: string]: string[]; }, prefixes?: string[]): EntitySubsetRow[]; subsetRowsToSubsetFields(subsetRows: EntitySubsetRow[], subsetKey: string, internal?: boolean): string[]; createProp(prop: EntityProp, at?: number): Promise; analyzeSubsetField(subsetField: string): { entityId: string; propName: string; }[]; modifyProp(newProp: EntityProp, at: number): Promise; delProp(at: number): Promise; getEntityIdFromSubsetField(subsetField: string): string; moveProp(at: number, to: number): Promise; /** * 필드명을 "테이블명.필드명" 형식으로 변환 */ getFullFieldName(field: string): string; /** * 엔티티의 PK 타입을 반환합니다. * id 필드의 타입을 기준으로 "integer" | "string" | "uuid"를 반환합니다. */ getPkType(): "integer" | "string" | "uuid"; /** * 엔티티의 PK prop을 반환합니다. * length 등 세부 정보에 접근할 때 사용합니다. */ getPkProp(): EntityProp; /** * 엔티티의 PK 배열 타입을 반환합니다. * LoaderQuery의 fromIds 타입으로 사용됩니다. */ getPkArrayType(): string; } //# sourceMappingURL=entity.d.ts.map