@decaf-ts/decorator-validation
Version:
simple decorator based validation engine
48 lines (47 loc) • 1.75 kB
TypeScript
/**
* @description Base decorator for model classes.
* @summary This decorator wraps the original constructor to bind the Model prototype, run a builder function, and register the model.
* @param {any} original The original constructor of the class.
* @return {any} The new constructor with added model functionality.
* @function modelBaseDecorator
* @memberOf module:decorator-validation
*/
export declare function modelBaseDecorator(original: any): any;
/**
* @summary Defines a class as a Model class
* @description
*
* - Registers the class under the model registry so it can be easily rebuilt;
* - Overrides the class constructor;
* - Runs the global {@link ModelBuilderFunction} if defined;
*
* @function model
*
* @category Class Decorators
*/
export declare function model(): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
/**
* @summary Defines the hashing algorithm to use on the model
* @description
*
* - Registers the class under the model registry so it can be easily rebuilt;
* - Overrides the class constructor;
* - Runs the global {@link ModelBuilderFunction} if defined;
*
* @param {string} algorithm the algorithm to use
*
* @function hashedBy
*
* @category Class Decorators
*/
export declare function hashedBy(algorithm: string, ...args: any[]): (model: any, prop?: any, descriptor?: PropertyDescriptor | number) => void;
/**
* @summary Defines the serialization algorithm to use on the model
*
* @param {string} serializer the algorithm to use
*
* @function serializedBy
*
* @category Class Decorators
*/
export declare function serializedBy(serializer: string, ...args: any[]): (model: any, prop?: any, descriptor?: PropertyDescriptor | number) => void;