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
docs(skills): objectstack-data factual sweep (3/3) — hooks reference, datasources, and the remaining rule files (#13698)
Four measured-false behavioral claims corrected against the implementation:
- data-hooks.md: ctx.log is documented as { info, warn, error } in two places.
It has FOUR levels — quickjs-runner.ts wires ['debug','info','warn','error']
and its own comment reads '[#7661] FOUR levels, not three'.
- data-hooks.md: the sandbox ctx.api.object(n) method table omits three real
methods — aggregate (api.read), updateMany and deleteMany (api.write).
- datasources.md: 'field.columnName on managed objects is unaffected' — the key
was removed in the 16.x line and is a parse error on ANY object.
- datasources.md: 'external settings are ... forbidden otherwise' — a managed
datasource carrying an external block parses fine. The required half holds.
The other six files in this PR's scope (validation.md, hooks.md, lifecycle.md,
naming.md, evals/README.md, references/_index.md) were inventoried and verified
with no falsehood found, so they carry no edit.
Token ratchet: both edited files shrink (-27 / -8).
Fixes#13675
Claude-Session: https://claude.ai/code/session_01EXxTW8mvPBhoHxmyPZ63de
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: skills/objectstack-data/references/data-hooks.md
+8-10Lines changed: 8 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -369,7 +369,7 @@ The sandbox is handed a **JSON snapshot** of these (built by
369
369
|`ctx.event`| string | e.g. `'afterUpdate'` — dispatch on it when one hook subscribes to several events. |
370
370
|`ctx.object`| string | The target object name. |
371
371
|`ctx.api`| object | Cross-object CRUD. Gated by `api.read` / `api.write` — see below. |
372
-
|`ctx.log`|`{ info, warn, error }`| Gated by `log`. Call **`ctx.log.info(msg, data?)`** — `ctx.log` is an **object, not** callable as `ctx.log(msg)`. Emission is **best-effort** (see Troubleshooting). |
372
+
|`ctx.log`|`{ debug, info, warn, error }`| Gated by `log`. Call **`ctx.log.info(msg, data?)`** — `ctx.log` is an **object, not** callable as `ctx.log(msg)`. Emission is **best-effort** (see Troubleshooting). |
373
373
|`ctx.crypto`|`{ randomUUID }`| Gated by `crypto.uuid`. |
374
374
|`ctx.title`|`(field?) => Promise<string \| null>`|**Name the record instead of printing its id.**`await ctx.title()` resolves this object's `nameField` — including when it is a **formula**, evaluated server-side, with no extra read. `await ctx.title('account_id')` resolves the related record's title through a lookup column (one `findOne`, gated by `api.read`; the no-argument form needs no capability). `null` when there is no title — it never falls back to the id. |
375
375
@@ -395,6 +395,7 @@ org / user / transaction. Methods:
395
395
|`update(data, opts?)`|`api.write`|**`update({ id, ...fields })`** — put the id **inside**`data`|
|`delete(opts)`|`api.write`|`delete({ where: { id } })`|
398
+
|`aggregate` · `updateMany` · `deleteMany`| read · write · write | also installed; same `where` shape |
398
399
399
400
**Query shape — the key is `where`.** It takes an object with `$`-operators, the
400
401
same DSL as the [objectstack-query](../../objectstack-query/SKILL.md) skill:
@@ -443,11 +444,11 @@ set of legal tokens (`HookBodyCapability`) is exactly five:
443
444
444
445
| Token | Unlocks |
445
446
|:--|:--|
446
-
|`api.read`|`ctx.api.object(n).find` / `findOne` / `count`; also `ctx.title('<lookup field>')`, which reads that related record. Plain `ctx.title()` reads nothing and needs no token. |
|`api.read`|`ctx.api.object(n).find` / `findOne` / `count` / `aggregate`; also `ctx.title('<lookup field>')`, which reads that related record. Plain `ctx.title()` reads nothing and needs no token. |
|`api.transaction`|`ctx.api.transaction(async () => { … })` — runs the callback's `ctx.api` ops in **one driver transaction** (commit on return, rollback on throw). Pair it with `api.write`. |
0 commit comments