changemaker.lite/api/dist/modules/docs/docs-files.service.d.ts

40 lines
1.5 KiB
TypeScript

export interface FileNode {
name: string;
path: string;
isDirectory: boolean;
children?: FileNode[];
}
/**
* Resolve and validate a relative path within MKDOCS_DOCS_PATH.
* Throws if the resolved path escapes the docs root.
*/
declare function safeResolve(relativePath: string): string;
export declare class PathTraversalError extends Error {
constructor();
}
export declare class FileNotFoundError extends Error {
constructor(filePath: string);
}
/**
* Recursively list the file tree under MKDOCS_DOCS_PATH.
* Cached in Redis with 1-hour TTL for root calls.
*/
declare function listTree(dir?: string, relBase?: string): Promise<FileNode[]>;
declare function readFileContent(relativePath: string): Promise<string>;
declare function writeFileContent(relativePath: string, content: string): Promise<void>;
declare function createFile(relativePath: string, content?: string, isDirectory?: boolean): Promise<void>;
declare function deleteFile(relativePath: string): Promise<void>;
declare function renameFile(fromPath: string, toPath: string): Promise<void>;
declare function isEditableFile(relativePath: string): boolean;
export declare const docsFilesService: {
listTree: typeof listTree;
readFileContent: typeof readFileContent;
writeFileContent: typeof writeFileContent;
createFile: typeof createFile;
deleteFile: typeof deleteFile;
renameFile: typeof renameFile;
safeResolve: typeof safeResolve;
isEditableFile: typeof isEditableFile;
};
export {};
//# sourceMappingURL=docs-files.service.d.ts.map