imapflow 1.0.192 → 1.0.194
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 +15 -0
- package/lib/imap-flow.js +310 -269
- package/package.json +5 -5
- package/test/authentication-test.js +83 -0
- package/test/commands-test.js +73 -0
- package/test/connection-edge-cases-test.js +629 -0
- package/test/connection-test.js +162 -0
- package/test/integration-test.js +83 -0
- package/test/search-compiler-test.js +81 -0
- package/test/special-use-test.js +49 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imapflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.194",
|
|
4
4
|
"description": "IMAP Client for Node",
|
|
5
5
|
"main": "lib/imap-flow.js",
|
|
6
6
|
"types": "lib/imap-flow.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@babel/eslint-plugin": "7.27.1",
|
|
33
33
|
"@babel/plugin-syntax-class-properties": "7.12.13",
|
|
34
34
|
"@babel/preset-env": "7.28.0",
|
|
35
|
-
"@types/node": "24.1
|
|
35
|
+
"@types/node": "24.2.1",
|
|
36
36
|
"eslint": "8.57.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|
|
38
38
|
"eslint-config-prettier": "9.1.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"imapflow-jsdoc-template": "3.4.0-imapflow.3",
|
|
44
44
|
"jsdoc": "4.0.4",
|
|
45
45
|
"st": "3.0.2",
|
|
46
|
-
"typescript": "5.
|
|
46
|
+
"typescript": "5.9.2"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"encoding-japanese": "2.2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"libqp": "2.1.1",
|
|
54
54
|
"mailsplit": "5.4.6",
|
|
55
55
|
"nodemailer": "7.0.5",
|
|
56
|
-
"pino": "9.
|
|
57
|
-
"socks": "2.8.
|
|
56
|
+
"pino": "9.8.0",
|
|
57
|
+
"socks": "2.8.7"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ImapFlow } = require('../lib/imap-flow');
|
|
4
|
+
const { AuthenticationFailure } = require('../lib/tools');
|
|
5
|
+
|
|
6
|
+
module.exports['Authentication: Password auth configuration'] = test => {
|
|
7
|
+
let client = new ImapFlow({
|
|
8
|
+
host: 'imap.example.com',
|
|
9
|
+
auth: {
|
|
10
|
+
user: 'testuser',
|
|
11
|
+
pass: 'testpass'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test.equal(client.options.auth.user, 'testuser');
|
|
16
|
+
test.equal(client.options.auth.pass, 'testpass');
|
|
17
|
+
test.done();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports['Authentication: OAuth2 auth configuration'] = test => {
|
|
21
|
+
let client = new ImapFlow({
|
|
22
|
+
host: 'imap.example.com',
|
|
23
|
+
auth: {
|
|
24
|
+
user: 'testuser',
|
|
25
|
+
accessToken: 'oauth2_token_here'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test.equal(client.options.auth.user, 'testuser');
|
|
30
|
+
test.equal(client.options.auth.accessToken, 'oauth2_token_here');
|
|
31
|
+
test.done();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports['Authentication: Login method specification'] = test => {
|
|
35
|
+
let client = new ImapFlow({
|
|
36
|
+
host: 'imap.example.com',
|
|
37
|
+
auth: {
|
|
38
|
+
user: 'testuser',
|
|
39
|
+
pass: 'testpass',
|
|
40
|
+
loginMethod: 'AUTH=PLAIN'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test.equal(client.options.auth.loginMethod, 'AUTH=PLAIN');
|
|
45
|
+
test.done();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports['Authentication: AuthenticationFailure error structure'] = test => {
|
|
49
|
+
let error = new AuthenticationFailure('Invalid credentials');
|
|
50
|
+
|
|
51
|
+
test.ok(error instanceof Error);
|
|
52
|
+
test.equal(error.constructor.name, 'AuthenticationFailure');
|
|
53
|
+
test.equal(error.message, 'Invalid credentials');
|
|
54
|
+
test.done();
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
module.exports['Authentication: Verify-only mode'] = test => {
|
|
58
|
+
let client = new ImapFlow({
|
|
59
|
+
host: 'imap.example.com',
|
|
60
|
+
auth: {
|
|
61
|
+
user: 'testuser',
|
|
62
|
+
pass: 'testpass'
|
|
63
|
+
},
|
|
64
|
+
verifyOnly: true
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test.equal(client.options.verifyOnly, true);
|
|
68
|
+
test.done();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
module.exports['Authentication: Disable auto IDLE'] = test => {
|
|
72
|
+
let client = new ImapFlow({
|
|
73
|
+
host: 'imap.example.com',
|
|
74
|
+
auth: {
|
|
75
|
+
user: 'testuser',
|
|
76
|
+
pass: 'testpass'
|
|
77
|
+
},
|
|
78
|
+
disableAutoIdle: true
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test.equal(client.options.disableAutoIdle, true);
|
|
82
|
+
test.done();
|
|
83
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ImapFlow } = require('../lib/imap-flow');
|
|
4
|
+
|
|
5
|
+
module.exports['Commands: Client instantiation'] = test => {
|
|
6
|
+
let client = new ImapFlow({
|
|
7
|
+
host: 'imap.example.com',
|
|
8
|
+
auth: { user: 'test', pass: 'test' }
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test.ok(client);
|
|
12
|
+
test.equal(typeof client.exec, 'function');
|
|
13
|
+
test.done();
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports['Commands: Method availability'] = test => {
|
|
17
|
+
let client = new ImapFlow({
|
|
18
|
+
host: 'imap.example.com',
|
|
19
|
+
auth: { user: 'test', pass: 'test' }
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Check that key IMAP methods exist
|
|
23
|
+
test.equal(typeof client.connect, 'function');
|
|
24
|
+
test.equal(typeof client.logout, 'function');
|
|
25
|
+
test.equal(typeof client.list, 'function');
|
|
26
|
+
test.equal(typeof client.mailboxOpen, 'function');
|
|
27
|
+
test.equal(typeof client.mailboxClose, 'function');
|
|
28
|
+
test.equal(typeof client.search, 'function');
|
|
29
|
+
test.equal(typeof client.fetch, 'function');
|
|
30
|
+
test.done();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
module.exports['Commands: State management methods'] = test => {
|
|
34
|
+
let client = new ImapFlow({
|
|
35
|
+
host: 'imap.example.com',
|
|
36
|
+
auth: { user: 'test', pass: 'test' }
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test.equal(typeof client.mailboxCreate, 'function');
|
|
40
|
+
test.equal(typeof client.mailboxDelete, 'function');
|
|
41
|
+
test.equal(typeof client.mailboxRename, 'function');
|
|
42
|
+
test.equal(typeof client.mailboxSubscribe, 'function');
|
|
43
|
+
test.equal(typeof client.mailboxUnsubscribe, 'function');
|
|
44
|
+
test.done();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
module.exports['Commands: Message operation methods'] = test => {
|
|
48
|
+
let client = new ImapFlow({
|
|
49
|
+
host: 'imap.example.com',
|
|
50
|
+
auth: { user: 'test', pass: 'test' }
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test.equal(typeof client.messageFlagsSet, 'function');
|
|
54
|
+
test.equal(typeof client.messageFlagsAdd, 'function');
|
|
55
|
+
test.equal(typeof client.messageFlagsRemove, 'function');
|
|
56
|
+
test.equal(typeof client.messageCopy, 'function');
|
|
57
|
+
test.equal(typeof client.messageMove, 'function');
|
|
58
|
+
test.equal(typeof client.messageDelete, 'function');
|
|
59
|
+
test.done();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
module.exports['Commands: Utility methods'] = test => {
|
|
63
|
+
let client = new ImapFlow({
|
|
64
|
+
host: 'imap.example.com',
|
|
65
|
+
auth: { user: 'test', pass: 'test' }
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test.equal(typeof client.noop, 'function');
|
|
69
|
+
test.equal(typeof client.getQuota, 'function');
|
|
70
|
+
test.equal(typeof client.stats, 'function');
|
|
71
|
+
test.equal(typeof client.getRandomId, 'function');
|
|
72
|
+
test.done();
|
|
73
|
+
};
|