1 | import { getMetadataStorage } from './metadata/MetadataStorage';
|
2 | import { Validator } from './validation/Validator';
|
3 | import { getFromContainer } from './container';
|
4 |
|
5 |
|
6 |
|
7 | export * from './container';
|
8 | export * from './decorator/decorators';
|
9 | export * from './decorator/ValidationOptions';
|
10 | export * from './validation/ValidatorConstraintInterface';
|
11 | export * from './validation/ValidationError';
|
12 | export * from './validation/ValidatorOptions';
|
13 | export * from './validation/ValidationArguments';
|
14 | export * from './validation/ValidationTypes';
|
15 | export * from './validation/Validator';
|
16 | export * from './validation-schema/ValidationSchema';
|
17 | export * from './register-decorator';
|
18 | export * from './metadata/MetadataStorage';
|
19 |
|
20 |
|
21 |
|
22 | export function validate(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions) {
|
23 | if (typeof schemaNameOrObject === 'string') {
|
24 | return getFromContainer(Validator).validate(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions);
|
25 | }
|
26 | else {
|
27 | return getFromContainer(Validator).validate(schemaNameOrObject, objectOrValidationOptions);
|
28 | }
|
29 | }
|
30 |
|
31 |
|
32 |
|
33 | export function validateOrReject(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions) {
|
34 | if (typeof schemaNameOrObject === 'string') {
|
35 | return getFromContainer(Validator).validateOrReject(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions);
|
36 | }
|
37 | else {
|
38 | return getFromContainer(Validator).validateOrReject(schemaNameOrObject, objectOrValidationOptions);
|
39 | }
|
40 | }
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | export function validateSync(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions) {
|
47 | if (typeof schemaNameOrObject === 'string') {
|
48 | return getFromContainer(Validator).validateSync(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions);
|
49 | }
|
50 | else {
|
51 | return getFromContainer(Validator).validateSync(schemaNameOrObject, objectOrValidationOptions);
|
52 | }
|
53 | }
|
54 |
|
55 |
|
56 |
|
57 | export function registerSchema(schema) {
|
58 | getMetadataStorage().addValidationSchema(schema);
|
59 | }
|
60 |
|
\ | No newline at end of file |