@stalfh233/omc-cli 0.6.95 → 0.6.97
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/dist/lanes/businessrule-contract.js +1 -1
- package/dist/lanes/businessrule.js +182 -21
- package/dist/lanes/datarule.js +2 -2
- package/dist/lanes/online-js.js +11 -0
- package/dist/read.js +3 -1
- package/package.json +3 -3
|
@@ -168,7 +168,7 @@ export const BUSINESSRULE_LANE_CONTRACT = Object.freeze({
|
|
|
168
168
|
// 295,400B,HEAD 4c524b83 实测 295,331 仅余 69B——加对照句即红门)。对照
|
|
169
169
|
// 教学住 read-shapes 的 notes[0](默认 describe 面即回,不进 tools/list);
|
|
170
170
|
// MCP 面的同款对照由 omc_graph_explore 的 description 承担。
|
|
171
|
-
description: "跨规则引用检索:一次调用替代 agent 逐 schema×ruleCode 全平台枚举 rule.get(删服务/模型/字段/规则前的影响面)。kind=service 查 BIZ_ACTION 的 methodMapping.serviceCode;kind=model 查 CREATE/UPDATE/DELETE 的 targetObjectCode 与 methodMapping.schemaCode(删模型前的影响面);kind=field 查 dataActions.targetDataItem、inputMappings/outputMappings 的 bizCode、规则条件叶子(filterCondition/BRANCH 出口等,只认主模型字段)与 datarule(propertyCodes + options 文本;字段 code 跨模型不唯一,建议配 schemaCodes 限范围);kind=rule 查流程事件绑定(flow 级 handler 与节点级 nodeEvent 的 bizActions,按模型枚举流程面)。kind:\"trigger\" 按 schemaCode
|
|
171
|
+
description: "跨规则引用检索:一次调用替代 agent 逐 schema×ruleCode 全平台枚举 rule.get(删服务/模型/字段/规则前的影响面)。kind=service 查 BIZ_ACTION 的 methodMapping.serviceCode;kind=model 查 CREATE/UPDATE/DELETE 的 targetObjectCode 与 methodMapping.schemaCode(删模型前的影响面);kind=field 查 dataActions.targetDataItem、inputMappings/outputMappings 的 bizCode、规则条件叶子(filterCondition/BRANCH 出口等,只认主模型字段)与 datarule(propertyCodes + options 文本;字段 code 跨模型不唯一,建议配 schemaCodes 限范围);kind=rule 查流程事件绑定(flow 级 handler 与节点级 nodeEvent 的 bizActions,按模型枚举流程面)。kind:\"trigger\" 按 schemaCode 列全触发点(流程三面/表单按钮/规则/预置事件/数据规则/在线 JS)。实现为客户端聚合(应用树模型清单→逐模型 rule.list/rule.get 或 get_published),输出只回命中行;各 kind 的覆盖面与协议局限见回执 coverage。",
|
|
172
172
|
}),
|
|
173
173
|
"rule.save": Object.freeze({
|
|
174
174
|
scope: "dead-state CRUD conditional node graphs",
|
|
@@ -12,7 +12,9 @@ import { extractDataRuleEdges, extractReferenceEdges } from "../graph.js";
|
|
|
12
12
|
import { DEFAULT_SCAN_CONCURRENCY, mapWithConcurrency } from "../concurrency.js";
|
|
13
13
|
import { readFormButtons, readFormOrNull } from "../form-support.js";
|
|
14
14
|
import { scanModelWorkflowBindings } from "./workflow.js";
|
|
15
|
-
import { readCustomScriptSource } from "./online-js.js";
|
|
15
|
+
import { listOtherScriptSources, readCustomScriptSource } from "./online-js.js";
|
|
16
|
+
import { decodeButtonScript } from "./list-view.js";
|
|
17
|
+
import { decodeDataRule, listDataRules } from "./datarule.js";
|
|
16
18
|
import { wireCall, wireCallWith404Fallback, wireRows } from "../wire.js";
|
|
17
19
|
import { readModelRecord } from "../model-record.js";
|
|
18
20
|
import { BUSINESSRULE_LANE_CONTRACT } from "./businessrule-contract.js";
|
|
@@ -790,6 +792,36 @@ const RULE_BIZ_TYPE_TIMING = 2;
|
|
|
790
792
|
* 「多久跑一次、从哪取数」。
|
|
791
793
|
*/
|
|
792
794
|
const TRIGGER_SCHEDULER_KEYS = ["triggerTimeType", "cycleType", "execCycle", "hour", "minute", "startTime", "dataSourceType"];
|
|
795
|
+
/**
|
|
796
|
+
* 数据规则(BizDataRule)在服务端**新增/更新**时执行(8.6.26 反编译:
|
|
797
|
+
* BizObjectManagerImpl.insertBizObject:372-378 / updateBizObject:418-425 →
|
|
798
|
+
* BizDataRuleManagerImpl.executeDataRule;type2 计算走 CalculateHandler)。
|
|
799
|
+
* 所以它是模型的自动化面,不是「表单里才生效」的 UI 配置。
|
|
800
|
+
*
|
|
801
|
+
* 真机采样(local,2026-11-23):多数模型的规则是字段创建时平台自动生成的
|
|
802
|
+
* `dataRuleType:1 + checkType:4` 长度上限(某模型 35 条全是)。逐条列会把真
|
|
803
|
+
* 自动化淹没——这类聚合成一行计数,其余逐条列。
|
|
804
|
+
*/
|
|
805
|
+
const DATARULE_TRIGGER_TYPE_NAMES = Object.freeze({ 1: "校验", 2: "计算", 3: "显示", 4: "必填", 5: "只读" });
|
|
806
|
+
const DATARULE_TRIGGER_CHECK_NAMES = Object.freeze({ 1: "正则", 2: "提交校验", 3: "空行", 4: "最大长度", 5: "重复" });
|
|
807
|
+
const TRIGGER_DATARULE_MAX_ROWS = 30;
|
|
808
|
+
function isAutoMaxLengthRule(row) {
|
|
809
|
+
return Number(row.dataRuleType) === 1 && Number(row.checkType) === 4;
|
|
810
|
+
}
|
|
811
|
+
function dataRuleTriggerRow(row) {
|
|
812
|
+
const dataRuleType = Number(row.dataRuleType);
|
|
813
|
+
const checkType = row.checkType === null || row.checkType === undefined ? null : Number(row.checkType);
|
|
814
|
+
return {
|
|
815
|
+
via: "datarule",
|
|
816
|
+
group: "rule",
|
|
817
|
+
name: typeof row.name === "string" ? row.name : null,
|
|
818
|
+
...(Number.isFinite(dataRuleType) ? { dataRuleType, typeName: DATARULE_TRIGGER_TYPE_NAMES[dataRuleType] ?? "未知" } : {}),
|
|
819
|
+
checkType,
|
|
820
|
+
...(checkType !== null ? { checkName: DATARULE_TRIGGER_CHECK_NAMES[checkType] ?? null } : {}),
|
|
821
|
+
childRule: row.childRule === true,
|
|
822
|
+
propertyCodes: Array.isArray(row.propertyCodes) ? row.propertyCodes.map((code) => String(code)) : [],
|
|
823
|
+
};
|
|
824
|
+
}
|
|
793
825
|
/**
|
|
794
826
|
* 在线 JS 触发点的**文本**匹配:每行至多一条(优先级 axios → fetch( → /api/)。
|
|
795
827
|
* 可能漏动态拼 URL、可能命中注释——这是协议局限,回执标 scanMode:"text"。
|
|
@@ -799,8 +831,39 @@ const ONLINEJS_TRIGGER_PATTERNS = [
|
|
|
799
831
|
{ kind: "fetch", test: /fetch\(/ },
|
|
800
832
|
{ kind: "/api/", test: /\/api\// },
|
|
801
833
|
];
|
|
802
|
-
|
|
834
|
+
/**
|
|
835
|
+
* sites 模式每个脚本源的命中行上限。read.ts 的 smallRowSet 只按 triggers **行数**
|
|
836
|
+
* ≤30 放行、不看字节——不设上限时一条 onlinejs 行能把整个回执顶出 2048B 折叠门
|
|
837
|
+
* 直接全量内联(评审必改 3)。hitCount 仍是真实总数。
|
|
838
|
+
*/
|
|
839
|
+
const ONLINEJS_HITS_CAP = 20;
|
|
840
|
+
/**
|
|
841
|
+
* 命中行的「打到哪个接口」抽取:只做**同行字面量**,不做语法分析。
|
|
842
|
+
* - `axios.post('/x')` → `POST /x`;`fetch('/x')` → `/x`(fetch 默认 GET,不编造 method)
|
|
843
|
+
* - 模板串含 `${…}`、变量拼接、`axios({url:…})` 配置式 → 抽不到目标,标 `targetUnresolved`
|
|
844
|
+
* 注释行仍可能命中(scanMode:"text" 的既有局限)。
|
|
845
|
+
*/
|
|
846
|
+
const ONLINEJS_TARGET_PATTERNS = [
|
|
847
|
+
{
|
|
848
|
+
test: /axios\s*\.\s*(post|get|put|delete|patch)\s*\(\s*(["'`])([^"'`]*)\2/,
|
|
849
|
+
build: (match) => match[3].includes("${") ? { target: `${match[1].toUpperCase()} ${match[3]}`, targetUnresolved: true } : { target: `${match[1].toUpperCase()} ${match[3]}` },
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
test: /fetch\s*\(\s*(["'`])([^"'`]*)\1/,
|
|
853
|
+
build: (match) => (match[2].includes("${") ? { target: match[2], targetUnresolved: true } : { target: match[2] }),
|
|
854
|
+
},
|
|
855
|
+
];
|
|
856
|
+
function onlineJsHitTarget(line) {
|
|
857
|
+
for (const pattern of ONLINEJS_TARGET_PATTERNS) {
|
|
858
|
+
const match = pattern.test.exec(line);
|
|
859
|
+
if (match !== null)
|
|
860
|
+
return pattern.build(match);
|
|
861
|
+
}
|
|
862
|
+
return { targetUnresolved: true };
|
|
863
|
+
}
|
|
864
|
+
function onlineJsTriggerSites(script) {
|
|
803
865
|
const hits = [];
|
|
866
|
+
let hitCount = 0;
|
|
804
867
|
script.split("\n").forEach((raw, index) => {
|
|
805
868
|
const line = raw.trim();
|
|
806
869
|
if (line === "")
|
|
@@ -808,10 +871,13 @@ function onlineJsTriggerHits(script) {
|
|
|
808
871
|
const matched = ONLINEJS_TRIGGER_PATTERNS.find((pattern) => pattern.test.test(line));
|
|
809
872
|
if (matched === undefined)
|
|
810
873
|
return;
|
|
874
|
+
hitCount += 1;
|
|
875
|
+
if (hits.length >= ONLINEJS_HITS_CAP)
|
|
876
|
+
return;
|
|
811
877
|
// excerpt ≤120 字(含截断省略号本身)。
|
|
812
|
-
hits.push({ line: index + 1, excerpt: line.length > 120 ? `${line.slice(0, 119)}…` : line, kind: matched.kind });
|
|
878
|
+
hits.push({ line: index + 1, excerpt: line.length > 120 ? `${line.slice(0, 119)}…` : line, kind: matched.kind, ...onlineJsHitTarget(line) });
|
|
813
879
|
});
|
|
814
|
-
return hits;
|
|
880
|
+
return { hits, hitCount };
|
|
815
881
|
}
|
|
816
882
|
/**
|
|
817
883
|
* `action:"create"|"update"|"delete"` 的「绑定到该事件的自定义规则」反推:
|
|
@@ -880,9 +946,17 @@ async function scanSchemaTriggers(session, args) {
|
|
|
880
946
|
let scannedButtons = 0;
|
|
881
947
|
let onlinejsBytes = 0;
|
|
882
948
|
let script = null;
|
|
949
|
+
// 评审必改 1(2026-11-23):SCRIPT 按钮的脚本与表单 customScript 同属「在线 JS
|
|
950
|
+
// 触发面」——数据已在同一次 bizsheet/get 里(options.customButtonJson),零额外
|
|
951
|
+
// wire。actionConfig 可能是对象也可能是 legacy JSON 字符串,解码走
|
|
952
|
+
// decodeButtonScript(与 form.get buttonScripts 同一实现)。
|
|
953
|
+
let scriptButtonCount = 0;
|
|
954
|
+
let buttonScriptBytes = 0;
|
|
955
|
+
const scriptButtonSources = [];
|
|
956
|
+
const unreadableScriptButtons = [];
|
|
883
957
|
const buttonRows = [];
|
|
884
958
|
if (activityCodeFilter !== undefined) {
|
|
885
|
-
notScanned.push("activityCode
|
|
959
|
+
notScanned.push("activityCode 过滤:表单按钮/规则/预置事件/数据规则/在线 JS 未扫描(只看该流程节点的绑定)");
|
|
886
960
|
}
|
|
887
961
|
else {
|
|
888
962
|
try {
|
|
@@ -894,9 +968,25 @@ async function scanSchemaTriggers(session, args) {
|
|
|
894
968
|
const buttons = readFormButtons(sheet.options) ?? [];
|
|
895
969
|
scannedButtons = buttons.length;
|
|
896
970
|
for (const button of buttons) {
|
|
897
|
-
//
|
|
898
|
-
|
|
971
|
+
// BUSINESS_RULE 绑定是规则触发点;SCRIPT 按钮的脚本走文本匹配(下方
|
|
972
|
+
// onlineRows,source:"button");其它按钮(流程动作/页面等)只计数。
|
|
973
|
+
if (button.bindAction !== "BUSINESS_RULE") {
|
|
974
|
+
if (button.bindAction !== "SCRIPT")
|
|
975
|
+
continue;
|
|
976
|
+
const code = typeof button.code === "string" ? button.code : null;
|
|
977
|
+
const decoded = decodeButtonScript(button);
|
|
978
|
+
const source = typeof decoded.scriptData === "string" ? decoded.scriptData : null;
|
|
979
|
+
if (source === null || source.trim() === "") {
|
|
980
|
+
// 聚合点名(不逐个 push):notScanned 有 2000B 内联上限。
|
|
981
|
+
unreadableScriptButtons.push(code ?? "(无 code)");
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
984
|
+
// 只计「实际完成文本扫描」的按钮;不可读的由 notScanned 点名。
|
|
985
|
+
scriptButtonCount += 1;
|
|
986
|
+
buttonScriptBytes += Buffer.byteLength(source, "utf8");
|
|
987
|
+
scriptButtonSources.push({ code, name: typeof button.name === "string" ? button.name : null, script: source });
|
|
899
988
|
continue;
|
|
989
|
+
}
|
|
900
990
|
buttonRows.push({
|
|
901
991
|
via: "button",
|
|
902
992
|
sheetCode,
|
|
@@ -906,9 +996,30 @@ async function scanSchemaTriggers(session, args) {
|
|
|
906
996
|
targetCode: typeof button.targetCode === "string" ? button.targetCode : null,
|
|
907
997
|
});
|
|
908
998
|
}
|
|
909
|
-
|
|
999
|
+
if (unreadableScriptButtons.length > 0) {
|
|
1000
|
+
// 真机 notScanned 已 ~1.3KB/2.0KB 内联上限(超了会被 compact 折成
|
|
1001
|
+
// {count,sha256,omitted},0.6.93 的坑)——按钮名最多点 8 个,其余只报数。
|
|
1002
|
+
const named = unreadableScriptButtons.slice(0, 8).join("、");
|
|
1003
|
+
const rest = unreadableScriptButtons.length > 8 ? ` 等 ${unreadableScriptButtons.length} 个` : "";
|
|
1004
|
+
notScanned.push(`SCRIPT 按钮的脚本不可读(${named}${rest}):actionConfig 缺失/不是合法 JSON 或 scriptData 为空——这些按钮的脚本未扫描`);
|
|
1005
|
+
}
|
|
1006
|
+
if (scriptButtonCount > 0) {
|
|
1007
|
+
// 评审必改 2:读的是授权面(options),运行面用的是发布时物化的
|
|
1008
|
+
// h_biz_button(ModelManagementFacadeImpl.publishBizForm)。不声明就会把
|
|
1009
|
+
// 「草稿里刚改的脚本」报成现状。
|
|
1010
|
+
notScanned.push("按钮脚本读的是表单 options 授权面(发布时才物化为 h_biz_button):草稿里未发布的脚本改动会被当作现状,运行面实际执行上一次发布的版本");
|
|
1011
|
+
if (sheet.published !== true)
|
|
1012
|
+
notScanned.push(`表单 ${sheetCode} 的 published 旗标=${String(sheet.published)}(部分构建该旗标滞后):运行面是否已有这些按钮以发布态为准`);
|
|
1013
|
+
}
|
|
1014
|
+
const publishedHtmlJson = typeof sheet.publishedHtmlJson === "string" ? sheet.publishedHtmlJson : null;
|
|
1015
|
+
script = readCustomScriptSource(publishedHtmlJson).script;
|
|
910
1016
|
if (script === null)
|
|
911
|
-
notScanned.push(`在线 JS:表单 ${sheetCode} 的发布面无 customScript
|
|
1017
|
+
notScanned.push(`在线 JS:表单 ${sheetCode} 的发布面无 customScript 脚本(表单级在线 JS 未扫描;SCRIPT 按钮的脚本单独扫,见 triggers 里 source:"button" 的行)`);
|
|
1018
|
+
// 评审必改 5:把「before/after 恒空」从经验断言变成自校验——真出现非空
|
|
1019
|
+
// 的其它 script 元素就点名(而不是静默漏扫)。
|
|
1020
|
+
const strayScripts = listOtherScriptSources(publishedHtmlJson);
|
|
1021
|
+
if (strayScripts.length > 0)
|
|
1022
|
+
notScanned.push(`布局里除 customScript 外还有非空 script 元素(${strayScripts.map((item) => `${item.id ?? "(无 id)"} ${item.bytes}B`).join("、")})未扫描——8.6.x 实测 before/after 恒空,出现即异常形态`);
|
|
912
1023
|
}
|
|
913
1024
|
}
|
|
914
1025
|
catch (error) {
|
|
@@ -986,17 +1097,65 @@ async function scanSchemaTriggers(session, args) {
|
|
|
986
1097
|
}
|
|
987
1098
|
}
|
|
988
1099
|
}
|
|
989
|
-
//
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1100
|
+
// 4c. 数据规则:服务端新增/更新时执行(见 DATARULE_TRIGGER_TYPE_NAMES 注释)。
|
|
1101
|
+
// 一次 list(+1 wire)。type1/checkType4 是字段创建时自动生成的长度规则,
|
|
1102
|
+
// 聚合一行计数;其余逐条(>30 条截断并点名)。读失败不连坐,进 notScanned。
|
|
1103
|
+
let scannedDataRules = 0;
|
|
1104
|
+
const dataRuleRows = [];
|
|
1105
|
+
if (activityCodeFilter === undefined) {
|
|
1106
|
+
try {
|
|
1107
|
+
const decodedRows = (await listDataRules(session, schemaCode)).map(decodeDataRule);
|
|
1108
|
+
scannedDataRules = decodedRows.length;
|
|
1109
|
+
const autoMaxLength = decodedRows.filter(isAutoMaxLengthRule);
|
|
1110
|
+
const explicitRows = decodedRows.filter((row) => !isAutoMaxLengthRule(row));
|
|
1111
|
+
for (const row of explicitRows.slice(0, TRIGGER_DATARULE_MAX_ROWS))
|
|
1112
|
+
dataRuleRows.push(dataRuleTriggerRow(row));
|
|
1113
|
+
if (explicitRows.length > TRIGGER_DATARULE_MAX_ROWS)
|
|
1114
|
+
notScanned.push(`数据规则 ${explicitRows.length} 条 > ${TRIGGER_DATARULE_MAX_ROWS}:第 ${TRIGGER_DATARULE_MAX_ROWS + 1} 条起未列出(omc call datarule.list --args '{"schemaCode":"${schemaCode}"}' 读全量)`);
|
|
1115
|
+
if (autoMaxLength.length > 0)
|
|
1116
|
+
dataRuleRows.push({
|
|
1117
|
+
via: "datarule",
|
|
1118
|
+
group: "maxLength",
|
|
1119
|
+
count: autoMaxLength.length,
|
|
1120
|
+
dataRuleType: 1,
|
|
1121
|
+
typeName: "校验",
|
|
1122
|
+
checkType: 4,
|
|
1123
|
+
checkName: "最大长度",
|
|
1124
|
+
note: "字段长度上限(平台随字段创建自动生成)——逐条字段与上限见 omc call datarule.list,不是业务自动化",
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
catch (error) {
|
|
1128
|
+
notScanned.push(`数据规则读取失败(${error instanceof Error ? error.message : String(error)}):datarule 未扫描`);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
// 5. 在线 JS 文本匹配(零 wire;表单 customScript + SCRIPT 按钮脚本。无脚本时
|
|
1132
|
+
// 第 3 步已记 notScanned)。
|
|
1133
|
+
const onlineRows = [];
|
|
1134
|
+
const pushOnlineRow = (input) => {
|
|
1135
|
+
const sites = onlineJsTriggerSites(input.script);
|
|
1136
|
+
if (sites.hitCount === 0)
|
|
1137
|
+
return;
|
|
1138
|
+
onlineRows.push({
|
|
1139
|
+
via: "onlinejs",
|
|
1140
|
+
source: input.source,
|
|
1141
|
+
sheetCode,
|
|
1142
|
+
...(input.source === "button" ? { buttonCode: input.buttonCode ?? null, buttonName: input.buttonName ?? null } : {}),
|
|
1143
|
+
scanMode: "text",
|
|
1144
|
+
hitCount: sites.hitCount,
|
|
1145
|
+
...(mode === "sites" ? { hits: sites.hits, ...(sites.hitCount > sites.hits.length ? { hitsTruncated: true } : {}) } : {}),
|
|
1146
|
+
});
|
|
1147
|
+
};
|
|
1148
|
+
if (script !== null) {
|
|
1149
|
+
onlinejsBytes = Buffer.byteLength(script, "utf8");
|
|
1150
|
+
pushOnlineRow({ source: "form", script });
|
|
1151
|
+
}
|
|
1152
|
+
for (const button of scriptButtonSources)
|
|
1153
|
+
pushOnlineRow({ source: "button", buttonCode: button.code, buttonName: button.name, script: button.script });
|
|
995
1154
|
// P4(2026-11-22,F6b):**覆盖面自述**。F6b 转录:任务说「别漏」时,agent 拿到
|
|
996
1155
|
// 触发视图后仍逐面交叉核对 datarule/programming/视图——因为回执只说了"扫了什么",
|
|
997
1156
|
// 没说"哪些面本来就不在这里"。把未覆盖面按入口点名列出来,省掉这轮盲目核对;
|
|
998
1157
|
// 视图/权限不是动作触发点,单独说明"不适用",避免继续查。
|
|
999
|
-
notScanned.push(
|
|
1158
|
+
notScanned.push(`数据规则只查主模型 schemaCode(${schemaCode}):子表规则多数在主表范围可见,公式镜像行/子表独有规则用 datarule.list --schemaCode <子表code> 复核`, `数据规则的动作内容(公式/校验条件/长度上限)不在本视图:omc call datarule.list --args '{"schemaCode":"${schemaCode}"}'`, `后端在线开发(programming)是规则/方法的**动作实现**,不是触发点:要看实现走 omc call programming.sources --args '{"schemaCode":"${schemaCode}"}'`, "自定义页面(custompage)是页面级配置、不挂模型(schemaCode),不在模型触发视图范围", `多表单模型只扫一个槽位(本次 ${sheetCode};省略 sheetCode 时=模型码):其它槽位的按钮与在线 JS 未扫——用 omc call form.list --args '{"schemaCode":"${schemaCode}"}' 列槽位后按 sheetCode 逐个查`, "视图(listview)/字段权限/流程权限不是动作触发点(只影响显示与可达性),无需扫描", "只扫当前应用;跨应用流程与规则需显式换应用(workflow.list --applicationCode)");
|
|
1000
1159
|
// 6. 并集 + action/activityCode 过滤(分组顺序:workflow → button → rule → preset → onlinejs)。
|
|
1001
1160
|
let triggers;
|
|
1002
1161
|
if (activityCodeFilter !== undefined) {
|
|
@@ -1010,11 +1169,13 @@ async function scanSchemaTriggers(session, args) {
|
|
|
1010
1169
|
triggers = [
|
|
1011
1170
|
...ruleRows.filter((row) => bound.has(row.ruleCode) || row.ruleCode.toLowerCase() === action),
|
|
1012
1171
|
...presetRows.filter((row) => row.trigger.toLowerCase() === action),
|
|
1172
|
+
// 数据规则在服务端 insert/update 时执行(delete 不跑):create/update 视图带上,delete 不带。
|
|
1173
|
+
...(action === "delete" ? [] : dataRuleRows),
|
|
1013
1174
|
...onlineRows,
|
|
1014
1175
|
];
|
|
1015
1176
|
}
|
|
1016
1177
|
else {
|
|
1017
|
-
triggers = [...workflowRows, ...buttonRows, ...ruleRows, ...presetRows, ...onlineRows];
|
|
1178
|
+
triggers = [...workflowRows, ...buttonRows, ...ruleRows, ...presetRows, ...dataRuleRows, ...onlineRows];
|
|
1018
1179
|
}
|
|
1019
1180
|
const filterNote = action !== undefined && action !== "flow"
|
|
1020
1181
|
? `;action:"${action}" 的规则绑定判据=workflow 行的 activityCode/nodeEvent/handler 或按钮的 buttonCode/targetCode 含「${action}」,或规则 code 就是 ${action}(不区分大小写,启发式;完整清单去掉 action)`
|
|
@@ -1026,10 +1187,10 @@ async function scanSchemaTriggers(session, args) {
|
|
|
1026
1187
|
action: action ?? null,
|
|
1027
1188
|
mode,
|
|
1028
1189
|
triggers,
|
|
1029
|
-
scanned: { workflows, rules: scannedRules, buttons: scannedButtons, onlinejsBytes, schedulerReads, schedulerReadFailed },
|
|
1190
|
+
scanned: { workflows, rules: scannedRules, buttons: scannedButtons, buttonScripts: scriptButtonCount, onlinejsBytes, buttonScriptBytes, datarules: scannedDataRules, schedulerReads, schedulerReadFailed },
|
|
1030
1191
|
notScanned,
|
|
1031
1192
|
scanMode: "source",
|
|
1032
|
-
note: "
|
|
1193
|
+
note: "零命中=本次扫描未命中触发点,不代表没有触发;数据规则在服务端新增/更新时执行(1 校验/2 计算/3 显示/4 必填/5 只读;type1+checkType4 的字段长度规则聚合计数);在线 JS(表单 customScript + SCRIPT 按钮脚本)是文本匹配,可能漏动态拼 URL、可能命中注释(命中行带 target;抽不到字面量目标标 targetUnresolved)" + schedulerNote + filterNote,
|
|
1033
1194
|
...(activityCodeFilter !== undefined ? { activityCode: activityCodeFilter } : {}),
|
|
1034
1195
|
applicationResolution: { ...applicationResolutionOf(scope), mode: "trigger", models: 1 },
|
|
1035
1196
|
};
|
|
@@ -1119,13 +1280,13 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1119
1280
|
description: RULE_TOOLS["rule.references"].description,
|
|
1120
1281
|
inputSchema: {
|
|
1121
1282
|
environment: environmentArg,
|
|
1122
|
-
kind: z.enum(["service", "model", "field", "rule", "trigger"]).describe("按什么找引用:service=BIZ_ACTION methodMapping.serviceCode(service 行带 serviceMethodCode);model=CREATE/UPDATE/DELETE targetObjectCode 与 methodMapping.schemaCode;field=dataActions.targetDataItem、映射 bizCode、规则条件叶子与 datarule;rule=流程事件绑定的规则码(flow 级 handler + 节点级 nodeEvent,扫应用内模型的流程面);trigger
|
|
1283
|
+
kind: z.enum(["service", "model", "field", "rule", "trigger"]).describe("按什么找引用:service=BIZ_ACTION methodMapping.serviceCode(service 行带 serviceMethodCode);model=CREATE/UPDATE/DELETE targetObjectCode 与 methodMapping.schemaCode;field=dataActions.targetDataItem、映射 bizCode、规则条件叶子与 datarule;rule=流程事件绑定的规则码(flow 级 handler + 节点级 nodeEvent,扫应用内模型的流程面);trigger=一个模型的全部触发点(流程/按钮/规则/预置/数据规则/在线 JS;code 是 schemaCode,不是规则码)"),
|
|
1123
1284
|
code: z.string().min(1).describe("要查引用的编码(服务/模型/字段 code);kind=field 可用 schemaCode.field 消歧"),
|
|
1124
1285
|
schemaCodes: z.union([z.array(z.string().min(1)), z.string()]).optional().describe("只扫这些模型(省 wire 读);省略=全平台模型"),
|
|
1125
1286
|
action: z.enum(["create", "update", "delete", "flow"]).optional().describe("仅 kind=trigger:动作过滤,省略=全量"),
|
|
1126
1287
|
activityCode: z.string().min(1).optional().describe("仅 kind=trigger:只看该流程节点的绑定(与 action 互斥)"),
|
|
1127
1288
|
sheetCode: z.string().min(1).optional().describe("仅 kind=trigger:多表单模型指定槽位;省略=默认槽位"),
|
|
1128
|
-
mode: z.enum(["summary", "sites"]).optional().describe("仅 kind=trigger:summary=默认,在线 JS
|
|
1289
|
+
mode: z.enum(["summary", "sites"]).optional().describe("仅 kind=trigger:summary=默认,在线 JS(表单 customScript + SCRIPT 按钮脚本)只回计数;sites=回命中行(带 target)"),
|
|
1129
1290
|
capability: capabilityArg,
|
|
1130
1291
|
},
|
|
1131
1292
|
handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
|
package/dist/lanes/datarule.js
CHANGED
|
@@ -115,7 +115,7 @@ function storedTargetCodes(row) {
|
|
|
115
115
|
const single = row.propertyCode;
|
|
116
116
|
return single !== undefined && single !== null && String(single).length > 0 ? [String(single)] : [];
|
|
117
117
|
}
|
|
118
|
-
function decodeDataRule(row) {
|
|
118
|
+
export function decodeDataRule(row) {
|
|
119
119
|
const options = parseOptions(row.options);
|
|
120
120
|
const codes = storedTargetCodes(row);
|
|
121
121
|
const decoded = {
|
|
@@ -670,7 +670,7 @@ function dataRuleChanges(before, after) {
|
|
|
670
670
|
changedFields.push(field);
|
|
671
671
|
return { changedFields, unexpectedChanges: changedFields.filter((field) => !["options", "checkType", "childRule", "name", "sortKey", "propertyCode", "propertyCodes", "dataRuleType"].includes(field)) };
|
|
672
672
|
}
|
|
673
|
-
async function listDataRules(session, schemaCode, dataRuleType) {
|
|
673
|
+
export async function listDataRules(session, schemaCode, dataRuleType) {
|
|
674
674
|
const query = { schemaCode };
|
|
675
675
|
if (dataRuleType !== undefined)
|
|
676
676
|
query.dataRuleType = String(dataRuleType);
|
package/dist/lanes/online-js.js
CHANGED
|
@@ -55,6 +55,17 @@ export function readCustomScriptSource(rawHtml) {
|
|
|
55
55
|
? { present: true, script, sha256: createHash("sha256").update(script, "utf8").digest("hex"), elementCount: elements.length }
|
|
56
56
|
: { present: false, script: null, sha256: "", elementCount: elements.length, notCollected: true, notCollectedReason: "customScript 不存在,无法计算脚本哈希" };
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* 2026-11-23(评审必改 5):把「脚本骨架固定 6 元素、before/after 恒空」从经验
|
|
60
|
+
* 断言变成**自校验**——列出布局里除 customScript 外非空的 script 元素。调用方
|
|
61
|
+
* 非空即在 notScanned 点名,避免把「没见过的形态」静默当成「没有脚本」。
|
|
62
|
+
*/
|
|
63
|
+
export function listOtherScriptSources(rawHtml) {
|
|
64
|
+
return parseLayoutElements(rawHtml)
|
|
65
|
+
.filter((element) => element.tagName === "script" && element.id !== "customScript")
|
|
66
|
+
.filter((element) => typeof element.innerHTML === "string" && element.innerHTML.trim() !== "")
|
|
67
|
+
.map((element) => ({ id: typeof element.id === "string" ? element.id : null, bytes: Buffer.byteLength(String(element.innerHTML), "utf8") }));
|
|
68
|
+
}
|
|
58
69
|
/**
|
|
59
70
|
* R75-B(2026-11-18):compose 的两道门都是「读面可判、但在 execute 里」——
|
|
60
71
|
* dry-run 绿灯、真写拒(investigate-B E2 实证)。抽成共享函数,dry-run 与真写
|
package/dist/read.js
CHANGED
|
@@ -65,7 +65,9 @@ export async function governedRead(ctx, tool, args, execute, options = {}) {
|
|
|
65
65
|
|| (Array.isArray(result.logs) && result.logs.length <= 10)
|
|
66
66
|
// 2026-11-22(0.6.93 真机,kind:"trigger"):触发器清单就是答案本体——
|
|
67
67
|
// 6 条就超 2048B 被折叠到 artifact,agent 还得再取一次。与 items/logs 同口径。
|
|
68
|
-
|
|
68
|
+
// 2026-11-23(0.6.97):数据规则纳入后单模型可达 30+ 行(1 条计算/校验规则
|
|
69
|
+
// 各一行)——30→60,仍是有界的小行集(长度规则已聚合,不会无限长)。
|
|
70
|
+
|| (Array.isArray(result.triggers) && result.triggers.length <= 60);
|
|
69
71
|
const large = !smallRowSet && jsonBytes(result) > 2048;
|
|
70
72
|
const fileName = `${tool.name.replace(/[^a-zA-Z0-9._-]/g, "_")}-${sha256(target).slice(0, 16)}.json`;
|
|
71
73
|
const artifactRef = writeArtifact(ctx, fileName, detail);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.97",
|
|
4
4
|
"description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"commander": "14.0.3",
|
|
59
|
-
"omc-core": "0.6.
|
|
59
|
+
"omc-core": "0.6.97",
|
|
60
60
|
"proper-lockfile": "4.1.2",
|
|
61
61
|
"write-file-atomic": "6.0.0",
|
|
62
62
|
"zod": "^3.23.8",
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"directory": "packages/omc-cli"
|
|
75
75
|
},
|
|
76
76
|
"optionalDependencies": {
|
|
77
|
-
"@stalfh233/omc-fake-platform": "0.6.
|
|
77
|
+
"@stalfh233/omc-fake-platform": "0.6.97"
|
|
78
78
|
}
|
|
79
79
|
}
|