@bobfrankston/mailx-sync 0.1.20 → 0.1.22
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/gmail.d.ts +1 -1
- package/gmail.js +13 -4
- package/package.json +1 -1
package/gmail.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare class GmailApiProvider implements MailProvider {
|
|
|
58
58
|
* `\Flagged` is the presence of STARRED. We always send both add and
|
|
59
59
|
* remove so the end state matches regardless of what was there before,
|
|
60
60
|
* which makes the call idempotent and safe to retry. */
|
|
61
|
-
setFlags(folder: string, uid: number, flags: string[]): Promise<void>;
|
|
61
|
+
setFlags(folder: string, uid: number, flags: string[], messageId?: string): Promise<void>;
|
|
62
62
|
/** Move a message to the trash label. Gmail treats trash as a label, not
|
|
63
63
|
* as a destination folder — `POST /messages/{id}/trash` is the native
|
|
64
64
|
* path (equivalent to setting TRASH and removing INBOX in one op).
|
package/gmail.js
CHANGED
|
@@ -530,10 +530,19 @@ export class GmailApiProvider {
|
|
|
530
530
|
* `\Flagged` is the presence of STARRED. We always send both add and
|
|
531
531
|
* remove so the end state matches regardless of what was there before,
|
|
532
532
|
* which makes the call idempotent and safe to retry. */
|
|
533
|
-
async setFlags(folder, uid, flags) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
533
|
+
async setFlags(folder, uid, flags, messageId) {
|
|
534
|
+
// Prefer the caller-supplied Gmail message id (stored provider_id).
|
|
535
|
+
// Without it we fall back to a capped list-and-hash search, which
|
|
536
|
+
// misses any message past the most-recent ~1000 — so starring an older
|
|
537
|
+
// message threw "UID not found in INBOX", the flag never reached Gmail,
|
|
538
|
+
// and the local star got reverted on the next sync (Bob 2026-06-12).
|
|
539
|
+
// Same fix already applied to trashMessage.
|
|
540
|
+
let id = messageId;
|
|
541
|
+
if (!id) {
|
|
542
|
+
const query = `in:${this.folderToLabel(folder)}`;
|
|
543
|
+
const ids = await this.listMessageIds(query, 1000);
|
|
544
|
+
id = ids.find(id => idToUid(id) === uid);
|
|
545
|
+
}
|
|
537
546
|
if (!id)
|
|
538
547
|
throw new Error(`Gmail setFlags: UID ${uid} not found in ${folder}`);
|
|
539
548
|
const flagSet = new Set(flags);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-sync",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "Platform-agnostic mail provider implementations + sync orchestration. Single source of truth for Gmail/IMAP/Outlook protocol code, consumed by both desktop (Node) and Android (WebView) — eliminates the parallel mailx-imap/mailx-store-web Gmail providers that drifted in practice.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.ts",
|