UNPKG

company-cafeteria-shared-demo

Version:

Package partagé pour l'écosystème Cafétéria Entreprise

197 lines 4.84 kB
import { z } from 'zod'; /** * Validation d'email */ export declare const emailSchema: z.ZodString; /** * Validation de mot de passe */ export declare const passwordSchema: z.ZodString; /** * Validation de nom utilisateur */ export declare const usernameSchema: z.ZodString; /** * Validation de téléphone */ export declare const phoneSchema: z.ZodOptional<z.ZodString>; /** * Validation de prix */ export declare const priceSchema: z.ZodEffects<z.ZodNumber, number, number>; /** * Validation de quantité */ export declare const quantitySchema: z.ZodNumber; /** * Validation d'ID Firestore */ export declare const firestoreIdSchema: z.ZodString; /** * Validation d'URL */ export declare const urlSchema: z.ZodOptional<z.ZodString>; /** * Validation de date ISO */ export declare const dateISOSchema: z.ZodString; /** * Validation de rating (note de 1 à 5) */ export declare const ratingSchema: z.ZodNumber; /** * Validation de commentaire */ export declare const commentSchema: z.ZodOptional<z.ZodString>; /** * Validation de code promo */ export declare const promoCodeSchema: z.ZodString; /** * Validation de pourcentage */ export declare const percentageSchema: z.ZodNumber; /** * Fonctions utilitaires de validation */ /** * Valide une adresse email */ export declare function isValidEmail(email: string): boolean; /** * Valide un mot de passe */ export declare function isValidPassword(password: string): boolean; /** * Valide un nom */ export declare function isValidName(name: string): boolean; /** * Valide un prix */ export declare function isValidPrice(price: number): boolean; /** * Valide une quantité */ export declare function isValidQuantity(quantity: number): boolean; /** * Valide un ID Firestore */ export declare function isValidFirestoreId(id: string): boolean; /** * Valide une note */ export declare function isValidRating(rating: number): boolean; /** * Nettoie et valide une chaîne de caractères */ export declare function sanitizeString(input: string): string; /** * Nettoie un nom d'utilisateur */ export declare function sanitizeName(name: string): string; /** * Nettoie un email */ export declare function sanitizeEmail(email: string): string; /** * Valide et formate un prix */ export declare function formatPrice(price: number): number; /** * Valide et limite une chaîne de caractères */ export declare function validateAndTruncate(input: string, maxLength: number): string; /** * Valide un objet selon un schéma Zod et retourne les erreurs formatées */ export declare function validateWithSchema<T>(schema: z.ZodSchema<T>, data: unknown): { success: boolean; data?: T; errors?: Record<string, string>; }; /** * Schémas de validation composés */ /** * Validation de coordonnées GPS */ export declare const coordinatesSchema: z.ZodObject<{ latitude: z.ZodNumber; longitude: z.ZodNumber; }, "strip", z.ZodTypeAny, { latitude: number; longitude: number; }, { latitude: number; longitude: number; }>; /** * Validation d'adresse */ export declare const addressSchema: z.ZodObject<{ street: z.ZodString; city: z.ZodString; postalCode: z.ZodString; country: z.ZodDefault<z.ZodString>; coordinates: z.ZodOptional<z.ZodObject<{ latitude: z.ZodNumber; longitude: z.ZodNumber; }, "strip", z.ZodTypeAny, { latitude: number; longitude: number; }, { latitude: number; longitude: number; }>>; }, "strip", z.ZodTypeAny, { street: string; city: string; postalCode: string; country: string; coordinates?: { latitude: number; longitude: number; } | undefined; }, { street: string; city: string; postalCode: string; country?: string | undefined; coordinates?: { latitude: number; longitude: number; } | undefined; }>; /** * Validation d'informations nutritionnelles */ export declare const nutritionalInfoSchema: z.ZodObject<{ calories: z.ZodNumber; protein: z.ZodNumber; carbs: z.ZodNumber; fat: z.ZodNumber; fiber: z.ZodOptional<z.ZodNumber>; sugar: z.ZodOptional<z.ZodNumber>; sodium: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { calories: number; protein: number; fat: number; carbs: number; fiber?: number | undefined; sodium?: number | undefined; sugar?: number | undefined; }, { calories: number; protein: number; fat: number; carbs: number; fiber?: number | undefined; sodium?: number | undefined; sugar?: number | undefined; }>; export type NutritionalInfo = z.infer<typeof nutritionalInfoSchema>; export type Address = z.infer<typeof addressSchema>; export type Coordinates = z.infer<typeof coordinatesSchema>; //# sourceMappingURL=validation.d.ts.map