code: nextjs,frontends,validate (11 files)

This commit is contained in:
2025-12-25 19:35:12 +00:00
parent deb31a772d
commit fa0a275ca4
11 changed files with 91 additions and 0 deletions
@@ -0,0 +1,39 @@
import type { ComponentHierarchy } from '../types'
import { isPlainObject } from './is-plain-object'
import { isValidUuid } from './is-valid-uuid'
export function validateComponentHierarchyCreate(data: Partial<ComponentHierarchy>): string[] {
const errors: string[] = []
if (!data.pageId) {
errors.push('pageId is required')
} else if (!isValidUuid(data.pageId)) {
errors.push('pageId must be a valid UUID')
}
if (data.parentId !== undefined) {
if (typeof data.parentId !== 'string' || !isValidUuid(data.parentId)) {
errors.push('parentId must be a valid UUID')
}
}
if (!data.componentType) {
errors.push('componentType is required')
} else if (data.componentType.length > 100) {
errors.push('componentType must be 1-100 characters')
}
if (data.order === undefined) {
errors.push('order is required')
} else if (!Number.isInteger(data.order) || data.order < 0) {
errors.push('order must be a non-negative integer')
}
if (data.props === undefined) {
errors.push('props is required')
} else if (!isPlainObject(data.props)) {
errors.push('props must be an object')
}
return errors
}
@@ -0,0 +1,3 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export { Alert, AlertTitle, AlertDescription, type AlertVariant, type AlertProps } from './molecules/Alert'
@@ -0,0 +1,3 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export { Badge, type BadgeProps, type BadgeVariant } from './atoms/Badge'
@@ -0,0 +1,3 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export { Button, type ButtonProps, type ButtonVariant, type ButtonSize } from './atoms/Button'
@@ -0,0 +1,3 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from './molecules/Card'
@@ -0,0 +1,14 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
} from './molecules/Dialog'
@@ -0,0 +1,3 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export { Input, type InputProps } from './atoms/Input'
@@ -0,0 +1,3 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export { Label, type LabelProps } from './atoms/Label'
@@ -0,0 +1,14 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectScrollDownButton,
SelectScrollUpButton,
SelectSeparator,
SelectTrigger,
SelectValue,
} from './molecules/Select'
@@ -0,0 +1,3 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export { Separator, type SeparatorProps } from './atoms/Separator'
@@ -0,0 +1,3 @@
// Re-export for backward compatibility
// TODO: Update imports to use @/components/ui directly
export { Tabs, TabsList, TabsTrigger, TabsContent } from './molecules/Tabs'