feat: implement command functionality with new CommandController, update Query entity, and enhance query execution with headers support

This commit is contained in:
lborv
2025-10-02 10:02:44 +03:00
parent e53e3cf92c
commit efbb9f5c21
11 changed files with 122 additions and 11 deletions

View File

@ -47,7 +47,11 @@ export class Vm {
this.jail.setSync(name, func);
}
async runScript(script: string, args: Record<string, any>): Promise<any> {
async runScript(
script: string,
args: Record<string, any>,
headers: Record<string, any>
): Promise<any> {
let resolvePromise: (value: any) => void;
let rejectPromise: (reason?: any) => void;
@ -76,7 +80,9 @@ export class Vm {
(async () => {
${script}
try {
const result = await main(${JSON.stringify(args)});
const result = await main(${JSON.stringify(
args
)}, ${JSON.stringify(headers)});
returnResult(JSON.stringify(result))
} catch (e) {
error(e)