@remit/mailbox-service 0.0.110 → 0.0.112

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.
Files changed (123) hide show
  1. package/package.json +21 -6
  2. package/src/body-part-mapper.ts +51 -1
  3. package/src/body-sync-queue.test.ts +39 -99
  4. package/src/body-sync-terminal.test.ts +115 -277
  5. package/src/body-sync-terminal.ts +10 -12
  6. package/src/body-sync.test.ts +925 -0
  7. package/src/body-sync.ts +226 -200
  8. package/src/classification-backfill.test.ts +197 -527
  9. package/src/classify-message.test.ts +11 -74
  10. package/src/external-move.test.ts +102 -209
  11. package/src/external-move.ts +13 -0
  12. package/src/filter-operations.test.ts +319 -0
  13. package/src/filter-operations.ts +377 -0
  14. package/src/filter-update.test.ts +313 -0
  15. package/src/filters/filter-config.test.ts +55 -197
  16. package/src/filters/filter-config.ts +4 -39
  17. package/src/filters/match.test.ts +1 -38
  18. package/src/filters/match.ts +3 -52
  19. package/src/filters/pipeline.test.ts +158 -289
  20. package/src/filters/pipeline.ts +56 -170
  21. package/src/flag-push-terminal.ts +9 -11
  22. package/src/flag-push.test.ts +76 -372
  23. package/src/flag-queue.test.ts +197 -0
  24. package/src/folder-operations.test.ts +273 -0
  25. package/src/folder-operations.ts +217 -0
  26. package/src/forwarded-message.test.ts +122 -0
  27. package/src/imapflow-connect-retry.test.ts +76 -113
  28. package/src/imapflow-connection.test.ts +34 -0
  29. package/src/imapflow-connection.ts +19 -15
  30. package/src/index.ts +59 -12
  31. package/src/list-id-backfill.test.ts +133 -499
  32. package/src/mailbox-cursor.test.ts +81 -189
  33. package/src/mailbox-delete-intent.test.ts +78 -205
  34. package/src/mailbox-intent.ts +5 -3
  35. package/src/mailbox-management.test.ts +107 -220
  36. package/src/mailbox-management.ts +1 -2
  37. package/src/mailbox-presence.test.ts +36 -34
  38. package/src/mailbox-queue.ts +2 -20
  39. package/src/mailbox-rename-intent.test.ts +156 -325
  40. package/src/mailbox-rename-subtree.test.ts +205 -582
  41. package/src/mailbox-sync.test.ts +182 -744
  42. package/src/message-move.test.ts +726 -0
  43. package/src/message-move.ts +227 -57
  44. package/src/message-read.ts +87 -0
  45. package/src/message-save-retry.test.ts +90 -0
  46. package/src/message-sync-flags.test.ts +10 -1
  47. package/src/message-sync.test.ts +762 -0
  48. package/src/message-sync.ts +409 -239
  49. package/src/mime-walker.ts +16 -15
  50. package/src/organize-job.ts +93 -0
  51. package/src/outbox-attachment.test.ts +97 -209
  52. package/src/outbox-failed-recovery.test.ts +198 -269
  53. package/src/outbox-queue.test.ts +24 -0
  54. package/src/outbox-queue.ts +25 -8
  55. package/src/ownership.ts +140 -0
  56. package/src/placement-move-terminal.ts +9 -12
  57. package/src/placement-move.ts +33 -6
  58. package/src/placement-settled.ts +28 -4
  59. package/src/placement.test.ts +404 -0
  60. package/src/quarantine.test.ts +90 -148
  61. package/src/quarantine.ts +3 -2
  62. package/src/refusal.ts +29 -0
  63. package/src/restore-source-placement.ts +0 -4
  64. package/src/spam-report.test.ts +238 -710
  65. package/src/sync-warning.test.ts +213 -0
  66. package/src/sync-warning.ts +56 -0
  67. package/src/test-helpers/fake-imap.ts +690 -0
  68. package/src/test-helpers/test-queue.ts +56 -0
  69. package/src/test-helpers/test-store.ts +299 -0
  70. package/src/thread-root.test.ts +29 -0
  71. package/src/thread-root.ts +51 -0
  72. package/src/types/mailparser-augment.d.ts +8 -0
  73. package/src/types.ts +1 -1
  74. package/src/adversarial-mime.e2e.test.ts +0 -307
  75. package/src/body-sync-auto-read-writeonce.test.ts +0 -219
  76. package/src/body-sync-calendar-suggestion.test.ts +0 -433
  77. package/src/body-sync-category-denormalize.test.ts +0 -352
  78. package/src/body-sync-category-override.test.ts +0 -501
  79. package/src/body-sync-category-writeonce.test.ts +0 -234
  80. package/src/body-sync-filter.test.ts +0 -237
  81. package/src/body-sync-placement-flags.test.ts +0 -347
  82. package/src/body-sync-placement-writeonce.test.ts +0 -337
  83. package/src/body-sync-quarantine.test.ts +0 -276
  84. package/src/body-sync-resync.test.ts +0 -605
  85. package/src/body-sync-unclassifiable-once.test.ts +0 -260
  86. package/src/body-sync-unsubscribed-auto-read.test.ts +0 -176
  87. package/src/filters/anchor-drift.ts +0 -55
  88. package/src/filters/message-embedder.test.ts +0 -39
  89. package/src/filters/message-embedder.ts +0 -33
  90. package/src/flag-push-terminal.test.ts +0 -209
  91. package/src/flag-queue-stars.test.ts +0 -171
  92. package/src/imapflow-connection.e2e.test.ts +0 -335
  93. package/src/imapflow-connection.integ.test.ts +0 -316
  94. package/src/message-delete-junk-reconcile.test.ts +0 -117
  95. package/src/message-delete-no-trash.test.ts +0 -245
  96. package/src/message-delete-unsettled-placement.test.ts +0 -396
  97. package/src/message-move-copy.test.ts +0 -562
  98. package/src/message-move-empty-trash.test.ts +0 -326
  99. package/src/message-move-same-mailbox.test.ts +0 -139
  100. package/src/message-move-unsettled-placement.test.ts +0 -378
  101. package/src/message-sync-address-spoof.test.ts +0 -293
  102. package/src/message-sync-category.test.ts +0 -142
  103. package/src/message-sync-changedsince.test.ts +0 -840
  104. package/src/message-sync-junk-harvest.test.ts +0 -244
  105. package/src/message-sync-quarantine.test.ts +0 -416
  106. package/src/message-sync-repoint.test.ts +0 -419
  107. package/src/outbox-queue-settled-row.test.ts +0 -140
  108. package/src/pass-through-unit-of-work.ts +0 -17
  109. package/src/placement-move-terminal.test.ts +0 -300
  110. package/src/placement-move-unsettled.test.ts +0 -275
  111. package/src/placement-transition-race.test.ts +0 -482
  112. package/src/stale-message-reconcile.test.ts +0 -82
  113. package/src/stale-message-reconcile.ts +0 -55
  114. package/src/test-helpers/isolated-mailbox.ts +0 -44
  115. package/src/test-helpers/mailfuzz-connection.ts +0 -27
  116. package/test/fixtures/mime-adversarial-e2e/01-octet-stream-pdf.eml +0 -21
  117. package/test/fixtures/mime-adversarial-e2e/02-nested-related-cid-image.eml +0 -31
  118. package/test/fixtures/mime-adversarial-e2e/03-calendar-invite.eml +0 -33
  119. package/test/fixtures/mime-adversarial-e2e/04-forwarded-rfc822-with-attachments.eml +0 -42
  120. package/test/fixtures/mime-adversarial-e2e/05-tnef-winmail.eml +0 -25
  121. package/test/fixtures/mime-adversarial-e2e/06-8bit-non-ascii.eml +0 -15
  122. package/test/fixtures/mime-adversarial-e2e/07-quoted-printable-soft-breaks.eml +0 -17
  123. package/test/fixtures/mime-adversarial-e2e/08-alternative-empty-text.eml +0 -18
