kodexa.* namespace, where each sub-namespace corresponds to a capability gated by the form’s bridge permissions.
Bridge Permissions
Thebridge property on a data form configures what scripts are allowed to do. The permissions array lists capability gates — a script that attempts to call a method without the required permission will receive a Permission denied error.
| Permission | Grants access to |
|---|---|
data:read | Read data objects, attributes, tag metadata, taxonomies |
data:write | Modify data objects and attributes |
document:read | Access the document proxy (kodexa.document) |
navigation | Focus attributes, scroll to nodes, switch views |
formState | Get and set form state values, access node refs |
http:get | HTTP GET requests via kodexa.http |
http:post | HTTP POST requests via kodexa.http and service bridge calls |
apiBaseUrl— Base URL forkodexa.httpandkodexa.serviceBridgecalls. Defaults to"/api".maxExecutionMs— Script execution timeout in milliseconds. Defaults to1000.
kodexa.data
Requiresdata:read. Methods that modify data also require data:write.
| Method | Parameters | Returns | Permission |
|---|---|---|---|
getDataObjects(filter?) | { path?: string, parentId?: string } | DataObject[] | data:read |
getDataObject(uuid) | uuid: string | DataObject | null | data:read |
getAttributes(dataObjectUuid) | dataObjectUuid: string | Attribute[] | data:read |
getAttribute(dataObjectUuid, path) | dataObjectUuid: string, path: string | any | data:read |
setAttribute(dataObjectUuid, path, value) | dataObjectUuid: string, path: string, value: any | void | data:write |
addDataObject(parentUuid, path) | parentUuid: string, path: string | DataObject | data:write |
deleteDataObject(uuid) | uuid: string | void | data:write |
getTagMetadata(path) | path: string | TagMetadata | null | data:read |
getTaxonomies() | — | Taxonomy[] | data:read |
kodexa.navigation
Requiresnavigation.
| Method | Parameters | Description |
|---|---|---|
focusAttribute(dataObjectUuid, attributePath) | dataObjectUuid: string, attributePath: string | Highlight an attribute in the document viewer |
scrollToNode(ref) | ref: string | Scroll the document viewer to a content node |
switchView(viewName) | viewName: string | Switch to a different form view |
focusAttribute takes dataObjectUuid as the first parameter and attributePath as the second.
kodexa.form
RequiresformState.
| Method | Parameters | Returns | Description |
|---|---|---|---|
get(key) | key: string | any | Read a form state value |
set(key, value) | key: string, value: any | void | Write a form state value |
getNodeRef(ref) | ref: string | { setProps(props) } | Get a UINode by ref for dynamic prop updates |
kodexa.document
Requiresdocument:read. The writable snapshot also requires data:write.
| Method | Returns | Description |
|---|---|---|
snapshot() | ScriptDocumentProxy | Read-only proxy over the current document data |
writableSnapshot() | ScriptDocumentProxy | Writable proxy — mutations flow through the workspace store |
ScriptDocumentProxy exposes getAllDataObjects(), getDataObjectByUUID(uuid), and getDataObjectsByPath(path). Each returns ScriptDataObjectProxy instances with methods like getAttributes(), getAttribute(label), getChildren(), and getPath(). Writable proxies additionally support addAttribute(), addChild(), and setValue() on attributes.
This API is separate from loadDocument() available in inline or named scripts. kodexa.document provides Bridge API context tied to the current workspace session; loadDocument() is for standalone script execution.
kodexa.http
Requireshttp:get for GET requests, http:post for POST requests. Both are async.
| Method | Parameters | Returns |
|---|---|---|
get(path) | path: string | Promise<any> |
post(path, body?) | path: string, body?: any | Promise<any> |
apiBaseUrl + path. The base URL defaults to "/api" if not configured.
kodexa.serviceBridge
Requireshttp:post.
| Method | Parameters | Returns |
|---|---|---|
call(ref, endpoint, body?) | ref: string, endpoint: string, body?: any | Promise<any> |
ref is the bridge slug (e.g., "cass-freight/data-entry-automation"), and endpoint is the endpoint name defined in the bridge YAML.
The bridge manages an X-Bridge-Context header for session caching. On the first call, no context header is sent; the server runs any configured initScript and returns context in the response header. Subsequent calls attach the cached context, skipping re-initialization. Context expires after a configurable TTL (default 3600 seconds).
kodexa.log
No permission required.| Method | Parameters |
|---|---|
debug(message) | message: string |
warn(message) | message: string |
error(message) | message: string |
[DataFormV2] and routed to the browser console.
Service Bridges on Panels
In addition to imperativekodexa.serviceBridge.call() from scripts, panels support declarative service bridge integration through the serviceBridge prop on v2:panel. This allows a component to declare an external API dependency without writing script code.
ServiceBridgeConfig
| Property | Type | Description |
|---|---|---|
ref | string | Bridge reference (e.g., "cass-freight/data-entry-automation") |
endpoint | string | Endpoint name from the bridge YAML |
method | "GET" | "POST" | HTTP method, defaults to POST |
requestMapping | Record<string, string> | Maps data attribute paths to request fields |
responseMapping | ServiceBridgeResponseMapping | Controls how the response maps back to UI or data |
triggerOn | string[] | Attribute paths that trigger a re-call when values change |
ServiceBridgeResponseMapping
| Property | Type | Description |
|---|---|---|
value | string | Path to extract option value from each response item |
label | string | Path or expression for the option label (supports concatenation like "code + ' - ' + description") |
description | string | Path or expression for hint text shown below the label in dropdowns |
autoSelect | string | Auto-select a single best-match field from the response |
attributes | Array<{ from, to }> | Map response fields to data attributes (from: response path, to: attribute path) |
How It Works
When any attribute listed intriggerOn changes, the panel reads the current values from requestMapping, calls the service bridge endpoint, and maps the response back using responseMapping. This creates a reactive loop: user edits a field, the bridge fetches updated data, and dependent fields populate automatically.
