@zz1996/dbhub-dameng 0.1.7 → 1.2.5-dameng.621

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 (32) hide show
  1. package/README.md +126 -137
  2. package/dbhub.dameng.toml.example +4 -11
  3. package/dist/{chunk-SQA2ISDE.js → chunk-2JL4KCP5.js} +21 -119
  4. package/dist/chunk-3RJRH3CN.js +121 -0
  5. package/dist/chunk-4276LPPU.js +179 -0
  6. package/dist/chunk-FU2ZJE4E.js +16 -0
  7. package/dist/chunk-HDPZAIDL.js +155 -0
  8. package/dist/{chunk-2A2QF3CS.js → chunk-HGU7ILEZ.js} +215 -68
  9. package/dist/{chunk-IPK7BYBL.js → chunk-JFWX35TB.js} +0 -1
  10. package/dist/chunk-O3PEWKBB.js +302 -0
  11. package/dist/dameng-NKF7NZKE.js +250 -0
  12. package/dist/index.js +461 -251
  13. package/dist/{mariadb-7F72IRB4.js → mariadb-MMC6WMEG.js} +86 -53
  14. package/dist/{mysql-A43SL7UM.js → mysql-TESH7KKV.js} +126 -50
  15. package/dist/{postgres-VFNLBWMF.js → postgres-C24SBQ4I.js} +154 -36
  16. package/dist/public/assets/index-BJ-1UrcV.css +1 -0
  17. package/dist/public/assets/index-BdBaFSHd.js +148 -0
  18. package/dist/public/assets/postgres-BpcazhJg.svg +22 -0
  19. package/dist/public/assets/sqlserver-ByfFYYpV.svg +11 -0
  20. package/dist/public/favicon.svg +57 -0
  21. package/dist/public/index.html +14 -0
  22. package/dist/public/logo-full-light.svg +58 -0
  23. package/dist/{registry-XSX2VZTD.js → registry-WVSFVS35.js} +3 -2
  24. package/dist/{sqlite-IOUAYHGE.js → sqlite-7BNGDMBZ.js} +57 -42
  25. package/dist/sqlserver-KZPPK67Q.js +1042 -0
  26. package/package.json +22 -65
  27. package/dist/chunk-RTB262PR.js +0 -60
  28. package/dist/chunk-ZNQTMARG.js +0 -127
  29. package/dist/dameng-5KYI5JBK.js +0 -898
  30. package/dist/sqlserver-OE4SFH4B.js +0 -587
  31. package/docs/README.md +0 -14
  32. package/docs/dameng-connector-plan.md +0 -143
package/package.json CHANGED
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "name": "@zz1996/dbhub-dameng",
3
- "version": "0.1.7",
3
+ "version": "1.2.5-dameng.621",
4
4
  "mcpName": "io.github.zuozh11/dbhub-dameng",
5
- "description": "Local fork of DBHub with Dameng/DM8 database connector support",
5
+ "description": "DBHub with a minimal Dameng/DM8 connector",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/zuozh11/dbhub-dameng.git"
9
9
  },
10
- "homepage": "https://github.com/zuozh11/dbhub-dameng#readme",
11
- "bugs": {
12
- "url": "https://github.com/zuozh11/dbhub-dameng/issues"
13
- },
14
10
  "main": "dist/index.js",
15
11
  "type": "module",
16
12
  "bin": {
@@ -18,83 +14,36 @@
18
14
  },
19
15
  "files": [
20
16
  "dist",
21
- "dbhub.dameng.toml.example",
22
- "docs/dameng-connector-plan.md",
23
17
  "LICENSE",
24
- "README.md"
18
+ "README.md",
19
+ "dbhub.dameng.toml.example"
25
20
  ],
