imapflow 1.0.110 → 1.0.111
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 +7 -0
- package/lib/imap-flow.js +12 -3
- package/lib/types.d.ts +6 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
- 1.0.111 - 2022-10-13
|
|
4
|
+
|
|
5
|
+
- Added new connection options
|
|
6
|
+
- connectionTimeout=90000: how many milliseconds to wait for the connection to establish (default is 90 seconds)
|
|
7
|
+
- greetingTimeout=16000: how many milliseconds to wait for the greeting after connection is established (default is 16 seconds)
|
|
8
|
+
- socketTimeout=300000: how many milliseconds of inactivity to allow (default is 5 minutes)
|
|
9
|
+
|
|
3
10
|
- 1.0.110 - 2022-10-10
|
|
4
11
|
|
|
5
12
|
- Allow unicode atoms by default
|
package/lib/imap-flow.js
CHANGED
|
@@ -132,6 +132,9 @@ class ImapFlow extends EventEmitter {
|
|
|
132
132
|
* @param {Number} [options.maxIdleTime] If set, then breaks and restarts IDLE every maxIdleTime ms
|
|
133
133
|
* @param {Boolean} [options.disableBinary=false] If true, then ignores the BINARY extension when making FETCH and APPEND calls
|
|
134
134
|
* @param {Boolean} [options.disableAutoEnable] Do not enable supported extensions by default
|
|
135
|
+
* @param {Number} [options.connectionTimeout=90000] how many milliseconds to wait for the connection to establish (default is 90 seconds)
|
|
136
|
+
* @param {Number} [options.greetingTimeout=16000] how many milliseconds to wait for the greeting after connection is established (default is 16 seconds)
|
|
137
|
+
* @param {Number} [options.socketTimeout=300000] how many milliseconds of inactivity to allow (default is 5 minutes)
|
|
135
138
|
*/
|
|
136
139
|
constructor(options) {
|
|
137
140
|
super({ captureRejections: true });
|
|
@@ -1187,23 +1190,29 @@ class ImapFlow extends EventEmitter {
|
|
|
1187
1190
|
this.connectTimeout = setTimeout(() => {
|
|
1188
1191
|
let err = new Error('Failed to established connection in required time');
|
|
1189
1192
|
err.code = 'CONNECT_TIMEOUT';
|
|
1193
|
+
err.details = {
|
|
1194
|
+
connectionTimeout: this.options.connectionTimeout || CONNECT_TIMEOUT
|
|
1195
|
+
};
|
|
1190
1196
|
this.log.error({ err, cid: this.id });
|
|
1191
1197
|
setImmediate(() => this.close());
|
|
1192
1198
|
reject(err);
|
|
1193
|
-
}, CONNECT_TIMEOUT);
|
|
1199
|
+
}, this.options.connectionTimeout || CONNECT_TIMEOUT);
|
|
1194
1200
|
|
|
1195
1201
|
let onConnect = () => {
|
|
1196
1202
|
clearTimeout(this.connectTimeout);
|
|
1197
1203
|
this.socket.setKeepAlive(true, 5 * 1000);
|
|
1198
|
-
this.socket.setTimeout(SOCKET_TIMEOUT);
|
|
1204
|
+
this.socket.setTimeout(this.options.socketTimeout || SOCKET_TIMEOUT);
|
|
1199
1205
|
|
|
1200
1206
|
this.greetingTimeout = setTimeout(() => {
|
|
1201
1207
|
let err = new Error(`Failed to receive greeting from server in required time${!this.secureConnection ? '. Maybe should use TLS?' : ''}`);
|
|
1202
1208
|
err.code = 'GREEETING_TIMEOUT';
|
|
1209
|
+
err.details = {
|
|
1210
|
+
greetingTimeout: this.options.greetingTimeout || GREETING_TIMEOUT
|
|
1211
|
+
};
|
|
1203
1212
|
this.log.error({ err, cid: this.id });
|
|
1204
1213
|
setImmediate(() => this.close());
|
|
1205
1214
|
reject(err);
|
|
1206
|
-
}, GREETING_TIMEOUT);
|
|
1215
|
+
}, this.options.greetingTimeout || GREETING_TIMEOUT);
|
|
1207
1216
|
|
|
1208
1217
|
this.tls = typeof this.socket.getCipher === 'function' ? this.socket.getCipher() : false;
|
|
1209
1218
|
|
package/lib/types.d.ts
CHANGED
|
@@ -31,6 +31,9 @@ declare module "imapflow" {
|
|
|
31
31
|
* @param [options.maxIdleTime] - If set, then breaks and restarts IDLE every maxIdleTime ms
|
|
32
32
|
* @param [options.disableBinary = false] - If true, then ignores the BINARY extension when making FETCH and APPEND calls
|
|
33
33
|
* @param [options.disableAutoEnable] - Do not enable supported extensions by default
|
|
34
|
+
* @param [options.connectionTimeout = 90000] - how many milliseconds to wait for the connection to establish (default is 90 seconds)
|
|
35
|
+
* @param [options.greetingTimeout = 16000] - how many milliseconds to wait for the greeting after connection is established (default is 16 seconds)
|
|
36
|
+
* @param [options.socketTimeout = 300000] - how many milliseconds of inactivity to allow (default is 5 minutes)
|
|
34
37
|
*/
|
|
35
38
|
class ImapFlow extends EventEmitter {
|
|
36
39
|
constructor(options: {
|
|
@@ -60,6 +63,9 @@ declare module "imapflow" {
|
|
|
60
63
|
maxIdleTime?: number;
|
|
61
64
|
disableBinary?: boolean;
|
|
62
65
|
disableAutoEnable?: boolean;
|
|
66
|
+
connectionTimeout?: number;
|
|
67
|
+
greetingTimeout?: number;
|
|
68
|
+
socketTimeout?: number;
|
|
63
69
|
});
|
|
64
70
|
/**
|
|
65
71
|
* Current module version as a static class property
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imapflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.111",
|
|
4
4
|
"description": "IMAP Client for Node",
|
|
5
5
|
"main": "./lib/imap-flow.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@babel/eslint-parser": "7.19.1",
|
|
31
31
|
"@babel/eslint-plugin": "7.19.1",
|
|
32
32
|
"@babel/plugin-syntax-class-properties": "7.12.13",
|
|
33
|
-
"@babel/preset-env": "7.19.
|
|
34
|
-
"@types/node": "18.8.
|
|
33
|
+
"@babel/preset-env": "7.19.4",
|
|
34
|
+
"@types/node": "18.8.5",
|
|
35
35
|
"braintree-jsdoc-template": "3.3.0",
|
|
36
36
|
"eslint": "8.25.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|