@stalfh233/omc-cli 0.8.15 → 0.8.17
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/cli.js +50 -14
- package/dist/discovery.js +2 -0
- package/dist/field-add.js +1 -1
- package/dist/form-support.js +213 -19
- package/dist/goal-plan.js +23 -2
- package/dist/goal-routes.js +94 -18
- package/dist/human-summary.js +24 -4
- package/dist/lanes/datarule.js +3 -0
- package/dist/lanes/field-contract.js +10 -1
- package/dist/lanes/field.js +10 -2
- package/dist/lanes/form.js +3 -1
- package/dist/lanes/list-view-contract.js +1 -1
- package/dist/lanes/list-view.js +56 -0
- package/dist/lanes/model-references.js +22 -3
- package/dist/lanes/runtime-data.js +97 -17
- package/dist/lanes/workflow.js +97 -14
- package/dist/model-purge.js +112 -37
- package/dist/model-scaffold.js +11 -3
- package/dist/path-projection.js +151 -4
- package/dist/recipes/datarule.js +39 -1
- package/dist/recipes/form.js +2 -2
- package/dist/residue.js +13 -2
- package/dist/tool-types.js +19 -0
- package/dist/wire-refusal.js +171 -0
- package/dist/write.js +27 -174
- package/package.json +3 -3
- package/skills/omc-glossary.md +22 -0
- package/skills/omc-start-here.md +1 -1
|
@@ -18,7 +18,8 @@ import { scanPages } from "./runtime-paging.js";
|
|
|
18
18
|
import { dataRuleSubmitContext } from "./datarule.js";
|
|
19
19
|
import { decodeJsonColumn, JSON_COLUMN_NULL_COALESCE } from "../json-column.js";
|
|
20
20
|
import { FIELD_PROPERTY_TYPES, SYSTEM_FIELD_CODES, familyName } from "../field-families.js";
|
|
21
|
-
import { applicationResolutionOf, resolveApplicationScope } from "../support.js";
|
|
21
|
+
import { applicationResolutionOf, isUncertainWireError, resolveApplicationScope } from "../support.js";
|
|
22
|
+
import { refusalFromWireError } from "../wire-refusal.js";
|
|
22
23
|
/** r29b F8: keep ids/itemsPreview through governedRead's compact diet. */
|
|
23
24
|
const DATA_LIST_PREVIEW_LIMIT = 20;
|
|
24
25
|
function dataListItemPreview(items) {
|
|
@@ -3722,6 +3723,14 @@ export function registerRuntimeDataLane(tools) {
|
|
|
3722
3723
|
: {}),
|
|
3723
3724
|
draftRuleHint: ((saveIsUpdate ? workflowUpdateHint : workflowDraftHint) ?? workflowCheckSkippedHint) ?? "草稿态(DRAFT)保存不触发业务规则——DRAFT 行跳过 Create/Update 分发(DomainServiceImpl.java:240-248);要一调完成态本调用加 submit:true(仅 data.save 有此参数;data.submit 不收);已存草稿直提形状:data.submit {schemaCode, bizObjectId: 本读回的 bizObjectId, formData}(submit 自持久化)",
|
|
3724
3725
|
};
|
|
3726
|
+
// w132 复核:submitRefused 存在时 draftRuleHint 自相矛盾(它还教「加
|
|
3727
|
+
// submit:true / data.submit 直提」)。partial 回执统一省略该键——本次已经
|
|
3728
|
+
// 试过提交,下一步只能从 submitRefused 读,不能再教一遍相同动作。
|
|
3729
|
+
const partialReadback = (submitRefused) => {
|
|
3730
|
+
const rest = { ...plainReadback };
|
|
3731
|
+
delete rest.draftRuleHint;
|
|
3732
|
+
return { ...rest, submitRefused };
|
|
3733
|
+
};
|
|
3725
3734
|
// r18 retro (G3): one-call COMPLETED creation — the agent goal is usually
|
|
3726
3735
|
// "record AND rule effect", not "a draft". Chain the no-flow submit in
|
|
3727
3736
|
// the same governed write (the same sibling execute apply_changes uses).
|
|
@@ -3731,31 +3740,102 @@ export function registerRuntimeDataLane(tools) {
|
|
|
3731
3740
|
// COMPLETED) — the one-call chain's ruleHint would lie. Workflow-
|
|
3732
3741
|
// backed models keep the two-phase chain.
|
|
3733
3742
|
if (publishedWorkflow) {
|
|
3743
|
+
// P1(w132 探针 J):草稿已落库、提交被确定拒收——这是 partial,不是
|
|
3744
|
+
// ok/DELIVERED。旧回执把 submitRefused 埋在 readback 里,顶层仍盖
|
|
3745
|
+
// DELIVERED,调用方只看 status 会以为已提交。保留原 blocker 名(
|
|
3746
|
+
// submit-model-has-workflow)在 submitRefused 里,顶层用自己的
|
|
3747
|
+
// blocker 说明「首段成功、复合目标未完成」。
|
|
3748
|
+
const submitRefused = {
|
|
3749
|
+
blocker: "submit-model-has-workflow",
|
|
3750
|
+
workflowCode: publishedWorkflow,
|
|
3751
|
+
// 更新行不能复用新建语义(「没有流程实例 / 重建草稿 / formData 不要带 id」
|
|
3752
|
+
// 都会让调用方多建一行);按 saveIsUpdate 分路。
|
|
3753
|
+
message: `草稿已保存(bizObjectId=${bizObjectId});${saveIsUpdate ? workflowUpdateHint : workflowDraftHint}(见 describe data.submit --example workflow-backed-data-submit)`,
|
|
3754
|
+
};
|
|
3755
|
+
const nextCommand = saveIsUpdate
|
|
3756
|
+
? `omc call workitem.list --args '{"schemaCode":"${args.schemaCode}"}'`
|
|
3757
|
+
: `omc call data.save --env <env> --args '{"schemaCode":"${args.schemaCode}","workflowCode":"${publishedWorkflow}","formData":{...}}'`;
|
|
3734
3758
|
return {
|
|
3759
|
+
status: "partial",
|
|
3760
|
+
blocker: "submit-refused-after-save",
|
|
3761
|
+
submitRefused,
|
|
3762
|
+
message: `草稿已保存(bizObjectId=${bizObjectId}),提交未完成:模型有已发布流程 ${publishedWorkflow},submit:true 被拒(submit-model-has-workflow)。` +
|
|
3763
|
+
`要提交请走两段式:${saveIsUpdate ? "workitem.list 找现有待办 → data.submit 三件套" : "先用 workflowCode 保存流程草稿取得 workItemId,再 data.submit 三件套"}。`,
|
|
3764
|
+
nextCommand,
|
|
3735
3765
|
performed: { errcode: performed.errcode, bizObjectId, sheetCode, resolvedFrom, submitted: false },
|
|
3736
|
-
readback:
|
|
3737
|
-
...plainReadback,
|
|
3738
|
-
submitRefused: {
|
|
3739
|
-
blocker: "submit-model-has-workflow",
|
|
3740
|
-
workflowCode: publishedWorkflow,
|
|
3741
|
-
// 更新行不能复用新建语义(「没有流程实例 / 重建草稿 / formData 不要带 id」
|
|
3742
|
-
// 都会让调用方多建一行);按 saveIsUpdate 分路。
|
|
3743
|
-
message: `草稿已保存;${saveIsUpdate ? workflowUpdateHint : workflowDraftHint}(见 describe data.submit --example workflow-backed-data-submit)`,
|
|
3744
|
-
},
|
|
3745
|
-
},
|
|
3766
|
+
readback: partialReadback(submitRefused),
|
|
3746
3767
|
};
|
|
3747
3768
|
}
|
|
3748
3769
|
const submitTool = tools.find((entry) => entry.name === "data.submit");
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3770
|
+
// writeExecute 失败是**抛异常**(ToolRefusalError / WireError),不会返回
|
|
3771
|
+
// `{status:...}`——历史返回分支因此不可达,异常会冒到外层 wrote 管线,
|
|
3772
|
+
// 把「草稿已保存」的事实一起丢掉(复核驳回 P1b/P1c)。这里接住异常,
|
|
3773
|
+
// 统一折成 partial + 已落草稿证据;transport/uncertain 也按 partial 报
|
|
3774
|
+
// (submitRefused.outcome:"uncertain"),因为草稿的落库是确定的,只有
|
|
3775
|
+
// 提交结果未知——不回滚、不冒充全部完成。
|
|
3776
|
+
let submitOutcome;
|
|
3777
|
+
try {
|
|
3778
|
+
submitOutcome = submitTool?.writeExecute
|
|
3779
|
+
? (await submitTool.writeExecute(session, { schemaCode: args.schemaCode, bizObjectId, formData: args.formData }))
|
|
3780
|
+
: { status: "error", message: "data.submit 工具不可用" };
|
|
3781
|
+
}
|
|
3782
|
+
catch (error) {
|
|
3783
|
+
// 本地拒绝(ToolRefusalError)永远是确定的拒绝,即便 message 里恰好
|
|
3784
|
+
// 出现 timeout 字样也不能被当成传输不确定。
|
|
3785
|
+
const uncertain = !(error instanceof ToolRefusalError) && isUncertainWireError(error);
|
|
3786
|
+
const failure = error instanceof ToolRefusalError
|
|
3787
|
+
? { ...error.payload }
|
|
3788
|
+
: error instanceof WireError
|
|
3789
|
+
// 复用 governedWrite 的同一张 WireError 翻译表(300004 分叉、
|
|
3790
|
+
// 409200 隐藏字段、40000 双成因、@AdminOnly 等)——不要在这里
|
|
3791
|
+
// 复制一份简化文案,否则 submit-leg 会只剩平台原文。
|
|
3792
|
+
? refusalFromWireError(error)
|
|
3793
|
+
: {
|
|
3794
|
+
status: uncertain ? "uncertain" : "refused",
|
|
3795
|
+
blocker: uncertain ? "submit-outcome-uncertain" : "submit-failed-after-save",
|
|
3796
|
+
message: error instanceof Error ? error.message : String(error),
|
|
3797
|
+
};
|
|
3798
|
+
// uncertain 形态(transport / 401-403)在翻译表里是 refused(那张表
|
|
3799
|
+
// 描述的是「写请求被拒/结果未知」的基线);submit-leg 已知首段草稿
|
|
3800
|
+
// 落库确定、只有提交结果未知——status 与 outcome 必须同时对齐为
|
|
3801
|
+
// uncertain,不能留 status:"refused" 与 outcome 自相矛盾。
|
|
3802
|
+
const submitRefused = uncertain ? { ...failure, status: "uncertain", outcome: "uncertain" } : failure;
|
|
3803
|
+
const refusalMessage = typeof submitRefused.message === "string" && submitRefused.message.length > 0
|
|
3804
|
+
? submitRefused.message
|
|
3805
|
+
: `提交失败(${String(submitRefused.blocker ?? submitRefused.status ?? "?")})`;
|
|
3806
|
+
const transportLabel = error instanceof WireError && error.kind === "http-status"
|
|
3807
|
+
? `服务器返回 HTTP ${error.diagnostic?.httpStatus ?? "异常"} 响应`
|
|
3808
|
+
: "网络传输中断";
|
|
3809
|
+
return {
|
|
3810
|
+
status: "partial",
|
|
3811
|
+
blocker: "submit-refused-after-save",
|
|
3812
|
+
submitRefused,
|
|
3813
|
+
// 自动化只看 status/deliveryState 仍可能把「提交结果未知」读成普通
|
|
3814
|
+
// 拒绝;显式再带一个顶层信号(write.ts 透传)。
|
|
3815
|
+
...(uncertain ? { submitOutcome: "uncertain" } : {}),
|
|
3816
|
+
message: `草稿已保存(bizObjectId=${bizObjectId}),提交未完成:` +
|
|
3817
|
+
(uncertain ? `提交结果未知(${transportLabel})——先 data.load/workitem.list 核对草稿与待办,再决定是否重发` : refusalMessage),
|
|
3818
|
+
nextCommand: typeof submitRefused.nextCommand === "string"
|
|
3819
|
+
? submitRefused.nextCommand
|
|
3820
|
+
: `omc call data.load --env <env> --args '{"schemaCode":"${args.schemaCode}","bizObjectId":"${bizObjectId}"}'`,
|
|
3821
|
+
performed: { errcode: performed.errcode, bizObjectId, sheetCode, resolvedFrom, submitted: false },
|
|
3822
|
+
readback: partialReadback(submitRefused),
|
|
3823
|
+
};
|
|
3824
|
+
}
|
|
3752
3825
|
if ("status" in submitOutcome && typeof submitOutcome.status === "string" && submitOutcome.status !== "ok") {
|
|
3753
|
-
// The save itself
|
|
3754
|
-
//
|
|
3826
|
+
// The save itself landed but the submit did not. This is a partial
|
|
3827
|
+
// composite write — never status ok/DELIVERED (P1, w132 probe J).
|
|
3755
3828
|
const envelope = "envelope" in submitOutcome ? submitOutcome.envelope : submitOutcome;
|
|
3829
|
+
const innerMessage = typeof envelope.message === "string" && envelope.message.length > 0 ? envelope.message : `提交失败(${String(envelope.blocker ?? envelope.status ?? "?")})`;
|
|
3830
|
+
const innerNext = typeof envelope.nextCommand === "string" ? envelope.nextCommand : `omc call data.submit --env <env> --args '{"schemaCode":"${args.schemaCode}","bizObjectId":"${bizObjectId}"}'`;
|
|
3756
3831
|
return {
|
|
3832
|
+
status: "partial",
|
|
3833
|
+
blocker: "submit-refused-after-save",
|
|
3834
|
+
submitRefused: envelope,
|
|
3835
|
+
message: `草稿已保存(bizObjectId=${bizObjectId}),提交未完成:${innerMessage}`,
|
|
3836
|
+
nextCommand: innerNext,
|
|
3757
3837
|
performed: { errcode: performed.errcode, bizObjectId, sheetCode, resolvedFrom, submitted: false },
|
|
3758
|
-
readback:
|
|
3838
|
+
readback: partialReadback(envelope),
|
|
3759
3839
|
};
|
|
3760
3840
|
}
|
|
3761
3841
|
const okOutcome = submitOutcome;
|
package/dist/lanes/workflow.js
CHANGED
|
@@ -13,6 +13,7 @@ import { wireCall, wireRows, WireError } from "../wire.js";
|
|
|
13
13
|
import { diagnoseInstanceActivity, getInstanceBaseInfo, isCanceledInstanceStatus, isFinishedInstanceStatus, listInstanceActivities, listWorkItemsByParticipant, resolveBizObjectIdByInstance, searchWorkItems, wireString } from "../workflow-support.js";
|
|
14
14
|
import { readSchemaFormButtons } from "../form-support.js";
|
|
15
15
|
import { WORKFLOW_EVENT_HANDLER_FIELDS, WORKFLOW_NODE_EVENT_HANDLER_FIELDS, WORKFLOW_LANE_CONTRACT, workflowTemplateArg } from "./workflow-contract.js";
|
|
16
|
+
import { decodeActionRow } from "./list-view-shapes.js";
|
|
16
17
|
import { PLATFORM_TRIGGER_RULE_CODES } from "./rule-graph.js";
|
|
17
18
|
import { executeRuleEnableWrite } from "./rule-lifecycle.js";
|
|
18
19
|
import { PLATFORM_ADMIN_START_BYPASS, resolvePermissionActor } from "../identity.js";
|
|
@@ -3351,20 +3352,35 @@ export function registerWorkflowLane(tools) {
|
|
|
3351
3352
|
actions: [],
|
|
3352
3353
|
replaceActions: true,
|
|
3353
3354
|
})}'`;
|
|
3355
|
+
// F8(0.8.16 探针 J):`workflow.delete` 已支持 `unbindListviews:true`——它
|
|
3356
|
+
// 只解本流程的视图绑定,不动视图其它动作。旧的 beforeWorkflowDelete 只
|
|
3357
|
+
// 指向 listview.configure `actions:[] + replaceActions:true`,那会把
|
|
3358
|
+
// add/delete/import/export/editowner 等其它动作一起清掉。首选 unbindListviews。
|
|
3359
|
+
const workflowDeleteCommand = `omc call workflow.delete --env <env> --args '${JSON.stringify({
|
|
3360
|
+
schemaCode: args.schemaCode,
|
|
3361
|
+
code: args.code,
|
|
3362
|
+
unbindListviews: true,
|
|
3363
|
+
})}'`;
|
|
3354
3364
|
const listviewBinding = {
|
|
3355
3365
|
bound: addBindings.bound.map(({ code, actionCode }) => ({ code, actionCode })),
|
|
3356
3366
|
...(firstPublish ? {} : { firstPublish: false }),
|
|
3357
3367
|
note: addBindings.bound.length > 0
|
|
3358
3368
|
? firstPublish
|
|
3359
|
-
? "首次发布已把本模型各列表视图的 add
|
|
3360
|
-
: "列表视图的 add
|
|
3369
|
+
? "首次发布已把本模型各列表视图的 add 动作绑到本流程;删流程前用 workflow.delete 的 nextCommand(unbindListviews:true)解绑"
|
|
3370
|
+
: "列表视图的 add 动作已绑定本流程(本次不是首次发布,绑定沿用既有配置);删流程前用 workflow.delete 的 nextCommand(unbindListviews:true)解绑"
|
|
3361
3371
|
: addBindings.readable
|
|
3362
3372
|
? "无隐式绑定"
|
|
3363
3373
|
: "列表视图读取失败,未能确认 add 绑定;删流程前先 listview.get 复核",
|
|
3364
3374
|
...(addBindings.bound.length > 0
|
|
3365
3375
|
? {
|
|
3366
|
-
beforeWorkflowDelete: "
|
|
3367
|
-
...(unbindCommand !== undefined
|
|
3376
|
+
beforeWorkflowDelete: "删流程前先解绑:首选 nextCommand —— workflow.delete 带 unbindListviews:true,本工具会先逐个视图解绑(只清本流程的绑定,不动视图其它动作),再删流程;否则会撞 workflow-bound-to-listview(303024,列表还绑着流程)。多个视图绑定时由 unbindListviews 逐视图处理。",
|
|
3377
|
+
...(unbindCommand !== undefined
|
|
3378
|
+
? {
|
|
3379
|
+
unbindCommand,
|
|
3380
|
+
unbindCommandNote: "次选(只在你想手工改视图时用):listview.configure 清 actions:[] + replaceActions:true 会**顺带清掉该视图的其它动作**(add/delete/import/export/editowner 等),不是只解本流程绑定;只想解本流程绑定请用 nextCommand。",
|
|
3381
|
+
}
|
|
3382
|
+
: {}),
|
|
3383
|
+
nextCommand: workflowDeleteCommand,
|
|
3368
3384
|
}
|
|
3369
3385
|
: {}),
|
|
3370
3386
|
};
|
|
@@ -3924,7 +3940,7 @@ export function registerWorkflowLane(tools) {
|
|
|
3924
3940
|
unbindListviews: z
|
|
3925
3941
|
.boolean()
|
|
3926
3942
|
.optional()
|
|
3927
|
-
.describe("先解绑列表视图再删流程:true
|
|
3943
|
+
.describe("先解绑列表视图再删流程:true 时对每个绑定了本流程的列表视图,只移除其 add 动作里指向本流程的那一条(保留 delete/import/export/editowner 等其它动作),再删流程;任一步解绑失败即停、不删流程。**会改动视图配置(移除该视图 add 动作的平台关联),必须显式确认才做。** 默认 false 只删流程,遇 303024 仍拒绝并给 nextCommand"),
|
|
3928
3944
|
},
|
|
3929
3945
|
// F7(0.8.8):dry-run 与真写共用同一份只读扫描——预览列出会被解绑的视图,
|
|
3930
3946
|
// 真写在任何写 wire 之前也先跑这里。两者都不写。
|
|
@@ -3955,7 +3971,7 @@ export function registerWorkflowLane(tools) {
|
|
|
3955
3971
|
code,
|
|
3956
3972
|
name,
|
|
3957
3973
|
...(fieldCodes.length > 0 ? { fieldCodes } : {}),
|
|
3958
|
-
action: "
|
|
3974
|
+
action: "移除指向本流程的 add 绑定(其余动作原样保留)",
|
|
3959
3975
|
})),
|
|
3960
3976
|
}
|
|
3961
3977
|
: {}),
|
|
@@ -3984,14 +4000,20 @@ export function registerWorkflowLane(tools) {
|
|
|
3984
4000
|
workflowCode: args.code,
|
|
3985
4001
|
message: "workflow.delete 需要 listview.configure 来解绑视图,但它未注册写执行;零写入停止",
|
|
3986
4002
|
});
|
|
3987
|
-
|
|
4003
|
+
const boundViews = new Map();
|
|
4004
|
+
for (const view of scan.bound)
|
|
4005
|
+
if (!boundViews.has(view.code))
|
|
4006
|
+
boundViews.set(view.code, view);
|
|
4007
|
+
for (const view of boundViews.values()) {
|
|
3988
4008
|
const fieldCodes = view.fieldCodes.length > 0 ? view.fieldCodes : ["createdTime", "creater", "name", "sequenceNo"];
|
|
4009
|
+
// F8(0.8.16):只移除指向本流程的 add 行,其余动作原样回写。
|
|
4010
|
+
const remainingActions = actionsWithoutWorkflowBinding(view.actions, args.code, args.schemaCode);
|
|
3989
4011
|
try {
|
|
3990
4012
|
const outcome = await configure.writeExecute(session, {
|
|
3991
4013
|
schemaCode: args.schemaCode,
|
|
3992
4014
|
code: view.code,
|
|
3993
4015
|
fieldCodes,
|
|
3994
|
-
actions:
|
|
4016
|
+
actions: remainingActions,
|
|
3995
4017
|
replaceActions: true,
|
|
3996
4018
|
});
|
|
3997
4019
|
if ("status" in outcome)
|
|
@@ -4007,8 +4029,16 @@ export function registerWorkflowLane(tools) {
|
|
|
4007
4029
|
status: "ok",
|
|
4008
4030
|
viewCode: view.code,
|
|
4009
4031
|
viewName: view.name,
|
|
4010
|
-
actions: "
|
|
4032
|
+
actions: "selective-unbind",
|
|
4033
|
+
removedActions: view.actions
|
|
4034
|
+
.filter((action) => isWorkflowAddBinding(action, args.code, args.schemaCode))
|
|
4035
|
+
.map((action) => ({
|
|
4036
|
+
actionCode: action.actionCode ?? null,
|
|
4037
|
+
associationCode: action.associationCode ?? null,
|
|
4038
|
+
})),
|
|
4039
|
+
keptActions: remainingActions.map((action) => action.actionCode),
|
|
4011
4040
|
replaceActions: true,
|
|
4041
|
+
note: "add 动作已移除,平台读面不会自动补回(也不会重新绑定本流程);需要恢复新增按钮时用 listview.configure defaultActions:true 重建内置动作。",
|
|
4012
4042
|
readback: outcome.readback,
|
|
4013
4043
|
});
|
|
4014
4044
|
}
|
|
@@ -4021,7 +4051,7 @@ export function registerWorkflowLane(tools) {
|
|
|
4021
4051
|
schemaCode: args.schemaCode,
|
|
4022
4052
|
viewCode: view.code,
|
|
4023
4053
|
steps,
|
|
4024
|
-
nextCommand: `omc call listview.configure --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, code: view.code, fieldCodes, actions:
|
|
4054
|
+
nextCommand: `omc call listview.configure --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, code: view.code, fieldCodes, actions: remainingActions, replaceActions: true })}'`,
|
|
4025
4055
|
message: `解绑列表视图 ${view.code} 失败,已停止:**流程 ${args.code} 未删除**(不半删)。原因:${cause}。` +
|
|
4026
4056
|
`按 nextCommand 修好该视图后重发 workflow.delete(仍带 unbindListviews:true);已成功解绑的视图在 steps 里。`,
|
|
4027
4057
|
});
|
|
@@ -4073,6 +4103,14 @@ export function registerWorkflowLane(tools) {
|
|
|
4073
4103
|
replaceActions: true,
|
|
4074
4104
|
};
|
|
4075
4105
|
const detachExample = `omc call listview.configure --env <env> --args '${JSON.stringify(detachArgs)}'`;
|
|
4106
|
+
// F8(0.8.16 复核):安全路径优先——workflow.delete 带 unbindListviews
|
|
4107
|
+
// 只移除本流程的 add 绑定,保留 delete/import/export/editowner 等其它
|
|
4108
|
+
// 动作;listview.configure actions:[] 是全清次选,必须标明代价。
|
|
4109
|
+
const safeUnbindDeleteCommand = `omc call workflow.delete --env <env> --args '${JSON.stringify({
|
|
4110
|
+
schemaCode: args.schemaCode,
|
|
4111
|
+
code: args.code,
|
|
4112
|
+
unbindListviews: true,
|
|
4113
|
+
})}'`;
|
|
4076
4114
|
throw new ToolRefusalError({
|
|
4077
4115
|
status: "refused",
|
|
4078
4116
|
blocker: "workflow-bound-to-listview",
|
|
@@ -4086,15 +4124,18 @@ export function registerWorkflowLane(tools) {
|
|
|
4086
4124
|
associationCode,
|
|
4087
4125
|
...(cols.length > 0 ? { fieldCodes: cols } : {}),
|
|
4088
4126
|
})),
|
|
4089
|
-
nextCommand:
|
|
4127
|
+
nextCommand: safeUnbindDeleteCommand,
|
|
4128
|
+
unbindCommand: detachExample,
|
|
4129
|
+
unbindCommandNote: "次选(只在你想手工改视图时用):listview.configure 清 actions:[] + replaceActions:true 会**顺带清掉该视图的其它动作**(add/delete/import/export/editowner 等),不是只解本流程绑定;只想解本流程绑定请用 nextCommand(workflow.delete 带 unbindListviews:true)。",
|
|
4090
4130
|
message: `流程 ${args.code} 仍被列表视图绑定(303024「列表绑定了流程」)。` +
|
|
4091
4131
|
(bound.length > 0
|
|
4092
4132
|
? `绑在:${bound.map((view) => `${view.code}(${view.name})action=${view.actionCode ?? "?"}`).join("、")}。`
|
|
4093
4133
|
: `默认视图多半是 ${args.schemaCode}(workflow.create 会自动绑)。`) +
|
|
4094
|
-
|
|
4134
|
+
`先解绑再删:nextCommand 是 workflow.delete 带 unbindListviews:true(只移除本流程的 add 绑定,保留 delete/import/export/editowner 等其它动作)。` +
|
|
4135
|
+
`次选 unbindCommand(listview.configure actions:[] + replaceActions:true + 现有 fieldCodes)会**清掉该视图其它动作**,只在你想手工改视图时用。` +
|
|
4095
4136
|
(args.unbindListviews === true
|
|
4096
|
-
? `本次已带 unbindListviews:true,但仍有绑定未被清掉(见 boundListviews / unreadableViews
|
|
4097
|
-
:
|
|
4137
|
+
? `本次已带 unbindListviews:true,但仍有绑定未被清掉(见 boundListviews / unreadableViews);可重发 nextCommand,若仍 303024 用 unbindCommand 逐视图手工处理。`
|
|
4138
|
+
: "") +
|
|
4098
4139
|
`整体清理也可用 omc model-purge --code ${args.schemaCode}(级联带走流程模板与视图)。`,
|
|
4099
4140
|
});
|
|
4100
4141
|
}
|
|
@@ -4115,6 +4156,7 @@ export function registerWorkflowLane(tools) {
|
|
|
4115
4156
|
listviewUnbind: {
|
|
4116
4157
|
requested: true,
|
|
4117
4158
|
unboundViews: steps.filter((step) => step.step === "listview.configure").map((step) => step.viewCode),
|
|
4159
|
+
note: "只移除了指向本流程的 add 绑定;平台读面不会自动补回。需要恢复新增按钮时用 listview.configure defaultActions:true 重建内置动作。",
|
|
4118
4160
|
},
|
|
4119
4161
|
}
|
|
4120
4162
|
: {}),
|
|
@@ -4541,6 +4583,11 @@ export function registerWorkflowLane(tools) {
|
|
|
4541
4583
|
* (F7 0.8.8). Bindings are only ever created on the `add` action by
|
|
4542
4584
|
* workflow.publish → updateBizQueryAddAction (8.6.26
|
|
4543
4585
|
* WorkflowTemplateController.java:791,818-846; 2.1.5 :695-711,741-761).
|
|
4586
|
+
*
|
|
4587
|
+
* 0.8.16 F8: `actions` carries the view's decoded action rows (the same
|
|
4588
|
+
* `query/get` response), so workflow.delete can remove ONLY the workflow-bound
|
|
4589
|
+
* `add` row and write the remaining set back — delete/import/export/editowner
|
|
4590
|
+
* and caller-authored actions survive the unbind.
|
|
4544
4591
|
*/
|
|
4545
4592
|
async function scanListviewsBoundToWorkflow(session, schemaCode, workflowCode) {
|
|
4546
4593
|
const bound = [];
|
|
@@ -4565,6 +4612,7 @@ export function registerWorkflowLane(tools) {
|
|
|
4565
4612
|
const fieldCodes = (Array.isArray(model.queryColumns) ? model.queryColumns : [])
|
|
4566
4613
|
.map((column) => String(column.propertyCode ?? ""))
|
|
4567
4614
|
.filter(Boolean);
|
|
4615
|
+
const decodedActions = actions.map(decodeActionRow);
|
|
4568
4616
|
for (const action of actions) {
|
|
4569
4617
|
const association = action.associationType ?? action.queryActionRelativeType;
|
|
4570
4618
|
const associationCode = String(action.associationCode ?? action.relativeCode ?? "");
|
|
@@ -4582,6 +4630,7 @@ export function registerWorkflowLane(tools) {
|
|
|
4582
4630
|
actionCode: action.actionCode === undefined || action.actionCode === null ? null : String(action.actionCode),
|
|
4583
4631
|
associationCode: associationCode || null,
|
|
4584
4632
|
fieldCodes,
|
|
4633
|
+
actions: decodedActions,
|
|
4585
4634
|
});
|
|
4586
4635
|
}
|
|
4587
4636
|
}
|
|
@@ -4597,6 +4646,40 @@ export function registerWorkflowLane(tools) {
|
|
|
4597
4646
|
async function findListviewsBoundToWorkflow(session, schemaCode, workflowCode) {
|
|
4598
4647
|
return (await scanListviewsBoundToWorkflow(session, schemaCode, workflowCode)).bound;
|
|
4599
4648
|
}
|
|
4649
|
+
/**
|
|
4650
|
+
* F8(0.8.16): is this the workflow-bound `add` row? The platform only ever
|
|
4651
|
+
* binds the `add` action to a workflow (publish → updateBizQueryAddAction),
|
|
4652
|
+
* so that single row is what must go; every other action stays untouched.
|
|
4653
|
+
*/
|
|
4654
|
+
const isWorkflowAddBinding = (action, workflowCode, schemaCode) => {
|
|
4655
|
+
if (String(action.actionCode ?? "") !== "add")
|
|
4656
|
+
return false;
|
|
4657
|
+
if (String(action.associationType ?? "").toUpperCase() !== "WORKFLOW")
|
|
4658
|
+
return false;
|
|
4659
|
+
const associationCode = String(action.associationCode ?? "");
|
|
4660
|
+
return associationCode === workflowCode || associationCode === schemaCode || associationCode === "";
|
|
4661
|
+
};
|
|
4662
|
+
/**
|
|
4663
|
+
* Build the configure `actions` payload that keeps every action except the
|
|
4664
|
+
* workflow-bound `add` row. Decoded read rows are converted back to the
|
|
4665
|
+
* configure arg shape (nulls dropped — optional zod fields reject null) and
|
|
4666
|
+
* renumbered, because query/update assigns `sortKey` by array position.
|
|
4667
|
+
*/
|
|
4668
|
+
const actionsWithoutWorkflowBinding = (actions, workflowCode, schemaCode) => actions
|
|
4669
|
+
.filter((action) => !isWorkflowAddBinding(action, workflowCode, schemaCode))
|
|
4670
|
+
.map((action, index) => {
|
|
4671
|
+
const row = {
|
|
4672
|
+
actionCode: String(action.actionCode ?? ""),
|
|
4673
|
+
queryActionType: String(action.queryActionType ?? ""),
|
|
4674
|
+
sortKey: index + 1,
|
|
4675
|
+
};
|
|
4676
|
+
for (const key of ["name", "icon", "systemAction", "serviceCode", "serviceMethod", "customService", "associationCode", "associationType"]) {
|
|
4677
|
+
const value = action[key];
|
|
4678
|
+
if (value !== null && value !== undefined)
|
|
4679
|
+
row[key] = value;
|
|
4680
|
+
}
|
|
4681
|
+
return row;
|
|
4682
|
+
});
|
|
4600
4683
|
// `list_permission` echoes the PERMISSION row id plus the unit's display name
|
|
4601
4684
|
// and code — never the unitId (WorkflowTemplateController.getPermissionMap).
|
|
4602
4685
|
// So identity for readback/removal is resolved from the unit's own face.
|