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,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration loader for template manager
|
|
3
|
+
*
|
|
4
|
+
* Loads template configuration from config/hazo_notify_config.ini
|
|
5
|
+
*/
|
|
6
|
+
import type { TemplateManagerConfig, TemplateVariableDefinition } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Load template manager configuration from config/hazo_notify_config.ini
|
|
9
|
+
*
|
|
10
|
+
* Configuration is cached after first load
|
|
11
|
+
*
|
|
12
|
+
* @param force_reload - Force reload from file (bypass cache)
|
|
13
|
+
* @returns Template manager configuration
|
|
14
|
+
* @throws Error if configuration is invalid
|
|
15
|
+
*/
|
|
16
|
+
export declare function load_template_config(force_reload?: boolean): TemplateManagerConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Get template variable definitions for a specific template type
|
|
19
|
+
*
|
|
20
|
+
* @param template_name - Name of the template type
|
|
21
|
+
* @param config - Optional config (loads if not provided)
|
|
22
|
+
* @returns Variable definitions for the template, or empty array if not found
|
|
23
|
+
*/
|
|
24
|
+
export declare function get_template_variables(template_name: string, config?: TemplateManagerConfig): TemplateVariableDefinition[];
|
|
25
|
+
/**
|
|
26
|
+
* Get all available variable names (user + system) for a template type
|
|
27
|
+
*
|
|
28
|
+
* @param template_name - Name of the template type
|
|
29
|
+
* @param config - Optional config (loads if not provided)
|
|
30
|
+
* @returns Object with user and system variable names
|
|
31
|
+
*/
|
|
32
|
+
export declare function get_all_variable_names(template_name: string, config?: TemplateManagerConfig): {
|
|
33
|
+
user: string[];
|
|
34
|
+
system: string[];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Clear the cached configuration
|
|
38
|
+
*
|
|
39
|
+
* Useful for testing or when config file has been updated
|
|
40
|
+
*/
|
|
41
|
+
export declare function clear_config_cache(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Check if configuration is loaded and cached
|
|
44
|
+
*
|
|
45
|
+
* @returns true if config is cached
|
|
46
|
+
*/
|
|
47
|
+
export declare function is_config_cached(): boolean;
|
|
48
|
+
//# sourceMappingURL=config_loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config_loader.d.ts","sourceRoot":"","sources":["../../../src/lib/template_manager/config/config_loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EACV,qBAAqB,EAErB,0BAA0B,EAC3B,MAAM,UAAU,CAAC;AA0FlB;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,GAAE,OAAe,GAC5B,qBAAqB,CA+CvB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,qBAAqB,GAC7B,0BAA0B,EAAE,CAQ9B;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,qBAAqB,GAC7B;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAStC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration loader for template manager
|
|
4
|
+
*
|
|
5
|
+
* Loads template configuration from config/hazo_notify_config.ini
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.load_template_config = load_template_config;
|
|
9
|
+
exports.get_template_variables = get_template_variables;
|
|
10
|
+
exports.get_all_variable_names = get_all_variable_names;
|
|
11
|
+
exports.clear_config_cache = clear_config_cache;
|
|
12
|
+
exports.is_config_cached = is_config_cached;
|
|
13
|
+
const hazo_config_1 = require("hazo_config");
|
|
14
|
+
const path_1 = require("path");
|
|
15
|
+
const system_variables_1 = require("../utils/system_variables");
|
|
16
|
+
const constants_1 = require("./constants");
|
|
17
|
+
/**
|
|
18
|
+
* Cached configuration
|
|
19
|
+
*/
|
|
20
|
+
let cached_config = null;
|
|
21
|
+
/**
|
|
22
|
+
* Parse and validate template variable types from JSON string
|
|
23
|
+
*
|
|
24
|
+
* @param json_string - JSON string from config
|
|
25
|
+
* @returns Parsed template type definitions
|
|
26
|
+
*/
|
|
27
|
+
function parse_template_variable_types(json_string) {
|
|
28
|
+
try {
|
|
29
|
+
const parsed = JSON.parse(json_string);
|
|
30
|
+
if (!Array.isArray(parsed)) {
|
|
31
|
+
throw new Error('email_template_variable_types must be an array');
|
|
32
|
+
}
|
|
33
|
+
// Validate and normalize each entry
|
|
34
|
+
return parsed.map((entry, index) => {
|
|
35
|
+
if (typeof entry.template_name !== 'string' || !entry.template_name) {
|
|
36
|
+
throw new Error(`Invalid template_name at index ${index}: must be a non-empty string`);
|
|
37
|
+
}
|
|
38
|
+
if (typeof entry.template_label !== 'string' || !entry.template_label) {
|
|
39
|
+
throw new Error(`Invalid template_label at index ${index}: must be a non-empty string`);
|
|
40
|
+
}
|
|
41
|
+
if (!Array.isArray(entry.variables)) {
|
|
42
|
+
throw new Error(`Invalid variables at index ${index}: must be an array`);
|
|
43
|
+
}
|
|
44
|
+
const variables = entry.variables.map((v, vIndex) => {
|
|
45
|
+
if (typeof v.variable_name !== 'string' || !v.variable_name) {
|
|
46
|
+
throw new Error(`Invalid variable_name at index ${index}.${vIndex}: must be a non-empty string`);
|
|
47
|
+
}
|
|
48
|
+
if (typeof v.variable_description !== 'string' ||
|
|
49
|
+
!v.variable_description) {
|
|
50
|
+
throw new Error(`Invalid variable_description at index ${index}.${vIndex}: must be a non-empty string`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
variable_name: v.variable_name,
|
|
54
|
+
variable_description: v.variable_description,
|
|
55
|
+
default_value: typeof v.default_value === 'string' ? v.default_value : undefined,
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
template_name: entry.template_name,
|
|
60
|
+
template_label: entry.template_label,
|
|
61
|
+
variables,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (error instanceof SyntaxError) {
|
|
67
|
+
throw new Error(`Failed to parse email_template_variable_types: Invalid JSON - ${error.message}`);
|
|
68
|
+
}
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Load template manager configuration from config/hazo_notify_config.ini
|
|
74
|
+
*
|
|
75
|
+
* Configuration is cached after first load
|
|
76
|
+
*
|
|
77
|
+
* @param force_reload - Force reload from file (bypass cache)
|
|
78
|
+
* @returns Template manager configuration
|
|
79
|
+
* @throws Error if configuration is invalid
|
|
80
|
+
*/
|
|
81
|
+
function load_template_config(force_reload = false) {
|
|
82
|
+
if (cached_config && !force_reload) {
|
|
83
|
+
return cached_config;
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const config_file_path = (0, path_1.join)(process.cwd(), 'config', 'hazo_notify_config.ini');
|
|
87
|
+
const hazo_config = new hazo_config_1.HazoConfig({ filePath: config_file_path });
|
|
88
|
+
const template_section = hazo_config.getSection('template_manager') || {};
|
|
89
|
+
// Parse email_template_variable_types
|
|
90
|
+
let email_template_variable_types;
|
|
91
|
+
if (template_section?.email_template_variable_types) {
|
|
92
|
+
email_template_variable_types = parse_template_variable_types(template_section.email_template_variable_types);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// Use defaults if not configured
|
|
96
|
+
email_template_variable_types = constants_1.DEFAULT_EMAIL_TEMPLATE_VARIABLE_TYPES.map((t) => ({
|
|
97
|
+
template_name: t.template_name,
|
|
98
|
+
template_label: t.template_label,
|
|
99
|
+
variables: t.variables.map((v) => ({
|
|
100
|
+
variable_name: v.variable_name,
|
|
101
|
+
variable_description: v.variable_description,
|
|
102
|
+
})),
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
// Get system variables
|
|
106
|
+
const system_email_template_variables = (0, system_variables_1.get_system_variables)();
|
|
107
|
+
cached_config = {
|
|
108
|
+
email_template_variable_types,
|
|
109
|
+
system_email_template_variables,
|
|
110
|
+
};
|
|
111
|
+
return cached_config;
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
const error_message = error instanceof Error ? error.message : 'Unknown error';
|
|
115
|
+
throw new Error(`${constants_1.ERROR_MESSAGES.CONFIG_NOT_LOADED}: ${error_message}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get template variable definitions for a specific template type
|
|
120
|
+
*
|
|
121
|
+
* @param template_name - Name of the template type
|
|
122
|
+
* @param config - Optional config (loads if not provided)
|
|
123
|
+
* @returns Variable definitions for the template, or empty array if not found
|
|
124
|
+
*/
|
|
125
|
+
function get_template_variables(template_name, config) {
|
|
126
|
+
const cfg = config || load_template_config();
|
|
127
|
+
const template_type = cfg.email_template_variable_types.find((t) => t.template_name === template_name);
|
|
128
|
+
return template_type?.variables || [];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get all available variable names (user + system) for a template type
|
|
132
|
+
*
|
|
133
|
+
* @param template_name - Name of the template type
|
|
134
|
+
* @param config - Optional config (loads if not provided)
|
|
135
|
+
* @returns Object with user and system variable names
|
|
136
|
+
*/
|
|
137
|
+
function get_all_variable_names(template_name, config) {
|
|
138
|
+
const cfg = config || load_template_config();
|
|
139
|
+
const user_vars = get_template_variables(template_name, cfg);
|
|
140
|
+
return {
|
|
141
|
+
user: user_vars.map((v) => v.variable_name),
|
|
142
|
+
system: cfg.system_email_template_variables.map((v) => v.variable_name),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Clear the cached configuration
|
|
147
|
+
*
|
|
148
|
+
* Useful for testing or when config file has been updated
|
|
149
|
+
*/
|
|
150
|
+
function clear_config_cache() {
|
|
151
|
+
cached_config = null;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Check if configuration is loaded and cached
|
|
155
|
+
*
|
|
156
|
+
* @returns true if config is cached
|
|
157
|
+
*/
|
|
158
|
+
function is_config_cached() {
|
|
159
|
+
return cached_config !== null;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=config_loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config_loader.js","sourceRoot":"","sources":["../../../src/lib/template_manager/config/config_loader.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA2GH,oDAiDC;AASD,wDAWC;AASD,wDAYC;AAOD,gDAEC;AAOD,4CAEC;AArND,6CAAyC;AACzC,+BAA4B;AAM5B,gEAAiE;AACjE,2CAGqB;AAErB;;GAEG;AACH,IAAI,aAAa,GAAiC,IAAI,CAAC;AAEvD;;;;;GAKG;AACH,SAAS,6BAA6B,CACpC,WAAmB;IAEnB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAEvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QAED,oCAAoC;QACpC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YACjC,IAAI,OAAO,KAAK,CAAC,aAAa,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;gBACpE,MAAM,IAAI,KAAK,CACb,kCAAkC,KAAK,8BAA8B,CACtE,CAAC;YACJ,CAAC;YAED,IAAI,OAAO,KAAK,CAAC,cAAc,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;gBACtE,MAAM,IAAI,KAAK,CACb,mCAAmC,KAAK,8BAA8B,CACvE,C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
|
|
5
|
+
*/
|
|
6
|
+
export declare const TABLE_TEMPLATE_CATEGORY = "hazo_notify_template_cat";
|
|
7
|
+
export declare const TABLE_TEMPLATES = "hazo_notify_templates";
|
|
8
|
+
export declare const DEFAULT_TEMPLATE_NAMES: readonly ["welcome_email", "email_verification", "forgot_password", "email_signature"];
|
|
9
|
+
export type DefaultTemplateName = (typeof DEFAULT_TEMPLATE_NAMES)[number];
|
|
10
|
+
export declare const DEFAULT_CATEGORY_NAMES: {
|
|
11
|
+
readonly SYSTEM: "System";
|
|
12
|
+
readonly USER: "Custom";
|
|
13
|
+
};
|
|
14
|
+
/** Maximum length for template name */
|
|
15
|
+
export declare const MAX_TEMPLATE_NAME_LENGTH = 100;
|
|
16
|
+
/** Maximum length for category name */
|
|
17
|
+
export declare const MAX_CATEGORY_NAME_LENGTH = 100;
|
|
18
|
+
/** Maximum size for template HTML content (1MB) */
|
|
19
|
+
export declare const MAX_TEMPLATE_HTML_SIZE: number;
|
|
20
|
+
/** Maximum size for template text content (500KB) */
|
|
21
|
+
export declare const MAX_TEMPLATE_TEXT_SIZE: number;
|
|
22
|
+
/** Maximum number of variables per template */
|
|
23
|
+
export declare const MAX_VARIABLES_PER_TEMPLATE = 50;
|
|
24
|
+
/** Maximum depth for @template references to prevent infinite loops */
|
|
25
|
+
export declare const MAX_TEMPLATE_REFERENCE_DEPTH = 5;
|
|
26
|
+
/** Regex pattern for {{variable_name}} */
|
|
27
|
+
export declare const VARIABLE_PATTERN: RegExp;
|
|
28
|
+
/** Regex pattern for @template_name */
|
|
29
|
+
export declare const TEMPLATE_REFERENCE_PATTERN: RegExp;
|
|
30
|
+
/** Valid variable name pattern (lowercase alphanumeric with underscores) */
|
|
31
|
+
export declare const VALID_VARIABLE_NAME_PATTERN: RegExp;
|
|
32
|
+
export declare const DEFAULT_EMAIL_TEMPLATE_VARIABLE_TYPES: readonly [{
|
|
33
|
+
readonly template_name: "welcome_email";
|
|
34
|
+
readonly template_label: "Welcome Email";
|
|
35
|
+
readonly variables: readonly [{
|
|
36
|
+
readonly variable_name: "user_name";
|
|
37
|
+
readonly variable_description: "Recipient's full name";
|
|
38
|
+
}, {
|
|
39
|
+
readonly variable_name: "login_url";
|
|
40
|
+
readonly variable_description: "URL to login page";
|
|
41
|
+
}];
|
|
42
|
+
}, {
|
|
43
|
+
readonly template_name: "email_verification";
|
|
44
|
+
readonly template_label: "Email Verification";
|
|
45
|
+
readonly variables: readonly [{
|
|
46
|
+
readonly variable_name: "user_name";
|
|
47
|
+
readonly variable_description: "Recipient's name";
|
|
48
|
+
}, {
|
|
49
|
+
readonly variable_name: "verification_link";
|
|
50
|
+
readonly variable_description: "Email verification URL";
|
|
51
|
+
}, {
|
|
52
|
+
readonly variable_name: "expiry_hours";
|
|
53
|
+
readonly variable_description: "Hours until link expires";
|
|
54
|
+
}];
|
|
55
|
+
}, {
|
|
56
|
+
readonly template_name: "forgot_password";
|
|
57
|
+
readonly template_label: "Forgot Password";
|
|
58
|
+
readonly variables: readonly [{
|
|
59
|
+
readonly variable_name: "user_name";
|
|
60
|
+
readonly variable_description: "Recipient's name";
|
|
61
|
+
}, {
|
|
62
|
+
readonly variable_name: "reset_link";
|
|
63
|
+
readonly variable_description: "Password reset URL";
|
|
64
|
+
}, {
|
|
65
|
+
readonly variable_name: "expiry_minutes";
|
|
66
|
+
readonly variable_description: "Minutes until link expires";
|
|
67
|
+
}];
|
|
68
|
+
}, {
|
|
69
|
+
readonly template_name: "email_signature";
|
|
70
|
+
readonly template_label: "Email Signature";
|
|
71
|
+
readonly variables: readonly [{
|
|
72
|
+
readonly variable_name: "sender_name";
|
|
73
|
+
readonly variable_description: "Sender's name";
|
|
74
|
+
}, {
|
|
75
|
+
readonly variable_name: "sender_title";
|
|
76
|
+
readonly variable_description: "Sender's job title";
|
|
77
|
+
}, {
|
|
78
|
+
readonly variable_name: "company_name";
|
|
79
|
+
readonly variable_description: "Company name";
|
|
80
|
+
}];
|
|
81
|
+
}];
|
|
82
|
+
export declare const SYSTEM_VARIABLE_NAMES: readonly ["date_yyyy_mm_dd", "date_mmm_dd", "date_mmmm_dd_yyyy", "date_dd_mm_yyyy", "date_dd_mmm_yyyy", "time_hh_mm", "time_hh_mm_ss", "datetime_full", "year", "month_name", "day_of_week"];
|
|
83
|
+
export type SystemVariableName = (typeof SYSTEM_VARIABLE_NAMES)[number];
|
|
84
|
+
export declare const ERROR_MESSAGES: {
|
|
85
|
+
readonly TEMPLATE_NOT_FOUND: "Template not found";
|
|
86
|
+
readonly CATEGORY_NOT_FOUND: "Category not found";
|
|
87
|
+
readonly INVALID_TEMPLATE_NAME: "Invalid template name";
|
|
88
|
+
readonly INVALID_CATEGORY_NAME: "Invalid category name";
|
|
89
|
+
readonly INVALID_VARIABLE_NAME: "Invalid variable name";
|
|
90
|
+
readonly TEMPLATE_NAME_TOO_LONG: "Template name exceeds maximum length of 100 characters";
|
|
91
|
+
readonly CATEGORY_NAME_TOO_LONG: "Category name exceeds maximum length of 100 characters";
|
|
92
|
+
readonly TEMPLATE_HTML_TOO_LARGE: "Template HTML exceeds maximum size of 1024KB";
|
|
93
|
+
readonly TEMPLATE_TEXT_TOO_LARGE: "Template text exceeds maximum size of 512KB";
|
|
94
|
+
readonly CANNOT_DELETE_SYSTEM_TEMPLATE: "Cannot delete system templates";
|
|
95
|
+
readonly CIRCULAR_REFERENCE_DETECTED: "Circular template reference detected";
|
|
96
|
+
readonly MAX_REFERENCE_DEPTH_EXCEEDED: "Maximum template reference depth of 5 exceeded";
|
|
97
|
+
readonly MISSING_REQUIRED_VARIABLE: "Missing required variable";
|
|
98
|
+
readonly CONFIG_NOT_LOADED: "Template manager configuration not loaded";
|
|
99
|
+
readonly DB_CONNECTION_REQUIRED: "Database connection instance required";
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/template_manager/config/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAClE,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAMvD,eAAO,MAAM,sBAAsB,wFAKzB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAM1E,eAAO,MAAM,sBAAsB;;;CAGzB,CAAC;AAMX,uCAAuC;AACvC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,uCAAuC;AACvC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,mDAAmD;AACnD,eAAO,MAAM,sBAAsB,QAAc,CAAC;AAElD,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,QAAa,CAAC;AAEjD,+CAA+C;AAC/C,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,uEAAuE;AACvE,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAM9C,0CAA0C;AAC1C,eAAO,MAAM,gBAAgB,QAA+B,CAAC;AAE7D,uCAAuC;AACvC,eAAO,MAAM,0BAA0B,QAAwB,CAAC;AAEhE,4EAA4E;AAC5E,eAAO,MAAM,2BAA2B,QAAsB,CAAC;AAM/D,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqExC,CAAC;AAMX,eAAO,MAAM,qBAAqB,8LAYxB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAMxE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;CAgBjB,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Constants for the template manager service
|
|
4
|
+
*
|
|
5
|
+
* Default values, table names, and validation limits
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ERROR_MESSAGES = exports.SYSTEM_VARIABLE_NAMES = exports.DEFAULT_EMAIL_TEMPLATE_VARIABLE_TYPES = exports.VALID_VARIABLE_NAME_PATTERN = exports.TEMPLATE_REFERENCE_PATTERN = exports.VARIABLE_PATTERN = exports.MAX_TEMPLATE_REFERENCE_DEPTH = exports.MAX_VARIABLES_PER_TEMPLATE = exports.MAX_TEMPLATE_TEXT_SIZE = exports.MAX_TEMPLATE_HTML_SIZE = 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 = void 0;
|
|
9
|
+
// ============================================================
|
|
10
|
+
// Database Table Names
|
|
11
|
+
// ============================================================
|
|
12
|
+
exports.TABLE_TEMPLATE_CATEGORY = 'hazo_notify_template_cat';
|
|
13
|
+
exports.TABLE_TEMPLATES = 'hazo_notify_templates';
|
|
14
|
+
// ============================================================
|
|
15
|
+
// Default Template Names
|
|
16
|
+
// ============================================================
|
|
17
|
+
exports.DEFAULT_TEMPLATE_NAMES = [
|
|
18
|
+
'welcome_email',
|
|
19
|
+
'email_verification',
|
|
20
|
+
'forgot_password',
|
|
21
|
+
'email_signature',
|
|
22
|
+
];
|
|
23
|
+
// ============================================================
|
|
24
|
+
// Default Category Names
|
|
25
|
+
// ============================================================
|
|
26
|
+
exports.DEFAULT_CATEGORY_NAMES = {
|
|
27
|
+
SYSTEM: 'System',
|
|
28
|
+
USER: 'Custom',
|
|
29
|
+
};
|
|
30
|
+
// ============================================================
|
|
31
|
+
// Validation Limits
|
|
32
|
+
// ============================================================
|
|
33
|
+
/** Maximum length for template name */
|
|
34
|
+
exports.MAX_TEMPLATE_NAME_LENGTH = 100;
|
|
35
|
+
/** Maximum length for category name */
|
|
36
|
+
exports.MAX_CATEGORY_NAME_LENGTH = 100;
|
|
37
|
+
/** Maximum size for template HTML content (1MB) */
|
|
38
|
+
exports.MAX_TEMPLATE_HTML_SIZE = 1024 * 1024;
|
|
39
|
+
/** Maximum size for template text content (500KB) */
|
|
40
|
+
exports.MAX_TEMPLATE_TEXT_SIZE = 512 * 1024;
|
|
41
|
+
/** Maximum number of variables per template */
|
|
42
|
+
exports.MAX_VARIABLES_PER_TEMPLATE = 50;
|
|
43
|
+
/** Maximum depth for @template references to prevent infinite loops */
|
|
44
|
+
exports.MAX_TEMPLATE_REFERENCE_DEPTH = 5;
|
|
45
|
+
// ============================================================
|
|
46
|
+
// Variable Patterns
|
|
47
|
+
// ============================================================
|
|
48
|
+
/** Regex pattern for {{variable_name}} */
|
|
49
|
+
exports.VARIABLE_PATTERN = /\{\{([a-z][a-z0-9_]*)\}\}/g;
|
|
50
|
+
/** Regex pattern for @template_name */
|
|
51
|
+
exports.TEMPLATE_REFERENCE_PATTERN = /@([a-z][a-z0-9_]*)/g;
|
|
52
|
+
/** Valid variable name pattern (lowercase alphanumeric with underscores) */
|
|
53
|
+
exports.VALID_VARIABLE_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
54
|
+
// ============================================================
|
|
55
|
+
// Default Template Variable Types
|
|
56
|
+
// ============================================================
|
|
57
|
+
exports.DEFAULT_EMAIL_TEMPLATE_VARIABLE_TYPES = [
|
|
58
|
+
{
|
|
59
|
+
template_name: 'welcome_email',
|
|
60
|
+
template_label: 'Welcome Email',
|
|
61
|
+
variables: [
|
|
62
|
+
{
|
|
63
|
+
variable_name: 'user_name',
|
|
64
|
+
variable_description: "Recipient's full name",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
variable_name: 'login_url',
|
|
68
|
+
variable_description: 'URL to login page',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
template_name: 'email_verification',
|
|
74
|
+
template_label: 'Email Verification',
|
|
75
|
+
variables: [
|
|
76
|
+
{
|
|
77
|
+
variable_name: 'user_name',
|
|
78
|
+
variable_description: "Recipient's name",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
variable_name: 'verification_link',
|
|
82
|
+
variable_description: 'Email verification URL',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
variable_name: 'expiry_hours',
|
|
86
|
+
variable_description: 'Hours until link expires',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
template_name: 'forgot_password',
|
|
92
|
+
template_label: 'Forgot Password',
|
|
93
|
+
variables: [
|
|
94
|
+
{
|
|
95
|
+
variable_name: 'user_name',
|
|
96
|
+
variable_description: "Recipient's name",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
variable_name: 'reset_link',
|
|
100
|
+
variable_description: 'Password reset URL',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
variable_name: 'expiry_minutes',
|
|
104
|
+
variable_description: 'Minutes until link expires',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
template_name: 'email_signature',
|
|
110
|
+
template_label: 'Email Signature',
|
|
111
|
+
variables: [
|
|
112
|
+
{
|
|
113
|
+
variable_name: 'sender_name',
|
|
114
|
+
variable_description: "Sender's name",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
variable_name: 'sender_title',
|
|
118
|
+
variable_description: "Sender's job title",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
variable_name: 'company_name',
|
|
122
|
+
variable_description: 'Company name',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
// ============================================================
|
|
128
|
+
// System Variable Names
|
|
129
|
+
// ============================================================
|
|
130
|
+
exports.SYSTEM_VARIABLE_NAMES = [
|
|
131
|
+
'date_yyyy_mm_dd',
|
|
132
|
+
'date_mmm_dd',
|
|
133
|
+
'date_mmmm_dd_yyyy',
|
|
134
|
+
'date_dd_mm_yyyy',
|
|
135
|
+
'date_dd_mmm_yyyy',
|
|
136
|
+
'time_hh_mm',
|
|
137
|
+
'time_hh_mm_ss',
|
|
138
|
+
'datetime_full',
|
|
139
|
+
'year',
|
|
140
|
+
'month_name',
|
|
141
|
+
'day_of_week',
|
|
142
|
+
];
|
|
143
|
+
// ============================================================
|
|
144
|
+
// Error Messages
|
|
145
|
+
// ============================================================
|
|
146
|
+
exports.ERROR_MESSAGES = {
|
|
147
|
+
TEMPLATE_NOT_FOUND: 'Template not found',
|
|
148
|
+
CATEGORY_NOT_FOUND: 'Category not found',
|
|
149
|
+
INVALID_TEMPLATE_NAME: 'Invalid template name',
|
|
150
|
+
INVALID_CATEGORY_NAME: 'Invalid category name',
|
|
151
|
+
INVALID_VARIABLE_NAME: 'Invalid variable name',
|
|
152
|
+
TEMPLATE_NAME_TOO_LONG: `Template name exceeds maximum length of ${exports.MAX_TEMPLATE_NAME_LENGTH} characters`,
|
|
153
|
+
CATEGORY_NAME_TOO_LONG: `Category name exceeds maximum length of ${exports.MAX_CATEGORY_NAME_LENGTH} characters`,
|
|
154
|
+
TEMPLATE_HTML_TOO_LARGE: `Template HTML exceeds maximum size of ${exports.MAX_TEMPLATE_HTML_SIZE / 1024}KB`,
|
|
155
|
+
TEMPLATE_TEXT_TOO_LARGE: `Template text exceeds maximum size of ${exports.MAX_TEMPLATE_TEXT_SIZE / 1024}KB`,
|
|
156
|
+
CANNOT_DELETE_SYSTEM_TEMPLATE: 'Cannot delete system templates',
|
|
157
|
+
CIRCULAR_REFERENCE_DETECTED: 'Circular template reference detected',
|
|
158
|
+
MAX_REFERENCE_DEPTH_EXCEEDED: `Maximum template reference depth of ${exports.MAX_TEMPLATE_REFERENCE_DEPTH} exceeded`,
|
|
159
|
+
MISSING_REQUIRED_VARIABLE: 'Missing required variable',
|
|
160
|
+
CONFIG_NOT_LOADED: 'Template manager configuration not loaded',
|
|
161
|
+
DB_CONNECTION_REQUIRED: 'Database connection instance required',
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/template_manager/config/constants.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+DAA+D;AAC/D,uBAAuB;AACvB,+DAA+D;AAElD,QAAA,uBAAuB,GAAG,0BAA0B,CAAC;AACrD,QAAA,eAAe,GAAG,uBAAuB,CAAC;AAEvD,+DAA+D;AAC/D,yBAAyB;AACzB,+DAA+D;AAElD,QAAA,sBAAsB,GAAG;IACpC,eAAe;IACf,oBAAoB;IACpB,iBAAiB;IACjB,iBAAiB;CACT,CAAC;AAIX,+DAA+D;AAC/D,yBAAyB;AACzB,+DAA+D;AAElD,QAAA,sBAAsB,GAAG;IACpC,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,QAAQ;CACN,CAAC;AAEX,+DAA+D;AAC/D,oBAAoB;AACpB,+DAA+D;AAE/D,uCAAuC;AAC1B,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C,uCAAuC;AAC1B,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C,mDAAmD;AACtC,QAAA,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,qDAAqD;AACxC,QAAA,sBAAsB,GAAG,GAAG,GAAG,IAAI,CAAC;AAEjD,+CAA+C;AAClC,QAAA,0BAA0B,GAAG,EAAE,CAAC;AAE7C,uEAAuE;AAC1D,QAAA,4BAA4B,GAAG,CAAC,CAAC;AAE9C,+DAA+D;AAC/D,oBAAoB;AACpB,+DAA+D;AAE/D,0CAA0C;AAC7B,QAAA,gBAAgB,GAAG,4BAA4B,CAAC;AAE7D,uCAAuC;AAC1B,QAAA,0BAA0B,GAAG,qBAAqB,CAAC;AAEhE,4EAA4E;AAC/D,QAAA,2BAA2B,GAAG,mBAAmB,CAAC;AAE/D,+DAA+D;AAC/D,kCAAkC;AAClC,+DAA+D;AAElD,QAAA,qCAAqC,GA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Y;IACZ,eAAe;IACf,eAAe;IACf,MAAM;IACN,YAAY;IACZ,aAAa;CACL,CAAC;AAIX,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAElD,QAAA,cAAc,GAAG;IAC5B,kBAAkB,EAAE,oBAAoB;IACxC,kBAAkB,EAAE,oBAAoB;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,qBAAqB,EAAE,uBAAuB;IAC9C,qBAAqB,EAAE,uBAAuB;IAC9C,sBAAsB,EAAE,2CAA2C,gCAAwB,aAAa;IACxG,sBAAsB,EAAE,2CAA2C,gCAAwB,aAAa;IACxG,uBAAuB,EAAE,yCAAyC,8BAAsB,GAAG,IAAI,IAAI;IACnG,uBAAuB,EAAE,yCAAyC,8BAAsB,GAAG,IAAI,IAAI;IACnG,6BAA6B,EAAE,gCAAgC;IAC/D,2BAA2B,EAAE,sCAAsC;IACnE,4BAA4B,EAAE,uCAAuC,oCAA4B,WAAW;IAC5G,yBAAyB,EAAE,2BAA2B;IACtD,iBAAiB,EAAE,2CAA2C;IAC9D,sBAAsB,EAAE,uCAAuC;CACvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/template_manager/config/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Centralized exports for validation, logging, and constants
|
|
3
|
+
* Config barrel export for template manager
|
|
5
4
|
*/
|
|
6
5
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
6
|
if (k2 === undefined) k2 = k;
|
|
@@ -18,7 +17,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
17
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
18
|
};
|
|
20
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.load_template_config = void 0;
|
|
21
21
|
__exportStar(require("./constants"), exports);
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
var config_loader_1 = require("./config_loader");
|
|
23
|
+
Object.defineProperty(exports, "load_template_config", { enumerable: true, get: function () { return config_loader_1.load_template_config; } });
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/template_manager/config/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,iDAAuD;AAA9C,qHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Category repository for template manager
|
|
3
|
+
*
|
|
4
|
+
* CRUD operations for template categories using hazo_connect
|
|
5
|
+
*/
|
|
6
|
+
import type { HazoConnectInstance, TemplateCategory, TemplateCategoryInput, TemplateCategoryUpdate, TemplateOperationResponse } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* List all template categories for an organization
|
|
9
|
+
*
|
|
10
|
+
* @param hazo_connect - Database connection instance
|
|
11
|
+
* @param org_id - Organization ID
|
|
12
|
+
* @returns Response with array of categories
|
|
13
|
+
*/
|
|
14
|
+
export declare function list_categories(hazo_connect: HazoConnectInstance, org_id: string): Promise<TemplateOperationResponse<TemplateCategory[]>>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a single template category by ID
|
|
17
|
+
*
|
|
18
|
+
* @param hazo_connect - Database connection instance
|
|
19
|
+
* @param id - Category ID
|
|
20
|
+
* @returns Response with category data
|
|
21
|
+
*/
|
|
22
|
+
export declare function get_category(hazo_connect: HazoConnectInstance, id: string): Promise<TemplateOperationResponse<TemplateCategory>>;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new template category
|
|
25
|
+
*
|
|
26
|
+
* @param hazo_connect - Database connection instance
|
|
27
|
+
* @param data - Category input data
|
|
28
|
+
* @returns Response with created category
|
|
29
|
+
*/
|
|
30
|
+
export declare function create_category(hazo_connect: HazoConnectInstance, data: TemplateCategoryInput): Promise<TemplateOperationResponse<TemplateCategory>>;
|
|
31
|
+
/**
|
|
32
|
+
* Update an existing template category
|
|
33
|
+
*
|
|
34
|
+
* @param hazo_connect - Database connection instance
|
|
35
|
+
* @param id - Category ID
|
|
36
|
+
* @param data - Update data
|
|
37
|
+
* @returns Response with updated category
|
|
38
|
+
*/
|
|
39
|
+
export declare function update_category(hazo_connect: HazoConnectInstance, id: string, data: TemplateCategoryUpdate): Promise<TemplateOperationResponse<TemplateCategory>>;
|
|
40
|
+
/**
|
|
41
|
+
* Delete a template category and all its templates
|
|
42
|
+
*
|
|
43
|
+
* @param hazo_connect - Database connection instance
|
|
44
|
+
* @param id - Category ID
|
|
45
|
+
* @returns Response with deletion result
|
|
46
|
+
*/
|
|
47
|
+
export declare function delete_category(hazo_connect: HazoConnectInstance, id: string): Promise<TemplateOperationResponse<boolean>>;
|
|
48
|
+
/**
|
|
49
|
+
* Find a category by name within an organization
|
|
50
|
+
*
|
|
51
|
+
* @param hazo_connect - Database connection instance
|
|
52
|
+
* @param org_id - Organization ID
|
|
53
|
+
* @param name - Category name
|
|
54
|
+
* @returns Response with category if found
|
|
55
|
+
*/
|
|
56
|
+
export declare function find_category_by_name(hazo_connect: HazoConnectInstance, org_id: string, name: string): Promise<TemplateOperationResponse<TemplateCategory | null>>;
|
|
57
|
+
//# sourceMappingURL=category_repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category_repository.d.ts","sourceRoot":"","sources":["../../../src/lib/template_manager/db/category_repository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAQlB;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,yBAAyB,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAyCxD;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,YAAY,EAAE,mBAAmB,EACjC,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,CAAC,CA6CtD;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,mBAAmB,EACjC,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,CAAC,CAyDtD;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,mBAAmB,EACjC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,CAAC,CAuEtD;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,mBAAmB,EACjC,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,CA+D7C;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,yBAAyB,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAiC7D"}
|