e10-data 0.1.13 → 0.1.15
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 +75 -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) {
|
|
@@ -608,6 +582,45 @@ async function cmdCount(args, json) {
|
|
|
608
582
|
console.log("totalCount = " + (data.totalCount ?? "-"));
|
|
609
583
|
}
|
|
610
584
|
|
|
585
|
+
// ---------------- eb:EB 建模表单权限校验 ----------------
|
|
586
|
+
// chatBi EB 配置映射分页查询:EB 表权限前置校验的 CLI 通道
|
|
587
|
+
// (替代原「DSL 查 dw.chat_bi_eb_config_map + 客户端拼 (all_scop=1 OR target_id=本人)」写法)
|
|
588
|
+
// 服务端已按登录人过滤:有权限 → total>=1 且行内回带 appId;无权限 / 表不存在 → total=0
|
|
589
|
+
const EB_PERM_PAGE_PATH = "/api/dw/newetl/chatBi/getChatBiEbConfigMapByPage";
|
|
590
|
+
async function cmdEbPermPage(args, json) {
|
|
591
|
+
// ⚠️ obj-id / app-id 为 19 位大整数:必须原样字符串传递。
|
|
592
|
+
// 经 JS Number 会舍入(840360795890851856 → 840360795890851840),实测后端接受字符串,
|
|
593
|
+
// 但吃下舍入后的数字会返回 total=0 —— 把「有权限」静默伪装成「无权限」。
|
|
594
|
+
const objId = String(need("obj-id", args));
|
|
595
|
+
const formTable = String(need("form-table", args));
|
|
596
|
+
// ⚠️ obj-id / form-table 缺失时后端不是报错,而是 HTTP 200 + 无 actionMsg + data 空,
|
|
597
|
+
// 外观与「无权限」完全一致 → 必须用 need() 在本地拦掉(need 对空串同样报错)。
|
|
598
|
+
const body = {
|
|
599
|
+
objId,
|
|
600
|
+
formTable,
|
|
601
|
+
pageNum: parseInt(args.page || "1", 10),
|
|
602
|
+
pageSize: parseInt(args.size || "10", 10),
|
|
603
|
+
};
|
|
604
|
+
if (typeof args["app-id"] === "string" && args["app-id"] !== "") body.app_id = String(args["app-id"]);
|
|
605
|
+
const r = await postJson(EB_PERM_PAGE_PATH, body);
|
|
606
|
+
if (json) return r;
|
|
607
|
+
// ⚠️ 失败判定:非法入参时 actionMsg 缺失(code=undefined),业务失败时 code!==0 → 一并按失败输出
|
|
608
|
+
const am = r.actionMsg || {};
|
|
609
|
+
if (am.code !== 0) { console.log("code=" + am.code + " msg=" + (am.message || "")); return; }
|
|
610
|
+
const d = r.data || {};
|
|
611
|
+
const recs = d.records || [];
|
|
612
|
+
const total = d.total === undefined || d.total === null ? 0 : d.total;
|
|
613
|
+
const first = recs[0] || null;
|
|
614
|
+
console.log("total = " + total);
|
|
615
|
+
printHuman("", recs, ["id", "objId", "formTable", "appId", "allScop", "targetId", "enabled", "deleteType"]);
|
|
616
|
+
console.log(total >= 1
|
|
617
|
+
? (first
|
|
618
|
+
? "结论: 有权限(appId=" + first.appId + ")"
|
|
619
|
+
: "结论: 有权限(total>=1;当前页无记录,appId 请用 --page 1 获取)")
|
|
620
|
+
: "结论: 无权限(total=0)");
|
|
621
|
+
if (args.require && total < 1) throw new Error("没有查询该 EB 表的权限(total=0)");
|
|
622
|
+
}
|
|
623
|
+
|
|
611
624
|
// ---------------- doc:文档查询 ----------------
|
|
612
625
|
function docBaseBody(pageNo, pageSize) {
|
|
613
626
|
return {
|
|
@@ -1403,16 +1416,17 @@ function usage() {
|
|
|
1403
1416
|
query DSL 数据查询 executeQueryDsl
|
|
1404
1417
|
query --conn <connId> --model <ebuilder|flow|eteams|attend|hr|document|dw|blog> --schema <数据库> [--table-id <流程ID>] [--debug true|false] --dsl @file.json|'{...}'
|
|
1405
1418
|
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 ...]
|
|
1419
|
+
ds tables --group <gid> [--name 关键词] [--app-id <id>]
|
|
1420
|
+
ds fields --group <gid> --table <tid> [--app-id <id>]
|
|
1421
|
+
ds list --group <gid> --table <tid> --fields a,b [--where @f|json] [--order "f asc"] [--page N] [--size N] [--app-id <id>]
|
|
1422
|
+
ds chart --group <gid> --table <tid> --group-by g1,g2 --stat @f.json [--where ...] [--app-id <id>]
|
|
1423
|
+
ds stat --group <gid> --table <tid> --stat @f.json [--where ...] [--app-id <id>]
|
|
1424
|
+
ds count --group <gid> --table <tid> [--where ...] [--app-id <id>]
|
|
1412
1425
|
(ds 通用 --source-type LOGIC|ETEAMS,默认 LOGIC)
|
|
1413
|
-
(ds
|
|
1414
|
-
|
|
1415
|
-
|
|
1426
|
+
(ds 取数的 appId:一律**显式传入** --app-id <id>(v0.1.14 起 CLI 不再自动反查)。
|
|
1427
|
+
EB 建模表单(groupId=weaver-ebuilder-form-service)必须带:该值取自 chat_bi_eb_config_map 的权限校验查询
|
|
1428
|
+
——调用方先查权限(无权限即终止、不取数),同一条记录的 app_id 即本次必带的 appId;
|
|
1429
|
+
其他数据集可不传,CLI 不拦截、以接口报错为准;--app-id auto / --no-app-id 已废弃,等同不传)
|
|
1416
1430
|
--where 过滤条件(v0.1.8 起支持树形 OR,递归):
|
|
1417
1431
|
数组 = AND 根: [{"fieldId":"f1","conditionType":"Date","compareType":"range","conditionValue":"2026-09~2026-10"},{"fieldId":"f2",...}]
|
|
1418
1432
|
对象 = 完整树: {"relationship":"0","conditionList":[{"fieldId":"f1",...},{"fieldId":"f2",...}]} # "0"=OR、"1"=AND,缺省 AND
|
|
@@ -1454,6 +1468,11 @@ exp 专家包版本管理(expert-repository/v1,响应以 data.actionMsg.
|
|
|
1454
1468
|
exp rollback --expert <code> --version vX.Y.Z
|
|
1455
1469
|
attend 考勤 REST 接口(2026-09-07 新增,hr-attendance 病假/事假等假期余额)
|
|
1456
1470
|
attend statis [--user <人员ID>] [--begin 2026-09-01] [--end 2026-09-30] # getAttendInfoStatis 假期余额统计;--user 默认当前登录用户,--begin/--end 默认当月
|
|
1471
|
+
eb EB 建模表单权限校验(chatBi EB 配置映射分页查询,替代 DSL 查 chat_bi_eb_config_map)
|
|
1472
|
+
eb perm-page --obj-id <id> --form-table <物理表名> [--page N] [--size N] [--app-id <id>] [--require]
|
|
1473
|
+
# obj-id / form-table 必填(本地强校验;缺失后端只回空、不报错)
|
|
1474
|
+
# obj-id / app-id 必须字符串传参(19 位大整数,Number 舍入 → 静默 total=0)
|
|
1475
|
+
# total>=1 = 有权限,并回带该行 appId;--require 时 total=0 直接报错退出
|
|
1457
1476
|
认证: 优先读权威源 ~/.e10-cli/profiles/<active>/auth(自动同步镜像 ~/.workbuddy/e10-login-cache.md);皆无请先 e10-login oidc`);
|
|
1458
1477
|
}
|
|
1459
1478
|
|
|
@@ -1513,6 +1532,12 @@ async function main() {
|
|
|
1513
1532
|
} else if (family === "attend") {
|
|
1514
1533
|
if (sub === "statis") result = await cmdAttendStatis(args, json);
|
|
1515
1534
|
else { usage(); process.exit(1); }
|
|
1535
|
+
} else if (family === "eb") {
|
|
1536
|
+
if (!sub) { usage(); process.exit(1); }
|
|
1537
|
+
switch (sub) {
|
|
1538
|
+
case "perm-page": result = await cmdEbPermPage(args, json); break;
|
|
1539
|
+
default: usage(); process.exit(1);
|
|
1540
|
+
}
|
|
1516
1541
|
} else { usage(); process.exit(1); }
|
|
1517
1542
|
if (json && result !== undefined) console.log(JSON.stringify(result, null, 1));
|
|
1518
1543
|
}
|
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.15",
|
|
4
|
+
"description": "泛微 E10 数据接口统一 CLI(data-assistant 专家配套):DSL 查询/数据源/文档/词库/关联字段翻译/环境参数配置中心(conf,支持 confGroup 分组)/EB 建模表单权限校验(eb perm-page)/专家包版本管理;ds 取数(list/chart/stat/count)的 appId 由调用方显式传入 --app-id(v0.1.14 起 CLI 不再自动反查;EB 建模表单 weaver-ebuilder-form-service 必须带,appId 取自 eb perm-page 权限校验返回行);认证加解密全部交由 weaver-e10-login(本 CLI 不再自行解密,通过 e10-login 命令出口获取凭据)",
|
|
5
5
|
"author": "e10-dw",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|