1
0
silverbullet/packages/server/syscalls/space.ts
Zef Hemel 76636dd9b1 Work
2022-04-26 19:04:36 +02:00

28 lines
795 B
TypeScript

import { PageMeta } from "@silverbulletmd/common/types";
import { SysCallMapping } from "@plugos/plugos/system";
import { Space } from "@silverbulletmd/common/spaces/space";
export default (space: Space): SysCallMapping => {
return {
"space.listPages": async (ctx, unfiltered = false): Promise<PageMeta[]> => {
return [...space.listPages(unfiltered)];
},
"space.readPage": async (
ctx,
name: string
): Promise<{ text: string; meta: PageMeta }> => {
return space.readPage(name);
},
"space.writePage": async (
ctx,
name: string,
text: string
): Promise<PageMeta> => {
return space.writePage(name, text);
},
"space.deletePage": async (ctx, name: string) => {
return space.deletePage(name);
},
};
};