Validators

Utilitaires de validation réutilisables dans tous les plugins.

Schemas de base

import { EmailAddressSchema, UrlSchema, UuidIdSchema } from "@plugin-factory/domain";

// Email
EmailAddressSchema.parse("user@example.com"); // OK
EmailAddressSchema.parse("invalid"); // throws ZodError

// URL
UrlSchema.parse("https://example.com"); // OK

// UUID v4
UuidIdSchema.parse("550e8400-e29b-41d4-a716-446655440000"); // OK

Validation de champs communs

import { PersonNameSchema } from "@plugin-factory/domain";

PersonNameSchema.parse("  Leo Brival  "); // "Leo Brival" (trimmed)
PersonNameSchema.parse(""); // throws ZodError

Validation de status

import { validateLeadStage } from "@plugin-factory/domain";

validateLeadStage("LEAD"); // OK
validateLeadStage("INVALID"); // throws ZodError

Previous

← Page précédente

Next

Page suivante →