imapflow 1.0.98 → 1.0.99
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 +4 -0
- package/lib/commands/list.js +7 -1
- package/lib/commands/status.js +10 -0
- package/lib/imap-flow.js +12 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/lib/commands/list.js
CHANGED
|
@@ -4,7 +4,9 @@ const { decodePath, encodePath, normalizePath } = require('../tools.js');
|
|
|
4
4
|
const { specialUse } = require('../special-use');
|
|
5
5
|
|
|
6
6
|
// Lists mailboxes from server
|
|
7
|
-
module.exports = async (connection, reference, mailbox) => {
|
|
7
|
+
module.exports = async (connection, reference, mailbox, options) => {
|
|
8
|
+
options = options || {};
|
|
9
|
+
|
|
8
10
|
let listCommand = connection.capabilities.has('XLIST') && !connection.capabilities.has('SPECIAL-USE') ? 'XLIST' : 'LIST';
|
|
9
11
|
|
|
10
12
|
let response;
|
|
@@ -64,6 +66,10 @@ module.exports = async (connection, reference, mailbox) => {
|
|
|
64
66
|
let normalizedReference = normalizePath(connection, reference || '');
|
|
65
67
|
await runList(normalizedReference, normalizePath(connection, mailbox || '', true));
|
|
66
68
|
|
|
69
|
+
if (options.listOnly) {
|
|
70
|
+
return entries;
|
|
71
|
+
}
|
|
72
|
+
|
|
67
73
|
if (normalizedReference && !entries.find(entry => entry.specialUse === '\\Inbox')) {
|
|
68
74
|
// INBOX was most probably not included in the listing if namespace was used
|
|
69
75
|
await runList('', 'INBOX');
|
package/lib/commands/status.js
CHANGED
|
@@ -126,6 +126,16 @@ module.exports = async (connection, path, query) => {
|
|
|
126
126
|
response.next();
|
|
127
127
|
return map;
|
|
128
128
|
} catch (err) {
|
|
129
|
+
if (err.responseStatus === 'NO') {
|
|
130
|
+
let folders = await connection.run('LIST', '', path, { listOnly: true });
|
|
131
|
+
if (folders && !folders.length) {
|
|
132
|
+
let error = new Error(`Mailbox doesn't exist: ${path}`);
|
|
133
|
+
error.code = 'NotFound';
|
|
134
|
+
error.response = err;
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
129
139
|
connection.log.warn({ err, cid: connection.id });
|
|
130
140
|
return false;
|
|
131
141
|
}
|
package/lib/imap-flow.js
CHANGED
|
@@ -2501,6 +2501,17 @@ class ImapFlow extends EventEmitter {
|
|
|
2501
2501
|
this.currentLockId = lockId;
|
|
2502
2502
|
return resolve({ path, release });
|
|
2503
2503
|
} catch (err) {
|
|
2504
|
+
if (err.responseStatus === 'NO') {
|
|
2505
|
+
try {
|
|
2506
|
+
let folders = await this.run('LIST', '', path, { listOnly: true });
|
|
2507
|
+
if (!folders || !folders.length) {
|
|
2508
|
+
err.mailboxMissing = true;
|
|
2509
|
+
}
|
|
2510
|
+
} catch (E) {
|
|
2511
|
+
this.log.trace({ msg: 'Failed to verify failed mailbox', path, err: E });
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2504
2515
|
this.log.trace({ msg: 'Failed to acquire mailbox lock', path, lockId });
|
|
2505
2516
|
reject(err);
|
|
2506
2517
|
await this.processLocks(true);
|
|
@@ -2531,6 +2542,7 @@ class ImapFlow extends EventEmitter {
|
|
|
2531
2542
|
*/
|
|
2532
2543
|
async getMailboxLock(path, options) {
|
|
2533
2544
|
options = options || {};
|
|
2545
|
+
|
|
2534
2546
|
path = normalizePath(this, path);
|
|
2535
2547
|
|
|
2536
2548
|
let lockId = ++this.lockCounter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imapflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.99",
|
|
4
4
|
"description": "IMAP Client for Node",
|
|
5
5
|
"main": "./lib/imap-flow.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"@babel/eslint-plugin": "7.17.7",
|
|
32
32
|
"@babel/plugin-syntax-class-properties": "7.12.13",
|
|
33
33
|
"@babel/preset-env": "7.18.2",
|
|
34
|
-
"@types/node": "17.0.
|
|
34
|
+
"@types/node": "17.0.40",
|
|
35
35
|
"braintree-jsdoc-template": "3.3.0",
|
|
36
|
-
"eslint": "8.
|
|
36
|
+
"eslint": "8.17.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|
|
38
38
|
"eslint-config-prettier": "8.5.0",
|
|
39
39
|
"grunt": "1.5.3",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"libqp": "1.1.0",
|
|
53
53
|
"mailsplit": "5.3.2",
|
|
54
54
|
"nodemailer": "6.7.5",
|
|
55
|
-
"pino": "
|
|
55
|
+
"pino": "8.0.0",
|
|
56
56
|
"socks": "2.6.2"
|
|
57
57
|
}
|
|
58
58
|
}
|