UNPKG

@themost/jspa

Version:
31 lines (30 loc) 1.26 kB
import { DataModelBase } from '@themost/common'; import { ColumnAnnotation } from './Column'; declare interface ValidationAnnotation { pattern?: string; patternMessage?: string; minValue?: unknown; maxValue?: unknown; minLength?: unknown; maxLength?: unknown; message?: string; validator?: (event: { model: DataModelBase; target: unknown; value: unknown; }) => Promise<boolean>; } declare interface ColumnValidationAnnotation extends ColumnAnnotation { validation?: ValidationAnnotation; } declare function Pattern(pattern?: string, patternMessage?: string): PropertyDecorator; declare function Size(minLength?: unknown, maxLength?: unknown, message?: string): PropertyDecorator; declare function Min(minValue?: unknown, message?: string): PropertyDecorator; declare function Max(maxValue?: unknown, message?: string): PropertyDecorator; declare function Range(minValue: unknown, maxValue: unknown, message?: string): PropertyDecorator; declare function Validate(validator: (event: { model: DataModelBase; target: unknown; value: unknown; }) => Promise<boolean>, message?: string): PropertyDecorator; export { Pattern, Size, Min, Max, Validate, Range, ColumnValidationAnnotation };