u
This commit is contained in:
@@ -106,4 +106,25 @@ export const vfs = {
|
||||
body: { oldPath: cleanOld, newPath: cleanNew },
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* POST /api/vfs/*path — run a `.applet.js` file from VFS.
|
||||
* Path goes in the URL, run params in the JSON body.
|
||||
* @param {string} path VFS-relative applet path (e.g. `demo.applet.js`)
|
||||
* @param {{ input?: object, timeout?: number, max_output?: number }} [options]
|
||||
* → 200 { ok, result, columns, rows, warnings?, stdout, consoleLines, durationMs, truncated? }
|
||||
* `result` is a typed CSV string (`;`-separated, header row first), `columns` are the
|
||||
* declared `{ name, type }` pairs, `rows` is the data-row count.
|
||||
*/
|
||||
runApplet(path, options = {}) {
|
||||
const clean = String(path || '').replace(/^\/+/, '');
|
||||
const body = {};
|
||||
if (options.input !== undefined) body.input = options.input;
|
||||
if (options.timeout !== undefined) body.timeout = options.timeout;
|
||||
if (options.max_output !== undefined) body.max_output = options.max_output;
|
||||
return http(`/api/vfs/${clean}`, {
|
||||
method: 'POST',
|
||||
body,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user