hazo_notify 1.0.0 → 1.0.1

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 (108) hide show
  1. package/dist/lib/emailer/emailer.d.ts +19 -0
  2. package/dist/lib/emailer/emailer.d.ts.map +1 -0
  3. package/dist/lib/emailer/emailer.js +220 -0
  4. package/dist/lib/emailer/emailer.js.map +1 -0
  5. package/{src/lib/emailer/index.ts → dist/lib/emailer/index.d.ts} +1 -1
  6. package/dist/lib/emailer/index.d.ts.map +1 -0
  7. package/dist/lib/emailer/index.js +34 -0
  8. package/dist/lib/emailer/index.js.map +1 -0
  9. package/dist/lib/emailer/providers/index.d.ts +15 -0
  10. package/dist/lib/emailer/providers/index.d.ts.map +1 -0
  11. package/dist/lib/emailer/providers/index.js +36 -0
  12. package/dist/lib/emailer/providers/index.js.map +1 -0
  13. package/dist/lib/emailer/providers/pop3_provider.d.ts +15 -0
  14. package/dist/lib/emailer/providers/pop3_provider.d.ts.map +1 -0
  15. package/dist/lib/emailer/providers/pop3_provider.js +29 -0
  16. package/dist/lib/emailer/providers/pop3_provider.js.map +1 -0
  17. package/dist/lib/emailer/providers/smtp_provider.d.ts +15 -0
  18. package/dist/lib/emailer/providers/smtp_provider.d.ts.map +1 -0
  19. package/dist/lib/emailer/providers/smtp_provider.js +29 -0
  20. package/dist/lib/emailer/providers/smtp_provider.js.map +1 -0
  21. package/dist/lib/emailer/providers/zeptomail_provider.d.ts +15 -0
  22. package/dist/lib/emailer/providers/zeptomail_provider.d.ts.map +1 -0
  23. package/dist/lib/emailer/providers/zeptomail_provider.js +250 -0
  24. package/dist/lib/emailer/providers/zeptomail_provider.js.map +1 -0
  25. package/dist/lib/emailer/types.d.ts +94 -0
  26. package/dist/lib/emailer/types.d.ts.map +1 -0
  27. package/dist/lib/emailer/types.js +6 -0
  28. package/dist/lib/emailer/types.js.map +1 -0
  29. package/dist/lib/emailer/utils/constants.d.ts +14 -0
  30. package/dist/lib/emailer/utils/constants.d.ts.map +1 -0
  31. package/dist/lib/emailer/utils/constants.js +22 -0
  32. package/dist/lib/emailer/utils/constants.js.map +1 -0
  33. package/{src/lib/emailer/utils/index.ts → dist/lib/emailer/utils/index.d.ts} +1 -2
  34. package/dist/lib/emailer/utils/index.d.ts.map +1 -0
  35. package/dist/lib/emailer/utils/index.js +24 -0
  36. package/dist/lib/emailer/utils/index.js.map +1 -0
  37. package/dist/lib/emailer/utils/logger.d.ts +37 -0
  38. package/dist/lib/emailer/utils/logger.d.ts.map +1 -0
  39. package/dist/lib/emailer/utils/logger.js +60 -0
  40. package/dist/lib/emailer/utils/logger.js.map +1 -0
  41. package/dist/lib/emailer/utils/validation.d.ts +37 -0
  42. package/dist/lib/emailer/utils/validation.d.ts.map +1 -0
  43. package/dist/lib/emailer/utils/validation.js +81 -0
  44. package/dist/lib/emailer/utils/validation.js.map +1 -0
  45. package/{src/lib/index.ts → dist/lib/index.d.ts} +1 -1
  46. package/dist/lib/index.d.ts.map +1 -0
  47. package/dist/lib/index.js +22 -0
  48. package/dist/lib/index.js.map +1 -0
  49. package/dist/lib/utils.d.ts +3 -0
  50. package/dist/lib/utils.d.ts.map +1 -0
  51. package/dist/lib/utils.js +9 -0
  52. package/dist/lib/utils.js.map +1 -0
  53. package/package.json +21 -7
  54. package/.cursor/rules/db_schema.mdc +0 -0
  55. package/.cursor/rules/design.mdc +0 -16
  56. package/.cursor/rules/general.mdc +0 -49
  57. package/components/emailer-html-editor.tsx +0 -94
  58. package/components/ui/button.tsx +0 -53
  59. package/components/ui/card.tsx +0 -78
  60. package/components/ui/input.tsx +0 -24
  61. package/components/ui/label.tsx +0 -21
  62. package/components/ui/sidebar.tsx +0 -121
  63. package/components/ui/spinner.tsx +0 -54
  64. package/components/ui/textarea.tsx +0 -23
  65. package/components/ui/tooltip.tsx +0 -30
  66. package/components.json +0 -20
  67. package/jest.config.js +0 -27
  68. package/jest.setup.js +0 -1
  69. package/next.config.js +0 -22
  70. package/postcss.config.js +0 -6
  71. package/src/app/api/hazo_notify/emailer/send/__tests__/route.test.ts +0 -227
  72. package/src/app/api/hazo_notify/emailer/send/route.ts +0 -537
  73. package/src/app/editor-00/page.tsx +0 -47
  74. package/src/app/globals.css +0 -69
  75. package/src/app/hazo_notify/emailer_test/layout.tsx +0 -53
  76. package/src/app/hazo_notify/emailer_test/page.tsx +0 -369
  77. package/src/app/hazo_notify/layout.tsx +0 -77
  78. package/src/app/hazo_notify/page.tsx +0 -12
  79. package/src/app/layout.tsx +0 -26
  80. package/src/app/page.tsx +0 -14
  81. package/src/components/blocks/editor-00/editor.tsx +0 -61
  82. package/src/components/blocks/editor-00/nodes.ts +0 -11
  83. package/src/components/blocks/editor-00/plugins.tsx +0 -36
  84. package/src/components/editor/editor-ui/content-editable.tsx +0 -34
  85. package/src/components/editor/themes/editor-theme.css +0 -91
  86. package/src/components/editor/themes/editor-theme.ts +0 -130
  87. package/src/components/ui/button.tsx +0 -53
  88. package/src/components/ui/card.tsx +0 -78
  89. package/src/components/ui/input.tsx +0 -24
  90. package/src/components/ui/label.tsx +0 -21
  91. package/src/components/ui/sidebar.tsx +0 -121
  92. package/src/components/ui/spinner.tsx +0 -54
  93. package/src/components/ui/textarea.tsx +0 -23
  94. package/src/components/ui/tooltip.tsx +0 -30
  95. package/src/lib/emailer/__tests__/emailer.test.ts +0 -200
  96. package/src/lib/emailer/emailer.ts +0 -263
  97. package/src/lib/emailer/providers/__tests__/zeptomail_provider.test.ts +0 -196
  98. package/src/lib/emailer/providers/index.ts +0 -33
  99. package/src/lib/emailer/providers/pop3_provider.ts +0 -30
  100. package/src/lib/emailer/providers/smtp_provider.ts +0 -30
  101. package/src/lib/emailer/providers/zeptomail_provider.ts +0 -299
  102. package/src/lib/emailer/types.ts +0 -119
  103. package/src/lib/emailer/utils/constants.ts +0 -24
  104. package/src/lib/emailer/utils/logger.ts +0 -71
  105. package/src/lib/emailer/utils/validation.ts +0 -84
  106. package/src/lib/utils.ts +0 -6
  107. package/tailwind.config.ts +0 -65
  108. package/tsconfig.json +0 -27
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ /**
3
+ * Zeptomail API provider implementation
4
+ * Sends emails using the Zeptomail API
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ZeptomailProvider = void 0;
11
+ const validation_1 = require("../utils/validation");
12
+ const logger_1 = require("../utils/logger");
13
+ const isomorphic_dompurify_1 = __importDefault(require("isomorphic-dompurify"));
14
+ const constants_1 = require("../utils/constants");
15
+ class ZeptomailProvider {
16
+ /**
17
+ * Send email using Zeptomail API
18
+ * @param options - Email send options
19
+ * @param config - Emailer configuration
20
+ * @returns Promise with email send response
21
+ */
22
+ async send_email(options, config) {
23
+ const filename = 'zeptomail_provider.ts';
24
+ const function_name = 'send_email';
25
+ try {
26
+ // Validate required configuration
27
+ if (!config.zeptomail_api_endpoint) {
28
+ throw new Error('Zeptomail API endpoint is required');
29
+ }
30
+ if (!config.zeptomail_api_key) {
31
+ throw new Error('Zeptomail API key is required');
32
+ }
33
+ // Prepare recipient array
34
+ const to_emails = Array.isArray(options.to) ? options.to : [options.to];
35
+ const cc_emails = options.cc ? (Array.isArray(options.cc) ? options.cc : [options.cc]) : [];
36
+ const bcc_emails = options.bcc ? (Array.isArray(options.bcc) ? options.bcc : [options.bcc]) : [];
37
+ // Prepare email data according to Zeptomail API format
38
+ const email_data = {
39
+ from: {
40
+ address: options.from || config.from_email,
41
+ name: (0, validation_1.sanitize_email_header)(options.from_name || config.from_name || 'Hazo Notify'),
42
+ },
43
+ to: to_emails.map((email) => ({
44
+ email_address: {
45
+ address: email,
46
+ },
47
+ })),
48
+ subject: (0, validation_1.sanitize_email_header)(options.subject),
49
+ };
50
+ // Add content (text and/or html)
51
+ if (options.content.text) {
52
+ email_data.textbody = options.content.text;
53
+ }
54
+ if (options.content.html) {
55
+ // Sanitize HTML content to prevent XSS attacks
56
+ email_data.htmlbody = isomorphic_dompurify_1.default.sanitize(options.content.html);
57
+ }
58
+ // Add reply-to if specified
59
+ if (options.reply_to || config.reply_to_email) {
60
+ email_data.reply_to = [
61
+ {
62
+ address: (0, validation_1.sanitize_email_header)(options.reply_to || config.reply_to_email || ''),
63
+ },
64
+ ];
65
+ }
66
+ // Add CC if specified
67
+ if (cc_emails.length > 0) {
68
+ email_data.cc = cc_emails.map((email) => ({
69
+ email_address: {
70
+ address: email,
71
+ },
72
+ }));
73
+ }
74
+ // Add BCC if specified
75
+ if (bcc_emails.length > 0) {
76
+ email_data.bcc = bcc_emails.map((email) => ({
77
+ email_address: {
78
+ address: email,
79
+ },
80
+ }));
81
+ }
82
+ // Add attachments if specified
83
+ if (options.attachments && options.attachments.length > 0) {
84
+ email_data.attachments = options.attachments.map((attachment) => ({
85
+ name: attachment.filename,
86
+ content: attachment.content,
87
+ mime_type: attachment.mime_type,
88
+ }));
89
+ }
90
+ // Prepare request headers
91
+ // Handle API key - it may already include the "Zoho-enczapikey" prefix or just be the key
92
+ const api_key = config.zeptomail_api_key.trim();
93
+ const auth_header = api_key.startsWith('Zoho-enczapikey')
94
+ ? api_key
95
+ : `Zoho-enczapikey ${api_key}`;
96
+ const headers = {
97
+ 'Accept': 'application/json',
98
+ 'Content-Type': 'application/json',
99
+ 'Authorization': auth_header,
100
+ };
101
+ // Log request for debugging (mask API key in logs)
102
+ (0, logger_1.log_info)((0, logger_1.create_log_entry)(filename, function_name, 'Sending email via Zeptomail API', {
103
+ endpoint: config.zeptomail_api_endpoint,
104
+ method: 'POST',
105
+ headers: {
106
+ ...headers,
107
+ Authorization: headers.Authorization ? 'Zoho-enczapikey ***' : undefined, // Mask API key
108
+ },
109
+ body: {
110
+ from: email_data.from,
111
+ to_count: email_data.to.length,
112
+ subject: email_data.subject,
113
+ has_text: !!email_data.textbody,
114
+ has_html: !!email_data.htmlbody,
115
+ attachments_count: email_data.attachments?.length || 0,
116
+ },
117
+ }));
118
+ // Set up request timeout
119
+ const timeout = config.request_timeout || constants_1.DEFAULT_REQUEST_TIMEOUT;
120
+ const controller = new AbortController();
121
+ const timeout_id = setTimeout(() => controller.abort(), timeout);
122
+ try {
123
+ // Make API request
124
+ const response = await fetch(config.zeptomail_api_endpoint, {
125
+ method: 'POST',
126
+ headers: headers,
127
+ body: JSON.stringify(email_data),
128
+ signal: controller.signal,
129
+ });
130
+ clearTimeout(timeout_id);
131
+ // Parse response (handle both JSON and text responses)
132
+ let response_data;
133
+ const content_type = response.headers.get('content-type') || '';
134
+ // Get response text first for better error handling
135
+ const response_text = await response.text();
136
+ if (content_type.includes('application/json')) {
137
+ try {
138
+ response_data = JSON.parse(response_text);
139
+ }
140
+ catch (e) {
141
+ response_data = { error: 'Failed to parse JSON response', raw: response_text };
142
+ }
143
+ }
144
+ else {
145
+ // For HTML/text responses, try to extract error information
146
+ response_data = {
147
+ text: response_text,
148
+ error: response_text.trim() || 'Unknown error from server'
149
+ };
150
+ // Log the full response for debugging
151
+ (0, logger_1.log_error)((0, logger_1.create_log_entry)(filename, function_name, 'Zeptomail API returned non-JSON response', {
152
+ status: response.status,
153
+ statusText: response.statusText,
154
+ contentType: content_type,
155
+ body: response_text,
156
+ headers: Object.fromEntries(response.headers.entries()),
157
+ }));
158
+ }
159
+ const raw_response = {
160
+ status: response.status,
161
+ status_text: response.statusText,
162
+ headers: Object.fromEntries(response.headers.entries()),
163
+ body: response_data,
164
+ };
165
+ // Check if request was successful
166
+ if (!response.ok) {
167
+ const response_obj = typeof response_data === 'object' ? response_data : {};
168
+ const error_message = response_obj.message ||
169
+ response_obj.error ||
170
+ (typeof response_data === 'string' ? response_data : '') ||
171
+ `HTTP ${response.status}: ${response.statusText}`;
172
+ // Enhanced error logging
173
+ (0, logger_1.log_error)((0, logger_1.create_log_entry)(filename, function_name, 'Zeptomail API error', {
174
+ status: response.status,
175
+ error_message,
176
+ response_body: response_data,
177
+ }));
178
+ const is_production = process.env.NODE_ENV === 'production';
179
+ return {
180
+ success: false,
181
+ error: error_message,
182
+ raw_response: is_production ? { status: response.status, status_text: response.statusText } : raw_response,
183
+ message: error_message,
184
+ };
185
+ }
186
+ // Return successful response
187
+ const response_obj = typeof response_data === 'object' ? response_data : {};
188
+ const data = response_obj.data;
189
+ return {
190
+ success: true,
191
+ message_id: data?.message_id || response_obj.message_id || undefined,
192
+ message: 'Email sent successfully',
193
+ raw_response: raw_response,
194
+ };
195
+ }
196
+ catch (fetch_error) {
197
+ clearTimeout(timeout_id);
198
+ // Handle timeout errors
199
+ if (fetch_error instanceof Error && fetch_error.name === 'AbortError') {
200
+ const timeout_error = `Request timeout after ${timeout}ms`;
201
+ (0, logger_1.log_error)((0, logger_1.create_log_entry)(filename, function_name, timeout_error, {
202
+ options: {
203
+ to: options.to,
204
+ subject: options.subject,
205
+ has_text: !!options.content.text,
206
+ has_html: !!options.content.html,
207
+ attachments_count: options.attachments?.length || 0,
208
+ },
209
+ }));
210
+ return {
211
+ success: false,
212
+ error: timeout_error,
213
+ message: timeout_error,
214
+ raw_response: undefined,
215
+ };
216
+ }
217
+ // Re-throw to be caught by outer catch
218
+ throw fetch_error;
219
+ }
220
+ }
221
+ catch (error) {
222
+ const error_message = error instanceof Error ? error.message : 'Unknown error occurred';
223
+ const error_string = error instanceof Error ? error.toString() : String(error);
224
+ const stack = error instanceof Error ? error.stack : undefined;
225
+ const is_production = process.env.NODE_ENV === 'production';
226
+ (0, logger_1.log_error)((0, logger_1.create_log_entry)(filename, function_name, error_message, {
227
+ line_number: stack || 'unknown',
228
+ error: error_string,
229
+ options: {
230
+ to: options.to,
231
+ subject: options.subject,
232
+ has_text: !!options.content.text,
233
+ has_html: !!options.content.html,
234
+ attachments_count: options.attachments?.length || 0,
235
+ },
236
+ }));
237
+ return {
238
+ success: false,
239
+ error: error_message,
240
+ message: error_message,
241
+ raw_response: is_production ? undefined : {
242
+ error: error_string,
243
+ stack: stack,
244
+ },
245
+ };
246
+ }
247
+ }
248
+ }
249
+ exports.ZeptomailProvider = ZeptomailProvider;
250
+ //# sourceMappingURL=zeptomail_provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zeptomail_provider.js","sourceRoot":"","sources":["../../../../src/lib/emailer/providers/zeptomail_provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAGH,oDAA4D;AAC5D,4CAAwE;AACxE,gFAA6C;AAC7C,kDAA6D;AAE7D,MAAa,iBAAiB;IAC5B;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CACd,OAAyB,EACzB,MAAqB;QAErB,MAAM,QAAQ,GAAG,uBAAuB,CAAC;QACzC,MAAM,aAAa,GAAG,YAAY,CAAC;QAEnC,IAAI,CAAC;YACH,kCAAkC;YAClC,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YACxD,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;YAED,0BAA0B;YAC1B,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACxE,MAAM,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5F,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,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QAAQ,EACR,aAAa,EACb,aAAa,EACb;gBACE,WAAW,EAAE,KAAK,IAAI,SAAS;gBAC/B,KAAK,EAAE,YAAY;gBACnB,OAAO,EAAE;oBACP,EAAE,EAAE,OAAO,CAAC,EAAE;oBACd,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI;oBAChC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI;oBAChC,iBAAiB,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC;iBACpD;aACF,CACF,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,aAAa;gBACpB,OAAO,EAAE,aAAa;gBACtB,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;oBACxC,KAAK,EAAE,YAAY;oBACnB,KAAK,EAAE,KAAK;iBACb;aACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA/RD,8CA+RC"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Type definitions for the emailer service
3
+ */
4
+ export type EmailerModule = 'zeptoemail_api' | 'smtp' | 'pop3';
5
+ export interface EmailContent {
6
+ text?: string;
7
+ html?: string;
8
+ }
9
+ export interface EmailAttachment {
10
+ filename: string;
11
+ content: string;
12
+ mime_type: string;
13
+ }
14
+ export interface SendEmailOptions {
15
+ to: string | string[];
16
+ subject: string;
17
+ content: EmailContent;
18
+ attachments?: EmailAttachment[];
19
+ from?: string;
20
+ from_name?: string;
21
+ reply_to?: string;
22
+ cc?: string | string[];
23
+ bcc?: string | string[];
24
+ }
25
+ export interface EmailerConfig {
26
+ emailer_module: EmailerModule;
27
+ zeptomail_api_endpoint?: string;
28
+ zeptomail_api_key?: string;
29
+ from_email: string;
30
+ from_name: string;
31
+ reply_to_email?: string;
32
+ bounce_email?: string;
33
+ return_path_email?: string;
34
+ rate_limit_requests?: number;
35
+ rate_limit_window?: number;
36
+ max_attachment_size?: number;
37
+ max_attachments?: number;
38
+ request_timeout?: number;
39
+ max_subject_length?: number;
40
+ max_body_length?: number;
41
+ cors_allowed_origins?: string;
42
+ smtp_host?: string;
43
+ smtp_port?: number;
44
+ smtp_secure?: boolean;
45
+ smtp_auth_user?: string;
46
+ smtp_auth_pass?: string;
47
+ smtp_timeout?: number;
48
+ smtp_pool?: boolean;
49
+ pop3_host?: string;
50
+ pop3_port?: number;
51
+ pop3_secure?: boolean;
52
+ pop3_auth_user?: string;
53
+ pop3_auth_pass?: string;
54
+ pop3_timeout?: number;
55
+ }
56
+ export interface EmailSendResponse {
57
+ success: boolean;
58
+ message_id?: string;
59
+ message?: string;
60
+ raw_response?: Record<string, unknown> | string;
61
+ error?: string;
62
+ }
63
+ export interface ZeptomailEmailAddress {
64
+ address: string;
65
+ name?: string;
66
+ }
67
+ export interface ZeptomailEmailAddressObject {
68
+ email_address: ZeptomailEmailAddress;
69
+ }
70
+ export interface ZeptomailAttachment {
71
+ name: string;
72
+ content: string;
73
+ mime_type: string;
74
+ }
75
+ export interface ZeptomailEmailData {
76
+ from: {
77
+ address: string;
78
+ name: string;
79
+ };
80
+ to: ZeptomailEmailAddressObject[];
81
+ subject: string;
82
+ textbody?: string;
83
+ htmlbody?: string;
84
+ reply_to?: Array<{
85
+ address: string;
86
+ }>;
87
+ cc?: ZeptomailEmailAddressObject[];
88
+ bcc?: ZeptomailEmailAddressObject[];
89
+ attachments?: ZeptomailAttachment[];
90
+ }
91
+ export interface EmailProvider {
92
+ send_email(options: SendEmailOptions, config: EmailerConfig): Promise<EmailSendResponse>;
93
+ }
94
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/emailer/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAA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M,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtC,EAAE,CAAC,EAAE,2BAA2B,EAAE,CAAC;IACnC,GAAG,CAAC,EAAE,2BAA2B,EAAE,CAAC;IACpC,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACrC;AAGD,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC1F"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions for the emailer service
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/emailer/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Constants for emailer service
3
+ * Centralized constants to avoid magic numbers and strings
4
+ */
5
+ export declare const DEFAULT_RATE_LIMIT_REQUESTS = 10;
6
+ export declare const DEFAULT_RATE_LIMIT_WINDOW = 60;
7
+ export declare const DEFAULT_MAX_ATTACHMENT_SIZE: number;
8
+ export declare const DEFAULT_MAX_ATTACHMENTS = 10;
9
+ export declare const DEFAULT_REQUEST_TIMEOUT = 30000;
10
+ export declare const MAX_SUBJECT_LENGTH = 255;
11
+ export declare const MAX_BODY_LENGTH: number;
12
+ export declare const MAX_EMAIL_LENGTH = 254;
13
+ export declare const VALID_EMAILER_MODULES: readonly ["zeptoemail_api", "smtp", "pop3"];
14
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/lib/emailer/utils/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAG5C,eAAO,MAAM,2BAA2B,QAAmB,CAAC;AAC5D,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAG1C,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAG7C,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,eAAe,QAAc,CAAC;AAC3C,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAGpC,eAAO,MAAM,qBAAqB,6CAA8C,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * Constants for emailer service
4
+ * Centralized constants to avoid magic numbers and strings
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.VALID_EMAILER_MODULES = exports.MAX_EMAIL_LENGTH = exports.MAX_BODY_LENGTH = exports.MAX_SUBJECT_LENGTH = exports.DEFAULT_REQUEST_TIMEOUT = exports.DEFAULT_MAX_ATTACHMENTS = exports.DEFAULT_MAX_ATTACHMENT_SIZE = exports.DEFAULT_RATE_LIMIT_WINDOW = exports.DEFAULT_RATE_LIMIT_REQUESTS = void 0;
8
+ // Rate limiting constants
9
+ exports.DEFAULT_RATE_LIMIT_REQUESTS = 10; // requests per minute
10
+ exports.DEFAULT_RATE_LIMIT_WINDOW = 60; // seconds
11
+ // Attachment limits
12
+ exports.DEFAULT_MAX_ATTACHMENT_SIZE = 10 * 1024 * 1024; // 10MB in bytes
13
+ exports.DEFAULT_MAX_ATTACHMENTS = 10;
14
+ // Request timeout
15
+ exports.DEFAULT_REQUEST_TIMEOUT = 30000; // 30 seconds in milliseconds
16
+ // Input length limits
17
+ exports.MAX_SUBJECT_LENGTH = 255; // characters
18
+ exports.MAX_BODY_LENGTH = 1024 * 1024; // 1MB in bytes
19
+ exports.MAX_EMAIL_LENGTH = 254; // characters (RFC 5321)
20
+ // Valid emailer modules
21
+ exports.VALID_EMAILER_MODULES = ['zeptoemail_api', 'smtp', 'pop3'];
22
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/lib/emailer/utils/constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0BAA0B;AACb,QAAA,2BAA2B,GAAG,EAAE,CAAC,CAAC,sBAAsB;AACxD,QAAA,yBAAyB,GAAG,EAAE,CAAC,CAAC,UAAU;AAEvD,oBAAoB;AACP,QAAA,2BAA2B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,gBAAgB;AAChE,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAE1C,kBAAkB;AACL,QAAA,uBAAuB,GAAG,KAAK,CAAC,CAAC,6BAA6B;AAE3E,sBAAsB;AACT,QAAA,kBAAkB,GAAG,GAAG,CAAC,CAAC,aAAa;AACvC,QAAA,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,eAAe;AAC9C,QAAA,gBAAgB,GAAG,GAAG,CAAC,CAAC,wBAAwB;AAE7D,wBAAwB;AACX,QAAA,qBAAqB,GAAG,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC"}
@@ -2,8 +2,7 @@
2
2
  * Utility functions for emailer service
