@454creative/easy-email
Version:
A framework-agnostic email service library for Node.js with observability and monitoring
155 lines • 4.02 kB
TypeScript
/**
* SES-specific TypeScript types and constants
*/
import { SesConfig } from '../interfaces/email-options.interface';
export type { SesConfig };
/**
* SES Error Types
*/
export type SesErrorType = 'MessageRejected' | 'MailFromDomainNotVerified' | 'ConfigurationSetDoesNotExist' | 'TemplateDoesNotExist' | 'AccountSendingPaused' | 'SendingPaused' | 'MessageTooLarge' | 'InvalidParameterValue' | 'ValidationError' | 'ThrottlingException' | 'ServiceUnavailable' | 'InternalError' | 'NetworkError' | 'TimeoutError';
/**
* SES Error Types Array
*/
export declare const SES_ERROR_TYPES: SesErrorType[];
/**
* SES Metrics Interface
*/
export interface SesMetrics {
quotaUsage: number;
bounceRate: number;
complaintRate: number;
deliveryRate: number;
lastQuotaCheck?: string;
}
/**
* SES Quota Data Interface
*/
export interface SesQuotaData {
max24HourSend: number;
sentLast24Hours: number;
maxSendRate: number;
}
/**
* SES Statistics Data Interface
*/
export interface SesStatisticsData {
deliveryAttempts: number;
bounces: number;
complaints: number;
rejects: number;
}
/**
* SES Email Event Interface
*/
export interface SesEmailEvent {
id: string;
timestamp: string;
type: 'email_sent' | 'email_failed';
provider: 'ses';
recipient?: string;
subject?: string;
messageId?: string;
duration?: number;
error?: {
message: string;
code: SesErrorType;
details?: {
sesErrorType: SesErrorType;
originalError: any;
};
};
metadata?: Record<string, any>;
}
/**
* SES Connection Event Interface
*/
export interface SesConnectionEvent {
id: string;
timestamp: string;
type: 'connection_verified' | 'connection_failed';
provider: 'ses';
duration?: number;
error?: {
message: string;
code: string;
};
}
/**
* SES Quota Event Interface
*/
export interface SesQuotaEvent {
id: string;
timestamp: string;
type: 'connection_verified';
provider: 'ses';
metadata: {
quotaUsage: number;
max24HourSend: number;
sentLast24Hours: number;
maxSendRate: number;
};
}
/**
* SES Statistics Event Interface
*/
export interface SesStatisticsEvent {
id: string;
timestamp: string;
type: 'connection_verified';
provider: 'ses';
metadata: {
deliveryRate: number;
bounceRate: number;
complaintRate: number;
deliveryAttempts: number;
bounces: number;
complaints: number;
rejects: number;
};
}
/**
* SES Error Event Interface
*/
export interface SesErrorEvent {
id: string;
timestamp: string;
type: 'email_failed';
provider: 'ses';
duration: number;
error: {
message: string;
code: SesErrorType;
details: {
sesErrorType: SesErrorType;
originalError: any;
};
};
metadata: {
errorType: SesErrorType;
duration: number;
};
}
/**
* SES Error Codes
*/
export declare const SES_ERROR_CODES: {
readonly MESSAGE_REJECTED: "MessageRejected";
readonly MAIL_FROM_DOMAIN_NOT_VERIFIED: "MailFromDomainNotVerified";
readonly CONFIGURATION_SET_DOES_NOT_EXIST: "ConfigurationSetDoesNotExist";
readonly TEMPLATE_DOES_NOT_EXIST: "TemplateDoesNotExist";
readonly ACCOUNT_SENDING_PAUSED: "AccountSendingPaused";
readonly SENDING_PAUSED: "SendingPaused";
readonly MESSAGE_TOO_LARGE: "MessageTooLarge";
readonly INVALID_PARAMETER_VALUE: "InvalidParameterValue";
readonly VALIDATION_ERROR: "ValidationError";
readonly THROTTLING_EXCEPTION: "ThrottlingException";
readonly SERVICE_UNAVAILABLE: "ServiceUnavailable";
readonly INTERNAL_ERROR: "InternalError";
readonly NETWORK_ERROR: "NetworkError";
readonly TIMEOUT_ERROR: "TimeoutError";
};
/**
* SES Default Configuration
*/
export declare const SES_DEFAULT_CONFIG: SesConfig;
//# sourceMappingURL=ses.types.d.ts.map