@tinacms/schema-tools 0.0.0-d9672bc-20250218033222 → 0.0.0-ddc5e8e-20250611011547

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.js CHANGED
@@ -1664,6 +1664,9 @@
1664
1664
  };
1665
1665
  };
1666
1666
  const normalizePath = (filepath) => filepath.replace(/\\/g, "/");
1667
+ const canonicalPath = (filepath) => {
1668
+ return normalizePath(filepath).split("/").filter((name2) => name2 !== "").join("/");
1669
+ };
1667
1670
  class TinaSchema {
1668
1671
  /**
1669
1672
  * Create a schema class from a user defined schema object
@@ -1713,21 +1716,21 @@
1713
1716
  };
1714
1717
  this.getCollectionByFullPath = (filepath) => {
1715
1718
  const fileExtension = filepath.split(".").pop();
1716
- const normalizedPath = filepath.replace(/\\/g, "/");
1719
+ const canonicalFilepath = canonicalPath(filepath);
1717
1720
  const possibleCollections = this.getCollections().filter((collection) => {
1718
1721
  var _a, _b;
1719
- if (!normalizedPath.endsWith(`.gitkeep.${collection.format || "md"}`) && fileExtension !== (collection.format || "md")) {
1722
+ if (!canonicalFilepath.endsWith(`.gitkeep.${collection.format || "md"}`) && fileExtension !== (collection.format || "md")) {
1720
1723
  return false;
1721
1724
  }
1722
1725
  if (((_a = collection == null ? void 0 : collection.match) == null ? void 0 : _a.include) || ((_b = collection == null ? void 0 : collection.match) == null ? void 0 : _b.exclude)) {
1723
1726
  const matches = this.getMatches({ collection });
1724
- const match = picomatch$1.isMatch(normalizedPath, matches);
1727
+ const match = picomatch$1.isMatch(canonicalFilepath, matches);
1725
1728
  if (!match) {
1726
1729
  return false;
1727
1730
  }
1728
1731
  }
1729
- const path = collection.path ? collection.path.replace(/\/?$/, "/") : "";
1730
- return normalizedPath.startsWith(path);
1732
+ const collectionPath = canonicalPath(collection.path);
1733
+ return collectionPath === "" || canonicalFilepath.startsWith(`${collectionPath}/`);
1731
1734
  });
1732
1735
  if (possibleCollections.length === 0) {
1733
1736
  throw new Error(`Unable to find collection for file at ${filepath}`);
@@ -1945,8 +1948,29 @@
1945
1948
  }
1946
1949
  }
1947
1950
  };
1951
+ this.legacyWalkFields = (cb) => {
1952
+ const walk = (collectionOrObject, collection, path) => {
1953
+ if (collectionOrObject.templates) {
1954
+ collectionOrObject.templates.forEach((template) => {
1955
+ template.fields.forEach((field) => {
1956
+ cb({ field, collection, path: [...path, template.name] });
1957
+ });
1958
+ });
1959
+ }
1960
+ if (collectionOrObject.fields) {
1961
+ collectionOrObject.fields.forEach((field) => {
1962
+ cb({ field, collection, path: [...path, field.name] });
1963
+ if (field.type === "rich-text" || field.type === "object") {
1964
+ walk(field, collection, [...path, field.name]);
1965
+ }
1966
+ });
1967
+ }
1968
+ };
1969
+ const collections = this.getCollections();
1970
+ collections.forEach((collection) => walk(collection, collection, []));
1971
+ };
1948
1972
  this.schema = config;
1949
- this.walkFields(({ field, collection }) => {
1973
+ this.legacyWalkFields(({ field, collection }) => {
1950
1974
  if (!("searchable" in field)) {
1951
1975
  if (field.type === "image") {
1952
1976
  field.searchable = false;
@@ -1984,6 +2008,11 @@
1984
2008
  });
1985
2009
  return result;
1986
2010
  }
2011
+ /**
2012
+ * Walk all fields in tina schema
2013
+ *
2014
+ * @param cb callback function invoked for each field
2015
+ */
1987
2016
  walkFields(cb) {
1988
2017
  const walk = (collectionOrObject, collection, path = "$") => {
1989
2018
  if (collectionOrObject.templates) {
@@ -2004,6 +2033,17 @@
2004
2033
  cb({ field, collection, path: fieldPath });
2005
2034
  if (field.type === "object" && field.fields) {
2006
2035
  walk(field, collection, fieldPath);
2036
+ } else if (field.templates) {
2037
+ field.templates.forEach((template) => {
2038
+ const templatePath = `${fieldPath}.${template.name}`;
2039
+ template.fields.forEach((field2) => {
2040
+ const fieldPath2 = field2.list ? `${templatePath}[*].${field2.name}` : `${templatePath}.${field2.name}`;
2041
+ cb({ field: field2, collection, path: fieldPath2 });
2042
+ if (field2.type === "object") {
2043
+ walk(field2, collection, fieldPath2);
2044
+ }
2045
+ });
2046
+ });
2007
2047
  }
2008
2048
  });
2009
2049
  }
@@ -2023,16 +2063,16 @@
2023
2063
  }) {
2024
2064
  var _a, _b;
2025
2065
  const collection = typeof collectionOrString === "string" ? this.getCollection(collectionOrString) : collectionOrString;
2026
- const normalPath = normalizePath(collection.path);
2027
- const pathSuffix = normalPath ? "/" : "";
2066
+ const collectionPath = canonicalPath(collection.path);
2067
+ const pathSuffix = collectionPath ? "/" : "";
2028
2068
  const format = collection.format || "md";
2029
2069
  const matches = [];
2030
2070
  if ((_a = collection == null ? void 0 : collection.match) == null ? void 0 : _a.include) {
2031
- const match = `${normalPath}${pathSuffix}${collection.match.include}.${format}`;
2071
+ const match = `${collectionPath}${pathSuffix}${collection.match.include}.${format}`;
2032
2072
  matches.push(match);
2033
2073
  }
2034
2074
  if ((_b = collection == null ? void 0 : collection.match) == null ? void 0 : _b.exclude) {
2035
- const exclude = `!(${normalPath}${pathSuffix}${collection.match.exclude}.${format})`;
2075
+ const exclude = `!(${collectionPath}${pathSuffix}${collection.match.exclude}.${format})`;
2036
2076
  matches.push(exclude);
2037
2077
  }
2038
2078
  return matches;
@@ -2225,6 +2265,15 @@
2225
2265
  })
