@stalfh233/omc-fake-platform 0.4.71 → 0.4.72

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.
@@ -23,29 +23,42 @@ function selfCheckProblems(state, model) {
23
23
  catch {
24
24
  return [];
25
25
  }
26
- const known = new Set();
26
+ const publishedBySchema = new Map();
27
27
  for (const [key, field] of state.fields) {
28
28
  const [schema, code] = key.split("#");
29
- if (schema === schemaCode && field.published)
30
- known.add(String(code));
29
+ if (!field.published)
30
+ continue;
31
+ if (!publishedBySchema.has(schema))
32
+ publishedBySchema.set(schema, new Set());
33
+ publishedBySchema.get(schema).add(String(code));
31
34
  }
35
+ const known = publishedBySchema.get(schemaCode) ?? new Set();
32
36
  const problems = [];
33
37
  for (const node of nodes) {
34
38
  const actions = Array.isArray(node.dataActions) ? node.dataActions : [];
39
+ // UPDATE/CREATE nodes write into `targetObjectCode`; its fields are a
40
+ // DIFFERENT model's published set. Checking every dataAction against the
41
+ // rule's own schema made every cross-model UPDATE look broken (550018) —
42
+ // exactly the false positive the platform's checkBizRuleIsEnable does not
43
+ // produce.
44
+ const targetSchema = String(node.nodeType ?? "").toUpperCase() === "UPDATE" && node.targetObjectCode
45
+ ? String(node.targetObjectCode)
46
+ : schemaCode;
47
+ const targetKnown = targetSchema === schemaCode ? known : (publishedBySchema.get(targetSchema) ?? new Set());
35
48
  const missing = actions
36
49
  .map((action) => String(action.targetDataItem ?? ""))
37
- .filter((code) => code !== "" && !known.has(code));
50
+ .filter((code) => code !== "" && !targetKnown.has(code));
38
51
  if (missing.length > 0) {
39
52
  problems.push({
40
53
  schemaCode,
41
54
  nodeCode: node.nodeCode ?? "",
42
55
  nodeName: node.nodeName ?? "",
43
56
  notExistPropertyObjectList: [{
44
- objectCode: schemaCode,
45
- objectName: schemaCode,
57
+ objectCode: targetSchema,
58
+ objectName: targetSchema,
46
59
  objectType: 1,
47
60
  modelExist: true,
48
- quotePropertyList: missing.map((code) => ({ objectCode: schemaCode, objectName: schemaCode, propertyCode: code, propertyName: code, exist: false, propertyPublished: false })),
61
+ quotePropertyList: missing.map((code) => ({ objectCode: targetSchema, objectName: targetSchema, propertyCode: code, propertyName: code, exist: false, propertyPublished: false })),
49
62
  }],
50
63
  notExistOrgObjectList: [],
51
64
  deadCycleRunMapList: [],
@@ -64,8 +77,6 @@ export const ruleLifecycleRoute = (ctx, input) => {
64
77
  const targetId = q.id ?? body.id;
65
78
  const stored = [...ctx.state.rules.values()].find((rule) => rule.id === targetId);
66
79
  const model = { ...(stored ?? {}), ...body };
67
- if (process.env.FAKE_DEBUG_SELFCHECK)
68
- console.error("DEBUG body keys", Object.keys(body), "nodeType", typeof body.node, String(body.node ?? "").slice(0, 120), "known", [...ctx.state.fields.keys()].slice(0, 6));
69
80
  if (selfCheckProblems(ctx.state, model).length > 0)
70
81
  return businessRefusal(550018, "保存规则失败,规则存在异常,请点击检测并修正!");
71
82
  for (const rule of ctx.state.rules.values())
package/dist/workflow.js CHANGED
@@ -266,14 +266,21 @@ export const workflowRoute = (ctx, input) => {
266
266
  // must pin the identity fields yet store name_i18n verbatim.
267
267
  const stored = wf.template.activities;
268
268
  const storedByCode = new Map((Array.isArray(stored) ? stored : []).map((activity) => [String(activity.activityCode ?? ""), activity]));
269
+ // 8.6 pins activityName/type on an existing code; AI-Platform 1.1.x
270
+ // accepts an in-place retype/rename on the SAME code (live 2026-10-21,
271
+ // 1.1.25: END→PARTICIPANT kept Activity4 and read back with the new
272
+ // name). The version switch keeps the fake faithful to both families.
273
+ const pinsIdentity = !(String(ctx.options.version ?? "").startsWith("1."));
269
274
  const pinned = Array.isArray(body.activities)
270
275
  ? {
271
276
  ...body,
272
277
  activities: body.activities.map((activity) => {
273
278
  const prior = storedByCode.get(String(activity.activityCode ?? ""));
274
- return prior
279
+ if (!prior)
280
+ return activity;
281
+ return pinsIdentity
275
282
  ? { ...activity, activityName: prior.activityName, i18nMessage: prior.i18nMessage, activityType: prior.activityType, name_i18n: activity.name_i18n ?? prior.name_i18n }
276
- : activity;
283
+ : { ...activity, name_i18n: activity.name_i18n ?? prior.name_i18n };
277
284
  }),
278
285
  }
279
286
  : body;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-fake-platform",
3
- "version": "0.4.71",
3
+ "version": "0.4.72",
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.71"
21
+ "omc-core": "0.4.72"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=22.13"