fiberx-backend-toolkit 0.0.36 → 0.0.39
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/database/scripts/sequelize_model_generator_script.js +4 -3
- package/dist/types/database_type.d.ts +1 -0
- package/dist/types/express_decelaration.d.ts +18 -0
- package/dist/types/express_decelaration.js +3 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/main.js +1 -0
- package/package.json +1 -1
|
@@ -20,13 +20,13 @@ class SeqeulizeModelGeneratorScript {
|
|
|
20
20
|
updateModelsIndex(models_created) {
|
|
21
21
|
const index_path = path_1.default.join(this.models_dir, "index.ts");
|
|
22
22
|
const model_names = [];
|
|
23
|
-
const
|
|
23
|
+
const sorted_models = models_created.sort((a, b) => a.migration_priority - b.migration_priority);
|
|
24
|
+
const imports = sorted_models
|
|
24
25
|
.map((model_obj) => {
|
|
25
26
|
model_names.push(model_obj.name);
|
|
26
27
|
return `import ${model_obj.name} from "./${model_obj.file_name.replace('.ts', '')}";`;
|
|
27
28
|
})
|
|
28
29
|
.join("\n");
|
|
29
|
-
const exports = model_names.join(",\n ");
|
|
30
30
|
const template = (0, sequelize_code_template_1.SEQUELIZE_MODELS_INDEX_CODE_TEMPLATE)(model_names, imports);
|
|
31
31
|
try {
|
|
32
32
|
fs_1.default.writeFileSync(index_path, template.trim(), { encoding: "utf-8" });
|
|
@@ -86,6 +86,7 @@ class SeqeulizeModelGeneratorScript {
|
|
|
86
86
|
const model_file_name = `${main_1.InputTransformerUtil.toSnakeCase(schema_content.model_name)}_model.ts`;
|
|
87
87
|
const model_file_path = path_1.default.join(this.models_dir, model_file_name);
|
|
88
88
|
const generation_result = this.generateModelFile(schema_file_path, schema_content, model_file_name, model_file_path);
|
|
89
|
+
const migration_priority = schema_content.migration_priority;
|
|
89
90
|
if (generation_result === "skipped") {
|
|
90
91
|
skipped_count++;
|
|
91
92
|
}
|
|
@@ -95,7 +96,7 @@ class SeqeulizeModelGeneratorScript {
|
|
|
95
96
|
else if (generation_result === "created") {
|
|
96
97
|
created_count++;
|
|
97
98
|
}
|
|
98
|
-
models.push({ name: schema_content.model_name, file_name: model_file_name });
|
|
99
|
+
models.push({ name: schema_content.model_name, file_name: model_file_name, migration_priority });
|
|
99
100
|
}
|
|
100
101
|
catch (error) {
|
|
101
102
|
this.logger.error(`Failed to load schema: ${schema_file_path}`, { error });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "express-serve-static-core";
|
|
2
|
+
declare module "express-serve-static-core" {
|
|
3
|
+
interface Response {
|
|
4
|
+
errResponse: (code?: number, msg?: string, data?: any) => Response;
|
|
5
|
+
successResponse: (code?: number, msg?: string, data?: any) => Response;
|
|
6
|
+
infoResponse: (code?: number, msg?: string, data?: any) => Response;
|
|
7
|
+
handle404Error: () => Response;
|
|
8
|
+
}
|
|
9
|
+
interface Request {
|
|
10
|
+
getCookie: (name: string) => string | undefined;
|
|
11
|
+
setCookie: (name: string, value: string, options?: {
|
|
12
|
+
max_age?: number;
|
|
13
|
+
}) => void;
|
|
14
|
+
clearCookie: (name: string) => void;
|
|
15
|
+
request_id?: string;
|
|
16
|
+
clientIp?: string;
|
|
17
|
+
}
|
|
18
|
+
}
|
package/dist/types/main.d.ts
CHANGED
package/dist/types/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fiberx-backend-toolkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
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",
|