import { Collection, CollectionImpl } from './collection/index.js';
import { DbClient } from './client.js';
import { PooledLiveQueries } from './query/pooled-live-query.js';
import { LiveQueryCollectionConfig } from './query/index.js';
/**
 * A hook config's pool: `pooledLiveQueries` or nothing. Any other value, such
 * as the removed boolean form, contradicts the hook contract, so every reader
 * rejects it the same way, whatever the config's other options. An adapter
 * that reads the pool from its own options, as Angular does, checks it here.
 */
export declare function configPool(config: object): PooledLiveQueries | undefined;
export type LiveQueryKey = ReadonlyArray<unknown>;
export type LiveQueryOptions = LiveQueryCollectionConfig<any> & {
    queryKey?: LiveQueryKey;
};
export type DeferredLiveQueryCollections = Set<CollectionImpl<any, string | number, any, any, any>>;
/**
 * Release the sync starts a rejected query input deferred, then rethrow its
 * rejection. A framework hook calls this around its own render work, so a
 * query the hook rejects leaves no source deferred and a later reader can
 * start it. A render that throws after the hook returns, such as in a sibling
 * hook, is not a rejection of this input: like any render that never commits,
 * it releases its deferral through `releaseDeferredOnReclaim` when garbage
 * collection reclaims its live query. As for a
 * `DbClient` preload, the rejection wins over a source whose resumed start
 * fails; that source records its own failure.
 */
export declare function rejectLiveQueryInput(collections: DeferredLiveQueryCollections | undefined, rejection: unknown): never;
/**
 * Release a render's deferred sync starts when the live query it built is
 * reclaimed. A render that commits releases them first, when it subscribes.
 * A render that never commits, because a sibling threw or it suspended, leaves
 * its live query unsubscribed until garbage collection cleans it up; that
 * cleanup releases the starts, so a direct reader's demand, made before or
 * after, then starts the sources. A live query that garbage collection never
 * reclaims, because its config disables GC or does not start its sync,
 * releases after the unsubscribed GC floor instead. Releases only the starts
 * deferred so far, not ones a later render of the same hook defers. Pass only
 * a live query the render built, and call the returned function when the
 * render commits, so a committed hook keeps no listener, timer, or copied
 * sources.
 */
export declare function releaseDeferredOnReclaim(liveQuery: Pick<Collection<any, any, any>, `once` | `config` | `status`>, deferredCollections: DeferredLiveQueryCollections): (() => void) | undefined;
/** Release every deferred source, then report the first startup failure. */
export declare function resumeDeferredLiveQueryCollections(collections: DeferredLiveQueryCollections, reportSourceErrors?: boolean): void;
export declare function prepareLiveQueryValue(value: unknown, dbClient: DbClient | undefined, deferredCollections?: DeferredLiveQueryCollections): unknown;
/** Concrete source objects in query-position order for a prepared value. */
export declare function getPreparedLiveQuerySources(value: unknown, onUnboundDescriptor?: (alias: string) => never): Array<Collection>;
/** Local row behavior, kept separate from the portable query identity. */
export type LiveQueryRowOptions = readonly [getKey: unknown, schema: unknown];
export declare function getLiveQueryRowOptions(value: unknown): LiveQueryRowOptions;
export declare function getPreparedLiveQueryIdentity(value: unknown, pool?: PooledLiveQueries): unknown;
export declare function getLiveQueryHash(preparedValue: unknown, queryKey?: LiveQueryKey): string;
/**
 * Resolve an adapter's query value to what its observer watches: `null` for a
 * disabled query, an existing Collection with sync started, or a live query.
 * A query builder whose shape a shared partition can serve gets a pooled view
 * instead of its own live-query Collection.
 */
export declare function resolveLiveQueryValue(value: unknown, { gcTime, pool, startSync, }?: {
    gcTime?: number;
    pool?: PooledLiveQueries | false;
    startSync?: boolean;
}): Collection<any, any, any> | null;
