@bumail/smtp 0.11.0 → 0.12.0

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 (40) hide show
  1. package/README.md +30 -2
  2. package/dist/client/connect.d.ts +18 -0
  3. package/dist/client/connect.d.ts.map +1 -0
  4. package/dist/client/inbox.d.ts +2 -0
  5. package/dist/client/inbox.d.ts.map +1 -1
  6. package/dist/client/index.d.ts +2 -0
  7. package/dist/client/index.d.ts.map +1 -1
  8. package/dist/client/index.js +594 -299
  9. package/dist/client/index.js.map +19 -11
  10. package/dist/client/options.d.ts +2 -0
  11. package/dist/client/options.d.ts.map +1 -1
  12. package/dist/client/pool/idle.d.ts +10 -0
  13. package/dist/client/pool/idle.d.ts.map +1 -0
  14. package/dist/client/pool/index.d.ts +18 -0
  15. package/dist/client/pool/index.d.ts.map +1 -0
  16. package/dist/client/pool/options.d.ts +26 -0
  17. package/dist/client/pool/options.d.ts.map +1 -0
  18. package/dist/client/pool/reset.d.ts +9 -0
  19. package/dist/client/pool/reset.d.ts.map +1 -0
  20. package/dist/client/pool/send.d.ts +8 -0
  21. package/dist/client/pool/send.d.ts.map +1 -0
  22. package/dist/client/pool/state.d.ts +28 -0
  23. package/dist/client/pool/state.d.ts.map +1 -0
  24. package/dist/client/send.d.ts +10 -1
  25. package/dist/client/send.d.ts.map +1 -1
  26. package/dist/client/session.d.ts +2 -2
  27. package/dist/client/session.d.ts.map +1 -1
  28. package/dist/client/settings.d.ts +11 -5
  29. package/dist/client/settings.d.ts.map +1 -1
  30. package/dist/client/socket-events.d.ts +15 -0
  31. package/dist/client/socket-events.d.ts.map +1 -0
  32. package/dist/client/socket.d.ts +12 -2
  33. package/dist/client/socket.d.ts.map +1 -1
  34. package/dist/client/transaction.d.ts +9 -3
  35. package/dist/client/transaction.d.ts.map +1 -1
  36. package/docs/README.md +3 -3
  37. package/docs/guide.md +25 -3
  38. package/docs/roadmap.md +26 -5
  39. package/docs/troubleshooting.md +84 -0
  40. package/package.json +3 -3
