@stalfh233/omc-fake-platform 0.4.98 → 0.4.100

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { dispatchFakeRoute } from "./routes.js";
2
- import { createFakeState, isBusinessRefusal, isMalformedEnvelope, isRawResponse } from "./state.js";
2
+ import { createFakeState, isBusinessRefusal, isHttpErrorResponse, isMalformedEnvelope, isRawResponse } from "./state.js";
3
3
  export { FAKE_RSA_PUBLIC_KEY } from "./state.js";
4
4
  /**
5
5
  * In-memory fake CloudPivot 8.6 for offline CLI tests: implements the auth
@@ -101,6 +101,8 @@ export class FakeCloudPivot {
101
101
  return { status: 200, body: handler.payload };
102
102
  // Ticket 106: non-envelope bodies (upload refId plain string, export ZIP
103
103
  // bytes) pass through verbatim.
104
+ if (isHttpErrorResponse(handler))
105
+ return { status: handler.status, body: handler.body };
104
106
  if (isRawResponse(handler))
105
107
  return { status: 200, body: handler.payload };
106
108
  if (handler === undefined)
package/dist/report.js CHANGED
@@ -1,4 +1,4 @@
1
- import { businessRefusal, NOT_HANDLED, rawResponse } from "./state.js";
1
+ import { businessRefusal, httpErrorResponse, NOT_HANDLED, rawResponse } from "./state.js";
2
2
  /**
3
3
  * R1-report fake. Twin of src/lanes/report.ts: the platform channel
4
4
  * (`/api/api/report/*`, errcode envelope) owns the report page; the BI channel
@@ -51,6 +51,12 @@ function biNoop() {
51
51
  export const reportRoute = (ctx, input) => {
52
52
  const q = input.query ?? {};
53
53
  const body = (input.body ?? {});
54
+ // r19 p14: a deployment without the report service — the gateway answers
55
+ // every BI-channel call with 502 + html (live 2026-10-26, p9 probe). The
56
+ // platform channel below keeps working, exactly like the real box.
57
+ if (ctx.options.reportServiceDown === true && input.path.startsWith("/dashboard/v1/")) {
58
+ return httpErrorResponse(502, "<html><body>502 Bad Gateway</body></html>");
59
+ }
54
60
  switch (input.path) {
55
61
  // ---- platform channel ----
56
62
  case "/api/api/app/folders/queryReportChartTree":
package/dist/state.d.ts CHANGED
@@ -9,6 +9,13 @@ export interface FakeCloudPivotOptions {
9
9
  readonly version?: string;
10
10
  readonly baseUrl?: string;
11
11
  readonly applicationCode?: string;
12
+ /**
13
+ * r19 p9/p14: simulate a deployment WITHOUT the report service — every
14
+ * `/dashboard/v1/*` call answers HTTP 502 with an html body from the gateway
15
+ * (exactly what the live 1.1.25 box returns; the platform `/api/api/report/*`
16
+ * channel keeps working). Pins the BI-boundary teaching offline.
17
+ */
18
+ readonly reportServiceDown?: boolean;
12
19
  /**
13
20
  * Optional override for the applicationList endpoint. When omitted, the
14
21
  * fake returns a single application keyed off `applicationCode` (default
@@ -503,6 +510,13 @@ export interface FakeRawResponse {
503
510
  readonly fakeRawResponse: true;
504
511
  readonly payload: unknown;
505
512
  }
513
+ export interface FakeHttpErrorResponse {
514
+ readonly fakeHttpError: true;
515
+ readonly status: number;
516
+ readonly body: string;
517
+ }
518
+ export declare function httpErrorResponse(status: number, body: string): FakeHttpErrorResponse;
519
+ export declare function isHttpErrorResponse(value: unknown): value is FakeHttpErrorResponse;
506
520
  export declare function rawResponse(payload: unknown): FakeRawResponse;
507
521
  export declare function isRawResponse(value: unknown): value is FakeRawResponse;
508
522
  export type LaneRoute = (ctx: FakeRouteContext, input: FakeRequestInput) => unknown;
package/dist/state.js CHANGED
@@ -19,6 +19,12 @@ export function malformedEnvelope(payload) {
19
19
  export function isMalformedEnvelope(value) {
20
20
  return typeof value === "object" && value !== null && value.fakeMalformedEnvelope === true;
21
21
  }
22
+ export function httpErrorResponse(status, body) {
23
+ return { fakeHttpError: true, status, body };
24
+ }
25
+ export function isHttpErrorResponse(value) {
26
+ return typeof value === "object" && value !== null && value.fakeHttpError === true;
27
+ }
22
28
  export function rawResponse(payload) {
23
29
  return { fakeRawResponse: true, payload };
24
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-fake-platform",
3
- "version": "0.4.98",
3
+ "version": "0.4.100",
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.98"
21
+ "omc-core": "0.4.100"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=22.13"