@tinacms/schema-tools 1.9.0 → 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 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) => {
@@ -129,6 +129,11 @@ export type UIField<Type, List extends boolean> = {
129
129
  type FieldGeneric<Type, List extends boolean | undefined, ExtraFieldUIProps = {}> = List extends true ? {
130
130
  list: true;
131
131
  ui?: UIField<Type, true> & ExtraFieldUIProps;
132
+ /**
133
+ * Defines where new items will be added in the list.
134
+ * If not specified, defaults to `append`.
135
+ */
136
+ addItemBehavior?: 'append' | 'prepend';
132
137
  } : List extends false ? {
133
138
  list?: false;
134
139
  ui?: UIField<Type, false> & ExtraFieldUIProps;
@@ -386,7 +391,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
386
391
  /**
387
392
  * The Schema is used to define the shape of the content.
388
393
  *
389
- * https://tina.io/docs/reference/schema/
394
+ * https://tina.io/docs/r/the-config-file/
390
395
  */
391
396
  schema: Schema;
392
397
  /**
@@ -423,11 +428,27 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
423
428
  * ```
424
429
  * [more info](https://vercel.com/docs/concepts/deployments/generated-urls#url-with-git-branch)
425
430
  */
426
- previewUrl: (context: {
431
+ previewUrl?: (context: {
427
432
  branch: string;
428
433
  }) => {
429
434
  url: string;
430
435
  };
436
+ /**
437
+ * Opt out of update checks - this will prevent the CMS for checking for new versions
438
+ * If true, the CMS will not check for updates.
439
+ * Defaults to false if not specified.
440
+ */
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
+ };
431
452
  };
432
453
  /**
433
454
  * Configurations for the autogenerated GraphQL HTTP client
@@ -507,7 +528,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
507
528
  } | {
508
529
  /**
509
530
  * Use Git-backed assets for media, these values will
510
- * [Learn more](https://tina.io/docs/reference/media/repo-based/)
531
+ * [Learn more](https://tina.io/docs/r/repo-based-media/)
511
532
  */
512
533
  tina: {
513
534
  /**
@@ -582,7 +603,7 @@ export interface Schema<WithNamespace extends boolean = false> {
582
603
  /**
583
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).
584
605
  *
585
- * https://tina.io/docs/reference/collections/
606
+ * https://tina.io/docs/r/content-modelling-collections/
586
607
  */
587
608
  collections: Collection<WithNamespace>[];
588
609
  /**
@@ -621,7 +642,7 @@ type TemplateCollection<WithNamespace extends boolean = false> = {
621
642
  /**
622
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".
623
644
  *
624
- * https://tina.io/docs/reference/templates/
645
+ * https://tina.io/docs/r/content-modelling-templates/
625
646
  */
626
647
  templates: Template<WithNamespace>[];
627
648
  fields?: undefined;
@@ -630,7 +651,7 @@ type FieldCollection<WithNamespace extends boolean = false> = {
630
651
  /**
631
652
  * Fields define the shape of the content and the user input.
632
653
  *
633
- * https://tina.io/docs/reference/fields/
654
+ * https://tina.io/docs/r/string-fields/
634
655
  */
635
656
  fields: TinaField<WithNamespace>[];
636
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.9.0",
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.0"
35
+ "@tinacms/scripts": "1.4.1"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": ">=16.14.0",