@@ -1,21 +0,0 @@
1
- From: alice@example.com
2
- To: bob@example.com
3
- Subject: Adversarial fixture 01 octet-stream PDF (Odido shape, #394)
4
- Date: Fri, 29 May 2026 09:00:00 +0000
5
- Message-Id: <adv-01-octet-stream-pdf@example.com>
6
- MIME-Version: 1.0
7
- Content-Type: multipart/mixed; boundary="=_adv01_="
8
-
9
- --=_adv01_=
10
- Content-Type: text/html; charset=us-ascii
11
- Content-Transfer-Encoding: 7bit
12
-
13
- <html><body><p>Your contract PDF is attached.</p></body></html>
14
- --=_adv01_=
15
- Content-Type: application/octet-stream; name="contract.pdf"
16
- Content-Transfer-Encoding: base64
17
- Content-Disposition: attachment; filename="contract.pdf"
18
-
19
- JVBERi0xLjQKJWZha2UgcGRmIGZvciBhZHZlcnNhcmlhbCBmaXh0dXJlIDAxIG9j
20
- dGV0LXN0cmVhbQolRU9GCg==
21
- --=_adv01_=--
@@ -1,31 +0,0 @@
1
- From: alice@example.com
2
- To: bob@example.com
3
- Subject: Adversarial fixture 02 nested related html + cid image
4
- Date: Fri, 29 May 2026 09:00:00 +0000
5
- Message-Id: <adv-02-nested-related@example.com>
6
- MIME-Version: 1.0
7
- Content-Type: multipart/mixed; boundary="=_adv02_outer_="
8
-
9
- --=_adv02_outer_=
10
- Content-Type: multipart/related; boundary="=_adv02_inner_="; type="text/html"
11
-
12
- --=_adv02_inner_=
13
- Content-Type: text/html; charset=us-ascii
14
- Content-Transfer-Encoding: 7bit
15
-
16
- <html><body><p>Hi bob,</p><p>Inline logo: <img src="cid:logo@example.com" alt="logo"></p><p>-- alice</p></body></html>
17
- --=_adv02_inner_=
18
- Content-Type: image/png; name="logo.png"
19
- Content-Transfer-Encoding: base64
20
- Content-Disposition: inline; filename="logo.png"
21
- Content-ID: <logo@example.com>
22
-
23
- iVBORw0KGgpmaXh0dXJlMDJjaWRpbWFnZWJ5dGVz
24
- --=_adv02_inner_=--
25
- --=_adv02_outer_=
26
- Content-Type: application/pdf; name="invoice.pdf"
27
- Content-Transfer-Encoding: base64
28
- Content-Disposition: attachment; filename="invoice.pdf"
29
-
30
- JVBERi0xLjQKJWFkdiAwMiBmaXh0dXJlIGludm9pY2UKJUVPRgo=
31
- --=_adv02_outer_=--
@@ -1,33 +0,0 @@
1
- From: alice@example.com
2
- To: bob@example.com
3
- Subject: Adversarial fixture 03 calendar invite + html
4
- Date: Fri, 29 May 2026 09:00:00 +0000
5
- Message-Id: <adv-03-calendar@example.com>
6
- MIME-Version: 1.0
7
- Content-Type: multipart/mixed; boundary="=_adv03_="
8
-
9
- --=_adv03_=
10
- Content-Type: text/html; charset=us-ascii
11
- Content-Transfer-Encoding: 7bit
12
-
13
- <html><body><p>Hi bob,</p><p>Meeting invite for our sync on Monday is attached.</p><p>-- alice</p></body></html>
14
- --=_adv03_=
15
- Content-Type: text/calendar; method=REQUEST; charset=us-ascii; name="invite.ics"
16
- Content-Transfer-Encoding: 7bit
17
- Content-Disposition: attachment; filename="invite.ics"
18
-
19
- BEGIN:VCALENDAR
20
- VERSION:2.0
21
- PRODID:-//Remit//Adversarial Fixture 03//EN
22
- METHOD:REQUEST
23
- BEGIN:VEVENT
24
- UID:adv-03-event@example.com
25
- DTSTAMP:20260529T090000Z
26
- DTSTART:20260601T140000Z
27
- DTEND:20260601T150000Z
28
- SUMMARY:Adversarial fixture 03 sync
29
- ORGANIZER:mailto:alice@example.com
30
- ATTENDEE:mailto:bob@example.com
31
- END:VEVENT
32
- END:VCALENDAR
33
- --=_adv03_=--
@@ -1,42 +0,0 @@
1
- From: alice@example.com
2
- To: bob@example.com
3
- Subject: Adversarial fixture 04 forwarded rfc822 with inner attachment
4
- Date: Fri, 29 May 2026 09:00:00 +0000
5
- Message-Id: <adv-04-forwarded@example.com>
6
- MIME-Version: 1.0
7
- Content-Type: multipart/mixed; boundary="=_adv04_outer_="
8
-
9
- --=_adv04_outer_=
10
- Content-Type: text/plain; charset=us-ascii
11
- Content-Transfer-Encoding: 7bit
12
-
13
- Hi bob,
14
-
15
- Forwarding the message below for your records. Note the original carries its own attachment.
16
-
17
- -- alice
18
- --=_adv04_outer_=
19
- Content-Type: message/rfc822
20
- Content-Disposition: attachment; filename="forwarded.eml"
21
-
22
- From: carol@example.com
23
- To: alice@example.com
24
- Subject: Original message with attachment for fixture 04
25
- Date: Thu, 28 May 2026 12:00:00 +0000
26
- Message-Id: <adv-04-inner@example.com>
27
- MIME-Version: 1.0
28
- Content-Type: multipart/mixed; boundary="=_adv04_inner_="
29
-
30
- --=_adv04_inner_=
31
- Content-Type: text/plain; charset=us-ascii
32
- Content-Transfer-Encoding: 7bit
33
-
34
- Original message body before forwarding.
35
- --=_adv04_inner_=
36
- Content-Type: application/pdf; name="original.pdf"
37
- Content-Transfer-Encoding: base64
38
- Content-Disposition: attachment; filename="original.pdf"
39
-
40
- JVBERi0xLjQKJWFkdiAwNCBpbm5lciBwZGYKJUVPRgo=
41
- --=_adv04_inner_=--
42
- --=_adv04_outer_=--
@@ -1,25 +0,0 @@
1
- X-Remit-Fixture-Note: Synthetic TNEF stub for fixture 05. mailparser surfaces this as an application/ms-tnef attachment with filename "winmail.dat" — which is the #402 contract. The trailing BODYSTRUCTURE round-trip via imapflow is skipped for this shape (see EXPECTATIONS in adversarial-mime.e2e.test.ts). TODO(#402): replace with a real-world winmail.dat capture once we have one to ship.
2
- From: alice@example.com
3
- To: bob@example.com
4
- Subject: Adversarial fixture 05 Outlook TNEF winmail.dat
5
- Date: Fri, 29 May 2026 09:00:00 +0000
6
- Message-Id: <adv-05-tnef@example.com>
7
- MIME-Version: 1.0
8
- Content-Type: multipart/mixed; boundary="=_adv05_="
9
-
10
- --=_adv05_=
11
- Content-Type: text/plain; charset=us-ascii
12
- Content-Transfer-Encoding: 7bit
13
-
14
- Hi bob,
15
-
16
- This message carries the Microsoft TNEF (winmail.dat) shape that some Outlook senders still produce. Remit should list the attachment without crashing the body sync.
17
-
18
- -- alice
19
- --=_adv05_=
20
- Content-Type: application/ms-tnef; name="winmail.dat"
21
- Content-Transfer-Encoding: base64
22
- Content-Disposition: attachment; filename="winmail.dat"
23
-
24
- eJ8+IgEAAAABAAAACAAAAAAAAAA=
25
- --=_adv05_=--
@@ -1,15 +0,0 @@
1
- From: alice@example.com
2
- To: bob@example.com
3
- Subject: =?UTF-8?B?Q2Fmw6kgZmHDp2FkZSAtIGFkdmVyc2FyaWFsIGZpeHR1cmUgMDY=?=
4
- Date: Fri, 29 May 2026 09:00:00 +0000
5
- Message-Id: <adv-06-8bit@example.com>
6
- MIME-Version: 1.0
7
- Content-Type: text/plain; charset=utf-8
8
- Content-Transfer-Encoding: 8bit
9
-
10
- Hallo bob,
11
-
12
- De café op de hoek heeft een prachtige façade. We’ll meet there — ben je vrij?
13
-
14
- Groetjes,
15
- alice
@@ -1,17 +0,0 @@
1
- From: alice@example.com
2
- To: bob@example.com
3
- Subject: Adversarial fixture 07 quoted-printable with soft line breaks
4
- Date: Fri, 29 May 2026 09:00:00 +0000
5
- Message-Id: <adv-07-qp@example.com>
6
- MIME-Version: 1.0
7
- Content-Type: text/plain; charset=utf-8
8
- Content-Transfer-Encoding: quoted-printable
9
-
10
- Hi bob,
11
-
12
- This paragraph deliberately uses quoted-printable soft line breaks so a sing=
13
- le logical line is wrapped across multiple physical lines without inserting=
14
- a real newline. The body-sync pipeline must reassemble it back into one l=
15
- ogical line when rendering.
16
-
17
- Also includes a non-ASCII token: caf=C3=A9 r=C3=A9union =E2=80=94 alice
@@ -1,18 +0,0 @@
1
- From: alice@example.com
2
- To: bob@example.com
3
- Subject: Adversarial fixture 08 alternative with empty text/plain
4
- Date: Fri, 29 May 2026 09:00:00 +0000
5
- Message-Id: <adv-08-empty-text-alt@example.com>
6
- MIME-Version: 1.0
7
- Content-Type: multipart/alternative; boundary="=_adv08_="
8
-
9
- --=_adv08_=
10
- Content-Type: text/plain; charset=us-ascii
11
- Content-Transfer-Encoding: 7bit
12
-
13
- --=_adv08_=
14
- Content-Type: text/html; charset=us-ascii
15
- Content-Transfer-Encoding: 7bit
16
-
17
- <html><body><p>Hi bob,</p><p>The text/plain sibling of this multipart/alternative is intentionally empty. The HTML part must still render.</p><p>-- alice</p></body></html>
18
- --=_adv08_=--