silverbullet/plugos/types.ts

23 lines
463 B
TypeScript
Raw Normal View History

2022-03-23 22:41:12 +08:00
import { System } from "./system";
export interface Manifest<HookT> {
2022-03-25 19:03:06 +08:00
requiredPermissions?: string[];
functions: {
2022-03-27 17:26:13 +08:00
[key: string]: FunctionDef<HookT>;
};
}
2022-03-27 17:26:13 +08:00
export type FunctionDef<HookT> = {
path?: string;
code?: string;
2022-03-23 22:41:12 +08:00
env?: RuntimeEnvironment;
2022-03-27 17:26:13 +08:00
} & HookT;
2022-03-23 22:41:12 +08:00
export type RuntimeEnvironment = "client" | "server";
export interface Feature<HookT> {
validateManifest(manifest: Manifest<HookT>): string[];
2022-03-21 22:21:34 +08:00
2022-03-23 22:41:12 +08:00
apply(system: System<HookT>): void;
}