1
0

Exposed "store" syscalls to client and server environments

This commit is contained in:
Zef Hemel
2022-07-12 12:30:15 +02:00
parent 8a10369d91
commit f0d09a51e6
3 changed files with 27 additions and 2 deletions
+2
View File
@@ -60,6 +60,7 @@ import { FilterOption, PageMeta } from "@silverbulletmd/common/types";
import { syntaxTree } from "@codemirror/language";
import sandboxSyscalls from "@plugos/plugos/syscalls/sandbox";
import { eventSyscalls } from "@plugos/plugos/syscalls/event";
import { storeSyscalls } from "./syscalls/store";
class PageState {
constructor(
@@ -155,6 +156,7 @@ export class Editor {
systemSyscalls(this),
markdownSyscalls(buildMarkdown(this.mdExtensions)),
clientStoreSyscalls(),
storeSyscalls(this.space),
sandboxSyscalls(this.system)
);
+17
View File
@@ -0,0 +1,17 @@
import { SysCallMapping } from "@plugos/plugos/system";
import { proxySyscalls } from "@plugos/plugos/syscalls/transport";
import { Space } from "@silverbulletmd/common/spaces/space";
export function storeSyscalls(space: Space): SysCallMapping {
return proxySyscalls(
[
"store.queryPrefix",
"store.get",
"store.set",
"store.batchSet",
"store.delete",
"store.deletePrefix",
],
(ctx, name, ...args) => space.proxySyscall(ctx.plug, name, args)
);
}