@stalfh233/omc-fake-platform 0.6.1 → 0.6.3
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/index.d.ts +14 -0
- package/dist/index.js +26 -0
- package/dist/rule-lifecycle.js +8 -0
- package/dist/workflow.js +30 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,20 @@ export declare class FakeCloudPivot implements CloudPivotHttp {
|
|
|
24
24
|
pathFragment: string;
|
|
25
25
|
body: unknown;
|
|
26
26
|
} | null;
|
|
27
|
+
/**
|
|
28
|
+
* 2026-11-03 issue A1(8.1.108 版本族):模拟「端点在该版本族缺席」——列出的
|
|
29
|
+
* path 一律回 HTTP 404(不带 errcode 信封),用于测 CLI 的端点备选下探
|
|
30
|
+
* (如 8.1 族没有 `runtime/business_rule/list_by_schemacode` 与
|
|
31
|
+
* `businessrule/publish`)。与 reportServiceDown 的 502 注入同一家族。
|
|
32
|
+
*/
|
|
33
|
+
absentPaths: ReadonlySet<string>;
|
|
34
|
+
/**
|
|
35
|
+
* 2026-11-03 issue A2(8.1.108 读缺陷):`bizservice/method/get`(按 id 的 get 面)
|
|
36
|
+
* 把 DB 实有的参数面读成 `"[]"`(同服务短参数正常、长参数读空——平台侧长度相
|
|
37
|
+
* 关缺陷)。置 true 后 get 面的 input/outputParametersJson 回 "[]",list 面与
|
|
38
|
+
* 存储行保持实有数据——用于测 CLI 的双面交叉校验(parametersUnreadable)。
|
|
39
|
+
*/
|
|
40
|
+
methodGetParameterFaceEmpty: boolean;
|
|
27
41
|
/** When true, /api/api/runtime/form/submit returns no objectId for formType=2. */
|
|
28
42
|
forceSubmitMissingObjectId: boolean;
|
|
29
43
|
forceSubmitMismatchedObjectId: boolean;
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,20 @@ export class FakeCloudPivot {
|
|
|
17
17
|
businessFailure = null;
|
|
18
18
|
/** Round-2 T-06: inject a RAW (non-errcode) response body to exercise malformed-envelope diagnostics. */
|
|
19
19
|
malformedResponse = null;
|
|
20
|
+
/**
|
|
21
|
+
* 2026-11-03 issue A1(8.1.108 版本族):模拟「端点在该版本族缺席」——列出的
|
|
22
|
+
* path 一律回 HTTP 404(不带 errcode 信封),用于测 CLI 的端点备选下探
|
|
23
|
+
* (如 8.1 族没有 `runtime/business_rule/list_by_schemacode` 与
|
|
24
|
+
* `businessrule/publish`)。与 reportServiceDown 的 502 注入同一家族。
|
|
25
|
+
*/
|
|
26
|
+
absentPaths = new Set();
|
|
27
|
+
/**
|
|
28
|
+
* 2026-11-03 issue A2(8.1.108 读缺陷):`bizservice/method/get`(按 id 的 get 面)
|
|
29
|
+
* 把 DB 实有的参数面读成 `"[]"`(同服务短参数正常、长参数读空——平台侧长度相
|
|
30
|
+
* 关缺陷)。置 true 后 get 面的 input/outputParametersJson 回 "[]",list 面与
|
|
31
|
+
* 存储行保持实有数据——用于测 CLI 的双面交叉校验(parametersUnreadable)。
|
|
32
|
+
*/
|
|
33
|
+
methodGetParameterFaceEmpty = false;
|
|
20
34
|
/** When true, /api/api/runtime/form/submit returns no objectId for formType=2. */
|
|
21
35
|
forceSubmitMissingObjectId = false;
|
|
22
36
|
forceSubmitMismatchedObjectId = false;
|
|
@@ -86,6 +100,10 @@ export class FakeCloudPivot {
|
|
|
86
100
|
query: input.query,
|
|
87
101
|
...(input.multipart !== undefined ? { multipart: { filename: input.multipart.filename, contentType: input.multipart.contentType, bytes: input.multipart.content.length } } : {}),
|
|
88
102
|
});
|
|
103
|
+
// 2026-11-03 issue A1: 列入 absentPaths 的端点一律回 HTTP 404(版本族缺席
|
|
104
|
+
// 模拟)。放在 callLog 之后:下探链的「先打了主端点」仍可在日志里核对。
|
|
105
|
+
if (this.absentPaths.has(input.path))
|
|
106
|
+
return { status: 404, body: { errcode: 404, errmsg: "not found (absent endpoint — version family simulation)", data: null } };
|
|
89
107
|
if (this.transportDown)
|
|
90
108
|
throw new Error("simulated transport outage");
|
|
91
109
|
if (this.businessFailure && input.path.includes(this.businessFailure.pathFragment))
|
|
@@ -107,6 +125,14 @@ export class FakeCloudPivot {
|
|
|
107
125
|
return { status: 200, body: handler.payload };
|
|
108
126
|
if (handler === undefined)
|
|
109
127
|
return { status: 404, body: { errcode: 404, errmsg: "not found", data: null } };
|
|
128
|
+
// 2026-11-03 issue A2: the get face answers "[]" for a face the DB (and
|
|
129
|
+
// the list face) actually hold — length-correlated live read defect on
|
|
130
|
+
// 8.1.108. Injected AFTER routing so the stored row and the list face
|
|
131
|
+
// keep the real parameter JSON (exactly the live asymmetry).
|
|
132
|
+
if (this.methodGetParameterFaceEmpty && input.path === "/api/api/bizservice/method/get" && handler !== null && typeof handler === "object" && !Array.isArray(handler)) {
|
|
133
|
+
const hollowFace = { ...handler, inputParametersJson: "[]", outputParametersJson: "[]" };
|
|
134
|
+
return { status: 200, body: { errcode: 0, errmsg: "ok", data: hollowFace } };
|
|
135
|
+
}
|
|
110
136
|
return { status: 200, body: { errcode: 0, errmsg: "ok", data: handler } };
|
|
111
137
|
}
|
|
112
138
|
route(input) {
|
package/dist/rule-lifecycle.js
CHANGED
|
@@ -157,6 +157,14 @@ export const ruleLifecycleRoute = (ctx, input) => {
|
|
|
157
157
|
target.enabled = true;
|
|
158
158
|
return null;
|
|
159
159
|
}
|
|
160
|
+
case "/api/api/app/businessrule/disable": {
|
|
161
|
+
// 8.6.26 BusinessRuleController.java:517 与 8.1.108 同款(body={schemaCode,
|
|
162
|
+
// ruleCode})。rule.disable 直打此端点(2026-11-04 源码实证)。
|
|
163
|
+
const target = [...ctx.state.rules.values()].find((rule) => rule.schemaCode === body.schemaCode && rule.code === body.ruleCode);
|
|
164
|
+
if (target)
|
|
165
|
+
target.enabled = false;
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
160
168
|
case "/api/api/app/businessrule/delete":
|
|
161
169
|
for (const [code, rule] of ctx.state.rules)
|
|
162
170
|
if (rule.id === q.id)
|
package/dist/workflow.js
CHANGED
|
@@ -451,12 +451,40 @@ export const workflowRoute = (ctx, input) => {
|
|
|
451
451
|
return null;
|
|
452
452
|
return { id: item.bizObjectId, schemaCode: item.schemaCode };
|
|
453
453
|
}
|
|
454
|
-
case "/api/api/organization/role/list":
|
|
454
|
+
case "/api/api/organization/role/list": {
|
|
455
455
|
// Real shape: groups with `children` roles (see real-env observation).
|
|
456
|
+
// r70: previously a static fixture — a group/role created in the same
|
|
457
|
+
// session never showed up, so any readback-based guard (and any agent
|
|
458
|
+
// checking its own write) got a wrong "not created" answer. Reflect the
|
|
459
|
+
// live state: seeded group first, then created groups, each with its
|
|
460
|
+
// roles. Roles whose roleGroupId is not a known group are omitted, which
|
|
461
|
+
// mirrors the real orphan behaviour (row exists, tree never returns it).
|
|
462
|
+
const roleOf = (role) => ({
|
|
463
|
+
id: role.id,
|
|
464
|
+
name: role.name,
|
|
465
|
+
code: role.code,
|
|
466
|
+
roleType: role.roleType ?? "SYS",
|
|
467
|
+
corpId: role.corpId ?? "corp-1",
|
|
468
|
+
});
|
|
469
|
+
const rolesByGroup = new Map();
|
|
470
|
+
for (const role of [...ctx.state.orgRoles.values()]) {
|
|
471
|
+
const bucket = rolesByGroup.get(role.roleGroupId) ?? [];
|
|
472
|
+
bucket.push(roleOf(role));
|
|
473
|
+
rolesByGroup.set(role.roleGroupId, bucket);
|
|
474
|
+
}
|
|
475
|
+
const seededRoles = [{ id: "role-lead", name: "部门负责人", code: "SYS260630023816197", roleType: "SYS", corpId: "corp-1" }];
|
|
476
|
+
const groups = [
|
|
477
|
+
{ id: "grp-1", name: "默认", code: "SYS_1000000", group: true, children: [...seededRoles, ...(rolesByGroup.get("grp-1") ?? [])] },
|
|
478
|
+
...[...ctx.state.orgGroups.values()]
|
|
479
|
+
.filter((group) => group.id !== "grp-1")
|
|
480
|
+
.map((group) => ({ id: group.id, name: group.name, code: group.code, group: true, children: rolesByGroup.get(group.id) ?? [] })),
|
|
481
|
+
];
|
|
456
482
|
return [
|
|
457
|
-
|
|
483
|
+
...groups,
|
|
484
|
+
// Leaf role with no group container (legacy fixture shape).
|
|
458
485
|
{ id: "role-finance", name: "财务负责人", code: "SYS260515031207258", roleType: "SYS", corpId: "corp-1" },
|
|
459
486
|
];
|
|
487
|
+
}
|
|
460
488
|
case "/api/api/organization/department/tree": {
|
|
461
489
|
// Platform semantics (re-verified r15, 1.1.25): no deptIds → roots ONLY;
|
|
462
490
|
// deptIds=<id> → DIRECT CHILDREN only. The old "whole subtree" fake made
|
package/package.json
CHANGED