imapflow 1.2.4 → 1.2.6
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +15 -0
- package/lib/commands/append.js +2 -7
- package/lib/commands/copy.js +2 -7
- package/lib/commands/create.js +8 -17
- package/lib/commands/delete.js +2 -7
- package/lib/commands/expunge.js +2 -7
- package/lib/commands/move.js +2 -7
- package/lib/commands/quota.js +2 -7
- package/lib/commands/rename.js +2 -7
- package/lib/commands/search.js +2 -7
- package/lib/commands/select.js +2 -6
- package/lib/commands/store.js +2 -7
- package/lib/commands/subscribe.js +2 -7
- package/lib/commands/unsubscribe.js +2 -8
- package/lib/imap-flow.d.ts +4 -2
- package/lib/imap-flow.js +68 -63
- package/lib/tools.js +26 -15
- package/package.json +5 -2
- package/test/commands-integration-test.js +8216 -0
- package/test/connection-edge-cases-test.js +518 -0
- package/test/jp-decoder-test.js +199 -0
- package/test/limited-passthrough-test.js +258 -0
- package/test/memory-leak-test.js +667 -0
- package/test/proxy-connection-test.js +541 -0
- package/test/search-compiler-test.js +820 -50
- package/test/tools-test.js +992 -0
package/lib/tools.js
CHANGED
|
@@ -115,6 +115,15 @@ const tools = {
|
|
|
115
115
|
return (await compiler(response)).toString();
|
|
116
116
|
},
|
|
117
117
|
|
|
118
|
+
async enhanceCommandError(err) {
|
|
119
|
+
let errorCode = tools.getStatusCode(err.response);
|
|
120
|
+
if (errorCode) {
|
|
121
|
+
err.serverResponseCode = errorCode;
|
|
122
|
+
}
|
|
123
|
+
err.response = await tools.getErrorText(err.response);
|
|
124
|
+
return err;
|
|
125
|
+
},
|
|
126
|
+
|
|
118
127
|
getFolderTree(folders) {
|
|
119
128
|
let tree = {
|
|
120
129
|
root: true,
|
|
@@ -758,38 +767,40 @@ const tools = {
|
|
|
758
767
|
return Object.prototype.toString.call(obj) === '[object Date]';
|
|
759
768
|
},
|
|
760
769
|
|
|
761
|
-
|
|
770
|
+
toValidDate(value) {
|
|
771
|
+
if (!value) {
|
|
772
|
+
return null;
|
|
773
|
+
}
|
|
762
774
|
if (typeof value === 'string') {
|
|
763
775
|
value = new Date(value);
|
|
764
776
|
}
|
|
777
|
+
if (!tools.isDate(value) || value.toString() === 'Invalid Date') {
|
|
778
|
+
return null;
|
|
779
|
+
}
|
|
780
|
+
return value;
|
|
781
|
+
},
|
|
765
782
|
|
|
766
|
-
|
|
783
|
+
formatDate(value) {
|
|
784
|
+
value = tools.toValidDate(value);
|
|
785
|
+
if (!value) {
|
|
767
786
|
return;
|
|
768
787
|
}
|
|
769
788
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
value.reverse();
|
|
789
|
+
let dateParts = value.toISOString().substr(0, 10).split('-');
|
|
790
|
+
dateParts.reverse();
|
|
773
791
|
|
|
774
792
|
let months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
775
|
-
|
|
793
|
+
dateParts[1] = months[Number(dateParts[1]) - 1];
|
|
776
794
|
|
|
777
|
-
return
|
|
795
|
+
return dateParts.join('-');
|
|
778
796
|
},
|
|
779
797
|
|
|
780
798
|
formatDateTime(value) {
|
|
799
|
+
value = tools.toValidDate(value);
|
|
781
800
|
if (!value) {
|
|
782
801
|
return;
|
|
783
802
|
}
|
|
784
803
|
|
|
785
|
-
if (typeof value === 'string') {
|
|
786
|
-
value = new Date(value);
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
if (Object.prototype.toString(value) !== '[object Object]' || value.toString() === 'Invalid Date') {
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
804
|
let dateStr = tools.formatDate(value).replace(/^0/, ' '); //starts with date-day-fixed with leading 0 replaced by SP
|
|
794
805
|
let timeStr = value.toISOString().substr(11, 8);
|
|
795
806
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imapflow",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "IMAP Client for Node",
|
|
5
5
|
"main": "lib/imap-flow.js",
|
|
6
6
|
"types": "lib/imap-flow.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "grunt",
|
|
9
|
+
"coverage": "c8 --reporter=text --reporter=html npx nodeunit test/*-test.js",
|
|
9
10
|
"prepare": "npm run build",
|
|
10
11
|
"docs": "rm -rf docs && mkdir -p docs && jsdoc lib/imap-flow.js -c jsdoc.json -R README.md --destination docs/ && cp assets/favicon.ico docs",
|
|
11
12
|
"build": "npm run docs",
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"@eslint/eslintrc": "3.3.3",
|
|
38
39
|
"@eslint/js": "9.39.2",
|
|
39
40
|
"@types/node": "25.0.3",
|
|
41
|
+
"c8": "10.1.3",
|
|
40
42
|
"eslint": "9.39.2",
|
|
41
43
|
"eslint-config-nodemailer": "1.2.0",
|
|
42
44
|
"eslint-config-prettier": "10.1.8",
|
|
@@ -47,16 +49,17 @@
|
|
|
47
49
|
"imapflow-jsdoc-template": "3.4.0-imapflow.3",
|
|
48
50
|
"jsdoc": "4.0.4",
|
|
49
51
|
"prettier": "3.7.4",
|
|
52
|
+
"proxyquire": "^2.1.3",
|
|
50
53
|
"st": "3.0.3",
|
|
51
54
|
"typescript": "5.9.3"
|
|
52
55
|
},
|
|
53
56
|
"dependencies": {
|
|
57
|
+
"@zone-eu/mailsplit": "5.4.8",
|
|
54
58
|
"encoding-japanese": "2.2.0",
|
|
55
59
|
"iconv-lite": "0.7.1",
|
|
56
60
|
"libbase64": "1.3.0",
|
|
57
61
|
"libmime": "5.3.7",
|
|
58
62
|
"libqp": "2.1.1",
|
|
59
|
-
"@zone-eu/mailsplit": "5.4.8",
|
|
60
63
|
"nodemailer": "7.0.12",
|
|
61
64
|
"pino": "10.1.0",
|
|
62
65
|
"socks": "2.8.7"
|