taurusdb-core 0.4.0 → 0.5.0-rc.10

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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -1
  3. package/dist/audit/jsonl-writer.d.ts +47 -0
  4. package/dist/audit/jsonl-writer.js +124 -0
  5. package/dist/auth/sql-profile-loader/env-source.js +6 -10
  6. package/dist/auth/sql-profile-loader/parsing.js +8 -5
  7. package/dist/auth/sql-profile-loader/runtime-override.d.ts +1 -0
  8. package/dist/auth/sql-profile-loader/runtime-override.js +19 -1
  9. package/dist/auth/sql-profile-loader/types.d.ts +5 -0
  10. package/dist/capability/probe.js +3 -1
  11. package/dist/cloud/auth.d.ts +1 -0
  12. package/dist/cloud/auth.js +37 -0
  13. package/dist/config/env.js +16 -0
  14. package/dist/config/schema.d.ts +78 -0
  15. package/dist/config/schema.js +19 -0
  16. package/dist/context/datasource-resolver.js +7 -0
  17. package/dist/context/session-context.d.ts +7 -0
  18. package/dist/diagnostics/replication-lag.d.ts +4 -0
  19. package/dist/diagnostics/replication-lag.js +138 -0
  20. package/dist/diagnostics/types.d.ts +5 -1
  21. package/dist/diagnostics/types.js +7 -7
  22. package/dist/engine/runtime.d.ts +2 -2
  23. package/dist/engine/runtime.js +8 -14
  24. package/dist/engine/types.d.ts +3 -2
  25. package/dist/engine.d.ts +5 -5
  26. package/dist/engine.js +32 -5
  27. package/dist/executor/bounded-sql.d.ts +1 -0
  28. package/dist/executor/bounded-sql.js +10 -0
  29. package/dist/executor/concurrency-limiter.d.ts +15 -0
  30. package/dist/executor/concurrency-limiter.js +67 -0
  31. package/dist/executor/connection-pool.d.ts +3 -2
  32. package/dist/executor/connection-pool.js +35 -24
  33. package/dist/executor/sql-executor.d.ts +3 -0
  34. package/dist/executor/sql-executor.js +52 -9
  35. package/dist/executor/types.d.ts +5 -1
  36. package/dist/index.d.ts +8 -3
  37. package/dist/index.js +5 -1
  38. package/dist/safety/confirmation-store.d.ts +30 -7
  39. package/dist/safety/confirmation-store.js +154 -30
  40. package/dist/safety/guardrail.d.ts +3 -0
  41. package/dist/safety/guardrail.js +16 -6
  42. package/dist/safety/redaction.d.ts +6 -0
  43. package/dist/safety/redaction.js +47 -6
  44. package/dist/safety/sql-classifier.d.ts +1 -0
  45. package/dist/safety/sql-classifier.js +1 -0
  46. package/dist/safety/sql-validator.d.ts +1 -0
  47. package/dist/safety/sql-validator.js +25 -1
  48. package/dist/schema/adapters/mysql.js +3 -1
  49. package/dist/taurus/flashback.js +4 -10
  50. package/dist/taurus/recycle-bin.js +2 -8
  51. package/dist/utils/formatter.d.ts +11 -2
  52. package/dist/utils/formatter.js +12 -3
  53. package/dist/utils/logger.js +8 -0
  54. package/dist/utils/mysql-identifier.d.ts +1 -0
  55. package/dist/utils/mysql-identifier.js +9 -0
  56. package/package.json +13 -2