26
- "publishConfig": {
27
- "access": "public"
28
- },
29
- "scripts": {
30
- "build": "pnpm run generate:api-types && tsup && cd frontend && pnpm run build",
31
- "build:backend": "npm run generate:api-types && tsup",
32
- "build:frontend": "cd frontend && pnpm run build",
33
- "start": "node dist/index.js",
34
- "dev": "concurrently --kill-others \"pnpm run dev:backend\" \"pnpm run dev:frontend\"",
35
- "dev:backend": "NODE_ENV=development tsx src/index.ts --transport=http",
36
- "dev:frontend": "cd frontend && pnpm run dev",
37
- "crossdev": "cross-env NODE_ENV=development tsx src/index.ts",
38
- "generate:api-types": "openapi-typescript src/api/openapi.yaml -o src/api/openapi.d.ts",
39
- "test": "vitest run",
40
- "test:unit": "vitest run --project unit",
41
- "test:watch": "vitest",
42
- "test:integration": "vitest run --project integration",
43
- "test:build": "node scripts/smoke-test-build.mjs",
44
- "verify:dameng": "tsx scripts/verify-dameng.mjs",
45
- "prepublishOnly": "npm run build:backend"
46
- },
21
+ "scripts": {},
47
22
  "engines": {
48
23
  "node": ">=22.5.0"
49
24
  },
50
- "packageManager": "pnpm@10.17.1",
51
- "keywords": [
52
- "mcp",
53
- "database",
54
- "dbhub",
55
- "dameng",
56
- "dm8"
57
- ],
58
- "author": "zuozh11",
25
+ "keywords": [],
26
+ "author": "",
59
27
  "license": "MIT",
60
28
  "dependencies": {
61
29
  "@iarna/toml": "^2.2.5",
62
- "@modelcontextprotocol/sdk": "^1.25.1",
30
+ "@modelcontextprotocol/node": "^2.0.0",
31
+ "@modelcontextprotocol/server": "^2.0.0",
63
32
  "dotenv": "^16.4.7",
64
33
  "express": "^4.18.2",
65
34
  "ssh-config": "^5.0.3",
66
35
  "ssh2": "^1.16.0",
67
- "zod": "^3.24.2"
36
+ "zod": "^4.2.0"
68
37
  },
69
38
  "optionalDependencies": {
39
+ "@aws-sdk/credential-providers": "^3.1001.0",
70
40
  "@aws-sdk/rds-signer": "^3.1001.0",
71
41
  "@azure/identity": "^4.8.0",
42
+ "dmdb": "1.0.52452",
72
43
  "mariadb": "^3.4.0",
73
44
  "mssql": "^11.0.1",
74
45
  "mysql2": "^3.13.0",
75
- "pg": "^8.13.3",
76
- "dmdb": "^1.0.49630"
77
- },
78
- "devDependencies": {
79
- "@testcontainers/mariadb": "^11.0.3",
80
- "@testcontainers/mssqlserver": "^11.0.3",
81
- "@testcontainers/mysql": "^11.0.3",
82
- "@testcontainers/postgresql": "^11.0.3",
83
- "@types/express": "^4.17.21",
84
- "@types/mssql": "^9.1.7",
85
- "@types/node": "^22.13.10",
86
- "@types/pg": "^8.11.11",
87
- "@types/ssh2": "^1.15.5",
88
- "concurrently": "^9.2.1",
89
- "cross-env": "^7.0.3",
90
- "openapi-typescript": "^7.10.1",
91
- "prettier": "^3.5.3",
92
- "testcontainers": "^11.0.3",
93
- "ts-node": "^10.9.2",
94
- "tsup": "^8.4.0",
95
- "tsx": "^4.19.3",
96
- "typescript": "^5.8.2",
97
- "vitest": "^4.0.6"
46
+ "pg": "^8.13.3"
98
47
  },
99
48
  "compilerOptions": {
100
49
  "target": "ES2020",
@@ -107,5 +56,13 @@
107
56
  },
108
57
  "include": [
109
58
  "src/**/*"
110
- ]
59
+ ],
60
+ "homepage": "https://github.com/zuozh11/dbhub-dameng/blob/main/README.md",
61
+ "bugs": {
62
+ "url": "https://github.com/zuozh11/dbhub-dameng/issues"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public",
66
+ "registry": "https://registry.npmjs.org"
67
+ }
111
68
  }
