imapflow 1.0.103 → 1.0.104

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/lib/imap-flow.js CHANGED
@@ -127,10 +127,11 @@ class ImapFlow extends EventEmitter {
127
127
  * @param {Boolean} [options.logRaw=false] If true then log data read from and written to socket encoded in base64
128
128
  * @param {Boolean} [options.emitLogs=false] If `true` then in addition of sending data to logger, ImapFlow emits 'log' events with the same data
129
129
  * @param {Boolean} [options.verifyOnly=false] If `true` then logs out automatically after successful authentication
130
- * @param {Boolean} [options.proxy] Optional proxy URL. Supports HTTP CONNECT (`http://`, `https://`) and SOCKS (`socks://`, `socks4://`, `socks5://`) proxies
130
+ * @param {String} [options.proxy] Optional proxy URL. Supports HTTP CONNECT (`http://`, `https://`) and SOCKS (`socks://`, `socks4://`, `socks5://`) proxies
131
131
  * @param {Boolean} [options.qresync=false] If true, then enables QRESYNC support. EXPUNGE notifications will include `uid` property instead of `seq`
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
+ * @param {Boolean} [options.disableAutoEnable] Do not enable supported extensions by default
134
135
  */
135
136
  constructor(options) {
136
137
  super({ captureRejections: true });
@@ -211,6 +212,7 @@ class ImapFlow extends EventEmitter {
211
212
  * @type {Map<string, boolean|number>}
212
213
  */
213
214
  this.capabilities = new Map();
215
+ this.rawCapabilities = null;
214
216
 
215
217
  this.expectCapabilityUpdate = false; // force CAPABILITY after LOGIN
216
218
 
@@ -645,8 +647,10 @@ class ImapFlow extends EventEmitter {
645
647
  await this.compress();
646
648
  }
647
649
 
648
- // enable extensions if possible
649
- await this.run('ENABLE', ['CONDSTORE', 'UTF8=ACCEPT'].concat(this.options.qresync ? 'QRESYNC' : []));
650
+ if (!this.options.disableAutoEnable) {
651
+ // enable extensions if possible
652
+ await this.run('ENABLE', ['CONDSTORE', 'UTF8=ACCEPT'].concat(this.options.qresync ? 'QRESYNC' : []));
653
+ }
650
654
 
651
655
  this.usable = true;
652
656
  }
@@ -920,6 +924,7 @@ class ImapFlow extends EventEmitter {
920
924
  }
921
925
 
922
926
  async sectionCapability(section) {
927
+ this.rawCapabilities = section;
923
928
  this.capabilities = updateCapabilities(section);
924
929
  if (this.expectCapabilityUpdate) {
925
930
  this.expectCapabilityUpdate = false;
@@ -927,6 +932,7 @@ class ImapFlow extends EventEmitter {
927
932
  }
928
933
 
929
934
  async untaggedCapability(untagged) {
935
+ this.rawCapabilities = untagged.attributes;
930
936
  this.capabilities = updateCapabilities(untagged.attributes);
931
937
  if (this.expectCapabilityUpdate) {
932
938
  this.expectCapabilityUpdate = false;
@@ -2611,6 +2617,20 @@ class ImapFlow extends EventEmitter {
2611
2617
 
2612
2618
  return synteticLogger;
2613
2619
  }
2620
+
2621
+ unbind() {
2622
+ this.socket.unpipe(this.streamer);
2623
+
2624
+ this.socket.removeListener('error', this._socketError);
2625
+ this.socket.removeListener('close', this._socketClose);
2626
+ this.socket.removeListener('end', this._socketEnd);
2627
+ this.socket.removeListener('tlsClientError', this._socketError);
2628
+ this.socket.removeListener('timeout', this._socketTimeout);
2629
+
2630
+ return {
2631
+ socket: this.socket
2632
+ };
2633
+ }
2614
2634
  }
2615
2635
 
2616
2636
  /**
package/lib/types.d.ts CHANGED
@@ -30,6 +30,7 @@ declare module "imapflow" {
30
30
  * @param [options.qresync = false] - If true, then enables QRESYNC support. EXPUNGE notifications will include `uid` property instead of `seq`
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
+ * @param [options.disableAutoEnable] - Do not enable supported extensions by default
33
34
  */
34
35
  class ImapFlow extends EventEmitter {
35
36
  constructor(options: {
@@ -54,10 +55,11 @@ declare module "imapflow" {
54
55
  logRaw?: boolean;
55
56
  emitLogs?: boolean;
56
57
  verifyOnly?: boolean;
57
- proxy?: boolean;
58
+ proxy?: string;
58
59
  qresync?: boolean;
59
60
  maxIdleTime?: number;
60
61
  disableBinary?: boolean;
62
+ disableAutoEnable?: boolean;
61
63
  });
62
64
  /**
63
65
  * 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.103",
3
+ "version": "1.0.104",
4
4
  "description": "IMAP Client for Node",
5
5
  "main": "./lib/imap-flow.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  "@babel/eslint-plugin": "7.18.10",
32
32
  "@babel/plugin-syntax-class-properties": "7.12.13",
33
33
  "@babel/preset-env": "7.18.10",
34
- "@types/node": "18.7.6",
34
+ "@types/node": "18.7.9",
35
35
  "braintree-jsdoc-template": "3.3.0",
36
36
  "eslint": "8.22.0",
37
37
  "eslint-config-nodemailer": "1.2.0",
@@ -52,7 +52,7 @@
52
52
  "libqp": "1.1.0",
53
53
  "mailsplit": "5.3.2",
54
54
  "nodemailer": "6.7.8",
55
- "pino": "8.4.1",
55
+ "pino": "8.4.2",
56
56
  "socks": "2.7.0"
57
57
  }
58
58
  }