datapeek 0.1.15 → 0.1.17
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/cli/chunk-25W7DLJU.js +763 -0
- package/dist/cli/chunk-4ZTTGN4K.js +772 -0
- package/dist/cli/chunk-ACJCJE4M.js +728 -0
- package/dist/cli/chunk-AZZM4KI4.js +748 -0
- package/dist/cli/chunk-B5ENJPHN.js +726 -0
- package/dist/cli/chunk-D6TUHXVK.js +726 -0
- package/dist/cli/chunk-N4ZN35TN.js +753 -0
- package/dist/cli/chunk-NT7RKOGB.js +736 -0
- package/dist/cli/chunk-Q3ZM5P6B.js +713 -0
- package/dist/cli/chunk-TYOF4OPP.js +725 -0
- package/dist/cli/db-2XNNFT6D.js +36 -0
- package/dist/cli/db-DF2EYIGH.js +36 -0
- package/dist/cli/db-DUN4MAAS.js +36 -0
- package/dist/cli/db-ETWHJA2O.js +36 -0
- package/dist/cli/db-G3OUYANY.js +36 -0
- package/dist/cli/db-GII5HVII.js +36 -0
- package/dist/cli/db-J26NBD6Q.js +34 -0
- package/dist/cli/db-PLHJBMIE.js +36 -0
- package/dist/cli/db-PQSXQQER.js +36 -0
- package/dist/cli/db-UXHWQZEH.js +36 -0
- package/dist/cli/dev.js +61 -13
- package/dist/cli/index.js +61 -13
- package/dist/client/assets/index-BvCSgDQI.css +1 -0
- package/dist/client/assets/index-k-JqbRd3.js +395 -0
- package/dist/client/index.html +2 -2
- package/dist/server/chunk-AMDULVT7.js +723 -0
- package/dist/server/chunk-FUD3HYYO.js +750 -0
- package/dist/server/chunk-ICJJTM6H.js +745 -0
- package/dist/server/chunk-IFTGVLYX.js +760 -0
- package/dist/server/chunk-J4S2WZCU.js +733 -0
- package/dist/server/chunk-MS2MQHXD.js +723 -0
- package/dist/server/chunk-N6J45PJ6.js +710 -0
- package/dist/server/chunk-U3PBIJYP.js +725 -0
- package/dist/server/chunk-VTBMBBQX.js +769 -0
- package/dist/server/chunk-ZMTC5GW4.js +722 -0
- package/dist/server/db-737AZNBF.js +34 -0
- package/dist/server/db-AASKOPPI.js +32 -0
- package/dist/server/db-ELL5GJQG.js +34 -0
- package/dist/server/db-GM7OCOES.js +34 -0
- package/dist/server/db-P6KUHD2Z.js +34 -0
- package/dist/server/db-QCCVQUMG.js +34 -0
- package/dist/server/db-SHAIVNT5.js +34 -0
- package/dist/server/db-T5GG3OX4.js +34 -0
- package/dist/server/db-TN4IWAPG.js +34 -0
- package/dist/server/db-ZEV3LCJM.js +34 -0
- package/dist/server/dev.js +61 -13
- package/dist/server/index.js +61 -13
- package/package.json +1 -1
- package/dist/client/assets/index-C0Gnjc5g.css +0 -1
- package/dist/client/assets/index-CPRX2vzW.js +0 -390
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getConnectionConfig,
|
|
9
|
+
getDbType,
|
|
10
|
+
getDialect,
|
|
11
|
+
parseConnectionString,
|
|
12
|
+
setDbType,
|
|
13
|
+
testConnection
|
|
14
|
+
} from "./chunk-U3PBIJYP.js";
|
|
15
|
+
import {
|
|
16
|
+
cancelQuery,
|
|
17
|
+
generateQueryId
|
|
18
|
+
} from "./chunk-3DAIYH42.js";
|
|
19
|
+
export {
|
|
20
|
+
cancelQuery,
|
|
21
|
+
connect,
|
|
22
|
+
detectDbType,
|
|
23
|
+
disconnect,
|
|
24
|
+
executeQuery,
|
|
25
|
+
executeQueryMultiple,
|
|
26
|
+
generateQueryId,
|
|
27
|
+
getConnection,
|
|
28
|
+
getConnectionConfig,
|
|
29
|
+
getDbType,
|
|
30
|
+
getDialect,
|
|
31
|
+
parseConnectionString,
|
|
32
|
+
setDbType,
|
|
33
|
+
testConnection
|
|
34
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getDbType,
|
|
9
|
+
getDialect,
|
|
10
|
+
parseConnectionString,
|
|
11
|
+
setDbType,
|
|
12
|
+
testConnection
|
|
13
|
+
} from "./chunk-N6J45PJ6.js";
|
|
14
|
+
import {
|
|
15
|
+
cancelQuery,
|
|
16
|
+
generateQueryId
|
|
17
|
+
} from "./chunk-3DAIYH42.js";
|
|
18
|
+
export {
|
|
19
|
+
cancelQuery,
|
|
20
|
+
connect,
|
|
21
|
+
detectDbType,
|
|
22
|
+
disconnect,
|
|
23
|
+
executeQuery,
|
|
24
|
+
executeQueryMultiple,
|
|
25
|
+
generateQueryId,
|
|
26
|
+
getConnection,
|
|
27
|
+
getDbType,
|
|
28
|
+
getDialect,
|
|
29
|
+
parseConnectionString,
|
|
30
|
+
setDbType,
|
|
31
|
+
testConnection
|
|
32
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getConnectionConfig,
|
|
9
|
+
getDbType,
|
|
10
|
+
getDialect,
|
|
11
|
+
parseConnectionString,
|
|
12
|
+
setDbType,
|
|
13
|
+
testConnection
|
|
14
|
+
} from "./chunk-AMDULVT7.js";
|
|
15
|
+
import {
|
|
16
|
+
cancelQuery,
|
|
17
|
+
generateQueryId
|
|
18
|
+
} from "./chunk-3DAIYH42.js";
|
|
19
|
+
export {
|
|
20
|
+
cancelQuery,
|
|
21
|
+
connect,
|
|
22
|
+
detectDbType,
|
|
23
|
+
disconnect,
|
|
24
|
+
executeQuery,
|
|
25
|
+
executeQueryMultiple,
|
|
26
|
+
generateQueryId,
|
|
27
|
+
getConnection,
|
|
28
|
+
getConnectionConfig,
|
|
29
|
+
getDbType,
|
|
30
|
+
getDialect,
|
|
31
|
+
parseConnectionString,
|
|
32
|
+
setDbType,
|
|
33
|
+
testConnection
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getConnectionConfig,
|
|
9
|
+
getDbType,
|
|
10
|
+
getDialect,
|
|
11
|
+
parseConnectionString,
|
|
12
|
+
setDbType,
|
|
13
|
+
testConnection
|
|
14
|
+
} from "./chunk-ZMTC5GW4.js";
|
|
15
|
+
import {
|
|
16
|
+
cancelQuery,
|
|
17
|
+
generateQueryId
|
|
18
|
+
} from "./chunk-3DAIYH42.js";
|
|
19
|
+
export {
|
|
20
|
+
cancelQuery,
|
|
21
|
+
connect,
|
|
22
|
+
detectDbType,
|
|
23
|
+
disconnect,
|
|
24
|
+
executeQuery,
|
|
25
|
+
executeQueryMultiple,
|
|
26
|
+
generateQueryId,
|
|
27
|
+
getConnection,
|
|
28
|
+
getConnectionConfig,
|
|
29
|
+
getDbType,
|
|
30
|
+
getDialect,
|
|
31
|
+
parseConnectionString,
|
|
32
|
+
setDbType,
|
|
33
|
+
testConnection
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getConnectionConfig,
|
|
9
|
+
getDbType,
|
|
10
|
+
getDialect,
|
|
11
|
+
parseConnectionString,
|
|
12
|
+
setDbType,
|
|
13
|
+
testConnection
|
|
14
|
+
} from "./chunk-VTBMBBQX.js";
|
|
15
|
+
import {
|
|
16
|
+
cancelQuery,
|
|
17
|
+
generateQueryId
|
|
18
|
+
} from "./chunk-3DAIYH42.js";
|
|
19
|
+
export {
|
|
20
|
+
cancelQuery,
|
|
21
|
+
connect,
|
|
22
|
+
detectDbType,
|
|
23
|
+
disconnect,
|
|
24
|
+
executeQuery,
|
|
25
|
+
executeQueryMultiple,
|
|
26
|
+
generateQueryId,
|
|
27
|
+
getConnection,
|
|
28
|
+
getConnectionConfig,
|
|
29
|
+
getDbType,
|
|
30
|
+
getDialect,
|
|
31
|
+
parseConnectionString,
|
|
32
|
+
setDbType,
|
|
33
|
+
testConnection
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getConnectionConfig,
|
|
9
|
+
getDbType,
|
|
10
|
+
getDialect,
|
|
11
|
+
parseConnectionString,
|
|
12
|
+
setDbType,
|
|
13
|
+
testConnection
|
|
14
|
+
} from "./chunk-J4S2WZCU.js";
|
|
15
|
+
import {
|
|
16
|
+
cancelQuery,
|
|
17
|
+
generateQueryId
|
|
18
|
+
} from "./chunk-3DAIYH42.js";
|
|
19
|
+
export {
|
|
20
|
+
cancelQuery,
|
|
21
|
+
connect,
|
|
22
|
+
detectDbType,
|
|
23
|
+
disconnect,
|
|
24
|
+
executeQuery,
|
|
25
|
+
executeQueryMultiple,
|
|
26
|
+
generateQueryId,
|
|
27
|
+
getConnection,
|
|
28
|
+
getConnectionConfig,
|
|
29
|
+
getDbType,
|
|
30
|
+
getDialect,
|
|
31
|
+
parseConnectionString,
|
|
32
|
+
setDbType,
|
|
33
|
+
testConnection
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getConnectionConfig,
|
|
9
|
+
getDbType,
|
|
10
|
+
getDialect,
|
|
11
|
+
parseConnectionString,
|
|
12
|
+
setDbType,
|
|
13
|
+
testConnection
|
|
14
|
+
} from "./chunk-FUD3HYYO.js";
|
|
15
|
+
import {
|
|
16
|
+
cancelQuery,
|
|
17
|
+
generateQueryId
|
|
18
|
+
} from "./chunk-3DAIYH42.js";
|
|
19
|
+
export {
|
|
20
|
+
cancelQuery,
|
|
21
|
+
connect,
|
|
22
|
+
detectDbType,
|
|
23
|
+
disconnect,
|
|
24
|
+
executeQuery,
|
|
25
|
+
executeQueryMultiple,
|
|
26
|
+
generateQueryId,
|
|
27
|
+
getConnection,
|
|
28
|
+
getConnectionConfig,
|
|
29
|
+
getDbType,
|
|
30
|
+
getDialect,
|
|
31
|
+
parseConnectionString,
|
|
32
|
+
setDbType,
|
|
33
|
+
testConnection
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getConnectionConfig,
|
|
9
|
+
getDbType,
|
|
10
|
+
getDialect,
|
|
11
|
+
parseConnectionString,
|
|
12
|
+
setDbType,
|
|
13
|
+
testConnection
|
|
14
|
+
} from "./chunk-IFTGVLYX.js";
|
|
15
|
+
import {
|
|
16
|
+
cancelQuery,
|
|
17
|
+
generateQueryId
|
|
18
|
+
} from "./chunk-3DAIYH42.js";
|
|
19
|
+
export {
|
|
20
|
+
cancelQuery,
|
|
21
|
+
connect,
|
|
22
|
+
detectDbType,
|
|
23
|
+
disconnect,
|
|
24
|
+
executeQuery,
|
|
25
|
+
executeQueryMultiple,
|
|
26
|
+
generateQueryId,
|
|
27
|
+
getConnection,
|
|
28
|
+
getConnectionConfig,
|
|
29
|
+
getDbType,
|
|
30
|
+
getDialect,
|
|
31
|
+
parseConnectionString,
|
|
32
|
+
setDbType,
|
|
33
|
+
testConnection
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getConnectionConfig,
|
|
9
|
+
getDbType,
|
|
10
|
+
getDialect,
|
|
11
|
+
parseConnectionString,
|
|
12
|
+
setDbType,
|
|
13
|
+
testConnection
|
|
14
|
+
} from "./chunk-ICJJTM6H.js";
|
|
15
|
+
import {
|
|
16
|
+
cancelQuery,
|
|
17
|
+
generateQueryId
|
|
18
|
+
} from "./chunk-3DAIYH42.js";
|
|
19
|
+
export {
|
|
20
|
+
cancelQuery,
|
|
21
|
+
connect,
|
|
22
|
+
detectDbType,
|
|
23
|
+
disconnect,
|
|
24
|
+
executeQuery,
|
|
25
|
+
executeQueryMultiple,
|
|
26
|
+
generateQueryId,
|
|
27
|
+
getConnection,
|
|
28
|
+
getConnectionConfig,
|
|
29
|
+
getDbType,
|
|
30
|
+
getDialect,
|
|
31
|
+
parseConnectionString,
|
|
32
|
+
setDbType,
|
|
33
|
+
testConnection
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
detectDbType,
|
|
4
|
+
disconnect,
|
|
5
|
+
executeQuery,
|
|
6
|
+
executeQueryMultiple,
|
|
7
|
+
getConnection,
|
|
8
|
+
getConnectionConfig,
|
|
9
|
+
getDbType,
|
|
10
|
+
getDialect,
|
|
11
|
+
parseConnectionString,
|
|
12
|
+
setDbType,
|
|
13
|
+
testConnection
|
|
14
|
+
} from "./chunk-MS2MQHXD.js";
|
|
15
|
+
import {
|
|
16
|
+
cancelQuery,
|
|
17
|
+
generateQueryId
|
|
18
|
+
} from "./chunk-3DAIYH42.js";
|
|
19
|
+
export {
|
|
20
|
+
cancelQuery,
|
|
21
|
+
connect,
|
|
22
|
+
detectDbType,
|
|
23
|
+
disconnect,
|
|
24
|
+
executeQuery,
|
|
25
|
+
executeQueryMultiple,
|
|
26
|
+
generateQueryId,
|
|
27
|
+
getConnection,
|
|
28
|
+
getConnectionConfig,
|
|
29
|
+
getDbType,
|
|
30
|
+
getDialect,
|
|
31
|
+
parseConnectionString,
|
|
32
|
+
setDbType,
|
|
33
|
+
testConnection
|
|
34
|
+
};
|
package/dist/server/dev.js
CHANGED
|
@@ -4,11 +4,13 @@ import {
|
|
|
4
4
|
executeQuery,
|
|
5
5
|
executeQueryMultiple,
|
|
6
6
|
getConnection,
|
|
7
|
+
getConnectionConfig,
|
|
7
8
|
getDbType,
|
|
8
9
|
getDialect,
|
|
10
|
+
parseConnectionString,
|
|
9
11
|
setDbType,
|
|
10
12
|
testConnection
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VTBMBBQX.js";
|
|
12
14
|
import {
|
|
13
15
|
cancelQuery,
|
|
14
16
|
generateQueryId
|
|
@@ -119,7 +121,25 @@ connectionRoutes.get("/status", async (req, res) => {
|
|
|
119
121
|
const dialect = getDialect();
|
|
120
122
|
const result = await executeQuery(dialect.currentDbQuery());
|
|
121
123
|
const databaseName = result[0]?.databaseName || null;
|
|
122
|
-
|
|
124
|
+
let connConfig = getConnectionConfig();
|
|
125
|
+
if (!connConfig && databaseName) {
|
|
126
|
+
const connString = getProvidedConnectionString();
|
|
127
|
+
if (connString) {
|
|
128
|
+
try {
|
|
129
|
+
const parsed = parseConnectionString(connString);
|
|
130
|
+
if (parsed.server && parsed.database && parsed.database.toLowerCase() === databaseName.toLowerCase()) {
|
|
131
|
+
const dbType = connString.trim().startsWith("postgresql://") || connString.trim().startsWith("postgres://") ? "postgres" : "mssql";
|
|
132
|
+
connConfig = { server: parsed.server, database: parsed.database, dbType };
|
|
133
|
+
}
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
res.json({
|
|
139
|
+
connected: true,
|
|
140
|
+
databaseName,
|
|
141
|
+
...connConfig && { server: connConfig.server, database: connConfig.database, dbType: connConfig.dbType }
|
|
142
|
+
});
|
|
123
143
|
} catch (error) {
|
|
124
144
|
const errorMessage = error.message || "";
|
|
125
145
|
if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
|
|
@@ -168,7 +188,7 @@ tableRoutes.get("/", async (req, res) => {
|
|
|
168
188
|
console.error("Error fetching tables:", error);
|
|
169
189
|
const errorMessage = error.message || "";
|
|
170
190
|
if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
|
|
171
|
-
const { disconnect: disconnect2 } = await import("./db-
|
|
191
|
+
const { disconnect: disconnect2 } = await import("./db-P6KUHD2Z.js");
|
|
172
192
|
await disconnect2();
|
|
173
193
|
}
|
|
174
194
|
const errorDetails = error.originalError?.message || error.originalError?.info?.message || error.message || "Failed to fetch tables";
|
|
@@ -244,7 +264,7 @@ tableRoutes.get("/:schema/:table", async (req, res) => {
|
|
|
244
264
|
} catch (error) {
|
|
245
265
|
const errorMessage = error.message || "";
|
|
246
266
|
if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
|
|
247
|
-
const { disconnect: disconnect2 } = await import("./db-
|
|
267
|
+
const { disconnect: disconnect2 } = await import("./db-P6KUHD2Z.js");
|
|
248
268
|
await disconnect2();
|
|
249
269
|
}
|
|
250
270
|
res.status(500).json({ error: error.message || "Failed to fetch table structure" });
|
|
@@ -800,7 +820,7 @@ ${limitOffsetClause}`;
|
|
|
800
820
|
console.error("Error fetching table data:", error);
|
|
801
821
|
const errorMessage = error.message || "";
|
|
802
822
|
if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
|
|
803
|
-
const { disconnect: disconnect2 } = await import("./db-
|
|
823
|
+
const { disconnect: disconnect2 } = await import("./db-P6KUHD2Z.js");
|
|
804
824
|
await disconnect2();
|
|
805
825
|
}
|
|
806
826
|
const isTimeout = error.code === "ETIMEOUT" || error.code === "ESOCKET" || error.message?.includes("timeout") || error.message?.includes("ETIMEDOUT") || error.originalError?.code === "ETIMEOUT" || error.originalError?.code === "ESOCKET";
|
|
@@ -901,7 +921,7 @@ tableRoutes.post("/:schema/:table/related-data", async (req, res) => {
|
|
|
901
921
|
console.error("Error fetching related data:", error);
|
|
902
922
|
const errorMessage = error.message || "";
|
|
903
923
|
if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
|
|
904
|
-
const { disconnect: disconnect2 } = await import("./db-
|
|
924
|
+
const { disconnect: disconnect2 } = await import("./db-P6KUHD2Z.js");
|
|
905
925
|
await disconnect2();
|
|
906
926
|
}
|
|
907
927
|
res.status(500).json({ error: error.message || "Failed to fetch related data" });
|
|
@@ -1078,7 +1098,7 @@ tableRoutes.get("/:schema/:table/distinct-values/:column", async (req, res) => {
|
|
|
1078
1098
|
console.error("Error fetching distinct values:", error);
|
|
1079
1099
|
const errorMessage = error.message || "";
|
|
1080
1100
|
if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
|
|
1081
|
-
const { disconnect: disconnect2 } = await import("./db-
|
|
1101
|
+
const { disconnect: disconnect2 } = await import("./db-P6KUHD2Z.js");
|
|
1082
1102
|
await disconnect2();
|
|
1083
1103
|
}
|
|
1084
1104
|
res.status(500).json({ error: error.message || "Failed to fetch distinct values" });
|
|
@@ -1144,7 +1164,7 @@ tableRoutes.get("/:schema/:table/reverse-foreign-keys", async (req, res) => {
|
|
|
1144
1164
|
console.error("Error fetching reverse foreign keys:", error);
|
|
1145
1165
|
const errorMessage = error.message || "";
|
|
1146
1166
|
if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
|
|
1147
|
-
const { disconnect: disconnect2 } = await import("./db-
|
|
1167
|
+
const { disconnect: disconnect2 } = await import("./db-P6KUHD2Z.js");
|
|
1148
1168
|
await disconnect2();
|
|
1149
1169
|
}
|
|
1150
1170
|
res.status(500).json({ error: error.message || "Failed to fetch reverse foreign keys" });
|
|
@@ -1203,7 +1223,7 @@ tableRoutes.post("/:schema/:table/count-related", async (req, res) => {
|
|
|
1203
1223
|
console.error("Error counting related rows:", error);
|
|
1204
1224
|
const errorMessage = error.message || "";
|
|
1205
1225
|
if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
|
|
1206
|
-
const { disconnect: disconnect2 } = await import("./db-
|
|
1226
|
+
const { disconnect: disconnect2 } = await import("./db-P6KUHD2Z.js");
|
|
1207
1227
|
await disconnect2();
|
|
1208
1228
|
}
|
|
1209
1229
|
res.status(500).json({ error: error.message || "Failed to count related rows" });
|
|
@@ -1213,6 +1233,31 @@ tableRoutes.post("/:schema/:table/count-related", async (req, res) => {
|
|
|
1213
1233
|
// src/server/routes/query.ts
|
|
1214
1234
|
import { Router as Router3 } from "express";
|
|
1215
1235
|
var queryRoutes = Router3();
|
|
1236
|
+
function extractErrorMessages(error) {
|
|
1237
|
+
const out = [];
|
|
1238
|
+
if (Array.isArray(error?.messages)) {
|
|
1239
|
+
for (const msg of error.messages) {
|
|
1240
|
+
const text = typeof msg?.message === "string" ? msg.message : String(msg ?? "");
|
|
1241
|
+
if (!text.trim()) continue;
|
|
1242
|
+
const type = msg?.type === "warning" ? "warning" : msg?.type === "error" ? "error" : "info";
|
|
1243
|
+
out.push({ type, message: text });
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
if (Array.isArray(error?.precedingErrors)) {
|
|
1247
|
+
for (const err of error.precedingErrors) {
|
|
1248
|
+
const text = typeof err?.message === "string" ? err.message : String(err ?? "");
|
|
1249
|
+
if (!text.trim()) continue;
|
|
1250
|
+
out.push({ type: "error", message: text });
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
if (error?.message) {
|
|
1254
|
+
const hasPrimary = out.some((msg) => msg.message === error.message);
|
|
1255
|
+
if (!hasPrimary) {
|
|
1256
|
+
out.push({ type: "error", message: error.message });
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
return out.length > 0 ? out : void 0;
|
|
1260
|
+
}
|
|
1216
1261
|
queryRoutes.post("/", async (req, res) => {
|
|
1217
1262
|
try {
|
|
1218
1263
|
const { query: sqlQuery, queryId } = req.body;
|
|
@@ -1221,7 +1266,7 @@ queryRoutes.post("/", async (req, res) => {
|
|
|
1221
1266
|
}
|
|
1222
1267
|
const activeQueryId = queryId || generateQueryId();
|
|
1223
1268
|
const startTime = Date.now();
|
|
1224
|
-
const { recordsets: resultSets, columnMetadata } = await executeQueryMultiple(sqlQuery, void 0, activeQueryId);
|
|
1269
|
+
const { recordsets: resultSets, columnMetadata, messages } = await executeQueryMultiple(sqlQuery, void 0, activeQueryId);
|
|
1225
1270
|
const executionTime = Date.now() - startTime;
|
|
1226
1271
|
res.json({
|
|
1227
1272
|
data: resultSets[0] || [],
|
|
@@ -1229,6 +1274,7 @@ queryRoutes.post("/", async (req, res) => {
|
|
|
1229
1274
|
executionTime,
|
|
1230
1275
|
columnMetadata,
|
|
1231
1276
|
// Include column metadata for empty result sets
|
|
1277
|
+
messages,
|
|
1232
1278
|
queryId: activeQueryId
|
|
1233
1279
|
// Return queryId so client can track it
|
|
1234
1280
|
});
|
|
@@ -1236,17 +1282,19 @@ queryRoutes.post("/", async (req, res) => {
|
|
|
1236
1282
|
if (error.cancelled || error.code === "ECANCEL") {
|
|
1237
1283
|
return res.status(499).json({
|
|
1238
1284
|
error: "Query was cancelled",
|
|
1239
|
-
cancelled: true
|
|
1285
|
+
cancelled: true,
|
|
1286
|
+
messages: extractErrorMessages(error)
|
|
1240
1287
|
});
|
|
1241
1288
|
}
|
|
1242
1289
|
const errorMessage = error.message || "";
|
|
1243
1290
|
if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
|
|
1244
|
-
const { disconnect: disconnect2 } = await import("./db-
|
|
1291
|
+
const { disconnect: disconnect2 } = await import("./db-P6KUHD2Z.js");
|
|
1245
1292
|
await disconnect2();
|
|
1246
1293
|
}
|
|
1247
1294
|
res.status(500).json({
|
|
1248
1295
|
error: error.message || "Query execution failed",
|
|
1249
|
-
details: error.originalError?.message
|
|
1296
|
+
details: error.originalError?.message,
|
|
1297
|
+
messages: extractErrorMessages(error)
|
|
1250
1298
|
});
|
|
1251
1299
|
}
|
|
1252
1300
|
});
|