Next.js Supabase V3 (#463)
Version 3 of the kit: - Radix UI replaced with Base UI (using the Shadcn UI patterns) - next-intl replaces react-i18next - enhanceAction deprecated; usage moved to next-safe-action - main layout now wrapped with [locale] path segment - Teams only mode - Layout updates - Zod v4 - Next.js 16.2 - Typescript 6 - All other dependencies updated - Removed deprecated Edge CSRF - Dynamic Github Action runner
This commit is contained in:
committed by
GitHub
parent
4912e402a3
commit
7ebff31475
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
export const AcceptInvitationSchema = z.object({
|
||||
inviteToken: z.string().uuid(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
/**
|
||||
* @name RESERVED_NAMES_ARRAY
|
||||
@@ -40,20 +40,18 @@ export function containsNonLatinCharacters(value: string): boolean {
|
||||
* @description Schema for validating URL-friendly slugs
|
||||
*/
|
||||
export const SlugSchema = z
|
||||
.string({
|
||||
description: 'URL-friendly identifier for the team',
|
||||
})
|
||||
.string()
|
||||
.min(2)
|
||||
.max(50)
|
||||
.regex(SLUG_REGEX, {
|
||||
message: 'teams:invalidSlugError',
|
||||
message: 'teams.invalidSlugError',
|
||||
})
|
||||
.refine(
|
||||
(slug) => {
|
||||
return !RESERVED_NAMES_ARRAY.includes(slug.toLowerCase());
|
||||
},
|
||||
{
|
||||
message: 'teams:reservedNameError',
|
||||
message: 'teams.reservedNameError',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -62,9 +60,7 @@ export const SlugSchema = z
|
||||
* @description Schema for team name - allows non-Latin characters
|
||||
*/
|
||||
export const TeamNameSchema = z
|
||||
.string({
|
||||
description: 'The name of the team account',
|
||||
})
|
||||
.string()
|
||||
.min(2)
|
||||
.max(50)
|
||||
.refine(
|
||||
@@ -72,7 +68,7 @@ export const TeamNameSchema = z
|
||||
return !SPECIAL_CHARACTERS_REGEX.test(name);
|
||||
},
|
||||
{
|
||||
message: 'teams:specialCharactersError',
|
||||
message: 'teams.specialCharactersError',
|
||||
},
|
||||
)
|
||||
.refine(
|
||||
@@ -80,7 +76,7 @@ export const TeamNameSchema = z
|
||||
return !RESERVED_NAMES_ARRAY.includes(name.toLowerCase());
|
||||
},
|
||||
{
|
||||
message: 'teams:reservedNameError',
|
||||
message: 'teams.reservedNameError',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -93,10 +89,11 @@ export const CreateTeamSchema = z
|
||||
.object({
|
||||
name: TeamNameSchema,
|
||||
// Transform empty strings to undefined before validation
|
||||
slug: z.preprocess(
|
||||
(val) => (val === '' ? undefined : val),
|
||||
SlugSchema.optional(),
|
||||
),
|
||||
slug: z
|
||||
.string()
|
||||
.optional()
|
||||
.transform((val) => (val === '' ? undefined : val))
|
||||
.pipe(SlugSchema.optional()),
|
||||
})
|
||||
.refine(
|
||||
(data) => {
|
||||
@@ -107,7 +104,7 @@ export const CreateTeamSchema = z
|
||||
return true;
|
||||
},
|
||||
{
|
||||
message: 'teams:slugRequiredForNonLatinName',
|
||||
message: 'teams.slugRequiredForNonLatinName',
|
||||
path: ['slug'],
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
export const DeleteInvitationSchema = z.object({
|
||||
invitationId: z.number().int(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
export const DeleteTeamAccountSchema = z.object({
|
||||
accountId: z.string().uuid(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
const InviteSchema = z.object({
|
||||
email: z.string().email(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
export const LeaveTeamAccountSchema = z.object({
|
||||
accountId: z.string().uuid(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
export const RemoveMemberSchema = z.object({
|
||||
accountId: z.string().uuid(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
export const RenewInvitationSchema = z.object({
|
||||
invitationId: z.number().positive(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
export const TransferOwnershipConfirmationSchema = z.object({
|
||||
accountId: z.string().uuid(),
|
||||
@@ -6,6 +6,6 @@ export const TransferOwnershipConfirmationSchema = z.object({
|
||||
otp: z.string().min(6),
|
||||
});
|
||||
|
||||
export type TransferOwnershipConfirmationData = z.infer<
|
||||
export type TransferOwnershipConfirmationData = z.output<
|
||||
typeof TransferOwnershipConfirmationSchema
|
||||
>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
export const UpdateInvitationSchema = z.object({
|
||||
invitationId: z.number(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
export const RoleSchema = z.object({
|
||||
role: z.string().min(1),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import * as z from 'zod';
|
||||
|
||||
import {
|
||||
SlugSchema,
|
||||
@@ -23,7 +23,7 @@ export const TeamNameFormSchema = z
|
||||
return true;
|
||||
},
|
||||
{
|
||||
message: 'teams:slugRequiredForNonLatinName',
|
||||
message: 'teams.slugRequiredForNonLatinName',
|
||||
path: ['newSlug'],
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user