import 'reflect-metadata'; import { IRequestContext } from "../../pipeline/common"; /** * Property definition * * @export * @interface PropertyDefinition */ export interface PropertyDefinition { /** * Base type * * @type {string} - a valid base type * @memberOf PropertyOptions */ type?: string; /** * List of values for 'enum' type * * @type {string[]} - An array of values * @memberOf PropertyOptions */ values?: string[]; /** * True is this property is required * * @type {boolean} * @memberOf PropertyOptions */ required?: boolean; /** * Property description * * @type {string} * @memberOf PropertyOptions */ description?: string; /** * Item type property of type 'ArrayOf' * * @type {string} - A valid type for all elements of the array * @memberOf PropertyOptions */ itemsType?: string; /** * Entity key - Only one property by entity can be define. * * @type {boolean} * @memberOf PropertyOptions */ isKey?: boolean; /** * Used to create an unique index key - Supports multiple property keys * * @type {boolean} * @memberOf PropertyOptions */ unique?: boolean; /** * Cardinality in case of reference */ cardinality?: 'one' | 'many' | undefined; /** * Function to transform an input value. If null or false, the value is ignored. * * * @memberOf PropertyOptions */ coerce?: ((val, entity) => any) | boolean; /** * Provide a way to check if a validation should be done. * validation are skipped, if the function returns false. * * @memberOf PropertyOptions */ dependsOn?: (entity) => boolean; /** * Custom validation. This validation runs after all others validators * * * @memberOf PropertyOptions */ validate?: (val, ctx?: IRequestContext) => string; /** * Define if the property contains sensible data. * Sensible datas are obfuscated and are removed from get request. * This behavior only works with built-in provider and command. * * @type {boolean} * @memberOf PropertyOptions */ sensible?: boolean; /** * Property sequence order */ order?: number; /** * This property is not exposed by service description */ private?: boolean; /** * Properties for custom types */ typeProperties?: any; } export interface ReferenceDefinition { reference: string; /** * Foreign key in case of reference */ referenceProperty?: string; verb?: string; args?: any; } export declare function Reference(def: any): (target: any, key?: any) => void; export declare function Property(def?: PropertyDefinition, typeProperties?: any): (target: any, key: any) => void;