@mavogel/awscdk-rootmail 0.1.24 → 0.1.25
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.
- package/.jsii +3 -3
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@zone-eu/mailsplit/README.md +1 -1
- package/node_modules/@zone-eu/mailsplit/lib/headers.js +10 -4
- package/node_modules/@zone-eu/mailsplit/lib/message-splitter.js +5 -4
- package/node_modules/@zone-eu/mailsplit/lib/mime-node.d.ts +4 -1
- package/node_modules/@zone-eu/mailsplit/lib/mime-node.js +23 -2
- package/node_modules/@zone-eu/mailsplit/lib/types.d.ts +3 -1
- package/node_modules/@zone-eu/mailsplit/package.json +4 -4
- package/node_modules/libbase64/CHANGELOG.md +20 -0
- package/node_modules/libbase64/README.md +40 -13
- package/node_modules/libbase64/dist/cjs/libbase64.d.ts +80 -0
- package/node_modules/libbase64/dist/cjs/libbase64.js +310 -0
- package/node_modules/libbase64/dist/cjs/package.json +3 -0
- package/node_modules/libbase64/dist/esm/libbase64.d.ts +80 -0
- package/node_modules/libbase64/{lib → dist/esm}/libbase64.js +74 -117
- package/node_modules/libbase64/dist/esm/package.json +3 -0
- package/node_modules/libbase64/package.json +59 -13
- package/node_modules/libmime/CHANGELOG.md +31 -0
- package/node_modules/libmime/README.md +55 -26
- package/node_modules/libmime/SECURITY.md +152 -0
- package/node_modules/libmime/dist/cjs/charset.d.ts +43 -0
- package/node_modules/libmime/dist/cjs/charset.js +135 -0
- package/node_modules/libmime/dist/cjs/charsets.d.ts +2 -0
- package/node_modules/libmime/dist/cjs/charsets.js +213 -0
- package/node_modules/libmime/dist/cjs/get-charset-name.d.ts +1 -0
- package/node_modules/libmime/dist/cjs/get-charset-name.js +224 -0
- package/node_modules/libmime/dist/cjs/libmime.d.ts +218 -0
- package/node_modules/libmime/dist/cjs/libmime.js +1013 -0
- package/node_modules/libmime/dist/cjs/mimetypes.d.ts +7 -0
- package/node_modules/libmime/dist/cjs/mimetypes.js +2072 -0
- package/node_modules/libmime/dist/cjs/package.json +3 -0
- package/node_modules/libmime/dist/cjs/types.d.ts +59 -0
- package/node_modules/libmime/dist/cjs/types.js +4 -0
- package/node_modules/libmime/dist/esm/charset.d.ts +43 -0
- package/node_modules/libmime/dist/esm/charset.js +125 -0
- package/node_modules/libmime/dist/esm/charsets.d.ts +2 -0
- package/node_modules/libmime/{lib → dist/esm}/charsets.js +3 -5
- package/node_modules/libmime/dist/esm/get-charset-name.d.ts +1 -0
- package/node_modules/libmime/{lib → dist/esm}/get-charset-name.js +1 -8
- package/node_modules/libmime/dist/esm/libmime.d.ts +219 -0
- package/node_modules/libmime/{lib → dist/esm}/libmime.js +256 -329
- package/node_modules/libmime/dist/esm/mimetypes.d.ts +7 -0
- package/node_modules/libmime/dist/esm/mimetypes.js +2068 -0
- package/node_modules/libmime/dist/esm/package.json +3 -0
- package/node_modules/libmime/dist/esm/types.d.ts +59 -0
- package/node_modules/libmime/dist/esm/types.js +3 -0
- package/node_modules/libmime/package.json +58 -15
- package/node_modules/libqp/CHANGELOG.md +18 -0
- package/node_modules/libqp/README.md +50 -19
- package/node_modules/libqp/dist/cjs/libqp.d.ts +74 -0
- package/node_modules/libqp/dist/cjs/libqp.js +378 -0
- package/node_modules/libqp/dist/cjs/package.json +3 -0
- package/node_modules/libqp/dist/esm/libqp.d.ts +74 -0
- package/node_modules/libqp/dist/esm/libqp.js +369 -0
- package/node_modules/libqp/dist/esm/package.json +3 -0
- package/node_modules/libqp/lib/libqp.js +4 -383
- package/node_modules/libqp/lib/package.json +3 -0
- package/node_modules/libqp/package.json +62 -6
- package/node_modules/mailparser/.release-please-manifest.json +1 -1
- package/node_modules/mailparser/CHANGELOG.md +42 -0
- package/node_modules/mailparser/package.json +5 -5
- package/node_modules/nodemailer/CHANGELOG.md +44 -0
- package/node_modules/nodemailer/dist/cjs/addressparser/index.js +695 -267
- package/node_modules/nodemailer/dist/cjs/mailer/mail-message.js +4 -1
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +8 -2
- package/node_modules/nodemailer/dist/cjs/mime-node/index.js +48 -16
- package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
- package/node_modules/nodemailer/dist/cjs/shared/url.js +22 -5
- package/node_modules/nodemailer/dist/esm/addressparser/index.js +695 -267
- package/node_modules/nodemailer/dist/esm/mailer/mail-message.js +4 -1
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.js +8 -2
- package/node_modules/nodemailer/dist/esm/mime-node/index.js +48 -16
- package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
- package/node_modules/nodemailer/dist/esm/shared/url.js +22 -5
- package/node_modules/nodemailer/package.json +1 -1
- package/package.json +2 -2
- package/node_modules/libbase64/.eslintrc +0 -11
- package/node_modules/libbase64/.github/FUNDING.yml +0 -4
- package/node_modules/libbase64/.github/VULNERABILITY_REPORT.yml +0 -75
- package/node_modules/libbase64/.github/workflows/release.yaml +0 -39
- package/node_modules/libbase64/.github/workflows/test.yml +0 -21
- package/node_modules/libbase64/.ncurc.js +0 -13
- package/node_modules/libbase64/.prettierrc.js +0 -8
- package/node_modules/libmime/lib/charset.js +0 -131
- package/node_modules/libmime/lib/mimetypes.js +0 -2049
- package/node_modules/libqp/.eslintrc +0 -15
- package/node_modules/libqp/.github/FUNDING.yml +0 -4
- package/node_modules/libqp/.github/VULNERABILITY_REPORT.yml +0 -75
- package/node_modules/libqp/.github/workflows/release.yaml +0 -39
- package/node_modules/libqp/.github/workflows/test.yml +0 -21
- package/node_modules/libqp/.prettierrc.js +0 -8
- package/node_modules/libqp/test/libqp-test.js +0 -366
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Charset name aliases, keyed by the lowercased alias, mapped to the canonical name
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const charsets = {
|
|
5
|
+
'866': 'IBM866',
|
|
6
|
+
'unicode-1-1-utf-8': 'UTF-8',
|
|
7
|
+
'utf-8': 'UTF-8',
|
|
8
|
+
utf8: 'UTF-8',
|
|
9
|
+
cp866: 'IBM866',
|
|
10
|
+
csibm866: 'IBM866',
|
|
11
|
+
ibm866: 'IBM866',
|
|
12
|
+
csisolatin2: 'ISO-8859-2',
|
|
13
|
+
'iso-8859-2': 'ISO-8859-2',
|
|
14
|
+
'iso-ir-101': 'ISO-8859-2',
|
|
15
|
+
'iso8859-2': 'ISO-8859-2',
|
|
16
|
+
iso88592: 'ISO-8859-2',
|
|
17
|
+
'iso_8859-2': 'ISO-8859-2',
|
|
18
|
+
'iso_8859-2:1987': 'ISO-8859-2',
|
|
19
|
+
l2: 'ISO-8859-2',
|
|
20
|
+
latin2: 'ISO-8859-2',
|
|
21
|
+
csisolatin3: 'ISO-8859-3',
|
|
22
|
+
'iso-8859-3': 'ISO-8859-3',
|
|
23
|
+
'iso-ir-109': 'ISO-8859-3',
|
|
24
|
+
'iso8859-3': 'ISO-8859-3',
|
|
25
|
+
iso88593: 'ISO-8859-3',
|
|
26
|
+
'iso_8859-3': 'ISO-8859-3',
|
|
27
|
+
'iso_8859-3:1988': 'ISO-8859-3',
|
|
28
|
+
l3: 'ISO-8859-3',
|
|
29
|
+
latin3: 'ISO-8859-3',
|
|
30
|
+
csisolatin4: 'ISO-8859-4',
|
|
31
|
+
'iso-8859-4': 'ISO-8859-4',
|
|
32
|
+
'iso-ir-110': 'ISO-8859-4',
|
|
33
|
+
'iso8859-4': 'ISO-8859-4',
|
|
34
|
+
iso88594: 'ISO-8859-4',
|
|
35
|
+
'iso_8859-4': 'ISO-8859-4',
|
|
36
|
+
'iso_8859-4:1988': 'ISO-8859-4',
|
|
37
|
+
l4: 'ISO-8859-4',
|
|
38
|
+
latin4: 'ISO-8859-4',
|
|
39
|
+
csisolatincyrillic: 'ISO-8859-5',
|
|
40
|
+
cyrillic: 'ISO-8859-5',
|
|
41
|
+
'iso-8859-5': 'ISO-8859-5',
|
|
42
|
+
'iso-ir-144': 'ISO-8859-5',
|
|
43
|
+
'iso8859-5': 'ISO-8859-5',
|
|
44
|
+
iso88595: 'ISO-8859-5',
|
|
45
|
+
'iso_8859-5': 'ISO-8859-5',
|
|
46
|
+
'iso_8859-5:1988': 'ISO-8859-5',
|
|
47
|
+
arabic: 'ISO-8859-6',
|
|
48
|
+
'asmo-708': 'ISO-8859-6',
|
|
49
|
+
csiso88596e: 'ISO-8859-6',
|
|
50
|
+
csiso88596i: 'ISO-8859-6',
|
|
51
|
+
csisolatinarabic: 'ISO-8859-6',
|
|
52
|
+
'ecma-114': 'ISO-8859-6',
|
|
53
|
+
'iso-8859-6': 'ISO-8859-6',
|
|
54
|
+
'iso-8859-6-e': 'ISO-8859-6',
|
|
55
|
+
'iso-8859-6-i': 'ISO-8859-6',
|
|
56
|
+
'iso-ir-127': 'ISO-8859-6',
|
|
57
|
+
'iso8859-6': 'ISO-8859-6',
|
|
58
|
+
iso88596: 'ISO-8859-6',
|
|
59
|
+
'iso_8859-6': 'ISO-8859-6',
|
|
60
|
+
'iso_8859-6:1987': 'ISO-8859-6',
|
|
61
|
+
csisolatingreek: 'ISO-8859-7',
|
|
62
|
+
'ecma-118': 'ISO-8859-7',
|
|
63
|
+
elot_928: 'ISO-8859-7',
|
|
64
|
+
greek: 'ISO-8859-7',
|
|
65
|
+
greek8: 'ISO-8859-7',
|
|
66
|
+
'iso-8859-7': 'ISO-8859-7',
|
|
67
|
+
'iso-ir-126': 'ISO-8859-7',
|
|
68
|
+
'iso8859-7': 'ISO-8859-7',
|
|
69
|
+
iso88597: 'ISO-8859-7',
|
|
70
|
+
'iso_8859-7': 'ISO-8859-7',
|
|
71
|
+
'iso_8859-7:1987': 'ISO-8859-7',
|
|
72
|
+
sun_eu_greek: 'ISO-8859-7',
|
|
73
|
+
csiso88598e: 'ISO-8859-8',
|
|
74
|
+
csisolatinhebrew: 'ISO-8859-8',
|
|
75
|
+
hebrew: 'ISO-8859-8',
|
|
76
|
+
'iso-8859-8': 'ISO-8859-8',
|
|
77
|
+
'iso-8859-8-e': 'ISO-8859-8',
|
|
78
|
+
'iso-8859-8-i': 'ISO-8859-8',
|
|
79
|
+
'iso-ir-138': 'ISO-8859-8',
|
|
80
|
+
'iso8859-8': 'ISO-8859-8',
|
|
81
|
+
iso88598: 'ISO-8859-8',
|
|
82
|
+
'iso_8859-8': 'ISO-8859-8',
|
|
83
|
+
'iso_8859-8:1988': 'ISO-8859-8',
|
|
84
|
+
visual: 'ISO-8859-8',
|
|
85
|
+
csisolatin6: 'ISO-8859-10',
|
|
86
|
+
'iso-8859-10': 'ISO-8859-10',
|
|
87
|
+
'iso-ir-157': 'ISO-8859-10',
|
|
88
|
+
'iso8859-10': 'ISO-8859-10',
|
|
89
|
+
iso885910: 'ISO-8859-10',
|
|
90
|
+
l6: 'ISO-8859-10',
|
|
91
|
+
latin6: 'ISO-8859-10',
|
|
92
|
+
'iso-8859-13': 'ISO-8859-13',
|
|
93
|
+
'iso8859-13': 'ISO-8859-13',
|
|
94
|
+
iso885913: 'ISO-8859-13',
|
|
95
|
+
'iso-8859-14': 'ISO-8859-14',
|
|
96
|
+
'iso8859-14': 'ISO-8859-14',
|
|
97
|
+
iso885914: 'ISO-8859-14',
|
|
98
|
+
csisolatin9: 'ISO-8859-15',
|
|
99
|
+
'iso-8859-15': 'ISO-8859-15',
|
|
100
|
+
'iso8859-15': 'ISO-8859-15',
|
|
101
|
+
iso885915: 'ISO-8859-15',
|
|
102
|
+
'iso_8859-15': 'ISO-8859-15',
|
|
103
|
+
l9: 'ISO-8859-15',
|
|
104
|
+
'iso-8859-16': 'ISO-8859-16',
|
|
105
|
+
cskoi8r: 'KOI8-R',
|
|
106
|
+
koi: 'KOI8-R',
|
|
107
|
+
koi8: 'KOI8-R',
|
|
108
|
+
'koi8-r': 'KOI8-R',
|
|
109
|
+
koi8_r: 'KOI8-R',
|
|
110
|
+
'koi8-ru': 'KOI8-U',
|
|
111
|
+
'koi8-u': 'KOI8-U',
|
|
112
|
+
csmacintosh: 'macintosh',
|
|
113
|
+
mac: 'macintosh',
|
|
114
|
+
macintosh: 'macintosh',
|
|
115
|
+
'x-mac-roman': 'macintosh',
|
|
116
|
+
'dos-874': 'windows-874',
|
|
117
|
+
'iso-8859-11': 'windows-874',
|
|
118
|
+
'iso8859-11': 'windows-874',
|
|
119
|
+
iso885911: 'windows-874',
|
|
120
|
+
'tis-620': 'windows-874',
|
|
121
|
+
'windows-874': 'windows-874',
|
|
122
|
+
cp1250: 'windows-1250',
|
|
123
|
+
'windows-1250': 'windows-1250',
|
|
124
|
+
'x-cp1250': 'windows-1250',
|
|
125
|
+
cp1251: 'windows-1251',
|
|
126
|
+
'windows-1251': 'windows-1251',
|
|
127
|
+
'x-cp1251': 'windows-1251',
|
|
128
|
+
'ansi_x3.4-1968': 'windows-1252',
|
|
129
|
+
ascii: 'windows-1252',
|
|
130
|
+
cp1252: 'windows-1252',
|
|
131
|
+
cp819: 'windows-1252',
|
|
132
|
+
csisolatin1: 'windows-1252',
|
|
133
|
+
ibm819: 'windows-1252',
|
|
134
|
+
'iso-8859-1': 'windows-1252',
|
|
135
|
+
'iso-ir-100': 'windows-1252',
|
|
136
|
+
'iso8859-1': 'windows-1252',
|
|
137
|
+
iso88591: 'windows-1252',
|
|
138
|
+
'iso_8859-1': 'windows-1252',
|
|
139
|
+
'iso_8859-1:1987': 'windows-1252',
|
|
140
|
+
l1: 'windows-1252',
|
|
141
|
+
latin1: 'windows-1252',
|
|
142
|
+
'us-ascii': 'windows-1252',
|
|
143
|
+
'windows-1252': 'windows-1252',
|
|
144
|
+
'x-cp1252': 'windows-1252',
|
|
145
|
+
cp1253: 'windows-1253',
|
|
146
|
+
'windows-1253': 'windows-1253',
|
|
147
|
+
'x-cp1253': 'windows-1253',
|
|
148
|
+
cp1254: 'windows-1254',
|
|
149
|
+
csisolatin5: 'windows-1254',
|
|
150
|
+
'iso-8859-9': 'windows-1254',
|
|
151
|
+
'iso-ir-148': 'windows-1254',
|
|
152
|
+
'iso8859-9': 'windows-1254',
|
|
153
|
+
iso88599: 'windows-1254',
|
|
154
|
+
'iso_8859-9': 'windows-1254',
|
|
155
|
+
'iso_8859-9:1989': 'windows-1254',
|
|
156
|
+
l5: 'windows-1254',
|
|
157
|
+
latin5: 'windows-1254',
|
|
158
|
+
'windows-1254': 'windows-1254',
|
|
159
|
+
'x-cp1254': 'windows-1254',
|
|
160
|
+
cp1255: 'windows-1255',
|
|
161
|
+
'windows-1255': 'windows-1255',
|
|
162
|
+
'x-cp1255': 'windows-1255',
|
|
163
|
+
cp1256: 'windows-1256',
|
|
164
|
+
'windows-1256': 'windows-1256',
|
|
165
|
+
'x-cp1256': 'windows-1256',
|
|
166
|
+
cp1257: 'windows-1257',
|
|
167
|
+
'windows-1257': 'windows-1257',
|
|
168
|
+
'x-cp1257': 'windows-1257',
|
|
169
|
+
cp1258: 'windows-1258',
|
|
170
|
+
'windows-1258': 'windows-1258',
|
|
171
|
+
'x-cp1258': 'windows-1258',
|
|
172
|
+
chinese: 'GBK',
|
|
173
|
+
csgb2312: 'GBK',
|
|
174
|
+
csiso58gb231280: 'GBK',
|
|
175
|
+
gb2312: 'GBK',
|
|
176
|
+
gb_2312: 'GBK',
|
|
177
|
+
'gb_2312-80': 'GBK',
|
|
178
|
+
gbk: 'GBK',
|
|
179
|
+
'iso-ir-58': 'GBK',
|
|
180
|
+
'x-gbk': 'GBK',
|
|
181
|
+
gb18030: 'gb18030',
|
|
182
|
+
big5: 'Big5',
|
|
183
|
+
'big5-hkscs': 'Big5',
|
|
184
|
+
'cn-big5': 'Big5',
|
|
185
|
+
csbig5: 'Big5',
|
|
186
|
+
'x-x-big5': 'Big5',
|
|
187
|
+
cseucpkdfmtjapanese: 'EUC-JP',
|
|
188
|
+
'euc-jp': 'EUC-JP',
|
|
189
|
+
'x-euc-jp': 'EUC-JP',
|
|
190
|
+
csshiftjis: 'Shift_JIS',
|
|
191
|
+
ms932: 'Shift_JIS',
|
|
192
|
+
ms_kanji: 'Shift_JIS',
|
|
193
|
+
'shift-jis': 'Shift_JIS',
|
|
194
|
+
shift_jis: 'Shift_JIS',
|
|
195
|
+
sjis: 'Shift_JIS',
|
|
196
|
+
'windows-31j': 'Shift_JIS',
|
|
197
|
+
'x-sjis': 'Shift_JIS',
|
|
198
|
+
cseuckr: 'EUC-KR',
|
|
199
|
+
csksc56011987: 'EUC-KR',
|
|
200
|
+
'euc-kr': 'EUC-KR',
|
|
201
|
+
'iso-ir-149': 'EUC-KR',
|
|
202
|
+
korean: 'EUC-KR',
|
|
203
|
+
'ks_c_5601-1987': 'EUC-KR',
|
|
204
|
+
'ks_c_5601-1989': 'EUC-KR',
|
|
205
|
+
ksc5601: 'EUC-KR',
|
|
206
|
+
ksc_5601: 'EUC-KR',
|
|
207
|
+
'windows-949': 'EUC-KR',
|
|
208
|
+
'utf-16be': 'UTF-16BE',
|
|
209
|
+
'utf-16': 'UTF-16LE',
|
|
210
|
+
'utf-16le': 'UTF-16LE'
|
|
211
|
+
};
|
|
212
|
+
exports.default = charsets;
|
|
213
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCharsetName: (charset: unknown) => string | false;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCharsetName = void 0;
|
|
4
|
+
// https://nodejs.org/api/util.html#encodings-supported-by-default-with-full-icu-data
|
|
5
|
+
// NB! iso-8859-16 not supported
|
|
6
|
+
const CHARSETS = [
|
|
7
|
+
'866',
|
|
8
|
+
'ansi_x3.4-1968',
|
|
9
|
+
'arabic',
|
|
10
|
+
'ascii',
|
|
11
|
+
'asmo-708',
|
|
12
|
+
'big5',
|
|
13
|
+
'big5-hkscs',
|
|
14
|
+
'chinese',
|
|
15
|
+
'cn-big5',
|
|
16
|
+
'cp1250',
|
|
17
|
+
'cp1251',
|
|
18
|
+
'cp1252',
|
|
19
|
+
'cp1253',
|
|
20
|
+
'cp1254',
|
|
21
|
+
'cp1255',
|
|
22
|
+
'cp1256',
|
|
23
|
+
'cp1257',
|
|
24
|
+
'cp1258',
|
|
25
|
+
'cp819',
|
|
26
|
+
'cp866',
|
|
27
|
+
'csbig5',
|
|
28
|
+
'cseuckr',
|
|
29
|
+
'cseucpkdfmtjapanese',
|
|
30
|
+
'csgb2312',
|
|
31
|
+
'csibm866',
|
|
32
|
+
'csiso2022jp',
|
|
33
|
+
'csiso58gb231280',
|
|
34
|
+
'csiso88596e',
|
|
35
|
+
'csiso88596i',
|
|
36
|
+
'csiso88598e',
|
|
37
|
+
'csiso88598i',
|
|
38
|
+
'csisolatin1',
|
|
39
|
+
'csisolatin2',
|
|
40
|
+
'csisolatin3',
|
|
41
|
+
'csisolatin4',
|
|
42
|
+
'csisolatin5',
|
|
43
|
+
'csisolatin6',
|
|
44
|
+
'csisolatin9',
|
|
45
|
+
'csisolatinarabic',
|
|
46
|
+
'csisolatincyrillic',
|
|
47
|
+
'csisolatingreek',
|
|
48
|
+
'csisolatinhebrew',
|
|
49
|
+
'cskoi8r',
|
|
50
|
+
'csksc56011987',
|
|
51
|
+
'csmacintosh',
|
|
52
|
+
'csshiftjis',
|
|
53
|
+
'cyrillic',
|
|
54
|
+
'dos-874',
|
|
55
|
+
'ecma-114',
|
|
56
|
+
'ecma-118',
|
|
57
|
+
'elot_928',
|
|
58
|
+
'euc-jp',
|
|
59
|
+
'euc-kr',
|
|
60
|
+
'gb18030',
|
|
61
|
+
'gb2312',
|
|
62
|
+
'gb_2312',
|
|
63
|
+
'gb_2312-80',
|
|
64
|
+
'gbk',
|
|
65
|
+
'greek',
|
|
66
|
+
'greek8',
|
|
67
|
+
'hebrew',
|
|
68
|
+
'ibm819',
|
|
69
|
+
'ibm866',
|
|
70
|
+
'iso-2022-jp',
|
|
71
|
+
'iso-8859-1',
|
|
72
|
+
'iso8859-1',
|
|
73
|
+
'iso88591',
|
|
74
|
+
'iso_8859-1',
|
|
75
|
+
'iso_8859-1:1987',
|
|
76
|
+
'iso-8859-10',
|
|
77
|
+
'iso8859-10',
|
|
78
|
+
'iso885910',
|
|
79
|
+
'iso-8859-11',
|
|
80
|
+
'iso8859-11',
|
|
81
|
+
'iso885911',
|
|
82
|
+
'iso-8859-13',
|
|
83
|
+
'iso8859-13',
|
|
84
|
+
'iso885913',
|
|
85
|
+
'iso-8859-14',
|
|
86
|
+
'iso8859-14',
|
|
87
|
+
'iso885914',
|
|
88
|
+
'iso-8859-15',
|
|
89
|
+
'iso8859-15',
|
|
90
|
+
'iso885915',
|
|
91
|
+
'iso_8859-15',
|
|
92
|
+
'iso-8859-2',
|
|
93
|
+
'iso8859-2',
|
|
94
|
+
'iso88592',
|
|
95
|
+
'iso_8859-2',
|
|
96
|
+
'iso_8859-2:1987',
|
|
97
|
+
'iso-8859-3',
|
|
98
|
+
'iso8859-3',
|
|
99
|
+
'iso88593',
|
|
100
|
+
'iso_8859-3',
|
|
101
|
+
'iso_8859-3:1988',
|
|
102
|
+
'iso-8859-4',
|
|
103
|
+
'iso8859-4',
|
|
104
|
+
'iso88594',
|
|
105
|
+
'iso_8859-4',
|
|
106
|
+
'iso_8859-4:1988',
|
|
107
|
+
'iso-8859-5',
|
|
108
|
+
'iso8859-5',
|
|
109
|
+
'iso88595',
|
|
110
|
+
'iso_8859-5',
|
|
111
|
+
'iso_8859-5:1988',
|
|
112
|
+
'iso-8859-6',
|
|
113
|
+
'iso8859-6',
|
|
114
|
+
'iso88596',
|
|
115
|
+
'iso_8859-6',
|
|
116
|
+
'iso_8859-6:1987',
|
|
117
|
+
'iso-8859-6-e',
|
|
118
|
+
'iso-8859-6-i',
|
|
119
|
+
'iso-8859-7',
|
|
120
|
+
'iso8859-7',
|
|
121
|
+
'iso88597',
|
|
122
|
+
'iso_8859-7',
|
|
123
|
+
'iso_8859-7:1987',
|
|
124
|
+
'iso-8859-8',
|
|
125
|
+
'iso8859-8',
|
|
126
|
+
'iso88598',
|
|
127
|
+
'iso_8859-8',
|
|
128
|
+
'iso_8859-8:1988',
|
|
129
|
+
'iso-8859-8-e',
|
|
130
|
+
'iso-8859-8-i',
|
|
131
|
+
'iso-8859-9',
|
|
132
|
+
'iso8859-9',
|
|
133
|
+
'iso88599',
|
|
134
|
+
'iso_8859-9',
|
|
135
|
+
'iso_8859-9:1989',
|
|
136
|
+
'iso-ir-100',
|
|
137
|
+
'iso-ir-101',
|
|
138
|
+
'iso-ir-109',
|
|
139
|
+
'iso-ir-110',
|
|
140
|
+
'iso-ir-126',
|
|
141
|
+
'iso-ir-127',
|
|
142
|
+
'iso-ir-138',
|
|
143
|
+
'iso-ir-144',
|
|
144
|
+
'iso-ir-148',
|
|
145
|
+
'iso-ir-149',
|
|
146
|
+
'iso-ir-157',
|
|
147
|
+
'iso-ir-58',
|
|
148
|
+
'koi',
|
|
149
|
+
'koi8',
|
|
150
|
+
'koi8-r',
|
|
151
|
+
'koi8_r',
|
|
152
|
+
'koi8-ru',
|
|
153
|
+
'koi8-u',
|
|
154
|
+
'korean',
|
|
155
|
+
'ksc5601',
|
|
156
|
+
'ksc_5601',
|
|
157
|
+
'ks_c_5601-1987',
|
|
158
|
+
'ks_c_5601-1989',
|
|
159
|
+
'l1',
|
|
160
|
+
'l2',
|
|
161
|
+
'l3',
|
|
162
|
+
'l4',
|
|
163
|
+
'l5',
|
|
164
|
+
'l6',
|
|
165
|
+
'l9',
|
|
166
|
+
'latin1',
|
|
167
|
+
'latin2',
|
|
168
|
+
'latin3',
|
|
169
|
+
'latin4',
|
|
170
|
+
'latin5',
|
|
171
|
+
'latin6',
|
|
172
|
+
'logical',
|
|
173
|
+
'mac',
|
|
174
|
+
'macintosh',
|
|
175
|
+
'ms932',
|
|
176
|
+
'ms_kanji',
|
|
177
|
+
'shift_jis',
|
|
178
|
+
'shift-jis',
|
|
179
|
+
'sjis',
|
|
180
|
+
'sun_eu_greek',
|
|
181
|
+
'tis-620',
|
|
182
|
+
'unicode-1-1-utf-8',
|
|
183
|
+
'us-ascii',
|
|
184
|
+
'utf-16',
|
|
185
|
+
'utf-16be',
|
|
186
|
+
'utf-16le',
|
|
187
|
+
'utf-8',
|
|
188
|
+
'utf8',
|
|
189
|
+
'visual',
|
|
190
|
+
'windows-1250',
|
|
191
|
+
'windows-1251',
|
|
192
|
+
'windows-1252',
|
|
193
|
+
'windows-1253',
|
|
194
|
+
'windows-1254',
|
|
195
|
+
'windows-1255',
|
|
196
|
+
'windows-1256',
|
|
197
|
+
'windows-1257',
|
|
198
|
+
'windows-1258',
|
|
199
|
+
'windows-31j',
|
|
200
|
+
'windows-874',
|
|
201
|
+
'windows-949',
|
|
202
|
+
'x-cp1250',
|
|
203
|
+
'x-cp1251',
|
|
204
|
+
'x-cp1252',
|
|
205
|
+
'x-cp1253',
|
|
206
|
+
'x-cp1254',
|
|
207
|
+
'x-cp1255',
|
|
208
|
+
'x-cp1256',
|
|
209
|
+
'x-cp1257',
|
|
210
|
+
'x-cp1258',
|
|
211
|
+
'x-euc-jp',
|
|
212
|
+
'x-gbk',
|
|
213
|
+
'x-mac-cyrillic',
|
|
214
|
+
'x-mac-roman',
|
|
215
|
+
'x-mac-ukrainian',
|
|
216
|
+
'x-sjis',
|
|
217
|
+
'x-x-big5'
|
|
218
|
+
];
|
|
219
|
+
const CHARSET_MAP = new Map(CHARSETS.map(charset => [charset.replace(/[-_]+/g, ''), charset]));
|
|
220
|
+
const getCharsetName = (charset) => {
|
|
221
|
+
let charsetKey = (charset || '').toString().toLowerCase().trim().replace(/[-_]+/g, '');
|
|
222
|
+
return CHARSET_MAP.get(charsetKey) || false;
|
|
223
|
+
};
|
|
224
|
+
exports.getCharsetName = getCharsetName;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import type { HeaderLine, HeaderObject, HeaderParam, LibmimeConfig, ParsedHeaderValue, StructuredHeaderValue } from './types.js';
|
|
3
|
+
import type * as types from './types.js';
|
|
4
|
+
declare class Libmime {
|
|
5
|
+
config: LibmimeConfig;
|
|
6
|
+
constructor(config?: LibmimeConfig);
|
|
7
|
+
/**
|
|
8
|
+
* Checks if a value is plaintext string (uses only printable 7bit chars)
|
|
9
|
+
*
|
|
10
|
+
* When isParam is set the value is destined for a header parameter, so HT, CR and LF
|
|
11
|
+
* are not plaintext either: a header parameter has no way to carry them. HT is a valid
|
|
12
|
+
* fold point, so folding and unfolding a header would rewrite it as a space, and CR/LF
|
|
13
|
+
* cannot appear in a header value at all. DEL is neither a token character nor qtext,
|
|
14
|
+
* so it can not be carried bare or quoted. Such values have to go through the rfc2231
|
|
15
|
+
* parameter continuation encoding instead, the same way non-ASCII text does.
|
|
16
|
+
*
|
|
17
|
+
* @param {String} value String to be tested
|
|
18
|
+
* @param {Boolean} [isParam] Set to true if the value is a header parameter value
|
|
19
|
+
* @returns {Boolean} true if it is a plaintext string
|
|
20
|
+
*/
|
|
21
|
+
isPlainText(value: unknown, isParam?: boolean): boolean;
|
|
22
|
+
private isPlainParamValue;
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a multi line string containes lines longer than the selected value.
|
|
25
|
+
*
|
|
26
|
+
* Useful when detecting if a mail message needs any processing at all:
|
|
27
|
+
* if only plaintext characters are used and lines are short, then there is
|
|
28
|
+
* no need to encode the values in any way. If the value is plaintext but has
|
|
29
|
+
* longer lines then allowed, then use format=flowed
|
|
30
|
+
*
|
|
31
|
+
* @param {String} str String to be tested
|
|
32
|
+
* @param {Number} lineLength Max line length to check for
|
|
33
|
+
* @returns {Boolean} Returns true if there is at least one line longer than lineLength chars
|
|
34
|
+
*/
|
|
35
|
+
hasLongerLines(str: string, lineLength: number): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Decodes a string from a format=flowed soft wrapping.
|
|
38
|
+
*
|
|
39
|
+
* @param {String} str Plaintext string with format=flowed to decode
|
|
40
|
+
* @param {Boolean} [delSp] If true, delete leading spaces (delsp=yes)
|
|
41
|
+
* @return {String} Mime decoded string
|
|
42
|
+
*/
|
|
43
|
+
decodeFlowed(input: unknown, delSp?: boolean): string;
|
|
44
|
+
/**
|
|
45
|
+
* Adds soft line breaks to content marked with format=flowed to
|
|
46
|
+
* ensure that no line in the message is never longer than lineLength
|
|
47
|
+
*
|
|
48
|
+
* @param {String} str Plaintext string that requires wrapping
|
|
49
|
+
* @param {Number} [lineLength=76] Maximum length of a line
|
|
50
|
+
* @return {String} String with forced line breaks
|
|
51
|
+
*/
|
|
52
|
+
encodeFlowed(str: string, lineLength?: number): string;
|
|
53
|
+
/**
|
|
54
|
+
* Encodes a string or an Buffer to an UTF-8 MIME Word (rfc2047)
|
|
55
|
+
*
|
|
56
|
+
* @param {String|Buffer} data String to be encoded
|
|
57
|
+
* @param {String} mimeWordEncoding='Q' Encoding for the mime word, either Q or B
|
|
58
|
+
* @param {Number} [maxLength=0] If set, split mime words into several chunks if needed
|
|
59
|
+
* @return {String} Single or several mime words joined together
|
|
60
|
+
*/
|
|
61
|
+
encodeWord(data: string | Buffer, mimeWordEncoding?: string, maxLength?: number): string;
|
|
62
|
+
/**
|
|
63
|
+
* Normalizes a charset name to its canonical form, resolving common aliases and
|
|
64
|
+
* invalid names. For example `iso-8859-8-i` and `iso-8859-8-e` become `ISO-8859-8`
|
|
65
|
+
* and `win-1257` becomes `windows-1257`. Unknown charsets are returned uppercased.
|
|
66
|
+
* Missing or non-string input defaults to `UTF-8`.
|
|
67
|
+
*
|
|
68
|
+
* @param {String} charset Charset name to normalize
|
|
69
|
+
* @return {String} Canonical charset name
|
|
70
|
+
*/
|
|
71
|
+
normalizeCharset(charset?: unknown): string;
|
|
72
|
+
/**
|
|
73
|
+
* Decodes the inner payload of a single mime encoded-word into a unicode string.
|
|
74
|
+
* Expects the three components of `=?charset?encoding?text?=` already separated.
|
|
75
|
+
*
|
|
76
|
+
* @param {String} charset Charset name from the encoded-word (may include an RFC 2231 language tag, which is ignored)
|
|
77
|
+
* @param {String} encoding Encoding indicator, either 'Q' or 'B' (case insensitive)
|
|
78
|
+
* @param {String} str Encoded payload between the second `?` and the trailing `?=`
|
|
79
|
+
* @return {String} Decoded unicode string
|
|
80
|
+
*/
|
|
81
|
+
decodeWord(charset: string, encoding: string, str: string): string;
|
|
82
|
+
/**
|
|
83
|
+
* Finds word sequences with non ascii text and converts these to mime words
|
|
84
|
+
*
|
|
85
|
+
* @param {String|Buffer} data String to be encoded
|
|
86
|
+
* @param {String} mimeWordEncoding='Q' Encoding for the mime word, either Q or B
|
|
87
|
+
* @param {Number} [maxLength=0] If set, split mime words into several chunks if needed
|
|
88
|
+
* @param {String} [fromCharset='UTF-8'] Source character set
|
|
89
|
+
* @return {String} String with possible mime words
|
|
90
|
+
*/
|
|
91
|
+
encodeWords(data: string | Buffer, mimeWordEncoding?: string, maxLength?: number | string, fromCharset?: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* Decode a string that might include one or several mime words
|
|
94
|
+
*
|
|
95
|
+
* @param {String} str String including some mime words that will be decoded
|
|
96
|
+
* @return {String} Decoded unicode string
|
|
97
|
+
*/
|
|
98
|
+
decodeWords(str: unknown): string;
|
|
99
|
+
getHex(c: number | undefined): string | false;
|
|
100
|
+
/**
|
|
101
|
+
* Splits a string by :
|
|
102
|
+
* The result is not mime word decoded, you need to do your own decoding based
|
|
103
|
+
* on the rules for the specific header key
|
|
104
|
+
*
|
|
105
|
+
* @param {String} headerLine Single header line, might include linebreaks as well if folded
|
|
106
|
+
* @return {Object} An object of {key, value}
|
|
107
|
+
*/
|
|
108
|
+
decodeHeader(headerLine: unknown): HeaderLine;
|
|
109
|
+
/**
|
|
110
|
+
* Parses a block of header lines. Does not decode mime words as every
|
|
111
|
+
* header might have its own rules (eg. formatted email addresses and such)
|
|
112
|
+
*
|
|
113
|
+
* @param {String} headers Headers string
|
|
114
|
+
* @return {Object} An object of headers, where header keys are object keys and every value is an Array of the values for that key
|
|
115
|
+
*/
|
|
116
|
+
decodeHeaders(headers: string): HeaderObject;
|
|
117
|
+
/**
|
|
118
|
+
* Joins parsed header value together as 'value; param1=value1; param2=value2'
|
|
119
|
+
* PS: We are following RFC 822 for the list of special characters that we need to keep in quotes.
|
|
120
|
+
* Refer: https://www.w3.org/Protocols/rfc1341/4_Content-Type.html
|
|
121
|
+
* @param {Object} structured Parsed header value
|
|
122
|
+
* @return {String} joined header value
|
|
123
|
+
*/
|
|
124
|
+
buildHeaderValue(structured: StructuredHeaderValue): string;
|
|
125
|
+
/**
|
|
126
|
+
* Parses a header value with key=value arguments into a structured
|
|
127
|
+
* object.
|
|
128
|
+
*
|
|
129
|
+
* parseHeaderValue('text/plain; CHARSET=UTF-8') ->
|
|
130
|
+
* {
|
|
131
|
+
* 'value': 'text/plain',
|
|
132
|
+
* 'params': {
|
|
133
|
+
* 'charset': 'UTF-8'
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
*
|
|
137
|
+
* The result also carries a non-enumerable `decodedParams` array that names the params
|
|
138
|
+
* assembled from rfc2231 segments (title*=, title*0*=, title*0=). Those values are already
|
|
139
|
+
* decoded, so a caller that runs decodeWords() over the params has to leave them out
|
|
140
|
+
*
|
|
141
|
+
* @param {String} str Header value
|
|
142
|
+
* @return {Object} Header value as a parsed structure
|
|
143
|
+
*/
|
|
144
|
+
parseHeaderValue(str: string): ParsedHeaderValue;
|
|
145
|
+
/**
|
|
146
|
+
* Encodes a string or an Buffer to an UTF-8 Parameter Value Continuation encoding (rfc2231)
|
|
147
|
+
* Useful for splitting long parameter values.
|
|
148
|
+
*
|
|
149
|
+
* For example
|
|
150
|
+
* title="unicode string"
|
|
151
|
+
* becomes
|
|
152
|
+
* title*0*=utf-8''unicode
|
|
153
|
+
* title*1*=%20string
|
|
154
|
+
*
|
|
155
|
+
* @param {String} key Parameter name (eg. 'filename')
|
|
156
|
+
* @param {String|Buffer} data String to be encoded
|
|
157
|
+
* @param {Number} [maxLength=50] Max length for generated chunks
|
|
158
|
+
* @param {String} [fromCharset='UTF-8'] Source character set
|
|
159
|
+
* @return {Array} A list of encoded keys and headers
|
|
160
|
+
*/
|
|
161
|
+
buildHeaderParam(key: string, data: unknown, maxLength?: number, fromCharset?: string): HeaderParam[];
|
|
162
|
+
/**
|
|
163
|
+
* Returns file extension for a content type string. If no suitable extensions
|
|
164
|
+
* are found, 'bin' is used as the default extension
|
|
165
|
+
*
|
|
166
|
+
* @param {String} mimeType Content type to be checked for
|
|
167
|
+
* @return {String} File extension
|
|
168
|
+
*/
|
|
169
|
+
detectExtension(input: unknown): string;
|
|
170
|
+
/**
|
|
171
|
+
* Returns content type for a file extension. If no suitable content types
|
|
172
|
+
* are found, 'application/octet-stream' is used as the default content type
|
|
173
|
+
*
|
|
174
|
+
* @param {String} extension Extension (or filename) to be checked for
|
|
175
|
+
* @return {String} Content type
|
|
176
|
+
*/
|
|
177
|
+
detectMimeType(input: unknown): string;
|
|
178
|
+
/**
|
|
179
|
+
* Folds long lines, useful for folding header lines (afterSpace=false) and
|
|
180
|
+
* flowed text (afterSpace=true)
|
|
181
|
+
*
|
|
182
|
+
* @param {String} str String to be folded
|
|
183
|
+
* @param {Number} [lineLength=76] Maximum length of a line
|
|
184
|
+
* @param {Boolean} afterSpace If true, leave a space in the end of a line
|
|
185
|
+
* @return {String} String with folded lines
|
|
186
|
+
*/
|
|
187
|
+
foldLines(input: unknown, lineLength?: number, afterSpace?: boolean): string;
|
|
188
|
+
/**
|
|
189
|
+
* Splits a mime encoded string. Needed for dividing mime words into smaller chunks
|
|
190
|
+
*
|
|
191
|
+
* @param {String} str Mime encoded string to be split up
|
|
192
|
+
* @param {Number} maxlen Maximum length of characters for one part (minimum 12)
|
|
193
|
+
* @return {Array} Split string
|
|
194
|
+
*/
|
|
195
|
+
splitMimeEncodedString(str: string, maxlen?: number): string[];
|
|
196
|
+
encodeURICharComponent(chr: string): string;
|
|
197
|
+
safeEncodeURIComponent(input: unknown): string;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The shared instance, the default export of the package. The class is attached to it as `Libmime`,
|
|
201
|
+
* so `require('libmime').Libmime` keeps working
|
|
202
|
+
*/
|
|
203
|
+
declare const libmime: Libmime & {
|
|
204
|
+
Libmime: typeof Libmime;
|
|
205
|
+
};
|
|
206
|
+
type LibmimeInstance = Libmime;
|
|
207
|
+
declare namespace libmime {
|
|
208
|
+
type Libmime = LibmimeInstance;
|
|
209
|
+
type HeaderLine = types.HeaderLine;
|
|
210
|
+
type HeaderObject = types.HeaderObject;
|
|
211
|
+
type HeaderParam = types.HeaderParam;
|
|
212
|
+
type LibmimeConfig = types.LibmimeConfig;
|
|
213
|
+
type MimeWordEncoding = types.MimeWordEncoding;
|
|
214
|
+
type ParsedHeaderValue = types.ParsedHeaderValue;
|
|
215
|
+
type StructuredHeader = types.StructuredHeader;
|
|
216
|
+
type StructuredHeaderValue = types.StructuredHeaderValue;
|
|
217
|
+
}
|
|
218
|
+
export = libmime;
|