import { type Accessor } from "solid-js"; import { type MaybeAccessor } from "../maybe-accessor.js"; export interface CreateAsyncSourceOptions { /** * Reactive query. Each settled flip re-runs the fetcher; in-flight * fetches against the prior query are aborted. */ query: MaybeAccessor; /** * Async fetcher. `signal` aborts when: * 1. `query` flips before the fetch resolves (last-start-wins). * 2. The `items` memo loses every subscriber (`unobserved`). * 3. The owning scope disposes (`onCleanup`). * * Throwing or rejecting propagates through the graph to the nearest * `` boundary. The primitive does not swallow. */ fetch: (query: Q, signal: AbortSignal) => Promise; /** * Optional async commit. Exposed on the API as an `action()`-typed * setter — consumers awaiting it participate in the same transition * as the items memo, and `isPending(() => c.items())` reflects * commit-driven invalidations. */ commit?: (value: V, signal: AbortSignal) => Promise; } export interface AsyncSourceApi { query: Accessor; /** * Async accessor. Reads inside a `` ancestor suspend during * the initial fetch and reveal stale-while-revalidating during * re-fetches. Reads outside any `` ancestor throw * `ASYNC_OUTSIDE_LOADING_BOUNDARY`. * * Fetcher rejections re-throw on every read until the next successful * fetch — wrap in `` (stage 02 contract). */ items: Accessor; /** * `action()`-typed commit. Async generator under the hood — the * returned promise resolves when the action's transition settles. * Visible in the type signature (no "transparent upgrade" — the * action-ness is part of the public surface, axis S). */ commit: (value: V) => Promise; /** * Imperatively re-run the items fetcher. Useful after a server write * that doesn't flip `query`. Equivalent to `refresh(c.items)` but * keeps the memo handle private. */ refresh: () => void; } export declare function createAsyncSource(options: CreateAsyncSourceOptions): AsyncSourceApi; //# sourceMappingURL=create-async-source.d.ts.map