import { n as SendEmailParams, S as SendEmailResult } from './html-to-text-BVHoYC3B.js'; export { w as EmailAddress, G as SESError, V as ValidationError, H as WrapsEmailError, J as htmlToPlainText } from './html-to-text-BVHoYC3B.js'; import '@aws-sdk/client-s3'; import '@aws-sdk/client-ses'; import '@aws-sdk/client-sesv2'; import '@aws-sdk/client-ssm'; import '@aws-sdk/lib-dynamodb'; import '@aws-sdk/types'; import 'react'; /** * Static AWS credentials for edge environments. * Workers have no AWS credential chain, so region and credentials are required. */ interface WrapsEmailWorkerConfig { /** AWS region where your SES is configured (e.g. `'us-east-1'`). */ region: string; /** Static AWS credentials. Store these as Wrangler secrets — never in source. */ credentials: { accessKeyId: string; secretAccessKey: string; sessionToken?: string; }; /** * Custom SESv2 REST endpoint override. Defaults to the standard regional endpoint. * Useful for local testing or custom domains. */ endpoint?: string; } /** * Subset of {@link SendEmailParams} supported at the edge. * * Not supported on the edge entry: `react` (render to HTML first), * `attachments` (MIME serialization requires Node built-ins), * `conversationId`, `sendId`, `replyTtlSeconds` (reply-threading uses SSM). */ type WorkerSendEmailParams = Omit; /** * Edge-native SES email client for Cloudflare Workers and other `workerd`-based runtimes. * * Uses `aws4fetch` (Web Crypto) to sign requests and the SESv2 REST API (JSON payloads, * no `DOMParser`) — zero Node.js APIs, ~5 KiB bundled. * * @example * ```typescript * const email = new WrapsEmail({ * region: env.AWS_REGION, * credentials: { * accessKeyId: env.AWS_ACCESS_KEY_ID, * secretAccessKey: env.AWS_SECRET_ACCESS_KEY, * }, * }); * const result = await email.send({ * from: 'hello@example.com', * to: 'user@example.com', * subject: 'Welcome!', * html: '

Hello

', * }); * ``` */ declare class WrapsEmail { private readonly aws; private readonly endpoint; /** * Create a new edge-native SES client. * * @param config - Region and static AWS credentials (required at the edge). * @throws {ValidationError} If `region` or credentials fields are missing. */ constructor(config: WrapsEmailWorkerConfig); /** * Send a single email via the SESv2 REST API. * * Mirrors the Node `WrapsEmail.send()` surface — change only the import path. * When `html` is provided without `text`, plain text is auto-generated. * * @param params - Email send options. `react` and `attachments` are not supported at the edge. * @returns Resolved with `{ messageId, requestId }` on success. * @throws {ValidationError} If required fields are missing or unsupported options are used. * @throws {SESError} If the SESv2 API returns a non-2xx response. * * @example * ```typescript * const result = await email.send({ * from: 'hello@example.com', * to: ['alice@example.com', 'bob@example.com'], * subject: 'Hello!', * html: '

Hi there

', * }); * console.log(result.messageId); * ``` */ send(params: WorkerSendEmailParams): Promise; private buildSesV2Payload; private mapSesV2Error; } export { SendEmailResult, type WorkerSendEmailParams, WrapsEmail, type WrapsEmailWorkerConfig };