ConstraintMetadata.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. import { getFromContainer } from '../container';
  2. /**
  3. * This metadata interface contains information for custom validators.
  4. */
  5. var ConstraintMetadata = /** @class */ (function () {
  6. // -------------------------------------------------------------------------
  7. // Constructor
  8. // -------------------------------------------------------------------------
  9. function ConstraintMetadata(target, name, async) {
  10. if (async === void 0) { async = false; }
  11. this.target = target;
  12. this.name = name;
  13. this.async = async;
  14. }
  15. Object.defineProperty(ConstraintMetadata.prototype, "instance", {
  16. // -------------------------------------------------------------------------
  17. // Accessors
  18. // -------------------------------------------------------------------------
  19. /**
  20. * Instance of the target custom validation class which performs validation.
  21. */
  22. get: function () {
  23. return getFromContainer(this.target);
  24. },
  25. enumerable: false,
  26. configurable: true
  27. });
  28. return ConstraintMetadata;
  29. }());
  30. export { ConstraintMetadata };
  31. //# sourceMappingURL=ConstraintMetadata.js.map