import { CharacterResult } from "../checks/character.js"; import { c as MxRecord, d as MxResolution } from "./mx.d-HxIDdxvR.js"; import { SmtpVerificationResult } from "../checks/smtp.js"; import { SymbolResult } from "../checks/symbol.js"; import { TagResult } from "../checks/tag.js"; import { NameResult } from "../enrich/name.js"; import { MxProviderInfo } from '@visulima/email-provider-mx'; /** * The overall deliverability verdict for an address, mirroring emailable's states. * * - `deliverable`: the mailbox almost certainly exists and accepts mail. * - `risky`: deliverable but lower-quality (catch-all, role, disposable, full mailbox). * - `undeliverable`: syntax/domain/mailbox failure — do not send. * - `unknown`: could not be determined (SMTP blocked, greylisted, or not probed). */ type VerificationState = "deliverable" | "risky" | "undeliverable" | "unknown"; /** * The resolved domain portion of a verification report. */ interface DomainReport { /** * True when the domain lookup was inconclusive because of a transient DNS * failure (timeout, SERVFAIL, refused). The domain is neither confirmed nor * proven undeliverable — treat as `unknown`. */ deferred?: boolean; /** The MX records found (empty when resolved via A/AAAA or not at all). */ records: MxRecord[]; /** How mail-acceptance was established (`unchecked` when DNS was skipped). */ resolvedVia: MxResolution | "unchecked"; /** True when the domain can accept mail. */ valid: boolean; } /** * A complete email verification + enrichment report. * * Aggregates every check and enrichment into a single object whose shape reads * as a drop-in mental model for emailable's API response. */ interface EmailVerificationReport { /** True when the SMTP server accepts any recipient (catch-all / accept-all). */ acceptAll: boolean; /** Local-part character analysis. */ character: CharacterResult; /** True when the SMTP result was inconclusive (greylisting / temporary failure). */ deferred: boolean; /** Typo-corrected address suggestion, if the domain looked misspelled. */ didYouMean?: string; /** True when the address uses a known disposable / throwaway domain. */ disposable: boolean; /** The resolved domain details. */ domain: DomainReport; /** The normalized (lowercased, trimmed) email address. */ email: string; /** True when the address uses a known free mailbox provider. */ free: boolean; /** True when the mailbox exists but is over quota. */ mailboxFull: boolean; /** Name parsed from the local part (no gender detection). */ name: NameResult; /** True when the address is a no-reply / do-not-reply mailbox. */ noReply: boolean; /** The classified mailbox/SEG provider, if recognized. */ provider?: MxProviderInfo; /** Human-readable explanation of the `state`. */ reason: string; /** True when the address is a role-based (shared) mailbox. */ role: boolean; /** Composite 0–100 quality score. */ score: number; /** True when the resolving MX is a Secure Email Gateway. */ secureEmailGateway: boolean; /** The raw SMTP probe result, when SMTP verification ran. */ smtp?: SmtpVerificationResult; /** The overall deliverability verdict. */ state: VerificationState; /** Symbol / Unicode-script analysis. */ symbol: SymbolResult; /** True when the address passed the syntax check. */ syntaxValid: boolean; /** Sub-address (tag) detection result. */ tag: TagResult; } /** * The fields of a report the scorer consumes (everything except the derived * `score`, `state`, and `reason`). */ type ScoreInput = Omit; /** * Overridable penalty/bonus weights for the quality score. * * Each value is points applied to a 100-point baseline. Penalties are positive * numbers that get subtracted; bonuses are added. */ interface ScoreWeights { acceptAll: number; character: number; deferred: number; didYouMean: number; disposable: number; free: number; knownProvider: number; mailboxFull: number; mixedScripts: number; noReply: number; role: number; smtpUnverified: number; symbol: number; } /** * The default scoring rubric. Transparent and additive so callers can reason * about — and override — every weight. */ declare const DEFAULT_WEIGHTS: ScoreWeights; /** * The outcome of scoring: the numeric score plus the derived state and reason. */ interface ScoreResult { reason: string; score: number; state: VerificationState; } /** * Computes a 0–100 quality score and the deliverability state for a report. * * The state is derived from hard signals (syntax, domain, SMTP verdict); the * score layers transparent penalties/bonuses on top so two `risky` addresses can * still be ranked against each other. * @param input The verification signals (a report without its derived fields). * @param weights Optional weight overrides. * @returns The score, state, and reason. * @example * ```ts * import { scoreReport } from "@visulima/email-verifier/score"; * * const { score, state } = scoreReport(report); * ``` */ declare const scoreReport: (input: ScoreInput, weights?: Partial) => ScoreResult; export { DEFAULT_WEIGHTS as D, EmailVerificationReport as E, ScoreInput as S, VerificationState as V, DomainReport as a, ScoreResult as b, ScoreWeights as c, scoreReport as s };