@@ -1,24 +1,32 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/client/address.ts", "../src/client/mx.ts", "../src/protocol/data-writer.ts", "../src/client/content.ts", "../src/protocol/reply-reader.ts", "../src/client/refusal.ts", "../src/protocol/ehlo.ts", "../src/client/session.ts", "../src/client/settings.ts", "../src/client/dsn.ts", "../src/client/inbox.ts", "../src/client/target.ts", "../src/client/socket.ts", "../src/client/transaction.ts", "../src/client/send.ts"],
3
+ "sources": ["../src/client/address.ts", "../src/client/mx.ts", "../src/protocol/data-writer.ts", "../src/client/content.ts", "../src/protocol/ehlo.ts", "../src/protocol/reply-reader.ts", "../src/client/refusal.ts", "../src/client/session.ts", "../src/client/inbox.ts", "../src/client/target.ts", "../src/client/socket-events.ts", "../src/client/socket.ts", "../src/client/connect.ts", "../src/client/settings.ts", "../src/client/dsn.ts", "../src/client/transaction.ts", "../src/client/send.ts", "../src/client/pool/options.ts", "../src/client/pool/reset.ts", "../src/client/pool/state.ts", "../src/client/pool/idle.ts", "../src/client/pool/send.ts", "../src/client/pool/index.ts"],
4
4
  "sourcesContent": [
5
5
  "import { parsePath } from '../protocol/path';\n\n/**\n * Whether `address` is one `sendMail` takes as a recipient, or as a sender\n * other than the null one: exactly those, since `sendMail` checks its\n * addresses with this same predicate. That is an RFC 5321 Mailbox\n * (§4.1.2), `local@domain` with no brackets — a dot-string or quoted local\n * part of 64 characters at most, and a domain of valid labels or an\n * address literal — with no source route, no control character (C0, DEL\n * or C1), no `>`, no U+2028 or U+2029, no Unicode format character\n * (`\\p{Cf}`), no lone surrogate and no IPv4 literal octet above 255. A caller that keeps addresses for\n * later, such as a queue, checks them with this when it takes them, so\n * `sendMail` never refuses them with `INVALID_OPTION` afterwards.\n */\nexport function isMailbox(address: unknown): address is string {\n\treturn (\n\t\ttypeof address === 'string' &&\n\t\tparsePath(`<${address}>`, false, 'refuse') !== undefined\n\t);\n}\n",
6
6
  "import { SmtpError } from '../errors';\nimport type { MxResolver } from './options';\n\n/** A host that takes mail for a domain, by preference: the lowest first. */\nexport interface MailHost {\n\treadonly host: string;\n\treadonly priority: number;\n\t/** No MX record: the domain itself, by its A or AAAA (RFC 5321 §5.1). */\n\treadonly implicit: boolean;\n}\n\n/** A `DnsError`'s code, read by shape: the client imports nothing of `@bumail/dns` at runtime. */\nfunction dnsCode(error: unknown): string | undefined {\n\treturn error instanceof Error && error.name === 'DnsError'\n\t\t? (error as Error & { code?: string }).code\n\t\t: undefined;\n}\n\n/**\n * `@bumail/dns`'s `isTemporary` (`packages/dns/src/errors.ts`), copied so\n * the client imports nothing of it: anything but a `DnsError`, a\n * `TEMPORARY` and a `TIMEOUT` are. Change both together.\n */\nfunction temporary(error: unknown): boolean {\n\tconst code = dnsCode(error);\n\treturn code === undefined || code === 'TEMPORARY' || code === 'TIMEOUT';\n}\n\nconst messageOf = (error: unknown) =>\n\terror instanceof Error ? error.message : String(error);\n\n/**\n * By preference, equal ones in a random order, as RFC 5321 §5.1 asks, to\n * spread the load. `random` is `Math.random` but in a spec.\n */\nexport function byPreference(\n\thosts: readonly MailHost[],\n\trandom: () => number = Math.random,\n): MailHost[] {\n\treturn hosts\n\t\t.map((host) => ({ host, key: random() }))\n\t\t.sort((x, y) => x.host.priority - y.host.priority || x.key - y.key)\n\t\t.map(({ host }) => host);\n}\n\n/**\n * The hosts to deliver a domain's mail to, in the order to try them (RFC\n * 5321 §5.1): its MX records by preference, or the domain itself when it\n * has none. A null MX (RFC 7505) is a permanent `NULL_MX`; a lookup that\n * failed is `DNS_FAILED`, temporary unless the DNS said there is no such\n * domain.\n */\nexport async function resolveMx(\n\tdomain: string,\n\tresolver: Pick<MxResolver, 'mx'>,\n): Promise<MailHost[]> {\n\tconst implicit = [\n\t\t{ host: domain.toLowerCase(), priority: 0, implicit: true },\n\t];\n\tlet records: Awaited<ReturnType<MxResolver['mx']>>;\n\ttry {\n\t\trecords = await resolver.mx(domain);\n\t} catch (error) {\n\t\tif (dnsCode(error) === 'NOT_FOUND') return implicit;\n\t\tthrow new SmtpError(\n\t\t\t'DNS_FAILED',\n\t\t\t`Could not look up the MX records of ${domain}: ${messageOf(error)}`,\n\t\t\t{ temporary: temporary(error) },\n\t\t);\n\t}\n\tconst hosts = records\n\t\t.filter((record) => record.exchange !== '')\n\t\t.map((record) => ({\n\t\t\thost: record.exchange,\n\t\t\tpriority: record.priority,\n\t\t\timplicit: false,\n\t\t}));\n\t// A resolver of your own may answer \"none\" with no record at all.\n\tif (records.length === 0) return implicit;\n\tif (hosts.length === 0) {\n\t\tthrow new SmtpError(\n\t\t\t'NULL_MX',\n\t\t\t`${domain} accepts no mail: its MX record is the null MX (RFC 7505)`,\n\t\t\t{ temporary: false },\n\t\t);\n\t}\n\treturn byPreference(hosts);\n}\n\n/** A host's addresses, IPv4 first; an error when it has none. */\nexport async function addressesOf(\n\thost: string,\n\tresolver: Pick<MxResolver, 'a' | 'aaaa'>,\n): Promise<string[] | { readonly error: unknown }> {\n\tconst found: string[] = [];\n\tlet failure: unknown;\n\tfor (const lookup of [resolver.a, resolver.aaaa]) {\n\t\ttry {\n\t\t\tfor (const record of await lookup.call(resolver, host)) {\n\t\t\t\tfound.push(record.address);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (failure === undefined || temporary(error)) failure = error;\n\t\t}\n\t}\n\treturn found.length > 0 ? found : { error: failure };\n}\n\n/** `DNS_FAILED` for a domain none of whose hosts had an address. */\nexport function noAddress(domain: string, error: unknown): SmtpError {\n\tconst why = error === undefined ? 'no A or AAAA record' : messageOf(error);\n\treturn new SmtpError(\n\t\t'DNS_FAILED',\n\t\t`No mail host of ${domain} has an address: ${why}`,\n\t\t{ temporary: error !== undefined && temporary(error) },\n\t);\n}\n",
7
7
  "const CR = 0x0d;\nconst LF = 0x0a;\nconst DOT = 0x2e;\n\n/**\n * Writes the content of `DATA` (RFC 5321 §4.1.1.4), the other half of\n * `DataReader`: a dot is added before every line that starts with one\n * (§4.5.2), and `end` closes the message with `<CRLF>.<CRLF>`. One pass,\n * one byte at a time, whatever the chunks.\n *\n * A bare CR or LF is counted in `bareLineBreaks`, as `DataReader` counts\n * it, for the caller to refuse the message: a server that reads one as a\n * line end is the SMTP smuggling a server refuses. With `normalize`, each\n * becomes CRLF instead. `eightBit` says whether a byte above 127 was seen.\n */\nexport class DataWriter {\n\treadonly #normalize: boolean;\n\t#lineStart = true;\n\t#heldCr = false;\n\tbareLineBreaks = 0;\n\teightBit = false;\n\n\tconstructor(normalize = false) {\n\t\tthis.#normalize = normalize;\n\t}\n\n\t/** A bare CR or LF: CRLF when normalising, else counted and kept as it is. */\n\t#bare(out: Uint8Array, n: number, byte: number): number {\n\t\tif (this.#normalize) {\n\t\t\tout[n++] = CR;\n\t\t\tout[n++] = LF;\n\t\t\tthis.#lineStart = true;\n\t\t\treturn n;\n\t\t}\n\t\tthis.bareLineBreaks++;\n\t\tout[n++] = byte;\n\t\tthis.#lineStart = false;\n\t\treturn n;\n\t}\n\n\t/** The next bytes of the message, stuffed. */\n\twrite(chunk: Uint8Array): Uint8Array {\n\t\t// At worst every byte doubles: a dot or a bare line break each.\n\t\tconst out = new Uint8Array(chunk.length * 2 + 2);\n\t\tlet n = 0;\n\t\tfor (let i = 0; i < chunk.length; i++) {\n\t\t\tconst byte = chunk[i] as number;\n\t\t\tif (this.#heldCr) {\n\t\t\t\tthis.#heldCr = false;\n\t\t\t\tif (byte === LF) {\n\t\t\t\t\tout[n++] = CR;\n\t\t\t\t\tout[n++] = LF;\n\t\t\t\t\tthis.#lineStart = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tn = this.#bare(out, n, CR);\n\t\t\t}\n\t\t\tif (byte === CR) {\n\t\t\t\tthis.#heldCr = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (byte === LF) {\n\t\t\t\tn = this.#bare(out, n, LF);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (byte === DOT && this.#lineStart) out[n++] = DOT;\n\t\t\tif (byte > 0x7f) this.eightBit = true;\n\t\t\tout[n++] = byte;\n\t\t\tthis.#lineStart = false;\n\t\t}\n\t\treturn out.subarray(0, n);\n\t}\n\n\t/** The end of the message: a CRLF if its last line has none, then `.` CRLF. */\n\tend(): Uint8Array {\n\t\tconst out = new Uint8Array(7);\n\t\tlet n = 0;\n\t\tif (this.#heldCr) {\n\t\t\tthis.#heldCr = false;\n\t\t\tn = this.#bare(out, n, CR);\n\t\t}\n\t\tif (!this.#lineStart) {\n\t\t\tout[n++] = CR;\n\t\t\tout[n++] = LF;\n\t\t}\n\t\tout[n++] = DOT;\n\t\tout[n++] = CR;\n\t\tout[n++] = LF;\n\t\treturn out.subarray(0, n);\n\t}\n}\n",
8
8
  "import { SmtpError } from '../errors';\nimport { DataWriter } from '../protocol/data-writer';\nimport type { MessageSource } from './options';\n\n/** The slice of a message in memory sent at once. */\nconst SLICE = 64 * 1024;\n\n/** The message's bytes, one slice at a time; `undefined` once they end. */\nexport interface Chunks {\n\tnext(): Promise<Uint8Array | undefined>;\n\t/** Stops reading: a delivery that failed half-way. */\n\tcancel(): void;\n}\n\n/** A message ready to send: what is known of it before the first byte, and its bytes. */\nexport interface Content {\n\t/** Bytes, when known before sending: SIZE declares it. */\n\treadonly size?: number;\n\t/** A byte above 127, when known before sending: it needs 8BITMIME. */\n\treadonly eightBit: boolean;\n\tchunks(): Chunks;\n}\n\n/** The error for a bare CR or LF in the message: a server must refuse it, and this client does first. */\nexport const bareLineBreak = () =>\n\tnew SmtpError(\n\t\t'BARE_LINE_BREAK',\n\t\t'sendMail(): the message holds a bare CR or LF, which a server must refuse (SMTP smuggling); end every line with CRLF, or pass normalizeLineEnds: true',\n\t);\n\n/** Bytes in `SLICE`s, so no chunk sent at once is larger. */\nfunction sliced(next: () => Promise<Uint8Array | undefined>) {\n\tlet held: Uint8Array | undefined;\n\treturn async (): Promise<Uint8Array | undefined> => {\n\t\tif (!held || held.length === 0) held = await next();\n\t\tif (!held) return undefined;\n\t\tconst slice = held.subarray(0, SLICE);\n\t\theld = held.subarray(SLICE);\n\t\treturn slice;\n\t};\n}\n\nfunction fromBytes(bytes: Uint8Array): Chunks {\n\tlet given = false;\n\tconst next = sliced(async () => {\n\t\tif (given) return undefined;\n\t\tgiven = true;\n\t\treturn bytes;\n\t});\n\treturn { next, cancel() {} };\n}\n\nfunction fromStream(stream: ReadableStream<Uint8Array>): Chunks {\n\tconst reader = stream.getReader();\n\tconst next = sliced(async () => {\n\t\tconst { done, value } = await reader.read();\n\t\tif (done) return undefined;\n\t\tif (!(value instanceof Uint8Array)) {\n\t\t\tthrow new SmtpError(\n\t\t\t\t'INVALID_OPTION',\n\t\t\t\t'sendMail(): a message stream must give Uint8Array chunks',\n\t\t\t);\n\t\t}\n\t\treturn value;\n\t});\n\treturn {\n\t\tnext,\n\t\tcancel: () => void reader.cancel().catch(() => {}),\n\t};\n}\n\n/**\n * The message, checked before any connection when it is in memory: a bare\n * CR or LF is refused here (unless normalised), and its size and 8-bit\n * bytes are known for MAIL FROM. A stream is checked as it is sent.\n */\nexport function contentOf(\n\tmessage: MessageSource,\n\tnormalize: boolean,\n\tsize: number | undefined,\n): Content {\n\tif (message instanceof ReadableStream) {\n\t\tlet read = false;\n\t\treturn {\n\t\t\t...(size === undefined ? {} : { size }),\n\t\t\teightBit: false,\n\t\t\tchunks() {\n\t\t\t\tif (read) {\n\t\t\t\t\tthrow new SmtpError(\n\t\t\t\t\t\t'INVALID_OPTION',\n\t\t\t\t\t\t'sendMail(): a message stream can be sent once only',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tread = true;\n\t\t\t\treturn fromStream(message);\n\t\t\t},\n\t\t};\n\t}\n\tlet bytes: Uint8Array;\n\tif (typeof message === 'string') bytes = new TextEncoder().encode(message);\n\telse if (message instanceof Uint8Array) bytes = message;\n\telse {\n\t\tthrow new SmtpError(\n\t\t\t'INVALID_OPTION',\n\t\t\t'sendMail(): the message must be a Uint8Array, a string or a ReadableStream',\n\t\t);\n\t}\n\t// One dry run: what the server will be sent, its size as normalised.\n\tconst writer = new DataWriter(normalize);\n\tlet sent = 0;\n\tfor (let at = 0; at < bytes.length; at += SLICE) {\n\t\tsent += writer.write(bytes.subarray(at, at + SLICE)).length;\n\t}\n\twriter.end();\n\tif (writer.bareLineBreaks > 0) throw bareLineBreak();\n\treturn {\n\t\tsize: sent,\n\t\teightBit: writer.eightBit,\n\t\tchunks: () => fromBytes(bytes),\n\t};\n}\n",
9
+ "/**\n * The extensions an EHLO reply names (RFC 5321 §4.1.1.1): every line after\n * the first is a keyword, then its parameters. Keywords in upper case,\n * parameters as written, spaces around them dropped.\n */\nexport function parseEhlo(\n\tlines: readonly string[],\n): ReadonlyMap<string, string> {\n\tconst extensions = new Map<string, string>();\n\tfor (const line of lines.slice(1)) {\n\t\tconst text = line.trim();\n\t\tconst space = text.indexOf(' ');\n\t\tconst keyword = (space < 0 ? text : text.slice(0, space)).toUpperCase();\n\t\tif (keyword === '') continue;\n\t\textensions.set(keyword, space < 0 ? '' : text.slice(space + 1).trim());\n\t}\n\treturn extensions;\n}\n",
9
10
  "import type { Reply } from './reply';\n\n/** The most lines one reply may have; an EHLO reply has a dozen or so. */\nexport const MAX_REPLY_LINES = 100;\n\n/** A reply line's parts: `250-text` or `250 text`, or a bare `250`. */\ninterface ReplyLine {\n\treadonly code: number;\n\treadonly last: boolean;\n\treadonly text: string;\n}\n\nconst isDigit = (c: number) => c >= 0x30 && c <= 0x39;\n\n/** RFC 5321 §4.2: three digits, the first 2 to 5, then a space, a hyphen, or nothing. */\nfunction parseLine(line: string): ReplyLine | undefined {\n\tif (line.length < 3) return undefined;\n\tconst a = line.charCodeAt(0);\n\tif (a < 0x32 || a > 0x35) return undefined;\n\tif (!isDigit(line.charCodeAt(1)) || !isDigit(line.charCodeAt(2)))\n\t\treturn undefined;\n\tconst code = Number(line.slice(0, 3));\n\tif (line.length === 3) return { code, last: true, text: '' };\n\tconst separator = line[3];\n\tif (separator !== ' ' && separator !== '-') return undefined;\n\treturn { code, last: separator === ' ', text: line.slice(4) };\n}\n\n/** `x.y.z` of RFC 3463, its class the reply's own first digit. */\nfunction statusOf(code: number, text: string): string | undefined {\n\tconst space = text.indexOf(' ');\n\tconst token = space < 0 ? text : text.slice(0, space);\n\tif (token.length > 11 || !/^[245]\\.\\d{1,3}\\.\\d{1,3}$/.test(token))\n\t\treturn undefined;\n\treturn token[0] === String(code)[0] ? token : undefined;\n}\n\n/** A reply put together: the enhanced status taken off every line that starts with it. */\nfunction build(code: number, lines: readonly string[]): Reply {\n\tconst status = statusOf(code, lines[0] ?? '');\n\tconst text = status\n\t\t? lines.map((line) =>\n\t\t\t\tline.startsWith(`${status} `)\n\t\t\t\t\t? line.slice(status.length + 1)\n\t\t\t\t\t: line === status\n\t\t\t\t\t\t? ''\n\t\t\t\t\t\t: line,\n\t\t\t)\n\t\t: [...lines];\n\tconst body = text.length === 1 ? (text[0] as string) : text;\n\treturn status === undefined\n\t\t? { code, text: body }\n\t\t: { code, status, text: body };\n}\n\n/**\n * Puts a server's reply lines together (RFC 5321 §4.2.1): `code-` lines,\n * then a `code ` line, all with the same code. Each line costs one pass,\n * and a reply holds `MAX_REPLY_LINES` at most; what is not a reply is an\n * error, never guessed at.\n */\nexport class ReplyReader {\n\t#lines: string[] = [];\n\t#code = 0;\n\n\t/** One line, CRLF taken off: the reply it completes, `undefined` while it goes on, or why it is not one. */\n\tline(text: string): Reply | { readonly error: string } | undefined {\n\t\tconst parsed = parseLine(text);\n\t\tif (!parsed) {\n\t\t\tconst shown = text.length > 40 ? `${text.slice(0, 40)}…` : text;\n\t\t\treturn {\n\t\t\t\terror: `a line that is not an SMTP reply: ${JSON.stringify(shown)}`,\n\t\t\t};\n\t\t}\n\t\tif (this.#lines.length > 0 && parsed.code !== this.#code) {\n\t\t\treturn {\n\t\t\t\terror: `a reply whose lines change code, from ${this.#code} to ${parsed.code}`,\n\t\t\t};\n\t\t}\n\t\tif (this.#lines.length >= MAX_REPLY_LINES) {\n\t\t\treturn { error: `a reply of more than ${MAX_REPLY_LINES} lines` };\n\t\t}\n\t\tthis.#code = parsed.code;\n\t\tthis.#lines.push(parsed.text);\n\t\tif (!parsed.last) return undefined;\n\t\tconst lines = this.#lines;\n\t\tthis.#lines = [];\n\t\treturn build(parsed.code, lines);\n\t}\n}\n\n/** A reply's text as one line: its lines joined with a space. */\nexport function replyText(reply: Reply): string {\n\treturn typeof reply.text === 'string' ? reply.text : reply.text.join(' ');\n}\n",
10
11
  "import { type RecipientReply, SmtpError } from '../errors';\nimport type { Reply } from '../protocol/reply';\nimport { replyText } from '../protocol/reply-reader';\n\n/** A reply as an error message shows it: code, status, text, cut at 200 characters. */\nexport function shown(reply: Reply): string {\n\tconst text = replyText(reply);\n\tconst line = `${reply.code}${reply.status ? ` ${reply.status}` : ''} ${text}`;\n\treturn line.length > 200 ? `${line.slice(0, 200)}…` : line;\n}\n\n/** `REFUSED`, temporary for a 4xx: the server said no to `what`. */\nexport function refused(host: string, what: string, reply: Reply): SmtpError {\n\treturn new SmtpError('REFUSED', `${host} refused ${what}: ${shown(reply)}`, {\n\t\treply,\n\t});\n}\n\n/** `BAD_REPLY`: what the server sent is not a reply, or too much of one. */\nexport const badReply = (host: string, what: string) =>\n\tnew SmtpError('BAD_REPLY', `${host} sent ${what}`);\n\n/** `CONNECTION_LOST` while waiting for `what`, or while the message was sent. */\nexport const lost = (host: string, what?: string) =>\n\tnew SmtpError(\n\t\t'CONNECTION_LOST',\n\t\twhat === undefined\n\t\t\t? `The connection to ${host} closed while the message was sent`\n\t\t\t: `The connection to ${host} closed before ${what}`,\n\t);\n\n/** `TIMEOUT`: a step's own, or the whole delivery's deadline when `deadline` is given. */\nexport const timedOut = (\n\thost: string,\n\twhat: string,\n\tseconds: number,\n\tdeadline?: number,\n) =>\n\tnew SmtpError(\n\t\t'TIMEOUT',\n\t\tdeadline === undefined\n\t\t\t? `Timed out after ${seconds} s waiting for ${what} (${host})`\n\t\t\t: `The deadline of ${deadline} s passed waiting for ${what} (${host})`,\n\t);\n\n/** `TLS_FAILED`: the handshake, or the certificate's check. */\nexport const tlsFailed = (host: string, why: string) =>\n\tnew SmtpError('TLS_FAILED', `TLS with ${host} failed: ${why}`);\n\n/**\n * `error` as it is, marked `afterData` when it is an `SmtpError` of a\n * missing reply to the final dot: the same code, message, `temporary`,\n * `rejected` and `cause`, plus the envelope's outcome: `accepted` and\n * `rejected` as `taken` says them, together (the error's own `rejected` gives way).\n */\nexport function afterDot(\n\terror: unknown,\n\ttaken?: {\n\t\treadonly accepted: readonly RecipientReply[];\n\t\treadonly rejected: readonly RecipientReply[];\n\t},\n): unknown {\n\tif (!(error instanceof SmtpError) || error.afterData || error.reply)\n\t\treturn error; // a reply is the server's word: it did not take the message\n\treturn new SmtpError(error.code, error.message, {\n\t\ttemporary: error.temporary,\n\t\tafterData: true,\n\t\t...(taken\n\t\t\t? { accepted: taken.accepted, rejected: taken.rejected }\n\t\t\t: error.rejected\n\t\t\t\t? { rejected: error.rejected }\n\t\t\t\t: {}),\n\t\t...(error.cause === undefined ? {} : { cause: error.cause }),\n\t});\n}\n",
11
- "/**\n * The extensions an EHLO reply names (RFC 5321 §4.1.1.1): every line after\n * the first is a keyword, then its parameters. Keywords in upper case,\n * parameters as written, spaces around them dropped.\n */\nexport function parseEhlo(\n\tlines: readonly string[],\n): ReadonlyMap<string, string> {\n\tconst extensions = new Map<string, string>();\n\tfor (const line of lines.slice(1)) {\n\t\tconst text = line.trim();\n\t\tconst space = text.indexOf(' ');\n\t\tconst keyword = (space < 0 ? text : text.slice(0, space)).toUpperCase();\n\t\tif (keyword === '') continue;\n\t\textensions.set(keyword, space < 0 ? '' : text.slice(space + 1).trim());\n\t}\n\treturn extensions;\n}\n",
12
- "import { SmtpError } from '../errors';\nimport { parseEhlo } from '../protocol/ehlo';\nimport { encodeLoginStep, encodePlain } from '../protocol/sasl';\nimport { refused, shown } from './refusal';\nimport type { ClientSettings } from './settings';\nimport type { ClientSocket } from './socket';\nimport type { TlsTarget } from './target';\n\n/** A session past its greeting, EHLO, STARTTLS and AUTH: what the server offers. */\nexport interface Ready {\n\treadonly extensions: ReadonlyMap<string, string>;\n\treadonly authenticated: boolean;\n}\n\n/** EHLO, or HELO when the server refuses EHLO with a 5xx (RFC 5321 §4.1.4). */\nasync function hello(\n\tsocket: ClientSocket,\n\tsettings: ClientSettings,\n\tallowHelo: boolean,\n): Promise<ReadonlyMap<string, string>> {\n\tconst seconds = settings.timeouts.command;\n\tsocket.write(`EHLO ${settings.helo}\\r\\n`);\n\tconst ehlo = await socket.reply('the reply to EHLO', seconds);\n\tif (ehlo.code === 250) {\n\t\treturn parseEhlo(typeof ehlo.text === 'string' ? [ehlo.text] : ehlo.text);\n\t}\n\tif (ehlo.code < 500 || !allowHelo) throw refused(socket.host, 'EHLO', ehlo);\n\tsocket.write(`HELO ${settings.helo}\\r\\n`);\n\tconst helo = await socket.reply('the reply to HELO', seconds);\n\tif (helo.code !== 250) throw refused(socket.host, 'HELO', helo);\n\treturn new Map();\n}\n\n/** STARTTLS when offered (RFC 3207); `required` fails without it, `opportunistic` goes on in clear. */\nasync function startTls(\n\tsocket: ClientSocket,\n\tsettings: ClientSettings,\n\ttls: TlsTarget,\n\textensions: ReadonlyMap<string, string>,\n): Promise<ReadonlyMap<string, string>> {\n\tconst required = settings.tls === 'required';\n\tif (!extensions.has('STARTTLS')) {\n\t\tif (!required) return extensions;\n\t\tthrow new SmtpError(\n\t\t\t'TLS_UNAVAILABLE',\n\t\t\t`${socket.host} does not offer STARTTLS, and tls is 'required'`,\n\t\t);\n\t}\n\tsocket.write('STARTTLS\\r\\n');\n\tconst answer = await socket.reply(\n\t\t'the reply to STARTTLS',\n\t\tsettings.timeouts.command,\n\t);\n\tif (answer.code !== 220) {\n\t\tif (!required) return extensions;\n\t\tthrow new SmtpError(\n\t\t\t'TLS_UNAVAILABLE',\n\t\t\t`${socket.host} refused STARTTLS, and tls is 'required': ${shown(answer)}`,\n\t\t\t{ reply: answer, temporary: true },\n\t\t);\n\t}\n\tawait socket.startTls(tls, settings.timeouts.connect);\n\t// RFC 3207 §4.2: what was learnt in clear is forgotten; EHLO again.\n\treturn hello(socket, settings, false);\n}\n\n/** AUTH PLAIN or LOGIN (RFC 4954), over TLS unless `allowPlaintextAuth`. */\nasync function authenticate(\n\tsocket: ClientSocket,\n\tsettings: ClientSettings,\n\textensions: ReadonlyMap<string, string>,\n): Promise<void> {\n\tconst { auth } = settings;\n\tif (!auth) return;\n\tconst { host } = socket;\n\tif (!socket.secure && !settings.allowPlaintextAuth) {\n\t\tthrow new SmtpError(\n\t\t\t'AUTH_UNAVAILABLE',\n\t\t\t`Refusing to send credentials to ${host} in clear: it did not start TLS (allowPlaintextAuth is for a local test server only)`,\n\t\t);\n\t}\n\tconst offered = (extensions.get('AUTH') ?? '').toUpperCase().split(' ');\n\tconst mechanism =\n\t\tauth.mechanism ??\n\t\t(offered.includes('PLAIN')\n\t\t\t? 'PLAIN'\n\t\t\t: offered.includes('LOGIN')\n\t\t\t\t? 'LOGIN'\n\t\t\t\t: undefined);\n\tif (!mechanism || !offered.includes(mechanism)) {\n\t\tthrow new SmtpError(\n\t\t\t'AUTH_UNAVAILABLE',\n\t\t\t`${host} offers no AUTH mechanism this client speaks (${auth.mechanism ?? 'PLAIN, LOGIN'}): AUTH ${extensions.get('AUTH') ?? 'is not offered'}`,\n\t\t);\n\t}\n\tconst seconds = settings.timeouts.command;\n\tconst steps =\n\t\tmechanism === 'PLAIN'\n\t\t\t? [`AUTH PLAIN ${encodePlain(auth.username, auth.password)}`]\n\t\t\t: [\n\t\t\t\t\t'AUTH LOGIN',\n\t\t\t\t\tencodeLoginStep(auth.username),\n\t\t\t\t\tencodeLoginStep(auth.password),\n\t\t\t\t];\n\tfor (const [i, step] of steps.entries()) {\n\t\tsocket.write(`${step}\\r\\n`);\n\t\tconst answer = await socket.reply('the reply to AUTH', seconds);\n\t\tconst last = i === steps.length - 1;\n\t\tif (answer.code === (last ? 235 : 334)) continue;\n\t\tthrow refused(host, `AUTH ${mechanism}`, answer);\n\t}\n}\n\n/** The greeting, EHLO, STARTTLS and AUTH: a session ready for MAIL FROM. */\nexport async function open(\n\tsocket: ClientSocket,\n\tsettings: ClientSettings,\n\ttls: TlsTarget,\n): Promise<Ready> {\n\tconst greeting = await socket.reply(\n\t\t'the greeting',\n\t\tsettings.timeouts.greeting,\n\t);\n\tif (greeting.code !== 220) {\n\t\tthrow refused(socket.host, 'the connection', greeting);\n\t}\n\tlet extensions = await hello(socket, settings, true);\n\tif (!socket.secure && settings.tls !== 'none') {\n\t\textensions = await startTls(socket, settings, tls, extensions);\n\t}\n\tawait authenticate(socket, settings, extensions);\n\treturn { extensions, authenticated: settings.auth !== undefined };\n}\n",
13
- "import { hostname as machineName } from 'node:os';\nimport { SmtpError } from '../errors';\nimport { isHelloName, parsePath } from '../protocol/path';\nimport { isMailbox } from './address';\nimport { type DsnSettings, dsnOf } from './dsn';\nimport type {\n\tMxDestination,\n\tSendMailAuth,\n\tSendMailEnvelope,\n\tSendMailOptions,\n\tSendMailTimeouts,\n\tTlsMode,\n} from './options';\n\n/** The longest delay `setTimeout` takes, in seconds: past 2^31 − 1 ms it fires after 1 ms. */\nexport const MAX_SECONDS = Math.floor(2_147_483_647 / 1000);\n\n/** RFC 5321 §4.5.3.2's timeouts; `connect` is this client's own. */\nconst TIMEOUTS: Required<SendMailTimeouts> = {\n\tconnect: 30,\n\tgreeting: 300,\n\tcommand: 300,\n\tmail: 300,\n\trcpt: 300,\n\tdataStart: 120,\n\tdataBlock: 180,\n\tdataEnd: 600,\n};\n\n/** The options, checked, with their defaults; timeouts in seconds. */\nexport interface ClientSettings {\n\treadonly from: string;\n\treadonly to: readonly string[];\n\treadonly helo: string;\n\treadonly tls: TlsMode;\n\treadonly secure: boolean;\n\treadonly ca?: readonly string[];\n\treadonly auth?: SendMailAuth;\n\treadonly allowPlaintextAuth: boolean;\n\treadonly size?: number;\n\treadonly dsn: DsnSettings;\n\t/** An address is not ASCII, or `smtputf8` asked for it. */\n\treadonly smtputf8: boolean;\n\treadonly normalizeLineEnds: boolean;\n\treadonly timeouts: Required<SendMailTimeouts>;\n\treadonly deadline: number;\n}\n\n/** `INVALID_OPTION`, for an option `sendMail` cannot take. */\nexport const invalid = (message: string) =>\n\tnew SmtpError('INVALID_OPTION', `sendMail(): ${message}`);\n\nfunction seconds(name: string, value: unknown, fallback: number): number {\n\tif (value === undefined) return fallback;\n\tif (\n\t\ttypeof value !== 'number' ||\n\t\t!Number.isFinite(value) ||\n\t\tvalue <= 0 ||\n\t\tvalue > MAX_SECONDS\n\t) {\n\t\tthrow invalid(\n\t\t\t`${name} must be a number of seconds above 0 and at most ${MAX_SECONDS}, not ${String(value)}`,\n\t\t);\n\t}\n\treturn value;\n}\n\nfunction timeoutsOf(given: SendMailTimeouts = {}): Required<SendMailTimeouts> {\n\tconst out: Record<string, number> = {};\n\tfor (const [name, fallback] of Object.entries(TIMEOUTS)) {\n\t\tout[name] = seconds(\n\t\t\t`timeouts.${name}`,\n\t\t\tgiven[name as keyof SendMailTimeouts],\n\t\t\tfallback,\n\t\t);\n\t}\n\treturn out as Required<SendMailTimeouts>;\n}\n\n/**\n * `from` or a recipient, checked as an RFC 5321 path, since it is written\n * into `MAIL FROM:<…>` or `RCPT TO:<…>` as it is. A source route is refused\n * (§4.1.1.3: clients should not send one), with a message of its own when\n * the route is otherwise valid. What it takes, past the null sender, is\n * exactly what `isMailbox` says yes to: the two share one predicate.\n */\nfunction address(value: unknown, allowNull: boolean): string {\n\tif (allowNull && value === '') return '';\n\tif (isMailbox(value)) return value;\n\tconst text = typeof value === 'string' ? value : '';\n\tconst routed = typeof value === 'string' && parsePath(`<${text}>`, false);\n\tif (routed) {\n\t\tthrow invalid(\n\t\t\t`${JSON.stringify(value)} holds a source route (@host:), which RFC 5321 says a client should not send: pass ${JSON.stringify(`${routed.local}@${text.slice(text.lastIndexOf('@') + 1)}`)} alone`,\n\t\t);\n\t}\n\tthrow invalid(\n\t\t`${JSON.stringify(value)} is not an address (local@domain${allowNull ? \", or '' for a bounce\" : ''})`,\n\t);\n}\n\n/**\n * `helo`, checked. By MX it is required: the machine's name (such as\n * `laptop.local`) is rarely a name that resolves back to the sender, which\n * receiving hosts penalise, and it would tell them the machine's name.\n */\nfunction heloOf(value: string | undefined, byMx: boolean): string {\n\tif (value !== undefined) {\n\t\tif (!isHelloName(value))\n\t\t\tthrow invalid(`helo \"${value}\" is not a host name`);\n\t\treturn value;\n\t}\n\tif (byMx)\n\t\tthrow invalid(\n\t\t\t\"helo is required for delivery by MX: pass your server's public name, such as helo: 'mail.example.com'\",\n\t\t);\n\tconst name = machineName();\n\treturn isHelloName(name) ? name : 'localhost';\n}\n\nfunction authOf(auth: SendMailAuth | undefined): SendMailAuth | undefined {\n\tif (auth === undefined) return undefined;\n\tconst { username, password, mechanism } = auth;\n\tif (typeof username !== 'string' || username === '')\n\t\tthrow invalid('auth.username must be a non-empty string');\n\tif (typeof password !== 'string' || password === '')\n\t\tthrow invalid('auth.password must be a non-empty string');\n\tif (mechanism !== undefined && mechanism !== 'PLAIN' && mechanism !== 'LOGIN')\n\t\tthrow invalid(\n\t\t\t`auth.mechanism must be 'PLAIN' or 'LOGIN', not ${mechanism}`,\n\t\t);\n\treturn auth;\n}\n\nfunction tlsOf(options: SendMailOptions, plaintextAuth: boolean): TlsMode {\n\tconst secure = options.secure === true;\n\tconst tls =\n\t\toptions.tls ??\n\t\t(secure || (options.auth && !plaintextAuth) ? 'required' : 'opportunistic');\n\tif (tls !== 'opportunistic' && tls !== 'required' && tls !== 'none')\n\t\tthrow invalid(\n\t\t\t`tls must be 'opportunistic', 'required' or 'none', not ${tls}`,\n\t\t);\n\tif (tls === 'none' && secure)\n\t\tthrow invalid(\n\t\t\t\"secure is TLS from the first byte: it cannot go with tls: 'none'\",\n\t\t);\n\tif (tls === 'none' && options.auth && !plaintextAuth)\n\t\tthrow invalid(\n\t\t\t\"auth with tls: 'none' would send the password in clear; pass allowPlaintextAuth: true for a local test server\",\n\t\t);\n\tif (tls === 'opportunistic' && options.auth && !plaintextAuth)\n\t\tthrow invalid(\n\t\t\t\"auth with tls: 'opportunistic' would send the password to a server whose certificate is not checked; leave tls out to check it, or pass allowPlaintextAuth: true for a local test server\",\n\t\t);\n\treturn tls;\n}\n\n/** Checks every option; throws an `SmtpError` (`INVALID_OPTION`) on the first wrong one. */\nexport function settingsOf(options: SendMailOptions): ClientSettings {\n\tif (typeof options !== 'object' || options === null)\n\t\tthrow invalid('options must be an object');\n\tconst from = address(options.from, true);\n\tconst list = typeof options.to === 'string' ? [options.to] : options.to;\n\tif (!Array.isArray(list) || list.length === 0)\n\t\tthrow invalid('to must name one recipient or more');\n\tconst to = list.map((recipient) => address(recipient, false));\n\tconst allowPlaintextAuth = options.allowPlaintextAuth === true;\n\tconst { size } = options;\n\tif (size !== undefined && (!Number.isSafeInteger(size) || size < 0))\n\t\tthrow invalid(`size must be a number of bytes, not ${size}`);\n\tconst ca = options.ca === undefined ? undefined : [options.ca].flat();\n\tconst auth = authOf(options.auth);\n\treturn {\n\t\tfrom,\n\t\tto,\n\t\thelo: heloOf(options.helo, byMx(options)),\n\t\ttls: tlsOf(options, allowPlaintextAuth),\n\t\tsecure: options.secure === true,\n\t\t...(ca ? { ca } : {}),\n\t\t...(auth ? { auth } : {}),\n\t\tallowPlaintextAuth,\n\t\t...(size === undefined ? {} : { size }),\n\t\tdsn: dsnOf(options, to, invalid),\n\t\tsmtputf8:\n\t\t\toptions.smtputf8 === true ||\n\t\t\t[from, ...to].some((text) => /[^ -~]/.test(text)),\n\t\tnormalizeLineEnds: options.normalizeLineEnds === true,\n\t\ttimeouts: timeoutsOf(options.timeouts),\n\t\tdeadline: seconds('deadline', options.deadline, 1800),\n\t};\n}\n\n/** Whether the options name a domain to deliver to by MX, not a host. */\nexport const byMx = (\n\toptions: SendMailOptions,\n): options is SendMailEnvelope & MxDestination =>\n\t!('host' in options && options.host !== undefined);\n\n/** A port: an integer from 1 to 65535. */\nexport function portOf(port: number | undefined, fallback: number): number {\n\tif (port === undefined) return fallback;\n\tif (!Number.isInteger(port) || port < 1 || port > 65535)\n\t\tthrow invalid(`port must be an integer from 1 to 65535, not ${port}`);\n\treturn port;\n}\n",
14
- "// The value rules (and utf8OrcptLength, RFC 6533) repeat packages/smtp/src/server/dsn-params.ts, packages/jmap/src/submission/dsn.ts and\n// packages/queue/src/contract/dsn-checks.ts (AGENTS.md, Deliberate duplications); this copy checks the client's own options.\nimport { encodeUtf8Orcpt, utf8OrcptLength } from '../protocol/orcpt';\nimport { encodeXtext } from '../protocol/xtext';\nimport type { DsnNotify, EnvelopeRecipient } from '../server/options';\n\n/** The DSN parameters of the message and of its recipients (RFC 3461 §4), checked. */\nexport interface DsnSettings {\n\treadonly ret?: 'FULL' | 'HDRS';\n\treadonly envid?: string;\n\t/** The recipients that carry `NOTIFY` or `ORCPT`, by address. */\n\treadonly recipients: ReadonlyMap<string, EnvelopeRecipient>;\n}\n\nconst EVENTS: readonly string[] = ['SUCCESS', 'FAILURE', 'DELAY'];\n\n/** Checks `ret`, `envid` and `recipients`; `fail` throws the `INVALID_OPTION` for a message. */\nexport function dsnOf(\n\tgiven: {\n\t\tret?: unknown;\n\t\tenvid?: unknown;\n\t\trecipients?: unknown;\n\t},\n\tto: readonly string[],\n\tfail: (message: string) => Error,\n): DsnSettings {\n\tconst { ret, envid, recipients } = given;\n\tif (ret !== undefined && ret !== 'FULL' && ret !== 'HDRS')\n\t\tthrow fail(`ret must be 'FULL' or 'HDRS', not ${String(ret)}`);\n\tif (\n\t\tenvid !== undefined &&\n\t\t(typeof envid !== 'string' ||\n\t\t\t!/^[ -~]{1,100}$/.test(envid) ||\n\t\t\t// RFC 3461 §4.4: \"The ENVID parameter MAY be up to 100 characters in length\", as sent.\n\t\t\tencodeXtext(envid).length > 100)\n\t)\n\t\tthrow fail(\n\t\t\t'envid must be 1 to 100 printable ASCII characters, at most 100 once encoded as xtext',\n\t\t);\n\tconst byAddress = new Map<string, EnvelopeRecipient>();\n\tif (recipients !== undefined) {\n\t\tif (!Array.isArray(recipients))\n\t\t\tthrow fail('recipients must be an array of { address, notify, orcpt }');\n\t\tfor (const entry of recipients as EnvelopeRecipient[]) {\n\t\t\tconst address = entry?.address;\n\t\t\tif (typeof address !== 'string' || !to.includes(address))\n\t\t\t\tthrow fail(\n\t\t\t\t\t`recipients names ${JSON.stringify(address)}, which is not in to`,\n\t\t\t\t);\n\t\t\tif (byAddress.has(address))\n\t\t\t\tthrow fail(`recipients names ${address} twice`);\n\t\t\tcheckRecipient(entry, fail);\n\t\t\tbyAddress.set(address, entry);\n\t\t}\n\t}\n\treturn {\n\t\t...(ret ? { ret } : {}),\n\t\t...(envid === undefined ? {} : { envid }),\n\t\trecipients: byAddress,\n\t};\n}\n\nfunction checkRecipient(\n\t{ address, notify, orcpt }: EnvelopeRecipient,\n\tfail: (message: string) => Error,\n): void {\n\tif (notify !== undefined && notify !== 'NEVER') {\n\t\tconst events: readonly unknown[] = Array.isArray(notify) ? notify : [];\n\t\tif (\n\t\t\tevents.length === 0 ||\n\t\t\tevents.some(\n\t\t\t\t(e, i) => !EVENTS.includes(e as string) || events.indexOf(e) !== i,\n\t\t\t)\n\t\t)\n\t\t\tthrow fail(\n\t\t\t\t`notify of ${address} must be 'NEVER' or a list of 'SUCCESS', 'FAILURE', 'DELAY', each once`,\n\t\t\t);\n\t}\n\tif (orcpt !== undefined) {\n\t\tif (\n\t\t\ttypeof orcpt !== 'object' ||\n\t\t\torcpt === null ||\n\t\t\ttypeof orcpt.type !== 'string' ||\n\t\t\t!/^[A-Za-z0-9-]+$/.test(orcpt.type)\n\t\t)\n\t\t\tthrow fail(\n\t\t\t\t`orcpt of ${address} must be { type, address }, the type a token`,\n\t\t\t);\n\t\tif (typeof orcpt.address !== 'string' || orcpt.address === '')\n\t\t\tthrow fail(`orcpt.address of ${address} must be a non-empty string`);\n\t\t// RFC 3461 §4.2: \"The entire ORCPT parameter MAY be up to 500 characters in length\", as sent.\n\t\t// For utf-8 (RFC 6533), the length of the unitext form, as the server counts it.\n\t\tconst encoded =\n\t\t\torcpt.type.toLowerCase() === 'utf-8'\n\t\t\t\t? utf8OrcptLength(orcpt.address)\n\t\t\t\t: encodeXtext(orcpt.address).length;\n\t\tif (orcpt.type.length + 1 + encoded > 500)\n\t\t\tthrow fail(`orcpt of ${address} is over 500 characters once encoded`);\n\t}\n}\n\n/** Whether the options carry any DSN parameter. */\nexport const asksDsn = (dsn: DsnSettings): boolean =>\n\tdsn.ret !== undefined || dsn.envid !== undefined || dsn.recipients.size > 0;\n\n/** ` RET=… ENVID=…` for MAIL FROM, when the server lists DSN (RFC 3461 §4.3, §4.4). */\nexport function mailDsn(dsn: DsnSettings, offered: boolean): string {\n\tif (!offered) return '';\n\tlet out = '';\n\tif (dsn.ret) out += ` RET=${dsn.ret}`;\n\tif (dsn.envid !== undefined) out += ` ENVID=${encodeXtext(dsn.envid)}`;\n\treturn out;\n}\n\n/**\n * ` ORCPT=…` or nothing: `rfc822` and an ASCII address as xtext; any other\n * type as xtext of the address octets, type case kept (RFC 3461 §5.2(d)); `utf-8` per\n * RFC 6533 §3, `utf-8-addr-unitext` when the transaction uses SMTPUTF8 (the\n * server of this transaction lists it), else `utf-8-addr-xtext`. Left out\n * rather than refused: a non-ASCII `rfc822` address, a lone\n * surrogate (any type), or a `utf-8` value over 500 characters (its escapes can be longer\n * than the xtext the options were checked against; RFC 3461 §4.2).\n */\nfunction orcptParameter(\n\t{ type, address }: NonNullable<EnvelopeRecipient['orcpt']>,\n\tsmtputf8: boolean,\n): string {\n\tconst kind = type.toLowerCase();\n\tif (kind === 'rfc822')\n\t\treturn /^[\\x20-\\x7e]+$/.test(address)\n\t\t\t? ` ORCPT=${type};${encodeXtext(address)}`\n\t\t\t: '';\n\tif (kind !== 'utf-8') {\n\t\t// RFC 3461 §5.2(d): relayed identical, type case kept; any octets fit xtext, a lone surrogate does not round-trip.\n\t\tconst value = `${type};${encodeXtext(address)}`;\n\t\treturn address.isWellFormed() ? ` ORCPT=${value}` : '';\n\t}\n\tconst encoded = encodeUtf8Orcpt(address, smtputf8);\n\tif (encoded === undefined) return '';\n\tconst value = `${type};${encoded}`;\n\treturn new TextEncoder().encode(value).length > 500 ? '' : ` ORCPT=${value}`;\n}\n\n/** ` NOTIFY=… ORCPT=…` for one RCPT TO, when the server lists DSN (RFC 3461 §4.1, §4.2). */\nexport function rcptDsn(\n\tdsn: DsnSettings,\n\taddress: string,\n\toffered: boolean,\n\tsmtputf8 = false,\n): string {\n\tconst entry = dsn.recipients.get(address);\n\tif (!offered || !entry) return '';\n\tlet out = '';\n\tconst { notify, orcpt } = entry;\n\tif (notify !== undefined)\n\t\tout += ` NOTIFY=${notify === 'NEVER' ? 'NEVER' : (notify as readonly DsnNotify[]).join(',')}`;\n\tif (orcpt) out += orcptParameter(orcpt, smtputf8);\n\treturn out;\n}\n",
15
- "import { LineSplitter, MAX_LINE } from '../protocol/lines';\nimport type { Reply } from '../protocol/reply';\nimport { ReplyReader } from '../protocol/reply-reader';\n\n/** The most bytes a server may send in one session, every reply together. */\nexport const MAX_REPLY_BYTES = 1024 * 1024;\n\n/**\n * What a server sent, put together into replies, each bounded: `MAX_LINE`\n * a line, `MAX_REPLY_LINES` a reply, `MAX_REPLY_BYTES` in all. One pass\n * over the bytes, whatever the chunks.\n */\nexport class Inbox {\n\treadonly #lines = new LineSplitter();\n\treadonly #reader = new ReplyReader();\n\treadonly #replies: Reply[] = [];\n\t#received = 0;\n\n\t/** Takes the next bytes; says what is wrong with them, if they are not replies. */\n\tpush(chunk: Uint8Array): string | undefined {\n\t\tthis.#received += chunk.length;\n\t\tif (this.#received > MAX_REPLY_BYTES) {\n\t\t\treturn `more than ${MAX_REPLY_BYTES} bytes of replies`;\n\t\t}\n\t\tthis.#lines.push(chunk);\n\t\tfor (let event = this.#lines.next(); event; event = this.#lines.next()) {\n\t\t\tif ('tooLong' in event)\n\t\t\t\treturn `a reply line longer than ${MAX_LINE} bytes`;\n\t\t\tconst result = this.#reader.line(event.line);\n\t\t\tif (result === undefined) continue;\n\t\t\tif ('error' in result) return result.error;\n\t\t\tthis.#replies.push(result);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** The next complete reply. */\n\tshift(): Reply | undefined {\n\t\treturn this.#replies.shift();\n\t}\n\n\t/** Bytes or replies not yet read. */\n\tget holding(): boolean {\n\t\treturn this.#lines.holding || this.#replies.length > 0;\n\t}\n}\n",
12
+ "import { SmtpError } from '../errors';\nimport { parseEhlo } from '../protocol/ehlo';\nimport { encodeLoginStep, encodePlain } from '../protocol/sasl';\nimport { refused, shown } from './refusal';\nimport type { ConnectionSettings } from './settings';\nimport type { ClientSocket } from './socket';\nimport type { TlsTarget } from './target';\n\n/** A session past its greeting, EHLO, STARTTLS and AUTH: what the server offers. */\nexport interface Ready {\n\treadonly extensions: ReadonlyMap<string, string>;\n\treadonly authenticated: boolean;\n}\n\n/** EHLO, or HELO when the server refuses EHLO with a 5xx (RFC 5321 §4.1.4). */\nasync function hello(\n\tsocket: ClientSocket,\n\tsettings: ConnectionSettings,\n\tallowHelo: boolean,\n): Promise<ReadonlyMap<string, string>> {\n\tconst seconds = settings.timeouts.command;\n\tsocket.write(`EHLO ${settings.helo}\\r\\n`);\n\tconst ehlo = await socket.reply('the reply to EHLO', seconds);\n\tif (ehlo.code === 250) {\n\t\treturn parseEhlo(typeof ehlo.text === 'string' ? [ehlo.text] : ehlo.text);\n\t}\n\tif (ehlo.code < 500 || !allowHelo) throw refused(socket.host, 'EHLO', ehlo);\n\tsocket.write(`HELO ${settings.helo}\\r\\n`);\n\tconst helo = await socket.reply('the reply to HELO', seconds);\n\tif (helo.code !== 250) throw refused(socket.host, 'HELO', helo);\n\treturn new Map();\n}\n\n/** STARTTLS when offered (RFC 3207); `required` fails without it, `opportunistic` goes on in clear. */\nasync function startTls(\n\tsocket: ClientSocket,\n\tsettings: ConnectionSettings,\n\ttls: TlsTarget,\n\textensions: ReadonlyMap<string, string>,\n): Promise<ReadonlyMap<string, string>> {\n\tconst required = settings.tls === 'required';\n\tif (!extensions.has('STARTTLS')) {\n\t\tif (!required) return extensions;\n\t\tthrow new SmtpError(\n\t\t\t'TLS_UNAVAILABLE',\n\t\t\t`${socket.host} does not offer STARTTLS, and tls is 'required'`,\n\t\t);\n\t}\n\tsocket.write('STARTTLS\\r\\n');\n\tconst answer = await socket.reply(\n\t\t'the reply to STARTTLS',\n\t\tsettings.timeouts.command,\n\t);\n\tif (answer.code !== 220) {\n\t\tif (!required) return extensions;\n\t\tthrow new SmtpError(\n\t\t\t'TLS_UNAVAILABLE',\n\t\t\t`${socket.host} refused STARTTLS, and tls is 'required': ${shown(answer)}`,\n\t\t\t{ reply: answer, temporary: true },\n\t\t);\n\t}\n\tawait socket.startTls(tls, settings.timeouts.connect);\n\t// RFC 3207 §4.2: what was learnt in clear is forgotten; EHLO again.\n\treturn hello(socket, settings, false);\n}\n\n/** AUTH PLAIN or LOGIN (RFC 4954), over TLS unless `allowPlaintextAuth`. */\nasync function authenticate(\n\tsocket: ClientSocket,\n\tsettings: ConnectionSettings,\n\textensions: ReadonlyMap<string, string>,\n): Promise<void> {\n\tconst { auth } = settings;\n\tif (!auth) return;\n\tconst { host } = socket;\n\tif (!socket.secure && !settings.allowPlaintextAuth) {\n\t\tthrow new SmtpError(\n\t\t\t'AUTH_UNAVAILABLE',\n\t\t\t`Refusing to send credentials to ${host} in clear: it did not start TLS (allowPlaintextAuth is for a local test server only)`,\n\t\t);\n\t}\n\tconst offered = (extensions.get('AUTH') ?? '').toUpperCase().split(' ');\n\tconst mechanism =\n\t\tauth.mechanism ??\n\t\t(offered.includes('PLAIN')\n\t\t\t? 'PLAIN'\n\t\t\t: offered.includes('LOGIN')\n\t\t\t\t? 'LOGIN'\n\t\t\t\t: undefined);\n\tif (!mechanism || !offered.includes(mechanism)) {\n\t\tthrow new SmtpError(\n\t\t\t'AUTH_UNAVAILABLE',\n\t\t\t`${host} offers no AUTH mechanism this client speaks (${auth.mechanism ?? 'PLAIN, LOGIN'}): AUTH ${extensions.get('AUTH') ?? 'is not offered'}`,\n\t\t);\n\t}\n\tconst seconds = settings.timeouts.command;\n\tconst steps =\n\t\tmechanism === 'PLAIN'\n\t\t\t? [`AUTH PLAIN ${encodePlain(auth.username, auth.password)}`]\n\t\t\t: [\n\t\t\t\t\t'AUTH LOGIN',\n\t\t\t\t\tencodeLoginStep(auth.username),\n\t\t\t\t\tencodeLoginStep(auth.password),\n\t\t\t\t];\n\tfor (const [i, step] of steps.entries()) {\n\t\tsocket.write(`${step}\\r\\n`);\n\t\tconst answer = await socket.reply('the reply to AUTH', seconds);\n\t\tconst last = i === steps.length - 1;\n\t\tif (answer.code === (last ? 235 : 334)) continue;\n\t\tthrow refused(host, `AUTH ${mechanism}`, answer);\n\t}\n}\n\n/** The greeting, EHLO, STARTTLS and AUTH: a session ready for MAIL FROM. */\nexport async function open(\n\tsocket: ClientSocket,\n\tsettings: ConnectionSettings,\n\ttls: TlsTarget,\n): Promise<Ready> {\n\tconst greeting = await socket.reply(\n\t\t'the greeting',\n\t\tsettings.timeouts.greeting,\n\t);\n\tif (greeting.code !== 220) {\n\t\tthrow refused(socket.host, 'the connection', greeting);\n\t}\n\tlet extensions = await hello(socket, settings, true);\n\tif (!socket.secure && settings.tls !== 'none') {\n\t\textensions = await startTls(socket, settings, tls, extensions);\n\t}\n\tawait authenticate(socket, settings, extensions);\n\treturn { extensions, authenticated: settings.auth !== undefined };\n}\n",
13
+ "import { LineSplitter, MAX_LINE } from '../protocol/lines';\nimport type { Reply } from '../protocol/reply';\nimport { ReplyReader } from '../protocol/reply-reader';\n\n/** The most bytes a server may send in one session, every reply together. */\nexport const MAX_REPLY_BYTES = 1024 * 1024;\n\n/**\n * What a server sent, put together into replies, each bounded: `MAX_LINE`\n * a line, `MAX_REPLY_LINES` a reply, `MAX_REPLY_BYTES` in all. One pass\n * over the bytes, whatever the chunks.\n */\nexport class Inbox {\n\treadonly #lines = new LineSplitter();\n\treadonly #reader = new ReplyReader();\n\treadonly #replies: Reply[] = [];\n\t#received = 0;\n\n\t/** Takes the next bytes; says what is wrong with them, if they are not replies. */\n\tpush(chunk: Uint8Array): string | undefined {\n\t\tthis.#received += chunk.length;\n\t\tif (this.#received > MAX_REPLY_BYTES) {\n\t\t\treturn `more than ${MAX_REPLY_BYTES} bytes of replies`;\n\t\t}\n\t\tthis.#lines.push(chunk);\n\t\tfor (let event = this.#lines.next(); event; event = this.#lines.next()) {\n\t\t\tif ('tooLong' in event)\n\t\t\t\treturn `a reply line longer than ${MAX_LINE} bytes`;\n\t\t\tconst result = this.#reader.line(event.line);\n\t\t\tif (result === undefined) continue;\n\t\t\tif ('error' in result) return result.error;\n\t\t\tthis.#replies.push(result);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** The bytes counted against `MAX_REPLY_BYTES` start over: a new message on a reused connection. */\n\treset(): void {\n\t\tthis.#received = 0;\n\t}\n\n\t/** The next complete reply. */\n\tshift(): Reply | undefined {\n\t\treturn this.#replies.shift();\n\t}\n\n\t/** Bytes or replies not yet read. */\n\tget holding(): boolean {\n\t\treturn this.#lines.holding || this.#replies.length > 0;\n\t}\n}\n",
16
14
  "import type { TLSOptions } from 'bun';\n\n/** Where to connect: `host` names the server in errors, and is what TLS checks. */\nexport interface Endpoint {\n\treadonly host: string;\n\treadonly address: string;\n\treadonly port: number;\n}\n\n/** How to start TLS: check the certificate against `servername`, or not. */\nexport interface TlsTarget {\n\treadonly servername: string;\n\treadonly verify: boolean;\n\treadonly ca?: readonly string[];\n}\n\n/** Bun's TLS options for a target: `rejectUnauthorized` only when checking (RFC 7435 otherwise). */\nexport const tlsOptions = (tls: TlsTarget): TLSOptions => ({\n\tserverName: tls.servername,\n\trejectUnauthorized: tls.verify,\n\t...(tls.ca ? { ca: [...tls.ca] } : {}),\n});\n\n/** Why a connection or a handshake failed, from what Bun gave: its code, else its message. */\nexport const reason = (error: unknown): string =>\n\t(error as { code?: string } | null)?.code ??\n\t(error as Error | null)?.message ??\n\t'the handshake failed';\n\n/** The whole delivery's deadline. */\nexport class Clock {\n\treadonly seconds: number;\n\treadonly #end: number;\n\n\tconstructor(seconds: number) {\n\t\tthis.seconds = seconds;\n\t\tthis.#end = performance.now() + seconds * 1000;\n\t}\n\n\t/**\n\t * `promise`, or what `expire` gives, thrown once `ms` passed or the\n\t * deadline did, whichever comes first; `deadline` says which it was.\n\t */\n\tasync race<T>(\n\t\tpromise: Promise<T>,\n\t\tms: number,\n\t\texpire: (deadline: boolean) => Error,\n\t): Promise<T> {\n\t\tconst left = this.#end - performance.now();\n\t\tconst deadline = left < ms;\n\t\tms = Math.min(ms, left);\n\t\tif (ms <= 0) throw expire(deadline);\n\t\tlet timer: Timer | undefined;\n\t\tconst expired = new Promise<never>((_, reject) => {\n\t\t\ttimer = setTimeout(() => reject(expire(deadline)), ms);\n\t\t});\n\t\ttry {\n\t\t\treturn await Promise.race([promise, expired]);\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t}\n}\n",
17
- "import type { Socket, SocketHandler } from 'bun';\nimport { SmtpError } from '../errors';\nimport { Outgoing } from '../io/outgoing';\nimport type { Reply } from '../protocol/reply';\nimport { Inbox } from './inbox';\nimport { badReply, lost, refused, timedOut, tlsFailed } from './refusal';\nimport {\n\ttype Clock,\n\ttype Endpoint,\n\treason,\n\ttype TlsTarget,\n\ttlsOptions,\n} from './target';\n\n/**\n * A connection to an SMTP server: replies read as they come into an\n * `Inbox`, which bounds them; every wait bounded by its timeout and the\n * deadline. Whatever the server does ends in a reply or an `SmtpError`,\n * never in an exception of Bun's.\n */\nexport class ClientSocket {\n\treadonly host: string;\n\treadonly #clock: Clock;\n\t#socket: Socket<undefined> | undefined;\n\t#outgoing = new Outgoing(() => 0);\n\t/** Which socket's events count: the TLS one's after STARTTLS. */\n\t#tls = false;\n\treadonly #inbox = new Inbox();\n\t#failure: SmtpError | undefined;\n\t#closed = false;\n\t#wake: (() => void) | undefined;\n\t#handshaking: ((ok: boolean, error: unknown) => void) | undefined;\n\t/** Resolves when the connection is gone. */\n\treadonly #gone = Promise.withResolvers<void>();\n\tsecure = false;\n\t/** The certificate checked out against the host name. */\n\tverified = false;\n\n\tprivate constructor(host: string, clock: Clock) {\n\t\tthis.host = host;\n\t\tthis.#clock = clock;\n\t}\n\n\t/** Connects, with TLS from the first byte when `tls` is given. */\n\tstatic async open(\n\t\tendpoint: Endpoint,\n\t\ttls: TlsTarget | undefined,\n\t\tseconds: number,\n\t\tclock: Clock,\n\t): Promise<ClientSocket> {\n\t\tconst client = new ClientSocket(endpoint.host, clock);\n\t\tclient.#tls = tls !== undefined;\n\t\tconst handshake = tls ? client.#expectHandshake(tls) : undefined;\n\t\thandshake?.catch(() => {});\n\t\tconst { address, port } = endpoint;\n\t\tconst connecting = Bun.connect({\n\t\t\thostname: address,\n\t\t\tport,\n\t\t\t...(tls ? { tls: tlsOptions(tls) } : {}),\n\t\t\tsocket: client.#handlers(tls !== undefined),\n\t\t});\n\t\ttry {\n\t\t\tclient.#use(await client.#race(connecting, seconds, 'the connection'));\n\t\t} catch (error) {\n\t\t\tconnecting.then(\n\t\t\t\t(socket) => socket.terminate(),\n\t\t\t\t() => {},\n\t\t\t);\n\t\t\tif (error instanceof SmtpError) throw error;\n\t\t\tthrow new SmtpError(\n\t\t\t\t'CONNECTION_FAILED',\n\t\t\t\t`Could not connect to ${endpoint.host} (${address}:${port}): ${reason(error)}`,\n\t\t\t);\n\t\t}\n\t\tif (handshake) {\n\t\t\t// A handshake that failed before the connection resolved left it open.\n\t\t\tawait client.#race(handshake, seconds, 'the TLS handshake').catch((e) => {\n\t\t\t\tclient.close(true);\n\t\t\t\tthrow e;\n\t\t\t});\n\t\t}\n\t\treturn client;\n\t}\n\n\t#use(socket: Socket<undefined>): void {\n\t\tthis.#socket = socket;\n\t\tthis.#outgoing = new Outgoing((bytes) => socket.write(bytes));\n\t}\n\n\t/** Bun's events for one socket: only the live one's count, the clear one's or, after STARTTLS, the TLS one's. */\n\t#handlers(tls: boolean): SocketHandler<undefined> {\n\t\tconst live =\n\t\t\t<A extends unknown[]>(run: (...args: A) => void) =>\n\t\t\t(...args: A) => {\n\t\t\t\tif (this.#tls === tls) run(...args);\n\t\t\t};\n\t\treturn {\n\t\t\tdata: live((_, chunk: Uint8Array) => this.#receive(chunk)),\n\t\t\tdrain: live(() => this.#outgoing.drain()),\n\t\t\tclose: live(() => this.#lost()),\n\t\t\terror: live(() => this.#lost()),\n\t\t\thandshake: live((_, ok: boolean, error: Error | null) =>\n\t\t\t\tthis.#handshaking?.(ok, error),\n\t\t\t),\n\t\t};\n\t}\n\n\t#expectHandshake(tls: TlsTarget): Promise<void> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.#handshaking = (ok, error) => {\n\t\t\t\tthis.#handshaking = undefined;\n\t\t\t\tif (this.#closed || (tls.verify && !ok)) {\n\t\t\t\t\tconst why = this.#closed ? 'the connection closed' : reason(error);\n\t\t\t\t\treturn reject(this.#fail(tlsFailed(this.host, why)));\n\t\t\t\t}\n\t\t\t\tthis.secure = true;\n\t\t\t\tthis.verified = ok && error === null;\n\t\t\t\tresolve();\n\t\t\t};\n\t\t});\n\t}\n\n\t#receive(chunk: Uint8Array): void {\n\t\tif (this.#failure || this.#closed) return;\n\t\tconst wrong = this.#inbox.push(chunk);\n\t\tif (wrong) this.#fail(badReply(this.host, wrong));\n\t\telse this.#wakeUp();\n\t}\n\n\t#wakeUp(): void {\n\t\tconst wake = this.#wake;\n\t\tthis.#wake = undefined;\n\t\twake?.();\n\t}\n\n\t#lost(): void {\n\t\tthis.#closed = true;\n\t\tthis.#gone.resolve();\n\t\tthis.#outgoing.clear();\n\t\tthis.#handshaking?.(false, null);\n\t\tthis.#wakeUp();\n\t}\n\n\t/** Records the first failure, hangs up, and returns it to throw. */\n\t#fail(error: SmtpError): SmtpError {\n\t\tthis.#failure ??= error;\n\t\tthis.#socket?.terminate();\n\t\tthis.#lost();\n\t\treturn this.#failure;\n\t}\n\n\t/**\n\t * `promise`, or a `TIMEOUT` once `seconds` passed since `start` (now by\n\t * default), or the deadline did, whichever comes first.\n\t */\n\t#race<T>(\n\t\tpromise: Promise<T>,\n\t\tseconds: number,\n\t\twhat: string,\n\t\tstart = performance.now(),\n\t): Promise<T> {\n\t\tconst ms = start + seconds * 1000 - performance.now();\n\t\tconst { host } = this;\n\t\tconst deadline = this.#clock.seconds;\n\t\treturn this.#clock.race(promise, ms, (passed) =>\n\t\t\tthis.#fail(timedOut(host, what, seconds, passed ? deadline : undefined)),\n\t\t);\n\t}\n\n\t/** The next reply, within `seconds` all told; `what` names it in errors: `the greeting`, `the reply to MAIL FROM`. */\n\tasync reply(what: string, seconds: number): Promise<Reply> {\n\t\tconst start = performance.now();\n\t\tfor (;;) {\n\t\t\tconst next = this.#inbox.shift();\n\t\t\tif (next) return next;\n\t\t\tif (this.#failure) throw this.#failure;\n\t\t\tif (this.#closed) throw this.#fail(lost(this.host, what));\n\t\t\tawait this.#race(\n\t\t\t\tnew Promise<void>((wake) => {\n\t\t\t\t\tthis.#wake = wake;\n\t\t\t\t}),\n\t\t\t\tseconds,\n\t\t\t\twhat,\n\t\t\t\tstart,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** One of the caller's promises — the message stream's next part — bounded as a reply is, and cut short if the connection goes (a hang-up after it settled is none of its business). */\n\twithin<T>(promise: Promise<T>, seconds: number, what: string): Promise<T> {\n\t\tconst over = new AbortController();\n\t\tconst gone = this.#gone.promise.then(() => {\n\t\t\tif (!over.signal.aborted) throw this.#hungUp(lost(this.host, what));\n\t\t});\n\t\tconst race = Promise.race([promise, gone]) as Promise<T>;\n\t\t// Once the deadline passed, the clock throws before it listens to `race`, and its expiry hangs up (`#fail`), which rejects `gone` and so `race` unheard.\n\t\trace.catch(() => undefined);\n\t\treturn this.#race(race, seconds, what).finally(() => over.abort());\n\t}\n\n\t/** Queues bytes for the server; nothing once the connection failed. Whether it did queue them. */\n\twrite(data: Uint8Array | string): boolean {\n\t\tif (this.#failure || this.#closed) return false;\n\t\tthis.#outgoing.write(\n\t\t\ttypeof data === 'string' ? new TextEncoder().encode(data) : data,\n\t\t);\n\t\treturn true;\n\t}\n\n\t/** Waits until the server took everything written. */\n\tasync drained(seconds: number): Promise<void> {\n\t\tawait this.#race(\n\t\t\tthis.#outgoing.drained(),\n\t\t\tseconds,\n\t\t\t'the server to take the message',\n\t\t);\n\t\tif (this.#failure || this.#closed) throw this.#hungUp(lost(this.host));\n\t}\n\n\t/** Why the connection is gone during DATA: its failure, the refusal a server sent before hanging up, or `lost`. */\n\t#hungUp(otherwise: SmtpError): SmtpError {\n\t\tif (this.#failure) return this.#failure;\n\t\tconst said = this.#inbox.shift();\n\t\treturn this.#fail(\n\t\t\tsaid ? refused(this.host, 'the message', said) : otherwise,\n\t\t);\n\t}\n\n\t/** After the 220 to STARTTLS: TLS on this connection. Anything the server sent past the 220 is an attack. */\n\tasync startTls(tls: TlsTarget, seconds: number): Promise<void> {\n\t\tconst socket = this.#socket;\n\t\tif (this.#inbox.holding || !socket) {\n\t\t\tthrow this.#fail(badReply(this.host, 'more after its 220 to STARTTLS'));\n\t\t}\n\t\tconst handshake = this.#expectHandshake(tls);\n\t\thandshake.catch(() => {});\n\t\tthis.#tls = true;\n\t\tconst [, encrypted] = socket.upgradeTLS<undefined>({\n\t\t\ttls: tlsOptions(tls),\n\t\t\tsocket: this.#handlers(true),\n\t\t});\n\t\tthis.#use(encrypted);\n\t\tawait this.#race(handshake, seconds, 'the TLS handshake');\n\t}\n\n\t/** Hangs up; `now` at once, so a message cut short is not delivered. */\n\tclose(now = false): void {\n\t\tthis.#closed = true;\n\t\tif (now) this.#socket?.terminate();\n\t\telse this.#socket?.end();\n\t}\n}\n",
18
- "import { type RecipientReply, SmtpError } from '../errors';\nimport { DataWriter } from '../protocol/data-writer';\nimport type { Reply } from '../protocol/reply';\nimport { bareLineBreak, type Content } from './content';\nimport { mailDsn, rcptDsn } from './dsn';\nimport { afterDot, refused, shown } from './refusal';\nimport type { Ready } from './session';\nimport type { ClientSettings } from './settings';\nimport type { ClientSocket } from './socket';\n\n/** What the server said to the envelope and the message. */\nexport interface Delivered {\n\treadonly accepted: readonly RecipientReply[];\n\treadonly rejected: readonly RecipientReply[];\n\treadonly reply: Reply;\n\t/** The server lists DSN. */\n\treadonly dsnOffered: boolean;\n}\n\n/** The envelope's outcome, as an error after the final dot carries it. */\ntype Taken = Pick<Delivered, 'accepted' | 'rejected'>;\n\nconst missing = (host: string, extension: string, why: string) =>\n\tnew SmtpError(\n\t\t'EXTENSION_MISSING',\n\t\t`${host} does not offer ${extension}, which ${why}`,\n\t);\n\n/** MAIL FROM's parameters: SIZE (RFC 1870), BODY (RFC 6152), SMTPUTF8 (RFC 6531). */\nfunction mailParameters(\n\thost: string,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\textensions: ReadonlyMap<string, string>,\n): string {\n\tlet parameters = '';\n\tconst size = extensions.get('SIZE');\n\tif (size !== undefined && content.size !== undefined) {\n\t\tconst max = Number(size);\n\t\tif (Number.isSafeInteger(max) && max > 0 && content.size > max) {\n\t\t\tthrow new SmtpError(\n\t\t\t\t'MESSAGE_TOO_BIG',\n\t\t\t\t`The message (${content.size} bytes) is larger than the ${max} bytes ${host} takes (SIZE)`,\n\t\t\t\t{ temporary: false },\n\t\t\t);\n\t\t}\n\t\tparameters += ` SIZE=${content.size}`;\n\t}\n\tif (extensions.has('8BITMIME')) parameters += ' BODY=8BITMIME';\n\telse if (content.eightBit) {\n\t\tthrow missing(host, '8BITMIME', 'the message needs: it has 8-bit bytes');\n\t}\n\tif (settings.smtputf8) {\n\t\tif (!extensions.has('SMTPUTF8')) {\n\t\t\tthrow missing(\n\t\t\t\thost,\n\t\t\t\t'SMTPUTF8',\n\t\t\t\t'an address that is not ASCII needs (or smtputf8 asked for)',\n\t\t\t);\n\t\t}\n\t\tparameters += ' SMTPUTF8';\n\t}\n\treturn parameters;\n}\n\n/** MAIL FROM and every RCPT TO: in one write with PIPELINING (RFC 2920), else one by one. */\nasync function envelope(\n\tsocket: ClientSocket,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tready: Ready,\n): Promise<{ accepted: RecipientReply[]; rejected: RecipientReply[] }> {\n\tconst { host } = socket;\n\tconst { timeouts } = settings;\n\tconst dsn = ready.extensions.has('DSN');\n\tconst mail = `MAIL FROM:<${settings.from}>${mailParameters(host, settings, content, ready.extensions)}${mailDsn(settings.dsn, dsn)}\\r\\n`;\n\tconst rcpts = settings.to.map(\n\t\t(to) =>\n\t\t\t`RCPT TO:<${to}>${rcptDsn(settings.dsn, to, dsn, settings.smtputf8)}\\r\\n`,\n\t);\n\tconst pipelining = ready.extensions.has('PIPELINING');\n\tsocket.write(pipelining ? mail + rcpts.join('') : mail);\n\tconst from = await socket.reply('the reply to MAIL FROM', timeouts.mail);\n\tif (from.code !== 250) throw refused(host, 'the sender', from);\n\tconst accepted: RecipientReply[] = [];\n\tconst rejected: RecipientReply[] = [];\n\tfor (const [i, recipient] of settings.to.entries()) {\n\t\tif (!pipelining) socket.write(rcpts[i] as string);\n\t\tconst reply = await socket.reply('the reply to RCPT TO', timeouts.rcpt);\n\t\tconst into = reply.code === 250 || reply.code === 251 ? accepted : rejected;\n\t\tinto.push({ recipient, reply });\n\t}\n\tif (accepted.length === 0) {\n\t\tconst first = rejected[0] as RecipientReply;\n\t\tthrow new SmtpError(\n\t\t\t'RECIPIENTS_REFUSED',\n\t\t\t`${host} refused every recipient, ${first.recipient} with ${shown(first.reply)}`,\n\t\t\t{\n\t\t\t\treply: first.reply,\n\t\t\t\trejected,\n\t\t\t\ttemporary: rejected.some(({ reply }) => reply.code < 500),\n\t\t\t},\n\t\t);\n\t}\n\treturn { accepted, rejected };\n}\n\n/** The message, stuffed, block by block as the server takes it; a bad stream hangs up before the dot. */\nasync function data(\n\tsocket: ClientSocket,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tready: Ready,\n\ttaken: Taken,\n): Promise<Reply> {\n\tconst { host } = socket;\n\tconst { timeouts } = settings;\n\tsocket.write('DATA\\r\\n');\n\tconst start = await socket.reply('the reply to DATA', timeouts.dataStart);\n\tif (start.code !== 354) throw refused(host, 'DATA', start);\n\tconst writer = new DataWriter(settings.normalizeLineEnds);\n\tconst eightBitOk = ready.extensions.has('8BITMIME');\n\tconst chunks = content.chunks();\n\tlet tail: Uint8Array;\n\ttry {\n\t\tfor (;;) {\n\t\t\t// The caller's stream is bounded as the server is: a stalled one times out.\n\t\t\tconst chunk = await socket.within(\n\t\t\t\tchunks.next(),\n\t\t\t\ttimeouts.dataBlock,\n\t\t\t\t'the next part of the message',\n\t\t\t);\n\t\t\tif (!chunk) break;\n\t\t\tconst bytes = writer.write(chunk);\n\t\t\tif (writer.bareLineBreaks > 0) throw bareLineBreak();\n\t\t\tif (writer.eightBit && !eightBitOk) {\n\t\t\t\tthrow missing(\n\t\t\t\t\thost,\n\t\t\t\t\t'8BITMIME',\n\t\t\t\t\t'the message needs: it has 8-bit bytes',\n\t\t\t\t);\n\t\t\t}\n\t\t\tsocket.write(bytes);\n\t\t\tawait socket.drained(timeouts.dataBlock);\n\t\t}\n\t\t// A CR held at the very end is bare only now: still no dot for it.\n\t\ttail = writer.end();\n\t\tif (writer.bareLineBreaks > 0) throw bareLineBreak();\n\t} catch (error) {\n\t\t// No final dot: the server drops what it has of the message.\n\t\tchunks.cancel();\n\t\tsocket.close(true);\n\t\tthrow error;\n\t}\n\t// A connection that failed already took no dot: its error is not afterData.\n\tconst dotSent = socket.write(tail);\n\tconst end = await socket\n\t\t.reply('the reply to the final dot', timeouts.dataEnd)\n\t\t.catch((error: unknown) => {\n\t\t\t// No reply to the dot: the server may have taken the message.\n\t\t\tthrow dotSent ? afterDot(error, taken) : error;\n\t\t});\n\tif (end.code !== 250) throw refused(host, 'the message', end);\n\treturn end;\n}\n\n/** One message: the envelope, then the content. */\nexport async function transact(\n\tsocket: ClientSocket,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tready: Ready,\n): Promise<Delivered> {\n\tconst { accepted, rejected } = await envelope(\n\t\tsocket,\n\t\tsettings,\n\t\tcontent,\n\t\tready,\n\t);\n\tconst reply = await data(socket, settings, content, ready, {\n\t\taccepted,\n\t\trejected,\n\t});\n\treturn {\n\t\taccepted,\n\t\trejected,\n\t\treply,\n\t\tdsnOffered: ready.extensions.has('DSN'),\n\t};\n}\n",
19
- "import { SmtpError } from '../errors';\nimport { type Content, contentOf } from './content';\nimport { addressesOf, noAddress, resolveMx } from './mx';\nimport type {\n\tMessageSource,\n\tMxDestination,\n\tSendMailOptions,\n\tSendMailResult,\n} from './options';\nimport { timedOut } from './refusal';\nimport { open } from './session';\nimport {\n\tbyMx,\n\ttype ClientSettings,\n\tinvalid,\n\tportOf,\n\tsettingsOf,\n} from './settings';\nimport { ClientSocket } from './socket';\nimport { Clock, type Endpoint, type TlsTarget } from './target';\nimport { transact } from './transaction';\n\n/** The most addresses one delivery tries, every MX host together; and the most MX hosts it looks up. */\nexport const MAX_ADDRESSES = 10;\n\n/** Seconds to wait for the 221 to QUIT once the message was taken. */\nconst QUIT_WAIT = 5;\n\n/** Errors from before MAIL FROM: another MX host may do better. */\nconst early = new WeakSet<object>();\n\n/** One session with one server, from the connection to QUIT. */\nasync function attempt(\n\tendpoint: Endpoint,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tclock: Clock,\n): Promise<SendMailResult> {\n\tconst tls: TlsTarget = {\n\t\tservername: endpoint.host,\n\t\tverify: settings.tls === 'required',\n\t\t...(settings.ca ? { ca: settings.ca } : {}),\n\t};\n\tlet socket: ClientSocket;\n\ttry {\n\t\tsocket = await ClientSocket.open(\n\t\t\tendpoint,\n\t\t\tsettings.secure ? tls : undefined,\n\t\t\tsettings.timeouts.connect,\n\t\t\tclock,\n\t\t);\n\t} catch (error) {\n\t\tearly.add(error as object);\n\t\tthrow error;\n\t}\n\tlet quit = false;\n\ttry {\n\t\tconst ready = await open(socket, settings, tls).catch((error) => {\n\t\t\tearly.add(error as object);\n\t\t\tthrow error;\n\t\t});\n\t\tconst delivered = await transact(socket, settings, content, ready);\n\t\tsocket.write('QUIT\\r\\n');\n\t\tquit = true;\n\t\tawait socket\n\t\t\t.reply(\n\t\t\t\t'the reply to QUIT',\n\t\t\t\tMath.min(QUIT_WAIT, settings.timeouts.command),\n\t\t\t)\n\t\t\t.catch(() => {});\n\t\treturn {\n\t\t\t...delivered,\n\t\t\thost: endpoint.host,\n\t\t\tport: endpoint.port,\n\t\t\ttls: socket.secure ? { verified: socket.verified } : false,\n\t\t\tauthenticated: ready.authenticated,\n\t\t};\n\t} finally {\n\t\t// After a refusal the session is still in step: say goodbye.\n\t\tif (!quit) socket.write('QUIT\\r\\n');\n\t\tsocket.close();\n\t}\n}\n\n/** A DNS lookup, bounded by the delivery's deadline (the resolver has its own timeout too). */\nconst withinDeadline = <T>(\n\tlookup: Promise<T>,\n\tclock: Clock,\n\tname: string,\n\twhat: string,\n): Promise<T> =>\n\tclock.race(lookup, Number.POSITIVE_INFINITY, () =>\n\t\ttimedOut(name, what, clock.seconds, clock.seconds),\n\t);\n\n/** Direct delivery: each MX host's addresses in turn, while the failures are temporary and before MAIL FROM. */\nasync function viaMx(\n\toptions: MxDestination,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tclock: Clock,\n): Promise<SendMailResult> {\n\tconst { domain, resolver } = options;\n\tif (typeof domain !== 'string' || domain === '')\n\t\tthrow invalid('domain must be a domain name');\n\tif (typeof resolver?.mx !== 'function')\n\t\tthrow invalid('resolver must be a Resolver, such as @bumail/dns gives');\n\tconst port = portOf(options.port, 25);\n\tlet last: unknown;\n\tlet dnsError: unknown;\n\tlet tried = 0;\n\tlet looked = 0;\n\tconst mailHosts = await withinDeadline(\n\t\tresolveMx(domain, resolver),\n\t\tclock,\n\t\tdomain,\n\t\t'the MX lookup',\n\t);\n\thosts: for (const mx of mailHosts) {\n\t\t// A host looked up counts, with an address or not: no endless lookups.\n\t\tif (tried >= MAX_ADDRESSES || looked++ >= MAX_ADDRESSES) break;\n\t\tconst addresses = await withinDeadline(\n\t\t\taddressesOf(mx.host, resolver),\n\t\t\tclock,\n\t\t\tmx.host,\n\t\t\t'the address lookup',\n\t\t);\n\t\tif (!Array.isArray(addresses)) {\n\t\t\tdnsError = addresses.error;\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const address of addresses) {\n\t\t\tif (tried++ >= MAX_ADDRESSES) break hosts;\n\t\t\ttry {\n\t\t\t\treturn await attempt(\n\t\t\t\t\t{ host: mx.host, address, port },\n\t\t\t\t\tsettings,\n\t\t\t\t\tcontent,\n\t\t\t\t\tclock,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tconst next =\n\t\t\t\t\terror instanceof SmtpError && error.temporary && early.has(error);\n\t\t\t\tif (!next) throw error;\n\t\t\t\tlast = error;\n\t\t\t}\n\t\t}\n\t}\n\tthrow last ?? noAddress(domain, dnsError);\n}\n\n/**\n * Delivers one message to one destination: a host (`{ host, port }`, a\n * smarthost or a submission server) or a domain's mail hosts (`{ domain,\n * resolver }`, by MX). Resolves once the server took the message for one\n * recipient at least; rejects with an `SmtpError` otherwise, `temporary`\n * telling whether to try again later. It is not a queue: retries are the\n * caller's.\n */\nexport async function sendMail(\n\tmessage: MessageSource,\n\toptions: SendMailOptions,\n): Promise<SendMailResult> {\n\tconst settings = settingsOf(options);\n\tconst content = contentOf(message, settings.normalizeLineEnds, settings.size);\n\tconst clock = new Clock(settings.deadline);\n\tif (!byMx(options)) {\n\t\tconst { host } = options;\n\t\tif (typeof host !== 'string' || !/^[^\\s/]+$/.test(host))\n\t\t\tthrow invalid(`host must be a host name or an address, not ${host}`);\n\t\tconst port = portOf(options.port, settings.secure ? 465 : 25);\n\t\treturn attempt({ host, address: host, port }, settings, content, clock);\n\t}\n\treturn viaMx(options, settings, content, clock);\n}\n"
15
+ "import type { SocketHandler } from 'bun';\nimport { SmtpError } from '../errors';\nimport { type Endpoint, reason } from './target';\n\n/** What a socket's events do to its `ClientSocket`. */\nexport interface SocketHooks {\n\treadonly receive: (chunk: Uint8Array) => void;\n\treadonly drain: () => void;\n\treadonly lost: () => void;\n\treadonly handshake: (ok: boolean, error: Error | null) => void;\n}\n\n/** Bun's events for one socket: only the live one's count (`live`), the clear one's or, after STARTTLS, the TLS one's. */\nexport function socketHandlers(\n\tlive: () => boolean,\n\thooks: SocketHooks,\n): SocketHandler<undefined> {\n\tconst when =\n\t\t<A extends unknown[]>(run: (...args: A) => void) =>\n\t\t(...args: A) => {\n\t\t\tif (live()) run(...args);\n\t\t};\n\treturn {\n\t\tdata: when((_, chunk: Uint8Array) => hooks.receive(chunk)),\n\t\tdrain: when(() => hooks.drain()),\n\t\tclose: when(() => hooks.lost()),\n\t\terror: when(() => hooks.lost()),\n\t\thandshake: when((_, ok: boolean, error: Error | null) =>\n\t\t\thooks.handshake(ok, error),\n\t\t),\n\t};\n}\n\n/** `error` as the connect step failed it: an `SmtpError` as it is, else `CONNECTION_FAILED`. */\nexport const connectFailure = (\n\tendpoint: Endpoint,\n\terror: unknown,\n): SmtpError =>\n\terror instanceof SmtpError\n\t\t? error\n\t\t: new SmtpError(\n\t\t\t\t'CONNECTION_FAILED',\n\t\t\t\t`Could not connect to ${endpoint.host} (${endpoint.address}:${endpoint.port}): ${reason(error)}`,\n\t\t\t);\n",
16
+ "import type { Socket, SocketHandler } from 'bun';\nimport type { SmtpError } from '../errors';\nimport { Outgoing } from '../io/outgoing';\nimport type { Reply } from '../protocol/reply';\nimport { Inbox } from './inbox';\nimport { badReply, lost, refused, timedOut, tlsFailed } from './refusal';\nimport { connectFailure, socketHandlers } from './socket-events';\nimport {\n\ttype Clock,\n\ttype Endpoint,\n\treason,\n\ttype TlsTarget,\n\ttlsOptions,\n} from './target';\n\n/**\n * A connection to an SMTP server: replies read as they come into an\n * `Inbox`, which bounds them; every wait bounded by its timeout and the\n * deadline. Whatever the server does ends in a reply or an `SmtpError`,\n * never in an exception of Bun's.\n */\nexport class ClientSocket {\n\t#socket: Socket<undefined> | undefined;\n\t#outgoing = new Outgoing(() => 0);\n\t#tls = false; // whose events count: the TLS socket's after STARTTLS\n\treadonly #inbox = new Inbox();\n\t#failure: SmtpError | undefined;\n\t#closed = false;\n\t#wake: (() => void) | undefined;\n\t#handshaking: ((ok: boolean, error: unknown) => void) | undefined;\n\treadonly #watchers = new Set<() => void>();\n\tsecure = false;\n\t/** Replies read so far: a failure with the same count as before a command got no reply to it. */\n\treplies = 0;\n\t/** The certificate checked out against the host name. */\n\tverified = false;\n\n\tprivate constructor(\n\t\treadonly host: string,\n\t\t/** Times the waits; only the sender or pool sets it (a new `Clock` per transaction), never while a wait is pending. */\n\t\tpublic clock: Clock,\n\t) {}\n\n\t/** Connects, with TLS from the first byte when `tls` is given. */\n\tstatic async open(\n\t\tendpoint: Endpoint,\n\t\ttls: TlsTarget | undefined,\n\t\tseconds: number,\n\t\tclock: Clock,\n\t): Promise<ClientSocket> {\n\t\tconst client = new ClientSocket(endpoint.host, clock);\n\t\tclient.#tls = tls !== undefined;\n\t\tconst handshake = tls ? client.#expectHandshake(tls) : undefined;\n\t\thandshake?.catch(() => {});\n\t\tconst { address, port } = endpoint;\n\t\tconst connecting = Bun.connect({\n\t\t\thostname: address,\n\t\t\tport,\n\t\t\t...(tls ? { tls: tlsOptions(tls) } : {}),\n\t\t\tsocket: client.#handlers(tls !== undefined),\n\t\t});\n\t\ttry {\n\t\t\tclient.#use(await client.#race(connecting, seconds, 'the connection'));\n\t\t} catch (error) {\n\t\t\tconnecting.then(\n\t\t\t\t(socket) => socket.terminate(),\n\t\t\t\t() => {},\n\t\t\t);\n\t\t\tthrow connectFailure(endpoint, error);\n\t\t}\n\t\tif (handshake) {\n\t\t\t// A handshake that failed before the connection resolved left it open.\n\t\t\tawait client.#race(handshake, seconds, 'the TLS handshake').catch((e) => {\n\t\t\t\tclient.close(true);\n\t\t\t\tthrow e;\n\t\t\t});\n\t\t}\n\t\treturn client;\n\t}\n\n\t#use(socket: Socket<undefined>): void {\n\t\tthis.#socket = socket;\n\t\tthis.#outgoing = new Outgoing((bytes) => socket.write(bytes));\n\t}\n\n\t#handlers(tls: boolean): SocketHandler<undefined> {\n\t\treturn socketHandlers(() => this.#tls === tls, {\n\t\t\treceive: (chunk) => this.#receive(chunk),\n\t\t\tdrain: () => this.#outgoing.drain(),\n\t\t\tlost: () => this.#lost(),\n\t\t\thandshake: (ok, error) => this.#handshaking?.(ok, error),\n\t\t});\n\t}\n\n\t#expectHandshake(tls: TlsTarget): Promise<void> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.#handshaking = (ok, error) => {\n\t\t\t\tthis.#handshaking = undefined;\n\t\t\t\tif (this.#closed || (tls.verify && !ok)) {\n\t\t\t\t\tconst why = this.#closed ? 'the connection closed' : reason(error);\n\t\t\t\t\treturn reject(this.#fail(tlsFailed(this.host, why)));\n\t\t\t\t}\n\t\t\t\tthis.secure = true;\n\t\t\t\tthis.verified = ok && error === null;\n\t\t\t\tresolve();\n\t\t\t};\n\t\t});\n\t}\n\n\t#receive(chunk: Uint8Array): void {\n\t\tif (this.#failure || this.#closed) return;\n\t\tconst wrong = this.#inbox.push(chunk);\n\t\tif (wrong) this.#fail(badReply(this.host, wrong));\n\t\telse this.#wakeUp();\n\t}\n\n\t#wakeUp(): void {\n\t\tconst wake = this.#wake;\n\t\tthis.#wake = undefined;\n\t\twake?.();\n\t}\n\n\t#lost(): void {\n\t\tthis.#closed = true;\n\t\tfor (const watcher of this.#watchers) watcher();\n\t\tthis.#outgoing.clear();\n\t\tthis.#handshaking?.(false, null);\n\t\tthis.#wakeUp();\n\t}\n\n\t/** Records the first failure, hangs up, and returns it to throw. */\n\t#fail(error: SmtpError): SmtpError {\n\t\tthis.#failure ??= error;\n\t\tthis.#socket?.terminate();\n\t\tthis.#lost();\n\t\treturn this.#failure;\n\t}\n\n\t/**\n\t * `promise`, or a `TIMEOUT` once `seconds` passed since `start` (now by\n\t * default), or the deadline did, whichever comes first.\n\t */\n\t#race<T>(\n\t\tpromise: Promise<T>,\n\t\tseconds: number,\n\t\twhat: string,\n\t\tstart = performance.now(),\n\t): Promise<T> {\n\t\tconst ms = start + seconds * 1000 - performance.now();\n\t\tconst { host, clock } = this;\n\t\treturn clock.race(promise, ms, (passed) =>\n\t\t\tthis.#fail(\n\t\t\t\ttimedOut(host, what, seconds, passed ? clock.seconds : undefined),\n\t\t\t),\n\t\t);\n\t}\n\n\t/** The next reply, within `seconds` all told; `what` names it in errors: `the greeting`, `the reply to MAIL FROM`. */\n\tasync reply(what: string, seconds: number): Promise<Reply> {\n\t\tconst start = performance.now();\n\t\tfor (;;) {\n\t\t\tconst next = this.#inbox.shift();\n\t\t\tif (next) {\n\t\t\t\tthis.replies++;\n\t\t\t\treturn next;\n\t\t\t}\n\t\t\tif (this.#failure) throw this.#failure;\n\t\t\tif (this.#closed) throw this.#fail(lost(this.host, what));\n\t\t\tawait this.#race(\n\t\t\t\tnew Promise<void>((wake) => {\n\t\t\t\t\tthis.#wake = wake;\n\t\t\t\t}),\n\t\t\t\tseconds,\n\t\t\t\twhat,\n\t\t\t\tstart,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** One of the caller's promises — the message stream's next part — bounded as a reply is, and cut short if the connection goes (a hang-up after it settled is none of its business). */\n\twithin<T>(promise: Promise<T>, seconds: number, what: string): Promise<T> {\n\t\tconst watcher = Promise.withResolvers<void>();\n\t\tif (this.#closed) watcher.resolve();\n\t\telse this.#watchers.add(watcher.resolve);\n\t\tconst gone = watcher.promise;\n\t\tlet over = false;\n\t\tconst hung = gone.then(() => {\n\t\t\tif (!over) throw this.#hungUp(lost(this.host, what));\n\t\t});\n\t\tconst race = Promise.race([promise, hung]) as Promise<T>;\n\t\t// Once the deadline passed, the clock throws before it listens to `race`, and its expiry hangs up (`#fail`), which wakes `gone` and so settles `race` unheard.\n\t\trace.catch(() => undefined);\n\t\thung.catch(() => undefined);\n\t\treturn this.#race(race, seconds, what).finally(() => {\n\t\t\tover = true;\n\t\t\tthis.#watchers.delete(watcher.resolve);\n\t\t});\n\t}\n\n\t/** Queues bytes; false once the connection failed. */\n\twrite(data: Uint8Array | string): boolean {\n\t\tif (this.#failure || this.#closed) return false;\n\t\tthis.#outgoing.write(\n\t\t\ttypeof data === 'string' ? new TextEncoder().encode(data) : data,\n\t\t);\n\t\treturn true;\n\t}\n\n\t/** Waits until the server took everything written. */\n\tasync drained(seconds: number): Promise<void> {\n\t\tawait this.#race(\n\t\t\tthis.#outgoing.drained(),\n\t\t\tseconds,\n\t\t\t'the server to take the message',\n\t\t);\n\t\tif (this.#failure || this.#closed) throw this.#hungUp(lost(this.host));\n\t}\n\n\t/** Why the connection is gone during DATA: its failure, the refusal a server sent before hanging up, or `lost`. */\n\t#hungUp(otherwise: SmtpError): SmtpError {\n\t\tif (this.#failure) return this.#failure;\n\t\tconst said = this.#inbox.shift();\n\t\treturn this.#fail(\n\t\t\tsaid ? refused(this.host, 'the message', said) : otherwise,\n\t\t);\n\t}\n\n\t/** After the 220 to STARTTLS: TLS on this connection. Anything the server sent past the 220 is an attack. */\n\tasync startTls(tls: TlsTarget, seconds: number): Promise<void> {\n\t\tconst socket = this.#socket;\n\t\tif (this.#inbox.holding || !socket) {\n\t\t\tthrow this.#fail(badReply(this.host, 'more after its 220 to STARTTLS'));\n\t\t}\n\t\tconst handshake = this.#expectHandshake(tls);\n\t\thandshake.catch(() => {});\n\t\tthis.#tls = true;\n\t\tconst [, encrypted] = socket.upgradeTLS<undefined>({\n\t\t\ttls: tlsOptions(tls),\n\t\t\tsocket: this.#handlers(true),\n\t\t});\n\t\tthis.#use(encrypted);\n\t\tawait this.#race(handshake, seconds, 'the TLS handshake');\n\t}\n\n\t/** Alive and silent: nothing failed, closed, or arrived unasked. A pool checks it before it lends the connection. */\n\tget quiet(): boolean {\n\t\treturn !this.#failure && !this.#closed && !this.#inbox.holding;\n\t}\n\n\t/** Whether the open connection keeps the process alive: a pool unrefs an idle one. */\n\tref(keep: boolean): void {\n\t\tif (keep) this.#socket?.ref();\n\t\telse this.#socket?.unref();\n\t}\n\n\t/** A new message: the server's reply budget starts over. */\n\tnewMessage(): void {\n\t\tthis.#inbox.reset();\n\t}\n\n\t/** Hangs up; `now` at once, so a cut message is not delivered. */\n\tclose(now = false): void {\n\t\tthis.#closed = true;\n\t\tif (now) this.#socket?.terminate();\n\t\telse this.#socket?.end();\n\t}\n}\n",
17
+ "import type { SendMailResult } from './options';\nimport { open, type Ready } from './session';\nimport type { ClientSettings } from './settings';\nimport { ClientSocket } from './socket';\nimport type { Clock, Endpoint, TlsTarget } from './target';\nimport type { Delivered } from './transaction';\n\n/** Errors from before MAIL FROM: another MX host may do better. */\nexport const early = new WeakSet<object>();\n\n/** A connection, past its greeting, EHLO, STARTTLS and AUTH. */\nexport interface Session {\n\treadonly socket: ClientSocket;\n\treadonly ready: Ready;\n}\n\n/** Connects and opens a session; a failure is marked `early`. The socket's clock is the delivery's. */\nexport async function connect(\n\tendpoint: Endpoint,\n\tsettings: Pick<\n\t\tClientSettings,\n\t\t| 'tls'\n\t\t| 'secure'\n\t\t| 'ca'\n\t\t| 'timeouts'\n\t\t| 'helo'\n\t\t| 'auth'\n\t\t| 'allowPlaintextAuth'\n\t>,\n\tclock: Clock,\n): Promise<Session> {\n\tconst tls: TlsTarget = {\n\t\tservername: endpoint.host,\n\t\tverify: settings.tls === 'required',\n\t\t...(settings.ca ? { ca: settings.ca } : {}),\n\t};\n\tlet socket: ClientSocket;\n\ttry {\n\t\tsocket = await ClientSocket.open(\n\t\t\tendpoint,\n\t\t\tsettings.secure ? tls : undefined,\n\t\t\tsettings.timeouts.connect,\n\t\t\tclock,\n\t\t);\n\t} catch (error) {\n\t\tearly.add(error as object);\n\t\tthrow error;\n\t}\n\ttry {\n\t\tconst ready = await open(socket, settings, tls);\n\t\treturn { socket, ready };\n\t} catch (error) {\n\t\tearly.add(error as object);\n\t\tsocket.write('QUIT\\r\\n');\n\t\tsocket.close();\n\t\tthrow error;\n\t}\n}\n\n/** What a delivery reports: the server's answers, where they came from and how the session was secured. */\nexport function resultOf(\n\tdelivered: Delivered,\n\t{ socket, ready }: Session,\n\tendpoint: Pick<Endpoint, 'host' | 'port'>,\n): SendMailResult {\n\treturn {\n\t\t...delivered,\n\t\thost: endpoint.host,\n\t\tport: endpoint.port,\n\t\ttls: socket.secure ? { verified: socket.verified } : false,\n\t\tauthenticated: ready.authenticated,\n\t};\n}\n",
18
+ "import { hostname as machineName } from 'node:os';\nimport { SmtpError } from '../errors';\nimport { isHelloName, parsePath } from '../protocol/path';\nimport { isMailbox } from './address';\nimport { type DsnSettings, dsnOf } from './dsn';\nimport type {\n\tMxDestination,\n\tSendMailAuth,\n\tSendMailEnvelope,\n\tSendMailOptions,\n\tSendMailTimeouts,\n\tTlsMode,\n} from './options';\n\n/** The longest delay `setTimeout` takes, in seconds: past 2^31 − 1 ms it fires after 1 ms. */\nexport const MAX_SECONDS = Math.floor(2_147_483_647 / 1000);\n\n/** RFC 5321 §4.5.3.2's timeouts; `connect` is this client's own. */\nconst TIMEOUTS: Required<SendMailTimeouts> = {\n\tconnect: 30,\n\tgreeting: 300,\n\tcommand: 300,\n\tmail: 300,\n\trcpt: 300,\n\tdataStart: 120,\n\tdataBlock: 180,\n\tdataEnd: 600,\n};\n\n/** What a connection is: where it greets from, how it secures and authenticates, how long each wait lasts (seconds). Shared by every message sent over it. */\nexport interface ConnectionSettings {\n\treadonly helo: string;\n\treadonly tls: TlsMode;\n\treadonly secure: boolean;\n\treadonly ca?: readonly string[];\n\treadonly auth?: SendMailAuth;\n\treadonly allowPlaintextAuth: boolean;\n\treadonly timeouts: Required<SendMailTimeouts>;\n}\n\n/** What one message is: its envelope, its size, its DSN request, how its lines end. */\nexport interface EnvelopeSettings {\n\treadonly from: string;\n\treadonly to: readonly string[];\n\treadonly size?: number;\n\treadonly dsn: DsnSettings;\n\t/** An address is not ASCII, or `smtputf8` asked for it. */\n\treadonly smtputf8: boolean;\n\treadonly normalizeLineEnds: boolean;\n}\n\n/** The options, checked, with their defaults: the connection's, the envelope's, and the transaction's `deadline` in seconds. */\nexport interface ClientSettings extends ConnectionSettings, EnvelopeSettings {\n\treadonly deadline: number;\n}\n\n/** `INVALID_OPTION`, for an option `sendMail` cannot take. */\nexport const invalid = (message: string) =>\n\tnew SmtpError('INVALID_OPTION', `sendMail(): ${message}`);\n\nfunction seconds(name: string, value: unknown, fallback: number): number {\n\tif (value === undefined) return fallback;\n\tif (\n\t\ttypeof value !== 'number' ||\n\t\t!Number.isFinite(value) ||\n\t\tvalue <= 0 ||\n\t\tvalue > MAX_SECONDS\n\t) {\n\t\tthrow invalid(\n\t\t\t`${name} must be a number of seconds above 0 and at most ${MAX_SECONDS}, not ${String(value)}`,\n\t\t);\n\t}\n\treturn value;\n}\n\nfunction timeoutsOf(given: SendMailTimeouts = {}): Required<SendMailTimeouts> {\n\tconst out: Record<string, number> = {};\n\tfor (const [name, fallback] of Object.entries(TIMEOUTS)) {\n\t\tout[name] = seconds(\n\t\t\t`timeouts.${name}`,\n\t\t\tgiven[name as keyof SendMailTimeouts],\n\t\t\tfallback,\n\t\t);\n\t}\n\treturn out as Required<SendMailTimeouts>;\n}\n\n/**\n * `from` or a recipient, checked as an RFC 5321 path, since it is written\n * into `MAIL FROM:<…>` or `RCPT TO:<…>` as it is. A source route is refused\n * (§4.1.1.3: clients should not send one), with a message of its own when\n * the route is otherwise valid. What it takes, past the null sender, is\n * exactly what `isMailbox` says yes to: the two share one predicate.\n */\nfunction address(value: unknown, allowNull: boolean): string {\n\tif (allowNull && value === '') return '';\n\tif (isMailbox(value)) return value;\n\tconst text = typeof value === 'string' ? value : '';\n\tconst routed = typeof value === 'string' && parsePath(`<${text}>`, false);\n\tif (routed) {\n\t\tthrow invalid(\n\t\t\t`${JSON.stringify(value)} holds a source route (@host:), which RFC 5321 says a client should not send: pass ${JSON.stringify(`${routed.local}@${text.slice(text.lastIndexOf('@') + 1)}`)} alone`,\n\t\t);\n\t}\n\tthrow invalid(\n\t\t`${JSON.stringify(value)} is not an address (local@domain${allowNull ? \", or '' for a bounce\" : ''})`,\n\t);\n}\n\n/**\n * `helo`, checked. By MX it is required: the machine's name (such as\n * `laptop.local`) is rarely a name that resolves back to the sender, which\n * receiving hosts penalise, and it would tell them the machine's name.\n */\nfunction heloOf(value: string | undefined, byMx: boolean): string {\n\tif (value !== undefined) {\n\t\tif (!isHelloName(value))\n\t\t\tthrow invalid(`helo \"${value}\" is not a host name`);\n\t\treturn value;\n\t}\n\tif (byMx)\n\t\tthrow invalid(\n\t\t\t\"helo is required for delivery by MX: pass your server's public name, such as helo: 'mail.example.com'\",\n\t\t);\n\tconst name = machineName();\n\treturn isHelloName(name) ? name : 'localhost';\n}\n\nfunction authOf(auth: SendMailAuth | undefined): SendMailAuth | undefined {\n\tif (auth === undefined) return undefined;\n\tconst { username, password, mechanism } = auth;\n\tif (typeof username !== 'string' || username === '')\n\t\tthrow invalid('auth.username must be a non-empty string');\n\tif (typeof password !== 'string' || password === '')\n\t\tthrow invalid('auth.password must be a non-empty string');\n\tif (mechanism !== undefined && mechanism !== 'PLAIN' && mechanism !== 'LOGIN')\n\t\tthrow invalid(\n\t\t\t`auth.mechanism must be 'PLAIN' or 'LOGIN', not ${mechanism}`,\n\t\t);\n\treturn auth;\n}\n\nfunction tlsOf(options: SendMailOptions, plaintextAuth: boolean): TlsMode {\n\tconst secure = options.secure === true;\n\tconst tls =\n\t\toptions.tls ??\n\t\t(secure || (options.auth && !plaintextAuth) ? 'required' : 'opportunistic');\n\tif (tls !== 'opportunistic' && tls !== 'required' && tls !== 'none')\n\t\tthrow invalid(\n\t\t\t`tls must be 'opportunistic', 'required' or 'none', not ${tls}`,\n\t\t);\n\tif (tls === 'none' && secure)\n\t\tthrow invalid(\n\t\t\t\"secure is TLS from the first byte: it cannot go with tls: 'none'\",\n\t\t);\n\tif (tls === 'none' && options.auth && !plaintextAuth)\n\t\tthrow invalid(\n\t\t\t\"auth with tls: 'none' would send the password in clear; pass allowPlaintextAuth: true for a local test server\",\n\t\t);\n\tif (tls === 'opportunistic' && options.auth && !plaintextAuth)\n\t\tthrow invalid(\n\t\t\t\"auth with tls: 'opportunistic' would send the password to a server whose certificate is not checked; leave tls out to check it, or pass allowPlaintextAuth: true for a local test server\",\n\t\t);\n\treturn tls;\n}\n\n/** Checks every option; throws an `SmtpError` (`INVALID_OPTION`) on the first wrong one. */\nexport function settingsOf(options: SendMailOptions): ClientSettings {\n\tif (typeof options !== 'object' || options === null)\n\t\tthrow invalid('options must be an object');\n\tconst from = address(options.from, true);\n\tconst list = typeof options.to === 'string' ? [options.to] : options.to;\n\tif (!Array.isArray(list) || list.length === 0)\n\t\tthrow invalid('to must name one recipient or more');\n\tconst to = list.map((recipient) => address(recipient, false));\n\tconst allowPlaintextAuth = options.allowPlaintextAuth === true;\n\tconst { size } = options;\n\tif (size !== undefined && (!Number.isSafeInteger(size) || size < 0))\n\t\tthrow invalid(`size must be a number of bytes, not ${size}`);\n\tconst ca = options.ca === undefined ? undefined : [options.ca].flat();\n\tconst auth = authOf(options.auth);\n\treturn {\n\t\tfrom,\n\t\tto,\n\t\thelo: heloOf(options.helo, byMx(options)),\n\t\ttls: tlsOf(options, allowPlaintextAuth),\n\t\tsecure: options.secure === true,\n\t\t...(ca ? { ca } : {}),\n\t\t...(auth ? { auth } : {}),\n\t\tallowPlaintextAuth,\n\t\t...(size === undefined ? {} : { size }),\n\t\tdsn: dsnOf(options, to, invalid),\n\t\tsmtputf8:\n\t\t\toptions.smtputf8 === true ||\n\t\t\t[from, ...to].some((text) => /[^ -~]/.test(text)),\n\t\tnormalizeLineEnds: options.normalizeLineEnds === true,\n\t\ttimeouts: timeoutsOf(options.timeouts),\n\t\tdeadline: seconds('deadline', options.deadline, 1800),\n\t};\n}\n\n/** Whether the options name a domain to deliver to by MX, not a host. */\nexport const byMx = (\n\toptions: SendMailOptions,\n): options is SendMailEnvelope & MxDestination =>\n\t!('host' in options && options.host !== undefined);\n\n/** A port: an integer from 1 to 65535. */\nexport function portOf(port: number | undefined, fallback: number): number {\n\tif (port === undefined) return fallback;\n\tif (!Number.isInteger(port) || port < 1 || port > 65535)\n\t\tthrow invalid(`port must be an integer from 1 to 65535, not ${port}`);\n\treturn port;\n}\n",
19
+ "// The value rules (and utf8OrcptLength, RFC 6533) repeat packages/smtp/src/server/dsn-params.ts, packages/jmap/src/submission/dsn.ts and\n// packages/queue/src/contract/dsn-checks.ts (AGENTS.md, Deliberate duplications); this copy checks the client's own options.\nimport { encodeUtf8Orcpt, utf8OrcptLength } from '../protocol/orcpt';\nimport { encodeXtext } from '../protocol/xtext';\nimport type { DsnNotify, EnvelopeRecipient } from '../server/options';\n\n/** The DSN parameters of the message and of its recipients (RFC 3461 §4), checked. */\nexport interface DsnSettings {\n\treadonly ret?: 'FULL' | 'HDRS';\n\treadonly envid?: string;\n\t/** The recipients that carry `NOTIFY` or `ORCPT`, by address. */\n\treadonly recipients: ReadonlyMap<string, EnvelopeRecipient>;\n}\n\nconst EVENTS: readonly string[] = ['SUCCESS', 'FAILURE', 'DELAY'];\n\n/** Checks `ret`, `envid` and `recipients`; `fail` throws the `INVALID_OPTION` for a message. */\nexport function dsnOf(\n\tgiven: {\n\t\tret?: unknown;\n\t\tenvid?: unknown;\n\t\trecipients?: unknown;\n\t},\n\tto: readonly string[],\n\tfail: (message: string) => Error,\n): DsnSettings {\n\tconst { ret, envid, recipients } = given;\n\tif (ret !== undefined && ret !== 'FULL' && ret !== 'HDRS')\n\t\tthrow fail(`ret must be 'FULL' or 'HDRS', not ${String(ret)}`);\n\tif (\n\t\tenvid !== undefined &&\n\t\t(typeof envid !== 'string' ||\n\t\t\t!/^[ -~]{1,100}$/.test(envid) ||\n\t\t\t// RFC 3461 §4.4: \"The ENVID parameter MAY be up to 100 characters in length\", as sent.\n\t\t\tencodeXtext(envid).length > 100)\n\t)\n\t\tthrow fail(\n\t\t\t'envid must be 1 to 100 printable ASCII characters, at most 100 once encoded as xtext',\n\t\t);\n\tconst byAddress = new Map<string, EnvelopeRecipient>();\n\tif (recipients !== undefined) {\n\t\tif (!Array.isArray(recipients))\n\t\t\tthrow fail('recipients must be an array of { address, notify, orcpt }');\n\t\tfor (const entry of recipients as EnvelopeRecipient[]) {\n\t\t\tconst address = entry?.address;\n\t\t\tif (typeof address !== 'string' || !to.includes(address))\n\t\t\t\tthrow fail(\n\t\t\t\t\t`recipients names ${JSON.stringify(address)}, which is not in to`,\n\t\t\t\t);\n\t\t\tif (byAddress.has(address))\n\t\t\t\tthrow fail(`recipients names ${address} twice`);\n\t\t\tcheckRecipient(entry, fail);\n\t\t\tbyAddress.set(address, entry);\n\t\t}\n\t}\n\treturn {\n\t\t...(ret ? { ret } : {}),\n\t\t...(envid === undefined ? {} : { envid }),\n\t\trecipients: byAddress,\n\t};\n}\n\nfunction checkRecipient(\n\t{ address, notify, orcpt }: EnvelopeRecipient,\n\tfail: (message: string) => Error,\n): void {\n\tif (notify !== undefined && notify !== 'NEVER') {\n\t\tconst events: readonly unknown[] = Array.isArray(notify) ? notify : [];\n\t\tif (\n\t\t\tevents.length === 0 ||\n\t\t\tevents.some(\n\t\t\t\t(e, i) => !EVENTS.includes(e as string) || events.indexOf(e) !== i,\n\t\t\t)\n\t\t)\n\t\t\tthrow fail(\n\t\t\t\t`notify of ${address} must be 'NEVER' or a list of 'SUCCESS', 'FAILURE', 'DELAY', each once`,\n\t\t\t);\n\t}\n\tif (orcpt !== undefined) {\n\t\tif (\n\t\t\ttypeof orcpt !== 'object' ||\n\t\t\torcpt === null ||\n\t\t\ttypeof orcpt.type !== 'string' ||\n\t\t\t!/^[A-Za-z0-9-]+$/.test(orcpt.type)\n\t\t)\n\t\t\tthrow fail(\n\t\t\t\t`orcpt of ${address} must be { type, address }, the type a token`,\n\t\t\t);\n\t\tif (typeof orcpt.address !== 'string' || orcpt.address === '')\n\t\t\tthrow fail(`orcpt.address of ${address} must be a non-empty string`);\n\t\t// RFC 3461 §4.2: \"The entire ORCPT parameter MAY be up to 500 characters in length\", as sent.\n\t\t// For utf-8 (RFC 6533), the length of the unitext form, as the server counts it.\n\t\tconst encoded =\n\t\t\torcpt.type.toLowerCase() === 'utf-8'\n\t\t\t\t? utf8OrcptLength(orcpt.address)\n\t\t\t\t: encodeXtext(orcpt.address).length;\n\t\tif (orcpt.type.length + 1 + encoded > 500)\n\t\t\tthrow fail(`orcpt of ${address} is over 500 characters once encoded`);\n\t}\n}\n\n/** Whether the options carry any DSN parameter. */\nexport const asksDsn = (dsn: DsnSettings): boolean =>\n\tdsn.ret !== undefined || dsn.envid !== undefined || dsn.recipients.size > 0;\n\n/** ` RET=… ENVID=…` for MAIL FROM, when the server lists DSN (RFC 3461 §4.3, §4.4). */\nexport function mailDsn(dsn: DsnSettings, offered: boolean): string {\n\tif (!offered) return '';\n\tlet out = '';\n\tif (dsn.ret) out += ` RET=${dsn.ret}`;\n\tif (dsn.envid !== undefined) out += ` ENVID=${encodeXtext(dsn.envid)}`;\n\treturn out;\n}\n\n/**\n * ` ORCPT=…` or nothing: `rfc822` and an ASCII address as xtext; any other\n * type as xtext of the address octets, type case kept (RFC 3461 §5.2(d)); `utf-8` per\n * RFC 6533 §3, `utf-8-addr-unitext` when the transaction uses SMTPUTF8 (the\n * server of this transaction lists it), else `utf-8-addr-xtext`. Left out\n * rather than refused: a non-ASCII `rfc822` address, a lone\n * surrogate (any type), or a `utf-8` value over 500 characters (its escapes can be longer\n * than the xtext the options were checked against; RFC 3461 §4.2).\n */\nfunction orcptParameter(\n\t{ type, address }: NonNullable<EnvelopeRecipient['orcpt']>,\n\tsmtputf8: boolean,\n): string {\n\tconst kind = type.toLowerCase();\n\tif (kind === 'rfc822')\n\t\treturn /^[\\x20-\\x7e]+$/.test(address)\n\t\t\t? ` ORCPT=${type};${encodeXtext(address)}`\n\t\t\t: '';\n\tif (kind !== 'utf-8') {\n\t\t// RFC 3461 §5.2(d): relayed identical, type case kept; any octets fit xtext, a lone surrogate does not round-trip.\n\t\tconst value = `${type};${encodeXtext(address)}`;\n\t\treturn address.isWellFormed() ? ` ORCPT=${value}` : '';\n\t}\n\tconst encoded = encodeUtf8Orcpt(address, smtputf8);\n\tif (encoded === undefined) return '';\n\tconst value = `${type};${encoded}`;\n\treturn new TextEncoder().encode(value).length > 500 ? '' : ` ORCPT=${value}`;\n}\n\n/** ` NOTIFY=… ORCPT=…` for one RCPT TO, when the server lists DSN (RFC 3461 §4.1, §4.2). */\nexport function rcptDsn(\n\tdsn: DsnSettings,\n\taddress: string,\n\toffered: boolean,\n\tsmtputf8 = false,\n): string {\n\tconst entry = dsn.recipients.get(address);\n\tif (!offered || !entry) return '';\n\tlet out = '';\n\tconst { notify, orcpt } = entry;\n\tif (notify !== undefined)\n\t\tout += ` NOTIFY=${notify === 'NEVER' ? 'NEVER' : (notify as readonly DsnNotify[]).join(',')}`;\n\tif (orcpt) out += orcptParameter(orcpt, smtputf8);\n\treturn out;\n}\n",
20
+ "import { type RecipientReply, SmtpError } from '../errors';\nimport { DataWriter } from '../protocol/data-writer';\nimport type { Reply } from '../protocol/reply';\nimport { bareLineBreak, type Content } from './content';\nimport { mailDsn, rcptDsn } from './dsn';\nimport { afterDot, refused, shown } from './refusal';\nimport type { Ready } from './session';\nimport type { ConnectionSettings, EnvelopeSettings } from './settings';\nimport type { ClientSocket } from './socket';\n\n/** What the server said to the envelope and the message. */\nexport interface Delivered {\n\treadonly accepted: readonly RecipientReply[];\n\treadonly rejected: readonly RecipientReply[];\n\treadonly reply: Reply;\n\t/** The server lists DSN. */\n\treadonly dsnOffered: boolean;\n}\n\n/** What `transact` returns: the server's answers. */\nexport interface Transacted {\n\treadonly delivered: Delivered;\n}\n\n/** Errors after which replies are still in order and the connection alive; a transaction may be open, so `RSET` before reuse. */\nconst stepped = new WeakSet<object>();\n\n/** Refusals whose stream was found out of order or dead while reading what followed. */\nconst broken = new WeakSet<object>();\n\n/** Whether `error` came from `transact` with replies in order and the connection alive (a clean 4xx/5xx refusal, not a 421, a timeout, a bad reply or a lost connection); `RSET` before reuse. */\nexport const inStep = (error: unknown): boolean =>\n\ttypeof error === 'object' && error !== null && stepped.has(error);\n\n/** The envelope's outcome, as an error after the final dot carries it. */\ntype Taken = Pick<Delivered, 'accepted' | 'rejected'>;\n\nconst missing = (host: string, extension: string, why: string) =>\n\tnew SmtpError(\n\t\t'EXTENSION_MISSING',\n\t\t`${host} does not offer ${extension}, which ${why}`,\n\t);\n\n/** MAIL FROM's parameters: SIZE (RFC 1870), BODY (RFC 6152), SMTPUTF8 (RFC 6531). */\nfunction mailParameters(\n\thost: string,\n\tsettings: EnvelopeSettings,\n\tcontent: Content,\n\textensions: ReadonlyMap<string, string>,\n): string {\n\tlet parameters = '';\n\tconst size = extensions.get('SIZE');\n\tif (size !== undefined && content.size !== undefined) {\n\t\tconst max = Number(size);\n\t\tif (Number.isSafeInteger(max) && max > 0 && content.size > max) {\n\t\t\tthrow new SmtpError(\n\t\t\t\t'MESSAGE_TOO_BIG',\n\t\t\t\t`The message (${content.size} bytes) is larger than the ${max} bytes ${host} takes (SIZE)`,\n\t\t\t\t{ temporary: false },\n\t\t\t);\n\t\t}\n\t\tparameters += ` SIZE=${content.size}`;\n\t}\n\tif (extensions.has('8BITMIME')) parameters += ' BODY=8BITMIME';\n\telse if (content.eightBit) {\n\t\tthrow missing(host, '8BITMIME', 'the message needs: it has 8-bit bytes');\n\t}\n\tif (settings.smtputf8) {\n\t\tif (!extensions.has('SMTPUTF8')) {\n\t\t\tthrow missing(\n\t\t\t\thost,\n\t\t\t\t'SMTPUTF8',\n\t\t\t\t'an address that is not ASCII needs (or smtputf8 asked for)',\n\t\t\t);\n\t\t}\n\t\tparameters += ' SMTPUTF8';\n\t}\n\treturn parameters;\n}\n\n/** MAIL FROM and every RCPT TO: in one write with PIPELINING (RFC 2920), else one by one. */\nasync function envelope(\n\tsocket: ClientSocket,\n\tsettings: ConnectionSettings & EnvelopeSettings,\n\tcontent: Content,\n\tready: Ready,\n): Promise<{ accepted: RecipientReply[]; rejected: RecipientReply[] }> {\n\tconst { host } = socket;\n\tconst { timeouts } = settings;\n\tconst dsn = ready.extensions.has('DSN');\n\tlet parameters: string;\n\ttry {\n\t\tparameters = mailParameters(host, settings, content, ready.extensions);\n\t} catch (error) {\n\t\tstepped.add(error as object); // nothing sent yet\n\t\tthrow error;\n\t}\n\tconst mail = `MAIL FROM:<${settings.from}>${parameters}${mailDsn(settings.dsn, dsn)}\\r\\n`;\n\tconst rcpts = settings.to.map(\n\t\t(to) =>\n\t\t\t`RCPT TO:<${to}>${rcptDsn(settings.dsn, to, dsn, settings.smtputf8)}\\r\\n`,\n\t);\n\tconst pipelining = ready.extensions.has('PIPELINING');\n\tsocket.write(pipelining ? mail + rcpts.join('') : mail);\n\tconst from = await socket.reply('the reply to MAIL FROM', timeouts.mail);\n\tif (from.code !== 250) {\n\t\t// Pipelined, the RCPT replies are on their way: read them so the next command reads its own.\n\t\tconst refusal = refused(host, 'the sender', from);\n\t\tif (pipelining) {\n\t\t\tfor (const _ of rcpts) {\n\t\t\t\ttry {\n\t\t\t\t\tawait socket.reply('the reply to RCPT TO', timeouts.rcpt);\n\t\t\t\t} catch {\n\t\t\t\t\t// Out of order or dead: the MAIL refusal is still the reason, but not in step.\n\t\t\t\t\tbroken.add(refusal);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthrow refusal;\n\t}\n\tconst accepted: RecipientReply[] = [];\n\tconst rejected: RecipientReply[] = [];\n\tfor (const [i, recipient] of settings.to.entries()) {\n\t\tif (!pipelining) socket.write(rcpts[i] as string);\n\t\tconst reply = await socket.reply('the reply to RCPT TO', timeouts.rcpt);\n\t\tconst into = reply.code === 250 || reply.code === 251 ? accepted : rejected;\n\t\tinto.push({ recipient, reply });\n\t}\n\tif (accepted.length === 0) {\n\t\tconst first = rejected[0] as RecipientReply;\n\t\tthrow new SmtpError(\n\t\t\t'RECIPIENTS_REFUSED',\n\t\t\t`${host} refused every recipient, ${first.recipient} with ${shown(first.reply)}`,\n\t\t\t{\n\t\t\t\treply: first.reply,\n\t\t\t\trejected,\n\t\t\t\ttemporary: rejected.some(({ reply }) => reply.code < 500),\n\t\t\t},\n\t\t);\n\t}\n\treturn { accepted, rejected };\n}\n\n/** The message, stuffed, block by block as the server takes it; a bad stream hangs up before the dot. */\nasync function data(\n\tsocket: ClientSocket,\n\tsettings: ConnectionSettings & EnvelopeSettings,\n\tcontent: Content,\n\tready: Ready,\n\ttaken: Taken,\n): Promise<Reply> {\n\tconst { host } = socket;\n\tconst { timeouts } = settings;\n\tsocket.write('DATA\\r\\n');\n\tconst start = await socket.reply('the reply to DATA', timeouts.dataStart);\n\tif (start.code !== 354) throw refused(host, 'DATA', start);\n\tconst writer = new DataWriter(settings.normalizeLineEnds);\n\tconst eightBitOk = ready.extensions.has('8BITMIME');\n\tconst chunks = content.chunks();\n\tlet tail: Uint8Array;\n\ttry {\n\t\tfor (;;) {\n\t\t\t// The caller's stream is bounded as the server is: a stalled one times out.\n\t\t\tconst chunk = await socket.within(\n\t\t\t\tchunks.next(),\n\t\t\t\ttimeouts.dataBlock,\n\t\t\t\t'the next part of the message',\n\t\t\t);\n\t\t\tif (!chunk) break;\n\t\t\tconst bytes = writer.write(chunk);\n\t\t\tif (writer.bareLineBreaks > 0) throw bareLineBreak();\n\t\t\tif (writer.eightBit && !eightBitOk) {\n\t\t\t\tthrow missing(\n\t\t\t\t\thost,\n\t\t\t\t\t'8BITMIME',\n\t\t\t\t\t'the message needs: it has 8-bit bytes',\n\t\t\t\t);\n\t\t\t}\n\t\t\tsocket.write(bytes);\n\t\t\tawait socket.drained(timeouts.dataBlock);\n\t\t}\n\t\t// A CR held at the very end is bare only now: still no dot for it.\n\t\ttail = writer.end();\n\t\tif (writer.bareLineBreaks > 0) throw bareLineBreak();\n\t} catch (error) {\n\t\t// No final dot: the server drops what it has of the message.\n\t\tchunks.cancel();\n\t\tsocket.close(true);\n\t\tthrow error;\n\t}\n\t// A connection that failed already took no dot: its error is not afterData.\n\tconst dotSent = socket.write(tail);\n\tconst end = await socket\n\t\t.reply('the reply to the final dot', timeouts.dataEnd)\n\t\t.catch((error: unknown) => {\n\t\t\t// No reply to the dot: the server may have taken the message.\n\t\t\tthrow dotSent ? afterDot(error, taken) : error;\n\t\t});\n\tif (end.code !== 250) throw refused(host, 'the message', end);\n\treturn end;\n}\n\n/** One message: the envelope, then the content. A refusal throws, `inStep(error)` telling whether the session can go on. */\nexport async function transact(\n\tsocket: ClientSocket,\n\tsettings: ConnectionSettings & EnvelopeSettings,\n\tcontent: Content,\n\tready: Ready,\n): Promise<Transacted> {\n\ttry {\n\t\tconst { accepted, rejected } = await envelope(\n\t\t\tsocket,\n\t\t\tsettings,\n\t\t\tcontent,\n\t\t\tready,\n\t\t);\n\t\tconst reply = await data(socket, settings, content, ready, {\n\t\t\taccepted,\n\t\t\trejected,\n\t\t});\n\t\tconst delivered = {\n\t\t\taccepted,\n\t\t\trejected,\n\t\t\treply,\n\t\t\tdsnOffered: ready.extensions.has('DSN'),\n\t\t};\n\t\treturn { delivered };\n\t} catch (error) {\n\t\t// A reply is the server's word, given in step; a 421 is it closing.\n\t\tconst code = error instanceof SmtpError ? error.reply?.code : undefined;\n\t\tif (\n\t\t\tcode !== undefined &&\n\t\t\tcode >= 400 &&\n\t\t\tcode < 600 &&\n\t\t\tcode !== 421 &&\n\t\t\t!broken.has(error as object)\n\t\t)\n\t\t\tstepped.add(error as object);\n\t\tthrow error;\n\t}\n}\n",
21
+ "import { SmtpError } from '../errors';\nimport { connect, early, resultOf } from './connect';\nimport { type Content, contentOf } from './content';\nimport { addressesOf, noAddress, resolveMx } from './mx';\nimport type {\n\tMessageSource,\n\tMxDestination,\n\tSendMailOptions,\n\tSendMailResult,\n} from './options';\nimport { timedOut } from './refusal';\nimport {\n\tbyMx,\n\ttype ClientSettings,\n\tinvalid,\n\tportOf,\n\tsettingsOf,\n} from './settings';\nimport { Clock, type Endpoint } from './target';\nimport { transact } from './transaction';\n\n/** The most addresses one delivery tries, every MX host together; and the most MX hosts it looks up. */\nexport const MAX_ADDRESSES = 10;\n\n/** Seconds to wait for the 221 to QUIT once the message was taken. */\nconst QUIT_WAIT = 5;\n\n/** One delivery to one server address: a fresh session here, a pooled one in `pool.ts`. */\nexport type Attempt = (\n\tendpoint: Endpoint,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tclock: Clock,\n) => Promise<SendMailResult>;\n\n/** One session with one server, from the connection to QUIT. */\nconst attempt: Attempt = async (endpoint, settings, content, clock) => {\n\tconst { socket, ready } = await connect(endpoint, settings, clock);\n\tlet quit = false;\n\ttry {\n\t\tconst { delivered } = await transact(socket, settings, content, ready);\n\t\tsocket.write('QUIT\\r\\n');\n\t\tquit = true;\n\t\tawait socket\n\t\t\t.reply(\n\t\t\t\t'the reply to QUIT',\n\t\t\t\tMath.min(QUIT_WAIT, settings.timeouts.command),\n\t\t\t)\n\t\t\t.catch(() => {});\n\t\treturn resultOf(delivered, { socket, ready }, endpoint);\n\t} finally {\n\t\t// After a refusal the session is still in step: say goodbye.\n\t\tif (!quit) socket.write('QUIT\\r\\n');\n\t\tsocket.close();\n\t}\n};\n\n/** A DNS lookup, bounded by the delivery's deadline (the resolver has its own timeout too). */\nconst withinDeadline = <T>(\n\tlookup: Promise<T>,\n\tclock: Clock,\n\tname: string,\n\twhat: string,\n): Promise<T> =>\n\tclock.race(lookup, Number.POSITIVE_INFINITY, () =>\n\t\ttimedOut(name, what, clock.seconds, clock.seconds),\n\t);\n\n/** Direct delivery, by `try_`: each MX host's addresses in turn, while the failures are temporary and before MAIL FROM. */\nexport async function viaMx(\n\ttry_: Attempt,\n\toptions: MxDestination,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tclock: Clock,\n): Promise<SendMailResult> {\n\tconst { domain, resolver } = options;\n\tif (typeof domain !== 'string' || domain === '')\n\t\tthrow invalid('domain must be a domain name');\n\tif (typeof resolver?.mx !== 'function')\n\t\tthrow invalid('resolver must be a Resolver, such as @bumail/dns gives');\n\tconst port = portOf(options.port, 25);\n\tlet last: unknown;\n\tlet dnsError: unknown;\n\tlet tried = 0;\n\tlet looked = 0;\n\tconst mailHosts = await withinDeadline(\n\t\tresolveMx(domain, resolver),\n\t\tclock,\n\t\tdomain,\n\t\t'the MX lookup',\n\t);\n\thosts: for (const mx of mailHosts) {\n\t\t// A host looked up counts, with an address or not: no endless lookups.\n\t\tif (tried >= MAX_ADDRESSES || looked++ >= MAX_ADDRESSES) break;\n\t\tconst addresses = await withinDeadline(\n\t\t\taddressesOf(mx.host, resolver),\n\t\t\tclock,\n\t\t\tmx.host,\n\t\t\t'the address lookup',\n\t\t);\n\t\tif (!Array.isArray(addresses)) {\n\t\t\tdnsError = addresses.error;\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const address of addresses) {\n\t\t\tif (tried++ >= MAX_ADDRESSES) break hosts;\n\t\t\ttry {\n\t\t\t\treturn await try_(\n\t\t\t\t\t{ host: mx.host, address, port },\n\t\t\t\t\tsettings,\n\t\t\t\t\tcontent,\n\t\t\t\t\tclock,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tconst next =\n\t\t\t\t\terror instanceof SmtpError && error.temporary && early.has(error);\n\t\t\t\tif (!next) throw error;\n\t\t\t\tlast = error;\n\t\t\t}\n\t\t}\n\t}\n\tthrow last ?? noAddress(domain, dnsError);\n}\n\n/** Where the options send the message: a host, or a domain's mail hosts by MX; each address is tried by `try_`. */\nexport function deliver(\n\ttry_: Attempt,\n\toptions: SendMailOptions,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tclock: Clock,\n): Promise<SendMailResult> {\n\tif (!byMx(options)) {\n\t\tconst { host } = options;\n\t\tif (typeof host !== 'string' || !/^[^\\s/]+$/.test(host))\n\t\t\tthrow invalid(`host must be a host name or an address, not ${host}`);\n\t\tconst port = portOf(options.port, settings.secure ? 465 : 25);\n\t\treturn try_({ host, address: host, port }, settings, content, clock);\n\t}\n\treturn viaMx(try_, options, settings, content, clock);\n}\n\n/**\n * Delivers one message to one destination: a host (`{ host, port }`, a\n * smarthost or a submission server) or a domain's mail hosts (`{ domain,\n * resolver }`, by MX). Resolves once the server took the message for one\n * recipient at least; rejects with an `SmtpError` otherwise, `temporary`\n * telling whether to try again later. It is not a queue: retries are the\n * caller's.\n */\nexport async function sendMail(\n\tmessage: MessageSource,\n\toptions: SendMailOptions,\n): Promise<SendMailResult> {\n\tconst settings = settingsOf(options);\n\tconst content = contentOf(message, settings.normalizeLineEnds, settings.size);\n\treturn deliver(\n\t\tattempt,\n\t\toptions,\n\t\tsettings,\n\t\tcontent,\n\t\tnew Clock(settings.deadline),\n\t);\n}\n",
22
+ "import { SmtpError } from '../../errors';\nimport type { SendMailAuth } from '../options';\nimport { type ConnectionSettings, MAX_SECONDS } from '../settings';\nimport type { Endpoint } from '../target';\n\n/** How a pool keeps its connections. */\nexport interface SmtpPoolOptions {\n\t/** Messages one connection carries before it is closed. Default 100. */\n\treadonly maxMessages?: number;\n\t/** Seconds an idle connection waits for another message. Default 5. */\n\treadonly idleSeconds?: number;\n\t/** Seconds a connection lives, from its opening. Default 300. */\n\treadonly maxAgeSeconds?: number;\n\t/** Idle connections kept per mail host. Default 4. */\n\treadonly maxIdlePerHost?: number;\n}\n\n/** `SmtpPoolOptions` checked, with their defaults. */\nexport type PoolLimits = Required<SmtpPoolOptions>;\n\n// @bumail/queue strips this `createSmtpPool(): ` prefix to report `reuse.<message>` (queue/settings/sender.ts): keep them in step.\nconst invalid = (message: string) =>\n\tnew SmtpError('INVALID_OPTION', `createSmtpPool(): ${message}`);\n\nfunction count(name: string, value: number | undefined, fallback: number) {\n\tif (value === undefined) return fallback;\n\tif (!Number.isSafeInteger(value) || value < 1)\n\t\tthrow invalid(\n\t\t\t`${name} must be an integer of at least 1, not ${String(value)}`,\n\t\t);\n\treturn value;\n}\n\nfunction seconds(name: string, value: number | undefined, fallback: number) {\n\tif (value === undefined) return fallback;\n\tif (!Number.isFinite(value) || value <= 0 || value > MAX_SECONDS)\n\t\tthrow invalid(\n\t\t\t`${name} must be a number of seconds above 0 and at most ${MAX_SECONDS}, not ${String(value)}`,\n\t\t);\n\treturn value;\n}\n\n/** Checks the options; throws `INVALID_OPTION`. */\nexport function limitsOf(options: SmtpPoolOptions = {}): PoolLimits {\n\tif (typeof options !== 'object' || options === null)\n\t\tthrow invalid('options must be an object');\n\treturn {\n\t\tmaxMessages: count('maxMessages', options.maxMessages, 100),\n\t\tidleSeconds: seconds('idleSeconds', options.idleSeconds, 5),\n\t\tmaxAgeSeconds: seconds('maxAgeSeconds', options.maxAgeSeconds, 300),\n\t\tmaxIdlePerHost: count('maxIdlePerHost', options.maxIdlePerHost, 4),\n\t};\n}\n\n/** What a connection is: where it goes and how it greets, secures and authenticates. Timeouts and the envelope are the message's. */\nexport interface Identity extends Endpoint {\n\treadonly connection: Omit<ConnectionSettings, 'timeouts'>;\n}\n\nconst sameList = (\n\ta: readonly string[] | undefined,\n\tb: readonly string[] | undefined,\n) =>\n\ta === b ||\n\t(a !== undefined &&\n\t\tb !== undefined &&\n\t\ta.length === b.length &&\n\t\ta.every((item, i) => item === b[i]));\n\nconst sameAuth = (a?: SendMailAuth, b?: SendMailAuth) =>\n\ta === b ||\n\t(a !== undefined &&\n\t\tb !== undefined &&\n\t\ta.username === b.username &&\n\t\ta.password === b.password &&\n\t\ta.mechanism === b.mechanism);\n\n/** Whether two connections are the same, field by field: credentials included, and never joined into a string key. */\nexport function sameIdentity(a: Identity, b: Identity): boolean {\n\tconst x = a.connection;\n\tconst y = b.connection;\n\treturn (\n\t\ta.host === b.host &&\n\t\ta.address === b.address &&\n\t\ta.port === b.port &&\n\t\tx.helo === y.helo &&\n\t\tx.tls === y.tls &&\n\t\tx.secure === y.secure &&\n\t\tx.allowPlaintextAuth === y.allowPlaintextAuth &&\n\t\tsameList(x.ca, y.ca) &&\n\t\tsameAuth(x.auth, y.auth)\n\t);\n}\n\n/** The identity of a delivery to `endpoint`. */\nexport const identityOf = (\n\tendpoint: Endpoint,\n\tsettings: ConnectionSettings,\n): Identity => ({\n\thost: endpoint.host,\n\taddress: endpoint.address,\n\tport: endpoint.port,\n\tconnection: {\n\t\thelo: settings.helo,\n\t\ttls: settings.tls,\n\t\tsecure: settings.secure,\n\t\tallowPlaintextAuth: settings.allowPlaintextAuth,\n\t\t...(settings.ca ? { ca: [...settings.ca] } : {}),\n\t\t...(settings.auth ? { auth: { ...settings.auth } } : {}),\n\t},\n});\n",
23
+ "import { SmtpError } from '../../errors';\nimport type { Clock } from '../target';\nimport type { Entry } from './state';\n\n/** Seconds to wait for the reply to an RSET, at most: a silent dead connection is stale, not worth 300 s. */\nexport const RESET_WAIT = 5;\n\n/** RSET, answered 250 within `seconds`; false when the connection is no good. */\nexport async function reset(\n\tentry: Entry,\n\tclock: Clock,\n\tseconds: number,\n): Promise<boolean> {\n\tconst { socket } = entry;\n\tif (!socket.quiet) return false;\n\tsocket.clock = clock;\n\tsocket.write('RSET\\r\\n');\n\ttry {\n\t\treturn (await socket.reply('the reply to RSET', seconds)).code === 250;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** A reused connection that died before the server answered MAIL FROM: nothing was taken. */\nexport const stale = (entry: Entry, before: number, error: unknown): boolean =>\n\terror instanceof SmtpError &&\n\terror.code === 'CONNECTION_LOST' &&\n\terror.reply === undefined &&\n\t!error.afterData &&\n\tentry.socket.replies === before;\n",
24
+ "import type { Ready } from '../session';\nimport type { ClientSocket } from '../socket';\nimport type { Identity, PoolLimits } from './options';\n\n/** A connection past its opening, between messages or lent. */\nexport interface Entry {\n\treadonly socket: ClientSocket;\n\treadonly ready: Ready;\n\treadonly identity: Identity;\n\treadonly born: number;\n\tmessages: number;\n\ttimer?: Timer;\n}\n\n/** What a pool holds; the functions of this folder act on it. */\nexport interface PoolState {\n\treadonly limits: PoolLimits;\n\treadonly idle: Entry[];\n\t/** Messages in flight. */\n\treadonly busy: Set<Promise<unknown>>;\n\t/** Connections of aborted messages being reset in the background. */\n\treadonly resetting: Set<Promise<void>>;\n\tclosed: boolean;\n}\n\nexport const newState = (limits: PoolLimits): PoolState => ({\n\tlimits,\n\tidle: [],\n\tbusy: new Set(),\n\tresetting: new Set(),\n\tclosed: false,\n});\n\n/** Closes a connection, saying QUIT first unless `polite` is false (it is dead or out of step). */\nexport function hangUp(entry: Entry, polite = true): void {\n\tclearTimeout(entry.timer);\n\tif (polite) entry.socket.write('QUIT\\r\\n');\n\tentry.socket.close();\n}\n\n/** Whether the connection outlived `maxAgeSeconds`. */\nexport const aged = (state: PoolState, entry: Entry): boolean =>\n\tperformance.now() - entry.born >= state.limits.maxAgeSeconds * 1000;\n",
25
+ "import type { Clock } from '../target';\nimport { type Identity, sameIdentity } from './options';\nimport { reset } from './reset';\nimport { aged, type Entry, hangUp, type PoolState } from './state';\n\n/** Takes `entry` out of the idle list and stops its timer. */\nexport function forget(state: PoolState, entry: Entry): void {\n\tconst at = state.idle.indexOf(entry);\n\tif (at >= 0) state.idle.splice(at, 1);\n\tclearTimeout(entry.timer);\n}\n\n/** Keeps the connection for the next message, or says goodbye when it is spent. */\nexport function release(state: PoolState, entry: Entry): void {\n\tconst { limits, idle } = state;\n\tconst spent =\n\t\tstate.closed ||\n\t\tentry.messages >= limits.maxMessages ||\n\t\taged(state, entry) ||\n\t\t!entry.socket.quiet;\n\tfor (const other of idle.filter((e) => !e.socket.quiet)) {\n\t\tforget(state, other);\n\t\thangUp(other, false);\n\t}\n\tconst same = idle.filter((e) => e.identity.host === entry.identity.host);\n\tif (spent || same.length >= limits.maxIdlePerHost) {\n\t\thangUp(entry);\n\t\treturn;\n\t}\n\tentry.timer = setTimeout(() => {\n\t\tforget(state, entry);\n\t\thangUp(entry);\n\t}, limits.idleSeconds * 1000);\n\t// Neither the timer nor the idle socket keeps the process alive.\n\tentry.timer.unref();\n\tentry.socket.ref(false);\n\tidle.push(entry);\n}\n\n/** An idle connection to the same server, reset; none when no one is fit. */\nexport async function borrow(\n\tstate: PoolState,\n\tidentity: Identity,\n\tseconds: number,\n\tclock: Clock,\n): Promise<Entry | undefined> {\n\tfor (;;) {\n\t\tconst entry = state.idle.find((e) => sameIdentity(e.identity, identity));\n\t\tif (!entry) return undefined;\n\t\tforget(state, entry);\n\t\tentry.socket.ref(true);\n\t\tif (aged(state, entry)) {\n\t\t\thangUp(entry, true); // healthy, only old: a polite QUIT\n\t\t\tcontinue;\n\t\t}\n\t\tif (await reset(entry, clock, seconds)) return entry;\n\t\thangUp(entry, false); // stale: silently, the next one or a fresh one\n\t}\n}\n",
26
+ "import { connect, resultOf } from '../connect';\nimport type { Content } from '../content';\nimport type { SendMailResult } from '../options';\nimport type { ClientSettings } from '../settings';\nimport { Clock, type Endpoint } from '../target';\nimport { inStep, transact } from '../transaction';\nimport { borrow, release } from './idle';\nimport { identityOf } from './options';\nimport { RESET_WAIT, reset, stale } from './reset';\nimport { type Entry, hangUp, type PoolState } from './state';\n\n/** Thrown inside the pool: the lent connection was dead, so try a fresh one. */\nclass Stale extends Error {}\n\n/** After an aborted message, off the caller's path: back to the pool if the server resets. */\nfunction recover(state: PoolState, entry: Entry): void {\n\tconst job = reset(entry, new Clock(RESET_WAIT), RESET_WAIT)\n\t\t.then((ok) => (ok ? release(state, entry) : hangUp(entry, false)))\n\t\t.catch(() => hangUp(entry, false));\n\tstate.resetting.add(job);\n\tjob.finally(() => state.resetting.delete(job));\n}\n\nasync function send(\n\tstate: PoolState,\n\tentry: Entry,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tclock: Clock,\n\treused: boolean,\n): Promise<SendMailResult> {\n\tconst { socket, ready } = entry;\n\tsocket.clock = clock; // a transaction takes its own clock\n\tsocket.newMessage(); // and its own budget of reply bytes\n\tconst before = socket.replies;\n\tlet result: SendMailResult;\n\ttry {\n\t\tconst { delivered } = await transact(socket, settings, content, ready);\n\t\tresult = {\n\t\t\t...resultOf(delivered, entry, entry.identity),\n\t\t\treused,\n\t\t};\n\t} catch (error) {\n\t\tif (inStep(error)) {\n\t\t\tentry.messages++;\n\t\t\trecover(state, entry);\n\t\t} else hangUp(entry);\n\t\tif (reused && stale(entry, before, error)) throw new Stale();\n\t\tthrow error;\n\t}\n\t// Only transact can fail a delivery: what follows cannot.\n\tentry.messages++;\n\trelease(state, entry);\n\treturn result;\n}\n\n/** One delivery to one server address, over a pooled connection when there is one. */\nexport async function attempt(\n\tstate: PoolState,\n\tendpoint: Endpoint,\n\tsettings: ClientSettings,\n\tcontent: Content,\n\tclock: Clock,\n): Promise<SendMailResult> {\n\tconst identity = identityOf(endpoint, settings);\n\tconst wait = Math.min(RESET_WAIT, settings.timeouts.command);\n\tconst entry = await borrow(state, identity, wait, clock);\n\tif (entry) {\n\t\ttry {\n\t\t\treturn await send(state, entry, settings, content, clock, true);\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof Stale)) throw error;\n\t\t\t// Once, on a fresh connection, so that the caller never sees it.\n\t\t}\n\t}\n\tconst { socket, ready } = await connect(endpoint, settings, clock);\n\tconst fresh: Entry = {\n\t\tsocket,\n\t\tready,\n\t\tidentity,\n\t\tborn: performance.now(),\n\t\tmessages: 0,\n\t};\n\treturn send(state, fresh, settings, content, clock, false);\n}\n",
27
+ "import { SmtpError } from '../../errors';\nimport { contentOf } from '../content';\nimport type {\n\tMessageSource,\n\tSendMailOptions,\n\tSendMailResult,\n} from '../options';\nimport { deliver } from '../send';\nimport { settingsOf } from '../settings';\nimport { Clock } from '../target';\nimport { limitsOf, type SmtpPoolOptions } from './options';\nimport { attempt } from './send';\nimport { hangUp, newState } from './state';\n\nexport type { SmtpPoolOptions } from './options';\n\n/** A pool of SMTP connections: a delivery takes an idle one to the same server, as `sendMail` would open, or opens one. */\nexport interface SmtpPool {\n\t/** `sendMail`, over a pooled connection. `result.reused` tells whether one carried a message before. */\n\tsendMail(\n\t\tmessage: MessageSource,\n\t\toptions: SendMailOptions,\n\t): Promise<SendMailResult>;\n\t/** QUITs the idle connections, waits for the busy ones, and refuses any further `sendMail` with `STOPPED`. */\n\tclose(): Promise<void>;\n}\n\n/**\n * Creates a pool. Connections are kept apart by what they are: server\n * address, greeting name, TLS and credentials. One is reset (RSET) when it\n * is lent, and closed after a 421, a timeout, a bad reply, a lost stream,\n * or bytes it was not asked for.\n */\nexport function createSmtpPool(options?: SmtpPoolOptions): SmtpPool {\n\tconst state = newState(limitsOf(options));\n\treturn {\n\t\tsendMail(message, sendOptions) {\n\t\t\tconst job = (async () => {\n\t\t\t\tif (state.closed)\n\t\t\t\t\tthrow new SmtpError('STOPPED', 'The SMTP pool is closed');\n\t\t\t\tconst settings = settingsOf(sendOptions);\n\t\t\t\tconst content = contentOf(\n\t\t\t\t\tmessage,\n\t\t\t\t\tsettings.normalizeLineEnds,\n\t\t\t\t\tsettings.size,\n\t\t\t\t);\n\t\t\t\treturn deliver(\n\t\t\t\t\t(endpoint, s, c, clock) => attempt(state, endpoint, s, c, clock),\n\t\t\t\t\tsendOptions,\n\t\t\t\t\tsettings,\n\t\t\t\t\tcontent,\n\t\t\t\t\tnew Clock(settings.deadline),\n\t\t\t\t);\n\t\t\t})();\n\t\t\tstate.busy.add(job);\n\t\t\tconst done = () => state.busy.delete(job);\n\t\t\tjob.then(done, done);\n\t\t\treturn job;\n\t\t},\n\t\tasync close() {\n\t\t\tstate.closed = true;\n\t\t\tfor (const entry of state.idle.splice(0)) hangUp(entry);\n\t\t\tawait Promise.allSettled([...state.busy]);\n\t\t\tawait Promise.allSettled([...state.resetting]);\n\t\t},\n\t};\n}\n"
20
28
  ],
