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 { MailerSendConfig } from './mailersend.config.js'; export declare class MailerSendEmailConnector extends BaseConnector implements IEmailProvider, IEmailConnector { private config; readonly id = "mailersend"; readonly channelType: ChannelTypeEnum.EMAIL; constructor(config: MailerSendConfig, fetchImpl?: typeof fetch); /** * Thinwrap-native send. Implements `IEmailConnector`. * Builds the MailerSend `/v1/email` JSON body in snake_case wire shape and * POSTs to `https://api.mailersend.com/v1/email` with `Authorization: Bearer * `. the connector explicitly invokes * `transformKeys(_passthrough.body, CasingEnum.SNAKE_CASE)` before * `mergePassthrough` so consumer-supplied camelCase keys (e.g., `templateId`, * `sendAt`, `inReplyTo`, `personalization`) land as snake_case in the wire * body. MailerSend returns 202 Accepted with empty body; the message ID is * carried in the `X-Message-Id` response header. A 202 can still carry a * `warnings` body when recipients are suppressed — see `readAcceptedBody`. */ send(input: EmailSendInput): Promise; /** * Decode a 2xx body, which MailerSend only sends to report suppressed * recipients. `ALL_SUPPRESSED` means "Email is not sent" (and no * `X-Message-Id` is returned), so it is surfaced as `invalid_recipient`; * `SOME_SUPPRESSED` still sends to the rest, so the warnings are returned * for `raw` and the send succeeds. */ private readAcceptedBody; /** * Build the MailerSend `/v1/email` wire body from Thinwrap's `EmailSendInput`. * Hand-mapped in snake_case (locality): `from`/`to`/`cc`/`bcc` * become `{ email, name? }` objects; `replyTo` becomes the `reply_to` * object `{ email }`; `headers` (Record) is reshaped to MailerSend's * Array<{name, value}> shape; `tags` is truncated to MailerSend's 5-tag limit * with first-5-wins silent truncation (the >=90% baseline-coverage rule). */ private buildMailerSendBody; /** * Map MailerSend 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; sendMessage(options: IEmailOptions, bridgeProviderData?: WithPassthrough>): Promise; }