UNPKG

@worktif/purews

Version:

Work TIF TypeScript-based AWS infrastructure toolkit featuring DynamoDB integration, AppSync support, SES functionality, and GraphQL capabilities with comprehensive audit logging and AWS Signature V4 authentication.

77 lines (76 loc) 3.51 kB
import 'reflect-metadata'; import { Logger } from '@aws-lambda-powertools/logger'; import { SendEmailCommandOutput, SES } from '@aws-sdk/client-ses'; import { BeforeInstance, LoggerInterface } from '@worktif/utils'; import { EnvConfigPurews } from '@config/env.config.purews'; export declare class SesService implements LoggerInterface { protected envConfig: EnvConfigPurews; /** * Represents a logger instance for the specified service. * * @param {Object} options - The configuration options for the logger instance. * @param {string} options.serviceName - The name of the service for which the logger is used. * @return {Logger} The logger instance. */ loggerInstance: Logger; /** * Represents an instance of SNS client. * @class * @constructor * @param {object} options - Configuration options for the SNS client. */ protected sesClient: SES; /** * The source name of a person or organization. * * @type {string} */ protected sourceName: string; /** * The default subject for a message related to the success of advanced scaling for a website. * * @type {string} * @constant * @memberof module:mail */ private defaultSubject; /** * The default character encoding of the application. * * @type {string} */ private defaultCharset; /** * Constructor for creating an instance of a class. * * @param {EnvConfigPurews} envConfig - The environment configuration. */ constructor(envConfig: EnvConfigPurews); /** * Sends an email using the AWS SES service with the specified parameters. * * @param {string} messageHtml - The HTML content of the email to be sent. * @param {string} toAddress - The recipient's email address. * @param {string} [subject] - The subject of the email. If not provided, a default subject will be used. * @param {BeforeInstance} [beforeInstance] - An optional instance for logging or performing actions before email is sent. * @return {Promise<SendEmailCommandOutput>} A promise that resolves to the output of the send email operation. */ sendEmail<T>(messageHtml: string, toAddress: string, subject?: string, beforeInstance?: BeforeInstance): Promise<SendEmailCommandOutput>; /** * Verifies the given email address using the SES client. * This process is used to confirm the ownership of an email address for further communication. * * @param {string} email - The email address to be verified. * @param {BeforeInstance} [beforeInstance] - Optional instance to handle logging and additional processing before execution. * @return {Promise<void>} Resolves with no value if the email is verified successfully. Throws an error in case of failure. */ verifyEmailAddress(email: string, beforeInstance?: BeforeInstance): Promise<void>; /** * Verifies if the specified email address has been successfully verified with Amazon Simple Email Service (SES). * * @param {string} email - The email address to check for verification status. * @param {BeforeInstance} [beforeInstance] - An optional instance for logging activities before execution. * @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the email is verified (`true`) or not (`false`). */ isEmailAddressVerified(email: string, beforeInstance?: BeforeInstance): Promise<boolean>; }