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.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CurrencyAsyncResolver(exchange?): CurrencyAsyncResolver;Defined in: packages/engine/src/uom/CurrencyResolver.ts:41
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
exchange? | CurrencyExchangeService |
Returns
Section titled “Returns”CurrencyAsyncResolver
Properties
Section titled “Properties”namespace
Section titled “namespace”readonly namespace: "currency" = CURRENCY_NS;Defined in: packages/engine/src/uom/CurrencyResolver.ts:28
Unique namespace for cache key scoping (e.g., “currency”, “weather”)
Implementation of
Section titled “Implementation of”watchedOpcodes
Section titled “watchedOpcodes”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.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”destroy()
Section titled “destroy()”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.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”preflight()
Section titled “preflight()”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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
_tokens | Token[] | - |
bytecode | BytecodeProgram | The compiled bytecode program |
packageId | string | - |
signal | AbortSignal | AbortSignal for the current evaluation |
queryClient | QueryClient | - |
Returns
Section titled “Returns”| AsyncCheckResult
| null