@warlock.js/core 1.0.38 → 2.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 (161) hide show
  1. package/cjs/application.js +1 -1
  2. package/cjs/application.js.map +1 -1
  3. package/cjs/builder/config-loader-builder.js +17 -17
  4. package/cjs/console/commander.js +1 -1
  5. package/cjs/console/commander.js.map +1 -1
  6. package/cjs/http/UploadedFile.d.ts +15 -0
  7. package/cjs/http/UploadedFile.d.ts.map +1 -1
  8. package/cjs/http/UploadedFile.js +15 -0
  9. package/cjs/http/UploadedFile.js.map +1 -1
  10. package/cjs/http/request.d.ts +14 -1
  11. package/cjs/http/request.d.ts.map +1 -1
  12. package/cjs/http/request.js +37 -23
  13. package/cjs/http/request.js.map +1 -1
  14. package/cjs/http/response.d.ts +6 -2
  15. package/cjs/http/response.d.ts.map +1 -1
  16. package/cjs/http/response.js +16 -0
  17. package/cjs/http/response.js.map +1 -1
  18. package/cjs/index.js +1 -1
  19. package/cjs/modules/uploads/controllers/upload-files.d.ts +1 -0
  20. package/cjs/modules/uploads/controllers/upload-files.d.ts.map +1 -1
  21. package/cjs/modules/uploads/controllers/upload-files.js +28 -7
  22. package/cjs/modules/uploads/controllers/upload-files.js.map +1 -1
  23. package/cjs/modules/uploads/utils/get-watermark-options.js +1 -1
  24. package/cjs/modules/uploads/utils/get-watermark-options.js.map +1 -1
  25. package/cjs/modules/uploads/utils/uploadable.d.ts +1 -1
  26. package/cjs/modules/uploads/utils/uploadable.d.ts.map +1 -1
  27. package/cjs/modules/uploads/utils/uploadable.js +3 -15
  28. package/cjs/modules/uploads/utils/uploadable.js.map +1 -1
  29. package/cjs/repositories/repository-listing.d.ts.map +1 -1
  30. package/cjs/repositories/repository-listing.js +3 -0
  31. package/cjs/repositories/repository-listing.js.map +1 -1
  32. package/cjs/router/route.d.ts +26 -0
  33. package/cjs/router/route.d.ts.map +1 -0
  34. package/cjs/router/router.d.ts.map +1 -1
  35. package/cjs/router/router.js +3 -0
  36. package/cjs/router/router.js.map +1 -1
  37. package/cjs/router/types.d.ts +44 -0
  38. package/cjs/router/types.d.ts.map +1 -1
  39. package/cjs/validator/index.d.ts +1 -0
  40. package/cjs/validator/index.d.ts.map +1 -1
  41. package/cjs/validator/locales.js +6 -2
  42. package/cjs/validator/locales.js.map +1 -1
  43. package/cjs/validator/rules/file.d.ts.map +1 -1
  44. package/cjs/validator/rules/file.js +1 -0
  45. package/cjs/validator/rules/file.js.map +1 -1
  46. package/cjs/validator/rules/in.js +1 -1
  47. package/cjs/validator/rules/in.js.map +1 -1
  48. package/cjs/validator/v/array-validator.d.ts +21 -0
  49. package/cjs/validator/v/array-validator.d.ts.map +1 -0
  50. package/cjs/validator/v/base-validator.d.ts +117 -0
  51. package/cjs/validator/v/base-validator.d.ts.map +1 -0
  52. package/cjs/validator/v/index.d.ts +3 -0
  53. package/cjs/validator/v/index.d.ts.map +1 -0
  54. package/cjs/validator/v/mutators.d.ts +23 -0
  55. package/cjs/validator/v/mutators.d.ts.map +1 -0
  56. package/cjs/validator/v/mutators.js +83 -0
  57. package/cjs/validator/v/mutators.js.map +1 -0
  58. package/cjs/validator/v/number-validator.d.ts +21 -0
  59. package/cjs/validator/v/number-validator.d.ts.map +1 -0
  60. package/cjs/validator/v/object-validator.d.ts +37 -0
  61. package/cjs/validator/v/object-validator.d.ts.map +1 -0
  62. package/cjs/validator/v/rules.d.ts +83 -0
  63. package/cjs/validator/v/rules.d.ts.map +1 -0
  64. package/cjs/validator/v/rules.js +457 -0
  65. package/cjs/validator/v/rules.js.map +1 -0
  66. package/cjs/validator/v/schema.d.ts +159 -0
  67. package/cjs/validator/v/schema.d.ts.map +1 -0
  68. package/cjs/validator/v/schema.js +516 -0
  69. package/cjs/validator/v/schema.js.map +1 -0
  70. package/cjs/validator/v/string-validator.d.ts +41 -0
  71. package/cjs/validator/v/string-validator.d.ts.map +1 -0
  72. package/cjs/validator/v/types.d.ts +63 -0
  73. package/cjs/validator/v/types.d.ts.map +1 -0
  74. package/cjs/validator/v/utils.d.ts +5 -0
  75. package/cjs/validator/v/utils.d.ts.map +1 -0
  76. package/cjs/validator/v/utils.js +22 -0
  77. package/cjs/validator/v/utils.js.map +1 -0
  78. package/cjs/validator/validateAll.d.ts.map +1 -1
  79. package/cjs/validator/validateAll.js +17 -1
  80. package/cjs/validator/validateAll.js.map +1 -1
  81. package/esm/application.js +1 -1
  82. package/esm/application.js.map +1 -1
  83. package/esm/builder/config-loader-builder.js +17 -17
  84. package/esm/console/commander.js +1 -1
  85. package/esm/console/commander.js.map +1 -1
  86. package/esm/http/UploadedFile.d.ts +15 -0
  87. package/esm/http/UploadedFile.d.ts.map +1 -1
  88. package/esm/http/UploadedFile.js +15 -0
  89. package/esm/http/UploadedFile.js.map +1 -1
  90. package/esm/http/request.d.ts +14 -1
  91. package/esm/http/request.d.ts.map +1 -1
  92. package/esm/http/request.js +37 -23
  93. package/esm/http/request.js.map +1 -1
  94. package/esm/http/response.d.ts +6 -2
  95. package/esm/http/response.d.ts.map +1 -1
  96. package/esm/http/response.js +16 -0
  97. package/esm/http/response.js.map +1 -1
  98. package/esm/index.js +1 -1
  99. package/esm/modules/uploads/controllers/upload-files.d.ts +1 -0
  100. package/esm/modules/uploads/controllers/upload-files.d.ts.map +1 -1
  101. package/esm/modules/uploads/controllers/upload-files.js +28 -7
  102. package/esm/modules/uploads/controllers/upload-files.js.map +1 -1
  103. package/esm/modules/uploads/utils/get-watermark-options.js +1 -1
  104. package/esm/modules/uploads/utils/get-watermark-options.js.map +1 -1
  105. package/esm/modules/uploads/utils/uploadable.d.ts +1 -1
  106. package/esm/modules/uploads/utils/uploadable.d.ts.map +1 -1
  107. package/esm/modules/uploads/utils/uploadable.js +3 -15
  108. package/esm/modules/uploads/utils/uploadable.js.map +1 -1
  109. package/esm/repositories/repository-listing.d.ts.map +1 -1
  110. package/esm/repositories/repository-listing.js +4 -1
  111. package/esm/repositories/repository-listing.js.map +1 -1
  112. package/esm/router/route.d.ts +26 -0
  113. package/esm/router/route.d.ts.map +1 -0
  114. package/esm/router/router.d.ts.map +1 -1
  115. package/esm/router/router.js +3 -0
  116. package/esm/router/router.js.map +1 -1
  117. package/esm/router/types.d.ts +44 -0
  118. package/esm/router/types.d.ts.map +1 -1
  119. package/esm/validator/index.d.ts +1 -0
  120. package/esm/validator/index.d.ts.map +1 -1
  121. package/esm/validator/locales.js +6 -2
  122. package/esm/validator/locales.js.map +1 -1
  123. package/esm/validator/rules/file.d.ts.map +1 -1
  124. package/esm/validator/rules/file.js +1 -0
  125. package/esm/validator/rules/file.js.map +1 -1
  126. package/esm/validator/rules/in.js +1 -1
  127. package/esm/validator/rules/in.js.map +1 -1
  128. package/esm/validator/v/array-validator.d.ts +21 -0
  129. package/esm/validator/v/array-validator.d.ts.map +1 -0
  130. package/esm/validator/v/base-validator.d.ts +117 -0
  131. package/esm/validator/v/base-validator.d.ts.map +1 -0
  132. package/esm/validator/v/index.d.ts +3 -0
  133. package/esm/validator/v/index.d.ts.map +1 -0
  134. package/esm/validator/v/mutators.d.ts +23 -0
  135. package/esm/validator/v/mutators.d.ts.map +1 -0
  136. package/esm/validator/v/mutators.js +83 -0
  137. package/esm/validator/v/mutators.js.map +1 -0
  138. package/esm/validator/v/number-validator.d.ts +21 -0
  139. package/esm/validator/v/number-validator.d.ts.map +1 -0
  140. package/esm/validator/v/object-validator.d.ts +37 -0
  141. package/esm/validator/v/object-validator.d.ts.map +1 -0
  142. package/esm/validator/v/rules.d.ts +83 -0
  143. package/esm/validator/v/rules.d.ts.map +1 -0
  144. package/esm/validator/v/rules.js +457 -0
  145. package/esm/validator/v/rules.js.map +1 -0
  146. package/esm/validator/v/schema.d.ts +159 -0
  147. package/esm/validator/v/schema.d.ts.map +1 -0
  148. package/esm/validator/v/schema.js +516 -0
  149. package/esm/validator/v/schema.js.map +1 -0
  150. package/esm/validator/v/string-validator.d.ts +41 -0
  151. package/esm/validator/v/string-validator.d.ts.map +1 -0
  152. package/esm/validator/v/types.d.ts +63 -0
  153. package/esm/validator/v/types.d.ts.map +1 -0
  154. package/esm/validator/v/utils.d.ts +5 -0
  155. package/esm/validator/v/utils.d.ts.map +1 -0
  156. package/esm/validator/v/utils.js +22 -0
  157. package/esm/validator/v/utils.js.map +1 -0
  158. package/esm/validator/validateAll.d.ts.map +1 -1
  159. package/esm/validator/validateAll.js +17 -1
  160. package/esm/validator/validateAll.js.map +1 -1
  161. package/package.json +5 -5
