import type { IConstraint, ValidatorConstraintOptions } from "../types"; import type { ValidationArguments } from 'class-validator'; /** * @file Decorator Constraints - IsBranchConstraint * @module grease/constraints/IsBranch */ /** * Custom validator for the `IsBranch` decorator. * * @implements {IConstraint} */ export default class IsBranchConstraint 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 {IsBranchOptions} args.constraints.0 - Validation options * @return {string} Default error message */ defaultMessage(args: ValidationArguments): string; /** * Checks if `value` is the name of a branch in the current repository. * * By default, local branches will be listed. To specifiy a remote to pull * branches from, set `args.constraints.0.remote`. * * If validation fails, the arguments context `args.constraints[0].context`, * will be modified. * * @async * @param {any} value - Value to test against constraint * @param {ValidationArguments} args - Message builder arguments * @param {any[]} args.constraints - Validator constraints * @param {IsBranchOptions} args.constraints.0 - Validation options * @param {string} [args.constraints.0.dir=process.env.PROJECT_CWD] - `.git` directory * @param {string} [args.constraints.0.remote] - Name of remote * @return {Promise} Boolean indicating if value is branch */ validate(value: any, args?: ValidationArguments): Promise; }