@bobfrankston/mailx-imap 0.1.51 → 0.1.52
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/index.js +15 -2
- package/package.json +11 -11
package/index.js
CHANGED
|
@@ -951,11 +951,13 @@ export class ImapManager extends EventEmitter {
|
|
|
951
951
|
let bodyPath = "";
|
|
952
952
|
let preview = "";
|
|
953
953
|
let hasAttachments = false;
|
|
954
|
+
let ftsBody = "";
|
|
954
955
|
if (source) {
|
|
955
956
|
bodyPath = await this.bodyStore.putMessage(accountId, folderId, msg.uid, Buffer.from(source, "utf-8"));
|
|
956
957
|
const parsed = await extractPreview(source);
|
|
957
958
|
preview = parsed.preview;
|
|
958
959
|
hasAttachments = parsed.hasAttachments;
|
|
960
|
+
ftsBody = parsed.bodyText || "";
|
|
959
961
|
}
|
|
960
962
|
const flags = [];
|
|
961
963
|
if (msg.seen)
|
|
@@ -966,7 +968,7 @@ export class ImapManager extends EventEmitter {
|
|
|
966
968
|
flags.push("\\Answered");
|
|
967
969
|
if (msg.draft)
|
|
968
970
|
flags.push("\\Draft");
|
|
969
|
-
this.db.upsertMessage({
|
|
971
|
+
const ftsRowId = this.db.upsertMessage({
|
|
970
972
|
accountId, folderId, uid: msg.uid,
|
|
971
973
|
messageId: msg.messageId || "",
|
|
972
974
|
inReplyTo: msg.inReplyTo || "",
|
|
@@ -978,6 +980,12 @@ export class ImapManager extends EventEmitter {
|
|
|
978
980
|
cc: toEmailAddresses(msg.cc || []),
|
|
979
981
|
flags, size: msg.size || 0, hasAttachments, preview, bodyPath
|
|
980
982
|
});
|
|
983
|
+
// Index the full body for search. extractPreview already
|
|
984
|
+
// parsed `source`, so the body text is free here — and
|
|
985
|
+
// indexing it at sync time means a word buried in the body
|
|
986
|
+
// is searchable without the user first opening the message.
|
|
987
|
+
if (ftsRowId && ftsBody)
|
|
988
|
+
this.db.updateFtsBody(ftsRowId, ftsBody);
|
|
981
989
|
stored++;
|
|
982
990
|
batchCount++;
|
|
983
991
|
if (batchCount >= BATCH_SIZE) {
|
|
@@ -1476,7 +1484,7 @@ export class ImapManager extends EventEmitter {
|
|
|
1476
1484
|
if (msg.draft)
|
|
1477
1485
|
flags.push("\\Draft");
|
|
1478
1486
|
// Store metadata
|
|
1479
|
-
this.db.upsertMessage({
|
|
1487
|
+
const ftsRowId = this.db.upsertMessage({
|
|
1480
1488
|
accountId,
|
|
1481
1489
|
folderId,
|
|
1482
1490
|
uid: msg.uid,
|
|
@@ -1494,6 +1502,11 @@ export class ImapManager extends EventEmitter {
|
|
|
1494
1502
|
preview: parsed.preview,
|
|
1495
1503
|
bodyPath
|
|
1496
1504
|
});
|
|
1505
|
+
// Full body into the FTS index — the parse above already
|
|
1506
|
+
// produced the text, so search covers body content even
|
|
1507
|
+
// for messages the user hasn't opened.
|
|
1508
|
+
if (ftsRowId && parsed.bodyText)
|
|
1509
|
+
this.db.updateFtsBody(ftsRowId, parsed.bodyText);
|
|
1497
1510
|
newCount++;
|
|
1498
1511
|
}
|
|
1499
1512
|
this.db.commitTransaction();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@bobfrankston/mailx-types": "^0.1.
|
|
13
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
12
|
+
"@bobfrankston/mailx-types": "^0.1.17",
|
|
13
|
+
"@bobfrankston/mailx-settings": "^0.1.19",
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.29",
|
|
15
15
|
"@bobfrankston/iflow-direct": "^0.1.50",
|
|
16
16
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
17
17
|
"@bobfrankston/smtp-direct": "^0.1.8",
|
|
18
|
-
"@bobfrankston/mailx-sync": "^0.1.
|
|
19
|
-
"@bobfrankston/oauthsupport": "^1.0.
|
|
18
|
+
"@bobfrankston/mailx-sync": "^0.1.19",
|
|
19
|
+
"@bobfrankston/oauthsupport": "^1.0.27"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
},
|
|
38
38
|
".transformedSnapshot": {
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@bobfrankston/mailx-types": "^0.1.
|
|
41
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
40
|
+
"@bobfrankston/mailx-types": "^0.1.17",
|
|
41
|
+
"@bobfrankston/mailx-settings": "^0.1.19",
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.29",
|
|
43
43
|
"@bobfrankston/iflow-direct": "^0.1.50",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.8",
|
|
46
|
-
"@bobfrankston/mailx-sync": "^0.1.
|
|
47
|
-
"@bobfrankston/oauthsupport": "^1.0.
|
|
46
|
+
"@bobfrankston/mailx-sync": "^0.1.19",
|
|
47
|
+
"@bobfrankston/oauthsupport": "^1.0.27"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|