UNPKG

2.02 kBSource Map (JSON)View Raw
1{"version":3,"file":"ConstraintMetadata.js","sourceRoot":"","sources":["../../../src/metadata/ConstraintMetadata.ts"],"names":[],"mappings":";;;AACA,4CAAgD;AAEhD;;GAEG;AACH,MAAa,kBAAkB;IAoB7B,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,MAAgB,EAAE,IAAa,EAAE,QAAiB,KAAK;QACjE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,4EAA4E;IAC5E,YAAY;IACZ,4EAA4E;IAE5E;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAA,4BAAgB,EAA+B,IAAI,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC;CACF;AAxCD,gDAwCC","sourcesContent":["import { ValidatorConstraintInterface } from '../validation/ValidatorConstraintInterface';\nimport { getFromContainer } from '../container';\n\n/**\n * This metadata interface contains information for custom validators.\n */\nexport class ConstraintMetadata {\n // -------------------------------------------------------------------------\n // Properties\n // -------------------------------------------------------------------------\n\n /**\n * Target class which performs validation.\n */\n target: Function;\n\n /**\n * Custom validation's name, that will be used as validation error type.\n */\n name: string;\n\n /**\n * Indicates if this validation is asynchronous or not.\n */\n async: boolean;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(target: Function, name?: string, async: boolean = false) {\n this.target = target;\n this.name = name;\n this.async = async;\n }\n\n // -------------------------------------------------------------------------\n // Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Instance of the target custom validation class which performs validation.\n */\n get instance(): ValidatorConstraintInterface {\n return getFromContainer<ValidatorConstraintInterface>(this.target);\n }\n}\n"]}
\No newline at end of file