@bobfrankston/mailx-imap 0.1.40 → 0.1.42

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 +7 -5
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -5,12 +5,11 @@
5
5
  */
6
6
  import { createAutoImapConfig, CompatImapClient } from "@bobfrankston/iflow-direct";
7
7
  import { authenticateOAuth } from "@bobfrankston/oauthsupport";
8
- import { FileMessageStore } from "@bobfrankston/mailx-store";
8
+ import { FileMessageStore, parseSerial } from "@bobfrankston/mailx-store";
9
9
  import { loadSettings, getStorePath, getConfigDir, getHistoryDays, getPrefetch } from "@bobfrankston/mailx-settings";
10
10
  import { EventEmitter } from "node:events";
11
11
  import * as fs from "node:fs";
12
12
  import * as path from "node:path";
13
- import { simpleParser } from "mailparser";
14
13
  import { GmailApiProvider } from "./providers/gmail-api.js";
15
14
  import { SmtpClient } from "@bobfrankston/smtp-direct";
16
15
  import * as os from "node:os";
@@ -99,7 +98,7 @@ function decodeEntities(text) {
99
98
  /** Extract a plain-text preview from message source */
100
99
  async function extractPreview(source) {
101
100
  try {
102
- const parsed = await simpleParser(source);
101
+ const parsed = await parseSerial(source, "background");
103
102
  const bodyText = parsed.text || "";
104
103
  const bodyHtml = parsed.html || "";
105
104
  // Use text part; fall back to stripping HTML tags if text is empty
@@ -972,8 +971,11 @@ export class ImapManager extends EventEmitter {
972
971
  *
973
972
  * Fires the same emits as a normal sync so the UI updates. */
974
973
  async insertLocalRowFromSource(accountId, folder, uid, source, flags) {
975
- const { simpleParser } = await import("mailparser");
976
- const parsed = await simpleParser(source);
974
+ // insertLocalRowFromSource runs right after sendMessage — that's a
975
+ // user-initiated path but the parse cost is on the post-send
976
+ // background work, not the click-through. Tag as background so a
977
+ // concurrent user-click foreground parse jumps ahead.
978
+ const parsed = await parseSerial(source, "background");
977
979
  // Coerce mailparser AddressObject(s) into the flat `{name, address}[]`
978
980
  // shape storeMessages's downstream toEmailAddresses expects.
979
981
  // RFC 2047 encoded-word decoding (incl. inside quoted-strings) is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -11,8 +11,8 @@
11
11
  "dependencies": {
12
12
  "@bobfrankston/mailx-types": "^0.1.11",
13
13
  "@bobfrankston/mailx-settings": "^0.1.16",
14
- "@bobfrankston/mailx-store": "^0.1.21",
15
- "@bobfrankston/iflow-direct": "^0.1.41",
14
+ "@bobfrankston/mailx-store": "^0.1.22",
15
+ "@bobfrankston/iflow-direct": "^0.1.42",
16
16
  "@bobfrankston/tcp-transport": "^0.1.6",
17
17
  "@bobfrankston/smtp-direct": "^0.1.8",
18
18
  "@bobfrankston/mailx-sync": "^0.1.16",
@@ -39,8 +39,8 @@
39
39
  "dependencies": {
40
40
  "@bobfrankston/mailx-types": "^0.1.11",
41
41
  "@bobfrankston/mailx-settings": "^0.1.16",
42
- "@bobfrankston/mailx-store": "^0.1.21",
43
- "@bobfrankston/iflow-direct": "^0.1.41",
42
+ "@bobfrankston/mailx-store": "^0.1.22",
43
+ "@bobfrankston/iflow-direct": "^0.1.42",
44
44
  "@bobfrankston/tcp-transport": "^0.1.6",
45
45
  "@bobfrankston/smtp-direct": "^0.1.8",
46
46
  "@bobfrankston/mailx-sync": "^0.1.16",