mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 06:14:59 +00:00
code: nextjs,frontends,validate (14 files)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import type { ComponentHierarchy } from '../types'
|
||||
import { isPlainObject } from './is-plain-object'
|
||||
import { isValidUuid } from './is-valid-uuid'
|
||||
|
||||
export function validateComponentHierarchyUpdate(data: Partial<ComponentHierarchy>): string[] {
|
||||
const errors: string[] = []
|
||||
|
||||
if (data.pageId !== undefined) {
|
||||
if (typeof data.pageId !== 'string' || !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 !== undefined) {
|
||||
if (typeof data.componentType !== 'string' || data.componentType.length === 0 || data.componentType.length > 100) {
|
||||
errors.push('componentType must be 1-100 characters')
|
||||
}
|
||||
}
|
||||
|
||||
if (data.order !== undefined) {
|
||||
if (!Number.isInteger(data.order) || data.order < 0) {
|
||||
errors.push('order must be a non-negative integer')
|
||||
}
|
||||
}
|
||||
|
||||
if (data.props !== undefined && !isPlainObject(data.props)) {
|
||||
errors.push('props must be an object')
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
26
dbal/ts/src/core/validation/validate-credential-create.ts
Normal file
26
dbal/ts/src/core/validation/validate-credential-create.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { Credential } from '../types'
|
||||
import { isValidUsername } from './is-valid-username'
|
||||
|
||||
export function validateCredentialCreate(data: Partial<Credential>): string[] {
|
||||
const errors: string[] = []
|
||||
|
||||
if (!data.username) {
|
||||
errors.push('username is required')
|
||||
} else if (!isValidUsername(data.username)) {
|
||||
errors.push('username must be 3-50 characters (alphanumeric, underscore, hyphen)')
|
||||
}
|
||||
|
||||
if (!data.passwordHash) {
|
||||
errors.push('passwordHash is required')
|
||||
} else if (typeof data.passwordHash !== 'string' || data.passwordHash.trim().length === 0) {
|
||||
errors.push('passwordHash must be a non-empty string')
|
||||
}
|
||||
|
||||
if (data.firstLogin === undefined) {
|
||||
errors.push('firstLogin is required')
|
||||
} else if (typeof data.firstLogin !== 'boolean') {
|
||||
errors.push('firstLogin must be a boolean')
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
13
frontends/nextjs/src/components/ui/alert-dialog.ts
Normal file
13
frontends/nextjs/src/components/ui/alert-dialog.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export {
|
||||
AlertDialog,
|
||||
AlertDialogTrigger,
|
||||
AlertDialogContent,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogCancel,
|
||||
AlertDialogAction,
|
||||
} from './organisms/AlertDialog'
|
||||
3
frontends/nextjs/src/components/ui/avatar.ts
Normal file
3
frontends/nextjs/src/components/ui/avatar.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export { Avatar, AvatarImage, AvatarFallback, type AvatarProps } from './atoms/Avatar'
|
||||
3
frontends/nextjs/src/components/ui/checkbox.ts
Normal file
3
frontends/nextjs/src/components/ui/checkbox.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export { Checkbox, type CheckboxProps } from './atoms/Checkbox'
|
||||
19
frontends/nextjs/src/components/ui/dropdown-menu.ts
Normal file
19
frontends/nextjs/src/components/ui/dropdown-menu.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export {
|
||||
DropdownMenu,
|
||||
DropdownMenuTrigger,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuShortcut,
|
||||
DropdownMenuGroup,
|
||||
DropdownMenuPortal,
|
||||
DropdownMenuSub,
|
||||
DropdownMenuSubContent,
|
||||
DropdownMenuSubTrigger,
|
||||
DropdownMenuCheckboxItem,
|
||||
DropdownMenuRadioGroup,
|
||||
DropdownMenuRadioItem,
|
||||
} from './molecules/DropdownMenu'
|
||||
3
frontends/nextjs/src/components/ui/progress.ts
Normal file
3
frontends/nextjs/src/components/ui/progress.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export { Progress, type ProgressProps } from './atoms/Progress'
|
||||
3
frontends/nextjs/src/components/ui/radio-group.ts
Normal file
3
frontends/nextjs/src/components/ui/radio-group.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export { RadioGroup, RadioGroupItem } from './molecules/RadioGroup'
|
||||
12
frontends/nextjs/src/components/ui/sheet.ts
Normal file
12
frontends/nextjs/src/components/ui/sheet.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export {
|
||||
Sheet,
|
||||
SheetTrigger,
|
||||
SheetContent,
|
||||
SheetHeader,
|
||||
SheetFooter,
|
||||
SheetTitle,
|
||||
SheetDescription,
|
||||
SheetClose,
|
||||
} from './organisms/Sheet'
|
||||
3
frontends/nextjs/src/components/ui/skeleton.ts
Normal file
3
frontends/nextjs/src/components/ui/skeleton.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export { Skeleton, type SkeletonProps } from './atoms/Skeleton'
|
||||
3
frontends/nextjs/src/components/ui/slider.ts
Normal file
3
frontends/nextjs/src/components/ui/slider.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export { Slider, type SliderProps } from './atoms/Slider'
|
||||
3
frontends/nextjs/src/components/ui/switch.ts
Normal file
3
frontends/nextjs/src/components/ui/switch.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export { Switch, type SwitchProps } from './atoms/Switch'
|
||||
3
frontends/nextjs/src/components/ui/table.ts
Normal file
3
frontends/nextjs/src/components/ui/table.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption } from './organisms/Table'
|
||||
3
frontends/nextjs/src/components/ui/textarea.ts
Normal file
3
frontends/nextjs/src/components/ui/textarea.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export for backward compatibility
|
||||
// TODO: Update imports to use @/components/ui directly
|
||||
export { Textarea, type TextareaProps } from './atoms/Textarea'
|
||||
Reference in New Issue
Block a user