@stalfh233/omc-fake-platform 0.6.2 → 0.6.4

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 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) {
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-fake-platform",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "OMC 的内存假 CloudPivot 平台(wire 接缝的第二个适配器)+ HTTP 假服务器——@stalfh233/omc-cli 的测试与 bench 基准基座",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",