bpmax-cli 0.1.32 → 0.1.33

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
@@ -665,7 +665,7 @@ async function parseJsonInput(input, label = "JSON input") {
665
665
  // package.json
666
666
  var package_default = {
667
667
  name: "bpmax-cli",
668
- version: "0.1.32",
668
+ version: "0.1.33",
669
669
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
670
670
  type: "module",
671
671
  bin: {
@@ -1975,6 +1975,8 @@ var FIELD_LABEL_NAMES = ["label", "title", "display_name", "displayName", "text"
1975
1975
  var FIELD_TYPE_NAMES = ["type", "field_type", "fieldType", "value_type", "valueType", "control", "component", "widget"];
1976
1976
  var OPTION_NAMES = ["options", "items", "choices", "values"];
1977
1977
  var REQUIRED_NAMES = ["required", "is_required", "isRequired", "require", "must", "validateRequired"];
1978
+ var HIDDEN_NAMES = ["hidden", "is_hidden", "isHidden", "hide", "hideInForm"];
1979
+ var VISIBLE_NAMES = ["visible", "display", "show"];
1978
1980
  function isRecord3(value) {
1979
1981
  return typeof value === "object" && value !== null && !Array.isArray(value);
1980
1982
  }
@@ -2004,6 +2006,25 @@ function pickBoolean(source, keys) {
2004
2006
  if (Array.isArray(rules)) {
2005
2007
  return rules.some((rule) => isRecord3(rule) && pickBoolean(rule, REQUIRED_NAMES));
2006
2008
  }
2009
+ const validateMap = source.validateMap;
2010
+ if (isRecord3(validateMap) && pickBoolean(validateMap, REQUIRED_NAMES)) {
2011
+ return true;
2012
+ }
2013
+ return false;
2014
+ }
2015
+ function pickHidden(source) {
2016
+ for (const key of HIDDEN_NAMES) {
2017
+ const value = source[key];
2018
+ if (value === true || value === 1 || value === "1" || value === "true") {
2019
+ return true;
2020
+ }
2021
+ }
2022
+ for (const key of VISIBLE_NAMES) {
2023
+ const value = source[key];
2024
+ if (value === false || value === 0 || value === "0" || value === "false") {
2025
+ return true;
2026
+ }
2027
+ }
2007
2028
  return false;
2008
2029
  }
2009
2030
  function optionValue(option) {
@@ -2037,6 +2058,7 @@ function fieldFromRecord(source) {
2037
2058
  const label = pickString(source, FIELD_LABEL_NAMES);
2038
2059
  const options = pickOptions(source);
2039
2060
  const required = pickBoolean(source, REQUIRED_NAMES);
2061
+ const hidden = pickHidden(source);
2040
2062
  if (!type && !label && !options && !required) {
2041
2063
  return null;
2042
2064
  }
@@ -2045,6 +2067,7 @@ function fieldFromRecord(source) {
2045
2067
  ...label ? { label } : {},
2046
2068
  ...type ? { type } : {},
2047
2069
  required,
2070
+ ...hidden ? { hidden } : {},
2048
2071
  ...options ? { options } : {}
2049
2072
  };
2050
2073
  }
@@ -2054,10 +2077,12 @@ function isSubFormField(field) {
2054
2077
  }
2055
2078
  function mergeField(existing, incoming) {
2056
2079
  const children = incoming.children ?? existing?.children;
2080
+ const hidden = incoming.hidden === true || existing?.hidden === true && incoming.hidden !== false;
2057
2081
  return {
2058
2082
  ...existing,
2059
2083
  ...incoming,
2060
2084
  required: Boolean(existing?.required || incoming.required),
2085
+ ...hidden ? { hidden } : {},
2061
2086
  ...children?.length ? { children } : {}
2062
2087
  };
2063
2088
  }
@@ -2123,6 +2148,15 @@ function validateComplexSelector(field, value) {
2123
2148
  function isComplexSelectorType(type) {
2124
2149
  return /(plugin_city_selector|plugin_project_selector|plugin_user_selector|plugin_department_selector|relation_project|relation_form|user_selector|department_selector|group_select|project_selector_new)/.test(type);
2125
2150
  }
2151
+ function isEnumSelectType(type) {
2152
+ return /enum_select/.test(type);
2153
+ }
2154
+ function optionComparableValue(value) {
2155
+ if (isRecord3(value) && ("value" in value || "label" in value)) {
2156
+ return value.value ?? value.label;
2157
+ }
2158
+ return value;
2159
+ }
2126
2160
  function validateType(field, value) {
2127
2161
  const type = field.type?.toLowerCase() ?? "";
2128
2162
  if (!type || isEmpty(value)) {
@@ -2143,7 +2177,7 @@ function validateType(field, value) {
2143
2177
  return null;
2144
2178
  }
2145
2179
  if (field.options) {
2146
- const values = Array.isArray(value) ? value.map(String) : [String(value)];
2180
+ const values = Array.isArray(value) ? value.map((item) => String(optionComparableValue(item))) : [String(optionComparableValue(value))];
2147
2181
  const invalid = values.filter((item) => !field.options?.includes(item));
2148
2182
  if (invalid.length > 0) {
2149
2183
  return `${field.key} has invalid option value(s): ${invalid.join(", ")}`;
@@ -2158,6 +2192,10 @@ function validateType(field, value) {
2158
2192
  if (/(array|multi|multiple)/.test(type) && !Array.isArray(value)) {
2159
2193
  return `${field.key} must be an array`;
2160
2194
  }
2195
+ if (isEnumSelectType(type) && isRecord3(value)) {
2196
+ const optionValue2 = value.value ?? value.label;
2197
+ return typeof optionValue2 === "string" || typeof optionValue2 === "number" ? null : `${field.key} must be an enum option object with a scalar value`;
2198
+ }
2161
2199
  if (/(string|text|textarea|input|date|time|select|user|department)/.test(type) && typeof value === "object" && value !== null && !Array.isArray(value)) {
2162
2200
  return `${field.key} must be a scalar value`;
2163
2201
  }
@@ -2749,10 +2787,6 @@ function assertHandoffFormCompatible(fields, form) {
2749
2787
  function isEmptyValue(value) {
2750
2788
  return value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
2751
2789
  }
2752
- function isSuggestedManualField(field) {
2753
- const type = field.type?.toLowerCase() ?? "";
2754
- return /(plugin_|selector|relation_|sub[_-]?form|associated[_-]?form|table|upload|image|file|attachment)/.test(type);
2755
- }
2756
2790
  function contextField(field, reason, options = {}) {
2757
2791
  return {
2758
2792
  key: options.path ?? field.key,
@@ -2775,10 +2809,8 @@ function collectPrefillContextForFields(fields, form, result, options = {}) {
2775
2809
  parentKey: options.parentKey
2776
2810
  };
2777
2811
  if (isEmptyValue(value)) {
2778
- if (field.required) {
2812
+ if (field.required && !field.hidden) {
2779
2813
  result.missing_fields.push(contextField(field, "required_empty", fieldOptions));
2780
- } else if (isSuggestedManualField(field)) {
2781
- result.suggested_fields.push(contextField(field, "manual_confirm_recommended", fieldOptions));
2782
2814
  }
2783
2815
  continue;
2784
2816
  }