@makehq/forman-schema 1.18.0 → 1.19.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
@@ -1392,7 +1392,12 @@ async function validateFormanWithDomainsInternal(domains, options) {
1392
1392
  states: errors.length === 0 && options?.states ? buildRestoreStructure(
1393
1393
  Object.keys(domains).map((domain) => roots[domain].fieldStates.map((state) => ({ domain, ...state }))).flat()
1394
1394
  ) : void 0,
1395
- schemas: errors.length === 0 && options?.schemas ? Object.fromEntries(Object.keys(domains).map((domain) => [domain, roots[domain].schemaFields])) : void 0
1395
+ schemas: errors.length === 0 && options?.schemas ? Object.fromEntries(Object.keys(domains).map((domain) => [domain, roots[domain].schemaFields])) : void 0,
1396
+ // Same spec as `schemas`, but also on the failure path. Remote-resolved fields are
1397
+ // built before the verdict, so a rejection can name the fields it rejected instead of
1398
+ // leaving the caller to guess at a sub-form it never saw. `schemas` stays success-only:
1399
+ // callers read its presence as a success signal.
1400
+ resolvedSchemas: options?.schemas ? Object.fromEntries(Object.keys(domains).map((domain) => [domain, roots[domain].schemaFields])) : void 0
1396
1401
  };
1397
1402
  }
1398
1403
  async function validateFormanValue(value, field, context) {
package/dist/index.d.cts CHANGED
@@ -216,8 +216,15 @@ type FormanValidationResult = {
216
216
  }[];
217
217
  /** States of fields grouped by domain */
218
218
  states?: Record<string, FormanSchemaFieldState>;
219
- /** Resolved schema fields per domain */
219
+ /** Resolved schema fields per domain. Requires `options.schemas`; only present when validation succeeded. */
220
220
  schemas?: Record<string, FormanSchemaField[]>;
221
+ /**
222
+ * Resolved schema fields per domain. Requires `options.schemas`, and unlike {@link schemas} is
223
+ * present whether or not validation succeeded — including fields revealed by a remote-resolved
224
+ * (`rpc://`) sub-form, which cannot be known from the static schema alone. Lets a caller report
225
+ * which fields it rejected.
226
+ */
227
+ resolvedSchemas?: Record<string, FormanSchemaField[]>;
221
228
  };
222
229
  type FormanSchemaFieldState = {
223
230
  mode?: 'chose' | 'edit';
package/dist/index.d.ts CHANGED
@@ -216,8 +216,15 @@ type FormanValidationResult = {
216
216
  }[];
217
217
  /** States of fields grouped by domain */
218
218
  states?: Record<string, FormanSchemaFieldState>;
219
- /** Resolved schema fields per domain */
219
+ /** Resolved schema fields per domain. Requires `options.schemas`; only present when validation succeeded. */
220
220
  schemas?: Record<string, FormanSchemaField[]>;
221
+ /**
222
+ * Resolved schema fields per domain. Requires `options.schemas`, and unlike {@link schemas} is
223
+ * present whether or not validation succeeded — including fields revealed by a remote-resolved
224
+ * (`rpc://`) sub-form, which cannot be known from the static schema alone. Lets a caller report
225
+ * which fields it rejected.
226
+ */
227
+ resolvedSchemas?: Record<string, FormanSchemaField[]>;
221
228
  };
222
229
  type FormanSchemaFieldState = {
223
230
  mode?: 'chose' | 'edit';
package/dist/index.js CHANGED
@@ -1360,7 +1360,12 @@ async function validateFormanWithDomainsInternal(domains, options) {
1360
1360
  states: errors.length === 0 && options?.states ? buildRestoreStructure(
1361
1361
  Object.keys(domains).map((domain) => roots[domain].fieldStates.map((state) => ({ domain, ...state }))).flat()
1362
1362
  ) : void 0,
1363
- schemas: errors.length === 0 && options?.schemas ? Object.fromEntries(Object.keys(domains).map((domain) => [domain, roots[domain].schemaFields])) : void 0
1363
+ schemas: errors.length === 0 && options?.schemas ? Object.fromEntries(Object.keys(domains).map((domain) => [domain, roots[domain].schemaFields])) : void 0,
1364
+ // Same spec as `schemas`, but also on the failure path. Remote-resolved fields are
1365
+ // built before the verdict, so a rejection can name the fields it rejected instead of
1366
+ // leaving the caller to guess at a sub-form it never saw. `schemas` stays success-only:
1367
+ // callers read its presence as a success signal.
1368
+ resolvedSchemas: options?.schemas ? Object.fromEntries(Object.keys(domains).map((domain) => [domain, roots[domain].schemaFields])) : void 0
1364
1369
  };
1365
1370
  }
1366
1371
  async function validateFormanValue(value, field, context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makehq/forman-schema",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "Forman Schema Tools",
5
5
  "license": "MIT",
6
6
  "author": "Make",