@palmares/schemas 0.0.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 (219) hide show
  1. package/.turbo/turbo-build$colon$watch.log +424 -0
  2. package/.turbo/turbo-build.log +13 -0
  3. package/.turbo/turbo-build:watch.log +26 -0
  4. package/CHANGELOG.md +11 -0
  5. package/LICENSE +21 -0
  6. package/dist/cjs/src/adapter/fields/array.js +157 -0
  7. package/dist/cjs/src/adapter/fields/boolean.js +167 -0
  8. package/dist/cjs/src/adapter/fields/datetime.js +167 -0
  9. package/dist/cjs/src/adapter/fields/index.js +311 -0
  10. package/dist/cjs/src/adapter/fields/number.js +167 -0
  11. package/dist/cjs/src/adapter/fields/object.js +167 -0
  12. package/dist/cjs/src/adapter/fields/string.js +167 -0
  13. package/dist/cjs/src/adapter/fields/union.js +167 -0
  14. package/dist/cjs/src/adapter/index.js +198 -0
  15. package/dist/cjs/src/adapter/types.js +4 -0
  16. package/dist/cjs/src/compile.js +262 -0
  17. package/dist/cjs/src/conf.js +27 -0
  18. package/dist/cjs/src/constants.js +42 -0
  19. package/dist/cjs/src/domain.js +12 -0
  20. package/dist/cjs/src/exceptions.js +168 -0
  21. package/dist/cjs/src/index.js +365 -0
  22. package/dist/cjs/src/model.js +628 -0
  23. package/dist/cjs/src/parsers/convert-from-number.js +20 -0
  24. package/dist/cjs/src/parsers/convert-from-string.js +24 -0
  25. package/dist/cjs/src/parsers/index.js +25 -0
  26. package/dist/cjs/src/schema/array.js +890 -0
  27. package/dist/cjs/src/schema/boolean.js +826 -0
  28. package/dist/cjs/src/schema/datetime.js +778 -0
  29. package/dist/cjs/src/schema/index.js +17 -0
  30. package/dist/cjs/src/schema/number.js +960 -0
  31. package/dist/cjs/src/schema/object.js +999 -0
  32. package/dist/cjs/src/schema/schema.js +1788 -0
  33. package/dist/cjs/src/schema/string.js +948 -0
  34. package/dist/cjs/src/schema/types.js +4 -0
  35. package/dist/cjs/src/schema/union.js +952 -0
  36. package/dist/cjs/src/types.js +4 -0
  37. package/dist/cjs/src/utils.js +627 -0
  38. package/dist/cjs/src/validators/array.js +457 -0
  39. package/dist/cjs/src/validators/boolean.js +199 -0
  40. package/dist/cjs/src/validators/datetime.js +287 -0
  41. package/dist/cjs/src/validators/number.js +403 -0
  42. package/dist/cjs/src/validators/object.js +290 -0
  43. package/dist/cjs/src/validators/schema.js +318 -0
  44. package/dist/cjs/src/validators/string.js +439 -0
  45. package/dist/cjs/src/validators/types.js +4 -0
  46. package/dist/cjs/src/validators/union.js +232 -0
  47. package/dist/cjs/src/validators/utils.js +426 -0
  48. package/dist/cjs/tsconfig.types.tsbuildinfo +1 -0
  49. package/dist/cjs/types/adapter/fields/array.d.ts +20 -0
  50. package/dist/cjs/types/adapter/fields/array.d.ts.map +1 -0
  51. package/dist/cjs/types/adapter/fields/boolean.d.ts +25 -0
  52. package/dist/cjs/types/adapter/fields/boolean.d.ts.map +1 -0
  53. package/dist/cjs/types/adapter/fields/datetime.d.ts +25 -0
  54. package/dist/cjs/types/adapter/fields/datetime.d.ts.map +1 -0
  55. package/dist/cjs/types/adapter/fields/index.d.ts +31 -0
  56. package/dist/cjs/types/adapter/fields/index.d.ts.map +1 -0
  57. package/dist/cjs/types/adapter/fields/number.d.ts +25 -0
  58. package/dist/cjs/types/adapter/fields/number.d.ts.map +1 -0
  59. package/dist/cjs/types/adapter/fields/object.d.ts +25 -0
  60. package/dist/cjs/types/adapter/fields/object.d.ts.map +1 -0
  61. package/dist/cjs/types/adapter/fields/string.d.ts +25 -0
  62. package/dist/cjs/types/adapter/fields/string.d.ts.map +1 -0
  63. package/dist/cjs/types/adapter/fields/union.d.ts +25 -0
  64. package/dist/cjs/types/adapter/fields/union.d.ts.map +1 -0
  65. package/dist/cjs/types/adapter/index.d.ts +25 -0
  66. package/dist/cjs/types/adapter/index.d.ts.map +1 -0
  67. package/dist/cjs/types/adapter/types.d.ts +144 -0
  68. package/dist/cjs/types/adapter/types.d.ts.map +1 -0
  69. package/dist/cjs/types/compile.d.ts +3 -0
  70. package/dist/cjs/types/compile.d.ts.map +1 -0
  71. package/dist/cjs/types/conf.d.ts +16 -0
  72. package/dist/cjs/types/conf.d.ts.map +1 -0
  73. package/dist/cjs/types/constants.d.ts +6 -0
  74. package/dist/cjs/types/constants.d.ts.map +1 -0
  75. package/dist/cjs/types/domain.d.ts +21 -0
  76. package/dist/cjs/types/domain.d.ts.map +1 -0
  77. package/dist/cjs/types/exceptions.d.ts +13 -0
  78. package/dist/cjs/types/exceptions.d.ts.map +1 -0
  79. package/dist/cjs/types/index.d.ts +240 -0
  80. package/dist/cjs/types/index.d.ts.map +1 -0
  81. package/dist/cjs/types/model.d.ts +136 -0
  82. package/dist/cjs/types/model.d.ts.map +1 -0
  83. package/dist/cjs/types/parsers/convert-from-number.d.ts +15 -0
  84. package/dist/cjs/types/parsers/convert-from-number.d.ts.map +1 -0
  85. package/dist/cjs/types/parsers/convert-from-string.d.ts +9 -0
  86. package/dist/cjs/types/parsers/convert-from-string.d.ts.map +1 -0
  87. package/dist/cjs/types/parsers/index.d.ts +3 -0
  88. package/dist/cjs/types/parsers/index.d.ts.map +1 -0
  89. package/dist/cjs/types/schema/array.d.ts +429 -0
  90. package/dist/cjs/types/schema/array.d.ts.map +1 -0
  91. package/dist/cjs/types/schema/boolean.d.ts +501 -0
  92. package/dist/cjs/types/schema/boolean.d.ts.map +1 -0
  93. package/dist/cjs/types/schema/datetime.d.ts +474 -0
  94. package/dist/cjs/types/schema/datetime.d.ts.map +1 -0
  95. package/dist/cjs/types/schema/index.d.ts +4 -0
  96. package/dist/cjs/types/schema/index.d.ts.map +1 -0
  97. package/dist/cjs/types/schema/number.d.ts +667 -0
  98. package/dist/cjs/types/schema/number.d.ts.map +1 -0
  99. package/dist/cjs/types/schema/object.d.ts +450 -0
  100. package/dist/cjs/types/schema/object.d.ts.map +1 -0
  101. package/dist/cjs/types/schema/schema.d.ts +646 -0
  102. package/dist/cjs/types/schema/schema.d.ts.map +1 -0
  103. package/dist/cjs/types/schema/string.d.ts +606 -0
  104. package/dist/cjs/types/schema/string.d.ts.map +1 -0
  105. package/dist/cjs/types/schema/types.d.ts +70 -0
  106. package/dist/cjs/types/schema/types.d.ts.map +1 -0
  107. package/dist/cjs/types/schema/union.d.ts +388 -0
  108. package/dist/cjs/types/schema/union.d.ts.map +1 -0
  109. package/dist/cjs/types/types.d.ts +11 -0
  110. package/dist/cjs/types/types.d.ts.map +1 -0
  111. package/dist/cjs/types/utils.d.ts +79 -0
  112. package/dist/cjs/types/utils.d.ts.map +1 -0
  113. package/dist/cjs/types/validators/array.d.ts +8 -0
  114. package/dist/cjs/types/validators/array.d.ts.map +1 -0
  115. package/dist/cjs/types/validators/boolean.d.ts +4 -0
  116. package/dist/cjs/types/validators/boolean.d.ts.map +1 -0
  117. package/dist/cjs/types/validators/datetime.d.ts +7 -0
  118. package/dist/cjs/types/validators/datetime.d.ts.map +1 -0
  119. package/dist/cjs/types/validators/number.d.ts +10 -0
  120. package/dist/cjs/types/validators/number.d.ts.map +1 -0
  121. package/dist/cjs/types/validators/object.d.ts +6 -0
  122. package/dist/cjs/types/validators/object.d.ts.map +1 -0
  123. package/dist/cjs/types/validators/schema.d.ts +10 -0
  124. package/dist/cjs/types/validators/schema.d.ts.map +1 -0
  125. package/dist/cjs/types/validators/string.d.ts +12 -0
  126. package/dist/cjs/types/validators/string.d.ts.map +1 -0
  127. package/dist/cjs/types/validators/types.d.ts +2 -0
  128. package/dist/cjs/types/validators/types.d.ts.map +1 -0
  129. package/dist/cjs/types/validators/union.d.ts +4 -0
  130. package/dist/cjs/types/validators/union.d.ts.map +1 -0
  131. package/dist/cjs/types/validators/utils.d.ts +83 -0
  132. package/dist/cjs/types/validators/utils.d.ts.map +1 -0
  133. package/dist/esm/src/adapter/fields/array.js +13 -0
  134. package/dist/esm/src/adapter/fields/boolean.js +20 -0
  135. package/dist/esm/src/adapter/fields/datetime.js +20 -0
  136. package/dist/esm/src/adapter/fields/index.js +37 -0
  137. package/dist/esm/src/adapter/fields/number.js +20 -0
  138. package/dist/esm/src/adapter/fields/object.js +20 -0
  139. package/dist/esm/src/adapter/fields/string.js +20 -0
  140. package/dist/esm/src/adapter/fields/union.js +20 -0
  141. package/dist/esm/src/adapter/index.js +18 -0
  142. package/dist/esm/src/adapter/types.js +1 -0
  143. package/dist/esm/src/compile.js +10 -0
  144. package/dist/esm/src/conf.js +19 -0
  145. package/dist/esm/src/constants.js +5 -0
  146. package/dist/esm/src/domain.js +2 -0
  147. package/dist/esm/src/exceptions.js +15 -0
  148. package/dist/esm/src/index.js +160 -0
  149. package/dist/esm/src/model.js +255 -0
  150. package/dist/esm/src/parsers/convert-from-number.js +8 -0
  151. package/dist/esm/src/parsers/convert-from-string.js +14 -0
  152. package/dist/esm/src/parsers/index.js +2 -0
  153. package/dist/esm/src/schema/array.js +403 -0
  154. package/dist/esm/src/schema/boolean.js +465 -0
  155. package/dist/esm/src/schema/datetime.js +423 -0
  156. package/dist/esm/src/schema/index.js +3 -0
  157. package/dist/esm/src/schema/number.js +592 -0
  158. package/dist/esm/src/schema/object.js +464 -0
  159. package/dist/esm/src/schema/schema.js +728 -0
  160. package/dist/esm/src/schema/string.js +579 -0
  161. package/dist/esm/src/schema/types.js +1 -0
  162. package/dist/esm/src/schema/union.js +388 -0
  163. package/dist/esm/src/types.js +1 -0
  164. package/dist/esm/src/utils.js +175 -0
  165. package/dist/esm/src/validators/array.js +135 -0
  166. package/dist/esm/src/validators/boolean.js +35 -0
  167. package/dist/esm/src/validators/datetime.js +85 -0
  168. package/dist/esm/src/validators/number.js +162 -0
  169. package/dist/esm/src/validators/object.js +38 -0
  170. package/dist/esm/src/validators/schema.js +114 -0
  171. package/dist/esm/src/validators/string.js +174 -0
  172. package/dist/esm/src/validators/types.js +1 -0
  173. package/dist/esm/src/validators/union.js +38 -0
  174. package/dist/esm/src/validators/utils.js +120 -0
  175. package/package.json +48 -0
  176. package/src/adapter/fields/array.ts +31 -0
  177. package/src/adapter/fields/boolean.ts +48 -0
  178. package/src/adapter/fields/datetime.ts +49 -0
  179. package/src/adapter/fields/index.ts +72 -0
  180. package/src/adapter/fields/number.ts +49 -0
  181. package/src/adapter/fields/object.ts +49 -0
  182. package/src/adapter/fields/string.ts +49 -0
  183. package/src/adapter/fields/union.ts +49 -0
  184. package/src/adapter/index.ts +34 -0
  185. package/src/adapter/types.ts +261 -0
  186. package/src/compile.ts +14 -0
  187. package/src/conf.ts +27 -0
  188. package/src/constants.ts +9 -0
  189. package/src/domain.ts +3 -0
  190. package/src/exceptions.ts +17 -0
  191. package/src/index.ts +338 -0
  192. package/src/model.ts +501 -0
  193. package/src/parsers/convert-from-number.ts +13 -0
  194. package/src/parsers/convert-from-string.ts +19 -0
  195. package/src/parsers/index.ts +2 -0
  196. package/src/schema/array.ts +633 -0
  197. package/src/schema/boolean.ts +700 -0
  198. package/src/schema/datetime.ts +613 -0
  199. package/src/schema/index.ts +5 -0
  200. package/src/schema/number.ts +885 -0
  201. package/src/schema/object.ts +699 -0
  202. package/src/schema/schema.ts +1093 -0
  203. package/src/schema/string.ts +807 -0
  204. package/src/schema/types.ts +126 -0
  205. package/src/schema/union.ts +596 -0
  206. package/src/types.ts +13 -0
  207. package/src/utils.ts +322 -0
  208. package/src/validators/array.ts +164 -0
  209. package/src/validators/boolean.ts +46 -0
  210. package/src/validators/datetime.ts +113 -0
  211. package/src/validators/number.ts +188 -0
  212. package/src/validators/object.ts +55 -0
  213. package/src/validators/schema.ts +134 -0
  214. package/src/validators/string.ts +215 -0
  215. package/src/validators/types.ts +1 -0
  216. package/src/validators/union.ts +52 -0
  217. package/src/validators/utils.ts +200 -0
  218. package/tsconfig.json +9 -0
  219. package/tsconfig.types.json +10 -0
