Skip to content

Commit c8e51db

Browse files
committed
docs(spec): regenerate references/ui/action.mdx on the merge with main
check:generated --fix after the merge commit (gen:docs, the one artifact it proved stale): main's ActionText rows from #35085 plus this branch's module description for ui/action.zod.ts. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
1 parent be7f97e commit c8e51db

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

‎content/docs/references/ui/action.mdx‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ declared inline on a page element instead of registered by name).
2828
## TypeScript Usage
2929

3030
```typescript
31-
import { ActionSchema, ActionAiSchema, ActionLocationSchema, ActionParamSchema, ActionRefusalSchema, ActionType, InlineActionSchema } from '@objectstack/spec/ui';
32-
import type { Action, ActionAi, ActionLocation, ActionParam, ActionRefusal, ActionType, InlineAction } from '@objectstack/spec/ui';
31+
import { ActionSchema, ActionAiSchema, ActionLocationSchema, ActionParamSchema, ActionRefusalSchema, ActionTextSchema, ActionType, InlineActionSchema } from '@objectstack/spec/ui';
32+
import type { Action, ActionAi, ActionLocation, ActionParam, ActionRefusal, ActionText, ActionType, InlineAction } from '@objectstack/spec/ui';
3333

3434
// Validate data
3535
const result = ActionSchema.parse(data);
@@ -55,6 +55,7 @@ const result = ActionSchema.parse(data);
5555
| **openIn** | `Enum<'self' \| 'new-tab'>` | optional | For type:'url' — where to open `target`. 'new-tab' opens a new browser tab; 'self' navigates in place. When omitted, external/absolute URLs open in a new tab and relative URLs navigate in place. Static execution option — keep it OUT of `params` (which is user-input-collection only). |
5656
| **body** | `{ language: 'expression'; source: string } \| { language: 'js'; source: string; capabilities?: Enum<'api.read' \| 'api.write' \| 'api.transaction' \| 'crypto.uuid' \| 'log' \| …>[]; timeoutMs?: integer; … }` | optional | Action body — expression (L1) or sandboxed JS (L2). Only used when type is `script`. An action body runs as system, and its update, transfer, delete, purge or restore of an object declared managedBy: 'append-only' is refused with PERMISSION_DENIED; an insert is not judged by this rule. |
5757
| **refusals** | `Record<string, { message: string; status?: integer; reasons?: Record<string, object>; params?: string[] }>` | optional | Refusal catalogue keyed by the SCREAMING_SNAKE code the action's js body throws: `{ message, status?, reasons?, params? }`. The body refuses by code only, optionally with a declared reason and params; the runtime answers with the declared message (translated through objects.`<object>`._actions.`<action>`.refusals.`<CODE>`.message, or globalActions.`<action>`.refusals.`<CODE>`.message for an object-less action, ….reasons.`<REASON>`.message for a reason, in the caller's locale, holes filled from params) and status. A code not declared here, or a reason a code with reasons does not declare, is refused loudly — at save when the body throws it literally, otherwise at run time. Only a type: 'script' action with a js body declares one |
58+
| **texts** | `Record<string, { message: string; params?: string[] }>` | optional | Texts the action's js body writes into records, keyed by the snake_case key it asks for with ctx.text(KEY, params): `{ message, params? }`. ctx.text answers the sentence in the organization's language (the Localization setting when somebody set it, else the app's i18n.defaultLocale), translated through objects.`<object>`._actions.`<action>`.texts.`<key>`.message (globalActions.`<action>`.texts.`<key>`.message for an object-less action) with the declared message as the fallback, its holes filled from params. A key not declared here is refused — at save when the body asks for it literally, otherwise at run time. Only a type: 'script' action with a js body declares one |
5859
| **operation** | `Enum<'update'>` | optional | The declarative single-record field write, mirroring a list view's `bulkActionDefs`: `'update'` applies `patch` (merged under the collected `params`) to the current record on the data plane AS THE CALLER — never system-elevated — so the caller's permissions, the object's hooks and its validations fire as for a user edit. `type` stays at its default `'script'` (the platform action route the write is performed on); `target`/`body`/`method`/`bodyExtra` are refused beside it. `'delete'` and `'custom'` have no row-level form. |
5960
| **patch** | `Record<string, any>` | optional | For `operation: 'update'` — static field values written to the current record, merged UNDER the user-supplied `params` so a fixed value can be declared without exposing it in the dialog. Written on the data plane as the caller: object permissions, hooks and validations fire as for a user edit. Refused on an action without `operation: 'update'` (it would be silently dropped). |
6061
| **execution** | `Enum<'perRecord' \| 'aggregate'>` | optional | The bulk dispatch contract this action's BODY is written for, in `bulkActionDefs`' own vocabulary: 'perRecord' = one dispatch per selected row carrying that row's `recordId` (the view's `bulkActions: ['<name>']` bare-string form); 'aggregate' = ONE dispatch for the whole selection carrying every id in `params._selectedIds` (a `bulkActionDefs` entry with `execution: 'aggregate'`). Optional with NO default — omit it only when the body genuinely serves both. A list view wiring a declared action under the other contract is refused by `@objectstack/lint` (`action-dispatch-contract-mismatch`). |
@@ -161,6 +162,13 @@ L2 sandboxed JS body — runs inside an isolated VM with declared capabilities
161162
| **reasons** | `Record<string, { message: string }>` | optional | Further sentences under this same code, keyed by the snake_case reason the action throws beside the code (`{ code, reason }`): `{ message }`. The wire code and status stay this entry's. A reason not declared here is refused loudly. Absent: the code has the one sentence, and a thrown reason is not read |
162163
| **params** | `string[]` | optional | The names this entry's sentences may fill: a `{{ NAME }}` or `{{ NAME \| formatter }}` hole renders the value the action throws in `params` (`{ code, params: { NAME: value } }`). A hole over any other name, logic, an unknown formatter, an empty hole and a currency formatter with no code are refused. Absent: the sentences are plain text and a `{{ }}` hole is refused |
163164

165+
### Nested Shape: `Action.texts[string]`
166+
167+
| Property | Type | Required | Description |
168+
| :--- | :--- | :--- | :--- |
169+
| **message** | `string` | ✅ | The sentence the action's body writes into a record — in the source locale, translated whole through objects.`<object>`._actions.`<action>`.texts.`<key>`.message (globalActions.`<action>`.texts.`<key>`.message for an object-less action) in the organization's language when the body asks for it (ctx.text). With no params every `{{ }}` hole is refused; with params a hole is a path over one of them with an optional known formatter |
170+
| **params** | `string[]` | optional | The names this text may fill: a `{{ NAME }}` or `{{ NAME \| formatter }}` hole renders the value the action's body passes in ctx.text(KEY, `{ NAME: value }`). A hole over any other name is refused at parse; a hole holding logic, an unknown formatter, an empty hole and a currency formatter with no code are refused where the text is compiled (os validate, compile, the publish gate). Absent: the sentence is plain text and a `{{ }}` hole is refused |
171+
164172
### Nested Shape: `Action.params[number]`
165173

166174
| Property | Type | Required | Description |
@@ -387,6 +395,18 @@ L2 sandboxed JS body — runs inside an isolated VM with declared capabilities
387395
| **message** | `string` | ✅ | The sentence the user reads when the action throws this reason under its code — in the source locale, translated through objects.`<object>`._actions.`<action>`.refusals.`<CODE>`.reasons.`<REASON>`.message (globalActions.`<action>`.… for an object-less action) in the caller's locale; its `{{ }}` holes follow the entry's message rule |
388396

389397

398+
---
399+
400+
## ActionText
401+
402+
### Properties
403+
404+
| Property | Type | Required | Description |
405+
| :--- | :--- | :--- | :--- |
406+
| **message** | `string` | ✅ | The sentence the action's body writes into a record — in the source locale, translated whole through objects.`<object>`._actions.`<action>`.texts.`<key>`.message (globalActions.`<action>`.texts.`<key>`.message for an object-less action) in the organization's language when the body asks for it (ctx.text). With no params every `{{ }}` hole is refused; with params a hole is a path over one of them with an optional known formatter |
407+
| **params** | `string[]` | optional | The names this text may fill: a `{{ NAME }}` or `{{ NAME \| formatter }}` hole renders the value the action's body passes in ctx.text(KEY, `{ NAME: value }`). A hole over any other name is refused at parse; a hole holding logic, an unknown formatter, an empty hole and a currency formatter with no code are refused where the text is compiled (os validate, compile, the publish gate). Absent: the sentence is plain text and a `{{ }}` hole is refused |
408+
409+
390410
---
391411

392412
## ActionType

0 commit comments

Comments
 (0)