UNPKG

@elsikora/nestjs-crud-automator

Version:

A library for automating the creation of CRUD operations in NestJS.

25 lines (24 loc) 1.44 kB
import { TApiPropertyDefaultStringFormat, TApiPropertyDefaultStringFormatProperties } from '../../../type/decorator/api/property'; import { TApiGetDefaultStringFormatPropertiesParameters } from '../../../type/utility/api'; /** * Returns default format properties for supported string types (EMAIL, IP, URL, UUID). * This utility provides standard validation rules including pattern, length constraints, * example values and descriptions for common string formats. * @param {TApiPropertyDefaultStringFormat} format - The string format type (EMAIL, IP, URL, or UUID) * @param {TApiGetDefaultStringFormatPropertiesParameters<TFormat>} parameters - Optional format-specific settings. * @returns {TApiPropertyDefaultStringFormatProperties} Default properties for the specified format * @example * ```typescript * const emailDefaults = GetDefaultStringFormatProperties(TApiPropertyDefaultStringFormat.EMAIL); * // Returns: * // { * // description: "email", * // exampleValue: "user@example.com", * // maxLength: 321, * // minLength: 5, * // pattern: "/^([a-zA-Z0-9_\\-.+])+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$/" * // } * ``` * @template TFormat - Default string format type. */ export declare function GetDefaultStringFormatProperties<const TFormat extends TApiPropertyDefaultStringFormat>(format: TFormat, ...parameters: TApiGetDefaultStringFormatPropertiesParameters<TFormat>): TApiPropertyDefaultStringFormatProperties;