@makehq/forman-schema 1.15.0 → 1.16.0

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
@@ -216,7 +216,7 @@ function buildRestoreStructure(items) {
216
216
  }
217
217
  current = current[key].items;
218
218
  } else {
219
- if (!current[key].nested) {
219
+ if (!current[key].nested || typeof current[key].nested !== "object" || Array.isArray(current[key].nested)) {
220
220
  current[key].nested = {};
221
221
  }
222
222
  current = current[key].nested;
@@ -1917,7 +1917,8 @@ async function handleSelectType(value, field, context) {
1917
1917
  path: context.path,
1918
1918
  state: {
1919
1919
  mode: "chose",
1920
- label: placeholder.label
1920
+ label: placeholder.label,
1921
+ ...placeholder.nested ? { nested: placeholder.nested } : {}
1921
1922
  }
1922
1923
  });
1923
1924
  }
@@ -1955,7 +1956,8 @@ async function handleSelectType(value, field, context) {
1955
1956
  path: context.path,
1956
1957
  state: {
1957
1958
  mode: isReferenceType(field.type) ? void 0 : "chose",
1958
- label: item.label
1959
+ label: item.label,
1960
+ ...item.nested ? { nested: item.nested } : {}
1959
1961
  }
1960
1962
  });
1961
1963
  }
package/dist/index.d.cts CHANGED
@@ -221,7 +221,12 @@ type FormanSchemaFieldState = {
221
221
  path?: Array<string>;
222
222
  data?: Record<string, unknown>;
223
223
  extra?: Record<string, unknown>;
224
- nested?: Record<string, FormanSchemaFieldState>;
224
+ /**
225
+ * Child field states (record, built from field paths) or, on `chose` states of
226
+ * select-like fields, the chosen option's nested field specification — the UI
227
+ * persists that spec in `metadata.restore` to render the dependent fields.
228
+ */
229
+ nested?: Record<string, FormanSchemaFieldState> | FormanSchemaNested;
225
230
  items?: Record<string, FormanSchemaFieldState>[];
226
231
  };
227
232
  /**
package/dist/index.d.ts CHANGED
@@ -221,7 +221,12 @@ type FormanSchemaFieldState = {
221
221
  path?: Array<string>;
222
222
  data?: Record<string, unknown>;
223
223
  extra?: Record<string, unknown>;
224
- nested?: Record<string, FormanSchemaFieldState>;
224
+ /**
225
+ * Child field states (record, built from field paths) or, on `chose` states of
226
+ * select-like fields, the chosen option's nested field specification — the UI
227
+ * persists that spec in `metadata.restore` to render the dependent fields.
228
+ */
229
+ nested?: Record<string, FormanSchemaFieldState> | FormanSchemaNested;
225
230
  items?: Record<string, FormanSchemaFieldState>[];
226
231
  };
227
232
  /**
package/dist/index.js CHANGED
@@ -186,7 +186,7 @@ function buildRestoreStructure(items) {
186
186
  }
187
187
  current = current[key].items;
188
188
  } else {
189
- if (!current[key].nested) {
189
+ if (!current[key].nested || typeof current[key].nested !== "object" || Array.isArray(current[key].nested)) {
190
190
  current[key].nested = {};
191
191
  }
192
192
  current = current[key].nested;
@@ -1887,7 +1887,8 @@ async function handleSelectType(value, field, context) {
1887
1887
  path: context.path,
1888
1888
  state: {
1889
1889
  mode: "chose",
1890
- label: placeholder.label
1890
+ label: placeholder.label,
1891
+ ...placeholder.nested ? { nested: placeholder.nested } : {}
1891
1892
  }
1892
1893
  });
1893
1894
  }
@@ -1925,7 +1926,8 @@ async function handleSelectType(value, field, context) {
1925
1926
  path: context.path,
1926
1927
  state: {
1927
1928
  mode: isReferenceType(field.type) ? void 0 : "chose",
1928
- label: item.label
1929
+ label: item.label,
1930
+ ...item.nested ? { nested: item.nested } : {}
1929
1931
  }
1930
1932
  });
1931
1933
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makehq/forman-schema",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Forman Schema Tools",
5
5
  "license": "MIT",
6
6
  "author": "Make",