@sparkelf/dsh-dataops-managed 0.3.28 → 0.3.29
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/lib/client.js +223 -164
- package/lib/client.js.map +1 -1
- package/lib/index.js +42 -7
- package/lib/types/client/DataOpsResourcesTab.d.ts +6 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1463,6 +1463,41 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
|
|
|
1463
1463
|
if (!Array.isArray(parsed)) throw new Error(tool + ": " + label + " must be a JSON array");
|
|
1464
1464
|
return parsed;
|
|
1465
1465
|
};
|
|
1466
|
+
/**
|
|
1467
|
+
* Keep only the fields the DataOps execute DTO accepts. The plan tool returns
|
|
1468
|
+
* `createSql`/`targetSchema`/`notes` beside `createTable`; if the model passes
|
|
1469
|
+
* the whole plan (or rebuilds it after a table-name edit), the backend's
|
|
1470
|
+
* `forbidNonWhitelisted` pipe rejects the call with a generic 400.
|
|
1471
|
+
*/
|
|
1472
|
+
const normalizeCreatePlan = (tool, plan) => {
|
|
1473
|
+
if (plan === void 0) return void 0;
|
|
1474
|
+
const tableName = typeof plan.tableName === "string" ? plan.tableName.trim() : "";
|
|
1475
|
+
if (!tableName) throw new Error(tool + ": create_plan_json.tableName is required");
|
|
1476
|
+
const rawColumns = Array.isArray(plan.columns) ? plan.columns : [];
|
|
1477
|
+
if (!rawColumns.length) throw new Error(tool + ": create_plan_json.columns is required");
|
|
1478
|
+
const columns = rawColumns.map((raw, index) => {
|
|
1479
|
+
const column = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
1480
|
+
const sourceKey = typeof column.sourceKey === "string" ? column.sourceKey : "";
|
|
1481
|
+
const name = typeof column.name === "string" ? column.name : "";
|
|
1482
|
+
const chineseName = typeof column.chineseName === "string" ? column.chineseName : "";
|
|
1483
|
+
const dataType = typeof column.dataType === "string" ? column.dataType : "";
|
|
1484
|
+
if (!sourceKey || !name || !chineseName || !dataType) throw new Error(tool + ": create_plan_json.columns[" + index + "] needs sourceKey/name/chineseName/dataType");
|
|
1485
|
+
return {
|
|
1486
|
+
sourceKey,
|
|
1487
|
+
name,
|
|
1488
|
+
chineseName,
|
|
1489
|
+
dataType,
|
|
1490
|
+
...typeof column.nullable === "boolean" ? { nullable: column.nullable } : {},
|
|
1491
|
+
...typeof column.comment === "string" ? { comment: column.comment } : {}
|
|
1492
|
+
};
|
|
1493
|
+
});
|
|
1494
|
+
return {
|
|
1495
|
+
tableName,
|
|
1496
|
+
...typeof plan.tableChineseName === "string" && plan.tableChineseName.trim() ? { tableChineseName: plan.tableChineseName.trim() } : {},
|
|
1497
|
+
...typeof plan.tableComment === "string" && plan.tableComment.trim() ? { tableComment: plan.tableComment.trim() } : {},
|
|
1498
|
+
columns
|
|
1499
|
+
};
|
|
1500
|
+
};
|
|
1466
1501
|
return [
|
|
1467
1502
|
{
|
|
1468
1503
|
name: "skill_list",
|
|
@@ -1949,7 +1984,7 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
|
|
|
1949
1984
|
name: "dataops_collect_execute",
|
|
1950
1985
|
definition: defineTool({
|
|
1951
1986
|
name: "dataops_collect_execute",
|
|
1952
|
-
description: "Execute one confirmed spreadsheet import: create a table (or write to an existing table), insert rows, and register the DataOps resource. This is the ONLY collection tool that mutates data. Call it only after the user explicitly
|
|
1987
|
+
description: "Execute one confirmed spreadsheet import: create a table (or write to an existing table), insert rows, and register the DataOps resource. This is the ONLY collection tool that mutates data. Call it only after the user explicitly confirms the read-only plan in natural language (e.g. 确认/开始吧); never call it while the plan is still being edited.",
|
|
1953
1988
|
parameters: {
|
|
1954
1989
|
session_id: {
|
|
1955
1990
|
type: "string",
|
|
@@ -1976,7 +2011,7 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
|
|
|
1976
2011
|
},
|
|
1977
2012
|
create_plan_json: {
|
|
1978
2013
|
type: "string",
|
|
1979
|
-
description: "
|
|
2014
|
+
description: "Only plan.createTable (tableName/tableChineseName/tableComment/columns). Do not send createSql/targetSchema/notes; if the user edits the table name, call dataops_collect_plan again and pass its createTable."
|
|
1980
2015
|
},
|
|
1981
2016
|
mappings_json: {
|
|
1982
2017
|
type: "string",
|
|
@@ -2010,7 +2045,7 @@ function buildAiManagementTools(ctx, reviewApi, readScope, collectHub) {
|
|
|
2010
2045
|
},
|
|
2011
2046
|
execute: async (args, exec) => {
|
|
2012
2047
|
if (args.mode !== "CREATE_TABLE" && args.mode !== "EXISTING_TABLE") throw new Error("dataops_collect_execute: mode must be CREATE_TABLE or EXISTING_TABLE");
|
|
2013
|
-
const createPlan = parseJsonObject("dataops_collect_execute", "create_plan_json", args.create_plan_json);
|
|
2048
|
+
const createPlan = normalizeCreatePlan("dataops_collect_execute", parseJsonObject("dataops_collect_execute", "create_plan_json", args.create_plan_json));
|
|
2014
2049
|
const mappings = parseJsonArray("dataops_collect_execute", "mappings_json", args.mappings_json);
|
|
2015
2050
|
if (args.mode === "CREATE_TABLE" && createPlan === void 0) throw new Error("dataops_collect_execute: create_plan_json is required for CREATE_TABLE");
|
|
2016
2051
|
if (args.mode === "EXISTING_TABLE" && (!args.target_schema || !args.target_table)) throw new Error("dataops_collect_execute: target_schema and target_table are required for EXISTING_TABLE");
|
|
@@ -2433,10 +2468,10 @@ const CONNECTOR_STATE_PATH = join(process.env.DSH_HOME?.trim() || "/workspace/.d
|
|
|
2433
2468
|
/**
|
|
2434
2469
|
* Capability definitions before permission filtering.
|
|
2435
2470
|
*
|
|
2436
|
-
* The set
|
|
2437
|
-
*
|
|
2438
|
-
* Skill plaza and review queue are governed by
|
|
2439
|
-
* connector's capability switches.
|
|
2471
|
+
* The set follows `dataops/docs/dataops-connector-development-spec.md` §2.3's credential list.
|
|
2472
|
+
* `approval.push` was renamed to `resource.manage` when the capability grew from approval push
|
|
2473
|
+
* into resource approval and authorization. Skill plaza and review queue are governed by
|
|
2474
|
+
* `skill:*` permissions and stay out of the connector's capability switches.
|
|
2440
2475
|
*/
|
|
2441
2476
|
const CAPABILITIES = [
|
|
2442
2477
|
{
|
|
@@ -21,7 +21,11 @@ export interface DataOpsResourcesTabProps {
|
|
|
21
21
|
};
|
|
22
22
|
tab: ResourceTabRecord;
|
|
23
23
|
visible?: boolean;
|
|
24
|
-
|
|
24
|
+
insertResourceReference?: (resource: {
|
|
25
|
+
id?: unknown;
|
|
26
|
+
name?: unknown;
|
|
27
|
+
table?: unknown;
|
|
28
|
+
}, reference: Record<string, unknown>, sessionId?: string) => void;
|
|
25
29
|
}
|
|
26
30
|
/** Render the embedded DataOps resource page and translate its parent messages. */
|
|
27
|
-
export declare function DataOpsResourcesTab({ tab, scope,
|
|
31
|
+
export declare function DataOpsResourcesTab({ tab, scope, insertResourceReference }: DataOpsResourcesTabProps): import("react").JSX.Element;
|
package/package.json
CHANGED