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