(data: any[], code: string)
| 67 | } |
| 68 | |
| 69 | async function executeInNode(data: any[], code: string): Promise<any> { |
| 70 | const vm = await import('node:vm'); |
| 71 | const context = vm.createContext({ data, stat }); |
| 72 | return vm.runInContext(`${code}\nresult;`, context, { timeout: EXECUTION_TIMEOUT }); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Execute analysis code with data and stat helpers. |