@stalfh233/omc-fake-platform 0.6.23 → 0.6.25
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/routes.js +2 -0
- package/dist/rulelog.d.ts +23 -0
- package/dist/rulelog.js +16 -0
- package/package.json +2 -2
package/dist/routes.js
CHANGED
|
@@ -13,6 +13,7 @@ import { onlineJsRoute } from "./online-js.js";
|
|
|
13
13
|
import { programmingRoute } from "./programming.js";
|
|
14
14
|
import { reportRoute } from "./report.js";
|
|
15
15
|
import { ruleLifecycleRoute } from "./rule-lifecycle.js";
|
|
16
|
+
import { ruleLogRoute } from "./rulelog.js";
|
|
16
17
|
import { runtimeDataRoute } from "./runtime-data.js";
|
|
17
18
|
import { NOT_HANDLED } from "./state.js";
|
|
18
19
|
import { workflowRoute } from "./workflow.js";
|
|
@@ -30,6 +31,7 @@ const LANE_ROUTES = [
|
|
|
30
31
|
dataRuleRoute,
|
|
31
32
|
formRoute,
|
|
32
33
|
businessRuleRoute,
|
|
34
|
+
ruleLogRoute,
|
|
33
35
|
ruleLifecycleRoute,
|
|
34
36
|
runtimeDataRoute,
|
|
35
37
|
workflowRoute,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type FakeState, type LaneRoute } from "./state.js";
|
|
2
|
+
export interface FakeRuleLog {
|
|
3
|
+
id: string;
|
|
4
|
+
schemaCode: string;
|
|
5
|
+
code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
triggerType?: string;
|
|
8
|
+
triggerTime?: string;
|
|
9
|
+
finishTime?: string;
|
|
10
|
+
status?: boolean;
|
|
11
|
+
errMsg?: string;
|
|
12
|
+
ruleVersion?: number;
|
|
13
|
+
traceId?: string;
|
|
14
|
+
inputSummaries?: {
|
|
15
|
+
id: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
}[];
|
|
18
|
+
nodes?: Record<string, unknown>[];
|
|
19
|
+
}
|
|
20
|
+
export declare function seedRuleLog(state: FakeState, seed: Omit<FakeRuleLog, "id"> & {
|
|
21
|
+
id?: string;
|
|
22
|
+
}): void;
|
|
23
|
+
export declare const ruleLogRoute: LaneRoute;
|
package/dist/rulelog.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NOT_HANDLED } from "./state.js";
|
|
2
|
+
const logStore = (state) => { const holder = state; return holder.__ruleLogs ?? (holder.__ruleLogs = []); };
|
|
3
|
+
export function seedRuleLog(state, seed) { const list = logStore(state); list.push({ ...seed, id: seed.id ?? `rule-log-${list.length + 1}`, inputSummaries: seed.inputSummaries ?? [], nodes: seed.nodes ?? [] }); }
|
|
4
|
+
export const ruleLogRoute = (ctx, input) => {
|
|
5
|
+
const match = input.path.match(/^\/api\/api\/launcher\/domain_service_runtime\/([^/]+)\/(search_rule_log|query_rule_activity_log)$/);
|
|
6
|
+
if (!match)
|
|
7
|
+
return NOT_HANDLED;
|
|
8
|
+
const schemaCode = decodeURIComponent(match[1]);
|
|
9
|
+
const list = logStore(ctx.state).filter((row) => row.schemaCode === schemaCode);
|
|
10
|
+
const body = (input.body ?? {});
|
|
11
|
+
if (match[2] === "query_rule_activity_log")
|
|
12
|
+
return list.find((row) => row.id === body.ruleLogId)?.nodes ?? [];
|
|
13
|
+
const filtered = list.filter((row) => (body.ruleCode === undefined || row.code === body.ruleCode) && (body.status === undefined || row.status === body.status) && (body.startTime === undefined || String(row.triggerTime ?? "") >= String(body.startTime)) && (body.endTime === undefined || String(row.triggerTime ?? "") <= String(body.endTime)));
|
|
14
|
+
const page = Number(body.page ?? 0), size = Number(body.size ?? 20);
|
|
15
|
+
return { content: filtered.slice(page * size, (page + 1) * size).map((row) => ({ ...row, bizObjectId: "NONE", bizObjectName: "NONE" })), totalElements: filtered.length, totalPages: Math.ceil(filtered.length / size), view: null, parentData: null, sumLine: null, sumMap: null };
|
|
16
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-fake-platform",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.25",
|
|
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.
|
|
21
|
+
"omc-core": "0.6.25"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=22.13"
|