@visulima/email 1.0.0-alpha.16 → 1.0.0-alpha.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE.md +303 -483
  3. package/dist/crypto/index.d.ts +147 -4
  4. package/dist/index.d.ts +785 -9
  5. package/dist/packem_shared/provider.d-DcfYeGJJ.d.ts +28 -0
  6. package/dist/packem_shared/types.d-CNnnk-Ya.d.ts +102 -0
  7. package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
  8. package/dist/packem_shared/types.d-wwpgA3to.d.ts +204 -0
  9. package/dist/providers/ahasend/index.d.ts +36 -3
  10. package/dist/providers/aws-ses/index.d.ts +47 -3
  11. package/dist/providers/azure/index.d.ts +52 -3
  12. package/dist/providers/brevo/index.d.ts +65 -3
  13. package/dist/providers/failover/index.d.ts +27 -3
  14. package/dist/providers/http/index.d.ts +35 -3
  15. package/dist/providers/infobip/index.d.ts +56 -3
  16. package/dist/providers/mailcrab/index.d.ts +32 -3
  17. package/dist/providers/mailersend/index.d.ts +51 -3
  18. package/dist/providers/mailgun/index.d.ts +73 -3
  19. package/dist/providers/mailjet/index.d.ts +72 -3
  20. package/dist/providers/mailomat/index.d.ts +40 -3
  21. package/dist/providers/mailpace/index.d.ts +52 -3
  22. package/dist/providers/mailtrap/index.d.ts +44 -3
  23. package/dist/providers/mandrill/index.d.ts +87 -3
  24. package/dist/providers/mock/index.d.ts +59 -3
  25. package/dist/providers/nodemailer/index.d.ts +38 -3
  26. package/dist/providers/opentelemetry/index.d.ts +529 -3
  27. package/dist/providers/plunk/index.d.ts +38 -3
  28. package/dist/providers/postal/index.d.ts +48 -3
  29. package/dist/providers/postmark/index.d.ts +60 -3
  30. package/dist/providers/resend/index.d.ts +51 -3
  31. package/dist/providers/roundrobin/index.d.ts +27 -3
  32. package/dist/providers/scaleway/index.d.ts +44 -3
  33. package/dist/providers/sendgrid/index.d.ts +84 -3
  34. package/dist/providers/smtp/index.d.ts +71 -3
  35. package/dist/providers/sweego/index.d.ts +40 -3
  36. package/dist/providers/zeptomail/index.d.ts +37 -3
  37. package/dist/template-engines/handlebars.d.ts +23 -22
  38. package/dist/template-engines/html-to-text.d.ts +24 -24
  39. package/dist/template-engines/mjml.d.ts +10 -10
  40. package/dist/template-engines/react-email.d.ts +9 -9
  41. package/dist/template-engines/vue-email.d.ts +9 -9
  42. package/dist/utils/cache.d.ts +49 -48
  43. package/dist/utils/format-email-address.d.ts +8 -7
  44. package/dist/utils/normalize-email-aliases.d.ts +20 -20
  45. package/dist/utils/parse-address.d.ts +18 -17
  46. package/dist/utils/validation/check-mx-records.d.ts +36 -35
  47. package/dist/utils/validation/disposable-email-domains.d.ts +1 -13
  48. package/dist/utils/validation/role-accounts.d.ts +18 -18
  49. package/dist/utils/validation/validate-email.d.ts +5 -5
  50. package/dist/utils/validation/verify-email.d.ts +45 -42
  51. package/dist/utils/validation/verify-smtp.d.ts +35 -34
  52. package/package.json +37 -37
  53. package/dist/attachment-helpers.d.ts +0 -64
  54. package/dist/crypto/dkim-signer.d.ts +0 -48
  55. package/dist/crypto/smime-encrypter.d.ts +0 -53
  56. package/dist/crypto/smime-signer.d.ts +0 -48
  57. package/dist/crypto/types.d.ts +0 -101
  58. package/dist/draft-mail-message.d.ts +0 -13
  59. package/dist/errors/email-error.d.ts +0 -17
  60. package/dist/errors/required-option-error.d.ts +0 -10
  61. package/dist/mail-message.d.ts +0 -425
  62. package/dist/mail.d.ts +0 -206
  63. package/dist/providers/ahasend/provider.d.ts +0 -7
  64. package/dist/providers/ahasend/types.d.ts +0 -28
  65. package/dist/providers/aws-ses/provider.d.ts +0 -8
  66. package/dist/providers/aws-ses/types.d.ts +0 -38
  67. package/dist/providers/azure/provider.d.ts +0 -7
  68. package/dist/providers/azure/types.d.ts +0 -44
  69. package/dist/providers/brevo/provider.d.ts +0 -7
  70. package/dist/providers/brevo/types.d.ts +0 -57
  71. package/dist/providers/failover/provider.d.ts +0 -7
  72. package/dist/providers/failover/types.d.ts +0 -19
  73. package/dist/providers/http/provider.d.ts +0 -7
  74. package/dist/providers/http/types.d.ts +0 -27
  75. package/dist/providers/infobip/provider.d.ts +0 -7
  76. package/dist/providers/infobip/types.d.ts +0 -48
  77. package/dist/providers/mailcrab/provider.d.ts +0 -9
  78. package/dist/providers/mailcrab/types.d.ts +0 -22
  79. package/dist/providers/mailersend/provider.d.ts +0 -7
  80. package/dist/providers/mailersend/types.d.ts +0 -43
  81. package/dist/providers/mailgun/provider.d.ts +0 -7
  82. package/dist/providers/mailgun/types.d.ts +0 -65
  83. package/dist/providers/mailjet/provider.d.ts +0 -7
  84. package/dist/providers/mailjet/types.d.ts +0 -64
  85. package/dist/providers/mailomat/provider.d.ts +0 -7
  86. package/dist/providers/mailomat/types.d.ts +0 -32
  87. package/dist/providers/mailpace/provider.d.ts +0 -7
  88. package/dist/providers/mailpace/types.d.ts +0 -44
  89. package/dist/providers/mailtrap/provider.d.ts +0 -7
  90. package/dist/providers/mailtrap/types.d.ts +0 -36
  91. package/dist/providers/mandrill/provider.d.ts +0 -7
  92. package/dist/providers/mandrill/types.d.ts +0 -79
  93. package/dist/providers/mock/provider.d.ts +0 -8
  94. package/dist/providers/mock/types.d.ts +0 -50
  95. package/dist/providers/nodemailer/provider.d.ts +0 -7
  96. package/dist/providers/nodemailer/types.d.ts +0 -30
  97. package/dist/providers/opentelemetry/provider.d.ts +0 -7
  98. package/dist/providers/opentelemetry/types.d.ts +0 -31
  99. package/dist/providers/plunk/provider.d.ts +0 -7
  100. package/dist/providers/plunk/types.d.ts +0 -30
  101. package/dist/providers/postal/provider.d.ts +0 -7
  102. package/dist/providers/postal/types.d.ts +0 -40
  103. package/dist/providers/postmark/provider.d.ts +0 -7
  104. package/dist/providers/postmark/types.d.ts +0 -52
  105. package/dist/providers/provider.d.ts +0 -27
  106. package/dist/providers/resend/provider.d.ts +0 -7
  107. package/dist/providers/resend/types.d.ts +0 -43
  108. package/dist/providers/roundrobin/provider.d.ts +0 -7
  109. package/dist/providers/roundrobin/types.d.ts +0 -19
  110. package/dist/providers/scaleway/provider.d.ts +0 -7
  111. package/dist/providers/scaleway/types.d.ts +0 -36
  112. package/dist/providers/sendgrid/provider.d.ts +0 -7
  113. package/dist/providers/sendgrid/types.d.ts +0 -76
  114. package/dist/providers/smtp/provider.d.ts +0 -7
  115. package/dist/providers/smtp/types.d.ts +0 -63
  116. package/dist/providers/sweego/provider.d.ts +0 -7
  117. package/dist/providers/sweego/types.d.ts +0 -32
  118. package/dist/providers/utils/address-formatter.d.ts +0 -139
  119. package/dist/providers/utils/attachment-processor.d.ts +0 -58
  120. package/dist/providers/utils/index.d.ts +0 -4
  121. package/dist/providers/utils/payload-builder.d.ts +0 -78
  122. package/dist/providers/utils/provider-base.d.ts +0 -69
  123. package/dist/providers/zeptomail/provider.d.ts +0 -7
  124. package/dist/providers/zeptomail/types.d.ts +0 -29
  125. package/dist/template-engines/types.d.ts +0 -8
  126. package/dist/types.d.ts +0 -203
  127. package/dist/utils/build-mime-message.d.ts +0 -8
  128. package/dist/utils/create-logger.d.ts +0 -16
  129. package/dist/utils/format-email-addresses.d.ts +0 -8
  130. package/dist/utils/generate-boundary.d.ts +0 -7
  131. package/dist/utils/generate-message-id.d.ts +0 -6
  132. package/dist/utils/headers-to-record.d.ts +0 -9
  133. package/dist/utils/is-port-available.d.ts +0 -9
  134. package/dist/utils/make-request.d.ts +0 -18
  135. package/dist/utils/retry.d.ts +0 -10
  136. package/dist/utils/sanitize-header.d.ts +0 -14
  137. package/dist/utils/to-base64.d.ts +0 -8
  138. package/dist/utils/validation/validate-email-options.d.ts +0 -8
