import { type Knex } from "knex"; import { type SonamuDBConfig } from "../database/db"; import { type Entity } from "../entity/entity"; import { type FixtureImportResult, type FixtureRecord, type FixtureSearchOptions } from "../types/types"; /** 사용자 지정 중복 확인 컬럼 (entityId별로 지정) */ export interface DuplicateCheckOptions { columns?: { [entityId: string]: string[]; }; } export declare class FixtureManagerClass { private _tdb; set tdb(tdb: Knex); get tdb(): Knex; private _fdb; set fdb(fdb: Knex); get fdb(): Knex; cachedTableNames: string[] | null; private relationGraph; private builder; private fixtureRefMap; private skippedFixtures; init(): void; /** 원격 fixture DB를 로컬 test DB로 복사합니다. pg_dump로 원격 DB를 덤프하고, pg_restore로 로컬에 복원합니다. */ sync(): Promise; /** * 모든 테이블의 시퀀스를 현재 MAX(id)로 리셋합니다. * fixture sync 후 시퀀스가 실제 데이터와 맞지 않는 문제를 해결합니다. */ private resetSequences; private visitedRecords; importFixture(entityId: string, ids: number[]): Promise; getImportQueries(entityId: string, field: string, id: number): Promise; destroy(): Promise; getFixtures(sourceDBName: keyof SonamuDBConfig, targetDBName: keyof SonamuDBConfig, searchOptions: FixtureSearchOptions, duplicateCheck?: DuplicateCheckOptions): Promise; createFixtureRecord(entity: Entity, row: { id: number | string; [key: string]: string | number | boolean | null; }, options?: { singleRecord?: boolean; _db?: Knex; }): Promise; /** * 1. RelationGraph로 fixture 단위 삽입 순서 계산 (self-reference 포함) * 2. 테이블별 레벨별로 UpsertBuilder에 등록 및 upsert 실행 * 3. 순서 기반 uuid→id 매핑 (UpsertBuilder가 uuid를 DB에 저장하지 않으므로) * * UpsertBuilder는 self-reference가 있으면 buildInsertLevels()로 재정렬하여 * 등록 순서와 반환 순서가 달라질 수 있습니다. 이를 방지하기 위해 * FixtureManager가 레벨별로 나눠서 처리하여 각 upsert 호출에서는 * self-reference가 없도록 합니다. */ insertFixtures(dbName: keyof SonamuDBConfig, _fixtures: FixtureRecord[]): Promise; /** * FixtureRecord를 UpsertBuilder에 등록 * @param insertedIdsByTable 이미 upsert된 테이블의 uuid→id 매핑 (레벨별 처리 시 사용) */ private registerFixture; /** * 컬럼 값 변환 */ private convertColumnValue; private processManyToManyRelations; /** * 같은 테이블 내 fixture들을 self-reference 레벨별로 분할 * - self-reference가 없는 fixture들: Level 0 * - Level 0을 참조하는 fixture들: Level 1 * - 반복 * * UpsertBuilder가 self-reference가 있으면 buildInsertLevels()로 재정렬하여 * 등록 순서와 반환 순서가 달라질 수 있습니다. * 이를 방지하기 위해 FixtureManager가 레벨별로 나눠서 처리합니다. */ private groupFixturesByLevel; private checkUniqueViolation; private checkDuplicateByColumns; addFixtureLoader(code: string): Promise; } export declare const FixtureManager: FixtureManagerClass; //# sourceMappingURL=fixture-manager.d.ts.map