@bernierllc/email-manager 0.12.2 → 0.12.3
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.
- package/dist/capabilities/degradation-logger.d.ts +59 -0
- package/dist/capabilities/degradation-logger.d.ts.map +1 -0
- package/dist/capabilities/degradation-logger.js +106 -0
- package/dist/capabilities/degradation-logger.js.map +1 -0
- package/dist/capabilities/feature-router.d.ts +55 -0
- package/dist/capabilities/feature-router.d.ts.map +1 -0
- package/dist/capabilities/feature-router.js +143 -0
- package/dist/capabilities/feature-router.js.map +1 -0
- package/dist/capabilities/in-memory-resolver.d.ts +27 -0
- package/dist/capabilities/in-memory-resolver.d.ts.map +1 -0
- package/dist/capabilities/in-memory-resolver.js +79 -0
- package/dist/capabilities/in-memory-resolver.js.map +1 -0
- package/dist/capabilities/index.d.ts +13 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +21 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/matrix.d.ts +67 -0
- package/dist/capabilities/matrix.d.ts.map +1 -0
- package/dist/capabilities/matrix.js +312 -0
- package/dist/capabilities/matrix.js.map +1 -0
- package/dist/capabilities/redis-resolver.d.ts +95 -0
- package/dist/capabilities/redis-resolver.d.ts.map +1 -0
- package/dist/capabilities/redis-resolver.js +227 -0
- package/dist/capabilities/redis-resolver.js.map +1 -0
- package/dist/capabilities/resolver-factory.d.ts +30 -0
- package/dist/capabilities/resolver-factory.d.ts.map +1 -0
- package/dist/capabilities/resolver-factory.js +70 -0
- package/dist/capabilities/resolver-factory.js.map +1 -0
- package/dist/capabilities/resolver.d.ts +40 -0
- package/dist/capabilities/resolver.d.ts.map +1 -0
- package/dist/capabilities/resolver.js +18 -0
- package/dist/capabilities/resolver.js.map +1 -0
- package/dist/capabilities/routing-metadata.d.ts +16 -0
- package/dist/capabilities/routing-metadata.d.ts.map +1 -0
- package/dist/capabilities/routing-metadata.js +17 -0
- package/dist/capabilities/routing-metadata.js.map +1 -0
- package/dist/capabilities/safe-resolver.d.ts +24 -0
- package/dist/capabilities/safe-resolver.d.ts.map +1 -0
- package/dist/capabilities/safe-resolver.js +48 -0
- package/dist/capabilities/safe-resolver.js.map +1 -0
- package/dist/config/loadConfiguration.d.ts +60 -0
- package/dist/config/loadConfiguration.d.ts.map +1 -0
- package/dist/config/loadConfiguration.js +468 -0
- package/dist/config/loadConfiguration.js.map +1 -0
- package/dist/config/schema.d.ts +962 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +318 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/types.d.ts +826 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +9 -0
- package/dist/config/types.js.map +1 -0
- package/dist/email-manager.d.ts +143 -0
- package/dist/email-manager.d.ts.map +1 -0
- package/dist/email-manager.js +365 -0
- package/dist/email-manager.js.map +1 -0
- package/dist/enhanced-email-manager.d.ts +349 -0
- package/dist/enhanced-email-manager.d.ts.map +1 -0
- package/dist/enhanced-email-manager.js +1396 -0
- package/dist/enhanced-email-manager.js.map +1 -0
- package/dist/errors.d.ts +154 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +251 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/managers/email-analytics.d.ts +92 -0
- package/dist/managers/email-analytics.d.ts.map +1 -0
- package/dist/managers/email-analytics.js +375 -0
- package/dist/managers/email-analytics.js.map +1 -0
- package/dist/managers/email-scheduler.d.ts +81 -0
- package/dist/managers/email-scheduler.d.ts.map +1 -0
- package/dist/managers/email-scheduler.js +288 -0
- package/dist/managers/email-scheduler.js.map +1 -0
- package/dist/managers/provider-manager.d.ts +152 -0
- package/dist/managers/provider-manager.d.ts.map +1 -0
- package/dist/managers/provider-manager.js +592 -0
- package/dist/managers/provider-manager.js.map +1 -0
- package/dist/managers/template-manager.d.ts +65 -0
- package/dist/managers/template-manager.d.ts.map +1 -0
- package/dist/managers/template-manager.js +314 -0
- package/dist/managers/template-manager.js.map +1 -0
- package/dist/types.d.ts +1029 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +62 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/simple-template-engine.d.ts +27 -0
- package/dist/utils/simple-template-engine.d.ts.map +1 -0
- package/dist/utils/simple-template-engine.js +61 -0
- package/dist/utils/simple-template-engine.js.map +1 -0
- package/package.json +10 -10
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,1029 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { EmailTracking } from '@bernierllc/email-sender';
|
|
3
|
+
import type { CapabilityResolver } from './capabilities/resolver.js';
|
|
4
|
+
/**
|
|
5
|
+
* Email Manager Configuration
|
|
6
|
+
*/
|
|
7
|
+
export interface EmailManagerConfig {
|
|
8
|
+
defaultProvider?: string;
|
|
9
|
+
providers: EmailProvider[];
|
|
10
|
+
templates?: EmailTemplate[];
|
|
11
|
+
scheduling?: SchedulingConfig;
|
|
12
|
+
analytics?: AnalyticsConfig;
|
|
13
|
+
retry?: RetryConfig;
|
|
14
|
+
routing?: RoutingConfig;
|
|
15
|
+
degradation?: DegradationConfig;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Email Data Interface
|
|
19
|
+
*/
|
|
20
|
+
export interface EmailData {
|
|
21
|
+
to: string | string[];
|
|
22
|
+
cc?: string | string[];
|
|
23
|
+
bcc?: string | string[];
|
|
24
|
+
replyTo?: string;
|
|
25
|
+
subject: string;
|
|
26
|
+
text?: string;
|
|
27
|
+
html?: string;
|
|
28
|
+
templateId?: string;
|
|
29
|
+
templateContext?: TemplateContext;
|
|
30
|
+
attachments?: Attachment[];
|
|
31
|
+
metadata?: Record<string, any>;
|
|
32
|
+
provider?: string;
|
|
33
|
+
priority?: 'low' | 'normal' | 'high';
|
|
34
|
+
/** Per-message open, click and UTM tracking override, passed through to the provider. */
|
|
35
|
+
tracking?: EmailTracking;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Email Template Interface
|
|
39
|
+
*/
|
|
40
|
+
export interface EmailTemplate {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
subject: string;
|
|
44
|
+
htmlTemplate: string;
|
|
45
|
+
textTemplate?: string;
|
|
46
|
+
variables: TemplateVariable[];
|
|
47
|
+
category?: string;
|
|
48
|
+
version: string;
|
|
49
|
+
isActive: boolean;
|
|
50
|
+
createdAt: Date;
|
|
51
|
+
updatedAt: Date;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Template Variable Definition
|
|
55
|
+
*/
|
|
56
|
+
export interface TemplateVariable {
|
|
57
|
+
name: string;
|
|
58
|
+
type: 'string' | 'number' | 'boolean' | 'object';
|
|
59
|
+
required: boolean;
|
|
60
|
+
description?: string;
|
|
61
|
+
defaultValue?: any;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Template Context for Rendering
|
|
65
|
+
*/
|
|
66
|
+
export interface TemplateContext {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Email Provider Configuration
|
|
71
|
+
*/
|
|
72
|
+
export interface EmailProvider {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
type: 'sendgrid' | 'mailgun' | 'ses' | 'smtp' | 'postmark' | 'mandrill' | 'smtp2go';
|
|
76
|
+
config: ProviderConfig;
|
|
77
|
+
isActive: boolean;
|
|
78
|
+
priority: number;
|
|
79
|
+
rateLimit?: RateLimit;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Provider-specific Configuration
|
|
83
|
+
*/
|
|
84
|
+
export interface ProviderConfig {
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Rate Limiting Configuration
|
|
89
|
+
*/
|
|
90
|
+
export interface RateLimit {
|
|
91
|
+
maxPerMinute: number;
|
|
92
|
+
maxPerHour: number;
|
|
93
|
+
maxPerDay: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Email Attachment
|
|
97
|
+
*/
|
|
98
|
+
export interface Attachment {
|
|
99
|
+
filename: string;
|
|
100
|
+
content: Buffer | string;
|
|
101
|
+
contentType: string;
|
|
102
|
+
contentDisposition?: 'attachment' | 'inline';
|
|
103
|
+
cid?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Send Result
|
|
107
|
+
*/
|
|
108
|
+
export interface SendResult {
|
|
109
|
+
success: boolean;
|
|
110
|
+
messageId?: string;
|
|
111
|
+
provider: string;
|
|
112
|
+
sentAt: Date;
|
|
113
|
+
errors?: SendError[];
|
|
114
|
+
metadata?: Record<string, any>;
|
|
115
|
+
routing?: RoutingMetadata;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Send Error
|
|
119
|
+
*/
|
|
120
|
+
export interface SendError {
|
|
121
|
+
code: string;
|
|
122
|
+
message: string;
|
|
123
|
+
recipient?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Schedule Result
|
|
127
|
+
*/
|
|
128
|
+
export interface ScheduleResult {
|
|
129
|
+
success: boolean;
|
|
130
|
+
scheduleId: string;
|
|
131
|
+
scheduledFor: Date;
|
|
132
|
+
emailId: string;
|
|
133
|
+
status: 'scheduled' | 'cancelled' | 'sent';
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Scheduled Email
|
|
137
|
+
*/
|
|
138
|
+
export interface ScheduledEmail {
|
|
139
|
+
id: string;
|
|
140
|
+
email: EmailData;
|
|
141
|
+
scheduledFor: Date;
|
|
142
|
+
status: 'scheduled' | 'cancelled' | 'sent' | 'failed';
|
|
143
|
+
createdAt: Date;
|
|
144
|
+
sentAt?: Date;
|
|
145
|
+
result?: SendResult;
|
|
146
|
+
error?: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Template Result
|
|
150
|
+
*/
|
|
151
|
+
export interface TemplateResult {
|
|
152
|
+
success: boolean;
|
|
153
|
+
template?: EmailTemplate;
|
|
154
|
+
errors?: string[];
|
|
155
|
+
message?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Rendered Template
|
|
159
|
+
*/
|
|
160
|
+
export interface RenderedTemplate {
|
|
161
|
+
subject: string;
|
|
162
|
+
html: string;
|
|
163
|
+
text?: string;
|
|
164
|
+
templateId: string;
|
|
165
|
+
version: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Validation Result
|
|
169
|
+
*/
|
|
170
|
+
export interface ValidationResult {
|
|
171
|
+
isValid: boolean;
|
|
172
|
+
errors: string[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Provider Result
|
|
176
|
+
*/
|
|
177
|
+
export interface ProviderResult {
|
|
178
|
+
success: boolean;
|
|
179
|
+
provider?: EmailProvider;
|
|
180
|
+
errors?: string[];
|
|
181
|
+
message?: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Delete Result
|
|
185
|
+
*/
|
|
186
|
+
export interface DeleteResult {
|
|
187
|
+
success: boolean;
|
|
188
|
+
message?: string;
|
|
189
|
+
error?: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Template List
|
|
193
|
+
*/
|
|
194
|
+
export interface TemplateList {
|
|
195
|
+
templates: EmailTemplate[];
|
|
196
|
+
total: number;
|
|
197
|
+
page: number;
|
|
198
|
+
pageSize: number;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Provider List
|
|
202
|
+
*/
|
|
203
|
+
export interface ProviderList {
|
|
204
|
+
providers: EmailProvider[];
|
|
205
|
+
total: number;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* List Options
|
|
209
|
+
*/
|
|
210
|
+
export interface ListOptions {
|
|
211
|
+
page?: number;
|
|
212
|
+
pageSize?: number;
|
|
213
|
+
category?: string;
|
|
214
|
+
active?: boolean;
|
|
215
|
+
search?: string;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Email Statistics
|
|
219
|
+
*/
|
|
220
|
+
export interface EmailStats {
|
|
221
|
+
emailId: string;
|
|
222
|
+
sent: number;
|
|
223
|
+
delivered: number;
|
|
224
|
+
opened: number;
|
|
225
|
+
clicked: number;
|
|
226
|
+
bounced: number;
|
|
227
|
+
deliveryRate: number;
|
|
228
|
+
openRate: number;
|
|
229
|
+
clickRate: number;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Delivery Report
|
|
233
|
+
*/
|
|
234
|
+
export interface DeliveryReport {
|
|
235
|
+
period: {
|
|
236
|
+
startDate: Date;
|
|
237
|
+
endDate: Date;
|
|
238
|
+
};
|
|
239
|
+
totalSent: number;
|
|
240
|
+
totalDelivered: number;
|
|
241
|
+
totalOpened: number;
|
|
242
|
+
totalClicked: number;
|
|
243
|
+
totalBounced: number;
|
|
244
|
+
deliveryRate: number;
|
|
245
|
+
openRate: number;
|
|
246
|
+
clickRate: number;
|
|
247
|
+
bounceRate: number;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Bounce Report
|
|
251
|
+
*/
|
|
252
|
+
export interface BounceReport {
|
|
253
|
+
period: {
|
|
254
|
+
startDate: Date;
|
|
255
|
+
endDate: Date;
|
|
256
|
+
};
|
|
257
|
+
totalBounces: number;
|
|
258
|
+
bouncesByReason: Record<string, number>;
|
|
259
|
+
bouncesByProvider: Record<string, number>;
|
|
260
|
+
bounceRate: number;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Report Options
|
|
264
|
+
*/
|
|
265
|
+
export interface ReportOptions {
|
|
266
|
+
startDate?: Date;
|
|
267
|
+
endDate?: Date;
|
|
268
|
+
provider?: string;
|
|
269
|
+
templateId?: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Provider Status
|
|
273
|
+
*/
|
|
274
|
+
export interface ProviderStatus {
|
|
275
|
+
id: string;
|
|
276
|
+
isActive: boolean;
|
|
277
|
+
isHealthy: boolean;
|
|
278
|
+
lastHealthCheck: Date;
|
|
279
|
+
currentUsage: {
|
|
280
|
+
minute: number;
|
|
281
|
+
hour: number;
|
|
282
|
+
day: number;
|
|
283
|
+
};
|
|
284
|
+
rateLimit?: RateLimit;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Test Result
|
|
288
|
+
*/
|
|
289
|
+
export interface TestResult {
|
|
290
|
+
success: boolean;
|
|
291
|
+
message: string;
|
|
292
|
+
details?: any;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Email Event for Analytics
|
|
296
|
+
*/
|
|
297
|
+
export interface EmailEvent {
|
|
298
|
+
type: 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced';
|
|
299
|
+
emailId: string;
|
|
300
|
+
recipient: string;
|
|
301
|
+
provider?: string;
|
|
302
|
+
url?: string;
|
|
303
|
+
reason?: string;
|
|
304
|
+
timestamp: Date;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Cancel Result
|
|
308
|
+
*/
|
|
309
|
+
export interface CancelResult {
|
|
310
|
+
success: boolean;
|
|
311
|
+
error?: string;
|
|
312
|
+
message?: string;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Scheduling Configuration
|
|
316
|
+
*/
|
|
317
|
+
export interface SchedulingConfig {
|
|
318
|
+
enabled: boolean;
|
|
319
|
+
checkIntervalMs: number;
|
|
320
|
+
maxRetries: number;
|
|
321
|
+
retryDelayMs: number;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Analytics Configuration
|
|
325
|
+
*/
|
|
326
|
+
export interface AnalyticsConfig {
|
|
327
|
+
enabled: boolean;
|
|
328
|
+
trackOpens: boolean;
|
|
329
|
+
trackClicks: boolean;
|
|
330
|
+
trackBounces: boolean;
|
|
331
|
+
maxEvents: number;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Retry Configuration
|
|
335
|
+
*/
|
|
336
|
+
export interface RetryConfig {
|
|
337
|
+
maxRetries: number;
|
|
338
|
+
initialDelayMs: number;
|
|
339
|
+
maxDelayMs: number;
|
|
340
|
+
backoffFactor: number;
|
|
341
|
+
jitter: boolean;
|
|
342
|
+
}
|
|
343
|
+
export declare const EmailDataSchema: z.ZodObject<{
|
|
344
|
+
to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
345
|
+
cc: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
346
|
+
bcc: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
347
|
+
replyTo: z.ZodOptional<z.ZodString>;
|
|
348
|
+
subject: z.ZodString;
|
|
349
|
+
text: z.ZodOptional<z.ZodString>;
|
|
350
|
+
html: z.ZodOptional<z.ZodString>;
|
|
351
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
352
|
+
templateContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
353
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
354
|
+
filename: z.ZodString;
|
|
355
|
+
content: z.ZodUnion<[z.ZodString, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>;
|
|
356
|
+
contentType: z.ZodString;
|
|
357
|
+
}, "strip", z.ZodTypeAny, {
|
|
358
|
+
filename: string;
|
|
359
|
+
content: string | Buffer<ArrayBufferLike>;
|
|
360
|
+
contentType: string;
|
|
361
|
+
}, {
|
|
362
|
+
filename: string;
|
|
363
|
+
content: string | Buffer<ArrayBufferLike>;
|
|
364
|
+
contentType: string;
|
|
365
|
+
}>, "many">>;
|
|
366
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
367
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
368
|
+
priority: z.ZodOptional<z.ZodEnum<["low", "normal", "high"]>>;
|
|
369
|
+
tracking: z.ZodOptional<z.ZodObject<{
|
|
370
|
+
opens: z.ZodOptional<z.ZodBoolean>;
|
|
371
|
+
clicks: z.ZodOptional<z.ZodBoolean>;
|
|
372
|
+
utm: z.ZodOptional<z.ZodBoolean>;
|
|
373
|
+
}, "strip", z.ZodTypeAny, {
|
|
374
|
+
opens?: boolean | undefined;
|
|
375
|
+
clicks?: boolean | undefined;
|
|
376
|
+
utm?: boolean | undefined;
|
|
377
|
+
}, {
|
|
378
|
+
opens?: boolean | undefined;
|
|
379
|
+
clicks?: boolean | undefined;
|
|
380
|
+
utm?: boolean | undefined;
|
|
381
|
+
}>>;
|
|
382
|
+
}, "strip", z.ZodTypeAny, {
|
|
383
|
+
to: string | string[];
|
|
384
|
+
subject: string;
|
|
385
|
+
cc?: string | string[] | undefined;
|
|
386
|
+
bcc?: string | string[] | undefined;
|
|
387
|
+
replyTo?: string | undefined;
|
|
388
|
+
text?: string | undefined;
|
|
389
|
+
html?: string | undefined;
|
|
390
|
+
templateId?: string | undefined;
|
|
391
|
+
templateContext?: Record<string, any> | undefined;
|
|
392
|
+
attachments?: {
|
|
393
|
+
filename: string;
|
|
394
|
+
content: string | Buffer<ArrayBufferLike>;
|
|
395
|
+
contentType: string;
|
|
396
|
+
}[] | undefined;
|
|
397
|
+
metadata?: Record<string, any> | undefined;
|
|
398
|
+
provider?: string | undefined;
|
|
399
|
+
priority?: "low" | "normal" | "high" | undefined;
|
|
400
|
+
tracking?: {
|
|
401
|
+
opens?: boolean | undefined;
|
|
402
|
+
clicks?: boolean | undefined;
|
|
403
|
+
utm?: boolean | undefined;
|
|
404
|
+
} | undefined;
|
|
405
|
+
}, {
|
|
406
|
+
to: string | string[];
|
|
407
|
+
subject: string;
|
|
408
|
+
cc?: string | string[] | undefined;
|
|
409
|
+
bcc?: string | string[] | undefined;
|
|
410
|
+
replyTo?: string | undefined;
|
|
411
|
+
text?: string | undefined;
|
|
412
|
+
html?: string | undefined;
|
|
413
|
+
templateId?: string | undefined;
|
|
414
|
+
templateContext?: Record<string, any> | undefined;
|
|
415
|
+
attachments?: {
|
|
416
|
+
filename: string;
|
|
417
|
+
content: string | Buffer<ArrayBufferLike>;
|
|
418
|
+
contentType: string;
|
|
419
|
+
}[] | undefined;
|
|
420
|
+
metadata?: Record<string, any> | undefined;
|
|
421
|
+
provider?: string | undefined;
|
|
422
|
+
priority?: "low" | "normal" | "high" | undefined;
|
|
423
|
+
tracking?: {
|
|
424
|
+
opens?: boolean | undefined;
|
|
425
|
+
clicks?: boolean | undefined;
|
|
426
|
+
utm?: boolean | undefined;
|
|
427
|
+
} | undefined;
|
|
428
|
+
}>;
|
|
429
|
+
export declare const EmailTemplateSchema: z.ZodObject<{
|
|
430
|
+
id: z.ZodString;
|
|
431
|
+
name: z.ZodString;
|
|
432
|
+
subject: z.ZodString;
|
|
433
|
+
htmlTemplate: z.ZodString;
|
|
434
|
+
textTemplate: z.ZodOptional<z.ZodString>;
|
|
435
|
+
variables: z.ZodArray<z.ZodObject<{
|
|
436
|
+
name: z.ZodString;
|
|
437
|
+
type: z.ZodEnum<["string", "number", "boolean", "object"]>;
|
|
438
|
+
required: z.ZodBoolean;
|
|
439
|
+
description: z.ZodOptional<z.ZodString>;
|
|
440
|
+
defaultValue: z.ZodOptional<z.ZodAny>;
|
|
441
|
+
}, "strip", z.ZodTypeAny, {
|
|
442
|
+
type: "string" | "number" | "boolean" | "object";
|
|
443
|
+
name: string;
|
|
444
|
+
required: boolean;
|
|
445
|
+
description?: string | undefined;
|
|
446
|
+
defaultValue?: any;
|
|
447
|
+
}, {
|
|
448
|
+
type: "string" | "number" | "boolean" | "object";
|
|
449
|
+
name: string;
|
|
450
|
+
required: boolean;
|
|
451
|
+
description?: string | undefined;
|
|
452
|
+
defaultValue?: any;
|
|
453
|
+
}>, "many">;
|
|
454
|
+
category: z.ZodOptional<z.ZodString>;
|
|
455
|
+
version: z.ZodString;
|
|
456
|
+
isActive: z.ZodBoolean;
|
|
457
|
+
createdAt: z.ZodDate;
|
|
458
|
+
updatedAt: z.ZodDate;
|
|
459
|
+
}, "strip", z.ZodTypeAny, {
|
|
460
|
+
subject: string;
|
|
461
|
+
id: string;
|
|
462
|
+
name: string;
|
|
463
|
+
htmlTemplate: string;
|
|
464
|
+
variables: {
|
|
465
|
+
type: "string" | "number" | "boolean" | "object";
|
|
466
|
+
name: string;
|
|
467
|
+
required: boolean;
|
|
468
|
+
description?: string | undefined;
|
|
469
|
+
defaultValue?: any;
|
|
470
|
+
}[];
|
|
471
|
+
version: string;
|
|
472
|
+
isActive: boolean;
|
|
473
|
+
createdAt: Date;
|
|
474
|
+
updatedAt: Date;
|
|
475
|
+
textTemplate?: string | undefined;
|
|
476
|
+
category?: string | undefined;
|
|
477
|
+
}, {
|
|
478
|
+
subject: string;
|
|
479
|
+
id: string;
|
|
480
|
+
name: string;
|
|
481
|
+
htmlTemplate: string;
|
|
482
|
+
variables: {
|
|
483
|
+
type: "string" | "number" | "boolean" | "object";
|
|
484
|
+
name: string;
|
|
485
|
+
required: boolean;
|
|
486
|
+
description?: string | undefined;
|
|
487
|
+
defaultValue?: any;
|
|
488
|
+
}[];
|
|
489
|
+
version: string;
|
|
490
|
+
isActive: boolean;
|
|
491
|
+
createdAt: Date;
|
|
492
|
+
updatedAt: Date;
|
|
493
|
+
textTemplate?: string | undefined;
|
|
494
|
+
category?: string | undefined;
|
|
495
|
+
}>;
|
|
496
|
+
export declare const EmailProviderSchema: z.ZodObject<{
|
|
497
|
+
id: z.ZodString;
|
|
498
|
+
name: z.ZodString;
|
|
499
|
+
type: z.ZodEnum<["sendgrid", "mailgun", "ses", "smtp", "postmark", "mandrill", "smtp2go"]>;
|
|
500
|
+
config: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
501
|
+
isActive: z.ZodBoolean;
|
|
502
|
+
priority: z.ZodNumber;
|
|
503
|
+
rateLimit: z.ZodOptional<z.ZodObject<{
|
|
504
|
+
maxPerMinute: z.ZodNumber;
|
|
505
|
+
maxPerHour: z.ZodNumber;
|
|
506
|
+
maxPerDay: z.ZodNumber;
|
|
507
|
+
}, "strip", z.ZodTypeAny, {
|
|
508
|
+
maxPerMinute: number;
|
|
509
|
+
maxPerHour: number;
|
|
510
|
+
maxPerDay: number;
|
|
511
|
+
}, {
|
|
512
|
+
maxPerMinute: number;
|
|
513
|
+
maxPerHour: number;
|
|
514
|
+
maxPerDay: number;
|
|
515
|
+
}>>;
|
|
516
|
+
}, "strip", z.ZodTypeAny, {
|
|
517
|
+
type: "sendgrid" | "mailgun" | "ses" | "smtp" | "postmark" | "mandrill" | "smtp2go";
|
|
518
|
+
priority: number;
|
|
519
|
+
id: string;
|
|
520
|
+
name: string;
|
|
521
|
+
isActive: boolean;
|
|
522
|
+
config: Record<string, any>;
|
|
523
|
+
rateLimit?: {
|
|
524
|
+
maxPerMinute: number;
|
|
525
|
+
maxPerHour: number;
|
|
526
|
+
maxPerDay: number;
|
|
527
|
+
} | undefined;
|
|
528
|
+
}, {
|
|
529
|
+
type: "sendgrid" | "mailgun" | "ses" | "smtp" | "postmark" | "mandrill" | "smtp2go";
|
|
530
|
+
priority: number;
|
|
531
|
+
id: string;
|
|
532
|
+
name: string;
|
|
533
|
+
isActive: boolean;
|
|
534
|
+
config: Record<string, any>;
|
|
535
|
+
rateLimit?: {
|
|
536
|
+
maxPerMinute: number;
|
|
537
|
+
maxPerHour: number;
|
|
538
|
+
maxPerDay: number;
|
|
539
|
+
} | undefined;
|
|
540
|
+
}>;
|
|
541
|
+
/**
|
|
542
|
+
* Email Recipient for bulk/templated sends
|
|
543
|
+
*/
|
|
544
|
+
export interface EmailRecipient {
|
|
545
|
+
email: string;
|
|
546
|
+
name?: string;
|
|
547
|
+
metadata?: Record<string, unknown>;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Send Template Options with validation and sender selection
|
|
551
|
+
*/
|
|
552
|
+
export interface SendTemplateOptions {
|
|
553
|
+
validateVariables?: boolean;
|
|
554
|
+
strictMode?: boolean;
|
|
555
|
+
context?: string;
|
|
556
|
+
senderOverride?: EnhancedSenderConfiguration;
|
|
557
|
+
selectBestSender?: boolean;
|
|
558
|
+
preferredProvider?: string;
|
|
559
|
+
providerOptions?: Record<string, unknown>;
|
|
560
|
+
baseTemplateId?: string;
|
|
561
|
+
buildFromComponents?: boolean;
|
|
562
|
+
bypassStagingSafety?: boolean;
|
|
563
|
+
dryRun?: boolean;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Enhanced Sender Configuration
|
|
567
|
+
*/
|
|
568
|
+
export interface EnhancedSenderConfiguration {
|
|
569
|
+
id: string;
|
|
570
|
+
name: string;
|
|
571
|
+
fromEmail: string;
|
|
572
|
+
fromName: string;
|
|
573
|
+
replyToEmail?: string;
|
|
574
|
+
provider?: string;
|
|
575
|
+
priority: number;
|
|
576
|
+
isDefault: boolean;
|
|
577
|
+
isActive: boolean;
|
|
578
|
+
isVerified: boolean;
|
|
579
|
+
verificationStatus?: 'pending' | 'verified' | 'failed';
|
|
580
|
+
lastVerifiedAt?: Date;
|
|
581
|
+
verificationError?: string;
|
|
582
|
+
providerMetadata?: Record<string, unknown>;
|
|
583
|
+
createdAt: Date;
|
|
584
|
+
updatedAt: Date;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Create Sender Request
|
|
588
|
+
*/
|
|
589
|
+
export interface CreateSenderRequest {
|
|
590
|
+
name: string;
|
|
591
|
+
fromEmail: string;
|
|
592
|
+
fromName: string;
|
|
593
|
+
replyToEmail?: string;
|
|
594
|
+
provider?: string;
|
|
595
|
+
priority?: number;
|
|
596
|
+
isDefault?: boolean;
|
|
597
|
+
providerMetadata?: Record<string, unknown>;
|
|
598
|
+
verificationStatus?: 'pending' | 'verified' | 'failed';
|
|
599
|
+
isVerified?: boolean;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Sender Selection Options
|
|
603
|
+
*/
|
|
604
|
+
export interface SenderSelectionOptions {
|
|
605
|
+
strategy?: 'domain_match' | 'priority' | 'round_robin';
|
|
606
|
+
allowUnverified?: boolean;
|
|
607
|
+
excludeIds?: string[];
|
|
608
|
+
autoCreate?: boolean;
|
|
609
|
+
defaultFromName?: string;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Sender Validation Result
|
|
613
|
+
*/
|
|
614
|
+
export interface EnhancedSenderValidationResult {
|
|
615
|
+
isValid: boolean;
|
|
616
|
+
errors: SenderValidationError[];
|
|
617
|
+
warnings: SenderValidationWarning[];
|
|
618
|
+
providerValidation?: ProviderSenderValidation;
|
|
619
|
+
metadata?: {
|
|
620
|
+
lastValidated: Date;
|
|
621
|
+
validatedBy: string;
|
|
622
|
+
checks: string[];
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Sender Validation Error
|
|
627
|
+
*/
|
|
628
|
+
export interface SenderValidationError {
|
|
629
|
+
field: string;
|
|
630
|
+
message: string;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Sender Validation Warning
|
|
634
|
+
*/
|
|
635
|
+
export interface SenderValidationWarning {
|
|
636
|
+
field: string;
|
|
637
|
+
message: string;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Provider Sender Validation Result
|
|
641
|
+
*/
|
|
642
|
+
export interface ProviderSenderValidation {
|
|
643
|
+
isVerified: boolean;
|
|
644
|
+
verificationStatus: string;
|
|
645
|
+
metadata?: Record<string, unknown>;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Enhanced Template Validation Result
|
|
649
|
+
*/
|
|
650
|
+
export interface EnhancedTemplateValidationResult {
|
|
651
|
+
isValid: boolean;
|
|
652
|
+
errors: TemplateValidationError[];
|
|
653
|
+
warnings: string[];
|
|
654
|
+
info?: string[];
|
|
655
|
+
unusedVariables?: string[];
|
|
656
|
+
undefinedVariables?: UndefinedVariable[];
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Template Validation Error with section
|
|
660
|
+
*/
|
|
661
|
+
export interface TemplateValidationError {
|
|
662
|
+
message: string;
|
|
663
|
+
section?: 'html' | 'subject' | 'text';
|
|
664
|
+
path?: string;
|
|
665
|
+
line?: number;
|
|
666
|
+
column?: number;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Undefined Variable info
|
|
670
|
+
*/
|
|
671
|
+
export interface UndefinedVariable {
|
|
672
|
+
name: string;
|
|
673
|
+
section: 'html' | 'subject' | 'text';
|
|
674
|
+
line?: number;
|
|
675
|
+
column?: number;
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Variable Context Definition
|
|
679
|
+
*/
|
|
680
|
+
export interface VariableContextDefinition {
|
|
681
|
+
name: string;
|
|
682
|
+
description?: string;
|
|
683
|
+
variables: VariableDefinition[];
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Variable Definition
|
|
687
|
+
*/
|
|
688
|
+
export interface VariableDefinition {
|
|
689
|
+
path: string;
|
|
690
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'date' | 'email' | 'url';
|
|
691
|
+
required?: boolean;
|
|
692
|
+
description?: string;
|
|
693
|
+
defaultValue?: unknown;
|
|
694
|
+
validationRules?: ValidationRule[];
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Validation Rule for Variables
|
|
698
|
+
*/
|
|
699
|
+
export interface ValidationRule {
|
|
700
|
+
type: 'length' | 'pattern' | 'range' | 'custom';
|
|
701
|
+
params?: Record<string, unknown>;
|
|
702
|
+
message?: string;
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Variable Suggestion
|
|
706
|
+
*/
|
|
707
|
+
export interface EnhancedVariableSuggestion {
|
|
708
|
+
path: string;
|
|
709
|
+
type: string;
|
|
710
|
+
description?: string;
|
|
711
|
+
required: boolean;
|
|
712
|
+
score: number;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Sync Result for Template Provider Sync
|
|
716
|
+
*/
|
|
717
|
+
export interface TemplateSyncResult {
|
|
718
|
+
success: boolean;
|
|
719
|
+
action: 'created' | 'updated' | 'deleted' | 'synced_all' | 'partially_synced' | 'failed';
|
|
720
|
+
localTemplateId: string;
|
|
721
|
+
providerId?: string;
|
|
722
|
+
providerTemplateId?: string;
|
|
723
|
+
error?: string;
|
|
724
|
+
metadata?: Record<string, unknown>;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Batch Sync Result
|
|
728
|
+
*/
|
|
729
|
+
export interface BatchTemplateSyncResult {
|
|
730
|
+
success: boolean;
|
|
731
|
+
total: number;
|
|
732
|
+
synced: number;
|
|
733
|
+
failed: number;
|
|
734
|
+
results: TemplateSyncResult[];
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Bootstrap Configuration
|
|
738
|
+
*/
|
|
739
|
+
export interface BootstrapConfig {
|
|
740
|
+
enabled: boolean;
|
|
741
|
+
senders?: {
|
|
742
|
+
enabled: boolean;
|
|
743
|
+
defaultSenders: CreateSenderRequest[];
|
|
744
|
+
createTables?: boolean;
|
|
745
|
+
};
|
|
746
|
+
templates?: {
|
|
747
|
+
enabled: boolean;
|
|
748
|
+
defaultTemplates: EnhancedTemplateDefinition[];
|
|
749
|
+
baseTemplates?: BaseTemplateDefinition[];
|
|
750
|
+
syncToProviders?: boolean;
|
|
751
|
+
};
|
|
752
|
+
variables?: {
|
|
753
|
+
enabled: boolean;
|
|
754
|
+
contexts: VariableContextDefinition[];
|
|
755
|
+
};
|
|
756
|
+
providers?: {
|
|
757
|
+
enabled: boolean;
|
|
758
|
+
testConnections?: boolean;
|
|
759
|
+
syncOnStartup?: boolean;
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Enhanced Template Definition
|
|
764
|
+
*/
|
|
765
|
+
export interface EnhancedTemplateDefinition {
|
|
766
|
+
name: string;
|
|
767
|
+
subject: string;
|
|
768
|
+
htmlContent: string;
|
|
769
|
+
textContent?: string;
|
|
770
|
+
context?: string;
|
|
771
|
+
category?: string;
|
|
772
|
+
variables?: VariableDefinition[];
|
|
773
|
+
baseTemplateId?: string;
|
|
774
|
+
providerTemplateIds?: Record<string, string>;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Base Template Definition
|
|
778
|
+
*/
|
|
779
|
+
export interface BaseTemplateDefinition {
|
|
780
|
+
id: string;
|
|
781
|
+
name: string;
|
|
782
|
+
htmlContent: string;
|
|
783
|
+
textContent?: string;
|
|
784
|
+
variables?: string[];
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Bootstrap Result
|
|
788
|
+
*/
|
|
789
|
+
export interface BootstrapResult {
|
|
790
|
+
success: boolean;
|
|
791
|
+
components: {
|
|
792
|
+
senders?: ComponentBootstrapResult;
|
|
793
|
+
templates?: ComponentBootstrapResult;
|
|
794
|
+
variables?: ComponentBootstrapResult;
|
|
795
|
+
providers?: ComponentBootstrapResult;
|
|
796
|
+
};
|
|
797
|
+
errors: string[];
|
|
798
|
+
warnings: string[];
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Component Bootstrap Result
|
|
802
|
+
*/
|
|
803
|
+
export interface ComponentBootstrapResult {
|
|
804
|
+
success: boolean;
|
|
805
|
+
created: string[];
|
|
806
|
+
updated: string[];
|
|
807
|
+
errors: string[];
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* System Health Report
|
|
811
|
+
*/
|
|
812
|
+
export interface SystemHealthReport {
|
|
813
|
+
overall: ComponentHealth;
|
|
814
|
+
timestamp: Date;
|
|
815
|
+
components: {
|
|
816
|
+
email: ComponentHealth;
|
|
817
|
+
templates: ComponentHealth;
|
|
818
|
+
senders: ComponentHealth;
|
|
819
|
+
providers: ComponentHealth;
|
|
820
|
+
variables?: ComponentHealth;
|
|
821
|
+
subscription?: ComponentHealth;
|
|
822
|
+
batchSender?: ComponentHealth;
|
|
823
|
+
};
|
|
824
|
+
recommendations: HealthRecommendation[];
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Component Health
|
|
828
|
+
*/
|
|
829
|
+
export interface ComponentHealth {
|
|
830
|
+
status: 'healthy' | 'degraded' | 'unhealthy';
|
|
831
|
+
score: number;
|
|
832
|
+
metrics: Record<string, number>;
|
|
833
|
+
issues: HealthIssue[];
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Health Issue
|
|
837
|
+
*/
|
|
838
|
+
export interface HealthIssue {
|
|
839
|
+
severity: 'error' | 'warning' | 'info';
|
|
840
|
+
message: string;
|
|
841
|
+
details?: string;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Health Recommendation
|
|
845
|
+
*/
|
|
846
|
+
export interface HealthRecommendation {
|
|
847
|
+
priority: 'high' | 'medium' | 'low';
|
|
848
|
+
category: string;
|
|
849
|
+
title: string;
|
|
850
|
+
description: string;
|
|
851
|
+
action: string;
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Staging Safety Configuration
|
|
855
|
+
*/
|
|
856
|
+
export interface StagingSafetyConfig {
|
|
857
|
+
enabled: boolean;
|
|
858
|
+
environment: string;
|
|
859
|
+
whitelist: string[];
|
|
860
|
+
rewriteTo: string;
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Template Sync Configuration
|
|
864
|
+
*/
|
|
865
|
+
export interface TemplateSyncConfig {
|
|
866
|
+
enabled: boolean;
|
|
867
|
+
providers: string[];
|
|
868
|
+
strategy?: 'auto' | 'manual';
|
|
869
|
+
conflictResolution?: 'local_wins' | 'remote_wins' | 'manual';
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Monitoring Configuration
|
|
873
|
+
*/
|
|
874
|
+
export interface MonitoringConfig {
|
|
875
|
+
enabled: boolean;
|
|
876
|
+
healthCheckIntervalMs?: number;
|
|
877
|
+
metricsRetentionDays?: number;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Calendar Invite Send Options
|
|
881
|
+
*/
|
|
882
|
+
export interface CalendarInviteSendOptions {
|
|
883
|
+
subject?: string;
|
|
884
|
+
textBody?: string;
|
|
885
|
+
htmlBody?: string;
|
|
886
|
+
provider?: string;
|
|
887
|
+
metadata?: Record<string, unknown>;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Subscription Configuration for Enhanced Email Manager
|
|
891
|
+
*/
|
|
892
|
+
export interface SubscriptionConfig {
|
|
893
|
+
enabled: boolean;
|
|
894
|
+
unsubscribe?: {
|
|
895
|
+
baseUrl: string;
|
|
896
|
+
secret: string;
|
|
897
|
+
expiresIn?: number;
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Routing Configuration for capability-aware provider selection
|
|
902
|
+
*/
|
|
903
|
+
export interface RoutingConfig {
|
|
904
|
+
strategy: 'primary-failover';
|
|
905
|
+
capabilityResolver?: CapabilityResolver;
|
|
906
|
+
featureOverrides?: Record<string, {
|
|
907
|
+
behavior: 'native-first' | 'platform-always' | 'error';
|
|
908
|
+
}>;
|
|
909
|
+
/** Reserved for future use. Accepted in config but not yet implemented. */
|
|
910
|
+
healthCheck?: {
|
|
911
|
+
enabled: boolean;
|
|
912
|
+
intervalMs: number;
|
|
913
|
+
failureThreshold: number;
|
|
914
|
+
recoveryTimeMs: number;
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Degradation Configuration for controlling how degraded feature routing is reported
|
|
919
|
+
*/
|
|
920
|
+
export interface DegradationConfig {
|
|
921
|
+
logLevel: 'silent' | 'info' | 'warn' | 'error';
|
|
922
|
+
includeDocLinks: boolean;
|
|
923
|
+
docsBaseUrl?: string;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Enhanced Email Manager Configuration
|
|
927
|
+
*/
|
|
928
|
+
/**
|
|
929
|
+
* Sender service interface for delegation from the suite layer.
|
|
930
|
+
* Matches the public API of @bernierllc/sender-identity-verification.
|
|
931
|
+
*/
|
|
932
|
+
export interface SenderService {
|
|
933
|
+
createSender(input: {
|
|
934
|
+
email: string;
|
|
935
|
+
name: string;
|
|
936
|
+
replyToEmail?: string;
|
|
937
|
+
provider?: string;
|
|
938
|
+
isDefault?: boolean;
|
|
939
|
+
skipVerification?: boolean;
|
|
940
|
+
createdBy?: string;
|
|
941
|
+
providerFields?: Record<string, unknown>;
|
|
942
|
+
}): Promise<{
|
|
943
|
+
success: boolean;
|
|
944
|
+
data?: {
|
|
945
|
+
id: string;
|
|
946
|
+
email: string;
|
|
947
|
+
name: string;
|
|
948
|
+
isVerified?: boolean;
|
|
949
|
+
status?: string;
|
|
950
|
+
[key: string]: unknown;
|
|
951
|
+
};
|
|
952
|
+
error?: string;
|
|
953
|
+
}>;
|
|
954
|
+
getSender(id: string): Promise<{
|
|
955
|
+
success: boolean;
|
|
956
|
+
data?: {
|
|
957
|
+
id: string;
|
|
958
|
+
email: string;
|
|
959
|
+
name: string;
|
|
960
|
+
[key: string]: unknown;
|
|
961
|
+
};
|
|
962
|
+
error?: string;
|
|
963
|
+
}>;
|
|
964
|
+
listSenders(options?: Record<string, unknown>): Promise<{
|
|
965
|
+
success: boolean;
|
|
966
|
+
data?: Array<{
|
|
967
|
+
id: string;
|
|
968
|
+
email: string;
|
|
969
|
+
name: string;
|
|
970
|
+
[key: string]: unknown;
|
|
971
|
+
}>;
|
|
972
|
+
error?: string;
|
|
973
|
+
}>;
|
|
974
|
+
updateSender(id: string, input: Record<string, unknown>): Promise<{
|
|
975
|
+
success: boolean;
|
|
976
|
+
data?: {
|
|
977
|
+
id: string;
|
|
978
|
+
name: string;
|
|
979
|
+
email?: string;
|
|
980
|
+
[key: string]: unknown;
|
|
981
|
+
};
|
|
982
|
+
error?: string;
|
|
983
|
+
}>;
|
|
984
|
+
deleteSender(id: string): Promise<{
|
|
985
|
+
success: boolean;
|
|
986
|
+
error?: string;
|
|
987
|
+
}>;
|
|
988
|
+
checkVerificationStatus?(id: string): Promise<{
|
|
989
|
+
success: boolean;
|
|
990
|
+
data?: {
|
|
991
|
+
status: string;
|
|
992
|
+
[key: string]: unknown;
|
|
993
|
+
};
|
|
994
|
+
}>;
|
|
995
|
+
}
|
|
996
|
+
export interface EnhancedEmailManagerConfig extends EmailManagerConfig {
|
|
997
|
+
templateServiceEnabled?: boolean;
|
|
998
|
+
senderManagerEnabled?: boolean;
|
|
999
|
+
variableRegistryEnabled?: boolean;
|
|
1000
|
+
bootstrap?: BootstrapConfig;
|
|
1001
|
+
stagingSafety?: StagingSafetyConfig;
|
|
1002
|
+
templateSync?: TemplateSyncConfig;
|
|
1003
|
+
monitoring?: MonitoringConfig;
|
|
1004
|
+
subscription?: SubscriptionConfig;
|
|
1005
|
+
routing?: RoutingConfig;
|
|
1006
|
+
degradation?: DegradationConfig;
|
|
1007
|
+
/** Optional sender service for delegated sender management */
|
|
1008
|
+
senderService?: SenderService;
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Enhanced Send Options
|
|
1012
|
+
*/
|
|
1013
|
+
export interface EnhancedSendOptions {
|
|
1014
|
+
providerId?: string;
|
|
1015
|
+
bypassSafety?: boolean;
|
|
1016
|
+
metadata?: Record<string, unknown>;
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Routing Metadata - tracks how a feature was routed across providers
|
|
1020
|
+
*/
|
|
1021
|
+
export interface RoutingMetadata {
|
|
1022
|
+
provider: string;
|
|
1023
|
+
feature: string;
|
|
1024
|
+
source: 'provider' | 'platform' | 'enhanced' | 'unsupported';
|
|
1025
|
+
degraded: boolean;
|
|
1026
|
+
degradationReason?: string;
|
|
1027
|
+
attemptedProviders?: string[];
|
|
1028
|
+
}
|
|
1029
|
+
//# sourceMappingURL=types.d.ts.map
|