@stalfh233/omc-cli 0.4.92 → 0.4.93
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/approval-flow.js +21 -5
- package/package.json +3 -3
package/dist/approval-flow.js
CHANGED
|
@@ -93,7 +93,7 @@ export async function cmdApprovalFlow(args) {
|
|
|
93
93
|
return 0;
|
|
94
94
|
}
|
|
95
95
|
// 1) 确保流程存在(一个模型只能有一个:已存在则直接 update)
|
|
96
|
-
const createOutcome = await runToolCall("workflow.create", { args: { schemaCode: schema, code: compiled.workflowCode, name: `${schema} 审批流`, ...(environment ? { environment } : {}) }, requestId: request, environment });
|
|
96
|
+
const createOutcome = await runToolCall("workflow.create", { args: { schemaCode: schema, code: compiled.workflowCode, name: `${schema} 审批流`, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
|
|
97
97
|
if (createOutcome.exitCode !== 0) {
|
|
98
98
|
const result = createOutcome.result;
|
|
99
99
|
const blocker = String(result.blocker ?? "");
|
|
@@ -102,8 +102,24 @@ export async function cmdApprovalFlow(args) {
|
|
|
102
102
|
return createOutcome.exitCode;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
+
// r14 U1: `<schema>_wf` is THIS composer's own naming convention (not the
|
|
106
|
+
// platform's), and `workflow.create` is idempotent — when that code already
|
|
107
|
+
// exists it answers alreadyPresent and writes nothing, so the following
|
|
108
|
+
// update() merges into whatever template was left behind. A residual from an
|
|
109
|
+
// earlier round then silently inherits the new nodes (r14 chased exactly this:
|
|
110
|
+
// a leftover inspHazardFlow made the next run's behaviour inexplicable).
|
|
111
|
+
const createReadback = createOutcome.result?.readback;
|
|
112
|
+
const preexistingTemplate = createReadback?.alreadyPresent === true;
|
|
113
|
+
const preexistingSection = preexistingTemplate
|
|
114
|
+
? {
|
|
115
|
+
preexistingTemplate: true,
|
|
116
|
+
preexistingWarning: `流程 code ${compiled.workflowCode} 在本轮之前就已存在(workflow.create 幂等跳过,未新建)。` +
|
|
117
|
+
`本次 update 是**合并**进这条既有模板,旧节点/旧连线会保留——它们可能属于上一次运行或另一个模型。` +
|
|
118
|
+
`如果不是有意复用,先 workflow.delete(有实例会 402508,用 model-purge)或换一个 workflowCode 再跑。`,
|
|
119
|
+
}
|
|
120
|
+
: {};
|
|
105
121
|
// 2) 取字段清单构建审批节点只读权限(r75 修正:审批节点 editable:false)
|
|
106
|
-
const fieldList = await runToolCall("field.list", { args: { schemaCode: schema, published: true, ...(environment ? { environment } : {}) }, requestId: request, environment });
|
|
122
|
+
const fieldList = await runToolCall("field.list", { args: { schemaCode: schema, published: true, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
|
|
107
123
|
const fieldRows = (fieldList.result?.fields ?? fieldList.result?.items ?? []);
|
|
108
124
|
const propertyCodes = fieldRows.map((row) => String(row.code ?? row.propertyCode ?? "")).filter(Boolean);
|
|
109
125
|
const approvalNodes = compiled.activities.filter((a) => a.activityType === "PARTICIPANT" && a.participant !== "{Originator}");
|
|
@@ -113,16 +129,16 @@ export async function cmdApprovalFlow(args) {
|
|
|
113
129
|
// 3) update 模板(merge 语义;工具自动补 sheetCode/链路/设计器默认)
|
|
114
130
|
const updateOutcome = await runToolCall("workflow.update", {
|
|
115
131
|
args: { schemaCode: schema, code: compiled.workflowCode, template: { workflowCode: compiled.workflowCode, activities: activitiesWithPermissions }, ...(environment ? { environment } : {}) },
|
|
116
|
-
requestId: request, environment,
|
|
132
|
+
requestId: request, environment, print: () => undefined,
|
|
117
133
|
});
|
|
118
134
|
if (updateOutcome.exitCode !== 0) {
|
|
119
135
|
writeEnvelope(envelope(classifyResult(updateOutcome.result).status, updateOutcome.result, request, classifyResult(updateOutcome.result).error));
|
|
120
136
|
return updateOutcome.exitCode;
|
|
121
137
|
}
|
|
122
138
|
// 4) publish
|
|
123
|
-
const publishOutcome = await runToolCall("workflow.publish", { args: { schemaCode: schema, code: compiled.workflowCode, ...(environment ? { environment } : {}) }, requestId: request, environment });
|
|
139
|
+
const publishOutcome = await runToolCall("workflow.publish", { args: { schemaCode: schema, code: compiled.workflowCode, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
|
|
124
140
|
const classified = classifyResult(publishOutcome.result);
|
|
125
|
-
writeEnvelope(envelope(classified.status, { schemaCode: schema, workflowCode: compiled.workflowCode, steps: steps.length, publish: publishOutcome.result }, request, classified.error));
|
|
141
|
+
writeEnvelope(envelope(classified.status, { schemaCode: schema, workflowCode: compiled.workflowCode, steps: steps.length, ...preexistingSection, publish: publishOutcome.result }, request, classified.error));
|
|
126
142
|
if (publishOutcome.exitCode === 0)
|
|
127
143
|
process.stderr.write("[omc] 前台生效验证清单:1) 造一条数据提交走流程;2) 每级审批人在门户有待办(角色用 FindUserByRole 需审批人挂在发起人同部门,否则 PENDING 不来);3) 审批节点字段只读(不可改单);4) 驳回退发起人核对;5) 设计器打开流程确认节点链显示正常。\n");
|
|
128
144
|
return publishOutcome.exitCode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.93",
|
|
4
4
|
"description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@stalfh233/omc-fake-platform": "0.4.
|
|
53
|
+
"@stalfh233/omc-fake-platform": "0.4.93",
|
|
54
54
|
"commander": "14.0.3",
|
|
55
|
-
"omc-core": "0.4.
|
|
55
|
+
"omc-core": "0.4.93",
|
|
56
56
|
"proper-lockfile": "4.1.2",
|
|
57
57
|
"write-file-atomic": "6.0.0",
|
|
58
58
|
"zod": "^3.23.8",
|