@@ -9,7 +9,14 @@ export const ErrorCode = {
9
9
  QUERY_TIMEOUT: "QUERY_TIMEOUT",
10
10
  QUERY_CANCELLED: "QUERY_CANCELLED",
11
11
  CONNECTION_FAILED: "CONNECTION_FAILED",
12
+ DB_ENDPOINT_UNREACHABLE: "DB_ENDPOINT_UNREACHABLE",
13
+ DB_CONNECTION_REFUSED: "DB_CONNECTION_REFUSED",
14
+ DB_TLS_FAILED: "DB_TLS_FAILED",
15
+ DB_AUTH_FAILED: "DB_AUTH_FAILED",
16
+ DB_VALIDATION_TIMEOUT: "DB_VALIDATION_TIMEOUT",
12
17
  RESULT_TOO_LARGE: "RESULT_TOO_LARGE",
18
+ AUDIT_FAILED: "AUDIT_FAILED",
19
+ SERVER_BUSY: "SERVER_BUSY",
13
20
  UNSUPPORTED_FEATURE: "UNSUPPORTED_FEATURE",
14
21
  };
15
22
  export function formatSuccess(data, options) {
@@ -47,12 +54,14 @@ export function formatBlocked(options) {
47
54
  export function formatConfirmationRequired(options) {
48
55
  return formatError({
49
56
  code: ErrorCode.CONFIRMATION_REQUIRED,
50
- message: options.message ?? "Re-run the same SQL with confirmation_token to continue.",
51
- summary: options.summary ?? "This SQL will modify data and requires explicit confirmation.",
57
+ message: options.message ??
58
+ "An external operator must sign approval_request with `taurusdb-mcp approve` before retrying with approval_token.",
59
+ summary: options.summary ?? "This SQL will modify data and requires external human approval.",
52
60
  retryable: true,
53
61
  metadata: options.metadata,
54
62
  data: {
55
- confirmation_token: options.confirmationToken,
63
+ approval_request: options.approvalRequest,
64
+ request_id: options.requestId,
56
65
  risk_level: options.riskLevel,
57
66
  sql_hash: options.sqlHash,
58
67
  },
@@ -8,6 +8,14 @@ const REDACT_PATHS = [
8
8
  "secret",
9
9
  "token",
10
10
  "*.token",
11
+ "approval_token",
12
+ "*.approval_token",
13
+ "approval_request",
14
+ "*.approval_request",
15
+ "authorization",
16
+ "*.authorization",
17
+ "headers.authorization",
18
+ "*.headers.authorization",
11
19
  "accessKeyId",
12
20
  "*.accessKeyId",
13
21
  "secretAccessKey",
@@ -0,0 +1 @@
1
+ export declare function quoteMysqlIdentifier(identifier: string, fieldName?: string): string;
@@ -0,0 +1,9 @@
1
+ export function quoteMysqlIdentifier(identifier, fieldName = "identifier") {
2
+ if (identifier.length === 0) {
3
+ throw new Error(`Invalid ${fieldName}: value cannot be empty.`);
4
+ }
5
+ if (identifier.includes("\0")) {
6
+ throw new Error(`Invalid ${fieldName}: NUL bytes are not allowed.`);
7
+ }
8
+ return `\`${identifier.replace(/`/g, "``")}\``;
9
+ }
package/package.json CHANGED
@@ -1,7 +1,17 @@
1
1
  {
2
2
  "name": "taurusdb-core",
3
- "version": "0.4.0",
3
+ "version": "0.5.0-rc.10",
4
4
  "description": "Shared TaurusDB data-plane engine for schema, SQL execution, guardrails, and diagnostics.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/youweichen0208/taurus-mcp-server.git",
9
+ "directory": "packages/core"
10
+ },
11
+ "homepage": "https://github.com/youweichen0208/taurus-mcp-server#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/youweichen0208/taurus-mcp-server/issues"
14
+ },
5
15
  "type": "module",
6
16
  "main": "dist/index.js",
7
17
  "types": "dist/index.d.ts",
@@ -16,7 +26,8 @@
16
26
  "guardrails"
17
27
  ],
18
28
  "publishConfig": {
19
- "access": "public"
29
+ "access": "public",
30
+ "provenance": true
20
31
  },
21
32
  "files": [
22
33
  "dist"