@makehq/forman-schema 1.9.3 → 1.9.4

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.cjs CHANGED
@@ -1048,6 +1048,11 @@ function hasPlaceholderNested(field) {
1048
1048
  const placeholder = field.options.placeholder;
1049
1049
  return isObject(placeholder) && placeholder.nested != null;
1050
1050
  }
1051
+ function extractNestedFromField(field) {
1052
+ if (field.nested) return field.nested;
1053
+ if (isObject(field.options) && field.options.nested) return field.options.nested;
1054
+ return void 0;
1055
+ }
1051
1056
  var FORMAN_TYPE_MAP2 = {
1052
1057
  account: "number",
1053
1058
  hook: "number",
@@ -1245,6 +1250,10 @@ async function validateFormanValue(value, field, context) {
1245
1250
  state: { mode: "edit" }
1246
1251
  });
1247
1252
  }
1253
+ const nested = extractNestedFromField(normalizedField);
1254
+ if (nested) {
1255
+ return handleNestedFields(nested, value, normalizedField, context);
1256
+ }
1248
1257
  return {
1249
1258
  valid: true,
1250
1259
  errors: []
@@ -1602,7 +1611,7 @@ async function handlePathType(value, field, context) {
1602
1611
  async function handleSelectType(value, field, context) {
1603
1612
  const errors = [];
1604
1613
  let optionsOrGroups = isObject(field.options) ? field.options.store : field.options;
1605
- let nested = field.nested ? field.nested : isObject(field.options) ? field.options.nested : void 0;
1614
+ let nested = extractNestedFromField(field);
1606
1615
  if (typeof optionsOrGroups === "string") {
1607
1616
  try {
1608
1617
  const resolved = await context.resolveRemote(optionsOrGroups, context);
@@ -1836,8 +1845,9 @@ async function handlePrimitiveType2(value, field, context) {
1836
1845
  }
1837
1846
  }
1838
1847
  }
1839
- if (field.nested) {
1840
- const result = await handleNestedFields(field.nested, value, field, context);
1848
+ const nested = extractNestedFromField(field);
1849
+ if (nested) {
1850
+ const result = await handleNestedFields(nested, value, field, context);
1841
1851
  errors.push(...result.errors);
1842
1852
  }
1843
1853
  return {
package/dist/index.js CHANGED
@@ -1019,6 +1019,11 @@ function hasPlaceholderNested(field) {
1019
1019
  const placeholder = field.options.placeholder;
1020
1020
  return isObject(placeholder) && placeholder.nested != null;
1021
1021
  }
1022
+ function extractNestedFromField(field) {
1023
+ if (field.nested) return field.nested;
1024
+ if (isObject(field.options) && field.options.nested) return field.options.nested;
1025
+ return void 0;
1026
+ }
1022
1027
  var FORMAN_TYPE_MAP2 = {
1023
1028
  account: "number",
1024
1029
  hook: "number",
@@ -1216,6 +1221,10 @@ async function validateFormanValue(value, field, context) {
1216
1221
  state: { mode: "edit" }
1217
1222
  });
1218
1223
  }
1224
+ const nested = extractNestedFromField(normalizedField);
1225
+ if (nested) {
1226
+ return handleNestedFields(nested, value, normalizedField, context);
1227
+ }
1219
1228
  return {
1220
1229
  valid: true,
1221
1230
  errors: []
@@ -1573,7 +1582,7 @@ async function handlePathType(value, field, context) {
1573
1582
  async function handleSelectType(value, field, context) {
1574
1583
  const errors = [];
1575
1584
  let optionsOrGroups = isObject(field.options) ? field.options.store : field.options;
1576
- let nested = field.nested ? field.nested : isObject(field.options) ? field.options.nested : void 0;
1585
+ let nested = extractNestedFromField(field);
1577
1586
  if (typeof optionsOrGroups === "string") {
1578
1587
  try {
1579
1588
  const resolved = await context.resolveRemote(optionsOrGroups, context);
@@ -1807,8 +1816,9 @@ async function handlePrimitiveType2(value, field, context) {
1807
1816
  }
1808
1817
  }
1809
1818
  }
1810
- if (field.nested) {
1811
- const result = await handleNestedFields(field.nested, value, field, context);
1819
+ const nested = extractNestedFromField(field);
1820
+ if (nested) {
1821
+ const result = await handleNestedFields(nested, value, field, context);
1812
1822
  errors.push(...result.errors);
1813
1823
  }
1814
1824
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makehq/forman-schema",
3
- "version": "1.9.3",
3
+ "version": "1.9.4",
4
4
  "description": "Forman Schema Tools",
5
5
  "license": "MIT",
6
6
  "author": "Make",