@stalfh233/omc-cli 0.6.85 → 0.6.87
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/README.md +3 -2
- package/dist/batch-executor.js +236 -0
- package/dist/capability-overview.js +2 -2
- package/dist/cli.js +21 -3
- package/dist/discovery.js +50 -1
- package/dist/endpoints.js +16 -0
- package/dist/goal-plan.js +12 -0
- package/dist/goal-routes.js +20 -1
- package/dist/intent/capabilities/bizservice.js +507 -108
- package/dist/intent/cli.js +1 -1
- package/dist/intent/compiler.js +11 -4
- package/dist/intent/plan-apply.js +22 -5
- package/dist/intent/plan-file.js +1 -0
- package/dist/intent/readback.js +78 -1
- package/dist/intent/schema.js +1 -1
- package/dist/lanes/apply-changes.js +134 -252
- package/dist/lanes/b2-registration.js +61 -5
- package/dist/lanes/businessrule.js +8 -3
- package/dist/lanes/config-diff.js +9 -0
- package/dist/lanes/rule-lifecycle.js +37 -4
- package/dist/lanes/runtime-data-contract.js +2 -1
- package/dist/lanes/runtime-data.js +344 -107
- package/dist/lanes/runtime-paging.js +100 -0
- package/dist/package.js +8 -2
- package/dist/read-shapes.js +29 -10
- package/dist/recipes/b2-registration.js +1 -1
- package/dist/rollback.js +71 -20
- package/dist/rule-support.js +43 -1
- package/dist/service-support.js +57 -0
- package/dist/surface-ref.js +37 -0
- package/dist/write.js +5 -1
- package/docs/omc-introduction.md +1 -0
- package/package.json +3 -3
- package/skills/omc-capabilities.md +1 -0
|
@@ -6,20 +6,67 @@ import { sameValue } from "../compare.js";
|
|
|
6
6
|
import { isScalarString, pushError } from "../validation.js";
|
|
7
7
|
import { toPlain } from "../yaml.js";
|
|
8
8
|
import { errorDetail } from "../../tool-types.js";
|
|
9
|
-
const SERVICE_KEYS = new Set(["code", "name", "adapterCode", "serviceCategoryId", "serviceConfig", "method"]);
|
|
10
|
-
const METHOD_KEYS = new Set(["code", "name", "methodConfig", "inputParameters", "outputParameters"]);
|
|
9
|
+
const SERVICE_KEYS = new Set(["code", "name", "adapterCode", "serviceCategoryId", "serviceConfig", "method", "methods", "absent"]);
|
|
10
|
+
const METHOD_KEYS = new Set(["code", "name", "methodConfig", "inputParameters", "outputParameters", "absent"]);
|
|
11
|
+
/** Shape keys on a service — illegal next to `absent:true` (delete only identifies by code). */
|
|
12
|
+
const SERVICE_SHAPE_KEYS = ["name", "adapterCode", "serviceCategoryId", "serviceConfig", "method", "methods"];
|
|
13
|
+
/** Shape keys on a method — illegal next to `absent:true`. */
|
|
14
|
+
const METHOD_SHAPE_KEYS = ["name", "methodConfig", "inputParameters", "outputParameters"];
|
|
11
15
|
function configError(error) {
|
|
12
16
|
return errorDetail(error);
|
|
13
17
|
}
|
|
18
|
+
function asPresentService(service) {
|
|
19
|
+
if (service.absent === true || service.name === undefined || service.adapterCode === undefined || service.serviceCategoryId === undefined || service.serviceConfig === undefined)
|
|
20
|
+
refuse("intent-service-shape-incomplete", `业务服务 ${service.code} 缺 name/adapterCode/serviceCategoryId/serviceConfig——absent:true 的服务只删不建,present 服务必须给全 shape`, { resource: `service:${service.code}` });
|
|
21
|
+
return service;
|
|
22
|
+
}
|
|
23
|
+
function asPresentMethod(serviceCode, method) {
|
|
24
|
+
if (method.absent === true || method.name === undefined)
|
|
25
|
+
refuse("intent-method-shape-incomplete", `业务方法 ${serviceCode}/${method.code} 缺 name——absent:true 的方法只删不建,present 方法必须给 name`, {
|
|
26
|
+
resource: `method:${serviceCode}.${method.code}`,
|
|
27
|
+
});
|
|
28
|
+
return method;
|
|
29
|
+
}
|
|
30
|
+
/** Every method declaration a service carries (legacy `method` or `methods[]`), absent included. */
|
|
31
|
+
function declaredMethods(service) {
|
|
32
|
+
if (service.methods !== undefined)
|
|
33
|
+
return service.methods;
|
|
34
|
+
return service.method ? [service.method] : [];
|
|
35
|
+
}
|
|
36
|
+
/** Declarations that must be ensured present (absent ones are deletions, not shapes). */
|
|
37
|
+
function declaredPresentMethods(service) {
|
|
38
|
+
return declaredMethods(service).filter((method) => method.absent !== true);
|
|
39
|
+
}
|
|
40
|
+
function declaredAbsentMethods(service) {
|
|
41
|
+
return declaredMethods(service).filter((method) => method.absent === true);
|
|
42
|
+
}
|
|
14
43
|
function compileService(service) {
|
|
15
44
|
assertBizServiceAdapterWhitelisted(service.adapterCode);
|
|
16
45
|
const serviceConfig = compileServiceConfig(service.adapterCode, service.serviceConfig);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
46
|
+
// Offline adapter/config/parameter-face validation for EVERY declared method
|
|
47
|
+
// (the write tools re-run the same compile, this catches it before any wire).
|
|
48
|
+
for (const declared of declaredPresentMethods(service)) {
|
|
49
|
+
const method = asPresentMethod(service.code, declared);
|
|
50
|
+
if (method.methodConfig !== undefined)
|
|
51
|
+
compileMethodConfigPlain(service.adapterCode, method.methodConfig);
|
|
52
|
+
if (method.inputParameters !== undefined)
|
|
53
|
+
compileParameterFace(service.adapterCode, method.inputParameters, "methodInputParameters");
|
|
54
|
+
if (method.outputParameters !== undefined)
|
|
55
|
+
compileParameterFace(service.adapterCode, method.outputParameters, "methodOutputParameters");
|
|
56
|
+
}
|
|
57
|
+
return { serviceConfig };
|
|
58
|
+
}
|
|
59
|
+
/** Exact `method.create`/`method.update` args for one declared method (plaintext config; the tool AES-encrypts). */
|
|
60
|
+
function methodArgs(service, declared) {
|
|
61
|
+
const method = asPresentMethod(service.code, declared);
|
|
62
|
+
return {
|
|
63
|
+
serviceCode: service.code,
|
|
64
|
+
methodCode: method.code,
|
|
65
|
+
name: method.name,
|
|
66
|
+
...(method.methodConfig !== undefined ? { methodConfig: method.methodConfig } : {}),
|
|
67
|
+
...(method.inputParameters !== undefined ? { methodInputParameters: method.inputParameters } : {}),
|
|
68
|
+
...(method.outputParameters !== undefined ? { methodOutputParameters: method.outputParameters } : {}),
|
|
69
|
+
};
|
|
23
70
|
}
|
|
24
71
|
function serviceArgs(service) {
|
|
25
72
|
compileService(service);
|
|
@@ -29,7 +76,7 @@ function serviceArgs(service) {
|
|
|
29
76
|
adapterCode: service.adapterCode,
|
|
30
77
|
serviceCategoryId: service.serviceCategoryId,
|
|
31
78
|
serviceConfig: service.serviceConfig,
|
|
32
|
-
...(service.method ? {
|
|
79
|
+
...(service.method && service.method.absent !== true ? {
|
|
33
80
|
methodName: service.method.code,
|
|
34
81
|
methodConfig: service.method.methodConfig,
|
|
35
82
|
...(service.method.inputParameters ? { methodInputParameters: service.method.inputParameters } : {}),
|
|
@@ -55,34 +102,154 @@ function expectedParameterFace(adapterCode, parameters, label) {
|
|
|
55
102
|
return undefined;
|
|
56
103
|
return normalizeParameterFaceReadback(adapterCode, JSON.parse(compileParameterFace(adapterCode, parameters, label)));
|
|
57
104
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Parameter-face equivalence. An undeclared face, a platform `null`, and a
|
|
107
|
+
* stored EMPTY face (`[]`) all mean "no parameters": the real platform persists
|
|
108
|
+
* `inputParametersJson`/`outputParametersJson` as `[]` even when the intent
|
|
109
|
+
* declares none, while the fake answers `null` — comparing them raw produced
|
|
110
|
+
* phantom `method-mismatch` on live apply (W12A acceptance). A NON-EMPTY stored
|
|
111
|
+
* face still fails against an undeclared one.
|
|
112
|
+
*/
|
|
113
|
+
function sameParameterFace(live, expected) {
|
|
114
|
+
const empty = (value) => (value === undefined || value === null || (Array.isArray(value) && value.length === 0) ? [] : value);
|
|
115
|
+
return sameValue(empty(live), empty(expected));
|
|
116
|
+
}
|
|
117
|
+
function decodeColumn(value) {
|
|
118
|
+
if (typeof value !== "string")
|
|
119
|
+
return value;
|
|
120
|
+
try {
|
|
121
|
+
return JSON.parse(value);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function methodFaceFromRow(method, adapterCode) {
|
|
128
|
+
return {
|
|
70
129
|
code: String(method.code ?? ""),
|
|
71
130
|
present: true,
|
|
72
131
|
name: typeof method.name === "string" ? method.name : null,
|
|
73
|
-
methodConfig: normalizeMethodConfigReadback(adapterCode,
|
|
74
|
-
inputParameters: normalizeParameterFaceReadback(adapterCode,
|
|
75
|
-
outputParameters: normalizeParameterFaceReadback(adapterCode,
|
|
76
|
-
}
|
|
132
|
+
methodConfig: normalizeMethodConfigReadback(adapterCode, decodeColumn(method.configJson)),
|
|
133
|
+
inputParameters: normalizeParameterFaceReadback(adapterCode, decodeColumn(method.inputParametersJson)),
|
|
134
|
+
outputParameters: normalizeParameterFaceReadback(adapterCode, decodeColumn(method.outputParametersJson)),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Project the service row + declared methods. The legacy `method` slice keeps
|
|
139
|
+
* its historical shape (the key is OMITTED when a present method is live-absent)
|
|
140
|
+
* so old plans/readbacks stay byte-identical; a DECLARED-ABSENT legacy method is
|
|
141
|
+
* always projected (present:false) so the planner can see its live presence.
|
|
142
|
+
* `methods[]` rows are always present so the planner/readback can name every
|
|
143
|
+
* declared-but-missing code.
|
|
144
|
+
*/
|
|
145
|
+
function serviceFromRow(service, adapterCode, rowsByCode, declared) {
|
|
146
|
+
const legacyRow = declared.method ? rowsByCode.get(declared.method.code) : undefined;
|
|
77
147
|
return {
|
|
78
|
-
code: String(service
|
|
79
|
-
present:
|
|
80
|
-
name: typeof service
|
|
81
|
-
adapterCode: typeof service
|
|
82
|
-
serviceConfig:
|
|
83
|
-
...(
|
|
148
|
+
code: String(service.code ?? ""),
|
|
149
|
+
present: true,
|
|
150
|
+
name: typeof service.name === "string" ? service.name : null,
|
|
151
|
+
adapterCode: typeof service.adapterCode === "string" ? service.adapterCode : null,
|
|
152
|
+
serviceConfig: decodeColumn(service.configJson),
|
|
153
|
+
...(legacyRow
|
|
154
|
+
? { method: methodFaceFromRow(legacyRow, adapterCode) }
|
|
155
|
+
: declared.method?.absent === true
|
|
156
|
+
? { method: { code: declared.method.code, present: false, name: null } }
|
|
157
|
+
: {}),
|
|
158
|
+
...(declared.methods !== undefined ? {
|
|
159
|
+
methods: declared.methods.map((method) => {
|
|
160
|
+
const row = rowsByCode.get(method.code);
|
|
161
|
+
return row ? methodFaceFromRow(row, adapterCode) : { code: method.code, present: false, name: null };
|
|
162
|
+
}),
|
|
163
|
+
} : {}),
|
|
84
164
|
};
|
|
85
165
|
}
|
|
166
|
+
/** Platform reference count (F12): GET /app/bizmethod/count_mapping → Integer. */
|
|
167
|
+
async function countMapping(session, serviceCode, methodCode) {
|
|
168
|
+
const response = await wireCall(session, {
|
|
169
|
+
path: ENDPOINTS.bizMethodCountMapping,
|
|
170
|
+
query: { serviceCode, ...(methodCode !== undefined ? { serviceMethodCode: methodCode } : {}) },
|
|
171
|
+
});
|
|
172
|
+
const value = response.data;
|
|
173
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
174
|
+
return value;
|
|
175
|
+
const parsed = Number(value);
|
|
176
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
177
|
+
}
|
|
178
|
+
/** Cap the identity scan: only DECLARED-ABSENT methods that the platform already counts get here. */
|
|
179
|
+
const REFERENCE_SCAN_MODELS = 25;
|
|
180
|
+
const REFERENCE_SCAN_RULES = 50;
|
|
181
|
+
const REFERENCE_SITES_RETURNED = 8;
|
|
182
|
+
function mappedNodeCodes(nodeColumn, serviceCode, methodCode) {
|
|
183
|
+
const decoded = decodeColumn(nodeColumn);
|
|
184
|
+
if (!Array.isArray(decoded))
|
|
185
|
+
return [];
|
|
186
|
+
const nodeCodes = [];
|
|
187
|
+
for (const entry of decoded) {
|
|
188
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
189
|
+
continue;
|
|
190
|
+
const node = entry;
|
|
191
|
+
const mapping = node.methodMapping;
|
|
192
|
+
if (!mapping || typeof mapping !== "object" || Array.isArray(mapping))
|
|
193
|
+
continue;
|
|
194
|
+
const mapped = mapping;
|
|
195
|
+
if (String(mapped.serviceCode ?? "") !== serviceCode || String(mapped.serviceMethodCode ?? "") !== methodCode)
|
|
196
|
+
continue;
|
|
197
|
+
const nodeCode = String(node.nodeCode ?? "");
|
|
198
|
+
if (nodeCode !== "")
|
|
199
|
+
nodeCodes.push(nodeCode);
|
|
200
|
+
}
|
|
201
|
+
return nodeCodes;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Readable identity of a reference (ruleCode/nodeCode) for the method-delete
|
|
205
|
+
* warning. `count_mapping` is the authoritative count; this is only the label —
|
|
206
|
+
* every read is best-effort and a failure degrades to a pointer at
|
|
207
|
+
* `rule.references kind=service`, never to a wrong claim.
|
|
208
|
+
*/
|
|
209
|
+
async function referenceSitesOf(session, serviceCode, methodCode) {
|
|
210
|
+
let schemaCodes = [];
|
|
211
|
+
try {
|
|
212
|
+
const rows = wireRows((await wireCall(session, {
|
|
213
|
+
path: ENDPOINTS.bizServiceMethodViewReference,
|
|
214
|
+
query: { serviceCode, serviceMethodCode: methodCode },
|
|
215
|
+
})).data);
|
|
216
|
+
schemaCodes = [...new Set(rows.map((row) => String(row.schemaCode ?? "")).filter((code) => code !== ""))].slice(0, REFERENCE_SCAN_MODELS);
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
const sites = [];
|
|
222
|
+
for (const schemaCode of schemaCodes) {
|
|
223
|
+
let rules = [];
|
|
224
|
+
try {
|
|
225
|
+
rules = wireRows((await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode } })).data);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
for (const rule of rules.slice(0, REFERENCE_SCAN_RULES)) {
|
|
231
|
+
const ruleCode = String(rule.code ?? "");
|
|
232
|
+
const id = rule.id;
|
|
233
|
+
if (ruleCode === "" || typeof id !== "string" || id === "")
|
|
234
|
+
continue;
|
|
235
|
+
let record = null;
|
|
236
|
+
try {
|
|
237
|
+
record = (await wireCall(session, { path: ENDPOINTS.businessRuleGet, query: { id } })).data;
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if (!record)
|
|
243
|
+
continue;
|
|
244
|
+
for (const nodeCode of mappedNodeCodes(record.node, serviceCode, methodCode)) {
|
|
245
|
+
sites.push({ schemaCode, ruleCode, nodeCode });
|
|
246
|
+
if (sites.length >= REFERENCE_SITES_RETURNED)
|
|
247
|
+
return sites;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return sites;
|
|
252
|
+
}
|
|
86
253
|
function validateServiceNode(serviceNode, index, draft, validation) {
|
|
87
254
|
const base = `services[${index}]`;
|
|
88
255
|
for (const entry of serviceNode.entries)
|
|
@@ -95,8 +262,24 @@ function validateServiceNode(serviceNode, index, draft, validation) {
|
|
|
95
262
|
const categoryNode = value("serviceCategoryId");
|
|
96
263
|
const configNode = value("serviceConfig");
|
|
97
264
|
const methodNode = value("method");
|
|
265
|
+
const methodsNode = value("methods");
|
|
266
|
+
const absentNode = value("absent");
|
|
98
267
|
if (!isScalarString(codeNode) || codeNode.value.trim().length === 0)
|
|
99
268
|
pushError(validation, "intent-service-code-invalid", "service.code 必须是非空字符串", `${base}.code`, "value");
|
|
269
|
+
if (absentNode !== undefined && !(absentNode.kind === "scalar" && absentNode.value === true))
|
|
270
|
+
pushError(validation, "intent-service-absent-invalid", "service.absent 只能写 true(显式缺席是声明式删除的唯一写法;恢复服务请整条去掉 absent)", `${base}.absent`, "value");
|
|
271
|
+
const absent = absentNode?.kind === "scalar" && absentNode.value === true;
|
|
272
|
+
if (absent) {
|
|
273
|
+
// A delete target is identified by code alone. Declaring shape (or methods)
|
|
274
|
+
// next to absent:true is refused exactly once here: a cascaded method delete
|
|
275
|
+
// would otherwise silently exceed what the intent declares.
|
|
276
|
+
const shapeKeys = SERVICE_SHAPE_KEYS.filter((key) => value(key) !== undefined);
|
|
277
|
+
if (shapeKeys.length > 0)
|
|
278
|
+
pushError(validation, "intent-service-absent-with-shape", `absent:true 的业务服务只认 code,不能再声明 ${shapeKeys.map((key) => `"${key}"`).join(" / ")}——服务删除会由平台级联删掉其下所有方法(BizServiceServiceImpl.java:259-273),方法声明会超出本次删除粒度;要删单个方法请保留服务并声明 methods[].absent`, `${base}.${shapeKeys[0]}`, "value");
|
|
279
|
+
if (validation.errors.length === 0 && isScalarString(codeNode))
|
|
280
|
+
draft.services.push({ code: codeNode.value.trim(), absent: true });
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
100
283
|
if (!isScalarString(nameNode) || nameNode.value.trim().length === 0)
|
|
101
284
|
pushError(validation, "intent-service-name-invalid", "service.name 必须是非空字符串", `${base}.name`, "value");
|
|
102
285
|
if (!isScalarString(adapterNode) || adapterNode.value.trim().length === 0)
|
|
@@ -107,57 +290,118 @@ function validateServiceNode(serviceNode, index, draft, validation) {
|
|
|
107
290
|
pushError(validation, "intent-service-config-invalid", "service.serviceConfig 必须是映射", `${base}.serviceConfig`, "value");
|
|
108
291
|
if (methodNode !== undefined && methodNode.kind !== "map")
|
|
109
292
|
pushError(validation, "intent-service-method-invalid", "service.method 必须是映射", `${base}.method`, "value");
|
|
293
|
+
if (methodsNode !== undefined && methodsNode.kind !== "seq")
|
|
294
|
+
pushError(validation, "intent-service-methods-invalid", "service.methods 必须是列表", `${base}.methods`, "value");
|
|
295
|
+
if (methodNode !== undefined && methodsNode !== undefined)
|
|
296
|
+
pushError(validation, "intent-service-method-both", "service.method 与 service.methods 互斥:单方法(methodName==code)用 method,多方法或给既有服务加方法用 methods", `${base}.methods`, "value");
|
|
110
297
|
if (!isScalarString(codeNode) || !isScalarString(nameNode) || !isScalarString(adapterNode) || !isScalarString(categoryNode) || configNode?.kind !== "map")
|
|
111
298
|
return;
|
|
112
299
|
const serviceConfig = toPlain(configNode);
|
|
300
|
+
/** Parse one method map; `legacy` enforces the service.register name==code constraint. */
|
|
301
|
+
const parseMethod = (map, path, legacy) => {
|
|
302
|
+
for (const entry of map.entries)
|
|
303
|
+
if (!METHOD_KEYS.has(entry.key))
|
|
304
|
+
pushError(validation, "intent-key-unknown", `${path} 不支持键 "${entry.key}"`, `${path}.${entry.key}`);
|
|
305
|
+
const methodValue = (key) => map.entries.find((entry) => entry.key === key)?.value;
|
|
306
|
+
const methodCode = methodValue("code");
|
|
307
|
+
const methodAbsentNode = methodValue("absent");
|
|
308
|
+
const methodName = methodValue("name");
|
|
309
|
+
const methodConfig = methodValue("methodConfig");
|
|
310
|
+
const input = methodValue("inputParameters");
|
|
311
|
+
const output = methodValue("outputParameters");
|
|
312
|
+
if (methodAbsentNode !== undefined && !(methodAbsentNode.kind === "scalar" && methodAbsentNode.value === true))
|
|
313
|
+
pushError(validation, "intent-method-absent-invalid", `${path}.absent 只能写 true(显式缺席是声明式删除的唯一写法)`, `${path}.absent`, "value");
|
|
314
|
+
const methodAbsent = methodAbsentNode?.kind === "scalar" && methodAbsentNode.value === true;
|
|
315
|
+
if (!isScalarString(methodCode) || methodCode.value.trim().length === 0)
|
|
316
|
+
pushError(validation, "intent-method-code-invalid", `${path}.code 必须是非空字符串`, `${path}.code`, "value");
|
|
317
|
+
if (methodAbsent) {
|
|
318
|
+
const shapeKeys = METHOD_SHAPE_KEYS.filter((key) => methodValue(key) !== undefined);
|
|
319
|
+
if (shapeKeys.length > 0)
|
|
320
|
+
pushError(validation, "intent-method-absent-with-shape", `absent:true 的业务方法只认 code,不能再声明 ${shapeKeys.map((key) => `"${key}"`).join(" / ")}——方法删除是原子删除,没有可收敛的 shape;要用方法请去掉 absent 并给 name/config`, `${path}.${shapeKeys[0]}`, "value");
|
|
321
|
+
return isScalarString(methodCode) ? { code: methodCode.value.trim(), absent: true } : undefined;
|
|
322
|
+
}
|
|
323
|
+
if (!isScalarString(methodName) || methodName.value.trim().length === 0)
|
|
324
|
+
pushError(validation, "intent-method-name-invalid", `${path}.name 必须是非空字符串`, `${path}.name`, "value");
|
|
325
|
+
if (methodConfig !== undefined && methodConfig.kind !== "map")
|
|
326
|
+
pushError(validation, "intent-method-config-invalid", `${path}.methodConfig 必须是映射`, `${path}.methodConfig`, "value");
|
|
327
|
+
if (input !== undefined && input.kind !== "seq")
|
|
328
|
+
pushError(validation, "intent-method-input-invalid", `${path}.inputParameters 必须是列表`, `${path}.inputParameters`, "value");
|
|
329
|
+
if (output !== undefined && output.kind !== "seq")
|
|
330
|
+
pushError(validation, "intent-method-output-invalid", `${path}.outputParameters 必须是列表`, `${path}.outputParameters`, "value");
|
|
331
|
+
if (!isScalarString(methodCode) || !isScalarString(methodName))
|
|
332
|
+
return undefined;
|
|
333
|
+
if (legacy && methodCode.value.trim() !== methodName.value.trim())
|
|
334
|
+
pushError(validation, "intent-method-name-code-mismatch", "当前 service.register 面 methodName 同时作为方法 code/name;method.name 必须等于 method.code(多方法且 name≠code 用 methods[])", `${path}.name`, "value");
|
|
335
|
+
return {
|
|
336
|
+
code: methodCode.value.trim(),
|
|
337
|
+
name: methodName.value.trim(),
|
|
338
|
+
...(methodConfig?.kind === "map" ? { methodConfig: toPlain(methodConfig) } : {}),
|
|
339
|
+
...(input?.kind === "seq" ? { inputParameters: input.items.map((item) => toPlain(item)) } : {}),
|
|
340
|
+
...(output?.kind === "seq" ? { outputParameters: output.items.map((item) => toPlain(item)) } : {}),
|
|
341
|
+
};
|
|
342
|
+
};
|
|
113
343
|
let method;
|
|
344
|
+
let methods;
|
|
114
345
|
try {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
...(output?.kind === "seq" ? { outputParameters: output.items.map((item) => toPlain(item)) } : {}),
|
|
145
|
-
};
|
|
146
|
-
}
|
|
346
|
+
if (methodNode?.kind === "map")
|
|
347
|
+
method = parseMethod(methodNode, `${base}.method`, true);
|
|
348
|
+
if (methodsNode?.kind === "seq") {
|
|
349
|
+
const seenCodes = new Map();
|
|
350
|
+
const parsed = [];
|
|
351
|
+
methodsNode.items.forEach((item, methodIndex) => {
|
|
352
|
+
const path = `${base}.methods[${methodIndex}]`;
|
|
353
|
+
if (item.kind !== "map") {
|
|
354
|
+
pushError(validation, "intent-service-method-invalid", "service.methods 每项必须是映射", path, "value");
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const parsedMethod = parseMethod(item, path, false);
|
|
358
|
+
if (!parsedMethod)
|
|
359
|
+
return;
|
|
360
|
+
const methodAbsent = parsedMethod.absent === true;
|
|
361
|
+
const seenBefore = seenCodes.get(parsedMethod.code);
|
|
362
|
+
if (seenBefore !== undefined) {
|
|
363
|
+
// Same code declared both as a deletion and as a shape: the plan would
|
|
364
|
+
// be ambiguous (delete-first vs ensure-present). Refuse, don't guess.
|
|
365
|
+
if (seenBefore !== methodAbsent)
|
|
366
|
+
pushError(validation, "intent-method-absent-conflict", `service.methods 内同一 code 不能既声明 absent:true 又声明为要保留的方法:${parsedMethod.code}(想删就只写 code+absent;想留就只写一次完整 shape)`, `${path}.code`, "value");
|
|
367
|
+
else
|
|
368
|
+
pushError(validation, "intent-method-code-duplicate", `service.methods 内方法 code 重复:${parsedMethod.code}`, `${path}.code`, "value");
|
|
369
|
+
}
|
|
370
|
+
seenCodes.set(parsedMethod.code, methodAbsent);
|
|
371
|
+
parsed.push(parsedMethod);
|
|
372
|
+
});
|
|
373
|
+
if (parsed.length > 0)
|
|
374
|
+
methods = parsed;
|
|
147
375
|
}
|
|
148
|
-
compileService({
|
|
376
|
+
compileService({
|
|
377
|
+
code: codeNode.value.trim(),
|
|
378
|
+
name: nameNode.value.trim(),
|
|
379
|
+
adapterCode: adapterNode.value.trim(),
|
|
380
|
+
serviceCategoryId: categoryNode.value.trim(),
|
|
381
|
+
serviceConfig,
|
|
382
|
+
...(method ? { method } : {}),
|
|
383
|
+
...(methods ? { methods } : {}),
|
|
384
|
+
});
|
|
149
385
|
}
|
|
150
386
|
catch (error) {
|
|
151
387
|
pushError(validation, "intent-service-config-unsupported", configError(error), base, "value");
|
|
152
388
|
return;
|
|
153
389
|
}
|
|
154
|
-
draft.services.push({
|
|
390
|
+
draft.services.push({
|
|
391
|
+
code: codeNode.value.trim(),
|
|
392
|
+
name: nameNode.value.trim(),
|
|
393
|
+
adapterCode: adapterNode.value.trim(),
|
|
394
|
+
serviceCategoryId: categoryNode.value.trim(),
|
|
395
|
+
serviceConfig,
|
|
396
|
+
...(method ? { method } : {}),
|
|
397
|
+
...(methods ? { methods } : {}),
|
|
398
|
+
});
|
|
155
399
|
}
|
|
156
400
|
export const bizserviceCapability = {
|
|
157
401
|
id: "bizservice",
|
|
158
402
|
title: "业务集成",
|
|
159
403
|
requires: [],
|
|
160
|
-
operations: ["register"],
|
|
404
|
+
operations: ["register", "method.create", "method.update", "method.delete", "delete"],
|
|
161
405
|
validateRoot(tree, draft, validation) {
|
|
162
406
|
const servicesNode = tree.entries.find((entry) => entry.key === "services")?.value;
|
|
163
407
|
if (servicesNode === undefined || (servicesNode.kind === "scalar" && servicesNode.value === null))
|
|
@@ -197,12 +441,42 @@ export const bizserviceCapability = {
|
|
|
197
441
|
result.push({ code: service.code, present: false, name: null, adapterCode: null });
|
|
198
442
|
continue;
|
|
199
443
|
}
|
|
200
|
-
|
|
201
|
-
|
|
444
|
+
if (service.absent === true) {
|
|
445
|
+
// A declared-absent service only needs presence + the platform reference
|
|
446
|
+
// count (F12, the UI's own delete gate). This read FAILS CLOSED: an
|
|
447
|
+
// unreadable count must not be read as "zero references, safe to delete".
|
|
448
|
+
const referenceCount = await countMapping(session, service.code);
|
|
449
|
+
result.push({
|
|
450
|
+
code: String(row.code ?? service.code),
|
|
451
|
+
present: true,
|
|
452
|
+
name: typeof row.name === "string" ? row.name : null,
|
|
453
|
+
adapterCode: typeof row.adapterCode === "string" ? row.adapterCode : null,
|
|
454
|
+
...(referenceCount > 0 ? { referenceCount } : {}),
|
|
455
|
+
});
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
// One method-list read covers every declared method (legacy `method` or
|
|
459
|
+
// `methods[]`, absent ones included so their live presence is baseline);
|
|
460
|
+
// `filterFlag:false` keeps platform-injected parameters raw.
|
|
461
|
+
const wanted = declaredMethods(service);
|
|
462
|
+
const rowsByCode = new Map();
|
|
463
|
+
if (wanted.length > 0) {
|
|
202
464
|
const rows = wireRows((await wireCall(session, { path: ENDPOINTS.bizServiceMethodList, query: { serviceCode: service.code, filterFlag: "false" } })).data);
|
|
203
|
-
|
|
465
|
+
for (const candidate of rows)
|
|
466
|
+
if (typeof candidate.code === "string")
|
|
467
|
+
rowsByCode.set(candidate.code, candidate);
|
|
204
468
|
}
|
|
205
|
-
|
|
469
|
+
const entry = serviceFromRow(row, String(row.adapterCode ?? service.adapterCode), rowsByCode, service);
|
|
470
|
+
// Method-level reference counts are read ONLY for methods the intent
|
|
471
|
+
// declares absent: the platform's own method-delete gate (500108) stays
|
|
472
|
+
// authoritative, this only labels the warning. A failed count never blocks
|
|
473
|
+
// the plan — the field is omitted with a note (and count_mapping=0 means
|
|
474
|
+
// "no mapping rows", so an omission must not be read as a clean bill).
|
|
475
|
+
const absentCodes = declaredAbsentMethods(service).map((method) => method.code);
|
|
476
|
+
if (absentCodes.length > 0)
|
|
477
|
+
result.push(await withMethodReferences(session, entry, service, absentCodes));
|
|
478
|
+
else
|
|
479
|
+
result.push(entry);
|
|
206
480
|
}
|
|
207
481
|
return result;
|
|
208
482
|
},
|
|
@@ -211,40 +485,76 @@ export const bizserviceCapability = {
|
|
|
211
485
|
const current = baseline.services ?? [];
|
|
212
486
|
for (const service of services) {
|
|
213
487
|
const live = current.find((entry) => entry.code === service.code);
|
|
214
|
-
const args = serviceArgs(service);
|
|
215
488
|
const resource = `service:${service.code}`;
|
|
489
|
+
if (service.absent === true) {
|
|
490
|
+
if (!live?.present) {
|
|
491
|
+
emit.skip(resource, "service-absent");
|
|
492
|
+
continue; // already gone: nothing to delete, and no method.delete either
|
|
493
|
+
}
|
|
494
|
+
// HARD GATE (fail closed): the platform deletes a referenced service
|
|
495
|
+
// without any check (BizServiceController.java:139-160 + BizServiceFacadeImpl
|
|
496
|
+
// .java:248-257) while the designer blocks it with this same count. Letting
|
|
497
|
+
// it through breaks the referencing rules (their next save is refused:
|
|
498
|
+
// BusinessRuleFacadeImpl.java:370-381) and leaves stale mapping rows.
|
|
499
|
+
const referenceCount = live.referenceCount ?? 0;
|
|
500
|
+
if (referenceCount > 0)
|
|
501
|
+
refuse("intent-service-referenced", `业务服务 ${service.code} 仍被 ${referenceCount} 条规则映射引用(平台删服务不做任何引用校验,但删完后引用它的规则会存不回去)。两条路:①推荐——先把引用规则里的服务节点解绑并 apply(rule.save),再单独 apply 本删除;②确知要绕过声明式门:omc call service.delete --args '{"serviceCode":"${service.code}"}'(平台会级联删方法且留下 h_biz_method_mapping 残留,同码重建后方法仍可能 500108)。注意一次 apply 不能既解绑又删服务:bizservice 能力早于 businessrule 执行`, { resource, serviceCode: service.code, referenceCount });
|
|
502
|
+
emit.change("service.delete", { serviceCode: service.code }, resource, "service-declared-absent");
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
const present = asPresentService(service);
|
|
506
|
+
const absentMethods = declaredAbsentMethods(present);
|
|
507
|
+
const presentMethods = declaredPresentMethods(present);
|
|
216
508
|
if (!live?.present) {
|
|
217
|
-
|
|
509
|
+
// A brand-new service: `method` rides the legacy service.register payload
|
|
510
|
+
// (methodName==code), while `methods[]` registers the service alone and
|
|
511
|
+
// adds each method through method.create after it exists. Absent methods
|
|
512
|
+
// on a service that does not exist are already satisfied.
|
|
513
|
+
emit.change("service.register", serviceArgs(present), resource, "service-absent");
|
|
514
|
+
for (const method of declaredPresentMethods(present).filter((candidate) => present.methods !== undefined))
|
|
515
|
+
emit.change("method.create", methodArgs(present, method), `method:${present.code}.${method.code}`, "method-absent");
|
|
516
|
+
for (const method of absentMethods)
|
|
517
|
+
emit.skip(`method:${present.code}.${method.code}`, "method-absent");
|
|
218
518
|
continue;
|
|
219
519
|
}
|
|
220
520
|
// An existing service is patched, not recreated. adapterCode is fixed at
|
|
221
521
|
// creation (the update face derives it from the stored row), so a declared
|
|
222
522
|
// adapter change is a genuine refusal.
|
|
223
|
-
if (live.adapterCode !==
|
|
224
|
-
refuse("intent-service-adapter-immutable", `业务服务 ${
|
|
225
|
-
if (live.name !==
|
|
226
|
-
emit.change("service.update", { serviceCode:
|
|
523
|
+
if (live.adapterCode !== present.adapterCode)
|
|
524
|
+
refuse("intent-service-adapter-immutable", `业务服务 ${present.code} 的 adapterCode 已固定为 ${live.adapterCode ?? "(未知)"},意图声明 ${present.adapterCode}——adapter 创建后不可迁移;修正意图或走 omc call`, { resource });
|
|
525
|
+
if (live.name !== present.name || !sameValue(live.serviceConfig, present.serviceConfig))
|
|
526
|
+
emit.change("service.update", { serviceCode: present.code, name: present.name, serviceConfig: present.serviceConfig }, resource, "service-drift");
|
|
227
527
|
else
|
|
228
528
|
emit.skip(resource, "service-present");
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
529
|
+
// Declared deletions come FIRST: same-service "drop A, add B" must not
|
|
530
|
+
// collide on a downstream create that reuses codes.
|
|
531
|
+
for (const declared of absentMethods) {
|
|
532
|
+
const methodResource = `method:${present.code}.${declared.code}`;
|
|
533
|
+
const liveMethod = liveMethodOf(live, present, declared.code);
|
|
534
|
+
if (!liveMethod?.present) {
|
|
535
|
+
emit.skip(methodResource, "method-absent");
|
|
536
|
+
continue;
|
|
537
|
+
}
|
|
538
|
+
if ((liveMethod.referenceCount ?? 0) > 0)
|
|
539
|
+
emit.warn(methodResource, methodReferencedWarning(present.code, declared.code, liveMethod), "method-referenced");
|
|
540
|
+
emit.change("method.delete", { serviceCode: present.code, methodCode: declared.code }, methodResource, "method-declared-absent");
|
|
541
|
+
}
|
|
542
|
+
// Every declared present method is ensured present: absent -> method.create,
|
|
543
|
+
// drift -> method.update, converged -> skip. This is what lets an existing
|
|
544
|
+
// service receive new methods declaratively.
|
|
545
|
+
for (const declared of presentMethods) {
|
|
546
|
+
const method = asPresentMethod(present.code, declared);
|
|
547
|
+
const methodResource = `method:${present.code}.${method.code}`;
|
|
548
|
+
const liveMethod = liveMethodOf(live, present, method.code);
|
|
549
|
+
if (!liveMethod?.present) {
|
|
550
|
+
emit.change("method.create", methodArgs(present, method), methodResource, "method-absent");
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
if (liveMethod.name !== method.name || !sameValue(liveMethod.methodConfig, expectedMethodConfig(present.adapterCode, method.methodConfig)) || !sameParameterFace(liveMethod.inputParameters, expectedParameterFace(present.adapterCode, method.inputParameters, "methodInputParameters")) || !sameParameterFace(liveMethod.outputParameters, expectedParameterFace(present.adapterCode, method.outputParameters, "methodOutputParameters")))
|
|
554
|
+
emit.change("method.update", methodArgs(present, method), methodResource, "method-drift");
|
|
555
|
+
else
|
|
556
|
+
emit.skip(methodResource, "method-present");
|
|
557
|
+
}
|
|
248
558
|
}
|
|
249
559
|
},
|
|
250
560
|
decodeRoot(baseline, live) {
|
|
@@ -252,23 +562,112 @@ export const bizserviceCapability = {
|
|
|
252
562
|
live.services = baseline.services.map((service) => ({ ...service }));
|
|
253
563
|
},
|
|
254
564
|
compareRoot(intent, live, emit) {
|
|
255
|
-
|
|
565
|
+
(intent.services ?? []).forEach((service, serviceIndex) => {
|
|
256
566
|
const current = live.services?.find((entry) => entry.code === service.code);
|
|
257
567
|
const resource = `service:${service.code}`;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
568
|
+
const basePath = `services[${serviceIndex}]`;
|
|
569
|
+
if (service.absent === true) {
|
|
570
|
+
if (current?.present)
|
|
571
|
+
emit.difference("service-present-unexpected", resource, `业务服务 ${service.code} 仍存在(absent:true 要求删除)`, {
|
|
572
|
+
sourceTool: "service.delete",
|
|
573
|
+
sourcePath: basePath,
|
|
574
|
+
next: { kind: "edit-intent" },
|
|
575
|
+
safeToReplan: true,
|
|
576
|
+
});
|
|
577
|
+
return;
|
|
261
578
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
579
|
+
const present = asPresentService(service);
|
|
580
|
+
if (!current?.present) {
|
|
581
|
+
emit.difference("service-missing", resource, `业务服务 ${service.code} 不存在`, {
|
|
582
|
+
sourceTool: "service.register",
|
|
583
|
+
sourcePath: basePath,
|
|
584
|
+
next: { kind: "replan", command: "omc intent plan <intent.yaml> --env <env>" },
|
|
585
|
+
safeToReplan: true,
|
|
586
|
+
});
|
|
587
|
+
return;
|
|
270
588
|
}
|
|
271
|
-
|
|
589
|
+
if (current.name !== present.name || current.adapterCode !== present.adapterCode || !sameValue(current.serviceConfig, present.serviceConfig))
|
|
590
|
+
emit.difference("service-mismatch", resource, `业务服务 ${service.code} 的名称/适配器/configJson 不等价`, {
|
|
591
|
+
sourceTool: "service.update",
|
|
592
|
+
sourcePath: basePath,
|
|
593
|
+
next: { kind: "replan", command: "omc intent plan <intent.yaml> --env <env>" },
|
|
594
|
+
safeToReplan: true,
|
|
595
|
+
});
|
|
596
|
+
const usesMethodsArray = service.methods !== undefined;
|
|
597
|
+
declaredMethods(service).forEach((declared, methodIndex) => {
|
|
598
|
+
const methodResource = `method:${service.code}.${declared.code}`;
|
|
599
|
+
const sourcePath = `${basePath}.${usesMethodsArray ? `methods[${methodIndex}]` : "method"}`;
|
|
600
|
+
const method = liveMethodOf(current, present, declared.code);
|
|
601
|
+
if (declared.absent === true) {
|
|
602
|
+
if (method?.present)
|
|
603
|
+
emit.difference("method-present-unexpected", methodResource, `业务方法 ${service.code}/${declared.code} 仍存在(absent:true 要求删除)`, {
|
|
604
|
+
sourceTool: "method.delete",
|
|
605
|
+
sourcePath,
|
|
606
|
+
next: { kind: "edit-intent" },
|
|
607
|
+
safeToReplan: true,
|
|
608
|
+
});
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
const methodPresent = asPresentMethod(service.code, declared);
|
|
612
|
+
if (!method?.present) {
|
|
613
|
+
emit.difference("method-missing", methodResource, `业务方法 ${service.code}/${declared.code} 不存在`, {
|
|
614
|
+
sourceTool: "method.create",
|
|
615
|
+
sourcePath,
|
|
616
|
+
next: { kind: "replan", command: "omc intent plan <intent.yaml> --env <env>" },
|
|
617
|
+
safeToReplan: true,
|
|
618
|
+
});
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
if (method.name !== methodPresent.name || !sameValue(method.methodConfig, expectedMethodConfig(present.adapterCode, methodPresent.methodConfig)) || !sameParameterFace(method.inputParameters, expectedParameterFace(present.adapterCode, methodPresent.inputParameters, "methodInputParameters")) || !sameParameterFace(method.outputParameters, expectedParameterFace(present.adapterCode, methodPresent.outputParameters, "methodOutputParameters")))
|
|
622
|
+
emit.difference("method-mismatch", methodResource, `业务方法 ${service.code}/${declared.code} 不等价`, {
|
|
623
|
+
sourceTool: "method.update",
|
|
624
|
+
sourcePath,
|
|
625
|
+
next: { kind: "replan", command: "omc intent plan <intent.yaml> --env <env>" },
|
|
626
|
+
safeToReplan: true,
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
});
|
|
272
630
|
},
|
|
273
631
|
};
|
|
632
|
+
/** The baseline row for one method code, honoring the legacy `method` vs `methods[]` projection. */
|
|
633
|
+
function liveMethodOf(service, declared, methodCode) {
|
|
634
|
+
if (declared.methods !== undefined)
|
|
635
|
+
return service.methods?.find((entry) => entry.code === methodCode);
|
|
636
|
+
return service.method?.code === methodCode ? service.method : undefined;
|
|
637
|
+
}
|
|
638
|
+
function methodReferencedWarning(serviceCode, methodCode, liveMethod) {
|
|
639
|
+
const count = liveMethod.referenceCount ?? 0;
|
|
640
|
+
const sites = liveMethod.referenceSites ?? [];
|
|
641
|
+
const identity = sites.length > 0
|
|
642
|
+
? `;引用点:${sites.slice(0, 3).map((site) => `${site.schemaCode}/${site.ruleCode}#${site.nodeCode}`).join("、")}${sites.length > 3 ? ` 等 ${sites.length} 处` : ""}`
|
|
643
|
+
: `;定位:omc call rule.references --args '{"kind":"service","code":"${serviceCode}"}'`;
|
|
644
|
+
return `业务方法 ${serviceCode}/${methodCode} 仍被 ${count} 条规则映射引用——平台删除会回 500108「业务方法已绑定默认方法,不可删除」(BizServiceMethodController.java:248-281),apply 会在该步原样失败且不删任何东西。先解绑引用规则(rule.save 去掉对应 BIZ_ACTION 节点)并 apply,再删方法${identity}`;
|
|
645
|
+
}
|
|
646
|
+
/** Attach method-level reference counts (+ readable sites) to declared-absent methods of a present service. */
|
|
647
|
+
async function withMethodReferences(session, entry, declared, absentCodes) {
|
|
648
|
+
const counts = new Map();
|
|
649
|
+
const failed = new Set();
|
|
650
|
+
for (const code of absentCodes) {
|
|
651
|
+
try {
|
|
652
|
+
counts.set(code, await countMapping(session, declared.code, code));
|
|
653
|
+
}
|
|
654
|
+
catch {
|
|
655
|
+
failed.add(code);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
const annotate = async (method) => {
|
|
659
|
+
if (!absentCodes.includes(method.code) || !method.present)
|
|
660
|
+
return method;
|
|
661
|
+
if (failed.has(method.code))
|
|
662
|
+
return { ...method, referenceCountNote: "count_mapping 读取失败:方法级引用计数未知(不阻塞 plan;平台 500108 仍是权威删除门)" };
|
|
663
|
+
const count = counts.get(method.code) ?? 0;
|
|
664
|
+
if (count <= 0)
|
|
665
|
+
return method;
|
|
666
|
+
const sites = await referenceSitesOf(session, declared.code, method.code);
|
|
667
|
+
return { ...method, referenceCount: count, ...(sites.length > 0 ? { referenceSites: sites } : {}) };
|
|
668
|
+
};
|
|
669
|
+
const methods = entry.methods === undefined ? undefined : await Promise.all(entry.methods.map(annotate));
|
|
670
|
+
const method = entry.method === undefined ? undefined : await annotate(entry.method);
|
|
671
|
+
return { ...entry, ...(method !== undefined ? { method } : {}), ...(methods !== undefined ? { methods } : {}) };
|
|
672
|
+
}
|
|
274
673
|
//# sourceMappingURL=bizservice.js.map
|