You've already forked obsidian-visualiser
Finished project configuration page with reorder
This commit is contained in:
23
schemas/project.ts
Normal file
23
schemas/project.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const baseItem = z.object({
|
||||
path: z.string(),
|
||||
parent: z.string(),
|
||||
name: z.string().optional(),
|
||||
title: z.string(),
|
||||
type: z.enum(['folder', 'file', 'markdown', 'canvas']),
|
||||
navigable: z.boolean(),
|
||||
private: z.boolean(),
|
||||
order: z.number().finite(),
|
||||
});
|
||||
export const item: z.ZodType<ProjectItem> = baseItem.extend({
|
||||
children: z.lazy(() => item.array().optional()),
|
||||
});
|
||||
export const project = z.object({
|
||||
items: z.array(item),
|
||||
});
|
||||
|
||||
export type Project = z.infer<typeof project>;
|
||||
export type ProjectItem = z.infer<typeof baseItem> & {
|
||||
children?: ProjectItem[]
|
||||
};
|
||||
Reference in New Issue
Block a user