@devbro/pashmak 0.1.26 → 0.1.28

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.
Files changed (31) hide show
  1. package/dist/app/console/generate/GenerateApiDocsCommand.d.mts +9 -0
  2. package/dist/app/console/generate/GenerateApiDocsCommand.mjs +117 -0
  3. package/dist/app/console/generate/GenerateApiDocsCommand.mjs.map +1 -0
  4. package/dist/app/console/generate/index.d.mts +1 -0
  5. package/dist/app/console/generate/index.mjs +1 -0
  6. package/dist/app/console/generate/index.mjs.map +1 -1
  7. package/dist/app/console/index.d.mts +1 -0
  8. package/dist/app/console/migrate/MigrateCommand.mjs +5 -0
  9. package/dist/app/console/migrate/MigrateCommand.mjs.map +1 -1
  10. package/dist/app/console/migrate/MigrateRollbackCommand.mjs +2 -0
  11. package/dist/app/console/migrate/MigrateRollbackCommand.mjs.map +1 -1
  12. package/dist/bin/app/console/DefaultCommand.cjs +3 -0
  13. package/dist/bin/app/console/KeyGenerateCommand.cjs +3 -0
  14. package/dist/bin/app/console/StartCommand.cjs +3 -0
  15. package/dist/bin/app/console/generate/GenerateApiDocsCommand.cjs +868 -0
  16. package/dist/bin/app/console/generate/GenerateControllerCommand.cjs +3 -0
  17. package/dist/bin/app/console/generate/index.cjs +131 -14
  18. package/dist/bin/app/console/index.cjs +170 -46
  19. package/dist/bin/app/console/migrate/GenerateMigrateCommand.cjs +3 -0
  20. package/dist/bin/app/console/migrate/MigrateCommand.cjs +8 -0
  21. package/dist/bin/app/console/migrate/MigrateRollbackCommand.cjs +5 -0
  22. package/dist/bin/app/console/migrate/index.cjs +10 -0
  23. package/dist/bin/app/console/queue/GenerateQueueMigrateCommand.cjs +3 -0
  24. package/dist/bin/cache.cjs +3 -0
  25. package/dist/bin/facades.cjs +3 -0
  26. package/dist/bin/factories.cjs +3 -0
  27. package/dist/bin/index.cjs +180 -49
  28. package/dist/bin/middlewares.cjs +3 -0
  29. package/dist/bin/queue.cjs +3 -0
  30. package/dist/bin/router.cjs +3 -0
  31. package/package.json +1 -1
@@ -1269,6 +1269,9 @@ var CompiledRoute = class {
1269
1269
  }
