import { BaseConnector } from '../../base/base.connector.js'; import type { IEmailOptions, IEmailProvider, ISendMessageSuccessResponse, WithPassthrough, EmailSendInput, EmailSendResult, IEmailConnector } from '../../types/index.js'; import { ChannelTypeEnum } from '../../types/index.js'; import type { MailtrapConfig } from './mailtrap.config.js'; export declare class MailtrapEmailConnector extends BaseConnector implements IEmailProvider, IEmailConnector { private config; readonly id = "mailtrap"; readonly channelType: ChannelTypeEnum.EMAIL; constructor(config: MailtrapConfig, fetchImpl?: typeof fetch); /** * Thinwrap-native send. Implements `IEmailConnector`. * Builds the Mailtrap send-email JSON body in snake_case wire shape and POSTs * to one of two endpoints depending on `config.mode`: * * - `'sandbox'` → `https://sandbox.api.mailtrap.io/api/send/` * (captures the email in the Mailtrap inbox UI, does not * deliver to the recipient) * - `'production'` → `https://send.api.mailtrap.io/api/send` * (actually delivers email) * * Auth: `Authorization: Bearer `. the connector * explicitly invokes `transformKeys(_passthrough.body, CasingEnum.SNAKE_CASE)` * so consumer-supplied camelCase keys (e.g., `templateUuid`, * `templateVariables`, `customVariables`, `category`) land as snake_case in * the wire body. */ send(input: EmailSendInput): Promise; /** * Build the Mailtrap wire body from Thinwrap's `EmailSendInput`. Hand-mapped * in snake_case (locality): `from`/`to`/`cc`/`bcc` become * `{ email, name? }` objects; `replyTo` becomes a single `reply_to` object * (not an array — Mailtrap differs from MailerSend here); `headers` is passed * through as a `Record` (Mailtrap accepts that shape natively, * unlike Postmark/MailerSend which require an Array<{name,value}>). */ private buildMailtrapBody; /** * Map Mailtrap error responses to canonical `ConnectorError` with the 6-value * `ProviderCode` union. Parses `Retry-After`: * parsed seconds embedded in `providerMessage` text; raw header value on * `cause.retryAfter`. No structured `retryAfterSeconds` field per * Retry is consumer policy (no retryAfterSeconds field). */ private mapVendorError; /** * Synchronous constructor-time validator. Throws `ConnectorError` if the * `mode` `inboxId` combination is invalid. See. */ private validateConfig; /** * Resolve the Mailtrap endpoint for the current config. Sandbox URLs embed * the inbox id in the path; production uses a single global host. */ private resolveEndpoint; sendMessage(options: IEmailOptions, bridgeProviderData?: WithPassthrough>): Promise; }