Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 42 minutes ago History
exchange_outbox.json · 4.6 KB · 52 lines
1{
2 "name": "exchange_outbox",
3 "title": "Exchange Outbox",
4 "version": 2,
5 "description": "Every document this box made to send, from the business record it was made from (source_collection / source_record_id): the signed envelope is written once, here, when the document is made (action_exchange_send) and frozen; the daemon's pass (system_exchange_deliver, every three minutes) delivers each queued row with a freshly signed delivery stamp, retries a partner that does not answer with exponential backoff (1 minute doubling to 6 hours, 12 attempts), stops on a refusal, and keeps the partner's signed receipt once it verifies against the keys pinned for that partner. Retrying is safe because the receiver stores a document once by its id, and it is not a paid call. One document per record and type (unique): a correction is a new document, such as a credit note, never a second copy. A delivery that stopped (`dead`) is the attention queue exchange_undelivered; action_exchange_admin op=requeue sends it again. Retention: one row per document sent, kept as the evidence of what was sent. v2: refused -- the partner's box verified the document and refused it (a signed refusal receipt answering the delivery: a type it does not take, a malformed document), or a person there refused it afterwards (a signed document_refusal). The signed refusal is kept, the reason shown, and the record the document was made from says \"Refused by <partner>: <reason>\" (exchange_status); the attention queue exchange_refused. A refusal from a box that could not prove who it was (not a partner) is still just a dead row.",
6 "fields": [
7 {"name": "id"},
8 {"name": "document_id", "type": "text", "required": true, "label": "Document Id"},
9 {"name": "document_type", "type": "text", "required": true, "label": "Type"},
10 {"name": "partner_domain", "type": "text", "required": true, "label": "To"},
11 {"name": "source_collection", "type": "text", "required": true, "label": "From A"},
12 {"name": "source_record_id", "type": "text", "required": true, "label": "Record"},
13 {"name": "envelope", "type": "textarea", "required": true, "label": "Signed Envelope"},
14 {"name": "envelope_sha256", "type": "text", "required": true, "label": "Envelope SHA-256"},
15 {"name": "status", "type": "enum", "default": "queued", "label": "Status",
16 "enum": ["queued", "delivered", "dead", "refused"]},
17 {"name": "attempts", "type": "integer", "default": "0", "label": "Attempts"},
18 {"name": "next_attempt_at", "type": "text", "label": "Next Attempt"},
19 {"name": "last_status_code", "type": "text", "label": "Last Answer"},
20 {"name": "last_error", "type": "text", "label": "Last Error"},
21 {"name": "receipt", "type": "textarea", "label": "Their Receipt"},
22 {"name": "receipt_verified", "type": "boolean", "default": "false", "label": "Receipt Verified"},
23 {"name": "delivered_at", "type": "text", "label": "Delivered"},
24 {"name": "refused_at", "type": "text", "label": "Refused"},
25 {"name": "refusal_reason", "type": "text", "label": "Refused Because"},
26 {"name": "refusal", "type": "textarea", "label": "Their Refusal",
27 "help": "The partner's signed refusal: a refusal receipt answering the delivery, or a signed document_refusal a person there sent later."},
28 {"name": "owner_id", "type": "text", "label": "Sent By"},
29 {"name": "created_at", "type": "datetime", "read_only": true, "label": "Created"},
30 {"name": "updated_at", "type": "text", "label": "Updated"}
31 ],
32 "unique": [
33 {"fields": ["document_id"], "message": "A document with that id was already sent."},
34 {"fields": ["source_collection", "source_record_id", "document_type"],
35 "message": "That record was already sent as this document type."}
36 ],
37 "locked_when": [
38 {"when": {"status": ["queued", "delivered", "dead", "refused"]},
39 "fields": ["document_id", "document_type", "partner_domain", "source_collection",
40 "source_record_id", "envelope", "envelope_sha256"],
41 "message": "A signed document is not edited; a correction is a new document."},
42 {"when": {"status": "delivered"},
43 "except": ["status", "refused_at", "refusal_reason", "refusal", "last_error", "updated_at"],
44 "message": "A delivered document and its receipt are evidence; the only thing added later is the partner's signed refusal."},
45 {"when": {"status": "refused"}, "except": [],
46 "message": "A refused document and the partner's signed refusal are evidence."}
47 ],
48 "views": {"list_mode": "table",
49 "list_fields": ["created_at", "partner_domain", "document_type", "status", "last_error"],
50 "filter_fields": ["status", "document_type"]},
51 "search": {"fields": ["partner_domain", "document_id"]}
52}