@tinacms/schema-tools 2.2.0 → 2.3.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 +10 -1
- package/dist/types/index.d.ts +17 -0
- package/dist/validate/schema.d.ts +103 -3
- package/dist/validate/tinaCloudSchemaConfig.d.ts +68 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -112,6 +112,7 @@ var constants$2 = {
|
|
|
112
112
|
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
113
113
|
// Replace globs with equivalent patterns to reduce parsing time.
|
|
114
114
|
REPLACEMENTS: {
|
|
115
|
+
__proto__: null,
|
|
115
116
|
"***": "*",
|
|
116
117
|
"**/**": "**",
|
|
117
118
|
"**/**/**": "**"
|
|
@@ -2573,7 +2574,15 @@ const tinaConfigKey = z$1.object({
|
|
|
2573
2574
|
const tinaSearchKey = z$1.object({
|
|
2574
2575
|
indexerToken: z$1.string().optional(),
|
|
2575
2576
|
stopwordLanguages: z$1.array(z$1.string()).nonempty().optional(),
|
|
2576
|
-
tokenSplitRegex: z$1.string().optional()
|
|
2577
|
+
tokenSplitRegex: z$1.string().optional(),
|
|
2578
|
+
fuzzyEnabled: z$1.boolean().optional(),
|
|
2579
|
+
fuzzyOptions: z$1.object({
|
|
2580
|
+
maxDistance: z$1.number().min(0).max(10).optional(),
|
|
2581
|
+
minSimilarity: z$1.number().min(0).max(1).optional(),
|
|
2582
|
+
maxTermExpansions: z$1.number().min(1).max(100).optional(),
|
|
2583
|
+
useTranspositions: z$1.boolean().optional(),
|
|
2584
|
+
caseSensitive: z$1.boolean().optional()
|
|
2585
|
+
}).strict().optional()
|
|
2577
2586
|
}).strict().optional();
|
|
2578
2587
|
const tinaConfigZod = z$1.object({
|
|
2579
2588
|
client: z$1.object({ referenceDepth: z$1.number().optional() }).optional(),
|
package/dist/types/index.d.ts
CHANGED
|
@@ -651,6 +651,23 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
651
651
|
* regex used for splitting tokens (default: /[\p{L}\d_]+/)
|
|
652
652
|
*/
|
|
653
653
|
tokenSplitRegex?: string;
|
|
654
|
+
/**
|
|
655
|
+
* Enable fuzzy search (default: true)
|
|
656
|
+
*/
|
|
657
|
+
fuzzyEnabled?: boolean;
|
|
658
|
+
/**
|
|
659
|
+
* Fuzzy search options
|
|
660
|
+
*/
|
|
661
|
+
fuzzyOptions?: {
|
|
662
|
+
/** Maximum edit distance for fuzzy matching (default: 2) */
|
|
663
|
+
maxDistance?: number;
|
|
664
|
+
/** Minimum similarity score 0-1 for matches (default: 0.6) */
|
|
665
|
+
minSimilarity?: number;
|
|
666
|
+
/** Maximum number of fuzzy term expansions to return per search term (default: 10) */
|
|
667
|
+
maxTermExpansions?: number;
|
|
668
|
+
/** Use Damerau-Levenshtein (allows transpositions) (default: true) */
|
|
669
|
+
useTranspositions?: boolean;
|
|
670
|
+
};
|
|
654
671
|
};
|
|
655
672
|
}) & {
|
|
656
673
|
/**
|
|
@@ -22,14 +22,14 @@ export declare const CollectionBaseSchema: z.ZodObject<{
|
|
|
22
22
|
isAuthCollection?: boolean;
|
|
23
23
|
}>;
|
|
24
24
|
export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
25
|
-
collections: z.ZodArray<z.ZodEffects<z.ZodObject<
|
|
25
|
+
collections: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
26
26
|
label: z.ZodOptional<z.ZodString>;
|
|
27
27
|
name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
28
28
|
path: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
29
29
|
format: z.ZodOptional<z.ZodEnum<["mdx", "md", "markdown", "json", "yaml", "yml", "toml"]>>;
|
|
30
30
|
isAuthCollection: z.ZodOptional<z.ZodBoolean>;
|
|
31
31
|
isDetached: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
-
}
|
|
32
|
+
} & {
|
|
33
33
|
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[]>;
|
|
34
34
|
templates: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
35
35
|
label: z.ZodString;
|
|
@@ -60,7 +60,7 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
60
60
|
fields?: import("..").TinaField[];
|
|
61
61
|
label?: string;
|
|
62
62
|
}[]>;
|
|
63
|
-
}
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
64
|
name?: string;
|
|
65
65
|
templates?: {
|
|
66
66
|
name?: string;
|
|
@@ -156,14 +156,50 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
156
156
|
indexerToken: z.ZodOptional<z.ZodString>;
|
|
157
157
|
stopwordLanguages: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
|
|
158
158
|
tokenSplitRegex: z.ZodOptional<z.ZodString>;
|
|
159
|
+
fuzzyEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
160
|
+
fuzzyOptions: z.ZodOptional<z.ZodObject<{
|
|
161
|
+
maxDistance: z.ZodOptional<z.ZodNumber>;
|
|
162
|
+
minSimilarity: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
maxTermExpansions: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
useTranspositions: z.ZodOptional<z.ZodBoolean>;
|
|
165
|
+
caseSensitive: z.ZodOptional<z.ZodBoolean>;
|
|
166
|
+
}, "strict", z.ZodTypeAny, {
|
|
167
|
+
maxDistance?: number;
|
|
168
|
+
minSimilarity?: number;
|
|
169
|
+
maxTermExpansions?: number;
|
|
170
|
+
useTranspositions?: boolean;
|
|
171
|
+
caseSensitive?: boolean;
|
|
172
|
+
}, {
|
|
173
|
+
maxDistance?: number;
|
|
174
|
+
minSimilarity?: number;
|
|
175
|
+
maxTermExpansions?: number;
|
|
176
|
+
useTranspositions?: boolean;
|
|
177
|
+
caseSensitive?: boolean;
|
|
178
|
+
}>>;
|
|
159
179
|
}, "strict", z.ZodTypeAny, {
|
|
160
180
|
indexerToken?: string;
|
|
161
181
|
stopwordLanguages?: [string, ...string[]];
|
|
162
182
|
tokenSplitRegex?: string;
|
|
183
|
+
fuzzyEnabled?: boolean;
|
|
184
|
+
fuzzyOptions?: {
|
|
185
|
+
maxDistance?: number;
|
|
186
|
+
minSimilarity?: number;
|
|
187
|
+
maxTermExpansions?: number;
|
|
188
|
+
useTranspositions?: boolean;
|
|
189
|
+
caseSensitive?: boolean;
|
|
190
|
+
};
|
|
163
191
|
}, {
|
|
164
192
|
indexerToken?: string;
|
|
165
193
|
stopwordLanguages?: [string, ...string[]];
|
|
166
194
|
tokenSplitRegex?: string;
|
|
195
|
+
fuzzyEnabled?: boolean;
|
|
196
|
+
fuzzyOptions?: {
|
|
197
|
+
maxDistance?: number;
|
|
198
|
+
minSimilarity?: number;
|
|
199
|
+
maxTermExpansions?: number;
|
|
200
|
+
useTranspositions?: boolean;
|
|
201
|
+
caseSensitive?: boolean;
|
|
202
|
+
};
|
|
167
203
|
}>>;
|
|
168
204
|
searchClient: z.ZodOptional<z.ZodAny>;
|
|
169
205
|
indexBatchSize: z.ZodOptional<z.ZodNumber>;
|
|
@@ -174,6 +210,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
174
210
|
indexerToken?: string;
|
|
175
211
|
stopwordLanguages?: [string, ...string[]];
|
|
176
212
|
tokenSplitRegex?: string;
|
|
213
|
+
fuzzyEnabled?: boolean;
|
|
214
|
+
fuzzyOptions?: {
|
|
215
|
+
maxDistance?: number;
|
|
216
|
+
minSimilarity?: number;
|
|
217
|
+
maxTermExpansions?: number;
|
|
218
|
+
useTranspositions?: boolean;
|
|
219
|
+
caseSensitive?: boolean;
|
|
220
|
+
};
|
|
177
221
|
};
|
|
178
222
|
searchClient?: any;
|
|
179
223
|
indexBatchSize?: number;
|
|
@@ -183,6 +227,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
183
227
|
indexerToken?: string;
|
|
184
228
|
stopwordLanguages?: [string, ...string[]];
|
|
185
229
|
tokenSplitRegex?: string;
|
|
230
|
+
fuzzyEnabled?: boolean;
|
|
231
|
+
fuzzyOptions?: {
|
|
232
|
+
maxDistance?: number;
|
|
233
|
+
minSimilarity?: number;
|
|
234
|
+
maxTermExpansions?: number;
|
|
235
|
+
useTranspositions?: boolean;
|
|
236
|
+
caseSensitive?: boolean;
|
|
237
|
+
};
|
|
186
238
|
};
|
|
187
239
|
searchClient?: any;
|
|
188
240
|
indexBatchSize?: number;
|
|
@@ -217,6 +269,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
217
269
|
indexerToken?: string;
|
|
218
270
|
stopwordLanguages?: [string, ...string[]];
|
|
219
271
|
tokenSplitRegex?: string;
|
|
272
|
+
fuzzyEnabled?: boolean;
|
|
273
|
+
fuzzyOptions?: {
|
|
274
|
+
maxDistance?: number;
|
|
275
|
+
minSimilarity?: number;
|
|
276
|
+
maxTermExpansions?: number;
|
|
277
|
+
useTranspositions?: boolean;
|
|
278
|
+
caseSensitive?: boolean;
|
|
279
|
+
};
|
|
220
280
|
};
|
|
221
281
|
searchClient?: any;
|
|
222
282
|
indexBatchSize?: number;
|
|
@@ -246,6 +306,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
246
306
|
indexerToken?: string;
|
|
247
307
|
stopwordLanguages?: [string, ...string[]];
|
|
248
308
|
tokenSplitRegex?: string;
|
|
309
|
+
fuzzyEnabled?: boolean;
|
|
310
|
+
fuzzyOptions?: {
|
|
311
|
+
maxDistance?: number;
|
|
312
|
+
minSimilarity?: number;
|
|
313
|
+
maxTermExpansions?: number;
|
|
314
|
+
useTranspositions?: boolean;
|
|
315
|
+
caseSensitive?: boolean;
|
|
316
|
+
};
|
|
249
317
|
};
|
|
250
318
|
searchClient?: any;
|
|
251
319
|
indexBatchSize?: number;
|
|
@@ -291,6 +359,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
291
359
|
indexerToken?: string;
|
|
292
360
|
stopwordLanguages?: [string, ...string[]];
|
|
293
361
|
tokenSplitRegex?: string;
|
|
362
|
+
fuzzyEnabled?: boolean;
|
|
363
|
+
fuzzyOptions?: {
|
|
364
|
+
maxDistance?: number;
|
|
365
|
+
minSimilarity?: number;
|
|
366
|
+
maxTermExpansions?: number;
|
|
367
|
+
useTranspositions?: boolean;
|
|
368
|
+
caseSensitive?: boolean;
|
|
369
|
+
};
|
|
294
370
|
};
|
|
295
371
|
searchClient?: any;
|
|
296
372
|
indexBatchSize?: number;
|
|
@@ -336,6 +412,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
336
412
|
indexerToken?: string;
|
|
337
413
|
stopwordLanguages?: [string, ...string[]];
|
|
338
414
|
tokenSplitRegex?: string;
|
|
415
|
+
fuzzyEnabled?: boolean;
|
|
416
|
+
fuzzyOptions?: {
|
|
417
|
+
maxDistance?: number;
|
|
418
|
+
minSimilarity?: number;
|
|
419
|
+
maxTermExpansions?: number;
|
|
420
|
+
useTranspositions?: boolean;
|
|
421
|
+
caseSensitive?: boolean;
|
|
422
|
+
};
|
|
339
423
|
};
|
|
340
424
|
searchClient?: any;
|
|
341
425
|
indexBatchSize?: number;
|
|
@@ -381,6 +465,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
381
465
|
indexerToken?: string;
|
|
382
466
|
stopwordLanguages?: [string, ...string[]];
|
|
383
467
|
tokenSplitRegex?: string;
|
|
468
|
+
fuzzyEnabled?: boolean;
|
|
469
|
+
fuzzyOptions?: {
|
|
470
|
+
maxDistance?: number;
|
|
471
|
+
minSimilarity?: number;
|
|
472
|
+
maxTermExpansions?: number;
|
|
473
|
+
useTranspositions?: boolean;
|
|
474
|
+
caseSensitive?: boolean;
|
|
475
|
+
};
|
|
384
476
|
};
|
|
385
477
|
searchClient?: any;
|
|
386
478
|
indexBatchSize?: number;
|
|
@@ -426,6 +518,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
426
518
|
indexerToken?: string;
|
|
427
519
|
stopwordLanguages?: [string, ...string[]];
|
|
428
520
|
tokenSplitRegex?: string;
|
|
521
|
+
fuzzyEnabled?: boolean;
|
|
522
|
+
fuzzyOptions?: {
|
|
523
|
+
maxDistance?: number;
|
|
524
|
+
minSimilarity?: number;
|
|
525
|
+
maxTermExpansions?: number;
|
|
526
|
+
useTranspositions?: boolean;
|
|
527
|
+
caseSensitive?: boolean;
|
|
528
|
+
};
|
|
429
529
|
};
|
|
430
530
|
searchClient?: any;
|
|
431
531
|
indexBatchSize?: number;
|
|
@@ -46,14 +46,50 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
46
46
|
indexerToken: z.ZodOptional<z.ZodString>;
|
|
47
47
|
stopwordLanguages: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
|
|
48
48
|
tokenSplitRegex: z.ZodOptional<z.ZodString>;
|
|
49
|
+
fuzzyEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
fuzzyOptions: z.ZodOptional<z.ZodObject<{
|
|
51
|
+
maxDistance: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
minSimilarity: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
maxTermExpansions: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
useTranspositions: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
caseSensitive: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
}, "strict", z.ZodTypeAny, {
|
|
57
|
+
maxDistance?: number;
|
|
58
|
+
minSimilarity?: number;
|
|
59
|
+
maxTermExpansions?: number;
|
|
60
|
+
useTranspositions?: boolean;
|
|
61
|
+
caseSensitive?: boolean;
|
|
62
|
+
}, {
|
|
63
|
+
maxDistance?: number;
|
|
64
|
+
minSimilarity?: number;
|
|
65
|
+
maxTermExpansions?: number;
|
|
66
|
+
useTranspositions?: boolean;
|
|
67
|
+
caseSensitive?: boolean;
|
|
68
|
+
}>>;
|
|
49
69
|
}, "strict", z.ZodTypeAny, {
|
|
50
70
|
indexerToken?: string;
|
|
51
71
|
stopwordLanguages?: [string, ...string[]];
|
|
52
72
|
tokenSplitRegex?: string;
|
|
73
|
+
fuzzyEnabled?: boolean;
|
|
74
|
+
fuzzyOptions?: {
|
|
75
|
+
maxDistance?: number;
|
|
76
|
+
minSimilarity?: number;
|
|
77
|
+
maxTermExpansions?: number;
|
|
78
|
+
useTranspositions?: boolean;
|
|
79
|
+
caseSensitive?: boolean;
|
|
80
|
+
};
|
|
53
81
|
}, {
|
|
54
82
|
indexerToken?: string;
|
|
55
83
|
stopwordLanguages?: [string, ...string[]];
|
|
56
84
|
tokenSplitRegex?: string;
|
|
85
|
+
fuzzyEnabled?: boolean;
|
|
86
|
+
fuzzyOptions?: {
|
|
87
|
+
maxDistance?: number;
|
|
88
|
+
minSimilarity?: number;
|
|
89
|
+
maxTermExpansions?: number;
|
|
90
|
+
useTranspositions?: boolean;
|
|
91
|
+
caseSensitive?: boolean;
|
|
92
|
+
};
|
|
57
93
|
}>>;
|
|
58
94
|
searchClient: z.ZodOptional<z.ZodAny>;
|
|
59
95
|
indexBatchSize: z.ZodOptional<z.ZodNumber>;
|
|
@@ -64,6 +100,14 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
64
100
|
indexerToken?: string;
|
|
65
101
|
stopwordLanguages?: [string, ...string[]];
|
|
66
102
|
tokenSplitRegex?: string;
|
|
103
|
+
fuzzyEnabled?: boolean;
|
|
104
|
+
fuzzyOptions?: {
|
|
105
|
+
maxDistance?: number;
|
|
106
|
+
minSimilarity?: number;
|
|
107
|
+
maxTermExpansions?: number;
|
|
108
|
+
useTranspositions?: boolean;
|
|
109
|
+
caseSensitive?: boolean;
|
|
110
|
+
};
|
|
67
111
|
};
|
|
68
112
|
searchClient?: any;
|
|
69
113
|
indexBatchSize?: number;
|
|
@@ -73,6 +117,14 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
73
117
|
indexerToken?: string;
|
|
74
118
|
stopwordLanguages?: [string, ...string[]];
|
|
75
119
|
tokenSplitRegex?: string;
|
|
120
|
+
fuzzyEnabled?: boolean;
|
|
121
|
+
fuzzyOptions?: {
|
|
122
|
+
maxDistance?: number;
|
|
123
|
+
minSimilarity?: number;
|
|
124
|
+
maxTermExpansions?: number;
|
|
125
|
+
useTranspositions?: boolean;
|
|
126
|
+
caseSensitive?: boolean;
|
|
127
|
+
};
|
|
76
128
|
};
|
|
77
129
|
searchClient?: any;
|
|
78
130
|
indexBatchSize?: number;
|
|
@@ -107,6 +159,14 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
107
159
|
indexerToken?: string;
|
|
108
160
|
stopwordLanguages?: [string, ...string[]];
|
|
109
161
|
tokenSplitRegex?: string;
|
|
162
|
+
fuzzyEnabled?: boolean;
|
|
163
|
+
fuzzyOptions?: {
|
|
164
|
+
maxDistance?: number;
|
|
165
|
+
minSimilarity?: number;
|
|
166
|
+
maxTermExpansions?: number;
|
|
167
|
+
useTranspositions?: boolean;
|
|
168
|
+
caseSensitive?: boolean;
|
|
169
|
+
};
|
|
110
170
|
};
|
|
111
171
|
searchClient?: any;
|
|
112
172
|
indexBatchSize?: number;
|
|
@@ -136,6 +196,14 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
136
196
|
indexerToken?: string;
|
|
137
197
|
stopwordLanguages?: [string, ...string[]];
|
|
138
198
|
tokenSplitRegex?: string;
|
|
199
|
+
fuzzyEnabled?: boolean;
|
|
200
|
+
fuzzyOptions?: {
|
|
201
|
+
maxDistance?: number;
|
|
202
|
+
minSimilarity?: number;
|
|
203
|
+
maxTermExpansions?: number;
|
|
204
|
+
useTranspositions?: boolean;
|
|
205
|
+
caseSensitive?: boolean;
|
|
206
|
+
};
|
|
139
207
|
};
|
|
140
208
|
searchClient?: any;
|
|
141
209
|
indexBatchSize?: number;
|