@@ -55,6 +55,12 @@ export const ActionParamSchema = lazySchema(() => z.object({
5555 helpText : z . string ( ) . optional ( ) ,
5656 /** Default value for the dialog input. */
5757 defaultValue : z . unknown ( ) . optional ( ) ,
58+ /**
59+ * When true, the param's default value is pulled from the current row record
60+ * (key = the resolved field name) when the action runs from a list_item
61+ * context. Useful for edit dialogs that pre-fill from the selected row.
62+ */
63+ defaultFromRow : z . boolean ( ) . optional ( ) ,
5864} ) . refine (
5965 ( p ) => Boolean ( p . name ) || Boolean ( p . field ) ,
6066 { message : 'ActionParam requires either "name" or "field"' } ,
@@ -190,6 +196,34 @@ export const ActionSchema = lazySchema(() => z.object({
190196 /** Bulk Operations */
191197 bulkEnabled : z . boolean ( ) . optional ( ) . describe ( 'Whether this action can be applied to multiple selected records' ) ,
192198
199+ /**
200+ * Row-context: when the action runs from a list_item location, this body key
201+ * receives the row's id (or the field named by `recordIdField`). Defaults to
202+ * `id` when omitted but `recordIdField` is set; otherwise no injection.
203+ */
204+ recordIdParam : z . string ( ) . optional ( ) . describe ( 'Body key to inject the row id into when running from a list_item context.' ) ,
205+ /**
206+ * Row field whose value seeds `recordIdParam`. Defaults to `'id'` when
207+ * `recordIdParam` is set. Use this when the body key expects a non-id value
208+ * (e.g. `token` for `revoke-session`).
209+ */
210+ recordIdField : z . string ( ) . optional ( ) . describe ( 'Row field whose value seeds recordIdParam. Defaults to "id".' ) ,
211+ /**
212+ * Request-body shape. `'flat'` (default) sends collected params at the top
213+ * level. `{ wrap: 'data' }` nests the user-collected params under that key
214+ * (used by better-auth `organization/update`), while `recordIdParam` and
215+ * other top-level keys stay flat.
216+ */
217+ bodyShape : z . union ( [
218+ z . literal ( 'flat' ) ,
219+ z . object ( { wrap : z . string ( ) } ) ,
220+ ] ) . optional ( ) . describe ( 'Body wrapping: flat (default) or { wrap: key } to nest user-collected params under a key.' ) ,
221+ /**
222+ * Semantic mode hint — UI / runtime can use this to pick confirm copy,
223+ * default variants, success messaging. Pure metadata; no runtime branching.
224+ */
225+ mode : z . enum ( [ 'create' , 'edit' , 'delete' , 'custom' ] ) . optional ( ) . describe ( 'Semantic mode of the action.' ) ,
226+
193227 /** Execution */
194228 timeout : z . number ( ) . optional ( ) . describe ( 'Maximum execution time in milliseconds for the action' ) ,
195229
0 commit comments