e10-data 0.1.14 → 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.
Files changed (2) hide show
  1. package/bin/e10-data.mjs +50 -0
  2. package/package.json +2 -2
package/bin/e10-data.mjs CHANGED
@@ -582,6 +582,45 @@ async function cmdCount(args, json) {
582
582
  console.log("totalCount = " + (data.totalCount ?? "-"));
583
583
  }
584
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
+
585
624
  // ---------------- doc:文档查询 ----------------
586
625
  function docBaseBody(pageNo, pageSize) {
587
626
  return {
@@ -1429,6 +1468,11 @@ exp 专家包版本管理(expert-repository/v1,响应以 data.actionMsg.
1429
1468
  exp rollback --expert <code> --version vX.Y.Z
1430
1469
  attend 考勤 REST 接口(2026-09-07 新增,hr-attendance 病假/事假等假期余额)
1431
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 直接报错退出
1432
1476
  认证: 优先读权威源 ~/.e10-cli/profiles/<active>/auth(自动同步镜像 ~/.workbuddy/e10-login-cache.md);皆无请先 e10-login oidc`);
1433
1477
  }
1434
1478
 
@@ -1488,6 +1532,12 @@ async function main() {
1488
1532
  } else if (family === "attend") {
1489
1533
  if (sub === "statis") result = await cmdAttendStatis(args, json);
1490
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
+ }
1491
1541
  } else { usage(); process.exit(1); }
1492
1542
  if (json && result !== undefined) console.log(JSON.stringify(result, null, 1));
1493
1543
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "e10-data",
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 命令出口获取凭据)",
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",