fiberx-backend-toolkit 0.0.66 → 0.0.68

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.
@@ -18,10 +18,10 @@ const GENERATE_NOTIFICATION_CODE_TYPE = (interface_name, static_obj, db_obj, cod
18
18
  * @generated-notification-code: ${code}
19
19
  */
20
20
  export interface ${interface_name} {
21
- static_data: {
21
+ static_content: {
22
22
  ${objectToType(static_obj, 8)}
23
23
  };
24
- db_data: {
24
+ db_content: {
25
25
  ${objectToType(db_obj, 8)}
26
26
  };
27
27
  }
@@ -373,7 +373,7 @@ class ${class_name}Seeder {
373
373
  const seed_data = this.getSeedData();
374
374
 
375
375
  if (!seed_data || seed_data.length === 0) {
376
- throw new Error("❌ Seeder data for 'roles' is empty. Aborting bulk insert.");
376
+ throw new Error("❌ Seeder data for '${table_name.toLowerCase()}' is empty. Aborting bulk insert.");
377
377
  }
378
378
 
379
379
  await queryInterface.bulkInsert('${table_name.toLowerCase()}', seed_data);
@@ -386,7 +386,7 @@ class ${class_name}Seeder {
386
386
  const seed_data = this.getSeedData();
387
387
 
388
388
  if (!seed_data || seed_data.length === 0) {
389
- throw new Error("❌ Seeder data for 'roles' is empty. Nothing to delete.");
389
+ throw new Error("❌ Seeder data for ${table_name.toLowerCase()}' is empty. Nothing to delete.");
390
390
  }
391
391
 
392
392
  const ids = seed_data.map(row => row.id);
@@ -112,8 +112,8 @@ class EmailEnqueueGenerator {
112
112
  const interface_name = main_1.InputTransformerUtil.toPascalCase(code) + "EmailPayload";
113
113
  const method_name = "send" + main_1.InputTransformerUtil.toPascalCase(code);
114
114
  const placeholders = this.provider.getRequiredPlaceholders(template) ?? {};
115
- const static_obj = main_1.InputTransformerUtil.buildNestedObject(placeholders.static_data ?? []);
116
- const db_obj = main_1.InputTransformerUtil.buildNestedObject(placeholders.db_data ?? []);
115
+ const static_obj = main_1.InputTransformerUtil.buildNestedObject(placeholders.static_content ?? []);
116
+ const db_obj = main_1.InputTransformerUtil.buildNestedObject(placeholders.db_content ?? []);
117
117
  this.logger.info(`🚀 Generating email enqueue code for → ${code}`);
118
118
  const type_success = this.appendType(interface_name, static_obj, db_obj, code);
119
119
  const method_success = this.appendUtilMethod(interface_name, method_name, code);
@@ -32,14 +32,14 @@ class EmailEnqueueProcessor {
32
32
  const check_patch = (obj, path) => {
33
33
  return path.split(".").reduce((o, k) => o?.[k], obj);
34
34
  };
35
- for (const p of required.static_data ?? []) {
36
- if (check_patch(payload["static_data"], p) === undefined) {
37
- missing.push(`static_data.${p}`);
35
+ for (const p of required.static_content ?? []) {
36
+ if (check_patch(payload["static_content"], p) === undefined) {
37
+ missing.push(`static_content.${p}`);
38
38
  }
39
39
  }
40
- for (const p of required.db_data ?? []) {
41
- if (check_patch(payload["db_data"], p) === undefined) {
42
- missing.push(`db_data.${p}`);
40
+ for (const p of required.db_content ?? []) {
41
+ if (check_patch(payload["db_content"], p) === undefined) {
42
+ missing.push(`db_content.${p}`);
43
43
  }
44
44
  }
45
45
  if (missing.length) {
@@ -5,8 +5,8 @@ export interface EmailEnqueueGeneratorOptions {
5
5
  batch_size?: number;
6
6
  }
7
7
  export interface EmailTemplatePlaceholders {
8
- static_data?: string[];
9
- db_data?: string[];
8
+ static_content?: string[];
9
+ db_content?: string[];
10
10
  }
11
11
  export interface EmailEnqueueDataProvider<TTemplate, TNotification> {
12
12
  fetchActiveTemplates(exclude_codes: string[], limit: number): Promise<TTemplate[]>;
@@ -112,5 +112,6 @@ declare class InputTransformerUtil {
112
112
  */
113
113
  static formatLinksObject(links: Record<string, string>): Record<string, string>;
114
114
  static buildNestedObject(paths: string[]): any;
115
+ static minifyHtml(html: string): string;
115
116
  }
116
117
  export default InputTransformerUtil;
@@ -327,5 +327,20 @@ class InputTransformerUtil {
327
327
  }
328
328
  return root;
329
329
  }
330
+ // Method to minify html code
331
+ static minifyHtml(html) {
332
+ if (!html) {
333
+ return html;
334
+ }
335
+ return html
336
+ // Remove line breaks and tabs
337
+ .replace(/[\n\r\t]+/g, " ")
338
+ // Remove spaces between tags
339
+ .replace(/>\s+</g, "><")
340
+ // Collapse multiple spaces (but keep single space)
341
+ .replace(/\s{2,}/g, " ")
342
+ // Trim start and end
343
+ .trim();
344
+ }
330
345
  }
331
346
  exports.default = InputTransformerUtil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiberx-backend-toolkit",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
4
4
  "description": "A TypeScript backend toolkit providing shared domain logic, infrastructure helpers, and utilities for FiberX server-side applications and services.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",