@bytebase/dbhub 0.4.6 → 0.4.8

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 (3) hide show
  1. package/README.md +18 -0
  2. package/dist/index.js +10 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -338,6 +338,24 @@ The demo mode uses an in-memory SQLite database loaded with the [sample employee
338
338
  pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
339
339
  ```
340
340
 
341
+ ### Testing
342
+
343
+ The project uses Vitest for testing:
344
+
345
+ - Run tests: `pnpm test`
346
+ - Run tests in watch mode: `pnpm test:watch`
347
+
348
+ #### Pre-commit Hooks (for Developers)
349
+
350
+ The project includes pre-commit hooks to run tests automatically before each commit:
351
+
352
+ 1. After cloning the repository, set up the pre-commit hooks:
353
+ ```bash
354
+ ./scripts/setup-husky.sh
355
+ ```
356
+
357
+ 2. This ensures the test suite runs automatically whenever you create a commit, preventing commits that would break tests.
358
+
341
359
  ### Debug with [MCP Inspector](https://github.com/modelcontextprotocol/inspector)
342
360
 
343
361
  #### stdio
package/dist/index.js CHANGED
@@ -2481,6 +2481,12 @@ function getSqliteInMemorySetupSql() {
2481
2481
  import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
2482
2482
 
2483
2483
  // src/utils/response-formatter.ts
2484
+ function bigIntReplacer(_key, value) {
2485
+ if (typeof value === "bigint") {
2486
+ return value.toString();
2487
+ }
2488
+ return value;
2489
+ }
2484
2490
  function formatSuccessResponse(data, meta = {}) {
2485
2491
  return {
2486
2492
  success: true,
@@ -2501,7 +2507,7 @@ function createToolErrorResponse(error, code = "ERROR", details) {
2501
2507
  content: [
2502
2508
  {
2503
2509
  type: "text",
2504
- text: JSON.stringify(formatErrorResponse(error, code, details), null, 2),
2510
+ text: JSON.stringify(formatErrorResponse(error, code, details), bigIntReplacer, 2),
2505
2511
  mimeType: "application/json"
2506
2512
  }
2507
2513
  ],
@@ -2513,7 +2519,7 @@ function createToolSuccessResponse(data, meta = {}) {
2513
2519
  content: [
2514
2520
  {
2515
2521
  type: "text",
2516
- text: JSON.stringify(formatSuccessResponse(data, meta), null, 2),
2522
+ text: JSON.stringify(formatSuccessResponse(data, meta), bigIntReplacer, 2),
2517
2523
  mimeType: "application/json"
2518
2524
  }
2519
2525
  ]
@@ -2524,7 +2530,7 @@ function createResourceErrorResponse(uri, error, code = "ERROR", details) {
2524
2530
  contents: [
2525
2531
  {
2526
2532
  uri,
2527
- text: JSON.stringify(formatErrorResponse(error, code, details), null, 2),
2533
+ text: JSON.stringify(formatErrorResponse(error, code, details), bigIntReplacer, 2),
2528
2534
  mimeType: "application/json"
2529
2535
  }
2530
2536
  ]
@@ -2535,7 +2541,7 @@ function createResourceSuccessResponse(uri, data, meta = {}) {
2535
2541
  contents: [
2536
2542
  {
2537
2543
  uri,
2538
- text: JSON.stringify(formatSuccessResponse(data, meta), null, 2),
2544
+ text: JSON.stringify(formatSuccessResponse(data, meta), bigIntReplacer, 2),
2539
2545
  mimeType: "application/json"
2540
2546
  }
2541
2547
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebase/dbhub",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Universal Database MCP Server",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",