@bobfrankston/rmfmail 1.1.29 → 1.1.30

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.
@@ -2496,11 +2496,29 @@ export class ImapManager extends EventEmitter {
2496
2496
  }
2497
2497
  : undefined;
2498
2498
 
2499
+ // Deletion push: when the server expunges a message from
2500
+ // INBOX while we're parked in IDLE (e.g. the user deletes it
2501
+ // in Thunderbird), reconcile it locally right away instead of
2502
+ // waiting for the 5-minute poll. Debounced — a cleanup pass
2503
+ // fires a burst of EXPUNGE notifications; collapse them into
2504
+ // one syncFolder. syncFolder's set-diff drops the gone rows.
2505
+ let expungeTimer: ReturnType<typeof setTimeout> | null = null;
2506
+ const onExpunge = (): void => {
2507
+ if (expungeTimer) clearTimeout(expungeTimer);
2508
+ expungeTimer = setTimeout(() => {
2509
+ expungeTimer = null;
2510
+ const inbox = this.db.getFolders(accountId).find(f => f.specialUse === "inbox");
2511
+ if (!inbox) return;
2512
+ console.log(` [idle] ${accountId}: INBOX expunge pushed → reconcile`);
2513
+ this.syncFolder(accountId, inbox.id).catch(e =>
2514
+ console.error(` [idle] expunge reconcile failed: ${e.message}`));
2515
+ }, 2000);
2516
+ };
2499
2517
  const stop = await watchClient.watchMailbox("INBOX", (newCount: number) => {
2500
2518
  console.log(` [idle] ${accountId}: ${newCount} new message(s)`);
2501
2519
  this.syncInboxNewOnly(accountId).catch(e =>
2502
2520
  console.error(` [idle] sync error: ${e.message}`));
2503
- }, { notifySpec, onMailboxStatus });
2521
+ }, { notifySpec, onMailboxStatus, onExpunge });
2504
2522
  this.watchers.set(accountId, async () => {
2505
2523
  await stop();
2506
2524
  await watchClient.logout();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bobfrankston/mailx-imap",
9
- "version": "0.1.47",
9
+ "version": "0.1.48",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@bobfrankston/iflow-direct": "^0.1.27",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-store",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",