@@ -0,0 +1,457 @@
1
+ 'use strict';var reinforcements=require('@mongez/reinforcements'),supportiveIs=require('@mongez/supportive-is'),cascade=require('src/cascade'),http=require('src/warlock/http'),utils=require('./utils.js');const requiredRule = {
2
+ name: "required",
3
+ defaultErrorMessage: "The :input is required",
4
+ requiresValue: false,
5
+ sortOrder: -2,
6
+ async validate(value, context) {
7
+ if (supportiveIs.isEmpty(value)) {
8
+ return utils.invalidRule(this, context);
9
+ }
10
+ return utils.VALID_RULE;
11
+ },
12
+ };
13
+ const requiredWithRule = {
14
+ name: "requiredWith",
15
+ description: "The field is required if another field is present",
16
+ sortOrder: -2,
17
+ requiresValue: false,
18
+ errorMessage: "The :input is required",
19
+ async validate(value, context) {
20
+ const otherField = this.context.options.field;
21
+ const fieldValue = reinforcements.get(context.allValues, otherField);
22
+ if ([undefined, null].includes(fieldValue)) {
23
+ return utils.VALID_RULE;
24
+ }
25
+ if (supportiveIs.isEmpty(value)) {
26
+ return utils.invalidRule(this, context);
27
+ }
28
+ return utils.VALID_RULE;
29
+ },
30
+ };
31
+ const requiredIfAbsentRule = {
32
+ name: "requiredIfAbsent",
33
+ description: "The field is required if another field is absent",
34
+ sortOrder: -2,
35
+ requiresValue: false,
36
+ errorMessage: "The :input is required",
37
+ async validate(value, context) {
38
+ const otherField = this.context.options.field;
39
+ const fieldValue = reinforcements.get(context.allValues, otherField);
40
+ const isPresent = ![undefined, null].includes(fieldValue);
41
+ if (!isPresent && supportiveIs.isEmpty(value)) {
42
+ return utils.invalidRule(this, context);
43
+ }
44
+ return utils.VALID_RULE;
45
+ },
46
+ };
47
+ const requiredIfEmptyRule = {
48
+ name: "requiredIfEmpty",
49
+ description: "The field is required if another field is empty",
50
+ sortOrder: -2,
51
+ requiresValue: false,
52
+ errorMessage: "The :input is required",
53
+ async validate(value, context) {
54
+ const otherField = this.context.options.field;
55
+ const fieldValue = reinforcements.get(context.allValues, otherField);
56
+ if (supportiveIs.isEmpty(fieldValue) && supportiveIs.isEmpty(value)) {
57
+ return utils.invalidRule(this, context);
58
+ }
59
+ return utils.VALID_RULE;
60
+ },
61
+ };
62
+ const requiredIfFieldRule = {
63
+ name: "requiredIfField",
64
+ description: "The field is required if another field has a specific value",
65
+ sortOrder: -2,
66
+ requiresValue: false,
67
+ errorMessage: "The :input is required",
68
+ async validate(value, context) {
69
+ const otherField = this.context.options.field;
70
+ const otherFieldValue = this.context.options.value;
71
+ if (otherField === undefined) {
72
+ throw new Error("The field option is required for requiredIfField rule");
73
+ }
74
+ const fieldValue = reinforcements.get(context.allValues, otherField);
75
+ if (fieldValue === otherFieldValue && supportiveIs.isEmpty(value)) {
76
+ return utils.invalidRule(this, context);
77
+ }
78
+ return utils.VALID_RULE;
79
+ },
80
+ };
81
+ const objectRule = {
82
+ name: "object",
83
+ defaultErrorMessage: "The :input must be an object",
84
+ async validate(value, context) {
85
+ if (supportiveIs.isPlainObject(value)) {
86
+ return utils.VALID_RULE;
87
+ }
88
+ return utils.invalidRule(this, context);
89
+ },
90
+ };
91
+ const arrayRule = {
92
+ name: "array",
93
+ defaultErrorMessage: "The :input must be an array",
94
+ async validate(value, context) {
95
+ if (Array.isArray(value)) {
96
+ return utils.VALID_RULE;
97
+ }
98
+ return utils.invalidRule(this, context);
99
+ },
100
+ };
101
+ const stringRule = {
102
+ name: "string",
103
+ errorMessage: "The :input must be a string",
104
+ async validate(value, context) {
105
+ if (typeof value === "string") {
106
+ return utils.VALID_RULE;
107
+ }
108
+ return utils.invalidRule(this, context);
109
+ },
110
+ };
111
+ const numberRule = {
112
+ name: "number",
113
+ errorMessage: "The :input must be a number",
114
+ async validate(value, context) {
115
+ if (typeof value === "number") {
116
+ return utils.VALID_RULE;
117
+ }
118
+ return utils.invalidRule(this, context);
119
+ },
120
+ };
121
+ const booleanRule = {
122
+ name: "boolean",
123
+ errorMessage: "The :input must be a boolean",
124
+ async validate(value, context) {
125
+ if (typeof value === "boolean") {
126
+ return utils.VALID_RULE;
127
+ }
128
+ return utils.invalidRule(this, context);
129
+ },
130
+ };
131
+ const intRule = {
132
+ name: "int",
133
+ errorMessage: "The :input must be an integer",
134
+ async validate(value, context) {
135
+ if (Number.isInteger(value)) {
136
+ return utils.VALID_RULE;
137
+ }
138
+ return utils.invalidRule(this, context);
139
+ },
140
+ };
141
+ const floatRule = {
142
+ name: "float",
143
+ errorMessage: "The :input must be a float",
144
+ async validate(value, context) {
145
+ if (Number.isFinite(value) && !Number.isInteger(value)) {
146
+ return utils.VALID_RULE;
147
+ }
148
+ return utils.invalidRule(this, context);
149
+ },
150
+ };
151
+ const inRule = {
152
+ name: "in",
153
+ errorMessage: "The :input must be one of the following values: :options",
154
+ async validate(value, context) {
155
+ if (this.context.options.values.includes(value)) {
156
+ return utils.VALID_RULE;
157
+ }
158
+ return utils.invalidRule(this, context);
159
+ },
160
+ };
161
+ const enumRule = inRule;
162
+ const minLengthRule = {
163
+ name: "minLength",
164
+ errorMessage: `The :input must be at least :minLength characters long`,
165
+ async validate(value, context) {
166
+ if (value?.length >= this.context.options.minLength) {
167
+ return utils.VALID_RULE;
168
+ }
169
+ return utils.invalidRule(this, context);
170
+ },
171
+ };
172
+ const maxLengthRule = {
173
+ name: "maxLength",
174
+ errorMessage: `The :input must not exceed :maxLength characters`,
175
+ async validate(value, context) {
176
+ if (value?.length <= this.context.options.maxLength) {
177
+ return utils.VALID_RULE;
178
+ }
179
+ return utils.invalidRule(this, context);
180
+ },
181
+ };
182
+ const lengthRule = {
183
+ name: "length",
184
+ errorMessage: `The :input must be exactly :length characters long`,
185
+ async validate(value, context) {
186
+ if (value?.length === this.context.options.length) {
187
+ return utils.VALID_RULE;
188
+ }
189
+ return utils.invalidRule(this, context);
190
+ },
191
+ };
192
+ const minRule = {
193
+ name: "min",
194
+ errorMessage: `The :input must be at least :min`,
195
+ async validate(value, context) {
196
+ if (value >= this.context.options.min) {
197
+ return utils.VALID_RULE;
198
+ }
199
+ return utils.invalidRule(this, context);
200
+ },
201
+ };
202
+ const maxRule = {
203
+ name: "max",
204
+ errorMessage: `The :input must equal to or less than :max`,
205
+ async validate(value, context) {
206
+ if (value <= this.context.options.max) {
207
+ return utils.VALID_RULE;
208
+ }
209
+ return utils.invalidRule(this, context);
210
+ },
211
+ };
212
+ const equalRule = {
213
+ name: "equal",
214
+ errorMessage: `The :input must be equal to :value`,
215
+ async validate(input, context) {
216
+ if (input === this.context.options.value) {
217
+ return utils.VALID_RULE;
218
+ }
219
+ return utils.invalidRule(this, context);
220
+ },
221
+ };
222
+ const emailRule = {
223
+ name: "email",
224
+ errorMessage: "The :input must be a valid email address",
225
+ async validate(value, context) {
226
+ if (supportiveIs.isEmail(value)) {
227
+ return utils.VALID_RULE;
228
+ }
229
+ return utils.invalidRule(this, context);
230
+ },
231
+ };
232
+ const scalarRule = {
233
+ name: "scalar",
234
+ errorMessage: "The :input must be a scalar value",
235
+ async validate(value, context) {
236
+ // a valid value considered to beb either a string, number, or boolean
237
+ if (["string", "number", "boolean"].includes(typeof value)) {
238
+ return utils.VALID_RULE;
239
+ }
240
+ return utils.invalidRule(this, context);
241
+ },
242
+ };
243
+ const unknownKeyRule = {
244
+ name: "unknownKey",
245
+ sortOrder: -1,
246
+ errorMessage: "The :input contains unknown properties",
247
+ async validate(value, context) {
248
+ const schema = this.context.options.schema;
249
+ const allowedKeys = this.context.options.allowedKeys || [];
250
+ for (const key in value) {
251
+ if (!schema[key] && !allowedKeys.includes(key)) {
252
+ this.context.options.key = utils.setKeyPath(context.path, key);
253
+ const newContext = {
254
+ ...context,
255
+ key,
256
+ path: utils.setKeyPath(context.path, key),
257
+ };
258
+ return utils.invalidRule(this, newContext);
259
+ }
260
+ }
261
+ return utils.VALID_RULE;
262
+ },
263
+ };
264
+ const matchesRule = {
265
+ name: "matches",
266
+ errorMessage: "The :input must match the :field",
267
+ async validate(value, context) {
268
+ const otherField = this.context.options.field;
269
+ if (value === reinforcements.get(context.allValues, otherField)) {
270
+ return utils.VALID_RULE;
271
+ }
272
+ return utils.invalidRule(this, context);
273
+ },
274
+ };
275
+ const dateRule = {
276
+ name: "date",
277
+ errorMessage: "The :input must be a valid date",
278
+ async validate(value, context) {
279
+ if (new Date(value).toString() !== "Invalid Date") {
280
+ return utils.VALID_RULE;
281
+ }
282
+ return utils.invalidRule(this, context);
283
+ },
284
+ };
285
+ const urlRule = {
286
+ name: "url",
287
+ errorMessage: "The :input must be a valid URL",
288
+ async validate(value, context) {
289
+ try {
290
+ new URL(value);
291
+ return utils.VALID_RULE;
292
+ }
293
+ catch (error) {
294
+ return utils.invalidRule(this, context);
295
+ }
296
+ },
297
+ };
298
+ const patternRule = {
299
+ name: "pattern",
300
+ errorMessage: "The :input does not match the pattern",
301
+ async validate(value, context) {
302
+ if (this.context.options.pattern.test(value)) {
303
+ return utils.VALID_RULE;
304
+ }
305
+ return utils.invalidRule(this, context);
306
+ },
307
+ };
308
+ const positiveRule = {
309
+ name: "positive",
310
+ errorMessage: "The :input must be a positive number",
311
+ async validate(value, context) {
312
+ if (value > 0) {
313
+ return utils.VALID_RULE;
314
+ }
315
+ return utils.invalidRule(this, context);
316
+ },
317
+ };
318
+ // unique for array
319
+ const uniqueArrayRule = {
320
+ name: "uniqueArray",
321
+ description: "The array must contain unique values",
322
+ errorMessage: "The :input must contain unique values",
323
+ async validate(value, context) {
324
+ const uniqueValues = new Set(value);
325
+ if (uniqueValues.size === value.length) {
326
+ return utils.VALID_RULE;
327
+ }
328
+ return utils.invalidRule(this, context);
329
+ },
330
+ };
331
+ /**
332
+ * Unique rule works with database
333
+ */
334
+ const uniqueRule = {
335
+ name: "unique",
336
+ errorMessage: "The :input must be unique",
337
+ async validate(value, context) {
338
+ const { Model, except, column = context.key, exceptColumnName, exceptValue, query, } = this.context.options;
339
+ const dbQuery = typeof Model !== "string" ? Model.aggregate() : new cascade.Aggregate(Model);
340
+ dbQuery.where(column, value);
341
+ if (except) {
342
+ const exceptValue = reinforcements.get(context.allValues, except);
343
+ if (exceptValue !== undefined) {
344
+ dbQuery.where(except, "!=", exceptValue);
345
+ }
346
+ }
347
+ if (exceptValue !== undefined) {
348
+ dbQuery.where(exceptColumnName ?? context.key, "!=", exceptValue);
349
+ }
350
+ if (query) {
351
+ await query({
352
+ query: dbQuery,
353
+ value,
354
+ allValues: context.allValues,
355
+ });
356
+ }
357
+ const document = await dbQuery.first();
358
+ if (!document) {
359
+ return utils.VALID_RULE;
360
+ }
361
+ return utils.invalidRule(this, context);
362
+ },
363
+ };
364
+ const existsRule = {
365
+ name: "exists",
366
+ errorMessage: "The :input must exist",
367
+ async validate(value, context) {
368
+ const { Model, query, column = context.key } = this.context.options;
369
+ const dbQuery = typeof Model !== "string" ? Model.aggregate() : new cascade.Aggregate(Model);
370
+ dbQuery.where(column, value);
371
+ if (query) {
372
+ await query({
373
+ query: dbQuery,
374
+ value,
375
+ allValues: context.allValues,
376
+ });
377
+ }
378
+ const document = await dbQuery.first();
379
+ if (document) {
380
+ return utils.VALID_RULE;
381
+ }
382
+ return utils.invalidRule(this, context);
383
+ },
384
+ };
385
+ const fileRile = {
386
+ name: "file",
387
+ errorMessage: "The :input must be a file",
388
+ async validate(value, context) {
389
+ if (value instanceof http.UploadedFile) {
390
+ return utils.VALID_RULE;
391
+ }
392
+ return utils.invalidRule(this, context);
393
+ },
394
+ };
395
+ const maxFileSizeRule = {
396
+ name: "maxFileSize",
397
+ errorMessage: "The :input must not exceed :maxFileSize",
398
+ async validate(value, context) {
399
+ if (value.size <= this.context.options.maxFileSize) {
400
+ return utils.VALID_RULE;
401
+ }
402
+ return utils.invalidRule(this, context);
403
+ },
404
+ };
405
+ const minFileSizeRule = {
406
+ name: "minFileSize",
407
+ errorMessage: "The :input must be at least :minFileSize",
408
+ async validate(value, context) {
409
+ if (value.size >= this.context.options.minFileSize) {
410
+ return utils.VALID_RULE;
411
+ }
412
+ return utils.invalidRule(this, context);
413
+ },
414
+ };
415
+ const imageRule = {
416
+ name: "image",
417
+ errorMessage: "The :input must be an image",
418
+ async validate(value, context) {
419
+ if (value instanceof http.UploadedFile && value.isImage) {
420
+ return utils.VALID_RULE;
421
+ }
422
+ return utils.invalidRule(this, context);
423
+ },
424
+ };
425
+ const minWidthRule = {
426
+ name: "minWidth",
427
+ errorMessage: "The :input must be at least :minWidth pixels wide",
428
+ async validate(value, context) {
429
+ const dimensions = await value.dimensions();
430
+ if (dimensions.width >= this.context.options.minWidth) {
431
+ return utils.VALID_RULE;
432
+ }
433
+ return utils.invalidRule(this, context);
434
+ },
435
+ };
436
+ const maxWidthRule = {
437
+ name: "maxWidth",
438
+ errorMessage: "The :input must be at most :maxWidth pixels wide",
439
+ async validate(value, context) {
440
+ const dimensions = await value.dimensions();
441
+ if (dimensions.width <= this.context.options.maxWidth) {
442
+ return utils.VALID_RULE;
443
+ }
444
+ return utils.invalidRule(this, context);
445
+ },
446
+ };
447
+ const minHeightRule = {
448
+ name: "minHeight",
449
+ errorMessage: "The :input must be at least :minHeight pixels tall",
450
+ async validate(value, context) {
451
+ const dimensions = await value.dimensions();
452
+ if (dimensions.height >= this.context.options.minHeight) {
453
+ return utils.VALID_RULE;
454
+ }
455
+ return utils.invalidRule(this, context);
456
+ },
457
+ };exports.arrayRule=arrayRule;exports.booleanRule=booleanRule;exports.dateRule=dateRule;exports.emailRule=emailRule;exports.enumRule=enumRule;exports.equalRule=equalRule;exports.existsRule=existsRule;exports.fileRile=fileRile;exports.floatRule=floatRule;exports.imageRule=imageRule;exports.inRule=inRule;exports.intRule=intRule;exports.lengthRule=lengthRule;exports.matchesRule=matchesRule;exports.maxFileSizeRule=maxFileSizeRule;exports.maxLengthRule=maxLengthRule;exports.maxRule=maxRule;exports.maxWidthRule=maxWidthRule;exports.minFileSizeRule=minFileSizeRule;exports.minHeightRule=minHeightRule;exports.minLengthRule=minLengthRule;exports.minRule=minRule;exports.minWidthRule=minWidthRule;exports.numberRule=numberRule;exports.objectRule=objectRule;exports.patternRule=patternRule;exports.positiveRule=positiveRule;exports.requiredIfAbsentRule=requiredIfAbsentRule;exports.requiredIfEmptyRule=requiredIfEmptyRule;exports.requiredIfFieldRule=requiredIfFieldRule;exports.requiredRule=requiredRule;exports.requiredWithRule=requiredWithRule;exports.scalarRule=scalarRule;exports.stringRule=stringRule;exports.uniqueArrayRule=uniqueArrayRule;exports.uniqueRule=uniqueRule;exports.unknownKeyRule=unknownKeyRule;exports.urlRule=urlRule;//# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sources":["../../../src/validator/v/rules.ts"],"sourcesContent":[null],"names":["isEmpty","invalidRule","VALID_RULE","get","isPlainObject","isEmail","setKeyPath","Aggregate","UploadedFile"],"mappings":"4MAYa,MAAA,YAAY,GAAe;AACtC,IAAA,IAAI,EAAE,UAAU;AAChB,IAAA,mBAAmB,EAAE,wBAAwB;AAC7C,IAAA,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,CAAC,CAAC;AACb,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;AAChC,QAAA,IAAIA,oBAAO,CAAC,KAAK,CAAC,EAAE;AAClB,YAAA,OAAOC,iBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnC,SAAA;AAED,QAAA,OAAOC,gBAAU,CAAC;KACnB;EACD;AAEW,MAAA,gBAAgB,GAAe;AAC1C,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,WAAW,EAAE,mDAAmD;IAChE,SAAS,EAAE,CAAC,CAAC;AACb,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,YAAY,EAAE,wBAAwB;AACtC,IAAA,MAAM,QAAQ,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AAA,OAAOD,iBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACnC;EACD;AAEW,MAAA,YAAY,GAAe;AACtC,IAAA,IAAI,EAAE,UAAU;AAChB,IAAA,YAAY,EAAE,kDAAkD;AAChE,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;AAChC,QAAA,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC;QAE5C,IAAI,UAAU,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE;AACrD,YAAA,OAAOC,gBAAU,CAAC;AACnB,SAAA;AAED,QAAA,OAAOD,iBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACnC;EACD;AAEW,MAAA,aAAa,GAAe;AACvC,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,YAAY,EAAE,oDAAoD;AAClE,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;AAChC,QAAA,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC;QAE5C,IAAI,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE;AACvD,YAAA,OAAOC,gBAAU,CAAC;AACnB,SAAA;AAED,QAAA,OAAOD,iBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACnC;"}
@@ -0,0 +1,159 @@
1
+ import { type BaseModel } from "src/cascade";
2
+ import { type ExistsRuleOptions, type UniqueRuleOptions } from "./rules";
3
+ import type { ContextualSchemaRule, ContextualizedMutator, Mutator, Schema, SchemaContext, SchemaRule, ValidationResult } from "./types";
4
+ export declare class BaseValidator {
5
+ rules: ContextualSchemaRule[];
6
+ mutators: ContextualizedMutator[];
7
+ protected defaultValue: any;
8
+ addRule(rule: SchemaRule, errorMessage?: string): ContextualSchemaRule;
9
+ addMutator(mutator: Mutator, options?: any): this;
10
+ default(value: any): this;
11
+ present(errorMessage?: string): this;
12
+ required(errorMessage?: string): this;
13
+ requiredWith(input: string, errorMessage?: string): this;
14
+ requiredIfAbsent(input: string, errorMessage?: string): this;
15
+ requiredIfEmpty(input: string, errorMessage?: string): this;
16
+ requiredIfField(input: string, value: any, errorMessage?: string): this;
17
+ mutate(data: any, context: SchemaContext): Promise<any>;
18
+ validate(data: any, context: SchemaContext): Promise<ValidationResult>;
19
+ }
20
+ export declare class AnyValidator extends BaseValidator {
21
+ }
22
+ export declare class ObjectValidator extends BaseValidator {
23
+ schema: Schema;
24
+ /**
25
+ * Whether to allow unknown properties
26
+ *
27
+ * @default false
28
+ */
29
+ protected shouldAllowUnknown: boolean;
30
+ /**
31
+ * Allowed keys that could be in the data but not necessarily validated
32
+ */
33
+ protected allowedKeys: string[];
34
+ constructor(schema: Schema, errorMessage?: string);
35
+ stripUnknown(): this;
36
+ /**
37
+ * Add list of allowed keys that could be in the data but not necessarily validated
38
+ */
39
+ allow(...keys: string[]): this;
40
+ /**
41
+ * Trim values of the object properties
42
+ */
43
+ trim(recursive?: boolean): this;
44
+ allowUnknown(allow?: boolean): this;
45
+ mutate(data: any, context: SchemaContext): any;
46
+ validate(data: any, context: SchemaContext): Promise<ValidationResult>;
47
+ }
48
+ export declare class ArrayValidator extends AnyValidator {
49
+ validator: BaseValidator;
50
+ constructor(validator: BaseValidator, errorMessage?: string);
51
+ /**
52
+ * Reverse array order
53
+ */
54
+ flip(): this;
55
+ /**
56
+ * Reverse array order
57
+ */
58
+ reverse(): this;
59
+ /**
60
+ * Make it has only unique values
61
+ */
62
+ onlyUnique(): this;
63
+ /**
64
+ * Sort array
65
+ *
66
+ * If key is passed, it will sort by the key value
67
+ * @supports dot notation
68
+ */
69
+ sort(direction?: "asc" | "desc", key?: string): this;
70
+ minLength(length: number, errorMessage?: string): this;
71
+ maxLength(length: number, errorMessage?: string): this;
72
+ length(length: number, errorMessage?: string): this;
73
+ /**
74
+ * Array must have unique values
75
+ */
76
+ unique(): this;
77
+ mutate(data: any, context: SchemaContext): any;
78
+ validate(data: any, context: SchemaContext): Promise<ValidationResult>;
79
+ }
80
+ export declare class StringValidator extends BaseValidator {
81
+ constructor(errorMessage?: string);
82
+ lowercase(): this;
83
+ uppercase(): this;
84
+ email(errorMessage?: string): this;
85
+ url(errorMessage?: string): this;
86
+ matches(field: RegExp, errorMessage?: string): this;
87
+ pattern(pattern: string, errorMessage?: string): this;
88
+ minLength(length: number, errorMessage?: string): this;
89
+ maxLength(length: number, errorMessage?: string): this;
90
+ length(length: number, errorMessage?: string): this;
91
+ enum(values: any[], errorMessage?: string): this;
92
+ in(values: any[], errorMessage?: string): this;
93
+ equal(value: any, errorMessage?: string): this;
94
+ unique(model: typeof BaseModel | string, { errorMessage, ...options }?: UniqueRuleOptions & {
95
+ errorMessage?: string;
96
+ }): this;
97
+ exists(model: typeof BaseModel | string, { errorMessage, ...options }?: ExistsRuleOptions & {
98
+ errorMessage?: string;
99
+ }): this;
100
+ }
101
+ export declare class DateValidator extends BaseValidator {
102
+ constructor(errorMessage?: string);
103
+ }
104
+ declare class NumberValidator extends BaseValidator {
105
+ constructor(errorMessage?: string);
106
+ min(min: number, errorMessage?: string): this;
107
+ max(max: number, errorMessage?: string): this;
108
+ equal(value: number, errorMessage?: string): this;
109
+ positive(errorMessage?: string): this;
110
+ unique(model: typeof BaseModel | string, { errorMessage, ...options }?: UniqueRuleOptions & {
111
+ errorMessage?: string;
112
+ }): this;
113
+ exists(model: typeof BaseModel | string, { errorMessage, ...options }?: ExistsRuleOptions & {
114
+ errorMessage?: string;
115
+ }): void;
116
+ }
117
+ export declare class IntValidator extends NumberValidator {
118
+ constructor(errorMessage?: string);
119
+ }
120
+ export declare class FloatValidator extends NumberValidator {
121
+ constructor(errorMessage?: string);
122
+ }
123
+ export declare class BooleanValidator extends BaseValidator {
124
+ constructor(errorMessage?: string);
125
+ }
126
+ export declare class ScalarValidator extends BaseValidator {
127
+ constructor(errorMessage?: string);
128
+ unique(model: typeof BaseModel | string, { errorMessage, ...options }?: UniqueRuleOptions & {
129
+ errorMessage?: string;
130
+ }): this;
131
+ exists(model: typeof BaseModel | string, { errorMessage, ...options }?: ExistsRuleOptions & {
132
+ errorMessage?: string;
133
+ }): void;
134
+ }
135
+ export declare class FileValidator extends BaseValidator {
136
+ constructor(errorMessage?: string);
137
+ image(errorMessage?: string): this;
138
+ minFileSize(size: number, errorMessage?: string): this;
139
+ maxFileSize(size: number, errorMessage?: string): this;
140
+ minWidth(width: number, errorMessage?: string): this;
141
+ maxWidth(width: number, errorMessage?: string): this;
142
+ minHeight(height: number, errorMessage?: string): this;
143
+ maxHeight(height: number, errorMessage?: string): this;
144
+ }
145
+ export declare const validate: (schema: BaseValidator, data: any) => Promise<ValidationResult>;
146
+ export declare const v: {
147
+ object: (schema: Schema, errorMessage?: string) => ObjectValidator;
148
+ array: (validator: BaseValidator, errorMessage?: string) => ArrayValidator;
149
+ string: (errorMessage?: string) => StringValidator;
150
+ number: (errorMessage?: string) => NumberValidator;
151
+ int: (errorMessage?: string) => IntValidator;
152
+ float: (errorMessage?: string) => FloatValidator;
153
+ boolean: (errorMessage?: string) => BooleanValidator;
154
+ scalar: (errorMessage?: string) => ScalarValidator;
155
+ file: (errorMessage?: string) => FileValidator;
156
+ validate: (schema: BaseValidator, data: any) => Promise<ValidationResult>;
157
+ };
158
+ export {};
159
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/validator/v/schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAa7C,OAAO,EAsCL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,EACP,MAAM,EACN,aAAa,EACb,UAAU,EACV,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAGjB,q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