/// import { FSWatcher } from 'fs'; import { ComponentDefinition } from '@json-to-office/shared-docx'; /** * File System utilities for JSON report definitions */ /** * Load JSON report definition from file * Supports both relative and absolute file paths */ export declare function loadJsonDefinition(filePath: string): Promise; /** * Load JSON definition with validation but without throwing on validation errors */ export declare function loadJsonDefinitionSafe(filePath: string): Promise<{ success: boolean; definition?: ComponentDefinition; error?: JsonFileError; }>; /** * Watch JSON file for changes and call callback on modifications * Useful for development workflows */ export declare function watchJsonFile(filePath: string, callback: (_definition: ComponentDefinition | null, _error?: JsonFileError) => void): JsonFileWatcher; /** * Watch multiple JSON files and call callback when any changes */ export declare function watchJsonFiles(filePaths: string[], callback: (_filePath: string, _definition: ComponentDefinition | null, _error?: JsonFileError) => void): JsonFileWatcher[]; /** * Check if file exists and is accessible */ export declare function checkJsonFile(filePath: string): Promise<{ exists: boolean; readable: boolean; isDirectory: boolean; error?: string; }>; /** * Find JSON files in a directory (non-recursive) */ export declare function findJsonFiles(directoryPath: string): Promise; /** * Save JSON report definition to file */ export declare function saveJsonDefinition(definition: ComponentDefinition, filePath: string, options?: { pretty?: boolean; backup?: boolean; }): Promise; /** * File watcher wrapper class */ export declare class JsonFileWatcher { private watcher; private filePath; constructor(watcher: FSWatcher, filePath: string); /** * Stop watching the file */ close(): void; /** * Get the watched file path */ getFilePath(): string; } /** * Custom error class for file system operations */ export declare class JsonFileError extends Error { readonly code: string; readonly originalError?: Error; constructor(message: string, code: string, originalError?: Error); } /** * Utility function to validate JSON file extension */ export declare function hasJsonExtension(filePath: string): boolean; /** * Utility to ensure a path has .json extension */ export declare function ensureJsonExtension(filePath: string): string; //# sourceMappingURL=filesystem.d.ts.map