@remit/mailbox-service 0.0.10 → 0.0.12
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/package.json +1 -1
- package/src/body-sync-backfill.test.ts +285 -0
- package/src/body-sync.ts +131 -18
- package/src/heuristics/classifyByHeaders.test.ts +2 -2
- package/src/heuristics/classifyByHeaders.ts +49 -16
- package/src/heuristics/classifyRealMail.test.ts +242 -0
- package/src/heuristics/machineSenders.test.ts +101 -0
- package/src/heuristics/machineSenders.ts +90 -0
- package/src/imapflow-connection.test.ts +85 -0
- package/src/imapflow-connection.ts +59 -12
- package/src/mailbox-sync.test.ts +31 -2
- package/src/mailbox-sync.ts +11 -11
- package/src/message-move.ts +6 -0
- package/src/message-sync-changedsince.test.ts +742 -0
- package/src/message-sync.ts +494 -108
- package/src/sync-watermarks.test.ts +418 -0
- package/src/sync-watermarks.ts +322 -0
- package/src/types.ts +22 -0
package/src/mailbox-sync.ts
CHANGED
|
@@ -353,7 +353,13 @@ export class MailboxSyncService {
|
|
|
353
353
|
fullPath: mailboxInfo.fullPath,
|
|
354
354
|
uidValidity: status.uidValidity,
|
|
355
355
|
uidNext: status.uidNext,
|
|
356
|
-
|
|
356
|
+
// The message-sync cursor, not a status projection: it records how
|
|
357
|
+
// far THIS mailbox's messages have been applied, and nothing has
|
|
358
|
+
// been. Seeding it from the server's current HIGHESTMODSEQ would
|
|
359
|
+
// declare an unsynced folder already caught up and skip every
|
|
360
|
+
// message in it. Message sync seeds it once it has enumerated the
|
|
361
|
+
// folder.
|
|
362
|
+
highestModseq: "0",
|
|
357
363
|
messageCount: status.messages,
|
|
358
364
|
unseenCount: status.unseen,
|
|
359
365
|
deletedCount: status.deletedCount,
|
|
@@ -429,8 +435,6 @@ export class MailboxSyncService {
|
|
|
429
435
|
existing.messageCount !== status.messages ||
|
|
430
436
|
existing.unseenCount !== status.unseen ||
|
|
431
437
|
existing.deletedCount !== status.deletedCount ||
|
|
432
|
-
(BigInt(status.highestModseq) > 0n &&
|
|
433
|
-
existing.highestModseq !== status.highestModseq) ||
|
|
434
438
|
specialUseChanged;
|
|
435
439
|
|
|
436
440
|
// Sync special-use attributes (handles migration of existing mailboxes)
|
|
@@ -458,13 +462,6 @@ export class MailboxSyncService {
|
|
|
458
462
|
changes.push(
|
|
459
463
|
`deletedCount: ${existing.deletedCount} -> ${status.deletedCount}`,
|
|
460
464
|
);
|
|
461
|
-
if (
|
|
462
|
-
BigInt(status.highestModseq) > 0n &&
|
|
463
|
-
existing.highestModseq !== status.highestModseq
|
|
464
|
-
)
|
|
465
|
-
changes.push(
|
|
466
|
-
`highestModseq: ${existing.highestModseq} -> ${status.highestModseq}`,
|
|
467
|
-
);
|
|
468
465
|
if (specialUseChanged)
|
|
469
466
|
changes.push(
|
|
470
467
|
`specialUse: [${(existing.specialUse ?? []).join(",")}] -> [${parsed.specialUse.join(",")}]`,
|
|
@@ -480,7 +477,10 @@ export class MailboxSyncService {
|
|
|
480
477
|
hierarchyDelimiter: mailboxInfo.delimiter,
|
|
481
478
|
uidValidity: status.uidValidity,
|
|
482
479
|
uidNext: status.uidNext,
|
|
483
|
-
highestModseq:
|
|
480
|
+
// `highestModseq` is deliberately absent: it is message sync's
|
|
481
|
+
// cursor over this mailbox's own applied changes, and overwriting it
|
|
482
|
+
// with the server's current value here would step it over every
|
|
483
|
+
// change message sync had not yet applied.
|
|
484
484
|
messageCount: status.messages,
|
|
485
485
|
unseenCount: status.unseen,
|
|
486
486
|
deletedCount: status.deletedCount,
|
package/src/message-move.ts
CHANGED
|
@@ -467,6 +467,12 @@ export class MessageMoveService {
|
|
|
467
467
|
status: MessageStatus.moving,
|
|
468
468
|
syncStatus: MessageSyncStatus.pending,
|
|
469
469
|
bodyStorageKey: sourceMessage.bodyStorageKey,
|
|
470
|
+
// The copy inherits the source's stored body, so body-sync's skip guard
|
|
471
|
+
// will never re-derive these. Carry them across or the copy is
|
|
472
|
+
// permanently `uncategorized` while its body says it is fully synced
|
|
473
|
+
// (issue #45).
|
|
474
|
+
category: sourceMessage.category,
|
|
475
|
+
hasListUnsubscribe: sourceMessage.hasListUnsubscribe,
|
|
470
476
|
});
|
|
471
477
|
|
|
472
478
|
// Copy ThreadMessage entry
|