e10-data 0.1.33 → 0.1.34
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/CHANGELOG.md +42 -0
- package/bin/e10-data.mjs +48 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# 变更记录
|
|
2
2
|
|
|
3
|
+
## 0.1.34(2026-10-29)—— `ds fields` / `ds describe` 改走 `getFields`(扁平返回)
|
|
4
|
+
|
|
5
|
+
### 1. 背景
|
|
6
|
+
|
|
7
|
+
取字段端点在后端已有统一实现 `GET /api/dw/newetl/chatBi/ds/getFields`(与 `ds/listByPage`、
|
|
8
|
+
`getListDatas` 同族),旧的 `POST /api/ebuilder/common/ds/fields` 不再是唯一入口。本次按用户
|
|
9
|
+
指定切到新端点,并适配其**扁平返回结构**。
|
|
10
|
+
|
|
11
|
+
### 2. 改动(**输出结构变化**)
|
|
12
|
+
|
|
13
|
+
- **`ds fields` 端点**:`POST /api/ebuilder/common/ds/fields`(multipart 表单)→
|
|
14
|
+
**`GET /api/dw/newetl/chatBi/ds/getFields`**(query 参数),四个参数全部取自本次调用:
|
|
15
|
+
|
|
16
|
+
| 参数 | 来源 |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `groupId` | `--group` |
|
|
19
|
+
| `sourceId` | `--table` |
|
|
20
|
+
| `sourceType` | `--source-type`(缺省 `LOGIC`) |
|
|
21
|
+
| `appId` | `--app-id`(显式传入才拼;`auto` / 空则不出现) |
|
|
22
|
+
|
|
23
|
+
- **返回结构(不兼容)**:`data` 由「表节点数组」变为**扁平字段数组** ——
|
|
24
|
+
不再有 `data[0].fields[]` 这一层,也不再有 `isDetailtable` 子表节点与表名。
|
|
25
|
+
字段本身不丢(实测同一流程表新旧均为 126 个字段),子表归属只能看字段的
|
|
26
|
+
`config.formTableId`。
|
|
27
|
+
- **`ds describe`**:字段段同步走 `getFields`;`fields.main` = 全部字段、`fields.detail` 恒为空,
|
|
28
|
+
并新增 `fields.shapeNote` 说明该端点不返回表名与子表分组。
|
|
29
|
+
- **文本模式**:`ds fields` 不加 `--json` 时按扁平数组打印(`字段 N 个(getFields 扁平返回)`)。
|
|
30
|
+
- **`getUrl()` 支持 `E10_DEBUG_URL`**:与 `postJson` 对齐,设 `E10_DEBUG_URL=1` 时打印真实
|
|
31
|
+
`GET` 路径(含 query),便于核对参数是否按预期拼装。
|
|
32
|
+
|
|
33
|
+
### 3. 影响 / 兼容
|
|
34
|
+
|
|
35
|
+
- 只读字段清单的调用方无需改命令;**自己解析 `data[0].fields` 的脚本必须改成遍历 `data`**。
|
|
36
|
+
- `ds fields-dsl` **未改**,仍走 `/api/dw/newetl/chatBi/ds/fieldsForDSL`(返回仍为嵌套结构,
|
|
37
|
+
DSL 需要密文列名 `f_*` 与 `compType` 回填)。
|
|
38
|
+
|
|
39
|
+
### 4. 实测
|
|
40
|
+
|
|
41
|
+
- EB 表单(`846297265322573830`):137 个字段;需求库(`840720984867880961`):106 个字段;
|
|
42
|
+
流程表(`100003460000000478`):126 个字段(主表 62 + 7 张子表 20/7/6/6/5/5/2 + 13 个无 formTableId)。
|
|
43
|
+
- 新旧字段集合逐项比对一致,`compType` / `browserParams` 等属性比旧端点更全。
|
|
44
|
+
|
|
3
45
|
## 0.1.33(2026-10-23)—— 移除 `login xiaoe-env`(登录交 weaver-work-cli)+ 新增 `scene search`
|
|
4
46
|
|
|
5
47
|
### 1. 背景
|
package/bin/e10-data.mjs
CHANGED
|
@@ -745,6 +745,9 @@ async function postJson(endpoint, bodyObj, extraHeaders = {}) {
|
|
|
745
745
|
return j;
|
|
746
746
|
}
|
|
747
747
|
async function getUrl(url) {
|
|
748
|
+
if (process.env.E10_DEBUG_URL) {
|
|
749
|
+
console.error("[http] GET " + url);
|
|
750
|
+
}
|
|
748
751
|
const resp = await fetch(BASE + url, {
|
|
749
752
|
method: "GET",
|
|
750
753
|
headers: {
|
|
@@ -1098,6 +1101,24 @@ function parseOrder(val) {
|
|
|
1098
1101
|
function dsFieldsForm(gid, tid, st) {
|
|
1099
1102
|
return { groupId: gid, sourceId: tid, sourceType: st, detailFieldsGroup: "true", enableMerge: "true", needTableName: "true", params: "[]" };
|
|
1100
1103
|
}
|
|
1104
|
+
// ---- 获取字段端点(2026-10-29 用户指定):GET /api/dw/newetl/chatBi/ds/getFields ----
|
|
1105
|
+
// 四个参数全部取自本次调用,不写死:
|
|
1106
|
+
// groupId ← --group
|
|
1107
|
+
// sourceId ← --table(数据集 / EB 表 id)
|
|
1108
|
+
// sourceType ← --source-type(缺省 LOGIC)
|
|
1109
|
+
// appId ← --app-id(仅显式传入时才带;EB 建模表单才需要)
|
|
1110
|
+
const DS_FIELDS_PATH = "/api/dw/newetl/chatBi/ds/getFields";
|
|
1111
|
+
function dsFieldsQuery(gid, tid, st, appId) {
|
|
1112
|
+
const q = new URLSearchParams();
|
|
1113
|
+
q.set("groupId", String(gid));
|
|
1114
|
+
q.set("sourceId", String(tid));
|
|
1115
|
+
q.set("sourceType", String(st || "LOGIC"));
|
|
1116
|
+
if (typeof appId === "string" && appId !== "" && appId !== "auto") q.set("appId", appId);
|
|
1117
|
+
return q.toString();
|
|
1118
|
+
}
|
|
1119
|
+
async function dsGetFields(gid, tid, st, appId) {
|
|
1120
|
+
return getUrl(DS_FIELDS_PATH + "?" + dsFieldsQuery(gid, tid, st, appId));
|
|
1121
|
+
}
|
|
1101
1122
|
// ---- ds listByPage 端点(唯一):/api/dw/newetl/chatBi/ds/listByPage ----
|
|
1102
1123
|
// ⚠️ 该端点**当前会忽略 name**(传 name/tableName/keyword/title 等任意字段名,都返回该分组全量,实测 8531 条)。
|
|
1103
1124
|
// 后端后续会升级支持 name 过滤(用户 2026-09-24 确认)——升级后 `ds find` / `ds tables --name` **无需改代码**
|
|
@@ -1124,16 +1145,17 @@ async function cmdTables(args, json) {
|
|
|
1124
1145
|
const recs = ((r.data || {}).records) || [];
|
|
1125
1146
|
printHuman("分组表清单 (total=" + ((r.data || {}).total) + ")", recs, ["id", "name", "appId", "tableText", "detailTable", "usage"]);
|
|
1126
1147
|
}
|
|
1148
|
+
// 取字段:GET /api/dw/newetl/chatBi/ds/getFields(2026-10-29 用户指定端点)
|
|
1149
|
+
// 返回形态 = **扁平字段数组**(data[] 里每个元素就是一个字段,没有 table node、没有子表节点)
|
|
1150
|
+
// ⇒ 与旧 /api/ebuilder/common/ds/fields 的 data[0].fields[] 不同,故 --json 原样透传、
|
|
1151
|
+
// 文本模式按扁平数组打印;下游(describe / 过滤脚本)按扁平形态归一。
|
|
1127
1152
|
async function cmdFields(args, json) {
|
|
1128
1153
|
const gid = need("group", args), tid = need("table", args);
|
|
1129
|
-
const
|
|
1130
|
-
if (typeof args["app-id"] === "string" && args["app-id"] !== "" && args["app-id"] !== "auto") form.appId = args["app-id"];
|
|
1131
|
-
const r = await postMultipart("/api/ebuilder/common/ds/fields", form);
|
|
1154
|
+
const r = await dsGetFields(gid, tid, args["source-type"] || "LOGIC", args["app-id"]);
|
|
1132
1155
|
if (json) return r;
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
}
|
|
1156
|
+
const fields = Array.isArray(r.data) ? r.data : [];
|
|
1157
|
+
console.log("== 字段 " + fields.length + " 个(getFields 扁平返回)==");
|
|
1158
|
+
for (const f of fields) console.log([f.name, f.text, f.type || f.compType, f.mainPrimaryKey ? "PK" : ""].filter(Boolean).join("\t"));
|
|
1137
1159
|
}
|
|
1138
1160
|
// fieldsForDSL:参数与返回结构同 cmdFields,仅接口换为 /api/dw/newetl/chatBi/ds/fieldsForDSL
|
|
1139
1161
|
async function cmdFieldsForDSL(args, json) {
|
|
@@ -1555,7 +1577,24 @@ function collectFieldNodes(list, out, subName) {
|
|
|
1555
1577
|
}
|
|
1556
1578
|
}
|
|
1557
1579
|
function normalizeFieldsResp(r) {
|
|
1558
|
-
const
|
|
1580
|
+
const data = Array.isArray(r.data) ? r.data : [];
|
|
1581
|
+
// ④ getFields 扁平形态(2026-10-29):data 直接是字段数组 —— 没有 table node、没有子表节点、没有表名。
|
|
1582
|
+
// 字段本身不丢(与旧端点字段名集合一致),但 isDetailtable 无从判断,只能靠 config.formTableId 区分归属。
|
|
1583
|
+
if (data.length && !data.some((d) => Array.isArray(d && d.fields))) {
|
|
1584
|
+
const all = data.map((f) => ({
|
|
1585
|
+
name: f.name ?? null, text: f.text ?? null, type: f.type || f.compType || null,
|
|
1586
|
+
isPK: !!f.mainPrimaryKey, subTable: null,
|
|
1587
|
+
dataKey: (f.config && f.config.dataKey) || null,
|
|
1588
|
+
formTableId: (f.config && f.config.formTableId) || null,
|
|
1589
|
+
}));
|
|
1590
|
+
return {
|
|
1591
|
+
tableName: null, tableId: null,
|
|
1592
|
+
mainCount: all.length, detailCount: 0,
|
|
1593
|
+
main: all, detail: [],
|
|
1594
|
+
shapeNote: "端点 getFields 返回扁平字段数组:不含表名与子表分组(isDetailtable),子表归属只能看 formTableId",
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
const node = data[0] || {};
|
|
1559
1598
|
const flat = [];
|
|
1560
1599
|
collectFieldNodes(node.fields, flat, null);
|
|
1561
1600
|
const main = flat.filter((x) => !x.__detail);
|
|
@@ -1586,9 +1625,7 @@ async function cmdDsDescribe(args, json) {
|
|
|
1586
1625
|
const tasks = [
|
|
1587
1626
|
(async () => {
|
|
1588
1627
|
try {
|
|
1589
|
-
|
|
1590
|
-
if (typeof args["app-id"] === "string" && args["app-id"] !== "" && args["app-id"] !== "auto") form.appId = args["app-id"];
|
|
1591
|
-
return { key: "fields", value: normalizeFieldsResp(await postMultipart("/api/ebuilder/common/ds/fields", form)) };
|
|
1628
|
+
return { key: "fields", value: normalizeFieldsResp(await dsGetFields(gid, tid, sourceType, args["app-id"])) };
|
|
1592
1629
|
} catch (e) { return { key: "fields", error: String((e && e.message) || e) }; }
|
|
1593
1630
|
})(),
|
|
1594
1631
|
(async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "e10-data",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
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 取自 ebdf_obj.app_id;2026-10-09 起不再做 EB 权限前置校验);认证凭据**唯一来源 = weaver-work-cli**(通过 `auth export-weaver-env` 命令出口取明文凭据,**不设 e10-login 回退**;加解密由该 CLI 自行负责,本 CLI 不实现任何加解密;登录命令不在本 CLI 内,一律用 weaver-work-cli auth login)。v0.1.17 性能改造:免凭据命令(--version/--help/未知命令)提前返回、直连 e10-login JS 入口(去掉 shell:true 的 cmd.exe 开销)、新增凭据进程间 TTL 缓存(不落明文);v0.1.19(2026-09-24)新增 ds 发现层聚合 groups/find/describe(进程内并发,全 58 分组扫表实测 ~5.5s),并修复 ds tables --name 因 listByPage 端点切换导致的关键词过滤静默失效;v0.1.18(2026-09-24)新增 ds fields-dsl(接口 /api/dw/newetl/chatBi/ds/fieldsForDSL),并移除凭据明文镜像同步(不再写 ~/.workbuddy/e10-login-cache.md);v0.1.20(2026-09-24)凭据来源切换为 weaver-work-cli 唯一来源、移除 e10-login 回退,并补齐 userId/tenantKey 传递(修复 attend statis 等命令报「缺少查询人员」的问题)。v0.1.21(2026-09-28)新增 module call —— 模块配置接口调用(配置中心驱动):已确定「哪个模块的哪条具体接口」之后的一条命令取数入口(精取该条 confAttrs → 按 http_method/input_params 组参 → 发请求(自动禁代理 + Cookie/eteamsid/UA 三件套)→ 提取精简结果),与技能自带 script/call_module.py 等价(参数名/退出码/提取口径全对齐),复用本 CLI 凭据缓存与 conf 通道、零临时文件;同时 auth 归一化与凭据缓存补齐 userAgent(供 AgentType UA 使用,缺失时从 cookie 的 agentType= 推导)。v0.1.22(2026-10-10):移除 `eb perm-page` 命令(EB 建模表单取数不再做权限前置校验,appId 直接取 ebdf_obj.app_id);`--fields`/`--group-by`/`--order` 等逗号列表支持 `@文件`(逗号字符串或 JSON 数组,与 --where/--stat/--dsl 一致,规避 shell 拆分导致的静默丢列/0 行)。v0.1.23(2026-10-13)新增 `refusal get` —— 拒答话术 getRefusalSpeechTechnique(入参仅 type,返回对象的 data = 话术字符串;默认 auto 通道 = POST multipart 表单优先、返回不含 data 时自动回退 GET ?type=,可用 --http post|get 锁定单通道)。v0.1.25(2026-10-14)新增 `scene groups|items` —— 场景定位元数据 getSceneGroups(① groups 分组骨架 / ② items --group <groupId> 组内条目),由技能 references/scene-locate/scripts/locate.mjs 整体迁入(属元数据定位接口、不取业务数据):默认输出精简 JSON(groups: groupId/groupName/itemCount/groupDesc;items: id/datasetName/datasetType/sourceId[/moduleName/sourceType/sourceGroupId/appId]/datasetDesc),--json 原样输出接口返回,计数走 stderr;--client agent|all|connector 默认 agent。v0.1.26(2026-10-15)新增 `refusal rules` —— 拒答话术规则 getRefusalSpeechRules(**无入参**,返回对象的 data = 对象数组;调用方式与 refusal get 同口径:默认 auto 通道 = POST 空 multipart 表单优先、返回不含 data 时回退 GET,可用 --http post|get 锁定单通道;人读直接打印 data 数组,--json 原样输出整个响应对象)。v0.1.27(2026-10-15)新增 `noun scope --ids <id1,id2|@ids.json>` —— 词库**按生效范围批量检索**(端点 /api/dw/newetl/chatBi/doc/getChatBiDocByScopeId,POST body = 数据集 id 的 JSON 数组;入参 = 数据集 id 列表 = `scene items --group <分组id>` 里每个条目的 `id`;命中 = allScope=1 全局词库 ∪ scopeEffectId 含任一传入 id;id 按字符串下发,避免 19 位雪花号超 2^53 丢精度)。属**新增通道**,原 `noun list --skill <skillKey>`(getChatDocsBySkillKey)行为**完全不变**。 v0.1.28(2026-10-17):`module call` 支持 `--type <confType>`(自定义 confType / 域级配置分组,默认 `api`,不传时行为与旧版一致)与 `--show-params` 精简模式(默认省略 `request_example`,`--full` / `--with-example` 回显,`--no-example` 显式精简),`--show-params` 输出新增 `conf_type` 字段。v0.1.29(2026-10-19)本地增强:`module call` 新增 `--conf-file <文件|@文件>`——直接读本地 confAttrs 跳过 `conf get`(同一 confKey 一次问数只取一次配置),兼容模板缓存与 `conf get --json` 原样输出,带该参数时 `--group`/`--conf-key` 可从文件回填,stderr 提示「未请求配置中心」;缓存缺失/过期时去掉该参数即回退原路径。 v0.1.30(2026-10-19):query 透传后端 executeQueryDsl 新增的 4 个 @RequestParam(dimension=后端 confKey / confGroup / username / startDate,恒定发送、值允许为空,缺键即失败),并显式声明 Content-Type=application/json;charset=utf-8。v0.1.31(2026-10-21)凭据直读快路径(providerAuthFileDirect 直读 weaver-work-cli auth 文件解密,省 2 个子进程约 5.6s→~0.1s)+ cred-helper stale socket 自愈。v0.1.32(2026-10-22)新增 `field options` —— Select/下拉框字段的选项值清单 {id,name,archive}(GET /api/ebuilder/common/ds/options?fieldName=&objId=&sourceType=&groupId=,通用下拉框选项方法,不限 DSL/宽表:EB 表单与 ETEAMS 宽表均适用;--field-name 用 ds fields 的 name,--source-type 需显式传参 LOGIC|ETEAMS、代码缺省 LOGIC 兜底;Select 列存 value_key 时用它做显示映射,替代已停用的 id2name/字典表直查)。v0.1.33(2026-10-23):**移除 `login xiaoe-env`**(含别名 `xiaoe-env`)——登录链路统一交 weaver-work-cli(`auth login/status/export-weaver-env`),本 CLI 不再提供任何登录命令,未登录时提示执行 `weaver-work-cli auth login --base-url <域名>`;同版本新增 `scene search --keywords <词1,词2>` —— 场景关键词候选召回(本地打分:拉一次 groups + 每个入选分组各拉一次 items,按 groupName/datasetName 命中×3 + 描述命中×1 排序,输出与 `scene items` 同构,支持 `--max-groups 3` / `--max-items 12` / `--scope-group-id`)。",
|
|
5
5
|
"author": "e10-dw",
|
|
6
6
|
"license": "MIT",
|