@tinacms/schema-tools 0.0.0-e70425b-20241028042614 → 0.0.0-e999254-20250610011143
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 +215 -175
- package/dist/index.mjs +215 -175
- package/dist/schema/TinaSchema.d.ts +21 -1
- package/dist/schema/addNamespaceToSchema.d.ts +8 -4
- package/dist/types/index.d.ts +17 -7
- package/dist/util/normalizePath.d.ts +8 -0
- package/dist/validate/fields.d.ts +0 -3
- package/dist/validate/schema.d.ts +36 -39
- package/dist/validate/util.d.ts +3 -0
- package/package.json +6 -6
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
type Node = {
|
|
2
|
+
name?: string;
|
|
3
|
+
value?: string;
|
|
4
|
+
namespace?: string[];
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
export declare function addNamespaceToSchema<T extends Node | string>(maybeNode: T, namespace?: string[]): T;
|
|
8
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -185,7 +188,7 @@ export type ReferenceField = (FieldGeneric<string, undefined, ReferenceFieldOpti
|
|
|
185
188
|
export type PasswordField = (FieldGeneric<string, undefined> | FieldGeneric<string, false>) & BaseField & {
|
|
186
189
|
type: 'password';
|
|
187
190
|
};
|
|
188
|
-
type
|
|
191
|
+
type ToolbarOverrideType = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'italic' | 'raw' | 'embed' | 'mermaid' | 'table';
|
|
189
192
|
type RichTextAst = {
|
|
190
193
|
type: 'root';
|
|
191
194
|
children: Record<string, unknown>[];
|
|
@@ -198,8 +201,14 @@ export type RichTextField<WithNamespace extends boolean = false> = (FieldGeneric
|
|
|
198
201
|
* will be stored as frontmatter
|
|
199
202
|
*/
|
|
200
203
|
isBody?: boolean;
|
|
201
|
-
|
|
204
|
+
/**@deprecated use overrides.toolbar */
|
|
205
|
+
toolbarOverride?: ToolbarOverrideType[];
|
|
202
206
|
templates?: RichTextTemplate<WithNamespace>[];
|
|
207
|
+
overrides?: {
|
|
208
|
+
toolbar?: ToolbarOverrideType[];
|
|
209
|
+
/**Default set to true */
|
|
210
|
+
showFloatingToolbar?: boolean;
|
|
211
|
+
};
|
|
203
212
|
/**
|
|
204
213
|
* By default, Tina parses markdown with MDX, this is a more strict parser
|
|
205
214
|
* that allows you to use structured content inside markdown (via `templates`).
|
|
@@ -394,7 +403,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
394
403
|
token?: string | null;
|
|
395
404
|
ui?: {
|
|
396
405
|
/**
|
|
397
|
-
* When using
|
|
406
|
+
* When using TinaCloud's branching feature, provide the URL for your given branch
|
|
398
407
|
*
|
|
399
408
|
* Eg. If you're deplying to Vercel, and your repo name is 'my-app',
|
|
400
409
|
* Vercel's preview URL would be based on the branch:
|
|
@@ -521,7 +530,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
521
530
|
} | {
|
|
522
531
|
searchClient?: never;
|
|
523
532
|
/**
|
|
524
|
-
* Use the
|
|
533
|
+
* Use the TinaCloud search index
|
|
525
534
|
*/
|
|
526
535
|
tina: {
|
|
527
536
|
/**
|
|
@@ -548,7 +557,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
548
557
|
maxSearchIndexFieldLength?: number;
|
|
549
558
|
};
|
|
550
559
|
/**
|
|
551
|
-
* Used to override the default
|
|
560
|
+
* Used to override the default TinaCloud API URL
|
|
552
561
|
*
|
|
553
562
|
* [mostly for internal use only]
|
|
554
563
|
*/
|
|
@@ -581,7 +590,7 @@ interface BaseCollection {
|
|
|
581
590
|
name: string;
|
|
582
591
|
path: string;
|
|
583
592
|
indexes?: IndexType[];
|
|
584
|
-
format?:
|
|
593
|
+
format?: ContentFormat;
|
|
585
594
|
ui?: UICollection;
|
|
586
595
|
/**
|
|
587
596
|
* @deprecated - use `ui.defaultItem` on the each `template` instead
|
|
@@ -590,7 +599,7 @@ interface BaseCollection {
|
|
|
590
599
|
/**
|
|
591
600
|
* This format will be used to parse the markdown frontmatter
|
|
592
601
|
*/
|
|
593
|
-
frontmatterFormat?:
|
|
602
|
+
frontmatterFormat?: ContentFrontmatterFormat;
|
|
594
603
|
/**
|
|
595
604
|
* The delimiters used to parse the frontmatter.
|
|
596
605
|
*/
|
|
@@ -630,6 +639,7 @@ type Document = {
|
|
|
630
639
|
relativePath: string;
|
|
631
640
|
filename: string;
|
|
632
641
|
extension: string;
|
|
642
|
+
hasReferences?: boolean;
|
|
633
643
|
};
|
|
634
644
|
};
|
|
635
645
|
export interface UICollection<Form = any, CMS = any, TinaForm = any> {
|
|
@@ -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;
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
1
|
import { z } from 'zod';
|
|
5
2
|
export declare const CollectionBaseSchema: z.ZodObject<{
|
|
6
3
|
label: z.ZodOptional<z.ZodString>;
|
|
7
4
|
name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
8
5
|
path: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
9
|
-
format: z.ZodOptional<z.ZodEnum<["
|
|
6
|
+
format: z.ZodOptional<z.ZodEnum<["mdx", "md", "markdown", "json", "yaml", "yml", "toml"]>>;
|
|
10
7
|
isAuthCollection: z.ZodOptional<z.ZodBoolean>;
|
|
11
8
|
isDetached: z.ZodOptional<z.ZodBoolean>;
|
|
12
9
|
}, "strip", z.ZodTypeAny, {
|
|
13
10
|
name?: string;
|
|
14
11
|
label?: string;
|
|
15
12
|
path?: string;
|
|
16
|
-
format?: "
|
|
13
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
17
14
|
isDetached?: boolean;
|
|
18
15
|
isAuthCollection?: boolean;
|
|
19
16
|
}, {
|
|
20
17
|
name?: string;
|
|
21
18
|
label?: string;
|
|
22
19
|
path?: string;
|
|
23
|
-
format?: "
|
|
20
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
24
21
|
isDetached?: boolean;
|
|
25
22
|
isAuthCollection?: boolean;
|
|
26
23
|
}>;
|
|
@@ -29,90 +26,90 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
29
26
|
label: z.ZodOptional<z.ZodString>;
|
|
30
27
|
name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
31
28
|
path: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
32
|
-
format: z.ZodOptional<z.ZodEnum<["
|
|
29
|
+
format: z.ZodOptional<z.ZodEnum<["mdx", "md", "markdown", "json", "yaml", "yml", "toml"]>>;
|
|
33
30
|
isAuthCollection: z.ZodOptional<z.ZodBoolean>;
|
|
34
31
|
isDetached: z.ZodOptional<z.ZodBoolean>;
|
|
35
32
|
}, {
|
|
36
|
-
fields: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodType<import("
|
|
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[]>;
|
|
37
34
|
templates: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
38
35
|
label: z.ZodString;
|
|
39
36
|
name: z.ZodEffects<z.ZodString, string, string>;
|
|
40
|
-
fields: z.ZodArray<z.ZodType<import("
|
|
37
|
+
fields: z.ZodArray<z.ZodType<import("../types/index").TinaField, z.ZodTypeDef, import("../types/index").TinaField>, "many">;
|
|
41
38
|
}, "strip", z.ZodTypeAny, {
|
|
42
39
|
name?: string;
|
|
43
|
-
fields?: import("
|
|
40
|
+
fields?: import("../types/index").TinaField[];
|
|
44
41
|
label?: string;
|
|
45
42
|
}, {
|
|
46
43
|
name?: string;
|
|
47
|
-
fields?: import("
|
|
44
|
+
fields?: import("../types/index").TinaField[];
|
|
48
45
|
label?: string;
|
|
49
46
|
}>, {
|
|
50
47
|
name?: string;
|
|
51
|
-
fields?: import("
|
|
48
|
+
fields?: import("../types/index").TinaField[];
|
|
52
49
|
label?: string;
|
|
53
50
|
}, {
|
|
54
51
|
name?: string;
|
|
55
|
-
fields?: import("
|
|
52
|
+
fields?: import("../types/index").TinaField[];
|
|
56
53
|
label?: string;
|
|
57
54
|
}>, "many">>, {
|
|
58
55
|
name?: string;
|
|
59
|
-
fields?: import("
|
|
56
|
+
fields?: import("../types/index").TinaField[];
|
|
60
57
|
label?: string;
|
|
61
58
|
}[], {
|
|
62
59
|
name?: string;
|
|
63
|
-
fields?: import("
|
|
60
|
+
fields?: import("../types/index").TinaField[];
|
|
64
61
|
label?: string;
|
|
65
62
|
}[]>;
|
|
66
63
|
}>, "strip", z.ZodTypeAny, {
|
|
67
64
|
name?: string;
|
|
68
65
|
templates?: {
|
|
69
66
|
name?: string;
|
|
70
|
-
fields?: import("
|
|
67
|
+
fields?: import("../types/index").TinaField[];
|
|
71
68
|
label?: string;
|
|
72
69
|
}[];
|
|
73
|
-
fields?: import("
|
|
70
|
+
fields?: import("../types/index").TinaField[];
|
|
74
71
|
label?: string;
|
|
75
72
|
path?: string;
|
|
76
|
-
format?: "
|
|
73
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
77
74
|
isDetached?: boolean;
|
|
78
75
|
isAuthCollection?: boolean;
|
|
79
76
|
}, {
|
|
80
77
|
name?: string;
|
|
81
78
|
templates?: {
|
|
82
79
|
name?: string;
|
|
83
|
-
fields?: import("
|
|
80
|
+
fields?: import("../types/index").TinaField[];
|
|
84
81
|
label?: string;
|
|
85
82
|
}[];
|
|
86
|
-
fields?: import("
|
|
83
|
+
fields?: import("../types/index").TinaField[];
|
|
87
84
|
label?: string;
|
|
88
85
|
path?: string;
|
|
89
|
-
format?: "
|
|
86
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
90
87
|
isDetached?: boolean;
|
|
91
88
|
isAuthCollection?: boolean;
|
|
92
89
|
}>, {
|
|
93
90
|
name?: string;
|
|
94
91
|
templates?: {
|
|
95
92
|
name?: string;
|
|
96
|
-
fields?: import("
|
|
93
|
+
fields?: import("../types/index").TinaField[];
|
|
97
94
|
label?: string;
|
|
98
95
|
}[];
|
|
99
|
-
fields?: import("
|
|
96
|
+
fields?: import("../types/index").TinaField[];
|
|
100
97
|
label?: string;
|
|
101
98
|
path?: string;
|
|
102
|
-
format?: "
|
|
99
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
103
100
|
isDetached?: boolean;
|
|
104
101
|
isAuthCollection?: boolean;
|
|
105
102
|
}, {
|
|
106
103
|
name?: string;
|
|
107
104
|
templates?: {
|
|
108
105
|
name?: string;
|
|
109
|
-
fields?: import("
|
|
106
|
+
fields?: import("../types/index").TinaField[];
|
|
110
107
|
label?: string;
|
|
111
108
|
}[];
|
|
112
|
-
fields?: import("
|
|
109
|
+
fields?: import("../types/index").TinaField[];
|
|
113
110
|
label?: string;
|
|
114
111
|
path?: string;
|
|
115
|
-
format?: "
|
|
112
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
116
113
|
isDetached?: boolean;
|
|
117
114
|
isAuthCollection?: boolean;
|
|
118
115
|
}>, "many">;
|
|
@@ -240,13 +237,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
240
237
|
name?: string;
|
|
241
238
|
templates?: {
|
|
242
239
|
name?: string;
|
|
243
|
-
fields?: import("
|
|
240
|
+
fields?: import("../types/index").TinaField[];
|
|
244
241
|
label?: string;
|
|
245
242
|
}[];
|
|
246
|
-
fields?: import("
|
|
243
|
+
fields?: import("../types/index").TinaField[];
|
|
247
244
|
label?: string;
|
|
248
245
|
path?: string;
|
|
249
|
-
format?: "
|
|
246
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
250
247
|
isDetached?: boolean;
|
|
251
248
|
isAuthCollection?: boolean;
|
|
252
249
|
}[];
|
|
@@ -278,13 +275,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
278
275
|
name?: string;
|
|
279
276
|
templates?: {
|
|
280
277
|
name?: string;
|
|
281
|
-
fields?: import("
|
|
278
|
+
fields?: import("../types/index").TinaField[];
|
|
282
279
|
label?: string;
|
|
283
280
|
}[];
|
|
284
|
-
fields?: import("
|
|
281
|
+
fields?: import("../types/index").TinaField[];
|
|
285
282
|
label?: string;
|
|
286
283
|
path?: string;
|
|
287
|
-
format?: "
|
|
284
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
288
285
|
isDetached?: boolean;
|
|
289
286
|
isAuthCollection?: boolean;
|
|
290
287
|
}[];
|
|
@@ -316,13 +313,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
316
313
|
name?: string;
|
|
317
314
|
templates?: {
|
|
318
315
|
name?: string;
|
|
319
|
-
fields?: import("
|
|
316
|
+
fields?: import("../types/index").TinaField[];
|
|
320
317
|
label?: string;
|
|
321
318
|
}[];
|
|
322
|
-
fields?: import("
|
|
319
|
+
fields?: import("../types/index").TinaField[];
|
|
323
320
|
label?: string;
|
|
324
321
|
path?: string;
|
|
325
|
-
format?: "
|
|
322
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
326
323
|
isDetached?: boolean;
|
|
327
324
|
isAuthCollection?: boolean;
|
|
328
325
|
}[];
|
|
@@ -354,13 +351,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
354
351
|
name?: string;
|
|
355
352
|
templates?: {
|
|
356
353
|
name?: string;
|
|
357
|
-
fields?: import("
|
|
354
|
+
fields?: import("../types/index").TinaField[];
|
|
358
355
|
label?: string;
|
|
359
356
|
}[];
|
|
360
|
-
fields?: import("
|
|
357
|
+
fields?: import("../types/index").TinaField[];
|
|
361
358
|
label?: string;
|
|
362
359
|
path?: string;
|
|
363
|
-
format?: "
|
|
360
|
+
format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
|
|
364
361
|
isDetached?: boolean;
|
|
365
362
|
isAuthCollection?: boolean;
|
|
366
363
|
}[];
|
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-e999254-20250610011143",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/jest": "^29.5.
|
|
26
|
+
"@types/jest": "^29.5.14",
|
|
27
27
|
"@types/micromatch": "^4.0.9",
|
|
28
|
-
"@types/react": "^18.3.
|
|
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.
|
|
33
|
+
"typescript": "^5.7.3",
|
|
34
34
|
"yup": "^0.32.11",
|
|
35
|
-
"@tinacms/scripts": "
|
|
35
|
+
"@tinacms/scripts": "0.0.0-e999254-20250610011143"
|
|
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.
|
|
51
|
+
"zod": "^3.24.2"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "tinacms-scripts build",
|