diff --git a/app/api/auth/provider-callback.tsx b/app/api/auth/provider-callback.tsx index 2e7d743..be0e3e6 100644 --- a/app/api/auth/provider-callback.tsx +++ b/app/api/auth/provider-callback.tsx @@ -1,13 +1,11 @@ -import { redirect } from 'react-router' import { authenticator } from '~/lib/authenticator.server' import { logger } from '~/lib/logger' -import { commitSession, getSession } from '~/lib/sessions.server' import type { Route } from './+types/provider-callback' +import { guardSocialProvider } from '~/lib/auth/guard-social-provider' +import { commitSessionAndRedirect } from '~/lib/auth/commit-session-and-redirect' export async function loader({ params: { provider }, request }: Route.LoaderArgs) { - if (provider !== 'google') { - throw new Response(`Unsupported provider: ${provider}`, { status: 400 }) - } + guardSocialProvider(provider) const user = await authenticator.authenticate(provider, request) if (!user) { logger.info({ event: 'auth_provider_login_error', message: `Login error for ${provider}` }) @@ -15,12 +13,5 @@ export async function loader({ params: { provider }, request }: Route.LoaderArgs } logger.info({ event: 'auth_provider_login', message: `Login success for ${provider}`, userId: user.id }) - const session = await getSession(request.headers.get('Cookie')) - session.set('user', user) - - return redirect('/profile', { - headers: { - 'Set-Cookie': await commitSession(session), - }, - }) + return commitSessionAndRedirect({ request, user }) } diff --git a/app/api/auth/provider.tsx b/app/api/auth/provider.tsx index 10622b1..5066c6b 100644 --- a/app/api/auth/provider.tsx +++ b/app/api/auth/provider.tsx @@ -1,9 +1,9 @@ import { authenticator } from '~/lib/authenticator.server' import type { Route } from './+types/provider' +import { guardSocialProvider } from '~/lib/auth/guard-social-provider' + export const loader = async ({ params: { provider }, request }: Route.LoaderArgs) => { - if (provider !== 'google') { - throw new Response(`Unsupported provider: ${provider}`, { status: 400 }) - } + guardSocialProvider(provider) return await authenticator.authenticate(provider, request) } diff --git a/app/features/app/route-dashboard.tsx b/app/features/app/route-dashboard.tsx index 7d399ad..8a185f6 100644 --- a/app/features/app/route-dashboard.tsx +++ b/app/features/app/route-dashboard.tsx @@ -82,18 +82,6 @@ const steps = [ ] export default function RouteDashboard({ loaderData: { user } }: Route.ComponentProps) { - const active = useMemo(() => { - if (!user || !user.identities?.length) { - return 0 - } - if (user.identities.length === 1) { - return 1 - } - if (user.identities.find((i) => i.provider === 'Solana')) { - return 2 - } - }, [user]) - const done = useMemo(() => stepsDone({ user }), [user]) const nextStep = useMemo(() => { const next = steps.find((step) => !done.includes(step.value)) @@ -111,7 +99,13 @@ export default function RouteDashboard({ loaderData: { user } }: Route.Component radius="lg" > {steps.map((item) => ( - + {item.label} @@ -156,11 +150,11 @@ function stepsDone({ user }: { user: User }): string[] { } function findUserIdentitiesSocial({ user }: { user: User }) { - return user.identities.filter((i) => i.provider !== 'Solana') + return user.identities?.filter((i) => i.provider !== 'Solana') ?? [] } function findUserIdentitiesSolana({ user }: { user: User }) { - return user.identities.filter((i) => i.provider === 'Solana') + return user.identities?.filter((i) => i.provider === 'Solana') ?? [] } function PanelSocial({ user }: { user: User }) { diff --git a/app/features/auth/data-access/auth-handle-user-login.request.ts b/app/features/auth/data-access/auth-handle-user-login.request.ts index bef59b0..a0c8c97 100644 --- a/app/features/auth/data-access/auth-handle-user-login.request.ts +++ b/app/features/auth/data-access/auth-handle-user-login.request.ts @@ -1,7 +1,6 @@ -import { redirect } from 'react-router' import { authenticator } from '~/lib/authenticator.server' import { logger } from '~/lib/logger' -import { commitSession, getSession } from '~/lib/sessions.server' +import { commitSessionAndRedirect } from '~/lib/auth/commit-session-and-redirect' export async function authHandleUserLoginRequest(request: Request) { const user = await authenticator.authenticate('user-pass', request) @@ -9,13 +8,6 @@ export async function authHandleUserLoginRequest(request: Request) { logger.info({ event: 'auth_login_error', message: 'User not found' }) throw new Error('Invalid login data') } - const session = await getSession(request.headers.get('Cookie')) - session.set('user', user) - logger.info({ event: 'auth_login_success', userId: user.id }) - return redirect('/profile', { - headers: { - 'Set-Cookie': await commitSession(session), - }, - }) + return commitSessionAndRedirect({ request, user }) } diff --git a/app/features/auth/data-access/auth-handle-user-register-request.ts b/app/features/auth/data-access/auth-handle-user-register-request.ts index 0165a6b..d4e5769 100644 --- a/app/features/auth/data-access/auth-handle-user-register-request.ts +++ b/app/features/auth/data-access/auth-handle-user-register-request.ts @@ -1,7 +1,6 @@ -import { redirect } from 'react-router' import { authUserRegister } from '~/features/auth/data-access/auth-user-register' -import { commitSession, getSession } from '~/lib/sessions.server' import { logger } from '~/lib/logger' +import { commitSessionAndRedirect } from '~/lib/auth/commit-session-and-redirect' export async function authHandleUserRegisterRequest(request: Request) { const formData = await request.formData() @@ -14,13 +13,6 @@ export async function authHandleUserRegisterRequest(request: Request) { logger.info({ event: 'auth_register_error', message: 'User not registered' }) throw new Error('Invalid register data') } - const session = await getSession(request.headers.get('Cookie')) - session.set('user', user) - logger.info({ event: 'auth_register_success', userId: user.id }) - return redirect('/', { - headers: { - 'Set-Cookie': await commitSession(session), - }, - }) + return commitSessionAndRedirect({ request, user }) } diff --git a/app/features/auth/data-access/ensure-user.ts b/app/features/auth/data-access/ensure-user.ts index 8449161..ee305b4 100644 --- a/app/features/auth/data-access/ensure-user.ts +++ b/app/features/auth/data-access/ensure-user.ts @@ -3,7 +3,7 @@ import { getUser } from '~/features/auth/data-access/get-user' export async function ensureUser(request: Request) { const user = await getUser(request) - if (!user) { + if (!user?.identities?.length) { throw new Error('User not found') } diff --git a/app/features/auth/data-access/get-user.ts b/app/features/auth/data-access/get-user.ts index 91cc92e..2e3aa27 100644 --- a/app/features/auth/data-access/get-user.ts +++ b/app/features/auth/data-access/get-user.ts @@ -1,15 +1,14 @@ -import { getSession } from '~/lib/sessions.server' import { logger } from '~/lib/logger' import { userFindById } from '~/lib/core/user-find-by-id' -export async function getUser(request: Request) { - const session = await getSession(request.headers.get('cookie')) +import { getSessionAndUser } from '~/lib/auth/get-session-and-user' - const user = session.get('user') - if (!user) { +export async function getUser(request: Request) { + const { userId } = await getSessionAndUser(request) + if (!userId) { return } - const found = await userFindById(user.id) + const found = await userFindById(userId) if (!found) { logger.info({ event: 'auth_get_user', message: 'User not found in database' }) return diff --git a/app/features/auth/route-login.tsx b/app/features/auth/route-login.tsx index aaa2eb9..751121c 100644 --- a/app/features/auth/route-login.tsx +++ b/app/features/auth/route-login.tsx @@ -16,12 +16,17 @@ export async function action({ request }: Route.ActionArgs) { } export async function loader({ request }: Route.LoaderArgs) { - const user = await getUser(request) - if (user) { - logger.info({ event: 'auth_login_redirect', userId: user.id, message: 'User already logged in' }) - return redirect('/profile') + try { + const user = await getUser(request) + if (user) { + logger.info({ event: 'auth_login_redirect', userId: user.id, message: 'User already logged in' }) + console.log(`user`, user) + return redirect('/dashboard') + } + return data(null) + } catch { + logger.info({ event: 'auth_login_redirect', message: 'User not logged in' }) } - return data(null) } export default function RouteLogin() { diff --git a/app/features/auth/route-logout.tsx b/app/features/auth/route-logout.tsx index 70f79e4..5030e9f 100644 --- a/app/features/auth/route-logout.tsx +++ b/app/features/auth/route-logout.tsx @@ -1,8 +1,6 @@ -import { redirect } from 'react-router' import { appMeta } from '~/lib/app-meta' -import { logger } from '~/lib/logger' -import { destroySession, getSession } from '~/lib/sessions.server' import type { Route } from './+types/route-login' +import { destroySessionAndRedirect } from '~/lib/auth/destroy-session-and-redirect' export function meta() { return appMeta('Logout') @@ -13,18 +11,5 @@ export default function RouteLogout() { } export async function loader({ request }: Route.LoaderArgs) { - const session = await getSession(request.headers.get('cookie')) - const user = session.get('user') - - if (!user) { - logger.info({ event: 'auth_logout_error', message: 'User not found' }) - return redirect('/') - } - - logger.info({ event: 'auth_logout_success', userId: user.id }) - return redirect('/', { - headers: { - 'Set-Cookie': await destroySession(session), - }, - }) + return destroySessionAndRedirect({ request }) } diff --git a/app/features/auth/ui/auth-ui-form.tsx b/app/features/auth/ui/auth-ui-form.tsx index 4ee7c14..c8dce2f 100644 --- a/app/features/auth/ui/auth-ui-form.tsx +++ b/app/features/auth/ui/auth-ui-form.tsx @@ -9,6 +9,14 @@ export function AuthUiForm({ title }: { title: string }) { {title} + + ) +} diff --git a/app/features/solana/use-solana-auth.tsx b/app/features/solana/use-solana-auth.tsx new file mode 100644 index 0000000..ce752e1 --- /dev/null +++ b/app/features/solana/use-solana-auth.tsx @@ -0,0 +1,34 @@ +import { useFetcher } from 'react-router' +import type { SolanaAuthMessageSigned } from '~/lib/solana-auth/solana-auth-message' + +export function useSolanaAuth({ publicKey }: { publicKey: string }) { + const fetcher = useFetcher() + + async function handleSubmit(data: Record) { + return await fetcher.submit(data, { method: 'post' }) + } + + async function handleCreate(action: 'sign-message-create') { + if (!publicKey.length) { + console.warn(`No public key, please connect your wallet`) + return + } + await handleSubmit({ action, publicKey }) + } + + async function handleVerify(action: 'sign-message-verify', payload: SolanaAuthMessageSigned) { + if (!publicKey.length) { + console.warn(`No public key, please connect your wallet`) + return + } + await handleSubmit({ action, publicKey, payload: JSON.stringify(payload) }) + } + + return { + fetcher, + handleCreate, + handleCreateSignMessage: () => handleCreate('sign-message-create'), + handleVerify, + handleVerifySignMessage: (payload: SolanaAuthMessageSigned) => handleVerify('sign-message-verify', payload), + } +} diff --git a/app/features/solana/user-solana-wallet.tsx b/app/features/solana/user-solana-wallet.tsx index 32bf758..b464537 100644 --- a/app/features/solana/user-solana-wallet.tsx +++ b/app/features/solana/user-solana-wallet.tsx @@ -1,24 +1,18 @@ import { Button, Flex, Group, Stack, Text } from '@mantine/core' -import { redirect, useFetcher } from 'react-router' -import { getBase58Decoder, getBase58Encoder, type ReadonlyUint8Array } from 'gill' +import { getBase58Decoder } from 'gill' import type { Route } from './+types/user-solana-wallet' import { useWallet } from '@solana/wallet-adapter-react' -import { solanaAuth } from '~/lib/solana-auth/solana-auth' import type { SolanaAuthMessage, SolanaAuthMessageSigned } from '~/lib/solana-auth/solana-auth-message' -import { getUserBySolanaIdentity } from '~/features/auth/data-access/get-user-by-solana-identity' import { getUser } from '~/features/auth/data-access/get-user' -import { getSolanaVerificationType, SolanaVerificationType } from './get-solana-verification-type' -import { userUpdateWithIdentity } from '~/lib/core/user-update-with-identity' -import { userCreateWithIdentity } from '~/lib/core/user-create-with-identity' -import { commitSession, getSession } from '~/lib/sessions.server' -import { IdentityProvider } from '@prisma/client' +import { useSolanaAuth } from '~/features/solana/use-solana-auth' +import { SolanaSignMessageButton } from '~/features/solana/solana-sign-message-button' +import { handleSolanaVerification } from '~/features/solana/handle-solana-verification' +import { useCallback } from 'react' -function parsePayload(payload: string = ''): SolanaAuthMessageSigned { - try { - return JSON.parse(payload) - } catch { - throw new Error(`Invalid payload`) - } +export async function loader(args: Route.LoaderArgs) { + const user = await getUser(args.request) + + return { user } } export async function action({ request }: Route.LoaderArgs) { @@ -30,167 +24,53 @@ export async function action({ request }: Route.LoaderArgs) { if (!publicKey) { return { success: false, message: `No public key` } } - const actor = await getUser(request) - const owner = await getUserBySolanaIdentity({ providerId: publicKey }) - - // This determines the type of verification we are performing - const verification = getSolanaVerificationType({ - actorId: actor?.id ?? undefined, - ownerId: owner?.id ?? undefined, - enabledTypes: [ - SolanaVerificationType.Login, - SolanaVerificationType.Link, - SolanaVerificationType.Register, - SolanaVerificationType.Verify, - ], - }) - if (verification.type === SolanaVerificationType.Error) { - return { success: false, message: verification.message } - } - - console.log( - `user-solana-wallet [${action}] -> publicKey: ${publicKey} -> owner: ${owner ? owner.username : 'NONE'} -> type: ${verification.type}`, - ) - switch (formData.get('action')) { - case 'sign-message-create': - return { - success: true, - message: await solanaAuth.createMessage({ method: 'solana:signMessage', publicKey }), - type: 'solana-auth-message', - } - case 'sign-message-verify': - const parsed = parsePayload(payload) - const result = await solanaAuth.verifyMessage(parsed) - if (!result) { - throw new Error('Invalid signature') - } - console.log(`sign message -> verify`, 'message', parsed, 'signature', parsed.signature, 'result', result) - if (verification.type === SolanaVerificationType.Link) { - // We should link the wallet to the actor. - if (!actor) { - throw new Error('No actor found') - } - await userUpdateWithIdentity(actor.id, { - provider: IdentityProvider.Solana, - providerId: publicKey, - name: publicKey, - }) - } - if (verification.type === SolanaVerificationType.Login) { - // We should set the cookie. - if (!owner) { - throw new Error('No owner found') - } - const session = await getSession(request.headers.get('Cookie')) - session.set('user', owner) - return redirect('/profile', { - headers: { - 'Set-Cookie': await commitSession(session), - }, - }) - } - if (verification.type === SolanaVerificationType.Verify) { - // We don't need to do anything? 🤷‍♂️ - } - if (verification.type === SolanaVerificationType.Register) { - // We should register a new user. - const user = await userCreateWithIdentity({ - provider: IdentityProvider.Solana, - providerId: publicKey, - name: publicKey, - }) - const session = await getSession(request.headers.get('Cookie')) - session.set('user', user) - return redirect('/profile', { - headers: { - 'Set-Cookie': await commitSession(session), - }, - }) - } - return { - success: true, - message: result, - type: 'solana-auth-result', - } - case 'sign-transaction-create': - return { - success: true, - message: await solanaAuth.createMessage({ method: 'solana:signTransaction', publicKey }), - type: 'solana-auth-message', - } - default: - return { - success: false, - message: `Unknown action ${action}`, - } - } + return await handleSolanaVerification({ action, request, payload, publicKey }) } -export default function UserSolanaWallet() { +export default function UserSolanaWallet({ loaderData: { user } }: Route.ComponentProps) { const wallet = useWallet() const publicKey = wallet.publicKey?.toString() ?? '' - const fetcher = useFetcher() - - async function handleSubmit(data: Record) { - return await fetcher.submit(data, { method: 'post' }) - } - - async function handleCreate(action: 'sign-message-create' | 'sign-transaction-create') { - if (!publicKey.length) { - console.warn(`No public key, please connect your wallet`) - return - } - await handleSubmit({ action, publicKey }) - } + const { fetcher, handleCreateSignMessage, handleVerifySignMessage } = useSolanaAuth({ + publicKey, + }) + const sign = useCallback( + async (message: SolanaAuthMessage) => { + if (!wallet.signMessage) { + return + } + const result = await createSignatureWallet({ + message, + signMessage: wallet.signMessage, + }) + return await sign(result) + }, + [wallet.signMessage], + ) - async function handleVerify( - action: 'sign-message-verify' | 'sign-transaction-verify', - payload: SolanaAuthMessageSigned, - ) { - if (!publicKey.length) { - console.warn(`No public key, please connect your wallet`) - return - } - await handleSubmit({ action, publicKey, payload: JSON.stringify(payload) }) - } + const walletIdentity = user?.identities.find((i) => i.provider === 'Solana' && i.providerId === publicKey) return ( {publicKey.length ? ( - Connected to + Connected to {walletIdentity ? 'your' : ''} wallet {publicKey} ) : null} - - + handleCreateSignMessage()} /> {fetcher.data?.type === 'solana-auth-message' ? (
- handleVerify('sign-message-verify', payload)} - /> + handleVerifySignMessage(payload)} />
{JSON.stringify(fetcher.data.message, null, 2)}
) : null} +
{JSON.stringify({ ...walletIdentity, profile: undefined }, null, 2)}
) @@ -235,10 +115,6 @@ export function bs58Encode(data: Uint8Array) { return getBase58Decoder().decode(data) } -export function bs58Decode(data: string): ReadonlyUint8Array { - return getBase58Encoder().encode(data) -} - export async function createSignatureWallet({ message, signMessage, diff --git a/app/features/user/ui/user-ui-avatar.tsx b/app/features/user/ui/user-ui-avatar.tsx index 7fa34b2..641a871 100644 --- a/app/features/user/ui/user-ui-avatar.tsx +++ b/app/features/user/ui/user-ui-avatar.tsx @@ -2,9 +2,12 @@ import { Avatar, type AvatarProps } from '@mantine/core' import type { User } from '~/lib/db.server' export function UserUiAvatar({ user, ...props }: AvatarProps & { user: Pick }) { + if (!user) { + return null + } return ( - - {user.username.charAt(0)} + + {(user?.username ?? '?').charAt(0)} ) } diff --git a/app/lib/auth/commit-session-and-redirect.ts b/app/lib/auth/commit-session-and-redirect.ts new file mode 100644 index 0000000..af4aa6c --- /dev/null +++ b/app/lib/auth/commit-session-and-redirect.ts @@ -0,0 +1,22 @@ +import { redirect } from 'react-router' +import { commitSession } from '~/lib/sessions.server' +import type { User } from '~/lib/db.server' +import { getSessionFromCookie } from '~/lib/auth/get-session-from-cookie' + +interface CommitSessionAndRedirectOptions { + request: Request + to?: string + user: User +} + +export async function commitSessionAndRedirect({ request, to = '/dashboard', user }: CommitSessionAndRedirectOptions) { + const session = await getSessionFromCookie(request) + + session.set('userId', user.id) + + return redirect(to, { + headers: { + 'Set-Cookie': await commitSession(session), + }, + }) +} diff --git a/app/lib/auth/destroy-session-and-redirect.ts b/app/lib/auth/destroy-session-and-redirect.ts new file mode 100644 index 0000000..5179c7a --- /dev/null +++ b/app/lib/auth/destroy-session-and-redirect.ts @@ -0,0 +1,18 @@ +import { getSessionFromCookie } from '~/lib/auth/get-session-from-cookie' +import { redirect } from 'react-router' +import { destroySession } from '~/lib/sessions.server' + +export interface DestroySessionAndRedirectOptions { + request: Request + to?: string +} + +export async function destroySessionAndRedirect({ request, to = '/' }: DestroySessionAndRedirectOptions) { + const session = await getSessionFromCookie(request) + + return redirect(to, { + headers: { + 'Set-Cookie': await destroySession(session), + }, + }) +} diff --git a/app/lib/auth/ensure-social-provider.ts b/app/lib/auth/ensure-social-provider.ts new file mode 100644 index 0000000..c3ed1b9 --- /dev/null +++ b/app/lib/auth/ensure-social-provider.ts @@ -0,0 +1,13 @@ +import { IdentityProvider } from '@prisma/client' + +export function ensureSocialProvider(provider: string) { + if (!socialProviders.map((i) => i.toLowerCase()).includes(provider.toLowerCase())) { + throw new Error(`Unknown provider "${provider}"`) + } +} + +export const socialProviders: IdentityProvider[] = [ + IdentityProvider.Github, + IdentityProvider.Google, + IdentityProvider.X, +] diff --git a/app/lib/auth/get-session-and-user.ts b/app/lib/auth/get-session-and-user.ts new file mode 100644 index 0000000..c2f48e6 --- /dev/null +++ b/app/lib/auth/get-session-and-user.ts @@ -0,0 +1,7 @@ +import { getSessionFromCookie } from '~/lib/auth/get-session-from-cookie' + +export async function getSessionAndUser(request: Request) { + const session = await getSessionFromCookie(request) + + return { session, userId: session.get('userId') } +} diff --git a/app/lib/auth/get-session-from-cookie.ts b/app/lib/auth/get-session-from-cookie.ts new file mode 100644 index 0000000..787bcd7 --- /dev/null +++ b/app/lib/auth/get-session-from-cookie.ts @@ -0,0 +1,5 @@ +import { getSession } from '~/lib/sessions.server' + +export async function getSessionFromCookie(request: Request) { + return await getSession(request.headers.get('Cookie')) +} diff --git a/app/lib/auth/guard-social-provider.ts b/app/lib/auth/guard-social-provider.ts new file mode 100644 index 0000000..8e477e6 --- /dev/null +++ b/app/lib/auth/guard-social-provider.ts @@ -0,0 +1,9 @@ +import { ensureSocialProvider } from '~/lib/auth/ensure-social-provider' + +export function guardSocialProvider(provider: string) { + try { + ensureSocialProvider(provider) + } catch (error) { + throw new Response(`${error}`, { status: 400 }) + } +} diff --git a/app/lib/authenticator.server.ts b/app/lib/authenticator.server.ts index d29cadb..5715770 100644 --- a/app/lib/authenticator.server.ts +++ b/app/lib/authenticator.server.ts @@ -3,6 +3,8 @@ import { FormStrategy } from 'remix-auth-form' import { authUserLogin } from '~/features/auth/data-access/auth-user-login' import { type User } from '~/lib/db.server' import { googleStrategy } from './strategies/google-strategy' +import { githubStrategy } from './strategies/github-strategy' +import { xStrategy } from './strategies/x-strategy' export const authenticator = new Authenticator() @@ -14,4 +16,6 @@ const userPassStrategy = new FormStrategy(async ({ form }) => { }) authenticator.use(userPassStrategy, 'user-pass') +authenticator.use(githubStrategy, 'github') authenticator.use(googleStrategy, 'google') +authenticator.use(xStrategy, 'x') diff --git a/app/lib/compute-user-avatar-url.ts b/app/lib/compute-user-avatar-url.ts index 51cd2e2..4ba5497 100644 --- a/app/lib/compute-user-avatar-url.ts +++ b/app/lib/compute-user-avatar-url.ts @@ -1,4 +1,5 @@ import type { User } from '@prisma/client' +import type { Identity } from '~/lib/generated/zod' export function computeUserAvatarUrl(user: Pick) { return user.avatarUrl ? user.avatarUrl : defaultUserAvatarUrl(user) @@ -11,3 +12,7 @@ export function computeUserViewUrl(user: Pick) { export function defaultUserAvatarUrl(user: Pick) { return `https://api.dicebear.com/9.x/initials/svg?seed=${user.username}&backgroundType=gradientLinear` } + +export function defaultIdentityAvatarUrl(identity: Pick) { + return `https://api.dicebear.com/9.x/initials/svg?seed=${identity.name ?? identity.providerId}&backgroundType=gradientLinear` +} diff --git a/app/lib/core/ensure-unique-username.ts b/app/lib/core/ensure-unique-username.ts new file mode 100644 index 0000000..1f99f81 --- /dev/null +++ b/app/lib/core/ensure-unique-username.ts @@ -0,0 +1,17 @@ +import { db } from '~/lib/db.server' + +function randomDigits(length: number = 6) { + return Math.floor(Math.random() * Math.pow(10, length)) +} + +export async function ensureUniqueUsername(username: string) { + const user = await db.user.findFirst({ + where: { username }, + select: { id: true }, + }) + + if (user) { + return `${username}-${randomDigits()}` + } + return username +} diff --git a/app/lib/core/user-create-with-identity.ts b/app/lib/core/user-create-with-identity.ts index eb925b8..01b2624 100644 --- a/app/lib/core/user-create-with-identity.ts +++ b/app/lib/core/user-create-with-identity.ts @@ -1,13 +1,20 @@ import { Prisma } from '@prisma/client' -import type { IdentityProfile } from '~/lib/strategies/google-strategy' +import type { IdentityProfile } from '~/lib/strategies/identity-profile' import { db } from '~/lib/db.server' +import { ensureUniqueUsername } from '~/lib/core/ensure-unique-username' export async function userCreateWithIdentity(data: Prisma.IdentityCreateWithoutOwnerInput) { const profile = (data.profile ?? {}) as IdentityProfile - const username = profile.username ?? `${data.providerId}-${data.provider}` + const username = await ensureUniqueUsername(profile.username ?? `${data.providerId}-${data.provider}`) return await db.user.create({ - data: { username, avatarUrl: profile.avatarUrl, name: data.name, identities: { create: data } }, + data: { + username, + avatarUrl: profile.avatarUrl, + name: data.name, + bio: profile.bio, + identities: { create: data }, + }, include: { identities: true }, }) } diff --git a/app/lib/core/user-ensure-verified-identity.ts b/app/lib/core/user-ensure-verified-identity.ts new file mode 100644 index 0000000..c293b1b --- /dev/null +++ b/app/lib/core/user-ensure-verified-identity.ts @@ -0,0 +1,27 @@ +import { Prisma } from '@prisma/client' +import { userFindById } from '~/lib/core/user-find-by-id' +import { db } from '~/lib/db.server' +import { userUpdateWithIdentity } from '~/lib/core/user-update-with-identity' +import { logger } from '~/lib/logger' + +export async function userEnsureVerifiedIdentity(userId: string, data: Prisma.IdentityCreateWithoutOwnerInput) { + const user = await userFindById(userId) + const identity = user?.identities.find((i) => i.provider === data.provider && i.providerId === data.providerId) + + if (!identity) { + logger.info({ event: 'user_ensure_verified_identity_create', userId, identityId: data.providerId }) + return userUpdateWithIdentity(userId, data) + } + + if (identity?.verified) { + logger.info({ event: 'user_ensure_verified_identity_skip', userId, identityId: identity.id }) + return user + } + + logger.info({ event: 'user_ensure_verified_identity_update', userId, identityId: identity.id }) + return db.user.update({ + where: { id: userId }, + data: { identities: { update: { where: { id: identity.id }, data: { ...data, verified: true } } } }, + include: { identities: true }, + }) +} diff --git a/app/lib/core/user-find-by-id.ts b/app/lib/core/user-find-by-id.ts index 2d26631..53140f5 100644 --- a/app/lib/core/user-find-by-id.ts +++ b/app/lib/core/user-find-by-id.ts @@ -1,5 +1,22 @@ import { db } from '~/lib/db.server' export async function userFindById(id: string) { - return await db.user.findFirst({ where: { id }, include: { identities: true } }) + return await db.user.findFirst({ where: { id }, include: { identities: true } }).then((user) => { + if (!user?.identities?.length) { + return user + } + return { + ...user, + identities: user?.identities.map((identity) => + // + ({ + ...identity, + profile: { + ...((identity.profile ?? {}) as Record), + raw: undefined, + }, + }), + ), + } + }) } diff --git a/app/lib/core/user-update-with-identity.ts b/app/lib/core/user-update-with-identity.ts index 5f3a584..0224150 100644 --- a/app/lib/core/user-update-with-identity.ts +++ b/app/lib/core/user-update-with-identity.ts @@ -4,7 +4,7 @@ import { db } from '~/lib/db.server' export async function userUpdateWithIdentity(userId: string, data: Prisma.IdentityCreateWithoutOwnerInput) { return await db.user.update({ where: { id: userId }, - data: { identities: { create: data } }, + data: { identities: { create: { ...data, verified: true } } }, include: { identities: true }, }) } diff --git a/app/lib/generated/zod/index.ts b/app/lib/generated/zod/index.ts index cda06c9..20e9991 100644 --- a/app/lib/generated/zod/index.ts +++ b/app/lib/generated/zod/index.ts @@ -1,5 +1,5 @@ -import { z } from 'zod' -import { Prisma } from '@prisma/client' +import { z } from 'zod'; +import { Prisma } from '@prisma/client'; ///////////////////////////////////////// // HELPER FUNCTIONS @@ -8,19 +8,13 @@ import { Prisma } from '@prisma/client' // JSON //------------------------------------------------------ -export type NullableJsonInput = - | Prisma.JsonValue - | null - | 'JsonNull' - | 'DbNull' - | Prisma.NullTypes.DbNull - | Prisma.NullTypes.JsonNull +export type NullableJsonInput = Prisma.JsonValue | null | 'JsonNull' | 'DbNull' | Prisma.NullTypes.DbNull | Prisma.NullTypes.JsonNull; export const transformJsonNull = (v?: NullableJsonInput) => { - if (!v || v === 'DbNull') return Prisma.DbNull - if (v === 'JsonNull') return Prisma.JsonNull - return v -} + if (!v || v === 'DbNull') return Prisma.DbNull; + if (v === 'JsonNull') return Prisma.JsonNull; + return v; +}; export const JsonValueSchema: z.ZodType = z.lazy(() => z.union([ @@ -30,17 +24,17 @@ export const JsonValueSchema: z.ZodType = z.lazy(() => z.literal(null), z.record(z.lazy(() => JsonValueSchema.optional())), z.array(z.lazy(() => JsonValueSchema)), - ]), -) + ]) +); -export type JsonValueType = z.infer +export type JsonValueType = z.infer; export const NullableJsonValue = z .union([JsonValueSchema, z.literal('DbNull'), z.literal('JsonNull')]) .nullable() - .transform((v) => transformJsonNull(v)) + .transform((v) => transformJsonNull(v)); -export type NullableJsonValueType = z.infer +export type NullableJsonValueType = z.infer; export const InputJsonValueSchema: z.ZodType = z.lazy(() => z.union([ @@ -50,71 +44,33 @@ export const InputJsonValueSchema: z.ZodType = z.lazy(() z.object({ toJSON: z.function(z.tuple([]), z.any()) }), z.record(z.lazy(() => z.union([InputJsonValueSchema, z.literal(null)]))), z.array(z.lazy(() => z.union([InputJsonValueSchema, z.literal(null)]))), - ]), -) + ]) +); + +export type InputJsonValueType = z.infer; -export type InputJsonValueType = z.infer ///////////////////////////////////////// // ENUMS ///////////////////////////////////////// -export const TransactionIsolationLevelSchema = z.enum([ - 'ReadUncommitted', - 'ReadCommitted', - 'RepeatableRead', - 'Serializable', -]) +export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']); -export const UserScalarFieldEnumSchema = z.enum([ - 'id', - 'createdAt', - 'updatedAt', - 'username', - 'password', - 'name', - 'avatarUrl', - 'admin', -]) +export const UserScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','username','password','name','bio','avatarUrl','admin']); -export const IdentityScalarFieldEnumSchema = z.enum([ - 'id', - 'createdAt', - 'updatedAt', - 'provider', - 'providerId', - 'address', - 'name', - 'accessToken', - 'refreshToken', - 'profile', - 'verified', - 'ownerId', -]) +export const IdentityScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','provider','providerId','address','name','accessToken','refreshToken','profile','verified','ownerId']); -export const SortOrderSchema = z.enum(['asc', 'desc']) +export const SortOrderSchema = z.enum(['asc','desc']); -export const NullableJsonNullValueInputSchema = z - .enum(['DbNull', 'JsonNull']) - .transform((value) => (value === 'JsonNull' ? Prisma.JsonNull : value === 'DbNull' ? Prisma.DbNull : value)) +export const NullableJsonNullValueInputSchema = z.enum(['DbNull','JsonNull',]).transform((value) => value === 'JsonNull' ? Prisma.JsonNull : value === 'DbNull' ? Prisma.DbNull : value); -export const QueryModeSchema = z.enum(['default', 'insensitive']) +export const QueryModeSchema = z.enum(['default','insensitive']); -export const NullsOrderSchema = z.enum(['first', 'last']) +export const NullsOrderSchema = z.enum(['first','last']); -export const JsonNullValueFilterSchema = z - .enum(['DbNull', 'JsonNull', 'AnyNull']) - .transform((value) => - value === 'JsonNull' - ? Prisma.JsonNull - : value === 'DbNull' - ? Prisma.JsonNull - : value === 'AnyNull' - ? Prisma.AnyNull - : value, - ) +export const JsonNullValueFilterSchema = z.enum(['DbNull','JsonNull','AnyNull',]).transform((value) => value === 'JsonNull' ? Prisma.JsonNull : value === 'DbNull' ? Prisma.JsonNull : value === 'AnyNull' ? Prisma.AnyNull : value); -export const IdentityProviderSchema = z.enum(['Discord', 'Github', 'Google', 'Solana', 'Telegram', 'X']) +export const IdentityProviderSchema = z.enum(['Discord','Github','Google','Solana','Telegram','X']); export type IdentityProviderType = `${z.infer}` @@ -133,6 +89,7 @@ export const UserSchema = z.object({ username: z.string(), password: z.string().nullable(), name: z.string().nullable(), + bio: z.string().nullable(), avatarUrl: z.string().nullable(), admin: z.boolean(), }) @@ -167,2140 +124,1371 @@ export type Identity = z.infer // USER //------------------------------------------------------ -export const UserIncludeSchema: z.ZodType = z - .object({ - identities: z.union([z.boolean(), z.lazy(() => IdentityFindManyArgsSchema)]).optional(), - _count: z.union([z.boolean(), z.lazy(() => UserCountOutputTypeArgsSchema)]).optional(), - }) - .strict() - -export const UserArgsSchema: z.ZodType = z - .object({ - select: z.lazy(() => UserSelectSchema).optional(), - include: z.lazy(() => UserIncludeSchema).optional(), - }) - .strict() - -export const UserCountOutputTypeArgsSchema: z.ZodType = z - .object({ - select: z.lazy(() => UserCountOutputTypeSelectSchema).nullish(), - }) - .strict() - -export const UserCountOutputTypeSelectSchema: z.ZodType = z - .object({ - identities: z.boolean().optional(), - }) - .strict() - -export const UserSelectSchema: z.ZodType = z - .object({ - id: z.boolean().optional(), - createdAt: z.boolean().optional(), - updatedAt: z.boolean().optional(), - username: z.boolean().optional(), - password: z.boolean().optional(), - name: z.boolean().optional(), - avatarUrl: z.boolean().optional(), - admin: z.boolean().optional(), - identities: z.union([z.boolean(), z.lazy(() => IdentityFindManyArgsSchema)]).optional(), - _count: z.union([z.boolean(), z.lazy(() => UserCountOutputTypeArgsSchema)]).optional(), - }) - .strict() +export const UserIncludeSchema: z.ZodType = z.object({ + identities: z.union([z.boolean(),z.lazy(() => IdentityFindManyArgsSchema)]).optional(), + _count: z.union([z.boolean(),z.lazy(() => UserCountOutputTypeArgsSchema)]).optional(), +}).strict() + +export const UserArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => UserSelectSchema).optional(), + include: z.lazy(() => UserIncludeSchema).optional(), +}).strict(); + +export const UserCountOutputTypeArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => UserCountOutputTypeSelectSchema).nullish(), +}).strict(); + +export const UserCountOutputTypeSelectSchema: z.ZodType = z.object({ + identities: z.boolean().optional(), +}).strict(); + +export const UserSelectSchema: z.ZodType = z.object({ + id: z.boolean().optional(), + createdAt: z.boolean().optional(), + updatedAt: z.boolean().optional(), + username: z.boolean().optional(), + password: z.boolean().optional(), + name: z.boolean().optional(), + bio: z.boolean().optional(), + avatarUrl: z.boolean().optional(), + admin: z.boolean().optional(), + identities: z.union([z.boolean(),z.lazy(() => IdentityFindManyArgsSchema)]).optional(), + _count: z.union([z.boolean(),z.lazy(() => UserCountOutputTypeArgsSchema)]).optional(), +}).strict() // IDENTITY //------------------------------------------------------ -export const IdentityIncludeSchema: z.ZodType = z - .object({ - owner: z.union([z.boolean(), z.lazy(() => UserArgsSchema)]).optional(), - }) - .strict() - -export const IdentityArgsSchema: z.ZodType = z - .object({ - select: z.lazy(() => IdentitySelectSchema).optional(), - include: z.lazy(() => IdentityIncludeSchema).optional(), - }) - .strict() - -export const IdentitySelectSchema: z.ZodType = z - .object({ - id: z.boolean().optional(), - createdAt: z.boolean().optional(), - updatedAt: z.boolean().optional(), - provider: z.boolean().optional(), - providerId: z.boolean().optional(), - address: z.boolean().optional(), - name: z.boolean().optional(), - accessToken: z.boolean().optional(), - refreshToken: z.boolean().optional(), - profile: z.boolean().optional(), - verified: z.boolean().optional(), - ownerId: z.boolean().optional(), - owner: z.union([z.boolean(), z.lazy(() => UserArgsSchema)]).optional(), - }) - .strict() +export const IdentityIncludeSchema: z.ZodType = z.object({ + owner: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), +}).strict() + +export const IdentityArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => IdentitySelectSchema).optional(), + include: z.lazy(() => IdentityIncludeSchema).optional(), +}).strict(); + +export const IdentitySelectSchema: z.ZodType = z.object({ + id: z.boolean().optional(), + createdAt: z.boolean().optional(), + updatedAt: z.boolean().optional(), + provider: z.boolean().optional(), + providerId: z.boolean().optional(), + address: z.boolean().optional(), + name: z.boolean().optional(), + accessToken: z.boolean().optional(), + refreshToken: z.boolean().optional(), + profile: z.boolean().optional(), + verified: z.boolean().optional(), + ownerId: z.boolean().optional(), + owner: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), +}).strict() + ///////////////////////////////////////// // INPUT TYPES ///////////////////////////////////////// -export const UserWhereInputSchema: z.ZodType = z - .object({ - AND: z.union([z.lazy(() => UserWhereInputSchema), z.lazy(() => UserWhereInputSchema).array()]).optional(), - OR: z - .lazy(() => UserWhereInputSchema) - .array() - .optional(), - NOT: z.union([z.lazy(() => UserWhereInputSchema), z.lazy(() => UserWhereInputSchema).array()]).optional(), - id: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - createdAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - updatedAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - username: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - password: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - name: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - avatarUrl: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - admin: z.union([z.lazy(() => BoolFilterSchema), z.boolean()]).optional(), - identities: z.lazy(() => IdentityListRelationFilterSchema).optional(), - }) - .strict() - -export const UserOrderByWithRelationInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - username: z.lazy(() => SortOrderSchema).optional(), - password: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - name: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - avatarUrl: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - admin: z.lazy(() => SortOrderSchema).optional(), - identities: z.lazy(() => IdentityOrderByRelationAggregateInputSchema).optional(), - }) - .strict() - -export const UserWhereUniqueInputSchema: z.ZodType = z - .union([ - z.object({ - id: z.string().cuid(), - username: z.string(), - }), - z.object({ - id: z.string().cuid(), - }), - z.object({ - username: z.string(), - }), - ]) - .and( - z - .object({ - id: z.string().cuid().optional(), - username: z.string().optional(), - AND: z.union([z.lazy(() => UserWhereInputSchema), z.lazy(() => UserWhereInputSchema).array()]).optional(), - OR: z - .lazy(() => UserWhereInputSchema) - .array() - .optional(), - NOT: z.union([z.lazy(() => UserWhereInputSchema), z.lazy(() => UserWhereInputSchema).array()]).optional(), - createdAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - updatedAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - password: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - name: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - avatarUrl: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - admin: z.union([z.lazy(() => BoolFilterSchema), z.boolean()]).optional(), - identities: z.lazy(() => IdentityListRelationFilterSchema).optional(), - }) - .strict(), - ) - -export const UserOrderByWithAggregationInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - username: z.lazy(() => SortOrderSchema).optional(), - password: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - name: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - avatarUrl: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - admin: z.lazy(() => SortOrderSchema).optional(), - _count: z.lazy(() => UserCountOrderByAggregateInputSchema).optional(), - _max: z.lazy(() => UserMaxOrderByAggregateInputSchema).optional(), - _min: z.lazy(() => UserMinOrderByAggregateInputSchema).optional(), - }) - .strict() - -export const UserScalarWhereWithAggregatesInputSchema: z.ZodType = z - .object({ - AND: z - .union([ - z.lazy(() => UserScalarWhereWithAggregatesInputSchema), - z.lazy(() => UserScalarWhereWithAggregatesInputSchema).array(), - ]) - .optional(), - OR: z - .lazy(() => UserScalarWhereWithAggregatesInputSchema) - .array() - .optional(), - NOT: z - .union([ - z.lazy(() => UserScalarWhereWithAggregatesInputSchema), - z.lazy(() => UserScalarWhereWithAggregatesInputSchema).array(), - ]) - .optional(), - id: z.union([z.lazy(() => StringWithAggregatesFilterSchema), z.string()]).optional(), - createdAt: z.union([z.lazy(() => DateTimeWithAggregatesFilterSchema), z.coerce.date()]).optional(), - updatedAt: z.union([z.lazy(() => DateTimeWithAggregatesFilterSchema), z.coerce.date()]).optional(), - username: z.union([z.lazy(() => StringWithAggregatesFilterSchema), z.string()]).optional(), - password: z - .union([z.lazy(() => StringNullableWithAggregatesFilterSchema), z.string()]) - .optional() - .nullable(), - name: z - .union([z.lazy(() => StringNullableWithAggregatesFilterSchema), z.string()]) - .optional() - .nullable(), - avatarUrl: z - .union([z.lazy(() => StringNullableWithAggregatesFilterSchema), z.string()]) - .optional() - .nullable(), - admin: z.union([z.lazy(() => BoolWithAggregatesFilterSchema), z.boolean()]).optional(), - }) - .strict() - -export const IdentityWhereInputSchema: z.ZodType = z - .object({ - AND: z.union([z.lazy(() => IdentityWhereInputSchema), z.lazy(() => IdentityWhereInputSchema).array()]).optional(), - OR: z - .lazy(() => IdentityWhereInputSchema) - .array() - .optional(), - NOT: z.union([z.lazy(() => IdentityWhereInputSchema), z.lazy(() => IdentityWhereInputSchema).array()]).optional(), - id: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - createdAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - updatedAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - provider: z - .union([z.lazy(() => EnumIdentityProviderFilterSchema), z.lazy(() => IdentityProviderSchema)]) - .optional(), - providerId: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - address: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - name: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - accessToken: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - refreshToken: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - profile: z.lazy(() => JsonNullableFilterSchema).optional(), - verified: z.union([z.lazy(() => BoolFilterSchema), z.boolean()]).optional(), - ownerId: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - owner: z.union([z.lazy(() => UserScalarRelationFilterSchema), z.lazy(() => UserWhereInputSchema)]).optional(), - }) - .strict() - -export const IdentityOrderByWithRelationInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - provider: z.lazy(() => SortOrderSchema).optional(), - providerId: z.lazy(() => SortOrderSchema).optional(), - address: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - name: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - accessToken: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - refreshToken: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - profile: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - verified: z.lazy(() => SortOrderSchema).optional(), - ownerId: z.lazy(() => SortOrderSchema).optional(), - owner: z.lazy(() => UserOrderByWithRelationInputSchema).optional(), - }) - .strict() - -export const IdentityWhereUniqueInputSchema: z.ZodType = z - .union([ - z.object({ - id: z.string().cuid(), - provider_providerId: z.lazy(() => IdentityProviderProviderIdCompoundUniqueInputSchema), - }), - z.object({ - id: z.string().cuid(), - }), - z.object({ - provider_providerId: z.lazy(() => IdentityProviderProviderIdCompoundUniqueInputSchema), - }), - ]) - .and( - z - .object({ - id: z.string().cuid().optional(), - provider_providerId: z.lazy(() => IdentityProviderProviderIdCompoundUniqueInputSchema).optional(), - AND: z - .union([z.lazy(() => IdentityWhereInputSchema), z.lazy(() => IdentityWhereInputSchema).array()]) - .optional(), - OR: z - .lazy(() => IdentityWhereInputSchema) - .array() - .optional(), - NOT: z - .union([z.lazy(() => IdentityWhereInputSchema), z.lazy(() => IdentityWhereInputSchema).array()]) - .optional(), - createdAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - updatedAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - provider: z - .union([z.lazy(() => EnumIdentityProviderFilterSchema), z.lazy(() => IdentityProviderSchema)]) - .optional(), - providerId: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - address: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - name: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - accessToken: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - refreshToken: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - profile: z.lazy(() => JsonNullableFilterSchema).optional(), - verified: z.union([z.lazy(() => BoolFilterSchema), z.boolean()]).optional(), - ownerId: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - owner: z.union([z.lazy(() => UserScalarRelationFilterSchema), z.lazy(() => UserWhereInputSchema)]).optional(), - }) - .strict(), - ) - -export const IdentityOrderByWithAggregationInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - provider: z.lazy(() => SortOrderSchema).optional(), - providerId: z.lazy(() => SortOrderSchema).optional(), - address: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - name: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - accessToken: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - refreshToken: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - profile: z.union([z.lazy(() => SortOrderSchema), z.lazy(() => SortOrderInputSchema)]).optional(), - verified: z.lazy(() => SortOrderSchema).optional(), - ownerId: z.lazy(() => SortOrderSchema).optional(), - _count: z.lazy(() => IdentityCountOrderByAggregateInputSchema).optional(), - _max: z.lazy(() => IdentityMaxOrderByAggregateInputSchema).optional(), - _min: z.lazy(() => IdentityMinOrderByAggregateInputSchema).optional(), - }) - .strict() - -export const IdentityScalarWhereWithAggregatesInputSchema: z.ZodType = z - .object({ - AND: z - .union([ - z.lazy(() => IdentityScalarWhereWithAggregatesInputSchema), - z.lazy(() => IdentityScalarWhereWithAggregatesInputSchema).array(), - ]) - .optional(), - OR: z - .lazy(() => IdentityScalarWhereWithAggregatesInputSchema) - .array() - .optional(), - NOT: z - .union([ - z.lazy(() => IdentityScalarWhereWithAggregatesInputSchema), - z.lazy(() => IdentityScalarWhereWithAggregatesInputSchema).array(), - ]) - .optional(), - id: z.union([z.lazy(() => StringWithAggregatesFilterSchema), z.string()]).optional(), - createdAt: z.union([z.lazy(() => DateTimeWithAggregatesFilterSchema), z.coerce.date()]).optional(), - updatedAt: z.union([z.lazy(() => DateTimeWithAggregatesFilterSchema), z.coerce.date()]).optional(), - provider: z - .union([z.lazy(() => EnumIdentityProviderWithAggregatesFilterSchema), z.lazy(() => IdentityProviderSchema)]) - .optional(), - providerId: z.union([z.lazy(() => StringWithAggregatesFilterSchema), z.string()]).optional(), - address: z - .union([z.lazy(() => StringNullableWithAggregatesFilterSchema), z.string()]) - .optional() - .nullable(), - name: z - .union([z.lazy(() => StringNullableWithAggregatesFilterSchema), z.string()]) - .optional() - .nullable(), - accessToken: z - .union([z.lazy(() => StringNullableWithAggregatesFilterSchema), z.string()]) - .optional() - .nullable(), - refreshToken: z - .union([z.lazy(() => StringNullableWithAggregatesFilterSchema), z.string()]) - .optional() - .nullable(), - profile: z.lazy(() => JsonNullableWithAggregatesFilterSchema).optional(), - verified: z.union([z.lazy(() => BoolWithAggregatesFilterSchema), z.boolean()]).optional(), - ownerId: z.union([z.lazy(() => StringWithAggregatesFilterSchema), z.string()]).optional(), - }) - .strict() - -export const UserCreateInputSchema: z.ZodType = z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - username: z.string(), - password: z.string().optional().nullable(), - name: z.string().optional().nullable(), - avatarUrl: z.string().optional().nullable(), - admin: z.boolean().optional(), - identities: z.lazy(() => IdentityCreateNestedManyWithoutOwnerInputSchema).optional(), - }) - .strict() - -export const UserUncheckedCreateInputSchema: z.ZodType = z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), +export const UserWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => UserWhereInputSchema),z.lazy(() => UserWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => UserWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => UserWhereInputSchema),z.lazy(() => UserWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + username: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + password: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + name: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + bio: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + avatarUrl: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + admin: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), + identities: z.lazy(() => IdentityListRelationFilterSchema).optional() +}).strict(); + +export const UserOrderByWithRelationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + username: z.lazy(() => SortOrderSchema).optional(), + password: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + bio: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + avatarUrl: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + admin: z.lazy(() => SortOrderSchema).optional(), + identities: z.lazy(() => IdentityOrderByRelationAggregateInputSchema).optional() +}).strict(); + +export const UserWhereUniqueInputSchema: z.ZodType = z.union([ + z.object({ + id: z.string().cuid(), + username: z.string() + }), + z.object({ + id: z.string().cuid(), + }), + z.object({ username: z.string(), - password: z.string().optional().nullable(), - name: z.string().optional().nullable(), - avatarUrl: z.string().optional().nullable(), - admin: z.boolean().optional(), - identities: z.lazy(() => IdentityUncheckedCreateNestedManyWithoutOwnerInputSchema).optional(), - }) - .strict() - -export const UserUpdateInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - username: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - password: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - avatarUrl: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - admin: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - identities: z.lazy(() => IdentityUpdateManyWithoutOwnerNestedInputSchema).optional(), - }) - .strict() - -export const UserUncheckedUpdateInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - username: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - password: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - avatarUrl: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - admin: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - identities: z.lazy(() => IdentityUncheckedUpdateManyWithoutOwnerNestedInputSchema).optional(), - }) - .strict() - -export const UserCreateManyInputSchema: z.ZodType = z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - username: z.string(), - password: z.string().optional().nullable(), - name: z.string().optional().nullable(), - avatarUrl: z.string().optional().nullable(), - admin: z.boolean().optional(), - }) - .strict() - -export const UserUpdateManyMutationInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - username: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - password: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - avatarUrl: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - admin: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() - -export const UserUncheckedUpdateManyInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - username: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - password: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - avatarUrl: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - admin: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() - -export const IdentityCreateInputSchema: z.ZodType = z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - provider: z.lazy(() => IdentityProviderSchema), - providerId: z.string(), - address: z.string().optional().nullable(), - name: z.string().optional().nullable(), - accessToken: z.string().optional().nullable(), - refreshToken: z.string().optional().nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.boolean().optional(), - owner: z.lazy(() => UserCreateNestedOneWithoutIdentitiesInputSchema), - }) - .strict() - -export const IdentityUncheckedCreateInputSchema: z.ZodType = z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - provider: z.lazy(() => IdentityProviderSchema), - providerId: z.string(), - address: z.string().optional().nullable(), - name: z.string().optional().nullable(), - accessToken: z.string().optional().nullable(), - refreshToken: z.string().optional().nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.boolean().optional(), - ownerId: z.string(), - }) - .strict() - -export const IdentityUpdateInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - provider: z - .union([z.lazy(() => IdentityProviderSchema), z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema)]) - .optional(), - providerId: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - address: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - accessToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - refreshToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - owner: z.lazy(() => UserUpdateOneRequiredWithoutIdentitiesNestedInputSchema).optional(), - }) - .strict() - -export const IdentityUncheckedUpdateInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - provider: z - .union([z.lazy(() => IdentityProviderSchema), z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema)]) - .optional(), - providerId: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - address: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - accessToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - refreshToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - ownerId: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() - -export const IdentityCreateManyInputSchema: z.ZodType = z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - provider: z.lazy(() => IdentityProviderSchema), - providerId: z.string(), - address: z.string().optional().nullable(), - name: z.string().optional().nullable(), - accessToken: z.string().optional().nullable(), - refreshToken: z.string().optional().nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.boolean().optional(), - ownerId: z.string(), - }) - .strict() - -export const IdentityUpdateManyMutationInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - provider: z - .union([z.lazy(() => IdentityProviderSchema), z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema)]) - .optional(), - providerId: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - address: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - accessToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - refreshToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() - -export const IdentityUncheckedUpdateManyInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - provider: z - .union([z.lazy(() => IdentityProviderSchema), z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema)]) - .optional(), - providerId: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - address: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - accessToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - refreshToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - ownerId: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() - -export const StringFilterSchema: z.ZodType = z - .object({ - equals: z.string().optional(), - in: z.string().array().optional(), - notIn: z.string().array().optional(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z.union([z.string(), z.lazy(() => NestedStringFilterSchema)]).optional(), - }) - .strict() - -export const DateTimeFilterSchema: z.ZodType = z - .object({ - equals: z.coerce.date().optional(), - in: z.coerce.date().array().optional(), - notIn: z.coerce.date().array().optional(), - lt: z.coerce.date().optional(), - lte: z.coerce.date().optional(), - gt: z.coerce.date().optional(), - gte: z.coerce.date().optional(), - not: z.union([z.coerce.date(), z.lazy(() => NestedDateTimeFilterSchema)]).optional(), - }) - .strict() - -export const StringNullableFilterSchema: z.ZodType = z - .object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z - .union([z.string(), z.lazy(() => NestedStringNullableFilterSchema)]) - .optional() - .nullable(), - }) - .strict() - -export const BoolFilterSchema: z.ZodType = z - .object({ - equals: z.boolean().optional(), - not: z.union([z.boolean(), z.lazy(() => NestedBoolFilterSchema)]).optional(), - }) - .strict() - -export const IdentityListRelationFilterSchema: z.ZodType = z - .object({ - every: z.lazy(() => IdentityWhereInputSchema).optional(), - some: z.lazy(() => IdentityWhereInputSchema).optional(), - none: z.lazy(() => IdentityWhereInputSchema).optional(), - }) - .strict() - -export const SortOrderInputSchema: z.ZodType = z - .object({ - sort: z.lazy(() => SortOrderSchema), - nulls: z.lazy(() => NullsOrderSchema).optional(), - }) - .strict() - -export const IdentityOrderByRelationAggregateInputSchema: z.ZodType = z - .object({ - _count: z.lazy(() => SortOrderSchema).optional(), - }) - .strict() - -export const UserCountOrderByAggregateInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - username: z.lazy(() => SortOrderSchema).optional(), - password: z.lazy(() => SortOrderSchema).optional(), - name: z.lazy(() => SortOrderSchema).optional(), - avatarUrl: z.lazy(() => SortOrderSchema).optional(), - admin: z.lazy(() => SortOrderSchema).optional(), - }) - .strict() - -export const UserMaxOrderByAggregateInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - username: z.lazy(() => SortOrderSchema).optional(), - password: z.lazy(() => SortOrderSchema).optional(), - name: z.lazy(() => SortOrderSchema).optional(), - avatarUrl: z.lazy(() => SortOrderSchema).optional(), - admin: z.lazy(() => SortOrderSchema).optional(), - }) - .strict() - -export const UserMinOrderByAggregateInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - username: z.lazy(() => SortOrderSchema).optional(), - password: z.lazy(() => SortOrderSchema).optional(), - name: z.lazy(() => SortOrderSchema).optional(), - avatarUrl: z.lazy(() => SortOrderSchema).optional(), - admin: z.lazy(() => SortOrderSchema).optional(), - }) - .strict() - -export const StringWithAggregatesFilterSchema: z.ZodType = z - .object({ - equals: z.string().optional(), - in: z.string().array().optional(), - notIn: z.string().array().optional(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z.union([z.string(), z.lazy(() => NestedStringWithAggregatesFilterSchema)]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedStringFilterSchema).optional(), - _max: z.lazy(() => NestedStringFilterSchema).optional(), - }) - .strict() - -export const DateTimeWithAggregatesFilterSchema: z.ZodType = z - .object({ - equals: z.coerce.date().optional(), - in: z.coerce.date().array().optional(), - notIn: z.coerce.date().array().optional(), - lt: z.coerce.date().optional(), - lte: z.coerce.date().optional(), - gt: z.coerce.date().optional(), - gte: z.coerce.date().optional(), - not: z.union([z.coerce.date(), z.lazy(() => NestedDateTimeWithAggregatesFilterSchema)]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedDateTimeFilterSchema).optional(), - _max: z.lazy(() => NestedDateTimeFilterSchema).optional(), - }) - .strict() - -export const StringNullableWithAggregatesFilterSchema: z.ZodType = z - .object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z - .union([z.string(), z.lazy(() => NestedStringNullableWithAggregatesFilterSchema)]) - .optional() - .nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), - _max: z.lazy(() => NestedStringNullableFilterSchema).optional(), - }) - .strict() - -export const BoolWithAggregatesFilterSchema: z.ZodType = z - .object({ - equals: z.boolean().optional(), - not: z.union([z.boolean(), z.lazy(() => NestedBoolWithAggregatesFilterSchema)]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedBoolFilterSchema).optional(), - _max: z.lazy(() => NestedBoolFilterSchema).optional(), - }) - .strict() - -export const EnumIdentityProviderFilterSchema: z.ZodType = z - .object({ - equals: z.lazy(() => IdentityProviderSchema).optional(), - in: z - .lazy(() => IdentityProviderSchema) - .array() - .optional(), - notIn: z - .lazy(() => IdentityProviderSchema) - .array() - .optional(), - not: z - .union([z.lazy(() => IdentityProviderSchema), z.lazy(() => NestedEnumIdentityProviderFilterSchema)]) - .optional(), - }) - .strict() - -export const JsonNullableFilterSchema: z.ZodType = z - .object({ - equals: InputJsonValueSchema.optional(), - path: z.string().array().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - string_contains: z.string().optional(), - string_starts_with: z.string().optional(), - string_ends_with: z.string().optional(), - array_starts_with: InputJsonValueSchema.optional().nullable(), - array_ends_with: InputJsonValueSchema.optional().nullable(), - array_contains: InputJsonValueSchema.optional().nullable(), - lt: InputJsonValueSchema.optional(), - lte: InputJsonValueSchema.optional(), - gt: InputJsonValueSchema.optional(), - gte: InputJsonValueSchema.optional(), - not: InputJsonValueSchema.optional(), - }) - .strict() - -export const UserScalarRelationFilterSchema: z.ZodType = z - .object({ - is: z.lazy(() => UserWhereInputSchema).optional(), - isNot: z.lazy(() => UserWhereInputSchema).optional(), - }) - .strict() - -export const IdentityProviderProviderIdCompoundUniqueInputSchema: z.ZodType = - z - .object({ - provider: z.lazy(() => IdentityProviderSchema), - providerId: z.string(), - }) - .strict() - -export const IdentityCountOrderByAggregateInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - provider: z.lazy(() => SortOrderSchema).optional(), - providerId: z.lazy(() => SortOrderSchema).optional(), - address: z.lazy(() => SortOrderSchema).optional(), - name: z.lazy(() => SortOrderSchema).optional(), - accessToken: z.lazy(() => SortOrderSchema).optional(), - refreshToken: z.lazy(() => SortOrderSchema).optional(), - profile: z.lazy(() => SortOrderSchema).optional(), - verified: z.lazy(() => SortOrderSchema).optional(), - ownerId: z.lazy(() => SortOrderSchema).optional(), - }) - .strict() - -export const IdentityMaxOrderByAggregateInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - provider: z.lazy(() => SortOrderSchema).optional(), - providerId: z.lazy(() => SortOrderSchema).optional(), - address: z.lazy(() => SortOrderSchema).optional(), - name: z.lazy(() => SortOrderSchema).optional(), - accessToken: z.lazy(() => SortOrderSchema).optional(), - refreshToken: z.lazy(() => SortOrderSchema).optional(), - verified: z.lazy(() => SortOrderSchema).optional(), - ownerId: z.lazy(() => SortOrderSchema).optional(), - }) - .strict() - -export const IdentityMinOrderByAggregateInputSchema: z.ZodType = z - .object({ - id: z.lazy(() => SortOrderSchema).optional(), - createdAt: z.lazy(() => SortOrderSchema).optional(), - updatedAt: z.lazy(() => SortOrderSchema).optional(), - provider: z.lazy(() => SortOrderSchema).optional(), - providerId: z.lazy(() => SortOrderSchema).optional(), - address: z.lazy(() => SortOrderSchema).optional(), - name: z.lazy(() => SortOrderSchema).optional(), - accessToken: z.lazy(() => SortOrderSchema).optional(), - refreshToken: z.lazy(() => SortOrderSchema).optional(), - verified: z.lazy(() => SortOrderSchema).optional(), - ownerId: z.lazy(() => SortOrderSchema).optional(), - }) - .strict() - -export const EnumIdentityProviderWithAggregatesFilterSchema: z.ZodType = - z - .object({ - equals: z.lazy(() => IdentityProviderSchema).optional(), - in: z - .lazy(() => IdentityProviderSchema) - .array() - .optional(), - notIn: z - .lazy(() => IdentityProviderSchema) - .array() - .optional(), - not: z - .union([ - z.lazy(() => IdentityProviderSchema), - z.lazy(() => NestedEnumIdentityProviderWithAggregatesFilterSchema), - ]) - .optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedEnumIdentityProviderFilterSchema).optional(), - _max: z.lazy(() => NestedEnumIdentityProviderFilterSchema).optional(), - }) - .strict() - -export const JsonNullableWithAggregatesFilterSchema: z.ZodType = z - .object({ - equals: InputJsonValueSchema.optional(), - path: z.string().array().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - string_contains: z.string().optional(), - string_starts_with: z.string().optional(), - string_ends_with: z.string().optional(), - array_starts_with: InputJsonValueSchema.optional().nullable(), - array_ends_with: InputJsonValueSchema.optional().nullable(), - array_contains: InputJsonValueSchema.optional().nullable(), - lt: InputJsonValueSchema.optional(), - lte: InputJsonValueSchema.optional(), - gt: InputJsonValueSchema.optional(), - gte: InputJsonValueSchema.optional(), - not: InputJsonValueSchema.optional(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedJsonNullableFilterSchema).optional(), - _max: z.lazy(() => NestedJsonNullableFilterSchema).optional(), - }) - .strict() - -export const IdentityCreateNestedManyWithoutOwnerInputSchema: z.ZodType = - z - .object({ - create: z - .union([ - z.lazy(() => IdentityCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityCreateWithoutOwnerInputSchema).array(), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema).array(), - ]) - .optional(), - connectOrCreate: z - .union([ - z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema), - z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema).array(), - ]) - .optional(), - createMany: z.lazy(() => IdentityCreateManyOwnerInputEnvelopeSchema).optional(), - connect: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - }) - .strict() - -export const IdentityUncheckedCreateNestedManyWithoutOwnerInputSchema: z.ZodType = - z - .object({ - create: z - .union([ - z.lazy(() => IdentityCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityCreateWithoutOwnerInputSchema).array(), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema).array(), - ]) - .optional(), - connectOrCreate: z - .union([ - z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema), - z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema).array(), - ]) - .optional(), - createMany: z.lazy(() => IdentityCreateManyOwnerInputEnvelopeSchema).optional(), - connect: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - }) - .strict() - -export const StringFieldUpdateOperationsInputSchema: z.ZodType = z - .object({ - set: z.string().optional(), - }) - .strict() - -export const DateTimeFieldUpdateOperationsInputSchema: z.ZodType = z - .object({ - set: z.coerce.date().optional(), - }) - .strict() - -export const NullableStringFieldUpdateOperationsInputSchema: z.ZodType = - z - .object({ - set: z.string().optional().nullable(), - }) - .strict() - -export const BoolFieldUpdateOperationsInputSchema: z.ZodType = z - .object({ - set: z.boolean().optional(), - }) - .strict() - -export const IdentityUpdateManyWithoutOwnerNestedInputSchema: z.ZodType = - z - .object({ - create: z - .union([ - z.lazy(() => IdentityCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityCreateWithoutOwnerInputSchema).array(), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema).array(), - ]) - .optional(), - connectOrCreate: z - .union([ - z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema), - z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema).array(), - ]) - .optional(), - upsert: z - .union([ - z.lazy(() => IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema), - z.lazy(() => IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema).array(), - ]) - .optional(), - createMany: z.lazy(() => IdentityCreateManyOwnerInputEnvelopeSchema).optional(), - set: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - disconnect: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - delete: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - connect: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - update: z - .union([ - z.lazy(() => IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema), - z.lazy(() => IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema).array(), - ]) - .optional(), - updateMany: z - .union([ - z.lazy(() => IdentityUpdateManyWithWhereWithoutOwnerInputSchema), - z.lazy(() => IdentityUpdateManyWithWhereWithoutOwnerInputSchema).array(), - ]) - .optional(), - deleteMany: z - .union([z.lazy(() => IdentityScalarWhereInputSchema), z.lazy(() => IdentityScalarWhereInputSchema).array()]) - .optional(), - }) - .strict() - -export const IdentityUncheckedUpdateManyWithoutOwnerNestedInputSchema: z.ZodType = - z - .object({ - create: z - .union([ - z.lazy(() => IdentityCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityCreateWithoutOwnerInputSchema).array(), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema).array(), - ]) - .optional(), - connectOrCreate: z - .union([ - z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema), - z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema).array(), - ]) - .optional(), - upsert: z - .union([ - z.lazy(() => IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema), - z.lazy(() => IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema).array(), - ]) - .optional(), - createMany: z.lazy(() => IdentityCreateManyOwnerInputEnvelopeSchema).optional(), - set: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - disconnect: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - delete: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - connect: z - .union([z.lazy(() => IdentityWhereUniqueInputSchema), z.lazy(() => IdentityWhereUniqueInputSchema).array()]) - .optional(), - update: z - .union([ - z.lazy(() => IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema), - z.lazy(() => IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema).array(), - ]) - .optional(), - updateMany: z - .union([ - z.lazy(() => IdentityUpdateManyWithWhereWithoutOwnerInputSchema), - z.lazy(() => IdentityUpdateManyWithWhereWithoutOwnerInputSchema).array(), - ]) - .optional(), - deleteMany: z - .union([z.lazy(() => IdentityScalarWhereInputSchema), z.lazy(() => IdentityScalarWhereInputSchema).array()]) - .optional(), - }) - .strict() - -export const UserCreateNestedOneWithoutIdentitiesInputSchema: z.ZodType = - z - .object({ - create: z - .union([ - z.lazy(() => UserCreateWithoutIdentitiesInputSchema), - z.lazy(() => UserUncheckedCreateWithoutIdentitiesInputSchema), - ]) - .optional(), - connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutIdentitiesInputSchema).optional(), - connect: z.lazy(() => UserWhereUniqueInputSchema).optional(), - }) - .strict() - -export const EnumIdentityProviderFieldUpdateOperationsInputSchema: z.ZodType = - z - .object({ - set: z.lazy(() => IdentityProviderSchema).optional(), - }) - .strict() - -export const UserUpdateOneRequiredWithoutIdentitiesNestedInputSchema: z.ZodType = - z - .object({ - create: z - .union([ - z.lazy(() => UserCreateWithoutIdentitiesInputSchema), - z.lazy(() => UserUncheckedCreateWithoutIdentitiesInputSchema), - ]) - .optional(), - connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutIdentitiesInputSchema).optional(), - upsert: z.lazy(() => UserUpsertWithoutIdentitiesInputSchema).optional(), - connect: z.lazy(() => UserWhereUniqueInputSchema).optional(), - update: z - .union([ - z.lazy(() => UserUpdateToOneWithWhereWithoutIdentitiesInputSchema), - z.lazy(() => UserUpdateWithoutIdentitiesInputSchema), - z.lazy(() => UserUncheckedUpdateWithoutIdentitiesInputSchema), - ]) - .optional(), - }) - .strict() - -export const NestedStringFilterSchema: z.ZodType = z - .object({ - equals: z.string().optional(), - in: z.string().array().optional(), - notIn: z.string().array().optional(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - not: z.union([z.string(), z.lazy(() => NestedStringFilterSchema)]).optional(), - }) - .strict() - -export const NestedDateTimeFilterSchema: z.ZodType = z - .object({ - equals: z.coerce.date().optional(), - in: z.coerce.date().array().optional(), - notIn: z.coerce.date().array().optional(), - lt: z.coerce.date().optional(), - lte: z.coerce.date().optional(), - gt: z.coerce.date().optional(), - gte: z.coerce.date().optional(), - not: z.union([z.coerce.date(), z.lazy(() => NestedDateTimeFilterSchema)]).optional(), - }) - .strict() - -export const NestedStringNullableFilterSchema: z.ZodType = z - .object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - not: z - .union([z.string(), z.lazy(() => NestedStringNullableFilterSchema)]) - .optional() - .nullable(), - }) - .strict() - -export const NestedBoolFilterSchema: z.ZodType = z - .object({ - equals: z.boolean().optional(), - not: z.union([z.boolean(), z.lazy(() => NestedBoolFilterSchema)]).optional(), - }) - .strict() - -export const NestedStringWithAggregatesFilterSchema: z.ZodType = z - .object({ - equals: z.string().optional(), - in: z.string().array().optional(), - notIn: z.string().array().optional(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - not: z.union([z.string(), z.lazy(() => NestedStringWithAggregatesFilterSchema)]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedStringFilterSchema).optional(), - _max: z.lazy(() => NestedStringFilterSchema).optional(), - }) - .strict() - -export const NestedIntFilterSchema: z.ZodType = z - .object({ - equals: z.number().optional(), - in: z.number().array().optional(), - notIn: z.number().array().optional(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([z.number(), z.lazy(() => NestedIntFilterSchema)]).optional(), - }) - .strict() - -export const NestedDateTimeWithAggregatesFilterSchema: z.ZodType = z - .object({ - equals: z.coerce.date().optional(), - in: z.coerce.date().array().optional(), - notIn: z.coerce.date().array().optional(), - lt: z.coerce.date().optional(), - lte: z.coerce.date().optional(), - gt: z.coerce.date().optional(), - gte: z.coerce.date().optional(), - not: z.union([z.coerce.date(), z.lazy(() => NestedDateTimeWithAggregatesFilterSchema)]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedDateTimeFilterSchema).optional(), - _max: z.lazy(() => NestedDateTimeFilterSchema).optional(), - }) - .strict() - -export const NestedStringNullableWithAggregatesFilterSchema: z.ZodType = - z - .object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - not: z - .union([z.string(), z.lazy(() => NestedStringNullableWithAggregatesFilterSchema)]) - .optional() - .nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), - _max: z.lazy(() => NestedStringNullableFilterSchema).optional(), - }) - .strict() - -export const NestedIntNullableFilterSchema: z.ZodType = z - .object({ - equals: z.number().optional().nullable(), - in: z.number().array().optional().nullable(), - notIn: z.number().array().optional().nullable(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z - .union([z.number(), z.lazy(() => NestedIntNullableFilterSchema)]) - .optional() - .nullable(), - }) - .strict() - -export const NestedBoolWithAggregatesFilterSchema: z.ZodType = z - .object({ - equals: z.boolean().optional(), - not: z.union([z.boolean(), z.lazy(() => NestedBoolWithAggregatesFilterSchema)]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedBoolFilterSchema).optional(), - _max: z.lazy(() => NestedBoolFilterSchema).optional(), - }) - .strict() - -export const NestedEnumIdentityProviderFilterSchema: z.ZodType = z - .object({ - equals: z.lazy(() => IdentityProviderSchema).optional(), - in: z - .lazy(() => IdentityProviderSchema) - .array() - .optional(), - notIn: z - .lazy(() => IdentityProviderSchema) - .array() - .optional(), - not: z - .union([z.lazy(() => IdentityProviderSchema), z.lazy(() => NestedEnumIdentityProviderFilterSchema)]) - .optional(), - }) - .strict() - -export const NestedEnumIdentityProviderWithAggregatesFilterSchema: z.ZodType = - z - .object({ - equals: z.lazy(() => IdentityProviderSchema).optional(), - in: z - .lazy(() => IdentityProviderSchema) - .array() - .optional(), - notIn: z - .lazy(() => IdentityProviderSchema) - .array() - .optional(), - not: z - .union([ - z.lazy(() => IdentityProviderSchema), - z.lazy(() => NestedEnumIdentityProviderWithAggregatesFilterSchema), - ]) - .optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedEnumIdentityProviderFilterSchema).optional(), - _max: z.lazy(() => NestedEnumIdentityProviderFilterSchema).optional(), - }) - .strict() - -export const NestedJsonNullableFilterSchema: z.ZodType = z - .object({ - equals: InputJsonValueSchema.optional(), - path: z.string().array().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - string_contains: z.string().optional(), - string_starts_with: z.string().optional(), - string_ends_with: z.string().optional(), - array_starts_with: InputJsonValueSchema.optional().nullable(), - array_ends_with: InputJsonValueSchema.optional().nullable(), - array_contains: InputJsonValueSchema.optional().nullable(), - lt: InputJsonValueSchema.optional(), - lte: InputJsonValueSchema.optional(), - gt: InputJsonValueSchema.optional(), - gte: InputJsonValueSchema.optional(), - not: InputJsonValueSchema.optional(), - }) - .strict() - -export const IdentityCreateWithoutOwnerInputSchema: z.ZodType = z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - provider: z.lazy(() => IdentityProviderSchema), - providerId: z.string(), - address: z.string().optional().nullable(), - name: z.string().optional().nullable(), - accessToken: z.string().optional().nullable(), - refreshToken: z.string().optional().nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.boolean().optional(), - }) - .strict() - -export const IdentityUncheckedCreateWithoutOwnerInputSchema: z.ZodType = - z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - provider: z.lazy(() => IdentityProviderSchema), - providerId: z.string(), - address: z.string().optional().nullable(), - name: z.string().optional().nullable(), - accessToken: z.string().optional().nullable(), - refreshToken: z.string().optional().nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.boolean().optional(), - }) - .strict() - -export const IdentityCreateOrConnectWithoutOwnerInputSchema: z.ZodType = - z - .object({ - where: z.lazy(() => IdentityWhereUniqueInputSchema), - create: z.union([ - z.lazy(() => IdentityCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema), - ]), - }) - .strict() - -export const IdentityCreateManyOwnerInputEnvelopeSchema: z.ZodType = z - .object({ - data: z.union([ - z.lazy(() => IdentityCreateManyOwnerInputSchema), - z.lazy(() => IdentityCreateManyOwnerInputSchema).array(), - ]), - skipDuplicates: z.boolean().optional(), - }) - .strict() - -export const IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema: z.ZodType = - z - .object({ - where: z.lazy(() => IdentityWhereUniqueInputSchema), - update: z.union([ - z.lazy(() => IdentityUpdateWithoutOwnerInputSchema), - z.lazy(() => IdentityUncheckedUpdateWithoutOwnerInputSchema), - ]), - create: z.union([ - z.lazy(() => IdentityCreateWithoutOwnerInputSchema), - z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema), - ]), - }) - .strict() - -export const IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema: z.ZodType = - z - .object({ - where: z.lazy(() => IdentityWhereUniqueInputSchema), - data: z.union([ - z.lazy(() => IdentityUpdateWithoutOwnerInputSchema), - z.lazy(() => IdentityUncheckedUpdateWithoutOwnerInputSchema), - ]), - }) - .strict() - -export const IdentityUpdateManyWithWhereWithoutOwnerInputSchema: z.ZodType = - z - .object({ - where: z.lazy(() => IdentityScalarWhereInputSchema), - data: z.union([ - z.lazy(() => IdentityUpdateManyMutationInputSchema), - z.lazy(() => IdentityUncheckedUpdateManyWithoutOwnerInputSchema), - ]), - }) - .strict() - -export const IdentityScalarWhereInputSchema: z.ZodType = z - .object({ - AND: z - .union([z.lazy(() => IdentityScalarWhereInputSchema), z.lazy(() => IdentityScalarWhereInputSchema).array()]) - .optional(), - OR: z - .lazy(() => IdentityScalarWhereInputSchema) - .array() - .optional(), - NOT: z - .union([z.lazy(() => IdentityScalarWhereInputSchema), z.lazy(() => IdentityScalarWhereInputSchema).array()]) - .optional(), - id: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - createdAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - updatedAt: z.union([z.lazy(() => DateTimeFilterSchema), z.coerce.date()]).optional(), - provider: z - .union([z.lazy(() => EnumIdentityProviderFilterSchema), z.lazy(() => IdentityProviderSchema)]) - .optional(), - providerId: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - address: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - name: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - accessToken: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - refreshToken: z - .union([z.lazy(() => StringNullableFilterSchema), z.string()]) - .optional() - .nullable(), - profile: z.lazy(() => JsonNullableFilterSchema).optional(), - verified: z.union([z.lazy(() => BoolFilterSchema), z.boolean()]).optional(), - ownerId: z.union([z.lazy(() => StringFilterSchema), z.string()]).optional(), - }) - .strict() - -export const UserCreateWithoutIdentitiesInputSchema: z.ZodType = z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - username: z.string(), - password: z.string().optional().nullable(), - name: z.string().optional().nullable(), - avatarUrl: z.string().optional().nullable(), - admin: z.boolean().optional(), - }) - .strict() - -export const UserUncheckedCreateWithoutIdentitiesInputSchema: z.ZodType = - z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - username: z.string(), - password: z.string().optional().nullable(), - name: z.string().optional().nullable(), - avatarUrl: z.string().optional().nullable(), - admin: z.boolean().optional(), - }) - .strict() - -export const UserCreateOrConnectWithoutIdentitiesInputSchema: z.ZodType = - z - .object({ - where: z.lazy(() => UserWhereUniqueInputSchema), - create: z.union([ - z.lazy(() => UserCreateWithoutIdentitiesInputSchema), - z.lazy(() => UserUncheckedCreateWithoutIdentitiesInputSchema), - ]), - }) - .strict() - -export const UserUpsertWithoutIdentitiesInputSchema: z.ZodType = z - .object({ - update: z.union([ - z.lazy(() => UserUpdateWithoutIdentitiesInputSchema), - z.lazy(() => UserUncheckedUpdateWithoutIdentitiesInputSchema), - ]), - create: z.union([ - z.lazy(() => UserCreateWithoutIdentitiesInputSchema), - z.lazy(() => UserUncheckedCreateWithoutIdentitiesInputSchema), - ]), - where: z.lazy(() => UserWhereInputSchema).optional(), - }) - .strict() - -export const UserUpdateToOneWithWhereWithoutIdentitiesInputSchema: z.ZodType = - z - .object({ - where: z.lazy(() => UserWhereInputSchema).optional(), - data: z.union([ - z.lazy(() => UserUpdateWithoutIdentitiesInputSchema), - z.lazy(() => UserUncheckedUpdateWithoutIdentitiesInputSchema), - ]), - }) - .strict() - -export const UserUpdateWithoutIdentitiesInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - username: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - password: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - avatarUrl: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - admin: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() - -export const UserUncheckedUpdateWithoutIdentitiesInputSchema: z.ZodType = - z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - username: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - password: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - avatarUrl: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - admin: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() - -export const IdentityCreateManyOwnerInputSchema: z.ZodType = z - .object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - provider: z.lazy(() => IdentityProviderSchema), - providerId: z.string(), - address: z.string().optional().nullable(), - name: z.string().optional().nullable(), - accessToken: z.string().optional().nullable(), - refreshToken: z.string().optional().nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.boolean().optional(), - }) - .strict() - -export const IdentityUpdateWithoutOwnerInputSchema: z.ZodType = z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - provider: z - .union([z.lazy(() => IdentityProviderSchema), z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema)]) - .optional(), - providerId: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - address: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - accessToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - refreshToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() - -export const IdentityUncheckedUpdateWithoutOwnerInputSchema: z.ZodType = - z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - provider: z - .union([ - z.lazy(() => IdentityProviderSchema), - z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema), - ]) - .optional(), - providerId: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - address: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - accessToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - refreshToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() - -export const IdentityUncheckedUpdateManyWithoutOwnerInputSchema: z.ZodType = - z - .object({ - id: z.union([z.string().cuid(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputSchema)]).optional(), - provider: z - .union([ - z.lazy(() => IdentityProviderSchema), - z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema), - ]) - .optional(), - providerId: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputSchema)]).optional(), - address: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - name: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - accessToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - refreshToken: z - .union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputSchema)]) - .optional() - .nullable(), - profile: z.union([z.lazy(() => NullableJsonNullValueInputSchema), InputJsonValueSchema]).optional(), - verified: z.union([z.boolean(), z.lazy(() => BoolFieldUpdateOperationsInputSchema)]).optional(), - }) - .strict() + }), +]) +.and(z.object({ + id: z.string().cuid().optional(), + username: z.string().optional(), + AND: z.union([ z.lazy(() => UserWhereInputSchema),z.lazy(() => UserWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => UserWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => UserWhereInputSchema),z.lazy(() => UserWhereInputSchema).array() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + password: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + name: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + bio: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + avatarUrl: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + admin: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), + identities: z.lazy(() => IdentityListRelationFilterSchema).optional() +}).strict()); + +export const UserOrderByWithAggregationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + username: z.lazy(() => SortOrderSchema).optional(), + password: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + bio: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + avatarUrl: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + admin: z.lazy(() => SortOrderSchema).optional(), + _count: z.lazy(() => UserCountOrderByAggregateInputSchema).optional(), + _max: z.lazy(() => UserMaxOrderByAggregateInputSchema).optional(), + _min: z.lazy(() => UserMinOrderByAggregateInputSchema).optional() +}).strict(); + +export const UserScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => UserScalarWhereWithAggregatesInputSchema),z.lazy(() => UserScalarWhereWithAggregatesInputSchema).array() ]).optional(), + OR: z.lazy(() => UserScalarWhereWithAggregatesInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => UserScalarWhereWithAggregatesInputSchema),z.lazy(() => UserScalarWhereWithAggregatesInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), + username: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + password: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + name: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + bio: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + avatarUrl: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + admin: z.union([ z.lazy(() => BoolWithAggregatesFilterSchema),z.boolean() ]).optional(), +}).strict(); + +export const IdentityWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => IdentityWhereInputSchema),z.lazy(() => IdentityWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => IdentityWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => IdentityWhereInputSchema),z.lazy(() => IdentityWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + provider: z.union([ z.lazy(() => EnumIdentityProviderFilterSchema),z.lazy(() => IdentityProviderSchema) ]).optional(), + providerId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + address: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + name: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + accessToken: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + refreshToken: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + profile: z.lazy(() => JsonNullableFilterSchema).optional(), + verified: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), + ownerId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + owner: z.union([ z.lazy(() => UserScalarRelationFilterSchema),z.lazy(() => UserWhereInputSchema) ]).optional(), +}).strict(); + +export const IdentityOrderByWithRelationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + provider: z.lazy(() => SortOrderSchema).optional(), + providerId: z.lazy(() => SortOrderSchema).optional(), + address: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + accessToken: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + refreshToken: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + profile: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + verified: z.lazy(() => SortOrderSchema).optional(), + ownerId: z.lazy(() => SortOrderSchema).optional(), + owner: z.lazy(() => UserOrderByWithRelationInputSchema).optional() +}).strict(); + +export const IdentityWhereUniqueInputSchema: z.ZodType = z.union([ + z.object({ + id: z.string().cuid(), + provider_providerId: z.lazy(() => IdentityProviderProviderIdCompoundUniqueInputSchema) + }), + z.object({ + id: z.string().cuid(), + }), + z.object({ + provider_providerId: z.lazy(() => IdentityProviderProviderIdCompoundUniqueInputSchema), + }), +]) +.and(z.object({ + id: z.string().cuid().optional(), + provider_providerId: z.lazy(() => IdentityProviderProviderIdCompoundUniqueInputSchema).optional(), + AND: z.union([ z.lazy(() => IdentityWhereInputSchema),z.lazy(() => IdentityWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => IdentityWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => IdentityWhereInputSchema),z.lazy(() => IdentityWhereInputSchema).array() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + provider: z.union([ z.lazy(() => EnumIdentityProviderFilterSchema),z.lazy(() => IdentityProviderSchema) ]).optional(), + providerId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + address: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + name: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + accessToken: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + refreshToken: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + profile: z.lazy(() => JsonNullableFilterSchema).optional(), + verified: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), + ownerId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + owner: z.union([ z.lazy(() => UserScalarRelationFilterSchema),z.lazy(() => UserWhereInputSchema) ]).optional(), +}).strict()); + +export const IdentityOrderByWithAggregationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + provider: z.lazy(() => SortOrderSchema).optional(), + providerId: z.lazy(() => SortOrderSchema).optional(), + address: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + accessToken: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + refreshToken: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + profile: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + verified: z.lazy(() => SortOrderSchema).optional(), + ownerId: z.lazy(() => SortOrderSchema).optional(), + _count: z.lazy(() => IdentityCountOrderByAggregateInputSchema).optional(), + _max: z.lazy(() => IdentityMaxOrderByAggregateInputSchema).optional(), + _min: z.lazy(() => IdentityMinOrderByAggregateInputSchema).optional() +}).strict(); + +export const IdentityScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => IdentityScalarWhereWithAggregatesInputSchema),z.lazy(() => IdentityScalarWhereWithAggregatesInputSchema).array() ]).optional(), + OR: z.lazy(() => IdentityScalarWhereWithAggregatesInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => IdentityScalarWhereWithAggregatesInputSchema),z.lazy(() => IdentityScalarWhereWithAggregatesInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), + provider: z.union([ z.lazy(() => EnumIdentityProviderWithAggregatesFilterSchema),z.lazy(() => IdentityProviderSchema) ]).optional(), + providerId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + address: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + name: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + accessToken: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + refreshToken: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + profile: z.lazy(() => JsonNullableWithAggregatesFilterSchema).optional(), + verified: z.union([ z.lazy(() => BoolWithAggregatesFilterSchema),z.boolean() ]).optional(), + ownerId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), +}).strict(); + +export const UserCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + username: z.string(), + password: z.string().optional().nullable(), + name: z.string().optional().nullable(), + bio: z.string().optional().nullable(), + avatarUrl: z.string().optional().nullable(), + admin: z.boolean().optional(), + identities: z.lazy(() => IdentityCreateNestedManyWithoutOwnerInputSchema).optional() +}).strict(); + +export const UserUncheckedCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + username: z.string(), + password: z.string().optional().nullable(), + name: z.string().optional().nullable(), + bio: z.string().optional().nullable(), + avatarUrl: z.string().optional().nullable(), + admin: z.boolean().optional(), + identities: z.lazy(() => IdentityUncheckedCreateNestedManyWithoutOwnerInputSchema).optional() +}).strict(); + +export const UserUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + password: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + bio: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + avatarUrl: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + admin: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + identities: z.lazy(() => IdentityUpdateManyWithoutOwnerNestedInputSchema).optional() +}).strict(); + +export const UserUncheckedUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + password: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + bio: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + avatarUrl: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + admin: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + identities: z.lazy(() => IdentityUncheckedUpdateManyWithoutOwnerNestedInputSchema).optional() +}).strict(); + +export const UserCreateManyInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + username: z.string(), + password: z.string().optional().nullable(), + name: z.string().optional().nullable(), + bio: z.string().optional().nullable(), + avatarUrl: z.string().optional().nullable(), + admin: z.boolean().optional() +}).strict(); + +export const UserUpdateManyMutationInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + password: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + bio: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + avatarUrl: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + admin: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const UserUncheckedUpdateManyInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + password: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + bio: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + avatarUrl: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + admin: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const IdentityCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + provider: z.lazy(() => IdentityProviderSchema), + providerId: z.string(), + address: z.string().optional().nullable(), + name: z.string().optional().nullable(), + accessToken: z.string().optional().nullable(), + refreshToken: z.string().optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.boolean().optional(), + owner: z.lazy(() => UserCreateNestedOneWithoutIdentitiesInputSchema) +}).strict(); + +export const IdentityUncheckedCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + provider: z.lazy(() => IdentityProviderSchema), + providerId: z.string(), + address: z.string().optional().nullable(), + name: z.string().optional().nullable(), + accessToken: z.string().optional().nullable(), + refreshToken: z.string().optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.boolean().optional(), + ownerId: z.string() +}).strict(); + +export const IdentityUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + provider: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema) ]).optional(), + providerId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + accessToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + refreshToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + owner: z.lazy(() => UserUpdateOneRequiredWithoutIdentitiesNestedInputSchema).optional() +}).strict(); + +export const IdentityUncheckedUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + provider: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema) ]).optional(), + providerId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + accessToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + refreshToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + ownerId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const IdentityCreateManyInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + provider: z.lazy(() => IdentityProviderSchema), + providerId: z.string(), + address: z.string().optional().nullable(), + name: z.string().optional().nullable(), + accessToken: z.string().optional().nullable(), + refreshToken: z.string().optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.boolean().optional(), + ownerId: z.string() +}).strict(); + +export const IdentityUpdateManyMutationInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + provider: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema) ]).optional(), + providerId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + accessToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + refreshToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const IdentityUncheckedUpdateManyInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + provider: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema) ]).optional(), + providerId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + accessToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + refreshToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + ownerId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const StringFilterSchema: z.ZodType = z.object({ + equals: z.string().optional(), + in: z.string().array().optional(), + notIn: z.string().array().optional(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + mode: z.lazy(() => QueryModeSchema).optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringFilterSchema) ]).optional(), +}).strict(); + +export const DateTimeFilterSchema: z.ZodType = z.object({ + equals: z.coerce.date().optional(), + in: z.coerce.date().array().optional(), + notIn: z.coerce.date().array().optional(), + lt: z.coerce.date().optional(), + lte: z.coerce.date().optional(), + gt: z.coerce.date().optional(), + gte: z.coerce.date().optional(), + not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeFilterSchema) ]).optional(), +}).strict(); + +export const StringNullableFilterSchema: z.ZodType = z.object({ + equals: z.string().optional().nullable(), + in: z.string().array().optional().nullable(), + notIn: z.string().array().optional().nullable(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + mode: z.lazy(() => QueryModeSchema).optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringNullableFilterSchema) ]).optional().nullable(), +}).strict(); + +export const BoolFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolFilterSchema) ]).optional(), +}).strict(); + +export const IdentityListRelationFilterSchema: z.ZodType = z.object({ + every: z.lazy(() => IdentityWhereInputSchema).optional(), + some: z.lazy(() => IdentityWhereInputSchema).optional(), + none: z.lazy(() => IdentityWhereInputSchema).optional() +}).strict(); + +export const SortOrderInputSchema: z.ZodType = z.object({ + sort: z.lazy(() => SortOrderSchema), + nulls: z.lazy(() => NullsOrderSchema).optional() +}).strict(); + +export const IdentityOrderByRelationAggregateInputSchema: z.ZodType = z.object({ + _count: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const UserCountOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + username: z.lazy(() => SortOrderSchema).optional(), + password: z.lazy(() => SortOrderSchema).optional(), + name: z.lazy(() => SortOrderSchema).optional(), + bio: z.lazy(() => SortOrderSchema).optional(), + avatarUrl: z.lazy(() => SortOrderSchema).optional(), + admin: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const UserMaxOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + username: z.lazy(() => SortOrderSchema).optional(), + password: z.lazy(() => SortOrderSchema).optional(), + name: z.lazy(() => SortOrderSchema).optional(), + bio: z.lazy(() => SortOrderSchema).optional(), + avatarUrl: z.lazy(() => SortOrderSchema).optional(), + admin: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const UserMinOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + username: z.lazy(() => SortOrderSchema).optional(), + password: z.lazy(() => SortOrderSchema).optional(), + name: z.lazy(() => SortOrderSchema).optional(), + bio: z.lazy(() => SortOrderSchema).optional(), + avatarUrl: z.lazy(() => SortOrderSchema).optional(), + admin: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const StringWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.string().optional(), + in: z.string().array().optional(), + notIn: z.string().array().optional(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + mode: z.lazy(() => QueryModeSchema).optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedStringFilterSchema).optional(), + _max: z.lazy(() => NestedStringFilterSchema).optional() +}).strict(); + +export const DateTimeWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.coerce.date().optional(), + in: z.coerce.date().array().optional(), + notIn: z.coerce.date().array().optional(), + lt: z.coerce.date().optional(), + lte: z.coerce.date().optional(), + gt: z.coerce.date().optional(), + gte: z.coerce.date().optional(), + not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedDateTimeFilterSchema).optional(), + _max: z.lazy(() => NestedDateTimeFilterSchema).optional() +}).strict(); + +export const StringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.string().optional().nullable(), + in: z.string().array().optional().nullable(), + notIn: z.string().array().optional().nullable(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + mode: z.lazy(() => QueryModeSchema).optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringNullableWithAggregatesFilterSchema) ]).optional().nullable(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), + _max: z.lazy(() => NestedStringNullableFilterSchema).optional() +}).strict(); + +export const BoolWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedBoolFilterSchema).optional(), + _max: z.lazy(() => NestedBoolFilterSchema).optional() +}).strict(); + +export const EnumIdentityProviderFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => IdentityProviderSchema).optional(), + in: z.lazy(() => IdentityProviderSchema).array().optional(), + notIn: z.lazy(() => IdentityProviderSchema).array().optional(), + not: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => NestedEnumIdentityProviderFilterSchema) ]).optional(), +}).strict(); + +export const JsonNullableFilterSchema: z.ZodType = z.object({ + equals: InputJsonValueSchema.optional(), + path: z.string().array().optional(), + mode: z.lazy(() => QueryModeSchema).optional(), + string_contains: z.string().optional(), + string_starts_with: z.string().optional(), + string_ends_with: z.string().optional(), + array_starts_with: InputJsonValueSchema.optional().nullable(), + array_ends_with: InputJsonValueSchema.optional().nullable(), + array_contains: InputJsonValueSchema.optional().nullable(), + lt: InputJsonValueSchema.optional(), + lte: InputJsonValueSchema.optional(), + gt: InputJsonValueSchema.optional(), + gte: InputJsonValueSchema.optional(), + not: InputJsonValueSchema.optional() +}).strict(); + +export const UserScalarRelationFilterSchema: z.ZodType = z.object({ + is: z.lazy(() => UserWhereInputSchema).optional(), + isNot: z.lazy(() => UserWhereInputSchema).optional() +}).strict(); + +export const IdentityProviderProviderIdCompoundUniqueInputSchema: z.ZodType = z.object({ + provider: z.lazy(() => IdentityProviderSchema), + providerId: z.string() +}).strict(); + +export const IdentityCountOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + provider: z.lazy(() => SortOrderSchema).optional(), + providerId: z.lazy(() => SortOrderSchema).optional(), + address: z.lazy(() => SortOrderSchema).optional(), + name: z.lazy(() => SortOrderSchema).optional(), + accessToken: z.lazy(() => SortOrderSchema).optional(), + refreshToken: z.lazy(() => SortOrderSchema).optional(), + profile: z.lazy(() => SortOrderSchema).optional(), + verified: z.lazy(() => SortOrderSchema).optional(), + ownerId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const IdentityMaxOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + provider: z.lazy(() => SortOrderSchema).optional(), + providerId: z.lazy(() => SortOrderSchema).optional(), + address: z.lazy(() => SortOrderSchema).optional(), + name: z.lazy(() => SortOrderSchema).optional(), + accessToken: z.lazy(() => SortOrderSchema).optional(), + refreshToken: z.lazy(() => SortOrderSchema).optional(), + verified: z.lazy(() => SortOrderSchema).optional(), + ownerId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const IdentityMinOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + provider: z.lazy(() => SortOrderSchema).optional(), + providerId: z.lazy(() => SortOrderSchema).optional(), + address: z.lazy(() => SortOrderSchema).optional(), + name: z.lazy(() => SortOrderSchema).optional(), + accessToken: z.lazy(() => SortOrderSchema).optional(), + refreshToken: z.lazy(() => SortOrderSchema).optional(), + verified: z.lazy(() => SortOrderSchema).optional(), + ownerId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const EnumIdentityProviderWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => IdentityProviderSchema).optional(), + in: z.lazy(() => IdentityProviderSchema).array().optional(), + notIn: z.lazy(() => IdentityProviderSchema).array().optional(), + not: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => NestedEnumIdentityProviderWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedEnumIdentityProviderFilterSchema).optional(), + _max: z.lazy(() => NestedEnumIdentityProviderFilterSchema).optional() +}).strict(); + +export const JsonNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: InputJsonValueSchema.optional(), + path: z.string().array().optional(), + mode: z.lazy(() => QueryModeSchema).optional(), + string_contains: z.string().optional(), + string_starts_with: z.string().optional(), + string_ends_with: z.string().optional(), + array_starts_with: InputJsonValueSchema.optional().nullable(), + array_ends_with: InputJsonValueSchema.optional().nullable(), + array_contains: InputJsonValueSchema.optional().nullable(), + lt: InputJsonValueSchema.optional(), + lte: InputJsonValueSchema.optional(), + gt: InputJsonValueSchema.optional(), + gte: InputJsonValueSchema.optional(), + not: InputJsonValueSchema.optional(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedJsonNullableFilterSchema).optional(), + _max: z.lazy(() => NestedJsonNullableFilterSchema).optional() +}).strict(); + +export const IdentityCreateNestedManyWithoutOwnerInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => IdentityCreateWithoutOwnerInputSchema),z.lazy(() => IdentityCreateWithoutOwnerInputSchema).array(),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema),z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema).array() ]).optional(), + createMany: z.lazy(() => IdentityCreateManyOwnerInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), +}).strict(); + +export const IdentityUncheckedCreateNestedManyWithoutOwnerInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => IdentityCreateWithoutOwnerInputSchema),z.lazy(() => IdentityCreateWithoutOwnerInputSchema).array(),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema),z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema).array() ]).optional(), + createMany: z.lazy(() => IdentityCreateManyOwnerInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), +}).strict(); + +export const StringFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.string().optional() +}).strict(); + +export const DateTimeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.coerce.date().optional() +}).strict(); + +export const NullableStringFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.string().optional().nullable() +}).strict(); + +export const BoolFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.boolean().optional() +}).strict(); + +export const IdentityUpdateManyWithoutOwnerNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => IdentityCreateWithoutOwnerInputSchema),z.lazy(() => IdentityCreateWithoutOwnerInputSchema).array(),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema),z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema),z.lazy(() => IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema).array() ]).optional(), + createMany: z.lazy(() => IdentityCreateManyOwnerInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema),z.lazy(() => IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => IdentityUpdateManyWithWhereWithoutOwnerInputSchema),z.lazy(() => IdentityUpdateManyWithWhereWithoutOwnerInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => IdentityScalarWhereInputSchema),z.lazy(() => IdentityScalarWhereInputSchema).array() ]).optional(), +}).strict(); + +export const IdentityUncheckedUpdateManyWithoutOwnerNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => IdentityCreateWithoutOwnerInputSchema),z.lazy(() => IdentityCreateWithoutOwnerInputSchema).array(),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema),z.lazy(() => IdentityCreateOrConnectWithoutOwnerInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema),z.lazy(() => IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema).array() ]).optional(), + createMany: z.lazy(() => IdentityCreateManyOwnerInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => IdentityWhereUniqueInputSchema),z.lazy(() => IdentityWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema),z.lazy(() => IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => IdentityUpdateManyWithWhereWithoutOwnerInputSchema),z.lazy(() => IdentityUpdateManyWithWhereWithoutOwnerInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => IdentityScalarWhereInputSchema),z.lazy(() => IdentityScalarWhereInputSchema).array() ]).optional(), +}).strict(); + +export const UserCreateNestedOneWithoutIdentitiesInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => UserCreateWithoutIdentitiesInputSchema),z.lazy(() => UserUncheckedCreateWithoutIdentitiesInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutIdentitiesInputSchema).optional(), + connect: z.lazy(() => UserWhereUniqueInputSchema).optional() +}).strict(); + +export const EnumIdentityProviderFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.lazy(() => IdentityProviderSchema).optional() +}).strict(); + +export const UserUpdateOneRequiredWithoutIdentitiesNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => UserCreateWithoutIdentitiesInputSchema),z.lazy(() => UserUncheckedCreateWithoutIdentitiesInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutIdentitiesInputSchema).optional(), + upsert: z.lazy(() => UserUpsertWithoutIdentitiesInputSchema).optional(), + connect: z.lazy(() => UserWhereUniqueInputSchema).optional(), + update: z.union([ z.lazy(() => UserUpdateToOneWithWhereWithoutIdentitiesInputSchema),z.lazy(() => UserUpdateWithoutIdentitiesInputSchema),z.lazy(() => UserUncheckedUpdateWithoutIdentitiesInputSchema) ]).optional(), +}).strict(); + +export const NestedStringFilterSchema: z.ZodType = z.object({ + equals: z.string().optional(), + in: z.string().array().optional(), + notIn: z.string().array().optional(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringFilterSchema) ]).optional(), +}).strict(); + +export const NestedDateTimeFilterSchema: z.ZodType = z.object({ + equals: z.coerce.date().optional(), + in: z.coerce.date().array().optional(), + notIn: z.coerce.date().array().optional(), + lt: z.coerce.date().optional(), + lte: z.coerce.date().optional(), + gt: z.coerce.date().optional(), + gte: z.coerce.date().optional(), + not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeFilterSchema) ]).optional(), +}).strict(); + +export const NestedStringNullableFilterSchema: z.ZodType = z.object({ + equals: z.string().optional().nullable(), + in: z.string().array().optional().nullable(), + notIn: z.string().array().optional().nullable(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringNullableFilterSchema) ]).optional().nullable(), +}).strict(); + +export const NestedBoolFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolFilterSchema) ]).optional(), +}).strict(); + +export const NestedStringWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.string().optional(), + in: z.string().array().optional(), + notIn: z.string().array().optional(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedStringFilterSchema).optional(), + _max: z.lazy(() => NestedStringFilterSchema).optional() +}).strict(); + +export const NestedIntFilterSchema: z.ZodType = z.object({ + equals: z.number().optional(), + in: z.number().array().optional(), + notIn: z.number().array().optional(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntFilterSchema) ]).optional(), +}).strict(); + +export const NestedDateTimeWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.coerce.date().optional(), + in: z.coerce.date().array().optional(), + notIn: z.coerce.date().array().optional(), + lt: z.coerce.date().optional(), + lte: z.coerce.date().optional(), + gt: z.coerce.date().optional(), + gte: z.coerce.date().optional(), + not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedDateTimeFilterSchema).optional(), + _max: z.lazy(() => NestedDateTimeFilterSchema).optional() +}).strict(); + +export const NestedStringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.string().optional().nullable(), + in: z.string().array().optional().nullable(), + notIn: z.string().array().optional().nullable(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringNullableWithAggregatesFilterSchema) ]).optional().nullable(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), + _max: z.lazy(() => NestedStringNullableFilterSchema).optional() +}).strict(); + +export const NestedIntNullableFilterSchema: z.ZodType = z.object({ + equals: z.number().optional().nullable(), + in: z.number().array().optional().nullable(), + notIn: z.number().array().optional().nullable(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntNullableFilterSchema) ]).optional().nullable(), +}).strict(); + +export const NestedBoolWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedBoolFilterSchema).optional(), + _max: z.lazy(() => NestedBoolFilterSchema).optional() +}).strict(); + +export const NestedEnumIdentityProviderFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => IdentityProviderSchema).optional(), + in: z.lazy(() => IdentityProviderSchema).array().optional(), + notIn: z.lazy(() => IdentityProviderSchema).array().optional(), + not: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => NestedEnumIdentityProviderFilterSchema) ]).optional(), +}).strict(); + +export const NestedEnumIdentityProviderWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => IdentityProviderSchema).optional(), + in: z.lazy(() => IdentityProviderSchema).array().optional(), + notIn: z.lazy(() => IdentityProviderSchema).array().optional(), + not: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => NestedEnumIdentityProviderWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedEnumIdentityProviderFilterSchema).optional(), + _max: z.lazy(() => NestedEnumIdentityProviderFilterSchema).optional() +}).strict(); + +export const NestedJsonNullableFilterSchema: z.ZodType = z.object({ + equals: InputJsonValueSchema.optional(), + path: z.string().array().optional(), + mode: z.lazy(() => QueryModeSchema).optional(), + string_contains: z.string().optional(), + string_starts_with: z.string().optional(), + string_ends_with: z.string().optional(), + array_starts_with: InputJsonValueSchema.optional().nullable(), + array_ends_with: InputJsonValueSchema.optional().nullable(), + array_contains: InputJsonValueSchema.optional().nullable(), + lt: InputJsonValueSchema.optional(), + lte: InputJsonValueSchema.optional(), + gt: InputJsonValueSchema.optional(), + gte: InputJsonValueSchema.optional(), + not: InputJsonValueSchema.optional() +}).strict(); + +export const IdentityCreateWithoutOwnerInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + provider: z.lazy(() => IdentityProviderSchema), + providerId: z.string(), + address: z.string().optional().nullable(), + name: z.string().optional().nullable(), + accessToken: z.string().optional().nullable(), + refreshToken: z.string().optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.boolean().optional() +}).strict(); + +export const IdentityUncheckedCreateWithoutOwnerInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + provider: z.lazy(() => IdentityProviderSchema), + providerId: z.string(), + address: z.string().optional().nullable(), + name: z.string().optional().nullable(), + accessToken: z.string().optional().nullable(), + refreshToken: z.string().optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.boolean().optional() +}).strict(); + +export const IdentityCreateOrConnectWithoutOwnerInputSchema: z.ZodType = z.object({ + where: z.lazy(() => IdentityWhereUniqueInputSchema), + create: z.union([ z.lazy(() => IdentityCreateWithoutOwnerInputSchema),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema) ]), +}).strict(); + +export const IdentityCreateManyOwnerInputEnvelopeSchema: z.ZodType = z.object({ + data: z.union([ z.lazy(() => IdentityCreateManyOwnerInputSchema),z.lazy(() => IdentityCreateManyOwnerInputSchema).array() ]), + skipDuplicates: z.boolean().optional() +}).strict(); + +export const IdentityUpsertWithWhereUniqueWithoutOwnerInputSchema: z.ZodType = z.object({ + where: z.lazy(() => IdentityWhereUniqueInputSchema), + update: z.union([ z.lazy(() => IdentityUpdateWithoutOwnerInputSchema),z.lazy(() => IdentityUncheckedUpdateWithoutOwnerInputSchema) ]), + create: z.union([ z.lazy(() => IdentityCreateWithoutOwnerInputSchema),z.lazy(() => IdentityUncheckedCreateWithoutOwnerInputSchema) ]), +}).strict(); + +export const IdentityUpdateWithWhereUniqueWithoutOwnerInputSchema: z.ZodType = z.object({ + where: z.lazy(() => IdentityWhereUniqueInputSchema), + data: z.union([ z.lazy(() => IdentityUpdateWithoutOwnerInputSchema),z.lazy(() => IdentityUncheckedUpdateWithoutOwnerInputSchema) ]), +}).strict(); + +export const IdentityUpdateManyWithWhereWithoutOwnerInputSchema: z.ZodType = z.object({ + where: z.lazy(() => IdentityScalarWhereInputSchema), + data: z.union([ z.lazy(() => IdentityUpdateManyMutationInputSchema),z.lazy(() => IdentityUncheckedUpdateManyWithoutOwnerInputSchema) ]), +}).strict(); + +export const IdentityScalarWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => IdentityScalarWhereInputSchema),z.lazy(() => IdentityScalarWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => IdentityScalarWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => IdentityScalarWhereInputSchema),z.lazy(() => IdentityScalarWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + provider: z.union([ z.lazy(() => EnumIdentityProviderFilterSchema),z.lazy(() => IdentityProviderSchema) ]).optional(), + providerId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + address: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + name: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + accessToken: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + refreshToken: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + profile: z.lazy(() => JsonNullableFilterSchema).optional(), + verified: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), + ownerId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), +}).strict(); + +export const UserCreateWithoutIdentitiesInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + username: z.string(), + password: z.string().optional().nullable(), + name: z.string().optional().nullable(), + bio: z.string().optional().nullable(), + avatarUrl: z.string().optional().nullable(), + admin: z.boolean().optional() +}).strict(); + +export const UserUncheckedCreateWithoutIdentitiesInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + username: z.string(), + password: z.string().optional().nullable(), + name: z.string().optional().nullable(), + bio: z.string().optional().nullable(), + avatarUrl: z.string().optional().nullable(), + admin: z.boolean().optional() +}).strict(); + +export const UserCreateOrConnectWithoutIdentitiesInputSchema: z.ZodType = z.object({ + where: z.lazy(() => UserWhereUniqueInputSchema), + create: z.union([ z.lazy(() => UserCreateWithoutIdentitiesInputSchema),z.lazy(() => UserUncheckedCreateWithoutIdentitiesInputSchema) ]), +}).strict(); + +export const UserUpsertWithoutIdentitiesInputSchema: z.ZodType = z.object({ + update: z.union([ z.lazy(() => UserUpdateWithoutIdentitiesInputSchema),z.lazy(() => UserUncheckedUpdateWithoutIdentitiesInputSchema) ]), + create: z.union([ z.lazy(() => UserCreateWithoutIdentitiesInputSchema),z.lazy(() => UserUncheckedCreateWithoutIdentitiesInputSchema) ]), + where: z.lazy(() => UserWhereInputSchema).optional() +}).strict(); + +export const UserUpdateToOneWithWhereWithoutIdentitiesInputSchema: z.ZodType = z.object({ + where: z.lazy(() => UserWhereInputSchema).optional(), + data: z.union([ z.lazy(() => UserUpdateWithoutIdentitiesInputSchema),z.lazy(() => UserUncheckedUpdateWithoutIdentitiesInputSchema) ]), +}).strict(); + +export const UserUpdateWithoutIdentitiesInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + password: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + bio: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + avatarUrl: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + admin: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const UserUncheckedUpdateWithoutIdentitiesInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + password: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + bio: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + avatarUrl: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + admin: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const IdentityCreateManyOwnerInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + provider: z.lazy(() => IdentityProviderSchema), + providerId: z.string(), + address: z.string().optional().nullable(), + name: z.string().optional().nullable(), + accessToken: z.string().optional().nullable(), + refreshToken: z.string().optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.boolean().optional() +}).strict(); + +export const IdentityUpdateWithoutOwnerInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + provider: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema) ]).optional(), + providerId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + accessToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + refreshToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const IdentityUncheckedUpdateWithoutOwnerInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + provider: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema) ]).optional(), + providerId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + accessToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + refreshToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const IdentityUncheckedUpdateManyWithoutOwnerInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + provider: z.union([ z.lazy(() => IdentityProviderSchema),z.lazy(() => EnumIdentityProviderFieldUpdateOperationsInputSchema) ]).optional(), + providerId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + accessToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + refreshToken: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + profile: z.union([ z.lazy(() => NullableJsonNullValueInputSchema),InputJsonValueSchema ]).optional(), + verified: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); ///////////////////////////////////////// // ARGS ///////////////////////////////////////// -export const UserFindFirstArgsSchema: z.ZodType = z - .object({ - select: UserSelectSchema.optional(), - include: UserIncludeSchema.optional(), - where: UserWhereInputSchema.optional(), - orderBy: z.union([UserOrderByWithRelationInputSchema.array(), UserOrderByWithRelationInputSchema]).optional(), - cursor: UserWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: z.union([UserScalarFieldEnumSchema, UserScalarFieldEnumSchema.array()]).optional(), - }) - .strict() - -export const UserFindFirstOrThrowArgsSchema: z.ZodType = z - .object({ - select: UserSelectSchema.optional(), - include: UserIncludeSchema.optional(), - where: UserWhereInputSchema.optional(), - orderBy: z.union([UserOrderByWithRelationInputSchema.array(), UserOrderByWithRelationInputSchema]).optional(), - cursor: UserWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: z.union([UserScalarFieldEnumSchema, UserScalarFieldEnumSchema.array()]).optional(), - }) - .strict() - -export const UserFindManyArgsSchema: z.ZodType = z - .object({ - select: UserSelectSchema.optional(), - include: UserIncludeSchema.optional(), - where: UserWhereInputSchema.optional(), - orderBy: z.union([UserOrderByWithRelationInputSchema.array(), UserOrderByWithRelationInputSchema]).optional(), - cursor: UserWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: z.union([UserScalarFieldEnumSchema, UserScalarFieldEnumSchema.array()]).optional(), - }) - .strict() - -export const UserAggregateArgsSchema: z.ZodType = z - .object({ - where: UserWhereInputSchema.optional(), - orderBy: z.union([UserOrderByWithRelationInputSchema.array(), UserOrderByWithRelationInputSchema]).optional(), - cursor: UserWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - }) - .strict() - -export const UserGroupByArgsSchema: z.ZodType = z - .object({ - where: UserWhereInputSchema.optional(), - orderBy: z.union([UserOrderByWithAggregationInputSchema.array(), UserOrderByWithAggregationInputSchema]).optional(), - by: UserScalarFieldEnumSchema.array(), - having: UserScalarWhereWithAggregatesInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - }) - .strict() - -export const UserFindUniqueArgsSchema: z.ZodType = z - .object({ - select: UserSelectSchema.optional(), - include: UserIncludeSchema.optional(), - where: UserWhereUniqueInputSchema, - }) - .strict() - -export const UserFindUniqueOrThrowArgsSchema: z.ZodType = z - .object({ - select: UserSelectSchema.optional(), - include: UserIncludeSchema.optional(), - where: UserWhereUniqueInputSchema, - }) - .strict() - -export const IdentityFindFirstArgsSchema: z.ZodType = z - .object({ - select: IdentitySelectSchema.optional(), - include: IdentityIncludeSchema.optional(), - where: IdentityWhereInputSchema.optional(), - orderBy: z - .union([IdentityOrderByWithRelationInputSchema.array(), IdentityOrderByWithRelationInputSchema]) - .optional(), - cursor: IdentityWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: z.union([IdentityScalarFieldEnumSchema, IdentityScalarFieldEnumSchema.array()]).optional(), - }) - .strict() - -export const IdentityFindFirstOrThrowArgsSchema: z.ZodType = z - .object({ - select: IdentitySelectSchema.optional(), - include: IdentityIncludeSchema.optional(), - where: IdentityWhereInputSchema.optional(), - orderBy: z - .union([IdentityOrderByWithRelationInputSchema.array(), IdentityOrderByWithRelationInputSchema]) - .optional(), - cursor: IdentityWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: z.union([IdentityScalarFieldEnumSchema, IdentityScalarFieldEnumSchema.array()]).optional(), - }) - .strict() - -export const IdentityFindManyArgsSchema: z.ZodType = z - .object({ - select: IdentitySelectSchema.optional(), - include: IdentityIncludeSchema.optional(), - where: IdentityWhereInputSchema.optional(), - orderBy: z - .union([IdentityOrderByWithRelationInputSchema.array(), IdentityOrderByWithRelationInputSchema]) - .optional(), - cursor: IdentityWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: z.union([IdentityScalarFieldEnumSchema, IdentityScalarFieldEnumSchema.array()]).optional(), - }) - .strict() - -export const IdentityAggregateArgsSchema: z.ZodType = z - .object({ - where: IdentityWhereInputSchema.optional(), - orderBy: z - .union([IdentityOrderByWithRelationInputSchema.array(), IdentityOrderByWithRelationInputSchema]) - .optional(), - cursor: IdentityWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - }) - .strict() - -export const IdentityGroupByArgsSchema: z.ZodType = z - .object({ - where: IdentityWhereInputSchema.optional(), - orderBy: z - .union([IdentityOrderByWithAggregationInputSchema.array(), IdentityOrderByWithAggregationInputSchema]) - .optional(), - by: IdentityScalarFieldEnumSchema.array(), - having: IdentityScalarWhereWithAggregatesInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - }) - .strict() - -export const IdentityFindUniqueArgsSchema: z.ZodType = z - .object({ - select: IdentitySelectSchema.optional(), - include: IdentityIncludeSchema.optional(), - where: IdentityWhereUniqueInputSchema, - }) - .strict() - -export const IdentityFindUniqueOrThrowArgsSchema: z.ZodType = z - .object({ - select: IdentitySelectSchema.optional(), - include: IdentityIncludeSchema.optional(), - where: IdentityWhereUniqueInputSchema, - }) - .strict() - -export const UserCreateArgsSchema: z.ZodType = z - .object({ - select: UserSelectSchema.optional(), - include: UserIncludeSchema.optional(), - data: z.union([UserCreateInputSchema, UserUncheckedCreateInputSchema]), - }) - .strict() - -export const UserUpsertArgsSchema: z.ZodType = z - .object({ - select: UserSelectSchema.optional(), - include: UserIncludeSchema.optional(), - where: UserWhereUniqueInputSchema, - create: z.union([UserCreateInputSchema, UserUncheckedCreateInputSchema]), - update: z.union([UserUpdateInputSchema, UserUncheckedUpdateInputSchema]), - }) - .strict() - -export const UserCreateManyArgsSchema: z.ZodType = z - .object({ - data: z.union([UserCreateManyInputSchema, UserCreateManyInputSchema.array()]), - skipDuplicates: z.boolean().optional(), - }) - .strict() - -export const UserCreateManyAndReturnArgsSchema: z.ZodType = z - .object({ - data: z.union([UserCreateManyInputSchema, UserCreateManyInputSchema.array()]), - skipDuplicates: z.boolean().optional(), - }) - .strict() - -export const UserDeleteArgsSchema: z.ZodType = z - .object({ - select: UserSelectSchema.optional(), - include: UserIncludeSchema.optional(), - where: UserWhereUniqueInputSchema, - }) - .strict() - -export const UserUpdateArgsSchema: z.ZodType = z - .object({ - select: UserSelectSchema.optional(), - include: UserIncludeSchema.optional(), - data: z.union([UserUpdateInputSchema, UserUncheckedUpdateInputSchema]), - where: UserWhereUniqueInputSchema, - }) - .strict() - -export const UserUpdateManyArgsSchema: z.ZodType = z - .object({ - data: z.union([UserUpdateManyMutationInputSchema, UserUncheckedUpdateManyInputSchema]), - where: UserWhereInputSchema.optional(), - limit: z.number().optional(), - }) - .strict() - -export const UserUpdateManyAndReturnArgsSchema: z.ZodType = z - .object({ - data: z.union([UserUpdateManyMutationInputSchema, UserUncheckedUpdateManyInputSchema]), - where: UserWhereInputSchema.optional(), - limit: z.number().optional(), - }) - .strict() - -export const UserDeleteManyArgsSchema: z.ZodType = z - .object({ - where: UserWhereInputSchema.optional(), - limit: z.number().optional(), - }) - .strict() - -export const IdentityCreateArgsSchema: z.ZodType = z - .object({ - select: IdentitySelectSchema.optional(), - include: IdentityIncludeSchema.optional(), - data: z.union([IdentityCreateInputSchema, IdentityUncheckedCreateInputSchema]), - }) - .strict() - -export const IdentityUpsertArgsSchema: z.ZodType = z - .object({ - select: IdentitySelectSchema.optional(), - include: IdentityIncludeSchema.optional(), - where: IdentityWhereUniqueInputSchema, - create: z.union([IdentityCreateInputSchema, IdentityUncheckedCreateInputSchema]), - update: z.union([IdentityUpdateInputSchema, IdentityUncheckedUpdateInputSchema]), - }) - .strict() - -export const IdentityCreateManyArgsSchema: z.ZodType = z - .object({ - data: z.union([IdentityCreateManyInputSchema, IdentityCreateManyInputSchema.array()]), - skipDuplicates: z.boolean().optional(), - }) - .strict() - -export const IdentityCreateManyAndReturnArgsSchema: z.ZodType = z - .object({ - data: z.union([IdentityCreateManyInputSchema, IdentityCreateManyInputSchema.array()]), - skipDuplicates: z.boolean().optional(), - }) - .strict() - -export const IdentityDeleteArgsSchema: z.ZodType = z - .object({ - select: IdentitySelectSchema.optional(), - include: IdentityIncludeSchema.optional(), - where: IdentityWhereUniqueInputSchema, - }) - .strict() - -export const IdentityUpdateArgsSchema: z.ZodType = z - .object({ - select: IdentitySelectSchema.optional(), - include: IdentityIncludeSchema.optional(), - data: z.union([IdentityUpdateInputSchema, IdentityUncheckedUpdateInputSchema]), - where: IdentityWhereUniqueInputSchema, - }) - .strict() - -export const IdentityUpdateManyArgsSchema: z.ZodType = z - .object({ - data: z.union([IdentityUpdateManyMutationInputSchema, IdentityUncheckedUpdateManyInputSchema]), - where: IdentityWhereInputSchema.optional(), - limit: z.number().optional(), - }) - .strict() - -export const IdentityUpdateManyAndReturnArgsSchema: z.ZodType = z - .object({ - data: z.union([IdentityUpdateManyMutationInputSchema, IdentityUncheckedUpdateManyInputSchema]), - where: IdentityWhereInputSchema.optional(), - limit: z.number().optional(), - }) - .strict() - -export const IdentityDeleteManyArgsSchema: z.ZodType = z - .object({ - where: IdentityWhereInputSchema.optional(), - limit: z.number().optional(), - }) - .strict() +export const UserFindFirstArgsSchema: z.ZodType = z.object({ + select: UserSelectSchema.optional(), + include: UserIncludeSchema.optional(), + where: UserWhereInputSchema.optional(), + orderBy: z.union([ UserOrderByWithRelationInputSchema.array(),UserOrderByWithRelationInputSchema ]).optional(), + cursor: UserWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(), +}).strict() ; + +export const UserFindFirstOrThrowArgsSchema: z.ZodType = z.object({ + select: UserSelectSchema.optional(), + include: UserIncludeSchema.optional(), + where: UserWhereInputSchema.optional(), + orderBy: z.union([ UserOrderByWithRelationInputSchema.array(),UserOrderByWithRelationInputSchema ]).optional(), + cursor: UserWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(), +}).strict() ; + +export const UserFindManyArgsSchema: z.ZodType = z.object({ + select: UserSelectSchema.optional(), + include: UserIncludeSchema.optional(), + where: UserWhereInputSchema.optional(), + orderBy: z.union([ UserOrderByWithRelationInputSchema.array(),UserOrderByWithRelationInputSchema ]).optional(), + cursor: UserWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(), +}).strict() ; + +export const UserAggregateArgsSchema: z.ZodType = z.object({ + where: UserWhereInputSchema.optional(), + orderBy: z.union([ UserOrderByWithRelationInputSchema.array(),UserOrderByWithRelationInputSchema ]).optional(), + cursor: UserWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() ; + +export const UserGroupByArgsSchema: z.ZodType = z.object({ + where: UserWhereInputSchema.optional(), + orderBy: z.union([ UserOrderByWithAggregationInputSchema.array(),UserOrderByWithAggregationInputSchema ]).optional(), + by: UserScalarFieldEnumSchema.array(), + having: UserScalarWhereWithAggregatesInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() ; + +export const UserFindUniqueArgsSchema: z.ZodType = z.object({ + select: UserSelectSchema.optional(), + include: UserIncludeSchema.optional(), + where: UserWhereUniqueInputSchema, +}).strict() ; + +export const UserFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: UserSelectSchema.optional(), + include: UserIncludeSchema.optional(), + where: UserWhereUniqueInputSchema, +}).strict() ; + +export const IdentityFindFirstArgsSchema: z.ZodType = z.object({ + select: IdentitySelectSchema.optional(), + include: IdentityIncludeSchema.optional(), + where: IdentityWhereInputSchema.optional(), + orderBy: z.union([ IdentityOrderByWithRelationInputSchema.array(),IdentityOrderByWithRelationInputSchema ]).optional(), + cursor: IdentityWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: z.union([ IdentityScalarFieldEnumSchema,IdentityScalarFieldEnumSchema.array() ]).optional(), +}).strict() ; + +export const IdentityFindFirstOrThrowArgsSchema: z.ZodType = z.object({ + select: IdentitySelectSchema.optional(), + include: IdentityIncludeSchema.optional(), + where: IdentityWhereInputSchema.optional(), + orderBy: z.union([ IdentityOrderByWithRelationInputSchema.array(),IdentityOrderByWithRelationInputSchema ]).optional(), + cursor: IdentityWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: z.union([ IdentityScalarFieldEnumSchema,IdentityScalarFieldEnumSchema.array() ]).optional(), +}).strict() ; + +export const IdentityFindManyArgsSchema: z.ZodType = z.object({ + select: IdentitySelectSchema.optional(), + include: IdentityIncludeSchema.optional(), + where: IdentityWhereInputSchema.optional(), + orderBy: z.union([ IdentityOrderByWithRelationInputSchema.array(),IdentityOrderByWithRelationInputSchema ]).optional(), + cursor: IdentityWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: z.union([ IdentityScalarFieldEnumSchema,IdentityScalarFieldEnumSchema.array() ]).optional(), +}).strict() ; + +export const IdentityAggregateArgsSchema: z.ZodType = z.object({ + where: IdentityWhereInputSchema.optional(), + orderBy: z.union([ IdentityOrderByWithRelationInputSchema.array(),IdentityOrderByWithRelationInputSchema ]).optional(), + cursor: IdentityWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() ; + +export const IdentityGroupByArgsSchema: z.ZodType = z.object({ + where: IdentityWhereInputSchema.optional(), + orderBy: z.union([ IdentityOrderByWithAggregationInputSchema.array(),IdentityOrderByWithAggregationInputSchema ]).optional(), + by: IdentityScalarFieldEnumSchema.array(), + having: IdentityScalarWhereWithAggregatesInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() ; + +export const IdentityFindUniqueArgsSchema: z.ZodType = z.object({ + select: IdentitySelectSchema.optional(), + include: IdentityIncludeSchema.optional(), + where: IdentityWhereUniqueInputSchema, +}).strict() ; + +export const IdentityFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: IdentitySelectSchema.optional(), + include: IdentityIncludeSchema.optional(), + where: IdentityWhereUniqueInputSchema, +}).strict() ; + +export const UserCreateArgsSchema: z.ZodType = z.object({ + select: UserSelectSchema.optional(), + include: UserIncludeSchema.optional(), + data: z.union([ UserCreateInputSchema,UserUncheckedCreateInputSchema ]), +}).strict() ; + +export const UserUpsertArgsSchema: z.ZodType = z.object({ + select: UserSelectSchema.optional(), + include: UserIncludeSchema.optional(), + where: UserWhereUniqueInputSchema, + create: z.union([ UserCreateInputSchema,UserUncheckedCreateInputSchema ]), + update: z.union([ UserUpdateInputSchema,UserUncheckedUpdateInputSchema ]), +}).strict() ; + +export const UserCreateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ UserCreateManyInputSchema,UserCreateManyInputSchema.array() ]), + skipDuplicates: z.boolean().optional(), +}).strict() ; + +export const UserCreateManyAndReturnArgsSchema: z.ZodType = z.object({ + data: z.union([ UserCreateManyInputSchema,UserCreateManyInputSchema.array() ]), + skipDuplicates: z.boolean().optional(), +}).strict() ; + +export const UserDeleteArgsSchema: z.ZodType = z.object({ + select: UserSelectSchema.optional(), + include: UserIncludeSchema.optional(), + where: UserWhereUniqueInputSchema, +}).strict() ; + +export const UserUpdateArgsSchema: z.ZodType = z.object({ + select: UserSelectSchema.optional(), + include: UserIncludeSchema.optional(), + data: z.union([ UserUpdateInputSchema,UserUncheckedUpdateInputSchema ]), + where: UserWhereUniqueInputSchema, +}).strict() ; + +export const UserUpdateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ UserUpdateManyMutationInputSchema,UserUncheckedUpdateManyInputSchema ]), + where: UserWhereInputSchema.optional(), + limit: z.number().optional(), +}).strict() ; + +export const UserUpdateManyAndReturnArgsSchema: z.ZodType = z.object({ + data: z.union([ UserUpdateManyMutationInputSchema,UserUncheckedUpdateManyInputSchema ]), + where: UserWhereInputSchema.optional(), + limit: z.number().optional(), +}).strict() ; + +export const UserDeleteManyArgsSchema: z.ZodType = z.object({ + where: UserWhereInputSchema.optional(), + limit: z.number().optional(), +}).strict() ; + +export const IdentityCreateArgsSchema: z.ZodType = z.object({ + select: IdentitySelectSchema.optional(), + include: IdentityIncludeSchema.optional(), + data: z.union([ IdentityCreateInputSchema,IdentityUncheckedCreateInputSchema ]), +}).strict() ; + +export const IdentityUpsertArgsSchema: z.ZodType = z.object({ + select: IdentitySelectSchema.optional(), + include: IdentityIncludeSchema.optional(), + where: IdentityWhereUniqueInputSchema, + create: z.union([ IdentityCreateInputSchema,IdentityUncheckedCreateInputSchema ]), + update: z.union([ IdentityUpdateInputSchema,IdentityUncheckedUpdateInputSchema ]), +}).strict() ; + +export const IdentityCreateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ IdentityCreateManyInputSchema,IdentityCreateManyInputSchema.array() ]), + skipDuplicates: z.boolean().optional(), +}).strict() ; + +export const IdentityCreateManyAndReturnArgsSchema: z.ZodType = z.object({ + data: z.union([ IdentityCreateManyInputSchema,IdentityCreateManyInputSchema.array() ]), + skipDuplicates: z.boolean().optional(), +}).strict() ; + +export const IdentityDeleteArgsSchema: z.ZodType = z.object({ + select: IdentitySelectSchema.optional(), + include: IdentityIncludeSchema.optional(), + where: IdentityWhereUniqueInputSchema, +}).strict() ; + +export const IdentityUpdateArgsSchema: z.ZodType = z.object({ + select: IdentitySelectSchema.optional(), + include: IdentityIncludeSchema.optional(), + data: z.union([ IdentityUpdateInputSchema,IdentityUncheckedUpdateInputSchema ]), + where: IdentityWhereUniqueInputSchema, +}).strict() ; + +export const IdentityUpdateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ IdentityUpdateManyMutationInputSchema,IdentityUncheckedUpdateManyInputSchema ]), + where: IdentityWhereInputSchema.optional(), + limit: z.number().optional(), +}).strict() ; + +export const IdentityUpdateManyAndReturnArgsSchema: z.ZodType = z.object({ + data: z.union([ IdentityUpdateManyMutationInputSchema,IdentityUncheckedUpdateManyInputSchema ]), + where: IdentityWhereInputSchema.optional(), + limit: z.number().optional(), +}).strict() ; + +export const IdentityDeleteManyArgsSchema: z.ZodType = z.object({ + where: IdentityWhereInputSchema.optional(), + limit: z.number().optional(), +}).strict() ; \ No newline at end of file diff --git a/app/lib/strategies/github-strategy.ts b/app/lib/strategies/github-strategy.ts new file mode 100644 index 0000000..b9aedb8 --- /dev/null +++ b/app/lib/strategies/github-strategy.ts @@ -0,0 +1,94 @@ +import { GitHubStrategy } from 'remix-auth-github' +import { type User } from '~/lib/db.server' +import { IdentityProvider, Prisma } from '@prisma/client' +import { logger } from '~/lib/logger' +import { getUser } from '~/features/auth/data-access/get-user' +import type { OAuth2Tokens } from 'arctic' +import { userUpdateWithIdentity } from '~/lib/core/user-update-with-identity' +import { identityFindByProviderId } from '~/lib/core/identity-find-by-provider-id' +import { userCreateWithIdentity } from '~/lib/core/user-create-with-identity' +import type { IdentityProfile } from './identity-profile' + +const authGithubClientId = process.env.AUTH_GITHUB_CLIENT_ID +const authGithubClientSecret = process.env.AUTH_GITHUB_CLIENT_SECRET +if (!authGithubClientId || !authGithubClientSecret) { + throw new Error('AUTH_GITHUB_CLIENT_ID or AUTH_GITHUB_CLIENT_SECRET is not set') +} + +const redirectURI = `${process.env.API_URL}/api/auth/github/callback` + +export const githubStrategy = new GitHubStrategy( + { clientId: authGithubClientId, clientSecret: authGithubClientSecret, redirectURI }, + async ({ request, tokens }) => { + const identityProfile = await getGitHubProfile(tokens.accessToken()) + const profile = convertProfileToUser(identityProfile, tokens) + const found = await identityFindByProviderId({ + provider: profile.provider, + providerId: profile.providerId?.toString(), + }) + + if (found) { + logger.info({ event: 'auth_github_find_identity', message: 'GitHub find identity', userId: profile.providerId }) + return found + } + + logger.info({ event: 'auth_github_login', message: 'GitHub login', userId: profile.id }) + + const existing = await getUser(request) + if (existing?.id) { + const updated = await userUpdateWithIdentity(existing.id, profile) + logger.info({ + event: 'auth_github_login', + message: `GitHub identity added to user ${existing.username}`, + userId: profile.id, + }) + return updated + } + + const created = await userCreateWithIdentity(profile) + logger.info({ event: 'auth_github_login', message: 'GitHub identity used to create user', userId: created.id }) + return created + }, +) + +interface GitHubProfile { + id: 36491 + bio: string + name: string + login: string + avatar_url: string +} + +function convertProfileToUser(input: GitHubProfile, tokens: OAuth2Tokens): Prisma.IdentityCreateWithoutOwnerInput { + const name = input.name + const address = input.login + const profile: IdentityProfile = { + bio: input.bio, + username: input.login, + avatarUrl: input.avatar_url, + raw: input, + } + + return { + accessToken: tokens.accessToken(), + refreshToken: tokens.hasRefreshToken() ? tokens.refreshToken() : undefined, + name, + address, + provider: IdentityProvider.Github, + providerId: input.id.toString(), + profile: profile as Prisma.InputJsonValue, + verified: true, + } +} + +async function getGitHubProfile(token: string) { + let response = await fetch('https://api.github.com/user', { + headers: { + Accept: 'application/vnd.github+json', + Authorization: `Bearer ${token}`, + 'X-GitHub-Api-Version': '2022-11-28', + }, + }) + + return await response.json() +} diff --git a/app/lib/strategies/google-strategy.ts b/app/lib/strategies/google-strategy.ts index 281d46b..3a3f2f9 100644 --- a/app/lib/strategies/google-strategy.ts +++ b/app/lib/strategies/google-strategy.ts @@ -7,6 +7,7 @@ import type { OAuth2Tokens } from 'arctic' import { userUpdateWithIdentity } from '~/lib/core/user-update-with-identity' import { identityFindByProviderId } from '~/lib/core/identity-find-by-provider-id' import { userCreateWithIdentity } from '~/lib/core/user-create-with-identity' +import type { IdentityProfile } from './identity-profile' const authGoogleClientId = process.env.AUTH_GOOGLE_CLIENT_ID const authGoogleClientSecret = process.env.AUTH_GOOGLE_CLIENT_SECRET @@ -31,7 +32,7 @@ export const googleStrategy = new GoogleStrategy( logger.info({ event: 'auth_google_login', message: 'Google login', userId: profile.id }) const existing = await getUser(request) - if (existing) { + if (existing?.id) { const updated = await userUpdateWithIdentity(existing.id, profile) logger.info({ event: 'auth_google_login', @@ -65,9 +66,3 @@ function convertProfileToUser(input: GoogleProfile, tokens: OAuth2Tokens): Prism verified: true, } } - -export interface IdentityProfile { - username?: string - avatarUrl?: string - raw?: unknown -} diff --git a/app/lib/strategies/identity-profile.ts b/app/lib/strategies/identity-profile.ts new file mode 100644 index 0000000..2ab8719 --- /dev/null +++ b/app/lib/strategies/identity-profile.ts @@ -0,0 +1,6 @@ +export interface IdentityProfile { + bio?: string + username?: string + avatarUrl?: string + raw?: unknown +} diff --git a/app/lib/strategies/x-strategy.ts b/app/lib/strategies/x-strategy.ts new file mode 100644 index 0000000..a174a06 --- /dev/null +++ b/app/lib/strategies/x-strategy.ts @@ -0,0 +1,93 @@ +import { Twitter2Strategy as XStrategy } from 'remix-auth-twitter' +import { type User } from '~/lib/db.server' +import { IdentityProvider, Prisma } from '@prisma/client' +import { logger } from '~/lib/logger' +import { getUser } from '~/features/auth/data-access/get-user' +import type { OAuth2Tokens } from 'arctic' + +import { userUpdateWithIdentity } from '~/lib/core/user-update-with-identity' +import { identityFindByProviderId } from '~/lib/core/identity-find-by-provider-id' +import { userCreateWithIdentity } from '~/lib/core/user-create-with-identity' +import { TwitterApi, type UserV2 } from 'twitter-api-v2' +import type { IdentityProfile } from '~/lib/strategies/identity-profile' + +const authXClientId = process.env.AUTH_X_CLIENT_ID +const authXClientSecret = process.env.AUTH_X_CLIENT_SECRET +if (!authXClientId || !authXClientSecret) { + throw new Error('AUTH_X_CLIENT_ID or AUTH_X_CLIENT_SECRET is not set') +} + +const redirectURI = `${process.env.API_URL}/api/auth/x/callback` + +export const xStrategy = new XStrategy( + { + callbackURL: redirectURI, + clientID: authXClientId, + clientSecret: authXClientSecret, + scopes: ['offline.access', 'tweet.read', 'users.read'], + }, + async ({ request, tokens }) => { + console.log(`xStrategy`, tokens) + const identityProfile = await getXProfile(tokens.accessToken()) + const profile = convertProfileToUser(identityProfile, tokens) + const found = await identityFindByProviderId({ + provider: profile.provider, + providerId: profile.providerId?.toString(), + }) + + if (found) { + logger.info({ event: 'auth_x_find_identity', message: 'X find identity', userId: profile.providerId }) + return found + } + + logger.info({ event: 'auth_x_login', message: 'X login', userId: profile.id }) + + const existing = await getUser(request) + if (existing?.id) { + const updated = await userUpdateWithIdentity(existing.id, profile) + logger.info({ + event: 'auth_x_login', + message: `X identity added to user ${existing.username}`, + userId: profile.id, + }) + return updated + } + + const created = await userCreateWithIdentity(profile) + logger.info({ event: 'auth_x_login', message: 'X identity used to create user', userId: created.id }) + return created + }, +) + +function convertProfileToUser(input: UserV2, tokens: OAuth2Tokens): Prisma.IdentityCreateWithoutOwnerInput { + const name = input.name + const address = input.username + const profile: IdentityProfile = { + bio: input.description, + username: input.username, + avatarUrl: input.profile_image_url, + raw: input, + } + + return { + accessToken: tokens.accessToken(), + refreshToken: tokens.hasRefreshToken() ? tokens.refreshToken() : undefined, + name, + address, + provider: IdentityProvider.X, + providerId: input.id.toString(), + profile: profile as Prisma.InputJsonValue, + verified: true, + } +} + +async function getXProfile(token: string) { + console.log(`getXProfile`, token) + const client = new TwitterApi(token) + console.log(`getXProfile`, client) + let response = await client.v2.me({ + 'user.fields': ['description', 'name', 'profile_image_url', 'username'], + }) + + return response.data +} diff --git a/package.json b/package.json index 0b80cd6..f2666d8 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,11 @@ "react-router": "^7.6.2", "remix-auth": "^4.2.0", "remix-auth-form": "^3.0.0", + "remix-auth-github": "^3.0.2", "remix-auth-oauth2": "^3.4.1", + "remix-auth-twitter": "4.0.0-1", "remix-themes": "^2.0.4", + "twitter-api-v2": "^1.23.2", "zod": "^3.25.67", "zod-prisma-types": "^3.2.4" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cf85c91..8882b03 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -116,12 +116,21 @@ importers: remix-auth-form: specifier: ^3.0.0 version: 3.0.0(remix-auth@4.2.0) + remix-auth-github: + specifier: ^3.0.2 + version: 3.0.2(remix-auth@4.2.0) remix-auth-oauth2: specifier: ^3.4.1 version: 3.4.1(remix-auth@4.2.0) + remix-auth-twitter: + specifier: 4.0.0-1 + version: 4.0.0-1(remix-auth@4.2.0) remix-themes: specifier: ^2.0.4 version: 2.0.4(react-router@7.6.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0)) + twitter-api-v2: + specifier: ^1.23.2 + version: 1.23.2 zod: specifier: ^3.25.67 version: 3.25.67 @@ -1025,6 +1034,12 @@ packages: '@mjackson/headers@0.10.0': resolution: {integrity: sha512-U1Eu1gF979k7ZoIBsJyD+T5l9MjtPONsZfoXfktsQHPJD0s7SokBGx+tLKDLsOY+gzVYAWS0yRFDNY8cgbQzWQ==} + '@mjackson/headers@0.11.1': + resolution: {integrity: sha512-uXXhd4rtDdDwkqAuGef1nuafkCa1NlTmEc1Jzc0NL4YiA1yON1NFXuqJ3hOuKvNKQwkiDwdD+JJlKVyz4dunFA==} + + '@mjackson/headers@0.9.0': + resolution: {integrity: sha512-1WFCu2iRaqbez9hcYYI611vcH1V25R+fDfOge/CyKc8sdbzniGfy/FRhNd3DgvFF4ZEEX2ayBrvFHLtOpfvadw==} + '@mjackson/node-fetch-server@0.2.0': resolution: {integrity: sha512-EMlH1e30yzmTpGLQjlFmaDAjyOeZhng1/XCd7DExR8PNAnG/G1tyruZxEoUe11ClnwGhGrtsdnyyUx1frSzjng==} @@ -2549,6 +2564,9 @@ packages: resolution: {integrity: sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==} engines: {node: '>=8'} + crypto-js@4.2.0: + resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==} + css-select@5.1.0: resolution: {integrity: sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==} @@ -3920,12 +3938,23 @@ packages: peerDependencies: remix-auth: ^4.0.0 + remix-auth-github@3.0.2: + resolution: {integrity: sha512-3XxykdwMrcPSyMsdGtBDl3DBc19gJM3t7q/1uzfz3g/SJRsxEytjGiQ17ztKykebCGM454Z0lVJMvSb+LF/yHA==} + engines: {node: ^18.0.0 || ^20.0.0 || >=20.0.0} + peerDependencies: + remix-auth: ^4.0.0 + remix-auth-oauth2@3.4.1: resolution: {integrity: sha512-ZhGon1czdIsOw1/O9EcTCzapZB6FpT3u9vtXSVeEMwGNs+iWljRsibnUC1RtwJbzzCdLBSwIXTNTbiRmLZ4cZw==} engines: {node: ^20.0.0 || >=20.0.0} peerDependencies: remix-auth: ^4.0.0 + remix-auth-twitter@4.0.0-1: + resolution: {integrity: sha512-LgNVBizaNp0mn3OMWaSG9gpwceZ5HphFegY2fFDDgOtUHHkmrwUYB7R/ouml3B9yocW7KKIYeAlMtpOBgTrxsw==} + peerDependencies: + remix-auth: ^4.2.0 + remix-auth@4.2.0: resolution: {integrity: sha512-3LSfWEvSgG2CgbG/p4ge5hbV8tTXWNnnYIGbTr9oSSiHz9dD7wh6S0MEyo3pwh7MlKezB2WIlevGeyqUZykk7g==} engines: {node: '>=20.0.0'} @@ -4233,6 +4262,9 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + twitter-api-v2@1.23.2: + resolution: {integrity: sha512-m0CGXmfGwUhWBOOTVCIXIoSEXwGCQV3Es9yraCwUxaVrjJT2CQcqDrQsQTpBhtiAvVL2HS1cCEGsotNjfX9log==} + type-detect@4.0.8: resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} engines: {node: '>=4'} @@ -5424,6 +5456,10 @@ snapshots: '@mjackson/headers@0.10.0': {} + '@mjackson/headers@0.11.1': {} + + '@mjackson/headers@0.9.0': {} + '@mjackson/node-fetch-server@0.2.0': {} '@msgpack/msgpack@3.1.2': {} @@ -7295,6 +7331,8 @@ snapshots: crypto-hash@1.3.0: {} + crypto-js@4.2.0: {} + css-select@5.1.0: dependencies: boolbase: 1.0.0 @@ -8859,6 +8897,15 @@ snapshots: dependencies: remix-auth: 4.2.0 + remix-auth-github@3.0.2(remix-auth@4.2.0): + dependencies: + '@mjackson/headers': 0.9.0 + arctic: 3.7.0 + debug: 4.4.1 + remix-auth: 4.2.0 + transitivePeerDependencies: + - supports-color + remix-auth-oauth2@3.4.1(remix-auth@4.2.0): dependencies: '@edgefirst-dev/data': 0.0.4 @@ -8866,6 +8913,17 @@ snapshots: arctic: 3.7.0 remix-auth: 4.2.0 + remix-auth-twitter@4.0.0-1(remix-auth@4.2.0): + dependencies: + '@mjackson/headers': 0.11.1 + arctic: 3.7.0 + crypto-js: 4.2.0 + debug: 4.4.1 + remix-auth: 4.2.0 + uuid: 8.3.2 + transitivePeerDependencies: + - supports-color + remix-auth@4.2.0: {} remix-themes@2.0.4(react-router@7.6.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0)): @@ -9174,6 +9232,8 @@ snapshots: tslib@2.8.1: {} + twitter-api-v2@1.23.2: {} + type-detect@4.0.8: {} type-fest@0.7.1: {}