@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,606 @@
1
+ import Schema from './schema';
2
+ import type { DefinitionsOfSchemaType } from './types';
3
+ import type { Narrow } from '@palmares/core';
4
+ export default class StringSchema<TType extends {
5
+ input: any;
6
+ validate: any;
7
+ internal: any;
8
+ output: any;
9
+ representation: any;
10
+ } = {
11
+ input: string;
12
+ output: string;
13
+ internal: string;
14
+ representation: string;
15
+ validate: string;
16
+ }, TDefinitions extends DefinitionsOfSchemaType = DefinitionsOfSchemaType> extends Schema<TType, TDefinitions> {
17
+ protected __is: {
18
+ value: Narrow<TType['input'] | TType['input'][]>;
19
+ message: string;
20
+ };
21
+ protected __email: {
22
+ message: string;
23
+ };
24
+ protected __uuid: {
25
+ message: string;
26
+ };
27
+ protected __minLength: {
28
+ value: number;
29
+ inclusive: boolean;
30
+ message: string;
31
+ };
32
+ protected __maxLength: {
33
+ value: number;
34
+ inclusive: boolean;
35
+ message: string;
36
+ };
37
+ protected __regex: {
38
+ value: RegExp;
39
+ message: string;
40
+ };
41
+ protected __endsWith: {
42
+ value: string;
43
+ message: string;
44
+ };
45
+ protected __startsWith: {
46
+ value: string;
47
+ message: string;
48
+ };
49
+ protected __includes: {
50
+ value: string;
51
+ message: string;
52
+ };
53
+ protected __transformToAdapter(options: Parameters<Schema['__transformToAdapter']>[0]): Promise<any>;
54
+ /**
55
+ * 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.
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * import * as p from '@palmares/schemas';
60
+ *
61
+ * const numberSchema = p.number().refine((value) => {
62
+ * if (value < 0) return { code: 'invalid_number', message: 'The number should be greater than 0' };
63
+ * });
64
+ *
65
+ * const { errors, parsed } = await numberSchema.parse(-1);
66
+ *
67
+ * console.log(errors); // [{ isValid: false, code: 'invalid_number', message: 'The number should be greater than 0', path: [] }]
68
+ * ```
69
+ *
70
+ * @param refinementCallback - The callback that will be called to validate the value.
71
+ * @param options - Options for the refinement.
72
+ * @param options.isAsync - Whether the callback is async or not. Defaults to true.
73
+ */
74
+ refine(refinementCallback: (value: TType['input']) => Promise<void | undefined | {
75
+ code: string;
76
+ message: string;
77
+ }> | void | undefined | {
78
+ code: string;
79
+ message: string;
80
+ }): StringSchema<{
81
+ input: TType["input"];
82
+ validate: TType["validate"];
83
+ internal: TType["internal"];
84
+ output: TType["output"];
85
+ representation: TType["representation"];
86
+ }, TDefinitions>;
87
+ /**
88
+ * Allows the value to be either undefined or null.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * import * as p from '@palmares/schemas';
93
+ *
94
+ * const numberSchema = p.number().optional();
95
+ *
96
+ * const { errors, parsed } = await numberSchema.parse(undefined);
97
+ *
98
+ * console.log(parsed); // undefined
99
+ *
100
+ * const { errors, parsed } = await numberSchema.parse(null);
101
+ *
102
+ * console.log(parsed); // null
103
+ *
104
+ * const { errors, parsed } = await numberSchema.parse(1);
105
+ *
106
+ * console.log(parsed); // 1
107
+ * ```
108
+ *
109
+ * @returns - The schema we are working with.
110
+ */
111
+ optional(options?: {
112
+ message: string;
113
+ allow: false;
114
+ }): StringSchema<{
115
+ input: TType["input"] | undefined | null;
116
+ validate: TType["validate"] | undefined | null;
117
+ internal: TType["internal"] | undefined | null;
118
+ output: TType["output"] | undefined | null;
119
+ representation: TType["representation"] | undefined | null;
120
+ }, TDefinitions>;
121
+ /**
122
+ * 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
123
+ * the { message: 'Your custom message', allow: false } on the options.
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * import * as p from '@palmares/schemas';
128
+ *
129
+ * const numberSchema = p.number().nullable();
130
+ *
131
+ * const { errors, parsed } = await numberSchema.parse(null);
132
+ *
133
+ * console.log(parsed); // null
134
+ *
135
+ * const { errors, parsed } = await numberSchema.parse(undefined);
136
+ *
137
+ * console.log(errors); // [{ isValid: false, code: 'invalid_type', message: 'Invalid type', path: [] }]
138
+ * ```
139
+ *
140
+ * @param options - The options for the nullable function.
141
+ * @param options.message - The message to be shown when the value is not null. Defaults to 'Cannot be null'.
142
+ * @param options.allow - Whether the value can be null or not. Defaults to true.
143
+ *
144
+ * @returns The schema.
145
+ */
146
+ nullable(options?: {
147
+ message: string;
148
+ allow: false;
149
+ }): StringSchema<{
150
+ input: TType["input"] | null;
151
+ validate: TType["validate"] | null;
152
+ internal: TType["internal"] | null;
153
+ output: TType["output"] | null;
154
+ representation: TType["representation"] | null;
155
+ }, TDefinitions>;
156
+ /**
157
+ * This method will remove the value from the representation of the schema. If the value is undefined it will keep that way
158
+ * otherwise it will set the value to undefined after it's validated.
159
+ * This is used in conjunction with the {@link data} function, the {@link parse} function or {@link validate}
160
+ * function. This will remove the value from the representation of the schema.
161
+ *
162
+ * By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
163
+ * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
164
+ * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * import * as p from '@palmares/schemas';
169
+ *
170
+ * const userSchema = p.object({
171
+ * id: p.number().optional(),
172
+ * name: p.string(),
173
+ * password: p.string().omit()
174
+ * });
175
+ *
176
+ * const user = await userSchema.data({
177
+ * id: 1,
178
+ * name: 'John Doe',
179
+ * password: '123456'
180
+ * });
181
+ *
182
+ * console.log(user); // { id: 1, name: 'John Doe' }
183
+ * ```
184
+ *
185
+ *
186
+ * @param args - By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
187
+ * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
188
+ * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
189
+ *
190
+ * @returns The schema.
191
+ */
192
+ omit<TToInternal extends boolean, TToRepresentation extends boolean = boolean extends TToInternal ? true : false>(args?: {
193
+ toInternal?: TToInternal;
194
+ toRepresentation?: TToRepresentation;
195
+ }): StringSchema<{
196
+ input: TToInternal extends true ? TType["input"] | undefined : TType["input"];
197
+ validate: TToInternal extends true ? TType["validate"] | undefined : TType["validate"];
198
+ internal: TToInternal extends true ? undefined : TType["internal"];
199
+ output: TToRepresentation extends true ? TType["output"] | undefined : TType["output"];
200
+ representation: TToRepresentation extends true ? undefined : TType["representation"];
201
+ }, TDefinitions>;
202
+ /**
203
+ * This function is used in conjunction with the {@link validate} function. It's used to save a value to an external source
204
+ * like a database. You should always return the schema after you save the value, that way we will always have the correct type
205
+ * of the schema after the save operation.
206
+ *
207
+ * You can use the {@link toRepresentation} function to transform and clean the value it returns after the save.
208
+ *
209
+ * @example
210
+ * ```typescript
211
+ * import * as p from '@palmares/schemas';
212
+ *
213
+ * import { User } from './models';
214
+ *
215
+ * const userSchema = p.object({
216
+ * id: p.number().optional(),
217
+ * name: p.string(),
218
+ * email: p.string().email(),
219
+ * }).onSave(async (value) => {
220
+ * // Create or update the user on the database using palmares models or any other library of your choice.
221
+ * if (value.id)
222
+ * await User.default.set(value, { search: { id: value.id } });
223
+ * else
224
+ * await User.default.set(value);
225
+ *
226
+ * return value;
227
+ * });
228
+ *
229
+ *
230
+ * // Then, on your controller, do something like this:
231
+ * const { isValid, save, errors } = await userSchema.validate(req.body);
232
+ * if (isValid) {
233
+ * const savedValue = await save();
234
+ * return Response.json(savedValue, { status: 201 });
235
+ * }
236
+ *
237
+ * return Response.json({ errors }, { status: 400 });
238
+ * ```
239
+ *
240
+ * @param callback - The callback that will be called to save the value on an external source.
241
+ *
242
+ * @returns The schema.
243
+ */
244
+ onSave(callback: (value: TType['internal']) => Promise<TType['output']> | TType['output']): StringSchema<{
245
+ input: TType["input"];
246
+ validate: TType["validate"];
247
+ internal: TType["internal"];
248
+ output: TType["output"];
249
+ representation: TType["representation"];
250
+ }, TDefinitions & {
251
+ hasSave: true;
252
+ }>;
253
+ /**
254
+ * 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.
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * import * as p from '@palmares/schemas';
259
+ *
260
+ * const numberSchema = p.number().default(0);
261
+ *
262
+ * const { errors, parsed } = await numberSchema.parse(undefined);
263
+ *
264
+ * console.log(parsed); // 0
265
+ * ```
266
+ */
267
+ default<TDefaultValue extends TType['input'] | (() => Promise<TType['input']>)>(defaultValueOrFunction: TDefaultValue): StringSchema<{
268
+ input: TType["input"] | undefined | null;
269
+ validate: TType["validate"];
270
+ internal: TType["internal"];
271
+ output: TType["output"] | undefined | null;
272
+ representation: TType["representation"];
273
+ }, TDefinitions>;
274
+ /**
275
+ * 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
276
+ * the custom schema your own way. Our API does not support passthrough? No problem, you can use this function to customize the zod schema.
277
+ *
278
+ * @example
279
+ * ```typescript
280
+ * import * as p from '@palmares/schemas';
281
+ *
282
+ * const numberSchema = p.number().extends((schema) => {
283
+ * return schema.nonnegative();
284
+ * });
285
+ *
286
+ * const { errors, parsed } = await numberSchema.parse(-1);
287
+ *
288
+ * console.log(errors); // [{ isValid: false, code: 'nonnegative', message: 'The number should be nonnegative', path: [] }]
289
+ * ```
290
+ *
291
+ * @param callback - The callback that will be called to customize the schema.
292
+ * @param toStringCallback - The callback that will be called to transform the schema to a string when you want to compile the underlying schema
293
+ * to a string so you can save it for future runs.
294
+ *
295
+ * @returns The schema.
296
+ */
297
+ extends(callback: (schema: Awaited<ReturnType<NonNullable<TDefinitions['schemaAdapter']['string']>['translate']>>) => Awaited<ReturnType<NonNullable<TDefinitions['schemaAdapter']['field']>['translate']>> | any, toStringCallback?: (schemaAsString: string) => string): this;
298
+ /**
299
+ * 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
300
+ * 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.
301
+ * The schema maps to itself.
302
+ *
303
+ * @example
304
+ * ```typescript
305
+ * import * as p from '@palmares/schemas';
306
+ *
307
+ * const recursiveSchema = p.object({
308
+ * id: p.number().optional(),
309
+ * name: p.string(),
310
+ * }).toRepresentation(async (value) => {
311
+ * return {
312
+ * id: value.id,
313
+ * name: value.name,
314
+ * children: await Promise.all(value.children.map(async (child) => await recursiveSchema.data(child)))
315
+ * }
316
+ * });
317
+ *
318
+ * const data = await recursiveSchema.data({
319
+ * id: 1,
320
+ * name: 'John Doe',
321
+ * });
322
+ * ```
323
+ *
324
+ * @example
325
+ * ```
326
+ * import * as p from '@palmares/schemas';
327
+ *
328
+ * const colorToRGBSchema = p.string().toRepresentation(async (value) => {
329
+ * switch (value) {
330
+ * case 'red': return { r: 255, g: 0, b: 0 };
331
+ * case 'green': return { r: 0, g: 255, b: 0 };
332
+ * case 'blue': return { r: 0, g: 0, b: 255 };
333
+ * default: return { r: 0, g: 0, b: 0 };
334
+ * }
335
+ * });
336
+ * ```
337
+ * @param toRepresentationCallback - The callback that will be called to transform the value to the representation.
338
+ *
339
+ * @returns The schema with a new return type
340
+ */
341
+ toRepresentation<TRepresentation>(toRepresentationCallback: (value: TType['representation']) => Promise<TRepresentation>): StringSchema<{
342
+ input: TType["input"];
343
+ validate: TType["validate"];
344
+ internal: TType["internal"];
345
+ output: TType["output"];
346
+ representation: TRepresentation;
347
+ }, TDefinitions>;
348
+ /**
349
+ * 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
350
+ * 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.
351
+ *
352
+ * @example
353
+ * ```typescript
354
+ * import * as p from '@palmares/schemas';
355
+ *
356
+ * const dateSchema = p.string().toInternal((value) => {
357
+ * return new Date(value);
358
+ * });
359
+ *
360
+ * const date = await dateSchema.parse('2021-01-01');
361
+ *
362
+ * console.log(date); // Date object
363
+ *
364
+ * const rgbToColorSchema = p.object({
365
+ * r: p.number().min(0).max(255),
366
+ * g: p.number().min(0).max(255),
367
+ * b: p.number().min(0).max(255),
368
+ * }).toInternal(async (value) => {
369
+ * if (value.r === 255 && value.g === 0 && value.b === 0) return 'red';
370
+ * if (value.r === 0 && value.g === 255 && value.b === 0) return 'green';
371
+ * if (value.r === 0 && value.g === 0 && value.b === 255) return 'blue';
372
+ * return `rgb(${value.r}, ${value.g}, ${value.b})`;
373
+ * });
374
+ * ```
375
+ *
376
+ * @param toInternalCallback - The callback that will be called to transform the value to the internal representation.
377
+ *
378
+ * @returns The schema with a new return type.
379
+ */
380
+ toInternal<TInternal>(toInternalCallback: (value: TType['validate']) => Promise<TInternal>): StringSchema<{
381
+ input: TType["input"];
382
+ validate: TType["validate"];
383
+ internal: TInternal;
384
+ output: TType["output"];
385
+ representation: TType["representation"];
386
+ }, TDefinitions>;
387
+ /**
388
+ * 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
389
+ * here BEFORE the validation. This pretty much transforms the value to a type that the schema adapter can understand.
390
+ *
391
+ * @example
392
+ * ```typescript
393
+ * import * as p from '@palmares/schemas';
394
+ * import * as z from 'zod';
395
+ *
396
+ * const customRecordToMapSchema = p.schema().appendSchema(z.map()).toValidate(async (value) => {
397
+ * return new Map(value); // Before validating we transform the value to a map.
398
+ * });
399
+ *
400
+ * const { errors, parsed } = await customRecordToMapSchema.parse({ key: 'value' });
401
+ * ```
402
+ *
403
+ * @param toValidateCallback - The callback that will be called to validate the value.
404
+ *
405
+ * @returns The schema with a new return type.
406
+ */
407
+ toValidate<TValidate>(toValidateCallback: (value: TType['input']) => Promise<TValidate> | TValidate): StringSchema<{
408
+ input: TType["input"];
409
+ validate: TValidate;
410
+ internal: TType["internal"];
411
+ output: TType["output"];
412
+ representation: TType["representation"];
413
+ }, TDefinitions>;
414
+ /**
415
+ * Defines a list of strings that are allowed, it's useful when you want to restrict the values that are allowed. Like a selector or a Choice field.
416
+ *
417
+ * @example
418
+ * ```typescript
419
+ * import * as p from '@palmares/schema';
420
+ *
421
+ * const schema = p.string().is(['Argentina', 'Brazil', 'Chile']);
422
+ *
423
+ * schema.parse('Argentina'); // { errors: [], parsed: 'Argentina' }
424
+ * schema.parse('Uruguay'); // { errors: [{ code: 'invalid_value', message: 'The value should be equal to Argentina, Brazil, Chile', path: [] }], parsed: 'Uruguay' }
425
+ * ```
426
+ *
427
+ * @param value - The list of numbers that are allowed
428
+ *
429
+ * @returns - The schema instance
430
+ */
431
+ is<const TValue extends TType['input'][]>(value: TValue): Schema<{
432
+ input: TValue[number];
433
+ output: TValue[number];
434
+ internal: TValue[number];
435
+ representation: TValue[number];
436
+ validate: TValue[number];
437
+ }, TDefinitions>;
438
+ /**
439
+ * Validates if the string ends with a specific value.
440
+ *
441
+ * @example
442
+ * ```typescript
443
+ * import * as p from '@palmares/schema';
444
+ *
445
+ * const schema = p.string().endsWith('.com');
446
+ *
447
+ * schema.parse('example.com'); // { errors: [], parsed: 'example.com' }
448
+ * schema.parse('example.org'); // { errors: [{ code: 'endsWith', message: 'The value should end with .com', path: [] }], parsed: 'example.org' }
449
+ * ```
450
+ *
451
+ * @param value - The value that the string should end with.
452
+ * @param options - The options for the endsWith function.
453
+ * @param options.message - The message to be shown when the value does not end with the value.
454
+ *
455
+ * @returns - The schema instance.
456
+ */
457
+ endsWith(value: string, options?: Partial<Omit<StringSchema['__endsWith'], 'value'>>): this;
458
+ /**
459
+ * Validates if the string starts with a specific value.
460
+ *
461
+ * @example
462
+ * ```typescript
463
+ * import * as p from '@palmares/schema';
464
+ *
465
+ * const schema = p.string().startsWith('https://');
466
+ *
467
+ * schema.parse('https://example.com'); // { errors: [], parsed: 'https://example.com' }
468
+ * schema.parse('http://example.com'); // { errors: [{ code: 'startsWith', message: 'The value should start with https://', path: [] }], parsed: 'http://example.com' }
469
+ * ```
470
+ *
471
+ * @param value - The value that the string should start with.
472
+ * @param options - The options for the startsWith function.
473
+ * @param options.message - The message to be shown when the value does not start with the value.
474
+ *
475
+ * @returns - The schema instance.
476
+ */
477
+ startsWith(value: string, options?: Partial<Omit<StringSchema['__startsWith'], 'value'>>): this;
478
+ /**
479
+ * Checks if the string includes a specific substring.
480
+ *
481
+ * @example
482
+ * ```typescript
483
+ * import * as p from '@palmares/schema';
484
+ *
485
+ * const schema = p.string().includes('for babies');
486
+ *
487
+ * schema.parse('Computer graphics for babies'); // { errors: [], parsed: 'Computer graphics for babies' }
488
+ * schema.parse('Learn javascript as you were 5'); // { errors: [{ code: 'includes', message: 'The string value should include the following substring 'for babies', path: [] }], parsed: 'example.org' }
489
+ * ```
490
+ *
491
+ * @param value - The value that the string should include.
492
+ * @param options - The options for the includes function.
493
+ * @param options.message - The message to be shown when the value does not include the value.
494
+ *
495
+ * @returns - The schema instance.
496
+ */
497
+ includes(value: string, options?: Partial<Omit<StringSchema['__includes'], 'value'>>): this;
498
+ /**
499
+ * Validates if the string matches a specific regex.
500
+ *
501
+ * @example
502
+ * ```typescript
503
+ * import * as p from '@palmares/schema';
504
+ *
505
+ * const schema = p.string().regex(/^[a-z]+$/);
506
+ *
507
+ * schema.parse('abc'); // { errors: [], parsed: 'abc' }
508
+ * schema.parse('123'); // { errors: [{ code: 'regex', message: 'The value should match the following regex /^[a-z]+$/', path: [] }], parsed: '123' }
509
+ * ```
510
+ *
511
+ * @param value - The regex that the string should match.
512
+ * @param options - The options for the regex function.
513
+ * @param options.message - The message to be shown when the value does not match the regex.
514
+ *
515
+ * @returns - The schema instance.
516
+ */
517
+ regex(value: RegExp, options?: Partial<Omit<StringSchema['__regex'], 'value'>>): this;
518
+ /**
519
+ * Validates if the string has a maximum length. Use { inclusive: true } to allow the value to have the same length as the maximum length.
520
+ *
521
+ * @example
522
+ * ```typescript
523
+ * import * as p from '@palmares/schema';
524
+ *
525
+ * const schema = p.string().maxLength(5);
526
+ *
527
+ * schema.parse('12345'); // { errors: [], parsed: '12345' }
528
+ * schema.parse('123456'); // { errors: [{ code: 'maxLength', message: 'The value should have a maximum length of 5', path: [] }], parsed: '123
529
+ * ```
530
+ *
531
+ * @param value - The maximum length that the string should have.
532
+ * @param options - The options for the maxLength function.
533
+ * @param options.message - The message to be shown when the value has a length greater than the maximum length.
534
+ * @param options.inclusive - Whether the value can have the same length as the maximum length. Defaults to false.
535
+ *
536
+ * @returns - The schema instance.
537
+ */
538
+ maxLength(value: number, options?: Partial<Omit<StringSchema['__maxLength'], 'value'>>): this;
539
+ /**
540
+ * Validates if the string has a minimum length. Use { inclusive: true } to allow the value to have the same length as the minimum length.
541
+ *
542
+ * @example
543
+ * ```typescript
544
+ * import * as p from '@palmares/schema';
545
+ *
546
+ * const schema = p.string().minLength(5);
547
+ *
548
+ * schema.parse('12345'); // { errors: [], parsed: '12345' }
549
+ * schema.parse('1234'); // { errors: [{ code: 'minLength', message: 'The value should have a minimum length of 5', path: [] }], parsed: '1234' }
550
+ * ```
551
+ *
552
+ * @param value - The minimum length that the string should have.
553
+ * @param options - The options for the minLength function.
554
+ * @param options.message - The message to be shown when the value has a length less than the minimum length.
555
+ * @param options.inclusive - Whether the value can have the same length as the minimum length. Defaults to false.
556
+ *
557
+ * @returns - The schema instance.
558
+ */
559
+ minLength(value: number, options?: Partial<Omit<StringSchema['__minLength'], 'value'>>): this;
560
+ /**
561
+ * Validates if the string is a valid UUID.
562
+ *
563
+ * @example
564
+ * ```typescript
565
+ * import * as p from '@palmares/schema';
566
+ *
567
+ * const schema = p.string().uuid();
568
+ *
569
+ * schema.parse('550e8400-e29b-41d4-a716-446655440000'); // { errors: [], parsed: '550e8400-e29b-41d4-a716-446655440000' }
570
+ * ```
571
+ *
572
+ * @param options - The options for the uuid function.
573
+ * @param options.message - The message to be shown when the value is not a valid UUID. Defaults to 'The value should be a valid UUID'.
574
+ *
575
+ * @returns - The schema instance.
576
+ */
577
+ uuid(options?: StringSchema['__uuid']): this;
578
+ /**
579
+ * Validates if the string is a valid email or not
580
+ *
581
+ * @example
582
+ * ```typescript
583
+ *
584
+ * import * as p from '@palmares/schema';
585
+ *
586
+ * const schema = p.string().email();
587
+ *
588
+ * schema.parse('john.doe@example.com'); // { errors: [], parsed: 'john.doe@example.com' }
589
+ * ```
590
+ *
591
+ * @param options - The options for the email function.
592
+ * @param options.message - The message to be shown when the value is not a valid email. Defaults to 'The value should be a valid email'.
593
+ *
594
+ * @returns - The schema instance.
595
+ */
596
+ email(options?: StringSchema['__email']): this;
597
+ static new<TDefinitions extends DefinitionsOfSchemaType>(): StringSchema<{
598
+ input: string;
599
+ output: string;
600
+ internal: string;
601
+ representation: string;
602
+ validate: string;
603
+ }, TDefinitions>;
604
+ }
605
+ export declare const string: typeof StringSchema.new;
606
+ //# sourceMappingURL=string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../../src/schema/string.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,UAAU,CAAC;AAK9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,YAAY,CAC/B,KAAK,SAAS;IACZ,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,cAAc,EAAE,GAAG,CAAC;CACrB,GAAG;IACF,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,EACD,YAAY,SAAS,uBAAuB,GAAG,uBAAuB,CACtE,SAAQ,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC;IACnC,SAAS,CAAC,IAAI,EAAG;QACf,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACjD,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,SAAS,CAAC,OAAO,EAAG;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAGF,SAAS,CAAC,MAAM,EAAG;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,SAAS,CAAC,WAAW,EAAG;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,SAAS,CAAC,WAAW,EAAG;QACtB,KAAK,EAAE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