@tinacms/schema-tools 1.9.1 → 1.10.0
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 +17 -0
- package/dist/index.mjs +17 -0
- package/dist/types/index.d.ts +15 -5
- package/dist/validate/schema.d.ts +65 -0
- package/dist/validate/tinaCloudSchemaConfig.d.ts +37 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2577,6 +2577,23 @@ ${stringifiedField}`
|
|
|
2577
2577
|
searchClient: z.any().optional(),
|
|
2578
2578
|
indexBatchSize: z.number().gte(1).optional(),
|
|
2579
2579
|
maxSearchIndexFieldLength: z.number().gte(1).optional()
|
|
2580
|
+
}).optional(),
|
|
2581
|
+
ui: z.object({
|
|
2582
|
+
previewUrl: z.function().optional(),
|
|
2583
|
+
optOutOfUpdateCheck: z.boolean().optional(),
|
|
2584
|
+
regexValidation: z.object({
|
|
2585
|
+
folderNameRegex: z.string().refine(
|
|
2586
|
+
(val) => {
|
|
2587
|
+
try {
|
|
2588
|
+
new RegExp(val);
|
|
2589
|
+
return true;
|
|
2590
|
+
} catch (error) {
|
|
2591
|
+
return false;
|
|
2592
|
+
}
|
|
2593
|
+
},
|
|
2594
|
+
{ message: "folderNameRegex is not a valid regex pattern" }
|
|
2595
|
+
).optional()
|
|
2596
|
+
}).optional()
|
|
2580
2597
|
}).optional()
|
|
2581
2598
|
});
|
|
2582
2599
|
const validateTinaCloudSchemaConfig = (config) => {
|
package/dist/index.mjs
CHANGED
|
@@ -2559,6 +2559,23 @@ const tinaConfigZod = z$1.object({
|
|
|
2559
2559
|
searchClient: z$1.any().optional(),
|
|
2560
2560
|
indexBatchSize: z$1.number().gte(1).optional(),
|
|
2561
2561
|
maxSearchIndexFieldLength: z$1.number().gte(1).optional()
|
|
2562
|
+
}).optional(),
|
|
2563
|
+
ui: z$1.object({
|
|
2564
|
+
previewUrl: z$1.function().optional(),
|
|
2565
|
+
optOutOfUpdateCheck: z$1.boolean().optional(),
|
|
2566
|
+
regexValidation: z$1.object({
|
|
2567
|
+
folderNameRegex: z$1.string().refine(
|
|
2568
|
+
(val) => {
|
|
2569
|
+
try {
|
|
2570
|
+
new RegExp(val);
|
|
2571
|
+
return true;
|
|
2572
|
+
} catch (error) {
|
|
2573
|
+
return false;
|
|
2574
|
+
}
|
|
2575
|
+
},
|
|
2576
|
+
{ message: "folderNameRegex is not a valid regex pattern" }
|
|
2577
|
+
).optional()
|
|
2578
|
+
}).optional()
|
|
2562
2579
|
}).optional()
|
|
2563
2580
|
});
|
|
2564
2581
|
const validateTinaCloudSchemaConfig = (config) => {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -391,7 +391,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
391
391
|
/**
|
|
392
392
|
* The Schema is used to define the shape of the content.
|
|
393
393
|
*
|
|
394
|
-
* https://tina.io/docs/
|
|
394
|
+
* https://tina.io/docs/r/the-config-file/
|
|
395
395
|
*/
|
|
396
396
|
schema: Schema;
|
|
397
397
|
/**
|
|
@@ -439,6 +439,16 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
439
439
|
* Defaults to false if not specified.
|
|
440
440
|
*/
|
|
441
441
|
optOutOfUpdateCheck?: boolean;
|
|
442
|
+
/**
|
|
443
|
+
* Regular expression pattern that folder names must match when creating new folders.
|
|
444
|
+
* Only applies to newly created folders, not existing ones.
|
|
445
|
+
*
|
|
446
|
+
* @example "^[a-z0-9-]+$" - allows lowercase letters, numbers, and hyphens only
|
|
447
|
+
* @example "^[A-Za-z0-9_-]+$" - allows letters, numbers, underscores, and hyphens
|
|
448
|
+
*/
|
|
449
|
+
regexValidation?: {
|
|
450
|
+
folderNameRegex?: string;
|
|
451
|
+
};
|
|
442
452
|
};
|
|
443
453
|
/**
|
|
444
454
|
* Configurations for the autogenerated GraphQL HTTP client
|
|
@@ -518,7 +528,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
518
528
|
} | {
|
|
519
529
|
/**
|
|
520
530
|
* Use Git-backed assets for media, these values will
|
|
521
|
-
* [Learn more](https://tina.io/docs/
|
|
531
|
+
* [Learn more](https://tina.io/docs/r/repo-based-media/)
|
|
522
532
|
*/
|
|
523
533
|
tina: {
|
|
524
534
|
/**
|
|
@@ -593,7 +603,7 @@ export interface Schema<WithNamespace extends boolean = false> {
|
|
|
593
603
|
/**
|
|
594
604
|
* 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).
|
|
595
605
|
*
|
|
596
|
-
* https://tina.io/docs/
|
|
606
|
+
* https://tina.io/docs/r/content-modelling-collections/
|
|
597
607
|
*/
|
|
598
608
|
collections: Collection<WithNamespace>[];
|
|
599
609
|
/**
|
|
@@ -632,7 +642,7 @@ type TemplateCollection<WithNamespace extends boolean = false> = {
|
|
|
632
642
|
/**
|
|
633
643
|
* 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".
|
|
634
644
|
*
|
|
635
|
-
* https://tina.io/docs/
|
|
645
|
+
* https://tina.io/docs/r/content-modelling-templates/
|
|
636
646
|
*/
|
|
637
647
|
templates: Template<WithNamespace>[];
|
|
638
648
|
fields?: undefined;
|
|
@@ -641,7 +651,7 @@ type FieldCollection<WithNamespace extends boolean = false> = {
|
|
|
641
651
|
/**
|
|
642
652
|
* Fields define the shape of the content and the user input.
|
|
643
653
|
*
|
|
644
|
-
* https://tina.io/docs/
|
|
654
|
+
* https://tina.io/docs/r/string-fields/
|
|
645
655
|
*/
|
|
646
656
|
fields: TinaField<WithNamespace>[];
|
|
647
657
|
templates?: undefined;
|
|
@@ -187,6 +187,29 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
187
187
|
searchClient?: any;
|
|
188
188
|
indexBatchSize?: number;
|
|
189
189
|
}>>;
|
|
190
|
+
ui: z.ZodOptional<z.ZodObject<{
|
|
191
|
+
previewUrl: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
192
|
+
optOutOfUpdateCheck: z.ZodOptional<z.ZodBoolean>;
|
|
193
|
+
regexValidation: z.ZodOptional<z.ZodObject<{
|
|
194
|
+
folderNameRegex: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
195
|
+
}, "strip", z.ZodTypeAny, {
|
|
196
|
+
folderNameRegex?: string;
|
|
197
|
+
}, {
|
|
198
|
+
folderNameRegex?: string;
|
|
199
|
+
}>>;
|
|
200
|
+
}, "strip", z.ZodTypeAny, {
|
|
201
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
202
|
+
optOutOfUpdateCheck?: boolean;
|
|
203
|
+
regexValidation?: {
|
|
204
|
+
folderNameRegex?: string;
|
|
205
|
+
};
|
|
206
|
+
}, {
|
|
207
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
208
|
+
optOutOfUpdateCheck?: boolean;
|
|
209
|
+
regexValidation?: {
|
|
210
|
+
folderNameRegex?: string;
|
|
211
|
+
};
|
|
212
|
+
}>>;
|
|
190
213
|
}, "strip", z.ZodTypeAny, {
|
|
191
214
|
search?: {
|
|
192
215
|
maxSearchIndexFieldLength?: number;
|
|
@@ -198,6 +221,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
198
221
|
searchClient?: any;
|
|
199
222
|
indexBatchSize?: number;
|
|
200
223
|
};
|
|
224
|
+
ui?: {
|
|
225
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
226
|
+
optOutOfUpdateCheck?: boolean;
|
|
227
|
+
regexValidation?: {
|
|
228
|
+
folderNameRegex?: string;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
201
231
|
client?: {
|
|
202
232
|
referenceDepth?: number;
|
|
203
233
|
};
|
|
@@ -220,6 +250,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
220
250
|
searchClient?: any;
|
|
221
251
|
indexBatchSize?: number;
|
|
222
252
|
};
|
|
253
|
+
ui?: {
|
|
254
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
255
|
+
optOutOfUpdateCheck?: boolean;
|
|
256
|
+
regexValidation?: {
|
|
257
|
+
folderNameRegex?: string;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
223
260
|
client?: {
|
|
224
261
|
referenceDepth?: number;
|
|
225
262
|
};
|
|
@@ -258,6 +295,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
258
295
|
searchClient?: any;
|
|
259
296
|
indexBatchSize?: number;
|
|
260
297
|
};
|
|
298
|
+
ui?: {
|
|
299
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
300
|
+
optOutOfUpdateCheck?: boolean;
|
|
301
|
+
regexValidation?: {
|
|
302
|
+
folderNameRegex?: string;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
261
305
|
client?: {
|
|
262
306
|
referenceDepth?: number;
|
|
263
307
|
};
|
|
@@ -296,6 +340,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
296
340
|
searchClient?: any;
|
|
297
341
|
indexBatchSize?: number;
|
|
298
342
|
};
|
|
343
|
+
ui?: {
|
|
344
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
345
|
+
optOutOfUpdateCheck?: boolean;
|
|
346
|
+
regexValidation?: {
|
|
347
|
+
folderNameRegex?: string;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
299
350
|
client?: {
|
|
300
351
|
referenceDepth?: number;
|
|
301
352
|
};
|
|
@@ -334,6 +385,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
334
385
|
searchClient?: any;
|
|
335
386
|
indexBatchSize?: number;
|
|
336
387
|
};
|
|
388
|
+
ui?: {
|
|
389
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
390
|
+
optOutOfUpdateCheck?: boolean;
|
|
391
|
+
regexValidation?: {
|
|
392
|
+
folderNameRegex?: string;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
337
395
|
client?: {
|
|
338
396
|
referenceDepth?: number;
|
|
339
397
|
};
|
|
@@ -372,6 +430,13 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
372
430
|
searchClient?: any;
|
|
373
431
|
indexBatchSize?: number;
|
|
374
432
|
};
|
|
433
|
+
ui?: {
|
|
434
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
435
|
+
optOutOfUpdateCheck?: boolean;
|
|
436
|
+
regexValidation?: {
|
|
437
|
+
folderNameRegex?: string;
|
|
438
|
+
};
|
|
439
|
+
};
|
|
375
440
|
client?: {
|
|
376
441
|
referenceDepth?: number;
|
|
377
442
|
};
|
|
@@ -77,6 +77,29 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
77
77
|
searchClient?: any;
|
|
78
78
|
indexBatchSize?: number;
|
|
79
79
|
}>>;
|
|
80
|
+
ui: z.ZodOptional<z.ZodObject<{
|
|
81
|
+
previewUrl: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
82
|
+
optOutOfUpdateCheck: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
+
regexValidation: z.ZodOptional<z.ZodObject<{
|
|
84
|
+
folderNameRegex: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
folderNameRegex?: string;
|
|
87
|
+
}, {
|
|
88
|
+
folderNameRegex?: string;
|
|
89
|
+
}>>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
92
|
+
optOutOfUpdateCheck?: boolean;
|
|
93
|
+
regexValidation?: {
|
|
94
|
+
folderNameRegex?: string;
|
|
95
|
+
};
|
|
96
|
+
}, {
|
|
97
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
98
|
+
optOutOfUpdateCheck?: boolean;
|
|
99
|
+
regexValidation?: {
|
|
100
|
+
folderNameRegex?: string;
|
|
101
|
+
};
|
|
102
|
+
}>>;
|
|
80
103
|
}, "strip", z.ZodTypeAny, {
|
|
81
104
|
search?: {
|
|
82
105
|
maxSearchIndexFieldLength?: number;
|
|
@@ -88,6 +111,13 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
88
111
|
searchClient?: any;
|
|
89
112
|
indexBatchSize?: number;
|
|
90
113
|
};
|
|
114
|
+
ui?: {
|
|
115
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
116
|
+
optOutOfUpdateCheck?: boolean;
|
|
117
|
+
regexValidation?: {
|
|
118
|
+
folderNameRegex?: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
91
121
|
client?: {
|
|
92
122
|
referenceDepth?: number;
|
|
93
123
|
};
|
|
@@ -110,6 +140,13 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
110
140
|
searchClient?: any;
|
|
111
141
|
indexBatchSize?: number;
|
|
112
142
|
};
|
|
143
|
+
ui?: {
|
|
144
|
+
previewUrl?: (...args: unknown[]) => unknown;
|
|
145
|
+
optOutOfUpdateCheck?: boolean;
|
|
146
|
+
regexValidation?: {
|
|
147
|
+
folderNameRegex?: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
113
150
|
client?: {
|
|
114
151
|
referenceDepth?: number;
|
|
115
152
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/schema-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"ts-jest": "^29.2.5",
|
|
33
33
|
"typescript": "^5.7.3",
|
|
34
34
|
"yup": "^0.32.11",
|
|
35
|
-
"@tinacms/scripts": "1.4.
|
|
35
|
+
"@tinacms/scripts": "1.4.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=16.14.0",
|