@xcr1234/dbhub-fork 1.3.0 → 1.5.0

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/README.md CHANGED
@@ -1,16 +1,18 @@
1
1
  # My fork version
2
2
 
3
- Remove better-sqlite3
3
+ `npm i @xcr1234/dbhub-fork`
4
4
 
5
- Add oracle support, example:
5
+ 1. Remove better-sqlite3
6
+
7
+ 2.Add oracle support, for example:
6
8
 
7
9
  ```toml
8
10
  [[sources]]
9
11
  id = "oracle_db"
10
12
  dsn = "oracle://SYSTEM:MyStrongPassword123@localhost:1521/FREEPDB1"
11
- type = "oracle"
12
13
  ```
13
14
 
15
+ 3.implement the search_objects UI.
14
16
 
15
17
  > > [!NOTE]
16
18
  > Brought to you by [Bytebase](https://www.bytebase.com/), open-source database DevSecOps platform.
@@ -8,7 +8,7 @@ import {
8
8
  getDefaultPortForType,
9
9
  parseConnectionInfoFromDSN,
10
10
  stripCommentsAndStrings
11
- } from "./chunk-OSGLPOZZ.js";
11
+ } from "./chunk-Q5EJYAEZ.js";
12
12
 
13
13
  // src/tools/builtin-tools.ts
14
14
  var BUILTIN_TOOL_EXECUTE_SQL = "execute_sql";
@@ -603,7 +603,7 @@ function buildDSNFromEnvParams() {
603
603
  return null;
604
604
  }
605
605
  }
606
- const supportedTypes = ["postgres", "postgresql", "mysql", "mariadb", "sqlserver", "sqlite"];
606
+ const supportedTypes = ["postgres", "postgresql", "mysql", "mariadb", "sqlserver", "sqlite", "oracle"];
607
607
  if (!supportedTypes.includes(dbType.toLowerCase())) {
608
608
  throw new Error(`Unsupported DB_TYPE: ${dbType}. Supported types: ${supportedTypes.join(", ")}`);
609
609
  }
