pocketbase-zod-schema 0.2.5 → 0.3.1

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cli/index.cjs +497 -298
  3. package/dist/cli/index.cjs.map +1 -1
  4. package/dist/cli/index.d.cts +2 -2
  5. package/dist/cli/index.d.ts +2 -2
  6. package/dist/cli/index.js +497 -298
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/cli/migrate.cjs +497 -298
  9. package/dist/cli/migrate.cjs.map +1 -1
  10. package/dist/cli/migrate.js +497 -298
  11. package/dist/cli/migrate.js.map +1 -1
  12. package/dist/cli/utils/index.d.cts +2 -2
  13. package/dist/cli/utils/index.d.ts +2 -2
  14. package/dist/{fields-YjcpBXVp.d.cts → fields-RVj26U-O.d.cts} +17 -0
  15. package/dist/{fields-YjcpBXVp.d.ts → fields-RVj26U-O.d.ts} +17 -0
  16. package/dist/index.cjs +575 -155
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +4 -4
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +576 -144
  21. package/dist/index.js.map +1 -1
  22. package/dist/migration/analyzer.cjs +12 -2
  23. package/dist/migration/analyzer.cjs.map +1 -1
  24. package/dist/migration/analyzer.d.cts +2 -2
  25. package/dist/migration/analyzer.d.ts +2 -2
  26. package/dist/migration/analyzer.js +12 -2
  27. package/dist/migration/analyzer.js.map +1 -1
  28. package/dist/migration/diff.cjs +150 -24
  29. package/dist/migration/diff.cjs.map +1 -1
  30. package/dist/migration/diff.d.cts +4 -4
  31. package/dist/migration/diff.d.ts +4 -4
  32. package/dist/migration/diff.js +150 -24
  33. package/dist/migration/diff.js.map +1 -1
  34. package/dist/migration/generator.cjs +360 -46
  35. package/dist/migration/generator.cjs.map +1 -1
  36. package/dist/migration/generator.d.cts +59 -12
  37. package/dist/migration/generator.d.ts +59 -12
  38. package/dist/migration/generator.js +356 -47
  39. package/dist/migration/generator.js.map +1 -1
  40. package/dist/migration/index.cjs +561 -90
  41. package/dist/migration/index.cjs.map +1 -1
  42. package/dist/migration/index.d.cts +3 -3
  43. package/dist/migration/index.d.ts +3 -3
  44. package/dist/migration/index.js +561 -90
  45. package/dist/migration/index.js.map +1 -1
  46. package/dist/migration/snapshot.cjs +51 -18
  47. package/dist/migration/snapshot.cjs.map +1 -1
  48. package/dist/migration/snapshot.d.cts +2 -2
  49. package/dist/migration/snapshot.d.ts +2 -2
  50. package/dist/migration/snapshot.js +51 -18
  51. package/dist/migration/snapshot.js.map +1 -1
  52. package/dist/migration/utils/index.cjs +66 -0
  53. package/dist/migration/utils/index.cjs.map +1 -1
  54. package/dist/migration/utils/index.d.cts +39 -202
  55. package/dist/migration/utils/index.d.ts +39 -202
  56. package/dist/migration/utils/index.js +65 -1
  57. package/dist/migration/utils/index.js.map +1 -1
  58. package/dist/schema.cjs +0 -61
  59. package/dist/schema.cjs.map +1 -1
  60. package/dist/schema.d.cts +2 -86
  61. package/dist/schema.d.ts +2 -86
  62. package/dist/schema.js +1 -50
  63. package/dist/schema.js.map +1 -1
  64. package/dist/type-mapper-CZzVeDj7.d.ts +208 -0
  65. package/dist/type-mapper-DaBe-1ph.d.cts +208 -0
  66. package/dist/{types-LFBGHl9Y.d.ts → types-CUVzgZ9k.d.ts} +33 -2
  67. package/dist/{types-mhQXWNi3.d.cts → types-D-Fsdn_O.d.cts} +33 -2
  68. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { Ora } from 'ora';
2
- import { e as SchemaDiff } from '../../types-mhQXWNi3.cjs';
3
- import '../../fields-YjcpBXVp.cjs';
2
+ import { e as SchemaDiff } from '../../types-D-Fsdn_O.cjs';
3
+ import '../../fields-RVj26U-O.cjs';
4
4
  import 'zod';
