1
0
silverbullet/packages/server/syscalls/space.ts

31 lines
915 B
TypeScript
Raw Normal View History

import { PageMeta } from "@silverbulletmd/common/types";
2022-04-25 08:33:38 +00:00
import { SysCallMapping } from "@plugos/plugos/system";
import { Space } from "@silverbulletmd/common/spaces/space";
2022-03-28 13:25:05 +00:00
export default (space: Space): SysCallMapping => {
2022-03-28 13:25:05 +00:00
return {
2022-04-26 17:04:36 +00:00
"space.listPages": async (ctx, unfiltered = false): Promise<PageMeta[]> => {
return [...space.listPages(unfiltered)];
2022-03-28 13:25:05 +00:00
},
"space.readPage": async (
2022-03-28 13:25:05 +00:00
ctx,
name: string
): Promise<{ text: string; meta: PageMeta }> => {
return space.readPage(name);
2022-03-28 13:25:05 +00:00
},
2022-08-08 11:33:20 +00:00
"space.getPageMeta": async (ctx, name: string): Promise<PageMeta> => {
return space.getPageMeta(name);
},
"space.writePage": async (
ctx,
name: string,
text: string
): Promise<PageMeta> => {
return space.writePage(name, text);
2022-03-28 13:25:05 +00:00
},
"space.deletePage": async (ctx, name: string) => {
return space.deletePage(name);
2022-03-28 13:25:05 +00:00
},
};
};