@stalfh233/omc-cli 0.0.0-stage → 0.4.10
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/LICENSE +21 -0
- package/README.md +293 -3
- package/coverage/m1-coverage-manifest-v1.json +1278 -0
- package/dist/approval-token.js +102 -0
- package/dist/args.js +25 -0
- package/dist/artifacts.js +119 -0
- package/dist/bench/call-face-eval.js +256 -0
- package/dist/bench/context-attribution.js +151 -0
- package/dist/bench/discovery-cost-eval.js +230 -0
- package/dist/bench/driver.js +81 -0
- package/dist/bench/evals.js +236 -0
- package/dist/bench/fake-http-server.js +65 -0
- package/dist/bench/instrument.js +87 -0
- package/dist/bench/intent-face-eval.js +343 -0
- package/dist/bench/run.js +166 -0
- package/dist/bench/scenario.js +343 -0
- package/dist/bench/types.js +76 -0
- package/dist/bi-wire.js +41 -0
- package/dist/bizservice-config.js +581 -0
- package/dist/call.js +153 -0
- package/dist/capability-absences.js +23 -0
- package/dist/capability-overview.js +492 -0
- package/dist/capability-shape.js +154 -0
- package/dist/cli-contract.js +70 -0
- package/dist/cli-output.js +73 -0
- package/dist/cli.js +1418 -0
- package/dist/code-rules.js +69 -0
- package/dist/command-transport.js +155 -0
- package/dist/config-store.js +195 -0
- package/dist/context.js +21 -0
- package/dist/contract-consistency.js +66 -0
- package/dist/contract-resources.js +62 -0
- package/dist/coverage-consistency.js +62 -0
- package/dist/coverage-registry.js +76 -0
- package/dist/coverage.js +130 -0
- package/dist/data-list-filter.js +114 -0
- package/dist/discovery.js +390 -0
- package/dist/endpoints.js +154 -0
- package/dist/environment-policy.js +26 -0
- package/dist/execution-metadata.js +1092 -0
- package/dist/fake/app.js +45 -0
- package/dist/fake/b2-registration.js +594 -0
- package/dist/fake/businessrule.js +242 -0
- package/dist/fake/datarule.js +72 -0
- package/dist/fake/dictionary.js +108 -0
- package/dist/fake/environment.js +30 -0
- package/dist/fake/field.js +167 -0
- package/dist/fake/form.js +101 -0
- package/dist/fake/index.js +121 -0
- package/dist/fake/list-view.js +289 -0
- package/dist/fake/model.js +136 -0
- package/dist/fake/online-js.js +18 -0
- package/dist/fake/report.js +253 -0
- package/dist/fake/routes.js +47 -0
- package/dist/fake/rule-lifecycle.js +37 -0
- package/dist/fake/runtime-data.js +367 -0
- package/dist/fake/state.js +67 -0
- package/dist/fake/workflow.js +364 -0
- package/dist/field-change.js +200 -0
- package/dist/field-families.js +896 -0
- package/dist/form-layout.js +111 -0
- package/dist/form-support.js +821 -0
- package/dist/goal-routes.js +468 -0
- package/dist/governed-execution.js +87 -0
- package/dist/human-summary.js +212 -0
- package/dist/identity.js +62 -0
- package/dist/intent/baseline.js +57 -0
- package/dist/intent/capabilities/bizservice.js +274 -0
- package/dist/intent/capabilities/businessrule.js +493 -0
- package/dist/intent/capabilities/datarule.js +187 -0
- package/dist/intent/capabilities/field.js +545 -0
- package/dist/intent/capabilities/form.js +136 -0
- package/dist/intent/capabilities/index.js +64 -0
- package/dist/intent/capabilities/listview.js +157 -0
- package/dist/intent/capabilities/model.js +100 -0
- package/dist/intent/capabilities/onlinejs.js +108 -0
- package/dist/intent/capabilities/report.js +355 -0
- package/dist/intent/capabilities/workflow.js +458 -0
- package/dist/intent/capability.js +6 -0
- package/dist/intent/cli.js +91 -0
- package/dist/intent/compare.js +56 -0
- package/dist/intent/compiler.js +79 -0
- package/dist/intent/dsl.js +129 -0
- package/dist/intent/plan-file.js +63 -0
- package/dist/intent/readback.js +65 -0
- package/dist/intent/schema.js +158 -0
- package/dist/intent/validation.js +30 -0
- package/dist/intent/yaml.js +315 -0
- package/dist/json-column.js +68 -0
- package/dist/lanes/app-contract.js +95 -0
- package/dist/lanes/app-coverage.js +16 -0
- package/dist/lanes/app.js +174 -0
- package/dist/lanes/apply-changes.js +231 -0
- package/dist/lanes/b2-registration-contract.js +292 -0
- package/dist/lanes/b2-registration-coverage.js +48 -0
- package/dist/lanes/b2-registration.js +1187 -0
- package/dist/lanes/businessrule-contract.js +232 -0
- package/dist/lanes/businessrule-coverage.js +16 -0
- package/dist/lanes/businessrule.js +221 -0
- package/dist/lanes/contract-support.js +65 -0
- package/dist/lanes/coverage-declaration.js +9 -0
- package/dist/lanes/datarule-contract.js +155 -0
- package/dist/lanes/datarule-coverage.js +19 -0
- package/dist/lanes/datarule-protocol.js +308 -0
- package/dist/lanes/datarule.js +818 -0
- package/dist/lanes/dictionary-contract.js +78 -0
- package/dist/lanes/dictionary-coverage.js +24 -0
- package/dist/lanes/dictionary.js +235 -0
- package/dist/lanes/environment-contract.js +70 -0
- package/dist/lanes/environment-coverage.js +14 -0
- package/dist/lanes/environment.js +163 -0
- package/dist/lanes/field-contract.js +223 -0
- package/dist/lanes/field-coverage.js +27 -0
- package/dist/lanes/field.js +374 -0
- package/dist/lanes/form-contract.js +97 -0
- package/dist/lanes/form-coverage.js +16 -0
- package/dist/lanes/form.js +185 -0
- package/dist/lanes/lane-ids.js +34 -0
- package/dist/lanes/list-view-contract.js +175 -0
- package/dist/lanes/list-view-coverage.js +20 -0
- package/dist/lanes/list-view-shapes.js +1207 -0
- package/dist/lanes/list-view.js +578 -0
- package/dist/lanes/meta-contract.js +85 -0
- package/dist/lanes/meta.js +255 -0
- package/dist/lanes/model-contract.js +168 -0
- package/dist/lanes/model-coverage.js +20 -0
- package/dist/lanes/model.js +986 -0
- package/dist/lanes/online-js-contract.js +99 -0
- package/dist/lanes/online-js-coverage.js +28 -0
- package/dist/lanes/online-js.js +127 -0
- package/dist/lanes/report-contract.js +144 -0
- package/dist/lanes/report-coverage.js +21 -0
- package/dist/lanes/report.js +476 -0
- package/dist/lanes/rule-graph.js +1846 -0
- package/dist/lanes/rule-lifecycle-contract.js +92 -0
- package/dist/lanes/rule-lifecycle-coverage.js +20 -0
- package/dist/lanes/rule-lifecycle.js +176 -0
- package/dist/lanes/runtime-data-contract.js +264 -0
- package/dist/lanes/runtime-data-coverage.js +25 -0
- package/dist/lanes/runtime-data.js +1054 -0
- package/dist/lanes/workflow-contract.js +223 -0
- package/dist/lanes/workflow-coverage.js +40 -0
- package/dist/lanes/workflow.js +1813 -0
- package/dist/online-js-layout.js +58 -0
- package/dist/online-js-source.js +276 -0
- package/dist/package-tool.js +51 -0
- package/dist/package.js +73 -0
- package/dist/plan.js +73 -0
- package/dist/read.js +144 -0
- package/dist/redact.js +28 -0
- package/dist/rule-support.js +587 -0
- package/dist/runtime-support.js +134 -0
- package/dist/server.js +92 -0
- package/dist/session-manager.js +30 -0
- package/dist/session.js +149 -0
- package/dist/skills.js +112 -0
- package/dist/support.js +98 -0
- package/dist/tool-types.js +127 -0
- package/dist/tools.js +59 -0
- package/dist/usage-log.js +197 -0
- package/dist/wire.js +287 -0
- package/dist/workflow-support.js +99 -0
- package/dist/write-lease.js +26 -0
- package/dist/write-lock.js +109 -0
- package/dist/write.js +176 -0
- package/dist/zip.js +156 -0
- package/docs/tool-surface-map.md +42 -0
- package/package.json +71 -6
- package/skills/omc-acceptance-criteria.md +47 -0
- package/skills/omc-business-configuration.md +257 -0
- package/skills/omc-capabilities.md +197 -0
- package/skills/omc-capability-scouting.md +55 -0
- package/skills/omc-config-draft-review.md +171 -0
- package/skills/omc-five-piece-flow.md +35 -0
- package/skills/omc-glossary.md +86 -0
- package/skills/omc-refusals.md +110 -0
- package/skills/omc-requirement-analysis.md +161 -0
- package/skills/omc-requirement-vocabulary.md +51 -0
- package/skills/omc-start-here.md +82 -0
- package/skills/omc-tool-selection.md +119 -0
- package/skills/omc-write-hazards.md +87 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NOT_HANDLED } from "./state.js";
|
|
2
|
+
/** online-js lane: programming compile/get_source/publish. Twin of src/lanes/online-js.ts. */
|
|
3
|
+
export const onlineJsRoute = (ctx, input) => {
|
|
4
|
+
const q = input.query ?? {};
|
|
5
|
+
const body = (input.body ?? {});
|
|
6
|
+
switch (input.path) {
|
|
7
|
+
case "/api/api/programming/compile":
|
|
8
|
+
return { compiled: true };
|
|
9
|
+
case "/api/api/programming/get_source":
|
|
10
|
+
return ctx.state.onlineJs.get(`${q.schemaCode}#${q.sheetCode}`) ?? null;
|
|
11
|
+
case "/api/api/programming/publish":
|
|
12
|
+
ctx.state.onlineJs.set(`${body.schemaCode}#${body.sheetCode}`, String(body.source));
|
|
13
|
+
return null;
|
|
14
|
+
default:
|
|
15
|
+
return NOT_HANDLED;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=online-js.js.map
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { businessRefusal, NOT_HANDLED, rawResponse } from "./state.js";
|
|
2
|
+
/**
|
|
3
|
+
* R1-report fake. Twin of src/lanes/report.ts: the platform channel
|
|
4
|
+
* (`/api/api/report/*`, errcode envelope) owns the report page; the BI channel
|
|
5
|
+
* (`/dashboard/v1/*`, `{data}` / `{errorCode}` envelope) owns the dashboard and
|
|
6
|
+
* charts. Fidelity notes matching live (aozhe tenant):
|
|
7
|
+
* - a BI call with no in-body `config` returns `{data:true}` but mutates
|
|
8
|
+
* nothing (silent no-op);
|
|
9
|
+
* - an absent dashboard answers `errorCode:"dashboard.not.exist"`;
|
|
10
|
+
* - a report tree reports a page's charts from its BI dashboard.
|
|
11
|
+
*/
|
|
12
|
+
function reportTree(ctx, appCode) {
|
|
13
|
+
const pages = [...ctx.state.reportPages.values()].filter((page) => !appCode || page.appCode === appCode);
|
|
14
|
+
const byApp = new Map();
|
|
15
|
+
for (const page of pages) {
|
|
16
|
+
const list = byApp.get(page.appCode) ?? [];
|
|
17
|
+
list.push(page);
|
|
18
|
+
byApp.set(page.appCode, list);
|
|
19
|
+
}
|
|
20
|
+
return [...byApp.entries()].map(([app, appPages]) => ({
|
|
21
|
+
code: app,
|
|
22
|
+
appFunctionList: appPages.map((page) => ({
|
|
23
|
+
code: page.code,
|
|
24
|
+
name: page.name,
|
|
25
|
+
appCode: page.appCode,
|
|
26
|
+
type: "Report",
|
|
27
|
+
reportObjectId: page.id,
|
|
28
|
+
appReportChartList: (ctx.state.biDashboards.get(page.id)?.charts ?? []).map((chart) => ({
|
|
29
|
+
uuid: chart.uuid,
|
|
30
|
+
title: chart.title,
|
|
31
|
+
type: chart.type,
|
|
32
|
+
objectId: page.id,
|
|
33
|
+
})),
|
|
34
|
+
})),
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
function hasConfig(body) {
|
|
38
|
+
const config = body.config;
|
|
39
|
+
return typeof config === "object" && config !== null;
|
|
40
|
+
}
|
|
41
|
+
/** BI error envelope (`{errorCode,...}`), returned verbatim with HTTP 200. */
|
|
42
|
+
function biError(errorCode, errorMessage) {
|
|
43
|
+
return rawResponse({ errorCode, errorMessage, errorType: "BIZ" });
|
|
44
|
+
}
|
|
45
|
+
function biData(data) {
|
|
46
|
+
return rawResponse({ data });
|
|
47
|
+
}
|
|
48
|
+
function biNoop() {
|
|
49
|
+
return biData(true);
|
|
50
|
+
}
|
|
51
|
+
export const reportRoute = (ctx, input) => {
|
|
52
|
+
const q = input.query ?? {};
|
|
53
|
+
const body = (input.body ?? {});
|
|
54
|
+
switch (input.path) {
|
|
55
|
+
// ---- platform channel ----
|
|
56
|
+
case "/api/api/app/folders/queryReportChartTree":
|
|
57
|
+
return reportTree(ctx);
|
|
58
|
+
case "/api/api/runtime/app/queryReportChartTreeByApp":
|
|
59
|
+
return reportTree(ctx, q.appCode);
|
|
60
|
+
case "/api/api/report/get": {
|
|
61
|
+
const page = ctx.state.reportPages.get(q.code);
|
|
62
|
+
if (!page)
|
|
63
|
+
return businessRefusal(302035, "报表不存在!");
|
|
64
|
+
// Live fidelity: report/get omits a top-level `parentId`; the immediate
|
|
65
|
+
// folder is the LAST folderList entry. The tool must derive parentId from
|
|
66
|
+
// it (report/update 500s without one).
|
|
67
|
+
const { parentId, ...rest } = page;
|
|
68
|
+
return { ...rest, reportObjectId: page.id, folderList: [{ id: parentId, type: "Folder" }] };
|
|
69
|
+
}
|
|
70
|
+
case "/api/api/report/create": {
|
|
71
|
+
const code = String(body.code ?? "");
|
|
72
|
+
if (!code)
|
|
73
|
+
return businessRefusal(50000, "code 不能为空");
|
|
74
|
+
if (ctx.state.reportPages.has(code))
|
|
75
|
+
return businessRefusal(50000, "编码重复");
|
|
76
|
+
const page = {
|
|
77
|
+
id: `report-${ctx.state.reportPages.size + 1}`,
|
|
78
|
+
code,
|
|
79
|
+
name: String(body.name ?? code),
|
|
80
|
+
appCode: String(body.appCode ?? ""),
|
|
81
|
+
parentId: String(body.parentId ?? ""),
|
|
82
|
+
icon: String(body.icon ?? "h-icon-all-Report"),
|
|
83
|
+
pcAble: body.pcAble !== false,
|
|
84
|
+
mobileAble: body.mobileAble !== false,
|
|
85
|
+
name_i18n: typeof body.name_i18n === "string" ? body.name_i18n : JSON.stringify(body.name_i18n ?? {}),
|
|
86
|
+
};
|
|
87
|
+
ctx.state.reportPages.set(code, page);
|
|
88
|
+
return { ...page, reportObjectId: page.id };
|
|
89
|
+
}
|
|
90
|
+
case "/api/api/report/update": {
|
|
91
|
+
const id = String(body.id ?? "");
|
|
92
|
+
const page = [...ctx.state.reportPages.values()].find((entry) => entry.id === id);
|
|
93
|
+
if (!page)
|
|
94
|
+
return businessRefusal(50000, "报表不存在");
|
|
95
|
+
// Live fidelity: a missing parentId answers 50000 服务异常 (the platform
|
|
96
|
+
// dereferences it), even though report/get never returns it directly.
|
|
97
|
+
if (body.parentId === undefined || body.parentId === null || body.parentId === "")
|
|
98
|
+
return businessRefusal(50000, "服务异常");
|
|
99
|
+
if (typeof body.name === "string")
|
|
100
|
+
page.name = body.name;
|
|
101
|
+
if (typeof body.icon === "string")
|
|
102
|
+
page.icon = body.icon;
|
|
103
|
+
if (typeof body.name_i18n === "string")
|
|
104
|
+
page.name_i18n = body.name_i18n;
|
|
105
|
+
if (typeof body.pcAble === "boolean")
|
|
106
|
+
page.pcAble = body.pcAble;
|
|
107
|
+
if (typeof body.mobileAble === "boolean")
|
|
108
|
+
page.mobileAble = body.mobileAble;
|
|
109
|
+
if (typeof body.parentId === "string")
|
|
110
|
+
page.parentId = body.parentId;
|
|
111
|
+
return page;
|
|
112
|
+
}
|
|
113
|
+
case "/api/api/report/logical_delete": {
|
|
114
|
+
const page = ctx.state.reportPages.get(q.code);
|
|
115
|
+
if (page) {
|
|
116
|
+
ctx.state.reportPages.delete(q.code);
|
|
117
|
+
ctx.state.biDashboards.delete(page.id);
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
// ---- BI channel ----
|
|
122
|
+
case "/dashboard/v1/report/v2/config": {
|
|
123
|
+
const objectId = String(body.objectId ?? "");
|
|
124
|
+
const dashboard = ctx.state.biDashboards.get(objectId);
|
|
125
|
+
if (!dashboard)
|
|
126
|
+
return biError("dashboard.not.exist", "The dashboard does not exist");
|
|
127
|
+
return biData({ corpId: "a", objectId, title: dashboard.title, global: dashboard.global, attributes: dashboard.attributes, charts: dashboard.charts });
|
|
128
|
+
}
|
|
129
|
+
case "/dashboard/v1/report/v2/reportpage": {
|
|
130
|
+
if (!hasConfig(body))
|
|
131
|
+
return biNoop();
|
|
132
|
+
const report = (body.report ?? {});
|
|
133
|
+
const objectId = String(report.objectId ?? "");
|
|
134
|
+
if (!objectId)
|
|
135
|
+
return biError("dashboard.save.fail", "objectId required");
|
|
136
|
+
const existing = ctx.state.biDashboards.get(objectId);
|
|
137
|
+
const dashboard = {
|
|
138
|
+
objectId,
|
|
139
|
+
title: String(report.title ?? existing?.title ?? ""),
|
|
140
|
+
global: typeof report.global === "string" ? report.global : JSON.stringify(report.global ?? {}),
|
|
141
|
+
attributes: typeof report.attributes === "string" ? report.attributes : JSON.stringify(report.attributes ?? {}),
|
|
142
|
+
charts: existing?.charts ?? [],
|
|
143
|
+
};
|
|
144
|
+
ctx.state.biDashboards.set(objectId, dashboard);
|
|
145
|
+
return biData(objectId);
|
|
146
|
+
}
|
|
147
|
+
case "/dashboard/v1/report/removeReport": {
|
|
148
|
+
if (!hasConfig(body))
|
|
149
|
+
return biNoop();
|
|
150
|
+
const objectId = String(body.objectId ?? "");
|
|
151
|
+
if (!ctx.state.biDashboards.has(objectId))
|
|
152
|
+
return biError("dashboard.not.exist", "The dashboard does not exist");
|
|
153
|
+
ctx.state.biDashboards.delete(objectId);
|
|
154
|
+
return biData(true);
|
|
155
|
+
}
|
|
156
|
+
case "/dashboard/v1/report/saveGlobal": {
|
|
157
|
+
if (!hasConfig(body))
|
|
158
|
+
return biNoop();
|
|
159
|
+
const dashboard = ctx.state.biDashboards.get(String(body.objectId ?? ""));
|
|
160
|
+
if (!dashboard)
|
|
161
|
+
return biError("dashboard.not.exist", "The dashboard does not exist");
|
|
162
|
+
dashboard.global = typeof body.global === "string" ? body.global : JSON.stringify(body.global ?? {});
|
|
163
|
+
return biData(true);
|
|
164
|
+
}
|
|
165
|
+
case "/dashboard/v1/report/saveAttributes": {
|
|
166
|
+
if (!hasConfig(body))
|
|
167
|
+
return biNoop();
|
|
168
|
+
const dashboard = ctx.state.biDashboards.get(String(body.objectId ?? ""));
|
|
169
|
+
if (!dashboard)
|
|
170
|
+
return biError("dashboard.not.exist", "The dashboard does not exist");
|
|
171
|
+
dashboard.attributes = typeof body.attributes === "string" ? body.attributes : JSON.stringify(body.attributes ?? {});
|
|
172
|
+
return biData(true);
|
|
173
|
+
}
|
|
174
|
+
case "/dashboard/v1/chart/addChart": {
|
|
175
|
+
if (!hasConfig(body))
|
|
176
|
+
return biNoop();
|
|
177
|
+
const charts = Array.isArray(body.charts) ? body.charts : [];
|
|
178
|
+
const objectId = String(charts[0]?.objectId ?? "");
|
|
179
|
+
const dashboard = ctx.state.biDashboards.get(objectId);
|
|
180
|
+
if (!dashboard)
|
|
181
|
+
return biError("dashboard.not.exist", "The dashboard does not exist");
|
|
182
|
+
for (const chart of charts) {
|
|
183
|
+
if (typeof chart.uuid !== "string" || !chart.uuid)
|
|
184
|
+
return biError("chart.invalid", "chart uuid required");
|
|
185
|
+
if (dashboard.charts.some((entry) => entry.uuid === chart.uuid))
|
|
186
|
+
return biError("chart.exist", "chart already exists");
|
|
187
|
+
dashboard.charts.push(chart);
|
|
188
|
+
}
|
|
189
|
+
return biData(true);
|
|
190
|
+
}
|
|
191
|
+
case "/dashboard/v1/chart/updateChart": {
|
|
192
|
+
if (!hasConfig(body))
|
|
193
|
+
return biNoop();
|
|
194
|
+
const charts = Array.isArray(body.charts) ? body.charts : [];
|
|
195
|
+
const objectId = String(charts[0]?.objectId ?? "");
|
|
196
|
+
const dashboard = ctx.state.biDashboards.get(objectId);
|
|
197
|
+
if (!dashboard)
|
|
198
|
+
return biError("dashboard.not.exist", "The dashboard does not exist");
|
|
199
|
+
for (const chart of charts) {
|
|
200
|
+
const index = dashboard.charts.findIndex((entry) => entry.uuid === chart.uuid);
|
|
201
|
+
if (index < 0)
|
|
202
|
+
return biError("chart.not.exist", "chart does not exist");
|
|
203
|
+
dashboard.charts[index] = chart;
|
|
204
|
+
}
|
|
205
|
+
return biData(true);
|
|
206
|
+
}
|
|
207
|
+
case "/dashboard/v1/chart/removeChart": {
|
|
208
|
+
if (!hasConfig(body))
|
|
209
|
+
return biNoop();
|
|
210
|
+
const objectId = String(body.objectId ?? "");
|
|
211
|
+
for (const dashboard of ctx.state.biDashboards.values())
|
|
212
|
+
dashboard.charts = dashboard.charts.filter((chart) => chart.uuid !== objectId);
|
|
213
|
+
return biData(true);
|
|
214
|
+
}
|
|
215
|
+
case "/dashboard/v1/chart/removeCharts": {
|
|
216
|
+
if (!hasConfig(body))
|
|
217
|
+
return biNoop();
|
|
218
|
+
const ids = new Set(Array.isArray(body.objectIds) ? body.objectIds.map(String) : []);
|
|
219
|
+
for (const dashboard of ctx.state.biDashboards.values())
|
|
220
|
+
dashboard.charts = dashboard.charts.filter((chart) => !ids.has(String(chart.uuid)));
|
|
221
|
+
return biData(true);
|
|
222
|
+
}
|
|
223
|
+
case "/dashboard/v1/report/v3/datasourcelist":
|
|
224
|
+
return biData([
|
|
225
|
+
{ dataSourceId: "model-1", displayName: "人员信息", nodeType: 0, useType: 1, objectId: "model-1", corpId: "a" },
|
|
226
|
+
]);
|
|
227
|
+
case "/dashboard/datasource/advanced_list":
|
|
228
|
+
return biData([
|
|
229
|
+
{ dataSourceId: "sql-1", displayName: "自定义查询", nodeType: 100, useType: 100, objectId: "sql-1", corpId: "a", status: 0, sort: 0, dwTableSyncFlag: false },
|
|
230
|
+
]);
|
|
231
|
+
case "/dashboard/datasource/v2/datasource_list":
|
|
232
|
+
return biData([]);
|
|
233
|
+
case "/dashboard/v1/report/v3/datasource": {
|
|
234
|
+
if (!hasConfig(body))
|
|
235
|
+
return biNoop();
|
|
236
|
+
const infos = Array.isArray(body.dataSourceInfos) ? body.dataSourceInfos : [];
|
|
237
|
+
return biData(infos.map((info) => ({ nodeType: 1, displayName: String(info.dataSourceId), dataSourceId: info.dataSourceId, schema: { dataSourceId: info.dataSourceId, tableName: `t_${String(info.dataSourceId)}` } })));
|
|
238
|
+
}
|
|
239
|
+
case "/dashboard/v1/datalogic/v3/chartdata": {
|
|
240
|
+
// Live fidelity: the endpoint wants the flattened chart with an Integer
|
|
241
|
+
// (or null) `limit`; a raw stored chart (limit is an object) answers
|
|
242
|
+
// server.error. This locks the normalization in report.ts.
|
|
243
|
+
const chart = (body.chart ?? {});
|
|
244
|
+
if (chart.limit !== null && chart.limit !== undefined && typeof chart.limit === "object")
|
|
245
|
+
return biError("server.error", "A server error, please try again later");
|
|
246
|
+
const metric = Array.isArray(chart.metric) ? chart.metric : [];
|
|
247
|
+
return biData({ series: [], total: 0, metricFields: metric.map((entry) => entry.field) });
|
|
248
|
+
}
|
|
249
|
+
default:
|
|
250
|
+
return NOT_HANDLED;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { appRoute } from "./app.js";
|
|
2
|
+
import { b2Route } from "./b2-registration.js";
|
|
3
|
+
import { businessRuleRoute } from "./businessrule.js";
|
|
4
|
+
import { dataRuleRoute } from "./datarule.js";
|
|
5
|
+
import { dictionaryRoute } from "./dictionary.js";
|
|
6
|
+
import { environmentRoute } from "./environment.js";
|
|
7
|
+
import { fieldRoute } from "./field.js";
|
|
8
|
+
import { formRoute } from "./form.js";
|
|
9
|
+
import { listViewRoute } from "./list-view.js";
|
|
10
|
+
import { modelRoute } from "./model.js";
|
|
11
|
+
import { onlineJsRoute } from "./online-js.js";
|
|
12
|
+
import { reportRoute } from "./report.js";
|
|
13
|
+
import { ruleLifecycleRoute } from "./rule-lifecycle.js";
|
|
14
|
+
import { runtimeDataRoute } from "./runtime-data.js";
|
|
15
|
+
import { NOT_HANDLED } from "./state.js";
|
|
16
|
+
import { workflowRoute } from "./workflow.js";
|
|
17
|
+
/**
|
|
18
|
+
* Composition root for the fake wire surface: one route module per lane,
|
|
19
|
+
* mirroring src/tools.ts. Every lane is tried in turn; the first that does
|
|
20
|
+
* not answer NOT_HANDLED owns the path.
|
|
21
|
+
*/
|
|
22
|
+
const LANE_ROUTES = [
|
|
23
|
+
environmentRoute,
|
|
24
|
+
appRoute,
|
|
25
|
+
dictionaryRoute,
|
|
26
|
+
modelRoute,
|
|
27
|
+
fieldRoute,
|
|
28
|
+
dataRuleRoute,
|
|
29
|
+
formRoute,
|
|
30
|
+
businessRuleRoute,
|
|
31
|
+
ruleLifecycleRoute,
|
|
32
|
+
runtimeDataRoute,
|
|
33
|
+
workflowRoute,
|
|
34
|
+
onlineJsRoute,
|
|
35
|
+
b2Route,
|
|
36
|
+
listViewRoute,
|
|
37
|
+
reportRoute,
|
|
38
|
+
];
|
|
39
|
+
export function dispatchFakeRoute(ctx, input) {
|
|
40
|
+
for (const route of LANE_ROUTES) {
|
|
41
|
+
const result = route(ctx, input);
|
|
42
|
+
if (result !== NOT_HANDLED)
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=routes.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { NOT_HANDLED } from "./state.js";
|
|
2
|
+
/**
|
|
3
|
+
* S25-rule-lifecycle lane: enable/disable/delete mutations. Twin of
|
|
4
|
+
* src/lanes/rule-lifecycle.ts. The platform quirk stands: `enabled` is the
|
|
5
|
+
* truth; `status` may still read DISABLED.
|
|
6
|
+
*/
|
|
7
|
+
export const ruleLifecycleRoute = (ctx, input) => {
|
|
8
|
+
const q = input.query ?? {};
|
|
9
|
+
const body = (input.body ?? {});
|
|
10
|
+
switch (input.path) {
|
|
11
|
+
case "/api/api/app/businessrule/publish": {
|
|
12
|
+
const targetId = q.id ?? body.id;
|
|
13
|
+
for (const rule of ctx.state.rules.values())
|
|
14
|
+
if (rule.id === targetId)
|
|
15
|
+
rule.enabled = true;
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
case "/api/api/app/businessrule/enable": {
|
|
19
|
+
// BusinessRuleKeyRequest {schemaCode, ruleCode} flips the DRAFT row's
|
|
20
|
+
// enable switch — the face the runtime dispatcher reads
|
|
21
|
+
// (getExecutableBySchemaCodeAndCode). The platform quirk stands:
|
|
22
|
+
// enabled is the truth; status may still read DISABLED.
|
|
23
|
+
const target = [...ctx.state.rules.values()].find((rule) => rule.schemaCode === body.schemaCode && rule.code === body.ruleCode);
|
|
24
|
+
if (target)
|
|
25
|
+
target.enabled = true;
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
case "/api/api/app/businessrule/delete":
|
|
29
|
+
for (const [code, rule] of ctx.state.rules)
|
|
30
|
+
if (rule.id === q.id)
|
|
31
|
+
ctx.state.rules.delete(code);
|
|
32
|
+
return null;
|
|
33
|
+
default:
|
|
34
|
+
return NOT_HANDLED;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=rule-lifecycle.js.map
|