/** * 설정 로더 공통 유틸리티 * * TOML 파일 로더, 설정 값 검증, 기본값 병합, 캐싱 기능을 제공합니다. * * 주요 기능: * - TOML 파일 로드 및 파싱 * - 설정 값 검증 (타입, 범위, 길이 등) * - 기본값과 설정 값 병합 * - 프로세스 단위 싱글톤 캐싱 * * 사용 예시: * ```typescript * import { loadTOMLConfig, validateConfig, mergeWithDefaults, getCachedConfig } from './config-loader-utils.js'; * * // TOML 파일 로드 * const config = loadTOMLConfig('config/my-config.toml', { default: 'value' }); * * // 설정 값 검증 * const schema = { number: { type: 'number', min: 0, max: 100 } }; * const result = validateConfig(config, schema); * * // 기본값 병합 * const merged = mergeWithDefaults(config, defaults); * * // 캐싱된 설정 가져오기 * const cached = getCachedConfig('my-config', () => loadTOMLConfig('config/my-config.toml')); * ``` */ /** * 프로젝트 루트 디렉토리를 찾습니다. * * 여러 경로를 시도하여 package.json이나 config 디렉토리가 있는 위치를 찾습니다. * * @returns 프로젝트 루트 디렉토리 경로 */ /** * 프로젝트 루트 디렉토리를 찾습니다. * * 여러 경로를 시도하여 package.json이나 config 디렉토리가 있는 위치를 찾습니다. * * @returns 프로젝트 루트 디렉토리 경로 */ export declare function findProjectRoot(): string; /** * 설정 값 검증 스키마 */ export interface ConfigValidationSchema { [key: string]: { type: 'number' | 'string' | 'boolean' | 'object' | 'array'; min?: number; max?: number; minLength?: number; maxLength?: number; required?: boolean; }; } /** * 설정 값 검증 결과 */ export interface ValidationResult { valid: boolean; errors: string[]; } /** * TOML 파일에서 설정을 로드합니다. * * @param configPath TOML 설정 파일 경로 * @param defaults 기본값 (파일이 없거나 파싱 실패 시 사용) * @returns 설정 객체 * @throws 파일을 읽을 수 없거나 파싱에 실패한 경우 (기본값이 제공되지 않은 경우) */ export declare function loadTOMLConfig>(configPath: string, defaults?: T): T; /** * 설정 값을 검증합니다. * * @param config 검증할 설정 객체 * @param schema 검증 스키마 * @returns 검증 결과 */ export declare function validateConfig(config: Record, schema: ConfigValidationSchema): ValidationResult; /** * 기본값과 설정 값을 병합합니다. * * @param config 설정 값 * @param defaults 기본값 * @returns 병합된 설정 객체 */ export declare function mergeWithDefaults>(config: Partial, defaults: T): T; /** * 캐싱된 설정을 가져옵니다. * * @param key 캐시 키 * @param loader 설정 로더 함수 * @returns 설정 객체 */ export declare function getCachedConfig(key: string, loader: () => T): T; /** * 설정 캐시를 초기화합니다 (테스트용). * * @param key 특정 키만 초기화 (지정하지 않으면 전체 초기화) */ export declare function clearConfigCache(key?: string): void; /** * 접두사가 일치하는 캐시 키를 모두 제거합니다 (테스트·프로필별 캐시 정리용). */ export declare function clearConfigCacheByPrefix(prefix: string): void; //# sourceMappingURL=config-loader-utils.d.ts.map