@bobfrankston/mailx 1.0.112 → 1.0.115

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx",
3
- "version": "1.0.112",
3
+ "version": "1.0.115",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -20,7 +20,7 @@
20
20
  "postinstall": "node launcher/builder/postinstall.js"
21
21
  },
22
22
  "dependencies": {
23
- "@bobfrankston/iflow": "^1.0.44",
23
+ "@bobfrankston/iflow": "^1.0.45",
24
24
  "@bobfrankston/miscinfo": "^1.0.7",
25
25
  "@bobfrankston/oauthsupport": "^1.0.20",
26
26
  "@bobfrankston/rust-builder": "^0.1.3",
@@ -805,7 +805,9 @@ export class ImapManager extends EventEmitter {
805
805
  if (!msg?.source)
806
806
  return null;
807
807
  const raw = Buffer.from(msg.source, "utf-8");
808
- await this.bodyStore.putMessage(accountId, folderId, uid, raw);
808
+ const bodyPath = await this.bodyStore.putMessage(accountId, folderId, uid, raw);
809
+ // Update DB so body_path isn't null for on-demand fetches
810
+ this.db.updateBodyPath(accountId, uid, bodyPath);
809
811
  return raw;
810
812
  }
811
813
  catch (e) {
@@ -75,7 +75,10 @@ export class MailxService {
75
75
  hasRemoteContent: false, remoteAllowed: false, attachments: [], emlPath: "", deliveredTo: "", returnPath: "", listUnsubscribe: ""
76
76
  };
77
77
  }
78
- if (raw) {
78
+ if (!raw) {
79
+ bodyText = "[Message body not available — not cached locally and IMAP fetch failed. Try again or re-sync the folder.]";
80
+ }
81
+ else {
79
82
  const parsed = await simpleParser(raw);
80
83
  bodyHtml = parsed.html || "";
81
84
  bodyText = parsed.text || "";
@@ -51,6 +51,7 @@ export declare class MailxDB {
51
51
  getMessageByUid(accountId: string, uid: number, folderId?: number): MessageEnvelope;
52
52
  getMessageBodyPath(accountId: string, uid: number): string;
53
53
  updateMessageFlags(accountId: string, uid: number, flags: string[]): void;
54
+ updateBodyPath(accountId: string, uid: number, bodyPath: string): void;
54
55
  getHighestUid(accountId: string, folderId: number): number;
55
56
  /** Get all UIDs for a folder */
56
57
  getUidsForFolder(accountId: string, folderId: number): number[];
@@ -314,6 +314,9 @@ export class MailxDB {
314
314
  updateMessageFlags(accountId, uid, flags) {
315
315
  this.db.prepare("UPDATE messages SET flags_json = ? WHERE account_id = ? AND uid = ?").run(JSON.stringify(flags), accountId, uid);
316
316
  }
317
+ updateBodyPath(accountId, uid, bodyPath) {
318
+ this.db.prepare("UPDATE messages SET body_path = ? WHERE account_id = ? AND uid = ?").run(bodyPath, accountId, uid);
319
+ }
317
320
  getHighestUid(accountId, folderId) {
318
321
  const r = this.db.prepare("SELECT MAX(uid) as maxUid FROM messages WHERE account_id = ? AND folder_id = ?").get(accountId, folderId);
319
322
  return r?.maxUid || 0;