feat: simplify global function assignment in Vm class and enable logging of results in case1-payload test
This commit is contained in:
@ -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);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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: {
|
||||||
|
|||||||
Reference in New Issue
Block a user