fiberx-backend-toolkit 0.0.69 → 0.0.71

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.
@@ -36,15 +36,17 @@ const GENERATE_UTIL_METHOD_CODE = (interface_name, method_name, code) => {
36
36
  public static async ${method_name}(params: {
37
37
  recipient_email: string;
38
38
  created_by?: number | null;
39
- payload: ${interface_name};
40
- }): Promise {
39
+ payload: Types.${interface_name};
40
+ }): Promise<boolean> {
41
41
  try {
42
- return this.email_enqueue_processor.enqueue<${interface_name}>({
42
+ const enqueued = await this.email_enqueue_processor.enqueue<Types.${interface_name}>({
43
43
  notification_code: "${code}",
44
44
  recipient_email: params.recipient_email,
45
45
  created_by: params.created_by ?? null,
46
46
  payload: params.payload,
47
47
  });
48
+
49
+ return (!enqueued);
48
50
  }
49
51
  catch(error: any) {
50
52
  this.logger.error("Failed to enqueue email in method ${method_name}", { error });
@@ -58,15 +60,15 @@ const GENERATE_UTIL_CLASS_CODE = (types_file_name, generated_content) => {
58
60
  return `
59
61
  import { EmailEnqueueProcessor } from "fiberx-backend-toolkit/dist/mailer/main";
60
62
  import { LoggerUtil } from "fiberx-backend-toolkit/dist/utils/main";
61
- import * as Types from "@/${types_file_name}";
63
+ import * as Types from "@/${types_file_name.replace(".ts", "")}";
62
64
 
63
65
  class GeneratedEmailEnqueueUtil {
64
66
  private static readonly name: string = "generated_email_enqueue_util";
65
67
  private static readonly logger: LoggerUtil = new LoggerUtil(this.name);
66
- private static email_enqueue_processor: EmailEnqueueProcessor = EmailEnqueueProcessor.getInstance();
68
+ private static readonly email_enqueue_processor = EmailEnqueueProcessor.getInstance();
67
69
 
68
70
 
69
- ${generated_content}
71
+ ${generated_content}
70
72
  }
71
73
 
72
74
  export default GeneratedEmailEnqueueUtil;
@@ -109,8 +109,8 @@ class EmailEnqueueGenerator {
109
109
  try {
110
110
  const notification = this.provider.getNotificationFromTemplate(template);
111
111
  const code = this.provider.getNotificationCode(notification);
112
- const interface_name = main_1.InputTransformerUtil.toPascalCase(code) + "EmailPayload";
113
- const method_name = "send" + main_1.InputTransformerUtil.toPascalCase(code);
112
+ const interface_name = main_1.InputTransformerUtil.toPascalCase(code.toLowerCase()) + "EmailPayload";
113
+ const method_name = "send" + main_1.InputTransformerUtil.toPascalCase(code.toLowerCase()) + "Email";
114
114
  const placeholders = this.provider.getRequiredPlaceholders(template) ?? {};
115
115
  const static_obj = main_1.InputTransformerUtil.buildNestedObject(placeholders.static_content ?? []);
116
116
  const db_obj = main_1.InputTransformerUtil.buildNestedObject(placeholders.db_content ?? []);
@@ -121,8 +121,8 @@ class TOTPServiceUtil {
121
121
  }
122
122
  generateAppSecret(member_email, custom_app_name = "") {
123
123
  const app_name = this.env_manager.getEnvVar("APP_NAME", custom_app_name) ?? custom_app_name;
124
- const name = input_validator_util_1.default.isProduction() ? `${app_name}:${member_email}` : `Dev ${app_name}:${member_email}`;
125
- const issuer = (this.env_manager.getEnvVar("APP_ID", custom_app_name) ?? custom_app_name)?.toLowerCase();
124
+ const name = member_email;
125
+ const issuer = input_validator_util_1.default.isProduction() ? `${app_name}` : `Dev ${app_name}`;
126
126
  return this.generateSecret({ name, issuer });
127
127
  }
128
128
  // ===============================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiberx-backend-toolkit",
3
- "version": "0.0.69",
3
+ "version": "0.0.71",
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",