@stalfh233/omc-cli 0.8.32 → 0.8.34
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/arg-vocabulary.js +223 -0
- package/dist/artifact-cmd.js +443 -0
- package/dist/batch-call.js +56 -3
- package/dist/call-command.js +70 -0
- package/dist/call-execute.js +228 -0
- package/dist/call-input.js +557 -0
- package/dist/call-output.js +240 -0
- package/dist/cli.js +13 -1359
- package/dist/command-transport.js +4 -1
- package/dist/form-support.js +14 -3
- package/dist/intent/plan-apply.js +14 -24
- package/dist/lanes/datarule.js +21 -0
- package/dist/lanes/field-contract.js +1 -1
- package/dist/lanes/field.js +128 -1
- package/dist/lanes/list-view-shapes.js +8 -1
- package/dist/lanes/list-view.js +64 -2
- package/dist/lanes/runtime-data/aggregate-support.js +209 -0
- package/dist/lanes/runtime-data/aggregate.js +679 -0
- package/dist/lanes/runtime-data/field-options.js +52 -0
- package/dist/lanes/runtime-data/lane.js +4 -0
- package/dist/lanes/runtime-data/record-delete.js +419 -0
- package/dist/lanes/runtime-data/record-read.js +984 -0
- package/dist/lanes/runtime-data/record-write.js +562 -0
- package/dist/lanes/runtime-data/registration.js +22 -0
- package/dist/lanes/runtime-data/shapes.js +594 -0
- package/dist/lanes/runtime-data/submission.js +1304 -0
- package/dist/lanes/runtime-data/write-support.js +875 -0
- package/dist/lanes/runtime-data.js +10 -5590
- package/dist/lanes/workflow/approval-ops.js +983 -0
- package/dist/lanes/workflow/instance-read.js +284 -0
- package/dist/lanes/workflow/lifecycle-write.js +1499 -0
- package/dist/lanes/workflow/permissions.js +571 -0
- package/dist/lanes/workflow/recovery.js +361 -0
- package/dist/lanes/workflow/registration.js +14 -0
- package/dist/lanes/workflow/shapes.js +811 -0
- package/dist/lanes/workflow/template-fetch.js +197 -0
- package/dist/lanes/workflow/template-merge.js +1351 -0
- package/dist/lanes/workflow/template-read.js +327 -0
- package/dist/lanes/workflow.js +11 -6312
- package/dist/model-scaffold.js +6 -2
- package/dist/plan.js +23 -1
- package/dist/read-projection.js +442 -0
- package/dist/read.js +40 -335
- package/dist/rollback.js +17 -23
- package/dist/runtime-support.js +1 -1
- package/dist/verification.js +39 -0
- package/dist/write-coordinator.js +152 -0
- package/dist/write-outcome.js +295 -0
- package/dist/write.js +34 -115
- package/package.json +3 -3
- package/skills/omc-refusals.md +1 -1
- package/skills/omc-start-here.md +2 -2
|
@@ -5,6 +5,7 @@ import { resolve } from "node:path";
|
|
|
5
5
|
import { CLI_DEFAULT_OUTPUT_BYTES, CLI_MAX_OUTPUT_BYTES, createArtifact, isWithinRoot, readArtifact } from "./artifacts.js";
|
|
6
6
|
import { CLI_EXIT_CODES, classifyResult, envelope, errorEnvelope } from "./cli-contract.js";
|
|
7
7
|
import { writeEnvelope, outputOptions } from "./cli-output.js";
|
|
8
|
+
import { fitsStdoutBudget } from "./read-projection.js";
|
|
8
9
|
const UNCERTAIN_NEXT_ACTION = "read back the requestId before retrying; retry only after the outcome is established";
|
|
9
10
|
/**
|
|
10
11
|
* Run a CLI action inside the transport band: validate the budget up front (a
|
|
@@ -78,7 +79,9 @@ export function boundResult(result, budget) {
|
|
|
78
79
|
const serialized = JSON.stringify(sanitized);
|
|
79
80
|
if (outputOptions().outFile)
|
|
80
81
|
return sanitized;
|
|
81
|
-
|
|
82
|
+
// 预算判定复用 read-projection.ts 的唯一字节判定(三层投影的最后一层;
|
|
83
|
+
// 前两层——读面 artifact 与 --jq 路径选择——都已在此处之前完成)。
|
|
84
|
+
if (fitsStdoutBudget(serialized, budget))
|
|
82
85
|
return sanitized;
|
|
83
86
|
const artifact = createArtifact(artifactRoot(), JSON.stringify(sanitized, null, 2) + "\n");
|
|
84
87
|
return { status: sanitized.status ?? "ok", truncated: true, artifactId: artifact.artifactId, sha256: artifact.sha256, bytes: Buffer.byteLength(serialized), fetch: artifactFetchHint(artifact.artifactId) };
|
package/dist/form-support.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { wireCall, wireRows, WireError } from "./wire.js";
|
|
2
2
|
import { ENDPOINTS } from "./endpoints.js";
|
|
3
3
|
import { decodeJsonObjectColumn } from "./json-column.js";
|
|
4
|
+
import { verificationPartial } from "./verification.js";
|
|
4
5
|
import { ToolRefusalError } from "./tool-types.js";
|
|
5
6
|
import { FIELD_CONTROL_TYPES, childColumnsOf, SYSTEM_FIELD_CODES, fieldControlOptions, relationDisplayField, relationMappings, } from "./field-families.js";
|
|
6
7
|
import { deriveControlOptions } from "./capability-shape.js";
|
|
@@ -1358,15 +1359,25 @@ export async function childColumnsMissingFromForm(session, args) {
|
|
|
1358
1359
|
/** 发布面缺子表列时的一句诊断(write 与 dry-run 同一句)。 */
|
|
1359
1360
|
export const CHILD_COLUMNS_NOT_IN_FORM_NOTE = "子表字段已发布,表单 Sheet201 columns 无此列——页面不可见(成功≠可见)。form.publish 加 bindNewChildColumns:true 一步绑定后发布(不动其它控件/布局);补 fieldCodes/布局才用 configure_form";
|
|
1360
1361
|
/** 发布面缺子表列时的回执片段(写路径 / already-published 短路 / dry-run 共用一份形状)。 */
|
|
1361
|
-
function childColumnsGapReadback(gaps, schemaCode, sheetCode
|
|
1362
|
+
function childColumnsGapReadback(gaps, schemaCode, sheetCode,
|
|
1363
|
+
// 预览(dry-run)没有发布动作:只给旧键,不冒充「已发布」的验收等级。
|
|
1364
|
+
phase = "written") {
|
|
1362
1365
|
if (gaps === undefined || gaps.length === 0)
|
|
1363
1366
|
return {};
|
|
1364
1367
|
// F3(0.8.32):form.publish 自己就能一步绑定(bindNewChildColumns:true,与
|
|
1365
1368
|
// field.publish 的教学一致),旧 nextCommand 指向 configure_form 的两次调用。
|
|
1369
|
+
const nextCommand = `omc call form.publish --args '${JSON.stringify({ schemaCode, ...(sheetCode !== schemaCode ? { sheetCode } : {}), bindNewChildColumns: true })}'`;
|
|
1366
1370
|
return {
|
|
1367
1371
|
childColumnsNotInForm: gaps,
|
|
1368
1372
|
childColumnsNote: CHILD_COLUMNS_NOT_IN_FORM_NOTE,
|
|
1369
|
-
nextCommand
|
|
1373
|
+
nextCommand,
|
|
1374
|
+
// 统一验收等级(0.8.33):已发布 ≠ 页面可见。旧 childColumnsNotInForm/
|
|
1375
|
+
// childColumnsNote/nextCommand 原样保留,这里补结构投影。
|
|
1376
|
+
...(phase === "written"
|
|
1377
|
+
? {
|
|
1378
|
+
verification: verificationPartial("已发布,但子表列未绑定到表单——业务页不可见(配置等价 ≠ 运行面可用)。", { command: nextCommand, manual: "门户打开该表单,确认子表控件里能看到这些列" }),
|
|
1379
|
+
}
|
|
1380
|
+
: {}),
|
|
1370
1381
|
};
|
|
1371
1382
|
}
|
|
1372
1383
|
/**
|
|
@@ -1419,7 +1430,7 @@ export async function lintFormPublishReadOnly(session, args) {
|
|
|
1419
1430
|
: "没有待绑定的子表列",
|
|
1420
1431
|
}
|
|
1421
1432
|
: {}),
|
|
1422
|
-
...childColumnsGapReadback(childColumnGaps, args.schemaCode, sheetCode),
|
|
1433
|
+
...childColumnsGapReadback(childColumnGaps, args.schemaCode, sheetCode, "planned"),
|
|
1423
1434
|
note: willBindChildColumns
|
|
1424
1435
|
? "降级门与真写同一函数;bindNewChildColumns 会先增量绑定这些子表列,因此真写不会短路(会改发布面)"
|
|
1425
1436
|
: "降级门与真写同一函数;alreadyPublished:true 时真写会短路(不改发布面)",
|
|
@@ -12,7 +12,7 @@ import { SessionManager } from "../session-manager.js";
|
|
|
12
12
|
import { ConfigStore, defaultPaths } from "../config-store.js";
|
|
13
13
|
import { buildToolRegistry } from "../tools.js";
|
|
14
14
|
import { executeChangesBatch } from "../lanes/apply-changes.js";
|
|
15
|
-
import {
|
|
15
|
+
import { writeCoordinator, WriteLockConflictError } from "../write-coordinator.js";
|
|
16
16
|
import { wireCall, WireError } from "../wire.js";
|
|
17
17
|
import { ENDPOINTS } from "../endpoints.js";
|
|
18
18
|
import { extractBizObjectPage } from "../lanes/runtime-data.js";
|
|
@@ -497,27 +497,10 @@ export async function applyIntent(planPath, options, ports) {
|
|
|
497
497
|
// `--wait` mirrors `omc call --wait`: bound the retry inside the CLI instead
|
|
498
498
|
// of forcing the caller to spend a round trip per conflict. Default stays 0
|
|
499
499
|
// (fail fast, structured refusal) — the opt-in is what makes it safe for
|
|
500
|
-
// non-replayable batches.
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
while (!lock.held && Date.now() < deadline) {
|
|
505
|
-
await new Promise((resolve) => setTimeout(resolve, Math.min(200, Math.max(0, deadline - Date.now()))));
|
|
506
|
-
lock = await acquireWriteLock(plan.environment);
|
|
507
|
-
}
|
|
508
|
-
if (!lock.held) {
|
|
509
|
-
const conflict = {
|
|
510
|
-
status: "refused",
|
|
511
|
-
blocker: "write-lock-held",
|
|
512
|
-
environment: plan.environment,
|
|
513
|
-
owner: lock.owner,
|
|
514
|
-
recovery: lock.recovery,
|
|
515
|
-
message: lock.recovery[0],
|
|
516
|
-
};
|
|
517
|
-
console.error(`write lock conflict: ${JSON.stringify(lock.owner)}`);
|
|
518
|
-
return emit(conflict);
|
|
519
|
-
}
|
|
520
|
-
try {
|
|
500
|
+
// non-replayable batches. The acquire/wait/refusal policy itself lives in
|
|
501
|
+
// write-coordinator (W35); this function only supplies the intent-shaped
|
|
502
|
+
// refusal receipt the CLI has always emitted.
|
|
503
|
+
const applyPlan = async () => {
|
|
521
504
|
const context = makeToolContext({ sessions: new SessionManager(new ConfigStore(defaultPaths())) });
|
|
522
505
|
const session = await context.sessions.session(plan.environment);
|
|
523
506
|
if (session.environmentFingerprint() !== plan.environmentFingerprint)
|
|
@@ -652,9 +635,16 @@ export async function applyIntent(planPath, options, ports) {
|
|
|
652
635
|
// refused / uncertain outcome already reports its own status and must not
|
|
653
636
|
// be papered over by a second read.
|
|
654
637
|
return emit(result.status === "ok" ? await confirmReadback(delivered) : delivered);
|
|
638
|
+
};
|
|
639
|
+
try {
|
|
640
|
+
return await writeCoordinator.run({ environment: plan.environment, tool: "intent.apply", waitMs: options.waitMs ?? 0, mode: "intent" }, applyPlan);
|
|
655
641
|
}
|
|
656
|
-
|
|
657
|
-
|
|
642
|
+
catch (error) {
|
|
643
|
+
if (!(error instanceof WriteLockConflictError))
|
|
644
|
+
throw error;
|
|
645
|
+
if (error.conflict.stderr !== undefined)
|
|
646
|
+
console.error(error.conflict.stderr);
|
|
647
|
+
return emit(error.conflict.receipt);
|
|
658
648
|
}
|
|
659
649
|
}
|
|
660
650
|
//# sourceMappingURL=plan-apply.js.map
|
package/dist/lanes/datarule.js
CHANGED
|
@@ -5,6 +5,7 @@ import { capabilityArg, environmentArg } from "../args.js";
|
|
|
5
5
|
import { governedRead } from "../read.js";
|
|
6
6
|
import { ToolRefusalError } from "../tool-types.js";
|
|
7
7
|
import { writeTool } from "../write.js";
|
|
8
|
+
import { verificationConfigOnly, verificationUnverified } from "../verification.js";
|
|
8
9
|
import { decodeJsonColumn, JSON_COLUMN_PASSTHROUGH } from "../json-column.js";
|
|
9
10
|
import { defineTool } from "../tool-types.js";
|
|
10
11
|
import { resolveDataRuleRow } from "../identity.js";
|
|
@@ -1037,6 +1038,17 @@ export function registerDataRuleLane(tools) {
|
|
|
1037
1038
|
runtimeScope: args.checkType === 5 ? "server" : args.checkType !== undefined ? "portal-only" : "unknown",
|
|
1038
1039
|
// 缺 checkType 时执行面未知:不要假装 enforcedServerSide:false。
|
|
1039
1040
|
...(args.checkType !== undefined ? { enforcedServerSide: args.checkType === 5 } : {}),
|
|
1041
|
+
// 统一验收等级(0.8.33):runtimeScope 是旧字段,这里补同一句话的
|
|
1042
|
+
// 结构投影。checkType 5 走服务端重复校验,但本次没有提交数据,
|
|
1043
|
+
// 只能算 unverified;其余 type1 只在门户提交管线执行,REST 实测放行。
|
|
1044
|
+
verification: args.checkType === 5
|
|
1045
|
+
? verificationUnverified("rest", "仅证明数据规则配置已保存;checkType 5 是服务端重复校验,在 REST data.submit 路径执行,但本次未提交数据取证。", { command: `omc call datarule.list --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, dataRuleType: 1 })}'` })
|
|
1046
|
+
: args.checkType !== undefined
|
|
1047
|
+
? verificationConfigOnly("portal", "仅证明数据规则配置已保存(datarule.list 回读一致),未证明 REST data.submit 执行该校验——type1 非 checkType 5 在门户前端提交管线执行,REST 实测放行违规值。", {
|
|
1048
|
+
command: `omc call datarule.list --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, dataRuleType: 1 })}'`,
|
|
1049
|
+
manual: "门户表单提交一次违规数据,核对校验是否拦截(REST data.submit 不执行该校验)",
|
|
1050
|
+
})
|
|
1051
|
+
: verificationUnverified("none", "仅证明数据规则配置已保存;缺 checkType,执行面未知(REST/门户均未取证)。"),
|
|
1040
1052
|
executionWarning: dataRuleExecutionWarning(args.checkType),
|
|
1041
1053
|
// P1(探针 H F3,复核 2026-11-27):声明 validateHiddenProperties
|
|
1042
1054
|
// 的行**不抑制**提示——该键 2.1.5 独有,8.6.26/8.7 不执行;只按
|
|
@@ -1141,6 +1153,15 @@ export function registerDataRuleLane(tools) {
|
|
|
1141
1153
|
return {
|
|
1142
1154
|
runtimeScope: effectiveCheckType === 5 ? "server" : effectiveCheckType !== undefined ? "portal-only" : "unknown",
|
|
1143
1155
|
...(effectiveCheckType !== undefined ? { enforcedServerSide: effectiveCheckType === 5 } : {}),
|
|
1156
|
+
// 统一验收等级(0.8.33):与 create 同一执行面口径,按生效 checkType 报。
|
|
1157
|
+
verification: effectiveCheckType === 5
|
|
1158
|
+
? verificationUnverified("rest", "仅证明数据规则配置已保存;checkType 5 是服务端重复校验,在 REST data.submit 路径执行,但本次未提交数据取证。", { command: `omc call datarule.list --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, dataRuleType: 1 })}'` })
|
|
1159
|
+
: effectiveCheckType !== undefined
|
|
1160
|
+
? verificationConfigOnly("portal", "仅证明数据规则配置已保存(datarule.list 回读一致),未证明 REST data.submit 执行该校验——type1 非 checkType 5 在门户前端提交管线执行,REST 实测放行违规值。", {
|
|
1161
|
+
command: `omc call datarule.list --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, dataRuleType: 1 })}'`,
|
|
1162
|
+
manual: "门户表单提交一次违规数据,核对校验是否拦截(REST data.submit 不执行该校验)",
|
|
1163
|
+
})
|
|
1164
|
+
: verificationUnverified("none", "仅证明数据规则配置已保存;生效 checkType 不可得,执行面未知(REST/门户均未取证)。"),
|
|
1144
1165
|
executionWarning: dataRuleExecutionWarning(effectiveCheckType),
|
|
1145
1166
|
};
|
|
1146
1167
|
})()
|
|
@@ -255,7 +255,7 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
|
|
|
255
255
|
wire: Object.freeze({
|
|
256
256
|
acceptedFamilies: FIELD_FAMILY_LIST,
|
|
257
257
|
blockedFamilies: "OCR, ELECTRONIC_SIGN, nested CHILD_TABLE",
|
|
258
|
-
childTableSubSchema: '{"code":"<父字段 code>","properties":[{"code","name","schemaCode":"<父字段 code>","propertyType","propertyEmpty","sortKey"}]}',
|
|
258
|
+
childTableSubSchema: '{"code":"<父字段 code>","properties":[{"code","name","schemaCode":"<父字段 code>","propertyType","propertyEmpty","sortKey"}]}(这是写面形状;field.list full:true 回的是平台未装配壳,code/name/published 可能为空,不是子表不存在——父字段 code 即子 schema code)',
|
|
259
259
|
childTableFormControl: "Sheet(201) with columns[{type,width,key,parentKey,options}]; child column keys never enter viewJson",
|
|
260
260
|
dateDefaultOptions: JSON.stringify(FIELD_DATE_DEFAULT_OPTIONS),
|
|
261
261
|
dateFormat: JSON.stringify({
|
package/dist/lanes/field.js
CHANGED
|
@@ -5,6 +5,7 @@ import { aggregationSelfSchemaMessage, aggregationTargetsOwnSchema, choicesArg,
|
|
|
5
5
|
import { capabilityArg, environmentArg } from "../args.js";
|
|
6
6
|
import { governedRead } from "../read.js";
|
|
7
7
|
import { writeTool } from "../write.js";
|
|
8
|
+
import { verificationConfigOnly } from "../verification.js";
|
|
8
9
|
import { decodeJsonColumn, decodeJsonObjectColumn, JSON_COLUMN_NULL_COALESCE, JSON_COLUMN_PASSTHROUGH } from "../json-column.js";
|
|
9
10
|
import { syncFormConditionDataRules } from "./datarule.js";
|
|
10
11
|
import { FORM_CONDITION_OPTION_KEYS } from "./datarule-protocol.js";
|
|
@@ -386,6 +387,76 @@ function parseFieldOptionsForReadback(options) {
|
|
|
386
387
|
return decoded;
|
|
387
388
|
}
|
|
388
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* F1/F2(探针 Y,0.8.34):全文面(`full:true`)的子表 `subSchema` 是平台原始载荷。
|
|
392
|
+
* 2.1.5 `BizPropertyController.java:440` / `BizPropertyVO.java:19-20` /
|
|
393
|
+
* `BizPropertyModel.java:105,779` 把 `options` 当 String 存,子列 `options` 因此
|
|
394
|
+
* 是 JSON 字符串(`mappings` 也是串);读面复用顶层字段的解码,原文留在
|
|
395
|
+
* `optionsRaw`(与 `mappingsRaw` 同款)。壳检测只看 code:2.1.5 的 list 只
|
|
396
|
+
* `setVoproperties`(`BizPropertyController.java:453,458`),真机 code/name/
|
|
397
|
+
* published/parentSchema 全空——此时补 `subSchemaCode`/`subSchemaShell`/note,
|
|
398
|
+
* 但不改原载荷。
|
|
399
|
+
*/
|
|
400
|
+
function decodeSubSchemaForReadback(subSchema) {
|
|
401
|
+
let parsed = subSchema;
|
|
402
|
+
if (typeof parsed === "string") {
|
|
403
|
+
try {
|
|
404
|
+
parsed = JSON.parse(parsed);
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
return { subSchema, shell: false };
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
411
|
+
return { subSchema: parsed, shell: false };
|
|
412
|
+
const record = parsed;
|
|
413
|
+
const rawProperties = record.properties;
|
|
414
|
+
let changed = false;
|
|
415
|
+
const properties = Array.isArray(rawProperties)
|
|
416
|
+
? rawProperties.map((child) => {
|
|
417
|
+
if (child === null || typeof child !== "object" || Array.isArray(child))
|
|
418
|
+
return child;
|
|
419
|
+
const row = child;
|
|
420
|
+
if (row.options === undefined || row.options === null)
|
|
421
|
+
return child;
|
|
422
|
+
const decoded = parseFieldOptionsForReadback(row.options);
|
|
423
|
+
const optionsRaw = typeof row.options === "string" ? row.options : undefined;
|
|
424
|
+
// 非 JSON 串按 passthrough 保留原值;`optionsRaw` 仍记录平台原文
|
|
425
|
+
// (GPT 复审 2026-12-02:不能因为解不开就丢掉「原文是什么」)。
|
|
426
|
+
if (decoded === row.options && optionsRaw === undefined)
|
|
427
|
+
return child;
|
|
428
|
+
changed = true;
|
|
429
|
+
return { ...row, options: decoded, ...(optionsRaw !== undefined ? { optionsRaw } : {}) };
|
|
430
|
+
})
|
|
431
|
+
: rawProperties;
|
|
432
|
+
return {
|
|
433
|
+
subSchema: changed ? { ...record, properties } : record,
|
|
434
|
+
shell: String(record.code ?? "").trim() === "",
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* F4(探针 Y,0.8.34):字段行 published:true 但选项级 `published:false`。
|
|
439
|
+
* `field-families` 生成 custom 选项时固定 `published:false`(8.1 兼容形态),
|
|
440
|
+
* 字段/表单发布不会重写这个标记;运行时 REST 按 code/value 接受。门户 UI 是否
|
|
441
|
+
* 使用该标记未验证——只给读数与边界,不断言门户也忽略。
|
|
442
|
+
*/
|
|
443
|
+
function hasUnpublishedCustomOptions(options) {
|
|
444
|
+
if (options === null || typeof options !== "object" || Array.isArray(options))
|
|
445
|
+
return false;
|
|
446
|
+
let optionsSet = options.optionsSet;
|
|
447
|
+
if (typeof optionsSet === "string") {
|
|
448
|
+
try {
|
|
449
|
+
optionsSet = JSON.parse(optionsSet);
|
|
450
|
+
}
|
|
451
|
+
catch {
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (optionsSet === null || typeof optionsSet !== "object" || Array.isArray(optionsSet))
|
|
456
|
+
return false;
|
|
457
|
+
const custom = optionsSet.custom;
|
|
458
|
+
return Array.isArray(custom) && custom.some((entry) => entry !== null && typeof entry === "object" && entry.published === false);
|
|
459
|
+
}
|
|
389
460
|
/**
|
|
390
461
|
* 探针 D F9(0.8.9):字段行 `options.mappings` 存在 = 关联填充配置。
|
|
391
462
|
* 平台存储形态是 options.mappings 的 **JSON 字符串**(`WorkSheetPropertyMapping[]`,
|
|
@@ -417,6 +488,10 @@ function hasRelationMappings(options) {
|
|
|
417
488
|
* 因此「配置对不对」看 options.mappings,「值会不会回填」看写入面走哪条路。
|
|
418
489
|
*/
|
|
419
490
|
const FIELD_MAPPING_RUNTIME_NOTE = "映射只在门户选值时回填:CLI data.save(/api/runtime/form/save)不跑 options.mappings,快照列需调用方自填;配置正确性以字段行 options.mappings 为准。";
|
|
491
|
+
/** 统一验收等级(0.8.33):关联映射的旧说明(mappingRuntimeNote)原样保留,这里给结构投影。 */
|
|
492
|
+
function fieldMappingVerification(schemaCode, code) {
|
|
493
|
+
return verificationConfigOnly("portal", "仅证明字段映射配置已保存(字段行 options.mappings 读回一致),未证明 REST 写会回填——data.save(/api/runtime/form/save)不跑 options.mappings,快照列需调用方自填。", { command: `omc call field.get --env <env> --args '${JSON.stringify({ schemaCode, code })}'` });
|
|
494
|
+
}
|
|
420
495
|
/**
|
|
421
496
|
* `name_i18n` is a JSON locale map. When every locale value equals the display
|
|
422
497
|
* `name` there is no translation to convey, so echoing the map on every field of
|
|
@@ -712,7 +787,19 @@ export function registerFieldLane(tools) {
|
|
|
712
787
|
// 37.6 KB for a 5-code answer).
|
|
713
788
|
...(row.subSchema !== undefined && row.subSchema !== null
|
|
714
789
|
? args.full === true
|
|
715
|
-
?
|
|
790
|
+
? (() => {
|
|
791
|
+
const decoded = decodeSubSchemaForReadback(row.subSchema);
|
|
792
|
+
return {
|
|
793
|
+
subSchema: decoded.subSchema,
|
|
794
|
+
...(decoded.shell
|
|
795
|
+
? {
|
|
796
|
+
subSchemaCode: String(fieldCode),
|
|
797
|
+
subSchemaShell: true,
|
|
798
|
+
subSchemaNote: "平台 2.1.5 的 bizproperty/list 只装配父 CHILD_TABLE 行的 subSchema 壳(code/name/published/parentSchema 为空/缺省),不是「子表不存在」:子表 schema code = 本父字段 code;发布态看父字段行 published 与子列行(schemaCode=该 code 的 field.list)。",
|
|
799
|
+
}
|
|
800
|
+
: {}),
|
|
801
|
+
};
|
|
802
|
+
})()
|
|
716
803
|
: (() => {
|
|
717
804
|
const subColumns = childColumnsOf(row.subSchema);
|
|
718
805
|
const businessColumns = subColumns.filter((column) => column.system !== true).length;
|
|
@@ -756,6 +843,14 @@ export function registerFieldLane(tools) {
|
|
|
756
843
|
const mappingRuntimeNote = detailed && visible.some((field) => hasRelationMappings(field.options))
|
|
757
844
|
? FIELD_MAPPING_RUNTIME_NOTE
|
|
758
845
|
: undefined;
|
|
846
|
+
// F4(探针 Y):只在实际把 options 送到调用方的详情面给读数——默认清单面
|
|
847
|
+
// 不带 options,在那里报告会变成「凭一次没读到的详情下结论」。
|
|
848
|
+
const optionPublishedFalseFields = detailed
|
|
849
|
+
? visible
|
|
850
|
+
.filter((field) => field.published === true && hasUnpublishedCustomOptions(field.options))
|
|
851
|
+
.map((field) => String(field.code))
|
|
852
|
+
.filter((code) => code !== "")
|
|
853
|
+
: [];
|
|
759
854
|
const projected = detailed
|
|
760
855
|
? visible
|
|
761
856
|
: visible.map((field) => {
|
|
@@ -828,6 +923,17 @@ export function registerFieldLane(tools) {
|
|
|
828
923
|
...(selector.length > 0 ? { selected: selector } : {}),
|
|
829
924
|
...(args.all !== true ? { businessOnly: true } : {}),
|
|
830
925
|
...(mappingRuntimeNote !== undefined ? { mappingRuntimeNote } : {}),
|
|
926
|
+
...(optionPublishedFalseFields.length > 0
|
|
927
|
+
? {
|
|
928
|
+
optionPublishedFalseFields,
|
|
929
|
+
optionPublishedNote: "这些字段行 published:true,但 custom 选项带 published:false:字段/表单发布不重写选项级标记;2.1.5 REST 按 code/value 接受该选项(运行期 data.save/data.load 可用);字段是否生效看行级 published。门户 UI 是否使用该选项标记未验证——不要据此断言门户会/不会显示。",
|
|
930
|
+
}
|
|
931
|
+
: {}),
|
|
932
|
+
...(mappingRuntimeNote !== undefined
|
|
933
|
+
? {
|
|
934
|
+
verification: verificationConfigOnly("portal", "仅证明字段映射配置已读回(字段行 options.mappings),未证明 REST 写会回填——data.save(/api/runtime/form/save)不跑 options.mappings,快照列需调用方自填。", { manual: "门户表单选择关联值,核对映射是否回填;REST data.save 不跑 options.mappings" }),
|
|
935
|
+
}
|
|
936
|
+
: {}),
|
|
831
937
|
fields: projected,
|
|
832
938
|
// 券商 issue 1.4(2026-10-27):默认面空清单曾被误读成「模型没有字段」。
|
|
833
939
|
// 空清单要自己解释三种可能,别让 agent 二次试错;发布面(published:true)
|
|
@@ -868,6 +974,19 @@ export function registerFieldLane(tools) {
|
|
|
868
974
|
if (args.full === true && Array.isArray(result.fields)
|
|
869
975
|
&& result.fields.some((field) => field.options !== undefined))
|
|
870
976
|
return result;
|
|
977
|
+
// 0.8.33 回归(w34):`verification`(映射运行期说明)把映射模型的原生
|
|
978
|
+
// 结果从 <2048B 推过 diet 门,本 compact 于是**第一次真正生效**——但它只
|
|
979
|
+
// 放行 `inventory` / `full`,把 `code` / `fields` 选择器当清单投影,
|
|
980
|
+
// `options` 被剥成 `optionsPresent`。回执自己的 hint 却在教「字段详情用
|
|
981
|
+
// code/fields 选择器」,调用方照做后读不到 `options.mappings`
|
|
982
|
+
// (`field-relation-mapping-sources` A1 直接红)。
|
|
983
|
+
// 选择器是**显式详情请求**,与 full 同级:原样返回,体积由 read 层的
|
|
984
|
+
// 外置兜底。不要改成「字节/行数阈值」——那会让无关字段的增长再次悄悄
|
|
985
|
+
// 触发同一回归。
|
|
986
|
+
const selectorRequested = (typeof args.code === "string" && args.code.length > 0 && !isRequiredAlternativePlaceholder(args.code))
|
|
987
|
+
|| (Array.isArray(args.fields) && args.fields.length > 0);
|
|
988
|
+
if (selectorRequested)
|
|
989
|
+
return result;
|
|
871
990
|
const fields = Array.isArray(result.fields) ? result.fields : [];
|
|
872
991
|
return {
|
|
873
992
|
schemaCode: result.schemaCode,
|
|
@@ -1051,6 +1170,10 @@ export function registerFieldLane(tools) {
|
|
|
1051
1170
|
// 探针 P F5(0.8.22):写回执回显**生效值**(scale/format/mappings 等只在
|
|
1052
1171
|
// options 里的语义),省掉一次 field.get 才能核对单位/精度/映射方向。
|
|
1053
1172
|
...(createdOptions !== undefined ? { options: createdOptions } : {}),
|
|
1173
|
+
// 统一验收等级(0.8.33):关联映射配置等价 ≠ REST 写回填。
|
|
1174
|
+
...(hasRelationMappings(createdOptions) || hasRelationMappings(prepared.options)
|
|
1175
|
+
? { verification: fieldMappingVerification(args.schemaCode, args.code) }
|
|
1176
|
+
: {}),
|
|
1054
1177
|
...(prepared.normalized ? { normalized: prepared.normalized } : {}),
|
|
1055
1178
|
...(textLike
|
|
1056
1179
|
? {
|
|
@@ -1986,6 +2109,10 @@ async function runFieldUpdate(session, args) {
|
|
|
1986
2109
|
}
|
|
1987
2110
|
: {}),
|
|
1988
2111
|
...(storedOptions !== undefined && storedOptions !== null ? { options: storedOptions } : {}),
|
|
2112
|
+
// 统一验收等级(0.8.33):关联映射配置等价 ≠ REST 写回填。
|
|
2113
|
+
...(hasRelationMappings(storedOptions) || hasRelationMappings(prepared.options)
|
|
2114
|
+
? { verification: fieldMappingVerification(args.schemaCode, args.code) }
|
|
2115
|
+
: {}),
|
|
1989
2116
|
...(dictionarySynced !== undefined ? { dictionarySynced } : {}),
|
|
1990
2117
|
...(formConditionSync !== undefined ? { formConditionSync } : {}),
|
|
1991
2118
|
...(formConditionSyncError !== undefined ? { formConditionSync: { error: formConditionSyncError } } : {}),
|
|
@@ -2,6 +2,7 @@ export { QUERY_ACTION_TYPE, QUERY_ACTION_RELATIVE, validateButtonActionConfig }
|
|
|
2
2
|
import { QUERY_ACTION_TYPE, QUERY_ACTION_RELATIVE, validateButtonActionConfig, wireEnum } from "omc-core/list-view-wire";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { ToolRefusalError } from "../tool-types.js";
|
|
5
|
+
import { normalizeConceptValue } from "../arg-vocabulary.js";
|
|
5
6
|
import { decodeJsonColumn, encodeJsonColumn, JSON_COLUMN_NULL_COALESCE } from "../json-column.js";
|
|
6
7
|
import { FIELD_PROPERTY_TYPES } from "../field-families.js";
|
|
7
8
|
/**
|
|
@@ -135,7 +136,13 @@ export const QUERY_PRESENTATION_TYPE = {
|
|
|
135
136
|
* ModelManagementFacadeImpl.resolveRelations and overwrites any input.
|
|
136
137
|
*/
|
|
137
138
|
export const PRESENTATION_FIELDS = ["htmlJson", "actionsJson", "columnsJson", "queryViewDataSource", "schemaRelations", "options"];
|
|
138
|
-
|
|
139
|
+
// 值归一:合法值是 ASC|DESC(SortDirectionType 数字 1/2),调用方按别的面习惯
|
|
140
|
+
// 写 `desc`/`Desc`。归一表在 arg-vocabulary(`listview.sort.direction`:asc/desc
|
|
141
|
+
// + 大小写折叠),这里只做 zod 层 preprocess——枚举本身不放宽,拒绝文案仍列
|
|
142
|
+
// ASC|DESC(zod 的 invalid_enum_value 带 options,见 tool-types 的中文渲染)。
|
|
143
|
+
export const directionArg = z
|
|
144
|
+
.preprocess((value) => normalizeConceptValue("listview.sort.direction", value), z.enum(["ASC", "DESC"]))
|
|
145
|
+
.describe("SortDirectionType; sent numeric ASC(1)/DESC(2)");
|
|
139
146
|
export const displayTypeArg = z
|
|
140
147
|
.enum(["INPUT", "RADIO", "CHECKBOX", "SELECT", "RANGE"])
|
|
141
148
|
.describe("门户筛选控件(不是字段类型):文本→INPUT;数值/日期/时间→RANGE;单选/复选/下拉/下拉多选→SELECT(需要复选组时才显式 CHECKBOX)。默认按 8.6.34 前端 typeFormat;2.1.5 未采样,见 docs/platform-contracts/2.1-delta.md:313-319");
|
package/dist/lanes/list-view.js
CHANGED
|
@@ -4,9 +4,12 @@ import { ENDPOINTS } from "../endpoints.js";
|
|
|
4
4
|
import { capabilityArg, environmentArg } from "../args.js";
|
|
5
5
|
import { governedRead, compactReadback } from "../read.js";
|
|
6
6
|
import { writeTool } from "../write.js";
|
|
7
|
+
import { verificationConfigOnly, verificationUnverified } from "../verification.js";
|
|
7
8
|
import { encodeJsonColumn } from "../json-column.js";
|
|
8
9
|
import { defineTool, ToolInputError, ToolRefusalError } from "../tool-types.js";
|
|
9
10
|
import { wireCall, wireRows, WireError } from "../wire.js";
|
|
11
|
+
import { jsonBytes } from "../support.js";
|
|
12
|
+
import { READ_DIET_INLINE_BYTES } from "../read-projection.js";
|
|
10
13
|
import { QUERY_ACTION_TYPE } from "omc-core/list-view-wire";
|
|
11
14
|
import { resolveModelTreeNode } from "./model.js";
|
|
12
15
|
import { NUMERICAL_FORMAT_DECIMALS, SYSTEM_FIELD_CODES, canonicalNumericalFormat } from "../field-families.js";
|
|
@@ -39,6 +42,40 @@ const DATA_LIST_OP_BY_FILTER_TYPE = {
|
|
|
39
42
|
Between: "between",
|
|
40
43
|
NotBetween: "notbetween",
|
|
41
44
|
};
|
|
45
|
+
function columnDetail(column, sumType) {
|
|
46
|
+
return {
|
|
47
|
+
propertyCode: column.propertyCode,
|
|
48
|
+
...(column.propertyType !== undefined ? { propertyType: column.propertyType } : {}),
|
|
49
|
+
...(column.displayFormat !== undefined ? { displayFormat: column.displayFormat } : {}),
|
|
50
|
+
...(column.visible !== undefined ? { visible: column.visible } : {}),
|
|
51
|
+
sumType: sumType ?? null,
|
|
52
|
+
...(column.width !== undefined ? { width: column.width } : {}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* W36K(0.8.34):`columnsDetailed` 的「不让逃逸键自己改判 diet」规则。
|
|
57
|
+
*
|
|
58
|
+
* `columns` 在 `CODE_LIST_KEYS` 里,默认读面 >2048B 会被折成裸码表,丢
|
|
59
|
+
* displayFormat/visible/sumType/width——与 0.8.30 的 `sortsDetailed`/
|
|
60
|
+
* `conditionsDetailed` 同形,给一个不折叠的详细键。但列对象在内联档本来就在
|
|
61
|
+
* `columns` 里,无条件加一份详情会把临界视图(实测:5 列视图 1638B、按钮读
|
|
62
|
+
* 1824B)推过 `READ_DIET_INLINE_BYTES`,把 `buttons`/`conditions` 一起折掉,
|
|
63
|
+
* 反而丢按钮脚本等正文。所以:
|
|
64
|
+
* - 带上后仍在预算内 → 内联面也带(小视图能直接看详情);
|
|
65
|
+
* - 结果本来就要外置 → 带上(折面唯一的详情来源);
|
|
66
|
+
* - 只有「加它才会翻成折面」→ 不带(内联 columns 已是完整列对象,零信息损失)。
|
|
67
|
+
* 阈值用 `read-projection.ts` 的共享常量,不另立第二真相源。listview.get 的结果
|
|
68
|
+
* 里没有 items/logs/triggers,`smallRowSet` 恒 false,故这里的字节判据与
|
|
69
|
+
* `decideReadExternalization` 一致。
|
|
70
|
+
*/
|
|
71
|
+
function withColumnsDetailedOr(result, columnsDetailed) {
|
|
72
|
+
if (columnsDetailed.length === 0)
|
|
73
|
+
return result;
|
|
74
|
+
if (jsonBytes(result) > READ_DIET_INLINE_BYTES)
|
|
75
|
+
return { ...result, columnsDetailed };
|
|
76
|
+
const withDetailed = { ...result, columnsDetailed };
|
|
77
|
+
return jsonBytes(withDetailed) <= READ_DIET_INLINE_BYTES ? withDetailed : result;
|
|
78
|
+
}
|
|
42
79
|
/**
|
|
43
80
|
* r62a-F5 / r61 a-F14:列汇总(sumType)真值在呈现层 queryPresentation.columnsJson
|
|
44
81
|
* ——queryColumns 列树不回它。listview.get 与 listview.configure 的读回共用这个
|
|
@@ -550,6 +587,11 @@ export function registerListViewLane(tools) {
|
|
|
550
587
|
visible: column.visible,
|
|
551
588
|
sumType: sumTypeByCode.get(String(column.propertyCode)) ?? column.sumType ?? null,
|
|
552
589
|
}));
|
|
590
|
+
// 0.8.34(W36K):列面也补 detailed 逃逸键。`columns` 在 CODE_LIST_KEYS 里,
|
|
591
|
+
// 默认读面 >2048B 会被折成裸码表,displayFormat/visible/sumType/width 全丢;
|
|
592
|
+
// 与 0.8.30 的 sortsDetailed/conditionsDetailed 同形。无值的键省略(undefined),
|
|
593
|
+
// `sumType` 保留 null(= 不汇总,是真值不是缺席);`options` 一律不内联。
|
|
594
|
+
const columnsDetailed = readArray(model, "queryColumns").map((column) => columnDetail(column, sumTypeByCode.get(String(column.propertyCode)) ?? column.sumType));
|
|
553
595
|
// Direction is decoded to the enum NAME (ASC/DESC) — the same shape
|
|
554
596
|
// `listview.configure` reads back, so a get→configure round-trip does not
|
|
555
597
|
// surprise the caller with a raw numeric index (dogfood R2 round17b).
|
|
@@ -577,7 +619,7 @@ export function registerListViewLane(tools) {
|
|
|
577
619
|
const queryLayer = Array.isArray(model.queryLayer) && model.queryLayer.length > 0
|
|
578
620
|
? queryLayerSummary(model.queryLayer)
|
|
579
621
|
: undefined;
|
|
580
|
-
return {
|
|
622
|
+
return withColumnsDetailedOr({
|
|
581
623
|
schemaCode: args.schemaCode,
|
|
582
624
|
code,
|
|
583
625
|
present: true,
|
|
@@ -655,20 +697,30 @@ export function registerListViewLane(tools) {
|
|
|
655
697
|
// lifecycle; this column is a design-time placeholder. The view is
|
|
656
698
|
// live as soon as it is saved. Say so, so the flag is not misread.
|
|
657
699
|
hint: "published 是设计态占位(列表视图无草稿/发布生命周期),false 不代表视图未生效;列/排序/条件/动作/按钮是否落成以 columns/sorts/conditionCount/actionCodes 与 field.list 为准。完整报文加 full:true。NUMERICAL 列的 displayFormat 是平台数值格式枚举(decimal scale2→3、currency→7、percent→6…),不是字段 scale;列的小数位以字段 options.scale 为准(用 field.list 读回)",
|
|
658
|
-
};
|
|
700
|
+
}, columnsDetailed);
|
|
659
701
|
}, {
|
|
660
702
|
compact: (result) => {
|
|
661
703
|
const base = compactReadback(result);
|
|
662
704
|
const detailedSorts = (result.sortsDetailed ?? result.sorts ?? []);
|
|
663
705
|
const detailedConditions = (result.conditionsDetailed ?? result.conditions ?? []);
|
|
706
|
+
const detailedColumns = (Array.isArray(result.columnsDetailed)
|
|
707
|
+
? result.columnsDetailed
|
|
708
|
+
: Array.isArray(result.columns)
|
|
709
|
+
// 极端路径兜底(例如重试后字节跨过 diet 门槛而在 handler 侧被省掉):
|
|
710
|
+
// 直接由内联 columns 对象重建;此时没有 width(columns 投影不带它)。
|
|
711
|
+
? result.columns.map((column) => columnDetail(column, column.sumType))
|
|
712
|
+
: []);
|
|
664
713
|
// 空 detailed 不能留下 compactReadback 的 {count:0,sha256,omitted:true} 占位。
|
|
665
714
|
if (detailedSorts.length === 0)
|
|
666
715
|
delete base.sortsDetailed;
|
|
667
716
|
if (detailedConditions.length === 0)
|
|
668
717
|
delete base.conditionsDetailed;
|
|
718
|
+
if (detailedColumns.length === 0)
|
|
719
|
+
delete base.columnsDetailed;
|
|
669
720
|
const codeOf = (entry) => typeof entry === "string" ? entry : entry && typeof entry === "object" ? String(entry.propertyCode ?? "") : "";
|
|
670
721
|
return {
|
|
671
722
|
...base,
|
|
723
|
+
...(detailedColumns.length > 0 ? { columnsDetailed: detailedColumns } : {}),
|
|
672
724
|
...(detailedSorts.length > 0
|
|
673
725
|
? { sorts: detailedSorts.map(codeOf).filter(Boolean), sortsDetailed: detailedSorts }
|
|
674
726
|
: {}),
|
|
@@ -1514,6 +1566,16 @@ export function registerListViewLane(tools) {
|
|
|
1514
1566
|
message: "平台 delete-on-omit:请求未带 queryDataRangeRestriction(或平台改写)会把既有数据范围限制删掉/改形且返回成功(ModelManagementFacadeImpl.java:2159-2161,242-243)。写已发生,本字段是状态而非失败;用 listview.get --full 复核并到设计器重建数据范围限制。",
|
|
1515
1567
|
};
|
|
1516
1568
|
}
|
|
1569
|
+
// 统一验收等级(0.8.33):旧键(acceptance/conditionRuntimeNote/
|
|
1570
|
+
// viewConditionsAppliedRest/conditionVerification)原样保留,这里只补
|
|
1571
|
+
// 一层统一投影——固定条件只在门户运行面生效,REST data.list --queryCode
|
|
1572
|
+
// 不应用;无固定条件时也没有任何运行面证据,不冒充 verified。
|
|
1573
|
+
readback.verification = conditions.length > 0
|
|
1574
|
+
? verificationConfigOnly("portal", "仅证明视图配置已保存(listview.get 回读 conditions 等价),未证明 REST data.list 应用固定条件——平台无 REST 运行面验证入口,门户点验为准。", {
|
|
1575
|
+
command: `omc call listview.get --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, code })}'`,
|
|
1576
|
+
manual: `门户打开视图 ${code}(模型 ${args.schemaCode}),按固定条件筛选一次并核对返回行`,
|
|
1577
|
+
})
|
|
1578
|
+
: verificationUnverified("rest", "仅证明视图配置已保存并读回;本工具没有调用 data.list 取证运行面(列/排序在 REST 读面是否生效未验证)。", { command: `omc call data.list --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, queryCode: code, size: 1 })}'` });
|
|
1517
1579
|
return { performed: { errcode: performed.errcode }, readback };
|
|
1518
1580
|
},
|
|
1519
1581
|
preflight: assertListViewConfigureShape,
|