ObjectStackObjectStack

Bulk Action schema — UI Protocol reference

The vocabulary of a list view's bulkActionDefs — one entry per button in the multi-select toolbar.

Bulk Action Schemas

The vocabulary of a list view's bulkActionDefs — one entry per button in the multi-select toolbar. Use a def for a mass data-plane mutation that no action expresses (operation: 'update' with a patch, or 'delete'), or for an operation: 'custom' + execution: 'aggregate' entry that dispatches the action it NAMES once for the whole selection.

For the per-record dispatch, name the action in the view's bulkActions: ['<name>'] instead — the bare-string form, promoted with the action's own label, params and visible.

Source: packages/spec/src/ui/bulk-action.zod.ts

TypeScript Usage

import { BulkActionDefSchema, BulkActionExecutionSchema, BulkActionOperationSchema, BulkActionParamSchema, BulkActionResultSchema } from '@objectstack/spec/ui';
import type { BulkActionDef, BulkActionExecution, BulkActionOperation, BulkActionParam, BulkActionResult } from '@objectstack/spec/ui';

// Validate data
const result = BulkActionDefSchema.parse(data);

BulkActionDef

Properties

PropertyTypeRequiredDescription
namestring✅Stable identifier — the audit-log action key, and (for an aggregate def) the name of the object action to dispatch.
labelstringoptionalButton + dialog-header text. Plain string: an authored def is not i18n-resolved (declare a real action and name it in bulkActions to get localization).
iconstringoptionalLucide icon name (e.g. "user-check", "trash").
variantEnum<'primary' | 'secondary' | 'danger' | 'ghost' | 'outline'>optionalVisual treatment of the button.
operationEnum<'update' | 'delete' | 'custom'>✅What the executor does: 'update'/'delete' are data-plane mass mutations; 'custom' dispatches an object action (see execution).
executionEnum<'perRecord' | 'aggregate'>optionalFor operation: 'custom' — 'aggregate' dispatches the named action ONCE for the whole selection, carrying every id in params._selectedIds. Required on a custom def: the per-record form is declared as bulkActions: ['<name>'] instead.
patchRecord<string, any>optionalFor operation: 'update' — static field values applied to every selected record, merged UNDER the user-supplied params so a fixed value can be declared without exposing it in the dialog.
params{ name: string; label?: string; help?: string; type: Enum<'text' | 'textarea' | 'email' | 'url' | 'phone' | 'password' | 'secret' | …>; … }[]optionalInputs collected once before the run. Omit to skip the params step and go straight to confirm.
confirmTextstring | { dialect: 'template'; source?: string; ast?: any; meta?: object } | stringoptionalConfirmation text shown above the affected-record summary — a template slot (ADR-0032): a bare string is shorthand for { dialect: 'template', source }, and text with no hole is shown as written. Holes are {{ path }} or {{ path | formatter[:arg] }} over two kinds of root, written bare: count, the number of records the run covers, and each of the def's params by name ({{ tier }}, never {{ params.tier }}; count wins over a param of that name). A param hole renders that param's DISPLAY value: the chosen option's label for an option-bearing param (a multi-value param's labels joined with ', '), the picked record's display name for a lookup / user param, and the entered value otherwise, so a number, date or currency value takes a formatter ({{ amount | currency:EUR }}, {{ due | date:long }}). Formatters come from the template engine's whitelist (TEMPLATE_FORMATTERS, @objectstack/formula); a hole holds no logic (no CEL, no arithmetic). Example: 'Update tier on {{ count }} account(s) to {{ tier }}?'. A hole over any other root, and a single-brace {x} token, are refused by name at objectstack validate, compile and the publish gate, as are a hole holding logic or an unknown formatter and a blank sentence.
confirmLabelstringoptionalCustom Confirm button label (default: "Run").
visiblestring | { dialect: Enum<'cel' | 'cron' | 'template'>; source: string; ast?: any; meta?: object }optionalEligibility predicate (CEL) — a string or a {dialect, source} envelope, i.e. action.visible without its boolean-literal arm: a per-record predicate has nothing to say as a constant. Evaluated once PER SELECTED RECORD with that record bound: the button is offered when at least one passes, the run covers only those, and the rest are reported as skipped. A record-free predicate (features.x, current_user.y) therefore behaves as a plain button-level gate. Fail-closed — a predicate that faults excludes the record.
requiredPermissionsstring[]optional[ADR-0066 D4] Capability gate on the button, action.requiredPermissions semantics verbatim: absent or empty always passes, several are AND-ed, and a client that cannot resolve the caller's capabilities fails OPEN (the server stays the authority). This key exists for INLINE defs — notably the update/delete data-plane forms, which dispatch no action and so have nothing to inherit a gate from; a def promoted from bulkActions: ['<name>'] (or an aggregate def naming a declared action) inherits the action's own declaration instead. On a data-plane def the gate governs visibility only — the write itself is still authorized by the data API's object permissions and server hooks.
maxRecordsintegeroptionalSelection size above which the run is blocked. Set it on defs whose server work is expensive — an aggregate def carries every selected id in one request.
batchSizeintegeroptionalRecords per executor batch (default 200). Data-plane operations only — an aggregate run is a single call by definition.

