@dbcube/schema-builder 5.2.6 → 5.2.8
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 +6 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -931,7 +931,9 @@ var Schema = class {
|
|
|
931
931
|
}
|
|
932
932
|
const cubeDbName = dbResult.message;
|
|
933
933
|
const configInstance = new import_core.Config();
|
|
934
|
-
|
|
934
|
+
import_core.EnvLoader.load();
|
|
935
|
+
const cjsPath = import_path3.default.resolve(process.cwd(), "dbcube.config.cjs");
|
|
936
|
+
const configFilePath = import_fs4.default.existsSync(cjsPath) ? cjsPath : import_path3.default.resolve(process.cwd(), "dbcube.config.js");
|
|
935
937
|
const requireUrl = typeof __filename !== "undefined" ? __filename : process.cwd();
|
|
936
938
|
const require2 = (0, import_module.createRequire)(requireUrl);
|
|
937
939
|
delete require2.cache[require2.resolve(configFilePath)];
|
|
@@ -940,25 +942,16 @@ var Schema = class {
|
|
|
940
942
|
if (typeof configFn === "function") {
|
|
941
943
|
configFn(configInstance);
|
|
942
944
|
} else {
|
|
943
|
-
throw new Error("\u274C The dbcube
|
|
945
|
+
throw new Error("\u274C The dbcube config file does not export a function.");
|
|
944
946
|
}
|
|
945
947
|
const dbConfig = configInstance.getDatabase(cubeDbName);
|
|
946
948
|
if (!dbConfig) {
|
|
947
949
|
let availableDbs = [];
|
|
948
950
|
try {
|
|
949
|
-
|
|
950
|
-
for (const testName of testNames) {
|
|
951
|
-
try {
|
|
952
|
-
const testConfig = configInstance.getDatabase(testName);
|
|
953
|
-
if (testConfig) {
|
|
954
|
-
availableDbs.push(testName);
|
|
955
|
-
}
|
|
956
|
-
} catch (e) {
|
|
957
|
-
}
|
|
958
|
-
}
|
|
951
|
+
availableDbs = Object.keys(configInstance.getAllDatabases() || {});
|
|
959
952
|
} catch (e) {
|
|
960
953
|
}
|
|
961
|
-
const availableText = availableDbs.length > 0 ? availableDbs.join(", ") : "none
|
|
954
|
+
const availableText = availableDbs.length > 0 ? availableDbs.join(", ") : "none configured";
|
|
962
955
|
return {
|
|
963
956
|
isValid: false,
|
|
964
957
|
error: {
|