@@ -1,60 +0,0 @@
1
- // src/utils/multi-statement-result-parser.ts
2
- function isMetadataObject(element) {
3
- if (!element || typeof element !== "object" || Array.isArray(element)) {
4
- return false;
5
- }
6
- return "affectedRows" in element || "insertId" in element || "fieldCount" in element || "warningStatus" in element;
7
- }
8
- function isMultiStatementResult(results) {
9
- if (!Array.isArray(results) || results.length === 0) {
10
- return false;
11
- }
12
- const firstElement = results[0];
13
- return isMetadataObject(firstElement) || Array.isArray(firstElement);
14
- }
15
- function extractRowsFromMultiStatement(results) {
16
- if (!Array.isArray(results)) {
17
- return [];
18
- }
19
- const allRows = [];
20
- for (const result of results) {
21
- if (Array.isArray(result)) {
22
- allRows.push(...result);
23
- }
24
- }
25
- return allRows;
26
- }
27
- function extractAffectedRows(results) {
28
- if (isMetadataObject(results)) {
29
- return results.affectedRows || 0;
30
- }
31
- if (!Array.isArray(results)) {
32
- return 0;
33
- }
34
- if (isMultiStatementResult(results)) {
35
- let totalAffected = 0;
36
- for (const result of results) {
37
- if (isMetadataObject(result)) {
38
- totalAffected += result.affectedRows || 0;
39
- } else if (Array.isArray(result)) {
40
- totalAffected += result.length;
41
- }
42
- }
43
- return totalAffected;
44
- }
45
- return results.length;
46
- }
47
- function parseQueryResults(results) {
48
- if (!Array.isArray(results)) {
49
- return [];
50
- }
51
- if (isMultiStatementResult(results)) {
52
- return extractRowsFromMultiStatement(results);
53
- }
54
- return results;
55
- }
56
-
57
- export {
58
- extractAffectedRows,
59
- parseQueryResults
60
- };
@@ -1,127 +0,0 @@
1
- import {
2
- stripCommentsAndStrings
3
- } from "./chunk-SQA2ISDE.js";
4
-
5
- // src/utils/sql-row-limiter.ts
6
- var SQLRowLimiter = class {
7
- /**
8
- * Check if a SQL statement is a SELECT query that can benefit from row limiting
9
- * Only handles SELECT queries
10
- */
11
- static isSelectQuery(sql) {
12
- const trimmed = sql.trim().toLowerCase();
13
- return trimmed.startsWith("select");
14
- }
15
- /**
16
- * Check if a SQL statement already has a LIMIT clause.
17
- * Strips comments and string literals first to avoid false positives.
18
- */
19
- static hasLimitClause(sql) {
20
- const cleanedSQL = stripCommentsAndStrings(sql);
21
- const limitRegex = /\blimit\s+(?:\d+|\$\d+|\?|@p\d+)/i;
22
- return limitRegex.test(cleanedSQL);
23
- }
24
- /**
25
- * Check if a SQL statement already has a TOP clause (SQL Server).
26
- * Strips comments and string literals first to avoid false positives.
27
- */
28
- static hasTopClause(sql) {
29
- const cleanedSQL = stripCommentsAndStrings(sql);
30
- const topRegex = /\bselect\s+top\s+\d+/i;
31
- return topRegex.test(cleanedSQL);
32
- }
33
- /**
34
- * Extract existing LIMIT value from SQL if present.
35
- * Strips comments and string literals first to avoid false positives.
36
- */
37
- static extractLimitValue(sql) {
38
- const cleanedSQL = stripCommentsAndStrings(sql);
39
- const limitMatch = cleanedSQL.match(/\blimit\s+(\d+)/i);
40
- if (limitMatch) {
41
- return parseInt(limitMatch[1], 10);
42
- }
43
- return null;
44
- }
45
- /**
46
- * Extract existing TOP value from SQL if present (SQL Server).
47
- * Strips comments and string literals first to avoid false positives.
48
- */
49
- static extractTopValue(sql) {
50
- const cleanedSQL = stripCommentsAndStrings(sql);
51
- const topMatch = cleanedSQL.match(/\bselect\s+top\s+(\d+)/i);
52
- if (topMatch) {
53
- return parseInt(topMatch[1], 10);
54
- }
55
- return null;
56
- }
57
- /**
58
- * Add or modify LIMIT clause in a SQL statement
59
- */
60
- static applyLimitToQuery(sql, maxRows) {
61
- const existingLimit = this.extractLimitValue(sql);
62
- if (existingLimit !== null) {
63
- const effectiveLimit = Math.min(existingLimit, maxRows);
64
- return sql.replace(/\blimit\s+\d+/i, `LIMIT ${effectiveLimit}`);
65
- } else {
66
- const trimmed = sql.trim();
67
- const hasSemicolon = trimmed.endsWith(";");
68
- const sqlWithoutSemicolon = hasSemicolon ? trimmed.slice(0, -1) : trimmed;
69
- return `${sqlWithoutSemicolon} LIMIT ${maxRows}${hasSemicolon ? ";" : ""}`;
70
- }
71
- }
72
- /**
73
- * Add or modify TOP clause in a SQL statement (SQL Server)
74
- */
75
- static applyTopToQuery(sql, maxRows) {
76
- const existingTop = this.extractTopValue(sql);
77
- if (existingTop !== null) {
78
- const effectiveTop = Math.min(existingTop, maxRows);
79
- return sql.replace(/\bselect\s+top\s+\d+/i, `SELECT TOP ${effectiveTop}`);
80
- } else {
81
- return sql.replace(/\bselect\s+/i, `SELECT TOP ${maxRows} `);
82
- }
83
- }
84
- /**
85
- * Check if a LIMIT clause uses a parameter placeholder (not a literal number).
86
- * Strips comments and string literals first to avoid false positives.
87
- */
88
- static hasParameterizedLimit(sql) {
89
- const cleanedSQL = stripCommentsAndStrings(sql);
90
- const parameterizedLimitRegex = /\blimit\s+(?:\$\d+|\?|@p\d+)/i;
91
- return parameterizedLimitRegex.test(cleanedSQL);
92
- }
93
- /**
94
- * Apply maxRows limit to a SELECT query only
95
- *
96
- * This method is used by PostgreSQL, MySQL, MariaDB, and SQLite connectors which all support
97
- * the LIMIT clause syntax. SQL Server uses applyMaxRowsForSQLServer() instead with TOP syntax.
98
- *
99
- * For parameterized LIMIT clauses (e.g., LIMIT $1 or LIMIT ?), we wrap the query in a subquery
100
- * to enforce max_rows as a hard cap, since the parameter value is not known until runtime.
101
- */
102
- static applyMaxRows(sql, maxRows) {
103
- if (!maxRows || !this.isSelectQuery(sql)) {
104
- return sql;
105
- }
106
- if (this.hasParameterizedLimit(sql)) {
107
- const trimmed = sql.trim();
108
- const hasSemicolon = trimmed.endsWith(";");
109
- const sqlWithoutSemicolon = hasSemicolon ? trimmed.slice(0, -1) : trimmed;
110
- return `SELECT * FROM (${sqlWithoutSemicolon}) AS subq LIMIT ${maxRows}${hasSemicolon ? ";" : ""}`;
111
- }
112
- return this.applyLimitToQuery(sql, maxRows);
113
- }
114
- /**
115
- * Apply maxRows limit to a SELECT query using SQL Server TOP syntax
116
- */
117
- static applyMaxRowsForSQLServer(sql, maxRows) {
118
- if (!maxRows || !this.isSelectQuery(sql)) {
119
- return sql;
120
- }
121
- return this.applyTopToQuery(sql, maxRows);
122
- }
123
- };
124
-
125
- export {
126
- SQLRowLimiter
127
- };