imapflow 1.0.163 → 1.0.165

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 CHANGED
@@ -1,196 +1,182 @@
1
1
  # Changelog
2
2
 
3
- ## [1.0.163](https://github.com/postalsys/imapflow/compare/v1.0.162...v1.0.163) (2024-07-06)
3
+ ## [1.0.165](https://github.com/postalsys/imapflow/compare/v1.0.164...v1.0.165) (2024-11-01)
4
4
 
5
5
 
6
6
  ### Bug Fixes
7
7
 
8
- * **parser:** parse subfolders with square brackets ([0d0e8a6](https://github.com/postalsys/imapflow/commit/0d0e8a6ea379adf11594684d49a1ce5031339939))
9
- * **socket:** Use destroy() instead of destroySoon() ([830c2d1](https://github.com/postalsys/imapflow/commit/830c2d18f3d27eb12dc6babe4edd37fed5f65490))
8
+ * **imap:** Support invalid servers that return a full partial instead of starting byte for a FETCH property ([7281ce9](https://github.com/postalsys/imapflow/commit/7281ce98683946f825b5bfec197beecad7867a70))
10
9
 
11
- ## [1.0.162](https://github.com/postalsys/imapflow/compare/v1.0.161...v1.0.162) (2024-05-07)
10
+ ## [1.0.164](https://github.com/postalsys/imapflow/compare/v1.0.163...v1.0.164) (2024-07-09)
12
11
 
12
+ ### Bug Fixes
13
+
14
+ - **api:** Add fetchAll method ([#207](https://github.com/postalsys/imapflow/issues/207)) ([bc09998](https://github.com/postalsys/imapflow/commit/bc09998270006ea6ff8430b3461619dd9b3e91c8))
15
+
16
+ ## [1.0.163](https://github.com/postalsys/imapflow/compare/v1.0.162...v1.0.163) (2024-07-06)
13
17
 
14
18
  ### Bug Fixes
15
19
 
16
- * **idle:** Do not clear preCheck from other command ([cdf7643](https://github.com/postalsys/imapflow/commit/cdf7643952c975556e11a03ceca85f8a57fe1420))
20
+ - **parser:** parse subfolders with square brackets ([0d0e8a6](https://github.com/postalsys/imapflow/commit/0d0e8a6ea379adf11594684d49a1ce5031339939))
21
+ - **socket:** Use destroy() instead of destroySoon() ([830c2d1](https://github.com/postalsys/imapflow/commit/830c2d18f3d27eb12dc6babe4edd37fed5f65490))
17
22
 
18
- ## [1.0.161](https://github.com/postalsys/imapflow/compare/v1.0.160...v1.0.161) (2024-05-06)
23
+ ## [1.0.162](https://github.com/postalsys/imapflow/compare/v1.0.161...v1.0.162) (2024-05-07)
24
+
25
+ ### Bug Fixes
26
+
27
+ - **idle:** Do not clear preCheck from other command ([cdf7643](https://github.com/postalsys/imapflow/commit/cdf7643952c975556e11a03ceca85f8a57fe1420))
19
28
 
29
+ ## [1.0.161](https://github.com/postalsys/imapflow/compare/v1.0.160...v1.0.161) (2024-05-06)
20
30
 
21
31
  ### Bug Fixes
22
32
 
23
- * **listTree:** pass listing options as an optional argument ([917ba80](https://github.com/postalsys/imapflow/commit/917ba80f21b2fe485154acd252d6565b838e73e6))
33
+ - **listTree:** pass listing options as an optional argument ([917ba80](https://github.com/postalsys/imapflow/commit/917ba80f21b2fe485154acd252d6565b838e73e6))
24
34
 
25
35
  ## [1.0.160](https://github.com/postalsys/imapflow/compare/v1.0.159...v1.0.160) (2024-04-22)
26
36
 
27
-
28
37
  ### Bug Fixes
29
38
 
30
- * **copy:** Updated cipyright year to 2024 ([e3f5040](https://github.com/postalsys/imapflow/commit/e3f5040e8f90523e12108e978ac5002f8caa9e1e))
39
+ - **copy:** Updated cipyright year to 2024 ([e3f5040](https://github.com/postalsys/imapflow/commit/e3f5040e8f90523e12108e978ac5002f8caa9e1e))
31
40
 
32
41
  ## [1.0.159](https://github.com/postalsys/imapflow/compare/v1.0.158...v1.0.159) (2024-04-12)
33
42
 
34
-
35
43
  ### Bug Fixes
36
44
 
37
- * **deps:** Bumped deps ([53ccd8b](https://github.com/postalsys/imapflow/commit/53ccd8b1027782dcd2af6dd1f7d337007a7f79c0))
45
+ - **deps:** Bumped deps ([53ccd8b](https://github.com/postalsys/imapflow/commit/53ccd8b1027782dcd2af6dd1f7d337007a7f79c0))
38
46
 
39
47
  ## [1.0.158](https://github.com/postalsys/imapflow/compare/v1.0.157...v1.0.158) (2024-03-19)
40
48
 
41
-
42
49
  ### Bug Fixes
43
50
 
44
- * **locking:** log extra information about locks ([9790ec5](https://github.com/postalsys/imapflow/commit/9790ec575f405820d05dd4777987a88e0a4e819d))
51
+ - **locking:** log extra information about locks ([9790ec5](https://github.com/postalsys/imapflow/commit/9790ec575f405820d05dd4777987a88e0a4e819d))
45
52
 
46
53
  ## [1.0.157](https://github.com/postalsys/imapflow/compare/v1.0.156...v1.0.157) (2024-03-19)
47
54
 
48
-
49
55
  ### Bug Fixes
50
56
 
51
- * **logs:** Log mailbox lock description ([ce87cf5](https://github.com/postalsys/imapflow/commit/ce87cf5a256ddc324624893a1c17992475fafeb3))
57
+ - **logs:** Log mailbox lock description ([ce87cf5](https://github.com/postalsys/imapflow/commit/ce87cf5a256ddc324624893a1c17992475fafeb3))
52
58
 
53
59
  ## [1.0.156](https://github.com/postalsys/imapflow/compare/v1.0.155...v1.0.156) (2024-03-07)
54
60
 
55
-
56
61
  ### Bug Fixes
57
62
 
58
- * micro-optimizations for parser ([3451ad2](https://github.com/postalsys/imapflow/commit/3451ad235532ca1a64a829f9f2f8e77bcef3a17d))
63
+ - micro-optimizations for parser ([3451ad2](https://github.com/postalsys/imapflow/commit/3451ad235532ca1a64a829f9f2f8e77bcef3a17d))
59
64
 
60
65
  ## [1.0.155](https://github.com/postalsys/imapflow/compare/v1.0.154...v1.0.155) (2024-03-06)
61
66
 
62
-
63
67
  ### Bug Fixes
64
68
 
65
- * **exchange:** handle special error response from exchange ([3ed4198](https://github.com/postalsys/imapflow/commit/3ed4198c1b5504ab0b46926fec179c682988b2e3))
69
+ - **exchange:** handle special error response from exchange ([3ed4198](https://github.com/postalsys/imapflow/commit/3ed4198c1b5504ab0b46926fec179c682988b2e3))
66
70
 
67
71
  ## [1.0.154](https://github.com/postalsys/imapflow/compare/v1.0.153...v1.0.154) (2024-03-05)
68
72
 
69
-
70
73
  ### Bug Fixes
71
74
 
72
- * **FETCH:** throw on failing FETCH ([12f9a45](https://github.com/postalsys/imapflow/commit/12f9a45530c6f3a2f35ba2968819011eea9c32b2))
75
+ - **FETCH:** throw on failing FETCH ([12f9a45](https://github.com/postalsys/imapflow/commit/12f9a45530c6f3a2f35ba2968819011eea9c32b2))
73
76
 
74
77
  ## [1.0.153](https://github.com/postalsys/imapflow/compare/v1.0.152...v1.0.153) (2024-02-29)
75
78
 
76
-
77
79
  ### Bug Fixes
78
80
 
79
- * **deps:** Bumped deps ([559aa72](https://github.com/postalsys/imapflow/commit/559aa72337018f21a3675f4521ce4aae87e0aabb))
81
+ - **deps:** Bumped deps ([559aa72](https://github.com/postalsys/imapflow/commit/559aa72337018f21a3675f4521ce4aae87e0aabb))
80
82
 
81
83
  ## [1.0.152](https://github.com/postalsys/imapflow/compare/v1.0.151...v1.0.152) (2024-02-12)
82
84
 
83
-
84
85
  ### Bug Fixes
85
86
 
86
- * **address:** do not use '@' instead of empyt address if a field does not contain a value ([aeabbde](https://github.com/postalsys/imapflow/commit/aeabbded3bf3c6ba7266f79d4bc001980644da0d))
87
+ - **address:** do not use '@' instead of empyt address if a field does not contain a value ([aeabbde](https://github.com/postalsys/imapflow/commit/aeabbded3bf3c6ba7266f79d4bc001980644da0d))
87
88
 
88
89
  ## [1.0.151](https://github.com/postalsys/imapflow/compare/v1.0.150...v1.0.151) (2024-02-12)
89
90
 
90
-
91
91
  ### Bug Fixes
92
92
 
93
- * **filename:** Fixed filename decoding for the download method ([68a8159](https://github.com/postalsys/imapflow/commit/68a8159a0988245bf3f7c9b002823b01d9d24876))
93
+ - **filename:** Fixed filename decoding for the download method ([68a8159](https://github.com/postalsys/imapflow/commit/68a8159a0988245bf3f7c9b002823b01d9d24876))
94
94
 
95
95
  ## [1.0.150](https://github.com/postalsys/imapflow/compare/v1.0.149...v1.0.150) (2024-02-01)
96
96
 
97
-
98
97
  ### Bug Fixes
99
98
 
100
- * **deps:** Bumped Nodemailer version ([ee02764](https://github.com/postalsys/imapflow/commit/ee0276493494ecf08be557cc0c486fe309d359bf))
99
+ - **deps:** Bumped Nodemailer version ([ee02764](https://github.com/postalsys/imapflow/commit/ee0276493494ecf08be557cc0c486fe309d359bf))
101
100
 
102
101
  ## [1.0.149](https://github.com/postalsys/imapflow/compare/v1.0.148...v1.0.149) (2024-01-31)
103
102
 
104
-
105
103
  ### Bug Fixes
106
104
 
107
- * **flag-colors:** added a method to set Flag Color. The color is also included in the Fetch response structure ([d840951](https://github.com/postalsys/imapflow/commit/d8409513075b864e9131665af3f1670a0714d05c))
105
+ - **flag-colors:** added a method to set Flag Color. The color is also included in the Fetch response structure ([d840951](https://github.com/postalsys/imapflow/commit/d8409513075b864e9131665af3f1670a0714d05c))
108
106
 
109
107
  ## [1.0.148](https://github.com/postalsys/imapflow/compare/v1.0.147...v1.0.148) (2024-01-16)
110
108
 
111
-
112
109
  ### Bug Fixes
113
110
 
114
- * **logout:** Fixed race condition for logout and TCP close. Fixes [#161](https://github.com/postalsys/imapflow/issues/161) ([39a7333](https://github.com/postalsys/imapflow/commit/39a7333a39499e4876abb29149f7c72f2f99a63d))
111
+ - **logout:** Fixed race condition for logout and TCP close. Fixes [#161](https://github.com/postalsys/imapflow/issues/161) ([39a7333](https://github.com/postalsys/imapflow/commit/39a7333a39499e4876abb29149f7c72f2f99a63d))
115
112
 
116
113
  ## [1.0.147](https://github.com/postalsys/imapflow/compare/v1.0.146...v1.0.147) (2023-10-26)
117
114
 
118
-
119
115
  ### Bug Fixes
120
116
 
121
- * **idle:** removed unneeded variable ([da59d9a](https://github.com/postalsys/imapflow/commit/da59d9a960dd0992b22335902808a315b1cb6ded))
117
+ - **idle:** removed unneeded variable ([da59d9a](https://github.com/postalsys/imapflow/commit/da59d9a960dd0992b22335902808a315b1cb6ded))
122
118
 
123
119
  ## [1.0.146](https://github.com/postalsys/imapflow/compare/v1.0.145...v1.0.146) (2023-10-26)
124
120
 
125
-
126
121
  ### Bug Fixes
127
122
 
128
- * **throttling:** automatically retry throttled FETCH commands a few times ([07a9aea](https://github.com/postalsys/imapflow/commit/07a9aea37ae55ed885ccc4c0e3732b367ad82cd3))
123
+ - **throttling:** automatically retry throttled FETCH commands a few times ([07a9aea](https://github.com/postalsys/imapflow/commit/07a9aea37ae55ed885ccc4c0e3732b367ad82cd3))
129
124
 
130
125
  ## [1.0.145](https://github.com/postalsys/imapflow/compare/v1.0.144...v1.0.145) (2023-10-26)
131
126
 
132
-
133
127
  ### Bug Fixes
134
128
 
135
- * **docs:** Fixed mailbox property name in AppendResponseObject ([ca6d789](https://github.com/postalsys/imapflow/commit/ca6d789b761d3117f733ed7b026122098f4d9142))
136
- * **special-use:** support custom special use flags for the Archive folder ([17aa6a8](https://github.com/postalsys/imapflow/commit/17aa6a8baf180a7349fe30f897184eb8e359a498))
129
+ - **docs:** Fixed mailbox property name in AppendResponseObject ([ca6d789](https://github.com/postalsys/imapflow/commit/ca6d789b761d3117f733ed7b026122098f4d9142))
130
+ - **special-use:** support custom special use flags for the Archive folder ([17aa6a8](https://github.com/postalsys/imapflow/commit/17aa6a8baf180a7349fe30f897184eb8e359a498))
137
131
 
138
132
  ## [1.0.144](https://github.com/postalsys/imapflow/compare/v1.0.143...v1.0.144) (2023-09-13)
139
133
 
140
-
141
134
  ### Bug Fixes
142
135
 
143
- * **MS365:** Wait until responding with a throttling response ([#142](https://github.com/postalsys/imapflow/issues/142)) ([09bfb3e](https://github.com/postalsys/imapflow/commit/09bfb3e1b90bdd37bc1c9b40e9284ad4afbd5c72))
136
+ - **MS365:** Wait until responding with a throttling response ([#142](https://github.com/postalsys/imapflow/issues/142)) ([09bfb3e](https://github.com/postalsys/imapflow/commit/09bfb3e1b90bdd37bc1c9b40e9284ad4afbd5c72))
144
137
 
145
138
  ## [1.0.143](https://github.com/postalsys/imapflow/compare/v1.0.142...v1.0.143) (2023-09-04)
146
139
 
147
-
148
140
  ### Bug Fixes
149
141
 
150
- * **release:** updated provenance setting ([e178629](https://github.com/postalsys/imapflow/commit/e1786296569e5a0acfb997b007091925519c7d79))
142
+ - **release:** updated provenance setting ([e178629](https://github.com/postalsys/imapflow/commit/e1786296569e5a0acfb997b007091925519c7d79))
151
143
 
152
144
  ## [1.0.142](https://github.com/postalsys/imapflow/compare/v1.0.141...v1.0.142) (2023-09-04)
153
145
 
154
-
155
146
  ### Bug Fixes
156
147
 
157
- * **release:** updated provenance setting ([4fd5fa8](https://github.com/postalsys/imapflow/commit/4fd5fa8aa74756c1b9ff166febf294acda4792b8))
148
+ - **release:** updated provenance setting ([4fd5fa8](https://github.com/postalsys/imapflow/commit/4fd5fa8aa74756c1b9ff166febf294acda4792b8))
158
149
 
159
150
  ## [1.0.141](https://github.com/postalsys/imapflow/compare/v1.0.140...v1.0.141) (2023-09-04)
160
151
 
161
-
162
152
  ### Bug Fixes
163
153
 
164
- * **readme:** testing note format ([3038c4d](https://github.com/postalsys/imapflow/commit/3038c4d9740af0a5161bbc45dd13b86d4febc0ac))
154
+ - **readme:** testing note format ([3038c4d](https://github.com/postalsys/imapflow/commit/3038c4d9740af0a5161bbc45dd13b86d4febc0ac))
165
155
 
166
156
  ## [1.0.140](https://github.com/postalsys/imapflow/compare/v1.0.139...v1.0.140) (2023-09-04)
167
157
 
168
-
169
158
  ### Bug Fixes
170
159
 
171
- * **license:** bumped license timeframe in README ([9a04730](https://github.com/postalsys/imapflow/commit/9a047309d10c0ef056c53fba3493df9f2fea5a1d))
160
+ - **license:** bumped license timeframe in README ([9a04730](https://github.com/postalsys/imapflow/commit/9a047309d10c0ef056c53fba3493df9f2fea5a1d))
172
161
 
173
162
  ## [1.0.139](https://github.com/postalsys/imapflow/compare/v1.0.138...v1.0.139) (2023-09-04)
174
163
 
175
-
176
164
  ### Bug Fixes
177
165
 
178
- * **license:** Bumped license timeframe ([ce308b6](https://github.com/postalsys/imapflow/commit/ce308b66e5d30819c6bab7d75752528abc4b8436))
166
+ - **license:** Bumped license timeframe ([ce308b6](https://github.com/postalsys/imapflow/commit/ce308b66e5d30819c6bab7d75752528abc4b8436))
179
167
 
180
168
  ## [1.0.138](https://github.com/postalsys/imapflow/compare/v1.0.137...v1.0.138) (2023-09-04)
181
169
 
182
-
183
170
  ### Bug Fixes
184
171
 
185
- * **release:** Added package-lock ([e35bda8](https://github.com/postalsys/imapflow/commit/e35bda8a2b14503ba30a46b555df82ab1084cf5a))
186
- * **release:** updated package-lock ([b59220f](https://github.com/postalsys/imapflow/commit/b59220f54a58111e0b3259c502ff51b2a624f397))
172
+ - **release:** Added package-lock ([e35bda8](https://github.com/postalsys/imapflow/commit/e35bda8a2b14503ba30a46b555df82ab1084cf5a))
173
+ - **release:** updated package-lock ([b59220f](https://github.com/postalsys/imapflow/commit/b59220f54a58111e0b3259c502ff51b2a624f397))
187
174
 
188
175
  ## [1.0.137](https://github.com/postalsys/imapflow/compare/v1.0.136...v1.0.137) (2023-09-04)
189
176
 
190
-
191
177
  ### Bug Fixes
192
178
 
193
- * **deps:** Bumped dependencies ([e8f5e8c](https://github.com/postalsys/imapflow/commit/e8f5e8ce431debddeecf523fa8739ae5ad23c659))
179
+ - **deps:** Bumped dependencies ([e8f5e8c](https://github.com/postalsys/imapflow/commit/e8f5e8ce431debddeecf523fa8739ae5ad23c659))
194
180
 
195
181
  ## CHANGELOG
196
182
 
@@ -240,7 +226,7 @@
240
226
 
241
227
  - 1.0.112 - 2022-10-16
242
228
 
243
- - Improved ID compatiblity with servers that allow ID only after login
229
+ - Improved ID compatibility with servers that allow ID only after login
244
230
 
245
231
  - 1.0.111 - 2022-10-13
246
232
 
@@ -448,7 +434,7 @@
448
434
 
449
435
  - 1.0.42 - 2020-04-13
450
436
 
451
- - Try to hande edge case when authenticating against Exchange IMAP
437
+ - Try to handle edge case when authenticating against Exchange IMAP
452
438
 
453
439
  - 1.0.41 - 2020-04-12
454
440
 
@@ -105,7 +105,7 @@ async function runIdle(connection) {
105
105
  }
106
106
  }
107
107
 
108
- // Listes for changes in mailbox
108
+ // Listens for changes in mailbox
109
109
  module.exports = async (connection, maxIdleTime) => {
110
110
  if (connection.state !== connection.states.SELECTED) {
111
111
  // nothing to do here
@@ -61,7 +61,7 @@ module.exports = async (response, options) => {
61
61
  lastType = 'LIST';
62
62
  resp.push(formatRespEntry('('));
63
63
 
64
- // check if we need to skip separtor WS between two arrays
64
+ // check if we need to skip separator WS between two arrays
65
65
  let subArray = node.length > 1 && Array.isArray(node[0]);
66
66
 
67
67
  for (let child of node) {
package/lib/imap-flow.js CHANGED
@@ -1330,7 +1330,7 @@ class ImapFlow extends EventEmitter {
1330
1330
 
1331
1331
  this.greetingTimeout = setTimeout(() => {
1332
1332
  let err = new Error(`Failed to receive greeting from server in required time${!this.secureConnection ? '. Maybe should use TLS?' : ''}`);
1333
- err.code = 'GREEETING_TIMEOUT';
1333
+ err.code = 'GREETING_TIMEOUT';
1334
1334
  err.details = {
1335
1335
  greetingTimeout: this.options.greetingTimeout || GREETING_TIMEOUT
1336
1336
  };
@@ -1371,7 +1371,7 @@ class ImapFlow extends EventEmitter {
1371
1371
  };
1372
1372
 
1373
1373
  if (socket) {
1374
- // socket is already establised via proxy
1374
+ // socket is already established via proxy
1375
1375
  if (this.secureConnection) {
1376
1376
  // TLS socket requires a handshake
1377
1377
  opts.socket = socket;
@@ -1841,7 +1841,7 @@ class ImapFlow extends EventEmitter {
1841
1841
  * @property {Date|string} [sentSince] Matches messages sent after date
1842
1842
  * @property {String} [keyword] Matches messages that have the custom flag set
1843
1843
  * @property {String} [unKeyword] Matches messages that do not have the custom flag set
1844
- * @property {Object.<string, Boolean|String>} [header] Mathces messages with header key set if value is `true` (**NB!** not supported by all servers) or messages where header partially matches a string value
1844
+ * @property {Object.<string, Boolean|String>} [header] Matches messages with header key set if value is `true` (**NB!** not supported by all servers) or messages where header partially matches a string value
1845
1845
  * @property {SearchObject[]} [or] An array of 2 or more {@link SearchObject} objects. At least on of these must match
1846
1846
  */
1847
1847
 
@@ -2010,7 +2010,7 @@ class ImapFlow extends EventEmitter {
2010
2010
  }
2011
2011
 
2012
2012
  /**
2013
- * Delete messages from currently opened mailbox. Method does not indicate info about deleted messages,
2013
+ * Delete messages from the currently opened mailbox. Method does not indicate info about deleted messages,
2014
2014
  * instead you should be using {@link ImapFlow#expunge} event for this
2015
2015
  *
2016
2016
  * @param {SequenceString | Number[] | SearchObject} range Range to filter the messages
@@ -2121,7 +2121,7 @@ class ImapFlow extends EventEmitter {
2121
2121
  }
2122
2122
 
2123
2123
  /**
2124
- * Search messages from currently opened mailbox
2124
+ * Search messages from the currently opened mailbox
2125
2125
  *
2126
2126
  * @param {SearchObject} query Query to filter the messages
2127
2127
  * @param {Object} [options]
@@ -2213,7 +2213,7 @@ class ImapFlow extends EventEmitter {
2213
2213
  * @property {Number} [size] Expected size of the node
2214
2214
  * @property {MessageEnvelopeObject} [envelope] message envelope of embedded RFC822 message
2215
2215
  * @property {String} [disposition] Content disposition
2216
- * @property {Object} [dispositionParameters] Additional parameters for Conent-Disposition
2216
+ * @property {Object} [dispositionParameters] Additional parameters for Content-Disposition
2217
2217
  * @property {MessageStructureObject[]} childNodes An array of child nodes if this is a multipart node. Not present for normal nodes
2218
2218
  */
2219
2219
 
@@ -2240,7 +2240,7 @@ class ImapFlow extends EventEmitter {
2240
2240
  */
2241
2241
 
2242
2242
  /**
2243
- * Fetch messages from currently opened mailbox
2243
+ * Fetch messages from the currently opened mailbox
2244
2244
  *
2245
2245
  * @param {SequenceString | Number[] | SearchObject} range Range of messages to fetch
2246
2246
  * @param {FetchQueryObject} query Fetch query
@@ -2353,7 +2353,38 @@ class ImapFlow extends EventEmitter {
2353
2353
  }
2354
2354
 
2355
2355
  /**
2356
- * Fetch a single message from currently opened mailbox
2356
+ * Fetch messages from the currently opened mailbox.
2357
+ *
2358
+ * This method will fetch all messages before resolving the promise, unlike .fetch(), which
2359
+ * is an async generator. Do not use large ranges like 1:*, as this might exhaust all available
2360
+ * memory if the mailbox contains a large number of emails.
2361
+ * @param {SequenceString | Number[] | SearchObject} range Range of messages to fetch
2362
+ * @param {FetchQueryObject} query Fetch query
2363
+ * @param {Object} [options]
2364
+ * @param {Boolean} [options.uid] If `true` then uses UID numbers instead of sequence numbers for `range`
2365
+ * @param {BigInt} [options.changedSince] If set then only messages with a higher modseq value are returned. Ignored if server does not support `CONDSTORE` extension.
2366
+ * @param {Boolean} [options.binary=false] If `true` then requests a binary response if the server supports this
2367
+ * @returns {Promise<FetchMessageObject[]>} Array of Message data object
2368
+ *
2369
+ * @example
2370
+ * let mailbox = await client.mailboxOpen('INBOX');
2371
+ * // fetch UID for all messages in a mailbox
2372
+ * const messages = await client.fetchAll('1:*', {uid: true});
2373
+ * for (let msg of messages){
2374
+ * console.log(msg.uid);
2375
+ * }
2376
+ */
2377
+ async fetchAll(range, query, options) {
2378
+ const results = [];
2379
+ const generator = this.fetch(range, query, options);
2380
+ for await (const message of generator) {
2381
+ results.push(message);
2382
+ }
2383
+ return results;
2384
+ }
2385
+
2386
+ /**
2387
+ * Fetch a single message from the currently opened mailbox
2357
2388
  *
2358
2389
  * @param {SequenceString} seq Single UID or sequence number of the message to fetch for
2359
2390
  * @param {FetchQueryObject} query Fetch query
@@ -2397,14 +2428,14 @@ class ImapFlow extends EventEmitter {
2397
2428
  * @property {Object} meta content metadata
2398
2429
  * @property {number} meta.expectedSize The fetch response size
2399
2430
  * @property {String} meta.contentType Content-Type of the streamed file. If part was not set then this value is "message/rfc822"
2400
- * @property {String} [meta.charset] Charset of the body part. Text parts are automaticaly converted to UTF-8, attachments are kept as is
2431
+ * @property {String} [meta.charset] Charset of the body part. Text parts are automatically converted to UTF-8, attachments are kept as is
2401
2432
  * @property {String} [meta.disposition] Content-Disposition of the streamed file
2402
2433
  * @property {String} [meta.filename] Filename of the streamed body part
2403
2434
  * @property {ReadableStream} content Streamed content
2404
2435
  */
2405
2436
 
2406
2437
  /**
2407
- * Download either full rfc822 formated message or a specific bodystructure part as a Stream.
2438
+ * Download either full rfc822 formatted message or a specific bodystructure part as a Stream.
2408
2439
  * Bodystructure parts are decoded so the resulting stream is a binary file. Text content
2409
2440
  * is automatically converted to UTF-8 charset.
2410
2441
  *
@@ -3062,7 +3093,7 @@ class ImapFlow extends EventEmitter {
3062
3093
  }
3063
3094
 
3064
3095
  /**
3065
- * Connection close event. **NB!** ImapFlow does not handle reconncts automatically.
3096
+ * Connection close event. **NB!** ImapFlow does not handle reconnects automatically.
3066
3097
  * So whenever a 'close' event occurs you must create a new connection yourself.
3067
3098
  *
3068
3099
  * @event module:imapflow~ImapFlow#close
package/lib/tools.js CHANGED
@@ -250,7 +250,7 @@ module.exports = {
250
250
  )
251
251
  .toString()
252
252
  .toLowerCase()
253
- .replace(/<\d+>$/, '');
253
+ .replace(/<\d+(\.\d+)?>$/, '');
254
254
  continue;
255
255
  }
256
256
  if (typeof key !== 'string') {
package/lib/types.d.ts CHANGED
@@ -355,7 +355,7 @@ declare module "imapflow" {
355
355
  unchangedSince?: bigint;
356
356
  }): Promise<Boolean>;
357
357
  /**
358
- * Delete messages from currently opened mailbox. Method does not indicate info about deleted messages,
358
+ * Delete messages from the currently opened mailbox. Method does not indicate info about deleted messages,
359
359
  * instead you should be using {@link ImapFlow#expunge} event for this
360
360
  * @example
361
361
  * let mailbox = await client.mailboxOpen('INBOX');
@@ -410,7 +410,7 @@ declare module "imapflow" {
410
410
  uid?: boolean;
411
411
  }): Promise<CopyResponseObject>;
412
412
  /**
413
- * Search messages from currently opened mailbox
413
+ * Search messages from the currently opened mailbox
414
414
  * @example
415
415
  * let mailbox = await client.mailboxOpen('INBOX');
416
416
  * // find all unseen messages
@@ -431,7 +431,7 @@ declare module "imapflow" {
431
431
  uid?: boolean;
432
432
  }): Promise<Number[]>;
433
433
  /**
434
- * Fetch messages from currently opened mailbox
434
+ * Fetch messages from the currently opened mailbox
435
435
  * @example
436
436
  * let mailbox = await client.mailboxOpen('INBOX');
437
437
  * // fetch UID for all messages in a mailbox
@@ -452,7 +452,32 @@ declare module "imapflow" {
452
452
  binary?: boolean;
453
453
  }): void;
454
454
  /**
455
- * Fetch a single message from currently opened mailbox
455
+ * Fetch messages from the currently opened mailbox.
456
+ *
457
+ * This method will fetch all messages before resolving the promise, unlike .fetch(), which
458
+ * is an async generator. Do not use large ranges like 1:*, as this might exhaust all available
459
+ * memory if the mailbox contains a large number of emails.
460
+ * @example
461
+ * let mailbox = await client.mailboxOpen('INBOX');
462
+ * // fetch UID for all messages in a mailbox
463
+ * const messages = await client.fetchAll('1:*', {uid: true});
464
+ * for (let msg of messages){
465
+ * console.log(msg.uid);
466
+ * }
467
+ * @param range - Range of messages to fetch
468
+ * @param query - Fetch query
469
+ * @param [options.uid] - If `true` then uses UID numbers instead of sequence numbers for `range`
470
+ * @param [options.changedSince] - If set then only messages with a higher modseq value are returned. Ignored if server does not support `CONDSTORE` extension.
471
+ * @param [options.binary = false] - If `true` then requests a binary response if the server supports this
472
+ * @returns Array of Message data object
473
+ */
474
+ fetchAll(range: SequenceString | Number[] | SearchObject, query: FetchQueryObject, options?: {
475
+ uid?: boolean;
476
+ changedSince?: bigint;
477
+ binary?: boolean;
478
+ }): Promise<FetchMessageObject[]>;
479
+ /**
480
+ * Fetch a single message from the currently opened mailbox
456
481
  * @example
457
482
  * let mailbox = await client.mailboxOpen('INBOX');
458
483
  * // fetch UID for the last email in the selected mailbox
@@ -469,7 +494,7 @@ declare module "imapflow" {
469
494
  binary?: boolean;
470
495
  }): Promise<FetchMessageObject>;
471
496
  /**
472
- * Download either full rfc822 formated message or a specific bodystructure part as a Stream.
497
+ * Download either full rfc822 formatted message or a specific bodystructure part as a Stream.
473
498
  * Bodystructure parts are decoded so the resulting stream is a binary file. Text content
474
499
  * is automatically converted to UTF-8 charset.
475
500
  * @example
@@ -787,7 +812,7 @@ declare type SequenceString = string;
787
812
  * @property [sentSince] - Matches messages sent after date
788
813
  * @property [keyword] - Matches messages that have the custom flag set
789
814
  * @property [unKeyword] - Matches messages that do not have the custom flag set
790
- * @property [header] - Mathces messages with header key set if value is `true` (**NB!** not supported by all servers) or messages where header partially matches a string value
815
+ * @property [header] - Matches messages with header key set if value is `true` (**NB!** not supported by all servers) or messages where header partially matches a string value
791
816
  * @property [or] - An array of 2 or more {@link SearchObject} objects. At least on of these must match
792
817
  */
793
818
  declare type SearchObject = {
@@ -931,7 +956,7 @@ declare type MessageEnvelopeObject = {
931
956
  * @property [size] - Expected size of the node
932
957
  * @property [envelope] - message envelope of embedded RFC822 message
933
958
  * @property [disposition] - Content disposition
934
- * @property [dispositionParameters] - Additional parameters for Conent-Disposition
959
+ * @property [dispositionParameters] - Additional parameters for Content-Disposition
935
960
  * @property childNodes - An array of child nodes if this is a multipart node. Not present for normal nodes
936
961
  */
937
962
  declare type MessageStructureObject = {
@@ -987,7 +1012,7 @@ declare type FetchMessageObject = {
987
1012
  * @property meta - content metadata
988
1013
  * @property meta.expectedSize - The fetch response size
989
1014
  * @property meta.contentType - Content-Type of the streamed file. If part was not set then this value is "message/rfc822"
990
- * @property [meta.charset] - Charset of the body part. Text parts are automaticaly converted to UTF-8, attachments are kept as is
1015
+ * @property [meta.charset] - Charset of the body part. Text parts are automatically converted to UTF-8, attachments are kept as is
991
1016
  * @property [meta.disposition] - Content-Disposition of the streamed file
992
1017
  * @property [meta.filename] - Filename of the streamed body part
993
1018
  * @property content - Streamed content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "1.0.163",
3
+ "version": "1.0.165",
4
4
  "description": "IMAP Client for Node",
5
5
  "main": "./lib/imap-flow.js",
6
6
  "scripts": {
@@ -28,21 +28,21 @@
28
28
  },
29
29
  "homepage": "https://imapflow.com/",
30
30
  "devDependencies": {
31
- "@babel/eslint-parser": "7.24.7",
32
- "@babel/eslint-plugin": "7.24.7",
31
+ "@babel/eslint-parser": "7.25.9",
32
+ "@babel/eslint-plugin": "7.25.9",
33
33
  "@babel/plugin-syntax-class-properties": "7.12.13",
34
- "@babel/preset-env": "7.24.7",
35
- "@types/node": "20.14.10",
34
+ "@babel/preset-env": "7.26.0",
35
+ "@types/node": "22.8.6",
36
36
  "eslint": "8.57.0",
37
37
  "eslint-config-nodemailer": "1.2.0",
38
38
  "eslint-config-prettier": "9.1.0",
39
39
  "grunt": "1.6.1",
40
- "grunt-cli": "1.4.3",
40
+ "grunt-cli": "1.5.0",
41
41
  "grunt-contrib-nodeunit": "5.0.0",
42
42
  "grunt-eslint": "24.3.0",
43
43
  "imapflow-jsdoc-template": "3.4.0-imapflow.1",
44
44
  "jsdoc": "3.6.11",
45
- "st": "3.0.0",
45
+ "st": "3.0.1",
46
46
  "tsd-jsdoc": "2.5.0"
47
47
  },
48
48
  "dependencies": {
@@ -52,8 +52,8 @@
52
52
  "libmime": "5.3.5",
53
53
  "libqp": "2.1.0",
54
54
  "mailsplit": "5.4.0",
55
- "nodemailer": "6.9.14",
56
- "pino": "9.2.0",
55
+ "nodemailer": "6.9.16",
56
+ "pino": "9.5.0",
57
57
  "socks": "2.8.3"
58
58
  }
59
59
  }
@@ -1002,3 +1002,62 @@ module.exports['IMAP Parser, subfolder square bracket'] = test =>
1002
1002
  { type: 'ATOM', value: 'INBOX.[Airmail].Snooze' }
1003
1003
  ]);
1004
1004
  });
1005
+
1006
+ module.exports['IMAP Parser, FETCH with full range'] = test =>
1007
+ asyncWrapper(test, async test => {
1008
+ let parsed = await parser('* 32 FETCH (UID 32 RFC822.SIZE 3991 BODY[2.MIME] "(* 61B literal *)" BODY[2]<0.65536> "(* 6B literal *)")');
1009
+ console.log(JSON.stringify(parsed.attributes));
1010
+ test.deepEqual(parsed.attributes, [
1011
+ {
1012
+ type: 'ATOM',
1013
+ value: 'FETCH'
1014
+ },
1015
+ [
1016
+ {
1017
+ type: 'ATOM',
1018
+ value: 'UID'
1019
+ },
1020
+ {
1021
+ type: 'ATOM',
1022
+ value: '32'
1023
+ },
1024
+ {
1025
+ type: 'ATOM',
1026
+ value: 'RFC822.SIZE'
1027
+ },
1028
+ {
1029
+ type: 'ATOM',
1030
+ value: '3991'
1031
+ },
1032
+ {
1033
+ type: 'ATOM',
1034
+ value: 'BODY',
1035
+ section: [
1036
+ {
1037
+ type: 'ATOM',
1038
+ value: '2.MIME'
1039
+ }
1040
+ ]
1041
+ },
1042
+ {
1043
+ type: 'STRING',
1044
+ value: '(* 61B literal *)'
1045
+ },
1046
+ {
1047
+ type: 'ATOM',
1048
+ value: 'BODY',
1049
+ section: [
1050
+ {
1051
+ type: 'ATOM',
1052
+ value: '2'
1053
+ }
1054
+ ],
1055
+ partial: [0, 65536]
1056
+ },
1057
+ {
1058
+ type: 'STRING',
1059
+ value: '(* 6B literal *)'
1060
+ }
1061
+ ]
1062
+ ]);
1063
+ });