refactor(domain): slim detectConfirmation contract

Return the ranked links directly (string[] | null) instead of an unused
{score, links} wrapper, and drop the redundant hasKeyword helper in favor
of matchesAny(_, KEYWORDS). No behavior change.
This commit is contained in:
Julien Herr
2026-05-25 10:50:06 +02:00
parent fc86b5f7d1
commit 5f05068449
3 changed files with 14 additions and 24 deletions
+4 -2
View File
@@ -187,7 +187,7 @@ async function storeEmail(
return false; // signal: skipped (not stored)
}
const confirmation = detectConfirmation({
const confirmationLinks = detectConfirmation({
subject: input.subject,
text: htmlToText(input.content),
links: extractLinks(input.content),
@@ -229,7 +229,9 @@ async function storeEmail(
...(inlineIds.length > 0 ? { inlineAttachmentIds: inlineIds } : {}),
...(messageId ? { messageId } : {}),
dedupHash,
...(confirmation ? { confirmation: { links: confirmation.links } } : {}),
...(confirmationLinks
? { confirmation: { links: confirmationLinks } }
: {}),
};
// Track the latest sender's domain (feed icon) and capture the RFC 8058