@@ -621,6 +621,9 @@ function buildDSNFromEnvParams() {
621
621
  case "sqlserver":
622
622
  port = "1433";
623
623
  break;
624
+ case "oracle":
625
+ port = "1521";
626
+ break;
624
627
  case "sqlite":
625
628
  return {
626
629
  dsn: `sqlite:///${dbName}`,
@@ -864,6 +867,8 @@ async function resolveSourceConfigs() {
864
867
  dbType = "sqlserver";
865
868
  } else if (protocol === "sqlite") {
866
869
  dbType = "sqlite";
870
+ } else if (protocol === "oracle") {
871
+ dbType = "oracle";
867
872
  } else {
868
873
  throw new Error(`Unsupported database type in DSN: ${protocol}`);
869
874
  }
@@ -1093,10 +1098,10 @@ function validateSourceConfig(source, configPath) {
1093
1098
  }
1094
1099
  }
1095
1100
  if (source.aws_iam_auth === true) {
1096
- const validIamTypes = ["postgres", "mysql", "mariadb"];
1101
+ const validIamTypes = ["postgres", "mysql", "mariadb", "oracle"];
1097
1102
  if (!source.type || !validIamTypes.includes(source.type)) {
1098
1103
  throw new Error(
1099
- `Configuration file ${configPath}: source '${source.id}' has aws_iam_auth enabled, but this is only supported for postgres, mysql, and mariadb sources.`
1104
+ `Configuration file ${configPath}: source '${source.id}' has aws_iam_auth enabled, but this is only supported for postgres, mysql, oracle, and mariadb sources.`
1100
1105
  );
1101
1106
  }
1102
1107
  if (!source.aws_region) {
@@ -1323,7 +1328,7 @@ function buildDSNFromSource(source) {
1323
1328
  }
1324
1329
  return `sqlite:///${source.database}`;
1325
1330
  }
1326
- const isAwsIamPasswordless = source.aws_iam_auth === true && ["postgres", "mysql", "mariadb"].includes(source.type);
1331
+ const isAwsIamPasswordless = source.aws_iam_auth === true && ["postgres", "mysql", "mariadb", "oracle"].includes(source.type);
1327
1332
  const passwordRequired = source.authentication !== "azure-active-directory-access-token" && !isAwsIamPasswordless;
1328
1333
  if (!source.host || !source.user || !source.database) {
1329
1334
  throw new Error(
@@ -1765,10 +1770,10 @@ var ConnectorManager = class {
1765
1770
  if (!source.aws_iam_auth) {
1766
1771
  return dsn;
1767
1772
  }
1768
- const supportedIamTypes = ["postgres", "mysql", "mariadb"];
1773
+ const supportedIamTypes = ["postgres", "mysql", "mariadb", "oracle"];
1769
1774
  if (!source.type || !supportedIamTypes.includes(source.type)) {
1770
1775
  throw new Error(
1771
- `Source '${source.id}': aws_iam_auth is only supported for postgres, mysql, and mariadb`
1776
+ `Source '${source.id}': aws_iam_auth is only supported for postgres, mysql, oracle, and mariadb`
1772
1777
  );
1773
1778
  }
1774
1779
  if (!source.aws_region) {
@@ -237,7 +237,8 @@ function protocolToConnectorType(protocol) {
237
237
  "mysql": "mysql",
238
238
  "mariadb": "mariadb",
239
239
  "sqlserver": "sqlserver",
240
- "sqlite": "sqlite"
240
+ "sqlite": "sqlite",
241
+ "oracle": "oracle"
241
242
  };
242
243
  return mapping[protocol];
243
244
  }
@@ -247,7 +248,8 @@ function getDefaultPortForType(type) {
247
248
  "mysql": 3306,
248
249
  "mariadb": 3306,
249
250
  "sqlserver": 1433,
250
- "sqlite": void 0
251
+ "sqlite": void 0,
252
+ "oracle": 1521
251
253
  };
252
254
  return ports[type];
253
255
  }
@@ -9,6 +9,7 @@ function quoteIdentifier(identifier, dbType) {
9
9
  switch (dbType) {
10
10
  case "postgres":
11
11
  case "sqlite":
12
+ case "oracle":
12
13
  return `"${identifier.replace(/"/g, '""')}"`;
13
14
  case "mysql":
14
15
  case "mariadb":
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  stripCommentsAndStrings
3
- } from "./chunk-OSGLPOZZ.js";
3
+ } from "./chunk-Q5EJYAEZ.js";
4
4
 
5
5
  // src/utils/sql-row-limiter.ts
6
6
  var SQLRowLimiter = class {
package/dist/index.js CHANGED
@@ -12,13 +12,13 @@ import {
12
12
  resolveSourceConfigs,
13
13
  resolveTomlConfigPath,
14
14
  resolveTransport
15
- } from "./chunk-SV472SM3.js";
15
+ } from "./chunk-C7DOB2OX.js";
16
16
  import {
17
17
  loadConnectors
18
18
  } from "./chunk-WVVMH6FJ.js";
19
19
  import {
20
20
  quoteQualifiedIdentifier
21
- } from "./chunk-JFWX35TB.js";
21
+ } from "./chunk-X2EC47W4.js";
22
22
  import {
23
23
  ConnectorRegistry,
24
24
  getDatabaseTypeFromDSN,
@@ -26,7 +26,7 @@ import {
26
26
  parseConnectionInfoFromDSN,
27
27
  splitSQLStatements,
28
28
  stripCommentsAndStrings
29
- } from "./chunk-OSGLPOZZ.js";
29
+ } from "./chunk-Q5EJYAEZ.js";
30
30
 
31
31
  // src/server.ts
32
32
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -97,7 +97,8 @@ var allowedKeywords = {
97
97
  mysql: ["select", "with", "explain", "show", "describe", "desc"],
98
98
  mariadb: ["select", "with", "explain", "show", "describe", "desc"],
99
99
  sqlite: ["select", "with", "explain", "pragma"],
100
- sqlserver: ["select", "with", "explain", "showplan"]
100
+ sqlserver: ["select", "with", "explain", "showplan"],
101
+ oracle: ["select", "with", "explain", "show"]
101
102
  };
102
103
  var mutatingKeywords = [
103
104
  "insert",
@@ -125,7 +126,8 @@ var mutatingPatterns = {
125
126
  mysql: mutatingPatternWithReplace,
126
127
  mariadb: mutatingPatternWithReplace,
127
128
  sqlite: mutatingPatternWithReplace,
128
- sqlserver: mutatingPattern
129
+ sqlserver: mutatingPattern,
130
+ oracle: mutatingPattern
129
131
  };
130
132
  var selectIntoPattern = /\bselect\b[\s\S]+\binto\b/i;
131
133
  var explainAnalyzePattern = /^explain\s+(?:\([^)]*\banalyze\b(?!\s*(?:=\s*)?(?:false|off|0)\b)[^)]*\)|\banalyze\b(?!\s*(?:=\s*)?(?:false|off|0)\b)(?:\s+verbose\b)?)/i;
@@ -1428,7 +1430,7 @@ See documentation for more details on configuring database connections.
1428
1430
  const sources = sourceConfigsData.sources;
1429
1431
  console.error(`Configuration source: ${sourceConfigsData.source}`);
1430
1432
  await connectorManager.connectWithSources(sources);
1431
- const { initializeToolRegistry: initializeToolRegistry2 } = await import("./registry-BYNIIISI.js");
1433
+ const { initializeToolRegistry: initializeToolRegistry2 } = await import("./registry-MDRFDJ4T.js");
1432
1434
  initializeToolRegistry2({
1433
1435
  sources: sourceConfigsData.sources,
1434
1436
  tools: sourceConfigsData.tools
@@ -1570,12 +1572,12 @@ See documentation for more details on configuring database connections.
1570
1572
 
1571
1573
  // src/index.ts
1572
1574
  var connectorModules = [
1573
- { load: () => import("./postgres-32KMZ7YK.js"), name: "PostgreSQL", driver: "pg" },
1574
- { load: () => import("./sqlserver-KEBKTIC6.js"), name: "SQL Server", driver: "mssql" },
1575
- { load: () => import("./sqlite-OABJLFKA.js"), name: "SQLite", driver: "better-sqlite3" },
1576
- { load: () => import("./mysql-L2V52BZM.js"), name: "MySQL", driver: "mysql2" },
1577
- { load: () => import("./mariadb-PUWTXMUM.js"), name: "MariaDB", driver: "mariadb" },
1578
- { load: () => import("./oracle-LPUU7T2G.js"), name: "Oracle", driver: "oracle" }
1575
+ { load: () => import("./postgres-GA6ZYCSZ.js"), name: "PostgreSQL", driver: "pg" },
1576
+ { load: () => import("./sqlserver-LN5V4I2X.js"), name: "SQL Server", driver: "mssql" },
1577
+ { load: () => import("./sqlite-PAG2E22N.js"), name: "SQLite", driver: "better-sqlite3" },
1578
+ { load: () => import("./mysql-HXACTOCX.js"), name: "MySQL", driver: "mysql2" },
1579
+ { load: () => import("./mariadb-LBLZFLEX.js"), name: "MariaDB", driver: "mariadb" },
1580
+ { load: () => import("./oracle-POFDPF45.js"), name: "Oracle", driver: "oracle" }
1579
1581
  ];
1580
1582
  loadConnectors(connectorModules).then(() => main()).catch((error) => {
1581
1583
  console.error("Fatal error:", error);
@@ -4,16 +4,16 @@ import {
4
4
  } from "./chunk-RTB262PR.js";
5
5
  import {
6
6
  quoteIdentifier
7
- } from "./chunk-JFWX35TB.js";
7
+ } from "./chunk-X2EC47W4.js";
8
8
  import {
9
9
  SQLRowLimiter
10
- } from "./chunk-JBJZJE5J.js";
10
+ } from "./chunk-XD3EZPMW.js";
11
11
  import {
12
12
  ConnectorRegistry,
13
13
  SafeURL,
14
14
  obfuscateDSNPassword,
15
15
  splitSQLStatements
16
- } from "./chunk-OSGLPOZZ.js";
16
+ } from "./chunk-Q5EJYAEZ.js";
17
17
 
18
18
  // src/connectors/mariadb/index.ts
19
19
  import * as mariadb from "mariadb";
@@ -4,16 +4,16 @@ import {
4
4
  } from "./chunk-RTB262PR.js";
5
5
  import {
6
6
  quoteIdentifier
7
- } from "./chunk-JFWX35TB.js";
7
+ } from "./chunk-X2EC47W4.js";
8
8
  import {
9
9
  SQLRowLimiter
10
- } from "./chunk-JBJZJE5J.js";
10
+ } from "./chunk-XD3EZPMW.js";
11
11
  import {
12
12
  ConnectorRegistry,
13
13
  SafeURL,
14
14
  obfuscateDSNPassword,
15
15
  splitSQLStatements
16
- } from "./chunk-OSGLPOZZ.js";
16
+ } from "./chunk-Q5EJYAEZ.js";
17
17
 
