imapflow 1.0.186 → 1.0.188
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 +14 -0
- package/lib/handler/token-parser.js +2 -21
- package/lib/imap-flow.js +5 -4
- package/lib/types.d.ts +1 -1
- package/package.json +9 -9
- package/test/imap-parser-test.js +14 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.188](https://github.com/postalsys/imapflow/compare/v1.0.187...v1.0.188) (2025-06-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **atom:** Allow < and [ in an atom value ([53b96bb](https://github.com/postalsys/imapflow/commit/53b96bb347705bd96efa3bd2503784d5f501f728))
|
|
9
|
+
|
|
10
|
+
## [1.0.187](https://github.com/postalsys/imapflow/compare/v1.0.186...v1.0.187) (2025-05-20)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* Bumped deps ([6efb9f6](https://github.com/postalsys/imapflow/commit/6efb9f6952ff1f17d80054edb3d46aa43d540756))
|
|
16
|
+
|
|
3
17
|
## [1.0.186](https://github.com/postalsys/imapflow/compare/v1.0.185...v1.0.186) (2025-04-20)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -364,20 +364,8 @@ class TokenParser {
|
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
// [ starts a section group for this element
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
if (['BODY', 'BODY.PEEK', 'BINARY', 'BINARY.PEEK'].indexOf(this.currentNode.value.toUpperCase()) < 0) {
|
|
370
|
-
if (/[./]/.test(this.currentNode.value)) {
|
|
371
|
-
// could be a path
|
|
372
|
-
this.currentNode.value += chr;
|
|
373
|
-
break;
|
|
374
|
-
} else {
|
|
375
|
-
let error = new Error(`Unexpected section start char [ at position ${this.pos + i} [E14]`);
|
|
376
|
-
error.code = 'ParserError14';
|
|
377
|
-
error.parserContext = { input: this.str, pos: this.pos + i, chr };
|
|
378
|
-
throw error;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
367
|
+
// Allowed only for selected elements, otherwise falls through to regular ATOM processing
|
|
368
|
+
if (chr === '[' && ['BODY', 'BODY.PEEK', 'BINARY', 'BINARY.PEEK'].indexOf(this.currentNode.value.toUpperCase()) >= 0) {
|
|
381
369
|
this.currentNode.endPos = this.pos + i;
|
|
382
370
|
this.currentNode = this.createNode(this.currentNode.parentNode, this.pos + i);
|
|
383
371
|
this.currentNode.type = 'SECTION';
|
|
@@ -386,13 +374,6 @@ class TokenParser {
|
|
|
386
374
|
break;
|
|
387
375
|
}
|
|
388
376
|
|
|
389
|
-
if (chr === '<') {
|
|
390
|
-
let error = new Error(`Unexpected start of partial at position ${this.pos + i} [E15]`);
|
|
391
|
-
error.code = 'ParserError15';
|
|
392
|
-
error.parserContext = { input: this.str, pos: this.pos + i, chr };
|
|
393
|
-
throw error;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
377
|
// if the char is not ATOM compatible, throw. Allow \* as an exception
|
|
397
378
|
if (
|
|
398
379
|
imapFormalSyntax['ATOM-CHAR']().indexOf(chr) < 0 &&
|
package/lib/imap-flow.js
CHANGED
|
@@ -771,9 +771,10 @@ class ImapFlow extends EventEmitter {
|
|
|
771
771
|
}
|
|
772
772
|
});
|
|
773
773
|
|
|
774
|
-
this.socket.
|
|
775
|
-
this.socket.
|
|
776
|
-
this.socket.
|
|
774
|
+
this.socket.once('error', this._socketError);
|
|
775
|
+
this.socket.once('close', this._socketClose);
|
|
776
|
+
this.socket.once('end', this._socketEnd);
|
|
777
|
+
|
|
777
778
|
this.socket.on('tlsClientError', this._socketError);
|
|
778
779
|
this.socket.on('timeout', this._socketTimeout);
|
|
779
780
|
|
|
@@ -1993,7 +1994,7 @@ class ImapFlow extends EventEmitter {
|
|
|
1993
1994
|
* @property {String} [unKeyword] Matches messages that do not have the custom flag set
|
|
1994
1995
|
* @property {Object.<string, Boolean|String>} [header] Matches messages with header key set if value is `true` (**NB!** not supported by all servers) or messages where header partially matches a string value
|
|
1995
1996
|
* @property {SearchObject} [not] A {@link SearchObject} object. It must not match.
|
|
1996
|
-
* @property {SearchObject[]} [or] An array of 2 or more {@link SearchObject} objects. At least
|
|
1997
|
+
* @property {SearchObject[]} [or] An array of 2 or more {@link SearchObject} objects. At least one of these must match
|
|
1997
1998
|
*/
|
|
1998
1999
|
|
|
1999
2000
|
/**
|
package/lib/types.d.ts
CHANGED
|
@@ -905,7 +905,7 @@ declare type SequenceString = string;
|
|
|
905
905
|
* @property [unKeyword] - Matches messages that do not have the custom flag set
|
|
906
906
|
* @property [header] - Matches messages with header key set if value is `true` (**NB!** not supported by all servers) or messages where header partially matches a string value
|
|
907
907
|
* @property [not] - A {@link SearchObject} object. It must not match.
|
|
908
|
-
* @property [or] - An array of 2 or more {@link SearchObject} objects. At least
|
|
908
|
+
* @property [or] - An array of 2 or more {@link SearchObject} objects. At least one of these must match
|
|
909
909
|
*/
|
|
910
910
|
declare type SearchObject = {
|
|
911
911
|
seq?: SequenceString;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imapflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.188",
|
|
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.
|
|
32
|
-
"@babel/eslint-plugin": "7.
|
|
31
|
+
"@babel/eslint-parser": "7.27.5",
|
|
32
|
+
"@babel/eslint-plugin": "7.27.1",
|
|
33
33
|
"@babel/plugin-syntax-class-properties": "7.12.13",
|
|
34
|
-
"@babel/preset-env": "7.
|
|
35
|
-
"@types/node": "
|
|
34
|
+
"@babel/preset-env": "7.27.2",
|
|
35
|
+
"@types/node": "24.0.1",
|
|
36
36
|
"eslint": "8.57.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|
|
38
38
|
"eslint-config-prettier": "9.1.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"grunt-eslint": "24.3.0",
|
|
43
43
|
"imapflow-jsdoc-template": "3.4.0-imapflow.2",
|
|
44
44
|
"jsdoc": "3.6.11",
|
|
45
|
-
"st": "3.0.
|
|
45
|
+
"st": "3.0.2",
|
|
46
46
|
"tsd-jsdoc": "2.5.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"libmime": "5.3.6",
|
|
53
53
|
"libqp": "2.1.1",
|
|
54
54
|
"mailsplit": "5.4.3",
|
|
55
|
-
"nodemailer": "
|
|
56
|
-
"pino": "9.
|
|
57
|
-
"socks": "2.8.
|
|
55
|
+
"nodemailer": "7.0.3",
|
|
56
|
+
"pino": "9.7.0",
|
|
57
|
+
"socks": "2.8.5"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/test/imap-parser-test.js
CHANGED
|
@@ -439,8 +439,6 @@ module.exports['IMAP Parser: Section: allow trailing ws'] = test =>
|
|
|
439
439
|
])
|
|
440
440
|
);
|
|
441
441
|
|
|
442
|
-
module.exports['IMAP Parser: Tags: fail unknown section'] = test => asyncWrapperFail(test, async test => test.ok(await parser('TAG1 CMD KODY[]')));
|
|
443
|
-
|
|
444
442
|
module.exports['IMAP Parser: Readable: simple'] = test =>
|
|
445
443
|
asyncWrapper(test, async test =>
|
|
446
444
|
test.deepEqual(await parser('* OK Hello world!'), {
|
|
@@ -817,8 +815,6 @@ module.exports['IMAP Parser: Partial: Section'] = test =>
|
|
|
817
815
|
])
|
|
818
816
|
);
|
|
819
817
|
|
|
820
|
-
module.exports['IMAP Parser: Partial: fail unknown section'] = test => asyncWrapperFail(test, async test => test.ok(await parser('TAG1 CMD KODY<0.123>')));
|
|
821
|
-
|
|
822
818
|
module.exports['IMAP Parser: Partial: fail zero prefix for start'] = test => asyncWrapperFail(test, async test => test.ok(await parser('TAG1 CMD BODY[]<01>')));
|
|
823
819
|
|
|
824
820
|
module.exports['IMAP Parser: Partial: fail zero prefix for end'] = test => asyncWrapperFail(test, async test => test.ok(await parser('TAG1 CMD BODY[]<0.01>')));
|
|
@@ -1249,3 +1245,17 @@ module.exports['IMAP Parser, FETCH with BODYSTRUCTURE'] = test =>
|
|
|
1249
1245
|
}
|
|
1250
1246
|
}
|
|
1251
1247
|
});
|
|
1248
|
+
|
|
1249
|
+
module.exports['IMAP Parser, ATOM with <, [, ]'] = test =>
|
|
1250
|
+
asyncWrapper(test, async test => {
|
|
1251
|
+
let password = `<[+=</$]`;
|
|
1252
|
+
let parsed = await parser(`3 LOGIN user@domain ${password}`);
|
|
1253
|
+
test.deepEqual(parsed, {
|
|
1254
|
+
tag: '3',
|
|
1255
|
+
command: 'LOGIN',
|
|
1256
|
+
attributes: [
|
|
1257
|
+
{ type: 'ATOM', value: 'user@domain' },
|
|
1258
|
+
{ type: 'ATOM', value: password }
|
|
1259
|
+
]
|
|
1260
|
+
});
|
|
1261
|
+
});
|