@tinacms/schema-tools 0.0.2 → 0.0.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/CHANGELOG.md CHANGED
@@ -1,18 +1,25 @@
1
1
  # @tinacms/schema-tools
2
2
 
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 921709a7e: Adds validation to the schema instead of only using typescript types
8
+
3
9
  ## 0.0.2
10
+
4
11
  ### Patch Changes
5
12
 
6
13
  - abf25c673: The schema can now to used on the frontend (optional for now but will be the main path moving forward).
7
-
14
+
8
15
  ### How to migrate.
9
-
16
+
10
17
  If you gone though the `tinacms init` process there should be a file called `.tina/components/TinaProvider`. In that file you can import the schema from `schema.ts` and add it to the TinaCMS wrapper component.
11
-
18
+
12
19
  ```tsx
13
20
  import TinaCMS from 'tinacms'
14
21
  import schema, { tinaConfig } from '../schema.ts'
15
-
22
+
16
23
  // Importing the TinaProvider directly into your page will cause Tina to be added to the production bundle.
17
24
  // Instead, import the tina/provider/index default export to have it dynamially imported in edit-moode
18
25
  /**
@@ -26,8 +33,9 @@
26
33
  </TinaCMS>
27
34
  )
28
35
  }
29
-
36
+
30
37
  export default TinaProvider
31
38
  ```
39
+
32
40
  - 801f39f62: Update types
33
41
  - e8b0de1f7: Add `parentTypename` to fields to allow us to disambiguate between fields which have the same field names but different types. Example, an event from field name of `blocks.0.title` could belong to a `Cta` block or a `Hero` block, both of which have a `title` field.
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ limitations under the License.
12
12
  */
13
13
  export * from './schema';
14
14
  export * from './types';
15
+ export * from './validate';
package/dist/index.js CHANGED
@@ -36,8 +36,8 @@ var __objRest = (source, exclude) => {
36
36
  };
37
37
  var __export = (target, all) => {
38
38
  __markAsModule(target);
39
- for (var name in all)
40
- __defProp(target, name, { get: all[name], enumerable: true });
39
+ for (var name2 in all)
40
+ __defProp(target, name2, { get: all[name2], enumerable: true });
41
41
  };