@@ -1,27 +0,0 @@
1
- import type { EmailOptions, EmailResult, FeatureFlags, MaybePromise, Result } from "../types.d.ts";
2
- /**
3
- * Standard provider interface for email services.
4
- */
5
- export interface Provider<OptionsT = unknown, InstanceT = unknown, EmailOptionsT extends EmailOptions = EmailOptions> {
6
- endpoint?: string;
7
- features?: FeatureFlags;
8
- getEmail?: (id: string) => MaybePromise<Result>;
9
- getInstance?: () => InstanceT;
10
- initialize: (options?: Record<string, unknown>) => MaybePromise<void>;
11
- isAvailable: () => MaybePromise<boolean>;
12
- name?: string;
13
- options?: OptionsT;
14
- sendEmail: (options: EmailOptionsT) => MaybePromise<Result<EmailResult>>;
15
- shutdown?: () => MaybePromise<void>;
16
- validateCredentials?: () => MaybePromise<boolean>;
17
- }
18
- /**
19
- * Type for provider factory function.
20
- */
21
- export type ProviderFactory<OptionsT = unknown, InstanceT = unknown, EmailOptionsT extends EmailOptions = EmailOptions> = (options?: OptionsT) => Provider<OptionsT, InstanceT, EmailOptionsT>;
22
- /**
23
- * Helper function to define an email provider.
24
- * @param factory The provider factory function.
25
- * @returns The same factory function (for type inference).
26
- */
27
- export declare const defineProvider: <OptionsT = unknown, InstanceT = unknown, EmailOptionsT extends EmailOptions = EmailOptions>(factory: ProviderFactory<OptionsT, InstanceT, EmailOptionsT>) => ProviderFactory<OptionsT, InstanceT, EmailOptionsT>;
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { ResendConfig, ResendEmailOptions } from "./types.d.ts";
3
- /**
4
- * Resend Provider for sending emails through Resend API.
5
- */
6
- declare const resendProvider: ProviderFactory<ResendConfig, unknown, ResendEmailOptions>;
7
- export default resendProvider;
@@ -1,43 +0,0 @@
1
- import type { BaseConfig, EmailOptions, EmailTag } from "../../types.d.ts";
2
- /**
3
- * Resend configuration
4
- */
5
- export interface ResendConfig extends BaseConfig {
6
- apiKey: string;
7
- endpoint?: string;
8
- }
9
- /**
10
- * Resend-specific email tag type with additional constraints
11
- */
12
- export interface ResendEmailTag extends EmailTag {
13
- /**
14
- * Tag name - must only contain ASCII letters, numbers, underscores, or dashes
15
- * Max length: 256 characters
16
- */
17
- name: string;
18
- /**
19
- * Tag value - must only contain ASCII letters, numbers, underscores, or dashes
20
- */
21
- value: string;
22
- }
23
- /**
24
- * Resend-specific email options
25
- */
26
- export interface ResendEmailOptions extends Omit<EmailOptions, "tags"> {
27
- /**
28
- * Schedule email for delivery at a specific time
29
- */
30
- scheduledAt?: Date | string;
31
- /**
32
- * Tags for categorizing emails
33
- */
34
- tags?: ResendEmailTag[];
35
- /**
36
- * Template data for template-based emails
37
- */
38
- templateData?: Record<string, unknown>;
39
- /**
40
- * Template ID for template-based emails
41
- */
42
- templateId?: string;
43
- }
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { RoundRobinConfig } from "./types.d.ts";
3
- /**
4
- * Round Robin Provider for distributing email sending across multiple providers
5
- */
6
- declare const roundRobinProvider: ProviderFactory<RoundRobinConfig>;
7
- export default roundRobinProvider;
@@ -1,19 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * Round Robin configuration
4
- */
5
- export interface RoundRobinConfig extends BaseConfig {
6
- /**
7
- * Array of provider instances or provider factories to use for round-robin distribution
8
- * Can be Provider instances or ProviderFactory functions
9
- */
10
- mailers: unknown[];
11
- /**
12
- * Time in milliseconds to wait before retrying with next provider if current is unavailable (default: 60)
13
- */
14
- retryAfter?: number;
15
- }
16
- /**
17
- * Round Robin-specific email options
18
- */
19
- export type RoundRobinEmailOptions = EmailOptions;
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { ScalewayConfig } from "./types.d.ts";
3
- /**
4
- * Scaleway Provider for sending emails through Scaleway API
5
- */
6
- declare const scalewayProvider: ProviderFactory<ScalewayConfig>;
7
- export default scalewayProvider;
@@ -1,36 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * Scaleway configuration
4
- */
5
- export interface ScalewayConfig extends BaseConfig {
6
- /**
7
- * Scaleway API key
8
- */
9
- apiKey: string;
10
- /**
11
- * Scaleway API endpoint
12
- * Defaults to: https://api.scaleway.com/transactional-email/v1alpha1
13
- */
14
- endpoint?: string;
15
- /**
16
- * Scaleway region (e.g., "fr-par", "nl-ams")
17
- */
18
- region: string;
19
- }
20
- /**
21
- * Scaleway-specific email options
22
- */
23
- export interface ScalewayEmailOptions extends EmailOptions {
24
- /**
25
- * Project ID (optional)
26
- */
27
- projectId?: string;
28
- /**
29
- * Scaleway template ID for template-based emails
30
- */
31
- templateId?: string;
32
- /**
33
- * Template variables for Scaleway templates
34
- */
35
- templateVariables?: Record<string, unknown>;
36
- }
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { SendGridConfig } from "./types.d.ts";
3
- /**
4
- * SendGrid Provider for sending emails through SendGrid API
5
- */
6
- declare const sendGridProvider: ProviderFactory<SendGridConfig>;
7
- export default sendGridProvider;
@@ -1,76 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * SendGrid configuration
4
- */
5
- export interface SendGridConfig extends BaseConfig {
6
- apiKey: string;
7
- endpoint?: string;
8
- }
9
- /**
10
- * SendGrid-specific email options
11
- */
12
- export interface SendGridEmailOptions extends EmailOptions {
13
- /**
14
- * ASM (Advanced Suppression Management) group ID for unsubscribe
15
- */
16
- asmGroupId?: number;
17
- /**
18
- * Batch ID for batch sending
19
- */
20
- batchId?: string;
21
- /**
22
- * IP pool name
23
- */
24
- ipPoolName?: string;
25
- /**
26
- * Mail settings (click tracking, open tracking, etc.)
27
- */
28
- mailSettings?: {
29
- bypassListManagement?: boolean;
30
- footer?: {
31
- enable?: boolean;
32
- html?: string;
33
- text?: string;
34
- };
35
- sandboxMode?: boolean;
36
- };
37
- /**
38
- * Send at timestamp (Unix timestamp)
39
- */
40
- sendAt?: number;
41
- /**
42
- * Dynamic template data for SendGrid dynamic templates
43
- */
44
- templateData?: Record<string, unknown>;
45
- /**
46
- * SendGrid template ID for template-based emails
47
- */
48
- templateId?: string;
49
- /**
50
- * Tracking settings
51
- */
52
- trackingSettings?: {
53
- clickTracking?: {
54
- enable?: boolean;
55
- enableText?: boolean;
56
- };
57
- ganalytics?: {
58
- enable?: boolean;
59
- utmCampaign?: string;
60
- utmContent?: string;
61
- utmMedium?: string;
62
- utmSource?: string;
63
- utmTerm?: string;
64
- };
65
- openTracking?: {
66
- enable?: boolean;
67
- substitutionTag?: string;
68
- };
69
- subscriptionTracking?: {
70
- enable?: boolean;
71
- html?: string;
72
- substitutionTag?: string;
73
- text?: string;
74
- };
75
- };
76
- }
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { SmtpConfig } from "./types.d.ts";
3
- /**
4
- * SMTP provider for sending emails via SMTP protocol
5
- */
6
- declare const smtpProvider: ProviderFactory<SmtpConfig>;
7
- export default smtpProvider;
@@ -1,63 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * SMTP configuration
4
- */
5
- export interface SmtpConfig extends BaseConfig {
6
- authMethod?: "LOGIN" | "PLAIN" | "CRAM-MD5" | "OAUTH2";
7
- dkim?: {
8
- domainName: string;
9
- keySelector: string;
10
- privateKey: string;
11
- };
12
- host: string;
13
- maxConnections?: number;
14
- oauth2?: {
15
- accessToken?: string;
16
- clientId: string;
17
- clientSecret: string;
18
- expires?: number;
19
- refreshToken: string;
20
- user: string;
21
- };
22
- password?: string;
23
- pool?: boolean;
24
- port: number;
25
- rejectUnauthorized?: boolean;
26
- secure?: boolean;
27
- user?: string;
28
- }
29
- /**
30
- * SMTP-specific email options
31
- */
32
- export interface SmtpEmailOptions extends EmailOptions {
33
- /**
34
- * Delivery Status Notification options
35
- */
36
- dsn?: {
37
- /** Request notification on delay */
38
- delay?: boolean;
39
- /** Request notification on failure */
40
- failure?: boolean;
41
- /** Request successful delivery notification */
42
- success?: boolean;
43
- };
44
- /** Special Google Mail headers */
45
- googleMailHeaders?: {
46
- /** Category for email organization */
47
- category?: "primary" | "social" | "promotions" | "updates" | "forums";
48
- /** Feedback ID for engagement tracking */
49
- feedbackId?: string;
50
- /** Mark as promotional content */
51
- promotionalContent?: boolean;
52
- };
53
- /** Reference to a previous message ID (for threading) */
54
- inReplyTo?: string;
55
- /** List-Unsubscribe header for easy unsubscribe functionality */
56
- listUnsubscribe?: string | string[];
57
- /** Message priority: 'high', 'normal', or 'low' */
58
- priority?: "high" | "normal" | "low";
59
- /** References to related message IDs */
60
- references?: string | string[];
61
- /** Whether to sign the email with DKIM */
62
- useDkim?: boolean;
63
- }
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { SweegoConfig } from "./types.d.ts";
3
- /**
4
- * Sweego Provider for sending emails through Sweego API
5
- */
6
- declare const sweegoProvider: ProviderFactory<SweegoConfig>;
7
- export default sweegoProvider;
@@ -1,32 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * Sweego configuration
4
- */
5
- export interface SweegoConfig extends BaseConfig {
6
- /**
7
- * Sweego API key
8
- */
9
- apiKey: string;
10
- /**
11
- * Sweego API endpoint
12
- * Defaults to: https://api.sweego.com
13
- */
14
- endpoint?: string;
15
- }
16
- /**
17
- * Sweego-specific email options
18
- */
19
- export interface SweegoEmailOptions extends EmailOptions {
20
- /**
21
- * Tags for categorization
22
- */
23
- tags?: string[];
24
- /**
25
- * Sweego template ID for template-based emails
26
- */
27
- templateId?: string;
28
- /**
29
- * Template variables for Sweego templates
30
- */
31
- templateVariables?: Record<string, unknown>;
32
- }
@@ -1,139 +0,0 @@
1
- import type { EmailAddress } from "../../types.d.ts";
2
- /**
3
- * Formats a single email address as "Name &lt;email>" or just "email" if no name is provided.
4
- * @param address The email address object to format.
5
- * @returns The formatted email address string.
6
- */
7
- export declare const formatAddress: (address: EmailAddress) => string;
8
- /**
9
- * Formats an array of email addresses or a single address as "Name &lt;email>" format.
10
- * @param addresses The email address(es) to format (single or array).
11
- * @returns An array of formatted email address strings.
12
- */
13
- export declare const formatAddresses: (addresses: EmailAddress | EmailAddress[]) => string[];
14
- /**
15
- * Formats a single email address for SendGrid API format.
16
- * @param address The email address object to format.
17
- * @returns An object with email and optional name properties.
18
- */
19
- export declare const formatSendGridAddress: (address: EmailAddress) => {
20
- email: string;
21
- name?: string;
22
- };
23
- /**
24
- * Formats email addresses for SendGrid API format.
25
- * @param addresses The email address(es) to format (single or array).
26
- * @returns An array of objects with email and optional name properties.
27
- */
28
- export declare const formatSendGridAddresses: (addresses: EmailAddress | EmailAddress[]) => {
29
- email: string;
30
- name?: string;
31
- }[];
32
- /**
33
- * Formats email addresses as a simple string array containing only email addresses.
34
- * @param addresses The email address(es) to format (single or array).
35
- * @returns An array of email address strings.
36
- */
37
- export declare const formatAddressEmails: (addresses: EmailAddress | EmailAddress[]) => string[];
38
- /**
39
- * Formats an email address for Azure API format.
40
- * @param address The email address object to format.
41
- * @returns An object with email and optional displayName properties.
42
- */
43
- export declare const formatAzureAddress: (address: EmailAddress) => {
44
- displayName?: string;
45
- email: string;
46
- };
47
- /**
48
- * Formats email addresses for Azure API format.
49
- * @param addresses The email address(es) to format (single or array).
50
- * @returns An array of objects with email and optional displayName properties.
51
- */
52
- export declare const formatAzureAddresses: (addresses: EmailAddress | EmailAddress[]) => {
53
- displayName?: string;
54
- email: string;
55
- }[];
56
- /**
57
- * Formats an email address for Mailjet API format.
58
- * @param address The email address object to format.
59
- * @returns An object with Email and optional Name properties.
60
- */
61
- export declare const formatMailjetAddress: (address: EmailAddress) => {
62
- Email: string;
63
- Name?: string;
64
- };
65
- /**
66
- * Formats email addresses for Mailjet API format.
67
- * @param addresses The email address(es) to format (single or array).
68
- * @returns An array of objects with Email and optional Name properties.
69
- */
70
- export declare const formatMailjetAddresses: (addresses: EmailAddress | EmailAddress[]) => {
71
- Email: string;
72
- Name?: string;
73
- }[];
74
- /**
75
- * Formats an email address for Mandrill API format.
76
- * @param address The email address object to format.
77
- * @param type The recipient type (default: "to").
78
- * @returns An object with email, optional name, and type properties.
79
- */
80
- export declare const formatMandrillAddress: (address: EmailAddress, type?: string) => {
81
- email: string;
82
- name?: string;
83
- type: string;
84
- };
85
- /**
86
- * Formats email addresses for Mandrill API format.
87
- * @param addresses The email address(es) to format (single or array).
88
- * @param type The recipient type (default: "to").
89
- * @returns An array of objects with email, optional name, and type properties.
90
- */
91
- export declare const formatMandrillAddresses: (addresses: EmailAddress | EmailAddress[], type?: string) => {
92
- email: string;
93
- name?: string;
94
- type: string;
95
- }[];
96
- /**
97
- * Formats an email address for Postal API format.
98
- * @param address The email address object to format.
99
- * @returns An object with address and optional name properties.
100
- */
101
- export declare const formatPostalAddress: (address: EmailAddress) => {
102
- address: string;
103
- name?: string;
104
- };
105
- /**
106
- * Formats email addresses for Postal API format.
107
- * @param addresses The email address(es) to format (single or array).
108
- * @returns An array of objects with address and optional name properties.
109
- */
110
- export declare const formatPostalAddresses: (addresses: EmailAddress | EmailAddress[]) => {
111
- address: string;
112
- name?: string;
113
- }[];
114
- /**
115
- * Formats email addresses for MailPace API format as formatted strings.
116
- * @param addresses The email address(es) to format (single or array).
117
- * @returns An array of formatted email address strings.
118
- */
119
- export declare const formatMailpaceAddresses: (addresses: EmailAddress | EmailAddress[]) => string[];
120
- /**
121
- * Formats an email address for Zeptomail API format.
122
- * @param address The email address object to format.
123
- * @returns An object with address and optional name properties.
124
- */
125
- export declare const formatZeptomailAddress: (address: EmailAddress) => {
126
- address: string;
127
- name?: string;
128
- };
129
- /**
130
- * Formats email addresses for Zeptomail API format.
131
- * @param addresses The email address(es) to format (single or array).
132
- * @returns An array of objects with email_address containing address and optional name properties.
133
- */
134
- export declare const formatZeptomailAddresses: (addresses: EmailAddress | EmailAddress[]) => {
135
- email_address: {
136
- address: string;
137
- name?: string;
138
- };
139
- }[];
@@ -1,58 +0,0 @@
1
- import type { Attachment } from "../../types.d.ts";
2
- /**
3
- * Processes attachment content and converts it to a base64-encoded string.
4
- * @param attachment The attachment object to process.
5
- * @param providerName The name of the provider (for error messages).
6
- * @returns The base64-encoded string representation of the attachment content.
7
- * @throws {EmailError} When the attachment has no content.
8
- */
9
- export declare const processAttachmentContent: (attachment: Attachment, providerName: string) => Promise<string>;
10
- /**
11
- * Creates a standardized attachment object for API payloads.
12
- * @param attachment The attachment object to standardize.
13
- * @param providerName The name of the provider (for error messages).
14
- * @returns A standardized attachment object with content, contentType, disposition, filename, and optional contentId.
15
- */
16
- export declare const createStandardAttachment: (attachment: Attachment, providerName: string) => Promise<{
17
- content: string;
18
- contentId?: string;
19
- contentType: string;
20
- disposition: string;
21
- filename: string;
22
- }>;
23
- /**
24
- * Creates a SendGrid-specific attachment format.
25
- * @param attachment The attachment object to format.
26
- * @param providerName The name of the provider (for error messages).
27
- * @returns A SendGrid-formatted attachment object with content, type, disposition, filename, and optional content_id.
28
- */
29
- export declare const createSendGridAttachment: (attachment: Attachment, providerName: string) => Promise<{
30
- content: string;
31
- content_id?: string;
32
- disposition: string;
33
- filename: string;
34
- type: string;
35
- }>;
36
- /**
37
- * Creates a Postmark-specific attachment format.
38
- * @param attachment The attachment object to format.
39
- * @param providerName The name of the provider (for error messages).
40
- * @returns A Postmark-formatted attachment object with Content, ContentType, Name, and optional ContentID.
41
- */
42
- export declare const createPostmarkAttachment: (attachment: Attachment, providerName: string) => Promise<{
43
- Content: string;
44
- ContentID?: string;
45
- ContentType: string;
46
- Name: string;
47
- }>;
48
- /**
49
- * Creates a Mailgun-specific attachment format for form data.
50
- * @param attachment The attachment object to format.
51
- * @param providerName The name of the provider (for error messages).
52
- * @param index The index of the attachment in the attachments array.
53
- * @returns A Mailgun-formatted attachment object with content and key properties.
54
- */
55
- export declare const createMailgunAttachment: (attachment: Attachment, providerName: string, index: number) => Promise<{
56
- content: string;
57
- key: string;
58
- }>;
@@ -1,4 +0,0 @@
1
- export * from "./address-formatter.d.ts";
2
- export * from "./attachment-processor.d.ts";
3
- export * from "./payload-builder.d.ts";
4
- export * from "./provider-base.d.ts";
@@ -1,78 +0,0 @@
1
- import type { EmailAddress, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * Common payload building utilities for email providers
4
- */
5
- export declare class PayloadBuilder {
6
- private payload;
7
- constructor(initialPayload?: Record<string, unknown>);
8
- /**
9
- * Sets a field in the payload.
10
- * @param key The field key to set.
11
- * @param value The field value to set (undefined and null values are ignored).
12
- * @returns This instance for method chaining.
13
- */
14
- set(key: string, value: unknown): this;
15
- /**
16
- * Sets multiple fields conditionally in the payload.
17
- * @param fields An object containing key-value pairs to set.
18
- * @returns This instance for method chaining.
19
- */
20
- setMultiple(fields: Record<string, unknown>): this;
21
- /**
22
- * Adds recipients (to, cc, bcc) to the payload using a formatter function.
23
- * @param emailOptions The email options containing recipient addresses.
24
- * @param formatter A function to format the addresses for the specific provider.
25
- * @returns This instance for method chaining.
26
- */
27
- addRecipients(emailOptions: EmailOptions, formatter: (addresses: EmailAddress | EmailAddress[]) => unknown): this;
28
- /**
29
- * Adds standard email fields (subject, html, text, replyTo) to the payload.
30
- * @param emailOptions The email options containing the standard fields.
31
- * @returns This instance for method chaining.
32
- */
33
- addStandardFields(emailOptions: EmailOptions): this;
34
- /**
35
- * Adds template-related fields to the payload.
36
- * @param emailOptions The email options containing template information.
37
- * @param templateKey The key name to use for the template ID (default: "template_id").
38
- * @returns This instance for method chaining.
39
- */
40
- addTemplateFields(emailOptions: EmailOptions, templateKey?: string): this;
41
- /**
42
- * Adds scheduling fields to the payload for delayed sending.
43
- * @param emailOptions The email options containing scheduling information.
44
- * @returns This instance for method chaining.
45
- */
46
- addSchedulingFields(emailOptions: EmailOptions): this;
47
- /**
48
- * Adds tags to the payload for email categorization.
49
- * @param emailOptions The email options containing tags.
50
- * @param formatter An optional function to format tags for the specific provider.
51
- * @returns This instance for method chaining.
52
- */
53
- addTags(emailOptions: EmailOptions, formatter?: (tags: unknown[]) => unknown): this;
54
- /**
55
- * Adds custom headers to the payload.
56
- * @param emailOptions The email options containing custom headers.
57
- * @param formatter An optional function to format headers for the specific provider.
58
- * @returns This instance for method chaining.
59
- */
60
- addHeaders(emailOptions: EmailOptions, formatter?: (headers: Record<string, string>) => unknown): this;
61
- /**
62
- * Adds a batch ID to the payload for batch email operations.
63
- * @param emailOptions The email options containing the batch ID.
64
- * @returns This instance for method chaining.
65
- */
66
- addBatchId(emailOptions: EmailOptions): this;
67
- /**
68
- * Builds and returns the final payload object.
69
- * @returns The complete payload object ready for API submission.
70
- */
71
- build(): Record<string, unknown>;
72
- }
73
- /**
74
- * Creates a new payload builder instance.
75
- * @param initialPayload Optional initial payload object to start with.
76
- * @returns A new PayloadBuilder instance.
77
- */
78
- export declare const createPayloadBuilder: (initialPayload?: Record<string, unknown>) => PayloadBuilder;