hazo_notify 1.0.2 → 1.1.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.
- package/README.md +30 -10
- package/config/hazo_logs_config.ini +21 -0
- package/{hazo_notify_config.ini → config/hazo_notify_config.ini} +39 -0
- package/data/templates/email_signature.html +11 -0
- package/data/templates/email_signature.txt +4 -0
- package/data/templates/email_verification.html +64 -0
- package/data/templates/email_verification.txt +11 -0
- package/data/templates/forgot_password.html +64 -0
- package/data/templates/forgot_password.txt +11 -0
- package/data/templates/manifest.json +86 -0
- package/data/templates/welcome_email.html +54 -0
- package/data/templates/welcome_email.txt +8 -0
- package/dist/emailer/emailer.d.ts +3 -3
- package/dist/emailer/emailer.d.ts.map +1 -1
- package/dist/emailer/emailer.js +25 -15
- package/dist/emailer/emailer.js.map +1 -1
- package/dist/emailer/index.d.ts +1 -0
- package/dist/emailer/index.d.ts.map +1 -1
- package/dist/emailer/index.js +5 -1
- package/dist/emailer/index.js.map +1 -1
- package/dist/emailer/providers/pop3_provider.d.ts +3 -2
- package/dist/emailer/providers/pop3_provider.d.ts.map +1 -1
- package/dist/emailer/providers/pop3_provider.js +2 -1
- package/dist/emailer/providers/pop3_provider.js.map +1 -1
- package/dist/emailer/providers/smtp_provider.d.ts +3 -2
- package/dist/emailer/providers/smtp_provider.d.ts.map +1 -1
- package/dist/emailer/providers/smtp_provider.js +2 -1
- package/dist/emailer/providers/smtp_provider.js.map +1 -1
- package/dist/emailer/providers/zeptomail_provider.d.ts +3 -2
- package/dist/emailer/providers/zeptomail_provider.d.ts.map +1 -1
- package/dist/emailer/providers/zeptomail_provider.js +24 -11
- package/dist/emailer/providers/zeptomail_provider.js.map +1 -1
- package/dist/emailer/types.d.ts +13 -1
- package/dist/emailer/types.d.ts.map +1 -1
- package/dist/emailer/utils/logger.d.ts +22 -14
- package/dist/emailer/utils/logger.d.ts.map +1 -1
- package/dist/emailer/utils/logger.js +51 -13
- package/dist/emailer/utils/logger.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/template_manager/config/config_loader.d.ts +48 -0
- package/dist/template_manager/config/config_loader.d.ts.map +1 -0
- package/dist/template_manager/config/config_loader.js +161 -0
- package/dist/template_manager/config/config_loader.js.map +1 -0
- package/dist/template_manager/config/constants.d.ts +101 -0
- package/dist/template_manager/config/constants.d.ts.map +1 -0
- package/dist/template_manager/config/constants.js +163 -0
- package/dist/template_manager/config/constants.js.map +1 -0
- package/dist/template_manager/config/index.d.ts +6 -0
- package/dist/template_manager/config/index.d.ts.map +1 -0
- package/dist/{lib/emailer/utils → template_manager/config}/index.js +4 -4
- package/dist/template_manager/config/index.js.map +1 -0
- package/dist/template_manager/db/category_repository.d.ts +57 -0
- package/dist/template_manager/db/category_repository.d.ts.map +1 -0
- package/dist/template_manager/db/category_repository.js +326 -0
- package/dist/template_manager/db/category_repository.js.map +1 -0
- package/dist/template_manager/db/index.d.ts +6 -0
- package/dist/template_manager/db/index.d.ts.map +1 -0
- package/dist/template_manager/db/index.js +23 -0
- package/dist/template_manager/db/index.js.map +1 -0
- package/dist/template_manager/db/template_repository.d.ts +76 -0
- package/dist/template_manager/db/template_repository.d.ts.map +1 -0
- package/dist/template_manager/db/template_repository.js +684 -0
- package/dist/template_manager/db/template_repository.js.map +1 -0
- package/dist/template_manager/engine/handlebars_engine.d.ts +52 -0
- package/dist/template_manager/engine/handlebars_engine.d.ts.map +1 -0
- package/dist/template_manager/engine/handlebars_engine.js +175 -0
- package/dist/template_manager/engine/handlebars_engine.js.map +1 -0
- package/dist/template_manager/engine/index.d.ts +6 -0
- package/dist/template_manager/engine/index.d.ts.map +1 -0
- package/dist/template_manager/engine/index.js +19 -0
- package/dist/template_manager/engine/index.js.map +1 -0
- package/dist/template_manager/engine/variable_resolver.d.ts +48 -0
- package/dist/template_manager/engine/variable_resolver.d.ts.map +1 -0
- package/dist/template_manager/engine/variable_resolver.js +223 -0
- package/dist/template_manager/engine/variable_resolver.js.map +1 -0
- package/dist/template_manager/index.d.ts +32 -0
- package/dist/template_manager/index.d.ts.map +1 -0
- package/dist/template_manager/index.js +88 -0
- package/dist/template_manager/index.js.map +1 -0
- package/dist/template_manager/template_manager.d.ts +69 -0
- package/dist/template_manager/template_manager.d.ts.map +1 -0
- package/dist/template_manager/template_manager.js +335 -0
- package/dist/template_manager/template_manager.js.map +1 -0
- package/dist/template_manager/types.d.ts +255 -0
- package/dist/template_manager/types.d.ts.map +1 -0
- package/dist/template_manager/types.js +12 -0
- package/dist/template_manager/types.js.map +1 -0
- package/dist/template_manager/utils/index.d.ts +6 -0
- package/dist/template_manager/utils/index.d.ts.map +1 -0
- package/dist/template_manager/utils/index.js +21 -0
- package/dist/template_manager/utils/index.js.map +1 -0
- package/dist/template_manager/utils/system_variables.d.ts +28 -0
- package/dist/template_manager/utils/system_variables.d.ts.map +1 -0
- package/dist/template_manager/utils/system_variables.js +209 -0
- package/dist/template_manager/utils/system_variables.js.map +1 -0
- package/dist/template_manager/utils/validation.d.ts +74 -0
- package/dist/template_manager/utils/validation.d.ts.map +1 -0
- package/dist/template_manager/utils/validation.js +163 -0
- package/dist/template_manager/utils/validation.js.map +1 -0
- package/package.json +70 -22
- package/dist/lib/emailer/emailer.d.ts +0 -19
- package/dist/lib/emailer/emailer.d.ts.map +0 -1
- package/dist/lib/emailer/emailer.js +0 -220
- package/dist/lib/emailer/emailer.js.map +0 -1
- package/dist/lib/emailer/index.d.ts +0 -11
- package/dist/lib/emailer/index.d.ts.map +0 -1
- package/dist/lib/emailer/index.js +0 -34
- package/dist/lib/emailer/index.js.map +0 -1
- package/dist/lib/emailer/providers/index.d.ts +0 -15
- package/dist/lib/emailer/providers/index.d.ts.map +0 -1
- package/dist/lib/emailer/providers/index.js +0 -36
- package/dist/lib/emailer/providers/index.js.map +0 -1
- package/dist/lib/emailer/providers/pop3_provider.d.ts +0 -15
- package/dist/lib/emailer/providers/pop3_provider.d.ts.map +0 -1
- package/dist/lib/emailer/providers/pop3_provider.js +0 -29
- package/dist/lib/emailer/providers/pop3_provider.js.map +0 -1
- package/dist/lib/emailer/providers/smtp_provider.d.ts +0 -15
- package/dist/lib/emailer/providers/smtp_provider.d.ts.map +0 -1
- package/dist/lib/emailer/providers/smtp_provider.js +0 -29
- package/dist/lib/emailer/providers/smtp_provider.js.map +0 -1
- package/dist/lib/emailer/providers/zeptomail_provider.d.ts +0 -15
- package/dist/lib/emailer/providers/zeptomail_provider.d.ts.map +0 -1
- package/dist/lib/emailer/providers/zeptomail_provider.js +0 -250
- package/dist/lib/emailer/providers/zeptomail_provider.js.map +0 -1
- package/dist/lib/emailer/types.d.ts +0 -94
- package/dist/lib/emailer/types.d.ts.map +0 -1
- package/dist/lib/emailer/types.js +0 -6
- package/dist/lib/emailer/types.js.map +0 -1
- package/dist/lib/emailer/utils/constants.d.ts +0 -14
- package/dist/lib/emailer/utils/constants.d.ts.map +0 -1
- package/dist/lib/emailer/utils/constants.js +0 -22
- package/dist/lib/emailer/utils/constants.js.map +0 -1
- package/dist/lib/emailer/utils/index.d.ts +0 -8
- package/dist/lib/emailer/utils/index.d.ts.map +0 -1
- package/dist/lib/emailer/utils/index.js.map +0 -1
- package/dist/lib/emailer/utils/logger.d.ts +0 -37
- package/dist/lib/emailer/utils/logger.d.ts.map +0 -1
- package/dist/lib/emailer/utils/logger.js +0 -60
- package/dist/lib/emailer/utils/logger.js.map +0 -1
- package/dist/lib/emailer/utils/validation.d.ts +0 -37
- package/dist/lib/emailer/utils/validation.d.ts.map +0 -1
- package/dist/lib/emailer/utils/validation.js +0 -81
- package/dist/lib/emailer/utils/validation.js.map +0 -1
- package/dist/lib/index.d.ts +0 -6
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -22
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -3
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -9
- package/dist/lib/utils.js.map +0 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Template Manager Module
|
|
4
|
+
*
|
|
5
|
+
* Email template management with Handlebars rendering and database storage
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { send_template_email, seed_default_templates } from 'hazo_notify/template_manager';
|
|
10
|
+
* import { createHazoConnect } from 'hazo_connect/server';
|
|
11
|
+
*
|
|
12
|
+
* const hazo = createHazoConnect({ type: 'sqlite', sqlite: { database_path: './db.sqlite' } });
|
|
13
|
+
*
|
|
14
|
+
* // Seed default templates on app init
|
|
15
|
+
* await seed_default_templates(hazo, org_id, root_org_id);
|
|
16
|
+
*
|
|
17
|
+
* // Send templated email
|
|
18
|
+
* const result = await send_template_email({
|
|
19
|
+
* template_name: 'welcome_email',
|
|
20
|
+
* variables: { user_name: 'John', login_url: 'https://example.com/login' },
|
|
21
|
+
* to: 'john@example.com',
|
|
22
|
+
* subject: 'Welcome!'
|
|
23
|
+
* }, hazo, org_id);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.ERROR_MESSAGES = exports.TEMPLATE_REFERENCE_PATTERN = exports.VARIABLE_PATTERN = exports.MAX_CATEGORY_NAME_LENGTH = exports.MAX_TEMPLATE_NAME_LENGTH = exports.DEFAULT_CATEGORY_NAMES = exports.DEFAULT_TEMPLATE_NAMES = exports.TABLE_TEMPLATES = exports.TABLE_TEMPLATE_CATEGORY = exports.validate_provided_variables = exports.extract_variables_from_content = exports.validate_variable_name = exports.validate_category_name = exports.validate_template_name = exports.get_system_variable_definitions = exports.resolve_system_variables = exports.get_system_variables = exports.resolve_template_references = exports.extract_template_references = exports.resolve_variables = exports.invalidate_template_cache = exports.clear_template_cache = exports.render_handlebars_string = exports.render_handlebars = exports.seed_default_templates = exports.delete_template = exports.update_template = exports.create_template = exports.get_template_by_name = exports.get_template = exports.list_templates_by_category = exports.list_templates = exports.find_category_by_name = exports.delete_category = exports.update_category = exports.create_category = exports.get_category = exports.list_categories = exports.clear_config_cache = exports.get_all_variable_names = exports.get_template_variables = exports.load_template_config = exports.validate_template_variables = exports.preview_template = exports.render_template = exports.send_template_email = void 0;
|
|
28
|
+
// Core functions
|
|
29
|
+
var template_manager_1 = require("./template_manager");
|
|
30
|
+
Object.defineProperty(exports, "send_template_email", { enumerable: true, get: function () { return template_manager_1.send_template_email; } });
|
|
31
|
+
Object.defineProperty(exports, "render_template", { enumerable: true, get: function () { return template_manager_1.render_template; } });
|
|
32
|
+
Object.defineProperty(exports, "preview_template", { enumerable: true, get: function () { return template_manager_1.preview_template; } });
|
|
33
|
+
Object.defineProperty(exports, "validate_template_variables", { enumerable: true, get: function () { return template_manager_1.validate_template_variables; } });
|
|
34
|
+
// Config
|
|
35
|
+
var config_loader_1 = require("./config/config_loader");
|
|
36
|
+
Object.defineProperty(exports, "load_template_config", { enumerable: true, get: function () { return config_loader_1.load_template_config; } });
|
|
37
|
+
Object.defineProperty(exports, "get_template_variables", { enumerable: true, get: function () { return config_loader_1.get_template_variables; } });
|
|
38
|
+
Object.defineProperty(exports, "get_all_variable_names", { enumerable: true, get: function () { return config_loader_1.get_all_variable_names; } });
|
|
39
|
+
Object.defineProperty(exports, "clear_config_cache", { enumerable: true, get: function () { return config_loader_1.clear_config_cache; } });
|
|
40
|
+
// Database operations
|
|
41
|
+
var db_1 = require("./db");
|
|
42
|
+
// Categories
|
|
43
|
+
Object.defineProperty(exports, "list_categories", { enumerable: true, get: function () { return db_1.list_categories; } });
|
|
44
|
+
Object.defineProperty(exports, "get_category", { enumerable: true, get: function () { return db_1.get_category; } });
|
|
45
|
+
Object.defineProperty(exports, "create_category", { enumerable: true, get: function () { return db_1.create_category; } });
|
|
46
|
+
Object.defineProperty(exports, "update_category", { enumerable: true, get: function () { return db_1.update_category; } });
|
|
47
|
+
Object.defineProperty(exports, "delete_category", { enumerable: true, get: function () { return db_1.delete_category; } });
|
|
48
|
+
Object.defineProperty(exports, "find_category_by_name", { enumerable: true, get: function () { return db_1.find_category_by_name; } });
|
|
49
|
+
// Templates
|
|
50
|
+
Object.defineProperty(exports, "list_templates", { enumerable: true, get: function () { return db_1.list_templates; } });
|
|
51
|
+
Object.defineProperty(exports, "list_templates_by_category", { enumerable: true, get: function () { return db_1.list_templates_by_category; } });
|
|
52
|
+
Object.defineProperty(exports, "get_template", { enumerable: true, get: function () { return db_1.get_template; } });
|
|
53
|
+
Object.defineProperty(exports, "get_template_by_name", { enumerable: true, get: function () { return db_1.get_template_by_name; } });
|
|
54
|
+
Object.defineProperty(exports, "create_template", { enumerable: true, get: function () { return db_1.create_template; } });
|
|
55
|
+
Object.defineProperty(exports, "update_template", { enumerable: true, get: function () { return db_1.update_template; } });
|
|
56
|
+
Object.defineProperty(exports, "delete_template", { enumerable: true, get: function () { return db_1.delete_template; } });
|
|
57
|
+
Object.defineProperty(exports, "seed_default_templates", { enumerable: true, get: function () { return db_1.seed_default_templates; } });
|
|
58
|
+
// Engine
|
|
59
|
+
var engine_1 = require("./engine");
|
|
60
|
+
Object.defineProperty(exports, "render_handlebars", { enumerable: true, get: function () { return engine_1.render_handlebars; } });
|
|
61
|
+
Object.defineProperty(exports, "render_handlebars_string", { enumerable: true, get: function () { return engine_1.render_handlebars_string; } });
|
|
62
|
+
Object.defineProperty(exports, "clear_template_cache", { enumerable: true, get: function () { return engine_1.clear_template_cache; } });
|
|
63
|
+
Object.defineProperty(exports, "invalidate_template_cache", { enumerable: true, get: function () { return engine_1.invalidate_template_cache; } });
|
|
64
|
+
Object.defineProperty(exports, "resolve_variables", { enumerable: true, get: function () { return engine_1.resolve_variables; } });
|
|
65
|
+
Object.defineProperty(exports, "extract_template_references", { enumerable: true, get: function () { return engine_1.extract_template_references; } });
|
|
66
|
+
Object.defineProperty(exports, "resolve_template_references", { enumerable: true, get: function () { return engine_1.resolve_template_references; } });
|
|
67
|
+
// Utils
|
|
68
|
+
var utils_1 = require("./utils");
|
|
69
|
+
Object.defineProperty(exports, "get_system_variables", { enumerable: true, get: function () { return utils_1.get_system_variables; } });
|
|
70
|
+
Object.defineProperty(exports, "resolve_system_variables", { enumerable: true, get: function () { return utils_1.resolve_system_variables; } });
|
|
71
|
+
Object.defineProperty(exports, "get_system_variable_definitions", { enumerable: true, get: function () { return utils_1.get_system_variable_definitions; } });
|
|
72
|
+
Object.defineProperty(exports, "validate_template_name", { enumerable: true, get: function () { return utils_1.validate_template_name; } });
|
|
73
|
+
Object.defineProperty(exports, "validate_category_name", { enumerable: true, get: function () { return utils_1.validate_category_name; } });
|
|
74
|
+
Object.defineProperty(exports, "validate_variable_name", { enumerable: true, get: function () { return utils_1.validate_variable_name; } });
|
|
75
|
+
Object.defineProperty(exports, "extract_variables_from_content", { enumerable: true, get: function () { return utils_1.extract_variables_from_content; } });
|
|
76
|
+
Object.defineProperty(exports, "validate_provided_variables", { enumerable: true, get: function () { return utils_1.validate_provided_variables; } });
|
|
77
|
+
// Constants
|
|
78
|
+
var constants_1 = require("./config/constants");
|
|
79
|
+
Object.defineProperty(exports, "TABLE_TEMPLATE_CATEGORY", { enumerable: true, get: function () { return constants_1.TABLE_TEMPLATE_CATEGORY; } });
|
|
80
|
+
Object.defineProperty(exports, "TABLE_TEMPLATES", { enumerable: true, get: function () { return constants_1.TABLE_TEMPLATES; } });
|
|
81
|
+
Object.defineProperty(exports, "DEFAULT_TEMPLATE_NAMES", { enumerable: true, get: function () { return constants_1.DEFAULT_TEMPLATE_NAMES; } });
|
|
82
|
+
Object.defineProperty(exports, "DEFAULT_CATEGORY_NAMES", { enumerable: true, get: function () { return constants_1.DEFAULT_CATEGORY_NAMES; } });
|
|
83
|
+
Object.defineProperty(exports, "MAX_TEMPLATE_NAME_LENGTH", { enumerable: true, get: function () { return constants_1.MAX_TEMPLATE_NAME_LENGTH; } });
|
|
84
|
+
Object.defineProperty(exports, "MAX_CATEGORY_NAME_LENGTH", { enumerable: true, get: function () { return constants_1.MAX_CATEGORY_NAME_LENGTH; } });
|
|
85
|
+
Object.defineProperty(exports, "VARIABLE_PATTERN", { enumerable: true, get: function () { return constants_1.VARIABLE_PATTERN; } });
|
|
86
|
+
Object.defineProperty(exports, "TEMPLATE_REFERENCE_PATTERN", { enumerable: true, get: function () { return constants_1.TEMPLATE_REFERENCE_PATTERN; } });
|
|
87
|
+
Object.defineProperty(exports, "ERROR_MESSAGES", { enumerable: true, get: function () { return constants_1.ERROR_MESSAGES; } });
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/template_manager/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,iBAAiB;AACjB,uDAK4B;AAJ1B,uHAAA,mBAAmB,OAAA;AACnB,mHAAA,eAAe,OAAA;AACf,oHAAA,gBAAgB,OAAA;AAChB,+HAAA,2BAA2B,OAAA;AAG7B,SAAS;AACT,wDAKgC;AAJ9B,qHAAA,oBAAoB,OAAA;AACpB,uHAAA,sBAAsB,OAAA;AACtB,uHAAA,sBAAsB,OAAA;AACtB,mHAAA,kBAAkB,OAAA;AAGpB,sBAAsB;AACtB,2BAiBc;AAhBZ,aAAa;AACb,qGAAA,eAAe,OAAA;AACf,kGAAA,YAAY,OAAA;AACZ,qGAAA,eAAe,OAAA;AACf,qGAAA,eAAe,OAAA;AACf,qGAAA,eAAe,OAAA;AACf,2GAAA,qBAAqB,OAAA;AACrB,YAAY;AACZ,oGAAA,cAAc,OAAA;AACd,gHAAA,0BAA0B,OAAA;AAC1B,kGAAA,YAAY,OAAA;AACZ,0GAAA,oBAAoB,OAAA;AACpB,qGAAA,eAAe,OAAA;AACf,qGAAA,eAAe,OAAA;AACf,qGAAA,eAAe,OAAA;AACf,4GAAA,sBAAsB,OAAA;AAGxB,SAAS;AACT,mCAQkB;AAPhB,2GAAA,iBAAiB,OAAA;AACjB,kHAAA,wBAAwB,OAAA;AACxB,8GAAA,oBAAoB,OAAA;AACpB,mHAAA,yBAAyB,OAAA;AACzB,2GAAA,iBAAiB,OAAA;AACjB,qHAAA,2BAA2B,OAAA;AAC3B,qHAAA,2BAA2B,OAAA;AAG7B,QAAQ;AACR,iCASiB;AARf,6GAAA,oBAAoB,OAAA;AACpB,iHAAA,wBAAwB,OAAA;AACxB,wHAAA,+BAA+B,OAAA;AAC/B,+GAAA,sBAAsB,OAAA;AACtB,+GAAA,sBAAsB,OAAA;AACtB,+GAAA,sBAAsB,OAAA;AACtB,uHAAA,8BAA8B,OAAA;AAC9B,oHAAA,2BAA2B,OAAA;AAG7B,YAAY;AACZ,gDAU4B;AAT1B,oHAAA,uBAAuB,OAAA;AACvB,4GAAA,eAAe,OAAA;AACf,mHAAA,sBAAsB,OAAA;AACtB,mHAAA,sBAAsB,OAAA;AACtB,qHAAA,wBAAwB,OAAA;AACxB,qHAAA,wBAAwB,OAAA;AACxB,6GAAA,gBAAgB,OAAA;AAChB,uHAAA,0BAA0B,OAAA;AAC1B,2GAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Manager Core Service
|
|
3
|
+
*
|
|
4
|
+
* Core functions for rendering and sending templated emails
|
|
5
|
+
*/
|
|
6
|
+
import type { HazoConnectInstance, TemplateManagerConfig, SendTemplateEmailOptions, SendTemplateEmailResponse, TemplateRenderResult, Logger } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Render a template with variables (without sending)
|
|
9
|
+
*
|
|
10
|
+
* This function fetches a template from the database, resolves all variables
|
|
11
|
+
* (including system variables), processes @template references, and renders
|
|
12
|
+
* the final content using Handlebars.
|
|
13
|
+
*
|
|
14
|
+
* @param template_name - Name of the template to render
|
|
15
|
+
* @param variables - User-provided variables to substitute
|
|
16
|
+
* @param hazo_connect - Database connection instance
|
|
17
|
+
* @param org_id - Organization ID
|
|
18
|
+
* @param config - Optional config override (loads from file if not provided)
|
|
19
|
+
* @param logger - Optional logger instance
|
|
20
|
+
* @returns Render result with HTML and text content
|
|
21
|
+
*/
|
|
22
|
+
export declare function render_template(template_name: string, variables: Record<string, string>, hazo_connect: HazoConnectInstance, org_id: string, config?: TemplateManagerConfig, logger?: Logger): Promise<TemplateRenderResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Send an email using a named template
|
|
25
|
+
*
|
|
26
|
+
* This function:
|
|
27
|
+
* 1. Fetches the template from the database
|
|
28
|
+
* 2. Resolves all variables (user + system)
|
|
29
|
+
* 3. Processes @template references
|
|
30
|
+
* 4. Renders with Handlebars
|
|
31
|
+
* 5. Sends via the emailer module
|
|
32
|
+
*
|
|
33
|
+
* @param options - Template email options
|
|
34
|
+
* @param hazo_connect - Database connection instance
|
|
35
|
+
* @param org_id - Organization ID
|
|
36
|
+
* @param config - Optional config override
|
|
37
|
+
* @returns Email send response
|
|
38
|
+
*/
|
|
39
|
+
export declare function send_template_email(options: SendTemplateEmailOptions, hazo_connect: HazoConnectInstance, org_id: string, config?: TemplateManagerConfig): Promise<SendTemplateEmailResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Preview a template render without saving or sending
|
|
42
|
+
*
|
|
43
|
+
* Useful for the UI to show a preview of what the email will look like
|
|
44
|
+
*
|
|
45
|
+
* @param html_content - Raw HTML template content
|
|
46
|
+
* @param text_content - Raw text template content
|
|
47
|
+
* @param variables - Variables to substitute
|
|
48
|
+
* @param hazo_connect - Database connection (for @template resolution)
|
|
49
|
+
* @param org_id - Organization ID
|
|
50
|
+
* @returns Render result
|
|
51
|
+
*/
|
|
52
|
+
export declare function preview_template(html_content: string, text_content: string, variables: Record<string, string>, hazo_connect?: HazoConnectInstance, org_id?: string): Promise<TemplateRenderResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Validate template variables before rendering
|
|
55
|
+
*
|
|
56
|
+
* Checks that all required variables are provided
|
|
57
|
+
*
|
|
58
|
+
* @param template_name - Name of the template
|
|
59
|
+
* @param variables - Variables to validate
|
|
60
|
+
* @param hazo_connect - Database connection
|
|
61
|
+
* @param org_id - Organization ID
|
|
62
|
+
* @returns Validation result
|
|
63
|
+
*/
|
|
64
|
+
export declare function validate_template_variables(template_name: string, variables: Record<string, string>, hazo_connect: HazoConnectInstance, org_id: string): Promise<{
|
|
65
|
+
valid: boolean;
|
|
66
|
+
missing: string[];
|
|
67
|
+
message: string;
|
|
68
|
+
}>;
|
|
69
|
+
//# sourceMappingURL=template_manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template_manager.d.ts","sourceRoot":"","sources":["../../src/lib/template_manager/template_manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,MAAM,EACP,MAAM,SAAS,CAAC;AAgBjB;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CACnC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,CAmH/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,wBAAwB,EACjC,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,qBAAqB,GAC7B,OAAO,CAAC,yBAAyB,CAAC,CA6HpC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,YAAY,CAAC,EAAE,mBAAmB,EAClC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,CAyC/B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,2BAA2B,CAC/C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA6DjE"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Template Manager Core Service
|
|
4
|
+
*
|
|
5
|
+
* Core functions for rendering and sending templated emails
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.render_template = render_template;
|
|
9
|
+
exports.send_template_email = send_template_email;
|
|
10
|
+
exports.preview_template = preview_template;
|
|
11
|
+
exports.validate_template_variables = validate_template_variables;
|
|
12
|
+
const emailer_1 = require("../emailer/emailer");
|
|
13
|
+
const logger_1 = require("../emailer/utils/logger");
|
|
14
|
+
const config_loader_1 = require("./config/config_loader");
|
|
15
|
+
const constants_1 = require("./config/constants");
|
|
16
|
+
const template_repository_1 = require("./db/template_repository");
|
|
17
|
+
const engine_1 = require("./engine");
|
|
18
|
+
const validation_1 = require("./utils/validation");
|
|
19
|
+
/**
|
|
20
|
+
* Render a template with variables (without sending)
|
|
21
|
+
*
|
|
22
|
+
* This function fetches a template from the database, resolves all variables
|
|
23
|
+
* (including system variables), processes @template references, and renders
|
|
24
|
+
* the final content using Handlebars.
|
|
25
|
+
*
|
|
26
|
+
* @param template_name - Name of the template to render
|
|
27
|
+
* @param variables - User-provided variables to substitute
|
|
28
|
+
* @param hazo_connect - Database connection instance
|
|
29
|
+
* @param org_id - Organization ID
|
|
30
|
+
* @param config - Optional config override (loads from file if not provided)
|
|
31
|
+
* @param logger - Optional logger instance
|
|
32
|
+
* @returns Render result with HTML and text content
|
|
33
|
+
*/
|
|
34
|
+
async function render_template(template_name, variables, hazo_connect, org_id, config, logger) {
|
|
35
|
+
const log = logger || (0, logger_1.create_fallback_logger)('template_manager');
|
|
36
|
+
const filename = 'template_manager.ts';
|
|
37
|
+
const function_name = 'render_template';
|
|
38
|
+
try {
|
|
39
|
+
log.info('Rendering template', {
|
|
40
|
+
filename,
|
|
41
|
+
function_name,
|
|
42
|
+
template_name,
|
|
43
|
+
org_id,
|
|
44
|
+
});
|
|
45
|
+
// Validate inputs
|
|
46
|
+
if (!hazo_connect) {
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
error: constants_1.ERROR_MESSAGES.DB_CONNECTION_REQUIRED,
|
|
50
|
+
message: constants_1.ERROR_MESSAGES.DB_CONNECTION_REQUIRED,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Load config
|
|
54
|
+
const cfg = config || (0, config_loader_1.load_template_config)();
|
|
55
|
+
// Fetch template from database
|
|
56
|
+
const template_result = await (0, template_repository_1.get_template_by_name)(hazo_connect, org_id, template_name);
|
|
57
|
+
if (!template_result.success || !template_result.data) {
|
|
58
|
+
log.warn('Template not found', {
|
|
59
|
+
filename,
|
|
60
|
+
function_name,
|
|
61
|
+
template_name,
|
|
62
|
+
error: template_result.error,
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
success: false,
|
|
66
|
+
error: template_result.error || constants_1.ERROR_MESSAGES.TEMPLATE_NOT_FOUND,
|
|
67
|
+
message: template_result.message || constants_1.ERROR_MESSAGES.TEMPLATE_NOT_FOUND,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const template = template_result.data;
|
|
71
|
+
// Merge user variables with system variables
|
|
72
|
+
const all_variables = (0, engine_1.resolve_variables)(variables);
|
|
73
|
+
// Resolve @template references in both HTML and text
|
|
74
|
+
const resolved_result = await (0, engine_1.resolve_all_template_references)(template.template_html, template.template_text, all_variables, hazo_connect, org_id);
|
|
75
|
+
if (!resolved_result.success) {
|
|
76
|
+
log.warn('Failed to resolve template references', {
|
|
77
|
+
filename,
|
|
78
|
+
function_name,
|
|
79
|
+
template_name,
|
|
80
|
+
error: resolved_result.error,
|
|
81
|
+
});
|
|
82
|
+
return resolved_result;
|
|
83
|
+
}
|
|
84
|
+
// Render with Handlebars
|
|
85
|
+
const render_result = (0, engine_1.render_handlebars)(resolved_result.rendered_html || template.template_html, resolved_result.rendered_text || template.template_text, all_variables, template_name);
|
|
86
|
+
if (!render_result.success) {
|
|
87
|
+
log.warn('Failed to render template', {
|
|
88
|
+
filename,
|
|
89
|
+
function_name,
|
|
90
|
+
template_name,
|
|
91
|
+
error: render_result.error,
|
|
92
|
+
});
|
|
93
|
+
return render_result;
|
|
94
|
+
}
|
|
95
|
+
log.info('Template rendered successfully', {
|
|
96
|
+
filename,
|
|
97
|
+
function_name,
|
|
98
|
+
template_name,
|
|
99
|
+
});
|
|
100
|
+
return {
|
|
101
|
+
success: true,
|
|
102
|
+
rendered_html: render_result.rendered_html,
|
|
103
|
+
rendered_text: render_result.rendered_text,
|
|
104
|
+
message: 'Template rendered successfully',
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
const error_message = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
109
|
+
log.error('Error rendering template', {
|
|
110
|
+
filename,
|
|
111
|
+
function_name,
|
|
112
|
+
template_name,
|
|
113
|
+
error: error_message,
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
success: false,
|
|
117
|
+
error: error_message,
|
|
118
|
+
message: `Failed to render template: ${error_message}`,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Send an email using a named template
|
|
124
|
+
*
|
|
125
|
+
* This function:
|
|
126
|
+
* 1. Fetches the template from the database
|
|
127
|
+
* 2. Resolves all variables (user + system)
|
|
128
|
+
* 3. Processes @template references
|
|
129
|
+
* 4. Renders with Handlebars
|
|
130
|
+
* 5. Sends via the emailer module
|
|
131
|
+
*
|
|
132
|
+
* @param options - Template email options
|
|
133
|
+
* @param hazo_connect - Database connection instance
|
|
134
|
+
* @param org_id - Organization ID
|
|
135
|
+
* @param config - Optional config override
|
|
136
|
+
* @returns Email send response
|
|
137
|
+
*/
|
|
138
|
+
async function send_template_email(options, hazo_connect, org_id, config) {
|
|
139
|
+
const log = options.logger
|
|
140
|
+
? (0, logger_1.get_logger)(options.logger)
|
|
141
|
+
: (0, logger_1.create_fallback_logger)('template_manager');
|
|
142
|
+
const filename = 'template_manager.ts';
|
|
143
|
+
const function_name = 'send_template_email';
|
|
144
|
+
try {
|
|
145
|
+
log.info('Sending template email', {
|
|
146
|
+
filename,
|
|
147
|
+
function_name,
|
|
148
|
+
template_name: options.template_name,
|
|
149
|
+
to: options.to,
|
|
150
|
+
org_id,
|
|
151
|
+
});
|
|
152
|
+
// Validate inputs
|
|
153
|
+
if (!hazo_connect) {
|
|
154
|
+
return {
|
|
155
|
+
success: false,
|
|
156
|
+
error: constants_1.ERROR_MESSAGES.DB_CONNECTION_REQUIRED,
|
|
157
|
+
message: constants_1.ERROR_MESSAGES.DB_CONNECTION_REQUIRED,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// Render the template
|
|
161
|
+
const render_result = await render_template(options.template_name, options.variables, hazo_connect, org_id, config, log);
|
|
162
|
+
if (!render_result.success) {
|
|
163
|
+
return {
|
|
164
|
+
success: false,
|
|
165
|
+
error: render_result.error,
|
|
166
|
+
message: render_result.message,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// Build subject - use provided subject or template name as fallback
|
|
170
|
+
const subject = options.subject ||
|
|
171
|
+
options.template_name
|
|
172
|
+
.replace(/_/g, ' ')
|
|
173
|
+
.replace(/\b\w/g, (l) => l.toUpperCase());
|
|
174
|
+
// Send the email using the emailer module
|
|
175
|
+
const email_response = await (0, emailer_1.send_email)({
|
|
176
|
+
to: options.to,
|
|
177
|
+
subject,
|
|
178
|
+
content: {
|
|
179
|
+
html: render_result.rendered_html,
|
|
180
|
+
text: render_result.rendered_text,
|
|
181
|
+
},
|
|
182
|
+
from: options.from,
|
|
183
|
+
from_name: options.from_name,
|
|
184
|
+
reply_to: options.reply_to,
|
|
185
|
+
cc: options.cc,
|
|
186
|
+
bcc: options.bcc,
|
|
187
|
+
attachments: options.attachments,
|
|
188
|
+
logger: log,
|
|
189
|
+
});
|
|
190
|
+
const is_production = process.env.NODE_ENV === 'production';
|
|
191
|
+
if (email_response.success) {
|
|
192
|
+
log.info('Template email sent successfully', {
|
|
193
|
+
filename,
|
|
194
|
+
function_name,
|
|
195
|
+
template_name: options.template_name,
|
|
196
|
+
message_id: email_response.message_id,
|
|
197
|
+
});
|
|
198
|
+
return {
|
|
199
|
+
success: true,
|
|
200
|
+
message_id: email_response.message_id,
|
|
201
|
+
message: email_response.message || 'Email sent successfully',
|
|
202
|
+
rendered_html: is_production ? undefined : render_result.rendered_html,
|
|
203
|
+
rendered_text: is_production ? undefined : render_result.rendered_text,
|
|
204
|
+
raw_response: email_response.raw_response,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
log.warn('Failed to send template email', {
|
|
209
|
+
filename,
|
|
210
|
+
function_name,
|
|
211
|
+
template_name: options.template_name,
|
|
212
|
+
error: email_response.error,
|
|
213
|
+
});
|
|
214
|
+
return {
|
|
215
|
+
success: false,
|
|
216
|
+
error: email_response.error,
|
|
217
|
+
message: email_response.message || 'Failed to send email',
|
|
218
|
+
rendered_html: is_production ? undefined : render_result.rendered_html,
|
|
219
|
+
rendered_text: is_production ? undefined : render_result.rendered_text,
|
|
220
|
+
raw_response: email_response.raw_response,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
const error_message = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
226
|
+
const error_string = error instanceof Error ? error.toString() : String(error);
|
|
227
|
+
const stack = error instanceof Error ? error.stack : undefined;
|
|
228
|
+
const is_production = process.env.NODE_ENV === 'production';
|
|
229
|
+
log.error('Error sending template email', {
|
|
230
|
+
filename,
|
|
231
|
+
function_name,
|
|
232
|
+
template_name: options.template_name,
|
|
233
|
+
error: error_message,
|
|
234
|
+
});
|
|
235
|
+
return {
|
|
236
|
+
success: false,
|
|
237
|
+
error: error_message,
|
|
238
|
+
message: `Failed to send template email: ${error_message}`,
|
|
239
|
+
raw_response: is_production
|
|
240
|
+
? undefined
|
|
241
|
+
: { error: error_string, stack },
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Preview a template render without saving or sending
|
|
247
|
+
*
|
|
248
|
+
* Useful for the UI to show a preview of what the email will look like
|
|
249
|
+
*
|
|
250
|
+
* @param html_content - Raw HTML template content
|
|
251
|
+
* @param text_content - Raw text template content
|
|
252
|
+
* @param variables - Variables to substitute
|
|
253
|
+
* @param hazo_connect - Database connection (for @template resolution)
|
|
254
|
+
* @param org_id - Organization ID
|
|
255
|
+
* @returns Render result
|
|
256
|
+
*/
|
|
257
|
+
async function preview_template(html_content, text_content, variables, hazo_connect, org_id) {
|
|
258
|
+
try {
|
|
259
|
+
// Merge with system variables
|
|
260
|
+
const all_variables = (0, engine_1.resolve_variables)(variables);
|
|
261
|
+
// If hazo_connect is provided, resolve @template references
|
|
262
|
+
let resolved_html = html_content;
|
|
263
|
+
let resolved_text = text_content;
|
|
264
|
+
if (hazo_connect && org_id) {
|
|
265
|
+
const resolved_result = await (0, engine_1.resolve_all_template_references)(html_content, text_content, all_variables, hazo_connect, org_id);
|
|
266
|
+
if (resolved_result.success) {
|
|
267
|
+
resolved_html = resolved_result.rendered_html || html_content;
|
|
268
|
+
resolved_text = resolved_result.rendered_text || text_content;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
// Render with Handlebars
|
|
272
|
+
const render_result = (0, engine_1.render_handlebars)(resolved_html, resolved_text, all_variables);
|
|
273
|
+
return render_result;
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
const error_message = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
277
|
+
return {
|
|
278
|
+
success: false,
|
|
279
|
+
error: error_message,
|
|
280
|
+
message: `Failed to preview template: ${error_message}`,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Validate template variables before rendering
|
|
286
|
+
*
|
|
287
|
+
* Checks that all required variables are provided
|
|
288
|
+
*
|
|
289
|
+
* @param template_name - Name of the template
|
|
290
|
+
* @param variables - Variables to validate
|
|
291
|
+
* @param hazo_connect - Database connection
|
|
292
|
+
* @param org_id - Organization ID
|
|
293
|
+
* @returns Validation result
|
|
294
|
+
*/
|
|
295
|
+
async function validate_template_variables(template_name, variables, hazo_connect, org_id) {
|
|
296
|
+
try {
|
|
297
|
+
// Fetch template
|
|
298
|
+
const template_result = await (0, template_repository_1.get_template_by_name)(hazo_connect, org_id, template_name);
|
|
299
|
+
if (!template_result.success || !template_result.data) {
|
|
300
|
+
return {
|
|
301
|
+
valid: false,
|
|
302
|
+
missing: [],
|
|
303
|
+
message: template_result.message || constants_1.ERROR_MESSAGES.TEMPLATE_NOT_FOUND,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
const template = template_result.data;
|
|
307
|
+
const config = (0, config_loader_1.load_template_config)();
|
|
308
|
+
// Get system variable names
|
|
309
|
+
const system_var_names = config.system_email_template_variables.map((v) => v.variable_name);
|
|
310
|
+
// Validate HTML content
|
|
311
|
+
const html_validation = (0, validation_1.validate_provided_variables)(template.template_html, variables, system_var_names);
|
|
312
|
+
// Validate text content
|
|
313
|
+
const text_validation = (0, validation_1.validate_provided_variables)(template.template_text, variables, system_var_names);
|
|
314
|
+
// Combine missing variables
|
|
315
|
+
const all_missing = [
|
|
316
|
+
...new Set([...html_validation.missing, ...text_validation.missing]),
|
|
317
|
+
];
|
|
318
|
+
return {
|
|
319
|
+
valid: all_missing.length === 0,
|
|
320
|
+
missing: all_missing,
|
|
321
|
+
message: all_missing.length === 0
|
|
322
|
+
? 'All required variables provided'
|
|
323
|
+
: `Missing variables: ${all_missing.join(', ')}`,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
const error_message = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
328
|
+
return {
|
|
329
|
+
valid: false,
|
|
330
|
+
missing: [],
|
|
331
|
+
message: `Validation error: ${error_message}`,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=template_manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template_manager.js","sourceRoot":"","sources":["../../src/lib/template_manager/template_manager.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAwCH,0CA0HC;AAkBD,kDAkIC;AAcD,4CA+CC;AAaD,kEAkEC;AAxbD,gDAAgD;AAChD,oDAA6E;AAC7E,0DAA8D;AAC9D,kDAAoD;AACpD,kEAAgE;AAChE,qCAIkB;AAClB,mDAG4B;AAE5B;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,eAAe,CACnC,aAAqB,EACrB,SAAiC,EACjC,YAAiC,EACjC,MAAc,EACd,MAA8B,EAC9B,MAAe;IAEf,MAAM,GAAG,GAAG,MAAM,IAAI,IAAA,+BAAsB,EAAC,kBAAkB,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,qBAAqB,CAAC;IACvC,MAAM,aAAa,GAAG,iBAAiB,CAAC;IAExC,IAAI,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC7B,QAAQ;YACR,aAAa;YACb,aAAa;YACb,MAAM;SACP,CAAC,CAAC;QAEH,kBAAkB;QAClB,IAAI,CAAC,YAAY,EAA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