imapflow 1.0.187 → 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 CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## [1.0.187](https://github.com/postalsys/imapflow/compare/v1.0.186...v1.0.187) (2025-05-20)
4
11
 
5
12
 
@@ -364,20 +364,8 @@ class TokenParser {
364
364
  }
365
365
 
366
366
  // [ starts a section group for this element
367
- if (chr === '[') {
368
- // allowed only for selected elements
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.on('error', this._socketError);
775
- this.socket.on('close', this._socketClose);
776
- this.socket.on('end', this._socketEnd);
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "1.0.187",
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.27.1",
31
+ "@babel/eslint-parser": "7.27.5",
32
32
  "@babel/eslint-plugin": "7.27.1",
33
33
  "@babel/plugin-syntax-class-properties": "7.12.13",
34
34
  "@babel/preset-env": "7.27.2",
35
- "@types/node": "22.15.19",
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.1",
45
+ "st": "3.0.2",
46
46
  "tsd-jsdoc": "2.5.0"
47
47
  },
48
48
  "dependencies": {
@@ -54,6 +54,6 @@
54
54
  "mailsplit": "5.4.3",
55
55
  "nodemailer": "7.0.3",
56
56
  "pino": "9.7.0",
57
- "socks": "2.8.4"
57
+ "socks": "2.8.5"
58
58
  }
59
59
  }
@@ -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
+ });