jmap-email 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jmap_email/__init__.py +112 -0
- jmap_email/composer.py +1081 -0
- jmap_email/helpers.py +198 -0
- jmap_email/limits.py +76 -0
- jmap_email/parser.py +1931 -0
- jmap_email/py.typed +0 -0
- jmap_email/types.py +234 -0
- jmap_email-0.1.0.dist-info/METADATA +472 -0
- jmap_email-0.1.0.dist-info/RECORD +11 -0
- jmap_email-0.1.0.dist-info/WHEEL +4 -0
- jmap_email-0.1.0.dist-info/licenses/LICENSE +22 -0
jmap_email/__init__.py
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""jmap-email: a strict-JMAP RFC 8621 Email object library.
|
|
2
|
+
|
|
3
|
+
Parse raw RFC 5322 bytes into a JMAP Email object dict, compose
|
|
4
|
+
JMAP Email object dicts into strict RFC 5322 bytes. Zero runtime
|
|
5
|
+
dependencies. Hardened against the documented CVE / research
|
|
6
|
+
attack classes — see the README.
|
|
7
|
+
|
|
8
|
+
Quick start::
|
|
9
|
+
|
|
10
|
+
import jmap_email
|
|
11
|
+
|
|
12
|
+
email = jmap_email.parse_email(raw_bytes)
|
|
13
|
+
raw = jmap_email.compose_email(email)
|
|
14
|
+
|
|
15
|
+
Versioning: semantic. Public API is everything exported below; anything
|
|
16
|
+
prefixed with ``_`` is internal.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
__version__ = "0.1.0"
|
|
20
|
+
|
|
21
|
+
from .composer import (
|
|
22
|
+
AttachmentError,
|
|
23
|
+
ComposeError,
|
|
24
|
+
HeaderInjectionError,
|
|
25
|
+
InvalidAddressError,
|
|
26
|
+
InvalidDateError,
|
|
27
|
+
InvalidMessageIdError,
|
|
28
|
+
compose_email,
|
|
29
|
+
format_address,
|
|
30
|
+
format_address_list,
|
|
31
|
+
is_valid_msg_id,
|
|
32
|
+
)
|
|
33
|
+
from .helpers import (
|
|
34
|
+
body_part_text,
|
|
35
|
+
body_text_joined,
|
|
36
|
+
find_header,
|
|
37
|
+
find_headers,
|
|
38
|
+
first_address,
|
|
39
|
+
first_address_email,
|
|
40
|
+
first_address_name,
|
|
41
|
+
first_msgid,
|
|
42
|
+
has_header,
|
|
43
|
+
msgid_chain,
|
|
44
|
+
now_sent_at,
|
|
45
|
+
sent_at_to_datetime,
|
|
46
|
+
)
|
|
47
|
+
from .limits import DEFAULT_PARSE_LIMITS, ParseLimits
|
|
48
|
+
from .parser import (
|
|
49
|
+
decode_rfc2047_header,
|
|
50
|
+
parse_address,
|
|
51
|
+
parse_addresses,
|
|
52
|
+
parse_date,
|
|
53
|
+
parse_email,
|
|
54
|
+
)
|
|
55
|
+
from .types import (
|
|
56
|
+
Attachment,
|
|
57
|
+
EmailAddress,
|
|
58
|
+
EmailBodyPart,
|
|
59
|
+
EmailBodyValue,
|
|
60
|
+
EmailHeader,
|
|
61
|
+
JmapEmail,
|
|
62
|
+
JmapEmailExt,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
__all__ = [
|
|
66
|
+
# Wire-format pair
|
|
67
|
+
"parse_email",
|
|
68
|
+
"compose_email",
|
|
69
|
+
# Field-level parsers
|
|
70
|
+
"parse_address",
|
|
71
|
+
"parse_addresses",
|
|
72
|
+
"parse_date",
|
|
73
|
+
"decode_rfc2047_header",
|
|
74
|
+
# Formatters
|
|
75
|
+
"format_address",
|
|
76
|
+
"format_address_list",
|
|
77
|
+
# Validators
|
|
78
|
+
"is_valid_msg_id",
|
|
79
|
+
# Null-safe shape accessors
|
|
80
|
+
"first_address",
|
|
81
|
+
"first_address_email",
|
|
82
|
+
"first_address_name",
|
|
83
|
+
"first_msgid",
|
|
84
|
+
"msgid_chain",
|
|
85
|
+
"now_sent_at",
|
|
86
|
+
"sent_at_to_datetime",
|
|
87
|
+
"find_header",
|
|
88
|
+
"find_headers",
|
|
89
|
+
"has_header",
|
|
90
|
+
"body_part_text",
|
|
91
|
+
"body_text_joined",
|
|
92
|
+
# Per-call resource caps
|
|
93
|
+
"ParseLimits",
|
|
94
|
+
"DEFAULT_PARSE_LIMITS",
|
|
95
|
+
# Errors (compose-side only; parse_email returns None on failure)
|
|
96
|
+
"ComposeError",
|
|
97
|
+
"InvalidAddressError",
|
|
98
|
+
"InvalidMessageIdError",
|
|
99
|
+
"InvalidDateError",
|
|
100
|
+
"AttachmentError",
|
|
101
|
+
"HeaderInjectionError",
|
|
102
|
+
# JMAP RFC 8621 type shapes
|
|
103
|
+
"Attachment",
|
|
104
|
+
"EmailAddress",
|
|
105
|
+
"EmailBodyPart",
|
|
106
|
+
"EmailBodyValue",
|
|
107
|
+
"EmailHeader",
|
|
108
|
+
"JmapEmail",
|
|
109
|
+
"JmapEmailExt",
|
|
110
|
+
# Package version
|
|
111
|
+
"__version__",
|
|
112
|
+
]
|