5
5
  import '../../permissions-ZHafVSIx.cjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { Ora } from 'ora';
2
- import { e as SchemaDiff } from '../../types-LFBGHl9Y.js';
3
- import '../../fields-YjcpBXVp.js';
2
+ import { e as SchemaDiff } from '../../types-CUVzgZ9k.js';
3
+ import '../../fields-RVj26U-O.js';
4
4
  import 'zod';
5
5
  import '../../permissions-ZHafVSIx.js';
6
6
 
@@ -67,6 +67,15 @@ interface NumberFieldOptions {
67
67
  * Whether to disallow decimal values (integers only)
68
68
  */
69
69
  noDecimal?: boolean;
70
+ /**
71
+ * Whether the field is required
72
+ * @default false
73
+ *
74
+ * Note: In PocketBase, `required: true` for number fields means the value must be non-zero.
75
+ * If you want to allow zero values (e.g., for progress: 0-100), keep this as `false`.
76
+ * Set to `true` only if you want to enforce non-zero values.
77
+ */
78
+ required?: boolean;
70
79
  }
71
80
  /**
72
81
  * Date field configuration options
@@ -123,6 +132,7 @@ interface FileFieldOptions {
123
132
  /**
124
133
  * Thumbnail sizes to generate
125
134
  * Example: ["100x100", "200x200"]
135
+ * Set to null to explicitly disable thumbnails
126
136
  */
127
137
  thumbs?: string[];
128
138
  /**
@@ -169,7 +179,14 @@ declare function BoolField(): z.ZodBoolean;
169
179
  * price: NumberField({ min: 0 }),
170
180
  * quantity: NumberField({ min: 0, noDecimal: true }),
171
181
  * rating: NumberField({ min: 0, max: 5 }),
182
+ * progress: NumberField({ min: 0, max: 100 }), // required defaults to false, allowing zero
183
+ * score: NumberField({ min: 1, max: 10, required: true }), // requires non-zero value
172
184
  * });
185
+ *
186
+ * @remarks
187
+ * By default, number fields are not required (`required: false`), which allows zero values.
188
+ * In PocketBase, `required: true` for number fields means the value must be non-zero.
189
+ * If you set `min: 0` and want to allow zero, keep `required: false` (the default).
173
190
  */
174
191
  declare function NumberField(options?: NumberFieldOptions): z.ZodNumber;
175
192
  /**
@@ -67,6 +67,15 @@ interface NumberFieldOptions {
67
67
  * Whether to disallow decimal values (integers only)
68
68
  */
69
69
  noDecimal?: boolean;
70
+ /**
71
+ * Whether the field is required
72
+ * @default false
73
+ *
74
+ * Note: In PocketBase, `required: true` for number fields means the value must be non-zero.
75
+ * If you want to allow zero values (e.g., for progress: 0-100), keep this as `false`.
76
+ * Set to `true` only if you want to enforce non-zero values.
77
+ */
78
+ required?: boolean;
70
79
  }
71
80
  /**
72
81
  * Date field configuration options
@@ -123,6 +132,7 @@ interface FileFieldOptions {
123
132
  /**
124
133
  * Thumbnail sizes to generate
125
134
  * Example: ["100x100", "200x200"]
135
+ * Set to null to explicitly disable thumbnails
126
136
  */
127
137
  thumbs?: string[];
128
138
  /**
@@ -169,7 +179,14 @@ declare function BoolField(): z.ZodBoolean;
169
179
  * price: NumberField({ min: 0 }),
170
180
  * quantity: NumberField({ min: 0, noDecimal: true }),
171
181
  * rating: NumberField({ min: 0, max: 5 }),
182
+ * progress: NumberField({ min: 0, max: 100 }), // required defaults to false, allowing zero
183
+ * score: NumberField({ min: 1, max: 10, required: true }), // requires non-zero value
172
184
  * });
185
+ *
186
+ * @remarks
187
+ * By default, number fields are not required (`required: false`), which allows zero values.
188
+ * In PocketBase, `required: true` for number fields means the value must be non-zero.
189
+ * If you set `min: 0` and want to allow zero, keep `required: false` (the default).
173
190
  */
174
191
  declare function NumberField(options?: NumberFieldOptions): z.ZodNumber;
175
192
  /**