@hcmai/sdk 0.21.12 → 0.21.13
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 +35 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13701,6 +13701,40 @@ function walk2(root, schema, value, segs, kind, issues, depth) {
|
|
|
13701
13701
|
}
|
|
13702
13702
|
}
|
|
13703
13703
|
}
|
|
13704
|
+
function validateScriptActionNames(doc, issues) {
|
|
13705
|
+
if (!doc || typeof doc !== "object" || !Array.isArray(doc.actions))
|
|
13706
|
+
return;
|
|
13707
|
+
const reserved = /* @__PURE__ */ new Set(["list", "get", "create", "update", "delete"]);
|
|
13708
|
+
const visited = /* @__PURE__ */ new Set();
|
|
13709
|
+
const visit = (raw, path24) => {
|
|
13710
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw) || visited.has(raw)) return;
|
|
13711
|
+
visited.add(raw);
|
|
13712
|
+
const action3 = raw;
|
|
13713
|
+
const type = typeof action3.type === "string" ? action3.type.toLowerCase() : action3.type;
|
|
13714
|
+
if (type === "script" && typeof action3.key === "string" && reserved.has(action3.key.trim().toLowerCase())) {
|
|
13715
|
+
issues.push({
|
|
13716
|
+
severity: "error",
|
|
13717
|
+
path: `${path24}.key`,
|
|
13718
|
+
message: `E_SCRIPT_ACTION_RESERVED_KEY: \u811A\u672C Action key '${action3.key}' \u4E0E CRUD \u4FDD\u7559\u540D\u51B2\u7A81\uFF08list/get/create/update/delete\uFF09`,
|
|
13719
|
+
hint: "\u6539\u7528\u4E1A\u52A1\u8BED\u4E49 key\uFF08\u5982 createBusinessRequest\uFF09\uFF0C\u5E76\u663E\u5F0F\u6388\u6743 action:<key>\uFF1BCRUD \u6743\u9650\u4E0E\u81EA\u5B9A\u4E49 Action \u6743\u9650\u72EC\u7ACB"
|
|
13720
|
+
});
|
|
13721
|
+
}
|
|
13722
|
+
if (type != null && type !== "composite") return;
|
|
13723
|
+
const composite = action3.composite;
|
|
13724
|
+
if (!composite || typeof composite !== "object") return;
|
|
13725
|
+
const steps = composite.steps;
|
|
13726
|
+
if (!Array.isArray(steps)) return;
|
|
13727
|
+
steps.forEach((step, index) => {
|
|
13728
|
+
const stepPath = `${path24}.composite.steps[${index}]`;
|
|
13729
|
+
visit(step, stepPath);
|
|
13730
|
+
if (step && typeof step === "object" && !Object.hasOwn(step, "type")) {
|
|
13731
|
+
visit(step.action, `${stepPath}.action`);
|
|
13732
|
+
}
|
|
13733
|
+
});
|
|
13734
|
+
};
|
|
13735
|
+
const actions = doc.actions;
|
|
13736
|
+
actions.forEach((action3, index) => visit(action3, `actions[${index}]`));
|
|
13737
|
+
}
|
|
13704
13738
|
function validateMetaContent(metaPath2, content) {
|
|
13705
13739
|
const issues = [];
|
|
13706
13740
|
const kind = metaKindFromPath(metaPath2);
|
|
@@ -13751,6 +13785,7 @@ function validateMetaContent(metaPath2, content) {
|
|
|
13751
13785
|
});
|
|
13752
13786
|
return mk();
|
|
13753
13787
|
}
|
|
13788
|
+
validateScriptActionNames(doc, issues);
|
|
13754
13789
|
walk2(schema, schema, doc, [], kind, issues, 0);
|
|
13755
13790
|
const rawLines = content.split("\n");
|
|
13756
13791
|
for (const issue of issues) {
|