@stalfh233/omc-cli 0.8.4 → 0.8.5

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.
@@ -93,6 +93,46 @@ function pendingOwnFieldRows(pending) {
93
93
  return field.code ? [{ code: field.code, ...(type !== undefined ? { type } : {}) }] : [];
94
94
  });
95
95
  }
96
+ /**
97
+ * 平台「**模型不存在**」的 errcode 白名单——只有这一类允许把本模型发布面读成
98
+ * 空读面。白名单之外的任何失败(50000 / 权限 / 超时 / 404 端点缺席)都必须原样
99
+ * 抛出去:吞掉它们等于「无证据不判」,会把写前门变成逃生口。
100
+ *
101
+ * 证据(双版本 ErrorCode 枚举逐字一致):
102
+ * - 8.6.26 `backend/decompiled-full/launcher-8.6.26/cloudpivot-shared-8.6.26/
103
+ * com/authine/cloudpivot/engine/ErrorCode.java:183`
104
+ * `BIZ_SCHEMA_MODEL_NOT_EXIST(300004L, "数据模型不存在!")`
105
+ * - 2.1.5 `backend/decompiled-full/launcher-2.1.5/cloudpivot-contracts-AI-Platform-v2.1.5/
106
+ * com/authine/cloudpivot/engine/ErrorCode.java:199` 同值
107
+ * - 抛点:`BizPropertyController.getPropertyList`(2.1.5 `cloudpivot-engine-AI-Platform-v2.1.5/
108
+ * .../app/BizPropertyController.java:232`,方法体 :225;8.6.26 同文件:346,方法体 :339)
109
+ * —— `getBizSchemaBySchemaCode` 回 null(schema 不存在)即抛该码。
110
+ *
111
+ * **300010 刻意不在白名单**:同枚举里它是 `BIZ_SCHEMA_CODE_EMPTY`
112
+ * 「数据模型编码不能为空!」(8.6.26:188 / 2.1.5:204),语义是「入参 schemaCode
113
+ * 为空」,不是「模型不存在」;吞它会掩盖入参错误。HTTP 404 属网关/端点缺席
114
+ * (wire.ts 的 http-status 家族),也不是同一类。
115
+ */
116
+ const MODEL_ABSENT_ERRCODES = new Set([300004]);
117
+ /**
118
+ * 本模型发布面读:模型不存在(300004)时退化为**空读面**,与
119
+ * `assertRelationOptionsFields` 内 `rowsOf` 的 `.catch(() => [])` 同口径。
120
+ *
121
+ * 0.8.5 P0 回归:`configure_model` 新建模型时本读面必然 300004,0.8.4 让它无兜底
122
+ * 抛上来,整条新建路径 100% 不可用(2.1.5 真机)。空读面 + `pendingOwnFields`
123
+ * overlay 仍参与判定(overlay 就是本模型字段面);没有 overlay 时由下游沿用
124
+ * 既有「空读面不判」的保守规则。
125
+ */
126
+ async function readPublishedFieldFace(session, schemaCode) {
127
+ try {
128
+ return wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode, isPublish: "true" } })).data);
129
+ }
130
+ catch (error) {
131
+ if (error instanceof WireError && error.kind === "business" && error.errcode !== undefined && MODEL_ABSENT_ERRCODES.has(error.errcode))
132
+ return [];
133
+ throw error;
134
+ }
135
+ }
96
136
  /** Semantic relation gate: the designer only offers published business fields. */
97
137
  async function assertRelationOptionsFields(session, schemaCode, propertyType, relativeCode, options, pendingOwnFields = []) {
98
138
  const type = typeof propertyType === "number" ? propertyType : FIELD_PROPERTY_TYPES[String(propertyType ?? "")];
@@ -510,7 +550,7 @@ async function assertNoChildSchemaAggregation(session, schemaCode, propertyType,
510
550
  */
511
551
  export async function lintFieldCreateWrite(session, input, options = {}) {
512
552
  const published = options.publishedRows
513
- ?? wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: input.schemaCode, isPublish: "true" } })).data);
553
+ ?? await readPublishedFieldFace(session, input.schemaCode);
514
554
  const pendingOwnFields = options.pendingOwnFields ?? [];
515
555
  assertNoSelfSchemaAggregation({ schemaCode: input.schemaCode, propertyType: input.propertyType, options: input.options }, published, pendingOwnFields);
516
556
  await assertNoChildSchemaAggregation(session, input.schemaCode, input.propertyType, input.options ?? {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
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.4",
61
+ "omc-core": "0.8.5",
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.4"
79
+ "@stalfh233/omc-fake-platform": "0.8.5"
80
80
  }
81
81
  }