import { BaseConnector } from '../../base/base.connector'; import type { IEmailOptions, IEmailProvider, ISendMessageSuccessResponse, WithPassthrough, EmailSendInput, EmailSendResult, IEmailConnector } from '../../types'; import { ChannelTypeEnum } from '../../types'; import type { BrevoConfig } from './brevo.config'; export declare class BrevoEmailConnector extends BaseConnector implements IEmailProvider, IEmailConnector { private config; readonly id = "brevo"; readonly channelType: ChannelTypeEnum.EMAIL; constructor(config: BrevoConfig, fetchImpl?: typeof fetch); /** * Thinwrap-native send. Implements `IEmailConnector`. * * ** pre-flight guard:** if any `attachments[].contentId` is set, throws * `ConnectorError({ providerCode: 'invalid_request', statusCode: 0 })` BEFORE * any HTTP call — Brevo's `/v3/smtp/email` has no first-class cid mechanism. * This is the canonical outlier "vendor doesn't support a baseline * field" throw the >=90% baseline-coverage rule. * * Brevo's wire shape is already camelCase, matching Thinwrap's input shape; * only field renames (`from` → `sender`, `html` → `htmlContent`, * `text` → `textContent`, `attachments` → `attachment` singular) are * hand-mapped inline. No `casingTransform()` invocation needed — neither on * the connector body nor on `_passthrough.body`. */ send(input: EmailSendInput): Promise; /** * Build the Brevo wire body from Thinwrap's `EmailSendInput`. Hand-maps the * field renames where Thinwrap's name diverges from Brevo's: * - `from` → `sender: { email, name? }` * - `to`/`cc`/`bcc` strings → `[{ email }]` * - `html` → `htmlContent`, `text` → `textContent` * - `replyTo` → `replyTo: { email }` * - `attachments` → `attachment` (singular) — name + base64 content only. * * The `contentId` guard at the top of `send()` ensures that no attachment * here carries a `contentId`. Brevo's attachment shape supports only * `{ name, content }`; `contentType` is implicit from filename per their docs. */ private buildBrevoBody; /** * Map Brevo 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; }