datapeek 0.1.14 → 0.1.16

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.
@@ -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-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
+ };
@@ -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-26GSUAI4.js";
13
+ } from "./chunk-AMDULVT7.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
- res.json({ connected: true, databaseName });
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-CJPCGHL3.js");
191
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
267
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
823
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
924
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
1101
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
1167
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
1226
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.js");
1207
1227
  await disconnect2();
1208
1228
  }
1209
1229
  res.status(500).json({ error: error.message || "Failed to count related rows" });
@@ -1241,7 +1261,7 @@ queryRoutes.post("/", async (req, res) => {
1241
1261
  }
1242
1262
  const errorMessage = error.message || "";
1243
1263
  if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
1244
- const { disconnect: disconnect2 } = await import("./db-CJPCGHL3.js");
1264
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.js");
1245
1265
  await disconnect2();
1246
1266
  }
1247
1267
  res.status(500).json({
@@ -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-26GSUAI4.js";
13
+ } from "./chunk-AMDULVT7.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
- res.json({ connected: true, databaseName });
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-CJPCGHL3.js");
191
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
267
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
823
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
924
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
1101
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
1167
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.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-CJPCGHL3.js");
1226
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.js");
1207
1227
  await disconnect2();
1208
1228
  }
1209
1229
  res.status(500).json({ error: error.message || "Failed to count related rows" });
@@ -1241,7 +1261,7 @@ queryRoutes.post("/", async (req, res) => {
1241
1261
  }
1242
1262
  const errorMessage = error.message || "";
1243
1263
  if (errorMessage.includes("Login failed") || errorMessage.includes("authentication") || errorMessage.includes("password authentication")) {
1244
- const { disconnect: disconnect2 } = await import("./db-CJPCGHL3.js");
1264
+ const { disconnect: disconnect2 } = await import("./db-ELL5GJQG.js");
1245
1265
  await disconnect2();
1246
1266
  }
1247
1267
  res.status(500).json({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datapeek",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "A local SQL database browser CLI tool",
5
5
  "type": "module",
6
6
  "bin": {