import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'; import { E as EmailStatus, a as EmailListOptions, b as EmailListResult, I as InboxListOptions, c as InboxListResult, d as InboxEmail, e as InboxGetAttachmentOptions, f as InboxForwardOptions, S as SendEmailResult, g as InboxReplyOptions, h as SuppressionEntry, i as SuppressionReason, j as SuppressionListOptions, k as SuppressionListResult, C as CreateTemplateParams, l as CreateTemplateFromReactParams, U as UpdateTemplateParams, T as Template, m as TemplateMetadata, W as WrapsEmailConfig, n as SendEmailParams, o as SendTemplateParams, p as SendBulkTemplateParams, q as SendBulkTemplateResult, r as SendBatchParams, s as SendBatchResult } from './html-to-text-DT5aZy7u.js'; export { A as Attachment, B as BatchEmailEntry, t as BatchEntryResult, u as BulkTemplateDestination, v as CredentialsError, D as DynamoDBError, w as EmailAddress, x as EmailEvent, y as InboxAttachment, z as InboxEmailAddress, F as InboxEmailSummary, R as ReplyThreadingConfig, G as SESError, H as SES_SIMULATOR_SUCCESS, J as SandboxError, K as SendEmailBody, L as SendEmailParamsBase, V as ValidationError, M as WrapsEmailError, N as htmlToPlainText } from './html-to-text-DT5aZy7u.js'; import { S3Client } from '@aws-sdk/client-s3'; import { SESClient } from '@aws-sdk/client-ses'; import { SSMClient } from '@aws-sdk/client-ssm'; import { SESv2Client } from '@aws-sdk/client-sesv2'; import '@aws-sdk/types'; import 'react'; declare class WrapsEmailEvents { private client; private tableName; constructor(client: DynamoDBDocumentClient, tableName: string); /** * Get all events for a single email by messageId * Returns null if no events found */ get(messageId: string): Promise; /** * List emails with events, queried via the accountId-sentAt GSI * Requires accountId for efficient querying * * `maxResults` bounds *messages*, not events. The GSI stores one row per * event, so a single DynamoDB page holds a mix of partial event sets; this * pages until enough distinct messages are found, then re-reads each message's * full event set from the base table. Without that second read `sentAt` would * be whichever event happened to fall inside the scan window. */ list(options: EmailListOptions): Promise; /** All events for one messageId, read from the base table's partition. */ private fetchMessage; private aggregateStatus; private handleDynamoDBError; } /** * WrapsInbox - Read and manage inbound emails stored in S3 * * Emails are stored by the inbound Lambda processor: * raw/{messageId} - Raw MIME from SES * parsed/{emailId}.json - Parsed email JSON * attachments/{emailId}/ - Extracted attachments */ declare class WrapsInbox { private s3Client; private bucketName; private sesClient; constructor(s3Client: S3Client, bucketName: string, sesClient?: SESClient); private requireSES; /** * List parsed inbound emails */ list(options?: InboxListOptions): Promise; /** * Get a parsed inbound email by ID */ get(emailId: string): Promise; /** * Get a presigned URL for an attachment */ getAttachment(emailId: string, attachmentId: string, options?: InboxGetAttachmentOptions): Promise; /** * Get a presigned URL for the raw MIME email */ getRaw(emailId: string): Promise; /** * Delete an inbound email and all associated files */ delete(emailId: string): Promise; /** * Forward an inbound email to new recipients * * Two modes: * - passthrough (default): Re-sends raw MIME with rewritten From/To/Subject headers * - wrapped: Builds a new message wrapping the original content */ forward(emailId: string, options: InboxForwardOptions): Promise; /** * Reply to an inbound email with proper threading headers (In-Reply-To, References) */ reply(emailId: string, options: InboxReplyOptions): Promise; private handleError; } type WrapsReplyThreadingOptions = { /** * SSM client used to fetch per-domain signing secrets. * Injected (not constructed inline) for testability. */ ssmClient: SSMClient; /** * SSM parameter name prefix. Full name = prefix + fromDomain. * Typically `"/wraps/email/reply-secret/"`. */ parameterPrefix: string; /** * Per-domain secret cache TTL in milliseconds. Defaults to 5 minutes. */ cacheTtlMs?: number; /** * Default exp (seconds from now) baked into tokens. Defaults to 90 days. * `0` means infinite (no expiry). */ defaultTtlSeconds?: number; /** * Constructor-level override for the reply domain. If unset, the reply * domain is auto-derived as `r.mail.{fromDomain}`. Per-call `replyDomain` * still wins over this. */ defaultReplyDomainOverride?: string; }; type GenerateReplyToParams = { fromDomain: string; replyDomain?: string; conversationId?: string; sendId?: string; /** * Override default TTL for this token. `0` = infinite. */ ttlSeconds?: number; }; type GenerateReplyToResult = { /** Full signed reply-to address: `<51-char-token>@{replyDomain}` */ address: string; conversationId: string; sendId: string; /** Unix seconds when the token expires; `null` when infinite. */ expiresAt: number | null; }; /** * WrapsReplyThreading - Mint signed reply-to addresses for email threading. * * Per-domain secrets are fetched from SSM and cached for `cacheTtlMs` * (default 5 minutes) so rotation eventually-converges without constant * SSM traffic. One instance handles N sending domains transparently. */ declare class WrapsReplyThreading { private ssmClient; private parameterPrefix; private cacheTtlMs; private defaultTtlSeconds; private defaultReplyDomainOverride?; private cache; constructor(opts: WrapsReplyThreadingOptions); /** * Generate a new conversation id (11-char base64url from 8 random bytes). * Synchronous — no SSM call. */ newConversation(): string; /** * Mint a signed reply-to address for the given sending domain. * * @throws {ValidationError} if reply threading is not enabled for `fromDomain` * (SSM parameter missing). */ generateReplyTo(params: GenerateReplyToParams): Promise; private getSecret; } declare class WrapsEmailSuppression { private client; constructor(client: SESv2Client); /** * Check if an email is on the suppression list * Returns the entry if suppressed, null if not */ get(email: string): Promise; /** * Add an email to the suppression list * Idempotent — succeeds silently if already suppressed */ add(email: string, reason: SuppressionReason): Promise; /** * Remove an email from the suppression list * Idempotent — silently succeeds if email is not on the list */ remove(email: string): Promise; /** * List suppressed emails with optional filters */ list(options?: SuppressionListOptions): Promise; /** * Route through the shared mapper so a credential-chain failure here becomes * a `CredentialsError` rather than escaping as raw AWS text, exactly as it * does on the send path. */ private handleError; /** * The region to name in an error, resolved only when the message will use it. * Resolution can walk to IMDS, so every other failure skips it. */ private errorRegion; } declare class WrapsEmail { private sesClient; private sesv2Client; /** * Inbox for reading inbound emails * Only available when inboxBucketName is configured */ readonly inbox: WrapsInbox | null; /** * Email event history from DynamoDB * Only available when historyTableName is configured */ readonly events: WrapsEmailEvents | null; /** * Suppression list management (SES v2) * Always available when credentials are configured */ readonly suppression: WrapsEmailSuppression; /** * Signed reply-to threading * Only available when `replyThreading` is configured */ readonly replyThreading: WrapsReplyThreading | null; /** * Constructor-level `replyDomain` override, preserved so per-send * resolution can honor it without re-reading config. */ private readonly replyDomainOverride; /** Clients this instance created itself and is responsible for closing. */ private readonly ownedClients; /** * Region resolution shared by every client this instance builds, so the * profile/IMDS legs of the chain are walked at most once. */ private readonly region; /** * Template management methods */ readonly templates: { create: (params: CreateTemplateParams) => Promise; createFromReact: (params: CreateTemplateFromReactParams) => Promise; update: (params: UpdateTemplateParams) => Promise; get: (name: string) => Promise