@tinacms/schema-tools 1.4.5 → 1.4.7
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.es.js +6 -10
- package/dist/index.js +6 -10
- package/dist/types/index.d.ts +4 -0
- package/dist/validate/schema.d.ts +40 -0
- package/dist/validate/tinaCloudSchemaConfig.d.ts +24 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -423,7 +423,6 @@ class TinaSchema {
|
|
|
423
423
|
};
|
|
424
424
|
this.schema = config;
|
|
425
425
|
this.walkFields(({ field, collection, path }) => {
|
|
426
|
-
var _a;
|
|
427
426
|
if (!("searchable" in field)) {
|
|
428
427
|
if (field.type === "image") {
|
|
429
428
|
field.searchable = false;
|
|
@@ -438,13 +437,6 @@ class TinaSchema {
|
|
|
438
437
|
if (collection.format === "mdx") {
|
|
439
438
|
field.parser = { type: "mdx" };
|
|
440
439
|
} else {
|
|
441
|
-
(_a = field.templates) == null ? void 0 : _a.forEach((template) => {
|
|
442
|
-
if (!template.match) {
|
|
443
|
-
console.warn(`WARNING: Found rich-text template at ${collection.name}.${path.join(".")} with no matches property.
|
|
444
|
-
Visit https://tina.io/docs/reference/types/rich-text/#custom-shortcode-syntax to learn more
|
|
445
|
-
`);
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
440
|
field.parser = { type: "markdown" };
|
|
449
441
|
}
|
|
450
442
|
}
|
|
@@ -889,7 +881,9 @@ const tinaConfigKey = z$1.object({
|
|
|
889
881
|
mediaRoot: z$1.string()
|
|
890
882
|
}).strict().optional();
|
|
891
883
|
const tinaSearchKey = z$1.object({
|
|
892
|
-
indexerToken: z$1.string().optional()
|
|
884
|
+
indexerToken: z$1.string().optional(),
|
|
885
|
+
stopwordLanguages: z$1.array(z$1.string()).nonempty().optional(),
|
|
886
|
+
tokenSplitRegex: z$1.string().optional()
|
|
893
887
|
}).strict().optional();
|
|
894
888
|
const tinaConfigZod = z$1.object({
|
|
895
889
|
client: z$1.object({ referenceDepth: z$1.number().optional() }).optional(),
|
|
@@ -899,7 +893,9 @@ const tinaConfigZod = z$1.object({
|
|
|
899
893
|
}).optional(),
|
|
900
894
|
search: z$1.object({
|
|
901
895
|
tina: tinaSearchKey,
|
|
902
|
-
searchClient: z$1.any().optional()
|
|
896
|
+
searchClient: z$1.any().optional(),
|
|
897
|
+
indexBatchSize: z$1.number().gte(1).optional(),
|
|
898
|
+
maxSearchIndexFieldLength: z$1.number().gte(1).optional()
|
|
903
899
|
}).optional()
|
|
904
900
|
});
|
|
905
901
|
const validateTinaCloudSchemaConfig = (config) => {
|
package/dist/index.js
CHANGED
|
@@ -450,7 +450,6 @@
|
|
|
450
450
|
};
|
|
451
451
|
this.schema = config;
|
|
452
452
|
this.walkFields(({ field, collection, path }) => {
|
|
453
|
-
var _a;
|
|
454
453
|
if (!("searchable" in field)) {
|
|
455
454
|
if (field.type === "image") {
|
|
456
455
|
field.searchable = false;
|
|
@@ -465,13 +464,6 @@
|
|
|
465
464
|
if (collection.format === "mdx") {
|
|
466
465
|
field.parser = { type: "mdx" };
|
|
467
466
|
} else {
|
|
468
|
-
(_a = field.templates) == null ? void 0 : _a.forEach((template) => {
|
|
469
|
-
if (!template.match) {
|
|
470
|
-
console.warn(`WARNING: Found rich-text template at ${collection.name}.${path.join(".")} with no matches property.
|
|
471
|
-
Visit https://tina.io/docs/reference/types/rich-text/#custom-shortcode-syntax to learn more
|
|
472
|
-
`);
|
|
473
|
-
}
|
|
474
|
-
});
|
|
475
467
|
field.parser = { type: "markdown" };
|
|
476
468
|
}
|
|
477
469
|
}
|
|
@@ -916,7 +908,9 @@ ${JSON.stringify(val, null, 2)}
|
|
|
916
908
|
mediaRoot: z__default["default"].string()
|
|
917
909
|
}).strict().optional();
|
|
918
910
|
const tinaSearchKey = z__default["default"].object({
|
|
919
|
-
indexerToken: z__default["default"].string().optional()
|
|
911
|
+
indexerToken: z__default["default"].string().optional(),
|
|
912
|
+
stopwordLanguages: z__default["default"].array(z__default["default"].string()).nonempty().optional(),
|
|
913
|
+
tokenSplitRegex: z__default["default"].string().optional()
|
|
920
914
|
}).strict().optional();
|
|
921
915
|
const tinaConfigZod = z__default["default"].object({
|
|
922
916
|
client: z__default["default"].object({ referenceDepth: z__default["default"].number().optional() }).optional(),
|
|
@@ -926,7 +920,9 @@ ${JSON.stringify(val, null, 2)}
|
|
|
926
920
|
}).optional(),
|
|
927
921
|
search: z__default["default"].object({
|
|
928
922
|
tina: tinaSearchKey,
|
|
929
|
-
searchClient: z__default["default"].any().optional()
|
|
923
|
+
searchClient: z__default["default"].any().optional(),
|
|
924
|
+
indexBatchSize: z__default["default"].number().gte(1).optional(),
|
|
925
|
+
maxSearchIndexFieldLength: z__default["default"].number().gte(1).optional()
|
|
930
926
|
}).optional()
|
|
931
927
|
});
|
|
932
928
|
const validateTinaCloudSchemaConfig = (config) => {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -452,6 +452,10 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
452
452
|
* stopword languages to use (default: eng)
|
|
453
453
|
*/
|
|
454
454
|
stopwordLanguages?: string[];
|
|
455
|
+
/**
|
|
456
|
+
* regex used for splitting tokens (default: /[\p{L}\d_]+/)
|
|
457
|
+
*/
|
|
458
|
+
tokenSplitRegex?: string;
|
|
455
459
|
};
|
|
456
460
|
}) & {
|
|
457
461
|
/**
|
|
@@ -136,29 +136,49 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
136
136
|
search: z.ZodOptional<z.ZodObject<{
|
|
137
137
|
tina: z.ZodOptional<z.ZodObject<{
|
|
138
138
|
indexerToken: z.ZodOptional<z.ZodString>;
|
|
139
|
+
stopwordLanguages: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
|
|
140
|
+
tokenSplitRegex: z.ZodOptional<z.ZodString>;
|
|
139
141
|
}, "strict", z.ZodTypeAny, {
|
|
140
142
|
indexerToken?: string;
|
|
143
|
+
stopwordLanguages?: [string, ...string[]];
|
|
144
|
+
tokenSplitRegex?: string;
|
|
141
145
|
}, {
|
|
142
146
|
indexerToken?: string;
|
|
147
|
+
stopwordLanguages?: [string, ...string[]];
|
|
148
|
+
tokenSplitRegex?: string;
|
|
143
149
|
}>>;
|
|
144
150
|
searchClient: z.ZodOptional<z.ZodAny>;
|
|
151
|
+
indexBatchSize: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
maxSearchIndexFieldLength: z.ZodOptional<z.ZodNumber>;
|
|
145
153
|
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
maxSearchIndexFieldLength?: number;
|
|
146
155
|
tina?: {
|
|
147
156
|
indexerToken?: string;
|
|
157
|
+
stopwordLanguages?: [string, ...string[]];
|
|
158
|
+
tokenSplitRegex?: string;
|
|
148
159
|
};
|
|
149
160
|
searchClient?: any;
|
|
161
|
+
indexBatchSize?: number;
|
|
150
162
|
}, {
|
|
163
|
+
maxSearchIndexFieldLength?: number;
|
|
151
164
|
tina?: {
|
|
152
165
|
indexerToken?: string;
|
|
166
|
+
stopwordLanguages?: [string, ...string[]];
|
|
167
|
+
tokenSplitRegex?: string;
|
|
153
168
|
};
|
|
154
169
|
searchClient?: any;
|
|
170
|
+
indexBatchSize?: number;
|
|
155
171
|
}>>;
|
|
156
172
|
}, "strip", z.ZodTypeAny, {
|
|
157
173
|
search?: {
|
|
174
|
+
maxSearchIndexFieldLength?: number;
|
|
158
175
|
tina?: {
|
|
159
176
|
indexerToken?: string;
|
|
177
|
+
stopwordLanguages?: [string, ...string[]];
|
|
178
|
+
tokenSplitRegex?: string;
|
|
160
179
|
};
|
|
161
180
|
searchClient?: any;
|
|
181
|
+
indexBatchSize?: number;
|
|
162
182
|
};
|
|
163
183
|
client?: {
|
|
164
184
|
referenceDepth?: number;
|
|
@@ -172,10 +192,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
172
192
|
};
|
|
173
193
|
}, {
|
|
174
194
|
search?: {
|
|
195
|
+
maxSearchIndexFieldLength?: number;
|
|
175
196
|
tina?: {
|
|
176
197
|
indexerToken?: string;
|
|
198
|
+
stopwordLanguages?: [string, ...string[]];
|
|
199
|
+
tokenSplitRegex?: string;
|
|
177
200
|
};
|
|
178
201
|
searchClient?: any;
|
|
202
|
+
indexBatchSize?: number;
|
|
179
203
|
};
|
|
180
204
|
client?: {
|
|
181
205
|
referenceDepth?: number;
|
|
@@ -203,10 +227,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
203
227
|
}[];
|
|
204
228
|
config?: {
|
|
205
229
|
search?: {
|
|
230
|
+
maxSearchIndexFieldLength?: number;
|
|
206
231
|
tina?: {
|
|
207
232
|
indexerToken?: string;
|
|
233
|
+
stopwordLanguages?: [string, ...string[]];
|
|
234
|
+
tokenSplitRegex?: string;
|
|
208
235
|
};
|
|
209
236
|
searchClient?: any;
|
|
237
|
+
indexBatchSize?: number;
|
|
210
238
|
};
|
|
211
239
|
client?: {
|
|
212
240
|
referenceDepth?: number;
|
|
@@ -234,10 +262,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
234
262
|
}[];
|
|
235
263
|
config?: {
|
|
236
264
|
search?: {
|
|
265
|
+
maxSearchIndexFieldLength?: number;
|
|
237
266
|
tina?: {
|
|
238
267
|
indexerToken?: string;
|
|
268
|
+
stopwordLanguages?: [string, ...string[]];
|
|
269
|
+
tokenSplitRegex?: string;
|
|
239
270
|
};
|
|
240
271
|
searchClient?: any;
|
|
272
|
+
indexBatchSize?: number;
|
|
241
273
|
};
|
|
242
274
|
client?: {
|
|
243
275
|
referenceDepth?: number;
|
|
@@ -265,10 +297,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
265
297
|
}[];
|
|
266
298
|
config?: {
|
|
267
299
|
search?: {
|
|
300
|
+
maxSearchIndexFieldLength?: number;
|
|
268
301
|
tina?: {
|
|
269
302
|
indexerToken?: string;
|
|
303
|
+
stopwordLanguages?: [string, ...string[]];
|
|
304
|
+
tokenSplitRegex?: string;
|
|
270
305
|
};
|
|
271
306
|
searchClient?: any;
|
|
307
|
+
indexBatchSize?: number;
|
|
272
308
|
};
|
|
273
309
|
client?: {
|
|
274
310
|
referenceDepth?: number;
|
|
@@ -296,10 +332,14 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
|
|
|
296
332
|
}[];
|
|
297
333
|
config?: {
|
|
298
334
|
search?: {
|
|
335
|
+
maxSearchIndexFieldLength?: number;
|
|
299
336
|
tina?: {
|
|
300
337
|
indexerToken?: string;
|
|
338
|
+
stopwordLanguages?: [string, ...string[]];
|
|
339
|
+
tokenSplitRegex?: string;
|
|
301
340
|
};
|
|
302
341
|
searchClient?: any;
|
|
342
|
+
indexBatchSize?: number;
|
|
303
343
|
};
|
|
304
344
|
client?: {
|
|
305
345
|
referenceDepth?: number;
|
|
@@ -39,29 +39,49 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
39
39
|
search: z.ZodOptional<z.ZodObject<{
|
|
40
40
|
tina: z.ZodOptional<z.ZodObject<{
|
|
41
41
|
indexerToken: z.ZodOptional<z.ZodString>;
|
|
42
|
+
stopwordLanguages: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
|
|
43
|
+
tokenSplitRegex: z.ZodOptional<z.ZodString>;
|
|
42
44
|
}, "strict", z.ZodTypeAny, {
|
|
43
45
|
indexerToken?: string;
|
|
46
|
+
stopwordLanguages?: [string, ...string[]];
|
|
47
|
+
tokenSplitRegex?: string;
|
|
44
48
|
}, {
|
|
45
49
|
indexerToken?: string;
|
|
50
|
+
stopwordLanguages?: [string, ...string[]];
|
|
51
|
+
tokenSplitRegex?: string;
|
|
46
52
|
}>>;
|
|
47
53
|
searchClient: z.ZodOptional<z.ZodAny>;
|
|
54
|
+
indexBatchSize: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
maxSearchIndexFieldLength: z.ZodOptional<z.ZodNumber>;
|
|
48
56
|
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
maxSearchIndexFieldLength?: number;
|
|
49
58
|
tina?: {
|
|
50
59
|
indexerToken?: string;
|
|
60
|
+
stopwordLanguages?: [string, ...string[]];
|
|
61
|
+
tokenSplitRegex?: string;
|
|
51
62
|
};
|
|
52
63
|
searchClient?: any;
|
|
64
|
+
indexBatchSize?: number;
|
|
53
65
|
}, {
|
|
66
|
+
maxSearchIndexFieldLength?: number;
|
|
54
67
|
tina?: {
|
|
55
68
|
indexerToken?: string;
|
|
69
|
+
stopwordLanguages?: [string, ...string[]];
|
|
70
|
+
tokenSplitRegex?: string;
|
|
56
71
|
};
|
|
57
72
|
searchClient?: any;
|
|
73
|
+
indexBatchSize?: number;
|
|
58
74
|
}>>;
|
|
59
75
|
}, "strip", z.ZodTypeAny, {
|
|
60
76
|
search?: {
|
|
77
|
+
maxSearchIndexFieldLength?: number;
|
|
61
78
|
tina?: {
|
|
62
79
|
indexerToken?: string;
|
|
80
|
+
stopwordLanguages?: [string, ...string[]];
|
|
81
|
+
tokenSplitRegex?: string;
|
|
63
82
|
};
|
|
64
83
|
searchClient?: any;
|
|
84
|
+
indexBatchSize?: number;
|
|
65
85
|
};
|
|
66
86
|
client?: {
|
|
67
87
|
referenceDepth?: number;
|
|
@@ -75,10 +95,14 @@ export declare const tinaConfigZod: z.ZodObject<{
|
|
|
75
95
|
};
|
|
76
96
|
}, {
|
|
77
97
|
search?: {
|
|
98
|
+
maxSearchIndexFieldLength?: number;
|
|
78
99
|
tina?: {
|
|
79
100
|
indexerToken?: string;
|
|
101
|
+
stopwordLanguages?: [string, ...string[]];
|
|
102
|
+
tokenSplitRegex?: string;
|
|
80
103
|
};
|
|
81
104
|
searchClient?: any;
|
|
105
|
+
indexBatchSize?: number;
|
|
82
106
|
};
|
|
83
107
|
client?: {
|
|
84
108
|
referenceDepth?: number;
|