@stalfh233/omc-fake-platform 0.4.86 → 0.4.88

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/state.d.ts CHANGED
@@ -380,6 +380,14 @@ export interface FakeState {
380
380
  roleIds: string[];
381
381
  deptIds?: string[];
382
382
  }>;
383
+ /** Workflow instances (biz_workflow_instance), keyed by instance id. */
384
+ workflowInstances: Map<string, {
385
+ id: string;
386
+ workflowCode: string;
387
+ schemaCode: string;
388
+ bizObjectId: string;
389
+ status: string;
390
+ }>;
383
391
  /** Workflow start permissions (h_workflow_permission): who may originate. */
384
392
  workflowPermissions: Map<string, {
385
393
  id: string;
package/dist/state.js CHANGED
@@ -64,6 +64,7 @@ export function createFakeState(options = {}) {
64
64
  orgUsers: new Map(),
65
65
  orgRoles: new Map(),
66
66
  orgMembers: new Map(),
67
+ workflowInstances: new Map(),
67
68
  workflowPermissions: new Map(),
68
69
  enforceWorkflowStartPermission: false,
69
70
  workflows: new Map(),
package/dist/workflow.js CHANGED
@@ -372,6 +372,52 @@ export const workflowRoute = (ctx, input) => {
372
372
  content: rows.slice(start, start + size).map(toWorkItemVO),
373
373
  };
374
374
  }
375
+ case "/api/api/runtime/workflow/list_instances": {
376
+ // WorkflowInstanceController.list_instances — the instance list a purge
377
+ // must empty before the model cascade can run (r14: a surviving instance's
378
+ // work item outlives its template and NPEs the global todo search).
379
+ let rows = [...ctx.state.workflowInstances.values()];
380
+ if (q.workflowCode)
381
+ rows = rows.filter((row) => row.workflowCode === q.workflowCode);
382
+ const size = Number(q.size ?? 10);
383
+ const page = Number(q.page ?? 0);
384
+ const start = page * size;
385
+ return {
386
+ totalElements: rows.length,
387
+ totalPages: size > 0 ? Math.ceil(rows.length / size) : 0,
388
+ content: rows.slice(start, start + size),
389
+ };
390
+ }
391
+ case "/api/api/runtime/workflow/delete_instance": {
392
+ // WorkflowInstanceController.delete_instance: only the instance id is
393
+ // required (the user comes from the session), so an admin session can erase
394
+ // an instance started by someone else.
395
+ const id = String(q.workflowInstanceId ?? "");
396
+ if (!id)
397
+ return businessRefusal(40000, "流程实例id为空");
398
+ const existed = ctx.state.workflowInstances.delete(id);
399
+ return existed;
400
+ }
401
+ case "/api/api/runtime/workflow/list_workitems": {
402
+ // The JPA-spec face (WorkflowInstanceController.listWorkItems): it queri
403
+ // the work-item table directly instead of resolving each hit's template,
404
+ // and it filters by `participant`, so it can answer "what is pending for
405
+ // user X" — the question an approval actually asks (r14 2026-10-24).
406
+ const wanted = String(q.status ?? "PENDING").toUpperCase();
407
+ let rows = [...ctx.state.workItems.values()].filter((item) => String(item.state ?? "").toUpperCase() === wanted);
408
+ if (q.participant)
409
+ rows = rows.filter((item) => item.participant === q.participant);
410
+ if (q.workflowCode)
411
+ rows = rows.filter((item) => item.workflowCode === q.workflowCode);
412
+ const size = Number(q.size ?? 10);
413
+ const page = Number(q.page ?? 0);
414
+ const start = page * size;
415
+ return {
416
+ totalElements: rows.length,
417
+ totalPages: size > 0 ? Math.ceil(rows.length / size) : 0,
418
+ content: rows.slice(start, start + size).map(toWorkItemVO),
419
+ };
420
+ }
375
421
  case "/api/api/runtime/workflow/getBizObjectByWfInstanceId": {
376
422
  const instanceId = String(q.workflowInstanceId ?? "");
377
423
  const item = [...ctx.state.workItems.values()].find((candidate) => candidate.instanceId === instanceId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-fake-platform",
3
- "version": "0.4.86",
3
+ "version": "0.4.88",
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.4.86"
21
+ "omc-core": "0.4.88"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=22.13"