@astralibx/email-rule-engine 3.0.2 → 5.0.0
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/README.md +1 -1
- package/dist/index.d.mts +83 -10
- package/dist/index.d.ts +83 -10
- package/dist/index.js +537 -102
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +536 -101
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ const engine = createEmailRuleEngine({
|
|
|
59
59
|
text: params.textBody,
|
|
60
60
|
});
|
|
61
61
|
},
|
|
62
|
-
selectAgent: async () => ({ accountId: 'default' }),
|
|
62
|
+
selectAgent: async () => ({ accountId: 'default', email: 'noreply@myapp.com', metadata: {} }),
|
|
63
63
|
findIdentifier: async (email) => {
|
|
64
64
|
const contact = await Contact.findOne({ email });
|
|
65
65
|
return contact ? { id: contact._id.toString(), contactId: contact._id.toString() } : null;
|
package/dist/index.d.mts
CHANGED
|
@@ -68,11 +68,17 @@ interface RuleRunStats {
|
|
|
68
68
|
skippedByThrottle: number;
|
|
69
69
|
errors: number;
|
|
70
70
|
}
|
|
71
|
-
interface
|
|
71
|
+
interface QueryTarget {
|
|
72
|
+
mode: 'query';
|
|
72
73
|
role: TemplateAudience;
|
|
73
74
|
platform: string;
|
|
74
75
|
conditions: RuleCondition[];
|
|
75
76
|
}
|
|
77
|
+
interface ListTarget {
|
|
78
|
+
mode: 'list';
|
|
79
|
+
identifiers: string[];
|
|
80
|
+
}
|
|
81
|
+
type RuleTarget = QueryTarget | ListTarget;
|
|
76
82
|
interface EmailRule {
|
|
77
83
|
_id: string;
|
|
78
84
|
name: string;
|
|
@@ -163,11 +169,50 @@ interface SendEmailParams {
|
|
|
163
169
|
}
|
|
164
170
|
interface AgentSelection {
|
|
165
171
|
accountId: string;
|
|
172
|
+
email: string;
|
|
173
|
+
metadata: Record<string, unknown>;
|
|
174
|
+
}
|
|
175
|
+
interface BeforeSendParams {
|
|
176
|
+
htmlBody: string;
|
|
177
|
+
textBody: string;
|
|
178
|
+
subject: string;
|
|
179
|
+
account: {
|
|
180
|
+
id: string;
|
|
181
|
+
email: string;
|
|
182
|
+
metadata: Record<string, unknown>;
|
|
183
|
+
};
|
|
184
|
+
user: {
|
|
185
|
+
id: string;
|
|
186
|
+
email: string;
|
|
187
|
+
name: string;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
interface BeforeSendResult {
|
|
191
|
+
htmlBody: string;
|
|
192
|
+
textBody: string;
|
|
193
|
+
subject: string;
|
|
166
194
|
}
|
|
167
195
|
interface RecipientIdentifier {
|
|
168
196
|
id: string;
|
|
169
197
|
contactId: string;
|
|
170
198
|
}
|
|
199
|
+
interface RunProgress {
|
|
200
|
+
rulesTotal: number;
|
|
201
|
+
rulesCompleted: number;
|
|
202
|
+
sent: number;
|
|
203
|
+
failed: number;
|
|
204
|
+
skipped: number;
|
|
205
|
+
invalid: number;
|
|
206
|
+
}
|
|
207
|
+
type RunStatus = 'running' | 'completed' | 'cancelled' | 'failed';
|
|
208
|
+
interface RunStatusResponse {
|
|
209
|
+
runId: string;
|
|
210
|
+
status: RunStatus;
|
|
211
|
+
currentRule: string;
|
|
212
|
+
progress: RunProgress;
|
|
213
|
+
startedAt: string;
|
|
214
|
+
elapsed: number;
|
|
215
|
+
}
|
|
171
216
|
interface EmailRuleEngineConfig {
|
|
172
217
|
db: {
|
|
173
218
|
connection: Connection;
|
|
@@ -229,6 +274,7 @@ interface EmailRuleEngineConfig {
|
|
|
229
274
|
totalStats: RuleRunStats;
|
|
230
275
|
perRuleStats: PerRuleStats[];
|
|
231
276
|
}) => void;
|
|
277
|
+
beforeSend?: (params: BeforeSendParams) => Promise<BeforeSendResult>;
|
|
232
278
|
};
|
|
233
279
|
}
|
|
234
280
|
|
|
@@ -240,9 +286,9 @@ interface EmailTemplate {
|
|
|
240
286
|
category: TemplateCategory;
|
|
241
287
|
audience: TemplateAudience;
|
|
242
288
|
platform: string;
|
|
243
|
-
subject: string;
|
|
244
|
-
body: string;
|
|
245
289
|
textBody?: string;
|
|
290
|
+
subjects: string[];
|
|
291
|
+
bodies: string[];
|
|
246
292
|
variables: string[];
|
|
247
293
|
version: number;
|
|
248
294
|
isActive: boolean;
|
|
@@ -256,9 +302,9 @@ interface CreateEmailTemplateInput {
|
|
|
256
302
|
category: TemplateCategory;
|
|
257
303
|
audience: TemplateAudience;
|
|
258
304
|
platform: string;
|
|
259
|
-
subject: string;
|
|
260
|
-
body: string;
|
|
261
305
|
textBody?: string;
|
|
306
|
+
subjects: string[];
|
|
307
|
+
bodies: string[];
|
|
262
308
|
variables?: string[];
|
|
263
309
|
}
|
|
264
310
|
interface UpdateEmailTemplateInput {
|
|
@@ -267,9 +313,9 @@ interface UpdateEmailTemplateInput {
|
|
|
267
313
|
category?: TemplateCategory;
|
|
268
314
|
audience?: TemplateAudience;
|
|
269
315
|
platform?: string;
|
|
270
|
-
subject?: string;
|
|
271
|
-
body?: string;
|
|
272
316
|
textBody?: string;
|
|
317
|
+
subjects?: string[];
|
|
318
|
+
bodies?: string[];
|
|
273
319
|
variables?: string[];
|
|
274
320
|
isActive?: boolean;
|
|
275
321
|
}
|
|
@@ -325,6 +371,8 @@ interface IEmailRuleSend {
|
|
|
325
371
|
accountId?: string;
|
|
326
372
|
senderName?: string;
|
|
327
373
|
subject?: string;
|
|
374
|
+
subjectIndex?: number;
|
|
375
|
+
bodyIndex?: number;
|
|
328
376
|
failureReason?: string;
|
|
329
377
|
}
|
|
330
378
|
type EmailRuleSendDocument = HydratedDocument<IEmailRuleSend>;
|
|
@@ -336,6 +384,8 @@ interface EmailRuleSendStatics {
|
|
|
336
384
|
accountId?: string;
|
|
337
385
|
senderName?: string;
|
|
338
386
|
subject?: string;
|
|
387
|
+
subjectIndex?: number;
|
|
388
|
+
bodyIndex?: number;
|
|
339
389
|
failureReason?: string;
|
|
340
390
|
}): Promise<EmailRuleSendDocument>;
|
|
341
391
|
}
|
|
@@ -351,10 +401,12 @@ declare function createEmailRuleSendSchema(collectionPrefix?: string): Schema<IE
|
|
|
351
401
|
}>;
|
|
352
402
|
|
|
353
403
|
interface IEmailRuleRunLog {
|
|
404
|
+
runId?: string;
|
|
354
405
|
runAt: Date;
|
|
355
406
|
triggeredBy: string;
|
|
356
407
|
duration: number;
|
|
357
408
|
rulesProcessed: number;
|
|
409
|
+
status?: string;
|
|
358
410
|
totalStats: {
|
|
359
411
|
matched: number;
|
|
360
412
|
sent: number;
|
|
@@ -494,11 +546,26 @@ declare class RuleRunnerService {
|
|
|
494
546
|
private templateRenderer;
|
|
495
547
|
private lock;
|
|
496
548
|
private logger;
|
|
549
|
+
private redis;
|
|
550
|
+
private keyPrefix;
|
|
497
551
|
constructor(EmailRule: EmailRuleModel, EmailTemplate: EmailTemplateModel, EmailRuleSend: EmailRuleSendModel, EmailRuleRunLog: EmailRuleRunLogModel, EmailThrottleConfig: EmailThrottleConfigModel, config: EmailRuleEngineConfig);
|
|
498
|
-
runAllRules(triggeredBy?: RunTrigger): Promise<
|
|
499
|
-
|
|
552
|
+
runAllRules(triggeredBy?: RunTrigger, runId?: string): Promise<{
|
|
553
|
+
runId: string;
|
|
554
|
+
}>;
|
|
555
|
+
executeRule(rule: any, throttleMap: Map<string, UserThrottle>, throttleConfig: any, templateMap?: Map<string, any>, runId?: string): Promise<RuleRunStats>;
|
|
556
|
+
private executeListMode;
|
|
557
|
+
private executeQueryMode;
|
|
500
558
|
private checkThrottle;
|
|
501
559
|
private getTodayStart;
|
|
560
|
+
private updateRunProgress;
|
|
561
|
+
private updateRunSendProgress;
|
|
562
|
+
getStatus(runId: string): Promise<RunStatusResponse | null>;
|
|
563
|
+
cancel(runId: string): Promise<{
|
|
564
|
+
ok: boolean;
|
|
565
|
+
}>;
|
|
566
|
+
trigger(triggeredBy?: RunTrigger): {
|
|
567
|
+
runId: string;
|
|
568
|
+
};
|
|
502
569
|
buildThrottleMap(recentSends: any[]): Map<string, UserThrottle>;
|
|
503
570
|
}
|
|
504
571
|
|
|
@@ -549,8 +616,14 @@ declare class TemplateRenderService {
|
|
|
549
616
|
constructor();
|
|
550
617
|
renderSingle(subject: string, body: string, data: Record<string, unknown>, textBody?: string): RenderResult;
|
|
551
618
|
compileBatch(subject: string, body: string, textBody?: string): CompiledTemplate;
|
|
619
|
+
compileBatchVariants(subjects: string[], bodies: string[], textBody?: string): {
|
|
620
|
+
subjectFns: HandlebarsTemplateDelegate[];
|
|
621
|
+
bodyFns: HandlebarsTemplateDelegate[];
|
|
622
|
+
textBodyFn?: HandlebarsTemplateDelegate;
|
|
623
|
+
};
|
|
552
624
|
renderFromCompiled(compiled: CompiledTemplate, data: Record<string, unknown>): RenderResult;
|
|
553
625
|
renderPreview(subject: string, body: string, data: Record<string, unknown>, textBody?: string): RenderResult;
|
|
626
|
+
htmlToText(html: string): string;
|
|
554
627
|
extractVariables(template: string): string[];
|
|
555
628
|
validateTemplate(body: string): {
|
|
556
629
|
valid: boolean;
|
|
@@ -604,4 +677,4 @@ interface EmailRuleEngine {
|
|
|
604
677
|
*/
|
|
605
678
|
declare function createEmailRuleEngine(config: EmailRuleEngineConfig): EmailRuleEngine;
|
|
606
679
|
|
|
607
|
-
export { type AgentSelection, AlxEmailError, type CompiledTemplate, ConfigValidationError, type CreateEmailRuleInput, type CreateEmailTemplateInput, DuplicateSlugError, EMAIL_SEND_STATUS, EMAIL_TYPE, type EmailRule, type EmailRuleDocument, type EmailRuleEngine, type EmailRuleEngineConfig, type EmailRuleModel, type EmailRuleRunLog, type EmailRuleRunLogDocument, type EmailRuleRunLogModel, type EmailRuleRunLogStatics, type EmailRuleSend, type EmailRuleSendDocument, type EmailRuleSendModel, type EmailRuleSendStatics, type EmailRuleStatics, type EmailSendStatus, type EmailTemplate, type EmailTemplateDocument, type EmailTemplateModel, type EmailTemplateStatics, type EmailThrottleConfig, type EmailThrottleConfigDocument, type EmailThrottleConfigModel, type EmailThrottleConfigStatics, type EmailType, type IEmailRule, type IEmailRuleRunLog, type IEmailRuleSend, type IEmailTemplate, type IEmailThrottleConfig, LockAcquisitionError, type PerRuleStats, RULE_OPERATOR, RUN_TRIGGER, type RecipientIdentifier, RedisLock, type RenderResult, type RuleCondition, RuleNotFoundError, type RuleOperator, type RuleRunStats, RuleRunnerService, RuleService, type RuleTarget, RuleTemplateIncompatibleError, type RunTrigger, type SendEmailParams, TEMPLATE_AUDIENCE, TEMPLATE_CATEGORY, THROTTLE_WINDOW, type TemplateAudience, type TemplateCategory, TemplateNotFoundError, TemplateRenderService, TemplateService, TemplateSyntaxError, type ThrottleWindow, type UpdateEmailRuleInput, type UpdateEmailTemplateInput, type UpdateEmailThrottleConfigInput, createEmailRuleEngine, createEmailRuleRunLogSchema, createEmailRuleSchema, createEmailRuleSendSchema, createEmailTemplateSchema, createEmailThrottleConfigSchema, validateConfig };
|
|
680
|
+
export { type AgentSelection, AlxEmailError, type BeforeSendParams, type BeforeSendResult, type CompiledTemplate, ConfigValidationError, type CreateEmailRuleInput, type CreateEmailTemplateInput, DuplicateSlugError, EMAIL_SEND_STATUS, EMAIL_TYPE, type EmailRule, type EmailRuleDocument, type EmailRuleEngine, type EmailRuleEngineConfig, type EmailRuleModel, type EmailRuleRunLog, type EmailRuleRunLogDocument, type EmailRuleRunLogModel, type EmailRuleRunLogStatics, type EmailRuleSend, type EmailRuleSendDocument, type EmailRuleSendModel, type EmailRuleSendStatics, type EmailRuleStatics, type EmailSendStatus, type EmailTemplate, type EmailTemplateDocument, type EmailTemplateModel, type EmailTemplateStatics, type EmailThrottleConfig, type EmailThrottleConfigDocument, type EmailThrottleConfigModel, type EmailThrottleConfigStatics, type EmailType, type IEmailRule, type IEmailRuleRunLog, type IEmailRuleSend, type IEmailTemplate, type IEmailThrottleConfig, type ListTarget, LockAcquisitionError, type PerRuleStats, type QueryTarget, RULE_OPERATOR, RUN_TRIGGER, type RecipientIdentifier, RedisLock, type RenderResult, type RuleCondition, RuleNotFoundError, type RuleOperator, type RuleRunStats, RuleRunnerService, RuleService, type RuleTarget, RuleTemplateIncompatibleError, type RunTrigger, type SendEmailParams, TEMPLATE_AUDIENCE, TEMPLATE_CATEGORY, THROTTLE_WINDOW, type TemplateAudience, type TemplateCategory, TemplateNotFoundError, TemplateRenderService, TemplateService, TemplateSyntaxError, type ThrottleWindow, type UpdateEmailRuleInput, type UpdateEmailTemplateInput, type UpdateEmailThrottleConfigInput, createEmailRuleEngine, createEmailRuleRunLogSchema, createEmailRuleSchema, createEmailRuleSendSchema, createEmailTemplateSchema, createEmailThrottleConfigSchema, validateConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -68,11 +68,17 @@ interface RuleRunStats {
|
|
|
68
68
|
skippedByThrottle: number;
|
|
69
69
|
errors: number;
|
|
70
70
|
}
|
|
71
|
-
interface
|
|
71
|
+
interface QueryTarget {
|
|
72
|
+
mode: 'query';
|
|
72
73
|
role: TemplateAudience;
|
|
73
74
|
platform: string;
|
|
74
75
|
conditions: RuleCondition[];
|
|
75
76
|
}
|
|
77
|
+
interface ListTarget {
|
|
78
|
+
mode: 'list';
|
|
79
|
+
identifiers: string[];
|
|
80
|
+
}
|
|
81
|
+
type RuleTarget = QueryTarget | ListTarget;
|
|
76
82
|
interface EmailRule {
|
|
77
83
|
_id: string;
|
|
78
84
|
name: string;
|
|
@@ -163,11 +169,50 @@ interface SendEmailParams {
|
|
|
163
169
|
}
|
|
164
170
|
interface AgentSelection {
|
|
165
171
|
accountId: string;
|
|
172
|
+
email: string;
|
|
173
|
+
metadata: Record<string, unknown>;
|
|
174
|
+
}
|
|
175
|
+
interface BeforeSendParams {
|
|
176
|
+
htmlBody: string;
|
|
177
|
+
textBody: string;
|
|
178
|
+
subject: string;
|
|
179
|
+
account: {
|
|
180
|
+
id: string;
|
|
181
|
+
email: string;
|
|
182
|
+
metadata: Record<string, unknown>;
|
|
183
|
+
};
|
|
184
|
+
user: {
|
|
185
|
+
id: string;
|
|
186
|
+
email: string;
|
|
187
|
+
name: string;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
interface BeforeSendResult {
|
|
191
|
+
htmlBody: string;
|
|
192
|
+
textBody: string;
|
|
193
|
+
subject: string;
|
|
166
194
|
}
|
|
167
195
|
interface RecipientIdentifier {
|
|
168
196
|
id: string;
|
|
169
197
|
contactId: string;
|
|
170
198
|
}
|
|
199
|
+
interface RunProgress {
|
|
200
|
+
rulesTotal: number;
|
|
201
|
+
rulesCompleted: number;
|
|
202
|
+
sent: number;
|
|
203
|
+
failed: number;
|
|
204
|
+
skipped: number;
|
|
205
|
+
invalid: number;
|
|
206
|
+
}
|
|
207
|
+
type RunStatus = 'running' | 'completed' | 'cancelled' | 'failed';
|
|
208
|
+
interface RunStatusResponse {
|
|
209
|
+
runId: string;
|
|
210
|
+
status: RunStatus;
|
|
211
|
+
currentRule: string;
|
|
212
|
+
progress: RunProgress;
|
|
213
|
+
startedAt: string;
|
|
214
|
+
elapsed: number;
|
|
215
|
+
}
|
|
171
216
|
interface EmailRuleEngineConfig {
|
|
172
217
|
db: {
|
|
173
218
|
connection: Connection;
|
|
@@ -229,6 +274,7 @@ interface EmailRuleEngineConfig {
|
|
|
229
274
|
totalStats: RuleRunStats;
|
|
230
275
|
perRuleStats: PerRuleStats[];
|
|
231
276
|
}) => void;
|
|
277
|
+
beforeSend?: (params: BeforeSendParams) => Promise<BeforeSendResult>;
|
|
232
278
|
};
|
|
233
279
|
}
|
|
234
280
|
|
|
@@ -240,9 +286,9 @@ interface EmailTemplate {
|
|
|
240
286
|
category: TemplateCategory;
|
|
241
287
|
audience: TemplateAudience;
|
|
242
288
|
platform: string;
|
|
243
|
-
subject: string;
|
|
244
|
-
body: string;
|
|
245
289
|
textBody?: string;
|
|
290
|
+
subjects: string[];
|
|
291
|
+
bodies: string[];
|
|
246
292
|
variables: string[];
|
|
247
293
|
version: number;
|
|
248
294
|
isActive: boolean;
|
|
@@ -256,9 +302,9 @@ interface CreateEmailTemplateInput {
|
|
|
256
302
|
category: TemplateCategory;
|
|
257
303
|
audience: TemplateAudience;
|
|
258
304
|
platform: string;
|
|
259
|
-
subject: string;
|
|
260
|
-
body: string;
|
|
261
305
|
textBody?: string;
|
|
306
|
+
subjects: string[];
|
|
307
|
+
bodies: string[];
|
|
262
308
|
variables?: string[];
|
|
263
309
|
}
|
|
264
310
|
interface UpdateEmailTemplateInput {
|
|
@@ -267,9 +313,9 @@ interface UpdateEmailTemplateInput {
|
|
|
267
313
|
category?: TemplateCategory;
|
|
268
314
|
audience?: TemplateAudience;
|
|
269
315
|
platform?: string;
|
|
270
|
-
subject?: string;
|
|
271
|
-
body?: string;
|
|
272
316
|
textBody?: string;
|
|
317
|
+
subjects?: string[];
|
|
318
|
+
bodies?: string[];
|
|
273
319
|
variables?: string[];
|
|
274
320
|
isActive?: boolean;
|
|
275
321
|
}
|
|
@@ -325,6 +371,8 @@ interface IEmailRuleSend {
|
|
|
325
371
|
accountId?: string;
|
|
326
372
|
senderName?: string;
|
|
327
373
|
subject?: string;
|
|
374
|
+
subjectIndex?: number;
|
|
375
|
+
bodyIndex?: number;
|
|
328
376
|
failureReason?: string;
|
|
329
377
|
}
|
|
330
378
|
type EmailRuleSendDocument = HydratedDocument<IEmailRuleSend>;
|
|
@@ -336,6 +384,8 @@ interface EmailRuleSendStatics {
|
|
|
336
384
|
accountId?: string;
|
|
337
385
|
senderName?: string;
|
|
338
386
|
subject?: string;
|
|
387
|
+
subjectIndex?: number;
|
|
388
|
+
bodyIndex?: number;
|
|
339
389
|
failureReason?: string;
|
|
340
390
|
}): Promise<EmailRuleSendDocument>;
|
|
341
391
|
}
|
|
@@ -351,10 +401,12 @@ declare function createEmailRuleSendSchema(collectionPrefix?: string): Schema<IE
|
|
|
351
401
|
}>;
|
|
352
402
|
|
|
353
403
|
interface IEmailRuleRunLog {
|
|
404
|
+
runId?: string;
|
|
354
405
|
runAt: Date;
|
|
355
406
|
triggeredBy: string;
|
|
356
407
|
duration: number;
|
|
357
408
|
rulesProcessed: number;
|
|
409
|
+
status?: string;
|
|
358
410
|
totalStats: {
|
|
359
411
|
matched: number;
|
|
360
412
|
sent: number;
|
|
@@ -494,11 +546,26 @@ declare class RuleRunnerService {
|
|
|
494
546
|
private templateRenderer;
|
|
495
547
|
private lock;
|
|
496
548
|
private logger;
|
|
549
|
+
private redis;
|
|
550
|
+
private keyPrefix;
|
|
497
551
|
constructor(EmailRule: EmailRuleModel, EmailTemplate: EmailTemplateModel, EmailRuleSend: EmailRuleSendModel, EmailRuleRunLog: EmailRuleRunLogModel, EmailThrottleConfig: EmailThrottleConfigModel, config: EmailRuleEngineConfig);
|
|
498
|
-
runAllRules(triggeredBy?: RunTrigger): Promise<
|
|
499
|
-
|
|
552
|
+
runAllRules(triggeredBy?: RunTrigger, runId?: string): Promise<{
|
|
553
|
+
runId: string;
|
|
554
|
+
}>;
|
|
555
|
+
executeRule(rule: any, throttleMap: Map<string, UserThrottle>, throttleConfig: any, templateMap?: Map<string, any>, runId?: string): Promise<RuleRunStats>;
|
|
556
|
+
private executeListMode;
|
|
557
|
+
private executeQueryMode;
|
|
500
558
|
private checkThrottle;
|
|
501
559
|
private getTodayStart;
|
|
560
|
+
private updateRunProgress;
|
|
561
|
+
private updateRunSendProgress;
|
|
562
|
+
getStatus(runId: string): Promise<RunStatusResponse | null>;
|
|
563
|
+
cancel(runId: string): Promise<{
|
|
564
|
+
ok: boolean;
|
|
565
|
+
}>;
|
|
566
|
+
trigger(triggeredBy?: RunTrigger): {
|
|
567
|
+
runId: string;
|
|
568
|
+
};
|
|
502
569
|
buildThrottleMap(recentSends: any[]): Map<string, UserThrottle>;
|
|
503
570
|
}
|
|
504
571
|
|
|
@@ -549,8 +616,14 @@ declare class TemplateRenderService {
|
|
|
549
616
|
constructor();
|
|
550
617
|
renderSingle(subject: string, body: string, data: Record<string, unknown>, textBody?: string): RenderResult;
|
|
551
618
|
compileBatch(subject: string, body: string, textBody?: string): CompiledTemplate;
|
|
619
|
+
compileBatchVariants(subjects: string[], bodies: string[], textBody?: string): {
|
|
620
|
+
subjectFns: HandlebarsTemplateDelegate[];
|
|
621
|
+
bodyFns: HandlebarsTemplateDelegate[];
|
|
622
|
+
textBodyFn?: HandlebarsTemplateDelegate;
|
|
623
|
+
};
|
|
552
624
|
renderFromCompiled(compiled: CompiledTemplate, data: Record<string, unknown>): RenderResult;
|
|
553
625
|
renderPreview(subject: string, body: string, data: Record<string, unknown>, textBody?: string): RenderResult;
|
|
626
|
+
htmlToText(html: string): string;
|
|
554
627
|
extractVariables(template: string): string[];
|
|
555
628
|
validateTemplate(body: string): {
|
|
556
629
|
valid: boolean;
|
|
@@ -604,4 +677,4 @@ interface EmailRuleEngine {
|
|
|
604
677
|
*/
|
|
605
678
|
declare function createEmailRuleEngine(config: EmailRuleEngineConfig): EmailRuleEngine;
|
|
606
679
|
|
|
607
|
-
export { type AgentSelection, AlxEmailError, type CompiledTemplate, ConfigValidationError, type CreateEmailRuleInput, type CreateEmailTemplateInput, DuplicateSlugError, EMAIL_SEND_STATUS, EMAIL_TYPE, type EmailRule, type EmailRuleDocument, type EmailRuleEngine, type EmailRuleEngineConfig, type EmailRuleModel, type EmailRuleRunLog, type EmailRuleRunLogDocument, type EmailRuleRunLogModel, type EmailRuleRunLogStatics, type EmailRuleSend, type EmailRuleSendDocument, type EmailRuleSendModel, type EmailRuleSendStatics, type EmailRuleStatics, type EmailSendStatus, type EmailTemplate, type EmailTemplateDocument, type EmailTemplateModel, type EmailTemplateStatics, type EmailThrottleConfig, type EmailThrottleConfigDocument, type EmailThrottleConfigModel, type EmailThrottleConfigStatics, type EmailType, type IEmailRule, type IEmailRuleRunLog, type IEmailRuleSend, type IEmailTemplate, type IEmailThrottleConfig, LockAcquisitionError, type PerRuleStats, RULE_OPERATOR, RUN_TRIGGER, type RecipientIdentifier, RedisLock, type RenderResult, type RuleCondition, RuleNotFoundError, type RuleOperator, type RuleRunStats, RuleRunnerService, RuleService, type RuleTarget, RuleTemplateIncompatibleError, type RunTrigger, type SendEmailParams, TEMPLATE_AUDIENCE, TEMPLATE_CATEGORY, THROTTLE_WINDOW, type TemplateAudience, type TemplateCategory, TemplateNotFoundError, TemplateRenderService, TemplateService, TemplateSyntaxError, type ThrottleWindow, type UpdateEmailRuleInput, type UpdateEmailTemplateInput, type UpdateEmailThrottleConfigInput, createEmailRuleEngine, createEmailRuleRunLogSchema, createEmailRuleSchema, createEmailRuleSendSchema, createEmailTemplateSchema, createEmailThrottleConfigSchema, validateConfig };
|
|
680
|
+
export { type AgentSelection, AlxEmailError, type BeforeSendParams, type BeforeSendResult, type CompiledTemplate, ConfigValidationError, type CreateEmailRuleInput, type CreateEmailTemplateInput, DuplicateSlugError, EMAIL_SEND_STATUS, EMAIL_TYPE, type EmailRule, type EmailRuleDocument, type EmailRuleEngine, type EmailRuleEngineConfig, type EmailRuleModel, type EmailRuleRunLog, type EmailRuleRunLogDocument, type EmailRuleRunLogModel, type EmailRuleRunLogStatics, type EmailRuleSend, type EmailRuleSendDocument, type EmailRuleSendModel, type EmailRuleSendStatics, type EmailRuleStatics, type EmailSendStatus, type EmailTemplate, type EmailTemplateDocument, type EmailTemplateModel, type EmailTemplateStatics, type EmailThrottleConfig, type EmailThrottleConfigDocument, type EmailThrottleConfigModel, type EmailThrottleConfigStatics, type EmailType, type IEmailRule, type IEmailRuleRunLog, type IEmailRuleSend, type IEmailTemplate, type IEmailThrottleConfig, type ListTarget, LockAcquisitionError, type PerRuleStats, type QueryTarget, RULE_OPERATOR, RUN_TRIGGER, type RecipientIdentifier, RedisLock, type RenderResult, type RuleCondition, RuleNotFoundError, type RuleOperator, type RuleRunStats, RuleRunnerService, RuleService, type RuleTarget, RuleTemplateIncompatibleError, type RunTrigger, type SendEmailParams, TEMPLATE_AUDIENCE, TEMPLATE_CATEGORY, THROTTLE_WINDOW, type TemplateAudience, type TemplateCategory, TemplateNotFoundError, TemplateRenderService, TemplateService, TemplateSyntaxError, type ThrottleWindow, type UpdateEmailRuleInput, type UpdateEmailTemplateInput, type UpdateEmailThrottleConfigInput, createEmailRuleEngine, createEmailRuleRunLogSchema, createEmailRuleSchema, createEmailRuleSendSchema, createEmailTemplateSchema, createEmailThrottleConfigSchema, validateConfig };
|