@yejiming/dsh-data-agent 0.1.0 → 0.1.2
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.en.md +37 -49
- package/README.md +37 -49
- package/dsh-plugin.json +1 -1
- package/lib/{catalog-DEJqOXRo.js → catalog-CbxIDQBG.js} +1 -1
- package/lib/client.js +147 -147
- package/lib/client.js.map +1 -1
- package/lib/{command-CzzSPmag.js → command-scZcZG11.js} +1 -1
- package/lib/command.js +1 -1
- package/lib/{connections-CFXOZTHZ.js → connections-dGPjgsGg.js} +11 -10
- package/lib/index.js +4 -4
- package/lib/routes.js +2 -2
- package/lib/{tool-DNkywSph.js → tool-Du1EadNP.js} +1 -1
- package/lib/tool.js +1 -1
- package/lib/types/clients.d.ts +7 -7
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as isDatabaseType, S as defaultDatabasePort$1, b as DATABASE_TYPES, i as validatePasswordRef, r as redactSecretText, x as databaseTypeLabel$1 } from "./connections-
|
|
1
|
+
import { C as isDatabaseType, S as defaultDatabasePort$1, b as DATABASE_TYPES, i as validatePasswordRef, r as redactSecretText, x as databaseTypeLabel$1 } from "./connections-dGPjgsGg.js";
|
|
2
2
|
import { RUN_CODE_NAME } from "@deepseek-ai/dsh-tools";
|
|
3
3
|
//#region src/tui-connection-form.ts
|
|
4
4
|
/**
|
package/lib/command.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as executeDatabaseCommand, c as isDshTuiPluginLoaded, d as parseDatabaseAction, i as apply, l as name, n as DATA_AGENT_TOOL_NAMES, o as formatConnectionStatus, r as DSH_TUI_PLUGIN_RUNTIME_NAME, s as inject, t as DATABASE_COMMAND_USAGE, u as parseConnectArguments } from "./command-
|
|
1
|
+
import { a as executeDatabaseCommand, c as isDshTuiPluginLoaded, d as parseDatabaseAction, i as apply, l as name, n as DATA_AGENT_TOOL_NAMES, o as formatConnectionStatus, r as DSH_TUI_PLUGIN_RUNTIME_NAME, s as inject, t as DATABASE_COMMAND_USAGE, u as parseConnectArguments } from "./command-scZcZG11.js";
|
|
2
2
|
export { DATABASE_COMMAND_USAGE, DATA_AGENT_TOOL_NAMES, DSH_TUI_PLUGIN_RUNTIME_NAME, apply, executeDatabaseCommand, formatConnectionStatus, inject, isDshTuiPluginLoaded, name, parseConnectArguments, parseDatabaseAction };
|
|
@@ -807,16 +807,16 @@ function rewriteTopLevelLimit(sql, maxRows) {
|
|
|
807
807
|
}
|
|
808
808
|
return sql;
|
|
809
809
|
}
|
|
810
|
+
const METADATA_IDENTIFIER = /^[\p{L}\p{M}\p{N}_$]+$/u;
|
|
810
811
|
/**
|
|
811
812
|
* Validate and quote one schema/table identifier for a safe metadata query.
|
|
812
|
-
* Identifiers
|
|
813
|
-
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
* `"`, `.`, `-` are all refused).
|
|
813
|
+
* Identifiers accept Unicode letters, combining marks and numbers plus `_`/`$`
|
|
814
|
+
* without normalizing or case-folding the database-provided text. Each value is
|
|
815
|
+
* then wrapped for its dialect. Whitespace, controls, punctuation and quoting
|
|
816
|
+
* delimiters remain outside the deliberately narrow metadata-input boundary.
|
|
817
817
|
*/
|
|
818
818
|
function sanitizeIdentifier(type, identifier) {
|
|
819
|
-
if (
|
|
819
|
+
if (!METADATA_IDENTIFIER.test(identifier)) throw new Error(`标识符含非法字符(仅允许 Unicode 字母、组合标记、数字与 _ $):${identifier}`);
|
|
820
820
|
switch (type) {
|
|
821
821
|
case "mysql":
|
|
822
822
|
case "doris":
|
|
@@ -834,8 +834,8 @@ function sanitizeIdentifier(type, identifier) {
|
|
|
834
834
|
* interior `'` doubled). postgres/oracle metadata queries filter system
|
|
835
835
|
* catalogs by NAME (a string value), not by identifier, so those positions
|
|
836
836
|
* need a quoted literal — not {@link sanitizeIdentifier}'s identifier quoting.
|
|
837
|
-
* The whitelist
|
|
838
|
-
*
|
|
837
|
+
* The whitelist excludes `'`, so doubling is a defense-in-depth no-op here but
|
|
838
|
+
* keeps the helper correct for any future widened metadata-input boundary.
|
|
839
839
|
*/
|
|
840
840
|
function quoteStringLiteral(value) {
|
|
841
841
|
return "'" + value.replace(/'/g, "''") + "'";
|
|
@@ -1124,8 +1124,9 @@ function tableListingSql(type, connection) {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
1126
|
/**
|
|
1127
|
-
* Metadata query per kind × type. `schema`/`table` are
|
|
1128
|
-
*
|
|
1127
|
+
* Metadata query per kind × type. `schema`/`table` are validated by the shared
|
|
1128
|
+
* connection service before they reach here; builders still quote identifier
|
|
1129
|
+
* positions or escape value positions rather than concatenating raw text.
|
|
1129
1130
|
*/
|
|
1130
1131
|
function metadataQuery(kind, type, schema, table) {
|
|
1131
1132
|
switch (kind) {
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as clientsSchema, b as DATABASE_TYPES, c as DEFAULT_CATALOG_MAX_RESULT_CHARS, d as DEFAULT_CONNECT_TIMEOUT_MS, f as DEFAULT_MAX_QUERY_CHARS, h as DEFAULT_QUERY_TIMEOUT_MS, l as DEFAULT_CATALOG_MAX_TEXT_CHARS, m as DEFAULT_PRESET_ID, p as DEFAULT_MAX_RESULT_CHARS, s as DEFAULT_CATALOG_MAX_ASSETS, t as createConnectionService, u as DEFAULT_CATALOG_QUERY_TIMEOUT_MS } from "./connections-
|
|
2
|
-
import { a as catalogDateTimeSchema, c as catalogRunSchema, f as catalogSemanticEntrySchema, i as catalogAssetRevisionSchema, m as catalogSourceSchema, n as createCatalogService, o as catalogObservationSchema, p as catalogSemanticRevisionSchema, r as catalogAssetHeadSchema, s as catalogRelationSchema, u as catalogSearchItemSchema } from "./catalog-
|
|
3
|
-
import { i as apply$1 } from "./command-
|
|
4
|
-
import { n as apply$2 } from "./tool-
|
|
1
|
+
import { _ as clientsSchema, b as DATABASE_TYPES, c as DEFAULT_CATALOG_MAX_RESULT_CHARS, d as DEFAULT_CONNECT_TIMEOUT_MS, f as DEFAULT_MAX_QUERY_CHARS, h as DEFAULT_QUERY_TIMEOUT_MS, l as DEFAULT_CATALOG_MAX_TEXT_CHARS, m as DEFAULT_PRESET_ID, p as DEFAULT_MAX_RESULT_CHARS, s as DEFAULT_CATALOG_MAX_ASSETS, t as createConnectionService, u as DEFAULT_CATALOG_QUERY_TIMEOUT_MS } from "./connections-dGPjgsGg.js";
|
|
2
|
+
import { a as catalogDateTimeSchema, c as catalogRunSchema, f as catalogSemanticEntrySchema, i as catalogAssetRevisionSchema, m as catalogSourceSchema, n as createCatalogService, o as catalogObservationSchema, p as catalogSemanticRevisionSchema, r as catalogAssetHeadSchema, s as catalogRelationSchema, u as catalogSearchItemSchema } from "./catalog-CbxIDQBG.js";
|
|
3
|
+
import { i as apply$1 } from "./command-scZcZG11.js";
|
|
4
|
+
import { n as apply$2 } from "./tool-Du1EadNP.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { access, cp, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
7
7
|
import { homedir } from "node:os";
|
package/lib/routes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as isDatabaseType, b as DATABASE_TYPES, d as DEFAULT_CONNECT_TIMEOUT_MS, f as DEFAULT_MAX_QUERY_CHARS, h as DEFAULT_QUERY_TIMEOUT_MS, p as DEFAULT_MAX_RESULT_CHARS } from "./connections-
|
|
2
|
-
import { d as catalogSearchRequestSchema, h as semanticDefinitionSchema, l as catalogScopeSchema, t as CatalogVersionConflictError } from "./catalog-
|
|
1
|
+
import { C as isDatabaseType, b as DATABASE_TYPES, d as DEFAULT_CONNECT_TIMEOUT_MS, f as DEFAULT_MAX_QUERY_CHARS, h as DEFAULT_QUERY_TIMEOUT_MS, p as DEFAULT_MAX_RESULT_CHARS } from "./connections-dGPjgsGg.js";
|
|
2
|
+
import { d as catalogSearchRequestSchema, h as semanticDefinitionSchema, l as catalogScopeSchema, t as CatalogVersionConflictError } from "./catalog-CbxIDQBG.js";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import z from "schemastery";
|
|
5
5
|
import { z as z$1 } from "zod";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as clientsSchema, a as parseStructuredQueryOutput, f as DEFAULT_MAX_QUERY_CHARS, g as classifyStatement, h as DEFAULT_QUERY_TIMEOUT_MS, n as redactQueryResult, o as runClientQuery, p as DEFAULT_MAX_RESULT_CHARS, r as redactSecretText, v as enforceReadRowLimit, y as assertSingleStatement } from "./connections-
|
|
1
|
+
import { _ as clientsSchema, a as parseStructuredQueryOutput, f as DEFAULT_MAX_QUERY_CHARS, g as classifyStatement, h as DEFAULT_QUERY_TIMEOUT_MS, n as redactQueryResult, o as runClientQuery, p as DEFAULT_MAX_RESULT_CHARS, r as redactSecretText, v as enforceReadRowLimit, y as assertSingleStatement } from "./connections-dGPjgsGg.js";
|
|
2
2
|
import { l as normalizeCatalogText } from "./catalog-identity-CVftmvQL.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { link, mkdir, unlink, writeFile } from "node:fs/promises";
|
package/lib/tool.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as name, n as apply, r as inject, t as Config } from "./tool-
|
|
1
|
+
import { i as name, n as apply, r as inject, t as Config } from "./tool-Du1EadNP.js";
|
|
2
2
|
export { Config, apply, inject, name };
|
package/lib/types/clients.d.ts
CHANGED
|
@@ -38,11 +38,10 @@ export declare function enforceReadRowLimit(sql: string, type: DatabaseType, max
|
|
|
38
38
|
export declare const SQLSERVER_COLUMN_SEPARATOR = "\u001F";
|
|
39
39
|
/**
|
|
40
40
|
* Validate and quote one schema/table identifier for a safe metadata query.
|
|
41
|
-
* Identifiers
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* `"`, `.`, `-` are all refused).
|
|
41
|
+
* Identifiers accept Unicode letters, combining marks and numbers plus `_`/`$`
|
|
42
|
+
* without normalizing or case-folding the database-provided text. Each value is
|
|
43
|
+
* then wrapped for its dialect. Whitespace, controls, punctuation and quoting
|
|
44
|
+
* delimiters remain outside the deliberately narrow metadata-input boundary.
|
|
46
45
|
*/
|
|
47
46
|
export declare function sanitizeIdentifier(type: DatabaseType, identifier: string): string;
|
|
48
47
|
/** One deployment override for a database type's CLI client. */
|
|
@@ -112,8 +111,9 @@ export declare function buildStructuredQueryTemplate(type: DatabaseType, connect
|
|
|
112
111
|
*/
|
|
113
112
|
export declare function tableListingSql(type: DatabaseType, connection?: DatabaseConnection): string;
|
|
114
113
|
/**
|
|
115
|
-
* Metadata query per kind × type. `schema`/`table` are
|
|
116
|
-
*
|
|
114
|
+
* Metadata query per kind × type. `schema`/`table` are validated by the shared
|
|
115
|
+
* connection service before they reach here; builders still quote identifier
|
|
116
|
+
* positions or escape value positions rather than concatenating raw text.
|
|
117
117
|
*/
|
|
118
118
|
export declare function metadataQuery(kind: 'schemas' | 'tables' | 'describe', type: DatabaseType, schema?: string, table?: string): string;
|
|
119
119
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yejiming/dsh-data-agent",
|
|
3
3
|
"description": "Data Agent for DSH Web and TUI: shared database connections, versioned metadata Catalog governance, secure credentials, SQL and Catalog tools, and the data-agent preset",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|