Cotton code
120 lines · 7.6 KB · JSONRaw
{  "id": "domain",  "name": "Domain",  "plural": "Domains",  "picture": null,  "builtin": false,  "engine": null,  "columns": [    { "key": "name", "name": "Name", "type": "text", "required": true, "placeholder": "example.com" },    { "key": "registrar", "name": "Registrar", "type": "text", "placeholder": "Where it is registered" },    { "key": "expires", "name": "Expires", "type": "date" },    { "key": "auto_renew", "name": "Auto-renews", "type": "bool" },    { "key": "dns_at", "name": "DNS at", "type": "text", "placeholder": "Who answers for its names" },    { "key": "nameservers", "name": "Nameservers", "type": "longtext" },    {      "key": "points_to",      "name": "Points to",      "type": "choice",      "choices": ["front_door", "page", "elsewhere"],      "labels": { "front_door": "This household", "page": "A page", "elsewhere": "Elsewhere" }    },    { "key": "destination", "name": "Where", "type": "text", "placeholder": "The page, or the address it goes to" },    { "key": "managed_for", "name": "Managed for", "type": "text", "placeholder": "Yourself, a business, a person" },    {      "key": "registration",      "name": "Registration",      "type": "choice",      "choices": ["wanted", "in_progress", "succeeded", "failed", "action_required", "blocked"],      "labels": {        "wanted": "Wanted", "in_progress": "Being registered", "succeeded": "Registered with Cotton",        "failed": "Could not be registered", "action_required": "Cloudflare needs something from you", "blocked": "Held up at Cloudflare"      }    },    { "key": "price", "name": "Price to register", "type": "text", "readonly": true },    { "key": "renewal_price", "name": "Then", "type": "text", "readonly": true },    { "key": "registration_note", "name": "Why not", "type": "longtext", "readonly": true },    { "key": "registered", "name": "Registered", "type": "date", "readonly": true },    { "key": "handed_to", "name": "Handed to", "type": "text", "readonly": true },    { "key": "handed_at", "name": "Handed on", "type": "date", "readonly": true },    { "key": "handed_to_database", "name": "Database id", "type": "text", "readonly": true },    { "key": "held_by", "name": "Held by", "type": "text", "readonly": true },    { "key": "whose", "name": "Whose it is", "type": "longtext", "readonly": true },    { "key": "status", "name": "Status", "type": "text", "placeholder": "active" },    { "key": "provider", "name": "Provider", "type": "text", "placeholder": "cloudflare" },    { "key": "plan", "name": "Plan", "type": "text" },    { "key": "created", "name": "Added", "type": "date" },    { "key": "account", "name": "Account", "type": "text" },    { "key": "external_id", "name": "Service id", "type": "text", "indexed": true, "readonly": true },    { "key": "notes", "name": "Notes", "type": "longtext", "markdown": true }  ],  "title": "name",  "date": "expires",  "project": null,  "order": null,  "slip": { "title": "name", "subtitle": ["registrar", "managed_for"], "trailing": "expires", "photo": null, "toggle": null },  "tile": {    "face": "slip-list",    "summary": [      { "op": "min", "column": "expires", "label": "next to expire" }    ]  },  "sort": { "column": "name" },  "empty": { "title": "No domains yet", "message": "Add one you hold, or connect Cloudflare and the domains it holds appear here." },  "create": { "label": "Add a domain" },  "page": [    { "heading": null, "columns": ["name", "registrar", "expires", "auto_renew"] },    { "heading": "DNS", "columns": ["dns_at", "nameservers"] },    { "heading": "Points to", "columns": ["points_to", "destination"], "commands": ["reach_here"] },    { "heading": "Managed for", "columns": ["managed_for", "handed_to", "handed_at", "held_by", "whose"], "commands": ["hand_over"] },    { "heading": "Registering", "columns": ["registration", "price", "renewal_price", "registration_note", "registered"], "commands": ["check_price", "register"] },    { "heading": "Records", "list": { "table": "dns_record", "link": "domain", "limit": 24 } },    { "heading": "At the provider", "columns": ["status", "provider", "plan", "account", "created", "external_id", "handed_to_database"] },    { "heading": "Notes", "columns": ["notes"] }  ],  "commands": [    {      "id": "check_price",      "label": "Check the price",      "kind": "update",      "method": "domains.checkPrice",      "bindings": { "id": "$id" },      "when": { "registration": ["wanted", "failed"] },      "receipt": "Asked what {name} costs"    },    {      "id": "register",      "label": "Register",      "kind": "update",      "method": "domains.register",      "bindings": { "id": "$id", "price": "price" },      "when": { "registration": ["wanted", "failed"], "price": { "not": false } },      "destructive": true,      "confirm": "Cloudflare charges the price on this page to the card on your account, now. A registration is never refunded.",      "receipt": "Registered {name}"    },    {      "id": "hand_over",      "label": "Hand over…",      "kind": "update",      "method": "domains.handOver",      "bindings": { "id": "$id" },      "pick": { "argument": "database", "kind": "database" },      "when": { "handed_to": false, "provider": "cloudflare" },      "destructive": true,      "confirm": "That database gets this domain's record and a key that edits its DNS, and nothing else of yours. The domain stays registered in your Cloudflare account, and legally yours, until you move it there.",      "receipt": "Handed {name} to {picked}"    },    {      "id": "reach_here",      "label": "Reach this household here",      "kind": "update",      "method": "workspace.setReach",      "data": { "through": "direct" },      "bindings": { "address": "name" },      "when": { "handed_to": false, "registration": { "not": ["wanted", "in_progress", "failed", "action_required", "blocked"] } },      "receipt": "Reached at {name}"    }  ],  "instructions": "One row per domain the owner holds or looks after. registrar is where it is registered and expires is the day the registration ends unless it renews. dns_at is who answers for its names (the provider whose nameservers it uses); it can differ from the registrar. points_to says what the bare name leads to: front_door is this household itself (the domain has been attached as a way to reach it), page is one page the household publishes, elsewhere is any other site; destination names the page or the address. managed_for is whose domain it is in practice when the owner holds it for someone else — a business or a person; empty means the owner's own. external_id is the provider's own id for it and is written by a connection, never by hand; status, provider, plan and account are the provider's own words. To ask for a NEW domain, write a row with its name and registration wanted (and managed_for, if it is for someone): that is all an assistant can do. Asking the price, registering it — which is billed to the owner's Cloudflare account and never refunded — handing a domain to another database, and Reach this household here (the household is then reached at that domain instead of through its relay, as its serving Mac's page would set it) are the owner's own acts on the row's page, never an assistant's; price, registration_note, registered, handed_to, handed_at, held_by and whose are written by those acts. handed_to names the database a domain was handed to: that database holds a key that edits this one domain's DNS, and whose says the limit in words — until the registration is moved in Cloudflare's dashboard, the domain is legally the owner's. A row made by hand is only a note of a domain: writing one registers, renews or moves nothing."}