import { CallInputOf, CallOutputOf } from '@plitzi/sdk-shared'; /** What a run answers a plugin: the action's output, or why there is none. */ export type ServerActionResult = { ok: true; runId: string; output: Output; } | { ok: false; runId: string; /** The server's word — `forbidden`, `invalid_input`, `duplicate`… — or `skipped` where nothing runs actions. */ reason: string; /** Said for the caller, by a step that refused with a reason written for them. */ error?: string; }; export type ServerActionOptions = { /** The same key twice runs once — a second click, a retry. */ idempotencyKey?: string; /** `none` for an action that only reads: by default a completed run refreshes the page's cached requests. */ invalidateQueries?: 'all' | 'none'; }; /** * Runs one of the space's server actions from a plugin, awaited — what a flow's `runServerAction` step does, with the * same access, the same refusals and the same entry in the dev tools: * * ```ts * import type { habitDone } from '../../space/actions'; // `taskAction(tasks.done, …)` or `defineAction(…)` * * const done = useServerAction('habits-done'); * const result = await done({ id }); // the input its `call` way in declares; `result.output` what its task returns * ``` * * One operation is one action — a contract the server checks before any code runs — never a `case` in one route. */ declare const useServerAction: >(actionId: string) => ((input: CallInputOf, options?: ServerActionOptions) => Promise>); export default useServerAction;