@bobfrankston/iflow 1.0.56 → 1.0.57
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/imaplib/imap-native.js +5 -2
- package/package.json +1 -1
package/imaplib/imap-native.js
CHANGED
|
@@ -293,7 +293,8 @@ export class NativeImapClient {
|
|
|
293
293
|
const uids = await this.search(`UID ${sinceUid + 1}:*`);
|
|
294
294
|
if (uids.length === 0)
|
|
295
295
|
return [];
|
|
296
|
-
|
|
296
|
+
uids.reverse(); // Newest first
|
|
297
|
+
console.log(` [fetch] ${uids.length} UIDs since ${sinceUid} (newest first)`);
|
|
297
298
|
if (uids.length <= NativeImapClient.INITIAL_CHUNK_SIZE) {
|
|
298
299
|
const msgs = await this.fetchMessages(uids.join(","), options);
|
|
299
300
|
if (onChunk)
|
|
@@ -323,7 +324,9 @@ export class NativeImapClient {
|
|
|
323
324
|
const uids = await this.search(criteria);
|
|
324
325
|
if (uids.length === 0)
|
|
325
326
|
return [];
|
|
326
|
-
|
|
327
|
+
// Reverse so newest messages (highest UIDs) come first
|
|
328
|
+
uids.reverse();
|
|
329
|
+
console.log(` [fetch] ${uids.length} UIDs to fetch (newest first)`);
|
|
327
330
|
const allMessages = [];
|
|
328
331
|
let chunkSize = NativeImapClient.INITIAL_CHUNK_SIZE;
|
|
329
332
|
for (let i = 0; i < uids.length; i += chunkSize) {
|