imapflow 1.0.160 → 1.0.161
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 +27 -20
- package/lib/types.d.ts +36 -31
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.161](https://github.com/postalsys/imapflow/compare/v1.0.160...v1.0.161) (2024-05-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **listTree:** pass listing options as an optional argument ([917ba80](https://github.com/postalsys/imapflow/commit/917ba80f21b2fe485154acd252d6565b838e73e6))
|
|
9
|
+
|
|
3
10
|
## [1.0.160](https://github.com/postalsys/imapflow/compare/v1.0.159...v1.0.160) (2024-04-22)
|
|
4
11
|
|
|
5
12
|
|
package/lib/imap-flow.js
CHANGED
|
@@ -768,7 +768,7 @@ class ImapFlow extends EventEmitter {
|
|
|
768
768
|
this.writeSocket.destroySoon = () => {
|
|
769
769
|
try {
|
|
770
770
|
if (this.socket) {
|
|
771
|
-
if (typeof this.socket.destroySoon ===
|
|
771
|
+
if (typeof this.socket.destroySoon === 'function') {
|
|
772
772
|
this.socket.destroySoon();
|
|
773
773
|
} else {
|
|
774
774
|
this.socket.destroy();
|
|
@@ -1484,7 +1484,7 @@ class ImapFlow extends EventEmitter {
|
|
|
1484
1484
|
|
|
1485
1485
|
if (this.writeSocket && !this.writeSocket.destroyed) {
|
|
1486
1486
|
try {
|
|
1487
|
-
if (typeof this.writeSocket.destroySoon ===
|
|
1487
|
+
if (typeof this.writeSocket.destroySoon === 'function') {
|
|
1488
1488
|
this.writeSocket.destroySoon();
|
|
1489
1489
|
} else {
|
|
1490
1490
|
this.writeSocket.destroy();
|
|
@@ -1496,7 +1496,7 @@ class ImapFlow extends EventEmitter {
|
|
|
1496
1496
|
|
|
1497
1497
|
if (this.socket && !this.socket.destroyed && this.writeSocket !== this.socket) {
|
|
1498
1498
|
try {
|
|
1499
|
-
if (typeof this.socket.destroySoon ===
|
|
1499
|
+
if (typeof this.socket.destroySoon === 'function') {
|
|
1500
1500
|
this.socket.destroySoon();
|
|
1501
1501
|
} else {
|
|
1502
1502
|
this.socket.destroy();
|
|
@@ -1544,7 +1544,7 @@ class ImapFlow extends EventEmitter {
|
|
|
1544
1544
|
* @property {String} pathAsListed mailbox path as listed in the LIST/LSUB response
|
|
1545
1545
|
* @property {String} name mailbox name (last part of path after delimiter)
|
|
1546
1546
|
* @property {String} delimiter mailbox path delimiter, usually "." or "/"
|
|
1547
|
-
* @property {
|
|
1547
|
+
* @property {String[]} parent An array of parent folder names. All names are in unicode
|
|
1548
1548
|
* @property {String} parentPath Same as `parent`, but as a complete string path (unicode string)
|
|
1549
1549
|
* @property {Set<string>} flags a set of flags for this mailbox
|
|
1550
1550
|
* @property {String} specialUse one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set
|
|
@@ -1553,22 +1553,27 @@ class ImapFlow extends EventEmitter {
|
|
|
1553
1553
|
* @property {StatusObject} [status] If `statusQuery` was used, then this value includes the status response
|
|
1554
1554
|
*/
|
|
1555
1555
|
|
|
1556
|
+
/**
|
|
1557
|
+
* @typedef {Object} ListOptions
|
|
1558
|
+
* @global
|
|
1559
|
+
* @property {Object} [statusQuery] request status items for every listed entry
|
|
1560
|
+
* @property {Boolean} [statusQuery.messages] if `true` request count of messages
|
|
1561
|
+
* @property {Boolean} [statusQuery.recent] if `true` request count of messages with \\Recent tag
|
|
1562
|
+
* @property {Boolean} [statusQuery.uidNext] if `true` request predicted next UID
|
|
1563
|
+
* @property {Boolean} [statusQuery.uidValidity] if `true` request mailbox `UIDVALIDITY` value
|
|
1564
|
+
* @property {Boolean} [statusQuery.unseen] if `true` request count of unseen messages
|
|
1565
|
+
* @property {Boolean} [statusQuery.highestModseq] if `true` request last known modseq value
|
|
1566
|
+
* @property {Object} [specialUseHints] set specific paths as special use folders, this would override special use flags provided from the server
|
|
1567
|
+
* @property {String} [specialUseHints.sent] Path to "Sent Mail" folder
|
|
1568
|
+
* @property {String} [specialUseHints.trash] Path to "Trash" folder
|
|
1569
|
+
* @property {String} [specialUseHints.junk] Path to "Junk Mail" folder
|
|
1570
|
+
* @property {String} [specialUseHints.drafts] Path to "Drafts" folder
|
|
1571
|
+
*/
|
|
1572
|
+
|
|
1556
1573
|
/**
|
|
1557
1574
|
* Lists available mailboxes as an Array
|
|
1558
1575
|
*
|
|
1559
|
-
* @param {
|
|
1560
|
-
* @param {Object} [options.statusQuery] request status items for every listed entry
|
|
1561
|
-
* @param {Boolean} [options.statusQuery.messages] if `true` request count of messages
|
|
1562
|
-
* @param {Boolean} [options.statusQuery.recent] if `true` request count of messages with \\Recent tag
|
|
1563
|
-
* @param {Boolean} [options.statusQuery.uidNext] if `true` request predicted next UID
|
|
1564
|
-
* @param {Boolean} [options.statusQuery.uidValidity] if `true` request mailbox `UIDVALIDITY` value
|
|
1565
|
-
* @param {Boolean} [options.statusQuery.unseen] if `true` request count of unseen messages
|
|
1566
|
-
* @param {Boolean} [options.statusQuery.highestModseq] if `true` request last known modseq value
|
|
1567
|
-
* @param {Object} [options.specialUseHints] set specific paths as special use folders, this would override special use flags provided from the server
|
|
1568
|
-
* @param {String} [options.specialUseHints.sent] Path to "Sent Mail" folder
|
|
1569
|
-
* @param {String} [options.specialUseHints.trash] Path to "Trash" folder
|
|
1570
|
-
* @param {String} [options.specialUseHints.junk] Path to "Junk Mail" folder
|
|
1571
|
-
* @param {String} [options.specialUseHints.drafts] Path to "Drafts" folder
|
|
1576
|
+
* @param {ListOptions} [options] defines additional listing options
|
|
1572
1577
|
* @returns {Promise<ListResponse[]>} An array of ListResponse objects
|
|
1573
1578
|
*
|
|
1574
1579
|
* @example
|
|
@@ -1589,7 +1594,7 @@ class ImapFlow extends EventEmitter {
|
|
|
1589
1594
|
* @property {String} path mailbox path
|
|
1590
1595
|
* @property {String} name mailbox name (last part of path after delimiter)
|
|
1591
1596
|
* @property {String} delimiter mailbox path delimiter, usually "." or "/"
|
|
1592
|
-
* @property {
|
|
1597
|
+
* @property {String[]} flags list of flags for this mailbox
|
|
1593
1598
|
* @property {String} specialUse one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set
|
|
1594
1599
|
* @property {Boolean} listed `true` if mailbox was found from the output of LIST command
|
|
1595
1600
|
* @property {Boolean} subscribed `true` if mailbox was found from the output of LSUB command
|
|
@@ -1600,14 +1605,16 @@ class ImapFlow extends EventEmitter {
|
|
|
1600
1605
|
/**
|
|
1601
1606
|
* Lists available mailboxes as a tree structured object
|
|
1602
1607
|
*
|
|
1608
|
+
* @param {ListOptions} [options] defines additional listing options
|
|
1603
1609
|
* @returns {Promise<ListTreeResponse>} Tree structured object
|
|
1604
1610
|
*
|
|
1605
1611
|
* @example
|
|
1606
1612
|
* let tree = await client.listTree();
|
|
1607
1613
|
* tree.folders.forEach(mailbox=>console.log(mailbox.path));
|
|
1608
1614
|
*/
|
|
1609
|
-
async listTree() {
|
|
1610
|
-
|
|
1615
|
+
async listTree(options) {
|
|
1616
|
+
options = options || {};
|
|
1617
|
+
let folders = await this.run('LIST', '', '*', options);
|
|
1611
1618
|
this.folders = new Map(folders.map(folder => [folder.path, folder]));
|
|
1612
1619
|
return getFolderTree(folders);
|
|
1613
1620
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -162,44 +162,18 @@ declare module "imapflow" {
|
|
|
162
162
|
* let list = await client.list();
|
|
163
163
|
* list.forEach(mailbox=>console.log(mailbox.path));
|
|
164
164
|
* @param [options] - defines additional listing options
|
|
165
|
-
* @param [options.statusQuery] - request status items for every listed entry
|
|
166
|
-
* @param [options.statusQuery.messages] - if `true` request count of messages
|
|
167
|
-
* @param [options.statusQuery.recent] - if `true` request count of messages with \\Recent tag
|
|
168
|
-
* @param [options.statusQuery.uidNext] - if `true` request predicted next UID
|
|
169
|
-
* @param [options.statusQuery.uidValidity] - if `true` request mailbox `UIDVALIDITY` value
|
|
170
|
-
* @param [options.statusQuery.unseen] - if `true` request count of unseen messages
|
|
171
|
-
* @param [options.statusQuery.highestModseq] - if `true` request last known modseq value
|
|
172
|
-
* @param [options.specialUseHints] - set specific paths as special use folders, this would override special use flags provided from the server
|
|
173
|
-
* @param [options.specialUseHints.sent] - Path to "Sent Mail" folder
|
|
174
|
-
* @param [options.specialUseHints.trash] - Path to "Trash" folder
|
|
175
|
-
* @param [options.specialUseHints.junk] - Path to "Junk Mail" folder
|
|
176
|
-
* @param [options.specialUseHints.drafts] - Path to "Drafts" folder
|
|
177
165
|
* @returns An array of ListResponse objects
|
|
178
166
|
*/
|
|
179
|
-
list(options?:
|
|
180
|
-
statusQuery?: {
|
|
181
|
-
messages?: boolean;
|
|
182
|
-
recent?: boolean;
|
|
183
|
-
uidNext?: boolean;
|
|
184
|
-
uidValidity?: boolean;
|
|
185
|
-
unseen?: boolean;
|
|
186
|
-
highestModseq?: boolean;
|
|
187
|
-
};
|
|
188
|
-
specialUseHints?: {
|
|
189
|
-
sent?: string;
|
|
190
|
-
trash?: string;
|
|
191
|
-
junk?: string;
|
|
192
|
-
drafts?: string;
|
|
193
|
-
};
|
|
194
|
-
}): Promise<ListResponse[]>;
|
|
167
|
+
list(options?: ListOptions): Promise<ListResponse[]>;
|
|
195
168
|
/**
|
|
196
169
|
* Lists available mailboxes as a tree structured object
|
|
197
170
|
* @example
|
|
198
171
|
* let tree = await client.listTree();
|
|
199
172
|
* tree.folders.forEach(mailbox=>console.log(mailbox.path));
|
|
173
|
+
* @param [options] - defines additional listing options
|
|
200
174
|
* @returns Tree structured object
|
|
201
175
|
*/
|
|
202
|
-
listTree(): Promise<ListTreeResponse>;
|
|
176
|
+
listTree(options?: ListOptions): Promise<ListTreeResponse>;
|
|
203
177
|
/**
|
|
204
178
|
* Performs a no-op call against server
|
|
205
179
|
*/
|
|
@@ -660,7 +634,7 @@ declare type ListResponse = {
|
|
|
660
634
|
pathAsListed: string;
|
|
661
635
|
name: string;
|
|
662
636
|
delimiter: string;
|
|
663
|
-
parent:
|
|
637
|
+
parent: String[];
|
|
664
638
|
parentPath: string;
|
|
665
639
|
flags: Set<string>;
|
|
666
640
|
specialUse: string;
|
|
@@ -669,6 +643,37 @@ declare type ListResponse = {
|
|
|
669
643
|
status?: StatusObject;
|
|
670
644
|
};
|
|
671
645
|
|
|
646
|
+
/**
|
|
647
|
+
* @property [statusQuery] - request status items for every listed entry
|
|
648
|
+
* @property [statusQuery.messages] - if `true` request count of messages
|
|
649
|
+
* @property [statusQuery.recent] - if `true` request count of messages with \\Recent tag
|
|
650
|
+
* @property [statusQuery.uidNext] - if `true` request predicted next UID
|
|
651
|
+
* @property [statusQuery.uidValidity] - if `true` request mailbox `UIDVALIDITY` value
|
|
652
|
+
* @property [statusQuery.unseen] - if `true` request count of unseen messages
|
|
653
|
+
* @property [statusQuery.highestModseq] - if `true` request last known modseq value
|
|
654
|
+
* @property [specialUseHints] - set specific paths as special use folders, this would override special use flags provided from the server
|
|
655
|
+
* @property [specialUseHints.sent] - Path to "Sent Mail" folder
|
|
656
|
+
* @property [specialUseHints.trash] - Path to "Trash" folder
|
|
657
|
+
* @property [specialUseHints.junk] - Path to "Junk Mail" folder
|
|
658
|
+
* @property [specialUseHints.drafts] - Path to "Drafts" folder
|
|
659
|
+
*/
|
|
660
|
+
declare type ListOptions = {
|
|
661
|
+
statusQuery?: {
|
|
662
|
+
messages?: boolean;
|
|
663
|
+
recent?: boolean;
|
|
664
|
+
uidNext?: boolean;
|
|
665
|
+
uidValidity?: boolean;
|
|
666
|
+
unseen?: boolean;
|
|
667
|
+
highestModseq?: boolean;
|
|
668
|
+
};
|
|
669
|
+
specialUseHints?: {
|
|
670
|
+
sent?: string;
|
|
671
|
+
trash?: string;
|
|
672
|
+
junk?: string;
|
|
673
|
+
drafts?: string;
|
|
674
|
+
};
|
|
675
|
+
};
|
|
676
|
+
|
|
672
677
|
/**
|
|
673
678
|
* @property root - If `true` then this is root node without any additional properties besides *folders*
|
|
674
679
|
* @property path - mailbox path
|
|
@@ -686,7 +691,7 @@ declare type ListTreeResponse = {
|
|
|
686
691
|
path: string;
|
|
687
692
|
name: string;
|
|
688
693
|
delimiter: string;
|
|
689
|
-
flags:
|
|
694
|
+
flags: String[];
|
|
690
695
|
specialUse: string;
|
|
691
696
|
listed: boolean;
|
|
692
697
|
subscribed: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imapflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.161",
|
|
4
4
|
"description": "IMAP Client for Node",
|
|
5
5
|
"main": "./lib/imap-flow.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://imapflow.com/",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/eslint-parser": "7.24.
|
|
32
|
-
"@babel/eslint-plugin": "7.
|
|
31
|
+
"@babel/eslint-parser": "7.24.5",
|
|
32
|
+
"@babel/eslint-plugin": "7.24.5",
|
|
33
33
|
"@babel/plugin-syntax-class-properties": "7.12.13",
|
|
34
|
-
"@babel/preset-env": "7.24.
|
|
35
|
-
"@types/node": "20.12.
|
|
34
|
+
"@babel/preset-env": "7.24.5",
|
|
35
|
+
"@types/node": "20.12.8",
|
|
36
36
|
"eslint": "8.57.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|
|
38
38
|
"eslint-config-prettier": "9.1.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"libqp": "2.1.0",
|
|
54
54
|
"mailsplit": "5.4.0",
|
|
55
55
|
"nodemailer": "6.9.13",
|
|
56
|
-
"pino": "
|
|
56
|
+
"pino": "9.0.0",
|
|
57
57
|
"socks": "2.8.3"
|
|
58
58
|
}
|
|
59
59
|
}
|