UNPKG

@microfox/aws-ses

Version:
636 lines (633 loc) 19 kB
import { z } from 'zod'; declare const SendEmailResponseSchema: z.ZodObject<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">>; declare const SESConfigSchema: z.ZodObject<{ accessKeyId: z.ZodString; secretAccessKey: z.ZodString; region: z.ZodString; }, "strip", z.ZodTypeAny, { accessKeyId: string; secretAccessKey: string; region: string; }, { accessKeyId: string; secretAccessKey: string; region: string; }>; declare const EmailParamsSchema: z.ZodObject<{ sender: z.ZodString; recipient: z.ZodString; displayName: z.ZodOptional<z.ZodString>; subject: z.ZodString; bodyText: z.ZodOptional<z.ZodString>; bodyHtml: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { sender: string; recipient: string; subject: string; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, { sender: string; recipient: string; subject: string; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }>; declare const BulkEmailParamsSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{ sender: z.ZodString; recipients: z.ZodArray<z.ZodString, "many">; displayName: z.ZodOptional<z.ZodString>; subject: z.ZodString; bodyText: z.ZodOptional<z.ZodString>; bodyHtml: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }>, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }>, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }>; type SESConfig = z.infer<typeof SESConfigSchema>; type EmailParams = z.infer<typeof EmailParamsSchema>; type BulkEmailParams = z.infer<typeof BulkEmailParamsSchema>; type SendEmailResponse = z.infer<typeof SendEmailResponseSchema>; declare const SESSdkSchema: z.ZodObject<{ sendEmail: z.ZodFunction<z.ZodTuple<[z.ZodObject<{ sender: z.ZodString; recipient: z.ZodString; displayName: z.ZodOptional<z.ZodString>; subject: z.ZodString; bodyText: z.ZodOptional<z.ZodString>; bodyHtml: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { sender: string; recipient: string; subject: string; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, { sender: string; recipient: string; subject: string; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }>], z.ZodUnknown>, z.ZodPromise<z.ZodObject<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">>>>; sendBulkEmails: z.ZodFunction<z.ZodTuple<[z.ZodEffects<z.ZodEffects<z.ZodObject<{ sender: z.ZodString; recipients: z.ZodArray<z.ZodString, "many">; displayName: z.ZodOptional<z.ZodString>; subject: z.ZodString; bodyText: z.ZodOptional<z.ZodString>; bodyHtml: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }>, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }>, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }>], z.ZodUnknown>, z.ZodPromise<z.ZodArray<z.ZodObject<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">>, "many">>>; }, "strip", z.ZodTypeAny, { sendEmail: (args_0: { sender: string; recipient: string; subject: string; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, ...args: unknown[]) => Promise<z.objectOutputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">>; sendBulkEmails: (args_0: { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, ...args: unknown[]) => Promise<z.objectOutputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">[]>; }, { sendEmail: (args_0: { sender: string; recipient: string; subject: string; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, ...args: unknown[]) => Promise<z.objectInputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">>; sendBulkEmails: (args_0: { sender: string; subject: string; recipients: string[]; displayName?: string | undefined; bodyText?: string | undefined; bodyHtml?: string | undefined; }, ...args: unknown[]) => Promise<z.objectInputType<{ SendEmailResponse: z.ZodObject<{ SendEmailResult: z.ZodObject<{ MessageId: z.ZodString; }, "strip", z.ZodTypeAny, { MessageId: string; }, { MessageId: string; }>; ResponseMetadata: z.ZodObject<{ RequestId: z.ZodString; }, "strip", z.ZodTypeAny, { RequestId: string; }, { RequestId: string; }>; }, "strip", z.ZodTypeAny, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }, { SendEmailResult: { MessageId: string; }; ResponseMetadata: { RequestId: string; }; }>; }, z.ZodTypeAny, "passthrough">[]>; }>; type SESSDK = z.infer<typeof SESSdkSchema>; /** * Create an AWS SES SDK instance for sending emails. * * @example * ```typescript * const ses = createSESSdk({ * accessKeyId: 'YOUR_AWS_ACCESS_KEY_ID', * secretAccessKey: 'YOUR_AWS_SECRET_ACCESS_KEY', * region: 'us-east-1' * }); * * // Send a plain text email * await ses.sendEmail({ * sender: 'sender@example.com', * recipient: 'recipient@example.com', * subject: 'Hello!', * bodyText: 'This is a plain text email' * }); * * // Send an HTML email * await ses.sendEmail({ * sender: 'sender@example.com', * recipient: 'recipient@example.com', * subject: 'Hello!', * bodyHtml: '<p>This is an HTML email</p>' * }); * ``` */ declare const createSESSdk: (config: SESConfig) => SESSDK; export { type BulkEmailParams, type EmailParams, type SESConfig, type SESSDK, type SendEmailResponse, createSESSdk, createSESSdk as default };