2226
2266
  };
2227
2267
  };
2268
+ const CONTENT_FORMATS = [
2269
+ "mdx",
2270
+ "md",
2271
+ "markdown",
2272
+ "json",
2273
+ "yaml",
2274
+ "yml",
2275
+ "toml"
2276
+ ];
2228
2277
  const parseZodError = ({ zodError }) => {
2229
2278
  var _a, _b, _c, _d;
2230
2279
  const errors = zodError.flatten((issue) => {
@@ -2534,15 +2583,6 @@ ${stringifiedField}`
2534
2583
  const newConfig = tinaConfigZod.parse(config);
2535
2584
  return newConfig;
2536
2585
  };
2537
- const FORMATS = [
2538
- "json",
2539
- "md",
2540
- "markdown",
2541
- "mdx",
2542
- "toml",
2543
- "yaml",
2544
- "yml"
2545
- ];
2546
2586
  const Template = z.z.object({
2547
2587
  label: z.z.string({
2548
2588
  invalid_type_error: "Invalid data type for property `label`. Must be of type `string`",
@@ -2578,7 +2618,7 @@ ${stringifiedField}`
2578
2618
  });
2579
2619
  }
2580
2620
  }),
2581
- format: z.z.enum(FORMATS).optional(),
2621
+ format: z.z.enum(CONTENT_FORMATS).optional(),
2582
2622
  isAuthCollection: z.z.boolean().optional(),
