@pgplex/pgconsole 0.2.3 → 1.0.1

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.
@@ -1 +1 @@
1
- import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./index-BhAg5WIC.js";export{o as ensureModuleLoaded};
1
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./index-D7n7c6X5.js";export{o as ensureModuleLoaded};
@@ -9,8 +9,8 @@
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
10
  <link href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap" rel="stylesheet" />
11
11
  <title>pgconsole</title>
12
- <script type="module" crossorigin src="/assets/index-BhAg5WIC.js"></script>
13
- <link rel="stylesheet" crossorigin href="/assets/index-DUHQjBL7.css">
12
+ <script type="module" crossorigin src="/assets/index-D7n7c6X5.js"></script>
13
+ <link rel="stylesheet" crossorigin href="/assets/index-C8bwjbrl.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
package/dist/server.mjs CHANGED
@@ -58022,6 +58022,7 @@ function transformExpr(node) {
58022
58022
  if ("CoalesceExpr" in obj) return transformCoalesce(obj.CoalesceExpr);
58023
58023
  if ("CaseExpr" in obj) return transformCase(obj.CaseExpr);
58024
58024
  if ("ParamRef" in obj) return transformParamRef(obj.ParamRef);
58025
+ if ("RowExpr" in obj) return transformRowExpr(obj.RowExpr);
58025
58026
  return { kind: "unknown", raw: node };
58026
58027
  }
58027
58028
  function transformColumnRef(node) {
@@ -58171,6 +58172,13 @@ function transformParamRef(node) {
58171
58172
  number: node.number
58172
58173
  };
58173
58174
  }
58175
+ function transformRowExpr(node) {
58176
+ const args = node.args || [];
58177
+ return {
58178
+ kind: "row",
58179
+ args: args.map(transformExpr)
58180
+ };
58181
+ }
58174
58182
  function transformInsert(raw) {
58175
58183
  const relation = raw.relation;
58176
58184
  const alias = relation.alias;
@@ -62588,13 +62596,37 @@ COMMIT;` : req.sql;
62588
62596
  } catch (err) {
62589
62597
  const errorMessage = err instanceof Error ? err.message : "Query execution failed";
62590
62598
  const executionTimeMs = Date.now() - start2;
62599
+ let fullError = errorMessage;
62600
+ const pgErr = err;
62601
+ const pos = pgErr?.position;
62602
+ if (typeof pos === "string" && pos) {
62603
+ const charPos = parseInt(pos, 10);
62604
+ if (charPos > 0) {
62605
+ const before = req.sql.slice(0, charPos - 1);
62606
+ const lineNumber = before.split("\n").length;
62607
+ const lines = req.sql.split("\n");
62608
+ const offendingLine = lines[lineNumber - 1];
62609
+ if (offendingLine !== void 0) {
62610
+ fullError = `ERROR at Line ${lineNumber}: ${errorMessage}
62611
+ LINE ${lineNumber}: ${offendingLine}`;
62612
+ }
62613
+ }
62614
+ }
62615
+ if (typeof pgErr?.detail === "string" && pgErr.detail) {
62616
+ fullError += `
62617
+ DETAIL: ${pgErr.detail}`;
62618
+ }
62619
+ if (typeof pgErr?.hint === "string" && pgErr.hint) {
62620
+ fullError += `
62621
+ HINT: ${pgErr.hint}`;
62622
+ }
62591
62623
  auditSQL(user.email, req.connectionId, details.database, req.sql, false, executionTimeMs, void 0, errorMessage);
62592
62624
  yield {
62593
62625
  columns: [],
62594
62626
  rows: [],
62595
62627
  rowCount: 0,
62596
62628
  executionTimeMs,
62597
- error: errorMessage,
62629
+ error: fullError,
62598
62630
  backendPid
62599
62631
  };
62600
62632
  } finally {
@@ -92948,7 +92980,7 @@ async function start() {
92948
92980
  \\ \\_\\ /\\____/
92949
92981
  \\/_/ \\_/__/
92950
92982
 
92951
- Version ${"0.2.3"}
92983
+ Version ${"1.0.1"}
92952
92984
  `);
92953
92985
  console.log(`Server running on http://localhost:${port}`);
92954
92986
  const browserUrl = false ? `http://localhost:5173` : getExternalUrl() || `http://localhost:${port}`;