@bobfrankston/mailx-imap 0.1.126 → 0.1.129

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 +22 -0
  2. package/package.json +7 -7
package/index.js CHANGED
@@ -4315,6 +4315,28 @@ export class ImapManager extends EventEmitter {
4315
4315
  this.syncFolder(accountId, target.id).catch(() => { });
4316
4316
  break;
4317
4317
  }
4318
+ case "replaceMessage": {
4319
+ // Attachment strip: swap the server copy for the
4320
+ // modified raw. Ordering is load-bearing — APPEND
4321
+ // first, and only delete the original once the
4322
+ // server confirmed the new copy (APPENDUID). A
4323
+ // failure at any point leaves at least one intact
4324
+ // copy on the server, never zero.
4325
+ if (!action.rawMessage)
4326
+ break;
4327
+ const keepFlags = (action.flags || []).filter((f) => f !== "\\Recent");
4328
+ const newUid = await client.appendMessage(folder.path, action.rawMessage, keepFlags);
4329
+ if (!newUid || newUid <= 0) {
4330
+ throw new Error("replace: server gave no APPENDUID — original kept, will retry");
4331
+ }
4332
+ // Rebind the local row BEFORE deleting the old server
4333
+ // copy: a crash between the two leaves a harmless
4334
+ // duplicate (old + new), never a missing message.
4335
+ this.db.updateMessageUid(accountId, folder.id, action.uid, newUid);
4336
+ await client.deleteMessageByUid(folder.path, action.uid);
4337
+ console.log(` [sync] replaced UID ${action.uid} → ${newUid} in ${folder.path} (attachment strip)`);
4338
+ break;
4339
+ }
4318
4340
  }
4319
4341
  // Success: the local action reached the server. Lift the
4320
4342
  // in-flight delete/move suppression so the destination
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.126",
3
+ "version": "0.1.129",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,9 +9,9 @@
9
9
  },
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "@bobfrankston/mailx-types": "^0.1.30",
13
- "@bobfrankston/mailx-settings": "^0.1.41",
14
- "@bobfrankston/mailx-store": "^0.1.66",
12
+ "@bobfrankston/mailx-types": "^0.1.33",
13
+ "@bobfrankston/mailx-settings": "^0.1.43",
14
+ "@bobfrankston/mailx-store": "^0.1.69",
15
15
  "@bobfrankston/iflow-direct": "^0.1.59",
16
16
  "@bobfrankston/tcp-transport": "^0.1.8",
17
17
  "@bobfrankston/smtp-direct": "^0.1.9",
@@ -37,9 +37,9 @@
37
37
  },
38
38
  ".transformedSnapshot": {
39
39
  "dependencies": {
40
- "@bobfrankston/mailx-types": "^0.1.30",
41
- "@bobfrankston/mailx-settings": "^0.1.41",
42
- "@bobfrankston/mailx-store": "^0.1.66",
40
+ "@bobfrankston/mailx-types": "^0.1.33",
41
+ "@bobfrankston/mailx-settings": "^0.1.43",
42
+ "@bobfrankston/mailx-store": "^0.1.69",
43
43
  "@bobfrankston/iflow-direct": "^0.1.59",
44
44
  "@bobfrankston/tcp-transport": "^0.1.8",
45
45
  "@bobfrankston/smtp-direct": "^0.1.9",