@decaf-ts/decorator-validation
Version:
simple decorator based validation engine
60 lines (59 loc) • 2.12 kB
TypeScript
/**
* @summary defines the tpe os an InstanceCallback function
*
* @memberOf module:decorator-validation
* @category Model
*/
export type InstanceCallback = (instance: any, ...args: any[]) => void;
/**
* @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;
* - Runs the optional {@link InstanceCallback} if provided;
*
* @param {InstanceCallback} [instanceCallback] optional callback that will be called with the instance upon instantiation. defaults to undefined
*
* @function model
*
* @category Class Decorators
*/
export declare function model(instanceCallback?: InstanceCallback): 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;
* - Runs the optional {@link InstanceCallback} if provided;
*
* @param {string} algorithm the algorithm to use
*
* @function hashedBy
*
* @category Class Decorators
*/
export declare function hashedBy(algorithm: string, ...args: any[]): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => 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[]): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
/**
* @summary Applies descriptive metadata to a class, property or method
*
* @param {string} description the description to apply
*
* @function description
*
* @category Decorators
*/
export declare function description(description: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;