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.
@@ -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 imports = models_created
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 });
@@ -13,4 +13,5 @@ export type ModelGenerationResult = "created" | "skipped" | "failed";
13
13
  export interface ModelsCreatedObj {
14
14
  name: string;
15
15
  file_name: string;
16
+ migration_priority: number;
16
17
  }
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("express-serve-static-core");
@@ -4,3 +4,4 @@ export * from "./util_type";
4
4
  export * from "./middle_ware_type";
5
5
  export * from "./database_type";
6
6
  export * from "./module_type";
7
+ export * from "./express_decelaration";
@@ -20,3 +20,4 @@ __exportStar(require("./util_type"), exports);
20
20
  __exportStar(require("./middle_ware_type"), exports);
21
21
  __exportStar(require("./database_type"), exports);
22
22
  __exportStar(require("./module_type"), exports);
23
+ __exportStar(require("./express_decelaration"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiberx-backend-toolkit",
3
- "version": "0.0.36",
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",