@tinacms/schema-tools 0.1.7 → 0.1.9
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 +2 -2
- package/dist/index.js +2 -2
- package/dist/types/SchemaTypes.d.ts +18 -1
- package/dist/validate/index.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -813,10 +813,10 @@ class TinaSchemaValidationError extends Error {
|
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
815
|
const validateSchema = ({
|
|
816
|
-
|
|
816
|
+
schema
|
|
817
817
|
}) => {
|
|
818
818
|
try {
|
|
819
|
-
TinaCloudSchemaZod.parse(
|
|
819
|
+
TinaCloudSchemaZod.parse(schema);
|
|
820
820
|
} catch (e) {
|
|
821
821
|
if (e instanceof ZodError) {
|
|
822
822
|
const errors = parseZodError({ zodError: e });
|
package/dist/index.js
CHANGED
|
@@ -840,10 +840,10 @@ ${JSON.stringify(val, null, 2)}
|
|
|
840
840
|
}
|
|
841
841
|
}
|
|
842
842
|
const validateSchema = ({
|
|
843
|
-
|
|
843
|
+
schema
|
|
844
844
|
}) => {
|
|
845
845
|
try {
|
|
846
|
-
TinaCloudSchemaZod.parse(
|
|
846
|
+
TinaCloudSchemaZod.parse(schema);
|
|
847
847
|
} catch (e) {
|
|
848
848
|
if (e instanceof z.ZodError) {
|
|
849
849
|
const errors = parseZodError({ zodError: e });
|
|
@@ -92,7 +92,7 @@ export interface UICollection {
|
|
|
92
92
|
collection: TinaCloudCollection<true>;
|
|
93
93
|
}) => string | undefined;
|
|
94
94
|
}
|
|
95
|
-
declare type DefaultItem<ReturnType> = () => ReturnType
|
|
95
|
+
declare type DefaultItem<ReturnType> = ReturnType | (() => ReturnType);
|
|
96
96
|
interface BaseCollection {
|
|
97
97
|
label?: string;
|
|
98
98
|
name: string;
|
|
@@ -266,6 +266,7 @@ interface ObjectTemplatesInnerWithList<WithNamespace extends boolean> extends Ob
|
|
|
266
266
|
key?: string;
|
|
267
267
|
label?: string;
|
|
268
268
|
};
|
|
269
|
+
defaultItem?: DefaultItem<Record<string, any>>;
|
|
269
270
|
} & UIField<any, string>);
|
|
270
271
|
}
|
|
271
272
|
interface ObjectTemplatesInnerWithoutList<WithNamespace extends boolean> extends ObjectTemplatesInnerBase<WithNamespace> {
|
|
@@ -293,6 +294,10 @@ interface ObjectTemplatesWithNamespace<WithNamespace extends boolean> extends Ti
|
|
|
293
294
|
visualSelector?: boolean;
|
|
294
295
|
required?: false;
|
|
295
296
|
ui?: UIField<any, Record<string, any>> & {
|
|
297
|
+
itemProps?(item: Record<string, any>): {
|
|
298
|
+
key?: string;
|
|
299
|
+
label?: string;
|
|
300
|
+
};
|
|
296
301
|
defaultItem?: DefaultItem<Record<string, any>>;
|
|
297
302
|
};
|
|
298
303
|
list?: boolean;
|
|
@@ -314,6 +319,10 @@ interface InnerObjectFields<WithNamespace extends boolean> extends TinaField {
|
|
|
314
319
|
visualSelector?: boolean;
|
|
315
320
|
required?: false;
|
|
316
321
|
ui?: UIField<any, Record<string, any>> & {
|
|
322
|
+
itemProps?(item: Record<string, any>): {
|
|
323
|
+
key?: string;
|
|
324
|
+
label?: string;
|
|
325
|
+
};
|
|
317
326
|
defaultItem?: DefaultItem<Record<string, any>>;
|
|
318
327
|
};
|
|
319
328
|
/**
|
|
@@ -331,6 +340,10 @@ interface InnerObjectFieldsWithNamespace<WithNamespace extends boolean> extends
|
|
|
331
340
|
visualSelector?: boolean;
|
|
332
341
|
required?: false;
|
|
333
342
|
ui?: UIField<any, Record<string, any>> & {
|
|
343
|
+
itemProps?(item: Record<string, any>): {
|
|
344
|
+
key?: string;
|
|
345
|
+
label?: string;
|
|
346
|
+
};
|
|
334
347
|
defaultItem?: DefaultItem<Record<string, any>>;
|
|
335
348
|
};
|
|
336
349
|
/**
|
|
@@ -400,6 +413,10 @@ export declare type CollectionTemplateableObject = {
|
|
|
400
413
|
type: 'object';
|
|
401
414
|
visualSelector?: boolean;
|
|
402
415
|
ui?: UIField<any, Record<string, any>> & {
|
|
416
|
+
itemProps?(item: Record<string, any>): {
|
|
417
|
+
key?: string;
|
|
418
|
+
label?: string;
|
|
419
|
+
};
|
|
403
420
|
defaultItem?: DefaultItem<Record<string, any>>;
|
|
404
421
|
};
|
|
405
422
|
required?: false;
|
package/dist/validate/index.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export { validateTinaCloudSchemaConfig } from './tinaCloudSchemaConfig';
|
|
|
15
15
|
export declare class TinaSchemaValidationError extends Error {
|
|
16
16
|
constructor(message: any);
|
|
17
17
|
}
|
|
18
|
-
export declare const validateSchema: ({
|
|
19
|
-
|
|
18
|
+
export declare const validateSchema: ({ schema, }: {
|
|
19
|
+
schema: TinaCloudSchema<false>;
|
|
20
20
|
}) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/schema-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"exports": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@tinacms/scripts": "0.51.
|
|
26
|
+
"@tinacms/scripts": "0.51.3",
|
|
27
27
|
"@types/yup": "^0.29.10",
|
|
28
28
|
"jest": "^27.0.6",
|
|
29
29
|
"react": "17.0.2",
|