@stalfh233/omc-cli 0.6.98 → 0.6.100

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/write.js CHANGED
@@ -26,7 +26,7 @@ import { validateBusinessCode } from "./code-rules.js";
26
26
  import { hardLayoutViolations, validateFormLayout } from "./form-layout.js";
27
27
  import { prepareRuleGraph, validateRuleNodeGraph } from "./lanes/rule-graph.js";
28
28
  import { assertRuleNamePlatformAcceptable } from "./rule-support.js";
29
- import { WireError } from "./wire.js";
29
+ import { WireError, optionPublishMessages } from "./wire.js";
30
30
  /**
31
31
  * The shared governed write pipeline and the low-level write registration
32
32
  * factory every lane adapter uses.
@@ -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 按业务键(单号/编码)查重,命中即成功勿重发;未命中再重试。",
@@ -131,6 +141,25 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
131
141
  if (error instanceof WireError) {
132
142
  // F3: rule-node runtime failures are masked by the platform as 300004.
133
143
  if (error.errcode === 300004) {
144
+ // T20(2026-11-24):2.1.5 的树形自定义下拉发布门把「选项非法」包成
145
+ // 外层 300004「数据模型不存在!」+ data 里的逐项 301013「…数据项的
146
+ // 选项设置有误」(BizSchemaCheckServiceImpl :60-66)。payload 命中时
147
+ // 必须比业务规则运行时异常的解释更优先,否则用户会去查 rulelog。
148
+ const platformMessages = optionPublishMessages(error.payload);
149
+ if (platformMessages.length > 0) {
150
+ return {
151
+ status: "refused",
152
+ blocker: "field-options-publish-invalid",
153
+ errcode: 300004,
154
+ platformMessages,
155
+ message: `平台在发布时拒绝了字段选项(外层 300004「数据模型不存在!」只是外壳,明细 301013):${platformMessages.join(";")}。` +
156
+ "这是 2.1.5+ 的树形自定义下拉发布门,不是模型缺失或业务规则运行时异常:optionsSet.optionsType=\"custom\" + optionStructure=\"tree\" 时," +
157
+ "每个节点的 code(平台内部叫选项编码,口语叫 key)与 value(显示值)必须非空,且 code 全树唯一(RadioOptionsModel.validateCustomTreeOptions,launcher-2.1.5 .../bizmodel/RadioOptionsModel.java:130-142)。" +
158
+ "8.6/8.7 不查;平铺自定义/字典/业务模型下拉也不查。",
159
+ nextCommand: "omc call field.list --args '{\"schemaCode\":\"<model>\",\"published\":false}'",
160
+ nextAction: "核对报错字段的 optionsSet.custom 树,用 field.update 补非空 code/value;不需要层级就把 optionStructure 改成 \"flat\" 后重发",
161
+ };
162
+ }
134
163
  return {
135
164
  status: "refused",
136
165
  blocker: `wire-${error.kind}`,
@@ -171,6 +200,97 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
171
200
  nextAction: "先分叉:本次是照示例新建/改配置吗?是→按成因②对照一条已成功配置(rule.get/form.get 读回)补齐非空列字段再重试;否→按成因①稍后重试同一请求,持续复现查平台 DB/ORM 日志",
172
201
  ...(error.diagnostic ? { diagnostic: error.diagnostic } : {}),
173
202
  };
203
+ // 2.1.5(AI-Platform v2.1.5)提交新增「隐藏字段」校验:规则引用的隐藏字段
204
+ // 也必须出现在 payload 里,否则 409200。8.6/8.7 没有这一道,旧调用方按
205
+ // 「只传可见字段」构造会被拒。
206
+ if (error.errcode === 409200)
207
+ return {
208
+ status: "refused",
209
+ blocker: `wire-${error.kind}`,
210
+ errcode: 409200,
211
+ "platform-version": "2.1.5+",
212
+ message: `${error.message}——2.1.5 起提交会校验**隐藏字段**(409200 HIDDEN_PROPERTY_SUBMIT_FAIL):数据规则引用的字段即使表单不可见,也必须出现在 formData/bizObject.data 里;8.6/8.7 不做这道校验。`,
213
+ nextAction: "先 data.load/form.get 读回该记录(隐藏字段有真值),把缺失字段补进 payload 再提交;不要靠删字段绕过——规则仍会命中",
214
+ nextCommand: "omc call data.load --args '{\"schemaCode\":\"<model>\",\"bizObjectId\":\"<id>\"}'",
215
+ };
216
+ // 2.1.5 起新增的「格式/长度/维护锁」错误码(8.6 这些场景回 10005/40000/50000,
217
+ // 没有可读码)。不改变判定,只把码翻成人话 + 下一步。
218
+ if (error.errcode === 309056 || error.errcode === 309057) {
219
+ const kind = error.errcode === 309056 ? "名称" : "code";
220
+ return {
221
+ status: "refused",
222
+ blocker: `wire-${error.kind}`,
223
+ errcode: error.errcode,
224
+ "platform-version": "2.1.5+",
225
+ message: `${error.message}——2.1.5 起平台统一用 309056/309057 校验${kind}格式(8.6 是零散的 10005):名称 1–60 字符且不能以空格开头;code 必须字母开头、≤60、只含 A-Za-z0-9_。`,
226
+ nextAction: `按上述规则改 ${kind}后重试;不要靠换中文/特殊字符绕过`,
227
+ };
228
+ }
229
+ if (error.errcode === 601016 || error.errcode === 601019)
230
+ return {
231
+ status: "refused",
232
+ blocker: "schema-maintenance-locked",
233
+ errcode: error.errcode,
234
+ "platform-version": "2.1.5+",
235
+ message: `${error.message}——模型正在做表结构变更/层级路径维护(2.1.5 新增 601016/601019),期间不接收写入;这是**暂时锁**,不是参数错。`,
236
+ nextAction: "等维护结束(或联系平台管理员确认迁移任务)后重试同一请求;不要改参数硬重试",
237
+ };
238
+ if (error.errcode === 700000)
239
+ return {
240
+ status: "refused",
241
+ blocker: "value-length-out-of-bounds",
242
+ errcode: 700000,
243
+ "platform-version": "2.1.5+",
244
+ message: `${error.message}——列长度溢出首次被翻译成 700000(8.6 只会回 40000/50000);先核对该字段的库列长度或 options 限制。`,
245
+ nextAction: "缩短该字段值,或改字段长度(field.update → field.publish)后重试",
246
+ };
247
+ if (error.errcode === 550038)
248
+ return {
249
+ status: "refused",
250
+ blocker: "inherited-rule-readonly",
251
+ errcode: 550038,
252
+ "platform-version": "2.1.5+",
253
+ message: `${error.message}——该业务规则继承自父级(2.1.5 新增继承机制),不能直接改/删/发布/启停。`,
254
+ nextAction: "到父级模型改规则,或用 rule.references 确认继承来源后再决定",
255
+ };
256
+ if (error.errcode === 401085)
257
+ return {
258
+ status: "refused",
259
+ blocker: "workflow-activity-name-invalid",
260
+ errcode: 401085,
261
+ "platform-version": "2.1.5+",
262
+ message: `${error.message}——2.1.5 的流程发布新增节点名校验:非空且 ≤80 字符单位(中文按 2 计),ERROR 级会让 publish 整体不发布。`,
263
+ nextAction: "workflow.get_draft 读回 activities[].name,缩短超长/补齐空名后重新 publish",
264
+ };
265
+ if (error.errcode === 480000)
266
+ return {
267
+ status: "refused",
268
+ blocker: "current-task-suspended",
269
+ errcode: 480000,
270
+ "platform-version": "2.1.5+",
271
+ message: `${error.message}——当前任务被挂起(2.1.5 新增:前置/串行任务未完成),不是提交参数错。`,
272
+ nextAction: "workitem.list 看同一实例的前置任务状态;前置完成后重试提交",
273
+ };
274
+ // 子表超限:8.6 = 36102,8.7/2.1.5 = 36104(同义)。
275
+ if (error.errcode === 36102 || error.errcode === 36104)
276
+ return {
277
+ status: "refused",
278
+ blocker: "child-table-data-over-limit",
279
+ errcode: error.errcode,
280
+ message: `${error.message}——子表查询结果超限(8.6 回 36102,8.7/2.1.5 回 36104,同一语义)。收窄 filters/时间窗,或分页读 list_child;不要靠调大 size 硬拉。`,
281
+ nextCommand: "omc call data.list --args '{\"schemaCode\":\"<child>\",\"size\":20,\"page\":0}'",
282
+ };
283
+ // 2.1.5 起管理面统一 @AdminOnly(8.6 是 @RequireAdmin):401/403 往往不是
284
+ // 「token 坏了」,而是该端点在新版要求管理员。
285
+ if (error.kind === "http-status" && (error.diagnostic?.httpStatus === 401 || error.diagnostic?.httpStatus === 403))
286
+ return {
287
+ status: "refused",
288
+ blocker: `wire-${error.kind}`,
289
+ errcode: error.errcode,
290
+ message: `${error.message}——HTTP ${error.diagnostic?.httpStatus}:先确认账号;2.1.5 起管理端点(programming.*、workflow.publish/update、license/info 等)统一为 @AdminOnly(8.6 是 @RequireAdmin),普通应用管理员可能不再放行。`,
291
+ nextAction: "换管理员账号复验;仍 403 就区分「端点要求管理员」与「平台未开该功能」",
292
+ ...(error.diagnostic ? { diagnostic: error.diagnostic } : {}),
293
+ };
174
294
  return { status: "refused", blocker: `wire-${error.kind}`, errcode: error.errcode, message: error.message, ...(error.diagnostic ? { diagnostic: error.diagnostic } : {}) };
175
295
  }
176
296
  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.100",
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.100",
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.100"
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 条不可删预置规则。