imapflow 1.0.133 → 1.0.135

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,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ - 1.0.135 - 2023-07-29
4
+
5
+ - Improved handling of unexpected close
6
+
7
+ - 1.0.134 - 2023-07-20
8
+
9
+ - Fixed unicode search if UTF8=ACCEPT extension was enabled
10
+
3
11
  - 1.0.131 - 2023-06-29
4
12
 
5
13
  - Fixed issue with labels that start with tilde
@@ -158,6 +158,7 @@ module.exports = async (connection, maxIdleTime) => {
158
158
  let response;
159
159
  switch (connection.missingIdleCommand) {
160
160
  case 'SELECT':
161
+ // FIXME: somehow a loop occurs after some time of idling with SELECT
161
162
  connection.log.debug({ src: 'c', msg: `Running SELECT to detect changes in folder` });
162
163
  response = await connection.exec(selectCommand.command, selectCommand.arguments);
163
164
  break;
package/lib/imap-flow.js CHANGED
@@ -923,6 +923,7 @@ class ImapFlow extends EventEmitter {
923
923
  this.log.error({ err, cid: this.id });
924
924
 
925
925
  if (typeof this.initialReject === 'function') {
926
+ clearTimeout(this.greetingTimeout);
926
927
  let reject = this.initialReject;
927
928
  this.initialResolve = false;
928
929
  this.initialReject = false;
@@ -958,6 +959,7 @@ class ImapFlow extends EventEmitter {
958
959
  this.log.error({ err, cid: this.id });
959
960
 
960
961
  if (typeof this.initialReject === 'function') {
962
+ clearTimeout(this.greetingTimeout);
961
963
  let reject = this.initialReject;
962
964
  this.initialResolve = false;
963
965
  this.initialReject = false;
@@ -1370,12 +1372,14 @@ class ImapFlow extends EventEmitter {
1370
1372
  this.idling = false;
1371
1373
 
1372
1374
  if (typeof this.initialReject === 'function' && !this.options.verifyOnly) {
1375
+ clearTimeout(this.greetingTimeout);
1373
1376
  let reject = this.initialReject;
1374
1377
  this.initialResolve = false;
1375
1378
  this.initialReject = false;
1376
1379
  let err = new Error('Unexpected close');
1377
1380
  err.code = `ClosedAfterConnect${this.secureConnection ? 'TLS' : 'Text'}`;
1378
- reject(err);
1381
+ // still has to go through the logic below
1382
+ setImmediate(() => reject(err));
1379
1383
  }
1380
1384
 
1381
1385
  if (typeof this.preCheck === 'function') {
@@ -1412,7 +1416,7 @@ class ImapFlow extends EventEmitter {
1412
1416
 
1413
1417
  if (this.writeSocket && !this.writeSocket.destroyed) {
1414
1418
  try {
1415
- this.writeSocket.end();
1419
+ this.writeSocket.destroySoon();
1416
1420
  } catch (err) {
1417
1421
  this.log.error({ err, cid: this.id });
1418
1422
  }
@@ -1420,7 +1424,7 @@ class ImapFlow extends EventEmitter {
1420
1424
 
1421
1425
  if (this.socket && !this.socket.destroyed && this.writeSocket !== this.socket) {
1422
1426
  try {
1423
- this.socket.end();
1427
+ this.socket.destroySoon();
1424
1428
  } catch (err) {
1425
1429
  this.log.error({ err, cid: this.id });
1426
1430
  }
@@ -259,7 +259,8 @@ module.exports.searchCompiler = (connection, query) => {
259
259
 
260
260
  walk(query);
261
261
 
262
- if (hasUnicode) {
262
+ if (hasUnicode && !connection.enabled.has('UTF8=ACCEPT')) {
263
+ // Prepend search query with `CHARSET UTF-8`
263
264
  attributes.unshift({ type: 'ATOM', value: 'UTF-8' });
264
265
  attributes.unshift({ type: 'ATOM', value: 'CHARSET' });
265
266
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "1.0.133",
3
+ "version": "1.0.135",
4
4
  "description": "IMAP Client for Node",
5
5
  "main": "./lib/imap-flow.js",
6
6
  "scripts": {
@@ -27,19 +27,19 @@
27
27
  },
28
28
  "homepage": "https://imapflow.com/",
29
29
  "devDependencies": {
30
- "@babel/eslint-parser": "7.22.5",
30
+ "@babel/eslint-parser": "7.22.9",
31
31
  "@babel/eslint-plugin": "7.22.5",
32
32
  "@babel/plugin-syntax-class-properties": "7.12.13",
33
- "@babel/preset-env": "7.22.5",
34
- "@types/node": "20.3.2",
33
+ "@babel/preset-env": "7.22.9",
34
+ "@types/node": "20.4.5",
35
35
  "braintree-jsdoc-template": "3.3.0",
36
- "eslint": "8.43.0",
36
+ "eslint": "8.46.0",
37
37
  "eslint-config-nodemailer": "1.2.0",
38
- "eslint-config-prettier": "8.8.0",
38
+ "eslint-config-prettier": "8.9.0",
39
39
  "grunt": "1.6.1",
40
40
  "grunt-cli": "1.4.3",
41
41
  "grunt-contrib-nodeunit": "5.0.0",
42
- "grunt-eslint": "24.2.0",
42
+ "grunt-eslint": "24.3.0",
43
43
  "jsdoc": "3.6.11",
44
44
  "st": "3.0.0",
45
45
  "tsd-jsdoc": "2.5.0"
@@ -51,8 +51,8 @@
51
51
  "libmime": "5.2.1",
52
52
  "libqp": "2.0.1",
53
53
  "mailsplit": "5.4.0",
54
- "nodemailer": "6.9.3",
55
- "pino": "8.14.1",
54
+ "nodemailer": "6.9.4",
55
+ "pino": "8.14.2",
56
56
  "socks": "2.7.1"
57
57
  }
58
58
  }