omc-core 0.4.77 → 0.4.79
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/list-view-wire.js +8 -4
- package/package.json +1 -1
package/dist/list-view-wire.js
CHANGED
|
@@ -58,14 +58,17 @@ function decodeButtonActionConfig(value, code) {
|
|
|
58
58
|
}
|
|
59
59
|
return value;
|
|
60
60
|
}
|
|
61
|
-
function requireButtonConfig(config, code, bindAction) {
|
|
62
|
-
|
|
61
|
+
function requireButtonConfig(config, code, bindAction, scriptShorthand) {
|
|
62
|
+
// `script` is the ergonomic spelling of actionConfig.scriptData; the
|
|
63
|
+
// normalizer merges it, so the pre-wire validator must accept it too.
|
|
64
|
+
const scriptFromShorthand = bindAction === "SCRIPT" && typeof scriptShorthand === "string";
|
|
65
|
+
const required = bindAction === "SCRIPT" && scriptFromShorthand ? [] : bindAction === "SCRIPT" ? ["scriptData"] : bindAction === "BUSINESS_RULE" || bindAction === "FLOW" ? ["targetCode"] : bindAction === "ADD_DATA" || bindAction === "FORM" ? ["schemaCodeVal", "formListData", "configureList"] : [];
|
|
63
66
|
for (const key of required) {
|
|
64
67
|
if (config?.[key] === undefined || config[key] === null) {
|
|
65
68
|
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons ${code}: ${bindAction} actionConfig requires ${key}` });
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
|
-
if (bindAction === "SCRIPT" && typeof config?.scriptData !== "string") {
|
|
71
|
+
if (bindAction === "SCRIPT" && !scriptFromShorthand && typeof config?.scriptData !== "string") {
|
|
69
72
|
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons ${code}: SCRIPT actionConfig.scriptData must be a string` });
|
|
70
73
|
}
|
|
71
74
|
if ((bindAction === "ADD_DATA" || bindAction === "FORM") && (typeof config?.schemaCodeVal !== "object" || config.schemaCodeVal === null || Array.isArray(config.schemaCodeVal) || !Array.isArray(config.formListData) || !Array.isArray(config.configureList))) {
|
|
@@ -76,6 +79,7 @@ export function validateButtonActionConfig(entry) {
|
|
|
76
79
|
const bindAction = typeof entry.bindAction === "string" ? entry.bindAction : "";
|
|
77
80
|
const code = String(entry.code ?? "");
|
|
78
81
|
const config = decodeButtonActionConfig(entry.actionConfig, code);
|
|
82
|
+
const scriptShorthand = entry.script;
|
|
79
83
|
if (bindAction === "BUSINESS_RULE") {
|
|
80
84
|
if (typeof entry.targetCode !== "string" || entry.targetCode.length === 0) {
|
|
81
85
|
throw new ToolRefusalError({ status: "refused", blocker: "listview-buttons-invalid", message: `buttons ${code}: BUSINESS_RULE requires targetCode` });
|
|
@@ -96,6 +100,6 @@ export function validateButtonActionConfig(entry) {
|
|
|
96
100
|
}
|
|
97
101
|
if ((bindAction === "ADD_DATA" || bindAction === "FORM") && (entry.targetModel !== undefined || entry.targetForm !== undefined || entry.configureList !== undefined) && entry.actionConfig === undefined)
|
|
98
102
|
return;
|
|
99
|
-
requireButtonConfig(config, code, bindAction);
|
|
103
|
+
requireButtonConfig(config, code, bindAction, scriptShorthand);
|
|
100
104
|
}
|
|
101
105
|
//# sourceMappingURL=list-view-wire.js.map
|