askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
exchange_inbox.json · 4.0 KB · 45 lines
| 1 | { |
| 2 | "name": "exchange_inbox", |
| 3 | "title": "Exchange Inbox", |
| 4 | "version": 2, |
| 5 | "description": "Every business document a partner delivered and this box accepted, kept verbatim: raw_body is the exact request body (envelope, its detached signature, the signed delivery stamp), and receipt is the signed receipt this box answered with. Written only by the inbound endpoint, after every check passed (object_exchange_box). Frozen from creation (`integrity` is set to verified on create and locked_when freezes everything but the mapping fields), so what arrived cannot be edited afterwards by anyone, admins included, and cannot be deleted. unique (sender, document_id) is what makes delivery idempotent: a resend stores nothing and gets the first receipt back. mapping_status says what became of it: mapped (a record was made or matched; mapped_collection/mapped_record_id), needs_attention (it could not be, and mapping_reason says why: the attention queue exchange_needs_attention), awaiting_confirmation (a remittance waiting for a person to check the bank). Retention: business documents are evidence and are kept; only connected partners can write here, each document is capped at 512 KiB, and requests are rate limited before they reach it. v2: resolution, resolved_by and resolved_at record a person's decision on a confirmation that differed from our order (accepted, applied through recorded changes, or rejected).", |
| 6 | "fields": [ |
| 7 | {"name": "id"}, |
| 8 | {"name": "sender", "type": "text", "required": true, "label": "From"}, |
| 9 | {"name": "recipient", "type": "text", "required": true, "label": "To"}, |
| 10 | {"name": "partner_id", "type": "text", "label": "Partner"}, |
| 11 | {"name": "document_id", "type": "text", "required": true, "label": "Document Id"}, |
| 12 | {"name": "document_type", "type": "text", "required": true, "label": "Type"}, |
| 13 | {"name": "envelope_sha256", "type": "text", "required": true, "label": "Envelope SHA-256"}, |
| 14 | {"name": "key_id", "type": "text", "label": "Signed With"}, |
| 15 | {"name": "raw_body", "type": "textarea", "required": true, "label": "As Received"}, |
| 16 | {"name": "received_at", "type": "text", "label": "Received"}, |
| 17 | {"name": "receipt", "type": "textarea", "label": "Our Receipt"}, |
| 18 | {"name": "integrity", "type": "enum", "enum": ["verified"], "required": true, |
| 19 | "label": "Integrity"}, |
| 20 | {"name": "mapping_status", "type": "enum", "default": "pending", "label": "Mapping", |
| 21 | "enum": ["pending", "mapped", "needs_attention", "awaiting_confirmation"]}, |
| 22 | {"name": "mapping_reason", "type": "textarea", "label": "What Happened"}, |
| 23 | {"name": "mapped_collection", "type": "text", "label": "Became A"}, |
| 24 | {"name": "mapped_record_id", "type": "text", "label": "Record"}, |
| 25 | {"name": "resolution", "type": "enum", "enum": ["accepted", "rejected", "refused"], "label": "Decision", |
| 26 | "help": "What a person decided (action_exchange_resolve): on a confirmation that differed from our order, accepted or rejected; on any document, refused (the sender is told)."}, |
| 27 | {"name": "resolved_by", "type": "text", "label": "Decided By"}, |
| 28 | {"name": "resolved_at", "type": "text", "label": "Decided"}, |
| 29 | {"name": "owner_id", "type": "text", "label": "Books Of"}, |
| 30 | {"name": "created_at", "type": "datetime", "read_only": true, "label": "Created"}, |
| 31 | {"name": "updated_at", "type": "text", "label": "Updated"} |
| 32 | ], |
| 33 | "unique": [{"fields": ["document_id"], "scope": ["sender"], |
| 34 | "message": "That document was already received from this sender."}], |
| 35 | "locked_when": [ |
| 36 | {"when": {"integrity": "verified"}, |
| 37 | "except": ["mapping_status", "mapping_reason", "mapped_collection", "mapped_record_id", |
| 38 | "resolution", "resolved_by", "resolved_at", "updated_at"], |
| 39 | "message": "A received document is evidence: it is kept exactly as it arrived."} |
| 40 | ], |
| 41 | "views": {"list_mode": "table", |
| 42 | "list_fields": ["received_at", "sender", "document_type", "mapping_status", "mapping_reason"], |
| 43 | "filter_fields": ["mapping_status", "document_type"]}, |
| 44 | "search": {"fields": ["sender", "document_id", "mapping_reason"]} |
| 45 | } |