@bobfrankston/mailx-imap 0.1.111 → 0.1.112

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.
Files changed (2) hide show
  1. package/index.js +6 -2
  2. package/package.json +9 -9
package/index.js CHANGED
@@ -1307,7 +1307,7 @@ export class ImapManager extends EventEmitter {
1307
1307
  return dbFolders;
1308
1308
  }
1309
1309
  /** Store a batch of messages to DB immediately — used by onChunk for incremental sync */
1310
- async storeMessages(accountId, folderId, folder, msgs, highestUid) {
1310
+ async storeMessages(accountId, folderId, folder, msgs, highestUid, liveServerUids) {
1311
1311
  // Chunked transactions: better-sqlite3 is synchronous and an open
1312
1312
  // transaction blocks every other query on the same DB. A 1881-row
1313
1313
  // INBOX sync inside ONE transaction locked the connection for ~1.5 s
@@ -1384,6 +1384,7 @@ export class ImapManager extends EventEmitter {
1384
1384
  cc: toEmailAddresses(msg.cc || []),
1385
1385
  flags, size: msg.size || 0, hasAttachments, preview, bodyPath,
1386
1386
  exclusive: true, // IMAP path → one folder per message
1387
+ liveServerUids,
1387
1388
  },
1388
1389
  ftsBody,
1389
1390
  });
@@ -1581,7 +1582,10 @@ export class ImapManager extends EventEmitter {
1581
1582
  const chunk = toFetch.slice(i, i + BACKFILL_CHUNK_SIZE);
1582
1583
  try {
1583
1584
  const got = await client.fetchMessages(folderPath, chunk.join(","), { source: false });
1584
- recoveredCount += await this.storeMessages(accountId, folderId, folder, got, 0);
1585
+ // Pass the server's live UID list so move-detect can tell a
1586
+ // duplicate delivery (both uids live in this folder) from a
1587
+ // real move — see upsertMessage.liveServerUids.
1588
+ recoveredCount += await this.storeMessages(accountId, folderId, folder, got, 0, new Set(serverUids));
1585
1589
  }
1586
1590
  catch (e) {
1587
1591
  console.error(` ${folderPath}: backfill chunk ${i}-${i + chunk.length} failed (${e?.message || e}) — keeping ${recoveredCount} so far, resuming next cycle`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.111",
3
+ "version": "0.1.112",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,13 +9,13 @@
9
9
  },
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "@bobfrankston/mailx-types": "^0.1.21",
13
- "@bobfrankston/mailx-settings": "^0.1.32",
14
- "@bobfrankston/mailx-store": "^0.1.56",
12
+ "@bobfrankston/mailx-types": "^0.1.22",
13
+ "@bobfrankston/mailx-settings": "^0.1.33",
14
+ "@bobfrankston/mailx-store": "^0.1.57",
15
15
  "@bobfrankston/iflow-direct": "^0.1.56",
16
16
  "@bobfrankston/tcp-transport": "^0.1.7",
17
17
  "@bobfrankston/smtp-direct": "^0.1.9",
18
- "@bobfrankston/mailx-sync": "^0.1.25",
18
+ "@bobfrankston/mailx-sync": "^0.1.27",
19
19
  "@bobfrankston/oauthsupport": "^1.0.33"
20
20
  },
21
21
  "repository": {
@@ -37,13 +37,13 @@
37
37
  },
38
38
  ".transformedSnapshot": {
39
39
  "dependencies": {
40
- "@bobfrankston/mailx-types": "^0.1.21",
41
- "@bobfrankston/mailx-settings": "^0.1.32",
42
- "@bobfrankston/mailx-store": "^0.1.56",
40
+ "@bobfrankston/mailx-types": "^0.1.22",
41
+ "@bobfrankston/mailx-settings": "^0.1.33",
42
+ "@bobfrankston/mailx-store": "^0.1.57",
43
43
  "@bobfrankston/iflow-direct": "^0.1.56",
44
44
  "@bobfrankston/tcp-transport": "^0.1.7",
45
45
  "@bobfrankston/smtp-direct": "^0.1.9",
46
- "@bobfrankston/mailx-sync": "^0.1.25",
46
+ "@bobfrankston/mailx-sync": "^0.1.27",
47
47
  "@bobfrankston/oauthsupport": "^1.0.33"
48
48
  }
49
49
  }