import { Plug } from "@plugos/plugos/plug"; import { AttachmentMeta, PageMeta } from "../types"; export type AttachmentEncoding = "arraybuffer" | "dataurl"; export type AttachmentData = ArrayBuffer | string; export interface SpacePrimitives { // Pages fetchPageList(): Promise<{ pages: Set; nowTimestamp: number }>; readPage(name: string): Promise<{ text: string; meta: PageMeta }>; getPageMeta(name: string): Promise; writePage( name: string, text: string, selfUpdate?: boolean, lastModified?: number ): Promise; deletePage(name: string): Promise; // Attachments fetchAttachmentList(): Promise<{ attachments: Set; nowTimestamp: number; }>; readAttachment( name: string, encoding: AttachmentEncoding ): Promise<{ data: AttachmentData; meta: AttachmentMeta }>; getAttachmentMeta(name: string): Promise; writeAttachment( name: string, data: AttachmentData, selfUpdate?: boolean, lastModified?: number ): Promise; deleteAttachment(name: string): Promise; // Plugs proxySyscall(plug: Plug, name: string, args: any[]): Promise; invokeFunction( plug: Plug, env: string, name: string, args: any[] ): Promise; }