Cotton code
636 lines · 14.8 KB · JSONRaw
{  "format_version": 1,  "id": "screenplay",  "name": "Screenplay",  "plural": "Screenplays",  "builtin": true,  "visibility": "owner",  "title": "title",  "columns": [    {      "key": "title",      "type": "text",      "required": true    },    {      "key": "logline",      "type": "text",      "placeholder": "One sentence saying what the story is"    },    {      "key": "archived_at",      "name": "Archived",      "type": "date"    },    {      "key": "trashed_at",      "type": "date",      "format": "calendar-datetime",      "readonly": true    },    {      "key": "scene_count",      "name": "Scenes",      "type": "number",      "readonly": true,      "units": {        "one": "scene",        "other": "scenes",        "zero": "No scenes yet"      }    },    {      "key": "estimated_pages",      "name": "Length",      "type": "number",      "readonly": true,      "units": {        "one": "page",        "other": "pages",        "zero": "No scenes yet"      }    },    {      "key": "draft_count",      "name": "Drafts",      "type": "number",      "readonly": true,      "units": {        "one": "draft",        "other": "drafts",        "zero": ""      }    },    {      "key": "fountain",      "name": "Fountain",      "type": "longtext",      "readonly": true    },    {      "key": "latest_draft",      "name": "Latest draft",      "type": "number",      "readonly": true    },    {      "key": "latest_draft_at",      "name": "Latest draft on",      "type": "date",      "readonly": true    }  ],  "instructions": "A screenplay is a script made of ordered scenes plus supporting documents such as the story and the outline. The logline is one sentence saying what the story is. Scenes, characters and drafts belong to it and are edited as their own records.",  "tables": [    {      "name": "cotton_screenplays",      "columns": [        {          "name": "id",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": true,          "declaration": "\n    id TEXT PRIMARY KEY",          "position": 0        },        {          "name": "workspace_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    workspace_id TEXT NOT NULL",          "position": 1        },        {          "name": "title",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    title TEXT NOT NULL",          "position": 2        },        {          "name": "logline",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    logline TEXT",          "position": 3        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 4        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 5        },        {          "name": "archived_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    archived_at TEXT",          "position": 6        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 7        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 8        },        {          "name": "trashed_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": " trashed_at TEXT",          "position": 9        }      ],      "constraints": [        {          "declaration": "\n    CHECK (length(trim(title)) > 0)",          "position": 10        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n  ",          "position": 11        }      ],      "prefix": "CREATE TABLE cotton_screenplays (",      "suffix": ")",      "indexes": [        "CREATE INDEX idx_cotton_screenplays_workspace ON cotton_screenplays (workspace_id, archived_at)",        "CREATE INDEX IF NOT EXISTS idx_cotton_screenplays_author ON cotton_screenplays (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    },    {      "name": "cotton_screenplay_draft_scenes",      "columns": [        {          "name": "id",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": true,          "declaration": "\n    id TEXT PRIMARY KEY",          "position": 0        },        {          "name": "workspace_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    workspace_id TEXT NOT NULL",          "position": 1        },        {          "name": "draft_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    draft_id TEXT NOT NULL",          "position": 2        },        {          "name": "scene_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    scene_id TEXT NOT NULL",          "position": 3        },        {          "name": "position",          "type": "REAL",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    \"position\" REAL NOT NULL",          "position": 4        },        {          "name": "heading",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    heading TEXT",          "position": 5        },        {          "name": "body",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    body TEXT NOT NULL",          "position": 6        },        {          "name": "purpose",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    purpose TEXT",          "position": 7        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 8        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 9        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 10        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 11        }      ],      "constraints": [        {          "declaration": "\n    UNIQUE (draft_id, scene_id)",          "position": 12        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE",          "position": 13        },        {          "declaration": "\n    FOREIGN KEY (draft_id) REFERENCES cotton_screenplay_drafts(id)\n  ",          "position": 14        }      ],      "prefix": "CREATE TABLE cotton_screenplay_draft_scenes (",      "suffix": ")",      "indexes": [        "CREATE INDEX idx_cotton_screenplay_draft_scenes_order ON cotton_screenplay_draft_scenes (draft_id, \"position\")",        "CREATE INDEX IF NOT EXISTS idx_cotton_screenplay_draft_scenes_author ON cotton_screenplay_draft_scenes (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    }  ],  "picture": {    "photo": "photo:7420f14aef6d78f71091bb2de82c0c23ba4b209c6689837f648db0617e629138",    "object": "tool-screenplays"  },  "engine": "screenplay",  "voice_words": [    "title"  ],  "date": null,  "project": null,  "order": null,  "slip": {    "title": "title",    "subtitle": "logline",    "trailing": null,    "photo": null,    "toggle": null  },  "tile": {    "face": "cover-grid"  },  "page": [    {      "heading": null,      "columns": [        "title",        "logline"      ]    },    {      "heading": null,      "columns": [        "scene_count",        "estimated_pages",        "draft_count"      ],      "role": "facts"    },    {      "heading": "Scenes",      "list": {        "table": "screenplay_scene",        "link": "screenplay_id",        "empty": "No scenes yet. Add the first one, or ask your assistant to write it."      },      "role": "side"    },    {      "heading": "Places",      "list": {        "table": "screenplay_place",        "link": "screenplay_id",        "empty": "No places yet. Name where the story happens."      },      "role": "side"    },    {      "heading": "Characters",      "list": {        "table": "screenplay_character",        "link": "screenplay_id",        "empty": "No characters yet. Whoever speaks in a scene is heard here, and you can name one yourself."      },      "role": "side"    },    {      "heading": "Documents",      "list": {        "table": "screenplay_document",        "link": "screenplay_id"      },      "role": "side"    },    {      "heading": "Drafts",      "list": {        "table": "screenplay_draft",        "link": "screenplay_id"      },      "role": "side"    },    {      "heading": "Read it straight through",      "list": {        "table": "screenplay_scene",        "link": "screenplay_id",        "face": "page",        "empty": "No scenes yet.",        "add": "Add a scene"      },      "role": "main"    }  ],  "page_parts": [    "title",    "facts",    "script",    "grid"  ],  "archived": "archived_at",  "record_route": "/screenplays/[id]",  "cover": {    "footer": [      "draft_count",      "estimated_pages"    ],    "bound": true  },  "empty": {    "title": "No screenplays yet",    "message": "Tap + to start one: give it a title, then add its first scene."  },  "create": {    "label": "New screenplay"  },  "capture": {    "table": "screenplay_scene",    "placeholder": "Add a scene…",    "link": "screenplay_id",    "page_only": true  },  "exports": [    {      "label": "Export Fountain",      "column": "fountain",      "extension": "fountain"    }  ],  "delete": false,  "tool": {    "views": [      {        "id": "all",        "label": "All",        "visibility": "owner",        "is_default": true,        "read": {          "table": "screenplay"        }      },      {        "id": "act_one",        "label": "Act I",        "is_default": false,        "visibility": "owner",        "read": {          "table": "screenplay_scene",          "where": {            "act": "1"          }        }      },      {        "id": "act_two",        "label": "Act II",        "is_default": false,        "visibility": "owner",        "read": {          "table": "screenplay_scene",          "where": {            "act": "2"          }        }      },      {        "id": "act_three",        "label": "Act III",        "is_default": false,        "visibility": "owner",        "read": {          "table": "screenplay_scene",          "where": {            "act": "3"          }        }      },      {        "id": "characters",        "label": "Characters",        "is_default": false,        "visibility": "owner",        "read": {          "table": "screenplay_character"        }      },      {        "id": "places",        "label": "Places",        "is_default": false,        "visibility": "owner",        "read": {          "table": "screenplay_place"        }      }    ],    "name": "Screenplays",    "purpose": "Scripts, scenes and the people in your story.",    "key": "screenplays",    "icon": "clapperboard",    "card_stock": "cream",    "route": "/screenplays",    "held_only": true  },  "card": {    "face": "screenplay",    "fields": [      {        "slot": "title",        "column": "title"      },      {        "slot": "subtitle",        "column": "logline"      },      {        "slot": "length",        "column": "estimated_pages"      },      {        "slot": "number",        "column": "latest_draft",        "line": "field.draft"      },      {        "slot": "date",        "column": "latest_draft_at",        "form": "day_month"      },      {        "slot": "count",        "column": "scene_count"      }    ],    "opens": {      "table": "screenplay_scene",      "by": "screenplay_id",      "order": [        "act",        "position"      ]    }  },  "parts": {    "shape": "desk",    "head": {      "facts": [        "logline",        "scene_count"      ]    },    "links": [],    "body": "fountain",    "lists": [      {        "table": "screenplay_scene",        "relation": "screenplay_id",        "heading": "Scenes"      },      {        "table": "screenplay_character",        "relation": "screenplay_id",        "heading": "Characters"      },      {        "table": "screenplay_place",        "relation": "screenplay_id",        "heading": "Places"      },      {        "table": "screenplay_document",        "relation": "screenplay_id",        "heading": "Documents"      },      {        "table": "screenplay_draft",        "relation": "screenplay_id",        "heading": "Drafts"      },      {        "table": "screenplay_scene",        "relation": "screenplay_id",        "heading": "Read it straight through"      }    ],    "acts": {      "more": []    },    "strip": [      {        "column": "logline"      },      {        "column": "scene_count"      },      {        "column": "estimated_pages"      },      {        "column": "draft_count"      }    ]  }}