e10-data 0.1.13 → 0.1.14
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.md +20 -16
- package/bin/e10-data.mjs +25 -50
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -112,33 +112,37 @@ e10-data conf delete GET_WORKFLOW_LIST --type api --group workflow
|
|
|
112
112
|
- 同一 `confKey` 可存在于多个 `confGroup`;`conf batch` / `batch-file` 的返回映射在带分组时以 `组|键` 为键,不会互相覆盖。
|
|
113
113
|
- `--json` 输出:`conf group` 返回配置数组(带 `--key` 时返回单条),`conf batch` 返回映射对象。
|
|
114
114
|
|
|
115
|
-
## ds appId
|
|
115
|
+
## ds appId:由调用方显式传入(v0.1.14 变更,自动解析已移除)
|
|
116
116
|
|
|
117
|
-
ChatBI 数据源取数接口(`getListDatas` / `getChartDatas` / `getStatDatas` / `getCountData`)对**部分 EB 应用(独立部署)**的数据集,必须在 `queryDto` 中携带 `appId`,否则后端一律返回 `code=500 请求失败`(实测:小餐厅应用 `840360791696547845` 名下 4 张表不传全 500、传即 200
|
|
117
|
+
ChatBI 数据源取数接口(`getListDatas` / `getChartDatas` / `getStatDatas` / `getCountData`)对**部分 EB 应用(独立部署)**的数据集,必须在 `queryDto` 中携带 `appId`,否则后端一律返回 `code=500 请求失败`(实测:小餐厅应用 `840360791696547845` 名下 4 张表不传全 500、传即 200;低代码大赛等应用不传也正常,**显式传其真实 appId 同样返回 200**)。
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
> ⚠️ **v0.1.14 行为变更(breaking)**:v0.1.13 的「自动解析 appId」已**整体移除**。原因:`chat_bi_eb_config_map` 是**权限表**——它的行代表「谁有权限查哪张表」,`app_id` 只是该行的附带字段。appId 应是**权限校验那一次查询的产物**,不应由 CLI 另开一条查询去反查(否则等于把权限表当普通字典使用,且 appId 来源对调用者不可见)。同步移除的还有 `ebdf_obj` 兜底来源(该表无权限语义)。
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
4. 都取不到 → 不带 appId 发送(兼容旧行为)。
|
|
121
|
+
**正确姿势:先权限校验(顺带取到 appId),再显式传入取数。**
|
|
122
|
+
|
|
123
|
+
**① 调用方(技能 / Agent)先做权限校验**,一条 DSL 同时得到「有没有权限」与「要带的 appId」:
|
|
125
124
|
|
|
126
125
|
```bash
|
|
127
|
-
#
|
|
128
|
-
|
|
126
|
+
# ① 权限校验(DSL,dw 库 / #{CONN_DW}):obj_id 命中 → 有权限;未命中 → 无权限,直接返回提示、不取数
|
|
127
|
+
# SELECT obj_id, app_id FROM chat_bi_eb_config_map
|
|
128
|
+
# WHERE delete_type=0 AND tenant_key=<租户> AND enabled=1 AND (all_scop=1 OR target_id=<当前人员ID>)
|
|
129
129
|
|
|
130
|
-
#
|
|
131
|
-
e10-data ds count
|
|
130
|
+
# ② 取数:EB 建模表单必须带 --app-id(值 = ① 中该行的 app_id)
|
|
131
|
+
e10-data ds count --group weaver-ebuilder-form-service --table 840360795890851856 --app-id 840360791696547845
|
|
132
|
+
e10-data ds fields --group weaver-ebuilder-form-service --table 840360795890851856 --app-id 840360791696547845
|
|
132
133
|
|
|
133
|
-
#
|
|
134
|
-
e10-data ds count
|
|
134
|
+
# 非 EB 数据集:无需 appId,照常调用
|
|
135
|
+
e10-data ds count --group weaver-project-servicetask --table 715738355537494016
|
|
135
136
|
|
|
136
|
-
# 查看某张表的 appId:ds tables 输出含 appId
|
|
137
|
+
# 查看某张表的 appId:ds tables 输出含 appId 列(服务端返回字段,仅展示用,与取数参数无关)
|
|
137
138
|
e10-data ds tables --group weaver-ebuilder-form-service --name 低代码大赛
|
|
138
139
|
```
|
|
139
140
|
|
|
140
|
-
>
|
|
141
|
-
>
|
|
141
|
+
> - 仅 **EB 建模表单分组(`weaver-ebuilder-form-service`)** 需要 appId;其他数据集传了也无害。
|
|
142
|
+
> - **不传时 CLI 不做拦截**(即使 EB 分组):按原样发送,由后端报错(与后端行为一致)。
|
|
143
|
+
> - `--app-id auto` / `--no-app-id` 自 v0.1.14 起为**空操作**(等同不传),仅为兼容旧脚本保留参数位。
|
|
144
|
+
> - 同一 appId 覆盖同一应用下的多张表(实测小餐厅 4 张表共用 `840360791696547845`),按 `obj_id` 从权限表取到即可直接复用。
|
|
145
|
+
> - 权限校验查询走 `#{CONN_DW}`(占位符由 CLI 向配置中心解析);该表需在 DSL 表授权白名单内。
|
|
142
146
|
|
|
143
147
|
## ds --where 过滤条件(v0.1.8 起支持树形 OR)
|
|
144
148
|
|
package/bin/e10-data.mjs
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* 覆盖(数据查询链路全部家族;登录/HRM 复用 e10-login / hrm-cli,checkEbModulePermission 已废弃不提供):
|
|
7
7
|
* e10-data query DSL 查询 executeQueryDsl(conn/model/schema/tableId/dslQuery/debug)
|
|
8
8
|
* e10-data ds tables|fields|list|chart|stat|count 数据源(业务模块)取数与元数据
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* appId 一律由调用方显式传入(v0.1.14 起 CLI 不再自动反查):
|
|
10
|
+
* EB 建模表单(groupId=weaver-ebuilder-form-service)取数必须带 --app-id <id>,
|
|
11
|
+
* 该值只能来自 chat_bi_eb_config_map 的权限校验查询(同一次查询给出权限与 appId);
|
|
12
|
+
* 不带 appId 时按原样发送,由后端报错(CLI 不做拦截)
|
|
12
13
|
* e10-data doc count|list 文档查询 documentListCount / documentList
|
|
13
14
|
* e10-data noun list 词库 getChatDocsBySkillKey
|
|
14
15
|
* e10-data field id2name|name2id 关联字段翻译 testRemoteBrowser / complete
|
|
@@ -496,51 +497,24 @@ function parseOrder(val) {
|
|
|
496
497
|
return { fieldId: f, fieldName: f, objId: "", isAsc: (dir || "asc").toLowerCase() !== "desc", mainField: true };
|
|
497
498
|
});
|
|
498
499
|
}
|
|
499
|
-
// ---------------- ds appId
|
|
500
|
+
// ---------------- ds appId:一律显式传入(v0.1.14,2026-09-11 用户确认调整)----------------
|
|
500
501
|
// 背景:ChatBI 数据源取数接口(getListDatas / getChartDatas / getStatDatas / getCountData)
|
|
501
502
|
// 对部分 EB 应用(独立部署)的数据集必须携带 queryDto.appId,否则后端一律返回 code=500。
|
|
502
|
-
//
|
|
503
|
-
//
|
|
504
|
-
//
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
];
|
|
503
|
+
// 设计:appId 属「权限校验」的产物 —— 调用方先查 dw.chat_bi_eb_config_map 判权限(无权限即终止),
|
|
504
|
+
// 同一条记录的 app_id 即本次取数必须携带的 appId,再显式传入本 CLI:
|
|
505
|
+
// → CLI 不再自行反查 appId(v0.1.13 的「chat_bi_eb_config_map → ebdf_obj 自动解析」已整体移除),
|
|
506
|
+
// 避免把权限表当普通字典使用、也避免 appId 来源不可见;
|
|
507
|
+
// → 仅 EB 建模表单(groupId = weaver-ebuilder-form-service)需要 appId,其它数据集可不传;
|
|
508
|
+
// → 不传也**不做拦截**,由后端按原样报错。
|
|
509
509
|
function dsFieldsForm(gid, tid, st) {
|
|
510
510
|
return { groupId: gid, sourceId: tid, sourceType: st, detailFieldsGroup: "true", enableMerge: "true", needTableName: "true", params: "[]" };
|
|
511
511
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
const connId = (conn && conn.confValue) ? String(conn.confValue) : "";
|
|
515
|
-
if (!connId) return "";
|
|
516
|
-
const dslQuery = {
|
|
517
|
-
select: { columns: [{ field: "t1.app_id", alias: "app_id" }] },
|
|
518
|
-
from: { table: src.table, alias: "t1" },
|
|
519
|
-
where: { logic: "AND", conditions: [{ field: "t1." + src.idField, op: "=", value: String(tid) }, { field: "t1.delete_type", op: "=", value: 0 }] },
|
|
520
|
-
limit: { size: 1, offset: 0 },
|
|
521
|
-
};
|
|
522
|
-
const r = await postJson("/api/dw/dsl/executeQueryDsl", { connId, model: src.model, schema: src.schema, tableId: "", dslQuery });
|
|
523
|
-
const rows = Array.isArray(r && r.data) ? r.data : [];
|
|
524
|
-
return (rows[0] && rows[0].app_id) ? String(rows[0].app_id) : "";
|
|
525
|
-
}
|
|
526
|
-
async function resolveDsAppId(tid) {
|
|
527
|
-
for (const src of APPID_SOURCES) {
|
|
528
|
-
let appId = "";
|
|
529
|
-
try { appId = await appIdByDsl(src, tid); } catch { appId = ""; }
|
|
530
|
-
if (appId) return appId;
|
|
531
|
-
}
|
|
532
|
-
return "";
|
|
533
|
-
}
|
|
534
|
-
// ds 取数统一入口:--app-id <id> 显式 / --app-id auto 或省略=自动解析 / --no-app-id 跳过
|
|
512
|
+
// ds 取数统一入口:appId 只认显式 --app-id <id>
|
|
513
|
+
// (--app-id auto / --no-app-id 一律视为未传:v0.1.14 起不再自动解析,也不做缺失拦截)
|
|
535
514
|
async function dsDto(args, tid, gid, pageNo, pageSize, queryType) {
|
|
536
515
|
const dto = baseDto(tid, gid, pageNo, pageSize, queryType);
|
|
537
|
-
const
|
|
538
|
-
if (typeof
|
|
539
|
-
dto.appId = explicit;
|
|
540
|
-
} else if (!args["no-app-id"]) {
|
|
541
|
-
const appId = await resolveDsAppId(tid);
|
|
542
|
-
if (appId) dto.appId = String(appId);
|
|
543
|
-
}
|
|
516
|
+
const appId = args["app-id"];
|
|
517
|
+
if (typeof appId === "string" && appId !== "" && appId !== "auto") dto.appId = appId;
|
|
544
518
|
return dto;
|
|
545
519
|
}
|
|
546
520
|
async function cmdTables(args, json) {
|
|
@@ -1403,16 +1377,17 @@ function usage() {
|
|
|
1403
1377
|
query DSL 数据查询 executeQueryDsl
|
|
1404
1378
|
query --conn <connId> --model <ebuilder|flow|eteams|attend|hr|document|dw|blog> --schema <数据库> [--table-id <流程ID>] [--debug true|false] --dsl @file.json|'{...}'
|
|
1405
1379
|
ds 数据源(业务模块)取数与元数据
|
|
1406
|
-
ds tables --group <gid> [--name 关键词]
|
|
1407
|
-
ds fields --group <gid> --table <tid>
|
|
1408
|
-
ds list --group <gid> --table <tid> --fields a,b [--where @f|json] [--order "f asc"] [--page N] [--size N]
|
|
1409
|
-
ds chart --group <gid> --table <tid> --group-by g1,g2 --stat
|
|
1410
|
-
ds stat --group <gid> --table <tid> --stat
|
|
1411
|
-
ds count --group <gid> --table <tid> [--where ...]
|
|
1380
|
+
ds tables --group <gid> [--name 关键词] [--app-id <id>]
|
|
1381
|
+
ds fields --group <gid> --table <tid> [--app-id <id>]
|
|
1382
|
+
ds list --group <gid> --table <tid> --fields a,b [--where @f|json] [--order "f asc"] [--page N] [--size N] [--app-id <id>]
|
|
1383
|
+
ds chart --group <gid> --table <tid> --group-by g1,g2 --stat @f.json [--where ...] [--app-id <id>]
|
|
1384
|
+
ds stat --group <gid> --table <tid> --stat @f.json [--where ...] [--app-id <id>]
|
|
1385
|
+
ds count --group <gid> --table <tid> [--where ...] [--app-id <id>]
|
|
1412
1386
|
(ds 通用 --source-type LOGIC|ETEAMS,默认 LOGIC)
|
|
1413
|
-
(ds
|
|
1414
|
-
|
|
1415
|
-
|
|
1387
|
+
(ds 取数的 appId:一律**显式传入** --app-id <id>(v0.1.14 起 CLI 不再自动反查)。
|
|
1388
|
+
EB 建模表单(groupId=weaver-ebuilder-form-service)必须带:该值取自 chat_bi_eb_config_map 的权限校验查询
|
|
1389
|
+
——调用方先查权限(无权限即终止、不取数),同一条记录的 app_id 即本次必带的 appId;
|
|
1390
|
+
其他数据集可不传,CLI 不拦截、以接口报错为准;--app-id auto / --no-app-id 已废弃,等同不传)
|
|
1416
1391
|
--where 过滤条件(v0.1.8 起支持树形 OR,递归):
|
|
1417
1392
|
数组 = AND 根: [{"fieldId":"f1","conditionType":"Date","compareType":"range","conditionValue":"2026-09~2026-10"},{"fieldId":"f2",...}]
|
|
1418
1393
|
对象 = 完整树: {"relationship":"0","conditionList":[{"fieldId":"f1",...},{"fieldId":"f2",...}]} # "0"=OR、"1"=AND,缺省 AND
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "e10-data",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "泛微 E10 数据接口统一 CLI(data-assistant 专家配套):DSL 查询/数据源/文档/词库/关联字段翻译/环境参数配置中心(conf,支持 confGroup 分组)/专家包版本管理;ds 取数(list/chart/stat/count
|
|
3
|
+
"version": "0.1.14",
|
|
4
|
+
"description": "泛微 E10 数据接口统一 CLI(data-assistant 专家配套):DSL 查询/数据源/文档/词库/关联字段翻译/环境参数配置中心(conf,支持 confGroup 分组)/专家包版本管理;ds 取数(list/chart/stat/count)的 appId 由调用方显式传入 --app-id(v0.1.14 起 CLI 不再自动反查;EB 建模表单 weaver-ebuilder-form-service 必须带,appId 取自 chat_bi_eb_config_map 权限校验);认证加解密全部交由 weaver-e10-login(本 CLI 不再自行解密,通过 e10-login 命令出口获取凭据)",
|
|
5
5
|
"author": "e10-dw",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|