@makehq/forman-schema 1.11.1 → 1.12.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
@@ -1158,6 +1158,7 @@ async function validateFormanWithDomainsInternal(domains, options) {
1158
1158
  seenFields: /* @__PURE__ */ new Set(),
1159
1159
  fieldStates: [],
1160
1160
  schemaFields: [],
1161
+ allowDynamicValues: domains[domain].allowDynamicValues ?? options?.allowDynamicValues ?? false,
1161
1162
  validateFields: (fields, context) => {
1162
1163
  return validateFormanValue(
1163
1164
  domains[domain].values,
@@ -1308,7 +1309,7 @@ async function validateFormanValue(value, field, context) {
1308
1309
  };
1309
1310
  }
1310
1311
  if (containsIMLExpression(value)) {
1311
- if (normalizedField.mappable === false) {
1312
+ if (normalizedField.mappable === false || !context.roots[context.domain].allowDynamicValues) {
1312
1313
  return {
1313
1314
  valid: false,
1314
1315
  errors: [
@@ -1783,7 +1784,7 @@ async function handleSelectType(value, field, context) {
1783
1784
  optionsOrGroups
1784
1785
  );
1785
1786
  if (!found) {
1786
- (optionsFromRPC ? warnings : errors).push({
1787
+ (optionsFromRPC && context.roots[context.domain].allowDynamicValues ? warnings : errors).push({
1787
1788
  domain: context.domain,
1788
1789
  path: context.path.join("."),
1789
1790
  message: `Value '${singleValue}' not found in options.`
@@ -1791,7 +1792,7 @@ async function handleSelectType(value, field, context) {
1791
1792
  hasUnresolvedValue = true;
1792
1793
  }
1793
1794
  }
1794
- if (optionsFromRPC && hasUnresolvedValue) {
1795
+ if (optionsFromRPC && context.roots[context.domain].allowDynamicValues && hasUnresolvedValue) {
1795
1796
  context.roots[context.domain].fieldStates.push({
1796
1797
  path: context.path,
1797
1798
  state: { mode: "edit" }
@@ -1828,7 +1829,7 @@ async function handleSelectType(value, field, context) {
1828
1829
  } else {
1829
1830
  const item = findValueInSelectOptions(field, value, optionsOrGroups);
1830
1831
  if (!item) {
1831
- if (optionsFromRPC) {
1832
+ if (optionsFromRPC && context.roots[context.domain].allowDynamicValues) {
1832
1833
  warnings.push({
1833
1834
  domain: context.domain,
1834
1835
  path: context.path.join("."),
@@ -2158,7 +2159,10 @@ function validateFormanWithDomains(domains, options) {
2158
2159
  return validateFormanWithDomainsInternal(domains, options);
2159
2160
  }
2160
2161
  function validateForman(values, schema, options, restoreExtras) {
2161
- return validateFormanWithDomains({ default: { values, schema, restoreExtras } }, options);
2162
+ return validateFormanWithDomains(
2163
+ { default: { values, schema, restoreExtras, allowDynamicValues: options?.allowDynamicValues } },
2164
+ options
2165
+ );
2162
2166
  }
2163
2167
  // Annotate the CommonJS export names for ESM import in node:
2164
2168
  0 && (module.exports = {
package/dist/index.d.cts CHANGED
@@ -231,6 +231,10 @@ type FormanValidationOptions = {
231
231
  resolveRemote?(path: string, data: Record<string, unknown>): Promise<unknown>;
232
232
  /** Maps domain names used in nested.domain to actual domain keys passed to validateFormanWithDomains */
233
233
  domainAliases?: Record<string, string>;
234
+ /** Whether to allow dynamic values (IML expressions, unresolved RPC options).
235
+ * When false (default), IML expressions cause errors and unresolved RPC options are treated as errors.
236
+ * Applies as a global default; can be overridden per-domain in validateFormanWithDomains(). */
237
+ allowDynamicValues?: boolean;
234
238
  };
235
239
 
236
240
  /**
@@ -257,6 +261,9 @@ declare function validateFormanWithDomains(domains: Record<string, {
257
261
  schema: FormanSchemaField[];
258
262
  /** Extra values injected into restore states, keyed by string path (dot notation, `[index]`, backtick-escaping). */
259
263
  restoreExtras?: Record<string, Record<string, unknown>>;
264
+ /** Whether the domain allows dynamic values (IML expressions, unresolved RPC select options).
265
+ * Defaults to false. When false, IML expressions cause errors and unresolved RPC options are treated as errors. */
266
+ allowDynamicValues?: boolean;
260
267
  }>, options?: FormanValidationOptions): Promise<FormanValidationResult>;
261
268
  /**
262
269
  * Validates a simple Forman values against a schema
package/dist/index.d.ts CHANGED
@@ -231,6 +231,10 @@ type FormanValidationOptions = {
231
231
  resolveRemote?(path: string, data: Record<string, unknown>): Promise<unknown>;
232
232
  /** Maps domain names used in nested.domain to actual domain keys passed to validateFormanWithDomains */
233
233
  domainAliases?: Record<string, string>;
234
+ /** Whether to allow dynamic values (IML expressions, unresolved RPC options).
235
+ * When false (default), IML expressions cause errors and unresolved RPC options are treated as errors.
236
+ * Applies as a global default; can be overridden per-domain in validateFormanWithDomains(). */
237
+ allowDynamicValues?: boolean;
234
238
  };
235
239
 
236
240
  /**
@@ -257,6 +261,9 @@ declare function validateFormanWithDomains(domains: Record<string, {
257
261
  schema: FormanSchemaField[];
258
262
  /** Extra values injected into restore states, keyed by string path (dot notation, `[index]`, backtick-escaping). */
259
263
  restoreExtras?: Record<string, Record<string, unknown>>;
264
+ /** Whether the domain allows dynamic values (IML expressions, unresolved RPC select options).
265
+ * Defaults to false. When false, IML expressions cause errors and unresolved RPC options are treated as errors. */
266
+ allowDynamicValues?: boolean;
260
267
  }>, options?: FormanValidationOptions): Promise<FormanValidationResult>;
261
268
  /**
262
269
  * Validates a simple Forman values against a schema
package/dist/index.js CHANGED
@@ -1129,6 +1129,7 @@ async function validateFormanWithDomainsInternal(domains, options) {
1129
1129
  seenFields: /* @__PURE__ */ new Set(),
1130
1130
  fieldStates: [],
1131
1131
  schemaFields: [],
1132
+ allowDynamicValues: domains[domain].allowDynamicValues ?? options?.allowDynamicValues ?? false,
1132
1133
  validateFields: (fields, context) => {
1133
1134
  return validateFormanValue(
1134
1135
  domains[domain].values,
@@ -1279,7 +1280,7 @@ async function validateFormanValue(value, field, context) {
1279
1280
  };
1280
1281
  }
1281
1282
  if (containsIMLExpression(value)) {
1282
- if (normalizedField.mappable === false) {
1283
+ if (normalizedField.mappable === false || !context.roots[context.domain].allowDynamicValues) {
1283
1284
  return {
1284
1285
  valid: false,
1285
1286
  errors: [
@@ -1754,7 +1755,7 @@ async function handleSelectType(value, field, context) {
1754
1755
  optionsOrGroups
1755
1756
  );
1756
1757
  if (!found) {
1757
- (optionsFromRPC ? warnings : errors).push({
1758
+ (optionsFromRPC && context.roots[context.domain].allowDynamicValues ? warnings : errors).push({
1758
1759
  domain: context.domain,
1759
1760
  path: context.path.join("."),
1760
1761
  message: `Value '${singleValue}' not found in options.`
@@ -1762,7 +1763,7 @@ async function handleSelectType(value, field, context) {
1762
1763
  hasUnresolvedValue = true;
1763
1764
  }
1764
1765
  }
1765
- if (optionsFromRPC && hasUnresolvedValue) {
1766
+ if (optionsFromRPC && context.roots[context.domain].allowDynamicValues && hasUnresolvedValue) {
1766
1767
  context.roots[context.domain].fieldStates.push({
1767
1768
  path: context.path,
1768
1769
  state: { mode: "edit" }
@@ -1799,7 +1800,7 @@ async function handleSelectType(value, field, context) {
1799
1800
  } else {
1800
1801
  const item = findValueInSelectOptions(field, value, optionsOrGroups);
1801
1802
  if (!item) {
1802
- if (optionsFromRPC) {
1803
+ if (optionsFromRPC && context.roots[context.domain].allowDynamicValues) {
1803
1804
  warnings.push({
1804
1805
  domain: context.domain,
1805
1806
  path: context.path.join("."),
@@ -2129,7 +2130,10 @@ function validateFormanWithDomains(domains, options) {
2129
2130
  return validateFormanWithDomainsInternal(domains, options);
2130
2131
  }
2131
2132
  function validateForman(values, schema, options, restoreExtras) {
2132
- return validateFormanWithDomains({ default: { values, schema, restoreExtras } }, options);
2133
+ return validateFormanWithDomains(
2134
+ { default: { values, schema, restoreExtras, allowDynamicValues: options?.allowDynamicValues } },
2135
+ options
2136
+ );
2133
2137
  }
2134
2138
  export {
2135
2139
  toFormanSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makehq/forman-schema",
3
- "version": "1.11.1",
3
+ "version": "1.12.0",
4
4
  "description": "Forman Schema Tools",
5
5
  "license": "MIT",
6
6
  "author": "Make",