@bobfrankston/mailx-store 0.1.39 → 0.1.40
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/db.d.ts +17 -3
- package/db.js +25 -7
- package/package.json +1 -1
- package/store.js +1 -1
package/db.d.ts
CHANGED
|
@@ -399,9 +399,23 @@ export declare class MailxDB {
|
|
|
399
399
|
* appended at a different real UID). Idempotent: if no row matches
|
|
400
400
|
* (already rebound by an earlier sync), it's a no-op. */
|
|
401
401
|
updateMessageUid(accountId: string, folderId: number, oldUid: number, newUid: number): void;
|
|
402
|
-
/** Delete a message by account + UID.
|
|
403
|
-
*
|
|
404
|
-
|
|
402
|
+
/** Delete a message by account + folder + UID. folderId is REQUIRED:
|
|
403
|
+
* IMAP UIDs are per-folder, so the same numeric UID refers to different
|
|
404
|
+
* messages in INBOX vs Sent vs any other folder. The pre-2026-05-27
|
|
405
|
+
* implementation accepted (accountId, uid) only and ran
|
|
406
|
+
* `DELETE FROM messages WHERE account_id=? AND uid=?` — which on a
|
|
407
|
+
* QRESYNC VANISHED for INBOX uid=N would also delete the row for the
|
|
408
|
+
* SAME numeric uid=N living in Sent, Drafts, every label folder, etc.
|
|
409
|
+
* That's what wiped 70k bobma rows on 2026-05-27 when QRESYNC reported
|
|
410
|
+
* a handful of vanished UIDs. Never again — folderId required.
|
|
411
|
+
*
|
|
412
|
+
* folderId === null is allowed as an explicit "I want every folder's
|
|
413
|
+
* copy of this UID gone" (used by cross-account move where the source
|
|
414
|
+
* is being abandoned entirely). All other callers MUST pass a folderId.
|
|
415
|
+
*
|
|
416
|
+
* Reason is propagated into the audit_log so the DB carries an
|
|
417
|
+
* authoritative trail of every removal. */
|
|
418
|
+
deleteMessage(accountId: string, folderId: number | null, uid: number, reason?: string, source?: string): void;
|
|
405
419
|
/** Recalculate folder total/unread counts from actual messages */
|
|
406
420
|
recalcFolderCounts(folderId: number): void;
|
|
407
421
|
/** Bulk insert within a transaction for sync performance */
|
package/db.js
CHANGED
|
@@ -2021,13 +2021,31 @@ export class MailxDB {
|
|
|
2021
2021
|
}
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
|
-
/** Delete a message by account + UID.
|
|
2025
|
-
*
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2024
|
+
/** Delete a message by account + folder + UID. folderId is REQUIRED:
|
|
2025
|
+
* IMAP UIDs are per-folder, so the same numeric UID refers to different
|
|
2026
|
+
* messages in INBOX vs Sent vs any other folder. The pre-2026-05-27
|
|
2027
|
+
* implementation accepted (accountId, uid) only and ran
|
|
2028
|
+
* `DELETE FROM messages WHERE account_id=? AND uid=?` — which on a
|
|
2029
|
+
* QRESYNC VANISHED for INBOX uid=N would also delete the row for the
|
|
2030
|
+
* SAME numeric uid=N living in Sent, Drafts, every label folder, etc.
|
|
2031
|
+
* That's what wiped 70k bobma rows on 2026-05-27 when QRESYNC reported
|
|
2032
|
+
* a handful of vanished UIDs. Never again — folderId required.
|
|
2033
|
+
*
|
|
2034
|
+
* folderId === null is allowed as an explicit "I want every folder's
|
|
2035
|
+
* copy of this UID gone" (used by cross-account move where the source
|
|
2036
|
+
* is being abandoned entirely). All other callers MUST pass a folderId.
|
|
2037
|
+
*
|
|
2038
|
+
* Reason is propagated into the audit_log so the DB carries an
|
|
2039
|
+
* authoritative trail of every removal. */
|
|
2040
|
+
deleteMessage(accountId, folderId, uid, reason, source) {
|
|
2041
|
+
// Get message_id + subject before deleting so the audit row carries
|
|
2042
|
+
// enough context to identify what was removed.
|
|
2043
|
+
const msg = folderId != null
|
|
2044
|
+
? this.db.prepare("SELECT folder_id, message_id, subject FROM messages WHERE account_id = ? AND folder_id = ? AND uid = ?").get(accountId, folderId, uid)
|
|
2045
|
+
: this.db.prepare("SELECT folder_id, message_id, subject FROM messages WHERE account_id = ? AND uid = ?").get(accountId, uid);
|
|
2046
|
+
const r = folderId != null
|
|
2047
|
+
? this.db.prepare("DELETE FROM messages WHERE account_id = ? AND folder_id = ? AND uid = ?").run(accountId, folderId, uid)
|
|
2048
|
+
: this.db.prepare("DELETE FROM messages WHERE account_id = ? AND uid = ?").run(accountId, uid);
|
|
2031
2049
|
if (r.changes && msg) {
|
|
2032
2050
|
this.audit({
|
|
2033
2051
|
kind: "delete-msg",
|
package/package.json
CHANGED
package/store.js
CHANGED
|
@@ -531,7 +531,7 @@ export class Store {
|
|
|
531
531
|
});
|
|
532
532
|
return "moved-to-trash";
|
|
533
533
|
}
|
|
534
|
-
this.db.deleteMessage(accountId, uid, "user-initiated trash (already in trash → expunge)", "Store.trashMessage");
|
|
534
|
+
this.db.deleteMessage(accountId, folderId, uid, "user-initiated trash (already in trash → expunge)", "Store.trashMessage");
|
|
535
535
|
this.db.recalcFolderCounts(folderId);
|
|
536
536
|
if (msgUuid) {
|
|
537
537
|
this.bus.publish({
|