feat: implement function management with FunctionEntity, FunctionService, and FunctionController; enhance QueryExecuterService to utilize functions; refactor CommandController and QueryController to extend BaseQueryController; update Vm class to handle functions; remove obsolete log entities

This commit is contained in:
lborv
2025-10-09 19:35:30 +03:00
parent 5b30b876e5
commit e89af0dd20
14 changed files with 261 additions and 160 deletions

View File

@ -9,6 +9,7 @@ export class Vm {
private context: any;
private jail: any;
private plugins: Plugin[];
private functions: string[];
private isolate: ivm.Isolate;
private timeLimit?: bigint;
private cpuTimeLimit?: bigint;
@ -19,12 +20,14 @@ export class Vm {
cpuTimeLimit?: bigint;
modules: VModule[];
plugins: Plugin[];
functions: string[];
}) {
this.memoryLimit = configs.memoryLimit;
this.modules = configs.modules;
this.plugins = configs.plugins;
this.timeLimit = configs.timeLimit;
this.cpuTimeLimit = configs.cpuTimeLimit;
this.functions = configs.functions;
}
async init(): Promise<Vm> {
@ -38,6 +41,10 @@ export class Vm {
await this.context.eval(mod.getSource());
}
for (const fn of this.functions) {
await this.context.eval(fn);
}
for (const plugin of this.plugins) {
const pluginName = plugin.getName();