@tinacms/schema-tools 1.6.2 → 1.6.4
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/schema/TinaSchema.d.ts +3 -3
- package/dist/schema/resolveField.d.ts +1 -1
- package/dist/schema/resolveForm.d.ts +2 -163
- package/dist/types/index.d.ts +76 -67
- package/dist/util/sequential.d.ts +1 -1
- package/dist/validate/schema.d.ts +24 -24
- package/package.json +11 -11
|
@@ -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,18 +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
|
-
|
|
161
|
+
type ReferenceFieldOptions = {
|
|
162
162
|
optionComponent?: OptionComponent;
|
|
163
163
|
experimental___filter?: (list: Array<any>, searchQuery: string) => Array<any>;
|
|
164
164
|
};
|
|
165
|
-
|
|
166
|
-
export
|
|
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 & {
|
|
167
167
|
type: 'reference';
|
|
168
168
|
/**
|
|
169
169
|
* The names of the collections this field can use as a reference
|
|
@@ -177,15 +177,15 @@ export declare type ReferenceField = (FieldGeneric<string, undefined, ReferenceF
|
|
|
177
177
|
*/
|
|
178
178
|
collections: string[];
|
|
179
179
|
};
|
|
180
|
-
export
|
|
180
|
+
export type PasswordField = (FieldGeneric<string, undefined> | FieldGeneric<string, false>) & BaseField & {
|
|
181
181
|
type: 'password';
|
|
182
182
|
};
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
type toolbarItemName = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'italic' | 'raw' | 'embed';
|
|
184
|
+
type RichTextAst = {
|
|
185
185
|
type: 'root';
|
|
186
186
|
children: Record<string, unknown>[];
|
|
187
187
|
};
|
|
188
|
-
export
|
|
188
|
+
export type RichTextField<WithNamespace extends boolean = false> = (FieldGeneric<RichTextAst, undefined> | FieldGeneric<RichTextAst, false>) & BaseField & SearchableTextField & {
|
|
189
189
|
type: 'rich-text';
|
|
190
190
|
/**
|
|
191
191
|
* When using Markdown or MDX formats, this field's value
|
|
@@ -212,7 +212,7 @@ export declare type RichTextField<WithNamespace extends boolean = false> = (Fiel
|
|
|
212
212
|
type: 'mdx';
|
|
213
213
|
};
|
|
214
214
|
};
|
|
215
|
-
export
|
|
215
|
+
export type RichTextTemplate<WithNamespace extends boolean = false> = Template<WithNamespace> & {
|
|
216
216
|
inline?: boolean;
|
|
217
217
|
/**
|
|
218
218
|
* If you have some custom shortcode logic in your markdown,
|
|
@@ -237,10 +237,10 @@ export declare type RichTextTemplate<WithNamespace extends boolean = false> = Te
|
|
|
237
237
|
name?: string;
|
|
238
238
|
};
|
|
239
239
|
};
|
|
240
|
-
|
|
240
|
+
type ObjectUiProps = {
|
|
241
241
|
visualSelector?: boolean;
|
|
242
242
|
};
|
|
243
|
-
export
|
|
243
|
+
export type ObjectField<WithNamespace extends boolean = false> = (FieldGeneric<string, undefined, ObjectUiProps> | FieldGeneric<string, true, ObjectUiProps> | FieldGeneric<string, false, ObjectUiProps>) & MaybeNamespace<WithNamespace> & BaseField & ({
|
|
244
244
|
type: 'object';
|
|
245
245
|
fields: Field<WithNamespace>[];
|
|
246
246
|
templates?: undefined;
|
|
@@ -251,12 +251,12 @@ export declare type ObjectField<WithNamespace extends boolean = false> = (FieldG
|
|
|
251
251
|
templates: Template<WithNamespace>[];
|
|
252
252
|
templateKey?: string;
|
|
253
253
|
});
|
|
254
|
-
|
|
255
|
-
export
|
|
256
|
-
|
|
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 ? {
|
|
257
257
|
namespace: string[];
|
|
258
258
|
} : {};
|
|
259
|
-
export
|
|
259
|
+
export type Template<WithNamespace extends boolean = false> = {
|
|
260
260
|
label?: string | boolean;
|
|
261
261
|
name: string;
|
|
262
262
|
nameOverride?: string;
|
|
@@ -290,13 +290,13 @@ export declare type Template<WithNamespace extends boolean = false> = {
|
|
|
290
290
|
};
|
|
291
291
|
fields: Field<WithNamespace>[];
|
|
292
292
|
} & MaybeNamespace<WithNamespace>;
|
|
293
|
-
|
|
293
|
+
type TokenObject = {
|
|
294
294
|
id_token: string;
|
|
295
295
|
access_token?: string;
|
|
296
296
|
refresh_token?: string;
|
|
297
297
|
};
|
|
298
|
-
export
|
|
299
|
-
export
|
|
298
|
+
export type LoginStrategy = 'UsernamePassword' | 'Redirect' | 'LoginScreen';
|
|
299
|
+
export type LoginScreenProps = {
|
|
300
300
|
handleAuthenticate: (props?: Record<string, string>) => Promise<void>;
|
|
301
301
|
};
|
|
302
302
|
export interface AuthProvider {
|
|
@@ -349,7 +349,7 @@ interface AuthHooks {
|
|
|
349
349
|
}) => Promise<void>;
|
|
350
350
|
onLogout?: () => Promise<void>;
|
|
351
351
|
}
|
|
352
|
-
|
|
352
|
+
type AuthOptions = AuthHooks & AuthProvider;
|
|
353
353
|
export interface Config<CMSCallback = undefined, FormifyCallback = undefined, DocumentCreatorCallback = undefined, Store = undefined, SearchClient = undefined> {
|
|
354
354
|
contentApiUrlOverride?: string;
|
|
355
355
|
authProvider?: AuthProvider;
|
|
@@ -557,7 +557,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
557
557
|
formifyCallback?: FormifyCallback;
|
|
558
558
|
documentCreatorCallback?: DocumentCreatorCallback;
|
|
559
559
|
}
|
|
560
|
-
export
|
|
560
|
+
export type TinaCMSConfig<CMSCallback = undefined, FormifyCallback = undefined, DocumentCreatorCallback = undefined, Store = undefined> = Config<CMSCallback, FormifyCallback, DocumentCreatorCallback, Store>;
|
|
561
561
|
export interface Schema<WithNamespace extends boolean = false> {
|
|
562
562
|
/**
|
|
563
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).
|
|
@@ -570,7 +570,7 @@ export interface Schema<WithNamespace extends boolean = false> {
|
|
|
570
570
|
*/
|
|
571
571
|
config?: Config;
|
|
572
572
|
}
|
|
573
|
-
export
|
|
573
|
+
export type Collection<WithNamespace extends boolean = false> = FieldCollection<WithNamespace> | TemplateCollection<WithNamespace>;
|
|
574
574
|
interface BaseCollection {
|
|
575
575
|
label?: string;
|
|
576
576
|
name: string;
|
|
@@ -597,7 +597,7 @@ interface BaseCollection {
|
|
|
597
597
|
isDetached?: boolean;
|
|
598
598
|
isAuthCollection?: boolean;
|
|
599
599
|
}
|
|
600
|
-
|
|
600
|
+
type TemplateCollection<WithNamespace extends boolean = false> = {
|
|
601
601
|
/**
|
|
602
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".
|
|
603
603
|
*
|
|
@@ -606,7 +606,7 @@ declare type TemplateCollection<WithNamespace extends boolean = false> = {
|
|
|
606
606
|
templates: Template<WithNamespace>[];
|
|
607
607
|
fields?: undefined;
|
|
608
608
|
} & BaseCollection & MaybeNamespace<WithNamespace>;
|
|
609
|
-
|
|
609
|
+
type FieldCollection<WithNamespace extends boolean = false> = {
|
|
610
610
|
/**
|
|
611
611
|
* Fields define the shape of the content and the user input.
|
|
612
612
|
*
|
|
@@ -615,7 +615,7 @@ declare type FieldCollection<WithNamespace extends boolean = false> = {
|
|
|
615
615
|
fields: TinaField<WithNamespace>[];
|
|
616
616
|
templates?: undefined;
|
|
617
617
|
} & BaseCollection & MaybeNamespace<WithNamespace>;
|
|
618
|
-
|
|
618
|
+
type Document = {
|
|
619
619
|
_sys: {
|
|
620
620
|
title?: string;
|
|
621
621
|
template: string;
|
|
@@ -649,6 +649,15 @@ export interface UICollection<Form = any, CMS = any, TinaForm = any> {
|
|
|
649
649
|
* When set to `true`, editors won't be able to modify the filename
|
|
650
650
|
*/
|
|
651
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;
|
|
652
661
|
};
|
|
653
662
|
/**
|
|
654
663
|
* Determines whether or not this collection can accept new docments
|
|
@@ -704,19 +713,19 @@ export interface UICollection<Form = any, CMS = any, TinaForm = any> {
|
|
|
704
713
|
form: TinaForm;
|
|
705
714
|
}) => Promise<void | Record<string, unknown>>;
|
|
706
715
|
}
|
|
707
|
-
export
|
|
708
|
-
|
|
716
|
+
export type DefaultItem<ReturnType> = ReturnType | (() => ReturnType);
|
|
717
|
+
type IndexType = {
|
|
709
718
|
name: string;
|
|
710
719
|
fields: {
|
|
711
720
|
name: string;
|
|
712
721
|
}[];
|
|
713
722
|
};
|
|
714
|
-
export
|
|
723
|
+
export type Option = string | {
|
|
715
724
|
label?: string;
|
|
716
725
|
icon?: FC;
|
|
717
726
|
value: string;
|
|
718
727
|
};
|
|
719
|
-
export
|
|
728
|
+
export type UITemplate = {
|
|
720
729
|
/**
|
|
721
730
|
* Override the properties passed to the field
|
|
722
731
|
* component. This is mostly useful for controlling
|
|
@@ -744,12 +753,12 @@ export declare type UITemplate = {
|
|
|
744
753
|
*/
|
|
745
754
|
previewSrc?: string;
|
|
746
755
|
};
|
|
747
|
-
export
|
|
756
|
+
export type CollectionTemplateableUnion = {
|
|
748
757
|
namespace: string[];
|
|
749
758
|
type: 'union';
|
|
750
759
|
templates: Template<true>[];
|
|
751
760
|
};
|
|
752
|
-
export
|
|
761
|
+
export type CollectionTemplateableObject = {
|
|
753
762
|
namespace: string[];
|
|
754
763
|
type: 'object';
|
|
755
764
|
visualSelector?: boolean;
|
|
@@ -763,60 +772,60 @@ export declare type CollectionTemplateableObject = {
|
|
|
763
772
|
required?: false;
|
|
764
773
|
template: Template<true>;
|
|
765
774
|
};
|
|
766
|
-
export
|
|
767
|
-
export
|
|
775
|
+
export type CollectionTemplateable = CollectionTemplateableUnion | CollectionTemplateableObject;
|
|
776
|
+
export type Collectable = Pick<Collection<true>, 'namespace' | 'templates' | 'fields' | 'name'> & {
|
|
768
777
|
label?: string | boolean;
|
|
769
778
|
};
|
|
770
779
|
/**
|
|
771
780
|
* @deprecated use Config instead
|
|
772
781
|
*/
|
|
773
|
-
export
|
|
782
|
+
export type TinaCloudSchemaConfig<DeleteMe = undefined> = Config;
|
|
774
783
|
/** @deprecated use Schema instead */
|
|
775
|
-
export
|
|
784
|
+
export type TinaCloudSchema<WithNamespace extends boolean = false> = Schema<WithNamespace>;
|
|
776
785
|
/** @deprecated use Schema instead */
|
|
777
|
-
export
|
|
786
|
+
export type TinaCloudSchemaBase = TinaCloudSchema;
|
|
778
787
|
/** @deprecated use Schema instead */
|
|
779
|
-
export
|
|
788
|
+
export type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
|
|
780
789
|
/** @deprecated use Schema instead */
|
|
781
|
-
export
|
|
790
|
+
export type TinaCloudSchemaWithNamespace = TinaCloudSchema<true>;
|
|
782
791
|
/** @deprecated use Collection instead */
|
|
783
|
-
export
|
|
792
|
+
export type TinaCloudCollection<WithNamespace extends boolean = false> = Collection<WithNamespace>;
|
|
784
793
|
/** @deprecated use Collection instead */
|
|
785
|
-
export
|
|
794
|
+
export type TinaCloudCollectionBase = TinaCloudCollection;
|
|
786
795
|
/** @deprecated use Collection instead */
|
|
787
|
-
export
|
|
796
|
+
export type TinaCloudCollectionEnriched = TinaCloudCollection<true>;
|
|
788
797
|
/** @deprecated use Template instead */
|
|
789
|
-
export
|
|
798
|
+
export type TinaTemplate = Template;
|
|
790
799
|
/** @deprecated use Template instead */
|
|
791
|
-
export
|
|
800
|
+
export type TinaCloudTemplateBase = Template;
|
|
792
801
|
/** @deprecated use Template instead */
|
|
793
|
-
export
|
|
802
|
+
export type TinaCloudTemplateEnriched = Template<true>;
|
|
794
803
|
/** @deprecated use Collection instead */
|
|
795
|
-
export
|
|
804
|
+
export type CollectionFieldsWithNamespace = FieldCollection<true>;
|
|
796
805
|
/** @deprecated use Collection instead */
|
|
797
|
-
export
|
|
806
|
+
export type CollectionTemplates = TemplateCollection;
|
|
798
807
|
/** @deprecated use Collection instead */
|
|
799
|
-
export
|
|
808
|
+
export type CollectionTemplatesWithNamespace = TemplateCollection<true>;
|
|
800
809
|
/** @deprecated use Template instead */
|
|
801
|
-
export
|
|
810
|
+
export type GlobalTemplate = Template;
|
|
802
811
|
/** @deprecated use TinaField instead */
|
|
803
|
-
export
|
|
812
|
+
export type TinaFieldBase = TinaField;
|
|
804
813
|
/** @deprecated use TinaField instead */
|
|
805
|
-
export
|
|
814
|
+
export type TinaFieldInner = TinaField;
|
|
806
815
|
/** @deprecated use TinaField instead */
|
|
807
|
-
export
|
|
816
|
+
export type TinaFieldEnriched = TinaField<true>;
|
|
808
817
|
/** @deprecated use ObjectField instead */
|
|
809
|
-
export
|
|
818
|
+
export type ObjectType<WithNamespace extends boolean = false> = ObjectField<WithNamespace>;
|
|
810
819
|
/** @deprecated use RichTextField instead */
|
|
811
|
-
export
|
|
820
|
+
export type RichTextType<WithNamespace extends boolean = false> = RichTextField<WithNamespace>;
|
|
812
821
|
/** @deprecated use ReferenceField instead */
|
|
813
|
-
export
|
|
822
|
+
export type ReferenceType<WithNamespace extends boolean = false> = ReferenceField & MaybeNamespace<WithNamespace>;
|
|
814
823
|
/** @deprecated use ReferenceField instead */
|
|
815
|
-
export
|
|
824
|
+
export type ReferenceTypeInner = ReferenceType;
|
|
816
825
|
/** @deprecated use ReferenceField instead */
|
|
817
|
-
export
|
|
826
|
+
export type ReferenceTypeWithNamespace = ReferenceType<true>;
|
|
818
827
|
/** @deprecated use RichTextField instead */
|
|
819
|
-
export
|
|
828
|
+
export type RichTypeWithNamespace = RichTextField<true>;
|
|
820
829
|
/** @deprecated use TinaField instead */
|
|
821
|
-
export
|
|
830
|
+
export type SchemaField<WithNamespace extends boolean = false> = TinaField<WithNamespace>;
|
|
822
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.4",
|
|
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.
|
|
27
|
-
"@types/micromatch": "^4.0.
|
|
28
|
-
"@types/react": "^18.3.
|
|
29
|
-
"@types/yup": "^0.29.
|
|
30
|
-
"jest": "^29.
|
|
26
|
+
"@types/jest": "^29.5.13",
|
|
27
|
+
"@types/micromatch": "^4.0.9",
|
|
28
|
+
"@types/react": "^18.3.10",
|
|
29
|
+
"@types/yup": "^0.29.14",
|
|
30
|
+
"jest": "^29.7.0",
|
|
31
31
|
"react": "^18.3.1",
|
|
32
|
-
"ts-jest": "^29.2.
|
|
33
|
-
"typescript": "
|
|
34
|
-
"yup": "^0.32.
|
|
35
|
-
"@tinacms/scripts": "1.2.
|
|
32
|
+
"ts-jest": "^29.2.5",
|
|
33
|
+
"typescript": "^5.6.2",
|
|
34
|
+
"yup": "^0.32.11",
|
|
35
|
+
"@tinacms/scripts": "1.2.3"
|
|
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.23.8"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "tinacms-scripts build",
|