@tinacms/schema-tools 0.0.0-20225819341 → 0.0.0-202261192534
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/CHANGELOG.md +14 -2
- package/dist/index.es.js +19 -5
- package/dist/index.js +65 -46
- package/dist/types/SchemaTypes.d.ts +10 -0
- package/dist/validate/index.d.ts +1 -0
- package/dist/validate/schema.d.ts +70 -0
- package/dist/validate/tinaCloudSchemaConfig.d.ts +53 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
# @tinacms/schema-tools
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-202261192534
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- ae23e9ad6: Remove unused deps from monorepo
|
|
8
|
+
|
|
9
|
+
## 0.0.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fb73fb355: Renames syncFolder to a mediaRoot when configuring Repo-Based Media
|
|
14
|
+
|
|
15
|
+
## 0.0.5
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- f6cb634c2: Added an optional config key to the schema that will be used for tina cloud media store
|
|
8
20
|
|
|
9
21
|
## 0.0.4
|
|
10
22
|
|
package/dist/index.es.js
CHANGED
|
@@ -30,7 +30,7 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
import * as yup from "yup";
|
|
33
|
-
import { z, ZodError } from "zod";
|
|
33
|
+
import z$1, { z, ZodError } from "zod";
|
|
34
34
|
function addNamespaceToSchema(maybeNode, namespace = []) {
|
|
35
35
|
if (typeof maybeNode === "string") {
|
|
36
36
|
return maybeNode;
|
|
@@ -416,7 +416,7 @@ const resolveForm = ({
|
|
|
416
416
|
};
|
|
417
417
|
};
|
|
418
418
|
const parseZodError = ({ zodError }) => {
|
|
419
|
-
var _a;
|
|
419
|
+
var _a, _b;
|
|
420
420
|
const errors = zodError.flatten((issue) => {
|
|
421
421
|
const moreInfo = [];
|
|
422
422
|
if (issue.code === "invalid_union") {
|
|
@@ -432,7 +432,7 @@ const parseZodError = ({ zodError }) => {
|
|
|
432
432
|
});
|
|
433
433
|
const formErrors = errors.formErrors.flatMap((x) => x.errors);
|
|
434
434
|
const parsedErrors = [
|
|
435
|
-
...((_a = errors.fieldErrors) == null ? void 0 : _a.collections.flatMap((x) => x.errors)) || [],
|
|
435
|
+
...((_b = (_a = errors.fieldErrors) == null ? void 0 : _a.collections) == null ? void 0 : _b.flatMap((x) => x.errors)) || [],
|
|
436
436
|
...formErrors
|
|
437
437
|
];
|
|
438
438
|
return parsedErrors;
|
|
@@ -606,6 +606,19 @@ const TinaFieldZod = z.lazy(() => {
|
|
|
606
606
|
return true;
|
|
607
607
|
});
|
|
608
608
|
});
|
|
609
|
+
const tinaConfigKey = z$1.object({
|
|
610
|
+
publicFolder: z$1.string(),
|
|
611
|
+
mediaRoot: z$1.string()
|
|
612
|
+
}).strict().optional();
|
|
613
|
+
const tinaConfigZod = z$1.object({
|
|
614
|
+
media: z$1.object({
|
|
615
|
+
tina: tinaConfigKey
|
|
616
|
+
}).optional()
|
|
617
|
+
});
|
|
618
|
+
const validateTinaCloudSchemaConfig = (config) => {
|
|
619
|
+
const newConfig = tinaConfigZod.parse(config);
|
|
620
|
+
return newConfig;
|
|
621
|
+
};
|
|
609
622
|
const FORMATS = ["json", "md", "markdown", "mdx"];
|
|
610
623
|
const Template = z.object({
|
|
611
624
|
label: z.string({
|
|
@@ -647,7 +660,8 @@ const TinaCloudCollection = TinaCloudCollectionBase.extend({
|
|
|
647
660
|
}
|
|
648
661
|
}, { message: "Must provide one of templates or fields in your collection" });
|
|
649
662
|
const TinaCloudSchemaZod = z.object({
|
|
650
|
-
collections: z.array(TinaCloudCollection)
|
|
663
|
+
collections: z.array(TinaCloudCollection),
|
|
664
|
+
config: tinaConfigZod.optional()
|
|
651
665
|
}).refine((val) => !hasDuplicates(val.collections.map((x) => x.name)), {
|
|
652
666
|
message: "can not have two collections with the same name"
|
|
653
667
|
});
|
|
@@ -671,4 +685,4 @@ const validateSchema = ({
|
|
|
671
685
|
}
|
|
672
686
|
}
|
|
673
687
|
};
|
|
674
|
-
export { TinaSchema, TinaSchemaValidationError, addNamespaceToSchema, resolveField, resolveForm, validateSchema };
|
|
688
|
+
export { TinaSchema, TinaSchemaValidationError, addNamespaceToSchema, resolveField, resolveForm, validateSchema, validateTinaCloudSchemaConfig };
|
package/dist/index.js
CHANGED
|
@@ -31,8 +31,11 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
(function(global, factory) {
|
|
33
33
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("yup"), require("zod")) : typeof define === "function" && define.amd ? define(["exports", "yup", "zod"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@tinacms/schema-tools"] = {}, global.NOOP, global.NOOP));
|
|
34
|
-
})(this, function(exports2, yup,
|
|
34
|
+
})(this, function(exports2, yup, z) {
|
|
35
35
|
"use strict";
|
|
36
|
+
function _interopDefaultLegacy(e) {
|
|
37
|
+
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
38
|
+
}
|
|
36
39
|
function _interopNamespace(e) {
|
|
37
40
|
if (e && e.__esModule)
|
|
38
41
|
return e;
|
|
@@ -54,6 +57,7 @@ var __objRest = (source, exclude) => {
|
|
|
54
57
|
return Object.freeze(n);
|
|
55
58
|
}
|
|
56
59
|
var yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
60
|
+
var z__default = /* @__PURE__ */ _interopDefaultLegacy(z);
|
|
57
61
|
function addNamespaceToSchema(maybeNode, namespace = []) {
|
|
58
62
|
if (typeof maybeNode === "string") {
|
|
59
63
|
return maybeNode;
|
|
@@ -439,7 +443,7 @@ var __objRest = (source, exclude) => {
|
|
|
439
443
|
};
|
|
440
444
|
};
|
|
441
445
|
const parseZodError = ({ zodError }) => {
|
|
442
|
-
var _a;
|
|
446
|
+
var _a, _b;
|
|
443
447
|
const errors = zodError.flatten((issue) => {
|
|
444
448
|
const moreInfo = [];
|
|
445
449
|
if (issue.code === "invalid_union") {
|
|
@@ -455,12 +459,12 @@ var __objRest = (source, exclude) => {
|
|
|
455
459
|
});
|
|
456
460
|
const formErrors = errors.formErrors.flatMap((x) => x.errors);
|
|
457
461
|
const parsedErrors = [
|
|
458
|
-
...((_a = errors.fieldErrors) == null ? void 0 : _a.collections.flatMap((x) => x.errors)) || [],
|
|
462
|
+
...((_b = (_a = errors.fieldErrors) == null ? void 0 : _a.collections) == null ? void 0 : _b.flatMap((x) => x.errors)) || [],
|
|
459
463
|
...formErrors
|
|
460
464
|
];
|
|
461
465
|
return parsedErrors;
|
|
462
466
|
};
|
|
463
|
-
const name =
|
|
467
|
+
const name = z.z.string({
|
|
464
468
|
required_error: "Name is required but not provided",
|
|
465
469
|
invalid_type_error: "Name must be a string"
|
|
466
470
|
});
|
|
@@ -476,71 +480,71 @@ var __objRest = (source, exclude) => {
|
|
|
476
480
|
];
|
|
477
481
|
const typeTypeError = `type must be one of ${TypeName.join(", ")}`;
|
|
478
482
|
const typeRequiredError = `type is required and must be one of ${TypeName.join(", ")}`;
|
|
479
|
-
const nameProp =
|
|
483
|
+
const nameProp = z.z.string({
|
|
480
484
|
required_error: "name must be provided",
|
|
481
485
|
invalid_type_error: "name must be a sting"
|
|
482
486
|
});
|
|
483
|
-
const Option =
|
|
487
|
+
const Option = z.z.union([z.z.string(), z.z.object({ label: z.z.string(), value: z.z.string() })], {
|
|
484
488
|
errorMap: () => {
|
|
485
489
|
return {
|
|
486
490
|
message: "Invalid option array. Must be a string[] or {label: string, value: string}[]"
|
|
487
491
|
};
|
|
488
492
|
}
|
|
489
493
|
});
|
|
490
|
-
const TinaField =
|
|
494
|
+
const TinaField = z.z.object({
|
|
491
495
|
name: nameProp,
|
|
492
|
-
label:
|
|
493
|
-
description:
|
|
494
|
-
required:
|
|
496
|
+
label: z.z.string().optional(),
|
|
497
|
+
description: z.z.string().optional(),
|
|
498
|
+
required: z.z.boolean().optional()
|
|
495
499
|
});
|
|
496
|
-
const FieldWithList = TinaField.extend({ list:
|
|
500
|
+
const FieldWithList = TinaField.extend({ list: z.z.boolean().optional() });
|
|
497
501
|
const TinaScalerBase = FieldWithList.extend({
|
|
498
|
-
options:
|
|
502
|
+
options: z.z.array(Option).optional()
|
|
499
503
|
});
|
|
500
504
|
const StringField = TinaScalerBase.extend({
|
|
501
|
-
type:
|
|
505
|
+
type: z.z.literal("string", {
|
|
502
506
|
invalid_type_error: typeTypeError,
|
|
503
507
|
required_error: typeRequiredError
|
|
504
508
|
}),
|
|
505
|
-
isTitle:
|
|
509
|
+
isTitle: z.z.boolean().optional()
|
|
506
510
|
});
|
|
507
511
|
const BooleanField = TinaScalerBase.extend({
|
|
508
|
-
type:
|
|
512
|
+
type: z.z.literal("boolean", {
|
|
509
513
|
invalid_type_error: typeTypeError,
|
|
510
514
|
required_error: typeRequiredError
|
|
511
515
|
})
|
|
512
516
|
});
|
|
513
517
|
const NumberField = TinaScalerBase.extend({
|
|
514
|
-
type:
|
|
518
|
+
type: z.z.literal("number", {
|
|
515
519
|
invalid_type_error: typeTypeError,
|
|
516
520
|
required_error: typeRequiredError
|
|
517
521
|
})
|
|
518
522
|
});
|
|
519
523
|
const ImageField = TinaScalerBase.extend({
|
|
520
|
-
type:
|
|
524
|
+
type: z.z.literal("image", {
|
|
521
525
|
invalid_type_error: typeTypeError,
|
|
522
526
|
required_error: typeRequiredError
|
|
523
527
|
})
|
|
524
528
|
});
|
|
525
529
|
const DateTimeField = TinaScalerBase.extend({
|
|
526
|
-
type:
|
|
530
|
+
type: z.z.literal("datetime", {
|
|
527
531
|
invalid_type_error: typeTypeError,
|
|
528
532
|
required_error: typeRequiredError
|
|
529
533
|
}),
|
|
530
|
-
dateFormat:
|
|
531
|
-
timeFormat:
|
|
534
|
+
dateFormat: z.z.string().optional(),
|
|
535
|
+
timeFormat: z.z.string().optional()
|
|
532
536
|
});
|
|
533
537
|
const ReferenceField = FieldWithList.extend({
|
|
534
|
-
type:
|
|
538
|
+
type: z.z.literal("reference", {
|
|
535
539
|
invalid_type_error: typeTypeError,
|
|
536
540
|
required_error: typeRequiredError
|
|
537
541
|
})
|
|
538
542
|
});
|
|
539
|
-
const TinaFieldZod =
|
|
540
|
-
const TemplateTemp =
|
|
541
|
-
label:
|
|
543
|
+
const TinaFieldZod = z.z.lazy(() => {
|
|
544
|
+
const TemplateTemp = z.z.object({
|
|
545
|
+
label: z.z.string(),
|
|
542
546
|
name: nameProp,
|
|
543
|
-
fields:
|
|
547
|
+
fields: z.z.array(TinaFieldZod)
|
|
544
548
|
}).refine((val) => {
|
|
545
549
|
var _a;
|
|
546
550
|
return !hasDuplicates((_a = val.fields) == null ? void 0 : _a.map((x) => x.name));
|
|
@@ -548,27 +552,27 @@ var __objRest = (source, exclude) => {
|
|
|
548
552
|
message: "Fields must have a unique name"
|
|
549
553
|
});
|
|
550
554
|
const ObjectField = FieldWithList.extend({
|
|
551
|
-
type:
|
|
555
|
+
type: z.z.literal("object", {
|
|
552
556
|
invalid_type_error: typeTypeError,
|
|
553
557
|
required_error: typeRequiredError
|
|
554
558
|
}),
|
|
555
|
-
fields:
|
|
559
|
+
fields: z.z.array(TinaFieldZod).min(1).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
|
|
556
560
|
message: "Fields must have a unique name"
|
|
557
561
|
}),
|
|
558
|
-
templates:
|
|
562
|
+
templates: z.z.array(TemplateTemp).min(1).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
|
|
559
563
|
message: "Templates must have a unique name"
|
|
560
564
|
})
|
|
561
565
|
});
|
|
562
566
|
const RichTextField = FieldWithList.extend({
|
|
563
|
-
type:
|
|
567
|
+
type: z.z.literal("rich-text", {
|
|
564
568
|
invalid_type_error: typeTypeError,
|
|
565
569
|
required_error: typeRequiredError
|
|
566
570
|
}),
|
|
567
|
-
templates:
|
|
571
|
+
templates: z.z.array(TemplateTemp).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
|
|
568
572
|
message: "Templates must have a unique name"
|
|
569
573
|
})
|
|
570
574
|
});
|
|
571
|
-
return
|
|
575
|
+
return z.z.discriminatedUnion("type", [
|
|
572
576
|
StringField,
|
|
573
577
|
BooleanField,
|
|
574
578
|
NumberField,
|
|
@@ -594,13 +598,13 @@ var __objRest = (source, exclude) => {
|
|
|
594
598
|
if (val.isTitle) {
|
|
595
599
|
if (val.list) {
|
|
596
600
|
ctx.addIssue({
|
|
597
|
-
code:
|
|
601
|
+
code: z.z.ZodIssueCode.custom,
|
|
598
602
|
message: "You can not have `list: true` when using `isTitle`"
|
|
599
603
|
});
|
|
600
604
|
}
|
|
601
605
|
if (!val.required) {
|
|
602
606
|
ctx.addIssue({
|
|
603
|
-
code:
|
|
607
|
+
code: z.z.ZodIssueCode.custom,
|
|
604
608
|
message: "You must have { required: true } when using `isTitle`"
|
|
605
609
|
});
|
|
606
610
|
}
|
|
@@ -611,7 +615,7 @@ var __objRest = (source, exclude) => {
|
|
|
611
615
|
let isValid = Boolean(val == null ? void 0 : val.templates) || Boolean(val == null ? void 0 : val.fields);
|
|
612
616
|
if (!isValid) {
|
|
613
617
|
ctx.addIssue({
|
|
614
|
-
code:
|
|
618
|
+
code: z.z.ZodIssueCode.custom,
|
|
615
619
|
message
|
|
616
620
|
});
|
|
617
621
|
return false;
|
|
@@ -619,7 +623,7 @@ var __objRest = (source, exclude) => {
|
|
|
619
623
|
isValid = !((val == null ? void 0 : val.templates) && (val == null ? void 0 : val.fields));
|
|
620
624
|
if (!isValid) {
|
|
621
625
|
ctx.addIssue({
|
|
622
|
-
code:
|
|
626
|
+
code: z.z.ZodIssueCode.custom,
|
|
623
627
|
message
|
|
624
628
|
});
|
|
625
629
|
}
|
|
@@ -629,27 +633,40 @@ var __objRest = (source, exclude) => {
|
|
|
629
633
|
return true;
|
|
630
634
|
});
|
|
631
635
|
});
|
|
636
|
+
const tinaConfigKey = z__default["default"].object({
|
|
637
|
+
publicFolder: z__default["default"].string(),
|
|
638
|
+
mediaRoot: z__default["default"].string()
|
|
639
|
+
}).strict().optional();
|
|
640
|
+
const tinaConfigZod = z__default["default"].object({
|
|
641
|
+
media: z__default["default"].object({
|
|
642
|
+
tina: tinaConfigKey
|
|
643
|
+
}).optional()
|
|
644
|
+
});
|
|
645
|
+
const validateTinaCloudSchemaConfig = (config) => {
|
|
646
|
+
const newConfig = tinaConfigZod.parse(config);
|
|
647
|
+
return newConfig;
|
|
648
|
+
};
|
|
632
649
|
const FORMATS = ["json", "md", "markdown", "mdx"];
|
|
633
|
-
const Template =
|
|
634
|
-
label:
|
|
650
|
+
const Template = z.z.object({
|
|
651
|
+
label: z.z.string({
|
|
635
652
|
invalid_type_error: "label must be a string",
|
|
636
653
|
required_error: "label was not provided but is required"
|
|
637
654
|
}),
|
|
638
655
|
name,
|
|
639
|
-
fields:
|
|
656
|
+
fields: z.z.array(TinaFieldZod)
|
|
640
657
|
}).refine((val) => {
|
|
641
658
|
var _a;
|
|
642
659
|
return !hasDuplicates((_a = val.fields) == null ? void 0 : _a.map((x) => x.name));
|
|
643
660
|
}, {
|
|
644
661
|
message: "Fields must have a unique name"
|
|
645
662
|
});
|
|
646
|
-
const TinaCloudCollectionBase =
|
|
647
|
-
label:
|
|
663
|
+
const TinaCloudCollectionBase = z.z.object({
|
|
664
|
+
label: z.z.string().optional(),
|
|
648
665
|
name,
|
|
649
|
-
format:
|
|
666
|
+
format: z.z.enum(FORMATS).optional()
|
|
650
667
|
});
|
|
651
668
|
const TinaCloudCollection = TinaCloudCollectionBase.extend({
|
|
652
|
-
fields:
|
|
669
|
+
fields: z.z.array(TinaFieldZod).min(1).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
|
|
653
670
|
message: "Fields must have a unique name"
|
|
654
671
|
}).refine((val) => {
|
|
655
672
|
const arr = (val == null ? void 0 : val.filter((x) => x.type === "string" && x.isTitle)) || [];
|
|
@@ -657,7 +674,7 @@ var __objRest = (source, exclude) => {
|
|
|
657
674
|
}, {
|
|
658
675
|
message: "Fields can only have one use of `isTitle`"
|
|
659
676
|
}),
|
|
660
|
-
templates:
|
|
677
|
+
templates: z.z.array(Template).min(1).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
|
|
661
678
|
message: "Templates must have a unique name"
|
|
662
679
|
})
|
|
663
680
|
}).refine((val) => {
|
|
@@ -669,8 +686,9 @@ var __objRest = (source, exclude) => {
|
|
|
669
686
|
return isValid;
|
|
670
687
|
}
|
|
671
688
|
}, { message: "Must provide one of templates or fields in your collection" });
|
|
672
|
-
const TinaCloudSchemaZod =
|
|
673
|
-
collections:
|
|
689
|
+
const TinaCloudSchemaZod = z.z.object({
|
|
690
|
+
collections: z.z.array(TinaCloudCollection),
|
|
691
|
+
config: tinaConfigZod.optional()
|
|
674
692
|
}).refine((val) => !hasDuplicates(val.collections.map((x) => x.name)), {
|
|
675
693
|
message: "can not have two collections with the same name"
|
|
676
694
|
});
|
|
@@ -686,7 +704,7 @@ var __objRest = (source, exclude) => {
|
|
|
686
704
|
try {
|
|
687
705
|
TinaCloudSchemaZod.parse(config);
|
|
688
706
|
} catch (e) {
|
|
689
|
-
if (e instanceof
|
|
707
|
+
if (e instanceof z.ZodError) {
|
|
690
708
|
const errors = parseZodError({ zodError: e });
|
|
691
709
|
throw new TinaSchemaValidationError(errors.join(", \n"));
|
|
692
710
|
} else {
|
|
@@ -700,6 +718,7 @@ var __objRest = (source, exclude) => {
|
|
|
700
718
|
exports2.resolveField = resolveField;
|
|
701
719
|
exports2.resolveForm = resolveForm;
|
|
702
720
|
exports2.validateSchema = validateSchema;
|
|
721
|
+
exports2.validateTinaCloudSchemaConfig = validateTinaCloudSchemaConfig;
|
|
703
722
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
704
723
|
exports2[Symbol.toStringTag] = "Module";
|
|
705
724
|
});
|
|
@@ -21,9 +21,18 @@ export declare type UIField<F extends UIField = any, Shape = any> = {
|
|
|
21
21
|
validate?(value: Shape, allValues: any, meta: any, field: UIField<F, Shape>): string | object | undefined | void;
|
|
22
22
|
defaultValue?: Shape;
|
|
23
23
|
};
|
|
24
|
+
export interface TinaCloudSchemaConfig {
|
|
25
|
+
media?: {
|
|
26
|
+
tina?: {
|
|
27
|
+
publicFolder: string;
|
|
28
|
+
mediaRoot: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
24
32
|
export interface TinaCloudSchema<WithNamespace extends boolean> {
|
|
25
33
|
templates?: GlobalTemplate<WithNamespace>[];
|
|
26
34
|
collections: TinaCloudCollection<WithNamespace>[];
|
|
35
|
+
config?: TinaCloudSchemaConfig;
|
|
27
36
|
}
|
|
28
37
|
export declare type TinaCloudSchemaBase = TinaCloudSchema<false>;
|
|
29
38
|
export declare type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
|
|
@@ -35,6 +44,7 @@ export declare type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
|
|
|
35
44
|
export interface TinaCloudSchemaWithNamespace {
|
|
36
45
|
templates?: GlobalTemplate<true>[];
|
|
37
46
|
collections: TinaCloudCollection<true>[];
|
|
47
|
+
config?: TinaCloudSchemaConfig;
|
|
38
48
|
namespace: string[];
|
|
39
49
|
}
|
|
40
50
|
export declare type TinaCloudCollection<WithNamespace extends boolean> = CollectionFields<WithNamespace> | CollectionTemplates<WithNamespace>;
|
package/dist/validate/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import { TinaCloudSchema } from '../types';
|
|
14
|
+
export { validateTinaCloudSchemaConfig } from './tinaCloudSchemaConfig';
|
|
14
15
|
export declare class TinaSchemaValidationError extends Error {
|
|
15
16
|
constructor(message: any);
|
|
16
17
|
}
|
|
@@ -88,6 +88,44 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
88
88
|
format?: "json" | "md" | "markdown" | "mdx";
|
|
89
89
|
label?: string;
|
|
90
90
|
}>, "many">;
|
|
91
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
tina: z.ZodOptional<z.ZodObject<{
|
|
94
|
+
publicFolder: z.ZodString;
|
|
95
|
+
mediaRoot: z.ZodString;
|
|
96
|
+
}, "strict", z.ZodTypeAny, {
|
|
97
|
+
publicFolder?: string;
|
|
98
|
+
mediaRoot?: string;
|
|
99
|
+
}, {
|
|
100
|
+
publicFolder?: string;
|
|
101
|
+
mediaRoot?: string;
|
|
102
|
+
}>>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
tina?: {
|
|
105
|
+
publicFolder?: string;
|
|
106
|
+
mediaRoot?: string;
|
|
107
|
+
};
|
|
108
|
+
}, {
|
|
109
|
+
tina?: {
|
|
110
|
+
publicFolder?: string;
|
|
111
|
+
mediaRoot?: string;
|
|
112
|
+
};
|
|
113
|
+
}>>;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
media?: {
|
|
116
|
+
tina?: {
|
|
117
|
+
publicFolder?: string;
|
|
118
|
+
mediaRoot?: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
media?: {
|
|
123
|
+
tina?: {
|
|
124
|
+
publicFolder?: string;
|
|
125
|
+
mediaRoot?: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
}>>;
|
|
91
129
|
}, "strip", z.ZodTypeAny, {
|
|
92
130
|
collections?: {
|
|
93
131
|
name?: string;
|
|
@@ -100,6 +138,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
100
138
|
format?: "json" | "md" | "markdown" | "mdx";
|
|
101
139
|
label?: string;
|
|
102
140
|
}[];
|
|
141
|
+
config?: {
|
|
142
|
+
media?: {
|
|
143
|
+
tina?: {
|
|
144
|
+
publicFolder?: string;
|
|
145
|
+
mediaRoot?: string;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
103
149
|
}, {
|
|
104
150
|
collections?: {
|
|
105
151
|
name?: string;
|
|
@@ -112,6 +158,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
112
158
|
format?: "json" | "md" | "markdown" | "mdx";
|
|
113
159
|
label?: string;
|
|
114
160
|
}[];
|
|
161
|
+
config?: {
|
|
162
|
+
media?: {
|
|
163
|
+
tina?: {
|
|
164
|
+
publicFolder?: string;
|
|
165
|
+
mediaRoot?: string;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
115
169
|
}>, {
|
|
116
170
|
collections?: {
|
|
117
171
|
name?: string;
|
|
@@ -124,6 +178,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
124
178
|
format?: "json" | "md" | "markdown" | "mdx";
|
|
125
179
|
label?: string;
|
|
126
180
|
}[];
|
|
181
|
+
config?: {
|
|
182
|
+
media?: {
|
|
183
|
+
tina?: {
|
|
184
|
+
publicFolder?: string;
|
|
185
|
+
mediaRoot?: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
};
|
|
127
189
|
}, {
|
|
128
190
|
collections?: {
|
|
129
191
|
name?: string;
|
|
@@ -136,4 +198,12 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
136
198
|
format?: "json" | "md" | "markdown" | "mdx";
|
|
137
199
|
label?: string;
|
|
138
200
|
}[];
|
|
201
|
+
config?: {
|
|
202
|
+
media?: {
|
|
203
|
+
tina?: {
|
|
204
|
+
publicFolder?: string;
|
|
205
|
+
mediaRoot?: string;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
};
|
|
139
209
|
}>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Copyright 2021 Forestry.io Holdings, Inc.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
See the License for the specific language governing permissions and
|
|
11
|
+
limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
import { TinaCloudSchemaConfig } from '../types';
|
|
14
|
+
import z from 'zod';
|
|
15
|
+
export declare const tinaConfigZod: z.ZodObject<{
|
|
16
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
tina: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
publicFolder: z.ZodString;
|
|
19
|
+
mediaRoot: z.ZodString;
|
|
20
|
+
}, "strict", z.ZodTypeAny, {
|
|
21
|
+
publicFolder?: string;
|
|
22
|
+
mediaRoot?: string;
|
|
23
|
+
}, {
|
|
24
|
+
publicFolder?: string;
|
|
25
|
+
mediaRoot?: string;
|
|
26
|
+
}>>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
tina?: {
|
|
29
|
+
publicFolder?: string;
|
|
30
|
+
mediaRoot?: string;
|
|
31
|
+
};
|
|
32
|
+
}, {
|
|
33
|
+
tina?: {
|
|
34
|
+
publicFolder?: string;
|
|
35
|
+
mediaRoot?: string;
|
|
36
|
+
};
|
|
37
|
+
}>>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
media?: {
|
|
40
|
+
tina?: {
|
|
41
|
+
publicFolder?: string;
|
|
42
|
+
mediaRoot?: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}, {
|
|
46
|
+
media?: {
|
|
47
|
+
tina?: {
|
|
48
|
+
publicFolder?: string;
|
|
49
|
+
mediaRoot?: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
export declare const validateTinaCloudSchemaConfig: (config: unknown) => TinaCloudSchemaConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/schema-tools",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-202261192534",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tinacms/scripts": "0.
|
|
18
|
+
"@tinacms/scripts": "0.50.9",
|
|
19
19
|
"@types/yup": "^0.29.10",
|
|
20
20
|
"jest": "^27.0.6",
|
|
21
21
|
"react": "17.0.2",
|