42
42
  var __reExport = (target, module2, desc) => {
43
43
  if (module2 && typeof module2 === "object" || typeof module2 === "function") {
@@ -54,9 +54,11 @@ var __toModule = (module2) => {
54
54
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/index.ts
55
55
  __export(exports, {
56
56
  TinaSchema: () => TinaSchema,
57
+ TinaSchemaValidationError: () => TinaSchemaValidationError,
57
58
  addNamespaceToSchema: () => addNamespaceToSchema,
58
59
  resolveField: () => resolveField,
59
- resolveForm: () => resolveForm
60
+ resolveForm: () => resolveForm,
61
+ validateSchema: () => validateSchema
60
62
  });
61
63
 
62
64
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/schema/addNamespaceToSchema.ts
@@ -170,6 +172,15 @@ var NAMER = {
170
172
  }
171
173
  };
172
174
 
175
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/util/hasDuplicates.ts
176
+ function hasDuplicates(array) {
177
+ if (!array) {
178
+ return false;
179
+ } else {
180
+ return new Set(array).size !== array.length;
181
+ }
182
+ }
183
+
173
184
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/schema/TinaSchema.ts
174
185
  var TinaSchema = class {
175
186
  constructor(config) {
@@ -445,10 +456,264 @@ var resolveForm = ({
445
456
  })
446
457
  };
447
458
  };
459
+
460
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/validate/index.ts
461
+ var import_zod4 = __toModule(require("zod"));
462
+
463
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/util/parseZodErrors.ts
464
+ var parseZodError = ({ zodError }) => {
465
+ var _a;
466
+ const errors = zodError.flatten((issue) => {
467
+ const moreInfo = [];
468
+ if (issue.code === "invalid_union") {
469
+ issue.unionErrors.map((unionError) => {
470
+ moreInfo.push(parseZodError({ zodError: unionError }));
471
+ });
472
+ }
473
+ const errorMessage = `Error ${issue == null ? void 0 : issue.message} at path ${issue.path.join(".")}`;
474
+ const errorMessages = [errorMessage, ...moreInfo];
475
+ return {
476
+ errors: errorMessages
477
+ };
478
+ });
479
+ const formErrors = errors.formErrors.flatMap((x) => x.errors);
480
+ const parsedErrors = [
481
+ ...((_a = errors.fieldErrors) == null ? void 0 : _a.collections.flatMap((x) => x.errors)) || [],
482
+ ...formErrors
483
+ ];
484
+ return parsedErrors;
485
+ };
486
+
487
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/validate/schema.ts
488
+ var import_zod3 = __toModule(require("zod"));
489
+
490
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/validate/properties.ts
491
+ var import_zod = __toModule(require("zod"));
492
+ var name = import_zod.z.string({
493
+ required_error: "Name is required but not provided",
494
+ invalid_type_error: "Name must be a string"
495
+ });
496
+
497
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/validate/fields.ts
498
+ var import_zod2 = __toModule(require("zod"));
499
+ var TypeName = [
500
+ "string",
501
+ "boolean",
502
+ "number",
503
+ "datetime",
504
+ "image",
505
+ "object",
506
+ "reference",
507
+ "rich-text"
508
+ ];
509
+ var typeTypeError = `type must be one of ${TypeName.join(", ")}`;
510
+ var typeRequiredError = `type is required and must be one of ${TypeName.join(", ")}`;
511
+ var nameProp = import_zod2.z.string({
512
+ required_error: "name must be provided",
513
+ invalid_type_error: "name must be a sting"
514
+ });
515
+ var Option = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.object({ label: import_zod2.z.string(), value: import_zod2.z.string() })], {
516
+ errorMap: () => {
517
+ return {
518
+ message: "Invalid option array. Must be a string[] or {label: string, value: string}[]"
519
+ };
520
+ }
521
+ });
522
+ var TinaField = import_zod2.z.object({
523
+ name: nameProp,
524
+ label: import_zod2.z.string().optional(),
525
+ description: import_zod2.z.string().optional(),
526
+ required: import_zod2.z.boolean().optional()
527
+ });
528
+ var FieldWithList = TinaField.extend({ list: import_zod2.z.boolean().optional() });
529
+ var TinaScalerBase = FieldWithList.extend({
530
+ options: import_zod2.z.array(Option).optional()
531
+ });
532
+ var StringField = TinaScalerBase.extend({
533
+ type: import_zod2.z.literal("string", {
534
+ invalid_type_error: typeTypeError,
535
+ required_error: typeRequiredError
536
+ })
537
+ });
538
+ var BooleanField = TinaScalerBase.extend({
539
+ type: import_zod2.z.literal("boolean", {
540
+ invalid_type_error: typeTypeError,
541
+ required_error: typeRequiredError
542
+ })
543
+ });
544
+ var NumberField = TinaScalerBase.extend({
545
+ type: import_zod2.z.literal("number", {
546
+ invalid_type_error: typeTypeError,
547
+ required_error: typeRequiredError
548
+ })
549
+ });
550
+ var ImageField = TinaScalerBase.extend({
551
+ type: import_zod2.z.literal("image", {
552
+ invalid_type_error: typeTypeError,
553
+ required_error: typeRequiredError
554
+ })
555
+ });
556
+ var DateTimeField = TinaScalerBase.extend({
557
+ type: import_zod2.z.literal("datetime", {
558
+ invalid_type_error: typeTypeError,
559
+ required_error: typeRequiredError
560
+ }),
561
+ dateFormat: import_zod2.z.string().optional(),
562
+ timeFormat: import_zod2.z.string().optional()
563
+ });
564
+ var ReferenceField = FieldWithList.extend({
565
+ type: import_zod2.z.literal("reference", {
566
+ invalid_type_error: typeTypeError,
567
+ required_error: typeRequiredError
568
+ })
569
+ });
570
+ var TinaFieldZod = import_zod2.z.lazy(() => {
571
+ const TemplateTemp = import_zod2.z.object({
572
+ label: import_zod2.z.string(),
573
+ name: nameProp,
574
+ fields: import_zod2.z.array(TinaFieldZod)
575
+ }).refine((val) => {
576
+ var _a;
577
+ return !hasDuplicates((_a = val.fields) == null ? void 0 : _a.map((x) => x.name));
578
+ }, {
579
+ message: "Fields must have a unique name"
580
+ });
581
+ const ObjectField = FieldWithList.extend({
582
+ type: import_zod2.z.literal("object", {
583
+ invalid_type_error: typeTypeError,
584
+ required_error: typeRequiredError
585
+ }),
586
+ fields: import_zod2.z.array(TinaFieldZod).min(1).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
587
+ message: "Fields must have a unique name"
588
+ }),
589
+ templates: import_zod2.z.array(TemplateTemp).min(1).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
590
+ message: "Templates must have a unique name"
591
+ })
592
+ });
593
+ const RichTextField = FieldWithList.extend({
594
+ type: import_zod2.z.literal("rich-text", {
595
+ invalid_type_error: typeTypeError,
596
+ required_error: typeRequiredError
597
+ }),
598
+ templates: import_zod2.z.array(TemplateTemp).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
599
+ message: "Templates must have a unique name"
600
+ })
601
+ });
602
+ return import_zod2.z.discriminatedUnion("type", [
603
+ StringField,
604
+ BooleanField,
605
+ NumberField,
606
+ ImageField,
607
+ DateTimeField,
608
+ ReferenceField,
609
+ ObjectField,
610
+ RichTextField
611
+ ], {
612
+ errorMap: (issue, ctx) => {
613
+ var _a;
614
+ if (issue.code === "invalid_union_discriminator") {
615
+ return {
616
+ message: `Invalid \`type\` property. In the schema is 'type: ${(_a = ctx.data) == null ? void 0 : _a.type}' and expected one of ${TypeName.join(", ")}`
617
+ };
618
+ }
619
+ return {
620
+ message: issue.message
621
+ };
622
+ }
623
+ }).superRefine((val, ctx) => {
624
+ if (val.type === "object") {
625
+ const message = "Must provide one of templates or fields in your collection";
626
+ let isValid = Boolean(val == null ? void 0 : val.templates) || Boolean(val == null ? void 0 : val.fields);
627
+ if (!isValid) {
628
+ ctx.addIssue({
629
+ code: import_zod2.z.ZodIssueCode.custom,
630
+ message
631
+ });
632
+ return false;
633
+ } else {
634
+ isValid = !((val == null ? void 0 : val.templates) && (val == null ? void 0 : val.fields));
635
+ if (!isValid) {
636
+ ctx.addIssue({
637
+ code: import_zod2.z.ZodIssueCode.custom,
638
+ message
639
+ });
640
+ }
641
+ return isValid;
642
+ }
643
+ }
644
+ return true;
645
+ });
646
+ });
647
+
648
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/validate/schema.ts
649
+ var FORMATS = ["json", "md", "markdown", "mdx"];
650
+ var Template = import_zod3.z.object({
651
+ label: import_zod3.z.string({
652
+ invalid_type_error: "label must be a string",
653
+ required_error: "label was not provided but is required"
654
+ }),
655
+ name,
656
+ fields: import_zod3.z.array(TinaFieldZod)
657
+ }).refine((val) => {
658
+ var _a;
659
+ return !hasDuplicates((_a = val.fields) == null ? void 0 : _a.map((x) => x.name));
660
+ }, {
661
+ message: "Fields must have a unique name"
662
+ });
663
+ var TinaCloudCollectionBase = import_zod3.z.object({
664
+ label: import_zod3.z.string().optional(),
665
+ name,
666
+ format: import_zod3.z.enum(FORMATS).optional()
667
+ });
668
+ var TinaCloudCollection = TinaCloudCollectionBase.extend({
669
+ fields: import_zod3.z.array(TinaFieldZod).min(1).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
670
+ message: "Fields must have a unique name"
671
+ }),
672
+ templates: import_zod3.z.array(Template).min(1).optional().refine((val) => !hasDuplicates(val == null ? void 0 : val.map((x) => x.name)), {
673
+ message: "Templates must have a unique name"
674
+ })
675
+ }).refine((val) => {
676
+ let isValid = Boolean(val == null ? void 0 : val.templates) || Boolean(val == null ? void 0 : val.fields);
677
+ if (!isValid) {
678
+ return false;
679
+ } else {
680
+ isValid = !((val == null ? void 0 : val.templates) && (val == null ? void 0 : val.fields));
681
+ return isValid;
682
+ }
683
+ }, { message: "Must provide one of templates or fields in your collection" });
684
+ var TinaCloudSchemaZod = import_zod3.z.object({
685
+ collections: import_zod3.z.array(TinaCloudCollection)
686
+ }).refine((val) => !hasDuplicates(val.collections.map((x) => x.name)), {
687
+ message: "can not have two collections with the same name"
688
+ });
689
+
690
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/schema-tools/src/validate/index.ts
691
+ var TinaSchemaValidationError = class extends Error {
692
+ constructor(message) {
693
+ super(message);
694
+ this.name = "TinaSchemaValidationError";
695
+ }
696
+ };
697
+ var validateSchema = ({
698
+ config
699
+ }) => {
700
+ try {
701
+ TinaCloudSchemaZod.parse(config);
702
+ } catch (e) {
703
+ if (e instanceof import_zod4.ZodError) {
704
+ const errors = parseZodError({ zodError: e });
705
+ throw new TinaSchemaValidationError(errors.join(", \n"));
706
+ } else {
707
+ throw new Error(e);
708
+ }
709
+ }
710
+ };
448
711
  // Annotate the CommonJS export names for ESM import in node:
449
712
  0 && (module.exports = {
450
713
  TinaSchema,
714
+ TinaSchemaValidationError,
451
715
  addNamespaceToSchema,
452
716
  resolveField,
453
- resolveForm
717
+ resolveForm,
718
+ validateSchema
454
719
  });
@@ -0,0 +1,13 @@
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
+ export declare function hasDuplicates<T = any>(array: T[]): boolean;
@@ -14,3 +14,4 @@ export * from './validate';
14
14
  export * from './lastItem';
15
15
  export * from './namer';
16
16
  export * from './sequential';
17
+ export * from './hasDuplicates';
@@ -0,0 +1,16 @@
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 type { ZodError } from 'zod';
14
+ export declare const parseZodError: ({ zodError }: {
15
+ zodError: ZodError;
16
+ }) => string[];
@@ -11,5 +11,5 @@ See the License for the specific language governing permissions and
11
11
  limitations under the License.
12
12
  */
13
13
  import * as yup from 'yup';
14
- import type { Schema } from 'yup';
15
- export declare function assertShape<T extends unknown>(value: unknown, yupSchema: (args: typeof yup) => Schema<any, any>, errorMessage?: string): asserts value is T;
14
+ import type { AnySchema } from 'yup';
15
+ export declare function assertShape<T extends unknown>(value: unknown, yupSchema: (args: typeof yup) => AnySchema, errorMessage?: string): asserts value is T;
@@ -0,0 +1,15 @@
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 { z } from 'zod';
14
+ import { TinaFieldInner } from '../types/SchemaTypes';
15
+ export declare const TinaFieldZod: z.ZodType<TinaFieldInner<false>>;
@@ -0,0 +1,19 @@
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 { TinaCloudSchema } from '../types';
14
+ export declare class TinaSchemaValidationError extends Error {
15
+ constructor(message: any);
16
+ }
17
+ export declare const validateSchema: ({ config, }: {
18
+ config: TinaCloudSchema<false>;
19
+ }) => void;
@@ -0,0 +1,14 @@
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 { z } from 'zod';
14
+ export declare const name: z.ZodString;
@@ -0,0 +1,139 @@
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 { z } from 'zod';
14
+ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
15
+ collections: z.ZodArray<z.ZodEffects<z.ZodObject<z.extendShape<{
16
+ label: z.ZodOptional<z.ZodString>;
17
+ name: z.ZodString;
18
+ format: z.ZodOptional<z.ZodEnum<["json", "md", "markdown", "mdx"]>>;
19
+ }, {
20
+ fields: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodType<import("..").TinaFieldInner<false>, z.ZodTypeDef, import("..").TinaFieldInner<false>>, "many">>, import("..").TinaFieldInner<false>[], import("..").TinaFieldInner<false>[]>;
21
+ templates: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
22
+ label: z.ZodString;
23
+ name: z.ZodString;
24
+ fields: z.ZodArray<z.ZodType<import("..").TinaFieldInner<false>, z.ZodTypeDef, import("..").TinaFieldInner<false>>, "many">;
25
+ }, "strip", z.ZodTypeAny, {
26
+ name?: string;
27
+ fields?: import("..").TinaFieldInner<false>[];
28
+ label?: string;
29
+ }, {
30
+ name?: string;
31
+ fields?: import("..").TinaFieldInner<false>[];
32
+ label?: string;
33
+ }>, {
34
+ name?: string;
35
+ fields?: import("..").TinaFieldInner<false>[];
36
+ label?: string;
37
+ }, {
38
+ name?: string;
39
+ fields?: import("..").TinaFieldInner<false>[];
40
+ label?: string;
41
+ }>, "many">>, {
42
+ name?: string;
43
+ fields?: import("..").TinaFieldInner<false>[];
44
+ label?: string;
45
+ }[], {
46
+ name?: string;
47
+ fields?: import("..").TinaFieldInner<false>[];
48
+ label?: string;
49
+ }[]>;
50
+ }>, "strip", z.ZodTypeAny, {
51
+ name?: string;
52
+ fields?: import("..").TinaFieldInner<false>[];
53
+ templates?: {
54
+ name?: string;
55
+ fields?: import("..").TinaFieldInner<false>[];
56
+ label?: string;
57
+ }[];
58
+ format?: "json" | "md" | "markdown" | "mdx";
59
+ label?: string;
60
+ }, {
61
+ name?: string;
62
+ fields?: import("..").TinaFieldInner<false>[];
63
+ templates?: {
64
+ name?: string;
65
+ fields?: import("..").TinaFieldInner<false>[];
66
+ label?: string;
67
+ }[];
68
+ format?: "json" | "md" | "markdown" | "mdx";
69
+ label?: string;
70
+ }>, {
71
+ name?: string;
72
+ fields?: import("..").TinaFieldInner<false>[];
73
+ templates?: {
74
+ name?: string;
75
+ fields?: import("..").TinaFieldInner<false>[];
76
+ label?: string;
77
+ }[];
78
+ format?: "json" | "md" | "markdown" | "mdx";
79
+ label?: string;
80
+ }, {
81
+ name?: string;
82
+ fields?: import("..").TinaFieldInner<false>[];
83
+ templates?: {
84
+ name?: string;
85
+ fields?: import("..").TinaFieldInner<false>[];
86
+ label?: string;
87
+ }[];
88
+ format?: "json" | "md" | "markdown" | "mdx";
89
+ label?: string;
90
+ }>, "many">;
91
+ }, "strip", z.ZodTypeAny, {
92
+ collections?: {
93
+ name?: string;
94
+ fields?: import("..").TinaFieldInner<false>[];
95
+ templates?: {
96
+ name?: string;
97
+ fields?: import("..").TinaFieldInner<false>[];
98
+ label?: string;
99
+ }[];
100
+ format?: "json" | "md" | "markdown" | "mdx";
101
+ label?: string;
102
+ }[];
103
+ }, {
104
+ collections?: {
105
+ name?: string;
106
+ fields?: import("..").TinaFieldInner<false>[];
107
+ templates?: {
108
+ name?: string;
109
+ fields?: import("..").TinaFieldInner<false>[];
110
+ label?: string;
111
+ }[];
112
+ format?: "json" | "md" | "markdown" | "mdx";
113
+ label?: string;
114
+ }[];
115
+ }>, {
116
+ collections?: {
117
+ name?: string;
118
+ fields?: import("..").TinaFieldInner<false>[];
119
+ templates?: {
120
+ name?: string;
121
+ fields?: import("..").TinaFieldInner<false>[];
122
+ label?: string;
123
+ }[];
124
+ format?: "json" | "md" | "markdown" | "mdx";
125
+ label?: string;
126
+ }[];
127
+ }, {
128
+ collections?: {
129
+ name?: string;
130
+ fields?: import("..").TinaFieldInner<false>[];
131
+ templates?: {
132
+ name?: string;
133
+ fields?: import("..").TinaFieldInner<false>[];
134
+ label?: string;
135
+ }[];
136
+ format?: "json" | "md" | "markdown" | "mdx";
137
+ label?: string;
138
+ }[];
139
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -20,7 +20,8 @@
20
20
  "@types/yup": "^0.29.10",
21
21
  "jest": "^27.0.6",
22
22
  "react": "16.14.0",
23
- "typescript": "^4.3.5"
23
+ "typescript": "^4.3.5",
24
+ "yup": "^0.32.0"
24
25
  },
25
26
  "peerDependencies": {
26
27
  "react": ">=16.14.0",
@@ -39,5 +40,8 @@
39
40
  "repository": {
40
41
  "url": "https://github.com/tinacms/tinacms.git",
41
42
  "directory": "packages/@tinacms/cli"
43
+ },
44
+ "dependencies": {
45
+ "zod": "^3.14.3"
42
46
  }
43
47
  }