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