This commit is contained in:
Saxon Fletcher committed 2025-08-04 15:50:15 +10:00
1 parent ff18607587
commit ec39bac6b6
142 files changed
+480 -464

No files matched your search

@@ -5,7 +5,7 @@ import { format } from 'date-fns'
import { CalendarIcon } from 'lucide-react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { cn } from '@/lib/utils'
import {
@@ -25,8 +25,8 @@ import {
const FormSchema = z.object({
dob: z.date({
required_error: 'A date of birth is required.',
}),
error: (issue) => issue.input === undefined ? 'A date of birth is required.' : undefined
}),
})
export default function CalendarForm() {
@@ -5,7 +5,7 @@ import { format } from 'date-fns'
import { CalendarIcon } from 'lucide-react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { cn } from '@/lib/utils'
import {
@@ -25,8 +25,8 @@ import {
const FormSchema = z.object({
dob: z.date({
required_error: 'A date of birth is required.',
}),
error: (issue) => issue.input === undefined ? 'A date of birth is required.' : undefined
}),
})
export default function CalendarForm() {
@@ -3,7 +3,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -46,8 +46,8 @@ const items = [
const FormSchema = z.object({
items: z.array(z.string()).refine((value) => value.some((item) => item), {
message: 'You have to select at least one item.',
}),
error: 'You have to select at least one item.'
}),
})
export default function CheckboxReactHookFormMultiple() {
@@ -4,7 +4,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
import Link from 'next/link'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -18,7 +18,7 @@ import {
} from 'ui'
const FormSchema = z.object({
mobile: z.boolean().default(false).optional(),
mobile: z.boolean().prefault(false).optional(),
})
export default function CheckboxReactHookFormSingle() {
@@ -4,7 +4,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { Check, ChevronsUpDown } from 'lucide-react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { cn } from '@/lib/utils'
import {
@@ -43,8 +43,8 @@ const languages = [
const FormSchema = z.object({
language: z.string({
required_error: 'Please select a language.',
}),
error: (issue) => issue.input === undefined ? 'Please select a language.' : undefined
}),
})
export default function ComboboxForm() {
@@ -5,7 +5,7 @@ import { format } from 'date-fns'
import { CalendarIcon } from 'lucide-react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { cn } from '@/lib/utils'
import {
@@ -25,8 +25,8 @@ import {
const FormSchema = z.object({
dob: z.date({
required_error: 'A date of birth is required.',
}),
error: (issue) => issue.input === undefined ? 'A date of birth is required.' : undefined
}),
})
export default function DatePickerForm() {
@@ -4,7 +4,7 @@ import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_, Switch }
import { Input } from 'ui-patterns/DataInputs/Input'
import { InfoTooltip } from 'ui-patterns/info-tooltip'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { z } from 'zod'
import { z } from 'zod/v4'
const FormSchema = z.object({
functionName: z.string(),
@@ -4,7 +4,7 @@ import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_, Switch }
import { Input } from 'ui-patterns/DataInputs/Input'
import { InfoTooltip } from 'ui-patterns/info-tooltip'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { z } from 'zod'
import { z } from 'zod/v4'
const FormSchema = z.object({
functionName: z.string(),
@@ -1,14 +1,14 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_ } from 'ui'
import { z } from 'zod'
import { z } from 'zod/v4'
import { Input } from 'ui-patterns/DataInputs/Input'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
const formSchema = z.object({
username: z.string().min(2, {
message: 'Username must be at least 2 characters.',
}),
error: 'Username must be at least 2 characters.'
}),
})
export default function FormItemLayoutDemo() {
@@ -2,12 +2,12 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { Button, Checkbox_Shadcn_, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_ } from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { z } from 'zod'
import { z } from 'zod/v4'
const FormSchema = z.object({
items: z.array(z.string()).refine((value) => value.some((item) => item), {
message: 'You have to select at least one item.',
}),
error: 'You have to select at least one item.'
}),
})
const items = [
@@ -9,10 +9,10 @@ import {
FormField_Shadcn_,
} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { z } from 'zod'
import { z } from 'zod/v4'
const FormSchema = z.object({
consistent_settings: z.boolean().default(false).optional(),
consistent_settings: z.boolean().prefault(false).optional(),
})
export default function FormItemLayoutDemo() {
@@ -1,14 +1,14 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_, Separator } from 'ui'
import { z } from 'zod'
import { z } from 'zod/v4'
import { Input } from 'ui-patterns/DataInputs/Input'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
const formSchema = z.object({
username: z.string().min(2, {
message: 'Username must be at least 2 characters.',
}),
error: 'Username must be at least 2 characters.'
}),
})
export default function FormItemLayoutDemo() {
@@ -12,14 +12,12 @@ import {
SelectValue_Shadcn_,
} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { z } from 'zod'
import { z } from 'zod/v4'
const FormSchema = z.object({
email: z
.string({
required_error: 'Please select an email to display.',
})
.email(),
email: z.email({
error: (issue) => issue.input === undefined ? 'Please select an email to display.' : undefined
}),
})
export default function FormItemLayoutDemo() {
@@ -2,10 +2,10 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_, Switch } from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { z } from 'zod'
import { z } from 'zod/v4'
const FormSchema = z.object({
switch_option: z.boolean().default(false).optional(),
switch_option: z.boolean().prefault(false).optional(),
})
export default function FormItemLayoutDemo() {
@@ -3,7 +3,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -19,8 +19,8 @@ import {
const FormSchema = z.object({
username: z.string().min(2, {
message: 'Username must be at least 2 characters.',
}),
error: 'Username must be at least 2 characters.'
}),
})
export default function InputForm() {
@@ -3,7 +3,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -21,8 +21,8 @@ import {
const FormSchema = z.object({
pin: z.string().min(6, {
message: 'Your one-time password must be 6 characters.',
}),
error: 'Your one-time password must be 6 characters.'
}),
})
export default function InputOTPForm() {
@@ -3,7 +3,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -19,8 +19,8 @@ import {
const FormSchema = z.object({
type: z.enum(['all', 'mentions', 'none'], {
required_error: 'You need to select a notification type.',
}),
error: (issue) => issue.input === undefined ? 'You need to select a notification type.' : undefined
}),
})
export default function RadioGroupForm() {
@@ -3,7 +3,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -19,8 +19,8 @@ import {
const FormSchema = z.object({
type: z.enum(['all', 'mentions', 'none'], {
required_error: 'You need to select a notification type.',
}),
error: (issue) => issue.input === undefined ? 'You need to select a notification type.' : undefined
}),
})
export default function RadioGroupForm() {
@@ -3,7 +3,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -19,8 +19,8 @@ import {
const FormSchema = z.object({
type: z.enum(['all', 'mentions', 'none'], {
required_error: 'You need to select a notification type.',
}),
error: (issue) => issue.input === undefined ? 'You need to select a notification type.' : undefined
}),
})
export default function RadioGroupForm() {
@@ -4,7 +4,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
import Link from 'next/link'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -23,11 +23,9 @@ import {
} from 'ui'
const FormSchema = z.object({
email: z
.string({
required_error: 'Please select an email to display.',
})
.email(),
email: z.email({
error: (issue) => issue.input === undefined ? 'Please select an email to display.' : undefined
}),
})
export default function SelectForm() {
@@ -3,7 +3,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -17,7 +17,7 @@ import {
} from 'ui'
const FormSchema = z.object({
marketing_emails: z.boolean().default(false).optional(),
marketing_emails: z.boolean().prefault(false).optional(),
security_emails: z.boolean(),
})
@@ -3,7 +3,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import {
Button,
@@ -21,10 +21,10 @@ const FormSchema = z.object({
bio: z
.string()
.min(10, {
message: 'Bio must be at least 10 characters.',
error: 'Bio must be at least 10 characters.'
})
.max(160, {
message: 'Bio must not be longer than 30 characters.',
error: 'Bio must not be longer than 30 characters.'
}),
})
+1 -1
View File
@@ -1,4 +1,4 @@
import { z } from 'zod'
import { z } from 'zod/v4'
export const blockChunkSchema = z.object({
name: z.string(),
+2 -2
View File
@@ -2,7 +2,7 @@ import * as Sentry from '@sentry/nextjs'
import { type DocumentNode, graphql, GraphQLError, parse, specifiedRules, validate } from 'graphql'
import { createComplexityLimitRule } from 'graphql-validation-complexity'
import { NextResponse } from 'next/server'
import { z } from 'zod'
import { z } from 'zod/v4'
import { ApiError, convertZodToInvalidRequestError, InvalidRequestError } from '~/app/api/utils'
import { BASE_PATH, IS_DEV } from '~/lib/constants'
import { sendToLogflare, LOGGING_CODES } from '~/lib/logger'
@@ -85,7 +85,7 @@ function isDevGraphiQL(request: Request) {
const graphQLRequestSchema = z.object({
query: z.string(),
variables: z.record(z.any()).optional(),
variables: z.record(z.string(), z.any()).optional(),
operationName: z.string().optional(),
})
+1 -1
View File
@@ -3,7 +3,7 @@ import { type Database } from 'common'
import { revalidateTag } from 'next/cache'
import { headers } from 'next/headers'
import { type NextRequest } from 'next/server'
import { z } from 'zod'
import { z } from 'zod/v4'
import { VALID_REVALIDATION_TAGS } from '~/features/helpers.fetch'
enum AuthorizationLevel {
+1 -1
View File
@@ -1,5 +1,5 @@
import { type PostgrestError } from '@supabase/supabase-js'
import { type ZodError } from 'zod'
import { type ZodError } from 'zod/v4'
import { isObject } from '~/features/helpers.misc'
type ObjectOrNever = object | never
+10 -9
View File
@@ -37,7 +37,7 @@ import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
import { type Parent } from 'unist'
import { visitParents } from 'unist-util-visit-parents'
import { z, type SafeParseError } from 'zod'
import { z, type SafeParseError } from 'zod/v4'
import { fetchWithNextOptions } from '~/features/helpers.fetch'
import { IS_PLATFORM } from '~/lib/constants'
@@ -49,16 +49,17 @@ const ALLOW_LISTED_GITHUB_ORGS = ['supabase', 'supabase-community'] as [string,
const linesSchema = z.array(z.tuple([z.coerce.number(), z.coerce.number()]))
const linesValidator = z
.string()
.default('[[1, -1]]')
.prefault('[[1, -1]]')
.transform((v, ctx) => {
try {
const array = JSON.parse(v)
return linesSchema.parse(array)
} catch (e) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Lines should be an array of [number, number] tuples',
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: 'Lines should be an array of [number, number] tuples',
input: ''
})
return z.NEVER
}
})
@@ -72,14 +73,14 @@ type AdditionalMeta = {
const codeSampleExternalSchema = z.object({
external: z.coerce.boolean().refine((v) => v === true),
org: z.enum(ALLOW_LISTED_GITHUB_ORGS, {
errorMap: () => ({ message: 'Org must be one of: ' + ALLOW_LISTED_GITHUB_ORGS.join(', ') }),
error: () => 'Org must be one of: ' + ALLOW_LISTED_GITHUB_ORGS.join(', '),
}),
repo: z.string(),
commit: z.string(),
path: z.string().transform((v) => (v.startsWith('/') ? v : `/${v}`)),
lines: linesValidator,
meta: z.string().optional(),
hideElidedLines: z.coerce.boolean().default(false),
hideElidedLines: z.coerce.boolean().prefault(false),
})
type ICodeSampleExternal = z.infer<typeof codeSampleExternalSchema> & AdditionalMeta
@@ -91,7 +92,7 @@ const codeSampleInternalSchema = z.object({
path: z.string().transform((v) => (v.startsWith('/') ? v : `/${v}`)),
lines: linesValidator,
meta: z.string().optional(),
hideElidedLines: z.coerce.boolean().default(false),
hideElidedLines: z.coerce.boolean().prefault(false),
})
type ICodeSampleInternal = z.infer<typeof codeSampleInternalSchema> & AdditionalMeta
@@ -1,5 +1,5 @@
import { cache } from 'react'
import { z } from 'zod'
import { z } from 'zod/v4'
import { cache_fullProcess_withDevCacheBust } from '~/features/helpers.fs'
import { IS_PLATFORM } from '~/lib/constants'
@@ -18,7 +18,7 @@ import {
Input_Shadcn_,
} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useAPIKeyCreateMutation } from 'data/api-keys/api-key-create-mutation'
import { useParams } from 'next/navigation'
@@ -22,7 +22,7 @@ import {
AlertTitle_Shadcn_,
} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import * as z from 'zod'
import * as z from 'zod/v4'
import { toast } from 'sonner'
import { useParams } from 'common'
@@ -4,7 +4,7 @@ import Link from 'next/link'
import { useState } from 'react'
import { type SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { useAccessTokenCreateMutation } from 'data/access-tokens/access-tokens-create-mutation'
import {
@@ -3,7 +3,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { useRef, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { InlineLink } from 'components/ui/InlineLink'
import { useEmailUpdateMutation } from 'data/profile/profile-update-email-mutation'
@@ -3,7 +3,7 @@ import { SupportCategories } from '@supabase/shared-types/out/constants'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useSendSupportTicketMutation } from 'data/feedback/support-ticket-send'
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
@@ -10,7 +10,7 @@ import {
Form_Shadcn_,
Input_Shadcn_,
} from 'ui'
import z from 'zod'
import z from 'zod/v4'
import { FormActions } from 'components/ui/Forms/FormActions'
import Panel from 'components/ui/Panel'
@@ -3,7 +3,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { useEffect } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useLintRuleCreateMutation } from 'data/lint/create-lint-rule-mutation'
@@ -3,7 +3,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'
@@ -5,7 +5,7 @@ import { useEffect, useMemo } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import ReactMarkdown from 'react-markdown'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { convertArgumentTypes } from 'components/interfaces/Database/Functions/Functions.utils'
@@ -74,34 +74,38 @@ const FormSchema = z
.superRefine((data, ctx) => {
if (data.selectedType === 'https') {
if (!data.httpsValues.url.startsWith('https://')) {
ctx.addIssue({
path: ['httpsValues', 'url'],
code: z.ZodIssueCode.custom,
message: 'The URL must start with https://',
})
ctx.issues.push({
path: ['httpsValues', 'url'],
code: z.ZodIssueCode.custom,
message: 'The URL must start with https://',
input: ''
})
}
if (!data.httpsValues.secret) {
ctx.addIssue({
path: ['httpsValues', 'secret'],
code: z.ZodIssueCode.custom,
message: 'Missing secret value',
})
ctx.issues.push({
path: ['httpsValues', 'secret'],
code: z.ZodIssueCode.custom,
message: 'Missing secret value',
input: ''
})
}
}
if (data.selectedType === 'postgres') {
if (!data.postgresValues.schema) {
ctx.addIssue({
path: ['postgresValues', 'schema'],
code: z.ZodIssueCode.custom,
message: 'You must select a schema',
})
ctx.issues.push({
path: ['postgresValues', 'schema'],
code: z.ZodIssueCode.custom,
message: 'You must select a schema',
input: ''
})
}
if (!data.postgresValues.functionName) {
ctx.addIssue({
path: ['postgresValues', 'functionName'],
code: z.ZodIssueCode.custom,
message: 'You must select a Postgres function',
})
ctx.issues.push({
path: ['postgresValues', 'functionName'],
code: z.ZodIssueCode.custom,
message: 'You must select a Postgres function',
input: ''
})
}
}
return true
@@ -7,7 +7,7 @@ import { isEqual } from 'lodash'
import { memo, useEffect, useRef, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { IStandaloneCodeEditor } from 'components/interfaces/SQLEditor/SQLEditor.types'
@@ -4,7 +4,7 @@ import Link from 'next/link'
import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { ScaffoldSection } from 'components/layouts/Scaffold'
@@ -3,7 +3,7 @@ import { Plus, Trash } from 'lucide-react'
import { useEffect } from 'react'
import { useFieldArray, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'
@@ -3,7 +3,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'
@@ -3,7 +3,7 @@ import { Trash } from 'lucide-react'
import { useEffect } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useCreateThirdPartyAuthIntegrationMutation } from 'data/third-party-auth/integration-create-mutation'
@@ -3,7 +3,7 @@ import { Trash } from 'lucide-react'
import { useEffect } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useCreateThirdPartyAuthIntegrationMutation } from 'data/third-party-auth/integration-create-mutation'
@@ -3,7 +3,7 @@ import { Trash } from 'lucide-react'
import { useEffect } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useCreateThirdPartyAuthIntegrationMutation } from 'data/third-party-auth/integration-create-mutation'
@@ -44,13 +44,14 @@ const FormSchema = z
!val.domain.match(/https:\/\/clerk([.][a-z0-9-]+){2,}\/?/) &&
!val.domain.match(/https:\/\/[a-z0-9-]+[.]clerk[.]accounts[.]dev\/?$/)
) {
ctx.addIssue({
code: z.ZodIssueCode.invalid_string,
path: ['domain'],
message:
'Production Clerk domains use HTTPS and start with the clerk subdomain (https://clerk.example.com). Development Clerk domains use HTTPS and end with .clerk.accounts.dev (https://example.clerk.accounts.dev).',
validation: 'regex',
})
ctx.issues.push({
code: z.ZodIssueCode.invalid_string,
path: ['domain'],
message:
'Production Clerk domains use HTTPS and start with the clerk subdomain (https://clerk.example.com). Development Clerk domains use HTTPS and end with .clerk.accounts.dev (https://example.clerk.accounts.dev).',
validation: 'regex',
input: ''
})
}
})
@@ -3,7 +3,7 @@ import { Trash } from 'lucide-react'
import { useEffect } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useCreateThirdPartyAuthIntegrationMutation } from 'data/third-party-auth/integration-create-mutation'
@@ -3,7 +3,7 @@ import { Trash } from 'lucide-react'
import { useEffect } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useCreateThirdPartyAuthIntegrationMutation } from 'data/third-party-auth/integration-create-mutation'
@@ -3,7 +3,7 @@ import dayjs from 'dayjs'
import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useUserUpdateMutation } from 'data/auth/user-update-mutation'
@@ -3,7 +3,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { Lock, Mail } from 'lucide-react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useUserCreateMutation } from 'data/auth/user-create-mutation'
@@ -7,7 +7,7 @@ import { useRouter } from 'next/router'
import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useIsBranching2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
@@ -155,11 +155,12 @@ export const CreateBranchModal = () => {
})
// valid – no issues added
} catch (error) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Unable to find branch "${val.gitBranchName}" in ${repoOwner}/${repoName}`,
path: ['gitBranchName'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Unable to find branch "${val.gitBranchName}" in ${repoOwner}/${repoName}`,
path: ['gitBranchName'],
input: ''
})
}
}
})
@@ -5,7 +5,7 @@ import Link from 'next/link'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import AlertError from 'components/ui/AlertError'
@@ -120,11 +120,12 @@ export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalPro
setIsGitBranchValid(true)
} catch (error) {
setIsGitBranchValid(false)
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Unable to find branch "${val.gitBranchName}" in ${repoOwner}/${repoName}`,
path: ['gitBranchName'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Unable to find branch "${val.gitBranchName}" in ${repoOwner}/${repoName}`,
path: ['gitBranchName'],
input: ''
})
}
} else {
// If git branch is empty or removed, it's valid for gitless branching
@@ -3,7 +3,7 @@ import { debounce } from 'lodash'
import { useRef, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import PasswordStrengthBar from 'components/ui/PasswordStrengthBar'
@@ -20,7 +20,7 @@ import {
SidePanel,
cn,
} from 'ui'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import { useEnumeratedTypeCreateMutation } from 'data/enumerated-types/enumerated-type-create-mutation'
@@ -19,7 +19,7 @@ import {
SidePanel,
cn,
} from 'ui'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import { useEnumeratedTypeUpdateMutation } from 'data/enumerated-types/enumerated-type-update-mutation'
@@ -4,7 +4,7 @@ import { Plus, Trash } from 'lucide-react'
import { useEffect, useMemo, useState } from 'react'
import { SubmitHandler, useFieldArray, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import z from 'zod/v4'
import { POSTGRES_DATA_TYPES } from 'components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.constants'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
@@ -35,7 +35,7 @@ import {
WarningIcon,
Label_Shadcn_ as Label,
} from 'ui'
import * as z from 'zod'
import * as z from 'zod/v4'
import PublicationsComboBox from './PublicationsComboBox'
import NewPublicationPanel from './NewPublicationPanel'
import { useState, useMemo, useEffect } from 'react'
@@ -23,7 +23,7 @@ import {
} from 'ui'
import { MultiSelector } from 'ui-patterns/multi-select'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { z } from 'zod'
import { z } from 'zod/v4'
interface NewPublicationPanelProps {
visible: boolean
@@ -1,7 +1,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import z from 'zod/v4'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import { FormActions } from 'components/ui/Forms/FormActions'
@@ -25,13 +25,13 @@ interface CreateRolePanelProps {
}
const FormSchema = z.object({
name: z.string().trim().min(1, 'You must provide a name').default(''),
isSuperuser: z.boolean().default(false),
canLogin: z.boolean().default(false),
canCreateRole: z.boolean().default(false),
canCreateDb: z.boolean().default(false),
isReplicationRole: z.boolean().default(false),
canBypassRls: z.boolean().default(false),
name: z.string().trim().min(1, 'You must provide a name').prefault(''),
isSuperuser: z.boolean().prefault(false),
canLogin: z.boolean().prefault(false),
canCreateRole: z.boolean().prefault(false),
canCreateDb: z.boolean().prefault(false),
isReplicationRole: z.boolean().prefault(false),
canBypassRls: z.boolean().prefault(false),
})
const initialValues = {
@@ -3,7 +3,7 @@ import { Terminal } from 'lucide-react'
import { useEffect, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { PostgresTrigger } from '@supabase/postgres-meta'
import FormBoxEmpty from 'components/ui/FormBoxEmpty'
@@ -1,4 +1,4 @@
import { z } from 'zod'
import { z } from 'zod/v4'
import { ComputeInstanceAddonVariantId } from './DiskManagement.types'
import {
calculateDiskSizeRequiredForIopsWithGp3,
@@ -13,29 +13,23 @@ import { CloudProvider } from 'shared-data'
const baseSchema = z.object({
storageType: z.enum(['io2', 'gp3']).describe('Type of storage: io2 or gp3'),
totalSize: z.number().int('Value must be an integer').describe('Allocated disk size in GB'),
totalSize: z.int().describe('Allocated disk size in GB'),
provisionedIOPS: z.number().describe('Provisioned IOPS for storage type'),
throughput: z.number().optional().describe('Throughput in MB/s for gp3'),
computeSize: z
.custom<ComputeInstanceAddonVariantId>((val): val is ComputeInstanceAddonVariantId => true)
.describe('Compute size'),
growthPercent: z
.number()
.int('Value must be an integer')
growthPercent: z.int()
.min(10, 'Growth percent must be at least 10%')
.max(100, 'Growth percent cannot exceed 100%')
.optional()
.nullable(),
minIncrementGb: z
.number()
.int('Value must be an integer')
minIncrementGb: z.int()
.min(1, 'Minimum increment must be at least 1 GB')
.max(200, 'Minimum increment cannot exceed 200 GB')
.optional()
.nullable(),
maxSizeGb: z
.number()
.int('Value must be an integer')
maxSizeGb: z.int()
.max(60000, 'Maximum size cannot exceed 60TB')
.optional()
.nullable(),
@@ -48,84 +42,93 @@ export const CreateDiskStorageSchema = (defaultTotalSize: number, cloudProvider:
const { storageType, totalSize, provisionedIOPS, throughput, maxSizeGb } = data
if (!isFlyProject && totalSize < 8) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Allocated disk size must be at least 8 GB.',
path: ['totalSize'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: 'Allocated disk size must be at least 8 GB.',
path: ['totalSize'],
input: ''
})
}
if (!isFlyProject && totalSize < defaultTotalSize) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Disk size cannot be reduced in size. Reduce your database size and then head to the Infrastructure settings and go through a Postgres version upgrade to right-size your disk.`,
path: ['totalSize'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Disk size cannot be reduced in size. Reduce your database size and then head to the Infrastructure settings and go through a Postgres version upgrade to right-size your disk.`,
path: ['totalSize'],
input: ''
})
}
// Validate maxSizeGb cannot be lower than totalSize
if (!isFlyProject && !!maxSizeGb && maxSizeGb < totalSize) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Max disk size cannot be lower than the current disk size. Must be at least ${formatNumber(totalSize)} GB.`,
path: ['maxSizeGb'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Max disk size cannot be lower than the current disk size. Must be at least ${formatNumber(totalSize)} GB.`,
path: ['maxSizeGb'],
input: ''
})
}
if (!isFlyProject && storageType === 'io2') {
// Validation rules for io2
if (provisionedIOPS > DISK_LIMITS[DiskType.IO2].maxIops) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `IOPS can not exceed ${formatNumber(DISK_LIMITS[DiskType.IO2].maxIops)} for io2 Disk type. Please reach out to support if you need higher IOPS than this.`,
path: ['provisionedIOPS'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `IOPS can not exceed ${formatNumber(DISK_LIMITS[DiskType.IO2].maxIops)} for io2 Disk type. Please reach out to support if you need higher IOPS than this.`,
path: ['provisionedIOPS'],
input: ''
})
}
const maxIOPSforDiskSizeWithio2 = calculateMaxIopsAllowedForDiskSizeWithio2(totalSize)
if (provisionedIOPS < DISK_LIMITS[DiskType.IO2].minIops) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Provisioned IOPS must be at least ${formatNumber(DISK_LIMITS[DiskType.IO2].minIops)}`,
path: ['provisionedIOPS'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Provisioned IOPS must be at least ${formatNumber(DISK_LIMITS[DiskType.IO2].minIops)}`,
path: ['provisionedIOPS'],
input: ''
})
} else if (provisionedIOPS > maxIOPSforDiskSizeWithio2) {
if (totalSize >= 8) {
const diskSizeRequiredForIopsWithIo2 =
calculateDiskSizeRequiredForIopsWithIo2(provisionedIOPS)
if (diskSizeRequiredForIopsWithIo2 > totalSize) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Larger Disk size of at least ${formatNumber(diskSizeRequiredForIopsWithIo2)} GB required. Current max is ${formatNumber(maxIOPSforDiskSizeWithio2)} IOPS.`,
path: ['provisionedIOPS'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Larger Disk size of at least ${formatNumber(diskSizeRequiredForIopsWithIo2)} GB required. Current max is ${formatNumber(maxIOPSforDiskSizeWithio2)} IOPS.`,
path: ['provisionedIOPS'],
input: ''
})
}
} else {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Invalid IOPS value due to small disk size`,
path: ['provisionedIOPS'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Invalid IOPS value due to small disk size`,
path: ['provisionedIOPS'],
input: ''
})
}
}
if (throughput !== undefined) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Throughput is not configurable for io2.',
path: ['throughput'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: 'Throughput is not configurable for io2.',
path: ['throughput'],
input: ''
})
}
if (totalSize > DISK_LIMITS[DiskType.IO2].maxStorage) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Allocated disksize must not exceed ${formatNumber(DISK_LIMITS[DiskType.IO2].maxStorage)} GB `,
path: ['totalSize'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Allocated disksize must not exceed ${formatNumber(DISK_LIMITS[DiskType.IO2].maxStorage)} GB `,
path: ['totalSize'],
input: ''
})
}
}
@@ -133,35 +136,39 @@ export const CreateDiskStorageSchema = (defaultTotalSize: number, cloudProvider:
const maxIopsAllowedForDiskSizeWithGp3 = calculateMaxIopsAllowedForDiskSizeWithGp3(totalSize)
if (provisionedIOPS > DISK_LIMITS[DiskType.GP3].maxIops) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `IOPS can not exceed ${formatNumber(DISK_LIMITS[DiskType.GP3].maxIops)} for GP3 Disk. Change the Disk type to io2 for higher IOPS support.`,
path: ['provisionedIOPS'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `IOPS can not exceed ${formatNumber(DISK_LIMITS[DiskType.GP3].maxIops)} for GP3 Disk. Change the Disk type to io2 for higher IOPS support.`,
path: ['provisionedIOPS'],
input: ''
})
}
if (provisionedIOPS < DISK_LIMITS[DiskType.GP3].minIops) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `IOPS must be at least ${formatNumber(DISK_LIMITS[DiskType.GP3].minIops)}`,
path: ['provisionedIOPS'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `IOPS must be at least ${formatNumber(DISK_LIMITS[DiskType.GP3].minIops)}`,
path: ['provisionedIOPS'],
input: ''
})
} else if (provisionedIOPS > maxIopsAllowedForDiskSizeWithGp3) {
if (totalSize >= 8) {
const diskSizeRequiredForIopsWithGp3 =
calculateDiskSizeRequiredForIopsWithGp3(provisionedIOPS)
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Larger Disk size of at least ${formatNumber(diskSizeRequiredForIopsWithGp3)} GB required. Current max is ${formatNumber(maxIopsAllowedForDiskSizeWithGp3)} IOPS.`,
path: ['provisionedIOPS'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Larger Disk size of at least ${formatNumber(diskSizeRequiredForIopsWithGp3)} GB required. Current max is ${formatNumber(maxIopsAllowedForDiskSizeWithGp3)} IOPS.`,
path: ['provisionedIOPS'],
input: ''
})
} else {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Invalid IOPS value due to invalid disk size`,
path: ['provisionedIOPS'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Invalid IOPS value due to invalid disk size`,
path: ['provisionedIOPS'],
input: ''
})
}
}
@@ -169,35 +176,39 @@ export const CreateDiskStorageSchema = (defaultTotalSize: number, cloudProvider:
const maxThroughput = Math.min(0.25 * provisionedIOPS, 1000)
if (throughput > DISK_LIMITS['gp3'].maxThroughput) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Throughput can not exceed ${formatNumber(maxThroughput)} MB/s`,
path: ['throughput'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Throughput can not exceed ${formatNumber(maxThroughput)} MB/s`,
path: ['throughput'],
input: ''
})
}
if (throughput > maxThroughput) {
const iopsRequiredForThroughput = calculateIopsRequiredForThroughput(throughput)
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Need at least ${formatNumber(iopsRequiredForThroughput)} IOPS to support ${formatNumber(throughput)} MB/s.`,
path: ['throughput'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Need at least ${formatNumber(iopsRequiredForThroughput)} IOPS to support ${formatNumber(throughput)} MB/s.`,
path: ['throughput'],
input: ''
})
}
if (throughput < DISK_LIMITS[DiskType.GP3].minThroughput) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Throughput must be at least ${formatNumber(DISK_LIMITS[DiskType.GP3].minThroughput)} MB/s`,
path: ['throughput'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Throughput must be at least ${formatNumber(DISK_LIMITS[DiskType.GP3].minThroughput)} MB/s`,
path: ['throughput'],
input: ''
})
}
}
if (totalSize > DISK_LIMITS[DiskType.GP3].maxStorage) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Allocated disksize must not exceed ${formatNumber(DISK_LIMITS[DiskType.GP3].maxStorage)} GB`,
path: ['totalSize'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Allocated disksize must not exceed ${formatNumber(DISK_LIMITS[DiskType.GP3].maxStorage)} GB`,
path: ['totalSize'],
input: ''
})
}
}
})
@@ -7,7 +7,7 @@ import { useRouter } from 'next/router'
import { useEffect, useMemo, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import z from 'zod/v4'
import { useParams } from 'common'
import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'
@@ -2,7 +2,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { Loader2, Plus, Send, X } from 'lucide-react'
import { useState } from 'react'
import { useFieldArray, useForm } from 'react-hook-form'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { RoleImpersonationPopover } from 'components/interfaces/RoleImpersonationSelector'
@@ -2,7 +2,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { useState } from 'react'
import { SubmitHandler, useFieldArray, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import z from 'zod/v4'
import { useParams } from 'common'
import Panel from 'components/ui/Panel'
@@ -33,7 +33,7 @@ const FormSchema = z.object({
.string()
.min(1, 'Please provide a name for your secret')
.refine((value) => !value.match(/^(SUPABASE_).*/), {
message: 'Name must not start with the SUPABASE_ prefix',
error: 'Name must not start with the SUPABASE_ prefix'
}),
value: z.string().min(1, 'Please provide a value for your secret'),
})
@@ -5,7 +5,7 @@ import { parseAsString, useQueryState } from 'nuqs'
import { useEffect, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import z from 'zod/v4'
import { useWatch } from '@ui/components/shadcn/ui/form'
import { urlRegex } from 'components/interfaces/Auth/Auth.constants'
@@ -65,7 +65,7 @@ const edgeFunctionSchema = z.object({
type: z.literal('edge_function'),
method: z.enum(['GET', 'POST']),
edgeFunctionName: z.string().trim().min(1, 'Please select one of the listed Edge Functions'),
timeoutMs: z.coerce.number().int().gte(1000).lte(5000).default(1000),
timeoutMs: z.coerce.number().int().gte(1000).lte(5000).prefault(1000),
httpHeaders: z.array(z.object({ name: z.string(), value: z.string() })),
httpBody: z
.string()
@@ -93,7 +93,7 @@ const httpRequestSchema = z.object({
.min(1, 'Please provide a URL')
.regex(urlRegex(), 'Please provide a valid URL')
.refine((value) => value.startsWith('http'), 'Please include HTTP/HTTPs to your URL'),
timeoutMs: z.coerce.number().int().gte(1000).lte(5000).default(1000),
timeoutMs: z.coerce.number().int().gte(1000).lte(5000).prefault(1000),
httpHeaders: z.array(z.object({ name: z.string(), value: z.string() })),
httpBody: z
.string()
@@ -155,11 +155,12 @@ const FormSchema = z
.superRefine((data, ctx) => {
if (!cronPattern.test(data.schedule)) {
if (!(data.supportsSeconds && secondsPattern.test(data.schedule))) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Seconds are supported only in pg_cron v1.5.0+. Please use a valid Cron format.',
path: ['schedule'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: 'Seconds are supported only in pg_cron v1.5.0+. Please use a valid Cron format.',
path: ['schedule'],
input: ''
})
}
}
})
@@ -1,7 +1,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import z from 'zod/v4'
import { Markdown } from 'components/interfaces/Markdown'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
@@ -3,7 +3,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { DocsButton } from 'components/ui/DocsButton'
import { FormHeader } from 'components/ui/Forms/FormHeader'
@@ -1,6 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { SubmitHandler, useForm } from 'react-hook-form'
import z from 'zod'
import z from 'zod/v4'
import { useParams } from 'common'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
@@ -17,7 +17,7 @@ interface SendMessageModalProps {
}
const FormSchema = z.object({
delay: z.coerce.number().int().gte(0).default(5),
delay: z.coerce.number().int().gte(0).prefault(5),
payload: z.string().refine(
(val) => {
try {
@@ -27,7 +27,7 @@ const FormSchema = z.object({
}
},
{
message: 'The payload should be a JSON object',
error: 'The payload should be a JSON object'
}
),
})
@@ -3,7 +3,7 @@ import { TrashIcon } from 'lucide-react'
import { ReactNode, useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { useParams } from 'common'
import { LogDrainData, useLogDrainsQuery } from 'data/log-drains/log-drains-query'
@@ -52,8 +52,12 @@ const formUnion = z.discriminatedUnion('type', [
}),
z.object({
type: z.literal('datadog'),
api_key: z.string().min(1, { message: 'API key is required' }),
region: z.string().min(1, { message: 'Region is required' }),
api_key: z.string().min(1, {
error: 'API key is required'
}),
region: z.string().min(1, {
error: 'Region is required'
}),
}),
z.object({
type: z.literal('elastic'),
@@ -66,7 +70,9 @@ const formUnion = z.discriminatedUnion('type', [
}),
z.object({
type: z.literal('loki'),
url: z.string().min(1, { message: 'Loki URL is required' }),
url: z.string().min(1, {
error: 'Loki URL is required'
}),
headers: z.record(z.string(), z.string()),
username: z.string().optional(),
password: z.string().optional(),
@@ -76,7 +82,7 @@ const formUnion = z.discriminatedUnion('type', [
const formSchema = z
.object({
name: z.string().min(1, {
message: 'Destination name is required',
error: 'Destination name is required'
}),
description: z.string().optional(),
})
@@ -1,6 +1,6 @@
import { Check, ChevronsUpDown, X } from 'lucide-react'
import { UseFormReturn } from 'react-hook-form'
import { z } from 'zod'
import { z } from 'zod/v4'
import { useMemo, useState } from 'react'
import {
@@ -53,18 +53,18 @@ export const BillingCustomerDataSchema = z
return !hasAnyField || (!!data.country && !!data.line1)
},
{
message: 'Country and Address line 1 are required if any other field is provided.',
path: ['line1'],
error: 'Country and Address line 1 are required if any other field is provided.'
}
)
.refine((data) => !(!!data.line1 && !data.country), {
message: 'Please select a country',
path: ['country'],
})
error: 'Please select a country'
})
.refine((data) => !(!!data.country && !data.line1), {
message: 'Please provide an address line 1',
path: ['line1'],
})
error: 'Please provide an address line 1'
})
export type BillingCustomerDataFormValues = z.infer<typeof BillingCustomerDataSchema>
@@ -3,7 +3,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { Form, FormControl, FormField } from '@ui/components/shadcn/ui/form'
import { useParams } from 'common'
@@ -35,8 +35,8 @@ import {
const FORM_ID = 'org-billing-email'
const formSchema = z.object({
billingEmail: z.string().email('Please provide a valid email address').optional(),
additionalBillingEmails: z.string().email({ message: 'invalid_email' }).array().default([]),
billingEmail: z.email().optional(),
additionalBillingEmails: z.email().array().prefault([]),
})
const BillingEmail = () => {
@@ -10,7 +10,7 @@ import Link from 'next/link'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { useOrganizationCreditTopUpMutation } from 'data/organizations/organization-credit-top-up-mutation'
@@ -32,7 +32,7 @@ import {
PopoverTrigger_Shadcn_ as PopoverTrigger,
} from 'ui'
import { TAX_IDS, type TaxId } from '../BillingCustomerData/TaxID.constants'
import { z } from 'zod'
import { z } from 'zod/v4'
import { useForm } from 'react-hook-form'
import { Form } from '@ui/components/shadcn/ui/form'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
@@ -45,8 +45,8 @@ import type { PaymentMethod } from '@stripe/stripe-js'
export const BillingCustomerDataSchema = z.object({
tax_id_type: z.string(),
tax_id_value: z.string().min(2, {
message: 'Tax ID needs to be set.',
}),
error: 'Tax ID needs to be set.'
}),
tax_id_name: z.string(),
})
@@ -4,7 +4,7 @@ import { useQueryClient } from '@tanstack/react-query'
import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import CopyButton from 'components/ui/CopyButton'
@@ -7,7 +7,7 @@ import { useRouter } from 'next/router'
import { parseAsString, useQueryStates } from 'nuqs'
import { useEffect, useMemo, useRef, useState } from 'react'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { LOCAL_STORAGE_KEYS } from 'common'
import SpendCapModal from 'components/interfaces/Billing/SpendCapModal'
@@ -4,7 +4,7 @@ import Link from 'next/link'
import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { useParams } from 'common'
import { ScaffoldContainerLegacy } from 'components/layouts/Scaffold'
@@ -5,7 +5,7 @@ import Link from 'next/link'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
@@ -3,7 +3,7 @@ import { useParams } from 'common'
import { ChevronDown } from 'lucide-react'
import { Dispatch, SetStateAction, useState } from 'react'
import { useForm } from 'react-hook-form'
import * as z from 'zod'
import * as z from 'zod/v4'
import { DocsButton } from 'components/ui/DocsButton'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
@@ -4,7 +4,7 @@ import Link from 'next/link'
import { useEffect } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
@@ -3,7 +3,7 @@ import { Check, Code, Plus } from 'lucide-react'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import { getContentById } from 'data/content/content-id-query'
@@ -6,7 +6,7 @@ import Link from 'next/link'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { useParams } from 'common'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
@@ -72,8 +72,8 @@ const formSchema = z
return true
},
{
message: 'Must have at least one schema if Data API is enabled',
path: ['dbSchema'],
error: 'Must have at least one schema if Data API is enabled'
}
)
@@ -4,7 +4,7 @@ import { capitalize } from 'lodash'
import { Fragment, useEffect, useMemo } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import z from 'zod/v4'
import { useParams } from 'common'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
@@ -6,7 +6,7 @@ import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { useParams } from 'common'
import { PLAN_DETAILS } from 'components/interfaces/DiskManagement/ui/DiskManagement.constants'
@@ -4,7 +4,7 @@ import { ChevronDown, Loader2, PlusIcon } from 'lucide-react'
import { useCallback, useEffect, useState, useMemo } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useBranchCreateMutation } from 'data/branches/branch-create-mutation'
import { useBranchUpdateMutation } from 'data/branches/branch-update-mutation'
@@ -155,11 +155,12 @@ const GitHubIntegrationConnectionForm = ({
const selectedRepo = githubRepos.find((repo) => repo.id === repositoryId)
const repoName =
selectedRepo?.name || connection?.repository.name || 'selected repository'
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Branch "${val.branchName}" not found in ${repoName}`,
path: ['branchName'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Branch "${val.branchName}" not found in ${repoName}`,
path: ['branchName'],
input: ''
})
}
}
}
@@ -1,7 +1,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { FormActions } from 'components/ui/Forms/FormActions'
import type {
@@ -4,7 +4,7 @@ import { useRouter } from 'next/router'
import { useRef, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useResetPasswordMutation } from 'data/misc/reset-password-mutation'
import { BASE_PATH } from 'lib/constants'
@@ -5,7 +5,7 @@ import { useRouter } from 'next/router'
import { useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { auth, getReturnToPath } from 'lib/gotrue'
import {
@@ -6,7 +6,7 @@ import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import z from 'zod/v4'
import { useParams } from 'common'
import { useIcebergWrapperExtension } from 'components/interfaces/Storage/AnalyticBucketDetails/useIcebergWrapper'
@@ -60,14 +60,14 @@ const FormSchema = z.object({
(value) => value !== 'public',
'"public" is a reserved name. Please choose another name'
),
type: z.enum(['STANDARD', 'ANALYTICS']).default('STANDARD'),
public: z.boolean().default(false),
has_file_size_limit: z.boolean().default(false),
type: z.enum(['STANDARD', 'ANALYTICS']).prefault('STANDARD'),
public: z.boolean().prefault(false),
has_file_size_limit: z.boolean().prefault(false),
formatted_size_limit: z.coerce
.number()
.min(0, 'File size upload limit has to be at least 0')
.default(0),
allowed_mime_types: z.string().trim().default(''),
.prefault(0),
allowed_mime_types: z.string().trim().prefault(''),
})
export type CreateBucketForm = z.infer<typeof FormSchema>
@@ -3,7 +3,7 @@ import { snakeCase, uniq } from 'lodash'
import { useEffect, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import z from 'zod/v4'
import { useParams } from 'common'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
@@ -61,7 +61,7 @@ export const ImportForeignSchemaDialog = ({
return !schemas?.find((s) => s.name === val)
},
{
message: 'This schema already exists. Please specify a unique schema name.',
error: 'This schema already exists. Please specify a unique schema name.'
}
),
})
@@ -2,7 +2,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useState } from 'react'
import { useForm } from 'react-hook-form'
import { z } from 'zod'
import { z } from 'zod/v4'
import { FormField } from '@ui/components/shadcn/ui/form'
import { useParams } from 'common'
@@ -47,7 +47,7 @@ export const CreateCredentialModal = ({ visible, onOpenChange }: CreateCredentia
const FormSchema = z.object({
description: z.string().min(3, {
message: 'Description must be at least 3 characters long',
error: 'Description must be at least 3 characters long'
}),
})
const form = useForm<z.infer<typeof FormSchema>>({
@@ -5,7 +5,7 @@ import Link from 'next/link'
import { useEffect, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import {
@@ -3,7 +3,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useEffect, useMemo, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useParams } from 'common'
import AlertError from 'components/ui/AlertError'
@@ -114,11 +114,12 @@ const StorageSettings = () => {
const { value: formattedMaxLimit } = convertFromBytes(maxBytes, unit)
if (fileSizeLimit > formattedMaxLimit) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Maximum limit is up to ${formattedMaxLimit.toLocaleString()} ${unit}.`,
path: ['fileSizeLimit'],
})
ctx.issues.push({
code: z.ZodIssueCode.custom,
message: `Maximum limit is up to ${formattedMaxLimit.toLocaleString()} ${unit}.`,
path: ['fileSizeLimit'],
input: ''
})
}
})
@@ -5,7 +5,7 @@ import Link from 'next/link'
import { ChangeEvent, useEffect, useMemo, useRef, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
import * as z from 'zod/v4'
import { useDocsSearch, useParams, type DocsSearchResult as Page } from 'common'
import { CLIENT_LIBRARIES } from 'common/constants'
@@ -1,4 +1,4 @@
import { z } from 'zod'
import { z } from 'zod/v4'
import {
ARRAY_DELIMITER,
@@ -72,7 +72,7 @@ export const timelineChartSchema = z.object({
...LEVELS.reduce(
(acc, level) => ({
...acc,
[level]: z.number().default(0),
[level]: z.number().prefault(0),
}),
{} as Record<(typeof LEVELS)[number], z.ZodNumber>
),
@@ -7,7 +7,7 @@ import Link from 'next/link'
import { useState } from 'react'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import { useParams } from 'common'
import { PostgresVersionSelector } from 'components/interfaces/ProjectCreation/PostgresVersionSelector'
@@ -1,4 +1,4 @@
import * as z from 'zod'
import * as z from 'zod/v4'
export const StringNumberOrNull = z
.string()
@@ -1,6 +1,6 @@
import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import pgMeta from '@supabase/pg-meta'
import { databaseKeys } from 'data/database/keys'
@@ -1,6 +1,6 @@
import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import pgMeta from '@supabase/pg-meta'
import { databaseKeys } from 'data/database/keys'
@@ -3,7 +3,7 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { databaseKeys } from 'data/database/keys'
import { executeSql } from 'data/sql/execute-sql-query'
import type { ResponseError } from 'types'
import { z } from 'zod'
import { z } from 'zod/v4'
export type DatabaseFunctionsVariables = {
projectRef?: string
@@ -1,6 +1,6 @@
import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
import { z } from 'zod'
import { z } from 'zod/v4'
import pgMeta from '@supabase/pg-meta'
import { databaseKeys } from 'data/database/keys'
@@ -1,6 +1,6 @@
import pgMeta from '@supabase/pg-meta'
import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { z } from 'zod'
import { z } from 'zod/v4'
import { executeSql, ExecuteSqlError } from 'data/sql/execute-sql-query'
import { databaseRoleKeys } from './keys'
+1 -1
View File
@@ -1,6 +1,6 @@
import pgMeta from '@supabase/pg-meta'
import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { z } from 'zod'
import { z } from 'zod/v4'
import { executeSql, ExecuteSqlError } from 'data/sql/execute-sql-query'
import { databaseKeys } from './keys'
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff. Show more