@tinacms/schema-tools 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.es.js +9 -1
- package/dist/index.js +9 -1
- package/dist/schema/TinaSchema.d.ts +0 -3
- package/dist/types/SchemaTypes.d.ts +6 -0
- package/dist/types.d.ts +19 -3
- package/dist/validate/schema.d.ts +9 -9
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -810,7 +810,15 @@ const validateTinaCloudSchemaConfig = (config) => {
|
|
|
810
810
|
const newConfig = tinaConfigZod.parse(config);
|
|
811
811
|
return newConfig;
|
|
812
812
|
};
|
|
813
|
-
const FORMATS = [
|
|
813
|
+
const FORMATS = [
|
|
814
|
+
"json",
|
|
815
|
+
"md",
|
|
816
|
+
"markdown",
|
|
817
|
+
"mdx",
|
|
818
|
+
"toml",
|
|
819
|
+
"yaml",
|
|
820
|
+
"yml"
|
|
821
|
+
];
|
|
814
822
|
const Template = z.object({
|
|
815
823
|
label: z.string({
|
|
816
824
|
invalid_type_error: "label must be a string",
|
package/dist/index.js
CHANGED
|
@@ -837,7 +837,15 @@ ${JSON.stringify(val, null, 2)}
|
|
|
837
837
|
const newConfig = tinaConfigZod.parse(config);
|
|
838
838
|
return newConfig;
|
|
839
839
|
};
|
|
840
|
-
const FORMATS = [
|
|
840
|
+
const FORMATS = [
|
|
841
|
+
"json",
|
|
842
|
+
"md",
|
|
843
|
+
"markdown",
|
|
844
|
+
"mdx",
|
|
845
|
+
"toml",
|
|
846
|
+
"yaml",
|
|
847
|
+
"yml"
|
|
848
|
+
];
|
|
841
849
|
const Template = z.z.object({
|
|
842
850
|
label: z.z.string({
|
|
843
851
|
invalid_type_error: "label must be a string",
|
|
@@ -275,6 +275,12 @@ export interface RichTypeInner extends TinaField {
|
|
|
275
275
|
type: 'rich-text';
|
|
276
276
|
isBody?: boolean;
|
|
277
277
|
list?: boolean;
|
|
278
|
+
parser?: {
|
|
279
|
+
type: 'markdown';
|
|
280
|
+
skipEscaping?: 'all' | 'html' | 'none';
|
|
281
|
+
} | {
|
|
282
|
+
type: 'mdx';
|
|
283
|
+
};
|
|
278
284
|
templates?: (string | (Template<false> & {
|
|
279
285
|
inline?: boolean;
|
|
280
286
|
}))[];
|
package/dist/types.d.ts
CHANGED
|
@@ -169,7 +169,7 @@ declare type UIField<Type, List extends boolean> = {
|
|
|
169
169
|
*/
|
|
170
170
|
validate?(value: List extends true ? Type[] : Type, allValues: {
|
|
171
171
|
[key: string]: any;
|
|
172
|
-
}, meta: Meta, field: UIField<Type, List>):
|
|
172
|
+
}, meta: Meta, field: UIField<Type, List>): string | void;
|
|
173
173
|
/**
|
|
174
174
|
* @deprecated use `defaultItem` at the collection level instead
|
|
175
175
|
*/
|
|
@@ -269,6 +269,22 @@ export declare type RichTextField = (FieldGeneric<RichTextAst, undefined> | Fiel
|
|
|
269
269
|
name?: string;
|
|
270
270
|
};
|
|
271
271
|
})[];
|
|
272
|
+
/**
|
|
273
|
+
* By default, Tina parses markdown with MDX, this is a more strict parser
|
|
274
|
+
* that allows you to use structured content inside markdown (via `templates`).
|
|
275
|
+
*
|
|
276
|
+
* Specify `"markdown"` if you're having problems with Tina parsing your content.
|
|
277
|
+
*/
|
|
278
|
+
parser?: {
|
|
279
|
+
type: 'markdown';
|
|
280
|
+
/**
|
|
281
|
+
* Tina will escape entities like `<` and `[` by default. You can choose to turn
|
|
282
|
+
* off all escaping, or specify HTML, so `<div>` will not be turned into `\<div>`
|
|
283
|
+
*/
|
|
284
|
+
skipEscaping?: 'all' | 'html' | 'none';
|
|
285
|
+
} | {
|
|
286
|
+
type: 'mdx';
|
|
287
|
+
};
|
|
272
288
|
};
|
|
273
289
|
declare type DefaultItem<ReturnType> = ReturnType | (() => ReturnType);
|
|
274
290
|
declare type ObjectUiProps = {
|
|
@@ -324,7 +340,7 @@ export interface FieldCollection {
|
|
|
324
340
|
label?: string;
|
|
325
341
|
name: string;
|
|
326
342
|
path: string;
|
|
327
|
-
format?: 'json' | 'md' | 'markdown' | 'mdx' | 'yaml' | 'toml';
|
|
343
|
+
format?: 'json' | 'md' | 'markdown' | 'mdx' | 'yaml' | 'yml' | 'toml';
|
|
328
344
|
/**
|
|
329
345
|
* This format will be used to parse the markdown frontmatter
|
|
330
346
|
*/
|
|
@@ -352,7 +368,7 @@ export interface TemplateCollection {
|
|
|
352
368
|
label?: string;
|
|
353
369
|
name: string;
|
|
354
370
|
path: string;
|
|
355
|
-
format?: 'json' | 'md' | 'markdown' | 'mdx' | 'yaml' | 'toml';
|
|
371
|
+
format?: 'json' | 'md' | 'markdown' | 'mdx' | 'yaml' | 'yml' | 'toml';
|
|
356
372
|
ui?: UICollection;
|
|
357
373
|
/**
|
|
358
374
|
* @deprecated - use `ui.defaultItem` on the each `template` instead
|
|
@@ -6,7 +6,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
6
6
|
collections: z.ZodArray<z.ZodEffects<z.ZodObject<z.extendShape<{
|
|
7
7
|
label: z.ZodOptional<z.ZodString>;
|
|
8
8
|
name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
9
|
-
format: z.ZodOptional<z.ZodEnum<["json", "md", "markdown", "mdx", "toml", "yaml"]>>;
|
|
9
|
+
format: z.ZodOptional<z.ZodEnum<["json", "md", "markdown", "mdx", "toml", "yaml", "yml"]>>;
|
|
10
10
|
}, {
|
|
11
11
|
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>[]>;
|
|
12
12
|
templates: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
@@ -46,7 +46,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
46
46
|
fields?: import("..").TinaFieldInner<false>[];
|
|
47
47
|
label?: string;
|
|
48
48
|
}[];
|
|
49
|
-
format?: "
|
|
49
|
+
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
50
50
|
label?: string;
|
|
51
51
|
}, {
|
|
52
52
|
name?: string;
|
|
@@ -56,7 +56,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
56
56
|
fields?: import("..").TinaFieldInner<false>[];
|
|
57
57
|
label?: string;
|
|
58
58
|
}[];
|
|
59
|
-
format?: "
|
|
59
|
+
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
60
60
|
label?: string;
|
|
61
61
|
}>, {
|
|
62
62
|
name?: string;
|
|
@@ -66,7 +66,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
66
66
|
fields?: import("..").TinaFieldInner<false>[];
|
|
67
67
|
label?: string;
|
|
68
68
|
}[];
|
|
69
|
-
format?: "
|
|
69
|
+
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
70
70
|
label?: string;
|
|
71
71
|
}, {
|
|
72
72
|
name?: string;
|
|
@@ -76,7 +76,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
76
76
|
fields?: import("..").TinaFieldInner<false>[];
|
|
77
77
|
label?: string;
|
|
78
78
|
}[];
|
|
79
|
-
format?: "
|
|
79
|
+
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
80
80
|
label?: string;
|
|
81
81
|
}>, "many">;
|
|
82
82
|
config: z.ZodOptional<z.ZodObject<{
|
|
@@ -144,7 +144,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
144
144
|
fields?: import("..").TinaFieldInner<false>[];
|
|
145
145
|
label?: string;
|
|
146
146
|
}[];
|
|
147
|
-
format?: "
|
|
147
|
+
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
148
148
|
label?: string;
|
|
149
149
|
}[];
|
|
150
150
|
config?: {
|
|
@@ -168,7 +168,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
168
168
|
fields?: import("..").TinaFieldInner<false>[];
|
|
169
169
|
label?: string;
|
|
170
170
|
}[];
|
|
171
|
-
format?: "
|
|
171
|
+
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
172
172
|
label?: string;
|
|
173
173
|
}[];
|
|
174
174
|
config?: {
|
|
@@ -192,7 +192,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
192
192
|
fields?: import("..").TinaFieldInner<false>[];
|
|
193
193
|
label?: string;
|
|
194
194
|
}[];
|
|
195
|
-
format?: "
|
|
195
|
+
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
196
196
|
label?: string;
|
|
197
197
|
}[];
|
|
198
198
|
config?: {
|
|
@@ -216,7 +216,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
216
216
|
fields?: import("..").TinaFieldInner<false>[];
|
|
217
217
|
label?: string;
|
|
218
218
|
}[];
|
|
219
|
-
format?: "
|
|
219
|
+
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
220
220
|
label?: string;
|
|
221
221
|
}[];
|
|
222
222
|
config?: {
|