bpmax-cli 0.2.1-beta.62 → 0.2.1-beta.63

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/bin.js CHANGED
@@ -501,7 +501,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
501
501
  // package.json
502
502
  var package_default = {
503
503
  name: "bpmax-cli",
504
- version: "0.2.1-beta.62",
504
+ version: "0.2.1-beta.63",
505
505
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
506
506
  type: "module",
507
507
  bin: {
@@ -10288,6 +10288,29 @@ function normalizeStructuredFormTemplateValue(value, ruleType) {
10288
10288
  const resolvedType = fieldType || typeAlias || (typeof ruleType === "string" ? ruleType : "");
10289
10289
  return resolvedType ? { ...value, field_type: resolvedType } : { ...value };
10290
10290
  }
10291
+ var FORM_SELECTION_CONTROL_TYPES = /* @__PURE__ */ new Set(["i_select", "checkbox"]);
10292
+ function normalizeSelectionRuleOptions(rule) {
10293
+ const type = typeof rule.type === "string" ? rule.type : "";
10294
+ if (!FORM_SELECTION_CONTROL_TYPES.has(type)) return rule;
10295
+ const normalizeOptions = (options) => {
10296
+ if (!Array.isArray(options)) return options;
10297
+ return options.map((option) => {
10298
+ if (!isRecord4(option)) return option;
10299
+ const label = option.label ?? option.title;
10300
+ const businessValue = option._original ?? option.value;
10301
+ if (label === void 0 || businessValue === void 0 || String(label) === String(option.value)) {
10302
+ return option;
10303
+ }
10304
+ return { ...option, label: String(label), value: String(label), _original: businessValue };
10305
+ });
10306
+ };
10307
+ const next = { ...rule };
10308
+ if (Array.isArray(next.options)) next.options = normalizeOptions(next.options);
10309
+ if (isRecord4(next.props) && Array.isArray(next.props.options)) {
10310
+ next.props = { ...next.props, options: normalizeOptions(next.props.options) };
10311
+ }
10312
+ return next;
10313
+ }
10291
10314
  function buildStructuredFormTemplatePayload(work) {
10292
10315
  const mode = work.mode;
10293
10316
  if (mode !== "edit" && mode !== "create") {
@@ -10333,7 +10356,7 @@ function buildStructuredFormTemplatePayload(work) {
10333
10356
  if (formTemplateValueFieldType(normalizedValue) !== bundle.rule.type) {
10334
10357
  throw new Error(`form-template field_type mismatch for ${ref}.`);
10335
10358
  }
10336
- const rule = mode === "create" ? stripKeys(bundle.rule, FORM_RULE_ID_KEYS) : { ...bundle.rule };
10359
+ const rule = normalizeSelectionRuleOptions(mode === "create" ? stripKeys(bundle.rule, FORM_RULE_ID_KEYS) : { ...bundle.rule });
10337
10360
  const value = normalizeFormTemplateValueValidateMap(
10338
10361
  mode === "create" ? stripKeys(normalizedValue, FORM_VALUE_ID_KEYS) : normalizedValue
10339
10362
  );
@@ -12782,6 +12805,9 @@ function buildDomainSubmitPayload(domain, work, options = {}, raw) {
12782
12805
  return payload2;
12783
12806
  }
12784
12807
  const payload = pickDefined(work, ["name", "desc", "category", "option", "rule", "value"]);
12808
+ if (Array.isArray(payload.rule)) {
12809
+ payload.rule = payload.rule.map((row) => Array.isArray(row) ? row.map((rule) => isRecord4(rule) ? normalizeSelectionRuleOptions(rule) : rule) : row);
12810
+ }
12785
12811
  if (work.mode === "create") {
12786
12812
  const createPayload = stripFormTemplateCreateIds(payload);
12787
12813
  validateNonEmptyFormCreatePayload(createPayload);