Generated API snapshot
@askrjs/askr/actions
Exports from the declarations published in @askrjs/askr. Signatures reflect the published artifact.
Exports
This entrypoint publishes 6 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.
actiontype
action: <TInput extends Record<string, unknown>, TResult = unknown>(descriptor: ActionDescriptor<TInput>) => { state: StateTuple<ActionStatus<TResult>>; submit(input: TInput): Promise<TResult>; }Returns a command handle, rather than a hook.
ActionDescriptortype
ActionDescriptor: anyA declared server action, built by {@link defineAction}, bound to a form via {@link ActionForm}.
id- readonly id: string;
input- readonly input: ObjectSchema<TInput>;
invalidates- readonly invalidates: readonly string[];
ActionFormtype
ActionForm: <TInput extends Record<string, unknown>>({ action, children, ...props }: { readonly action: ActionDescriptor<TInput>; readonly children?: RenderableChild; readonly [key: string]: unknown; }) => JSXElementA native form bound to a declared action; it is not a synthetic event API.
ActionStatustype
ActionStatus: anyPending/result/error status for an action, as reported by the `action()` hook.
pending- readonly pending: boolean;
result- readonly result?: TResult;
error- readonly error?: unknown;
ActionValidationErrortype
ActionValidationError: anyServer-replayed validation failure for an {@link ActionForm} submission.
kind- readonly kind: 'invalid';
action- readonly action: string;
values- readonly values: Readonly<Record<string, unknown>>;
issues- readonly issues: readonly unknown[];
fieldErrors- readonly fieldErrors: Readonly<Record<string, readonly string[]>>;
defineActiontype
defineAction: <TInput extends Record<string, unknown>>(options: { readonly id: string; readonly input: ObjectSchema<TInput>; readonly invalidates?: readonly string[]; }) => ActionDescriptor<TInput>Declare a server action with a stable id, input schema, and query prefixes to invalidate on success.