@tinacms/schema-tools 1.6.1 → 1.6.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.
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Schema, Collection, Template, Collectable, CollectionTemplateable, TinaField } from '../types/index';
|
|
2
|
-
|
|
2
|
+
type Version = {
|
|
3
3
|
fullVersion: string;
|
|
4
4
|
major: string;
|
|
5
5
|
minor: string;
|
|
6
6
|
patch: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type Meta = {
|
|
9
9
|
flags?: string[];
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
@@ -34,7 +34,7 @@ export declare class TinaSchema {
|
|
|
34
34
|
getCollectionAndTemplateByFullPath: (filepath: string, templateName?: string) => {
|
|
35
35
|
collection: Collection<true>;
|
|
36
36
|
template: Template<true>;
|
|
37
|
-
};
|
|
37
|
+
} | undefined;
|
|
38
38
|
getTemplateForData: ({ data, collection, }: {
|
|
39
39
|
data?: unknown;
|
|
40
40
|
collection: Collectable;
|
|
@@ -9,6 +9,6 @@ import type { TinaSchema } from './TinaSchema';
|
|
|
9
9
|
export declare const resolveField: (field: TinaField<true>, schema: TinaSchema) => {
|
|
10
10
|
[key: string]: unknown;
|
|
11
11
|
name: string;
|
|
12
|
-
component: NonNullable<TinaField<true>[
|
|
12
|
+
component: NonNullable<TinaField<true>["ui"]>["component"];
|
|
13
13
|
type: string;
|
|
14
14
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
|
-
/// <reference types="react" />
|
|
5
4
|
import type { Template, Collection } from '../types/index';
|
|
6
5
|
import type { TinaSchema } from './TinaSchema';
|
|
7
6
|
/**
|
|
@@ -14,171 +13,11 @@ export declare const resolveForm: ({ collection, basename, template, schema, }:
|
|
|
14
13
|
fields: {
|
|
15
14
|
[key: string]: unknown;
|
|
16
15
|
name: string;
|
|
17
|
-
component:
|
|
18
|
-
field: import("../types/index").TinaField<false> & {
|
|
19
|
-
namespace: string[];
|
|
20
|
-
};
|
|
21
|
-
input: {
|
|
22
|
-
name: string;
|
|
23
|
-
onBlur: (event?: import("react").FocusEvent<number, Element>) => void;
|
|
24
|
-
onChange: (event: import("react").ChangeEvent<number>) => void;
|
|
25
|
-
onFocus: (event?: import("react").FocusEvent<number, Element>) => void;
|
|
26
|
-
type?: string;
|
|
27
|
-
value: number[];
|
|
28
|
-
};
|
|
29
|
-
meta: {
|
|
30
|
-
active?: boolean;
|
|
31
|
-
dirty?: boolean;
|
|
32
|
-
error?: any;
|
|
33
|
-
};
|
|
34
|
-
}) => any) | ((props: {
|
|
35
|
-
field: import("../types/index").TinaField<false> & {
|
|
36
|
-
namespace: string[];
|
|
37
|
-
};
|
|
38
|
-
input: {
|
|
39
|
-
name: string;
|
|
40
|
-
onBlur: (event?: import("react").FocusEvent<string, Element>) => void;
|
|
41
|
-
onChange: (event: import("react").ChangeEvent<string>) => void;
|
|
42
|
-
onFocus: (event?: import("react").FocusEvent<string, Element>) => void;
|
|
43
|
-
type?: string;
|
|
44
|
-
value: string[];
|
|
45
|
-
};
|
|
46
|
-
meta: {
|
|
47
|
-
active?: boolean;
|
|
48
|
-
dirty?: boolean;
|
|
49
|
-
error?: any;
|
|
50
|
-
};
|
|
51
|
-
}) => any) | ((props: {
|
|
52
|
-
field: import("../types/index").TinaField<false> & {
|
|
53
|
-
namespace: string[];
|
|
54
|
-
};
|
|
55
|
-
input: {
|
|
56
|
-
name: string;
|
|
57
|
-
onBlur: (event?: import("react").FocusEvent<boolean, Element>) => void;
|
|
58
|
-
onChange: (event: import("react").ChangeEvent<boolean>) => void;
|
|
59
|
-
onFocus: (event?: import("react").FocusEvent<boolean, Element>) => void;
|
|
60
|
-
type?: string;
|
|
61
|
-
value: boolean[];
|
|
62
|
-
};
|
|
63
|
-
meta: {
|
|
64
|
-
active?: boolean;
|
|
65
|
-
dirty?: boolean;
|
|
66
|
-
error?: any;
|
|
67
|
-
};
|
|
68
|
-
}) => any) | ((props: {
|
|
69
|
-
field: import("../types/index").TinaField<false> & {
|
|
70
|
-
namespace: string[];
|
|
71
|
-
};
|
|
72
|
-
input: {
|
|
73
|
-
name: string;
|
|
74
|
-
onBlur: (event?: import("react").FocusEvent<{
|
|
75
|
-
type: "root";
|
|
76
|
-
children: Record<string, unknown>[];
|
|
77
|
-
}, Element>) => void;
|
|
78
|
-
onChange: (event: import("react").ChangeEvent<{
|
|
79
|
-
type: "root";
|
|
80
|
-
children: Record<string, unknown>[];
|
|
81
|
-
}>) => void;
|
|
82
|
-
onFocus: (event?: import("react").FocusEvent<{
|
|
83
|
-
type: "root";
|
|
84
|
-
children: Record<string, unknown>[];
|
|
85
|
-
}, Element>) => void;
|
|
86
|
-
type?: string;
|
|
87
|
-
value: {
|
|
88
|
-
type: "root";
|
|
89
|
-
children: Record<string, unknown>[];
|
|
90
|
-
}[];
|
|
91
|
-
};
|
|
92
|
-
meta: {
|
|
93
|
-
active?: boolean;
|
|
94
|
-
dirty?: boolean;
|
|
95
|
-
error?: any;
|
|
96
|
-
};
|
|
97
|
-
}) => any) | ((props: {
|
|
98
|
-
field: import("../types/index").TinaField<false> & {
|
|
99
|
-
namespace: string[];
|
|
100
|
-
};
|
|
101
|
-
input: {
|
|
102
|
-
name: string;
|
|
103
|
-
onBlur: (event?: import("react").FocusEvent<number, Element>) => void;
|
|
104
|
-
onChange: (event: import("react").ChangeEvent<number>) => void;
|
|
105
|
-
onFocus: (event?: import("react").FocusEvent<number, Element>) => void;
|
|
106
|
-
type?: string;
|
|
107
|
-
value: number;
|
|
108
|
-
};
|
|
109
|
-
meta: {
|
|
110
|
-
active?: boolean;
|
|
111
|
-
dirty?: boolean;
|
|
112
|
-
error?: any;
|
|
113
|
-
};
|
|
114
|
-
}) => any) | ((props: {
|
|
115
|
-
field: import("../types/index").TinaField<false> & {
|
|
116
|
-
namespace: string[];
|
|
117
|
-
};
|
|
118
|
-
input: {
|
|
119
|
-
name: string;
|
|
120
|
-
onBlur: (event?: import("react").FocusEvent<string, Element>) => void;
|
|
121
|
-
onChange: (event: import("react").ChangeEvent<string>) => void;
|
|
122
|
-
onFocus: (event?: import("react").FocusEvent<string, Element>) => void;
|
|
123
|
-
type?: string;
|
|
124
|
-
value: string;
|
|
125
|
-
};
|
|
126
|
-
meta: {
|
|
127
|
-
active?: boolean;
|
|
128
|
-
dirty?: boolean;
|
|
129
|
-
error?: any;
|
|
130
|
-
};
|
|
131
|
-
}) => any) | ((props: {
|
|
132
|
-
field: import("../types/index").TinaField<false> & {
|
|
133
|
-
namespace: string[];
|
|
134
|
-
};
|
|
135
|
-
input: {
|
|
136
|
-
name: string;
|
|
137
|
-
onBlur: (event?: import("react").FocusEvent<boolean, Element>) => void;
|
|
138
|
-
onChange: (event: import("react").ChangeEvent<boolean>) => void;
|
|
139
|
-
onFocus: (event?: import("react").FocusEvent<boolean, Element>) => void;
|
|
140
|
-
type?: string;
|
|
141
|
-
value: boolean;
|
|
142
|
-
};
|
|
143
|
-
meta: {
|
|
144
|
-
active?: boolean;
|
|
145
|
-
dirty?: boolean;
|
|
146
|
-
error?: any;
|
|
147
|
-
};
|
|
148
|
-
}) => any) | ((props: {
|
|
149
|
-
field: import("../types/index").TinaField<false> & {
|
|
150
|
-
namespace: string[];
|
|
151
|
-
};
|
|
152
|
-
input: {
|
|
153
|
-
name: string;
|
|
154
|
-
onBlur: (event?: import("react").FocusEvent<{
|
|
155
|
-
type: "root";
|
|
156
|
-
children: Record<string, unknown>[];
|
|
157
|
-
}, Element>) => void;
|
|
158
|
-
onChange: (event: import("react").ChangeEvent<{
|
|
159
|
-
type: "root";
|
|
160
|
-
children: Record<string, unknown>[];
|
|
161
|
-
}>) => void;
|
|
162
|
-
onFocus: (event?: import("react").FocusEvent<{
|
|
163
|
-
type: "root";
|
|
164
|
-
children: Record<string, unknown>[];
|
|
165
|
-
}, Element>) => void;
|
|
166
|
-
type?: string;
|
|
167
|
-
value: {
|
|
168
|
-
type: "root";
|
|
169
|
-
children: Record<string, unknown>[];
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
meta: {
|
|
173
|
-
active?: boolean;
|
|
174
|
-
dirty?: boolean;
|
|
175
|
-
error?: any;
|
|
176
|
-
};
|
|
177
|
-
}) => any);
|
|
16
|
+
component: NonNullable<import("../types/index").TinaField<true>["ui"]>["component"];
|
|
178
17
|
type: string;
|
|
179
18
|
}[];
|
|
180
19
|
};
|
|
181
|
-
|
|
20
|
+
type ResolveFormArgs = {
|
|
182
21
|
collection: Collection<true>;
|
|
183
22
|
basename: string;
|
|
184
23
|
template: Template<true>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
|
|
3
|
+
type Meta = {
|
|
4
4
|
active?: boolean;
|
|
5
5
|
dirty?: boolean;
|
|
6
6
|
error?: any;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type Component<Type, List> = (props: {
|
|
9
9
|
field: TinaField & {
|
|
10
10
|
namespace: string[];
|
|
11
11
|
};
|
|
@@ -31,7 +31,7 @@ declare type Component<Type, List> = (props: {
|
|
|
31
31
|
};
|
|
32
32
|
meta: Meta;
|
|
33
33
|
}) => any;
|
|
34
|
-
export
|
|
34
|
+
export type UIField<Type, List extends boolean> = {
|
|
35
35
|
max?: List extends true ? number : never;
|
|
36
36
|
min?: List extends true ? number : never;
|
|
37
37
|
/**
|
|
@@ -107,7 +107,7 @@ export declare type UIField<Type, List extends boolean> = {
|
|
|
107
107
|
*/
|
|
108
108
|
defaultValue?: List extends true ? Type[] : Type;
|
|
109
109
|
};
|
|
110
|
-
|
|
110
|
+
type FieldGeneric<Type, List extends boolean | undefined, ExtraFieldUIProps = {}> = List extends true ? {
|
|
111
111
|
list: true;
|
|
112
112
|
ui?: UIField<Type, true> & ExtraFieldUIProps;
|
|
113
113
|
} : List extends false ? {
|
|
@@ -117,7 +117,7 @@ declare type FieldGeneric<Type, List extends boolean | undefined, ExtraFieldUIPr
|
|
|
117
117
|
list?: undefined;
|
|
118
118
|
ui?: UIField<Type, false> & ExtraFieldUIProps;
|
|
119
119
|
};
|
|
120
|
-
|
|
120
|
+
type SearchableTextField = {
|
|
121
121
|
maxSearchIndexFieldLength?: number;
|
|
122
122
|
};
|
|
123
123
|
export interface BaseField {
|
|
@@ -130,19 +130,19 @@ export interface BaseField {
|
|
|
130
130
|
searchable?: boolean;
|
|
131
131
|
uid?: boolean;
|
|
132
132
|
}
|
|
133
|
-
export
|
|
133
|
+
export type StringField = (FieldGeneric<string, undefined> | FieldGeneric<string, true> | FieldGeneric<string, false>) & BaseField & SearchableTextField & {
|
|
134
134
|
type: 'string';
|
|
135
135
|
isTitle?: boolean;
|
|
136
136
|
isBody?: boolean;
|
|
137
137
|
options?: Option[];
|
|
138
138
|
};
|
|
139
|
-
export
|
|
139
|
+
export type NumberField = (FieldGeneric<number, undefined> | FieldGeneric<number, true> | FieldGeneric<number, false>) & BaseField & {
|
|
140
140
|
type: 'number';
|
|
141
141
|
};
|
|
142
|
-
export
|
|
142
|
+
export type BooleanField = (FieldGeneric<boolean, undefined> | FieldGeneric<boolean, true> | FieldGeneric<boolean, false>) & BaseField & {
|
|
143
143
|
type: 'boolean';
|
|
144
144
|
};
|
|
145
|
-
|
|
145
|
+
type DateFormatProps = {
|
|
146
146
|
/**
|
|
147
147
|
* Customize the way the format is rendered
|
|
148
148
|
* ```
|
|
@@ -152,23 +152,18 @@ declare type DateFormatProps = {
|
|
|
152
152
|
dateFormat?: string;
|
|
153
153
|
timeFormat?: string;
|
|
154
154
|
};
|
|
155
|
-
export
|
|
155
|
+
export type DateTimeField = (FieldGeneric<string, undefined, DateFormatProps> | FieldGeneric<string, true, DateFormatProps> | FieldGeneric<string, false, DateFormatProps>) & BaseField & {
|
|
156
156
|
type: 'datetime';
|
|
157
157
|
};
|
|
158
|
-
export
|
|
158
|
+
export type ImageField = (FieldGeneric<string, undefined> | FieldGeneric<string, true> | FieldGeneric<string, false>) & BaseField & {
|
|
159
159
|
type: 'image';
|
|
160
160
|
};
|
|
161
|
-
|
|
162
|
-
optionComponent?:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
optionComponent?: (props: {
|
|
168
|
-
values: Record<string, unknown>;
|
|
169
|
-
_sys: Document['_sys'];
|
|
170
|
-
}) => Element | undefined;
|
|
171
|
-
}>) & BaseField & {
|
|
161
|
+
type ReferenceFieldOptions = {
|
|
162
|
+
optionComponent?: OptionComponent;
|
|
163
|
+
experimental___filter?: (list: Array<any>, searchQuery: string) => Array<any>;
|
|
164
|
+
};
|
|
165
|
+
type OptionComponent<P = Record<string, unknown>, S = Document['_sys']> = (props: P, _internalSys: S) => React.ReactNode | Element | undefined;
|
|
166
|
+
export type ReferenceField = (FieldGeneric<string, undefined, ReferenceFieldOptions> | FieldGeneric<string, false, ReferenceFieldOptions>) & BaseField & {
|
|
172
167
|
type: 'reference';
|
|
173
168
|
/**
|
|
174
169
|
* The names of the collections this field can use as a reference
|
|
@@ -182,15 +177,15 @@ export declare type ReferenceField = (FieldGeneric<string, undefined, {
|
|
|
182
177
|
*/
|
|
183
178
|
collections: string[];
|
|
184
179
|
};
|
|
185
|
-
export
|
|
180
|
+
export type PasswordField = (FieldGeneric<string, undefined> | FieldGeneric<string, false>) & BaseField & {
|
|
186
181
|
type: 'password';
|
|
187
182
|
};
|
|
188
|
-
|
|
189
|
-
|
|
183
|
+
type toolbarItemName = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'italic' | 'raw' | 'embed';
|
|
184
|
+
type RichTextAst = {
|
|
190
185
|
type: 'root';
|
|
191
186
|
children: Record<string, unknown>[];
|
|
192
187
|
};
|
|
193
|
-
export
|
|
188
|
+
export type RichTextField<WithNamespace extends boolean = false> = (FieldGeneric<RichTextAst, undefined> | FieldGeneric<RichTextAst, false>) & BaseField & SearchableTextField & {
|
|
194
189
|
type: 'rich-text';
|
|
195
190
|
/**
|
|
196
191
|
* When using Markdown or MDX formats, this field's value
|
|
@@ -217,7 +212,7 @@ export declare type RichTextField<WithNamespace extends boolean = false> = (Fiel
|
|
|
217
212
|
type: 'mdx';
|
|
218
213
|
};
|
|
219
214
|
};
|
|
220
|
-
export
|
|
215
|
+
export type RichTextTemplate<WithNamespace extends boolean = false> = Template<WithNamespace> & {
|
|
221
216
|
inline?: boolean;
|
|
222
217
|
/**
|
|
223
218
|
* If you have some custom shortcode logic in your markdown,
|
|
@@ -242,10 +237,10 @@ export declare type RichTextTemplate<WithNamespace extends boolean = false> = Te
|
|
|
242
237
|
name?: string;
|
|
243
238
|
};
|
|
244
239
|
};
|
|
245
|
-
|
|
240
|
+
type ObjectUiProps = {
|
|
246
241
|
visualSelector?: boolean;
|
|
247
242
|
};
|
|
248
|
-
export
|
|
243
|
+
export type ObjectField<WithNamespace extends boolean = false> = (FieldGeneric<string, undefined, ObjectUiProps> | FieldGeneric<string, true, ObjectUiProps> | FieldGeneric<string, false, ObjectUiProps>) & MaybeNamespace<WithNamespace> & BaseField & ({
|
|
249
244
|
type: 'object';
|
|
250
245
|
fields: Field<WithNamespace>[];
|
|
251
246
|
templates?: undefined;
|
|
@@ -256,12 +251,12 @@ export declare type ObjectField<WithNamespace extends boolean = false> = (FieldG
|
|
|
256
251
|
templates: Template<WithNamespace>[];
|
|
257
252
|
templateKey?: string;
|
|
258
253
|
});
|
|
259
|
-
|
|
260
|
-
export
|
|
261
|
-
|
|
254
|
+
type Field<WithNamespace extends boolean = false> = (StringField | NumberField | BooleanField | DateTimeField | ImageField | ReferenceField | RichTextField<WithNamespace> | ObjectField<WithNamespace> | PasswordField) & MaybeNamespace<WithNamespace>;
|
|
255
|
+
export type TinaField<WithNamespace extends boolean = false> = Field<WithNamespace> & MaybeNamespace<WithNamespace>;
|
|
256
|
+
type MaybeNamespace<WithNamespace extends boolean = false> = WithNamespace extends true ? {
|
|
262
257
|
namespace: string[];
|
|
263
258
|
} : {};
|
|
264
|
-
export
|
|
259
|
+
export type Template<WithNamespace extends boolean = false> = {
|
|
265
260
|
label?: string | boolean;
|
|
266
261
|
name: string;
|
|
267
262
|
nameOverride?: string;
|
|
@@ -295,13 +290,13 @@ export declare type Template<WithNamespace extends boolean = false> = {
|
|
|
295
290
|
};
|
|
296
291
|
fields: Field<WithNamespace>[];
|
|
297
292
|
} & MaybeNamespace<WithNamespace>;
|
|
298
|
-
|
|
293
|
+
type TokenObject = {
|
|
299
294
|
id_token: string;
|
|
300
295
|
access_token?: string;
|
|
301
296
|
refresh_token?: string;
|
|
302
297
|
};
|
|
303
|
-
export
|
|
304
|
-
export
|
|
298
|
+
export type LoginStrategy = 'UsernamePassword' | 'Redirect' | 'LoginScreen';
|
|
299
|
+
export type LoginScreenProps = {
|
|
305
300
|
handleAuthenticate: (props?: Record<string, string>) => Promise<void>;
|
|
306
301
|
};
|
|
307
302
|
export interface AuthProvider {
|
|
@@ -354,7 +349,7 @@ interface AuthHooks {
|
|
|
354
349
|
}) => Promise<void>;
|
|
355
350
|
onLogout?: () => Promise<void>;
|
|
356
351
|
}
|
|
357
|
-
|
|
352
|
+
type AuthOptions = AuthHooks & AuthProvider;
|
|
358
353
|
export interface Config<CMSCallback = undefined, FormifyCallback = undefined, DocumentCreatorCallback = undefined, Store = undefined, SearchClient = undefined> {
|
|
359
354
|
contentApiUrlOverride?: string;
|
|
360
355
|
authProvider?: AuthProvider;
|
|
@@ -562,7 +557,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
562
557
|
formifyCallback?: FormifyCallback;
|
|
563
558
|
documentCreatorCallback?: DocumentCreatorCallback;
|
|
564
559
|
}
|
|
565
|
-
export
|
|
560
|
+
export type TinaCMSConfig<CMSCallback = undefined, FormifyCallback = undefined, DocumentCreatorCallback = undefined, Store = undefined> = Config<CMSCallback, FormifyCallback, DocumentCreatorCallback, Store>;
|
|
566
561
|
export interface Schema<WithNamespace extends boolean = false> {
|
|
567
562
|
/**
|
|
568
563
|
* Collections represent a type of content (EX, blog post, page, author, etc). We recommend using singular naming in a collection (Ex: use post and not posts).
|
|
@@ -575,7 +570,7 @@ export interface Schema<WithNamespace extends boolean = false> {
|
|
|
575
570
|
*/
|
|
576
571
|
config?: Config;
|
|
577
572
|
}
|
|
578
|
-
export
|
|
573
|
+
export type Collection<WithNamespace extends boolean = false> = FieldCollection<WithNamespace> | TemplateCollection<WithNamespace>;
|
|
579
574
|
interface BaseCollection {
|
|
580
575
|
label?: string;
|
|
581
576
|
name: string;
|
|
@@ -602,7 +597,7 @@ interface BaseCollection {
|
|
|
602
597
|
isDetached?: boolean;
|
|
603
598
|
isAuthCollection?: boolean;
|
|
604
599
|
}
|
|
605
|
-
|
|
600
|
+
type TemplateCollection<WithNamespace extends boolean = false> = {
|
|
606
601
|
/**
|
|
607
602
|
* In most cases, just using fields is enough, however templates can be used when there are multiple variants of the same collection or object. For example in a "page" collection there might be a need for a marketing page template and a content page template, both under the collection "page".
|
|
608
603
|
*
|
|
@@ -611,7 +606,7 @@ declare type TemplateCollection<WithNamespace extends boolean = false> = {
|
|
|
611
606
|
templates: Template<WithNamespace>[];
|
|
612
607
|
fields?: undefined;
|
|
613
608
|
} & BaseCollection & MaybeNamespace<WithNamespace>;
|
|
614
|
-
|
|
609
|
+
type FieldCollection<WithNamespace extends boolean = false> = {
|
|
615
610
|
/**
|
|
616
611
|
* Fields define the shape of the content and the user input.
|
|
617
612
|
*
|
|
@@ -620,7 +615,7 @@ declare type FieldCollection<WithNamespace extends boolean = false> = {
|
|
|
620
615
|
fields: TinaField<WithNamespace>[];
|
|
621
616
|
templates?: undefined;
|
|
622
617
|
} & BaseCollection & MaybeNamespace<WithNamespace>;
|
|
623
|
-
|
|
618
|
+
type Document = {
|
|
624
619
|
_sys: {
|
|
625
620
|
title?: string;
|
|
626
621
|
template: string;
|
|
@@ -654,6 +649,15 @@ export interface UICollection<Form = any, CMS = any, TinaForm = any> {
|
|
|
654
649
|
* When set to `true`, editors won't be able to modify the filename
|
|
655
650
|
*/
|
|
656
651
|
readonly?: boolean;
|
|
652
|
+
/**
|
|
653
|
+
* When set to `true`, the filename will be shown first in the form
|
|
654
|
+
* @default false
|
|
655
|
+
*/
|
|
656
|
+
showFirst?: boolean;
|
|
657
|
+
/**
|
|
658
|
+
* Sets the description for the filename field
|
|
659
|
+
*/
|
|
660
|
+
description?: string;
|
|
657
661
|
};
|
|
658
662
|
/**
|
|
659
663
|
* Determines whether or not this collection can accept new docments
|
|
@@ -709,19 +713,19 @@ export interface UICollection<Form = any, CMS = any, TinaForm = any> {
|
|
|
709
713
|
form: TinaForm;
|
|
710
714
|
}) => Promise<void | Record<string, unknown>>;
|
|
711
715
|
}
|
|
712
|
-
export
|
|
713
|
-
|
|
716
|
+
export type DefaultItem<ReturnType> = ReturnType | (() => ReturnType);
|
|
717
|
+
type IndexType = {
|
|
714
718
|
name: string;
|
|
715
719
|
fields: {
|
|
716
720
|
name: string;
|
|
717
721
|
}[];
|
|
718
722
|
};
|
|
719
|
-
export
|
|
723
|
+
export type Option = string | {
|
|
720
724
|
label?: string;
|
|
721
725
|
icon?: FC;
|
|
722
726
|
value: string;
|
|
723
727
|
};
|
|
724
|
-
export
|
|
728
|
+
export type UITemplate = {
|
|
725
729
|
/**
|
|
726
730
|
* Override the properties passed to the field
|
|
727
731
|
* component. This is mostly useful for controlling
|
|
@@ -749,12 +753,12 @@ export declare type UITemplate = {
|
|
|
749
753
|
*/
|
|
750
754
|
previewSrc?: string;
|
|
751
755
|
};
|
|
752
|
-
export
|
|
756
|
+
export type CollectionTemplateableUnion = {
|
|
753
757
|
namespace: string[];
|
|
754
758
|
type: 'union';
|
|
755
759
|
templates: Template<true>[];
|
|
756
760
|
};
|
|
757
|
-
export
|
|
761
|
+
export type CollectionTemplateableObject = {
|
|
758
762
|
namespace: string[];
|
|
759
763
|
type: 'object';
|
|
760
764
|
visualSelector?: boolean;
|
|
@@ -768,60 +772,60 @@ export declare type CollectionTemplateableObject = {
|
|
|
768
772
|
required?: false;
|
|
769
773
|
template: Template<true>;
|
|
770
774
|
};
|
|
771
|
-
export
|
|
772
|
-
export
|
|
775
|
+
export type CollectionTemplateable = CollectionTemplateableUnion | CollectionTemplateableObject;
|
|
776
|
+
export type Collectable = Pick<Collection<true>, 'namespace' | 'templates' | 'fields' | 'name'> & {
|
|
773
777
|
label?: string | boolean;
|
|
774
778
|
};
|
|
775
779
|
/**
|
|
776
780
|
* @deprecated use Config instead
|
|
777
781
|
*/
|
|
778
|
-
export
|
|
782
|
+
export type TinaCloudSchemaConfig<DeleteMe = undefined> = Config;
|
|
779
783
|
/** @deprecated use Schema instead */
|
|
780
|
-
export
|
|
784
|
+
export type TinaCloudSchema<WithNamespace extends boolean = false> = Schema<WithNamespace>;
|
|
781
785
|
/** @deprecated use Schema instead */
|
|
782
|
-
export
|
|
786
|
+
export type TinaCloudSchemaBase = TinaCloudSchema;
|
|
783
787
|
/** @deprecated use Schema instead */
|
|
784
|
-
export
|
|
788
|
+
export type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
|
|
785
789
|
/** @deprecated use Schema instead */
|
|
786
|
-
export
|
|
790
|
+
export type TinaCloudSchemaWithNamespace = TinaCloudSchema<true>;
|
|
787
791
|
/** @deprecated use Collection instead */
|
|
788
|
-
export
|
|
792
|
+
export type TinaCloudCollection<WithNamespace extends boolean = false> = Collection<WithNamespace>;
|
|
789
793
|
/** @deprecated use Collection instead */
|
|
790
|
-
export
|
|
794
|
+
export type TinaCloudCollectionBase = TinaCloudCollection;
|
|
791
795
|
/** @deprecated use Collection instead */
|
|
792
|
-
export
|
|
796
|
+
export type TinaCloudCollectionEnriched = TinaCloudCollection<true>;
|
|
793
797
|
/** @deprecated use Template instead */
|
|
794
|
-
export
|
|
798
|
+
export type TinaTemplate = Template;
|
|
795
799
|
/** @deprecated use Template instead */
|
|
796
|
-
export
|
|
800
|
+
export type TinaCloudTemplateBase = Template;
|
|
797
801
|
/** @deprecated use Template instead */
|
|
798
|
-
export
|
|
802
|
+
export type TinaCloudTemplateEnriched = Template<true>;
|
|
799
803
|
/** @deprecated use Collection instead */
|
|
800
|
-
export
|
|
804
|
+
export type CollectionFieldsWithNamespace = FieldCollection<true>;
|
|
801
805
|
/** @deprecated use Collection instead */
|
|
802
|
-
export
|
|
806
|
+
export type CollectionTemplates = TemplateCollection;
|
|
803
807
|
/** @deprecated use Collection instead */
|
|
804
|
-
export
|
|
808
|
+
export type CollectionTemplatesWithNamespace = TemplateCollection<true>;
|
|
805
809
|
/** @deprecated use Template instead */
|
|
806
|
-
export
|
|
810
|
+
export type GlobalTemplate = Template;
|
|
807
811
|
/** @deprecated use TinaField instead */
|
|
808
|
-
export
|
|
812
|
+
export type TinaFieldBase = TinaField;
|
|
809
813
|
/** @deprecated use TinaField instead */
|
|
810
|
-
export
|
|
814
|
+
export type TinaFieldInner = TinaField;
|
|
811
815
|
/** @deprecated use TinaField instead */
|
|
812
|
-
export
|
|
816
|
+
export type TinaFieldEnriched = TinaField<true>;
|
|
813
817
|
/** @deprecated use ObjectField instead */
|
|
814
|
-
export
|
|
818
|
+
export type ObjectType<WithNamespace extends boolean = false> = ObjectField<WithNamespace>;
|
|
815
819
|
/** @deprecated use RichTextField instead */
|
|
816
|
-
export
|
|
820
|
+
export type RichTextType<WithNamespace extends boolean = false> = RichTextField<WithNamespace>;
|
|
817
821
|
/** @deprecated use ReferenceField instead */
|
|
818
|
-
export
|
|
822
|
+
export type ReferenceType<WithNamespace extends boolean = false> = ReferenceField & MaybeNamespace<WithNamespace>;
|
|
819
823
|
/** @deprecated use ReferenceField instead */
|
|
820
|
-
export
|
|
824
|
+
export type ReferenceTypeInner = ReferenceType;
|
|
821
825
|
/** @deprecated use ReferenceField instead */
|
|
822
|
-
export
|
|
826
|
+
export type ReferenceTypeWithNamespace = ReferenceType<true>;
|
|
823
827
|
/** @deprecated use RichTextField instead */
|
|
824
|
-
export
|
|
828
|
+
export type RichTypeWithNamespace = RichTextField<true>;
|
|
825
829
|
/** @deprecated use TinaField instead */
|
|
826
|
-
export
|
|
830
|
+
export type SchemaField<WithNamespace extends boolean = false> = TinaField<WithNamespace>;
|
|
827
831
|
export {};
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
* })
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export declare const sequential: <A, B>(items: A[], callback: (args: A, idx: number) => Promise<B>) => Promise<B[]>;
|
|
14
|
+
export declare const sequential: <A, B>(items: A[] | undefined, callback: (args: A, idx: number) => Promise<B>) => Promise<B[]>;
|
|
@@ -33,44 +33,44 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
33
33
|
isAuthCollection: z.ZodOptional<z.ZodBoolean>;
|
|
34
34
|
isDetached: z.ZodOptional<z.ZodBoolean>;
|
|
35
35
|
}, {
|
|
36
|
-
fields: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodType<import("..").TinaField
|
|
36
|
+
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[]>;
|
|
37
37
|
templates: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
38
38
|
label: z.ZodString;
|
|
39
39
|
name: z.ZodEffects<z.ZodString, string, string>;
|
|
40
|
-
fields: z.ZodArray<z.ZodType<import("..").TinaField
|
|
40
|
+
fields: z.ZodArray<z.ZodType<import("..").TinaField, z.ZodTypeDef, import("..").TinaField>, "many">;
|
|
41
41
|
}, "strip", z.ZodTypeAny, {
|
|
42
42
|
name?: string;
|
|
43
|
-
fields?: import("..").TinaField
|
|
43
|
+
fields?: import("..").TinaField[];
|
|
44
44
|
label?: string;
|
|
45
45
|
}, {
|
|
46
46
|
name?: string;
|
|
47
|
-
fields?: import("..").TinaField
|
|
47
|
+
fields?: import("..").TinaField[];
|
|
48
48
|
label?: string;
|
|
49
49
|
}>, {
|
|
50
50
|
name?: string;
|
|
51
|
-
fields?: import("..").TinaField
|
|
51
|
+
fields?: import("..").TinaField[];
|
|
52
52
|
label?: string;
|
|
53
53
|
}, {
|
|
54
54
|
name?: string;
|
|
55
|
-
fields?: import("..").TinaField
|
|
55
|
+
fields?: import("..").TinaField[];
|
|
56
56
|
label?: string;
|
|
57
57
|
}>, "many">>, {
|
|
58
58
|
name?: string;
|
|
59
|
-
fields?: import("..").TinaField
|
|
59
|
+
fields?: import("..").TinaField[];
|
|
60
60
|
label?: string;
|
|
61
61
|
}[], {
|
|
62
62
|
name?: string;
|
|
63
|
-
fields?: import("..").TinaField
|
|
63
|
+
fields?: import("..").TinaField[];
|
|
64
64
|
label?: string;
|
|
65
65
|
}[]>;
|
|
66
66
|
}>, "strip", z.ZodTypeAny, {
|
|
67
67
|
name?: string;
|
|
68
68
|
templates?: {
|
|
69
69
|
name?: string;
|
|
70
|
-
fields?: import("..").TinaField
|
|
70
|
+
fields?: import("..").TinaField[];
|
|
71
71
|
label?: string;
|
|
72
72
|
}[];
|
|
73
|
-
fields?: import("..").TinaField
|
|
73
|
+
fields?: import("..").TinaField[];
|
|
74
74
|
label?: string;
|
|
75
75
|
path?: string;
|
|
76
76
|
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
@@ -80,10 +80,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
80
80
|
name?: string;
|
|
81
81
|
templates?: {
|
|
82
82
|
name?: string;
|
|
83
|
-
fields?: import("..").TinaField
|
|
83
|
+
fields?: import("..").TinaField[];
|
|
84
84
|
label?: string;
|
|
85
85
|
}[];
|
|
86
|
-
fields?: import("..").TinaField
|
|
86
|
+
fields?: import("..").TinaField[];
|
|
87
87
|
label?: string;
|
|
88
88
|
path?: string;
|
|
89
89
|
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
@@ -93,10 +93,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
93
93
|
name?: string;
|
|
94
94
|
templates?: {
|
|
95
95
|
name?: string;
|
|
96
|
-
fields?: import("..").TinaField
|
|
96
|
+
fields?: import("..").TinaField[];
|
|
97
97
|
label?: string;
|
|
98
98
|
}[];
|
|
99
|
-
fields?: import("..").TinaField
|
|
99
|
+
fields?: import("..").TinaField[];
|
|
100
100
|
label?: string;
|
|
101
101
|
path?: string;
|
|
102
102
|
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
@@ -106,10 +106,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
106
106
|
name?: string;
|
|
107
107
|
templates?: {
|
|
108
108
|
name?: string;
|
|
109
|
-
fields?: import("..").TinaField
|
|
109
|
+
fields?: import("..").TinaField[];
|
|
110
110
|
label?: string;
|
|
111
111
|
}[];
|
|
112
|
-
fields?: import("..").TinaField
|
|
112
|
+
fields?: import("..").TinaField[];
|
|
113
113
|
label?: string;
|
|
114
114
|
path?: string;
|
|
115
115
|
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
@@ -240,10 +240,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
240
240
|
name?: string;
|
|
241
241
|
templates?: {
|
|
242
242
|
name?: string;
|
|
243
|
-
fields?: import("..").TinaField
|
|
243
|
+
fields?: import("..").TinaField[];
|
|
244
244
|
label?: string;
|
|
245
245
|
}[];
|
|
246
|
-
fields?: import("..").TinaField
|
|
246
|
+
fields?: import("..").TinaField[];
|
|
247
247
|
label?: string;
|
|
248
248
|
path?: string;
|
|
249
249
|
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
@@ -278,10 +278,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
278
278
|
name?: string;
|
|
279
279
|
templates?: {
|
|
280
280
|
name?: string;
|
|
281
|
-
fields?: import("..").TinaField
|
|
281
|
+
fields?: import("..").TinaField[];
|
|
282
282
|
label?: string;
|
|
283
283
|
}[];
|
|
284
|
-
fields?: import("..").TinaField
|
|
284
|
+
fields?: import("..").TinaField[];
|
|
285
285
|
label?: string;
|
|
286
286
|
path?: string;
|
|
287
287
|
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
@@ -316,10 +316,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
316
316
|
name?: string;
|
|
317
317
|
templates?: {
|
|
318
318
|
name?: string;
|
|
319
|
-
fields?: import("..").TinaField
|
|
319
|
+
fields?: import("..").TinaField[];
|
|
320
320
|
label?: string;
|
|
321
321
|
}[];
|
|
322
|
-
fields?: import("..").TinaField
|
|
322
|
+
fields?: import("..").TinaField[];
|
|
323
323
|
label?: string;
|
|
324
324
|
path?: string;
|
|
325
325
|
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
|
@@ -354,10 +354,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
354
354
|
name?: string;
|
|
355
355
|
templates?: {
|
|
356
356
|
name?: string;
|
|
357
|
-
fields?: import("..").TinaField
|
|
357
|
+
fields?: import("..").TinaField[];
|
|
358
358
|
label?: string;
|
|
359
359
|
}[];
|
|
360
|
-
fields?: import("..").TinaField
|
|
360
|
+
fields?: import("..").TinaField[];
|
|
361
361
|
label?: string;
|
|
362
362
|
path?: string;
|
|
363
363
|
format?: "markdown" | "mdx" | "json" | "md" | "yaml" | "yml" | "toml";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/schema-tools",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"jest": "^29.5.0",
|
|
31
31
|
"react": "^18.3.1",
|
|
32
32
|
"ts-jest": "^29.2.3",
|
|
33
|
-
"typescript": "
|
|
33
|
+
"typescript": "^5.6.2",
|
|
34
34
|
"yup": "^0.32.0",
|
|
35
|
-
"@tinacms/scripts": "1.2.
|
|
35
|
+
"@tinacms/scripts": "1.2.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=16.14.0",
|