Nested Shape: BulkActionDef.params[number]

PropertyTypeRequiredDescription
namestring✅Param key — becomes params[name] in the patch / action params bag.
labelstringoptionalField label in the dialog. Plain string: an authored def is not i18n-resolved (see module header).
helpstringoptionalHelp text under the field. (An ActionParam spells this helpText — known divergence, module header.)
typeEnum<'text' | 'textarea' | 'email' | 'url' | 'phone' | 'password' | 'secret' | …>✅Field widget to render, from the standard field-type vocabulary (text/number/select/lookup/date/…).
requiredbooleanoptionalBlocks the Confirm button until a value is present.
defaultanyoptionalValue applied when the dialog opens. (An ActionParam spells this defaultValue.)
options({ label: string; value: string | number | boolean } & Record<string, any>)[]optionalStatic options for select-style widgets. Each entry is { label, value } plus any extra widget config — the entry is open (.passthrough()) because the renderer forwards unknown option keys to the field widget, which reads color / icon / disabled / visibleWhen beyond the declared pair.
objectstringoptionalTarget object for a lookup widget. (An ActionParam spells this reference.)
labelFieldstringoptionalRelated-object field used as the option label for a lookup widget (defaults to name/full_name/email/id).
multiplebooleanoptionalAllow picking multiple values — the param value becomes an array and is written to the patch as-is.
placeholderstringoptionalPlaceholder text.
dependsOn(string | { field: string; param?: string })[]optionalDeclares that this param's available values depend on the value of other field(s) on the same record — the form gates the field until they are set and re-evaluates as they change. For lookup/master_detail it scopes the candidate query (string = same local/remote key; {field,param} when the remote filter key differs — the {field,param} form is lookup-only). For select/multiselect/radio the actual per-option rule lives in each option's visibleWhen; list the referenced fields here (string form) so the option list gates and refreshes with the parent. On a BULK param the record is the dialog's own in-progress param values — a bulk run holds a selection, not a row — so a binding names a SIBLING PARAM of the same def.

BulkActionExecution

Allowed Values

  • perRecord
  • aggregate

BulkActionOperation

Allowed Values

  • update
  • delete
  • custom

BulkActionParam

Properties

