imapflow 1.0.161 → 1.0.163
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/CHANGELOG.md +15 -0
- package/lib/commands/idle.js +6 -4
- package/lib/handler/token-parser.js +10 -4
- package/lib/imap-flow.js +3 -15
- package/lib/tools.js +4 -1
- package/package.json +8 -8
- package/test/imap-parser-test.js +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.163](https://github.com/postalsys/imapflow/compare/v1.0.162...v1.0.163) (2024-07-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **parser:** parse subfolders with square brackets ([0d0e8a6](https://github.com/postalsys/imapflow/commit/0d0e8a6ea379adf11594684d49a1ce5031339939))
|
|
9
|
+
* **socket:** Use destroy() instead of destroySoon() ([830c2d1](https://github.com/postalsys/imapflow/commit/830c2d18f3d27eb12dc6babe4edd37fed5f65490))
|
|
10
|
+
|
|
11
|
+
## [1.0.162](https://github.com/postalsys/imapflow/compare/v1.0.161...v1.0.162) (2024-05-07)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **idle:** Do not clear preCheck from other command ([cdf7643](https://github.com/postalsys/imapflow/commit/cdf7643952c975556e11a03ceca85f8a57fe1420))
|
|
17
|
+
|
|
3
18
|
## [1.0.161](https://github.com/postalsys/imapflow/compare/v1.0.160...v1.0.161) (2024-05-06)
|
|
4
19
|
|
|
5
20
|
|
package/lib/commands/idle.js
CHANGED
|
@@ -37,7 +37,7 @@ async function runIdle(connection) {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
let connectionPreCheck = () => {
|
|
41
41
|
let handler = new Promise((resolve, reject) => {
|
|
42
42
|
preCheckWaitQueue.push({ resolve, reject });
|
|
43
43
|
});
|
|
@@ -57,9 +57,11 @@ async function runIdle(connection) {
|
|
|
57
57
|
return handler;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
connection.preCheck = connectionPreCheck;
|
|
61
|
+
|
|
60
62
|
response = await connection.exec('IDLE', false, {
|
|
61
63
|
onPlusTag: async () => {
|
|
62
|
-
connection.log.debug({ msg: `Initiated IDLE, waiting for server input`, doneRequested });
|
|
64
|
+
connection.log.debug({ msg: `Initiated IDLE, waiting for server input`, lockId: connection.currentLock?.lockId, doneRequested });
|
|
63
65
|
canEnd = true;
|
|
64
66
|
if (doneRequested) {
|
|
65
67
|
preCheck();
|
|
@@ -70,8 +72,8 @@ async function runIdle(connection) {
|
|
|
70
72
|
}
|
|
71
73
|
});
|
|
72
74
|
|
|
73
|
-
// unset before response.next()
|
|
74
|
-
if (typeof connection.preCheck === 'function') {
|
|
75
|
+
// unset before response.next() if preCheck function is not already cleared (usually is)
|
|
76
|
+
if (typeof connection.preCheck === 'function' && connection.preCheck === connectionPreCheck) {
|
|
75
77
|
connection.log.trace({
|
|
76
78
|
msg: 'Clearing pre-check function',
|
|
77
79
|
lockId: connection.currentLock?.lockId,
|
|
@@ -355,10 +355,16 @@ class TokenParser {
|
|
|
355
355
|
if (chr === '[') {
|
|
356
356
|
// allowed only for selected elements
|
|
357
357
|
if (['BODY', 'BODY.PEEK', 'BINARY', 'BINARY.PEEK'].indexOf(this.currentNode.value.toUpperCase()) < 0) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
358
|
+
if (/[./]/.test(this.currentNode.value)) {
|
|
359
|
+
// could be a path
|
|
360
|
+
this.currentNode.value += chr;
|
|
361
|
+
break;
|
|
362
|
+
} else {
|
|
363
|
+
let error = new Error(`Unexpected section start char [ at position ${this.pos + i} [E14]`);
|
|
364
|
+
error.code = 'ParserError14';
|
|
365
|
+
error.parserContext = { input: this.str, pos: this.pos + i, chr };
|
|
366
|
+
throw error;
|
|
367
|
+
}
|
|
362
368
|
}
|
|
363
369
|
this.currentNode.endPos = this.pos + i;
|
|
364
370
|
this.currentNode = this.createNode(this.currentNode.parentNode, this.pos + i);
|
package/lib/imap-flow.js
CHANGED
|
@@ -768,11 +768,7 @@ class ImapFlow extends EventEmitter {
|
|
|
768
768
|
this.writeSocket.destroySoon = () => {
|
|
769
769
|
try {
|
|
770
770
|
if (this.socket) {
|
|
771
|
-
|
|
772
|
-
this.socket.destroySoon();
|
|
773
|
-
} else {
|
|
774
|
-
this.socket.destroy();
|
|
775
|
-
}
|
|
771
|
+
this.socket.destroy();
|
|
776
772
|
}
|
|
777
773
|
this.writeSocket.end();
|
|
778
774
|
} catch (err) {
|
|
@@ -1484,11 +1480,7 @@ class ImapFlow extends EventEmitter {
|
|
|
1484
1480
|
|
|
1485
1481
|
if (this.writeSocket && !this.writeSocket.destroyed) {
|
|
1486
1482
|
try {
|
|
1487
|
-
|
|
1488
|
-
this.writeSocket.destroySoon();
|
|
1489
|
-
} else {
|
|
1490
|
-
this.writeSocket.destroy();
|
|
1491
|
-
}
|
|
1483
|
+
this.writeSocket.destroy();
|
|
1492
1484
|
} catch (err) {
|
|
1493
1485
|
this.log.error({ err, cid: this.id });
|
|
1494
1486
|
}
|
|
@@ -1496,11 +1488,7 @@ class ImapFlow extends EventEmitter {
|
|
|
1496
1488
|
|
|
1497
1489
|
if (this.socket && !this.socket.destroyed && this.writeSocket !== this.socket) {
|
|
1498
1490
|
try {
|
|
1499
|
-
|
|
1500
|
-
this.socket.destroySoon();
|
|
1501
|
-
} else {
|
|
1502
|
-
this.socket.destroy();
|
|
1503
|
-
}
|
|
1491
|
+
this.socket.destroy();
|
|
1504
1492
|
} catch (err) {
|
|
1505
1493
|
this.log.error({ err, cid: this.id });
|
|
1506
1494
|
}
|
package/lib/tools.js
CHANGED
|
@@ -147,6 +147,8 @@ module.exports = {
|
|
|
147
147
|
existing.path = folder.path;
|
|
148
148
|
existing.subscribed = !!folder.subscribed;
|
|
149
149
|
existing.listed = !!folder.listed;
|
|
150
|
+
existing.status = !!folder.status;
|
|
151
|
+
|
|
150
152
|
if (folder.specialUse) {
|
|
151
153
|
existing.specialUse = folder.specialUse;
|
|
152
154
|
}
|
|
@@ -164,7 +166,8 @@ module.exports = {
|
|
|
164
166
|
flags: folder.flags,
|
|
165
167
|
path: folder.path,
|
|
166
168
|
subscribed: !!folder.subscribed,
|
|
167
|
-
listed: !!folder.listed
|
|
169
|
+
listed: !!folder.listed,
|
|
170
|
+
status: !!folder.status
|
|
168
171
|
};
|
|
169
172
|
|
|
170
173
|
if (folder.delimiter) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imapflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.163",
|
|
4
4
|
"description": "IMAP Client for Node",
|
|
5
5
|
"main": "./lib/imap-flow.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://imapflow.com/",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/eslint-parser": "7.24.
|
|
32
|
-
"@babel/eslint-plugin": "7.24.
|
|
31
|
+
"@babel/eslint-parser": "7.24.7",
|
|
32
|
+
"@babel/eslint-plugin": "7.24.7",
|
|
33
33
|
"@babel/plugin-syntax-class-properties": "7.12.13",
|
|
34
|
-
"@babel/preset-env": "7.24.
|
|
35
|
-
"@types/node": "20.
|
|
34
|
+
"@babel/preset-env": "7.24.7",
|
|
35
|
+
"@types/node": "20.14.10",
|
|
36
36
|
"eslint": "8.57.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|
|
38
38
|
"eslint-config-prettier": "9.1.0",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"tsd-jsdoc": "2.5.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"encoding-japanese": "2.
|
|
49
|
+
"encoding-japanese": "2.2.0",
|
|
50
50
|
"iconv-lite": "0.6.3",
|
|
51
51
|
"libbase64": "1.3.0",
|
|
52
52
|
"libmime": "5.3.5",
|
|
53
53
|
"libqp": "2.1.0",
|
|
54
54
|
"mailsplit": "5.4.0",
|
|
55
|
-
"nodemailer": "6.9.
|
|
56
|
-
"pino": "9.
|
|
55
|
+
"nodemailer": "6.9.14",
|
|
56
|
+
"pino": "9.2.0",
|
|
57
57
|
"socks": "2.8.3"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/test/imap-parser-test.js
CHANGED
|
@@ -992,3 +992,13 @@ module.exports['IMAP Parser, BAD with throttling'] = test =>
|
|
|
992
992
|
test.equal(parsed.command, 'BAD');
|
|
993
993
|
test.deepEqual(parsed.attributes, [{ type: 'TEXT', value: 'Request is throttled. Suggested Backoff Time: 92415 milliseconds' }]);
|
|
994
994
|
});
|
|
995
|
+
|
|
996
|
+
module.exports['IMAP Parser, subfolder square bracket'] = test =>
|
|
997
|
+
asyncWrapper(test, async test => {
|
|
998
|
+
let parsed = await parser('* LIST (\\UnMarked) "." INBOX.[Airmail].Snooze');
|
|
999
|
+
test.deepEqual(parsed.attributes, [
|
|
1000
|
+
[{ type: 'ATOM', value: '\\UnMarked' }],
|
|
1001
|
+
{ type: 'STRING', value: '.' },
|
|
1002
|
+
{ type: 'ATOM', value: 'INBOX.[Airmail].Snooze' }
|
|
1003
|
+
]);
|
|
1004
|
+
});
|