@stalfh233/omc-fake-platform 0.6.52 → 0.6.54

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/model.js CHANGED
@@ -59,6 +59,18 @@ export const modelRoute = (ctx, input) => {
59
59
  else
60
60
  rootChildren.push(node);
61
61
  }
62
+ // r63 live fidelity (2026-11-14, h_app_function 实证):报表页镜像进应用树
63
+ // (type=Report 挂在 parentId 目录下);parentId 不指向任何目录的报表是
64
+ // **孤儿**——树里不可见(真机 create 传 appCode 当 parentId,平台原样存储,
65
+ // 两棵树都读不到)。queryReportChartTree 只回配了图的报表,与这棵树互补。
66
+ for (const page of ctx.state.reportPages.values()) {
67
+ if (appCode !== undefined && page.appCode !== appCode)
68
+ continue;
69
+ const parent = page.parentId ? nodes.get(page.parentId) : undefined;
70
+ if (!parent)
71
+ continue;
72
+ parent.children.push({ id: page.id, type: "Report", code: page.code, name: page.name, parentId: page.parentId });
73
+ }
62
74
  // Live 1.1.25 fidelity (2026-10-23, folder.tree readback): the tree
63
75
  // returns the TOP-LEVEL folders directly — no synthetic app-package
64
76
  // container row. The fake must match, or a depth-0 assertion would pass
package/dist/report.js CHANGED
@@ -226,10 +226,20 @@ export const reportRoute = (ctx, input) => {
226
226
  dashboard.charts = dashboard.charts.filter((chart) => !ids.has(String(chart.uuid)));
227
227
  return biData(true);
228
228
  }
229
- case "/dashboard/v1/report/v3/datasourcelist":
229
+ case "/dashboard/v1/report/v3/datasourcelist": {
230
+ // r63 live fidelity:datasourcelist 是层级树——不传 parentObjectIds 回
231
+ // 顶层(应用包容器 + 系统数据源);传了回该父下的**模型级**行
232
+ // (nodeType:1,objectId 是真键,dataSourceId 恒 null)。
233
+ const parents = Array.isArray(body.parentObjectIds) ? body.parentObjectIds.map(String) : [];
234
+ if (parents.length > 0)
235
+ return biData([
236
+ { dataSourceId: null, displayName: "合同", nodeType: 1, useType: 1, objectId: "bizmodel-1-contract", parentObjectId: parents[0], corpId: "a" },
237
+ { dataSourceId: null, displayName: "回款", nodeType: 1, useType: 1, objectId: "bizmodel-1-payment", parentObjectId: parents[0], corpId: "a" },
238
+ ]);
230
239
  return biData([
231
240
  { dataSourceId: "model-1", displayName: "人员信息", nodeType: 0, useType: 1, objectId: "model-1", corpId: "a" },
232
241
  ]);
242
+ }
233
243
  case "/dashboard/datasource/advanced_list":
