/** * @module * Deno socket adapter for SMTP connections via Deno.connect and Deno.startTls. * * @example * ```ts * import { DenoAdapter } from "sently/adapters/deno"; * import { createSMTPMailer } from "sently/smtp"; * * const mailer = await createSMTPMailer({ * host: "smtp.example.com", * adapter: new DenoAdapter(), * auth: { user: "you@example.com", pass: "secret" }, * }); * ``` */ import type { SocketAdapter, TLSOptions } from "../core/types.js"; /** Configuration options for {@link DenoAdapter}. */ export interface DenoAdapterOptions { /** Use implicit TLS on connect (port 465). Default: false. */ secure?: boolean; /** Socket connect timeout in milliseconds. Default: 30_000. */ connectionTimeout?: number; /** TLS options passed to Deno.startTls / Deno.connectTls. */ tls?: TLSOptions; } /** * Deno socket adapter using Deno.connect / Deno.startTls. */ export declare class DenoAdapter implements SocketAdapter { /** Active Deno TCP or TLS connection. */ private conn; /** Whether the connection is currently encrypted. */ private _secure; /** Whether the socket is connected. */ private _connected; /** TLS options for direct TLS and STARTTLS upgrades. */ private readonly tlsOptions; /** Creates a Deno socket adapter (requires the Deno runtime). */ constructor(options?: DenoAdapterOptions); /** Whether the connection uses TLS. */ get secure(): boolean; /** Whether the socket is currently connected. */ get connected(): boolean; /** Opens a TCP or TLS connection to the given host and port. */ connect(host: string, port: number): Promise; /** Upgrades a plain connection to TLS via STARTTLS. */ startTLS(options?: TLSOptions): Promise; /** Writes raw bytes to the socket. */ write(data: Uint8Array): Promise; /** Reads incoming socket data as an async iterable of byte chunks. */ read(): AsyncGenerator; /** Closes the socket connection. */ close(): Promise; }