@stalfh233/omc-cli 0.6.98 → 0.6.99

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.
@@ -44,7 +44,9 @@ function permissionGroupRows(data) {
44
44
  }
45
45
  return nested;
46
46
  }
47
- const permissionType = (v) => ({ 1: "全部可见", 2: "本部门", 3: "仅自己", 4: "自定义", 5: "角色管理范围", 6: "均不可见" }[String(v)] ?? (v == null ? null : v));
47
+ // 8.7(AI-Platform v1.1.23-dsj.8)的 DataPermissionType 新增 MY_BRANCH_OFFICE=7「同机构」;
48
+ // 未知值原样回传(不降级成 1/6),否则读回后回写会把新权限改坏。
49
+ const permissionType = (v) => ({ 1: "全部可见", 2: "本部门", 3: "仅自己", 4: "自定义", 5: "角色管理范围", 6: "均不可见", 7: "同机构" }[String(v)] ?? (v == null ? null : v));
48
50
  const PERMISSION_UPDATE_FUNCTION = "/api/api/system/permission/update_function";
49
51
  /**
50
52
  * r96(2026-11-24,真机会话 40 次 `perm.auth` 摩擦):动作码此前只活在源码里,
@@ -172,6 +174,14 @@ function mergeActions(existing, requested, allowed) {
172
174
  b.enabled = true;
173
175
  return b;
174
176
  });
177
+ // 2.1.5(AI-Platform v2.1.5,客户口径 8.8)把按钮权限拆成审批态/查看态:
178
+ // 运行时非审批态**只读** viewCustomBtns/viewChildTableBtns,缺失即空数组
179
+ // (ActionPermissionHandler:91-105);viewBtnPermissionEqualApproval=true 时才
180
+ // 复用审批态集合。旧配置没有这三个字段,2.1.5 上「查看页/已办页按钮会全部消失」。
181
+ // 因此:本工具只改审批态时,若容器没有任何查看态配置,就把查看态显式声明为
182
+ // 「等同审批态」——语义与 8.6 一致,且不改动已有独立查看态配置。
183
+ if (c.viewCustomBtns === undefined && c.viewChildTableBtns === undefined && c.viewBtnPermissionEqualApproval === undefined)
184
+ c.viewBtnPermissionEqualApproval = true;
175
185
  return c;
176
186
  });
177
187
  return { merged, unapplied, partial, turnedOff: [...new Set(turnedOffByContainer.flatMap((entry) => entry.codes))], turnedOffByContainer };
@@ -501,7 +511,7 @@ export function registerPermLane(tools) {
501
511
  schemaCode: z.string().min(1),
502
512
  visible: z.object({ pc: z.boolean(), mobile: z.boolean() }).optional(),
503
513
  rowLevel: z.object({
504
- type: z.number().int().min(1).max(6).describe("1=全部可见,2=本部门,3=仅自己,4=自定义(须 conditions),5=角色管理范围,6=均不可见"),
514
+ type: z.number().int().min(1).max(7).describe("1=全部可见,2=本部门,3=仅自己,4=自定义(须 conditions),5=角色管理范围,6=均不可见,7=同机构(8.7+ 新增,8.6 平台无此值)"),
505
515
  conditions: z.array(z.array(z.unknown())).optional(),
506
516
  }).optional(),
507
517
  properties: z.array(z.object({
@@ -853,6 +853,11 @@ async function staffStringShapeViolations(session, schemaCode, formData) {
853
853
  * intent so OMC never reports a successful child write that did not land: a row
854
854
  * carrying its own `id` is "Modified", an id-less row is "Added"; an explicit
855
855
  * rowStatus is preserved verbatim.
856
+ *
857
+ * 8.7(AI-Platform v1.1.23-dsj.8)新增 `"Sorted"`:排序请求走
858
+ * `subBizObjectSortService.reorder`,必须带既有行 id,重复行 id 直接报参数错误。
859
+ * 8.6 没有这个分支(会被当未知状态 → immutable),所以 `Sorted` 只能**原样透传**、
860
+ * 不能由 OMC 自动生成;版本不符时让平台自己的错误说话,别假装排序成功。
856
861
  */
