synology_apm_repo.sdk.units.saas.mail module

open_mail_provider/open_archive_mail_provider: M365/GWS Mail via mail_table, each message reassembled into an .eml from its META content_list fragments (build_eml). One code path covers both platforms.

M365’s mail_table.mail_id is not unique (historical rows can coexist, and listings don’t de-duplicate them); GWS’s is.

M365’s tree is mail_folder_table’s folder hierarchy, empty folders included, falling back to a flat folder grouping when that table is unusable (_open_m365_folder_tree). GWS has no folders, only many-to-many labels shown as a details entry, so its messages sit in one flat group. Archive Mail is a separate M365-only mailbox with regular Mail’s schema (open_archive_mail_provider).

class synology_apm_repo.sdk.units.saas.mail.MailState(gws_labels=<factory>)

Bases: object

What a mail tree_factory prefetches for _mail_extras.

Variables:

gws_labels (collections.abc.Mapping[str, list[str]]) – GWS label names, by mail_id; empty for M365.

gws_labels: Mapping[str, list[str]]
synology_apm_repo.sdk.units.saas.mail.MAIL_CONFIG = SaasWorkloadConfig(root_name='Mail', leaf_kind=<UnitKind.MAIL: 'mail'>, tables=('mail_table',), tree_factory=<function _make_build_tree.<locals>._build_tree>, content=<function _content>, object_names={'mail_table': ('mail_db', 'group_mail_db'), 'mail_folder_table': ('mail_folder_db', 'group_mail_folder_db')}, leaf_extras=<function _mail_extras>, group_extras=<function SaasWorkloadConfig.<lambda>>, leaf_size=<function SaasWorkloadConfig.<lambda>>, leaf_export_name=<function _export_name>)

SaasWorkloadConfig behind open_mail_provider — regular Mail, resolved via mail_db/group_mail_db.

synology_apm_repo.sdk.units.saas.mail.ARCHIVE_MAIL_CONFIG = SaasWorkloadConfig(root_name='Archive', leaf_kind=<UnitKind.MAIL: 'mail'>, tables=('mail_table',), tree_factory=<function _make_build_tree.<locals>._build_tree>, content=<function _content>, object_names={'mail_table': ('archive_mail_db',), 'mail_folder_table': ('archive_mail_folder_db',)}, leaf_extras=<function _archive_mail_extras>, group_extras=<function SaasWorkloadConfig.<lambda>>, leaf_size=<function SaasWorkloadConfig.<lambda>>, leaf_export_name=<function _export_name>)

SaasWorkloadConfig behind open_archive_mail_provider — M365’s separate archive_mail_db mailbox.

async synology_apm_repo.sdk.units.saas.mail.open_mail_provider(repo, version, saas_streams, *, shared=None)

Async factory over MAIL_CONFIG (see make_saas_provider).

async synology_apm_repo.sdk.units.saas.mail.open_archive_mail_provider(repo, version, saas_streams, *, shared=None)

Async factory over ARCHIVE_MAIL_CONFIG: M365’s Archive mailbox, a separate mail_table beside regular Mail in a USER_EXCHANGE version. Raises UnsupportedDataFormatError when the index has no archive_mail_db, so dispatch leaves Archive out of that version.