Expand description
The server’s host bindings: what a fully trusted script can reach.
The operator’s call: scripts are written by
administrators and are trusted with EVERYTHING — the network, the PLM, the
server’s file system and child processes. There is no allowlist. These
bindings are server-only; the interpreter core in super::engine does not
depend on them, so the CAD app can later embed the core with its own host.
| Global | Function | Returns |
|---|---|---|
http | request(url or { url, method, headers, body, timeoutMs }) | { status, headers, body, json } |
fs | readFile(path), writeFile(path, text), exists(path), listDir(path) | text / nothing / bool / names |
process | run(command, args?, { cwd, stdin }?) | { status, stdout, stderr } |
plm | user, part(idOrNumber), findParts(query), partTypes(), readDocument(part, revision), updatePart(part, fields), manufacturers(), suppliers(), addManufacturerPart(part, fields), addOffer(part, mpId, fields), bom(part, revision, { levels, flat }), whereUsed(part, revision?, levels?), attachments(part, revision?) | JSON |
Every call is synchronous — a Boa host function cannot await. An HTTP call
carries its own timeout (default HTTP_TIMEOUT_MS) because nothing else
bounds it; a child process is bounded by nothing but itself. A relative
file path, and a child’s default working directory, is the scripts
directory.
plm.* goes through the ordinary Db methods, each taking the store lock
itself for its own moment. That is safe only because hooks never run while
the lock is held (see crate::db); a binding here must never be called
from inside Db::mutate.
Structs§
- Host
- The bindings for one hook call: the store, and who the call acts for.
Constants§
- HTTP_
TIMEOUT_ MS - How long an
http.requestwaits when the script does not say.