@bytebase/dbhub 1.2.2 → 1.2.3

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.js CHANGED
@@ -2068,7 +2068,7 @@ See documentation for more details on configuring database connections.
2068
2068
 
2069
2069
  // src/index.ts
2070
2070
  var connectorModules = [
2071
- { load: () => import("./postgres-2FHS64EO.js"), name: "PostgreSQL", driver: "pg" },
2071
+ { load: () => import("./postgres-OVI2PNIJ.js"), name: "PostgreSQL", driver: "pg" },
2072
2072
  { load: () => import("./sqlserver-WNVSBFJ3.js"), name: "SQL Server", driver: "mssql" },
2073
2073
  { load: () => import("./sqlite-ASYMU5BI.js"), name: "SQLite", driver: "node:sqlite" },
2074
2074
  { load: () => import("./mysql-GXDUNLJ6.js"), name: "MySQL", driver: "mysql2" },
@@ -19,7 +19,7 @@ import {
19
19
  import fs from "fs";
20
20
  import os from "os";
21
21
  import path from "path";
22
- import pg from "pg";
22
+ import pg2 from "pg";
23
23
 
24
24
  // src/connectors/postgres/failed-to-read-certificate.ts
25
25
  var FailedToReadCertificate = class extends Error {
@@ -29,8 +29,35 @@ var FailedToReadCertificate = class extends Error {
29
29
  }
30
30
  };
31
31
 
32
+ // src/connectors/postgres/type-parsers.ts
33
+ import pg from "pg";
34
+ var VERBATIM_DATE_TIME_OIDS = /* @__PURE__ */ new Set([
35
+ 1082,
36
+ // date
37
+ 1114,
38
+ // timestamp without time zone
39
+ 1184,
40
+ // timestamp with time zone
41
+ 1182,
42
+ // date[]
43
+ 1115,
44
+ // timestamp[]
45
+ 1185
46
+ // timestamptz[]
47
+ ]);
48
+ var passthrough = (value) => value;
49
+ var postgresTypeParsers = {
50
+ getTypeParser(oid, format) {
51
+ if (VERBATIM_DATE_TIME_OIDS.has(oid) && (format === void 0 || format === "text")) {
52
+ return passthrough;
53
+ }
54
+ return pg.types.getTypeParser(oid, format);
55
+ }
56
+ };
57
+
32
58
  // src/connectors/postgres/index.ts
33
- var { Pool } = pg;
59
+ var { Pool } = pg2;
60
+ var POSTGRES_CLIENT_QUERY_TIMEOUT_GRACE_MS = 5e3;
34
61
  var PostgresDSNParser = class {
35
62
  async parse(dsn, config) {
36
63
  const connectionTimeoutSeconds = config?.connectionTimeoutSeconds;
@@ -90,7 +117,9 @@ Expected: ${expectedFormat}`
90
117
  poolConfig.connectionTimeoutMillis = connectionTimeoutSeconds * 1e3;
91
118
  }
92
119
  if (queryTimeoutSeconds !== void 0) {
93
- poolConfig.query_timeout = queryTimeoutSeconds * 1e3;
120
+ const queryTimeoutMs = queryTimeoutSeconds * 1e3;
121
+ poolConfig.statement_timeout = queryTimeoutMs;
122
+ poolConfig.query_timeout = queryTimeoutMs + POSTGRES_CLIENT_QUERY_TIMEOUT_GRACE_MS;
94
123
  }
95
124
  return poolConfig;
96
125
  } catch (error) {
@@ -136,6 +165,7 @@ var PostgresConnector = class _PostgresConnector {
136
165
  this.defaultSchema = "public";
137
166
  try {
138
167
  const poolConfig = await this.dsnParser.parse(dsn, config);
168
+ poolConfig.types = postgresTypeParsers;
139
169
  if (config?.readonly) {
140
170
  poolConfig.options = (poolConfig.options || "") + " -c default_transaction_read_only=on";
141
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebase/dbhub",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "mcpName": "io.github.bytebase/dbhub",
5
5
  "description": "Minimal, token-efficient Database MCP Server for PostgreSQL, MySQL, SQL Server, SQLite, MariaDB",
6
6
  "repository": {