1
0
silverbullet/plugbox/types.ts
2022-03-23 15:41:12 +01:00

27 lines
507 B
TypeScript

import { System } from "./system";
export interface Manifest<HookT> {
hooks: HookT & EventHook;
functions: {
[key: string]: FunctionDef;
};
}
export interface FunctionDef {
path?: string;
code?: string;
env?: RuntimeEnvironment;
}
export type RuntimeEnvironment = "client" | "server";
export type EventHook = {
events?: { [key: string]: string[] };
};
export interface Feature<HookT> {
validateManifest(manifest: Manifest<HookT>): string[];
apply(system: System<HookT>): void;
}