3
3
  * Centralized exports for validation, logging, and constants
4
4
  */
5
-
6
5
  export * from './constants';
7
6
  export * from './validation';
8
7
  export * from './logger';
9
-
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/emailer/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * Utility functions for emailer service
4
+ * Centralized exports for validation, logging, and constants
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ __exportStar(require("./constants"), exports);
22
+ __exportStar(require("./validation"), exports);
23
+ __exportStar(require("./logger"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/emailer/utils/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,+CAA6B;AAC7B,2CAAyB"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Centralized logging utility for emailer service
3
+ * Provides consistent JSON logging format across all components
4
+ */
5
+ interface LogEntry {
6
+ filename: string;
7
+ function_name: string;
8
+ line_number?: string | number;
9
+ message: string;
10
+ [key: string]: unknown;
11
+ }
12
+ /**
13
+ * Log an error message
14
+ * @param entry - Log entry object
15
+ */
16
+ export declare function log_error(entry: LogEntry): void;
17
+ /**
18
+ * Log an info message
19
+ * @param entry - Log entry object
20
+ */
21
+ export declare function log_info(entry: LogEntry): void;
22
+ /**
23
+ * Log a warning message
24
+ * @param entry - Log entry object
25
+ */
26
+ export declare function log_warning(entry: LogEntry): void;
27
+ /**
28
+ * Create a log entry with standard fields
29
+ * @param filename - Name of the file
30
+ * @param function_name - Name of the function
31
+ * @param message - Log message
32
+ * @param additional_data - Additional data to include
33
+ * @returns Log entry object
34
+ */
35
+ export declare function create_log_entry(filename: string, function_name: string, message: string, additional_data?: Record<string, unknown>): LogEntry;
36
+ export {};
37
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/lib/emailer/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,QAAQ;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAM/C;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAM9C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAMjD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,QAAQ,CAOV"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /**
3
+ * Centralized logging utility for emailer service
4
+ * Provides consistent JSON logging format across all components
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.log_error = log_error;
8
+ exports.log_info = log_info;
9
+ exports.log_warning = log_warning;
10
+ exports.create_log_entry = create_log_entry;
11
+ /**
12
+ * Log an error message
13
+ * @param entry - Log entry object
14
+ */
15
+ function log_error(entry) {
16
+ console.error(JSON.stringify({
17
+ level: 'error',
18
+ timestamp: new Date().toISOString(),
19
+ ...entry,
20
+ }));
21
+ }
22
+ /**
23
+ * Log an info message
24
+ * @param entry - Log entry object
25
+ */
26
+ function log_info(entry) {
27
+ console.log(JSON.stringify({
28
+ level: 'info',
29
+ timestamp: new Date().toISOString(),
30
+ ...entry,
31
+ }));
32
+ }
33
+ /**
34
+ * Log a warning message
35
+ * @param entry - Log entry object
36
+ */
37
+ function log_warning(entry) {
38
+ console.warn(JSON.stringify({
39
+ level: 'warning',
40
+ timestamp: new Date().toISOString(),
41
+ ...entry,
42
+ }));
43
+ }
44
+ /**
45
+ * Create a log entry with standard fields
46
+ * @param filename - Name of the file
47
+ * @param function_name - Name of the function
48
+ * @param message - Log message
49
+ * @param additional_data - Additional data to include
50
+ * @returns Log entry object
51
+ */
52
+ function create_log_entry(filename, function_name, message, additional_data) {
53
+ return {
54
+ filename,
55
+ function_name,
56
+ message,
57
+ ...(additional_data || {}),
58
+ };
59
+ }
60
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../src/lib/emailer/utils/logger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAcH,8BAMC;AAMD,4BAMC;AAMD,kCAMC;AAUD,4CAYC;AAxDD;;;GAGG;AACH,SAAgB,SAAS,CAAC,KAAe;IACvC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAC3B,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,GAAG,KAAK;KACT,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,KAAe;IACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;QACzB,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,GAAG,KAAK;KACT,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,KAAe;IACzC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;QAC1B,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,GAAG,KAAK;KACT,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC9B,QAAgB,EAChB,aAAqB,EACrB,OAAe,EACf,eAAyC;IAEzC,OAAO;QACL,QAAQ;QACR,aAAa;QACb,OAAO;QACP,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC;KAC3B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Validation utilities for emailer service
3
+ * Provides email validation, sanitization, and input validation functions
4
+ */
5
+ /**
6
+ * Validate email address format
7
+ * @param email - Email address to validate
8
+ * @returns boolean indicating if email is valid
9
+ */
10
+ export declare function validate_email_address(email: string): boolean;
11
+ /**
12
+ * Sanitize email header to prevent injection attacks
13
+ * Removes newlines, carriage returns, and other control characters
14
+ * @param value - Header value to sanitize
15
+ * @returns Sanitized header value
16
+ */
17
+ export declare function sanitize_email_header(value: string): string;
18
+ /**
19
+ * Validate subject length
20
+ * @param subject - Email subject to validate
21
+ * @returns boolean indicating if subject is valid
22
+ */
23
+ export declare function validate_subject_length(subject: string): boolean;
24
+ /**
25
+ * Validate body length
26
+ * @param body - Email body to validate
27
+ * @returns boolean indicating if body is valid
28
+ */
29
+ export declare function validate_body_length(body: string): boolean;
30
+ /**
31
+ * Validate attachment size
32
+ * @param content - Base64 encoded attachment content
33
+ * @param max_size - Maximum size in bytes
34
+ * @returns boolean indicating if attachment size is valid
35
+ */
36
+ export declare function validate_attachment_size(content: string, max_size: number): boolean;
37
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/lib/emailer/utils/validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAS7D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO3D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAKhE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQ1D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAWnF"}