pocketbase-to-zod 1.0.3 → 1.0.4
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 +8 -2
- package/index.ts +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,10 +32,16 @@ program
|
|
|
32
32
|
fileContent += `export const ${col.name}Schema = z.object({\n`;
|
|
33
33
|
// Base PocketBase fields
|
|
34
34
|
fileContent += ` id: z.string(),\n`;
|
|
35
|
-
fileContent += ` created: z.
|
|
36
|
-
fileContent += ` updated: z.
|
|
35
|
+
fileContent += ` created: z.date(),\n`;
|
|
36
|
+
fileContent += ` updated: z.date(),\n`;
|
|
37
37
|
for (const field of col.fields) {
|
|
38
38
|
let zodType = 'z.any()';
|
|
39
|
+
if (field.hidden)
|
|
40
|
+
continue;
|
|
41
|
+
if (['id', 'created', 'updated'].includes(field.name)) {
|
|
42
|
+
continue; // Skip specific fields if needed
|
|
43
|
+
}
|
|
44
|
+
console.log(` - Processing field: ${field.name} (type: ${field.type})`);
|
|
39
45
|
switch (field.type) {
|
|
40
46
|
case 'text':
|
|
41
47
|
case 'editor':
|
package/index.ts
CHANGED
|
@@ -36,12 +36,20 @@ program
|
|
|
36
36
|
|
|
37
37
|
// Base PocketBase fields
|
|
38
38
|
fileContent += ` id: z.string(),\n`;
|
|
39
|
-
fileContent += ` created: z.
|
|
40
|
-
fileContent += ` updated: z.
|
|
39
|
+
fileContent += ` created: z.date(),\n`;
|
|
40
|
+
fileContent += ` updated: z.date(),\n`;
|
|
41
41
|
|
|
42
42
|
for (const field of col.fields) {
|
|
43
43
|
let zodType = 'z.any()';
|
|
44
44
|
|
|
45
|
+
if (field.hidden) continue;
|
|
46
|
+
|
|
47
|
+
if (['id', 'created', 'updated'].includes(field.name)) {
|
|
48
|
+
continue; // Skip specific fields if needed
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
console.log(` - Processing field: ${field.name} (type: ${field.type})`);
|
|
52
|
+
|
|
45
53
|
switch (field.type) {
|
|
46
54
|
case 'text':
|
|
47
55
|
case 'editor':
|