2583
2623
  isDetached: z.z.boolean().optional()
2584
2624
  });
@@ -2697,11 +2737,13 @@ ${stringifiedField}`
2697
2737
  throw new Error(e);
2698
2738
  }
2699
2739
  };
2740
+ exports2.CONTENT_FORMATS = CONTENT_FORMATS;
2700
2741
  exports2.NAMER = NAMER;
2701
2742
  exports2.TINA_HOST = TINA_HOST;
2702
2743
  exports2.TinaSchema = TinaSchema;
2703
2744
  exports2.TinaSchemaValidationError = TinaSchemaValidationError;
2704
2745
  exports2.addNamespaceToSchema = addNamespaceToSchema;
2746
+ exports2.canonicalPath = canonicalPath;
2705
2747
  exports2.normalizePath = normalizePath;
2706
2748
  exports2.parseURL = parseURL;
2707
2749
  exports2.resolveField = resolveField;
package/dist/index.mjs CHANGED
@@ -1646,6 +1646,9 @@ const parseURL = (url) => {
1646
1646
  };
1647
1647
  };
1648
1648
  const normalizePath = (filepath) => filepath.replace(/\\/g, "/");
1649
+ const canonicalPath = (filepath) => {
1650
+ return normalizePath(filepath).split("/").filter((name2) => name2 !== "").join("/");
1651
+ };
1649
1652
  class TinaSchema {
1650
1653
  /**
1651
1654
  * Create a schema class from a user defined schema object
@@ -1695,21 +1698,21 @@ class TinaSchema {
1695
1698
  };
1696
1699
  this.getCollectionByFullPath = (filepath) => {
1697
1700
  const fileExtension = filepath.split(".").pop();
1698
- const normalizedPath = filepath.replace(/\\/g, "/");
1701
+ const canonicalFilepath = canonicalPath(filepath);
1699
1702
  const possibleCollections = this.getCollections().filter((collection) => {
1700
1703
  var _a, _b;
1701
- if (!normalizedPath.endsWith(`.gitkeep.${collection.format || "md"}`) && fileExtension !== (collection.format || "md")) {
1704
+ if (!canonicalFilepath.endsWith(`.gitkeep.${collection.format || "md"}`) && fileExtension !== (collection.format || "md")) {
1702
1705
  return false;
1703
1706
  }
1704
1707
  if (((_a = collection == null ? void 0 : collection.match) == null ? void 0 : _a.include) || ((_b = collection == null ? void 0 : collection.match) == null ? void 0 : _b.exclude)) {
1705
1708
  const matches = this.getMatches({ collection });
1706
- const match = picomatch$1.isMatch(normalizedPath, matches);
1709
+ const match = picomatch$1.isMatch(canonicalFilepath, matches);
1707
1710
  if (!match) {
1708
1711
  return false;
1709
1712
  }
1710
1713
  }
1711
- const path = collection.path ? collection.path.replace(/\/?$/, "/") : "";
1712
- return normalizedPath.startsWith(path);
1714
+ const collectionPath = canonicalPath(collection.path);
1715
+ return collectionPath === "" || canonicalFilepath.startsWith(`${collectionPath}/`);
1713
1716
  });
1714
1717
  if (possibleCollections.length === 0) {
1715
1718
  throw new Error(`Unable to find collection for file at ${filepath}`);
@@ -1927,8 +1930,29 @@ class TinaSchema {
1927
1930
  }
1928
1931
  }
1929
1932
  };
1933
+ this.legacyWalkFields = (cb) => {
1934
+ const walk = (collectionOrObject, collection, path) => {
1935
+ if (collectionOrObject.templates) {
1936
+ collectionOrObject.templates.forEach((template) => {
1937
+ template.fields.forEach((field) => {
1938
+ cb({ field, collection, path: [...path, template.name] });
1939
+ });
1940
+ });
1941
+ }
1942
+ if (collectionOrObject.fields) {
1943
+ collectionOrObject.fields.forEach((field) => {
1944
+ cb({ field, collection, path: [...path, field.name] });
1945
+ if (field.type === "rich-text" || field.type === "object") {
1946
+ walk(field, collection, [...path, field.name]);
1947
+ }
1948
+ });
1949
+ }
1950
+ };
1951
+ const collections = this.getCollections();
1952
+ collections.forEach((collection) => walk(collection, collection, []));
1953
+ };
1930
1954
  this.schema = config;
1931
- this.walkFields(({ field, collection }) => {
1955
+ this.legacyWalkFields(({ field, collection }) => {
1932
1956
  if (!("searchable" in field)) {
1933
1957
  if (field.type === "image") {
1934
1958
  field.searchable = false;
@@ -1966,6 +1990,11 @@ class TinaSchema {
1966
1990
  });
1967
1991
  return result;
1968
1992
  }
1993
+ /**
1994
+ * Walk all fields in tina schema
1995
+ *
1996
+ * @param cb callback function invoked for each field
1997
+ */
1969
1998
  walkFields(cb) {
1970
1999
  const walk = (collectionOrObject, collection, path = "$") => {
1971
2000
  if (collectionOrObject.templates) {
@@ -1986,6 +2015,17 @@ class TinaSchema {
1986
2015
  cb({ field, collection, path: fieldPath });
1987
2016
  if (field.type === "object" && field.fields) {
1988
2017
  walk(field, collection, fieldPath);
2018
+ } else if (field.templates) {
2019
+ field.templates.forEach((template) => {
2020
+ const templatePath = `${fieldPath}.${template.name}`;
2021
+ template.fields.forEach((field2) => {
2022
+ const fieldPath2 = field2.list ? `${templatePath}[*].${field2.name}` : `${templatePath}.${field2.name}`;
2023
+ cb({ field: field2, collection, path: fieldPath2 });
2024
+ if (field2.type === "object") {
2025
+ walk(field2, collection, fieldPath2);
2026
+ }
2027
+ });
2028
+ });
1989
2029
  }
1990
2030
  });
1991
2031
  }
@@ -2005,16 +2045,16 @@ class TinaSchema {
2005
2045
  }) {
2006
2046
  var _a, _b;
2007
2047
  const collection = typeof collectionOrString === "string" ? this.getCollection(collectionOrString) : collectionOrString;
2008
- const normalPath = normalizePath(collection.path);
2009
- const pathSuffix = normalPath ? "/" : "";
2048
+ const collectionPath = canonicalPath(collection.path);
2049
+ const pathSuffix = collectionPath ? "/" : "";
2010
2050
  const format = collection.format || "md";
2011
2051
  const matches = [];
2012
2052
  if ((_a = collection == null ? void 0 : collection.match) == null ? void 0 : _a.include) {
2013
- const match = `${normalPath}${pathSuffix}${collection.match.include}.${format}`;
2053
+ const match = `${collectionPath}${pathSuffix}${collection.match.include}.${format}`;
2014
2054
  matches.push(match);
2015
2055
  }
2016
2056
  if ((_b = collection == null ? void 0 : collection.match) == null ? void 0 : _b.exclude) {
2017
- const exclude = `!(${normalPath}${pathSuffix}${collection.match.exclude}.${format})`;
2057
+ const exclude = `!(${collectionPath}${pathSuffix}${collection.match.exclude}.${format})`;
2018
2058
  matches.push(exclude);
2019
2059
  }
2020
2060
  return matches;
@@ -2207,6 +2247,15 @@ const resolveForm = ({
2207
2247
  })
2208
2248
  };
2209
2249
  };
2250
+ const CONTENT_FORMATS = [
2251
+ "mdx",
2252
+ "md",
2253
+ "markdown",
2254
+ "json",
2255
+ "yaml",
2256
+ "yml",
2257
+ "toml"
2258
+ ];
2210
2259
  const parseZodError = ({ zodError }) => {
2211
2260
  var _a, _b, _c, _d;
2212
2261
  const errors = zodError.flatten((issue) => {
@@ -2516,15 +2565,6 @@ const validateTinaCloudSchemaConfig = (config) => {
2516
2565
  const newConfig = tinaConfigZod.parse(config);
2517
2566
  return newConfig;
2518
2567
  };
2519
- const FORMATS = [
2520
- "json",
2521
- "md",
2522
- "markdown",
2523
- "mdx",
2524
- "toml",
2525
- "yaml",
2526
- "yml"
2527
- ];
2528
2568
  const Template = z.object({
2529
2569
  label: z.string({
2530
2570
  invalid_type_error: "Invalid data type for property `label`. Must be of type `string`",
@@ -2560,7 +2600,7 @@ const CollectionBaseSchema = z.object({
2560
2600
  });
2561
2601
  }
2562
2602
  }),
2563
- format: z.enum(FORMATS).optional(),
2603
+ format: z.enum(CONTENT_FORMATS).optional(),
2564
2604
  isAuthCollection: z.boolean().optional(),
2565
2605
  isDetached: z.boolean().optional()
2566
2606
  });
@@ -2680,11 +2720,13 @@ const validateSchema = ({ schema }) => {
2680
2720
  }
2681
2721
  };
2682
2722
  export {
2723
+ CONTENT_FORMATS,
2683
2724
  NAMER,
2684
2725
  TINA_HOST,
2685
2726
  TinaSchema,
2686
2727
  TinaSchemaValidationError,
2687
2728
  addNamespaceToSchema,
2729
+ canonicalPath,
2688
2730
  normalizePath,
2689
2731
  parseURL,
2690
2732
  resolveField,
@@ -1,4 +1,4 @@
1
- import type { Schema, Collection, Template, Collectable, CollectionTemplateable } from '../types/index';
1
+ import type { Schema, Collection, Template, Collectable, CollectionTemplateable, TinaField } from '../types/index';
2
2
  type Version = {
3
3
  fullVersion: string;
4
4
  major: string;
@@ -60,12 +60,30 @@ export declare class TinaSchema {
60
60
  *
61
61
  */
62
62
  getTemplatesForCollectable: (collection: Collectable) => CollectionTemplateable;
63
+ /**
64
+ * Walk all fields in tina schema
65
+ *
66
+ * @param cb callback function invoked for each field
67
+ */
63
68
  walkFields(cb: (args: {
64
69
  field: any;
65
70
  collection: any;
66
71
  path: string;
67
72
  isListItem?: boolean;
68
73
  }) => void): void;
74
+ /**
75
+ * Walk all fields in Tina Schema
76
+ *
77
+ * This is a legacy version to preserve backwards compatibility for the tina generated schema. It does not
78
+ * traverse fields in object lists in rich-text templates.
79
+ *
80
+ * @param cb callback function invoked for each field
81
+ */
82
+ legacyWalkFields: (cb: (args: {
83
+ field: TinaField;
84
+ collection: Collection;
85
+ path: string[];
86
+ }) => void) => void;
69
87
  /**
70
88
  * This function returns an array of glob matches for a given collection.
71
89
  *
@@ -1,5 +1,8 @@
1
1
  import type { FC } from 'react';
2
2
  import type React from 'react';
3
+ export declare const CONTENT_FORMATS: readonly ["mdx", "md", "markdown", "json", "yaml", "yml", "toml"];
4
+ export type ContentFormat = (typeof CONTENT_FORMATS)[number];
5
+ export type ContentFrontmatterFormat = 'yaml' | 'toml' | 'json';
3
6
  type Meta = {
4
7
  active?: boolean;
5
8
  dirty?: boolean;
@@ -400,7 +403,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
400
403
  token?: string | null;
401
404
  ui?: {
402
405
  /**
403
- * When using Tina Cloud's branching feature, provide the URL for your given branch
406
+ * When using TinaCloud's branching feature, provide the URL for your given branch
404
407
  *
405
408
  * Eg. If you're deplying to Vercel, and your repo name is 'my-app',
406
409
  * Vercel's preview URL would be based on the branch:
@@ -527,7 +530,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
527
530
  } | {
528
531
  searchClient?: never;
529
532
  /**
530
- * Use the Tina Cloud search index
533
+ * Use the TinaCloud search index
531
534
  */
532
535
  tina: {
533
536
  /**
@@ -554,7 +557,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
554
557
  maxSearchIndexFieldLength?: number;
555
558
  };
556
559
  /**
557
- * Used to override the default Tina Cloud API URL
560
+ * Used to override the default TinaCloud API URL
558
561
  *
559
562
  * [mostly for internal use only]
560
563
  */
@@ -587,7 +590,7 @@ interface BaseCollection {
587
590
  name: string;
588
591
  path: string;
589
592
  indexes?: IndexType[];
590
- format?: 'json' | 'md' | 'markdown' | 'mdx' | 'yaml' | 'yml' | 'toml';
593
+ format?: ContentFormat;
591
594
  ui?: UICollection;
592
595
  /**
593
596
  * @deprecated - use `ui.defaultItem` on the each `template` instead
@@ -596,7 +599,7 @@ interface BaseCollection {
596
599
  /**
597
600
  * This format will be used to parse the markdown frontmatter
598
601
  */
599
- frontmatterFormat?: 'yaml' | 'toml' | 'json';
602
+ frontmatterFormat?: ContentFrontmatterFormat;
600
603
  /**
601
604
  * The delimiters used to parse the frontmatter.
602
605
  */
@@ -1 +1,9 @@
1
1
  export declare const normalizePath: (filepath: string) => string;
2
+ /**
3
+ * Returns the given path such that:
4
+ * - The path separator is converted from '\' to '/' if necessary.
5
+ * - Duplicate '/' are removed
6
+ * - Leading and trailing '/' are cleared
7
+ * @param filepath Filepath to convert to its canonical form
8
+ */
9
+ export declare const canonicalPath: (filepath: string) => string;
@@ -3,21 +3,21 @@ export declare const CollectionBaseSchema: z.ZodObject<{
3
3
  label: z.ZodOptional<z.ZodString>;
4
4
  name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
5
5
  path: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
6
- format: z.ZodOptional<z.ZodEnum<["json", "md", "markdown", "mdx", "toml", "yaml", "yml"]>>;
6
+ format: z.ZodOptional<z.ZodEnum<["mdx", "md", "markdown", "json", "yaml", "yml", "toml"]>>;
7
7
  isAuthCollection: z.ZodOptional<z.ZodBoolean>;
8
8
  isDetached: z.ZodOptional<z.ZodBoolean>;
9
9
  }, "strip", z.ZodTypeAny, {
10
10
  name?: string;
11
11
  label?: string;
12
12
  path?: string;
13
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
13
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
14
14
  isDetached?: boolean;
15
15
  isAuthCollection?: boolean;
16
16
  }, {
17
17
  name?: string;
18
18
  label?: string;
19
19
  path?: string;
20
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
20
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
21
21
  isDetached?: boolean;
22
22
  isAuthCollection?: boolean;
23
23
  }>;
@@ -26,90 +26,90 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
26
26
  label: z.ZodOptional<z.ZodString>;
27
27
  name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
28
28
  path: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
29
- format: z.ZodOptional<z.ZodEnum<["json", "md", "markdown", "mdx", "toml", "yaml", "yml"]>>;
29
+ format: z.ZodOptional<z.ZodEnum<["mdx", "md", "markdown", "json", "yaml", "yml", "toml"]>>;
30
30
  isAuthCollection: z.ZodOptional<z.ZodBoolean>;
31
31
  isDetached: z.ZodOptional<z.ZodBoolean>;
32
32
  }, {
33
- fields: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodType<import("..").TinaField, z.ZodTypeDef, import("..").TinaField>, "many">>, import("..").TinaField[], import("..").TinaField[]>, import("..").TinaField[], import("..").TinaField[]>, import("..").TinaField[], import("..").TinaField[]>, import("..").TinaField[], import("..").TinaField[]>;
33
+ fields: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodType<import("../types/index").TinaField, z.ZodTypeDef, import("../types/index").TinaField>, "many">>, import("../types/index").TinaField[], import("../types/index").TinaField[]>, import("../types/index").TinaField[], import("../types/index").TinaField[]>, import("../types/index").TinaField[], import("../types/index").TinaField[]>, import("../types/index").TinaField[], import("../types/index").TinaField[]>;
34
34
  templates: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
35
35
  label: z.ZodString;
36
36
  name: z.ZodEffects<z.ZodString, string, string>;
37
- fields: z.ZodArray<z.ZodType<import("..").TinaField, z.ZodTypeDef, import("..").TinaField>, "many">;
37
+ fields: z.ZodArray<z.ZodType<import("../types/index").TinaField, z.ZodTypeDef, import("../types/index").TinaField>, "many">;
38
38
  }, "strip", z.ZodTypeAny, {
39
39
  name?: string;
40
- fields?: import("..").TinaField[];
40
+ fields?: import("../types/index").TinaField[];
41
41
  label?: string;
42
42
  }, {
43
43
  name?: string;
44
- fields?: import("..").TinaField[];
44
+ fields?: import("../types/index").TinaField[];
45
45
  label?: string;
46
46
  }>, {
47
47
  name?: string;
48
- fields?: import("..").TinaField[];
48
+ fields?: import("../types/index").TinaField[];
49
49
  label?: string;
50
50
  }, {
51
51
  name?: string;
52
- fields?: import("..").TinaField[];
52
+ fields?: import("../types/index").TinaField[];
53
53
  label?: string;
54
54
  }>, "many">>, {
55
55
  name?: string;
56
- fields?: import("..").TinaField[];
56
+ fields?: import("../types/index").TinaField[];
57
57
  label?: string;
58
58
  }[], {
59
59
  name?: string;
60
- fields?: import("..").TinaField[];
60
+ fields?: import("../types/index").TinaField[];
61
61
  label?: string;
62
62
  }[]>;
63
63
  }>, "strip", z.ZodTypeAny, {
64
64
  name?: string;
65
65
  templates?: {
66
66
  name?: string;
67
- fields?: import("..").TinaField[];
67
+ fields?: import("../types/index").TinaField[];
68
68
  label?: string;
69
69
  }[];
70
- fields?: import("..").TinaField[];
70
+ fields?: import("../types/index").TinaField[];
71
71
  label?: string;
72
72
  path?: string;
73
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
73
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
74
74
  isDetached?: boolean;
75
75
  isAuthCollection?: boolean;
76
76
  }, {
77
77
  name?: string;
78
78
  templates?: {
79
79
  name?: string;
80
- fields?: import("..").TinaField[];
80
+ fields?: import("../types/index").TinaField[];
81
81
  label?: string;
82
82
  }[];
83
- fields?: import("..").TinaField[];
83
+ fields?: import("../types/index").TinaField[];
84
84
  label?: string;
85
85
  path?: string;
86
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
86
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
87
87
  isDetached?: boolean;
88
88
  isAuthCollection?: boolean;
89
89
  }>, {
90
90
  name?: string;
91
91
  templates?: {
92
92
  name?: string;
93
- fields?: import("..").TinaField[];
93
+ fields?: import("../types/index").TinaField[];
94
94
  label?: string;
95
95
  }[];
96
- fields?: import("..").TinaField[];
96
+ fields?: import("../types/index").TinaField[];
97
97
  label?: string;
98
98
  path?: string;
99
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
99
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
100
100
  isDetached?: boolean;
101
101
  isAuthCollection?: boolean;
102
102
  }, {
103
103
  name?: string;
104
104
  templates?: {
105
105
  name?: string;
106
- fields?: import("..").TinaField[];
106
+ fields?: import("../types/index").TinaField[];
107
107
  label?: string;
108
108
  }[];
109
- fields?: import("..").TinaField[];
109
+ fields?: import("../types/index").TinaField[];
110
110
  label?: string;
111
111
  path?: string;
112
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
112
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
113
113
  isDetached?: boolean;
114
114
  isAuthCollection?: boolean;
115
115
  }>, "many">;
@@ -237,13 +237,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
237
237
  name?: string;
238
238
  templates?: {
239
239
  name?: string;
240
- fields?: import("..").TinaField[];
240
+ fields?: import("../types/index").TinaField[];
241
241
  label?: string;
242
242
  }[];
243
- fields?: import("..").TinaField[];
243
+ fields?: import("../types/index").TinaField[];
244
244
  label?: string;
245
245
  path?: string;
246
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
246
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
247
247
  isDetached?: boolean;
248
248
  isAuthCollection?: boolean;
249
249
  }[];
@@ -275,13 +275,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
275
275
  name?: string;
276
276
  templates?: {
277
277
  name?: string;
278
- fields?: import("..").TinaField[];
278
+ fields?: import("../types/index").TinaField[];
279
279
  label?: string;
280
280
  }[];
281
- fields?: import("..").TinaField[];
281
+ fields?: import("../types/index").TinaField[];
282
282
  label?: string;
283
283
  path?: string;
284
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
284
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
285
285
  isDetached?: boolean;
286
286
  isAuthCollection?: boolean;
287
287
  }[];
@@ -313,13 +313,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
313
313
  name?: string;
314
314
  templates?: {
315
315
  name?: string;
316
- fields?: import("..").TinaField[];
316
+ fields?: import("../types/index").TinaField[];
317
317
  label?: string;
318
318
  }[];
319
- fields?: import("..").TinaField[];
319
+ fields?: import("../types/index").TinaField[];
320
320
  label?: string;
321
321
  path?: string;
322
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
322
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
323
323
  isDetached?: boolean;
324
324
  isAuthCollection?: boolean;
325
325
  }[];
@@ -351,13 +351,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
351
351
  name?: string;
352
352
  templates?: {
353
353
  name?: string;
354
- fields?: import("..").TinaField[];
354
+ fields?: import("../types/index").TinaField[];
355
355
  label?: string;
356
356
  }[];
357
- fields?: import("..").TinaField[];
357
+ fields?: import("../types/index").TinaField[];
358
358
  label?: string;
359
359
  path?: string;
360
- format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
360
+ format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
361
361
  isDetached?: boolean;
362
362
  isAuthCollection?: boolean;
363
363
  }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
- "version": "0.0.0-d9672bc-20250218033222",
3
+ "version": "0.0.0-ddc5e8e-20250611011547",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -25,14 +25,14 @@
25
25
  "devDependencies": {
26
26
  "@types/jest": "^29.5.14",
27
27
  "@types/micromatch": "^4.0.9",
28
- "@types/react": "^18.3.12",
28
+ "@types/react": "^18.3.18",
29
29
  "@types/yup": "^0.29.14",
30
30
  "jest": "^29.7.0",
31
31
  "react": "^18.3.1",
32
32
  "ts-jest": "^29.2.5",
33
- "typescript": "^5.6.3",
33
+ "typescript": "^5.7.3",
34
34
  "yup": "^0.32.11",
35
- "@tinacms/scripts": "1.3.1"
35
+ "@tinacms/scripts": "0.0.0-ddc5e8e-20250611011547"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": ">=16.14.0",
@@ -48,7 +48,7 @@
48
48
  "dependencies": {
49
49
  "picomatch-browser": "2.2.6",
50
50
  "url-pattern": "^1.0.3",
51
- "zod": "^3.23.8"
51
+ "zod": "^3.24.2"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "tinacms-scripts build",