import { fresh, stale } from './state'; import { action } from './action'; import { mixin } from './mixin'; import { wait, hasData, isLoading, isError } from './wait'; import { all, any, race, settled } from './combine'; import { derive } from './derive'; import { chain } from './then'; import { delay, state } from './utils'; /** * Async module - reactive async state management. * * This module provides: * - State creators: `async.fresh()`, `async.stale()` * - Store-bound actions: `async.action()` * - Component-local mixins: `async.mixin()` * - Data extraction: `async.wait()`, `async.hasData()`, `async.isLoading()`, `async.isError()` * - Combinators: `async.all()`, `async.any()`, `async.race()`, `async.settled()` * - Derivation: `async.derive()` * - Promise-like chaining: `async.chain()` * - Utilities: `async.delay()`, `async.invoke()`, `async.state()` */ export type { AsyncMixinOptions, AsyncMixinResult } from './mixin'; export type { AsyncStateExtra } from './state'; export { asyncState, asyncStateFrom } from './state'; export { getPendingPromise } from './helpers'; export { toPromise } from './utils'; /** * Async namespace providing reactive async state management. * * @example * // Create async state in store * const userStore = store({ * name: 'user', * state: { user: async.fresh() }, * setup({ focus }) { * const userQuery = async.action(focus('user'), async (ctx, id: string) => { * const res = await fetch(`/api/users/${id}`, { signal: ctx.signal }); * return res.json(); * }); * return { fetchUser: userQuery.dispatch }; * }, * }); * * @example * // Use async mixin in component * const submitMutation = async.mixin(async (ctx, data: FormData) => { * const res = await fetch('/api/submit', { method: 'POST', body: data }); * return res.json(); * }); * * function Form() { * const [state, { dispatch }] = useStore(({ mixin }) => mixin(submitMutation)); * return ; * } */ export declare const async: { fresh: typeof fresh; stale: typeof stale; action: typeof action; mixin: typeof mixin; wait: typeof wait; hasData: typeof hasData; isLoading: typeof isLoading; isError: typeof isError; all: typeof all; any: typeof any; race: typeof race; settled: typeof settled; derive: typeof derive; chain: typeof chain; delay: typeof delay; invoke: typeof import('./helpers').promiseTry; state: typeof state; }; //# sourceMappingURL=async.d.ts.map