@dbcube/core 4.1.7 → 4.1.9
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 +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1222,9 +1222,12 @@ var QueryEngine = class {
|
|
|
1222
1222
|
const timeout = setTimeout(() => {
|
|
1223
1223
|
if (!isResolved) {
|
|
1224
1224
|
isResolved = true;
|
|
1225
|
+
connection.off("data", onData);
|
|
1226
|
+
connection.off("error", onError);
|
|
1227
|
+
globalTcpConnections.delete(this.connectionId);
|
|
1225
1228
|
reject(new Error("TCP request timeout"));
|
|
1226
1229
|
}
|
|
1227
|
-
},
|
|
1230
|
+
}, this.timeout);
|
|
1228
1231
|
const onData = (data) => {
|
|
1229
1232
|
responseBuffer += data.toString();
|
|
1230
1233
|
const match = responseBuffer.match(/PROCESS_RESPONSE:(\{.*\})/);
|
|
@@ -1279,9 +1282,11 @@ var QueryEngine = class {
|
|
|
1279
1282
|
const timeout = setTimeout(() => {
|
|
1280
1283
|
if (!isResolved) {
|
|
1281
1284
|
isResolved = true;
|
|
1285
|
+
client.removeListener("data", dataHandler);
|
|
1286
|
+
globalTcpConnections.delete(this.connectionId);
|
|
1282
1287
|
reject(new Error("TCP connection timeout"));
|
|
1283
1288
|
}
|
|
1284
|
-
},
|
|
1289
|
+
}, this.timeout);
|
|
1285
1290
|
const executeQuery = () => {
|
|
1286
1291
|
const dmlIndex = args.findIndex((arg) => arg === "--dml");
|
|
1287
1292
|
const dmlJson = dmlIndex !== -1 ? args[dmlIndex + 1] : null;
|
|
@@ -1488,6 +1493,20 @@ var SqliteExecutor = class {
|
|
|
1488
1493
|
this.dbPath = dbPath;
|
|
1489
1494
|
this.binaryPath = this.getBinaryPath();
|
|
1490
1495
|
}
|
|
1496
|
+
findVersionedBinary(binDir, platform2) {
|
|
1497
|
+
try {
|
|
1498
|
+
const files = fs3.readdirSync(binDir);
|
|
1499
|
+
const extension = platform2 === "win32" ? ".exe" : "";
|
|
1500
|
+
const platformName = platform2 === "win32" ? "windows" : platform2 === "darwin" ? "macos" : "linux";
|
|
1501
|
+
const pattern = new RegExp(`^sqlite-engine-v\\d+\\.\\d+\\.\\d+-${platformName}-x64${extension.replace(".", "\\.")}$`);
|
|
1502
|
+
const matchingFile = files.find((f) => pattern.test(f));
|
|
1503
|
+
if (matchingFile) {
|
|
1504
|
+
return path5.join(binDir, matchingFile);
|
|
1505
|
+
}
|
|
1506
|
+
} catch (error) {
|
|
1507
|
+
}
|
|
1508
|
+
return null;
|
|
1509
|
+
}
|
|
1491
1510
|
getBinaryPath() {
|
|
1492
1511
|
const __filename2 = typeof import_meta3 !== "undefined" && import_meta3.url ? (0, import_url3.fileURLToPath)(import_meta3.url) : "";
|
|
1493
1512
|
const __dirname = __filename2 ? (0, import_path5.dirname)(__filename2) : process.cwd();
|
|
@@ -1498,7 +1517,14 @@ var SqliteExecutor = class {
|
|
|
1498
1517
|
];
|
|
1499
1518
|
const platform2 = process.platform;
|
|
1500
1519
|
const extension = platform2 === "win32" ? ".exe" : "";
|
|
1501
|
-
const
|
|
1520
|
+
const platformName = platform2 === "win32" ? "windows" : platform2 === "darwin" ? "macos" : "linux";
|
|
1521
|
+
for (const dir of possibleDirs) {
|
|
1522
|
+
const versionedPath = this.findVersionedBinary(dir, platform2);
|
|
1523
|
+
if (versionedPath && fs3.existsSync(versionedPath)) {
|
|
1524
|
+
return versionedPath;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
const binaryName = `sqlite-engine-${platformName}-x64${extension}`;
|
|
1502
1528
|
for (const dir of possibleDirs) {
|
|
1503
1529
|
const fullPath = path5.join(dir, binaryName);
|
|
1504
1530
|
if (fs3.existsSync(fullPath)) {
|