astro-loader-pocketbase 0.2.1 → 0.2.2
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/package.json
CHANGED
|
@@ -15,15 +15,15 @@ export function parseSchema(
|
|
|
15
15
|
switch (field.type) {
|
|
16
16
|
case "number":
|
|
17
17
|
// Coerce the value to a number
|
|
18
|
-
fieldType = z.number(
|
|
18
|
+
fieldType = z.coerce.number();
|
|
19
19
|
break;
|
|
20
20
|
case "bool":
|
|
21
21
|
// Coerce the value to a boolean
|
|
22
|
-
fieldType = z.boolean(
|
|
22
|
+
fieldType = z.coerce.boolean();
|
|
23
23
|
break;
|
|
24
24
|
case "date":
|
|
25
25
|
// Coerce and parse the value as a date
|
|
26
|
-
fieldType = z.date(
|
|
26
|
+
fieldType = z.coerce.date();
|
|
27
27
|
break;
|
|
28
28
|
case "select":
|
|
29
29
|
if (!field.options.values) {
|
|
@@ -58,7 +58,10 @@ export function parseSchema(
|
|
|
58
58
|
|
|
59
59
|
// If the field is not required, mark it as optional
|
|
60
60
|
if (!field.required) {
|
|
61
|
-
fieldType.
|
|
61
|
+
fieldType = z.preprocess(
|
|
62
|
+
(val) => val || undefined,
|
|
63
|
+
z.optional(fieldType)
|
|
64
|
+
);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
// Add the field to the fields object
|