@dbcube/core 1.0.40 → 1.0.43
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 +22 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -592,6 +592,7 @@ var Config = class {
|
|
|
592
592
|
|
|
593
593
|
// src/lib/Engine.ts
|
|
594
594
|
var import_child_process = require("child_process");
|
|
595
|
+
var import_module = require("module");
|
|
595
596
|
var Engine = class {
|
|
596
597
|
name;
|
|
597
598
|
config;
|
|
@@ -646,12 +647,23 @@ var Engine = class {
|
|
|
646
647
|
}
|
|
647
648
|
setConfig(name) {
|
|
648
649
|
const configInstance = new Config();
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
650
|
+
try {
|
|
651
|
+
const configFilePath = import_path.default.resolve(process.cwd(), "dbcube.config.js");
|
|
652
|
+
const requireUrl = typeof __filename !== "undefined" ? __filename : process.cwd();
|
|
653
|
+
const require2 = (0, import_module.createRequire)(requireUrl);
|
|
654
|
+
delete require2.cache[require2.resolve(configFilePath)];
|
|
655
|
+
const configModule = require2(configFilePath);
|
|
656
|
+
const configFn = configModule.default || configModule;
|
|
657
|
+
if (typeof configFn === "function") {
|
|
658
|
+
configFn(configInstance);
|
|
659
|
+
} else {
|
|
660
|
+
console.error("\u274C El archivo dbcube.config.js no exporta una funci\xF3n.");
|
|
661
|
+
}
|
|
662
|
+
} catch (error) {
|
|
663
|
+
console.error("\u274C Error loading config file:", error.message);
|
|
664
|
+
if (error.code === "MODULE_NOT_FOUND") {
|
|
665
|
+
console.error("\u274C Config file not found, please create a dbcube.config.js file");
|
|
666
|
+
}
|
|
655
667
|
}
|
|
656
668
|
return configInstance.getDatabase(name);
|
|
657
669
|
}
|
|
@@ -752,6 +764,7 @@ var import_child_process2 = require("child_process");
|
|
|
752
764
|
var path4 = __toESM(require("path"));
|
|
753
765
|
var fs3 = __toESM(require("fs"));
|
|
754
766
|
var import_util = require("util");
|
|
767
|
+
var import_module2 = require("module");
|
|
755
768
|
var execAsync = (0, import_util.promisify)(import_child_process2.exec);
|
|
756
769
|
var SqliteExecutor = class {
|
|
757
770
|
binaryPath;
|
|
@@ -883,7 +896,9 @@ var SqliteExecutor = class {
|
|
|
883
896
|
}
|
|
884
897
|
// Para compatibilidad con better-sqlite3 API sincrona usando deasync si es necesario
|
|
885
898
|
prepareSync(sql) {
|
|
886
|
-
const
|
|
899
|
+
const requireUrl = typeof __filename !== "undefined" ? __filename : process.cwd();
|
|
900
|
+
const require2 = (0, import_module2.createRequire)(requireUrl);
|
|
901
|
+
const deasync = require2("deasync");
|
|
887
902
|
return {
|
|
888
903
|
all: (...params) => {
|
|
889
904
|
let result;
|