1
0
silverbullet/server/syscalls/space.ts
Zef Hemel 6ebf8e7f15 * Refactored server to use spaces
* Other cleanup
2022-04-08 17:46:09 +02:00

28 lines
743 B
TypeScript

import { PageMeta } from "../../common/types";
import { SysCallMapping } from "../../plugos/system";
import { Space } from "../../common/spaces/space";
export default (space: Space): SysCallMapping => {
return {
"space.listPages": async (ctx): Promise<PageMeta[]> => {
return [...space.listPages()];
},
"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);
},
};
};