@stalfh233/omc-cli 0.4.40 → 0.4.41

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.
@@ -120,7 +120,7 @@ export const WORKFLOW_LANE_CONTRACT = Object.freeze({
120
120
  }),
121
121
  "workflow.update": Object.freeze({
122
122
  scope: WORKFLOW_SCOPE,
123
- description: "写入工作流模板草稿(`/api/api/workflow/update`,raw template JSON body)。cli 以当前草稿为基线做 merge,未列出的既有节点保留:**模板缺 START 或 END 时自动按增量 merge(部分模板),给全 START..END 才整模板替换**;也可显式 `merge:true/false`。**节点字段权限也走这里**:不必读 `get_draft --full`——直接发 `activities:[{activityCode, activityType:\"PARTICIPANT\", propertyPermissions:[{propertyCode, visible, editable, required, summary, subPropertyPermissions}]}]`,工具按 propertyCode 合并到草稿对应节点(未列的字段权限保留;`merge:true` 也可同用)——没有单独的权限工具,别把「找不到入口」当成不支持(dogfood 实测该误判会假阻塞)。**`summary:true` 才会进运行时的 `activitySummaries`**,否则 `form/load` 的 `formPermission.dataPermissions` 会回退默认(编辑权读不到你的 `editable:false`);子表字段用 `subPropertyPermissions`。用 `npm run test:live-permission`(非管理员参与者)验收,管理员会被后端强制 `e:true` 掩盖。",
123
+ description: "写入工作流模板草稿(`/api/api/workflow/update`,raw template JSON body)。cli 以当前草稿为基线做 merge,未列出的既有节点保留:**模板缺 START 或 END 时自动按增量 merge(部分模板),给全 START..END 才整模板替换**;也可显式 `merge:true/false`。**节点字段权限也走这里**:不必读 `get_draft --full`——直接发 `activities:[{activityCode, activityType:\"PARTICIPANT\", propertyPermissions:[{propertyCode, visible, editable, required, summary, subPropertyPermissions}]}]`,工具按 propertyCode 合并到草稿对应节点(未列的字段权限保留;`merge:true` 也可同用)——没有单独的权限工具,别把「找不到入口」当成不支持(dogfood 实测该误判会假阻塞)。`summary` **无需配置**:工具合并时自动补 `summary:true`(平台怪癖——缺省进不了运行时 `activitySummaries`、`form/load` 读不到你的 `editable:false`;显式传 `false` 才保留);子表字段用 `subPropertyPermissions`(同样自动补)。用 `npm run test:live-permission`(非管理员参与者)验收,管理员会被后端强制 `e:true` 掩盖。",
124
124
  }),
125
125
  "workflow.publish": Object.freeze({
126
126
  scope: WORKFLOW_SCOPE,
@@ -794,8 +794,15 @@ function activitiesLackBoundaries(template) {
794
794
  * taken as the caller's intent to replace.
795
795
  */
796
796
  function mergePermissionsByCode(base, caller) {
797
- if (!Array.isArray(base) || !Array.isArray(caller))
798
- return caller;
797
+ // 早退分支同样要过 summary 自动补全(首笔权限写入:draft 无既有 permissions 时
798
+ // base 不是数组,直接返回 caller 会绕过下面的补全——测试抓过这个洞)。
799
+ if (!Array.isArray(base) || !Array.isArray(caller)) {
800
+ if (!Array.isArray(caller))
801
+ return caller;
802
+ return caller.map((entry) => (entry && typeof entry === "object" && entry.summary === undefined
803
+ ? { ...entry, summary: true }
804
+ : entry));
805
+ }
799
806
  const byCode = new Map();
800
807
  for (const entry of base) {
801
808
  if (entry && typeof entry === "object") {
@@ -809,13 +816,17 @@ function mergePermissionsByCode(base, caller) {
809
816
  const row = entry;
810
817
  const key = String(row.propertyCode ?? "");
811
818
  const prev = byCode.get(key);
819
+ // 用户指令(r49 后):调用方**不需要配置 summary**——平台怪癖是 summary 缺省时
820
+ // 权限行不进运行时 activitySummaries(editable:false 形同虚设)。工具在合并层
821
+ // 自动补 summary:true(显式 false 原样尊重,供刻意要默认回退的少数场景)。
822
+ const withSummary = row.summary === undefined ? { ...row, summary: true } : row;
812
823
  byCode.set(key, prev
813
824
  ? {
814
825
  ...prev,
815
- ...row,
816
- ...(row.subPropertyPermissions !== undefined ? { subPropertyPermissions: mergePermissionsByCode(prev.subPropertyPermissions, row.subPropertyPermissions) } : {}),
826
+ ...withSummary,
827
+ ...(withSummary.subPropertyPermissions !== undefined ? { subPropertyPermissions: mergePermissionsByCode(prev.subPropertyPermissions, withSummary.subPropertyPermissions) } : {}),
817
828
  }
818
- : row);
829
+ : withSummary);
819
830
  }
820
831
  return [...byCode.values()];
821
832
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.4.40",
3
+ "version": "0.4.41",
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.40",
53
+ "@stalfh233/omc-fake-platform": "0.4.41",
54
54
  "commander": "14.0.3",
55
- "omc-core": "0.4.40",
55
+ "omc-core": "0.4.41",
56
56
  "proper-lockfile": "4.1.2",
57
57
  "write-file-atomic": "6.0.0",
58
58
  "zod": "^3.23.8",
@@ -154,8 +154,8 @@ rules:
154
154
  - 不需要展示的字段明确 `visible:false`。
155
155
 
156
156
  **怎么配**(没有单独的权限工具,别把「找不到入口」当不支持→假阻塞):`workflow.get_draft --full` 读节点正文,改目标
157
- `ParticipantActivity.propertyPermissions[]`(`{propertyCode, visible, editable, required, summary, subPropertyPermissions}`),
158
- 用 `workflow.update` 原样回写,再 `workflow.publish`。**要生效必须 `summary:true`**(只有它进运行时 `activitySummaries`;
157
+ `ParticipantActivity.propertyPermissions[]`(`{propertyCode, visible, editable, required, subPropertyPermissions}`——`summary` 无需配,工具自动补 `true`),
158
+ 用 `workflow.update` 原样回写,再 `workflow.publish`。(`summary:true` 才进运行时 `activitySummaries`,工具已自动处理;
159
159
  否则 `form/load` 的 `formPermission.dataPermissions` 回退默认,读不到你的 `editable:false`);子表列用 `subPropertyPermissions`。
160
160
  验收用 `npm run test:live-permission` + **非管理员参与者**(管理员会被后端强制 `e:true` 掩盖)。
161
161