PropertyTypeRequiredDescription
namestring✅Param key — becomes params[name] in the patch / action params bag.
labelstringoptionalField label in the dialog. Plain string: an authored def is not i18n-resolved (see module header).
helpstringoptionalHelp text under the field. (An ActionParam spells this helpText — known divergence, module header.)
typeEnum<'text' | 'textarea' | 'email' | 'url' | 'phone' | 'password' | 'secret' | 'markdown' | 'html' | 'richtext' | 'number' | 'currency' | 'percent' | 'date' | … +35 more>✅Field widget to render, from the standard field-type vocabulary (text/number/select/lookup/date/…).
requiredbooleanoptionalBlocks the Confirm button until a value is present.
defaultanyoptionalValue applied when the dialog opens. (An ActionParam spells this defaultValue.)
options({ label: string; value: string | number | boolean } & Record<string, any>)[]optionalStatic options for select-style widgets. Each entry is { label, value } plus any extra widget config — the entry is open (.passthrough()) because the renderer forwards unknown option keys to the field widget, which reads color / icon / disabled / visibleWhen beyond the declared pair.
objectstringoptionalTarget object for a lookup widget. (An ActionParam spells this reference.)
labelFieldstringoptionalRelated-object field used as the option label for a lookup widget (defaults to name/full_name/email/id).
multiplebooleanoptionalAllow picking multiple values — the param value becomes an array and is written to the patch as-is.
placeholderstringoptionalPlaceholder text.
dependsOn(string | { field: string; param?: string })[]optionalDeclares that this param's available values depend on the value of other field(s) on the same record — the form gates the field until they are set and re-evaluates as they change. For lookup/master_detail it scopes the candidate query (string = same local/remote key; {field,param} when the remote filter key differs — the {field,param} form is lookup-only). For select/multiselect/radio the actual per-option rule lives in each option's visibleWhen; list the referenced fields here (string form) so the option list gates and refreshes with the parent. On a BULK param the record is the dialog's own in-progress param values — a bulk run holds a selection, not a row — so a binding names a SIBLING PARAM of the same def.

Allowed Values: BulkActionParam.type

  • text
  • textarea
  • email
  • url
  • phone
  • password
  • secret
  • markdown
  • html
  • richtext
  • number
  • currency
  • percent
  • date
  • datetime
  • time
  • boolean
  • toggle
  • select
  • multiselect
  • radio
  • checkboxes
  • lookup
  • master_detail
  • tree
  • user
  • image
  • file
  • avatar
  • video
  • audio
  • formula
  • summary
  • autonumber
  • composite
  • repeater
  • record
  • location
  • address
  • code
  • json
  • color
  • rating
  • slider
  • signature
  • qrcode
  • progress
  • tags
  • vector

Nested Shape: BulkActionParam.options[number]

PropertyTypeRequiredDescription
labelstring✅Option label (plain string — not i18n-resolved on this path).
valuestring | number | boolean✅Stored value.

BulkActionResult

The per-row outcome an execution: 'aggregate' bulk action handler MAY resolve with: { succeeded: [ids], failed: [{ id, message }] } as its whole resolve value, never attached to a rejection (a rejection stays one outcome for the selection). The console reads it on every aggregate dispatch. Not the data plane's batch answer: here succeeded and failed are row lists, not counts. A value with neither member keeps the one-outcome report; a value with either member that does not parse is reported as unreadable, never as full success; members beyond the two lists carry no meaning. Ids must be dispatched params._selectedIds: an id outside the selection is dropped, a duplicate counts once, an id in both lists counts as failed, an id in failed twice keeps its first message, and a selected id in neither list is reported as not confirmed, never as succeeded.

Properties

PropertyTypeRequiredDescription
succeededstring[]✅Ids of the selected rows the handler wrote. Each must be one of the dispatched params._selectedIds. The reader drops an id outside the selection, counts a duplicate once, and counts an id that is also in failed as failed.
failed({ id: string; message: string } & Record<string, any>)[]✅One entry per selected row the handler did not write, each with its own reason (message, not error). The reader drops an id outside params._selectedIds and counts a duplicate once; an id listed twice keeps its first message.

Nested Shape: BulkActionResult.failed[number]

PropertyTypeRequiredDescription
idstring✅Id of a selected row the handler did not write: one of the dispatched params._selectedIds.
messagestring✅Why this row was not written, as the person running the action should read it.

On this page