Files
apxtri/schema/mails.json
T
2026-08-30 14:24:30 +00:00

252 lines
6.3 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "/schema/mails",
"title": "Mail - Synchronised email message",
"description": "A mail is an email message synchronised from a mailbox (imap/pop3) into a tribe namespace: {DATAPATH}/{tribe}/objects/mails/itm/{emailIdSafe}.json. Fine-grained access control cannot be expressed with static profiles because per-mailbox profiles are dynamic ('mail-{mailboxid}-reader' / 'mail-{mailboxid}-writer'): apxaccessrights grants druids full access and owner read access, while the fine verification (reader/writer on the mail's mailboxid) is enforced in routes/mailboxes.js and models/Mailboxes.js.",
"type": "object",
"required": [
"emailId",
"mailboxid",
"tribe"
],
"additionalProperties": true,
"apxid": "emailId",
"apxuniquekey": [
"emailId"
],
"apxidx": [
{
"name": "lst_emailId",
"type": "array",
"keyval": "emailId"
},
{
"name": "by_mailboxid",
"type": "distribution",
"keyval": "mailboxid"
},
{
"name": "by_status",
"type": "distribution",
"keyval": "status"
},
{
"name": "by_threadId",
"type": "distribution",
"keyval": "threadId"
},
{
"name": "by_from",
"type": "distribution",
"keyval": "from.email"
}
],
"apxaccessrights": {
"druids": {
"C": [],
"R": [],
"U": [],
"D": []
},
"owner": {
"R": []
}
},
"properties": {
"emailId": {
"type": "string",
"description": "Remote message id (IMAP uid / POP3 msgnumber or normalized message-id header) made safe for use as filename (apxid)"
},
"mailboxid": {
"type": "string"
},
"provider": {
"type": "string",
"enum": ["imap", "pop3"],
"description": "Provider that synchronised this mail"
},
"folder": {
"type": "string",
"description": "Remote folder (IMAP) the mail lives in"
},
"apxtriSent": {
"type": "boolean",
"default": false,
"description": "True when the mail was sent from apxtri itself (SMTP) and mirrors an entry of the Sent folder ('apxtriSent' badge/filter in the app)"
},
"remoteUid": {
"type": "string",
"description": "Remote message id (IMAP uid / POP3 msgnumber) used for on-demand fetching"
},
"tribe": {
"type": "string"
},
"threadId": {
"type": "string"
},
"inReplyTo": {
"type": "string"
},
"references": {
"type": "array",
"items": {
"type": "string"
}
},
"subject": {
"type": "string"
},
"snippet": {
"type": "string"
},
"from": {
"type": "object",
"properties": {
"email": { "type": "string" },
"name": { "type": "string" }
}
},
"to": {
"type": "array",
"items": {
"type": "object",
"properties": {
"email": { "type": "string" },
"name": { "type": "string" }
}
}
},
"cc": {
"type": "array",
"items": {
"type": "object",
"properties": {
"email": { "type": "string" },
"name": { "type": "string" }
}
}
},
"bcc": {
"type": "array",
"items": {
"type": "object",
"properties": {
"email": { "type": "string" },
"name": { "type": "string" }
}
}
},
"replyTo": {
"type": "array",
"items": {
"type": "object",
"properties": {
"email": { "type": "string" },
"name": { "type": "string" }
}
}
},
"messageId": {
"type": "string",
"description": "Raw RFC 5322 Message-ID header"
},
"contentType": {
"type": "string",
"description": "Content-Type of the message body"
},
"size": {
"type": "number",
"description": "Message size in bytes"
},
"flags": {
"type": "object",
"properties": {
"seen": { "type": "boolean" },
"unread": { "type": "boolean" },
"draft": { "type": "boolean" },
"starred": { "type": "boolean" },
"answered": { "type": "boolean" },
"important": { "type": "boolean" }
}
},
"hasAttachments": {
"type": "boolean",
"default": false
},
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string", "description": "Remote part identifier (Gmail attachmentId) if provided by the provider" },
"filename": { "type": "string", "description": "Original filename, kept for display" },
"mimeType": { "type": "string" },
"size": { "type": "number" },
"contentId": { "type": "string", "description": "Content-ID if the part is an inline image" },
"storageName": { "type": "string", "description": "Persisted filename under objects/mails/files/{emailId}/ once cached" }
}
}
},
"dateSent": {
"type": ["string", "null"],
"format": "date-time"
},
"dateReceived": {
"type": ["string", "null"],
"format": "date-time"
},
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"hasAttachments": {
"type": "boolean",
"default": false
},
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"filename": { "type": "string" },
"mimeType": { "type": "string" },
"size": { "type": "number" }
}
}
},
"status": {
"type": "string",
"enum": ["new", "read", "archived", "trash"],
"default": "new"
},
"bodyRef": {
"type": "string",
"description": "Relative path to the full body content if stored on disk (cache)"
},
"actions": {
"type": "array",
"description": "Treatments applied to this mail (e.g. tribe button creating a bdc)",
"items": {
"type": "object",
"properties": {
"date": { "type": "string" },
"alias": { "type": "string" },
"action": { "type": "string" },
"data": { "type": "object" }
}
}
},
"owner": {
"type": "string"
},
"dt_create": {
"type": "string"
},
"dt_update": {
"type": "string"
}
}
}