21
- "mappings": ";;;;;;;;;;;;;;AAcO,SAAS,SAAS,CAAC,SAAqC;AAAA,EAC9D,OACC,OAAO,YAAY,YACnB,WAAU,IAAI,YAAY,OAAO,QAAQ,MAAM;AAAA;;ACLjD,SAAS,OAAO,CAAC,OAAoC;AAAA,EACpD,OAAO,iBAAiB,SAAS,MAAM,SAAS,aAC5C,MAAoC,OACrC;AAAA;AAQJ,SAAS,SAAS,CAAC,OAAyB;AAAA,EAC3C,MAAM,OAAO,QAAQ,KAAK;AAAA,EAC1B,OAAO,SAAS,aAAa,SAAS,eAAe,SAAS;AAAA;AAG/D,IAAM,YAAY,CAAC,UAClB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK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,IACV;AAAA,QACA,OAAO,QACN,CAAC,UAAU,GAAG,GAAG,UAAU,SAAQ,OAAO,UAAU,GAAG,GAAG,KAAK,GAC/D,aACA,UACA,SACA,IAAI,MAAM,SAAS,QAAQ,CAC5B;AAAA,SACE;AAAA,MACH,MAAM,KAAK,IAAI,GAAG;AAAA,MAClB,MAAM,OAAO,MAAM,MAAM,KAAK,OAAO,GAAG;AAAA,MACxC,IAAI,KAAK,MAAM,IAAI;AAAA,MACnB,OAAO;AAAA;AAAA,UAEF,KAAK,GAAG;AAAA,MACb,MAAM,SAAS;AAAA,MACf,WAAW,SAAS,MAAM,KAAK,OAAO,CAAC;AAAA,QAAG,OAAO,KAAK;AAAA,MACtD,MAAM,QAAQ,WAAW,CAAC,GAAG,MAAM,IAAI,CAAC;AAAA,MACxC,MAAM,QAAQ,WAAW,CAAC,GAAG,MAAM,SAAS,CAAC;AAAA;AAAA,EAE/C;AAAA;",
30
+ "debugId": "CDDCD67CAFC1023D64756E2164756E21",
23
31
  "names": []
24
32
  }
@@ -153,5 +153,7 @@ export interface SendMailResult {
153
153
  * them: relaying a DSN is then the caller's (§5.2.2).
154
154
  */
155
155
  readonly dsnOffered: boolean;
156
+ /** A pool (`createSmtpPool`) sent the message over a connection that had carried another; absent from plain `sendMail`. */
157
+ readonly reused?: boolean;
156
158
  }
157
159
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/client/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,sGAAsG;AACtG,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;AAE7E;;;;GAIG;AACH,MAA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