feat: simplify global function assignment in Vm class and enable logging of results in case1-payload test

This commit is contained in:
Boris D
2025-10-09 13:04:38 +03:00
parent f357bc5e61
commit 0631e99886
2 changed files with 3 additions and 8 deletions

View File

@ -48,12 +48,7 @@ export class Vm {
await this.context.evalClosure( await this.context.evalClosure(
` `
const name = $0; globalThis[$0][$1] = (...args) => $2.apply(undefined, args, {
const method = $1;
const ref = $2;
const ns = globalThis[name];
ns[method] = (...args) => ref.apply(undefined, args, {
arguments: { copy: true }, arguments: { copy: true },
result: { promise: true, copy: true } result: { promise: true, copy: true }
}); });
@ -85,7 +80,7 @@ export class Vm {
}); });
this.setFunction("returnResult", (res) => { this.setFunction("returnResult", (res) => {
// console.log("Returning result from VM:", res); console.log("Returning result from VM:", res);
resolvePromise(res); resolvePromise(res);
}); });

View File

@ -17,7 +17,7 @@ async function main(input, headers) {
const res = await db.execute(sql); const res = await db.execute(sql);
// log(res); log(res);
return { return {
response: { response: {