@xuda.io/runtime-bundle 1.0.1433 → 1.0.1434

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.
@@ -18559,8 +18559,16 @@ func.runtime.render.build_base_xu_handlers = function (options, _ds) {
18559
18559
  const parse_object_value = function (attr_name, val, shape = 'object') {
18560
18560
  let parsed_value = val?.value;
18561
18561
  if (typeof parsed_value === 'string') {
18562
+ const trimmed_value = parsed_value.trim();
18563
+ const wrapped_candidate =
18564
+ trimmed_value.startsWith('(') && trimmed_value.endsWith(')')
18565
+ ? trimmed_value.slice(1, -1).trim()
18566
+ : trimmed_value;
18567
+ const looks_like_wrapped_shape =
18568
+ (shape === 'object' && wrapped_candidate.startsWith('{') && wrapped_candidate.endsWith('}')) ||
18569
+ (shape === 'array' && wrapped_candidate.startsWith('[') && wrapped_candidate.endsWith(']'));
18562
18570
  try {
18563
- parsed_value = JSON5.parse(parsed_value);
18571
+ parsed_value = JSON5.parse(looks_like_wrapped_shape ? wrapped_candidate : trimmed_value);
18564
18572
  } catch (error) {
18565
18573
  throw func.runtime.render.build_xu_runtime_error(
18566
18574
  { ...options, xu_func: attr_name, val: { key: attr_name, value: val?.value } },
@@ -18485,8 +18485,16 @@ func.runtime.render.build_base_xu_handlers = function (options, _ds) {
18485
18485
  const parse_object_value = function (attr_name, val, shape = 'object') {
18486
18486
  let parsed_value = val?.value;
18487
18487
  if (typeof parsed_value === 'string') {
18488
+ const trimmed_value = parsed_value.trim();
18489
+ const wrapped_candidate =
18490
+ trimmed_value.startsWith('(') && trimmed_value.endsWith(')')
18491
+ ? trimmed_value.slice(1, -1).trim()
18492
+ : trimmed_value;
18493
+ const looks_like_wrapped_shape =
18494
+ (shape === 'object' && wrapped_candidate.startsWith('{') && wrapped_candidate.endsWith('}')) ||
18495
+ (shape === 'array' && wrapped_candidate.startsWith('[') && wrapped_candidate.endsWith(']'));
18488
18496
  try {
18489
- parsed_value = JSON5.parse(parsed_value);
18497
+ parsed_value = JSON5.parse(looks_like_wrapped_shape ? wrapped_candidate : trimmed_value);
18490
18498
  } catch (error) {
18491
18499
  throw func.runtime.render.build_xu_runtime_error(
18492
18500
  { ...options, xu_func: attr_name, val: { key: attr_name, value: val?.value } },