18
18
  // src/connectors/mysql/index.ts
19
19
  import mysql from "mysql2/promise";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  SQLRowLimiter
3
- } from "./chunk-JBJZJE5J.js";
3
+ } from "./chunk-XD3EZPMW.js";
4
4
  import {
5
5
  ConnectorRegistry,
6
6
  SafeURL,
7
7
  obfuscateDSNPassword,
8
8
  splitSQLStatements
9
- } from "./chunk-OSGLPOZZ.js";
9
+ } from "./chunk-Q5EJYAEZ.js";
10
10
 
11
11
  // src/connectors/oracle/index.ts
12
12
  import oracledb from "oracledb";
@@ -106,7 +106,6 @@ var OracleConnector = class _OracleConnector {
106
106
  const result = await conn.execute(`
107
107
  SELECT USERNAME
108
108
  FROM ALL_USERS
109
- WHERE ORACLE_MAINTAINED = 'N'
110
109
  ORDER BY USERNAME
111
110
  `);
112
111
  return result.rows.map((row) => row.USERNAME);
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  quoteIdentifier
3
- } from "./chunk-JFWX35TB.js";
3
+ } from "./chunk-X2EC47W4.js";
4
4
  import {
5
5
  SQLRowLimiter
6
- } from "./chunk-JBJZJE5J.js";
6
+ } from "./chunk-XD3EZPMW.js";
7
7
  import {
8
8
  ConnectorRegistry,
9
9
  SafeURL,
10
10
  obfuscateDSNPassword,
11
11
  splitSQLStatements
12
- } from "./chunk-OSGLPOZZ.js";
12
+ } from "./chunk-Q5EJYAEZ.js";
13
13
 
14
14
  // src/connectors/postgres/index.ts
15
15
  import fs from "fs";