UNPKG

1.51 kBTypeScriptView Raw
1import { ValidationMetadata } from './ValidationMetadata';
2import { ConstraintMetadata } from './ConstraintMetadata';
3import { ValidationSchema } from '../validation-schema/ValidationSchema';
4/**
5 * Storage all metadatas.
6 */
7export declare class MetadataStorage {
8 private validationMetadatas;
9 private constraintMetadatas;
10 get hasValidationMetaData(): boolean;
11 /**
12 * Adds a new validation metadata.
13 */
14 addValidationSchema(schema: ValidationSchema): void;
15 /**
16 * Adds a new validation metadata.
17 */
18 addValidationMetadata(metadata: ValidationMetadata): void;
19 /**
20 * Adds a new constraint metadata.
21 */
22 addConstraintMetadata(metadata: ConstraintMetadata): void;
23 /**
24 * Groups metadata by their property names.
25 */
26 groupByPropertyName(metadata: ValidationMetadata[]): {
27 [propertyName: string]: ValidationMetadata[];
28 };
29 /**
30 * Gets all validation metadatas for the given object with the given groups.
31 */
32 getTargetValidationMetadatas(targetConstructor: Function, targetSchema: string, always: boolean, strictGroups: boolean, groups?: string[]): ValidationMetadata[];
33 /**
34 * Gets all validator constraints for the given object.
35 */
36 getTargetValidatorConstraints(target: Function): ConstraintMetadata[];
37}
38/**
39 * Gets metadata storage.
40 * Metadata storage follows the best practices and stores metadata in a global variable.
41 */
42export declare function getMetadataStorage(): MetadataStorage;