234
244
  return biData([
235
245
  { dataSourceId: "sql-1", displayName: "自定义查询", nodeType: 100, useType: 100, objectId: "sql-1", corpId: "a", status: 0, sort: 0, dwTableSyncFlag: false },
@@ -242,7 +252,8 @@ export const reportRoute = (ctx, input) => {
242
252
  const infos = Array.isArray(body.dataSourceInfos) ? body.dataSourceInfos : [];
243
253
  // Live 2026-10-18 fidelity: the platform answers success but links
244
254
  // NOTHING for a datasource that has not synced into BI yet (unknown id).
245
- const synced = new Set(["model-1", "sql-1"]);
255
+ // r63: 模型行的 objectId 也是合法 link 键(真机 crm_contract 实证)。
256
+ const synced = new Set(["model-1", "sql-1", "bizmodel-1-contract", "bizmodel-1-payment"]);
246
257
  return biData(infos
247
258
  .filter((info) => synced.has(String(info.dataSourceId)))
248
259
  .map((info) => ({ nodeType: 1, displayName: String(info.dataSourceId), dataSourceId: info.dataSourceId, schema: { dataSourceId: info.dataSourceId, tableName: `t_${String(info.dataSourceId)}` } })));
package/dist/workflow.js CHANGED
@@ -424,6 +424,108 @@ export const workflowRoute = (ctx, input) => {
424
424
  const existed = ctx.state.workflowInstances.delete(id);
425
425
  return existed;
426
426
  }
427
+ // r64:运维三件套依赖的两个读回面(此前只有真机测试,fake 未建模)。
428
+ case "/api/api/runtime/workflow/list_workflow_instance_activity": {
429
+ // 从 workItems 派生活动清单:PENDING 待办所在节点 status=1(带参与人),
430
+ // 其余出现过的节点 status=0。真机语义见 workflow.instanceActivity 契约。
431
+ const instanceId = String(q.workflowInstanceId ?? "");
432
+ const items = [...ctx.state.workItems.values()].filter((item) => item.instanceId === instanceId);
433
+ if (items.length === 0 && !ctx.state.workflowInstances.has(instanceId))
434
+ return businessRefusal(402504, "流程实例状态不存在!");
435
+ const byCode = new Map();
436
+ for (const item of items) {
437
+ const active = PENDING_STATES.has(item.state);
438
+ const existing = byCode.get(item.activityCode);
439
+ if (!existing) {
440
+ byCode.set(item.activityCode, {
441
+ activityCode: item.activityCode,
442
+ activityName: item.activityName,
443
+ activityType: "PARTICIPANT",
444
+ participantors: active ? [{ name: item.participantName ?? item.participant, id: item.participant }] : null,
445
+ status: active ? 1 : 0,
446
+ });
447
+ }
448
+ else if (active) {
449
+ existing.status = 1;
450
+ existing.participantors = [{ name: item.participantName ?? item.participant, id: item.participant }];
451
+ }
452
+ }
453
+ return [...byCode.values()];
454
+ }
455
+ case "/api/api/runtime/workflow/get_instance_baseinfo": {
456
+ const instanceId = String(q.workflowInstanceId ?? "");
457
+ const instance = ctx.state.workflowInstances.get(instanceId);
458
+ if (!instance) {
459
+ // startWorkflowInstance(直起路径)只写 workItems 不建实例行——从待办
460
+ // 存在性合成基线状态,运维读回不 404。
461
+ const items = [...ctx.state.workItems.values()].filter((item) => item.instanceId === instanceId);
462
+ if (items.length === 0)
463
+ return businessRefusal(402504, "流程实例状态不存在!");
464
+ return { workflowInstanceId: instanceId, workflowName: items[0].workflowCode, status: "PROCESSING" };
465
+ }
466
+ return { workflowInstanceId: instanceId, workflowCode: instance.workflowCode, workflowName: instance.workflowCode, status: instance.status };
467
+ }
468
+ case "/api/api/runtime/workflow/workflow_operation": {
469
+ const instanceId = String(body.workflowInstanceId ?? "");
470
+ const instance = ctx.state.workflowInstances.get(instanceId);
471
+ if (!instance)
472
+ return businessRefusal(402504, "流程实例状态不存在!");
473
+ if (typeof body.approval !== "object" || body.approval === null || Array.isArray(body.approval))
474
+ return businessRefusal(10009, "类型转换异常(approval 必须是对象 {activityCode,commonSet,deleted,resources,content})");
475
+ const operationType = String(body.operationType ?? "");
476
+ if (operationType === "ADJUST_PARTICIPANT") {
477
+ const ids = Array.isArray(body.participantors) ? body.participantors.map(String) : [];
478
+ if (ids.length === 0)
479
+ return businessRefusal(40000, "participantors 为空");
480
+ let hit = false;
481
+ for (const item of ctx.state.workItems.values()) {
482
+ if (item.instanceId !== instanceId || !PENDING_STATES.has(item.state))
483
+ continue;
484
+ if (body.activityCode !== undefined && item.activityCode !== String(body.activityCode))
485
+ continue;
486
+ item.participant = ids[0];
487
+ item.participantName = ids[0];
488
+ hit = true;
489
+ }
490
+ return hit;
491
+ }
492
+ if (operationType === "ACTIVATE_ACTIVITY") {
493
+ const target = String(body.activityCode ?? "");
494
+ if (!target)
495
+ return businessRefusal(40000, "activityCode 为空");
496
+ const ids = Array.isArray(body.participantors) ? body.participantors.map(String) : [];
497
+ for (const item of ctx.state.workItems.values()) {
498
+ if (item.instanceId !== instanceId)
499
+ continue;
500
+ if (PENDING_STATES.has(item.state))
501
+ item.state = "FINISHED";
502
+ if (item.activityCode === target) {
503
+ // fake 的待办状态词表是 NOTSTARTED/INPROGRESS/DRAFT(PENDING_STATES),
504
+ // 别写 PENDING——那不在集合里,读回会当成已完结。
505
+ item.state = "INPROGRESS";
506
+ if (ids.length > 0) {
507
+ item.participant = ids[0];
508
+ item.participantName = ids[0];
509
+ }
510
+ }
511
+ }
512
+ return true;
513
+ }
514
+ return businessRefusal(40000, `operationType ${operationType} 未建模(fake 仅 ADJUST_PARTICIPANT/ACTIVATE_ACTIVITY)`);
515
+ }
516
+ case "/api/api/runtime/workflow/finish_instance_by_post": {
517
+ // r64:发起人「结束流程」——正常完结语义(end 规则照常触发)。
518
+ const instanceId = String(body.workflowInstanceId ?? "");
519
+ const instance = ctx.state.workflowInstances.get(instanceId);
520
+ if (!instance)
521
+ return businessRefusal(402504, "流程实例状态不存在!");
522
+ instance.status = "COMPLETED";
523
+ for (const item of ctx.state.workItems.values()) {
524
+ if (item.instanceId === instanceId && PENDING_STATES.has(item.state))
525
+ item.state = "FINISHED";
526
+ }
527
+ return true;
528
+ }
427
529
  case "/api/api/runtime/workflow/list_workitems": {
428
530
  // The JPA-spec face (WorkflowInstanceController.listWorkItems): it queri
429
531
  // the work-item table directly instead of resolving each hit's template,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-fake-platform",
3
- "version": "0.6.52",
3
+ "version": "0.6.54",
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.52"
21
+ "omc-core": "0.6.54"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=22.13"