@innet/server 2.0.0-beta.25 → 2.0.0-beta.27

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 (60) hide show
  1. package/constants.d.ts +3 -0
  2. package/constants.es6.js +28 -1
  3. package/constants.js +29 -0
  4. package/hooks/index.d.ts +1 -1
  5. package/hooks/index.es6.js +1 -1
  6. package/hooks/index.js +1 -1
  7. package/hooks/useBodyContext/index.d.ts +1 -0
  8. package/hooks/useBodyContext/index.es6.js +1 -0
  9. package/hooks/useBodyContext/index.js +10 -0
  10. package/hooks/useBodyContext/useBodyContext.d.ts +6 -0
  11. package/hooks/{useBodyFile/useBodyFile.es6.js → useBodyContext/useBodyContext.es6.js} +6 -6
  12. package/hooks/{useBodyFile/useBodyFile.js → useBodyContext/useBodyContext.js} +7 -7
  13. package/hooks/useData/useData.d.ts +1 -1
  14. package/hooks/useData/useData.es6.js +4 -4
  15. package/hooks/useData/useData.js +4 -4
  16. package/index.es6.js +2 -2
  17. package/index.js +5 -3
  18. package/package.json +1 -1
  19. package/plugins/main/api/api.d.ts +7 -0
  20. package/plugins/main/api/api.es6.js +2 -4
  21. package/plugins/main/api/api.js +2 -4
  22. package/plugins/main/body/body.es6.js +6 -4
  23. package/plugins/main/body/body.js +6 -4
  24. package/plugins/main/endpoint/endpoint.d.ts +2 -0
  25. package/plugins/main/endpoint/endpoint.es6.js +78 -2
  26. package/plugins/main/endpoint/endpoint.js +78 -2
  27. package/plugins/schema/any/any.es6.js +6 -1
  28. package/plugins/schema/any/any.js +5 -0
  29. package/plugins/schema/array/array.es6.js +4 -1
  30. package/plugins/schema/array/array.js +4 -1
  31. package/plugins/schema/binary/binary.es6.js +7 -3
  32. package/plugins/schema/binary/binary.js +6 -2
  33. package/plugins/schema/boolean/boolean.es6.js +6 -1
  34. package/plugins/schema/boolean/boolean.js +5 -0
  35. package/plugins/schema/date/date.es6.js +6 -1
  36. package/plugins/schema/date/date.js +5 -0
  37. package/plugins/schema/integer/integer.es6.js +6 -1
  38. package/plugins/schema/integer/integer.js +5 -0
  39. package/plugins/schema/null/null.es6.js +8 -2
  40. package/plugins/schema/null/null.js +7 -1
  41. package/plugins/schema/number/number.es6.js +6 -1
  42. package/plugins/schema/number/number.js +5 -0
  43. package/plugins/schema/object/object.es6.js +34 -29
  44. package/plugins/schema/object/object.js +33 -28
  45. package/plugins/schema/string/string.es6.js +7 -2
  46. package/plugins/schema/string/string.js +6 -1
  47. package/plugins/schema/tuple/tuple.es6.js +27 -22
  48. package/plugins/schema/tuple/tuple.js +26 -21
  49. package/plugins/schema/uuid/uuid.es6.js +6 -1
  50. package/plugins/schema/uuid/uuid.js +5 -0
  51. package/types/appTypes.d.ts +3 -1
  52. package/utils/rules/constants.d.ts +4 -0
  53. package/utils/rules/constants.es6.js +547 -1
  54. package/utils/rules/constants.js +548 -0
  55. package/utils/rules/index.es6.js +1 -1
  56. package/utils/rules/index.js +2 -0
  57. package/hooks/useBodyFile/index.d.ts +0 -1
  58. package/hooks/useBodyFile/index.es6.js +0 -1
  59. package/hooks/useBodyFile/index.js +0 -10
  60. package/hooks/useBodyFile/useBodyFile.d.ts +0 -3
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ const inValidationValues = ['body', 'query', 'cookie', 'header', 'path'];
5
6
  const rulesErrors = [
6
7
  'oneOf',
7
8
  'number',
@@ -28,5 +29,552 @@ const rulesErrors = [
28
29
  'minBin',
29
30
  'maxBin',
30
31
  ];
32
+ const rulesErrorSchemas = {
33
+ array: {
34
+ description: 'The value should be an array',
35
+ properties: {
36
+ error: {
37
+ const: 'array',
38
+ type: 'string',
39
+ },
40
+ in: {
41
+ enum: inValidationValues,
42
+ type: 'string',
43
+ },
44
+ key: {
45
+ type: 'string',
46
+ },
47
+ },
48
+ required: ['error', 'in'],
49
+ title: 'array',
50
+ type: 'object',
51
+ },
52
+ binary: {
53
+ description: 'The value should be a binary file',
54
+ properties: {
55
+ error: {
56
+ const: 'binary',
57
+ type: 'string',
58
+ },
59
+ in: {
60
+ enum: inValidationValues,
61
+ type: 'string',
62
+ },
63
+ key: {
64
+ type: 'string',
65
+ },
66
+ value: {},
67
+ },
68
+ required: ['error', 'in', 'value'],
69
+ title: 'binary',
70
+ type: 'object',
71
+ },
72
+ binaryAccept: {
73
+ description: 'The file should match the accepted MIME types or extensions',
74
+ properties: {
75
+ accept: {
76
+ type: 'string',
77
+ },
78
+ error: {
79
+ const: 'binaryAccept',
80
+ type: 'string',
81
+ },
82
+ in: {
83
+ enum: inValidationValues,
84
+ type: 'string',
85
+ },
86
+ key: {
87
+ type: 'string',
88
+ },
89
+ value: {},
90
+ },
91
+ required: ['error', 'in', 'accept', 'value'],
92
+ title: 'binaryAccept',
93
+ type: 'object',
94
+ },
95
+ boolean: {
96
+ description: 'The value should be a boolean',
97
+ properties: {
98
+ error: {
99
+ const: 'boolean',
100
+ type: 'string',
101
+ },
102
+ in: {
103
+ enum: inValidationValues,
104
+ type: 'string',
105
+ },
106
+ key: {
107
+ type: 'string',
108
+ },
109
+ },
110
+ required: ['error', 'in'],
111
+ title: 'boolean',
112
+ type: 'object',
113
+ },
114
+ date: {
115
+ description: 'The value should be a valid date',
116
+ properties: {
117
+ error: {
118
+ const: 'date',
119
+ type: 'string',
120
+ },
121
+ in: {
122
+ enum: inValidationValues,
123
+ type: 'string',
124
+ },
125
+ key: {
126
+ type: 'string',
127
+ },
128
+ value: {},
129
+ },
130
+ required: ['error', 'in', 'value'],
131
+ title: 'date',
132
+ type: 'object',
133
+ },
134
+ integer: {
135
+ description: 'The value should be a valid integer within the specified format range',
136
+ properties: {
137
+ error: {
138
+ const: 'integer',
139
+ type: 'string',
140
+ },
141
+ format: {
142
+ enum: ['int32', 'int64'],
143
+ type: 'string',
144
+ },
145
+ in: {
146
+ enum: inValidationValues,
147
+ type: 'string',
148
+ },
149
+ key: {
150
+ type: 'string',
151
+ },
152
+ max: {
153
+ type: ['integer', 'string'],
154
+ },
155
+ min: {
156
+ type: ['integer', 'string'],
157
+ },
158
+ value: {},
159
+ },
160
+ required: ['error', 'in', 'format', 'value'],
161
+ title: 'integer',
162
+ type: 'object',
163
+ },
164
+ maxBin: {
165
+ description: 'The file size should not exceed the maximum limit',
166
+ properties: {
167
+ error: {
168
+ const: 'maxBin',
169
+ type: 'string',
170
+ },
171
+ in: {
172
+ enum: inValidationValues,
173
+ type: 'string',
174
+ },
175
+ key: {
176
+ type: 'string',
177
+ },
178
+ max: {
179
+ type: 'integer',
180
+ },
181
+ value: {},
182
+ },
183
+ required: ['error', 'in', 'max', 'value'],
184
+ title: 'maxBin',
185
+ type: 'object',
186
+ },
187
+ maxDate: {
188
+ description: 'The date should not exceed the maximum limit',
189
+ properties: {
190
+ error: {
191
+ const: 'maxDate',
192
+ type: 'string',
193
+ },
194
+ in: {
195
+ enum: inValidationValues,
196
+ type: 'string',
197
+ },
198
+ key: {
199
+ type: 'string',
200
+ },
201
+ max: {
202
+ format: 'date-time',
203
+ type: 'string',
204
+ },
205
+ value: {
206
+ format: 'date-time',
207
+ type: 'string',
208
+ },
209
+ },
210
+ required: ['error', 'in', 'max', 'value'],
211
+ title: 'maxDate',
212
+ type: 'object',
213
+ },
214
+ maximum: {
215
+ description: 'The number should not exceed the maximum limit',
216
+ properties: {
217
+ error: {
218
+ const: 'maximum',
219
+ type: 'string',
220
+ },
221
+ in: {
222
+ enum: inValidationValues,
223
+ type: 'string',
224
+ },
225
+ key: {
226
+ type: 'string',
227
+ },
228
+ max: {
229
+ oneOf: [
230
+ { type: 'number' },
231
+ { type: 'string' },
232
+ ],
233
+ },
234
+ value: {},
235
+ },
236
+ required: ['error', 'in', 'max', 'value'],
237
+ title: 'maximum',
238
+ type: 'object',
239
+ },
240
+ maxLength: {
241
+ description: 'The string length should not exceed the maximum limit',
242
+ properties: {
243
+ error: {
244
+ const: 'maxLength',
245
+ type: 'string',
246
+ },
247
+ in: {
248
+ enum: inValidationValues,
249
+ type: 'string',
250
+ },
251
+ key: {
252
+ type: 'string',
253
+ },
254
+ max: {
255
+ type: 'integer',
256
+ },
257
+ value: {
258
+ type: 'string',
259
+ },
260
+ },
261
+ required: ['error', 'in', 'max', 'value'],
262
+ title: 'maxLength',
263
+ type: 'object',
264
+ },
265
+ minBin: {
266
+ description: 'The file size should meet the minimum limit',
267
+ properties: {
268
+ error: {
269
+ const: 'minBin',
270
+ type: 'string',
271
+ },
272
+ in: {
273
+ enum: inValidationValues,
274
+ type: 'string',
275
+ },
276
+ key: {
277
+ type: 'string',
278
+ },
279
+ min: {
280
+ type: 'integer',
281
+ },
282
+ value: {},
283
+ },
284
+ required: ['error', 'in', 'min', 'value'],
285
+ title: 'minBin',
286
+ type: 'object',
287
+ },
288
+ minDate: {
289
+ description: 'The date should not be earlier than the minimum limit',
290
+ properties: {
291
+ error: {
292
+ const: 'minDate',
293
+ type: 'string',
294
+ },
295
+ in: {
296
+ enum: inValidationValues,
297
+ type: 'string',
298
+ },
299
+ key: {
300
+ type: 'string',
301
+ },
302
+ min: {
303
+ format: 'date-time',
304
+ type: 'string',
305
+ },
306
+ value: {
307
+ format: 'date-time',
308
+ type: 'string',
309
+ },
310
+ },
311
+ required: ['error', 'in', 'min', 'value'],
312
+ title: 'minDate',
313
+ type: 'object',
314
+ },
315
+ minimum: {
316
+ description: 'The number should meet the minimum limit',
317
+ properties: {
318
+ error: {
319
+ const: 'minimum',
320
+ type: 'string',
321
+ },
322
+ in: {
323
+ enum: inValidationValues,
324
+ type: 'string',
325
+ },
326
+ key: {
327
+ type: 'string',
328
+ },
329
+ min: {
330
+ oneOf: [
331
+ { type: 'number' },
332
+ { type: 'string' },
333
+ ],
334
+ },
335
+ value: {},
336
+ },
337
+ required: ['error', 'in', 'min', 'value'],
338
+ title: 'minimum',
339
+ type: 'object',
340
+ },
341
+ minLength: {
342
+ description: 'The string length should meet the minimum limit',
343
+ properties: {
344
+ error: {
345
+ const: 'minLength',
346
+ type: 'string',
347
+ },
348
+ in: {
349
+ enum: inValidationValues,
350
+ type: 'string',
351
+ },
352
+ key: {
353
+ type: 'string',
354
+ },
355
+ min: {
356
+ type: 'integer',
357
+ },
358
+ value: {
359
+ type: 'string',
360
+ },
361
+ },
362
+ required: ['error', 'in', 'min', 'value'],
363
+ title: 'minLength',
364
+ type: 'object',
365
+ },
366
+ null: {
367
+ description: 'The value should be null',
368
+ properties: {
369
+ error: {
370
+ const: 'null',
371
+ type: 'string',
372
+ },
373
+ in: {
374
+ enum: inValidationValues,
375
+ type: 'string',
376
+ },
377
+ key: {
378
+ type: 'string',
379
+ },
380
+ },
381
+ required: ['error', 'in'],
382
+ title: 'null',
383
+ type: 'object',
384
+ },
385
+ number: {
386
+ description: 'The value should be a valid number',
387
+ properties: {
388
+ error: {
389
+ const: 'number',
390
+ type: 'string',
391
+ },
392
+ in: {
393
+ enum: inValidationValues,
394
+ type: 'string',
395
+ },
396
+ key: {
397
+ type: 'string',
398
+ },
399
+ value: {},
400
+ },
401
+ required: ['error', 'in', 'value'],
402
+ title: 'number',
403
+ type: 'object',
404
+ },
405
+ object: {
406
+ description: 'The value should be an object',
407
+ properties: {
408
+ error: {
409
+ const: 'object',
410
+ type: 'string',
411
+ },
412
+ in: {
413
+ enum: inValidationValues,
414
+ type: 'string',
415
+ },
416
+ key: {
417
+ type: 'string',
418
+ },
419
+ value: {},
420
+ },
421
+ required: ['error', 'in', 'value'],
422
+ title: 'object',
423
+ type: 'object',
424
+ },
425
+ oneOf: {
426
+ description: 'The value should match exactly one of the provided schemas',
427
+ properties: {
428
+ error: {
429
+ const: 'oneOf',
430
+ type: 'string',
431
+ },
432
+ errors: {
433
+ items: {
434
+ type: 'object',
435
+ },
436
+ type: 'array',
437
+ },
438
+ in: {
439
+ enum: inValidationValues,
440
+ type: 'string',
441
+ },
442
+ key: {
443
+ type: 'string',
444
+ },
445
+ },
446
+ required: ['error', 'in', 'errors'],
447
+ title: 'oneOf',
448
+ type: 'object',
449
+ },
450
+ pattern: {
451
+ description: 'The value should match the specified regex pattern',
452
+ properties: {
453
+ error: {
454
+ const: 'pattern',
455
+ type: 'string',
456
+ },
457
+ in: {
458
+ enum: inValidationValues,
459
+ type: 'string',
460
+ },
461
+ key: {
462
+ type: 'string',
463
+ },
464
+ pattern: {
465
+ type: 'string',
466
+ },
467
+ patternId: {
468
+ type: 'string',
469
+ },
470
+ value: {},
471
+ },
472
+ required: ['error', 'in', 'pattern', 'patternId', 'value'],
473
+ title: 'pattern',
474
+ type: 'object',
475
+ },
476
+ required: {
477
+ description: 'The field is required and must not be undefined',
478
+ properties: {
479
+ error: {
480
+ const: 'required',
481
+ type: 'string',
482
+ },
483
+ in: {
484
+ enum: inValidationValues,
485
+ type: 'string',
486
+ },
487
+ key: {
488
+ type: 'string',
489
+ },
490
+ },
491
+ required: ['error', 'in'],
492
+ title: 'required',
493
+ type: 'object',
494
+ },
495
+ string: {
496
+ description: 'The value should be a string',
497
+ properties: {
498
+ error: {
499
+ const: 'string',
500
+ type: 'string',
501
+ },
502
+ in: {
503
+ enum: inValidationValues,
504
+ type: 'string',
505
+ },
506
+ key: {
507
+ type: 'string',
508
+ },
509
+ },
510
+ required: ['error', 'in'],
511
+ title: 'string',
512
+ type: 'object',
513
+ },
514
+ tuple: {
515
+ description: 'The value should be a tuple',
516
+ properties: {
517
+ error: {
518
+ const: 'tuple',
519
+ type: 'string',
520
+ },
521
+ in: {
522
+ enum: inValidationValues,
523
+ type: 'string',
524
+ },
525
+ key: {
526
+ type: 'string',
527
+ },
528
+ },
529
+ required: ['error', 'in'],
530
+ title: 'tuple',
531
+ type: 'object',
532
+ },
533
+ uuid: {
534
+ description: 'The value should be a valid UUID',
535
+ properties: {
536
+ error: {
537
+ const: 'uuid',
538
+ type: 'string',
539
+ },
540
+ in: {
541
+ enum: inValidationValues,
542
+ type: 'string',
543
+ },
544
+ key: {
545
+ type: 'string',
546
+ },
547
+ },
548
+ required: ['error', 'in'],
549
+ title: 'uuid',
550
+ type: 'object',
551
+ },
552
+ values: {
553
+ description: 'The value should be one of the allowed values',
554
+ properties: {
555
+ error: {
556
+ const: 'values',
557
+ type: 'string',
558
+ },
559
+ in: {
560
+ enum: inValidationValues,
561
+ type: 'string',
562
+ },
563
+ key: {
564
+ type: 'string',
565
+ },
566
+ value: {},
567
+ values: {
568
+ items: {},
569
+ type: 'array',
570
+ },
571
+ },
572
+ required: ['error', 'in', 'value', 'values'],
573
+ title: 'values',
574
+ type: 'object',
575
+ },
576
+ };
31
577
 
578
+ exports.inValidationValues = inValidationValues;
579
+ exports.rulesErrorSchemas = rulesErrorSchemas;
32
580
  exports.rulesErrors = rulesErrors;
@@ -1,7 +1,7 @@
1
1
  import './arrayOf/index.es6.js';
2
2
  import './bin/index.es6.js';
3
3
  import './binaryAccept/index.es6.js';
4
- export { rulesErrors } from './constants.es6.js';
4
+ export { inValidationValues, rulesErrorSchemas, rulesErrors } from './constants.es6.js';
5
5
  import './dateTo/index.es6.js';
6
6
  import './defaultTo/index.es6.js';
7
7
  export { RulesError, addKey } from './helpers.es6.js';
@@ -33,6 +33,8 @@ require('./values/index.js');
33
33
 
34
34
 
35
35
 
36
+ exports.inValidationValues = constants.inValidationValues;
37
+ exports.rulesErrorSchemas = constants.rulesErrorSchemas;
36
38
  exports.rulesErrors = constants.rulesErrors;
37
39
  exports.RulesError = helpers.RulesError;
38
40
  exports.addKey = helpers.addKey;
@@ -1 +0,0 @@
1
- export * from './useBodyFile';
@@ -1 +0,0 @@
1
- export { bodyFileContext, useBodyFile } from './useBodyFile.es6.js';
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var useBodyFile = require('./useBodyFile.js');
6
-
7
-
8
-
9
- exports.bodyFileContext = useBodyFile.bodyFileContext;
10
- exports.useBodyFile = useBodyFile.useBodyFile;
@@ -1,3 +0,0 @@
1
- import { Context } from '@innet/jsx';
2
- export declare const bodyFileContext: Context<() => void, (() => void) | undefined>;
3
- export declare function useBodyFile(): void;