Skip to content

VariableResolver

Defined in: packages/engine/src/variables/VariableResolver.ts:10

Resolves variable names by querying registered IVariableSource instances in priority order. Supports caching for repeated lookups.

Sources are sorted by priority (lowest first) on registration. When resolving a variable, sources are queried in order and the first non-undefined result wins.

new VariableResolver(): VariableResolver;

VariableResolver

invalidate(name): void;

Defined in: packages/engine/src/variables/VariableResolver.ts:85

Invalidate a single variable in the cache, forcing re-resolution on next read.

ParameterType
namestring

void


invalidateAll(): void;

Defined in: packages/engine/src/variables/VariableResolver.ts:90

Invalidate all cached variable lookups.

void


registerSource(source): void;

Defined in: packages/engine/src/variables/VariableResolver.ts:21

Register a variable source with a given priority. Sources are sorted so lower-priority-number sources are queried first.

ParameterTypeDescription
sourceIVariableSourceThe variable source to register

void


resolve(name): Promise<string | number | undefined>;

Defined in: packages/engine/src/variables/VariableResolver.ts:51

Resolve a variable name to its value.

Checks the cache first (if enabled), then queries registered sources in priority order. The first source returning a non-undefined value wins. Cached results are stored and returned on subsequent calls until invalidated.

ParameterTypeDescription
namestringThe variable name to resolve

Promise<string | number | undefined>

The resolved value, or undefined if not found in any source


set(name, value): Promise<void>;

Defined in: packages/engine/src/variables/VariableResolver.ts:77

Set a variable value across all registered sources. Also updates the local cache so subsequent reads return the new value.

ParameterTypeDescription
namestringThe variable name
valuestring | numberThe value to set

Promise<void>


setCacheEnabled(enabled): void;

Defined in: packages/engine/src/variables/VariableResolver.ts:95

Enable or disable the lookup cache. When disabled, every read queries sources directly.

ParameterType
enabledboolean

void


unregisterSource(source): void;

Defined in: packages/engine/src/variables/VariableResolver.ts:33

Remove a previously registered variable source (identity match). The lookup cache is cleared because resolution results may change once the source no longer participates.

ParameterTypeDescription
sourceIVariableSourceThe exact source instance passed to registerSource.

void