import type { TQueryFnResult, TQueryStreamContext } from "../../../query/types/index.js"; /** Lifecycle promises derived from a single query run (see {@link instrumentQueryRun}). */ export interface TQueryRunLifecycle { $queryFulfilled: Promise<{ data: TData; }>; $queryStream: TQueryStreamContext; } export interface TInstrumentedQueryRun { /** What to hand to the cache entry: the raw promise, or the stream instrumented in place. */ result: TQueryFnResult; lifecycle: TQueryRunLifecycle; } /** * Derive the `onQueryStarted` context promises from a single query run without * consuming it. * * A promise run backs all three promises directly (`firstReceived` ≡ * `allReceived` ≡ the run's outcome). A stream run is observed through a `tap` * inserted into the observable itself — the cache entry stays its only * subscriber, so the producer runs exactly once: `firstReceived` settles with * the first emission, `allReceived` with the last one at completion, both * reject with the raw producer error (or {@link EmptyStreamError} on an empty * completion). If the run is torn down before a milestone (refresh / retry / * eviction unsubscribes), the pending promises reject with the abort reason. * * Like `$queryFulfilled`, all promises deliberately sit upstream of `mapError` * and carry raw errors. */ export declare function instrumentQueryRun(raw: TQueryFnResult, signal: AbortSignal): TInstrumentedQueryRun;