imapflow 1.0.102 → 1.0.105
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/commands/list.js +13 -13
- package/lib/imap-flow.js +27 -3
- package/lib/types.d.ts +3 -1
- package/package.json +3 -3
package/lib/commands/list.js
CHANGED
|
@@ -42,13 +42,13 @@ module.exports = async (connection, reference, mailbox, options) => {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
if (listCommand === 'LIST' && connection.capabilities.has('LIST-STATUS') && statusQueryAttributes.length) {
|
|
46
|
+
returnArgs.push({ type: 'ATOM', value: 'STATUS' }, statusQueryAttributes);
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
let runList = async (reference, mailbox) => {
|
|
46
50
|
const cmdArgs = [encodePath(connection, reference), encodePath(connection, mailbox)];
|
|
47
51
|
|
|
48
|
-
if (listCommand === 'LIST' && connection.capabilities.has('LIST-STATUS') && statusQueryAttributes.length) {
|
|
49
|
-
returnArgs.push({ type: 'ATOM', value: 'STATUS' }, statusQueryAttributes);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
52
|
if (returnArgs.length) {
|
|
53
53
|
cmdArgs.push({ type: 'ATOM', value: 'RETURN' }, returnArgs);
|
|
54
54
|
}
|
|
@@ -165,6 +165,15 @@ module.exports = async (connection, reference, mailbox, options) => {
|
|
|
165
165
|
let normalizedReference = normalizePath(connection, reference || '');
|
|
166
166
|
await runList(normalizedReference, normalizePath(connection, mailbox || '', true));
|
|
167
167
|
|
|
168
|
+
if (options.listOnly) {
|
|
169
|
+
return entries;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (normalizedReference && !entries.find(entry => entry.specialUse === '\\Inbox')) {
|
|
173
|
+
// INBOX was most probably not included in the listing if namespace was used
|
|
174
|
+
await runList('', 'INBOX');
|
|
175
|
+
}
|
|
176
|
+
|
|
168
177
|
if (options.statusQuery) {
|
|
169
178
|
for (let entry of entries) {
|
|
170
179
|
if (!entry.flags.has('\\Noselect') && !entry.flags.has('\\NonExistent')) {
|
|
@@ -182,15 +191,6 @@ module.exports = async (connection, reference, mailbox, options) => {
|
|
|
182
191
|
}
|
|
183
192
|
}
|
|
184
193
|
|
|
185
|
-
if (options.listOnly) {
|
|
186
|
-
return entries;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (normalizedReference && !entries.find(entry => entry.specialUse === '\\Inbox')) {
|
|
190
|
-
// INBOX was most probably not included in the listing if namespace was used
|
|
191
|
-
await runList('', 'INBOX');
|
|
192
|
-
}
|
|
193
|
-
|
|
194
194
|
response = await connection.exec(
|
|
195
195
|
'LSUB',
|
|
196
196
|
[encodePath(connection, normalizePath(connection, reference || '')), encodePath(connection, normalizePath(connection, mailbox || '', true))],
|
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 {
|
|
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
|
-
|
|
649
|
-
|
|
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,24 @@ class ImapFlow extends EventEmitter {
|
|
|
2611
2617
|
|
|
2612
2618
|
return synteticLogger;
|
|
2613
2619
|
}
|
|
2620
|
+
|
|
2621
|
+
unbind() {
|
|
2622
|
+
this.socket.unpipe(this.streamer);
|
|
2623
|
+
if (this._inflate) {
|
|
2624
|
+
this._inflate.unpipe(this.streamer);
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
this.socket.removeListener('error', this._socketError);
|
|
2628
|
+
this.socket.removeListener('close', this._socketClose);
|
|
2629
|
+
this.socket.removeListener('end', this._socketEnd);
|
|
2630
|
+
this.socket.removeListener('tlsClientError', this._socketError);
|
|
2631
|
+
this.socket.removeListener('timeout', this._socketTimeout);
|
|
2632
|
+
|
|
2633
|
+
return {
|
|
2634
|
+
readSocket: this._inflate || this.socket,
|
|
2635
|
+
writeSocket: this.writeSocket || this.socket
|
|
2636
|
+
};
|
|
2637
|
+
}
|
|
2614
2638
|
}
|
|
2615
2639
|
|
|
2616
2640
|
/**
|
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?:
|
|
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.
|
|
3
|
+
"version": "1.0.105",
|
|
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.
|
|
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.
|
|
55
|
+
"pino": "8.4.2",
|
|
56
56
|
"socks": "2.7.0"
|
|
57
57
|
}
|
|
58
58
|
}
|