@bobfrankston/mailx-imap 0.1.59 → 0.1.61
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/index.js +32 -2
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -2597,6 +2597,14 @@ export class ImapManager extends EventEmitter {
|
|
|
2597
2597
|
* the user clicked, they're waiting, this jumps ahead of any background
|
|
2598
2598
|
* prefetch sitting in the slow lane. */
|
|
2599
2599
|
async fetchMessageBody(accountId, folderId, uid) {
|
|
2600
|
+
// Belt-and-braces against `UID FETCH 0`. The IMAP server rejects it as
|
|
2601
|
+
// BAD "Invalid uidset" and the connection slot is consumed for the
|
|
2602
|
+
// round-trip. The enqueue path now guards too — this catches direct
|
|
2603
|
+
// callers that bypass the queue (Bob 2026-05-25).
|
|
2604
|
+
if (!uid || !Number.isFinite(uid) || uid <= 0) {
|
|
2605
|
+
console.error(`[imap] fetchMessageBody rejected invalid uid=${uid} for ${accountId}/folder${folderId}`);
|
|
2606
|
+
return null;
|
|
2607
|
+
}
|
|
2600
2608
|
const envelope = this.db.getMessageByUid(accountId, uid, folderId);
|
|
2601
2609
|
let storedPath = envelope?.bodyPath || "";
|
|
2602
2610
|
if (!storedPath)
|
|
@@ -4441,7 +4449,19 @@ export class ImapManager extends EventEmitter {
|
|
|
4441
4449
|
return;
|
|
4442
4450
|
let reconciled = 0;
|
|
4443
4451
|
let appended = 0;
|
|
4444
|
-
|
|
4452
|
+
// Use a DEDICATED IMAP client for sent-sweep — do NOT share the
|
|
4453
|
+
// slow-lane ops client. The priority-INBOX sync grabs the slow-lane
|
|
4454
|
+
// client via getOpsClient() (no lane queueing) and runs SEARCH→FETCH
|
|
4455
|
+
// as a logical transaction; if sent-sweep's searchByHeader (SELECT
|
|
4456
|
+
// Sent → SEARCH → CLOSE) interleaves on the same wire between the
|
|
4457
|
+
// sync's SEARCH and FETCH, the FETCH lands with no mailbox selected
|
|
4458
|
+
// and Dovecot returns "BAD No mailbox selected" — new mail never
|
|
4459
|
+
// lands locally (Bob 2026-05-25: "not seeing recent mail").
|
|
4460
|
+
// iflow-direct serializes per-command, not per-task, so reusing the
|
|
4461
|
+
// shared client is unsafe across logical transactions. A dedicated
|
|
4462
|
+
// client is the smallest surgical fix.
|
|
4463
|
+
const client = await this.createClientWithLimit(accountId);
|
|
4464
|
+
try {
|
|
4445
4465
|
for (const row of rows) {
|
|
4446
4466
|
const msgId = row.message_id;
|
|
4447
4467
|
if (!msgId)
|
|
@@ -4485,7 +4505,17 @@ export class ImapManager extends EventEmitter {
|
|
|
4485
4505
|
}
|
|
4486
4506
|
}
|
|
4487
4507
|
}
|
|
4488
|
-
}
|
|
4508
|
+
}
|
|
4509
|
+
finally {
|
|
4510
|
+
try {
|
|
4511
|
+
await (client._realLogout || client.logout)();
|
|
4512
|
+
}
|
|
4513
|
+
catch { /* */ }
|
|
4514
|
+
try {
|
|
4515
|
+
client.destroy?.();
|
|
4516
|
+
}
|
|
4517
|
+
catch { /* */ }
|
|
4518
|
+
}
|
|
4489
4519
|
if (reconciled + appended > 0) {
|
|
4490
4520
|
this.emit("folderCountsChanged", accountId, {});
|
|
4491
4521
|
console.log(` [sent-sweep] ${accountId}: ${reconciled} rebound, ${appended} re-appended`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@bobfrankston/mailx-types": "^0.1.18",
|
|
13
13
|
"@bobfrankston/mailx-settings": "^0.1.22",
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.37",
|
|
15
15
|
"@bobfrankston/iflow-direct": "^0.1.50",
|
|
16
16
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
17
17
|
"@bobfrankston/smtp-direct": "^0.1.8",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@bobfrankston/mailx-types": "^0.1.18",
|
|
41
41
|
"@bobfrankston/mailx-settings": "^0.1.22",
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.37",
|
|
43
43
|
"@bobfrankston/iflow-direct": "^0.1.50",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.8",
|