Skip to content

CurrencyAsyncResolver

Defined in: packages/engine/src/uom/CurrencyResolver.ts:27

Fetches exchange rates before the VM runs, so a conversion has real numbers.

Until rates arrive the line evaluates to a pending value rather than a guessed one, and re-evaluates when they land.

new CurrencyAsyncResolver(exchange?): CurrencyAsyncResolver;

Defined in: packages/engine/src/uom/CurrencyResolver.ts:32

ParameterType
exchange?CurrencyExchangeService

CurrencyAsyncResolver

readonly namespace: "currency" = CURRENCY_NS;

Defined in: packages/engine/src/uom/CurrencyResolver.ts:28

Unique namespace for cache key scoping (e.g., “currency”, “weather”)

IAsyncResolver.namespace

destroy(): void;

Defined in: packages/engine/src/uom/CurrencyResolver.ts:108

Called when the resolver’s namespace is being unregistered. Clean up any in-flight promises, clear caches, unsubscribe.

void

IAsyncResolver.destroy


preflight(
_tokens,
bytecode,
packageId,
signal,
queryClient):
| AsyncCheckResult
| null;

Defined in: packages/engine/src/uom/CurrencyResolver.ts:36

Pre-flight check: called BEFORE VM execution.

Returns null if all data for this expression is cached and ready. Returns an AsyncCheckResult if async work is needed.

This method is synchronous, it only checks caches, never fetches. If data is missing, it creates a Promise and returns immediately.

ParameterTypeDescription
_tokensToken[]-
bytecodeBytecodeProgramThe compiled bytecode program
packageIdstring-
signalAbortSignalAbortSignal for the current evaluation
queryClientQueryClient-

| AsyncCheckResult | null

IAsyncResolver.preflight