fiberx-backend-toolkit 0.1.1 → 0.1.2

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.
@@ -19,7 +19,6 @@ const GENERATE_NOTIFICATION_CODE_TYPE = (interface_name, db_obj, code) => {
19
19
  */
20
20
  export interface ${interface_name} {
21
21
  ${objectToType(db_obj, 8)}
22
- attachment?s: EmailAttachmentInterface[]
23
22
  }
24
23
  `;
25
24
  };
@@ -33,6 +32,7 @@ const GENERATE_UTIL_METHOD_CODE = (interface_name, method_name, code) => {
33
32
  recipient_email: string;
34
33
  created_by?: number | null;
35
34
  payload: Types.${interface_name};
35
+ attachments?: EmailAttachmentInterface[];
36
36
  }): Promise<boolean> {
37
37
  try {
38
38
  const enqueued = await EmailEnqueueProcessor?.getInstance()?.enqueue<Types.${interface_name}>({
@@ -40,6 +40,7 @@ const GENERATE_UTIL_METHOD_CODE = (interface_name, method_name, code) => {
40
40
  recipient_email: params.recipient_email,
41
41
  created_by: params.created_by ?? null,
42
42
  payload: params.payload,
43
+ attachments: params.attachments
43
44
  });
44
45
 
45
46
  return (!enqueued);
@@ -63,7 +64,6 @@ class GeneratedEmailEnqueueUtil {
63
64
  private static readonly name: string = "generated_email_enqueue_util";
64
65
  private static readonly logger: LoggerUtil = new LoggerUtil(this.name);
65
66
 
66
-
67
67
  ${generated_content}
68
68
  }
69
69
 
@@ -67,7 +67,7 @@ class EmailEnqueueProcessor {
67
67
  // ==============================
68
68
  async enqueue(input) {
69
69
  try {
70
- const { notification_code, payload: data_payload, recipient_email, created_by, scheduled_at = null, } = input;
70
+ const { notification_code, payload: data_payload, recipient_email, created_by, scheduled_at = null, attachments = [] } = input;
71
71
  this.logger.info("Enqueue email request received", { notification_code, recipient_email, scheduled_at });
72
72
  // 1️⃣ Resolve notification
73
73
  const template = await this.provider.fetchActiveTemplate(notification_code);
@@ -83,7 +83,7 @@ class EmailEnqueueProcessor {
83
83
  }
84
84
  this.logger.info("Notification record resolved", { notification_code });
85
85
  const content_payload = await this.LoadEmailContentPayload(`${notification_code}_email`);
86
- const full_payload = { static_content: content_payload, db_content: data_payload };
86
+ const full_payload = { static_content: content_payload, db_content: data_payload, attachments };
87
87
  // 4️⃣ Validate
88
88
  this.validate(this.provider.getRequiredPlaceholders(template), full_payload);
89
89
  // 5️⃣ Resolve mailer config
@@ -35,6 +35,7 @@ export interface EmailEnqueueInput<TPayload> {
35
35
  recipient_email: string;
36
36
  created_by?: number | null;
37
37
  scheduled_at?: Date | null;
38
+ attachments?: EmailAttachmentInterface[];
38
39
  }
39
40
  export interface EmailEnqueueProcessorDataProvider<TNotification, TTemplate, TMailerConfig> {
40
41
  fetchActiveTemplate(notification_code: string): Promise<TTemplate | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiberx-backend-toolkit",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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",