fiberx-backend-toolkit 0.0.66 → 0.0.67
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/dist/code_templates/email_enqueue_code_template.js +2 -2
- package/dist/code_templates/sequelize_code_template.js +2 -2
- package/dist/mailer/generators/email_enqueue_generator.js +2 -2
- package/dist/mailer/processors/email_enqueue_processor.js +6 -6
- package/dist/types/mailer_type.d.ts +2 -2
- package/package.json +1 -1
|
@@ -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
|
-
|
|
21
|
+
static_content: {
|
|
22
22
|
${objectToType(static_obj, 8)}
|
|
23
23
|
};
|
|
24
|
-
|
|
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 '
|
|
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 '
|
|
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.
|
|
116
|
-
const db_obj = main_1.InputTransformerUtil.buildNestedObject(placeholders.
|
|
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.
|
|
36
|
-
if (check_patch(payload["
|
|
37
|
-
missing.push(`
|
|
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.
|
|
41
|
-
if (check_patch(payload["
|
|
42
|
-
missing.push(`
|
|
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
|
-
|
|
9
|
-
|
|
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[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fiberx-backend-toolkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.67",
|
|
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",
|