Operazioni sui moduli
6 operazioni di nome form.*. Ognuna si esegue in un batch con apply_ops, dry_run_ops, la CLI o l’admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| form.list | List the forms of the site with their fields and settings. | site.read | none |
| form.read | Read a form: its key, label, fields and settings. | site.read | none |
| form.create | Create a form with its fields and settings. | site.edit | none |
| form.update | Patch the label, fields or settings of a form. | site.edit | none |
| form.delete | Delete a form and every submission it received. | site.edit | destructive |
| form.sendTest | Render the notification a submission of the form sends, with sample values for its fields. | site.edit | none |
form.list
List the forms of the site with their fields and settings. Forms are not versioned: a saved definition takes effect at once.
Esempio di input
{}Input
L’input è un record: vedi lo schema qui sotto.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| forms | array of object | yes | |
| forms[].id | string (uuid) | yes | |
| forms[].key | string | yes | At most 40 characters. |
| forms[].label | string | record of string | yes | |
| forms[].fields | array of object | yes | |
| forms[].settings | object | yes | |
| forms[].createdAt | string (date-time) | yes | |
| forms[].updatedAt | string (date-time) | yes |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash form.list '{}' --dry-runform.read
Read a form: its key, label, fields and settings. Forms are not versioned: a saved definition takes effect at once.
Esempio di input
{
"formId": "d4e5f6a7-b8c9-4d0e-9f1a-3b4c5d6e7f8a"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| formId | string (uuid) | yes |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| form | object | yes | |
| form.id | string (uuid) | yes | |
| form.key | string | yes | At most 40 characters. |
| form.label | string | record of string | yes | |
| form.fields | array of object | yes | |
| form.settings | object | yes | |
| form.createdAt | string (date-time) | yes | |
| form.updatedAt | string (date-time) | yes |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash form.read '{"formId":"d4e5f6a7-b8c9-4d0e-9f1a-3b4c5d6e7f8a"}' --dry-runform.create
Create a form with its fields and settings. The key is unique on the site and never changes; a ds.form node names the form by its id. Forms are not versioned: a saved definition takes effect at once.
Esempio di input
{
"form": {
"key": "contact",
"label": {
"it": "Contatti",
"en": "Contact"
},
"fields": [
{
"key": "name",
"type": "text",
"label": {
"it": "Nome",
"en": "Name"
},
"required": true,
"maxLength": 120
},
{
"key": "email",
"type": "email",
"label": "Email",
"required": true
},
{
"key": "topic",
"type": "select",
"label": {
"it": "Argomento",
"en": "Topic"
},
"options": [
{
"value": "visit",
"label": {
"it": "Visita",
"en": "Visit"
}
},
{
"value": "press",
"label": {
"it": "Stampa",
"en": "Press"
}
}
]
},
{
"key": "message",
"type": "textarea",
"label": {
"it": "Messaggio",
"en": "Message"
},
"required": true,
"maxLength": 2000
}
],
"settings": {
"recipients": [
"info@example.com"
],
"senderName": "Sito web",
"replyToField": "email",
"consent": true
}
}
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| form | object | yes | |
| form.key | string | yes | At most 40 characters. |
| form.label | string | record of string | yes | |
| form.fields | array of object | yes | At least 1 item. At most 40 items. |
| form.settings | object | no | Default {}. |
{
"type": "object",
"properties": {
"form": {
"type": "object",
"properties": {
"key": {
"$ref": "#/$defs/__schema0"
},
"label": {
"$ref": "#/$defs/__schema1"
},
"fields": {
"$ref": "#/$defs/__schema4"
},
"settings": {
"$ref": "#/$defs/__schema17"
}
},
"required": [
"key",
"label",
"fields"
],
"additionalProperties": false
}
},
"required": [
"form"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "string",
"maxLength": 40,
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
},
"__schema1": {
"anyOf": [
{
"$ref": "#/$defs/__schema2"
},
{
"type": "object",
"propertyNames": {
"$ref": "#/$defs/__schema3"
},
"additionalProperties": {
"$ref": "#/$defs/__schema2"
}
}
]
},
"__schema2": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"__schema3": {
"type": "string",
"pattern": "^[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}|\\d{3}))?$"
},
"__schema4": {
"minItems": 1,
"maxItems": 40,
"type": "array",
"items": {
"$ref": "#/$defs/__schema5"
}
},
"__schema5": {
"type": "object",
"properties": {
"key": {
"$ref": "#/$defs/__schema6"
},
"type": {
"$ref": "#/$defs/__schema7"
},
"label": {
"$ref": "#/$defs/__schema1"
},
"help": {
"$ref": "#/$defs/__schema8"
},
"placeholder": {
"$ref": "#/$defs/__schema10"
},
"required": {
"$ref": "#/$defs/__schema11"
},
"maxLength": {
"$ref": "#/$defs/__schema12"
},
"showCount": {
"$ref": "#/$defs/__schema13"
},
"pattern": {
"$ref": "#/$defs/__schema14"
},
"options": {
"$ref": "#/$defs/__schema15"
}
},
"required": [
"key",
"type",
"label"
],
"additionalProperties": false
},
"__schema6": {
"type": "string",
"pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
},
"__schema7": {
"type": "string",
"enum": [
"text",
"email",
"tel",
"textarea",
"select",
"checkbox",
"date"
]
},
"__schema8": {
"anyOf": [
{
"$ref": "#/$defs/__schema9"
},
{
"type": "object",
"propertyNames": {
"$ref": "#/$defs/__schema3"
},
"additionalProperties": {
"$ref": "#/$defs/__schema9"
}
}
]
},
"__schema9": {
"type": "string",
"minLength": 1,
"maxLength": 240
},
"__schema10": {
"$ref": "#/$defs/__schema1"
},
"__schema11": {
"default": false,
"type": "boolean"
},
"__schema12": {
"type": "integer",
"minimum": 1,
"maximum": 5000
},
"__schema13": {
"type": "boolean"
},
"__schema14": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"__schema15": {
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"$ref": "#/$defs/__schema16"
}
},
"__schema16": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 40,
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
},
"label": {
"$ref": "#/$defs/__schema1"
}
},
"required": [
"value",
"label"
],
"additionalProperties": false
},
"__schema17": {
"default": {},
"type": "object",
"properties": {
"recipients": {
"default": [],
"maxItems": 10,
"type": "array",
"items": {
"$ref": "#/$defs/__schema18"
}
},
"senderName": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"replyToField": {
"$ref": "#/$defs/__schema6"
},
"consent": {
"default": false,
"type": "boolean"
},
"honeypot": {
"default": true,
"type": "boolean"
},
"minFillMs": {
"default": 2000,
"type": "integer",
"minimum": 0,
"maximum": 60000
},
"open": {
"default": true,
"type": "boolean"
},
"action": {
"default": {
"kind": "inbox"
},
"oneOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "inbox"
}
},
"required": [
"kind"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "accessRequest"
},
"fields": {
"type": "object",
"properties": {
"name": {
"$ref": "#/$defs/__schema6"
},
"email": {
"$ref": "#/$defs/__schema6"
},
"studio": {
"$ref": "#/$defs/__schema6"
},
"website": {
"$ref": "#/$defs/__schema6"
},
"message": {
"$ref": "#/$defs/__schema6"
}
},
"required": [
"name",
"email"
],
"additionalProperties": false
}
},
"required": [
"kind",
"fields"
],
"additionalProperties": false
}
]
}
},
"additionalProperties": false
},
"__schema18": {
"type": "string",
"format": "email",
"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
}
}
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| form | object | yes | |
| form.id | string (uuid) | yes | |
| form.key | string | yes | At most 40 characters. |
| form.label | string | record of string | yes | |
| form.fields | array of object | yes | |
| form.settings | object | yes | |
| form.createdAt | string (date-time) | yes | |
| form.updatedAt | string (date-time) | yes |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash form.create '{"form":{"key":"contact","label":{"it":"Contatti","en":"Contact"},"fields":[{"key":"name","type":"text","label":{"it":"Nome","en":"Name"},"required":true,"maxLength":120},{"key":"email","type":"email","label":"Email","required":true},{"key":"topic","type":"select","label":{"it":"Argomento","en":"Topic"},"options":[{"value":"visit","label":{"it":"Visita","en":"Visit"}},{"value":"press","label":{"it":"Stampa","en":"Press"}}]},{"key":"message","type":"textarea","label":{"it":"Messaggio","en":"Message"},"required":true,"maxLength":2000}],"settings":{"recipients":["info@example.com"],"senderName":"Sito web","replyToField":"email","consent":true}}}' --dry-runform.update
Patch the label, fields or settings of a form. The change is live at once: the public form follows without a publish, and stored submissions keep the values they were sent with. Forms are not versioned: a saved definition takes effect at once.
Esempio di input
{
"formId": "d4e5f6a7-b8c9-4d0e-9f1a-3b4c5d6e7f8a",
"patch": {
"settings": {
"recipients": [
"info@example.com",
"press@example.com"
],
"senderName": "Sito web",
"replyToField": "email",
"consent": true
}
}
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| formId | string (uuid) | yes | |
| patch | object | yes | |
| patch.label | string | record of string | no | |
| patch.fields | array of object | no | At least 1 item. At most 40 items. |
| patch.settings | object | no |
{
"type": "object",
"properties": {
"formId": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"patch": {
"type": "object",
"properties": {
"label": {
"$ref": "#/$defs/__schema0"
},
"fields": {
"minItems": 1,
"maxItems": 40,
"type": "array",
"items": {
"$ref": "#/$defs/__schema3"
}
},
"settings": {
"type": "object",
"properties": {
"recipients": {
"default": [],
"maxItems": 10,
"type": "array",
"items": {
"$ref": "#/$defs/__schema15"
}
},
"senderName": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"replyToField": {
"$ref": "#/$defs/__schema4"
},
"consent": {
"default": false,
"type": "boolean"
},
"honeypot": {
"default": true,
"type": "boolean"
},
"minFillMs": {
"default": 2000,
"type": "integer",
"minimum": 0,
"maximum": 60000
},
"open": {
"default": true,
"type": "boolean"
},
"action": {
"oneOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "inbox"
}
},
"required": [
"kind"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "accessRequest"
},
"fields": {
"type": "object",
"properties": {
"name": {
"$ref": "#/$defs/__schema4"
},
"email": {
"$ref": "#/$defs/__schema4"
},
"studio": {
"$ref": "#/$defs/__schema4"
},
"website": {
"$ref": "#/$defs/__schema4"
},
"message": {
"$ref": "#/$defs/__schema4"
}
},
"required": [
"name",
"email"
],
"additionalProperties": false
}
},
"required": [
"kind",
"fields"
],
"additionalProperties": false
}
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"required": [
"formId",
"patch"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"anyOf": [
{
"$ref": "#/$defs/__schema1"
},
{
"type": "object",
"propertyNames": {
"$ref": "#/$defs/__schema2"
},
"additionalProperties": {
"$ref": "#/$defs/__schema1"
}
}
]
},
"__schema1": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"__schema2": {
"type": "string",
"pattern": "^[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}|\\d{3}))?$"
},
"__schema3": {
"type": "object",
"properties": {
"key": {
"$ref": "#/$defs/__schema4"
},
"type": {
"$ref": "#/$defs/__schema5"
},
"label": {
"$ref": "#/$defs/__schema0"
},
"help": {
"$ref": "#/$defs/__schema6"
},
"placeholder": {
"$ref": "#/$defs/__schema8"
},
"required": {
"$ref": "#/$defs/__schema9"
},
"maxLength": {
"$ref": "#/$defs/__schema10"
},
"showCount": {
"$ref": "#/$defs/__schema11"
},
"pattern": {
"$ref": "#/$defs/__schema12"
},
"options": {
"$ref": "#/$defs/__schema13"
}
},
"required": [
"key",
"type",
"label"
],
"additionalProperties": false
},
"__schema4": {
"type": "string",
"pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
},
"__schema5": {
"type": "string",
"enum": [
"text",
"email",
"tel",
"textarea",
"select",
"checkbox",
"date"
]
},
"__schema6": {
"anyOf": [
{
"$ref": "#/$defs/__schema7"
},
{
"type": "object",
"propertyNames": {
"$ref": "#/$defs/__schema2"
},
"additionalProperties": {
"$ref": "#/$defs/__schema7"
}
}
]
},
"__schema7": {
"type": "string",
"minLength": 1,
"maxLength": 240
},
"__schema8": {
"$ref": "#/$defs/__schema0"
},
"__schema9": {
"default": false,
"type": "boolean"
},
"__schema10": {
"type": "integer",
"minimum": 1,
"maximum": 5000
},
"__schema11": {
"type": "boolean"
},
"__schema12": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"__schema13": {
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"$ref": "#/$defs/__schema14"
}
},
"__schema14": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 40,
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
},
"label": {
"$ref": "#/$defs/__schema0"
}
},
"required": [
"value",
"label"
],
"additionalProperties": false
},
"__schema15": {
"type": "string",
"format": "email",
"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
}
}
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| form | object | yes | |
| form.id | string (uuid) | yes | |
| form.key | string | yes | At most 40 characters. |
| form.label | string | record of string | yes | |
| form.fields | array of object | yes | |
| form.settings | object | yes | |
| form.createdAt | string (date-time) | yes | |
| form.updatedAt | string (date-time) | yes |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash form.update '{"formId":"d4e5f6a7-b8c9-4d0e-9f1a-3b4c5d6e7f8a","patch":{"settings":{"recipients":["info@example.com","press@example.com"],"senderName":"Sito web","replyToField":"email","consent":true}}}' --dry-runform.delete
Delete a form and every submission it received. A ds.form node that names it then draws its error state. Forms are not versioned: a saved definition takes effect at once.
Esempio di input
{
"formId": "d4e5f6a7-b8c9-4d0e-9f1a-3b4c5d6e7f8a"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| formId | string (uuid) | 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.
form.sendTest
Render the notification a submission of the form sends, with sample values for its fields. With dryRun (the default) the message is answered unsent; without it, it is sent to the form's recipients through the platform mail transport. Run it alone in a batch.
Esempio di input
{
"formId": "d4e5f6a7-b8c9-4d0e-9f1a-3b4c5d6e7f8a",
"dryRun": true
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| formId | string (uuid) | yes | |
| dryRun | boolean | no | Default true. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| formId | string (uuid) | yes | |
| dryRun | boolean | yes | |
| message | object | yes | |
| message.to | array of string (email) | yes | At least 1 item. |
| message.fromName | string | no | |
| message.replyTo | string (email) | no | |
| message.subject | string | yes | At least 1 character. |
| message.text | string | yes | |
| message.html | string | no | |
| messageId | string | null | yes |
Un dry run rifiuta un’operazione esterna, quindi non ha una riga di prova: eseguila da sola in un batch.
Generato dal registro delle operazioni e dal catalogo degli strumenti MCP (sorgente b5ef75cb0fb8c322).
Qualcosa non va in questa pagina? Scrivi a docs@librettocms.com.