@stalfh233/omc-cli 0.8.9 → 0.8.10
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 +8 -1
- package/dist/human-summary.js +30 -7
- package/dist/lanes/field-contract.js +1 -1
- package/dist/lanes/field.js +7 -0
- package/dist/lanes/list-view.js +53 -24
- package/dist/lanes/model-references.js +22 -6
- package/dist/lanes/model.js +6 -3
- package/dist/lanes/runtime-data.js +43 -19
- package/dist/model-purge.js +2 -2
- package/dist/read.js +12 -1
- package/dist/recipes/online-js.js +2 -2
- package/package.json +3 -3
- package/skills/omc-backend-online-coding.md +3 -0
package/dist/approval-flow.js
CHANGED
|
@@ -220,6 +220,9 @@ export async function cmdApprovalFlow(args) {
|
|
|
220
220
|
if (!apply) {
|
|
221
221
|
const compiledParticipantNotes = participantNotes(steps, environment);
|
|
222
222
|
writeEnvelope(envelope("ok", {
|
|
223
|
+
// 等同于 `omc call` 契约:结果顶层必须有 status。预览未写环境 → dry-run
|
|
224
|
+
// (与 model-scaffold/field-add 的预览口径一致),信封仍是 ok/exit 0。
|
|
225
|
+
status: "dry-run",
|
|
223
226
|
schemaCode: schema,
|
|
224
227
|
...compiled,
|
|
225
228
|
...(originatorName !== undefined ? { originatorName, originatorNameNote: ORIGINATOR_NAME_NOTE } : {}),
|
|
@@ -286,7 +289,11 @@ export async function cmdApprovalFlow(args) {
|
|
|
286
289
|
// 4) publish
|
|
287
290
|
const publishOutcome = await runToolCall("workflow.publish", { args: { schemaCode: schema, code: compiled.workflowCode, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
|
|
288
291
|
const classified = classifyResult(publishOutcome.result);
|
|
289
|
-
|
|
292
|
+
// 与 `omc call` 一致:结果顶层带生产者 status(成功 ok / 被拒 refused / 部分
|
|
293
|
+
// partial…),publish 的原始回执继续留在 publish 下。ok 与 status 因此不会
|
|
294
|
+
// 出现「ok:false + status:ok」。
|
|
295
|
+
const publishStatus = String(publishOutcome.result?.status ?? "ok");
|
|
296
|
+
writeEnvelope(envelope(classified.status, { status: publishStatus, schemaCode: schema, workflowCode: compiled.workflowCode, steps: steps.length, ...(originatorName !== undefined ? { originatorName, originatorNameNote: ORIGINATOR_NAME_NOTE } : {}), crossAccountApproval, ...preexistingSection, publish: publishOutcome.result }, request, classified.error));
|
|
290
297
|
if (publishOutcome.exitCode === 0)
|
|
291
298
|
process.stderr.write("[omc] 前台生效验证清单:1) 造一条数据提交走流程;2) 每级审批人在门户有待办(角色用 FindUserByRole 需审批人挂在发起人同部门,否则 PENDING 不来);3) 审批节点字段只读(不可改单);4) 驳回退发起人核对;5) 设计器打开流程确认节点链显示正常。边界:非发起人身份的审批无法在单会话 CLI 内推进(单 token);跨账号请另建环境或把参与人设为 {Originator}。\n");
|
|
292
299
|
return publishOutcome.exitCode;
|
package/dist/human-summary.js
CHANGED
|
@@ -294,7 +294,10 @@ function phraseOf(tool, args, outcome) {
|
|
|
294
294
|
// 停滞(readback.flowWarning 有真相)——summary 全绿会掩盖。有警告必须抬头。
|
|
295
295
|
const flowWarning = outcome?.readback?.flowWarning;
|
|
296
296
|
const warnTag = flowWarning ? `——⚠ ${flowWarning.code === "flow-instance-exception" ? "实例异常停滞(见 readback.flowWarning)" : "流程未续走(见 readback.flowWarning)"}` : "";
|
|
297
|
-
|
|
297
|
+
// F4(w71,0.8.10):显式传 name 但被平台「数据标题」覆盖时,摘要行与
|
|
298
|
+
// data.save 同口径抬头(JSON 字段 readback.nameOverwrittenNote)。
|
|
299
|
+
const nameNote = readbackNoteClause(outcome, "nameOverwrittenNote");
|
|
300
|
+
return `提交数据(模型 ${schemaCode ?? "?"}${stringArg(args, "workItemId") ? ",审批待办" : ""})${warnTag}${nameNote}`;
|
|
298
301
|
}
|
|
299
302
|
case "data.delete": {
|
|
300
303
|
const ids = Array.isArray(args.bizObjectIds) ? args.bizObjectIds.map(String) : [];
|
|
@@ -314,16 +317,36 @@ function phraseOf(tool, args, outcome) {
|
|
|
314
317
|
const conditionRuntimeLine = Array.isArray(args.conditions) && args.conditions.length > 0
|
|
315
318
|
? ";视图固定条件只在门户运行面生效,REST `data.list --queryCode` 不应用——要在 API 侧过滤请显式传 `filter`"
|
|
316
319
|
: "";
|
|
317
|
-
// F14(0.8.9 探针 D):清空 actions 后回执仍列平台注入的
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
+
// F14(0.8.9 探针 D)/ F8(0.8.10 探针 E):清空 actions 后回执仍列平台注入的
|
|
321
|
+
// 6 条默认动作,人读摘要要说清「清的是流程/自定义动作,剩下的是平台默认动作」,
|
|
322
|
+
// 否则会被读成 replaceActions 没生效。只要 replaceActions:true 且传了 actions
|
|
323
|
+
// (含空数组)就说;差集为空时明说「本次没有移除非默认动作」。
|
|
320
324
|
const readbackRemoved = Array.isArray(outcome?.readback?.removedActionCodes)
|
|
321
325
|
? (outcome.readback.removedActionCodes.map(String))
|
|
322
326
|
: [];
|
|
323
|
-
const
|
|
324
|
-
|
|
327
|
+
const readbackHasPlatformDefaults = Array.isArray(outcome?.readback?.platformDefaultActions);
|
|
328
|
+
const readbackPlatformDefaults = readbackHasPlatformDefaults
|
|
329
|
+
? (outcome.readback.platformDefaultActions.map(String))
|
|
330
|
+
: [];
|
|
331
|
+
// plan 阶段没有回读,不能断言「本次没有移除」或「回读里没有默认动作」——只说教学句。
|
|
332
|
+
const actionsRemovedClause = readbackRemoved.length > 0 ? `(移除 ${readbackRemoved.join("、")})` : readbackHasPlatformDefaults ? "(本次没有移除非默认动作)" : "";
|
|
333
|
+
const actionsDefaultsClause = !readbackHasPlatformDefaults
|
|
334
|
+
? "剩余为平台默认动作(query/get 注入)"
|
|
335
|
+
: readbackPlatformDefaults.length > 0
|
|
336
|
+
? `剩余为平台默认动作(${readbackPlatformDefaults.join("、")},query/get 注入)`
|
|
337
|
+
: "回读里没有平台注入的默认动作(剩余动作均来自本次提交或平台保留)";
|
|
338
|
+
const actionsClearedLine = args.replaceActions === true && Array.isArray(args.actions)
|
|
339
|
+
? `;流程/自定义动作已清空${actionsRemovedClause};${actionsDefaultsClause},不是 replaceActions 未生效`
|
|
340
|
+
: "";
|
|
341
|
+
// F2(0.8.10 探针 E):增量 configure 保留了平台默认系统列,摘要行必须说出来,
|
|
342
|
+
// 否则人只看到列名里多了 createdTime 等,不知道是平台既有列而非 fieldCodes 写错。
|
|
343
|
+
const systemColumnsAdded = Array.isArray(outcome?.readback?.systemColumnsAdded)
|
|
344
|
+
? (outcome.readback.systemColumnsAdded.map(String))
|
|
345
|
+
: [];
|
|
346
|
+
const systemColumnsLine = systemColumnsAdded.length > 0
|
|
347
|
+
? `;平台额外保留系统列 ${systemColumnsAdded.join("、")}(未传 replaceColumns/hideDefaultSystemFields);要精确列集合请加 replaceColumns:true + hideDefaultSystemFields:true`
|
|
325
348
|
: "";
|
|
326
|
-
return `配置列表视图 ${stringArg(args, "code") ?? schemaCode ?? "?"}(模型 ${schemaCode ?? "?"}):列 ${codes || "(未变)"}${sections.length > 0 ? `;同时配置 ${sections.join("、")}` : ""}${actionsClearedLine}${conditionRuntimeLine}`;
|
|
349
|
+
return `配置列表视图 ${stringArg(args, "code") ?? schemaCode ?? "?"}(模型 ${schemaCode ?? "?"}):列 ${codes || "(未变)"}${sections.length > 0 ? `;同时配置 ${sections.join("、")}` : ""}${systemColumnsLine}${actionsClearedLine}${conditionRuntimeLine}`;
|
|
327
350
|
}
|
|
328
351
|
case "listview.delete":
|
|
329
352
|
return `删除列表视图 ${stringArg(args, "code") ?? "?"}(${schemaCode ?? "?"})`;
|
|
@@ -341,7 +341,7 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
|
|
|
341
341
|
}),
|
|
342
342
|
"field.publish": Object.freeze({
|
|
343
343
|
scope: "create publish readback",
|
|
344
|
-
description: "Publish the model's draft fields (bizproperty/publish). **Model-scoped**: one call publishes every draft field — never once per field. Optional `code`/`codes` verify published face; readback 回 `publishedCodes`。`codes` 短路须草稿/发布 options 一致,否则真发布。formBinding
|
|
344
|
+
description: "Publish the model's draft fields (bizproperty/publish). **Model-scoped**: one call publishes every draft field — never once per field. Optional `code`/`codes` verify published face; readback 回 `publishedCodes`。`codes` 短路须草稿/发布 options 一致,否则真发布。formBinding 含 dictionaryStale / relation-mappings-empty(显式空键)。瞬态重试:DDL 中间态自动重试≤3(退避 2s/5s);仍失败等≥30s 再发,勿重复建字段。**部分交付口径**:有请求的 code 不在发布面时 `allRequestedPresent:false` + `verified:false` + `readback.present:false`(共享写门据此把 deliveryState 降为 WRITE_UNVERIFIED)+ `unpublishedRequested`,并区分 `nonexistentCodes`(草稿面都没有——先 field.list 核对)与 `stillDraftCodes`(模型里有、发布后仍不在发布面)——已发布的字段仍然算发布了,但不要只看 ok/DELIVERED。",
|
|
345
345
|
}),
|
|
346
346
|
"field.delete": Object.freeze({
|
|
347
347
|
scope: "create publish readback",
|
package/dist/lanes/field.js
CHANGED
|
@@ -1913,6 +1913,13 @@ function relationMappingsEmptyWarnings(publishedRows) {
|
|
|
1913
1913
|
if (type !== FIELD_PROPERTY_TYPES.WORK_SHEET)
|
|
1914
1914
|
return false;
|
|
1915
1915
|
const options = optionsObjectOf(row.options);
|
|
1916
|
+
// 普通关联本来就不需要副本列:`mappings` 键缺席是**合法常态**,不是空配置。
|
|
1917
|
+
// 平台证据:BizFormJsonResolveServiceImpl.getRelationMappingByCode 对空/缺
|
|
1918
|
+
// mappings 直接回 null(无映射即合法,无报错),DataModelInitUtils.disposeOptions
|
|
1919
|
+
// 也只在键存在时搬运 mappings。只有调用方**显式声明了 mappings 键却留空**
|
|
1920
|
+
// ("" / "[]" / [] / null)才是配置错误——那会在设计器里显示「已设置」但无映射行。
|
|
1921
|
+
if (!Object.prototype.hasOwnProperty.call(options, "mappings"))
|
|
1922
|
+
return false;
|
|
1916
1923
|
const mappings = options.mappings;
|
|
1917
1924
|
if (mappings === undefined || mappings === null)
|
|
1918
1925
|
return true;
|
package/dist/lanes/list-view.js
CHANGED
|
@@ -692,7 +692,14 @@ export function registerListViewLane(tools) {
|
|
|
692
692
|
// byte-compare. Columns project to the authorable identity (sortKey/id
|
|
693
693
|
// are re-minted by every configure). Actions are therefore OUT of the
|
|
694
694
|
// rollback snapshot (and out of the restore) by design.
|
|
695
|
-
|
|
695
|
+
// 0.8.10(探针 E / round17):系统列(name/creater/createdTime/sequenceNo…)
|
|
696
|
+
// 与动作同属平台托管面:默认视图由平台种下、每次 configure 重铸 sortKey/id,
|
|
697
|
+
// 且回滚恢复它们需要把它们当 fieldCodes 提交(会与业务字段混淆)。回滚快照
|
|
698
|
+
// 因此只保留**业务列**;恢复时 replaceColumns 只重建业务列,系统列由平台
|
|
699
|
+
// 按缺省行为处理。口径与 queryActions 出快照一致。
|
|
700
|
+
const columns = (Array.isArray(model.queryColumns) ? model.queryColumns : [])
|
|
701
|
+
.filter((column) => !SYSTEM_FIELD_CODES.has(String(column.propertyCode ?? "")))
|
|
702
|
+
.map((column) => ({ propertyCode: column.propertyCode, name: column.name, visible: column.visible }));
|
|
696
703
|
return { ...model, queryColumns: columns, queryActions: undefined };
|
|
697
704
|
},
|
|
698
705
|
inverse: ({ before, args }) => {
|
|
@@ -1177,6 +1184,23 @@ export function registerListViewLane(tools) {
|
|
|
1177
1184
|
.map(decodeConditionRow)
|
|
1178
1185
|
.sort((a, b) => String(a.propertyCode ?? "").localeCompare(String(b.propertyCode ?? "")));
|
|
1179
1186
|
const readback = { code, added, updated, columns: afterCols, sorts, conditions };
|
|
1187
|
+
// F2(0.8.10 探针 E):平台在建视图时就给默认视图种了 4 个系统列
|
|
1188
|
+
// name/creater/createdTime/sequenceNo(BizQueryServiceImpl.createDefaultBizQuery
|
|
1189
|
+
// :209-226),增量 configure(未传 replaceColumns/hideDefaultSystemFields)会
|
|
1190
|
+
// 把它们原样保留——真机 4 列请求回读 8 列,调用方会以为 fieldCodes 写错了。
|
|
1191
|
+
// 只报告不改变写入语义;权威列集合 = 调用方 fieldCodes + 平台既有列。
|
|
1192
|
+
if (args.replaceColumns !== true && args.hideDefaultSystemFields !== true) {
|
|
1193
|
+
const requestedCodes = new Set(args.fieldCodes.map((ref) => resolveFieldRef(fieldRows, ref)?.code ?? ref));
|
|
1194
|
+
const systemColumnsAdded = [
|
|
1195
|
+
...new Set(afterCols
|
|
1196
|
+
.map((column) => String(column.propertyCode ?? ""))
|
|
1197
|
+
.filter((columnCode) => columnCode.length > 0 && SYSTEM_FIELD_CODES.has(columnCode) && !requestedCodes.has(columnCode))),
|
|
1198
|
+
];
|
|
1199
|
+
if (systemColumnsAdded.length > 0) {
|
|
1200
|
+
readback.systemColumnsAdded = systemColumnsAdded;
|
|
1201
|
+
readback.systemColumnsNote = `平台额外保留系统列 ${systemColumnsAdded.join("、")};要精确 ${requestedCodes.size} 列请同时传 replaceColumns:true + hideDefaultSystemFields:true(系统列与业务列一视同仁,想保留哪个就写进 fieldCodes)`;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1180
1204
|
// r35(2026-10-31 真机):视图固定条件读回正确,但 `data.list --queryCode <视图>`
|
|
1181
1205
|
// 不应用该过滤(4 条未过滤返回)——视图条件的运行时过滤语义未取证(门户 vs
|
|
1182
1206
|
// REST queryCode),coverage 已声明 "filtering … not probed"。前置声明省 3 轮排查。
|
|
@@ -1246,34 +1270,39 @@ export function registerListViewLane(tools) {
|
|
|
1246
1270
|
.map(decodeActionRow)
|
|
1247
1271
|
.sort((a, b) => Number(a.sortKey ?? 0) - Number(b.sortKey ?? 0));
|
|
1248
1272
|
readback.actions = afterActions;
|
|
1249
|
-
// F14(0.8.9 探针 D):actions:[] + replaceActions:true
|
|
1250
|
-
//
|
|
1251
|
-
// 在 query/get 读面强制补齐 qr_code/batch_print/batch_update/
|
|
1273
|
+
// F14(0.8.9 探针 D)/ F8(0.8.10 探针 E):actions:[] + replaceActions:true
|
|
1274
|
+
// 之后 `actions` 仍列 6 条平台注入动作(BizQueryController.dealHistoryDataOfButton
|
|
1275
|
+
// :482-575 在 query/get 读面强制补齐 qr_code/batch_print/batch_update/
|
|
1252
1276
|
// import_attachment/export_attachment/batch_submit),使用者会怀疑 replace
|
|
1253
|
-
// 没生效。区分三层:平台真值 actions
|
|
1254
|
-
//
|
|
1255
|
-
//
|
|
1256
|
-
//
|
|
1277
|
+
// 没生效。区分三层:平台真值 actions 原样保留;本次被清掉的(写入前权威
|
|
1278
|
+
// 读回集减去回读集)进 removedActionCodes;回读里由平台注入且不是调用方
|
|
1279
|
+
// 显式提交的 code 进 platformDefaultActions。**只要按权威全集替换且传了
|
|
1280
|
+
// actions(含空数组)就必给 platformDefaultActions + actionsNote**——0.8.9
|
|
1281
|
+
// 只在两个差集非空时写 note,差集同时为空就静默,探针把它读成「replace
|
|
1282
|
+
// 没生效」。差集为空时 note 明说「本次没有移除非默认动作」,不伪装。
|
|
1257
1283
|
if (args.replaceActions === true) {
|
|
1258
1284
|
const afterCodes = new Set(afterActions.map((action) => String(action.actionCode ?? "")).filter(Boolean));
|
|
1259
1285
|
const submittedCodes = new Set(args.actions.map((action) => String(action.actionCode ?? "")).filter(Boolean));
|
|
1260
|
-
const platformDefaultActions =
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1286
|
+
const platformDefaultActions = [
|
|
1287
|
+
...new Set(afterActions
|
|
1288
|
+
.map((action) => String(action.actionCode ?? ""))
|
|
1289
|
+
.filter((code) => PLATFORM_INJECTED_READ_ACTIONS.includes(code) && !submittedCodes.has(code))),
|
|
1290
|
+
];
|
|
1291
|
+
const removedActionCodes = [
|
|
1292
|
+
...new Set(readArray(model, "queryActions")
|
|
1293
|
+
.map((action) => String(action.actionCode ?? ""))
|
|
1294
|
+
.filter((code) => code.length > 0 && !afterCodes.has(code) && !submittedCodes.has(code))),
|
|
1295
|
+
];
|
|
1266
1296
|
if (removedActionCodes.length > 0)
|
|
1267
|
-
readback.removedActionCodes =
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
}
|
|
1297
|
+
readback.removedActionCodes = removedActionCodes;
|
|
1298
|
+
readback.platformDefaultActions = platformDefaultActions;
|
|
1299
|
+
readback.actionsNote =
|
|
1300
|
+
(removedActionCodes.length > 0
|
|
1301
|
+
? `本次移除 ${removedActionCodes.join("、")}(权威读回差集);`
|
|
1302
|
+
: "本次没有移除非默认动作(权威读回差集为空);") +
|
|
1303
|
+
(platformDefaultActions.length > 0
|
|
1304
|
+
? `流程/自定义动作已清空;剩余为平台默认动作(${platformDefaultActions.join("、")},query/get 注入,不是 replaceActions 未生效)。`
|
|
1305
|
+
: "流程/自定义动作已清空;回读里没有平台注入的默认动作(剩余动作均来自本次提交或平台保留),不是 replaceActions 未生效。");
|
|
1277
1306
|
}
|
|
1278
1307
|
}
|
|
1279
1308
|
if (afterModel.queryPresentation && typeof afterModel.queryPresentation === "object") {
|
|
@@ -113,12 +113,21 @@ export async function inboundModelReferences(session, targets, treeRows, options
|
|
|
113
113
|
left.via.localeCompare(right.via) ||
|
|
114
114
|
(left.childTable?.code ?? "").localeCompare(right.childTable?.code ?? ""));
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* `omc model-purge --unbind-references --apply` — the ONE command that executes
|
|
118
|
+
* the same `field.delete → field.publish` unlink steps and then lets
|
|
119
|
+
* model.delete cascade (0.8.9 F7; `UNBIND_STEP_TOOLS` in model-purge.ts is the
|
|
120
|
+
* allow-list). Shared here so the refusal and the purge receipt cannot drift.
|
|
121
|
+
*/
|
|
122
|
+
export function modelPurgeUnbindCommand(schemaCode, options = {}) {
|
|
123
|
+
return `omc model-purge --code ${schemaCode} --unbind-references${options.purgeInstances === true ? " --purge-instances" : ""} --apply`;
|
|
124
|
+
}
|
|
116
125
|
/**
|
|
117
126
|
* Build the refusal payload shared by the three delete entry points
|
|
118
127
|
* (model.delete dry-run, model.delete, model.deleteMany). The message names the
|
|
119
128
|
* real platform cause and the exact commands that remove the reference.
|
|
120
129
|
*/
|
|
121
|
-
export function inboundReferenceRefusal(target, references) {
|
|
130
|
+
export function inboundReferenceRefusal(target, references, options = {}) {
|
|
122
131
|
const referencingModels = [];
|
|
123
132
|
for (const reference of references) {
|
|
124
133
|
const existing = referencingModels.find((model) => model.schemaCode === reference.schemaCode);
|
|
@@ -145,6 +154,9 @@ export function inboundReferenceRefusal(target, references) {
|
|
|
145
154
|
step("model.delete", { schemaCode: target });
|
|
146
155
|
const selfReferences = references.filter((reference) => reference.selfReference);
|
|
147
156
|
const externalReferences = references.filter((reference) => !reference.selfReference);
|
|
157
|
+
// F6(0.8.10):自引用才走「一条命令删净」;普通兄弟模型引用的 nextCommand
|
|
158
|
+
// 仍是 deletionSteps[0](既有路径不变)。
|
|
159
|
+
const selfPurgeCommand = selfReferences.length > 0 ? options.selfReferencePurgeCommand : undefined;
|
|
148
160
|
const selfText = selfReferences.map((reference) => `${reference.childTable.code}.${reference.fields.map((field) => field.code).join("/")}`);
|
|
149
161
|
const externalText = [...new Set(externalReferences.map((reference) => reference.schemaCode))];
|
|
150
162
|
const parts = [];
|
|
@@ -160,12 +172,16 @@ export function inboundReferenceRefusal(target, references) {
|
|
|
160
172
|
inboundReferences: [...references],
|
|
161
173
|
deletionOrder: [...new Set([...references.map((reference) => reference.schemaCode), target])],
|
|
162
174
|
deletionSteps: steps,
|
|
163
|
-
nextCommand: steps[0]?.command ?? `omc call model.delete --args '${JSON.stringify({ schemaCode: target })}'`,
|
|
164
|
-
nextAction:
|
|
165
|
-
? "
|
|
166
|
-
:
|
|
175
|
+
nextCommand: selfPurgeCommand ?? steps[0]?.command ?? `omc call model.delete --args '${JSON.stringify({ schemaCode: target })}'`,
|
|
176
|
+
nextAction: selfPurgeCommand !== undefined
|
|
177
|
+
? "一条命令删净(破坏性):nextCommand 会先按 deletionSteps 删除指向自身的子表关联列(及其它引用列),再让 model.delete 级联删本模型;被删列数据不可恢复。逐条手工审计命令仍见 deletionSteps"
|
|
178
|
+
: selfText.length > 0
|
|
179
|
+
? "按 deletionSteps 依赖倒序逐条执行:先 field.delete 删掉指向自身的子表关联列(及其它引用列),再 field.publish 发布所属模型,最后 model.delete(本工具已零写入拒绝,不会启动平台删除任务)"
|
|
180
|
+
: "按 deletionSteps 依赖倒序执行:先删引用方模型的关联字段(或整体删掉引用方模型),再删本模型",
|
|
167
181
|
message: `${target} 不能删除(零写入拒绝,未调用 physically_delete)。${parts.join(" ")}` +
|
|
168
|
-
|
|
182
|
+
(selfPurgeCommand !== undefined
|
|
183
|
+
? `一条命令删净:nextCommand = \`${selfPurgeCommand}\` —— 破坏性:它先删除上述引用列(子表关联列/兄弟模型关联列),再删除 ${target} 模型;被删列的数据不可恢复。逐条可审计的依赖倒序命令仍见 deletionSteps:先删关联列 → 发布所属模型 → 再删本模型。`
|
|
184
|
+
: `依赖倒序(逐条可执行命令见 deletionSteps / nextCommand):先删关联列 → 发布所属模型 → 再删本模型。`) +
|
|
169
185
|
`不要在未拆引用时重试 model.delete——平台只会再次回 taskId 并把真因留在删除历史里(模型引用失败时 taskStatus=FAIL,子表自引用时任务永远 RUN)。`,
|
|
170
186
|
};
|
|
171
187
|
}
|
package/dist/lanes/model.js
CHANGED
|
@@ -18,7 +18,7 @@ import { defineTool, ToolInputError, ToolRefusalError } from "../tool-types.js";
|
|
|
18
18
|
import { wireCall, wireRows, WireError } from "../wire.js";
|
|
19
19
|
import { assertTreeSelectionOptions } from "../field-tree-options.js";
|
|
20
20
|
import { readModelRecord } from "../model-record.js";
|
|
21
|
-
import { inboundModelReferences, inboundReferenceRefusal } from "./model-references.js";
|
|
21
|
+
import { inboundModelReferences, inboundReferenceRefusal, modelPurgeUnbindCommand } from "./model-references.js";
|
|
22
22
|
import { MODEL_CREATE_BODY_DEFAULTS, MODEL_LANE_CONTRACT } from "./model-contract.js";
|
|
23
23
|
import { flattenFolders } from "./folder.js";
|
|
24
24
|
const MODEL_LANE = MODEL_LANE_CONTRACT.lane;
|
|
@@ -911,7 +911,7 @@ export function registerModelLane(tools) {
|
|
|
911
911
|
// (dogfood R3). `mayBeReferenced` is the honest preview.
|
|
912
912
|
wouldChange: !nodeResolved || references.length === 0,
|
|
913
913
|
mayBeReferenced: references.length > 0,
|
|
914
|
-
...(references.length > 0 ? inboundReferenceRefusal(args.schemaCode, references) : {}),
|
|
914
|
+
...(references.length > 0 ? inboundReferenceRefusal(args.schemaCode, references, { selfReferencePurgeCommand: modelPurgeUnbindCommand(args.schemaCode) }) : {}),
|
|
915
915
|
referencingModels: referencing,
|
|
916
916
|
inboundReferences: references,
|
|
917
917
|
treeNodeResolved: nodeResolved,
|
|
@@ -1015,7 +1015,10 @@ export function registerModelLane(tools) {
|
|
|
1015
1015
|
throw new ToolRefusalError({
|
|
1016
1016
|
status: "refused",
|
|
1017
1017
|
schemaCode: args.schemaCode,
|
|
1018
|
-
|
|
1018
|
+
// F6(0.8.10):自引用子表列的三步手工链(0.8.7 起)仍保留在
|
|
1019
|
+
// deletionSteps,但 nextCommand 改为 0.8.9 就有的
|
|
1020
|
+
// `model-purge --unbind-references`——一条命令拆引用再删模型。
|
|
1021
|
+
...inboundReferenceRefusal(args.schemaCode, inboundReferences, { selfReferencePurgeCommand: modelPurgeUnbindCommand(args.schemaCode) }),
|
|
1019
1022
|
});
|
|
1020
1023
|
}
|
|
1021
1024
|
// Model deletion CASCADES the workflow template away but leaves
|
|
@@ -683,6 +683,24 @@ export function nameOverwrittenNoteOf(suppliedName, authoritativeName) {
|
|
|
683
683
|
return undefined;
|
|
684
684
|
return `平台按模型「数据标题」表达式自动覆盖了 name:传入“${shortReadbackValue(suppliedName)}”→读回“${shortReadbackValue(authoritativeName)}”;业务标识(单号/编码)请用自建字段,不要依赖 name。`;
|
|
685
685
|
}
|
|
686
|
+
/**
|
|
687
|
+
* 权威读回里的 name——`data.load` 的行形状可能是平铺 name,也可能在 fields.name
|
|
688
|
+
* 下(ticket 17 的扁平契约与旧 VO 嵌套并存)。两形都认,空串当缺席。
|
|
689
|
+
*/
|
|
690
|
+
function readbackRecordNameOf(record) {
|
|
691
|
+
if (record === null || typeof record !== "object" || Array.isArray(record))
|
|
692
|
+
return undefined;
|
|
693
|
+
const flat = record.name;
|
|
694
|
+
if (typeof flat === "string" && flat.trim() !== "")
|
|
695
|
+
return flat;
|
|
696
|
+
const fields = record.fields;
|
|
697
|
+
if (fields !== null && typeof fields === "object" && !Array.isArray(fields)) {
|
|
698
|
+
const nested = fields.name;
|
|
699
|
+
if (typeof nested === "string" && nested.trim() !== "")
|
|
700
|
+
return nested;
|
|
701
|
+
}
|
|
702
|
+
return undefined;
|
|
703
|
+
}
|
|
686
704
|
/**
|
|
687
705
|
* data.list 的视图证据读取(query/get 失败/无视图 → undefined = 无证据)。
|
|
688
706
|
* 拿到 queryColumns 数组才算可判定证据;视图对象在但 queryColumns 非数组 →
|
|
@@ -4321,18 +4339,21 @@ export function registerRuntimeDataLane(tools) {
|
|
|
4321
4339
|
submittedData: projectReadbackRecord(record, args),
|
|
4322
4340
|
// r62a-F10(P1-9):无流程分支的 name 覆盖检测(与 approval 分支同款)——
|
|
4323
4341
|
// 真机实证无流程模型也会把传入 name 换成「发起人+模型名+时间」标题。
|
|
4342
|
+
// F4(w71,0.8.10):与 data.save 同口径——复用 nameOverwrittenNoteOf,
|
|
4343
|
+
// 回执顶层给 nameOverwrittenNote(人类摘要行同源)。nameOverridden 保留
|
|
4344
|
+
// 结构化 wanted/landed,兼容既有调用方。
|
|
4324
4345
|
...(() => {
|
|
4325
|
-
const
|
|
4326
|
-
const
|
|
4327
|
-
const
|
|
4328
|
-
|
|
4329
|
-
: typeof (record.fields ?? {}).name === "string"
|
|
4330
|
-
? String(record.fields.name)
|
|
4331
|
-
: null;
|
|
4332
|
-
const landedName = landedNameRaw !== null && landedNameRaw.trim() !== "" ? landedNameRaw : null;
|
|
4333
|
-
if (wantedName === null || landedName === null || landedName === wantedName)
|
|
4346
|
+
const wantedName = typeof formData.name === "string" && formData.name.trim() !== "" ? formData.name : null;
|
|
4347
|
+
const landedName = readbackRecordNameOf(record);
|
|
4348
|
+
const note = nameOverwrittenNoteOf(wantedName, landedName);
|
|
4349
|
+
if (wantedName === null || landedName === undefined)
|
|
4334
4350
|
return {};
|
|
4335
|
-
return {
|
|
4351
|
+
return {
|
|
4352
|
+
...(note !== undefined ? { nameOverwrittenNote: note } : {}),
|
|
4353
|
+
...(landedName !== wantedName
|
|
4354
|
+
? { nameOverridden: { wanted: wantedName, landed: landedName, note: "name 是平台数据标题(自动生成优先):传入值被覆盖,业务字段请用自有 code(如 title/subject)" } }
|
|
4355
|
+
: {}),
|
|
4356
|
+
};
|
|
4336
4357
|
})(),
|
|
4337
4358
|
...(serialGenerationFailed.length > 0
|
|
4338
4359
|
? { serialGenerationFailed, serialGenerationWarning: SERIAL_GENERATION_FAILURE_NOTE }
|
|
@@ -4396,18 +4417,21 @@ export function registerRuntimeDataLane(tools) {
|
|
|
4396
4417
|
// 「发起人+模型名+时间」生成标题时,传的 name 被静默替换且无告警(探针
|
|
4397
4418
|
// 传「r62a_差旅-短程」得到「付文彬的差旅申请 2026-11-13 …」)。检测
|
|
4398
4419
|
// 覆盖并点名,别让调用方以为标题没生效是 bug。
|
|
4420
|
+
// F4(w71,0.8.10):与 data.save 同口径——复用 nameOverwrittenNoteOf,
|
|
4421
|
+
// 审批/发起提交(同一条 else 路径)也回 nameOverwrittenNote + 人类摘要行。
|
|
4399
4422
|
...(() => {
|
|
4400
|
-
const
|
|
4401
|
-
const
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
const wantedName = typeof wanted.name === "string" && wanted.name.trim() !== "" ? wanted.name : null;
|
|
4405
|
-
const landedNameRaw = typeof landed.name === "string" ? landed.name : typeof landedFields.name === "string" ? landedFields.name : null;
|
|
4406
|
-
const landedName = landedNameRaw !== null && landedNameRaw.trim() !== "" ? landedNameRaw : null;
|
|
4407
|
-
if (wantedName === null || landedName === null || landedName === wantedName)
|
|
4423
|
+
const wantedName = typeof formData.name === "string" && formData.name.trim() !== "" ? formData.name : null;
|
|
4424
|
+
const landedName = readbackRecordNameOf(loadedRecord);
|
|
4425
|
+
const note = nameOverwrittenNoteOf(wantedName, landedName);
|
|
4426
|
+
if (wantedName === null || landedName === undefined)
|
|
4408
4427
|
return {};
|
|
4409
4428
|
return {
|
|
4410
|
-
|
|
4429
|
+
...(note !== undefined ? { nameOverwrittenNote: note } : {}),
|
|
4430
|
+
...(landedName !== wantedName
|
|
4431
|
+
? {
|
|
4432
|
+
nameOverridden: { wanted: wantedName, landed: landedName, note: "name 是平台数据标题(自动生成优先):传入值被覆盖,业务字段请用自有 code(如 title/subject),不要用 name 承载业务语义" },
|
|
4433
|
+
}
|
|
4434
|
+
: {}),
|
|
4411
4435
|
};
|
|
4412
4436
|
})(),
|
|
4413
4437
|
...(approvalDelta
|
package/dist/model-purge.js
CHANGED
|
@@ -28,7 +28,7 @@ import { writeEnvelope } from "./cli-output.js";
|
|
|
28
28
|
import { ENDPOINTS } from "./endpoints.js";
|
|
29
29
|
import { wireCall, wireRows } from "./wire.js";
|
|
30
30
|
import { readModelRecord } from "./model-record.js";
|
|
31
|
-
import { inboundModelReferences, inboundReferenceRefusal } from "./lanes/model-references.js";
|
|
31
|
+
import { inboundModelReferences, inboundReferenceRefusal, modelPurgeUnbindCommand } from "./lanes/model-references.js";
|
|
32
32
|
import { resolveModelTreeNode } from "./lanes/model.js";
|
|
33
33
|
import { SessionManager } from "./session-manager.js";
|
|
34
34
|
import { ConfigStore, defaultPaths } from "./config-store.js";
|
|
@@ -47,7 +47,7 @@ export function unbindDeletionSteps(steps) {
|
|
|
47
47
|
* One purge command does instances → unbind → model cascade.
|
|
48
48
|
*/
|
|
49
49
|
export function unbindPurgeCommand(schemaCode, options = {}) {
|
|
50
|
-
return
|
|
50
|
+
return modelPurgeUnbindCommand(schemaCode, options);
|
|
51
51
|
}
|
|
52
52
|
async function sessionFor(environment) {
|
|
53
53
|
const store = new ConfigStore(defaultPaths());
|
package/dist/read.js
CHANGED
|
@@ -84,6 +84,14 @@ function transportDiagnostics(toolName, error, environment, retried, facts = des
|
|
|
84
84
|
* onlinejs.compose, service.update/method.update all self-read).
|
|
85
85
|
*/
|
|
86
86
|
const FULL_INLINE_CEILING_BYTES = 8192;
|
|
87
|
+
/**
|
|
88
|
+
* F3(w71,2026-11-26 真机):`data.load` 的语义就是「读这一条」——14 个业务
|
|
89
|
+
* 字段 + 2 行子表(约 2–3KB)却被通用读面 diet 外置成 `data:null`,调用方必须
|
|
90
|
+
* 再跑一次 `omc artifact get`。单条记录不是「大列表」,与 items/logs/triggers
|
|
91
|
+
* 同列为小行集;只保留上限保护(与 `artifact get` 的内联上限同为 8192B),
|
|
92
|
+
* 超过仍外置。`data.list` 及其它工具的 2048 门不变。
|
|
93
|
+
*/
|
|
94
|
+
const LOAD_RECORD_INLINE_CEILING_BYTES = FULL_INLINE_CEILING_BYTES;
|
|
87
95
|
/**
|
|
88
96
|
* Run composed sibling reads without the `unchanged` short-circuit, so a
|
|
89
97
|
* composite tool (model.inspect) receives their real payloads even after an
|
|
@@ -155,7 +163,10 @@ export async function governedRead(ctx, tool, args, execute, options = {}) {
|
|
|
155
163
|
// 6 条就超 2048B 被折叠到 artifact,agent 还得再取一次。与 items/logs 同口径。
|
|
156
164
|
// 2026-11-23(0.6.97):数据规则纳入后单模型可达 30+ 行(1 条计算/校验规则
|
|
157
165
|
// 各一行)——30→60,仍是有界的小行集(长度规则已聚合,不会无限长)。
|
|
158
|
-
|| (Array.isArray(result.triggers) && result.triggers.length <= 60)
|
|
166
|
+
|| (Array.isArray(result.triggers) && result.triggers.length <= 60)
|
|
167
|
+
// F3(w71):单条记录(data.load)在 8192B 内联上限内不外置;缺席
|
|
168
|
+
// (exists:false)没有记录可外置,保持既有形状。
|
|
169
|
+
|| (tool.name === "data.load" && result.exists !== false && jsonBytes(result) <= LOAD_RECORD_INLINE_CEILING_BYTES);
|
|
159
170
|
const large = !smallRowSet && jsonBytes(result) > 2048;
|
|
160
171
|
const fileName = `${tool.name.replace(/[^a-zA-Z0-9._-]/g, "_")}-${sha256(target).slice(0, 16)}.json`;
|
|
161
172
|
const artifactRef = writeArtifact(ctx, fileName, detail);
|
|
@@ -17,7 +17,7 @@ const onlinejsHighlightScript = Object.freeze({
|
|
|
17
17
|
],
|
|
18
18
|
conditionalRequirements: [
|
|
19
19
|
"事件模型:`form.on('onRendered', …)` 初始化 + `<控件>.valueChange.subscribe(function(change){ change.value })` 监听;改样式用 `control.options.style`",
|
|
20
|
-
"**脚本含引号/较长时不要塞 --args 内联**——写 JSON 参数文件走 `--args-file
|
|
20
|
+
"**脚本含引号/较长时不要塞 --args 内联**——写 JSON 参数文件走 `--args-file <配置根内的相对路径,如 ./compose.json>`(配置根外一律拒绝),或 `--args -` 从 stdin 读(shell 引号拆参 r38 实证)",
|
|
21
21
|
"深入教学面:`.claude/skills/form-online-js/references/`(lifecycle-api/control-api)",
|
|
22
22
|
],
|
|
23
23
|
priorToolReferences: [{ tool: "form.get", args: { environment, schemaCode: model }, purpose: "确认表单已发布与控件编码" }],
|
|
@@ -34,7 +34,7 @@ export const ONLINEJS_METADATA = Object.freeze({
|
|
|
34
34
|
tool: "onlinejs.compose",
|
|
35
35
|
args: { environment, schemaCode: model, sheetCode: "<默认表单 code == 模型 code>", replace: true, source: "(function(form){ h3form.axios.get(config.apiHost + '/api/organization/user/info', {params:{id:'<userId>'}}).then(function(res){ var dept = {id:res.data.departmentId, name:res.data.departmentName}; return h3form.axios.get(config.apiHost + '/api/organization/department/users', {params:{deptId:dept.id,page:0,size:300,filterType:'admin'}}); }).then(function(res){ var members = res.data.content || []; }); })" },
|
|
36
36
|
preconditions: ["门户取证:GET /api/organization/user/info 回 data.departmentId/departmentName;GET /api/organization/department/users 回 data.content,成员含 id/name"],
|
|
37
|
-
conditionalRequirements: ["这是已实证的门户请求形状;userId、schemaCode、字段使用前替换为真实值", "脚本含引号/较长时用 --args-file"],
|
|
37
|
+
conditionalRequirements: ["这是已实证的门户请求形状;userId、schemaCode、字段使用前替换为真实值", "脚本含引号/较长时用 --args-file <配置根内相对路径,如 ./compose.json> 或 --args -"],
|
|
38
38
|
refusalRecovery: [{ code: "onlinejs-source-invalid", action: "完整外壳改 `replace:true`(六元素模板保留,仅整体替换 customScript)" }],
|
|
39
39
|
priorToolReferences: [{ tool: "form.get", args: { environment, schemaCode: model }, purpose: "确认表单已发布与控件编码" }],
|
|
40
40
|
dryRun: { supported: true, command: `omc call onlinejs.compose --env ${environment} --dry-run --args-file compose.json`, notes: "dry-run 校验外壳/合并模式,不写平台" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"commander": "14.0.3",
|
|
61
|
-
"omc-core": "0.8.
|
|
61
|
+
"omc-core": "0.8.10",
|
|
62
62
|
"proper-lockfile": "4.1.2",
|
|
63
63
|
"write-file-atomic": "6.0.0",
|
|
64
64
|
"zod": "^3.23.8",
|
|
@@ -76,6 +76,6 @@
|
|
|
76
76
|
"directory": "packages/omc-cli"
|
|
77
77
|
},
|
|
78
78
|
"optionalDependencies": {
|
|
79
|
-
"@stalfh233/omc-fake-platform": "0.8.
|
|
79
|
+
"@stalfh233/omc-fake-platform": "0.8.10"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -221,6 +221,9 @@ omc call programming.save --env <env> --args-file save.json
|
|
|
221
221
|
omc call programming.publish --env <env> --args-file publish.json
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
+
> `save.json` / `publish.json` 必须位于**配置根内**(相对路径即可;根外文件一律拒绝);
|
|
225
|
+
> 根外内容改走 `--args -`(stdin)或先拷进配置根。
|
|
226
|
+
|
|
224
227
|
### 工作区(多规则、可 review,推荐)
|
|
225
228
|
|
|
226
229
|
```bash
|