/* Copyright 2021, vite-plugin-book by Mirone. */ export type FileInfo = { id: string; url: string; type: 'file'; name: string; }; export type DirInfo = { id: string; url: string; type: 'dir'; name: string; hasIndex: boolean; list: ItemInfo[]; }; export type ItemInfo = FileInfo | DirInfo; export type ProjectInfo = { name: string; repo: string; list: ItemInfo[]; }; export type BookConfig = { projectInfo: ProjectInfo; }; // These events are only supported for editable mode interface AdminEvents { createFile(near: string, folder?: boolean): Promise; deleteFile(url: string): Promise; writeFile(url: string, name: string, markdown: string): Promise; sort(info: ItemInfo[]): Promise; } export interface WebSocketServerEvents extends AdminEvents { getConfig(): Promise; getFile(url: string): Promise; } export type WebSocketClientEvents = { // add client events here };