@tinacms/schema-tools 1.2.0 → 1.2.1

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.es.js CHANGED
@@ -293,7 +293,15 @@ class TinaSchema {
293
293
  return { [_template]: this.transformCollectablePayload(rest, field) };
294
294
  }
295
295
  } else {
296
- return value;
296
+ if (field.list) {
297
+ assertShape(value, (yup2) => yup2.array(yup2.object()));
298
+ return value.map((item) => {
299
+ return this.transformCollectablePayload(item, field);
300
+ });
301
+ } else {
302
+ assertShape(value, (yup2) => yup2.object());
303
+ return this.transformCollectablePayload(value, field);
304
+ }
297
305
  }
298
306
  else {
299
307
  return value;
@@ -777,7 +785,14 @@ const Template = z.object({
777
785
  });
778
786
  const TinaCloudCollectionBase = z.object({
779
787
  label: z.string().optional(),
780
- name,
788
+ name: name.superRefine((val, ctx) => {
789
+ if (val === "relativePath") {
790
+ ctx.addIssue({
791
+ code: z.ZodIssueCode.custom,
792
+ message: `name cannot be 'relativePath'. 'relativePath' is a reserved field name.`
793
+ });
794
+ }
795
+ }),
781
796
  format: z.enum(FORMATS).optional()
782
797
  });
783
798
  const TinaCloudCollection = TinaCloudCollectionBase.extend({
package/dist/index.js CHANGED
@@ -320,7 +320,15 @@
320
320
  return { [_template]: this.transformCollectablePayload(rest, field) };
321
321
  }
322
322
  } else {
323
- return value;
323
+ if (field.list) {
324
+ assertShape(value, (yup2) => yup2.array(yup2.object()));
325
+ return value.map((item) => {
326
+ return this.transformCollectablePayload(item, field);
327
+ });
328
+ } else {
329
+ assertShape(value, (yup2) => yup2.object());
330
+ return this.transformCollectablePayload(value, field);
331
+ }
324
332
  }
325
333
  else {
326
334
  return value;
@@ -804,7 +812,14 @@ ${JSON.stringify(val, null, 2)}
804
812
  });
805
813
  const TinaCloudCollectionBase = z.z.object({
806
814
  label: z.z.string().optional(),
807
- name,
815
+ name: name.superRefine((val, ctx) => {
816
+ if (val === "relativePath") {
817
+ ctx.addIssue({
818
+ code: z.z.ZodIssueCode.custom,
819
+ message: `name cannot be 'relativePath'. 'relativePath' is a reserved field name.`
820
+ });
821
+ }
822
+ }),
808
823
  format: z.z.enum(FORMATS).optional()
809
824
  });
810
825
  const TinaCloudCollection = TinaCloudCollectionBase.extend({
package/dist/types.d.ts CHANGED
@@ -426,6 +426,19 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
426
426
  */
427
427
  referenceDepth?: number;
428
428
  };
429
+ /**
430
+ *
431
+ * Tina supports serving content from a separate Git repo. To enable this during local development, point
432
+ * this config at the root of the content repo.
433
+ *
434
+ * NOTE: Relative paths are fine to use here, but you should use an environment variable for this, as each developer on your team may have a different
435
+ * location to the path.
436
+ *
437
+ * ```ts
438
+ * localContentPath: process.env.REMOTE_ROOT_PATH // eg. '../../my-content-repo'
439
+ * ```
440
+ */
441
+ localContentPath?: string;
429
442
  /**
430
443
  * Tina is compiled as a single-page app and placed in the public directory
431
444
  * of your application.
@@ -14,7 +14,7 @@ import { z } from 'zod';
14
14
  export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
15
15
  collections: z.ZodArray<z.ZodEffects<z.ZodObject<z.extendShape<{
16
16
  label: z.ZodOptional<z.ZodString>;
17
- name: z.ZodEffects<z.ZodString, string, string>;
17
+ name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
18
18
  format: z.ZodOptional<z.ZodEnum<["json", "md", "markdown", "mdx", "toml", "yaml"]>>;
19
19
  }, {
20
20
  fields: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodType<import("..").TinaFieldInner<false>, z.ZodTypeDef, import("..").TinaFieldInner<false>>, "many">>, import("..").TinaFieldInner<false>[], import("..").TinaFieldInner<false>[]>, import("..").TinaFieldInner<false>[], import("..").TinaFieldInner<false>[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {