Runnable Editor
The runnable editor is a code editor integrated into Orvanta’s app editor, enabling creation and management of scripts or flows linked to components. Located at the bottom of the app editor, it allows you to connect everything together through components, inline scripts, and background runnables.
Panel structure
Section titled “Panel structure”The runnable editor panel consists of:
- Runnables list: Displays all available runnables; click to select one.
- Runnable editor: Shows the selected runnable with editing capabilities.
Header components
Section titled “Header components”The header contains:
- Editable runnable name
- Status indicator (valid/invalid based on LSP response)
- Cache button
- Orvanta AI button
- Delete button
- Expand to Script editor button
- Format button (also triggered on save)
- Run button
Types of runnables
Section titled “Types of runnables”Inline scripts
Section titled “Inline scripts”Scripts defined directly in the app editor, linked to a component.
Workspace/Hub runnables
Section titled “Workspace/Hub runnables”Runnables from the workspace or the Orvanta Hub (scripts and flows) connected to components.
Background runnables
Section titled “Background runnables”Run server-side without component attachment. Results can be shared across multiple components. Triggered on app refresh or input changes.
Frontend scripts
Section titled “Frontend scripts”JavaScript executed in the browser, capable of manipulating client app state. Includes access to frontend script helpers. Can be component-linked or background runnables.
Connect data sources to components or parameters. Re-evaluated only on detected output changes unless auto-evaluation is disabled.
Runnable configuration
Section titled “Runnable configuration”Transformer
Section titled “Transformer”Optional frontend script executed immediately after the component script. Accepts the previous computation result as result. Useful for lightweight browser-side transformations.
Triggers
Section titled “Triggers”Run on start and app refresh: Configure background runnables and data source runnables to execute at startup and refresh.
Recompute on Any Input Change: Runnables recompute when inputs change. Available for background runnables and data source runnables. Can be disabled per-input level.
Trigger runnables on success: Buttons, forms, and background scripts can trigger component recomputation after successful execution.
Resource configuration
Section titled “Resource configuration”Static resource select only / Resources from users allowed: Apps execute on behalf of publishers by default. If resources come from non-whitelisted static Resource select components, toggle “Resources from users allowed.”
Manual dependencies
Section titled “Manual dependencies”Frontend scripts can have manually specified dependencies for triggering recomputation when inputs change.
Caching app inline scripts
Section titled “Caching app inline scripts”Enable caching for inline scripts through the Code editor settings:
- Access the top bar Cache tab.
- Toggle “Cache the results for each possible inputs”.
- Specify cache duration in seconds.
Cached results return immediately if the script is re-triggered with identical inputs within the duration.
Frontend scripts helpers
Section titled “Frontend scripts helpers”Global variables and functions
Section titled “Global variables and functions”| Helper | Description |
|---|---|
ctx | Access the context object containing app metadata like email. |
state | Client-side store for data persistence. Updates require reassignment for reactivity. |
goto(path, newTab?) | Navigate to specified URL; optionally open in new tab. |
setTab(id, index) | Set active tab for tab components by ID and index. |
recompute(id) | Recompute a specific component by ID. |
globalRecompute() | Recompute all components and trigger their runnables. |
getAgGrid(id) | Retrieve the AG Grid instance of a table. |
setValue(id, value) | Manually set a component value. |
setSelectedIndex(id, index) | Select a table row by index. |
open(id) | Open a modal or drawer component. |
close(id) | Close a modal or drawer. |
validate(id, key) | Mark a form field as validated. |
invalidate(id, key, error) | Invalidate a form field with an error message. |
validateAll(id) | Validate all form fields. |
clearFiles(id) | Clear file input files. |
showToast(message, error) | Display a toast notification. |
waitJob(jobId) | Wait for job completion (returns a promise). |
askNewResource(id) | Request user resource creation on a UserResourceComponent. |
downloadFile(input, fileName?) | Download a file from URL, base64, dataURL, or S3 object. |
Security policy
Section titled “Security policy”Apps execute runnables on behalf of publishers, preventing viewers from accessing unavailable resources or scripts. The policy is computed at save time, restricts callable scripts/flows, and prevents static parameter overrides, ensuring viewers use apps as intended without resource leakage.