import { EventEmitter } from "events"; import { type z } from "zod"; import { registeredApis } from "../api/decorators"; import { type WorkflowMetadata } from "../tasks/decorator"; import { type GenerateOptions, type PathAndCode } from "../types/types"; import { TemplateKey } from "../types/types"; import { type TemplateOptions } from "../types/types"; import { type AbsolutePath } from "../utils/path-utils"; import { type FileType } from "./file-patterns"; import { type LoadedApis, type LoadedModels, type LoadedTypes } from "./module-loader"; type DiffGroups = { [key in FileType]: AbsolutePath[]; }; export declare class Syncer { apis: LoadedApis; types: LoadedTypes; models: LoadedModels; workflows: Map; eventEmitter: EventEmitter; /** * 체크섬이 변경된 부분에 대해 싱크를 진행합니다. * dev 서버가 처음 떴을 때, sonamu sync 할 때 실행됩니다. 이후에는 syncFromWatcher 경로를 타요. * @returns */ sync(): Promise; /** * 강제 풀-싱크: lock을 무시하고 처음부터 다시 싱크합니다. * * **사용처**: git post-merge hook, CI, dev 서버의 `f` 핫키. * **실패 안전성**: 도중에 프로세스가 죽어 lock 없는 상태로 남아도 무해 — 다음 sync에서 * lock 없으면 자연스럽게 풀-싱크가 트리거되어 새 lock이 작성됨. */ forceSync(): Promise; /** * Watcher가 batch로 모은 변경 파일들에 대해 한 번의 HMR/sync 사이클을 돕니다. * * HMR은 api/src 안에서 일어나는 모든 파일들에 대해서 수행합니다. * checksumPatternGroup 매칭 여부와 무관하게 api/src 전체 대상입니다. * 가령 api/src/utils/subset-loaders.ts 같은 파일도 변경되면 HMR은 해줍니다. * * Sync는 checksumPatternGroup으로 매칭되는 파일들에 대해서만 수행합니다. * 여기에는 web/src나 app/src 같은 다른 target의 파일이 포함될 수 있습니다. * 이런 non-api 경로의 파일들은 HMR과는 아무 상관이 없으므로, invalidate을 하지 않습니다. * * @param fileEvents - path → event 맵. event는 "change" | "add". */ hmrAndSync(fileEvents: Map): Promise; private extractHmrActionRequiredFileEvents; private extractSyncTriggeringFileEventPaths; private invalidateDependentsAffectedByFileEvents; removeInvalidatedRegisteredApis(invalidatedPath: AbsolutePath): (typeof registeredApis)[number][]; autoloadTypes(): Promise; autoloadModels(): Promise; autoloadApis(): Promise; autoloadWorkflows(): Promise; autoloadSsrRoutes(): Promise; /** * 실제 싱크를 수행하는 본체입니다. * 변경된 파일들을 타입별로 분류하고 각 타입에 맞는 액션을 실행합니다. * * @param diffFilePaths - 변경된 파일들의 절대 경로 목록 * @returns diffTypes - 변경된 파일의 타입 목록 (entity, types, model 등) */ doSyncActions(diffFilePaths: AbsolutePath[]): Promise<{ diffTypes: FileType[]; }>; calculateDiffGroups(diffFiles: AbsolutePath[]): DiffGroups; private changeMatcher; handleTruthSourceChanges(diffGroups: DiffGroups): Promise; handleImplementationChanges(diffGroups: DiffGroups): Promise; handleAuxiliarySymbolChanges(diffGroups: DiffGroups): Promise; handleConfigChanges(_: DiffGroups): Promise; handleSonamuDictionaryRelatedChanges(_: DiffGroups): Promise; handleDrifts(drifts: AbsolutePath[]): Promise; /** * 주어진 엔티티와 템플릿 키에 대해, 생성된 코드가 존재하는지 확인합니다. * @param entityId 엔티티 ID * @param templateKey 템플릿 키 * @param enumId 열거형 ID * @returns 생성된 코드가 존재하는지 여부 */ checkExistsGenCode(entityId: string, templateKey: TemplateKey, enumId?: string): Promise<{ subPath: string; fullPath: string; isExists: boolean; }>; /** * 주어진 엔티티와 열거형에 대해, 생성된 코드가 존재하는지 확인합니다. * @param entityId 엔티티 ID * @param enums 열거형 레이블 * @returns 생성된 코드가 존재하는지 여부 */ checkExists(entityId: string, enums: { [name: string]: z.ZodEnum; }): Promise>; /** * 하위호환용 프록시 메소드입니다. */ createEntity(form: TemplateOptions["entity"]): Promise; /** * 하위호환용 프록시 메소드입니다. */ delEntity(entityId: string): Promise<{ delPaths: string[]; }>; /** * 하위호환용 프록시 메소드입니다. */ generateTemplate(key: T, templateOptions: TemplateOptions[T], _generateOptions?: GenerateOptions): Promise; /** * 하위호환용 프록시 메소드입니다. */ renderTemplate(key: T, templateOptions: TemplateOptions[T]): Promise; /** * 하위호환용 프록시 메소드입니다. */ renewChecksums(): Promise; } export {}; //# sourceMappingURL=syncer.d.ts.map