import type { IConstraint, ValidatorConstraintOptions } from "../types"; import type { ValidationArguments } from 'class-validator'; /** * @file Decorator Constraints - IsTargetBranchConstraint * @module grease/constraints/IsTargetBranch */ /** * Custom validator for the `IsTargetBranch` decorator. * * @implements {IConstraint} */ export default class IsTargetBranchConstraint implements IConstraint { /** * @static * @readonly * @property {ValidatorConstraintOptions} options - Custom constraint options */ static readonly options: ValidatorConstraintOptions; /** * Returns the default error message if validation fails. * * @param {ValidationArguments} args - Message builder arguments * @param {any[]} args.constraints - Validator constraints * @param {IsTargetBranchOptions} args.constraints.0 - Validation options * @param {ValidationMessage} [args.constraints.0.message] - Error message * @return {string} Default error message */ defaultMessage(args: ValidationArguments): string; /** * Checks if `value` is the name of a branch or commit SHA (if enabled) in the * current repository. * * If validation fails, the arguments context `args.constraints[0].context`, * will be modified. * * @param {any} value - Value to test against constraint * @param {ValidationArguments} args - Message builder arguments * @param {any[]} args.constraints - Validator constraints * @param {IsTargetBranchOptions} args.constraints.0 - Validation options * @param {string} [args.constraints.0.dir=process.env.PROJECT_CWD] - `.git` directory * @param {string} [args.constraints.0.remote='origin'] - Name of remote * @param {boolean} [args.constraints.0.sha] - Allow Git commit SHAs * @return {Promise} Boolean indicating if value is branch or commit */ validate(value: any, args: ValidationArguments): Promise; }