@dbcube/schema-builder 1.0.17 → 1.0.18

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/index.cjs CHANGED
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  CubeValidator: () => CubeValidator,
34
+ DependencyResolver: () => DependencyResolver,
34
35
  Schema: () => Schema,
35
36
  UIUtils: () => UIUtils,
36
37
  default: () => index_default
@@ -38,9 +39,9 @@ __export(index_exports, {
38
39
  module.exports = __toCommonJS(index_exports);
39
40
 
40
41
  // src/lib/Schema.ts
41
- var import_fs3 = __toESM(require("fs"));
42
+ var import_fs4 = __toESM(require("fs"));
42
43
  var import_core = require("@dbcube/core");
43
- var import_path2 = __toESM(require("path"));
44
+ var import_path3 = __toESM(require("path"));
44
45
 
45
46
  // src/lib/FileUtils.ts
46
47
  var fs = __toESM(require("fs"));
@@ -405,7 +406,7 @@ var CubeValidator = class {
405
406
  filePath,
406
407
  lineNumber
407
408
  });
408
- } else if (!this.isOptionCompatibleWithType(option, columnType)) {
409
+ } else if (columnType !== "unknown" && !this.isOptionCompatibleWithType(option, columnType)) {
409
410
  errors.push({
410
411
  itemName: fileName,
411
412
  error: `Option '${option}' is not compatible with type '${columnType}'`,
@@ -424,6 +425,18 @@ var CubeValidator = class {
424
425
  if (/^\s*[a-zA-Z_][a-zA-Z0-9_]*\s*:\s*\{/.test(line)) {
425
426
  return;
426
427
  }
428
+ if (this.isInsideForeignKeyObject(content, lineNumber - 1)) {
429
+ const validForeignKeyProperties = ["table", "column"];
430
+ if (!validForeignKeyProperties.includes(propertyName)) {
431
+ errors.push({
432
+ itemName: fileName,
433
+ error: `Invalid foreign key property '${propertyName}'. Valid foreign key properties: ${validForeignKeyProperties.join(", ")}`,
434
+ filePath,
435
+ lineNumber
436
+ });
437
+ }
438
+ return;
439
+ }
427
440
  if (this.isInsideColumnsBlock(content, lineNumber - 1)) {
428
441
  if (!this.validProperties.includes(propertyName)) {
429
442
  errors.push({
@@ -592,6 +605,231 @@ var CubeValidator = class {
592
605
  }
593
606
  return columnsStartLine !== -1 && columnsEndLine !== -1 && lineIndex > columnsStartLine && lineIndex < columnsEndLine;
594
607
  }
608
+ isInsideForeignKeyObject(content, lineIndex) {
609
+ const lines = content.split("\n");
610
+ for (let i = lineIndex; i >= 0; i--) {
611
+ const line = lines[i];
612
+ if (/foreign\s*:\s*\{/.test(line)) {
613
+ let braceCount = 0;
614
+ for (let j = i; j <= lineIndex; j++) {
615
+ const currentLine = lines[j];
616
+ const openBraces = (currentLine.match(/\{/g) || []).length;
617
+ const closeBraces = (currentLine.match(/\}/g) || []).length;
618
+ braceCount += openBraces - closeBraces;
619
+ if (braceCount === 0 && j > i) {
620
+ return false;
621
+ }
622
+ }
623
+ return braceCount > 0;
624
+ }
625
+ if (line.trim() === "}" || line.includes("};")) {
626
+ break;
627
+ }
628
+ }
629
+ return false;
630
+ }
631
+ };
632
+
633
+ // src/lib/DependencyResolver.ts
634
+ var import_fs3 = __toESM(require("fs"));
635
+ var import_path2 = __toESM(require("path"));
636
+ var DependencyResolver = class {
637
+ /**
638
+ * Resolves table dependencies and creates execution order
639
+ */
640
+ static resolveDependencies(cubeFiles, cubeType = "table") {
641
+ const tableDependencies = this.extractDependencies(cubeFiles, cubeType);
642
+ const orderedTables = this.topologicalSort(tableDependencies);
643
+ const executionOrder = {
644
+ tables: cubeType === "table" ? orderedTables : [],
645
+ seeders: cubeType === "seeder" ? orderedTables : [],
646
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
647
+ };
648
+ this.saveExecutionOrder(executionOrder);
649
+ return executionOrder;
650
+ }
651
+ /**
652
+ * Extracts dependencies from cube files
653
+ */
654
+ static extractDependencies(cubeFiles, cubeType) {
655
+ const dependencies = [];
656
+ for (const file of cubeFiles) {
657
+ let filePath;
658
+ if (import_path2.default.isAbsolute(file)) {
659
+ filePath = file;
660
+ } else if (import_fs3.default.existsSync(file)) {
661
+ filePath = import_path2.default.resolve(file);
662
+ } else {
663
+ filePath = import_path2.default.join(process.cwd(), "dbcube", "cubes", file);
664
+ }
665
+ try {
666
+ const tableNameResult = FileUtils_default.extracTableNameFromCube(filePath);
667
+ const tableName = tableNameResult.status === 200 ? tableNameResult.message : import_path2.default.basename(file, `.${cubeType}.cube`);
668
+ const deps = this.extractForeignKeyReferences(filePath);
669
+ dependencies.push({
670
+ tableName,
671
+ filePath,
672
+ dependencies: deps
673
+ });
674
+ } catch (error) {
675
+ console.error(`Error processing ${filePath}:`, error);
676
+ }
677
+ }
678
+ return dependencies;
679
+ }
680
+ /**
681
+ * Extracts foreign key references from a cube file
682
+ */
683
+ static extractForeignKeyReferences(filePath) {
684
+ const dependencies = [];
685
+ try {
686
+ const content = import_fs3.default.readFileSync(filePath, "utf8");
687
+ const lines = content.split("\n");
688
+ let insideForeignKey = false;
689
+ let braceCount = 0;
690
+ for (const line of lines) {
691
+ if (/foreign\s*:\s*\{/.test(line)) {
692
+ insideForeignKey = true;
693
+ braceCount = 1;
694
+ const sameLineMatch = line.match(/table\s*:\s*["']([^"']+)["']/);
695
+ if (sameLineMatch) {
696
+ dependencies.push(sameLineMatch[1]);
697
+ insideForeignKey = false;
698
+ braceCount = 0;
699
+ }
700
+ continue;
701
+ }
702
+ if (insideForeignKey) {
703
+ braceCount += (line.match(/\{/g) || []).length;
704
+ braceCount -= (line.match(/\}/g) || []).length;
705
+ const tableMatch = line.match(/table\s*:\s*["']([^"']+)["']/);
706
+ if (tableMatch) {
707
+ dependencies.push(tableMatch[1]);
708
+ }
709
+ if (braceCount === 0) {
710
+ insideForeignKey = false;
711
+ }
712
+ }
713
+ }
714
+ } catch (error) {
715
+ console.error(`Error reading file ${filePath}:`, error);
716
+ }
717
+ return dependencies;
718
+ }
719
+ /**
720
+ * Performs topological sort to determine execution order
721
+ */
722
+ static topologicalSort(dependencies) {
723
+ const graph = /* @__PURE__ */ new Map();
724
+ const inDegree = /* @__PURE__ */ new Map();
725
+ const tableMap = /* @__PURE__ */ new Map();
726
+ for (const dep of dependencies) {
727
+ graph.set(dep.tableName, dep.dependencies);
728
+ inDegree.set(dep.tableName, 0);
729
+ tableMap.set(dep.tableName, dep);
730
+ }
731
+ for (const dep of dependencies) {
732
+ for (const dependency of dep.dependencies) {
733
+ if (inDegree.has(dependency)) {
734
+ inDegree.set(dep.tableName, (inDegree.get(dep.tableName) || 0) + 1);
735
+ }
736
+ }
737
+ }
738
+ const queue = [];
739
+ const result = [];
740
+ for (const [table, degree] of inDegree) {
741
+ if (degree === 0) {
742
+ queue.push(table);
743
+ }
744
+ }
745
+ while (queue.length > 0) {
746
+ const current = queue.shift();
747
+ result.push(current);
748
+ const currentDeps = graph.get(current) || [];
749
+ for (const neighbor of currentDeps) {
750
+ if (inDegree.has(neighbor)) {
751
+ const newDegree = (inDegree.get(neighbor) || 0) - 1;
752
+ inDegree.set(neighbor, newDegree);
753
+ if (newDegree === 0) {
754
+ queue.push(neighbor);
755
+ }
756
+ }
757
+ }
758
+ }
759
+ if (result.length !== dependencies.length) {
760
+ console.warn("\u26A0\uFE0F Circular dependencies detected in tables. Some tables may not execute in optimal order.");
761
+ for (const dep of dependencies) {
762
+ if (!result.includes(dep.tableName)) {
763
+ result.push(dep.tableName);
764
+ }
765
+ }
766
+ }
767
+ return result;
768
+ }
769
+ /**
770
+ * Saves the execution order to .dbcube/orderexecute.json
771
+ */
772
+ static saveExecutionOrder(order) {
773
+ try {
774
+ const projectRoot = process.cwd();
775
+ const dbcubeDir = import_path2.default.join(projectRoot, ".dbcube");
776
+ const orderFile = import_path2.default.join(dbcubeDir, "orderexecute.json");
777
+ if (!import_fs3.default.existsSync(dbcubeDir)) {
778
+ import_fs3.default.mkdirSync(dbcubeDir, { recursive: true });
779
+ }
780
+ import_fs3.default.writeFileSync(orderFile, JSON.stringify(order, null, 2), "utf8");
781
+ console.log(`\u{1F4C4} Execution order saved to: ${import_path2.default.relative(projectRoot, orderFile)}`);
782
+ } catch (error) {
783
+ console.error("\u274C Failed to save execution order:", error);
784
+ }
785
+ }
786
+ /**
787
+ * Loads the execution order from .dbcube/orderexecute.json
788
+ */
789
+ static loadExecutionOrder() {
790
+ try {
791
+ const projectRoot = process.cwd();
792
+ const orderFile = import_path2.default.join(projectRoot, ".dbcube", "orderexecute.json");
793
+ if (!import_fs3.default.existsSync(orderFile)) {
794
+ return null;
795
+ }
796
+ const content = import_fs3.default.readFileSync(orderFile, "utf8");
797
+ return JSON.parse(content);
798
+ } catch (error) {
799
+ console.error("\u274C Failed to load execution order:", error);
800
+ return null;
801
+ }
802
+ }
803
+ /**
804
+ * Orders cube files based on saved execution order
805
+ */
806
+ static orderCubeFiles(cubeFiles, cubeType) {
807
+ const executionOrder = this.loadExecutionOrder();
808
+ if (!executionOrder) {
809
+ console.log("\u{1F4C4} No execution order found, processing files in current order");
810
+ return cubeFiles;
811
+ }
812
+ const orderList = cubeType === "table" ? executionOrder.tables : executionOrder.seeders;
813
+ const orderedFiles = [];
814
+ const fileMap = /* @__PURE__ */ new Map();
815
+ for (const file of cubeFiles) {
816
+ const filePath = import_path2.default.isAbsolute(file) ? file : import_path2.default.join(process.cwd(), "dbcube", "cubes", file);
817
+ const tableNameResult = FileUtils_default.extracTableNameFromCube(filePath);
818
+ const tableName = tableNameResult.status === 200 ? tableNameResult.message : import_path2.default.basename(file, `.${cubeType}.cube`);
819
+ fileMap.set(tableName, file);
820
+ }
821
+ for (const tableName of orderList) {
822
+ if (fileMap.has(tableName)) {
823
+ orderedFiles.push(fileMap.get(tableName));
824
+ fileMap.delete(tableName);
825
+ }
826
+ }
827
+ for (const [, file] of fileMap) {
828
+ orderedFiles.push(file);
829
+ }
830
+ console.log(`\u{1F4CB} Using dependency order: ${orderList.join(" \u2192 ")}`);
831
+ return orderedFiles;
832
+ }
595
833
  };
596
834
 
597
835
  // src/lib/Schema.ts
@@ -623,7 +861,7 @@ var Schema = class {
623
861
  return {
624
862
  isValid: false,
625
863
  error: {
626
- itemName: import_path2.default.basename(filePath, import_path2.default.extname(filePath)),
864
+ itemName: import_path3.default.basename(filePath, import_path3.default.extname(filePath)),
627
865
  error: `Error reading database directive: ${dbResult.message}`,
628
866
  filePath,
629
867
  lineNumber: this.findDatabaseLineNumber(filePath)
@@ -632,7 +870,7 @@ var Schema = class {
632
870
  }
633
871
  const cubeDbName = dbResult.message;
634
872
  const configInstance = new import_core.Config();
635
- const configFilePath = import_path2.default.resolve(process.cwd(), "dbcube.config.js");
873
+ const configFilePath = import_path3.default.resolve(process.cwd(), "dbcube.config.js");
636
874
  const configFn = require(configFilePath);
637
875
  if (typeof configFn === "function") {
638
876
  configFn(configInstance);
@@ -659,7 +897,7 @@ var Schema = class {
659
897
  return {
660
898
  isValid: false,
661
899
  error: {
662
- itemName: import_path2.default.basename(filePath, import_path2.default.extname(filePath)),
900
+ itemName: import_path3.default.basename(filePath, import_path3.default.extname(filePath)),
663
901
  error: `Database configuration '${cubeDbName}' not found in dbcube.config.js. Available: ${availableText}`,
664
902
  filePath,
665
903
  lineNumber: this.findDatabaseLineNumber(filePath)
@@ -671,7 +909,7 @@ var Schema = class {
671
909
  return {
672
910
  isValid: false,
673
911
  error: {
674
- itemName: import_path2.default.basename(filePath, import_path2.default.extname(filePath)),
912
+ itemName: import_path3.default.basename(filePath, import_path3.default.extname(filePath)),
675
913
  error: `Database configuration validation failed: ${error.message}`,
676
914
  filePath,
677
915
  lineNumber: this.findDatabaseLineNumber(filePath)
@@ -684,7 +922,7 @@ var Schema = class {
684
922
  */
685
923
  findDatabaseLineNumber(filePath) {
686
924
  try {
687
- const content = import_fs3.default.readFileSync(filePath, "utf8");
925
+ const content = import_fs4.default.readFileSync(filePath, "utf8");
688
926
  const lines = content.split("\n");
689
927
  for (let i = 0; i < lines.length; i++) {
690
928
  if (lines[i].includes("@database")) {
@@ -698,7 +936,7 @@ var Schema = class {
698
936
  }
699
937
  async createDatabase() {
700
938
  const startTime = Date.now();
701
- const rootPath = import_path2.default.resolve(process.cwd());
939
+ const rootPath = import_path3.default.resolve(process.cwd());
702
940
  UIUtils.showOperationHeader(" CREATING DATABASE", this.name, "\u{1F5C4}\uFE0F");
703
941
  await UIUtils.showItemProgress("Preparando e instalando base de datos", 1, 1);
704
942
  try {
@@ -742,28 +980,31 @@ var Schema = class {
742
980
  }
743
981
  async refreshTables() {
744
982
  const startTime = Date.now();
745
- const cubesDir = import_path2.default.join(process.cwd(), "dbcube", "cubes");
746
- if (!import_fs3.default.existsSync(cubesDir)) {
983
+ const cubesDir = import_path3.default.join(process.cwd(), "dbcube", "cubes");
984
+ if (!import_fs4.default.existsSync(cubesDir)) {
747
985
  throw new Error("\u274C The cubes folder does not exist");
748
986
  }
749
987
  const cubeFiles = FileUtils_default.getCubeFilesRecursively("dbcube", "table.cube");
750
988
  if (cubeFiles.length === 0) {
751
989
  throw new Error("\u274C There are no cubes to execute");
752
990
  }
991
+ console.log("\u{1F504} Resolving table dependencies...");
992
+ DependencyResolver.resolveDependencies(cubeFiles, "table");
993
+ const orderedCubeFiles = DependencyResolver.orderCubeFiles(cubeFiles, "table");
753
994
  UIUtils.showOperationHeader("EXECUTING REFRESH TABLES", this.name, "\u{1F504}");
754
995
  let totalTablesProcessed = 0;
755
996
  let successCount = 0;
756
997
  let errorCount = 0;
757
998
  const processedTables = [];
758
999
  const errors = [];
759
- for (let index = 0; index < cubeFiles.length; index++) {
760
- const file = cubeFiles[index];
761
- const filePath = import_path2.default.isAbsolute(file) ? file : import_path2.default.join(cubesDir, file);
762
- const stats = import_fs3.default.statSync(filePath);
1000
+ for (let index = 0; index < orderedCubeFiles.length; index++) {
1001
+ const file = orderedCubeFiles[index];
1002
+ const filePath = import_path3.default.isAbsolute(file) ? file : import_path3.default.join(cubesDir, file);
1003
+ const stats = import_fs4.default.statSync(filePath);
763
1004
  if (stats.isFile()) {
764
1005
  const getTableName = FileUtils_default.extracTableNameFromCube(filePath);
765
- const tableName = getTableName.status === 200 ? getTableName.message : import_path2.default.basename(file, ".table.cube");
766
- await UIUtils.showItemProgress(tableName, index + 1, cubeFiles.length);
1006
+ const tableName = getTableName.status === 200 ? getTableName.message : import_path3.default.basename(file, ".table.cube");
1007
+ await UIUtils.showItemProgress(tableName, index + 1, orderedCubeFiles.length);
767
1008
  try {
768
1009
  const validation = this.validateDatabaseConfiguration(filePath);
769
1010
  if (!validation.isValid && validation.error) {
@@ -844,28 +1085,31 @@ var Schema = class {
844
1085
  }
845
1086
  async freshTables() {
846
1087
  const startTime = Date.now();
847
- const cubesDir = import_path2.default.join(process.cwd(), "dbcube", "cubes");
848
- if (!import_fs3.default.existsSync(cubesDir)) {
1088
+ const cubesDir = import_path3.default.join(process.cwd(), "dbcube", "cubes");
1089
+ if (!import_fs4.default.existsSync(cubesDir)) {
849
1090
  throw new Error("\u274C The cubes folder does not exist");
850
1091
  }
851
1092
  const cubeFiles = FileUtils_default.getCubeFilesRecursively("dbcube", "table.cube");
852
1093
  if (cubeFiles.length === 0) {
853
1094
  throw new Error("\u274C There are no cubes to execute");
854
1095
  }
1096
+ console.log("\u{1F504} Resolving table dependencies...");
1097
+ DependencyResolver.resolveDependencies(cubeFiles, "table");
1098
+ const orderedCubeFiles = DependencyResolver.orderCubeFiles(cubeFiles, "table");
855
1099
  UIUtils.showOperationHeader("EXECUTING FRESH TABLES", this.name);
856
1100
  let totalTablesProcessed = 0;
857
1101
  let successCount = 0;
858
1102
  let errorCount = 0;
859
1103
  const processedTables = [];
860
1104
  const errors = [];
861
- for (let index = 0; index < cubeFiles.length; index++) {
862
- const file = cubeFiles[index];
863
- const filePath = import_path2.default.isAbsolute(file) ? file : import_path2.default.join(cubesDir, file);
864
- const stats = import_fs3.default.statSync(filePath);
1105
+ for (let index = 0; index < orderedCubeFiles.length; index++) {
1106
+ const file = orderedCubeFiles[index];
1107
+ const filePath = import_path3.default.isAbsolute(file) ? file : import_path3.default.join(cubesDir, file);
1108
+ const stats = import_fs4.default.statSync(filePath);
865
1109
  if (stats.isFile()) {
866
1110
  const getTableName = FileUtils_default.extracTableNameFromCube(filePath);
867
- const tableName = getTableName.status === 200 ? getTableName.message : import_path2.default.basename(file, ".table.cube");
868
- await UIUtils.showItemProgress(tableName, index + 1, cubeFiles.length);
1111
+ const tableName = getTableName.status === 200 ? getTableName.message : import_path3.default.basename(file, ".table.cube");
1112
+ await UIUtils.showItemProgress(tableName, index + 1, orderedCubeFiles.length);
869
1113
  try {
870
1114
  const validation = this.validateDatabaseConfiguration(filePath);
871
1115
  if (!validation.isValid && validation.error) {
@@ -944,28 +1188,29 @@ var Schema = class {
944
1188
  }
945
1189
  async executeSeeders() {
946
1190
  const startTime = Date.now();
947
- const cubesDir = import_path2.default.join(process.cwd(), "dbcube", "cubes");
948
- if (!import_fs3.default.existsSync(cubesDir)) {
1191
+ const cubesDir = import_path3.default.join(process.cwd(), "dbcube", "cubes");
1192
+ if (!import_fs4.default.existsSync(cubesDir)) {
949
1193
  throw new Error("\u274C The cubes folder does not exist");
950
1194
  }
951
1195
  const cubeFiles = FileUtils_default.getCubeFilesRecursively("dbcube", "seeder.cube");
952
1196
  if (cubeFiles.length === 0) {
953
1197
  throw new Error("\u274C There are no cubes to execute");
954
1198
  }
1199
+ const orderedCubeFiles = DependencyResolver.orderCubeFiles(cubeFiles, "seeder");
955
1200
  UIUtils.showOperationHeader("EXECUTING SEEDERS", this.name, "\u{1F331}");
956
1201
  let totalSeedersProcessed = 0;
957
1202
  let successCount = 0;
958
1203
  let errorCount = 0;
959
1204
  const processedSeeders = [];
960
1205
  const errors = [];
961
- for (let index = 0; index < cubeFiles.length; index++) {
962
- const file = cubeFiles[index];
963
- const filePath = import_path2.default.isAbsolute(file) ? file : import_path2.default.join(cubesDir, file);
964
- const stats = import_fs3.default.statSync(filePath);
1206
+ for (let index = 0; index < orderedCubeFiles.length; index++) {
1207
+ const file = orderedCubeFiles[index];
1208
+ const filePath = import_path3.default.isAbsolute(file) ? file : import_path3.default.join(cubesDir, file);
1209
+ const stats = import_fs4.default.statSync(filePath);
965
1210
  if (stats.isFile()) {
966
1211
  const getSeederName = FileUtils_default.extracTableNameFromCube(filePath);
967
- const seederName = getSeederName.status === 200 ? getSeederName.message : import_path2.default.basename(file, ".seeder.cube");
968
- await UIUtils.showItemProgress(seederName, index + 1, cubeFiles.length);
1212
+ const seederName = getSeederName.status === 200 ? getSeederName.message : import_path3.default.basename(file, ".seeder.cube");
1213
+ await UIUtils.showItemProgress(seederName, index + 1, orderedCubeFiles.length);
969
1214
  try {
970
1215
  const validation = this.validateDatabaseConfiguration(filePath);
971
1216
  if (!validation.isValid && validation.error) {
@@ -1015,9 +1260,9 @@ var Schema = class {
1015
1260
  }
1016
1261
  async executeTriggers() {
1017
1262
  const startTime = Date.now();
1018
- const cubesDir = import_path2.default.join(process.cwd(), "dbcube", "cubes");
1019
- const triggersDirExit = import_path2.default.join(process.cwd(), "dbcube", "triggers");
1020
- if (!import_fs3.default.existsSync(cubesDir)) {
1263
+ const cubesDir = import_path3.default.join(process.cwd(), "dbcube", "cubes");
1264
+ const triggersDirExit = import_path3.default.join(process.cwd(), "dbcube", "triggers");
1265
+ if (!import_fs4.default.existsSync(cubesDir)) {
1021
1266
  throw new Error("\u274C The cubes folder does not exist");
1022
1267
  }
1023
1268
  const cubeFiles = FileUtils_default.getCubeFilesRecursively("dbcube", "trigger.cube");
@@ -1032,11 +1277,11 @@ var Schema = class {
1032
1277
  const errors = [];
1033
1278
  for (let index = 0; index < cubeFiles.length; index++) {
1034
1279
  const file = cubeFiles[index];
1035
- const filePath = import_path2.default.isAbsolute(file) ? file : import_path2.default.join(cubesDir, file);
1036
- const stats = import_fs3.default.statSync(filePath);
1280
+ const filePath = import_path3.default.isAbsolute(file) ? file : import_path3.default.join(cubesDir, file);
1281
+ const stats = import_fs4.default.statSync(filePath);
1037
1282
  if (stats.isFile()) {
1038
1283
  const getTriggerName = FileUtils_default.extracTableNameFromCube(filePath);
1039
- const triggerName = getTriggerName.status === 200 ? getTriggerName.message : import_path2.default.basename(file, ".trigger.cube");
1284
+ const triggerName = getTriggerName.status === 200 ? getTriggerName.message : import_path3.default.basename(file, ".trigger.cube");
1040
1285
  await UIUtils.showItemProgress(triggerName, index + 1, cubeFiles.length);
1041
1286
  try {
1042
1287
  const validation = this.validateDatabaseConfiguration(filePath);
@@ -1107,7 +1352,7 @@ ${import_chalk2.default.red("\u{1F6AB}")} ${import_chalk2.default.bold.red("ERRO
1107
1352
  const errorLocation = `${filePath}:${lineStr}:${columnStr}`;
1108
1353
  console.log(`${import_chalk2.default.cyan("[code]")} ${import_chalk2.default.yellow(errorLocation)}`);
1109
1354
  try {
1110
- const codeLines = import_fs3.default.readFileSync(filePath, "utf-8").split("\n");
1355
+ const codeLines = import_fs4.default.readFileSync(filePath, "utf-8").split("\n");
1111
1356
  const start = Math.max(0, lineNum - 3);
1112
1357
  const end = Math.min(codeLines.length, lineNum + 2);
1113
1358
  for (let i = start; i < end; i++) {
@@ -1130,6 +1375,7 @@ var index_default = Schema;
1130
1375
  // Annotate the CommonJS export names for ESM import in node:
1131
1376
  0 && (module.exports = {
1132
1377
  CubeValidator,
1378
+ DependencyResolver,
1133
1379
  Schema,
1134
1380
  UIUtils
1135
1381
  });