@bobfrankston/mailx-imap 0.1.130 → 0.1.133
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.d.ts +10 -0
- package/index.js +18 -0
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -519,6 +519,16 @@ export declare class ImapManager extends EventEmitter {
|
|
|
519
519
|
/** Save a draft to the Drafts folder via IMAP APPEND.
|
|
520
520
|
* Returns the UID of the saved draft (for replacing on next save). */
|
|
521
521
|
saveDraft(accountId: string, rawMessage: string | Buffer, previousDraftUid?: number, draftId?: string): Promise<number | null>;
|
|
522
|
+
/** Server check for a NEWER copy of a draft than the one just opened —
|
|
523
|
+
* same X-Mailx-Draft-ID, higher UID in the Drafts folder. That's the
|
|
524
|
+
* signature of an edit made on another machine that local sync hasn't
|
|
525
|
+
* pulled yet (each save deletes-and-reappends, so newer edits always
|
|
526
|
+
* have higher UIDs; this machine's own last save IS the opened row, so
|
|
527
|
+
* uid > sinceUid can only be foreign). Read-only — never mutates. */
|
|
528
|
+
findNewerDraft(accountId: string, draftId: string, sinceUid: number): Promise<{
|
|
529
|
+
uid: number;
|
|
530
|
+
folderId: number;
|
|
531
|
+
} | null>;
|
|
522
532
|
/** Delete a draft (or all drafts with a stable X-Mailx-Draft-ID) after successful send.
|
|
523
533
|
* Tries the specific UID first, then falls back to searchByHeader so orphaned copies
|
|
524
534
|
* from earlier failed autosaves are cleaned up at the same time. */
|
package/index.js
CHANGED
|
@@ -4513,6 +4513,24 @@ export class ImapManager extends EventEmitter {
|
|
|
4513
4513
|
return uid;
|
|
4514
4514
|
});
|
|
4515
4515
|
}
|
|
4516
|
+
/** Server check for a NEWER copy of a draft than the one just opened —
|
|
4517
|
+
* same X-Mailx-Draft-ID, higher UID in the Drafts folder. That's the
|
|
4518
|
+
* signature of an edit made on another machine that local sync hasn't
|
|
4519
|
+
* pulled yet (each save deletes-and-reappends, so newer edits always
|
|
4520
|
+
* have higher UIDs; this machine's own last save IS the opened row, so
|
|
4521
|
+
* uid > sinceUid can only be foreign). Read-only — never mutates. */
|
|
4522
|
+
async findNewerDraft(accountId, draftId, sinceUid) {
|
|
4523
|
+
if (!draftId)
|
|
4524
|
+
return null;
|
|
4525
|
+
const drafts = this.findFolder(accountId, "drafts");
|
|
4526
|
+
if (!drafts)
|
|
4527
|
+
return null;
|
|
4528
|
+
return this.withConnection(accountId, async (client) => {
|
|
4529
|
+
const uids = await client.searchByHeader(drafts.path, "X-Mailx-Draft-ID", draftId);
|
|
4530
|
+
const newer = uids.filter((u) => u > sinceUid).sort((a, b) => b - a)[0];
|
|
4531
|
+
return newer ? { uid: newer, folderId: drafts.id } : null;
|
|
4532
|
+
});
|
|
4533
|
+
}
|
|
4516
4534
|
/** Delete a draft (or all drafts with a stable X-Mailx-Draft-ID) after successful send.
|
|
4517
4535
|
* Tries the specific UID first, then falls back to searchByHeader so orphaned copies
|
|
4518
4536
|
* from earlier failed autosaves are cleaned up at the same time. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.133",
|
|
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.
|
|
13
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
12
|
+
"@bobfrankston/mailx-types": "^0.1.38",
|
|
13
|
+
"@bobfrankston/mailx-settings": "^0.1.48",
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.72",
|
|
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.
|
|
41
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
40
|
+
"@bobfrankston/mailx-types": "^0.1.38",
|
|
41
|
+
"@bobfrankston/mailx-settings": "^0.1.48",
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.72",
|
|
43
43
|
"@bobfrankston/iflow-direct": "^0.1.59",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.8",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.9",
|