Documentation Index
Fetch the complete documentation index at: https://kubo-47e69177.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
defineAction
defineAction valide input/output a l’execution tout en conservant le typage TypeScript.
Signature
packages/core/src/defineAction.ts
Options
| Option | Type | Obligatoire | Notes |
|---|---|---|---|
input | ZodType<TInput> | Oui | Validation runtime de l’input |
output | ZodType<TOutput> | Non | Validation runtime de l’output |
name | string | Non | Utilise par le logger |
tags | readonly string[] | Non | Passe a revalidateTags |
beforeAction | (args) => void | Promise<void> | Non | Execute avant handler |
afterAction | (args) => TOutput | void | Promise<TOutput | void> | Non | Execute apres handler |
handler | ({ input, ctx }) => Promise<TOutput> | Oui | Implementation principale |
Exemple
app/actions.ts