@dbcube/core 4.1.8 → 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.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1175,9 +1175,12 @@ var QueryEngine = class {
|
|
|
1175
1175
|
const timeout = setTimeout(() => {
|
|
1176
1176
|
if (!isResolved) {
|
|
1177
1177
|
isResolved = true;
|
|
1178
|
+
connection.off("data", onData);
|
|
1179
|
+
connection.off("error", onError);
|
|
1180
|
+
globalTcpConnections.delete(this.connectionId);
|
|
1178
1181
|
reject(new Error("TCP request timeout"));
|
|
1179
1182
|
}
|
|
1180
|
-
},
|
|
1183
|
+
}, this.timeout);
|
|
1181
1184
|
const onData = (data) => {
|
|
1182
1185
|
responseBuffer += data.toString();
|
|
1183
1186
|
const match = responseBuffer.match(/PROCESS_RESPONSE:(\{.*\})/);
|
|
@@ -1232,9 +1235,11 @@ var QueryEngine = class {
|
|
|
1232
1235
|
const timeout = setTimeout(() => {
|
|
1233
1236
|
if (!isResolved) {
|
|
1234
1237
|
isResolved = true;
|
|
1238
|
+
client.removeListener("data", dataHandler);
|
|
1239
|
+
globalTcpConnections.delete(this.connectionId);
|
|
1235
1240
|
reject(new Error("TCP connection timeout"));
|
|
1236
1241
|
}
|
|
1237
|
-
},
|
|
1242
|
+
}, this.timeout);
|
|
1238
1243
|
const executeQuery = () => {
|
|
1239
1244
|
const dmlIndex = args.findIndex((arg) => arg === "--dml");
|
|
1240
1245
|
const dmlJson = dmlIndex !== -1 ? args[dmlIndex + 1] : null;
|
|
@@ -1440,6 +1445,20 @@ var SqliteExecutor = class {
|
|
|
1440
1445
|
this.dbPath = dbPath;
|
|
1441
1446
|
this.binaryPath = this.getBinaryPath();
|
|
1442
1447
|
}
|
|
1448
|
+
findVersionedBinary(binDir, platform2) {
|
|
1449
|
+
try {
|
|
1450
|
+
const files = fs3.readdirSync(binDir);
|
|
1451
|
+
const extension = platform2 === "win32" ? ".exe" : "";
|
|
1452
|
+
const platformName = platform2 === "win32" ? "windows" : platform2 === "darwin" ? "macos" : "linux";
|
|
1453
|
+
const pattern = new RegExp(`^sqlite-engine-v\\d+\\.\\d+\\.\\d+-${platformName}-x64${extension.replace(".", "\\.")}$`);
|
|
1454
|
+
const matchingFile = files.find((f) => pattern.test(f));
|
|
1455
|
+
if (matchingFile) {
|
|
1456
|
+
return path5.join(binDir, matchingFile);
|
|
1457
|
+
}
|
|
1458
|
+
} catch (error) {
|
|
1459
|
+
}
|
|
1460
|
+
return null;
|
|
1461
|
+
}
|
|
1443
1462
|
getBinaryPath() {
|
|
1444
1463
|
const __filename2 = typeof import.meta !== "undefined" && import.meta.url ? fileURLToPath3(import.meta.url) : "";
|
|
1445
1464
|
const __dirname = __filename2 ? dirname3(__filename2) : process.cwd();
|
|
@@ -1450,7 +1469,14 @@ var SqliteExecutor = class {
|
|
|
1450
1469
|
];
|
|
1451
1470
|
const platform2 = process.platform;
|
|
1452
1471
|
const extension = platform2 === "win32" ? ".exe" : "";
|
|
1453
|
-
const
|
|
1472
|
+
const platformName = platform2 === "win32" ? "windows" : platform2 === "darwin" ? "macos" : "linux";
|
|
1473
|
+
for (const dir of possibleDirs) {
|
|
1474
|
+
const versionedPath = this.findVersionedBinary(dir, platform2);
|
|
1475
|
+
if (versionedPath && fs3.existsSync(versionedPath)) {
|
|
1476
|
+
return versionedPath;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
const binaryName = `sqlite-engine-${platformName}-x64${extension}`;
|
|
1454
1480
|
for (const dir of possibleDirs) {
|
|
1455
1481
|
const fullPath = path5.join(dir, binaryName);
|
|
1456
1482
|
if (fs3.existsSync(fullPath)) {
|