@stalfh233/omc-fake-platform 0.6.88 → 0.6.89
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/runtime-data.js +75 -0
- package/package.json +2 -2
package/dist/runtime-data.js
CHANGED
|
@@ -132,6 +132,75 @@ export const runtimeDataRoute = (ctx, input) => {
|
|
|
132
132
|
}
|
|
133
133
|
return result;
|
|
134
134
|
}
|
|
135
|
+
case "/api/api/runtime/form/list_child": {
|
|
136
|
+
// FormRuntimeController.list_child
|
|
137
|
+
// (cloudpivot-engine-8.6.26/.../runtime/FormRuntimeController.java:1901-1928)
|
|
138
|
+
// → BizObjectFacadeImpl.queryChildBizObjects
|
|
139
|
+
// (cloudpivot-bizdata-8.6.26/.../bizobject/BizObjectFacadeImpl.java:7594-7639).
|
|
140
|
+
// 主记录不存在 → BIZ_OBJECT_NOT_EXIST 304001「子表对应的主表数据不存在」
|
|
141
|
+
// (controller 在 getBizObjectWithoutChild 之后判 null/空 data)。
|
|
142
|
+
const childSchemaCode = String(body.childSchemaCode ?? "");
|
|
143
|
+
const listChildSchemaCode = String(body.schemaCode ?? "");
|
|
144
|
+
const bizObjectId = String(body.bizObjectId ?? "");
|
|
145
|
+
if (!listChildSchemaCode)
|
|
146
|
+
return businessRefusal(10005, "主模型编码不能为空");
|
|
147
|
+
if (!childSchemaCode)
|
|
148
|
+
return businessRefusal(10005, "子表模型编码不能为空");
|
|
149
|
+
if (!bizObjectId)
|
|
150
|
+
return businessRefusal(10005, "主模型对象id不能为空");
|
|
151
|
+
const parentRow = ctx.state.dataRows.get(bizObjectId);
|
|
152
|
+
// getBizObjectWithoutChild(schemaCode, id):按主模型+id 取行;取不到或 data 空即缺席。
|
|
153
|
+
if (!parentRow || parentRow.schemaCode !== listChildSchemaCode)
|
|
154
|
+
return businessRefusal(304001, "子表对应的主表数据不存在");
|
|
155
|
+
// getBizPropertyList(childSchemaCode, published=true);空清单 →
|
|
156
|
+
// BIZ_QUERY_DISPLAY_COLUMNS_NOT_EMPTY 303026(Facade:7597-7601)。
|
|
157
|
+
const childFieldCodes = [...ctx.state.fields.entries()]
|
|
158
|
+
.filter(([key, field]) => key.startsWith(`${childSchemaCode}#`) && field.published !== false)
|
|
159
|
+
.map(([, field]) => field.code);
|
|
160
|
+
if (childFieldCodes.length === 0)
|
|
161
|
+
return businessRefusal(303026, "列表显示字段不能为空!");
|
|
162
|
+
// 过滤:QueryDataVO.filters 是扁平 List<FilterModel>;queryVersion 不传且 filters
|
|
163
|
+
// 非空时平台把它们包成一个 AND 组(getFiltersByQueryParam:6584-6590)。
|
|
164
|
+
// fake 只实现 Eq(测试够用):其它算子/未知属性/空值按平台的
|
|
165
|
+
// filterQueryCondition:6543-6575 语义移除,不施加约束、行为确定。
|
|
166
|
+
const filterable = new Set([...childFieldCodes, ...DEFAULT_SUB_PROPERTY_CODES]);
|
|
167
|
+
const filters = (Array.isArray(body.filters) ? body.filters : []).filter((filter) => {
|
|
168
|
+
const code = String(filter?.propertyCode ?? "");
|
|
169
|
+
const op = String(filter?.queryFilterType ?? "");
|
|
170
|
+
const value = filter?.propertyValue;
|
|
171
|
+
return filterable.has(code) && op === "Eq" && value !== undefined && String(value) !== "";
|
|
172
|
+
});
|
|
173
|
+
const rows = [...ctx.state.dataRows.values()].filter((row) => row.schemaCode === childSchemaCode && String(row.parentId ?? "") === bizObjectId);
|
|
174
|
+
const filtered = filters.length === 0
|
|
175
|
+
? rows
|
|
176
|
+
: rows.filter((row) => filters.every((filter) => String(row[String(filter.propertyCode)] ?? "") === String(filter.propertyValue)));
|
|
177
|
+
// 排序固定 sortKey ASC(Facade:7636 SortableImpl(new OrderImpl(SORT_KEY, ASC)))。
|
|
178
|
+
const ordered = [...filtered].sort((left, right) => compareOrderValues(left.sortKey, right.sortKey));
|
|
179
|
+
const page = typeof body.page === "number" ? body.page : 0;
|
|
180
|
+
// QueryDataVO.getSize():size 空/0 → Integer.MAX_VALUE(QueryDataVO.java:186-191)。
|
|
181
|
+
const requestedSize = typeof body.size === "number" ? body.size : 0;
|
|
182
|
+
const size = requestedSize === 0 ? 2147483647 : requestedSize;
|
|
183
|
+
const content = ordered.slice(page * size, page * size + size);
|
|
184
|
+
// handleChildQueryColumn(Facade:7641-7678)DEFAULT 分支:
|
|
185
|
+
// 默认子表列(DefaultSubPropertyType 全集)+ columns[].propertyCode ∩ 已发布属性;
|
|
186
|
+
// columns 为空 → 追加**全部**已发布属性;columns 非空但无一命中 → 只回默认列。
|
|
187
|
+
const requestedColumns = (Array.isArray(body.columns) ? body.columns : [])
|
|
188
|
+
.map((column) => String(column?.propertyCode ?? ""))
|
|
189
|
+
.filter((code) => childFieldCodes.includes(code));
|
|
190
|
+
const display = [...DEFAULT_SUB_PROPERTY_CODES];
|
|
191
|
+
if (!Array.isArray(body.columns) || body.columns.length === 0)
|
|
192
|
+
display.push(...childFieldCodes);
|
|
193
|
+
else
|
|
194
|
+
display.push(...requestedColumns);
|
|
195
|
+
const displaySet = [...new Set(display)];
|
|
196
|
+
return {
|
|
197
|
+
totalElements: filtered.length,
|
|
198
|
+
totalPages: Math.ceil(filtered.length / size),
|
|
199
|
+
page,
|
|
200
|
+
size,
|
|
201
|
+
content: content.map((row) => Object.fromEntries(displaySet.map((code) => [code, code === "id" ? (row.bizObjectId ?? row.id ?? null) : row[code] ?? null]))),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
135
204
|
case "/api/api/runtime/form/save": {
|
|
136
205
|
const bizObject = (body.bizObject ?? {});
|
|
137
206
|
const data = bizObject.data ?? {};
|
|
@@ -454,6 +523,12 @@ export const runtimeDataRoute = (ctx, input) => {
|
|
|
454
523
|
return NOT_HANDLED;
|
|
455
524
|
}
|
|
456
525
|
};
|
|
526
|
+
/**
|
|
527
|
+
* DefaultSubPropertyType 全集(cloudpivot-shared-8.6.26/.../metadata/bizmodel/
|
|
528
|
+
* DefaultSubPropertyType.java):list_child 的 handleChildQueryColumn DEFAULT 分支
|
|
529
|
+
* 无条件带上这些列,再追加 columns[].propertyCode。
|
|
530
|
+
*/
|
|
531
|
+
const DEFAULT_SUB_PROPERTY_CODES = ["id", "parentId", "sortKey", "modifier", "modifiedTime", "version"];
|
|
457
532
|
/**
|
|
458
533
|
* The submit face persists bizObject.data itself (submitBizSheet ->
|
|
459
534
|
* saveBizObject; SubmitDataChangeHandlerImpl.updateBizObject): the submitted
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-fake-platform",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.89",
|
|
4
4
|
"description": "OMC 的内存假 CloudPivot 平台(wire 接缝的第二个适配器)+ HTTP 假服务器——@stalfh233/omc-cli 的测试与 bench 基准基座",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"build": "tsc --project tsconfig.build.json"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"omc-core": "0.6.
|
|
21
|
+
"omc-core": "0.6.89"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=22.13"
|