Page tree operations
3 operations named tree.*. Every one runs in a batch through apply_ops, dry_run_ops, the CLI or the admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| tree.read | Read a draft page tree and its revision. | site.read | none |
| tree.commit | Apply an invertible batch of splash.ops/2 ops to a page tree. | content.edit | none |
| tree.node | Read one node of a page's draft tree with its props, styles, meta, variant and theme, and its children down to depth levels (1 by default, 0 for the node alone), without reading the whole tree. | site.read | none |
tree.read
Read a draft page tree and its revision.
Example input
{
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | At least 1 character. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| format | "splash.tree" | yes | |
| v | 3 | yes | |
| revision | integer | yes | At least 0. |
| root | object | object | object | object | object | object | object | yes |
Try it
yarn splash tree.read '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f"}' --dry-runtree.commit
Apply an invertible batch of splash.ops/2 ops to a page tree. Each op names its node by id (insert names parentId and index): insert { parentId, index, node }, remove { id }, move { id, parentId, index }, set_props { id, patch } (a patch of props; null removes one), set_style { id, scope, patch }, set_meta { id, anchor?, name?, meta?, visibleTo?, locked? }, set_attrs { id, patch }, set_variant { id, variant }, set_theme { id, theme }, set_mixins { id, mixins }, set_visibility { id, visibility }, set_type { id, type }, set_override { id, target, patch }; only insert carries a whole node with its props. A node's section anchor is the node field anchor, not a prop or meta key. In a set_style patch and in the styles.sheet of an inserted node, each declaration value may be a raw CSS string ("clamp(22px, 2.3vw, 34px)", "{color.text}" for a token) or { kind: "raw", css }; the server tokenizes it with the inspector's parser and refuses a value the style catalogue does not allow, at its path. The class is content.edit, but only a content-prop edit (a set_props of a content field) needs no more: every other op of the batch needs site.edit.
Example input
{
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
"ops": [
{
"op": "insert",
"parentId": "root0000",
"index": 0,
"node": {
"id": "hero0001",
"kind": "section",
"type": "section",
"anchor": "hero",
"name": "Opening section",
"styles": {
"sheet": {
"base": {
"position": "sticky",
"top": "0",
"min-height": "100svh",
"max-width": "none",
"padding-inline": "0"
}
}
},
"children": [
{
"id": "claim001",
"kind": "primitive",
"type": "text",
"props": {
"text": {
"en-US": "Architecture for the places we live in"
}
},
"styles": {
"sheet": {
"base": {
"font-size": "clamp(22px, 2.3vw, 34px)",
"color": {
"kind": "raw",
"css": "{color.text.accent}"
}
}
}
}
}
]
}
},
{
"op": "set_props",
"id": "claim001",
"patch": {
"text": {
"en-US": "Architecture for the places we live and work in"
}
}
},
{
"op": "set_style",
"id": "claim001",
"scope": "bp:md",
"patch": {
"margin-inline-start": "50%"
}
},
{
"op": "set_meta",
"id": "hero0001",
"anchor": "opening",
"name": "Opening"
},
{
"op": "set_attrs",
"id": "claim001",
"patch": {
"data-tone": "quiet"
}
},
{
"op": "set_variant",
"id": "button01",
"variant": [
"ghost"
]
},
{
"op": "move",
"id": "intro001",
"parentId": "hero0001",
"index": 1
},
{
"op": "remove",
"id": "old00001"
}
]
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | At least 1 character. |
| ops | array of object | object | object | object | object | object | object | object | object | object | object | object | object | yes | At least 1 item. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| revision | integer | yes | At least 0. |
| inverse | array of object | object | object | object | object | object | object | object | object | object | object | object | object | yes |
Try it
yarn splash tree.commit '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","ops":[{"op":"insert","parentId":"root0000","index":0,"node":{"id":"hero0001","kind":"section","type":"section","anchor":"hero","name":"Opening section","styles":{"sheet":{"base":{"position":"sticky","top":"0","min-height":"100svh","max-width":"none","padding-inline":"0"}}},"children":[{"id":"claim001","kind":"primitive","type":"text","props":{"text":{"en-US":"Architecture for the places we live in"}},"styles":{"sheet":{"base":{"font-size":"clamp(22px, 2.3vw, 34px)","color":{"kind":"raw","css":"{color.text.accent}"}}}}}]}},{"op":"set_props","id":"claim001","patch":{"text":{"en-US":"Architecture for the places we live and work in"}}},{"op":"set_style","id":"claim001","scope":"bp:md","patch":{"margin-inline-start":"50%"}},{"op":"set_meta","id":"hero0001","anchor":"opening","name":"Opening"},{"op":"set_attrs","id":"claim001","patch":{"data-tone":"quiet"}},{"op":"set_variant","id":"button01","variant":["ghost"]},{"op":"move","id":"intro001","parentId":"hero0001","index":1},{"op":"remove","id":"old00001"}]}' --dry-runtree.node
Read one node of a page's draft tree with its props, styles, meta, variant and theme, and its children down to depth levels (1 by default, 0 for the node alone), without reading the whole tree. path names its ancestors from the root; cut lists the child ids left out at the depth limit. Find node ids in the page's outline resource; the answer's revision is the tree:<pageId> base revision of the batch that changes it.
Example input
{
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
"nodeId": "claim001",
"depth": 1
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | At least 1 character. |
| nodeId | string | yes | |
| depth | integer | no | At least 0. At most 4. Default 1. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | |
| revision | integer | yes | At least 0. |
| path | array of object | yes | |
| path[].id | string | yes | |
| path[].kind | string | yes | One of "root", "section", "repeater", "outlet", "primitive", "component", "instance". |
| path[].type | string | yes | |
| node | object | object | object | object | object | object | object | yes | |
| cut | record of array of string | yes |
Try it
yarn splash tree.node '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","nodeId":"claim001","depth":1}' --dry-runGenerated from the operation registry and the MCP tool catalogue (source bc1790f5703d2c89).
Something wrong on this page? Write to docs@librettocms.com.