1270
1270
  prepareOutputJsonFormat(obj) {
1271
1271
  function traverse(value) {
1272
+ if (value === void 0 || value === null) {
1273
+ return null;
1274
+ }
1272
1275
  if (!value || typeof value !== "object") {
1273
1276
  return value;
1274
1277
  }
@@ -1929,6 +1932,7 @@ var MigrateRollbackCommand = class extends import_clipanion2.Command {
1929
1932
  files = dirEntries.filter((entry) => entry.endsWith(".ts")).sort();
1930
1933
  const migrations = await db2.runQuery({
1931
1934
  sql: "select * from migrations order by created_at DESC limit $1",
1935
+ parts: [],
1932
1936
  bindings: [this.steps]
1933
1937
  });
1934
1938
  for (const migration of migrations) {
@@ -1939,6 +1943,7 @@ var MigrateRollbackCommand = class extends import_clipanion2.Command {
1939
1943
  await c.down(db2.getSchema());
1940
1944
  await db2.runQuery({
1941
1945
  sql: "delete from migrations where id = $1",
1946
+ parts: [],
1942
1947
  bindings: [migration.id]
1943
1948
  });
1944
1949
  }
@@ -1271,6 +1271,9 @@ var CompiledRoute = class {
1271
1271
  }
1272
1272
  prepareOutputJsonFormat(obj) {
1273
1273
  function traverse(value) {
1274
+ if (value === void 0 || value === null) {
1275
+ return null;
1276
+ }
1274
1277
  if (!value || typeof value !== "object") {
1275
1278
  return value;
1276
1279
  }
@@ -1933,6 +1936,7 @@ var MigrateCommand = class extends import_clipanion2.Command {
1933
1936
  logger().info("reverting all migrations!!");
1934
1937
  const existing_migrations = await db2.runQuery({
1935
1938
  sql: "select * from migrations order by created_at DESC",
1939
+ parts: [],
1936
1940
  bindings: []
1937
1941
  });
1938
1942
  const migrationsDir2 = import_neko_config2.config.get("migration.path");
@@ -1944,6 +1948,7 @@ var MigrateCommand = class extends import_clipanion2.Command {
1944
1948
  await migrationInstance.down(db2.getSchema());
1945
1949
  await db2.runQuery({
1946
1950
  sql: "delete from migrations where filename = $1",
1951
+ parts: [],
1947
1952
  bindings: [migration_record.filename]
1948
1953
  });
1949
1954
  } catch (error) {
@@ -1971,12 +1976,14 @@ var MigrateCommand = class extends import_clipanion2.Command {
1971
1976
  files = dirEntries.filter((entry) => entry.endsWith(".ts") || entry.endsWith(".js")).sort();
1972
1977
  let batch_number = await db2.runQuery({
1973
1978
  sql: "select max(batch) as next_batch from migrations",
1979
+ parts: [],
1974
1980
  bindings: []
1975
1981
  });
1976
1982
  batch_number = batch_number[0].next_batch || 0;
1977
1983
  batch_number++;
1978
1984
  const migrations = await db2.runQuery({
1979
1985
  sql: "select * from migrations order by created_at ASC",
1986
+ parts: [],
1980
1987
  bindings: []
1981
1988
  });
1982
1989
  const completed_migrations = migrations.map((r) => r.filename);
@@ -1991,6 +1998,7 @@ var MigrateCommand = class extends import_clipanion2.Command {
1991
1998
  await c.up(db2.getSchema());
1992
1999
  await db2.runQuery({
1993
2000
  sql: "insert into migrations (filename, batch) values ($1,$2)",
2001
+ parts: [],
1994
2002
  bindings: [class_to_migrate, batch_number]
1995
2003
  });
1996
2004
  migrated_count++;
@@ -2082,6 +2090,7 @@ var MigrateRollbackCommand = class extends import_clipanion4.Command {
2082
2090
  files = dirEntries.filter((entry) => entry.endsWith(".ts")).sort();
2083
2091
  const migrations = await db2.runQuery({
2084
2092
  sql: "select * from migrations order by created_at DESC limit $1",
2093
+ parts: [],
2085
2094
  bindings: [this.steps]
2086
2095
  });
2087
2096
  for (const migration of migrations) {
@@ -2092,6 +2101,7 @@ var MigrateRollbackCommand = class extends import_clipanion4.Command {
2092
2101
  await c.down(db2.getSchema());
2093
2102
  await db2.runQuery({
2094
2103
  sql: "delete from migrations where id = $1",
2104
+ parts: [],
2095
2105
  bindings: [migration.id]
2096
2106
  });
2097
2107
  }
@@ -114,6 +114,9 @@ var CompiledRoute = class {
114
114
  }
115
115
  prepareOutputJsonFormat(obj) {
116
116
  function traverse(value) {
117
+ if (value === void 0 || value === null) {
118
+ return null;
119
+ }
117
120
  if (!value || typeof value !== "object") {
118
121
  return value;
119
122
  }
@@ -115,6 +115,9 @@ var CompiledRoute = class {
115
115
  }
116
116
  prepareOutputJsonFormat(obj) {
117
117
  function traverse(value) {
118
+ if (value === void 0 || value === null) {
119
+ return null;
120
+ }
118
121
  if (!value || typeof value !== "object") {
119
122
  return value;
120
123
  }
@@ -123,6 +123,9 @@ var CompiledRoute = class {
123
123
  }
124
124
  prepareOutputJsonFormat(obj) {
125
125
  function traverse(value) {
126
+ if (value === void 0 || value === null) {
127
+ return null;
128
+ }
126
129
  if (!value || typeof value !== "object") {
127
130
  return value;
128
131
  }
@@ -124,6 +124,9 @@ var CompiledRoute = class {
124
124
  }
125
125
  prepareOutputJsonFormat(obj) {
126
126
  function traverse(value) {
127
+ if (value === void 0 || value === null) {
128
+ return null;
129
+ }
127
130
  if (!value || typeof value !== "object") {
128
131
  return value;
129
132
  }
@@ -133,6 +133,9 @@ var init_CompiledRoute = __esm({
133
133
  }
134
134
  prepareOutputJsonFormat(obj) {
135
135
  function traverse(value) {
136
+ if (value === void 0 || value === null) {
137
+ return null;
138
+ }
136
139
  if (!value || typeof value !== "object") {
137
140
  return value;
138
141
  }
@@ -246,46 +249,46 @@ var init_Route = __esm({
246
249
  static {
247
250
  __name(this, "Route");
248
251
  }
249
- constructor(methods, path9, handler) {
252
+ constructor(methods, path10, handler) {
250
253
  this.methods = methods;
251
- this.path = path9;
254
+ this.path = path10;
252
255
  this.handler = handler;
253
- this.urlRegex = this.pathToRegex(path9);
256
+ this.urlRegex = this.pathToRegex(path10);
254
257
  }
255
258
  middlewares = [];
256
259
  urlRegex;
257
- pathToRegex(path9) {
258
- const lex = this.lexUrlPath(path9);
260
+ pathToRegex(path10) {
261
+ const lex = this.lexUrlPath(path10);
259
262
  return this.tokensToRegex(lex);
260
263
  }
261
- lexUrlPath(path9) {
264
+ lexUrlPath(path10) {
262
265
  const tokens = [];
263
266
  let i = 0;
264
- while (i < path9.length) {
265
- const char = path9[i];
267
+ while (i < path10.length) {
268
+ const char = path10[i];
266
269
  if (char === "/") {
267
270
  tokens.push({ type: "SLASH", value: "/" });
268
271
  i++;
269
272
  } else if (char === ":") {
270
273
  let start = i + 1;
271
- while (start < path9.length && /[a-zA-Z0-9_]/.test(path9[start])) {
274
+ while (start < path10.length && /[a-zA-Z0-9_]/.test(path10[start])) {
272
275
  start++;
273
276
  }
274
- tokens.push({ type: "PARAM", value: path9.slice(i + 1, start) });
277
+ tokens.push({ type: "PARAM", value: path10.slice(i + 1, start) });
275
278
  i = start;
276
279
  } else if (char === "*") {
277
280
  let start = i + 1;
278
- while (start < path9.length && /[a-zA-Z0-9_\.]/.test(path9[start])) {
281
+ while (start < path10.length && /[a-zA-Z0-9_\.]/.test(path10[start])) {
279
282
  start++;
280
283
  }
281
- tokens.push({ type: "WILDCARD", value: path9.slice(i + 1, start) });
284
+ tokens.push({ type: "WILDCARD", value: path10.slice(i + 1, start) });
282
285
  i = start;
283
286
  } else {
284
287
  let start = i;
285
- while (start < path9.length && !["/", ":", "*"].includes(path9[start])) {
288
+ while (start < path10.length && !["/", ":", "*"].includes(path10[start])) {
286
289
  start++;
287
290
  }
288
- tokens.push({ type: "TEXT", value: path9.slice(i, start) });
291
+ tokens.push({ type: "TEXT", value: path10.slice(i, start) });
289
292
  i = start;
290
293
  }
291
294
  }
@@ -904,6 +907,7 @@ var init_MigrateCommand = __esm({
904
907
  logger().info("reverting all migrations!!");
905
908
  const existing_migrations = await db2.runQuery({
906
909
  sql: "select * from migrations order by created_at DESC",
910
+ parts: [],
907
911
  bindings: []
908
912
  });
909
913
  const migrationsDir2 = import_neko_config2.config.get("migration.path");
@@ -915,6 +919,7 @@ var init_MigrateCommand = __esm({
915
919
  await migrationInstance.down(db2.getSchema());
916
920
  await db2.runQuery({
917
921
  sql: "delete from migrations where filename = $1",
922
+ parts: [],
918
923
  bindings: [migration_record.filename]
919
924
  });
920
925
  } catch (error) {
@@ -942,12 +947,14 @@ var init_MigrateCommand = __esm({
942
947
  files = dirEntries.filter((entry) => entry.endsWith(".ts") || entry.endsWith(".js")).sort();
943
948
  let batch_number = await db2.runQuery({
944
949
  sql: "select max(batch) as next_batch from migrations",
950
+ parts: [],
945
951
  bindings: []
946
952
  });
947
953
  batch_number = batch_number[0].next_batch || 0;
948
954
  batch_number++;
949
955
  const migrations = await db2.runQuery({
950
956
  sql: "select * from migrations order by created_at ASC",
957
+ parts: [],
951
958
  bindings: []
952
959
  });
953
960
  const completed_migrations = migrations.map((r) => r.filename);
@@ -962,6 +969,7 @@ var init_MigrateCommand = __esm({
962
969
  await c.up(db2.getSchema());
963
970
  await db2.runQuery({
964
971
  sql: "insert into migrations (filename, batch) values ($1,$2)",
972
+ parts: [],
965
973
  bindings: [class_to_migrate, batch_number]
966
974
  });
967
975
  migrated_count++;
@@ -2219,6 +2227,7 @@ var init_MigrateRollbackCommand = __esm({
2219
2227
  files = dirEntries.filter((entry) => entry.endsWith(".ts")).sort();
2220
2228
  const migrations = await db2.runQuery({
2221
2229
  sql: "select * from migrations order by created_at DESC limit $1",
2230
+ parts: [],
2222
2231
  bindings: [this.steps]
2223
2232
  });
2224
2233
  for (const migration of migrations) {
@@ -2229,6 +2238,7 @@ var init_MigrateRollbackCommand = __esm({
2229
2238
  await c.down(db2.getSchema());
2230
2239
  await db2.runQuery({
2231
2240
  sql: "delete from migrations where id = $1",
2241
+ parts: [],
2232
2242
  bindings: [migration.id]
2233
2243
  });
2234
2244
  }
@@ -2489,33 +2499,153 @@ var init_GenerateControllerCommand = __esm({
2489
2499
  }
2490
2500
  });
2491
2501
 
2502
+ // src/app/console/generate/GenerateApiDocsCommand.mts
2503
+ var import_clipanion9, import_path7, fs6, GenerateApiDocsCommand;
2504
+ var init_GenerateApiDocsCommand = __esm({
2505
+ "src/app/console/generate/GenerateApiDocsCommand.mts"() {
2506
+ "use strict";
2507
+ init_facades();
2508
+ import_clipanion9 = require("clipanion");
2509
+ import_path7 = __toESM(require("path"), 1);
2510
+ fs6 = __toESM(require("fs/promises"), 1);
2511
+ GenerateApiDocsCommand = class extends import_clipanion9.Command {
2512
+ static {
2513
+ __name(this, "GenerateApiDocsCommand");
2514
+ }
2515
+ static paths = [
2516
+ [`make`, `apidocs`],
2517
+ [`generate`, `apidocs`]
2518
+ ];
2519
+ async execute() {
2520
+ const rootDir = process.cwd();
2521
+ this.context.stdout.write(`Generating OpenAPI documentation...
2522
+ `);
2523
+ const routes = router().routes;
2524
+ const openApiSpec = {
2525
+ openapi: "3.0.0",
2526
+ info: {
2527
+ title: "API Documentation",
2528
+ version: "1.0.0",
2529
+ description: "Auto-generated API documentation"
2530
+ },
2531
+ servers: [
2532
+ {
2533
+ url: "/",
2534
+ description: "Local server"
2535
+ }
2536
+ ],
2537
+ paths: {}
2538
+ };
2539
+ for (const route of routes) {
2540
+ const routePath = route.path;
2541
+ const openApiPath = routePath.replace(/:([a-zA-Z0-9_]+)/g, "{$1}");
2542
+ if (!openApiSpec.paths[openApiPath]) {
2543
+ openApiSpec.paths[openApiPath] = {};
2544
+ }
2545
+ for (const method of route.methods) {
2546
+ const lowerMethod = method.toLowerCase();
2547
+ if (lowerMethod === "head") {
2548
+ continue;
2549
+ }
2550
+ openApiSpec.paths[openApiPath][lowerMethod] = {
2551
+ summary: `${method} ${routePath}`,
2552
+ description: `Endpoint for ${method} ${routePath}`,
2553
+ parameters: this.extractParameters(routePath),
2554
+ responses: {
2555
+ "200": {
2556
+ description: "Successful response",
2557
+ content: {
2558
+ "application/json": {
2559
+ schema: {
2560
+ type: "object"
2561
+ }
2562
+ }
2563
+ }
2564
+ },
2565
+ "500": {
2566
+ description: "Internal server error"
2567
+ }
2568
+ }
2569
+ };
2570
+ if (["post", "put", "patch"].includes(lowerMethod)) {
2571
+ openApiSpec.paths[openApiPath][lowerMethod].requestBody = {
2572
+ required: true,
2573
+ content: {
2574
+ "application/json": {
2575
+ schema: {
2576
+ type: "object"
2577
+ }
2578
+ }
2579
+ }
2580
+ };
2581
+ }
2582
+ }
2583
+ }
2584
+ const publicDir = import_path7.default.join(rootDir, "public");
2585
+ await fs6.mkdir(publicDir, { recursive: true });
2586
+ const outputPath = import_path7.default.join(publicDir, "openapi.json");
2587
+ await fs6.writeFile(
2588
+ outputPath,
2589
+ JSON.stringify(openApiSpec, null, 2),
2590
+ "utf-8"
2591
+ );
2592
+ this.context.stdout.write(
2593
+ `OpenAPI documentation generated at: ${outputPath}
2594
+ `
2595
+ );
2596
+ this.context.stdout.write(`Total routes documented: ${routes.length}
2597
+ `);
2598
+ }
2599
+ extractParameters(routePath) {
2600
+ const paramRegex = /:([a-zA-Z0-9_]+)/g;
2601
+ const parameters = [];
2602
+ let match;
2603
+ while ((match = paramRegex.exec(routePath)) !== null) {
2604
+ parameters.push({
2605
+ name: match[1],
2606
+ in: "path",
2607
+ required: true,
2608
+ schema: {
2609
+ type: "string"
2610
+ },
2611
+ description: `Path parameter ${match[1]}`
2612
+ });
2613
+ }
2614
+ return parameters;
2615
+ }
2616
+ };
2617
+ cli().register(GenerateApiDocsCommand);
2618
+ }
2619
+ });
2620
+
2492
2621
  // src/app/console/generate/index.mts
2493
2622
  var init_generate = __esm({
2494
2623
  "src/app/console/generate/index.mts"() {
2495
2624
  "use strict";
2496
2625
  init_GenerateControllerCommand();
2626
+ init_GenerateApiDocsCommand();
2497
2627
  }
2498
2628
  });
2499
2629
 
2500
2630
  // src/app/console/project/CreateProjectCommand.mts
2501
- var import_clipanion9, import_change_case_all3, import_path7, fs6, import_url3, import_handlebars3, import_child_process, import_meta3, CreateProjectCommand;
2631
+ var import_clipanion10, import_change_case_all3, import_path8, fs7, import_url3, import_handlebars3, import_child_process, import_meta3, CreateProjectCommand;
2502
2632
  var init_CreateProjectCommand = __esm({
2503
2633
  "src/app/console/project/CreateProjectCommand.mts"() {
2504
2634
  "use strict";
2505
- import_clipanion9 = require("clipanion");
2635
+ import_clipanion10 = require("clipanion");
2506
2636
  import_change_case_all3 = require("change-case-all");
2507
- import_path7 = __toESM(require("path"), 1);
2508
- fs6 = __toESM(require("fs/promises"), 1);
2637
+ import_path8 = __toESM(require("path"), 1);
2638
+ fs7 = __toESM(require("fs/promises"), 1);
2509
2639
  import_url3 = require("url");
2510
2640
  import_handlebars3 = __toESM(require("handlebars"), 1);
2511
2641
  import_child_process = require("child_process");
2512
2642
  import_meta3 = {};
2513
- CreateProjectCommand = class extends import_clipanion9.Command {
2643
+ CreateProjectCommand = class extends import_clipanion10.Command {
2514
2644
  static {
2515
2645
  __name(this, "CreateProjectCommand");
2516
2646
  }
2517
2647
  static paths = [[`create`, `project`]];
2518
- static usage = import_clipanion9.Command.Usage({
2648
+ static usage = import_clipanion10.Command.Usage({
2519
2649
  category: `Project`,
2520
2650
  description: `Create a new project`,
2521
2651
  details: `
@@ -2533,13 +2663,13 @@ var init_CreateProjectCommand = __esm({
2533
2663
  ]
2534
2664
  ]
2535
2665
  });
2536
- projectPath = import_clipanion9.Option.String("--path", { required: true });
2537
- git = import_clipanion9.Option.Boolean(`--git`, false, {
2666
+ projectPath = import_clipanion10.Option.String("--path", { required: true });
2667
+ git = import_clipanion10.Option.Boolean(`--git`, false, {
2538
2668
  description: `Initialize a git repository in the new project`
2539
2669
  });
2540
2670
  async folderExists(folderPath) {
2541
2671
  try {
2542
- const stats = await fs6.stat(folderPath);
2672
+ const stats = await fs7.stat(folderPath);
2543
2673
  return stats.isDirectory();
2544
2674
  } catch (error) {
2545
2675
  if (error.code === "ENOENT") {
@@ -2549,28 +2679,28 @@ var init_CreateProjectCommand = __esm({
2549
2679
  }
2550
2680
  }
2551
2681
  async execute() {
2552
- const projectPath = import_path7.default.join(this.projectPath);
2682
+ const projectPath = import_path8.default.join(this.projectPath);
2553
2683
  try {
2554
- await fs6.access(projectPath);
2684
+ await fs7.access(projectPath);
2555
2685
  console.error(`Error: Directory ${projectPath} already exists.`);
2556
2686
  return 1;
2557
2687
  } catch {
2558
2688
  }
2559
- await fs6.mkdir(projectPath, { recursive: true });
2689
+ await fs7.mkdir(projectPath, { recursive: true });
2560
2690
  console.log(`Created project directory at: ${projectPath}`);
2561
- const dirname = typeof __dirname === "undefined" ? import_path7.default.dirname((0, import_url3.fileURLToPath)(import_meta3.url)) : __dirname;
2562
- let basePath = import_path7.default.join(dirname, `./base_project`);
2691
+ const dirname = typeof __dirname === "undefined" ? import_path8.default.dirname((0, import_url3.fileURLToPath)(import_meta3.url)) : __dirname;
2692
+ let basePath = import_path8.default.join(dirname, `./base_project`);
2563
2693
  if (await this.folderExists(basePath) === false) {
2564
- basePath = import_path7.default.join(dirname, `../app/console/project/base_project`);
2694
+ basePath = import_path8.default.join(dirname, `../app/console/project/base_project`);
2565
2695
  }
2566
2696
  console.log(`Using base project path: ${basePath}`);
2567
2697
  const baseProjectPath = basePath;
2568
2698
  await this.processTplFolder(baseProjectPath, projectPath, {});
2569
2699
  console.log(`Copied base project files to: ${projectPath}`);
2570
- const packageJsonPath = import_path7.default.join(projectPath, `package.json`);
2571
- const packageJson = JSON.parse(await fs6.readFile(packageJsonPath, `utf-8`));
2572
- packageJson.name = import_change_case_all3.Case.snake(import_path7.default.basename(projectPath));
2573
- await fs6.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
2700
+ const packageJsonPath = import_path8.default.join(projectPath, `package.json`);
2701
+ const packageJson = JSON.parse(await fs7.readFile(packageJsonPath, `utf-8`));
2702
+ packageJson.name = import_change_case_all3.Case.snake(import_path8.default.basename(projectPath));
2703
+ await fs7.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
2574
2704
  console.log(`Updated package.json with project name: ${packageJson.name}`);
2575
2705
  if (this.git) {
2576
2706
  try {
@@ -2587,12 +2717,12 @@ var init_CreateProjectCommand = __esm({
2587
2717
  }
2588
2718
  }
2589
2719
  async processTplFolder(src, dest, data = {}) {
2590
- const files = await fs6.readdir(src, { withFileTypes: true });
2720
+ const files = await fs7.readdir(src, { withFileTypes: true });
2591
2721
  for (const file of files) {
2592
- const srcPath = import_path7.default.join(src, file.name);
2593
- const destPath = file.isFile() && file.name.endsWith(".tpl") ? import_path7.default.join(dest, file.name.substring(0, file.name.length - 4)) : import_path7.default.join(dest, file.name);
2722
+ const srcPath = import_path8.default.join(src, file.name);
2723
+ const destPath = file.isFile() && file.name.endsWith(".tpl") ? import_path8.default.join(dest, file.name.substring(0, file.name.length - 4)) : import_path8.default.join(dest, file.name);
2594
2724
  if (file.isDirectory()) {
2595
- await fs6.mkdir(destPath, { recursive: true });
2725
+ await fs7.mkdir(destPath, { recursive: true });
2596
2726
  await this.processTplFolder(srcPath, destPath, data);
2597
2727
  } else if (file.name.endsWith(".tpl")) {
2598
2728
  await this.processTplFile(srcPath, destPath, {});
@@ -2605,30 +2735,30 @@ var init_CreateProjectCommand = __esm({
2605
2735
  }
2606
2736
  async processTplFile(src, dest, data = {}) {
2607
2737
  const compiledTemplate = import_handlebars3.default.compile(
2608
- (await fs6.readFile(src)).toString()
2738
+ (await fs7.readFile(src)).toString()
2609
2739
  );
2610
2740
  const template = await compiledTemplate(data);
2611
- await fs6.writeFile(dest, template);
2741
+ await fs7.writeFile(dest, template);
2612
2742
  }
2613
2743
  };
2614
2744
  }
2615
2745
  });
2616
2746
 
2617
2747
  // src/app/console/queue/GenerateQueueMigrateCommand.mts
2618
- var import_clipanion10, import_change_case_all4, import_path8, fs7, import_neko_config7, import_handlebars4, import_url4, import_meta4, GenerateQueueMigrateCommand;
2748
+ var import_clipanion11, import_change_case_all4, import_path9, fs8, import_neko_config7, import_handlebars4, import_url4, import_meta4, GenerateQueueMigrateCommand;
2619
2749
  var init_GenerateQueueMigrateCommand = __esm({
2620
2750
  "src/app/console/queue/GenerateQueueMigrateCommand.mts"() {
2621
2751
  "use strict";
2622
2752
  init_facades();
2623
- import_clipanion10 = require("clipanion");
2753
+ import_clipanion11 = require("clipanion");
2624
2754
  import_change_case_all4 = require("change-case-all");
2625
- import_path8 = __toESM(require("path"), 1);
2626
- fs7 = __toESM(require("fs/promises"), 1);
2755
+ import_path9 = __toESM(require("path"), 1);
2756
+ fs8 = __toESM(require("fs/promises"), 1);
2627
2757
  import_neko_config7 = require("@devbro/neko-config");
2628
2758
  import_handlebars4 = __toESM(require("handlebars"), 1);
2629
2759
  import_url4 = require("url");
2630
2760
  import_meta4 = {};
2631
- GenerateQueueMigrateCommand = class extends import_clipanion10.Command {
2761
+ GenerateQueueMigrateCommand = class extends import_clipanion11.Command {
2632
2762
  static {
2633
2763
  __name(this, "GenerateQueueMigrateCommand");
2634
2764
  }
@@ -2646,20 +2776,20 @@ var init_GenerateQueueMigrateCommand = __esm({
2646
2776
  const filename = `${year}_${month}_${day}_${secondsOfDay}_${fixed_name}.ts`;
2647
2777
  this.context.stdout.write(`creating migration file ${filename}
2648
2778
  `);
2649
- await fs7.mkdir(import_neko_config7.config.get("migration.path"), { recursive: true });
2779
+ await fs8.mkdir(import_neko_config7.config.get("migration.path"), { recursive: true });
2650
2780
  let dirname = typeof __dirname === "string" ? __dirname : void 0;
2651
2781
  if (!dirname) {
2652
- dirname = import_path8.default.dirname((0, import_url4.fileURLToPath)(import_meta4.url));
2782
+ dirname = import_path9.default.dirname((0, import_url4.fileURLToPath)(import_meta4.url));
2653
2783
  }
2654
2784
  const compiledTemplate = import_handlebars4.default.compile(
2655
- (await fs7.readFile(import_path8.default.join(dirname, "./queue_migration.tpl"))).toString()
2785
+ (await fs8.readFile(import_path9.default.join(dirname, "./queue_migration.tpl"))).toString()
2656
2786
  );
2657
2787
  const template = await compiledTemplate({
2658
2788
  className: import_change_case_all4.Case.pascal(this.name) + "Migration",
2659
2789
  tableName: import_change_case_all4.Case.snake(this.name)
2660
2790
  });
2661
- await fs7.writeFile(
2662
- import_path8.default.join(import_neko_config7.config.get("migration.path"), filename),
2791
+ await fs8.writeFile(
2792
+ import_path9.default.join(import_neko_config7.config.get("migration.path"), filename),
2663
2793
  template
2664
2794
  );
2665
2795
  }
@@ -2673,6 +2803,7 @@ var console_exports = {};
2673
2803
  __export(console_exports, {
2674
2804
  CreateProjectCommand: () => CreateProjectCommand,
2675
2805
  DefaultCommand: () => DefaultCommand,
2806
+ GenerateApiDocsCommand: () => GenerateApiDocsCommand,
2676
2807
  GenerateControllerCommand: () => GenerateControllerCommand,
2677
2808
  GenerateMigrateCommand: () => GenerateMigrateCommand,
2678
2809
  GenerateQueueMigrateCommand: () => GenerateQueueMigrateCommand,
@@ -115,6 +115,9 @@ var CompiledRoute = class {
115
115
  }
116
116
  prepareOutputJsonFormat(obj) {
117
117
  function traverse(value) {
118
+ if (value === void 0 || value === null) {
119
+ return null;
120
+ }
118
121
  if (!value || typeof value !== "object") {
119
122
  return value;
120
123
  }
@@ -115,6 +115,9 @@ var CompiledRoute = class {
115
115
  }
116
116
  prepareOutputJsonFormat(obj) {
117
117
  function traverse(value) {
118
+ if (value === void 0 || value === null) {
119
+ return null;
120
+ }
118
121
  if (!value || typeof value !== "object") {
119
122
  return value;
120
123
  }
@@ -128,6 +128,9 @@ var CompiledRoute = class {
128
128
  }
129
129
  prepareOutputJsonFormat(obj) {
130
130
  function traverse(value) {
131
+ if (value === void 0 || value === null) {
132
+ return null;
133
+ }
131
134
  if (!value || typeof value !== "object") {
132
135
  return value;
133
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devbro/pashmak",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "testing application for the entire repo",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",