Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

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:41

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


readonly watchedOpcodes: readonly OpCode[];

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

Every unit the scan below reads arrives as a PUSH_STRING operand, so a program with no string constant cannot name a currency and the engine need not ask. Deliberately not the arithmetic opcodes the scan also checks: ADD is in nearly every line, and declaring it would spare nothing. See IAsyncResolver.watchedOpcodes.

IAsyncResolver.watchedOpcodes

destroy(): void;

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

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:45

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