Site component operations
5 operations named component.*. Every one runs in a batch through apply_ops, dry_run_ops, the CLI or the admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| component.list | List the site components: key, name and exposed props. | site.read | none |
| component.createFromNode | Make a site component from a page node and its subtree: the component gets a fresh copy, and the node is replaced by an instance of it. | site.edit | none |
| component.update | Rename a site component or replace its exposed props (each binds a field of an inner node). | site.edit | none |
| component.instantiate | Place an instance of a site component in a page. | site.edit | none |
| component.detach | Replace an instance with a plain copy of the subtree it renders, overrides applied and fresh ids; it no longer follows the component. | site.edit | none |
component.list
List the site components: key, name and exposed props. Open one with tree.read on its pageId; place one with component.instantiate.
Example input
{}Input
The input is a record; see the schema below.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Output
| Field | Type | Required | Notes |
|---|
Try it
yarn splash component.list '{}' --dry-runcomponent.createFromNode
Make a site component from a page node and its subtree: the component gets a fresh copy, and the node is replaced by an instance of it. Refuses bindings the copy cannot keep.
Example input
{
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
"nodeId": "claim001",
"key": "member-card",
"name": "Member card"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | At least 1 character. |
| nodeId | string | yes | |
| key | string | yes | At most 64 characters. |
| name | string | yes | At least 1 character. At most 80 characters. |
| propsSchema | array of object | no | At most 32 items. |
| propsSchema[].name | string | yes | |
| propsSchema[].label | string | record of string | no | |
| propsSchema[].default | any JSON | no | |
| propsSchema[].bind | object | yes |
{
"type": "object",
"properties": {
"pageId": {
"type": "string",
"minLength": 1
},
"nodeId": {
"$ref": "#/$defs/__schema0"
},
"key": {
"type": "string",
"maxLength": 64,
"pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"propsSchema": {
"maxItems": 32,
"type": "array",
"items": {
"$ref": "#/$defs/__schema1"
}
}
},
"required": [
"pageId",
"nodeId",
"key",
"name"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "string",
"pattern": "^[0-9a-z]{8}$"
},
"__schema1": {
"type": "object",
"properties": {
"name": {
"$ref": "#/$defs/__schema2"
},
"label": {
"anyOf": [
{
"$ref": "#/$defs/__schema3"
},
{
"type": "object",
"propertyNames": {
"$ref": "#/$defs/__schema4"
},
"additionalProperties": {
"$ref": "#/$defs/__schema3"
}
}
]
},
"default": {
"$ref": "#/$defs/__schema5"
},
"bind": {
"type": "object",
"properties": {
"nodeId": {
"$ref": "#/$defs/__schema0"
},
"prop": {
"anyOf": [
{
"$ref": "#/$defs/__schema2"
},
{
"type": "string",
"enum": [
"$theme",
"$variant"
]
}
]
}
},
"required": [
"nodeId",
"prop"
],
"additionalProperties": false
}
},
"required": [
"name",
"bind"
],
"additionalProperties": false
},
"__schema2": {
"type": "string",
"pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
},
"__schema3": {
"type": "string",
"minLength": 1,
"maxLength": 60
},
"__schema4": {
"type": "string",
"enum": [
"it",
"en-US"
]
},
"__schema5": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/__schema5"
}
},
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema5"
}
}
]
}
}
}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 | |
| component | object | yes | |
| component.pageId | string | yes | At least 1 character. |
| component.key | string | yes | At most 64 characters. |
| component.name | string | yes | At least 1 character. At most 80 characters. |
| component.propsSchema | array of object | yes | At most 32 items. |
| component.unreadableLabels | array of object | no |
Fields nested deeper are in the output schema that discover_operations answers with outputSchemas: true.
Try it
yarn splash component.createFromNode '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","nodeId":"claim001","key":"member-card","name":"Member card"}' --dry-runcomponent.update
Rename a site component or replace its exposed props (each binds a field of an inner node). Edit its tree with tree.commit on its pageId; every instance follows.
Example input
{
"key": "member-card",
"propsSchema": [
{
"name": "name",
"default": "Name Surname",
"bind": {
"nodeId": "name0001",
"prop": "text"
}
},
{
"name": "portrait",
"bind": {
"nodeId": "photo001",
"prop": "src"
}
}
]
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| key | string | yes | At most 64 characters. |
| name | string | no | At least 1 character. At most 80 characters. |
| propsSchema | array of object | no | At most 32 items. |
| propsSchema[].name | string | yes | |
| propsSchema[].label | string | record of string | no | |
| propsSchema[].default | any JSON | no | |
| propsSchema[].bind | object | yes |
{
"type": "object",
"properties": {
"key": {
"$ref": "#/$defs/__schema0"
},
"name": {
"$ref": "#/$defs/__schema1"
},
"propsSchema": {
"$ref": "#/$defs/__schema2"
}
},
"required": [
"key"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "string",
"maxLength": 64,
"pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
},
"__schema1": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"__schema2": {
"maxItems": 32,
"type": "array",
"items": {
"$ref": "#/$defs/__schema3"
}
},
"__schema3": {
"type": "object",
"properties": {
"name": {
"$ref": "#/$defs/__schema4"
},
"label": {
"anyOf": [
{
"$ref": "#/$defs/__schema5"
},
{
"type": "object",
"propertyNames": {
"$ref": "#/$defs/__schema6"
},
"additionalProperties": {
"$ref": "#/$defs/__schema5"
}
}
]
},
"default": {
"$ref": "#/$defs/__schema7"
},
"bind": {
"type": "object",
"properties": {
"nodeId": {
"type": "string",
"pattern": "^[0-9a-z]{8}$"
},
"prop": {
"anyOf": [
{
"$ref": "#/$defs/__schema4"
},
{
"type": "string",
"enum": [
"$theme",
"$variant"
]
}
]
}
},
"required": [
"nodeId",
"prop"
],
"additionalProperties": false
}
},
"required": [
"name",
"bind"
],
"additionalProperties": false
},
"__schema4": {
"type": "string",
"pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
},
"__schema5": {
"type": "string",
"minLength": 1,
"maxLength": 60
},
"__schema6": {
"type": "string",
"enum": [
"it",
"en-US"
]
},
"__schema7": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/__schema7"
}
},
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema7"
}
}
]
}
}
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | At least 1 character. |
| key | string | yes | At most 64 characters. |
| name | string | yes | At least 1 character. At most 80 characters. |
| propsSchema | array of object | yes | At most 32 items. |
| propsSchema[].name | string | yes | |
| propsSchema[].label | string | record of string | no | |
| propsSchema[].default | any JSON | no | |
| propsSchema[].bind | object | yes | |
| unreadableLabels | array of object | no | |
| unreadableLabels[].name | string | yes | |
| unreadableLabels[].stored | string | yes | At most 200 characters. |
Fields nested deeper are in the output schema that discover_operations answers with outputSchemas: true.
Try it
yarn splash component.update '{"key":"member-card","propsSchema":[{"name":"name","default":"Name Surname","bind":{"nodeId":"name0001","prop":"text"}},{"name":"portrait","bind":{"nodeId":"photo001","prop":"src"}}]}' --dry-runcomponent.instantiate
Place an instance of a site component in a page. Set its exposed props with set_props and override inner nodes with set_override through tree.commit.
Example input
{
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
"parentId": "root0000",
"index": 0,
"key": "member-card"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | At least 1 character. |
| parentId | string | yes | |
| index | integer | yes | At least 0. |
| key | string | yes | At most 64 characters. |
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 |
Try it
yarn splash component.instantiate '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","parentId":"root0000","index":0,"key":"member-card"}' --dry-runcomponent.detach
Replace an instance with a plain copy of the subtree it renders, overrides applied and fresh ids; it no longer follows the component. The component's motion does not follow the copy.
Example input
{
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
"nodeId": "claim001"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| pageId | string | yes | At least 1 character. |
| nodeId | string | yes |
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 |
Try it
yarn splash component.detach '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","nodeId":"claim001"}' --dry-runGenerated from the operation registry and the MCP tool catalogue (source e4ac41b55c6d9a7e).
Something wrong on this page? Write to docs@librettocms.com.