This commit is contained in:
seb
2026-10-12 14:18:54 +02:00
parent 88ecf5bf5c
commit 06dc4629da
11 changed files with 56 additions and 12 deletions

View File

@@ -41,7 +41,7 @@ function appletExecErrorStatus(error) {
if (message.includes('must be an object')) return 400;
if (message.includes('Unable to read applet') || message.includes('ENOENT')) return 404;
if (message.includes('is not a file')) return 400;
if (message.includes('Applet metadata') || message.includes('Applet input schema') || message.includes('Applet output schema')) return 400;
if (message.includes('Applet metadata') || message.includes('Applet input schema') || message.includes('Applet output schema') || message.includes('Applet description')) return 400;
if (message.includes('Sandbox exceeded')) return 504;
if (message.includes('Sandbox worker did not report a result payload')) return 500;
return 400;
@@ -71,9 +71,10 @@ export function register(app, basePath = '') {
* Runs a `.applet.js` file from the virtual filesystem for the authenticated user's selected company
* and returns the exported function's result.
*
* The applet file must begin with two metadata lines:
* The applet file must begin with three metadata lines:
* `// @applet-input-schema {JSON Schema}` followed by
* `// @applet-output-schema {name:type;name:type}`. The input schema describes the GUI form posted as
* `// @applet-output-schema {name:type;name:type}` and
* `// @applet-description "description"`. The input schema describes the GUI form posted as
* `input`. The output line declares the RESULT COLUMNS as typed CSV — `name:type` pairs separated by `;`
* (e.g. `id:integer;name:string;active:boolean`); allowed types are `string`, `integer`, `number`,
* `boolean` and `date`. The applet exports a function that receives the posted `input` as `applet_input`
@@ -127,6 +128,9 @@ export function register(app, basePath = '') {
* properties:
* ok:
* type: boolean
* description:
* type: string
* description: Applet description declared in the @applet-description header
* result:
* type: string
* description: Typed CSV table (`;`-separated, header row first) built from the returned rows and the declared output columns