2022-04-05 15:02:17 +00:00
|
|
|
import { Manifest } from "../../common/manifest";
|
|
|
|
import { Plug } from "../../plugos/plug";
|
|
|
|
import { PageMeta } from "../../common/types";
|
|
|
|
|
|
|
|
export type SpaceEvents = {
|
|
|
|
pageCreated: (meta: PageMeta) => void;
|
|
|
|
pageChanged: (meta: PageMeta) => void;
|
|
|
|
pageDeleted: (name: string) => void;
|
|
|
|
pageListUpdated: (pages: Set<PageMeta>) => void;
|
|
|
|
plugLoaded: (plugName: string, plug: Manifest) => void;
|
|
|
|
plugUnloaded: (plugName: string) => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export interface Space {
|
|
|
|
// Pages
|
2022-04-06 13:39:20 +00:00
|
|
|
fetchPageList(): Promise<Set<PageMeta>>;
|
2022-04-05 15:02:17 +00:00
|
|
|
readPage(name: string): Promise<{ text: string; meta: PageMeta }>;
|
|
|
|
getPageMeta(name: string): Promise<PageMeta>;
|
|
|
|
writePage(
|
|
|
|
name: string,
|
|
|
|
text: string,
|
|
|
|
selfUpdate?: boolean,
|
2022-04-06 13:39:20 +00:00
|
|
|
lastModified?: number
|
2022-04-05 15:02:17 +00:00
|
|
|
): Promise<PageMeta>;
|
2022-04-06 13:39:20 +00:00
|
|
|
deletePage(name: string, deleteDate?: number): Promise<void>;
|
2022-04-05 15:02:17 +00:00
|
|
|
|
|
|
|
// Plugs
|
|
|
|
proxySyscall(plug: Plug<any>, name: string, args: any[]): Promise<any>;
|
|
|
|
invokeFunction(
|
|
|
|
plug: Plug<any>,
|
|
|
|
env: string,
|
|
|
|
name: string,
|
|
|
|
args: any[]
|
|
|
|
): Promise<any>;
|
|
|
|
}
|