resolveDynamic
Resolves an A2UI v0.9 dynamic value against a client data model.
Bare literals (strings, numbers, booleans) pass through unchanged, { path }
references read from the model by JSON-pointer path, arrays resolve
element-wise, and client-side function calls ({ call }) execute through the
provided function registry — argument values resolve recursively, so args may
themselves be bindings or nested calls. Without a registry (or for unknown
function names) calls resolve to undefined. Unrecognized plain objects pass
through unchanged.
import { resolveDynamic } from '@threadplane/a2ui';Declaration · overload 1
export declare function resolveDynamic(value: unknown, model: Record<string, unknown>, scope?: A2uiScope, registry?: A2uiFunctionRegistry): unknown;Parameters
value· requiredunknownmodel· requiredRecord<string, unknown>scope· optionalA2uiScoperegistry· optionalA2uiFunctionRegistry
Returns
unknownExamples
const model = { customer: { name: 'Ada' } };
resolveDynamic({ path: '/customer/name' }, model); // 'Ada'
resolveDynamic('Checkout', model); // 'Checkout'
resolveDynamic(
{ call: 'formatString', args: { value: 'Hi ${/customer/name}' } },
model, undefined, createA2uiFunctionRegistry(),
); // 'Hi Ada'