Operazioni sui preset
7 operazioni di nome preset.*. Ognuna si esegue in un batch con apply_ops, dry_run_ops, la CLI o l’admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| preset.list | List the presets the site can insert, theme presets first, then the site library; each with its tree. | site.read | none |
| preset.insert | Insert a fresh copy of a theme or site preset (section, group or element) into a page or a region. | site.edit | none |
| preset.save | Save a page node and its subtree into the site preset library, with fresh ids; refuses bindings the copy cannot keep. | site.edit | none |
| preset.rename | Rename a preset of the site library. | site.edit | none |
| preset.delete | Delete a preset from the site library; pages that inserted it keep their copies. | site.edit | destructive |
| preset.index | List the presets the site can insert, theme presets first, then the site library, without their trees: each with its source, id, kind, label, keywords, category and description. | site.read | none |
| preset.read | Read one preset with its tree, named as preset.insert names it (kind, presetId, and source, the theme's presets when absent). | site.read | none |
preset.list
List the presets the site can insert, theme presets first, then the site library; each with its tree.
Esempio di input
{
"kind": "section"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| kind | string | no | One of "section", "box", "element". |
| source | string | no | One of "theme", "site". |
Output
| Field | Type | Required | Notes |
|---|
Provala
yarn splash preset.list '{"kind":"section"}' --dry-runpreset.insert
Insert a fresh copy of a theme or site preset (section, group or element) into a page or a region. A section preset goes under a tree's root: in a region (header or footer), parentId is the region root, the root id region.read answers, never a section inside the region, which is refused as I5.section_placement. An element or box preset asked for under the root is wrapped in a new section (the answer's nodeId is the section); elsewhere it goes where asked. The batch is atomic, so one refused insert fails the whole batch.
Esempio di input
{
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
"parentId": "root0000",
"index": 0,
"kind": "section",
"presetId": "hero-split",
"source": "theme"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | At least 1 character. |
| parentId | string | yes | |
| index | integer | yes | At least 0. |
| kind | string | yes | One of "section", "box", "element". |
| presetId | string | yes | At least 1 character. |
| source | string | no | One of "theme", "site". |
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 | |
| nodeId | string | yes |
Provala
yarn splash preset.insert '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","parentId":"root0000","index":0,"kind":"section","presetId":"hero-split","source":"theme"}' --dry-runpreset.save
Save a page node and its subtree into the site preset library, with fresh ids; refuses bindings the copy cannot keep.
Esempio di input
{
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
"nodeId": "claim001",
"label": "Claim band",
"kind": "element",
"category": "bands"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | At least 1 character. |
| nodeId | string | yes | |
| label | string | yes | At least 1 character. At most 80 characters. |
| id | string | no | |
| kind | string | no | One of "section", "box", "element". |
| category | string | no | |
| description | string | no | At most 280 characters. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| source | string | yes | One of "theme", "site". |
| id | string | yes | |
| kind | string | yes | One of "section", "box", "element". |
| label | string | yes | At least 1 character. At most 80 characters. |
| keywords | array of string | no | At least 1 item. At most 16 items. |
| category | string | yes | |
| description | string | no | At most 280 characters. |
| thumbnail | string | no | |
| scenes | array of object | no | At most 20 items. |
| scenes[].trigger | object | object | object | object | object | object | yes | |
| scenes[].entries | array of object | yes | At most 100 items. |
| scenes[].conditions | object | no | |
| scenes[].actions | array of object | object | no | At most 20 items. |
| scenes[].seed | integer | no | At least 0. At most 4294967295. |
| scenes[].pushBy | object | no | |
| scenes[].recipe | object | no | |
| scenes[].disabled | boolean | no | |
| scenes[].defaults | object | no | |
| tree | object | object | object | object | object | object | object | yes |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash preset.save '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","nodeId":"claim001","label":"Claim band","kind":"element","category":"bands"}' --dry-runpreset.rename
Rename a preset of the site library.
Esempio di input
{
"presetId": "claim-band",
"label": "Claim band, dark"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| presetId | string | yes | |
| label | string | yes | At least 1 character. At most 80 characters. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| source | string | yes | One of "theme", "site". |
| id | string | yes | |
| kind | string | yes | One of "section", "box", "element". |
| label | string | yes | At least 1 character. At most 80 characters. |
| keywords | array of string | no | At least 1 item. At most 16 items. |
| category | string | yes | |
| description | string | no | At most 280 characters. |
| thumbnail | string | no | |
| scenes | array of object | no | At most 20 items. |
| scenes[].trigger | object | object | object | object | object | object | yes | |
| scenes[].entries | array of object | yes | At most 100 items. |
| scenes[].conditions | object | no | |
| scenes[].actions | array of object | object | no | At most 20 items. |
| scenes[].seed | integer | no | At least 0. At most 4294967295. |
| scenes[].pushBy | object | no | |
| scenes[].recipe | object | no | |
| scenes[].disabled | boolean | no | |
| scenes[].defaults | object | no | |
| tree | object | object | object | object | object | object | object | yes |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash preset.rename '{"presetId":"claim-band","label":"Claim band, dark"}' --dry-runpreset.delete
Delete a preset from the site library; pages that inserted it keep their copies.
Esempio di input
{
"presetId": "claim-band"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| presetId | string | yes |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| success | true | yes |
Vuole confirmed: ["destructive"] sul batch, che la forma della CLI per una sola operazione non imposta: mettila in un file di batch ed esegui yarn splash apply <file> --dry-run.
preset.index
List the presets the site can insert, theme presets first, then the site library, without their trees: each with its source, id, kind, label, keywords, category and description. Read one preset's tree with preset.read; insert one with preset.insert.
Esempio di input
{
"kind": "section"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| kind | string | no | One of "section", "box", "element". |
| source | string | no | One of "theme", "site". |
Output
| Field | Type | Required | Notes |
|---|
Provala
yarn splash preset.index '{"kind":"section"}' --dry-runpreset.read
Read one preset with its tree, named as preset.insert names it (kind, presetId, and source, the theme's presets when absent). Refused with 404 preset_not_found when the site has no such preset.
Esempio di input
{
"kind": "section",
"presetId": "hero-split",
"source": "theme"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| kind | string | yes | One of "section", "box", "element". |
| presetId | string | yes | At least 1 character. |
| source | string | no | One of "theme", "site". |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| source | string | yes | One of "theme", "site". |
| id | string | yes | |
| kind | string | yes | One of "section", "box", "element". |
| label | string | yes | At least 1 character. At most 80 characters. |
| keywords | array of string | no | At least 1 item. At most 16 items. |
| category | string | yes | |
| description | string | no | At most 280 characters. |
| thumbnail | string | no | |
| scenes | array of object | no | At most 20 items. |
| scenes[].trigger | object | object | object | object | object | object | yes | |
| scenes[].entries | array of object | yes | At most 100 items. |
| scenes[].conditions | object | no | |
| scenes[].actions | array of object | object | no | At most 20 items. |
| scenes[].seed | integer | no | At least 0. At most 4294967295. |
| scenes[].pushBy | object | no | |
| scenes[].recipe | object | no | |
| scenes[].disabled | boolean | no | |
| scenes[].defaults | object | no | |
| tree | object | object | object | object | object | object | object | yes |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash preset.read '{"kind":"section","presetId":"hero-split","source":"theme"}' --dry-runGenerato dal registro delle operazioni e dal catalogo degli strumenti MCP (sorgente 7f6b25496ba8c140).
Qualcosa non va in questa pagina? Scrivi a docs@librettocms.com.