@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,450 @@
1
+ import Schema from './schema';
2
+ import type { DefinitionsOfSchemaType, ExtractTypeFromObjectOfSchemas } from './types';
3
+ import type FieldAdapter from '../adapter/fields';
4
+ export default class ObjectSchema<TType extends {
5
+ input: any;
6
+ validate: any;
7
+ internal: any;
8
+ representation: any;
9
+ output: any;
10
+ } = {
11
+ input: Record<any, any>;
12
+ output: Record<any, any>;
13
+ validate: Record<any, any>;
14
+ internal: Record<any, any>;
15
+ representation: Record<any, any>;
16
+ }, TDefinitions extends DefinitionsOfSchemaType = DefinitionsOfSchemaType, TData extends Record<any, any> = Record<any, any>> extends Schema<TType, TDefinitions> {
17
+ protected __data: Record<any, Schema>;
18
+ protected __cachedDataAsEntries: [string, Schema][];
19
+ constructor(data: TData);
20
+ protected __retrieveDataAsEntriesAndCache(): [string, Schema][];
21
+ protected __transformToAdapter(options: Parameters<Schema['__transformToAdapter']>[0]): Promise<ReturnType<FieldAdapter['translate']>>;
22
+ /**
23
+ * Transform the data to the representation without validating it. This is useful when you want to return a data from a query directly to the user. The core idea of this is that you can join the data
24
+ * from the database "by hand". In other words, you can do the joins by yourself directly on code. For more complex cases, this can be really helpful.
25
+ *
26
+ * @param value - The value to be transformed.
27
+ *
28
+ * @returns The transformed value.
29
+ */
30
+ data(value: TType['output']): Promise<TType['representation']>;
31
+ /**
32
+ * 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.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * import * as p from '@palmares/schemas';
37
+ *
38
+ * const numberSchema = p.number().refine((value) => {
39
+ * if (value < 0) return { code: 'invalid_number', message: 'The number should be greater than 0' };
40
+ * });
41
+ *
42
+ * const { errors, parsed } = await numberSchema.parse(-1);
43
+ *
44
+ * console.log(errors); // [{ isValid: false, code: 'invalid_number', message: 'The number should be greater than 0', path: [] }]
45
+ * ```
46
+ *
47
+ * @param refinementCallback - The callback that will be called to validate the value.
48
+ * @param options - Options for the refinement.
49
+ * @param options.isAsync - Whether the callback is async or not. Defaults to true.
50
+ */
51
+ refine(refinementCallback: (value: TType['input']) => Promise<void | undefined | {
52
+ code: string;
53
+ message: string;
54
+ }> | void | undefined | {
55
+ code: string;
56
+ message: string;
57
+ }): ObjectSchema<{
58
+ input: TType["input"];
59
+ validate: TType["validate"];
60
+ internal: TType["internal"];
61
+ output: TType["output"];
62
+ representation: TType["representation"];
63
+ }, TDefinitions, TData>;
64
+ /**
65
+ * Allows the value to be either undefined or null. Different from the `optional` method on other schemas, You can pass `outputOnly` as `true` to this method.
66
+ * This will allow you to pass `null` or `undefined` as a value on the {@link Schema.data} method, but it will not allow the value to be `null` or `undefined`.
67
+ * This is useful for typing purposes
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * import * as p from '@palmares/schemas';
72
+ *
73
+ * const numberSchema = p.number().optional();
74
+ *
75
+ * const { errors, parsed } = await numberSchema.parse(undefined);
76
+ *
77
+ * console.log(parsed); // undefined
78
+ *
79
+ * const { errors, parsed } = await numberSchema.parse(null);
80
+ *
81
+ * console.log(parsed); // null
82
+ *
83
+ * const { errors, parsed } = await numberSchema.parse(1);
84
+ *
85
+ * console.log(parsed); // 1
86
+ *
87
+ *
88
+ * const companySchema = p.object({ id: p.number(), name: p.string() });
89
+ * const userSchema = p.object({
90
+ * id: p.number(),
91
+ * name: p.string(),
92
+ * company: companySchema.optional({ outputOnly: true })
93
+ * });
94
+ *
95
+ * const { errors, parsed } = await userSchema.data({ id: 1, name: 'John Doe' }); // Will not allow the company to be null or undefined on a typing level.
96
+ * const value = await userSchema.data({ id: 1, name: 'John Doe' }); // Will allow the company to be null or undefined on a typing level
97
+ * ```
98
+ *
99
+ * @returns - The schema we are working with.
100
+ */
101
+ optional<TOutputOnly extends boolean = false>(options?: {
102
+ message?: string;
103
+ allow?: false;
104
+ outputOnly?: TOutputOnly;
105
+ }): ObjectSchema<TOutputOnly extends true ? {
106
+ input: TType["input"];
107
+ validate: TType["validate"];
108
+ internal: TType["internal"];
109
+ output: TType["output"] | undefined | null;
110
+ representation: TType["representation"];
111
+ } : {
112
+ input: TType["input"] | undefined | null;
113
+ validate: TType["validate"] | undefined | null;
114
+ internal: TType["internal"] | undefined | null;
115
+ output: TType["output"] | undefined | null;
116
+ representation: TType["representation"] | undefined | null;
117
+ }, TDefinitions, TData>;
118
+ /**
119
+ * 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
120
+ * the { message: 'Your custom message', allow: false } on the options.
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * import * as p from '@palmares/schemas';
125
+ *
126
+ * const numberSchema = p.number().nullable();
127
+ *
128
+ * const { errors, parsed } = await numberSchema.parse(null);
129
+ *
130
+ * console.log(parsed); // null
131
+ *
132
+ * const { errors, parsed } = await numberSchema.parse(undefined);
133
+ *
134
+ * console.log(errors); // [{ isValid: false, code: 'invalid_type', message: 'Invalid type', path: [] }]
135
+ * ```
136
+ *
137
+ * @param options - The options for the nullable function.
138
+ * @param options.message - The message to be shown when the value is not null. Defaults to 'Cannot be null'.
139
+ * @param options.allow - Whether the value can be null or not. Defaults to true.
140
+ *
141
+ * @returns The schema.
142
+ */
143
+ nullable(options?: {
144
+ message: string;
145
+ allow: false;
146
+ }): ObjectSchema<{
147
+ input: TType["input"] | null;
148
+ validate: TType["validate"] | null;
149
+ internal: TType["internal"] | null;
150
+ output: TType["output"] | null;
151
+ representation: TType["representation"] | null;
152
+ }, TDefinitions, TData>;
153
+ /**
154
+ * This method will remove the value from the representation of the schema. If the value is undefined it will keep that way
155
+ * otherwise it will set the value to undefined after it's validated.
156
+ * This is used in conjunction with the {@link data} function, the {@link parse} function or {@link validate}
157
+ * function. This will remove the value from the representation of the schema.
158
+ *
159
+ * By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
160
+ * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
161
+ * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * import * as p from '@palmares/schemas';
166
+ *
167
+ * const userSchema = p.object({
168
+ * id: p.number().optional(),
169
+ * name: p.string(),
170
+ * password: p.string().omit()
171
+ * });
172
+ *
173
+ * const user = await userSchema.data({
174
+ * id: 1,
175
+ * name: 'John Doe',
176
+ * password: '123456'
177
+ * });
178
+ *
179
+ * console.log(user); // { id: 1, name: 'John Doe' }
180
+ * ```
181
+ *
182
+ *
183
+ * @param args - By default, the value will be removed just from the representation, in other words, when you call the {@link data} function.
184
+ * But if you want to remove the value from the internal representation, you can pass the argument `toInternal` as true.
185
+ * Then if you still want to remove the value from the representation, you will need to pass the argument `toRepresentation` as true as well.
186
+ *
187
+ * @returns The schema.
188
+ */
189
+ omit<TToInternal extends boolean, TToRepresentation extends boolean = boolean extends TToInternal ? true : false>(args?: {
190
+ toInternal?: TToInternal;
191
+ toRepresentation?: TToRepresentation;
192
+ }): ObjectSchema<{
193
+ input: TToInternal extends true ? TType["input"] | undefined : TType["input"];
194
+ validate: TToInternal extends true ? TType["validate"] | undefined : TType["validate"];
195
+ internal: TToInternal extends true ? undefined : TType["internal"];
196
+ output: TToRepresentation extends true ? TType["output"] | undefined : TType["output"];
197
+ representation: TToRepresentation extends true ? undefined : TType["representation"];
198
+ }, TDefinitions, TData>;
199
+ /**
200
+ * This function is used in conjunction with the {@link validate} function. It's used to save a value to an external source
201
+ * like a database. You should always return the schema after you save the value, that way we will always have the correct type
202
+ * of the schema after the save operation.
203
+ *
204
+ * You can use the {@link toRepresentation} function to transform and clean the value it returns after the save.
205
+ *
206
+ * @example
207
+ * ```typescript
208
+ * import * as p from '@palmares/schemas';
209
+ *
210
+ * import { User } from './models';
211
+ *
212
+ * const userSchema = p.object({
213
+ * id: p.number().optional(),
214
+ * name: p.string(),
215
+ * email: p.string().email(),
216
+ * }).onSave(async (value) => {
217
+ * // Create or update the user on the database using palmares models or any other library of your choice.
218
+ * if (value.id)
219
+ * await User.default.set(value, { search: { id: value.id } });
220
+ * else
221
+ * await User.default.set(value);
222
+ *
223
+ * return value;
224
+ * });
225
+ *
226
+ *
227
+ * // Then, on your controller, do something like this:
228
+ * const { isValid, save, errors } = await userSchema.validate(req.body);
229
+ * if (isValid) {
230
+ * const savedValue = await save();
231
+ * return Response.json(savedValue, { status: 201 });
232
+ * }
233
+ *
234
+ * return Response.json({ errors }, { status: 400 });
235
+ * ```
236
+ *
237
+ * @param callback - The callback that will be called to save the value on an external source.
238
+ *
239
+ * @returns The schema.
240
+ */
241
+ onSave(callback: (value: TType['internal']) => Promise<TType['output']> | TType['output']): ObjectSchema<{
242
+ input: TType["input"];
243
+ validate: TType["validate"];
244
+ internal: TType["internal"];
245
+ output: TType["output"];
246
+ representation: TType["representation"];
247
+ }, TDefinitions & {
248
+ hasSave: true;
249
+ }, TData>;
250
+ /**
251
+ * 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.
252
+ *
253
+ * @example
254
+ * ```typescript
255
+ * import * as p from '@palmares/schemas';
256
+ *
257
+ * const numberSchema = p.number().default(0);
258
+ *
259
+ * const { errors, parsed } = await numberSchema.parse(undefined);
260
+ *
261
+ * console.log(parsed); // 0
262
+ * ```
263
+ */
264
+ default<TDefaultValue extends TType['input'] | (() => Promise<TType['input']>)>(defaultValueOrFunction: TDefaultValue): ObjectSchema<{
265
+ input: TType["input"] | undefined | null;
266
+ validate: TType["validate"];
267
+ internal: TType["internal"];
268
+ output: TType["output"] | undefined | null;
269
+ representation: TType["representation"];
270
+ }, TDefinitions, TData>;
271
+ /**
272
+ * 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
273
+ * the custom schema your own way. Our API does not support passthrough? No problem, you can use this function to customize the zod schema.
274
+ *
275
+ * @example
276
+ * ```typescript
277
+ * import * as p from '@palmares/schemas';
278
+ *
279
+ * const numberSchema = p.number().extends((schema) => {
280
+ * return schema.nonnegative();
281
+ * });
282
+ *
283
+ * const { errors, parsed } = await numberSchema.parse(-1);
284
+ *
285
+ * console.log(errors); // [{ isValid: false, code: 'nonnegative', message: 'The number should be nonnegative', path: [] }]
286
+ * ```
287
+ *
288
+ * @param callback - The callback that will be called to customize the schema.
289
+ * @param toStringCallback - The callback that will be called to transform the schema to a string when you want to compile the underlying schema
290
+ * to a string so you can save it for future runs.
291
+ *
292
+ * @returns The schema.
293
+ */
294
+ extends(callback: (schema: Awaited<ReturnType<NonNullable<TDefinitions['schemaAdapter']['object']>['translate']>>) => Awaited<ReturnType<NonNullable<TDefinitions['schemaAdapter']['field']>['translate']>> | any, toStringCallback?: (schemaAsString: string) => string): this;
295
+ /**
296
+ * 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
297
+ * 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.
298
+ * The schema maps to itself.
299
+ *
300
+ * @example
301
+ * ```typescript
302
+ * import * as p from '@palmares/schemas';
303
+ *
304
+ * const recursiveSchema = p.object({
305
+ * id: p.number().optional(),
306
+ * name: p.string(),
307
+ * }).toRepresentation(async (value) => {
308
+ * return {
309
+ * id: value.id,
310
+ * name: value.name,
311
+ * children: await Promise.all(value.children.map(async (child) => await recursiveSchema.data(child)))
312
+ * }
313
+ * });
314
+ *
315
+ * const data = await recursiveSchema.data({
316
+ * id: 1,
317
+ * name: 'John Doe',
318
+ * });
319
+ * ```
320
+ *
321
+ * @example
322
+ * ```
323
+ * import * as p from '@palmares/schemas';
324
+ *
325
+ * const colorToRGBSchema = p.string().toRepresentation(async (value) => {
326
+ * switch (value) {
327
+ * case 'red': return { r: 255, g: 0, b: 0 };
328
+ * case 'green': return { r: 0, g: 255, b: 0 };
329
+ * case 'blue': return { r: 0, g: 0, b: 255 };
330
+ * default: return { r: 0, g: 0, b: 0 };
331
+ * }
332
+ * });
333
+ * ```
334
+ * @param toRepresentationCallback - The callback that will be called to transform the value to the representation.
335
+ * @param options - Options for the toRepresentation function.
336
+ * @param options.after - Whether the toRepresentationCallback should be called after the existing toRepresentationCallback. Defaults to true.
337
+ * @param options.before - Whether the toRepresentationCallback should be called before the existing toRepresentationCallback. Defaults to true.
338
+ *
339
+ * @returns The schema with a new return type
340
+ */
341
+ toRepresentation<TRepresentation>(toRepresentationCallback: (value: TType['representation']) => Promise<TRepresentation>, options?: {
342
+ after?: boolean;
343
+ before?: boolean;
344
+ }): ObjectSchema<{
345
+ input: TType["input"];
346
+ validate: TType["validate"];
347
+ internal: TType["internal"];
348
+ output: TType["output"];
349
+ representation: TRepresentation;
350
+ }, TDefinitions, TData>;
351
+ /**
352
+ * 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
353
+ * 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.
354
+ *
355
+ * @example
356
+ * ```typescript
357
+ * import * as p from '@palmares/schemas';
358
+ *
359
+ * const dateSchema = p.string().toInternal((value) => {
360
+ * return new Date(value);
361
+ * });
362
+ *
363
+ * const date = await dateSchema.parse('2021-01-01');
364
+ *
365
+ * console.log(date); // Date object
366
+ *
367
+ * const rgbToColorSchema = p.object({
368
+ * r: p.number().min(0).max(255),
369
+ * g: p.number().min(0).max(255),
370
+ * b: p.number().min(0).max(255),
371
+ * }).toInternal(async (value) => {
372
+ * if (value.r === 255 && value.g === 0 && value.b === 0) return 'red';
373
+ * if (value.r === 0 && value.g === 255 && value.b === 0) return 'green';
374
+ * if (value.r === 0 && value.g === 0 && value.b === 255) return 'blue';
375
+ * return `rgb(${value.r}, ${value.g}, ${value.b})`;
376
+ * });
377
+ * ```
378
+ *
379
+ * @param toInternalCallback - The callback that will be called to transform the value to the internal representation.
380
+ *
381
+ * @returns The schema with a new return type.
382
+ */
383
+ toInternal<TInternal>(toInternalCallback: (value: TType['validate']) => Promise<TInternal>): ObjectSchema<{
384
+ input: TType["input"];
385
+ validate: TType["validate"];
386
+ internal: TInternal;
387
+ output: TType["output"];
388
+ representation: TType["representation"];
389
+ }, TDefinitions, TData>;
390
+ /**
391
+ * 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
392
+ * here BEFORE the validation. This pretty much transforms the value to a type that the schema adapter can understand.
393
+ *
394
+ * @example
395
+ * ```
396
+ * import * as p from '@palmares/schemas';
397
+ * import * as z from 'zod';
398
+ *
399
+ * const customRecordToMapSchema = p.schema().appendSchema(z.map()).toValidate(async (value) => {
400
+ * return new Map(value); // Before validating we transform the value to a map.
401
+ * });
402
+ *
403
+ * const { errors, parsed } = await customRecordToMapSchema.parse({ key: 'value' });
404
+ * ```
405
+ *
406
+ * @param toValidateCallback - The callback that will be called to validate the value.
407
+ *
408
+ * @returns The schema with a new return type.
409
+ */
410
+ toValidate<TValidate>(toValidateCallback: (value: TType['input']) => Promise<TValidate> | TValidate): ObjectSchema<{
411
+ input: TType["input"];
412
+ validate: TValidate;
413
+ internal: TType["internal"];
414
+ output: TType["output"];
415
+ representation: TType["representation"];
416
+ }, TDefinitions, TData>;
417
+ /**
418
+ * Remove extraneous keys from the object, in other words, remove keys that are not in the schema.
419
+ *
420
+ * @example
421
+ * ```typescript
422
+ * import * as p from '@palmares/schemas';
423
+ *
424
+ * const userSchema = p.object({
425
+ * id: p.number().optional(),
426
+ * name: p.string(),
427
+ * }).removeExtraneous();
428
+ *
429
+ * const { errors, parsed } = await userSchema.parse({
430
+ * id: 1,
431
+ * name: 'John Doe',
432
+ * password: '123456'
433
+ * });
434
+ *
435
+ * console.log(parsed); // { id: 1, name: 'John Doe' }
436
+ * ```
437
+ *
438
+ * @returns The schema.
439
+ */
440
+ removeExtraneous(): this;
441
+ static new<TData extends Record<any, Schema<any, TDefinitions>>, TDefinitions extends DefinitionsOfSchemaType = DefinitionsOfSchemaType>(data: TData): ObjectSchema<{
442
+ input: ExtractTypeFromObjectOfSchemas<TData, "input">;
443
+ validate: ExtractTypeFromObjectOfSchemas<TData, "validate">;
444
+ internal: ExtractTypeFromObjectOfSchemas<TData, "internal">;
445
+ representation: ExtractTypeFromObjectOfSchemas<TData, "representation">;
446
+ output: ExtractTypeFromObjectOfSchemas<TData, "output">;
447
+ }, TDefinitions, TData>;
448
+ }
449
+ export declare const object: typeof ObjectSchema.new;
450
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../../src/schema/object.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM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