@lark-apaas/fullstack-cli 1.1.71-alpha.20261103101658 → 1.1.71-alpha.20261103103857
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 +32 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5606,13 +5606,31 @@ function isZodLikeSchema(value) {
|
|
|
5606
5606
|
function isLegacyManifest(manifest) {
|
|
5607
5607
|
return manifest.formActions === void 0 && manifest.hasValidateForm === void 0;
|
|
5608
5608
|
}
|
|
5609
|
+
var DEFAULT_FORM_ISSUE_CODE = "VALIDATION_FAILED";
|
|
5609
5610
|
var ISSUE_SEVERITIES = /* @__PURE__ */ new Set(["error", "warning"]);
|
|
5610
|
-
function
|
|
5611
|
+
function normalizeIssue(issue) {
|
|
5611
5612
|
if (!issue || typeof issue !== "object" || Array.isArray(issue)) {
|
|
5612
|
-
return
|
|
5613
|
+
return void 0;
|
|
5613
5614
|
}
|
|
5614
5615
|
const { code, severity, message, path: path28 } = issue;
|
|
5615
|
-
|
|
5616
|
+
if (typeof message !== "string" || message === "") {
|
|
5617
|
+
return void 0;
|
|
5618
|
+
}
|
|
5619
|
+
if (code !== void 0 && (typeof code !== "string" || code === "")) {
|
|
5620
|
+
return void 0;
|
|
5621
|
+
}
|
|
5622
|
+
if (severity !== void 0 && !ISSUE_SEVERITIES.has(severity)) {
|
|
5623
|
+
return void 0;
|
|
5624
|
+
}
|
|
5625
|
+
if (path28 !== void 0 && typeof path28 !== "string") {
|
|
5626
|
+
return void 0;
|
|
5627
|
+
}
|
|
5628
|
+
return {
|
|
5629
|
+
...issue,
|
|
5630
|
+
code: code ?? DEFAULT_FORM_ISSUE_CODE,
|
|
5631
|
+
severity: severity ?? "error",
|
|
5632
|
+
message
|
|
5633
|
+
};
|
|
5616
5634
|
}
|
|
5617
5635
|
function normalizeIssues(raw) {
|
|
5618
5636
|
const issues = raw?.issues;
|
|
@@ -5622,15 +5640,17 @@ function normalizeIssues(raw) {
|
|
|
5622
5640
|
"validateForm returned an unexpected shape: expected { issues: FormIssue[] }"
|
|
5623
5641
|
);
|
|
5624
5642
|
}
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5643
|
+
return issues.map((rawIssue, index) => {
|
|
5644
|
+
const issue = normalizeIssue(rawIssue);
|
|
5645
|
+
if (!issue) {
|
|
5646
|
+
throw new FormCliError(
|
|
5647
|
+
FormCliErrorCode.VALIDATION_EXECUTION_FAILED,
|
|
5648
|
+
`validateForm returned a malformed issue at index ${index}: message must be a non-empty string; code, if given, must be a non-empty string; severity, if given, must be "error" or "warning"`,
|
|
5649
|
+
{ details: { issue: rawIssue } }
|
|
5650
|
+
);
|
|
5651
|
+
}
|
|
5652
|
+
return issue;
|
|
5653
|
+
});
|
|
5634
5654
|
}
|
|
5635
5655
|
async function runValidate(options) {
|
|
5636
5656
|
const timeoutMs = parseTimeout(options.timeout);
|