@makehq/forman-schema 1.3.0 → 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 +29 -2
- package/dist/index.js +29 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -498,6 +498,7 @@ async function validateFormanValue(value, field, context) {
|
|
|
498
498
|
case "keychain":
|
|
499
499
|
case "datastore":
|
|
500
500
|
case "aiagent":
|
|
501
|
+
case "udt":
|
|
501
502
|
case "file":
|
|
502
503
|
case "folder":
|
|
503
504
|
return handleSelectType2(value, normalizedField, context);
|
|
@@ -510,7 +511,33 @@ async function handleCollectionType2(value, field, context) {
|
|
|
510
511
|
const seen = context.path.length === 0 ? context.roots[context.domain].seenFields : /* @__PURE__ */ new Set();
|
|
511
512
|
const path = context.path;
|
|
512
513
|
if (Array.isArray(field.spec)) {
|
|
513
|
-
|
|
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
|
+
}
|
|
514
541
|
if (FORMAN_VISUAL_TYPES.includes(subField.type)) {
|
|
515
542
|
continue;
|
|
516
543
|
}
|
|
@@ -604,7 +631,7 @@ async function handleArrayType2(value, field, context) {
|
|
|
604
631
|
async function handleSelectType2(value, field, context) {
|
|
605
632
|
const errors = [];
|
|
606
633
|
let optionsOrGroups = isObject(field.options) ? field.options.store : field.options;
|
|
607
|
-
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;
|
|
608
635
|
if (typeof optionsOrGroups === "string") {
|
|
609
636
|
try {
|
|
610
637
|
optionsOrGroups = await context.resolveRemote(optionsOrGroups, context);
|
package/dist/index.js
CHANGED
|
@@ -469,6 +469,7 @@ async function validateFormanValue(value, field, context) {
|
|
|
469
469
|
case "keychain":
|
|
470
470
|
case "datastore":
|
|
471
471
|
case "aiagent":
|
|
472
|
+
case "udt":
|
|
472
473
|
case "file":
|
|
473
474
|
case "folder":
|
|
474
475
|
return handleSelectType2(value, normalizedField, context);
|
|
@@ -481,7 +482,33 @@ async function handleCollectionType2(value, field, context) {
|
|
|
481
482
|
const seen = context.path.length === 0 ? context.roots[context.domain].seenFields : /* @__PURE__ */ new Set();
|
|
482
483
|
const path = context.path;
|
|
483
484
|
if (Array.isArray(field.spec)) {
|
|
484
|
-
|
|
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
|
+
}
|
|
485
512
|
if (FORMAN_VISUAL_TYPES.includes(subField.type)) {
|
|
486
513
|
continue;
|
|
487
514
|
}
|
|
@@ -575,7 +602,7 @@ async function handleArrayType2(value, field, context) {
|
|
|
575
602
|
async function handleSelectType2(value, field, context) {
|
|
576
603
|
const errors = [];
|
|
577
604
|
let optionsOrGroups = isObject(field.options) ? field.options.store : field.options;
|
|
578
|
-
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;
|
|
579
606
|
if (typeof optionsOrGroups === "string") {
|
|
580
607
|
try {
|
|
581
608
|
optionsOrGroups = await context.resolveRemote(optionsOrGroups, context);
|