33 lines
1000 B
TypeScript
33 lines
1000 B
TypeScript
import { explorerContentTable } from "~/db/schema";
|
|
import type { CanvasContent } from "./canvas";
|
|
|
|
export type FileType = typeof explorerContentTable.$inferSelect.type;
|
|
export type Overview = Omit<typeof explorerContentTable.$inferSelect, 'content'>;
|
|
export type Content = { content: string };
|
|
export type ExploreContent= Overview & Partial<Content>;
|
|
export type TreeItem = ExploreContent & { children?: TreeItem[] };
|
|
|
|
export interface ContentComposable {
|
|
content: Ref<ExploreContent[]>
|
|
tree: ComputedRef<TreeItem[]>
|
|
/**
|
|
* Fetch the overview of every content from the server.
|
|
*/
|
|
fetch: (force: boolean) => Promise<void>
|
|
/**
|
|
* Get the given content from the server.
|
|
*/
|
|
get: (path: string) => Promise<void>
|
|
}
|
|
|
|
export type MarkdownContent = string;
|
|
export type FileContent = any;
|
|
export type FolderContent = null;
|
|
|
|
export interface ContentTypeMap
|
|
{
|
|
markdown: MarkdownContent;
|
|
canvas: CanvasContent;
|
|
file: FileContent;
|
|
folder: FolderContent;
|
|
} |