857
862
  /**
858
863
  * Paths of non-empty child-table arrays anywhere inside a form payload. The
@@ -3606,6 +3606,14 @@ export function registerWorkflowLane(tools) {
3606
3606
  containerCode: existing.containerCode ?? args.schemaCode,
3607
3607
  customBtns: merged,
3608
3608
  childTableBtns: existing.childTableBtns ?? [],
3609
+ // 2.1.5(AI-Platform v2.1.5,客户口径 8.8)把节点按钮拆成审批态/查看态:
3610
+ // 非审批态只读 viewCustomBtns/viewChildTableBtns,缺失即空数组
3611
+ // (ActionPermissionHandler:91-105)。旧模板没有这三个字段,2.1.5 上
3612
+ // 「已办/查看页按钮会全部消失」。只写审批态时,若节点没有任何查看态
3613
+ // 配置,就显式声明「查看态等同审批态」(8.6 语义),不动已有独立配置。
3614
+ ...(existing.viewCustomBtns === undefined && existing.viewChildTableBtns === undefined && existing.viewBtnPermissionEqualApproval === undefined
3615
+ ? { viewBtnPermissionEqualApproval: true }
3616
+ : {}),
3609
3617
  },
3610
3618
  });
3611
3619
  }
package/dist/write.js CHANGED
@@ -121,7 +121,17 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
121
121
  environment: session.environmentName,
122
122
  baseUrl: session.profile.baseUrl,
123
123
  environmentHint: "env 清单随 cwd 变(项目根 .omc-env/.omc-envs + 配置根);`omc env list` 首行回显 configRoot/projectRoot",
124
- message: "write outcome cannot be established; frozen — re-discover before retrying; never assume success",
124
+ // 2.1.5 起管理端点统一 @AdminOnly(8.6 是 @RequireAdmin):401/403 往往
125
+ // 不是 token 坏了,而是该端点在新版要求管理员。不要笼统说「传输失败」。
126
+ ...(error instanceof WireError && error.kind === "http-status" && (error.diagnostic?.httpStatus === 401 || error.diagnostic?.httpStatus === 403)
127
+ ? {
128
+ message: `HTTP ${error.diagnostic?.httpStatus}:写请求被拒(结果未知,先别重放)。2.1.5 起管理端点(programming.*、workflow.publish/update、license/info)统一为 @AdminOnly,普通应用管理员可能不再放行;先确认账号,再区分「端点要求管理员」与「平台未开该功能」。`,
129
+ nextAction: "换管理员账号复验;仍 403 就查平台侧功能开关(如 cloudpivot.programming.enable),不要把 403 当 token 过期反复重登",
130
+ }
131
+ : {}),
132
+ message: error instanceof WireError && error.kind === "http-status" && (error.diagnostic?.httpStatus === 401 || error.diagnostic?.httpStatus === 403)
133
+ ? `HTTP ${error.diagnostic?.httpStatus}:写请求被拒(结果未知,先别重放)。2.1.5 起管理端点(programming.*、workflow.publish/update、license/info)统一为 @AdminOnly;先确认账号与功能开关。`
134
+ : "write outcome cannot be established; frozen — re-discover before retrying; never assume success",
125
135
  // r46 实证:data.submit 传输中断但平台已落行,按回执盲重试产生重复数据
126
136
  // 再连锁清理。uncertain ≠ 失败——先按业务键查重再决定。
127
137
  hint: "uncertain 不是失败:写可能已生效。data.submit/data.save 先 data.list 按业务键(单号/编码)查重,命中即成功勿重发;未命中再重试。",
@@ -171,6 +181,39 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
171
181
  nextAction: "先分叉:本次是照示例新建/改配置吗?是→按成因②对照一条已成功配置(rule.get/form.get 读回)补齐非空列字段再重试;否→按成因①稍后重试同一请求,持续复现查平台 DB/ORM 日志",
172
182
  ...(error.diagnostic ? { diagnostic: error.diagnostic } : {}),
173
183
  };
184
+ // 2.1.5(AI-Platform v2.1.5)提交新增「隐藏字段」校验:规则引用的隐藏字段
185
+ // 也必须出现在 payload 里,否则 409200。8.6/8.7 没有这一道,旧调用方按
186
+ // 「只传可见字段」构造会被拒。
187
+ if (error.errcode === 409200)
188
+ return {
189
+ status: "refused",
190
+ blocker: `wire-${error.kind}`,
191
+ errcode: 409200,
192
+ "platform-version": "2.1.5+",
193
+ message: `${error.message}——2.1.5 起提交会校验**隐藏字段**(409200 HIDDEN_PROPERTY_SUBMIT_FAIL):数据规则引用的字段即使表单不可见,也必须出现在 formData/bizObject.data 里;8.6/8.7 不做这道校验。`,
194
+ nextAction: "先 data.load/form.get 读回该记录(隐藏字段有真值),把缺失字段补进 payload 再提交;不要靠删字段绕过——规则仍会命中",
195
+ nextCommand: "omc call data.load --args '{\"schemaCode\":\"<model>\",\"bizObjectId\":\"<id>\"}'",
196
+ };
197
+ // 子表超限:8.6 = 36102,8.7/2.1.5 = 36104(同义)。
198
+ if (error.errcode === 36102 || error.errcode === 36104)
199
+ return {
200
+ status: "refused",
201
+ blocker: "child-table-data-over-limit",
202
+ errcode: error.errcode,
203
+ message: `${error.message}——子表查询结果超限(8.6 回 36102,8.7/2.1.5 回 36104,同一语义)。收窄 filters/时间窗,或分页读 list_child;不要靠调大 size 硬拉。`,
204
+ nextCommand: "omc call data.list --args '{\"schemaCode\":\"<child>\",\"size\":20,\"page\":0}'",
205
+ };
206
+ // 2.1.5 起管理面统一 @AdminOnly(8.6 是 @RequireAdmin):401/403 往往不是
207
+ // 「token 坏了」,而是该端点在新版要求管理员。
208
+ if (error.kind === "http-status" && (error.diagnostic?.httpStatus === 401 || error.diagnostic?.httpStatus === 403))
209
+ return {
210
+ status: "refused",
211
+ blocker: `wire-${error.kind}`,
212
+ errcode: error.errcode,
213
+ message: `${error.message}——HTTP ${error.diagnostic?.httpStatus}:先确认账号;2.1.5 起管理端点(programming.*、workflow.publish/update、license/info 等)统一为 @AdminOnly(8.6 是 @RequireAdmin),普通应用管理员可能不再放行。`,
214
+ nextAction: "换管理员账号复验;仍 403 就区分「端点要求管理员」与「平台未开该功能」",
215
+ ...(error.diagnostic ? { diagnostic: error.diagnostic } : {}),
216
+ };
174
217
  return { status: "refused", blocker: `wire-${error.kind}`, errcode: error.errcode, message: error.message, ...(error.diagnostic ? { diagnostic: error.diagnostic } : {}) };
175
218
  }
176
219
  throw error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.6.98",
3
+ "version": "0.6.99",
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.98",
59
+ "omc-core": "0.6.99",
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.98"
77
+ "@stalfh233/omc-fake-platform": "0.6.99"
78
78
  }
79
79
  }
@@ -189,6 +189,23 @@ omc call field.publish --env local --args '{"schemaCode":"expense"}'
189
189
  **只传主表字段**;确需追加行时显式 `allowChildRowAppend:true`(0.4.63 起默认拒绝,blocker `submit-approval-child-rows`)。
190
190
  收尾时前后各读一次子表行数确认未变。
191
191
 
192
+ ## Excel 导入会全量替换子表(8.6 起;2.1.5 同)
193
+
194
+ `importType=UPDATE|ADD_UPDATE` 命中**已有主记录**时:旧子行全标 `Deleted`、导入行标 `Added`。
195
+ Excel **缺子表列/sheet 为空** → 既有子行被清空(主记录还在)。要追加/局部改子表用
196
+ `data.save`/`data.update` 逐条带子行 `id + rowStatus`,不要用 Excel 导入。
197
+
198
+ ## 8.7 / 2.1.5 写面差异(同一操作行为不同)
199
+
200
+ - 权限档位:8.6 只有 1..6;8.7/2.1.5 多 `7=同机构`。
201
+ - 子表行状态:8.6 只认 `Added/Modified/Deleted`;8.7/2.1.5 新增 `Sorted`(排序落库,须带行 id)。
202
+ - 按钮权限:2.1.5 拆审批态/查看态(`viewCustomBtns`/`viewChildBtns`/`viewBtnPermissionEqualApproval`),
203
+ 非审批态只读查看态、缺失即空——OMC 只改审批态时会自动写 `viewBtnPermissionEqualApproval:true`。
204
+ - 提交校验:2.1.5 新增隐藏字段校验 `409200`(规则引用的隐藏字段也必须在 payload 里)。
205
+ - 子表超限:8.6 `36102`,8.7/2.1.5 `36104`(同义)。
206
+ - 批量提交:8.7/2.1.5 的 `batch_submit` 不校验 replayToken;单条流程发起仍要 `getReplayToken`。
207
+ - 管理端点:8.6 `@RequireAdmin`,8.7/2.1.5 `@AdminOnly`——401/403 先确认账号,别当 token 过期。
208
+
192
209
  ## 收尾核对(无 `omc baseline` 命令)
193
210
 
194
211
  对照开场 `count` 读 `model.list` → `rule.list {onlyCustom:true}` → `datarule.list`(后两者期望 `modelPresent:false`)。**勿**对已删/从未存在的 schemaCode 再 `rule.list`——会补建 7 条不可删预置规则。