@makehq/forman-schema 1.3.1 → 1.3.2

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
@@ -511,7 +511,33 @@ async function handleCollectionType2(value, field, context) {
511
511
  const seen = context.path.length === 0 ? context.roots[context.domain].seenFields : /* @__PURE__ */ new Set();
512
512
  const path = context.path;
513
513
  if (Array.isArray(field.spec)) {
514
- for (const subField of field.spec) {
514
+ const spec = field.spec.slice();
515
+ while (spec.length > 0) {
516
+ let subField = spec.shift();
517
+ if (!subField) continue;
518
+ if (typeof subField === "string") {
519
+ try {
520
+ const resolved = await context.resolveRemote(subField, context);
521
+ if (Array.isArray(resolved)) {
522
+ spec.unshift(...resolved);
523
+ continue;
524
+ } else {
525
+ subField = resolved;
526
+ }
527
+ } catch (error) {
528
+ return {
529
+ valid: false,
530
+ errors: [
531
+ ...errors,
532
+ {
533
+ domain: context.domain,
534
+ path: context.path.join("."),
535
+ message: `Failed to resolve remote resource ${subField}: ${error}`
536
+ }
537
+ ]
538
+ };
539
+ }
540
+ }
515
541
  if (FORMAN_VISUAL_TYPES.includes(subField.type)) {
516
542
  continue;
517
543
  }
@@ -605,7 +631,7 @@ async function handleArrayType2(value, field, context) {
605
631
  async function handleSelectType2(value, field, context) {
606
632
  const errors = [];
607
633
  let optionsOrGroups = isObject(field.options) ? field.options.store : field.options;
608
- let nested = isObject(field.options) ? field.options.nested : void 0;
634
+ let nested = field.nested ? field.nested : isObject(field.options) ? field.options.nested : void 0;
609
635
  if (typeof optionsOrGroups === "string") {
610
636
  try {
611
637
  optionsOrGroups = await context.resolveRemote(optionsOrGroups, context);
package/dist/index.js CHANGED
@@ -482,7 +482,33 @@ async function handleCollectionType2(value, field, context) {
482
482
  const seen = context.path.length === 0 ? context.roots[context.domain].seenFields : /* @__PURE__ */ new Set();
483
483
  const path = context.path;
484
484
  if (Array.isArray(field.spec)) {
485
- for (const subField of field.spec) {
485
+ const spec = field.spec.slice();
486
+ while (spec.length > 0) {
487
+ let subField = spec.shift();
488
+ if (!subField) continue;
489
+ if (typeof subField === "string") {
490
+ try {
491
+ const resolved = await context.resolveRemote(subField, context);
492
+ if (Array.isArray(resolved)) {
493
+ spec.unshift(...resolved);
494
+ continue;
495
+ } else {
496
+ subField = resolved;
497
+ }
498
+ } catch (error) {
499
+ return {
500
+ valid: false,
501
+ errors: [
502
+ ...errors,
503
+ {
504
+ domain: context.domain,
505
+ path: context.path.join("."),
506
+ message: `Failed to resolve remote resource ${subField}: ${error}`
507
+ }
508
+ ]
509
+ };
510
+ }
511
+ }
486
512
  if (FORMAN_VISUAL_TYPES.includes(subField.type)) {
487
513
  continue;
488
514
  }
@@ -576,7 +602,7 @@ async function handleArrayType2(value, field, context) {
576
602
  async function handleSelectType2(value, field, context) {
577
603
  const errors = [];
578
604
  let optionsOrGroups = isObject(field.options) ? field.options.store : field.options;
579
- let nested = isObject(field.options) ? field.options.nested : void 0;
605
+ let nested = field.nested ? field.nested : isObject(field.options) ? field.options.nested : void 0;
580
606
  if (typeof optionsOrGroups === "string") {
581
607
  try {
582
608
  optionsOrGroups = await context.resolveRemote(optionsOrGroups, context);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makehq/forman-schema",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Forman Schema Tools",
5
5
  "license": "MIT",
6
6
  "author": "Make",