@@ -0,0 +1,667 @@
1
+ import Schema from './schema';
2
+ import type { DefinitionsOfSchemaType } from './types';
3
+ export default class NumberSchema<TType extends {
4
+ input: any;
5
+ validate: any;
6
+ internal: any;
7
+ output: any;
8
+ representation: any;
9
+ } = {
10
+ input: number | bigint;
11
+ output: number | bigint;
12
+ validate: number | bigint;
13
+ internal: number | bigint;
14
+ representation: number | bigint;
15
+ }, TDefinitions extends DefinitionsOfSchemaType = DefinitionsOfSchemaType> extends Schema<TType, TDefinitions> {
16
+ protected __is: {
17
+ value: TType['input'][];
18
+ message: string;
19
+ };
20
+ protected __integer: {
21
+ message: string;
22
+ };
23
+ protected __maxDigits: {
24
+ value: number;
25
+ message: string;
26
+ };
27
+ protected __decimalPlaces: {
28
+ value: number;
29
+ message: string;
30
+ };
31
+ protected __max: {
32
+ value: number;
33
+ inclusive: boolean;
34
+ message: string;
35
+ };
36
+ protected __min: {
37
+ value: number;
38
+ inclusive: boolean;
39
+ message: string;
40
+ };
41
+ protected __allowNegative: {
42
+ allowZero: boolean;
43
+ message: string;
44
+ };
45
+ protected __allowPositive: {
46
+ allowZero: boolean;
47
+ message: string;
48
+ };
49
+ protected __transformToAdapter(options: Parameters<Schema['__transformToAdapter']>[0]): Promise<any>;
50
+ /**
51
+ * This let's you refine the schema with custom validations. This is useful when you want to validate something that is not supported by default by the schema adapter.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * import * as p from '@palmares/schemas';
56
+ *
57
+ * const numberSchema = p.number().refine((value) => {
58
+ * if (value < 0) return { code: 'invalid_number', message: 'The number should be greater than 0' };
59
+ * });
60
+ *
61
+ * const { errors, parsed } = await numberSchema.parse(-1);
62
+ *
63
+ * console.log(errors); // [{ isValid: false, code: 'invalid_number', message: 'The number should be greater than 0', path: [] }]
64
+ * ```
65
+ *
66
+ * @param refinementCallback - The callback that will be called to validate the value.
67
+ * @param options - Options for the refinement.
68
+ * @param options.isAsync - Whether the callback is async or not. Defaults to true.
69
+ *
70
+ * @returns The schema.
71
+ */
72
+ refine(refinementCallback: (value: TType['input']) => Promise<void | undefined | {
73
+ code: string;
74
+ message: string;
75
+ }> | void | undefined | {
76
+ code: string;
77
+ message: string;
78
+ }): NumberSchema<{
79
+ input: TType["input"];
80
+ validate: TType["validate"];
81
+ internal: TType["internal"];
82
+ output: TType["output"];
83
+ representation: TType["representation"];
84
+ }, TDefinitions>;
85
+ /**
86
+ * Allows the value to be either undefined or null.
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * import * as p from '@palmares/schemas';
91
+ *
92
+ * const numberSchema = p.number().optional();
93
+ *
94
+ * const { errors, parsed } = await numberSchema.parse(undefined);
95
+ *
96
+ * console.log(parsed); // undefined
97
+ *
98
+ * const { errors, parsed } = await numberSchema.parse(null);
99
+ *
100
+ * console.log(parsed); // null
101
+ *
102
+ * const { errors, parsed } = await numberSchema.parse(1);
103
+ *
104
+ * console.log(parsed); // 1
105
+ * ```
106
+ *
107
+ * @returns - The schema we are working with.
108
+ */
109
+ optional(options?: {
110
+ message: string;
111
+ allow: false;
112
+ }): NumberSchema<{
113
+ input: TType["input"] | undefined | null;
114
+ validate: TType["validate"] | undefined | null;
115
+ internal: TType["internal"] | undefined | null;
116
+ output: TType["output"] | undefined | null;
117
+ representation: TType["representation"] | undefined | null;
118
+ }, TDefinitions>;
119
+ /**
120
+ * Allows the value to be null and ONLY null. You can also use this function to set a custom message when the value is NULL by setting
121
+ * the { message: 'Your custom message', allow: false } on the options.
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * import * as p from '@palmares/schemas';
126
+ *
127
+ * const numberSchema = p.number().nullable();
128
+ *
129
+ * const { errors, parsed } = await numberSchema.parse(null);
130
+ *
131
+ * console.log(parsed); // null
132
+ *
133
+ * const { errors, parsed } = await numberSchema.parse(undefined);
134
+ *
135
+ * console.log(errors); // [{ isValid: false, code: 'invalid_type', message: 'Invalid type', path: [] }]
136
+ * ```
137
+ *
138
+ * @param options - The options for the nullable function.
139
+ * @param options.message - The message to be shown when the value is not null. Defaults to 'Cannot be null'.
140
+ * @param options.allow - Whether the value can be null or not. Defaults to true.
141
+ *
142
+ * @returns The schema.
143
+ */
144
+ nullable(options?: {
145
+ message: string;
146
+ allow: false;
147
+ }): NumberSchema<{
148
+ input: TType["input"] | null;
149
+ validate: TType["validate"] | null;
150
+ internal: TType["internal"] | null;
151
+ output: TType["output"] | null;
152
+ representation: TType["representation"] | null;
153
+ }, TDefinitions>;
154
+ /**
155
+ * This method will remove the value from the representation of the schema. If the value is undefined it will keep that way
156
+ * otherwise it will set the value to undefined after it's validated.
157
+ * This is used in conjunction with the {@link data} function, the {@link parse} function or {@link validate}
158
+ * function. This will remove the value from the representation of the schema.
159
+ *
160
+ * By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
161
+ * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
162
+ * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * import * as p from '@palmares/schemas';
167
+ *
168
+ * const userSchema = p.object({
169
+ * id: p.number().optional(),
170
+ * name: p.string(),
171
+ * password: p.string().omit()
172
+ * });
173
+ *
174
+ * const user = await userSchema.data({
175
+ * id: 1,
176
+ * name: 'John Doe',
177
+ * password: '123456'
178
+ * });
179
+ *
180
+ * console.log(user); // { id: 1, name: 'John Doe' }
181
+ * ```
182
+ *
183
+ *
184
+ * @param args - By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
185
+ * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
186
+ * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
187
+ *
188
+ * @returns The schema.
189
+ */
190
+ omit<TToInternal extends boolean, TToRepresentation extends boolean = boolean extends TToInternal ? true : false>(args?: {
191
+ toInternal?: TToInternal;
192
+ toRepresentation?: TToRepresentation;
193
+ parent?: boolean;
194
+ }): NumberSchema<{
195
+ input: TToInternal extends true ? TType["input"] | undefined : TType["input"];
196
+ validate: TToInternal extends true ? TType["validate"] | undefined : TType["validate"];
197
+ internal: TToInternal extends true ? undefined : TType["internal"];
198
+ output: TToRepresentation extends true ? TType["output"] | undefined : TType["output"];
199
+ representation: TToRepresentation extends true ? undefined : TType["representation"];
200
+ }, TDefinitions>;
201
+ /**
202
+ * This function is used in conjunction with the {@link validate} function. It's used to save a value to an external source
203
+ * like a database. You should always return the schema after you save the value, that way we will always have the correct type
204
+ * of the schema after the save operation.
205
+ *
206
+ * You can use the {@link toRepresentation} function to transform and clean the value it returns after the save.
207
+ *
208
+ * @example
209
+ * ```typescript
210
+ * import * as p from '@palmares/schemas';
211
+ *
212
+ * import { User } from './models';
213
+ *
214
+ * const userSchema = p.object({
215
+ * id: p.number().optional(),
216
+ * name: p.string(),
217
+ * email: p.string().email(),
218
+ * }).onSave(async (value) => {
219
+ * // Create or update the user on the database using palmares models or any other library of your choice.
220
+ * if (value.id)
221
+ * await User.default.set(value, { search: { id: value.id } });
222
+ * else
223
+ * await User.default.set(value);
224
+ *
225
+ * return value;
226
+ * });
227
+ *
228
+ *
229
+ * // Then, on your controller, do something like this:
230
+ * const { isValid, save, errors } = await userSchema.validate(req.body);
231
+ * if (isValid) {
232
+ * const savedValue = await save();
233
+ * return Response.json(savedValue, { status: 201 });
234
+ * }
235
+ *
236
+ * return Response.json({ errors }, { status: 400 });
237
+ * ```
238
+ *
239
+ * @param callback - The callback that will be called to save the value on an external source.
240
+ *
241
+ * @returns The schema.
242
+ */
243
+ onSave(callback: (value: TType['internal']) => Promise<TType['output']> | TType['output']): NumberSchema<{
244
+ input: TType["input"];
245
+ validate: TType["validate"];
246
+ internal: TType["internal"];
247
+ output: TType["output"];
248
+ representation: TType["representation"];
249
+ }, TDefinitions & {
250
+ hasSave: true;
251
+ }>;
252
+ /**
253
+ * This function is used to add a default value to the schema. If the value is either undefined or null, the default value will be used.
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * import * as p from '@palmares/schemas';
258
+ *
259
+ * const numberSchema = p.number().default(0);
260
+ *
261
+ * const { errors, parsed } = await numberSchema.parse(undefined);
262
+ *
263
+ * console.log(parsed); // 0
264
+ * ```
265
+ */
266
+ default<TDefaultValue extends TType['input'] | (() => Promise<TType['input']>)>(defaultValueOrFunction: TDefaultValue): NumberSchema<{
267
+ input: TType["input"] | undefined | null;
268
+ validate: TType["validate"];
269
+ internal: TType["internal"];
270
+ output: TType["output"] | undefined | null;
271
+ representation: TType["representation"];
272
+ }, TDefinitions>;
273
+ /**
274
+ * This function let's you customize the schema your own way. After we translate the schema on the adapter we call this function to let you customize
275
+ * the custom schema your own way. Our API does not support passthrough? No problem, you can use this function to customize the zod schema.
276
+ *
277
+ * @example
278
+ * ```typescript
279
+ * import * as p from '@palmares/schemas';
280
+ *
281
+ * const numberSchema = p.number().extends((schema) => {
282
+ * return schema.nonnegative();
283
+ * });
284
+ *
285
+ * const { errors, parsed } = await numberSchema.parse(-1);
286
+ *
287
+ * console.log(errors); // [{ isValid: false, code: 'nonnegative', message: 'The number should be nonnegative', path: [] }]
288
+ * ```
289
+ *
290
+ * @param callback - The callback that will be called to customize the schema.
291
+ * @param toStringCallback - The callback that will be called to transform the schema to a string when you want to compile the underlying schema
292
+ * to a string so you can save it for future runs.
293
+ *
294
+ * @returns The schema.
295
+ */
296
+ extends(callback: (schema: Awaited<ReturnType<NonNullable<TDefinitions['schemaAdapter']['number']>['translate']>>) => Awaited<ReturnType<NonNullable<TDefinitions['schemaAdapter']['field']>['translate']>> | any, toStringCallback?: (schemaAsString: string) => string): this;
297
+ /**
298
+ * This function is used to transform the value to the representation of the schema. When using the {@link data} function. With this function you have full
299
+ * control to add data cleaning for example, transforming the data and whatever. Another use case is when you want to return deeply nested recursive data.
300
+ * The schema maps to itself.
301
+ *
302
+ * @example
303
+ * ```typescript
304
+ * import * as p from '@palmares/schemas';
305
+ *
306
+ * const recursiveSchema = p.object({
307
+ * id: p.number().optional(),
308
+ * name: p.string(),
309
+ * }).toRepresentation(async (value) => {
310
+ * return {
311
+ * id: value.id,
312
+ * name: value.name,
313
+ * children: await Promise.all(value.children.map(async (child) => await recursiveSchema.data(child)))
314
+ * }
315
+ * });
316
+ *
317
+ * const data = await recursiveSchema.data({
318
+ * id: 1,
319
+ * name: 'John Doe',
320
+ * });
321
+ * ```
322
+ *
323
+ * @example
324
+ * ```
325
+ * import * as p from '@palmares/schemas';
326
+ *
327
+ * const colorToRGBSchema = p.string().toRepresentation(async (value) => {
328
+ * switch (value) {
329
+ * case 'red': return { r: 255, g: 0, b: 0 };
330
+ * case 'green': return { r: 0, g: 255, b: 0 };
331
+ * case 'blue': return { r: 0, g: 0, b: 255 };
332
+ * default: return { r: 0, g: 0, b: 0 };
333
+ * }
334
+ * });
335
+ * ```
336
+ * @param toRepresentationCallback - The callback that will be called to transform the value to the representation.
337
+ *
338
+ * @returns The schema with a new return type
339
+ */
340
+ toRepresentation<TRepresentation>(toRepresentationCallback: (value: TType['representation']) => Promise<TRepresentation>): NumberSchema<{
341
+ input: TType["input"];
342
+ validate: TType["validate"];
343
+ internal: TType["internal"];
344
+ output: TType["output"];
345
+ representation: TRepresentation;
346
+ }, TDefinitions>;
347
+ /**
348
+ * This function is used to transform the value to the internal representation of the schema. This is useful when you want to transform the value
349
+ * to a type that the schema adapter can understand. For example, you might want to transform a string to a date. This is the function you use.
350
+ *
351
+ * @example
352
+ * ```typescript
353
+ * import * as p from '@palmares/schemas';
354
+ *
355
+ * const dateSchema = p.string().toInternal((value) => {
356
+ * return new Date(value);
357
+ * });
358
+ *
359
+ * const date = await dateSchema.parse('2021-01-01');
360
+ *
361
+ * console.log(date); // Date object
362
+ *
363
+ * const rgbToColorSchema = p.object({
364
+ * r: p.number().min(0).max(255),
365
+ * g: p.number().min(0).max(255),
366
+ * b: p.number().min(0).max(255),
367
+ * }).toInternal(async (value) => {
368
+ * if (value.r === 255 && value.g === 0 && value.b === 0) return 'red';
369
+ * if (value.r === 0 && value.g === 255 && value.b === 0) return 'green';
370
+ * if (value.r === 0 && value.g === 0 && value.b === 255) return 'blue';
371
+ * return `rgb(${value.r}, ${value.g}, ${value.b})`;
372
+ * });
373
+ * ```
374
+ *
375
+ * @param toInternalCallback - The callback that will be called to transform the value to the internal representation.
376
+ *
377
+ * @returns The schema with a new return type.
378
+ */
379
+ toInternal<TInternal>(toInternalCallback: (value: TType['validate']) => Promise<TInternal>): NumberSchema<{
380
+ input: TType["input"];
381
+ validate: TType["validate"];
382
+ internal: TInternal;
383
+ output: TType["output"];
384
+ representation: TType["representation"];
385
+ }, TDefinitions>;
386
+ /**
387
+ * Called before the validation of the schema. Let's say that you want to validate a date that might receive a string, you can convert that string to a date
388
+ * here BEFORE the validation. This pretty much transforms the value to a type that the schema adapter can understand.
389
+ *
390
+ * @example
391
+ * ```
392
+ * import * as p from '@palmares/schemas';
393
+ * import * as z from 'zod';
394
+ *
395
+ * const customRecordToMapSchema = p.schema().appendSchema(z.map()).toValidate(async (value) => {
396
+ * return new Map(value); // Before validating we transform the value to a map.
397
+ * });
398
+ *
399
+ * const { errors, parsed } = await customRecordToMapSchema.parse({ key: 'value' });
400
+ * ```
401
+ *
402
+ * @param toValidateCallback - The callback that will be called to validate the value.
403
+ *
404
+ * @returns The schema with a new return type.
405
+ */
406
+ toValidate<TValidate>(toValidateCallback: (value: TType['input']) => Promise<TValidate> | TValidate): NumberSchema<{
407
+ input: TType["input"];
408
+ validate: TValidate;
409
+ internal: TType["internal"];
410
+ output: TType["output"];
411
+ representation: TType["representation"];
412
+ }, TDefinitions>;
413
+ /**
414
+ * Defines a list of numbers that are allowed, it's not a range but the actual numbers that are allowed, it's useful
415
+ * when you want to allow only specific set of numbers.
416
+ *
417
+ * @example
418
+ * ```typescript
419
+ * import * as p from '@palmares/schema';
420
+ *
421
+ * const schema = p.number().is([1, 2, 3]);
422
+ *
423
+ * schema.parse(1); // { errors: [], parsed: 1 }
424
+ * schema.parse(2); // { errors: [], parsed: 2 }
425
+ * schema.parse(3); // { errors: [], parsed: 3 }
426
+ * schema.parse(4); // { errors: [{ code: 'is', message: 'The value should be equal to 1,2,3' }], parsed: 4 }
427
+ * ```
428
+ *
429
+ * @param value - The list of numbers that are allowed
430
+ *
431
+ * @returns - The schema instance
432
+ */
433
+ is<const TValue extends TType['input'][]>(value: TValue): Schema<{
434
+ input: TValue[number];
435
+ output: TValue[number];
436
+ internal: TValue[number];
437
+ representation: TValue[number];
438
+ validate: TValue[number];
439
+ }, TDefinitions>;
440
+ /**
441
+ * Allows only numbers that are less than the value passed. If you want to allow the number to be equal to the value, you can pass the option `inclusive` as `true`.
442
+ * Otherwise, it will only allow numbers less than the value.
443
+ *
444
+ * @example
445
+ * ```typescript
446
+ * import * as p from '@palmares/schema';
447
+ *
448
+ * const schema = p.number().max(10);
449
+ *
450
+ * schema.parse(10); // { errors: [{ code: 'max', message: 'The number should be less than 10' }], parsed: 10 }
451
+ * schema.parse(9); // { errors: [], parsed: 9 }
452
+ *
453
+ * const schema = p.number().max(10, { inclusive: true });
454
+ *
455
+ * schema.parse(10); // { errors: [], parsed: 10 }
456
+ * ```
457
+ *
458
+ * @param value - The value to compare with the number
459
+ * @param options - The options to be passed to the validation
460
+ * @param options.inclusive - If you want to allow the number to be equal to the value, you can pass this option
461
+ * @param options.message - The message to be returned if the validation fails
462
+ *
463
+ * @returns - The schema instance
464
+ */
465
+ max(value: number, options?: {
466
+ inclusive?: boolean;
467
+ message?: string;
468
+ }): NumberSchema<TType, TDefinitions> & {
469
+ is: never;
470
+ };
471
+ /**
472
+ * This method will validate if the number is greater than the value passed. If you want to allow the number to be equal to the value, you can pass the option `inclusive` as `true`.
473
+ * Otherwise, it will only allow numbers greater than the value.
474
+ *
475
+ * @example
476
+ * ```typescript
477
+ * import * as p from '@palmares/schema';
478
+ *
479
+ * const schema = p.number().min(10);
480
+ *
481
+ * schema.parse(10); // { errors: [], parsed: 10 }
482
+ * schema.parse(9); // { errors: [{ code: 'min', message: 'The number should be greater than 10' }], parsed: 9 }
483
+ *
484
+ * const schema = p.number().min(10, { inclusive: true });
485
+ *
486
+ * schema.parse(10); // { errors: [], parsed: 10 }
487
+ * ```
488
+ *
489
+ * @param value - The value to compare with the number
490
+ * @param options - The options to be passed to the validation
491
+ * @param options.inclusive - If you want to allow the number to be equal to the value, you can pass this option
492
+ * @param options.message - The message to be returned if the validation fails
493
+ *
494
+ * @returns - The schema instance
495
+ */
496
+ min(value: number, options?: {
497
+ inclusive?: boolean;
498
+ message?: string;
499
+ }): this;
500
+ /**
501
+ * Allows only negative numbers. If you want to allow zero, you can pass the option `allowZero` as `true`. Otherwise, it will only allow negative numbers.
502
+ *
503
+ * @example
504
+ * ```typescript
505
+ * import * as p from '@palmares/schema';
506
+ *
507
+ * const schema = p.number().negative();
508
+ *
509
+ * schema.parse(-10); // { errors: [], parsed: -10 }
510
+ * schema.parse(0); // { errors: [{ code: 'negative', message: 'The number should be negative' }], parsed: 0 }
511
+ *
512
+ * const schema = p.number().negative({ allowZero: true });
513
+ *
514
+ * schema.parse(0); // { errors: [], parsed: 0 }
515
+ * ```
516
+ *
517
+ * @param options - The options to be passed to the validation
518
+ * @param options.allowZero - If you want to allow zero, you can pass this option as `true`. Otherwise, it will only allow negative numbers.
519
+ * @param options.message - The message to be returned if the validation fails
520
+ *
521
+ * @returns - The schema instance
522
+ */
523
+ negative(options?: {
524
+ allowZero?: boolean;
525
+ message?: string;
526
+ }): NumberSchema<{
527
+ input: TType["input"];
528
+ output: TType["output"];
529
+ representation: TType["representation"];
530
+ internal: TType["internal"];
531
+ validate: TType["validate"];
532
+ }, TDefinitions>;
533
+ /**
534
+ * Allows only positive numbers. If you want to allow zero, you can pass the option `allowZero` as `true`. Otherwise, it will only allow positive numbers greater than zero.
535
+ *
536
+ * @example
537
+ * ```typescript
538
+ * import * as p from '@palmares/schema';
539
+ *
540
+ * const schema = p.number().positive();
541
+ *
542
+ * schema.parse(10); // { errors: [], parsed: 10 }
543
+ * schema.parse(0); // { errors: [{ code: 'positive', message: 'The number should be positive' }], parsed: 0 }
544
+ *
545
+ * const schema = p.number().positive({ allowZero: true });
546
+ * schema.parse(0); // { errors: [], parsed: 0 }
547
+ * ```
548
+ *
549
+ * @param options - The options to be passed to the validation
550
+ * @param options.allowZero - If you want to allow zero, you can pass this option as `true`. Otherwise, it will only allow positive numbers greater than zero.
551
+ * @param options.message - The message to be returned if the validation fails
552
+ *
553
+ * @returns - The schema instance
554
+ */
555
+ positive(options?: {
556
+ allowZero?: boolean;
557
+ message?: string;
558
+ }): NumberSchema<{
559
+ input: TType["input"];
560
+ output: TType["output"];
561
+ representation: TType["representation"];
562
+ internal: TType["internal"];
563
+ validate: TType["validate"];
564
+ }, TDefinitions>;
565
+ /**
566
+ * This method will validate the number to have the exact number of decimal places. It's usually useful for decimal numbers like currencies.
567
+ *
568
+ * @example
569
+ * ```
570
+ * const schema = number().decimalPlaces(2);
571
+ *
572
+ * schema.parse(10.00); // { errors: [], parsed: 10.00}
573
+ *
574
+ * schema.parse(10.000); // { errors: [{ code: 'decimal_places', message: 'The number should have 2 decimal places' }], parsed: 10.000}
575
+ * ```
576
+ *
577
+ * @param value - The number of decimal places.
578
+ * @param options - The options.
579
+ * @param options.message - The message to show if the validation fails.
580
+ *
581
+ * @returns The schema so you can chain other methods.
582
+ */
583
+ decimalPlaces(value: number, options?: {
584
+ message?: string;
585
+ }): NumberSchema<{
586
+ input: TType["input"];
587
+ output: TType["output"];
588
+ representation: TType["representation"];
589
+ internal: TType["internal"];
590
+ validate: TType["validate"];
591
+ }, TDefinitions>;
592
+ /**
593
+ * This method will validate the number to have at most the number of digits specified. If used in conjunction with {@link decimalPlaces}, this number should be bigger than the
594
+ * value of the decimal places.
595
+ *
596
+ * Think about that
597
+ *
598
+ * - If you have a number with 2 decimal places, the number 10.00 has 4 digits and 2 decimal places.
599
+ * - The number 10.000 has 5 digits and 3 decimal places.
600
+ *
601
+ * @example
602
+ * ```
603
+ * const schema = number().maxDigits(4);
604
+ *
605
+ * schema.parse(10); // { errors: [], parsed: 10}
606
+ * schema.parse(100); // { errors: [], parsed: 100}
607
+ * schema.parse(1000); // { errors: [], parsed: 1000}
608
+ * ```
609
+ *
610
+ * @param value - The maximum number of digits, counting the digits before and after the decimal point.
611
+ * @param options - Custom options for the validation.
612
+ * @param options.message - The message to show if the validation fails.
613
+ *
614
+ * @returns - The schema so you can chain other methods.
615
+ */
616
+ maxDigits(value: number, options?: {
617
+ message?: string;
618
+ }): NumberSchema<{
619
+ input: TType["input"];
620
+ output: TType["output"];
621
+ representation: TType["representation"];
622
+ internal: TType["internal"];
623
+ validate: TType["validate"];
624
+ }, TDefinitions>;
625
+ /**
626
+ * With this method we will validate if the number is an integer. If it's not, we will return an error.
627
+ *
628
+ * @example
629
+ * ```typescript
630
+ * import * as p from '@palmares/schema';
631
+ *
632
+ * const schema = p.number().integer();
633
+ *
634
+ * schema.parse(10); // { errors: [], parsed: 10 }
635
+ * schema.parse(10.1); // { errors: [{ code: 'integer', message: 'The number should be an integer' }], parsed: 10.1 }
636
+ * ```
637
+ *
638
+ * @param options - The options to be passed to the validation
639
+ * @param options.message - The message to be returned if the validation fails
640
+ *
641
+ * @returns - The schema instance
642
+ */
643
+ integer(options?: {
644
+ message?: string;
645
+ }): NumberSchema<{
646
+ input: TType["input"];
647
+ output: TType["output"];
648
+ representation: TType["representation"];
649
+ internal: TType["internal"];
650
+ validate: TType["validate"];
651
+ }, TDefinitions>;
652
+ static new<TDefinitions extends DefinitionsOfSchemaType>(): NumberSchema<{
653
+ input: number | bigint;
654
+ output: number | bigint;
655
+ internal: number | bigint;
656
+ representation: number | bigint;
657
+ validate: number | bigint;
658
+ }, TDefinitions>;
659
+ }
660
+ export declare const number: <TDefinitions extends DefinitionsOfSchemaType>() => NumberSchema<{
661
+ input: number | bigint;
662
+ output: number | bigint;
663
+ internal: number | bigint;
664
+ representation: number | bigint;
665
+ validate: number | bigint;
666
+ }, TDefinitions>;
667
+ //# sourceMappingURL=number.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../../src/schema/number.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAW9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,YAAY,CAC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