You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c8e51db
Browse filesBrowse the repository at this point in the historyBrowse files
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
@@ -55,6 +55,7 @@ const result = ActionSchema.parse(data);
55
55
|**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). |
56
56
|**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. |
57
57
|**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 |
58
59
|**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. |
59
60
|**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). |
60
61
|**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
161
162
|**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 |
162
163
|**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 |
163
164
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
+
164
172
### Nested Shape: `Action.params[number]`
165
173
166
174
| Property | Type | Required | Description |
@@ -387,6 +395,18 @@ L2 sandboxed JS body — runs inside an isolated VM with declared capabilities
387
395
|**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 |
388
396
389
397
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 |
0 commit comments