MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / addScript

Function addScript

packages/hydrooj/src/context.ts:29–33  ·  view source on GitHub ↗
(name: string, description: string, validate: Schema<K>, run: (args: K, report: any) => boolean | Promise<boolean>)

Source from the content-addressed store, hash-verified

27}
28
29function addScript<K>(name: string, description: string, validate: Schema<K>, run: (args: K, report: any) => boolean | Promise<boolean>) {
30 if (global.Hydro.script[name]) throw new Error(`duplicate script ${name} registered.`);
31 global.Hydro.script[name] = { description, validate, run };
32 return () => delete global.Hydro.script[name];
33}
34
35function provideModule<T extends keyof ModuleInterfaces>(type: T, id: string, module: ModuleInterfaces[T]) {
36 if (global.Hydro.module[type][id]) throw new Error(`duplicate module ${type}/${id} registered.`);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected