2022-03-23 14:41:12 +00:00
|
|
|
import { System } from "./system";
|
2022-03-20 08:56:28 +00:00
|
|
|
|
|
|
|
export interface Manifest<HookT> {
|
|
|
|
hooks: HookT & EventHook;
|
|
|
|
functions: {
|
|
|
|
[key: string]: FunctionDef;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface FunctionDef {
|
|
|
|
path?: string;
|
|
|
|
code?: string;
|
2022-03-23 14:41:12 +00:00
|
|
|
env?: RuntimeEnvironment;
|
2022-03-20 08:56:28 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 14:41:12 +00:00
|
|
|
export type RuntimeEnvironment = "client" | "server";
|
|
|
|
|
2022-03-21 14:21:34 +00:00
|
|
|
export type EventHook = {
|
|
|
|
events?: { [key: string]: string[] };
|
|
|
|
};
|
|
|
|
|
2022-03-23 14:41:12 +00:00
|
|
|
export interface Feature<HookT> {
|
|
|
|
validateManifest(manifest: Manifest<HookT>): string[];
|
2022-03-21 14:21:34 +00:00
|
|
|
|
2022-03-23 14:41:12 +00:00
|
|
|
apply(system: System<HookT>): void;
|
2022-03-20 08:56:28 +00:00
|
|
|
}
|