Plugin

Inspect and manage this plugin package.

PLUGIN / ferrisflow.content-types

Content types

Version 1.1.1

Define content schemas, manage records, and create CRUD workflows.

Database0Content types and schema
Workflows12Workflow definitions
Menu items1Workspace navigation
Views1Saved presentations
Pages1Workspace pages
Database schemas0

No database schemas included.

Workflows12
  • ferrisflow_core / content-types-listVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-types-createVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-types-readVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-types-updateVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-types-deleteVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-records-listVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-records-createVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-records-readVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-records-updateVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-records-deleteVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-type-provisionVersion 1.0.0 · Serverless Workflow
  • ferrisflow_core / content-type-crudVersion 1.0.0 · Serverless Workflow
Pages1
  • Content typesPage · custom
Menu items1
  • Content types/plugins/ferrisflow.content-types/pages/content-types
Views1
  • Content typesPage · datatable
PLUGIN UI

Views

Open a plugin view to configure its list, create, and update layouts.

MANIFEST
{
  "builtin": true,
  "database": {
    "contentTypes": []
  },
  "description": "Define content schemas, manage records, and create CRUD workflows.",
  "id": "ferrisflow.content-types",
  "menuItems": [
    {
      "icon": "table",
      "label": "Content types",
      "page": "content-types",
      "path": "/plugins/ferrisflow.content-types/pages/content-types"
    }
  ],
  "name": "Content types",
  "pages": [
    {
      "id": "content-types",
      "title": "Content types",
      "view": "content-types-table"
    }
  ],
  "resourceTypes": [
    {
      "create": "content-type-provision",
      "name": "content-type",
      "postInstall": "content-type-crud",
      "source": "database.contentTypes"
    }
  ],
  "schemaVersion": 1,
  "version": "1.1.1",
  "views": [
    {
      "config": {
        "columns": [
          {
            "label": "Display name",
            "mapping": "display_name"
          },
          {
            "label": "API ID",
            "mapping": "uid"
          },
          {
            "label": "Created",
            "mapping": "created_at"
          }
        ],
        "createAction": {
          "input": {
            "display_name": "",
            "schema": {
              "fields": []
            },
            "uid": ""
          },
          "workflow": "content-types-create"
        },
        "rowAction": {
          "workflow": "content-types-update"
        },
        "rowNavigation": {
          "pathTemplate": "/content-types/{uid}"
        },
        "workflowNames": [
          "content-types-list",
          "content-types-create",
          "content-types-read",
          "content-types-update",
          "content-types-delete",
          "content-records-list",
          "content-records-create",
          "content-records-read",
          "content-records-update",
          "content-records-delete"
        ]
      },
      "dataSource": {
        "api": {
          "method": "GET",
          "path": "/api/content-type-registry"
        }
      },
      "id": "content-types-table",
      "name": "Content types",
      "type": "datatable"
    }
  ],
  "workflowTemplates": {
    "crud": [
      {
        "do": [
          {
            "record": {
              "call": "ferrisflow.primitive",
              "with": {
                "input": "${ . }",
                "keyType": "integer",
                "operation": "list",
                "primitive": "database",
                "table": "{{uid}}"
              }
            }
          }
        ],
        "document": {
          "dsl": "1.0.3",
          "metadata": {
            "ferrisflow": {
              "plugin": "{{ownerPlugin}}"
            },
            "rest_api": {
              "enabled": true,
              "method": "GET",
              "path": "/api/collections/{{uid}}"
            },
            "ui": {
              "input_schema": {
                "properties": {},
                "type": "object"
              },
              "view": {
                "config": {},
                "type": "json"
              }
            }
          },
          "name": "{{uid}}-list",
          "namespace": "ferrisflow_core",
          "version": "1.0.0"
        }
      },
      {
        "do": [
          {
            "requestInput": {
              "set": "${ (.request.body // .) + (.request.params // {}) }"
            }
          },
          {
            "record": {
              "call": "ferrisflow.primitive",
              "input": {
                "schema": {
                  "document": {
                    "$parameter": "inputSchema"
                  },
                  "format": "json"
                }
              },
              "with": {
                "input": "${ . }",
                "keyType": "integer",
                "operation": "create",
                "primitive": "database",
                "table": "{{uid}}"
              }
            }
          }
        ],
        "document": {
          "dsl": "1.0.3",
          "metadata": {
            "ferrisflow": {
              "plugin": "{{ownerPlugin}}"
            },
            "rest_api": {
              "enabled": true,
              "method": "POST",
              "path": "/api/collections/{{uid}}"
            },
            "ui": {
              "input_schema": {
                "$parameter": "inputSchema"
              },
              "view": {
                "config": {
                  "title": "{{display_name}}"
                },
                "type": "form"
              }
            }
          },
          "name": "{{uid}}-create",
          "namespace": "ferrisflow_core",
          "version": "1.0.0"
        }
      },
      {
        "do": [
          {
            "record": {
              "call": "ferrisflow.primitive",
              "with": {
                "input": "${ . }",
                "keyType": "integer",
                "operation": "read",
                "primitive": "database",
                "table": "{{uid}}"
              }
            }
          }
        ],
        "document": {
          "dsl": "1.0.3",
          "metadata": {
            "ferrisflow": {
              "plugin": "{{ownerPlugin}}"
            },
            "rest_api": {
              "enabled": true,
              "method": "GET",
              "path": "/api/collections/{{uid}}/{id}"
            },
            "ui": {
              "input_schema": {
                "properties": {},
                "type": "object"
              },
              "output_view": {
                "$parameter": "outputView"
              },
              "view": {
                "config": {},
                "type": "json"
              }
            }
          },
          "name": "{{uid}}-read",
          "namespace": "ferrisflow_core",
          "version": "1.0.0"
        }
      },
      {
        "do": [
          {
            "requestInput": {
              "set": "${ (.request.body // .) + (.request.params // {}) | . + {id:(.id | tonumber)} }"
            }
          },
          {
            "record": {
              "call": "ferrisflow.primitive",
              "input": {
                "schema": {
                  "document": {
                    "$parameter": "updateSchema"
                  },
                  "format": "json"
                }
              },
              "with": {
                "input": "${ . }",
                "keyType": "integer",
                "operation": "update",
                "primitive": "database",
                "table": "{{uid}}"
              }
            }
          }
        ],
        "document": {
          "dsl": "1.0.3",
          "metadata": {
            "ferrisflow": {
              "plugin": "{{ownerPlugin}}"
            },
            "rest_api": {
              "enabled": true,
              "method": "PUT",
              "path": "/api/collections/{{uid}}/{id}"
            },
            "ui": {
              "input_schema": {
                "$parameter": "updateSchema"
              },
              "view": {
                "config": {
                  "title": "{{display_name}}"
                },
                "type": "form"
              }
            }
          },
          "name": "{{uid}}-update",
          "namespace": "ferrisflow_core",
          "version": "1.0.0"
        }
      },
      {
        "do": [
          {
            "record": {
              "call": "ferrisflow.primitive",
              "with": {
                "input": "${ . }",
                "keyType": "integer",
                "operation": "delete",
                "primitive": "database",
                "table": "{{uid}}"
              }
            }
          }
        ],
        "document": {
          "dsl": "1.0.3",
          "metadata": {
            "ferrisflow": {
              "plugin": "{{ownerPlugin}}"
            },
            "rest_api": {
              "enabled": true,
              "method": "DELETE",
              "path": "/api/collections/{{uid}}/{id}"
            },
            "ui": {
              "input_schema": {
                "properties": {},
                "type": "object"
              },
              "view": {
                "config": {},
                "type": "json"
              }
            }
          },
          "name": "{{uid}}-delete",
          "namespace": "ferrisflow_core",
          "version": "1.0.0"
        }
      }
    ]
  },
  "workflows": [
    {
      "do": [
        {
          "registry": {
            "call": "ferrisflow.primitive",
            "output": {
              "as": "${ map(select(.uid != \"core.page\")) }"
            },
            "with": {
              "input": "${ . }",
              "jsonFields": {
                "schema": "schema_json"
              },
              "operation": "list",
              "primaryKey": "uid",
              "primitive": "database",
              "table": "content_types"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "List content type definitions",
            "name": "List content types",
            "operation": "list",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "GET",
            "path": "/api/content-type-registry"
          },
          "ui": {
            "input_schema": {
              "properties": {},
              "type": "object"
            },
            "view": {
              "config": {},
              "type": "json"
            }
          }
        },
        "name": "content-types-list",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "definition": {
            "set": {
              "definition": "${ .definition // .request.body // . }"
            }
          }
        },
        {
          "createTable": {
            "call": "ferrisflow.primitive",
            "input": {
              "schema": {
                "document": {
                  "properties": {
                    "definition": {
                      "properties": {
                        "display_name": {
                          "minLength": 1,
                          "type": "string"
                        },
                        "schema": {
                          "properties": {
                            "fields": {
                              "items": {
                                "properties": {
                                  "label": {
                                    "minLength": 1,
                                    "type": "string"
                                  },
                                  "name": {
                                    "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
                                    "type": "string"
                                  },
                                  "type": {
                                    "enum": [
                                      "text",
                                      "richtext",
                                      "number",
                                      "boolean",
                                      "date",
                                      "email",
                                      "json",
                                      "enum",
                                      "integer"
                                    ]
                                  }
                                },
                                "required": [
                                  "name",
                                  "label",
                                  "type"
                                ],
                                "type": "object"
                              },
                              "minItems": 1,
                              "type": "array"
                            }
                          },
                          "required": [
                            "fields"
                          ],
                          "type": "object"
                        },
                        "uid": {
                          "pattern": "^[A-Za-z][A-Za-z0-9_]{0,63}$",
                          "type": "string"
                        }
                      },
                      "required": [
                        "uid",
                        "display_name",
                        "schema"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "definition"
                  ],
                  "type": "object"
                },
                "format": "json"
              }
            },
            "with": {
              "columns": "${ [{name: \"id\", type: \"integer\", primaryKey: true}] + (.definition.schema.fields | map({name: .name, type: (if .type == \"integer\" then \"integer\" else if .type == \"number\" then \"number\" else if .type == \"boolean\" then \"boolean\" else \"string\" end end end), required: (.required // false), unique: (.unique // false)})) }",
              "input": "${ . }",
              "operation": "ensure",
              "primitive": "database",
              "returnInput": true,
              "table": "${ .definition.uid }"
            }
          }
        },
        {
          "registerType": {
            "call": "ferrisflow.primitive",
            "with": {
              "input": "${ {uid: .definition.uid, display_name: .definition.display_name, schema: .definition.schema} }",
              "jsonFields": {
                "schema": "schema_json"
              },
              "operation": "upsert",
              "primaryKey": "uid",
              "primitive": "database",
              "returnInput": true,
              "table": "content_types"
            }
          }
        },
        {
          "createCrudWorkflows": {
            "run": {
              "workflow": {
                "input": "${ . }",
                "name": "content-type-crud",
                "namespace": "ferrisflow_core",
                "version": "1.0.0"
              }
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "Create content type definitions",
            "name": "Create content type",
            "operation": "create",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "POST",
            "path": "/api/content-type-registry"
          },
          "ui": {
            "input_schema": {
              "properties": {
                "display_name": {
                  "placeholder": "Article",
                  "title": "Display name",
                  "type": "string"
                },
                "schema": {
                  "title": "Fields schema",
                  "type": "object"
                },
                "uid": {
                  "placeholder": "article",
                  "title": "API ID",
                  "type": "string"
                }
              },
              "required": [
                "uid",
                "display_name",
                "schema"
              ],
              "type": "object"
            },
            "view": {
              "config": {
                "description": "Define the collection and its fields.",
                "title": "Content type"
              },
              "type": "form"
            }
          }
        },
        "name": "content-types-create",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "registry": {
            "call": "ferrisflow.primitive",
            "with": {
              "input": "${ . }",
              "jsonFields": {
                "schema": "schema_json"
              },
              "operation": "read",
              "primaryKey": "uid",
              "primitive": "database",
              "table": "content_types"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "Read content type definitions",
            "name": "Read content type",
            "operation": "read",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "GET",
            "path": "/api/content-type-registry/{uid}"
          },
          "ui": {
            "input_schema": {
              "properties": {},
              "type": "object"
            },
            "view": {
              "config": {},
              "type": "json"
            }
          }
        },
        "name": "content-types-read",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "registry": {
            "call": "ferrisflow.primitive",
            "with": {
              "input": "${ . }",
              "jsonFields": {
                "schema": "schema_json"
              },
              "operation": "update",
              "primaryKey": "uid",
              "primitive": "database",
              "table": "content_types"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "Update content type definitions",
            "name": "Update content type",
            "operation": "update",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "PUT",
            "path": "/api/content-type-registry/{uid}"
          },
          "ui": {
            "input_schema": {
              "properties": {
                "display_name": {
                  "placeholder": "Article",
                  "title": "Display name",
                  "type": "string"
                },
                "schema": {
                  "title": "Fields schema",
                  "type": "object"
                },
                "uid": {
                  "placeholder": "article",
                  "title": "API ID",
                  "type": "string"
                }
              },
              "required": [
                "uid",
                "display_name",
                "schema"
              ],
              "type": "object"
            },
            "view": {
              "config": {
                "description": "Define the collection and its fields.",
                "title": "Content type"
              },
              "type": "form"
            }
          }
        },
        "name": "content-types-update",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "registry": {
            "call": "ferrisflow.primitive",
            "with": {
              "input": "${ . }",
              "jsonFields": {
                "schema": "schema_json"
              },
              "operation": "delete",
              "primaryKey": "uid",
              "primitive": "database",
              "table": "content_types"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "Delete content type definitions",
            "name": "Delete content type",
            "operation": "delete",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "DELETE",
            "path": "/api/content-type-registry/{uid}"
          },
          "ui": {
            "input_schema": {
              "properties": {},
              "type": "object"
            },
            "view": {
              "config": {},
              "type": "json"
            }
          }
        },
        "name": "content-types-delete",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "records": {
            "call": "ferrisflow.primitive",
            "with": {
              "fallback": "${ {\"primitive\": \"database\", \"operation\": \"list\", \"table\": \"content_entries\", \"keyType\": \"integer\", \"filter\": {\"content_type_uid\": (.request.params.uid // .uid)}, \"jsonFields\": {\"data\": \"data_json\"}, \"input\": (.)} }",
              "ignoreFields": [
                "uid"
              ],
              "input": "${ . }",
              "keyType": "integer",
              "operation": "list",
              "primitive": "database",
              "table": "${ .request.params.uid // .uid }"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "List content records",
            "name": "List records",
            "operation": "list",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "GET",
            "path": "/api/content/{uid}"
          },
          "ui": {
            "input_schema": {
              "properties": {},
              "type": "object"
            },
            "view": {
              "config": {},
              "type": "json"
            }
          }
        },
        "name": "content-records-list",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "records": {
            "call": "ferrisflow.primitive",
            "with": {
              "fallback": "${ {\"primitive\": \"database\", \"operation\": \"create\", \"table\": \"content_entries\", \"keyType\": \"integer\", \"filter\": {\"content_type_uid\": (.request.params.uid // .uid)}, \"jsonFields\": {\"data\": \"data_json\"}, \"input\": ({content_type_uid: (.request.params.uid // .uid), data: (.request.body.data // .data // .request.body // .), published: (.request.body.published // .published // false)})} }",
              "ignoreFields": [
                "uid"
              ],
              "input": "${ . }",
              "keyType": "integer",
              "operation": "create",
              "primitive": "database",
              "table": "${ .request.params.uid // .uid }"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "Create content records",
            "name": "Create record",
            "operation": "create",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "POST",
            "path": "/api/content/{uid}"
          },
          "ui": {
            "input_schema": {
              "properties": {},
              "type": "object"
            },
            "view": {
              "config": {},
              "type": "json"
            }
          }
        },
        "name": "content-records-create",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "records": {
            "call": "ferrisflow.primitive",
            "with": {
              "fallback": "${ {\"primitive\": \"database\", \"operation\": \"read\", \"table\": \"content_entries\", \"keyType\": \"integer\", \"filter\": {\"content_type_uid\": (.request.params.uid // .uid)}, \"jsonFields\": {\"data\": \"data_json\"}, \"input\": (.)} }",
              "ignoreFields": [
                "uid"
              ],
              "input": "${ . }",
              "keyType": "integer",
              "operation": "read",
              "primitive": "database",
              "table": "${ .request.params.uid // .uid }"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "Read content records",
            "name": "Read record",
            "operation": "read",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "GET",
            "path": "/api/content/{uid}/{id}"
          },
          "ui": {
            "input_schema": {
              "properties": {},
              "type": "object"
            },
            "view": {
              "config": {},
              "type": "json"
            }
          }
        },
        "name": "content-records-read",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "records": {
            "call": "ferrisflow.primitive",
            "with": {
              "fallback": "${ {\"primitive\": \"database\", \"operation\": \"update\", \"table\": \"content_entries\", \"keyType\": \"integer\", \"filter\": {\"content_type_uid\": (.request.params.uid // .uid)}, \"jsonFields\": {\"data\": \"data_json\"}, \"input\": ({content_type_uid: (.request.params.uid // .uid), data: (.request.body.data // .data // .request.body // .), published: (.request.body.published // .published // false)}), \"key\": (.request.params.id // .id)} }",
              "ignoreFields": [
                "uid"
              ],
              "input": "${ . }",
              "keyType": "integer",
              "operation": "update",
              "primitive": "database",
              "table": "${ .request.params.uid // .uid }"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "Update content records",
            "name": "Update record",
            "operation": "update",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "PUT",
            "path": "/api/content/{uid}/{id}"
          },
          "ui": {
            "input_schema": {
              "properties": {},
              "type": "object"
            },
            "view": {
              "config": {},
              "type": "json"
            }
          }
        },
        "name": "content-records-update",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "records": {
            "call": "ferrisflow.primitive",
            "with": {
              "fallback": "${ {\"primitive\": \"database\", \"operation\": \"delete\", \"table\": \"content_entries\", \"keyType\": \"integer\", \"filter\": {\"content_type_uid\": (.request.params.uid // .uid)}, \"jsonFields\": {\"data\": \"data_json\"}, \"input\": (.)} }",
              "ignoreFields": [
                "uid"
              ],
              "input": "${ . }",
              "keyType": "integer",
              "operation": "delete",
              "primitive": "database",
              "table": "${ .request.params.uid // .uid }"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "description": "Delete content records",
            "name": "Delete record",
            "operation": "delete",
            "plugin": "ferrisflow.content-types"
          },
          "rest_api": {
            "enabled": true,
            "method": "DELETE",
            "path": "/api/content/{uid}/{id}"
          },
          "ui": {
            "input_schema": {
              "properties": {},
              "type": "object"
            },
            "view": {
              "config": {},
              "type": "json"
            }
          }
        },
        "name": "content-records-delete",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "definition": {
            "set": {
              "definition": "${ .definition // .request.body // . }"
            }
          }
        },
        {
          "createTable": {
            "call": "ferrisflow.primitive",
            "input": {
              "schema": {
                "document": {
                  "properties": {
                    "definition": {
                      "properties": {
                        "display_name": {
                          "minLength": 1,
                          "type": "string"
                        },
                        "schema": {
                          "properties": {
                            "fields": {
                              "items": {
                                "properties": {
                                  "label": {
                                    "minLength": 1,
                                    "type": "string"
                                  },
                                  "name": {
                                    "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
                                    "type": "string"
                                  },
                                  "type": {
                                    "enum": [
                                      "text",
                                      "richtext",
                                      "number",
                                      "boolean",
                                      "date",
                                      "email",
                                      "json",
                                      "enum",
                                      "integer"
                                    ]
                                  }
                                },
                                "required": [
                                  "name",
                                  "label",
                                  "type"
                                ],
                                "type": "object"
                              },
                              "minItems": 1,
                              "type": "array"
                            }
                          },
                          "required": [
                            "fields"
                          ],
                          "type": "object"
                        },
                        "uid": {
                          "pattern": "^[A-Za-z][A-Za-z0-9_]{0,63}$",
                          "type": "string"
                        }
                      },
                      "required": [
                        "uid",
                        "display_name",
                        "schema"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "definition"
                  ],
                  "type": "object"
                },
                "format": "json"
              }
            },
            "with": {
              "columns": "${ [{name: \"id\", type: \"integer\", primaryKey: true}] + (.definition.schema.fields | map({name: .name, type: (if .type == \"integer\" then \"integer\" else if .type == \"number\" then \"number\" else if .type == \"boolean\" then \"boolean\" else \"string\" end end end), required: (.required // false), unique: (.unique // false)})) }",
              "input": "${ . }",
              "operation": "ensure",
              "primitive": "database",
              "returnInput": true,
              "table": "${ .definition.uid }"
            }
          }
        },
        {
          "registerType": {
            "call": "ferrisflow.primitive",
            "with": {
              "input": "${ {uid: .definition.uid, display_name: .definition.display_name, schema: .definition.schema} }",
              "jsonFields": {
                "schema": "schema_json"
              },
              "operation": "upsert",
              "primaryKey": "uid",
              "primitive": "database",
              "returnInput": true,
              "table": "content_types"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "plugin": "ferrisflow.content-types"
          }
        },
        "name": "content-type-provision",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    },
    {
      "do": [
        {
          "definition": {
            "set": {
              "definition": "${ .definition // . }",
              "plugin": "${ .plugin }"
            }
          }
        },
        {
          "inputSchema": {
            "set": {
              "definition": "${ .definition // . }",
              "inputSchema": "${ {type:\"object\",required:(.definition.schema.fields | map(select(.required == true) | .name)),properties:((.definition.schema.fields | map({(.name): ({title:.label,multiline:(.type == \"richtext\"),type:(if .type == \"integer\" then \"integer\" else if .type == \"number\" then \"number\" else if .type == \"boolean\" then \"boolean\" else if .type == \"json\" then \"object\" else \"string\" end end end end)} + (if .minimum != null then {minimum:.minimum} else {} end) + (if .required == true and (.type == \"text\" or .type == \"richtext\") then {minLength:1} else {} end))}) | add) + {id:{type:\"integer\",title:\"Record ID\"}})} }",
              "plugin": "${ .plugin }"
            }
          }
        },
        {
          "createCrudWorkflows": {
            "call": "ferrisflow.primitive",
            "with": {
              "parameters": "${ .definition + {ownerPlugin:(.plugin.id // \"ferrisflow.content-types\"), outputView:{type:\"article\",titleField:\"title\",bodyField:(.definition.schema.fields | map(select(.type == \"richtext\") | .name) | first)}, inputSchema:.inputSchema, updateSchema:(.inputSchema + {required:[\"id\"]})} }",
              "plugin": "ferrisflow.content-types",
              "primitive": "workflow.instantiate",
              "template": "crud"
            }
          }
        }
      ],
      "document": {
        "dsl": "1.0.3",
        "metadata": {
          "ferrisflow": {
            "plugin": "ferrisflow.content-types"
          }
        },
        "name": "content-type-crud",
        "namespace": "ferrisflow_core",
        "version": "1.0.0"
      }
    }
  ]
}