feat: implement command functionality with new CommandController, update Query entity, and enhance query execution with headers support
This commit is contained in:
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user