Home / File/ schema.ts — ui Source File

schema.ts — ui Source File

Architecture documentation for schema.ts, a typescript file in the ui codebase. 1 imports, 0 dependents.

File typescript 1 imports

Entity Profile

Dependency Diagram

graph LR
  473a1f48_2662_a76a_62f0_081eb9ba039d["schema.ts"]
  6802ce19_522d_e5fb_e458_8826d9f6952e["zod"]
  473a1f48_2662_a76a_62f0_081eb9ba039d --> 6802ce19_522d_e5fb_e458_8826d9f6952e
  style 473a1f48_2662_a76a_62f0_081eb9ba039d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { z } from "zod"

export const addons = [
  {
    id: "analytics",
    title: "Analytics",
    description: "Advanced analytics and reporting",
  },
  {
    id: "backup",
    title: "Backup",
    description: "Automated daily backups",
  },
  {
    id: "support",
    title: "Priority Support",
    description: "24/7 premium customer support",
  },
] as const

export const exampleFormSchema = z.object({
  name: z
    .string({
      required_error: "Name is required",
      invalid_type_error: "Name must be a string",
    })
    .min(2, "Name must be at least 2 characters")
    .max(50, "Name must be less than 50 characters")
    .refine((value) => !/\d/.test(value), {
      message: "Name must not contain numbers",
    }),

  email: z
    .string({
      required_error: "Email is required",
    })
    .email("Please enter a valid email address"),

  plan: z
    .string({
      required_error: "Please select a subscription plan",
    })
    .min(1, "Please select a subscription plan")
    .refine((value) => value === "basic" || value === "pro", {
      message: "Invalid plan selection. Please choose Basic or Pro",
    }),

  billingPeriod: z
    .string({
      required_error: "Please select a billing period",
    })
    .min(1, "Please select a billing period"),

  addons: z
    .array(z.string())
    .min(1, "Please select at least one add-on")
    .max(3, "You can select up to 3 add-ons"),

  teamSize: z.number().min(1).max(10),
  emailNotifications: z.boolean({
    required_error: "Please choose email notification preference",
  }),
  comments: z
    .string()
    .min(10, "Comments must be at least 10 characters")
    .max(240, "Comments must not exceed 240 characters"),
  startDate: z
    .date({
      required_error: "Please select a start date",
      invalid_type_error: "Invalid date format",
    })
    .min(new Date(), "Start date cannot be in the past")
    .refine(
      (date) => {
        const now = new Date()
        const oneWeekFromNow = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000)
        return date <= oneWeekFromNow
      },
      {
        message: "Start date must be within the current week",
      }
    ),
  theme: z
    .string({
      required_error: "Please select a theme",
    })
    .min(1, "Please select a theme"),
  password: z
    .string({
      required_error: "Password is required",
    })
    .min(8, "Password must be at least 8 characters")
    .regex(
      /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/,
      "Password must contain at least one uppercase letter, one lowercase letter, and one number"
    ),
})

Dependencies

  • zod

Frequently Asked Questions

What does schema.ts do?
schema.ts is a source file in the ui codebase, written in typescript.
What does schema.ts depend on?
schema.ts imports 1 module(s): zod.
Where is schema.ts in the architecture?
schema.ts is located at apps/v4/app/(internal)/sink/(pages)/schema.ts (directory: apps/v4/app/(internal)/sink/(pages)).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free