@bobfrankston/mailx 1.0.296 → 1.0.297

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.
@@ -1 +1 @@
1
- {"height":1421,"width":2151,"x":228,"y":93}
1
+ {"height":1420,"width":2304,"x":528,"y":99}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx",
3
- "version": "1.0.296",
3
+ "version": "1.0.297",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -1239,9 +1239,27 @@ export class ImapManager extends EventEmitter {
1239
1239
  const inbox = this.db.getFolders(accountId).find(f => f.specialUse === "inbox");
1240
1240
  if (!inbox)
1241
1241
  continue;
1242
- await this.withConnection(accountId, async (client) => {
1243
- await this.syncFolder(accountId, inbox.id, client);
1244
- });
1242
+ // Gmail: use REST API, NOT IMAP. Mixing paths causes UID
1243
+ // mismatch — API uses hashed IDs, IMAP uses server-assigned
1244
+ // UIDs. The IMAP reconcile then deletes every API-synced
1245
+ // message because their UIDs don't appear in the IMAP list.
1246
+ if (this.isGmailAccount(accountId)) {
1247
+ const api = this.getGmailProvider(accountId);
1248
+ try {
1249
+ await this.syncFolderViaApi(accountId, inbox, api);
1250
+ }
1251
+ finally {
1252
+ try {
1253
+ await api.close();
1254
+ }
1255
+ catch { /* ignore */ }
1256
+ }
1257
+ }
1258
+ else {
1259
+ await this.withConnection(accountId, async (client) => {
1260
+ await this.syncFolder(accountId, inbox.id, client);
1261
+ });
1262
+ }
1245
1263
  }
1246
1264
  catch (e) {
1247
1265
  console.error(` [inbox] Sync error for ${accountId}: ${e.message}`);