fiberx-backend-toolkit 0.0.76 → 0.0.77

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.
@@ -1,4 +1,4 @@
1
- declare const GENERATE_NOTIFICATION_CODE_TYPE: (interface_name: string, static_obj: any, db_obj: any, code: string) => string;
1
+ declare const GENERATE_NOTIFICATION_CODE_TYPE: (interface_name: string, db_obj: any, code: string) => string;
2
2
  declare const GENERATE_UTIL_METHOD_CODE: (interface_name: string, method_name: string, code: string) => string;
3
3
  declare const GENERATE_UTIL_CLASS_CODE: (types_file_name: string, generated_content: string) => string;
4
4
  export { GENERATE_NOTIFICATION_CODE_TYPE, GENERATE_UTIL_METHOD_CODE, GENERATE_UTIL_CLASS_CODE };
@@ -12,18 +12,13 @@ const objectToType = (obj, indent) => {
12
12
  })
13
13
  .join("\n");
14
14
  };
15
- const GENERATE_NOTIFICATION_CODE_TYPE = (interface_name, static_obj, db_obj, code) => {
15
+ const GENERATE_NOTIFICATION_CODE_TYPE = (interface_name, db_obj, code) => {
16
16
  return `
17
17
  /**
18
18
  * @generated-notification-code: ${code}
19
19
  */
20
20
  export interface ${interface_name} {
21
- static_content?: {
22
- ${objectToType(static_obj, 8)}
23
- };
24
- db_content: {
25
21
  ${objectToType(db_obj, 8)}
26
- };
27
22
  }
28
23
  `;
29
24
  };
@@ -65,9 +65,9 @@ class EmailEnqueueGenerator {
65
65
  }
66
66
  }
67
67
  // Method to append generated to type to output file type
68
- appendType(interface_name, static_obj, db_obj, code) {
68
+ appendType(interface_name, db_obj, code) {
69
69
  try {
70
- const content = (0, email_enqueue_code_template_1.GENERATE_NOTIFICATION_CODE_TYPE)(interface_name, static_obj, db_obj, code);
70
+ const content = (0, email_enqueue_code_template_1.GENERATE_NOTIFICATION_CODE_TYPE)(interface_name, db_obj, code);
71
71
  fs_1.default.appendFileSync(this.types_file_path, content);
72
72
  this.logger.info(`🧩 Type generated → ${interface_name} (${code})`);
73
73
  return true;
@@ -112,10 +112,9 @@ class EmailEnqueueGenerator {
112
112
  const interface_name = main_1.InputTransformerUtil.toPascalCase(code.toLowerCase()) + "EmailPayload";
113
113
  const method_name = "send" + main_1.InputTransformerUtil.toPascalCase(code.toLowerCase()) + "Email";
114
114
  const placeholders = this.provider.getRequiredPlaceholders(template) ?? {};
115
- const static_obj = main_1.InputTransformerUtil.buildNestedObject(placeholders.static_content ?? []);
116
115
  const db_obj = main_1.InputTransformerUtil.buildNestedObject(placeholders.db_content ?? []);
117
116
  this.logger.info(`🚀 Generating email enqueue code for → ${code}`);
118
- const type_success = this.appendType(interface_name, static_obj, db_obj, code);
117
+ const type_success = this.appendType(interface_name, db_obj, code);
119
118
  const method_success = this.appendUtilMethod(interface_name, method_name, code);
120
119
  if (type_success && method_success) {
121
120
  this.logger.success?.(`✅ Successfully generated enqueue method for code → ${code}`);
@@ -81,8 +81,8 @@ class EmailEnqueueProcessor {
81
81
  this.logger.error("Failed to fetch notification record from template", { notification });
82
82
  throw new Error("Failed to fetch notification record from template");
83
83
  }
84
- this.logger.info("Template record resolved", { notification_code });
85
- const content_payload = await this.LoadEmailContentPayload(notification_code);
84
+ this.logger.info("Notification record resolved", { notification_code });
85
+ const content_payload = await this.LoadEmailContentPayload(`${notification_code}_email`);
86
86
  const full_payload = { static_content: content_payload, db_content: data_payload };
87
87
  // 4️⃣ Validate
88
88
  this.validate(this.provider.getRequiredPlaceholders(template), full_payload);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiberx-backend-toolkit",
3
- "version": "0.0.76",
3
+ "version": "0.0.77",
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",