Optionalclock?: CollectClockInjectable clock for deterministic tests; defaults to real time.
Optionalconsistency?: VariableConsistencyOptionsEventual-consistency tolerance. Omitted or waitUpToMs: 0 reads exactly once.
Whether the query is scoped to a single scope (collisions impossible, early-stop safe).
Page through variable search results until every declared variable is found or the result set is exhausted, then collapse them into a VariableMap.
Eventual-consistency waiting (when
consistency.waitUpToMs > 0) is applied here, at the collection level — not on the underlying search calls. A freshly-written instance indexes its declared variables independently, so an early read can return only a subset (e.g.orderIdbeforeamount). Waiting on the first search alone is too weak: that search's success condition is "at least one matching variable", so it settles on a partial result. Instead we re-run the whole collection until every declared name is visible or the budget expires. On expiry we return the best snapshot gathered so far rather than throwing: a genuinely-absent variable is indistinguishable from a late one, and VariableMap.validate is the right place to surface a missing required variable. This also keeps pagination correct — a paging read that legitimately returns zero items never blocks, because the inner search never waits.The
fetchPagecallback isolates the HTTP call so the paging and collapse logic is unit-testable in isolation;clockisolates time so the consistency loop is too.