From ba46a2780f7a50a189b7d9ea24aaa29c1902968c Mon Sep 17 00:00:00 2001 From: aronmal Date: Tue, 11 Jul 2023 19:25:44 +0200 Subject: [PATCH] Format all files --- leaky-ships/components/Bluetooth.tsx | 8 +- leaky-ships/components/BurgerMenu.tsx | 3 +- .../components/Gamefield/BorderTiles.tsx | 8 +- leaky-ships/components/Gamefield/EventBar.tsx | 12 +- .../components/Gamefield/Gamefield.tsx | 7 +- .../components/Gamefield/GamefieldPointer.tsx | 2 +- leaky-ships/components/Gamefield/HitElems.tsx | 2 +- leaky-ships/components/Gamefield/Item.tsx | 5 +- leaky-ships/components/Gamefield/Labeling.tsx | 8 +- leaky-ships/components/Gamefield/Ship.tsx | 4 +- leaky-ships/components/Gamefield/Ships.tsx | 8 +- leaky-ships/components/Gamefield/Targets.tsx | 10 +- leaky-ships/components/Grid.tsx | 13 +- leaky-ships/components/Grid2.tsx | 13 +- leaky-ships/components/Lobby/Button.tsx | 3 +- leaky-ships/components/Lobby/LobbyFrame.tsx | 8 +- leaky-ships/components/Lobby/Player.tsx | 6 +- .../Lobby/SettingsFrame/Setting.tsx | 4 +- .../Lobby/SettingsFrame/Settings.tsx | 4 +- leaky-ships/components/Logo.tsx | 7 +- leaky-ships/components/OptionButton.tsx | 2 +- leaky-ships/components/profileImg.tsx | 2 - leaky-ships/drizzle/schema.ts | 2 +- leaky-ships/hooks/useDraw.ts | 4 +- leaky-ships/hooks/useDrawProps.ts | 6 +- leaky-ships/hooks/useGameProps.ts | 50 ++--- leaky-ships/hooks/useIndex.ts | 2 +- leaky-ships/hooks/useShips.ts | 8 +- leaky-ships/hooks/useSocket.ts | 8 +- leaky-ships/interfaces/NextApiSocket.ts | 4 +- leaky-ships/lib/backend/getPinFromBody.ts | 2 +- leaky-ships/lib/backend/logging.ts | 4 +- leaky-ships/lib/backend/sendError.ts | 6 +- leaky-ships/lib/backend/sendResponse.ts | 4 +- leaky-ships/lib/getPayloadwithChecksum.ts | 4 +- leaky-ships/lib/socket.ts | 2 +- leaky-ships/lib/utils/helpers.ts | 20 +- leaky-ships/pages/_app.tsx | 8 +- leaky-ships/pages/_document.tsx | 2 +- leaky-ships/pages/api/auth/[...nextauth].ts | 4 +- leaky-ships/pages/api/game/[id].ts | 4 +- leaky-ships/pages/api/game/create.ts | 6 +- leaky-ships/pages/api/game/join.ts | 8 +- leaky-ships/pages/api/game/running.ts | 6 +- leaky-ships/pages/api/ws.ts | 28 +-- leaky-ships/pages/game.tsx | 2 +- leaky-ships/pages/lobby.tsx | 2 +- leaky-ships/pages/signout.tsx | 2 +- leaky-ships/pages/start.tsx | 15 +- leaky-ships/prisma/generated/zod/index.ts | 179 +++++++++--------- leaky-ships/public/index.html | 2 +- leaky-ships/types/next-auth.d.ts | 2 +- 52 files changed, 268 insertions(+), 267 deletions(-) diff --git a/leaky-ships/components/Bluetooth.tsx b/leaky-ships/components/Bluetooth.tsx index ac117db..f2ea535 100644 --- a/leaky-ships/components/Bluetooth.tsx +++ b/leaky-ships/components/Bluetooth.tsx @@ -77,7 +77,7 @@ function Bluetooth() { gattCharacteristic = characteristic characteristic.addEventListener( "characteristicvaluechanged", - handleChangedValue + handleChangedValue, ) setStartDisabled(false) @@ -94,7 +94,7 @@ function Bluetooth() { const now = new Date() // Output the UV Index console.log( - `> ${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} UV Index is ${value}` + `> ${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} UV Index is ${value}`, ) // Output the Battery percentage @@ -159,7 +159,7 @@ function Bluetooth() { className="App-link" onClick={() => { navigator.clipboard.writeText( - "chrome://flags/#enable-experimental-web-platform-features" + "chrome://flags/#enable-experimental-web-platform-features", ) }} // target="_blank" @@ -172,7 +172,7 @@ function Bluetooth() { className="App-link" onClick={() => { navigator.clipboard.writeText( - "chrome://flags/#enable-web-bluetooth-new-permissions-backend" + "chrome://flags/#enable-web-bluetooth-new-permissions-backend", ) }} // target="_blank" diff --git a/leaky-ships/components/BurgerMenu.tsx b/leaky-ships/components/BurgerMenu.tsx index 12be92a..0c18f42 100644 --- a/leaky-ships/components/BurgerMenu.tsx +++ b/leaky-ships/components/BurgerMenu.tsx @@ -1,5 +1,4 @@ import classNames from "classnames" -import React from "react" function BurgerMenu({ onClick, @@ -13,7 +12,7 @@ function BurgerMenu({ id="menu" className={classNames( "absolute left-4 top-4 flex h-16 w-16 items-center justify-center rounded-lg border-b-2 border-shield-gray bg-grayish shadow-lg duration-100 active:border-b-0 active:border-t-2 md:left-6 md:top-6 md:h-20 md:w-20 md:rounded-xl md:border-b-4 md:active:border-t-4 lg:left-8 lg:top-8 xl:left-12 xl:top-12 xl:h-24 xl:w-24", - { "blur-sm": blur } + { "blur-sm": blur }, )} onClick={() => onClick && setTimeout(onClick, 200)} > diff --git a/leaky-ships/components/Gamefield/BorderTiles.tsx b/leaky-ships/components/Gamefield/BorderTiles.tsx index 2e40210..6e4f081 100644 --- a/leaky-ships/components/Gamefield/BorderTiles.tsx +++ b/leaky-ships/components/Gamefield/BorderTiles.tsx @@ -1,4 +1,3 @@ -import { count } from "./Gamefield" import { useGameProps } from "@hooks/useGameProps" import useIndex from "@hooks/useIndex" import useShips from "@hooks/useShips" @@ -13,6 +12,7 @@ import { targetList, } from "@lib/utils/helpers" import { CSSProperties, useCallback } from "react" +import { count } from "./Gamefield" type TilesType = { key: number @@ -41,7 +41,7 @@ function BorderTiles() { if ( !isGameTile || !list.filter( - ({ x, y }) => !isAlreadyHit(x, y, activeUser?.hits ?? []) + ({ x, y }) => !isAlreadyHit(x, y, activeUser?.hits ?? []), ).length ) return @@ -70,7 +70,7 @@ function BorderTiles() { setTarget, ships, targetPreview, - ] + ], ) let tilesProperties: TilesType[] = [] @@ -136,7 +136,7 @@ function BorderTiles() { y, orientation: targetPreview.orientation, }), - true + true, ).score < 2 : true), }) diff --git a/leaky-ships/components/Gamefield/EventBar.tsx b/leaky-ships/components/Gamefield/EventBar.tsx index d275889..dab4faf 100644 --- a/leaky-ships/components/Gamefield/EventBar.tsx +++ b/leaky-ships/components/Gamefield/EventBar.tsx @@ -1,5 +1,3 @@ -import { EventBarModes } from "../../interfaces/frontend" -import Item from "./Item" import { GameSettings } from "@components/Lobby/SettingsFrame/Setting" import { faSquare2, @@ -34,11 +32,13 @@ import { GamePropsSchema } from "@lib/zodSchemas" import { useRouter } from "next/router" import { useCallback, useEffect, useMemo } from "react" import { Icons, toast } from "react-toastify" +import { EventBarModes } from "../../interfaces/frontend" +import Item from "./Item" export function setGameSetting( payload: GameSettings, setSetting: (settings: GameSettings) => string | null, - full: (payload: GamePropsSchema) => void + full: (payload: GamePropsSchema) => void, ) { return () => { const hash = setSetting(payload) @@ -70,7 +70,7 @@ function EventBar({ clear }: { clear: () => void }) { } = useGameProps() const gameSetting = useCallback( (payload: GameSettings) => setGameSetting(payload, setSetting, full), - [full, setSetting] + [full, setSetting], ) const items = useMemo( @@ -142,7 +142,7 @@ function EventBar({ clear }: { clear: () => void }) { amount: 2 - ((selfUser?.moves ?? []).filter( - (e) => e.type === "htorpedo" || e.type === "vtorpedo" + (e) => e.type === "htorpedo" || e.type === "vtorpedo", ).length ?? 0), callback: () => { useGameProps.setState({ mode: 1 }) @@ -283,7 +283,7 @@ function EventBar({ clear }: { clear: () => void }) { setTargetPreview, router, reset, - ] + ], ) useEffect(() => { diff --git a/leaky-ships/components/Gamefield/Gamefield.tsx b/leaky-ships/components/Gamefield/Gamefield.tsx index ffef2f7..7d16a62 100644 --- a/leaky-ships/components/Gamefield/Gamefield.tsx +++ b/leaky-ships/components/Gamefield/Gamefield.tsx @@ -1,7 +1,5 @@ // import Bluetooth from "./Bluetooth" // import FogImages from "./FogImages" -import Labeling from "./Labeling" -import Ships from "./Ships" import BorderTiles from "@components/Gamefield/BorderTiles" import EventBar from "@components/Gamefield/EventBar" import HitElems from "@components/Gamefield/HitElems" @@ -14,9 +12,10 @@ import useSocket from "@hooks/useSocket" import { socket } from "@lib/socket" import { overlapsWithAnyBorder } from "@lib/utils/helpers" import { useRouter } from "next/router" -import { CSSProperties } from "react" -import { useEffect } from "react" +import { CSSProperties, useEffect } from "react" import { toast } from "react-toastify" +import Labeling from "./Labeling" +import Ships from "./Ships" export const count = 12 diff --git a/leaky-ships/components/Gamefield/GamefieldPointer.tsx b/leaky-ships/components/Gamefield/GamefieldPointer.tsx index 8cece22..df07577 100644 --- a/leaky-ships/components/Gamefield/GamefieldPointer.tsx +++ b/leaky-ships/components/Gamefield/GamefieldPointer.tsx @@ -1,9 +1,9 @@ -import { PointerProps } from "../../interfaces/frontend" import { faCrosshairs } from "@fortawesome/pro-solid-svg-icons" import { faRadar } from "@fortawesome/pro-thin-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import classNames from "classnames" import { CSSProperties } from "react" +import { PointerProps } from "../../interfaces/frontend" function GamefieldPointer({ props: { x, y, show, type, edges, imply }, diff --git a/leaky-ships/components/Gamefield/HitElems.tsx b/leaky-ships/components/Gamefield/HitElems.tsx index f759635..4a580eb 100644 --- a/leaky-ships/components/Gamefield/HitElems.tsx +++ b/leaky-ships/components/Gamefield/HitElems.tsx @@ -1,8 +1,8 @@ -import { Hit } from "../../interfaces/frontend" import { faBurst, faXmark } from "@fortawesome/pro-solid-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import useIndex from "@hooks/useIndex" import { CSSProperties } from "react" +import { Hit } from "../../interfaces/frontend" function HitElems({ props, diff --git a/leaky-ships/components/Gamefield/Item.tsx b/leaky-ships/components/Gamefield/Item.tsx index 7600baf..d3c03b4 100644 --- a/leaky-ships/components/Gamefield/Item.tsx +++ b/leaky-ships/components/Gamefield/Item.tsx @@ -1,10 +1,9 @@ -import { ItemProps } from "../../interfaces/frontend" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { useDrawProps } from "@hooks/useDrawProps" import classNames from "classnames" -import { enable } from "colors" -import React, { CSSProperties, useEffect, useRef, useState } from "react" +import { CSSProperties, useEffect, useRef, useState } from "react" import { HexColorPicker } from "react-colorful" +import { ItemProps } from "../../interfaces/frontend" function Item({ props: { icon, text, amount, iconColor, disabled, enabled, callback }, diff --git a/leaky-ships/components/Gamefield/Labeling.tsx b/leaky-ships/components/Gamefield/Labeling.tsx index 2988f45..3eac3fa 100644 --- a/leaky-ships/components/Gamefield/Labeling.tsx +++ b/leaky-ships/components/Gamefield/Labeling.tsx @@ -1,8 +1,8 @@ -import { Field } from "../../interfaces/frontend" -import { count } from "./Gamefield" import { fieldIndex } from "@lib/utils/helpers" import classNames from "classnames" import { CSSProperties } from "react" +import { Field } from "../../interfaces/frontend" +import { count } from "./Gamefield" function Labeling() { let elems: (Field & { @@ -27,11 +27,11 @@ function Labeling() { x: count + 2, y: x + 2, orientation: "right", - } + }, ) } elems = elems.sort( - (a, b) => fieldIndex(count, a.x, a.y) - fieldIndex(count, b.x, b.y) + (a, b) => fieldIndex(count, a.x, a.y) - fieldIndex(count, b.x, b.y), ) return ( <> diff --git a/leaky-ships/components/Gamefield/Ship.tsx b/leaky-ships/components/Gamefield/Ship.tsx index 144b08a..e1436d3 100644 --- a/leaky-ships/components/Gamefield/Ship.tsx +++ b/leaky-ships/components/Gamefield/Ship.tsx @@ -1,6 +1,6 @@ -import { ShipProps } from "../../interfaces/frontend" import classNames from "classnames" -import React, { CSSProperties, useEffect, useRef } from "react" +import { CSSProperties, useEffect, useRef } from "react" +import { ShipProps } from "../../interfaces/frontend" const sizes: { [n: number]: number } = { 2: 96, diff --git a/leaky-ships/components/Gamefield/Ships.tsx b/leaky-ships/components/Gamefield/Ships.tsx index c792a37..53777c7 100644 --- a/leaky-ships/components/Gamefield/Ships.tsx +++ b/leaky-ships/components/Gamefield/Ships.tsx @@ -1,15 +1,11 @@ -import Ship from "./Ship" import useIndex from "@hooks/useIndex" +import Ship from "./Ship" function Ships() { const { selfUser } = useIndex() return ( - <> - {selfUser?.ships.map((props, i) => ( - - ))} - + <>{selfUser?.ships.map((props, i) => )} ) } diff --git a/leaky-ships/components/Gamefield/Targets.tsx b/leaky-ships/components/Gamefield/Targets.tsx index f896875..8d1b98c 100644 --- a/leaky-ships/components/Gamefield/Targets.tsx +++ b/leaky-ships/components/Gamefield/Targets.tsx @@ -1,6 +1,3 @@ -import GamefieldPointer from "./GamefieldPointer" -import HitElems from "./HitElems" -import Ship from "./Ship" import { useGameProps } from "@hooks/useGameProps" import useIndex from "@hooks/useIndex" import useShips from "@hooks/useShips" @@ -9,6 +6,9 @@ import { intersectingShip, shipProps, } from "@lib/utils/helpers" +import GamefieldPointer from "./GamefieldPointer" +import HitElems from "./HitElems" +import Ship from "./Ship" function Targets() { const { activeUser } = useIndex() @@ -20,12 +20,12 @@ function Targets() { <> {[ ...composeTargetTiles(target, mode, activeUser?.hits ?? []).map( - (props, i) => + (props, i) => , ), ...composeTargetTiles( targetPreview, mode, - activeUser?.hits ?? [] + activeUser?.hits ?? [], ).map((props, i) => ( )), diff --git a/leaky-ships/components/Grid.tsx b/leaky-ships/components/Grid.tsx index e39e9fc..ec1c338 100644 --- a/leaky-ships/components/Grid.tsx +++ b/leaky-ships/components/Grid.tsx @@ -71,10 +71,13 @@ function Grid() { pos(params.columns, params.rows), ] - setTimeout(() => { - setActve(false) - setCount((e) => e + 1) - }, Math.max(...diagonals) * 1000 + 300) + setTimeout( + () => { + setActve(false) + setCount((e) => e + 1) + }, + Math.max(...diagonals) * 1000 + 300, + ) } return ( @@ -100,7 +103,7 @@ function Grid() { } > {Array.from(Array(params.quantity), (_tile, index) => - createTile(index) + createTile(index), )} ) diff --git a/leaky-ships/components/Grid2.tsx b/leaky-ships/components/Grid2.tsx index 7dda33c..e8dd0b9 100644 --- a/leaky-ships/components/Grid2.tsx +++ b/leaky-ships/components/Grid2.tsx @@ -72,10 +72,13 @@ function Grid2() { pos(params.columns, params.rows), ] - setTimeout(() => { - setAction(false) - if (active) setCount((e) => e + 1) - }, Math.max(...diagonals) * 1000 + 1000) + setTimeout( + () => { + setAction(false) + if (active) setCount((e) => e + 1) + }, + Math.max(...diagonals) * 1000 + 1000, + ) } return ( @@ -106,7 +109,7 @@ function Grid2() { {Array.from(Array(params.quantity), (_tile, index) => - createTile(index) + createTile(index), )} ) diff --git a/leaky-ships/components/Lobby/Button.tsx b/leaky-ships/components/Lobby/Button.tsx index a547435..93970ff 100644 --- a/leaky-ships/components/Lobby/Button.tsx +++ b/leaky-ships/components/Lobby/Button.tsx @@ -1,5 +1,4 @@ import classNames from "classnames" -import React from "react" import { ReactNode } from "react" function Button({ @@ -34,7 +33,7 @@ function Button({ "border-orange-400 bg-warn": type === "orange", "border-green-600 bg-green-500": type === "green", "border-gray-600 bg-gray-500": type === "gray", - } + }, )} onClick={onClick} > diff --git a/leaky-ships/components/Lobby/LobbyFrame.tsx b/leaky-ships/components/Lobby/LobbyFrame.tsx index dacc3c6..1eb7dc0 100644 --- a/leaky-ships/components/Lobby/LobbyFrame.tsx +++ b/leaky-ships/components/Lobby/LobbyFrame.tsx @@ -1,6 +1,3 @@ -import Button from "./Button" -import Icon from "./Icon" -import Player from "./Player" import { faRightFromBracket, faSpinnerThird, @@ -12,6 +9,9 @@ import { socket } from "@lib/socket" import { useSession } from "next-auth/react" import { useRouter } from "next/router" import { Fragment, ReactNode, useEffect, useMemo, useState } from "react" +import Button from "./Button" +import Icon from "./Icon" +import Player from "./Player" function WithDots({ children }: { children: ReactNode }) { const [dots, setDots] = useState(1) @@ -43,7 +43,7 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) { () => payload?.users.length === 2 && !userStates.filter((user) => !user.isReady).length, - [payload?.users.length, userStates] + [payload?.users.length, userStates], ) useEffect(() => { diff --git a/leaky-ships/components/Lobby/Player.tsx b/leaky-ships/components/Lobby/Player.tsx index a600d2b..6372ddd 100644 --- a/leaky-ships/components/Lobby/Player.tsx +++ b/leaky-ships/components/Lobby/Player.tsx @@ -1,4 +1,3 @@ -import Button from "./Button" import { faCheck, faHandPointer, @@ -13,6 +12,7 @@ import { useGameProps } from "@hooks/useGameProps" import { socket } from "@lib/socket" import classNames from "classnames" import { CSSProperties, useEffect, useMemo, useState } from "react" +import Button from "./Button" function HourGlass() { const [count, setCount] = useState(3) @@ -56,7 +56,7 @@ function Player({ const { isReady, isConnected } = useMemo(() => userStates[i], [i, userStates]) const primary = useMemo( () => userId && userId === payload?.users[i]?.id, - [i, payload?.users, userId] + [i, payload?.users, userId], ) return ( @@ -64,7 +64,7 @@ function Player({

{player?.name ?? "Spieler " + (player?.index === 2 ? "2" : "1")} diff --git a/leaky-ships/components/Lobby/SettingsFrame/Setting.tsx b/leaky-ships/components/Lobby/SettingsFrame/Setting.tsx index fcded48..a58f3b8 100644 --- a/leaky-ships/components/Lobby/SettingsFrame/Setting.tsx +++ b/leaky-ships/components/Lobby/SettingsFrame/Setting.tsx @@ -37,7 +37,7 @@ function Setting({ state ? "text-blue-500" : "text-gray-800", { "bg-gray-300 ": state, - } + }, )} size="3x" icon={state ? faToggleLargeOn : faToggleLargeOff} @@ -53,7 +53,7 @@ function Setting({ [prop]: !state, }, setSetting, - full + full, ) } hidden={true} diff --git a/leaky-ships/components/Lobby/SettingsFrame/Settings.tsx b/leaky-ships/components/Lobby/SettingsFrame/Settings.tsx index c967739..78ff8ee 100644 --- a/leaky-ships/components/Lobby/SettingsFrame/Settings.tsx +++ b/leaky-ships/components/Lobby/SettingsFrame/Settings.tsx @@ -1,10 +1,10 @@ -import Setting, { GameSettings } from "./Setting" import { faRotateLeft } from "@fortawesome/pro-regular-svg-icons" import { faXmark } from "@fortawesome/pro-solid-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { useGameProps } from "@hooks/useGameProps" import { socket } from "@lib/socket" import { useCallback } from "react" +import Setting, { GameSettings } from "./Setting" function Settings({ closeSettings }: { closeSettings: () => void }) { const { setSetting, full } = useGameProps() @@ -18,7 +18,7 @@ function Settings({ closeSettings }: { closeSettings: () => void }) { socket.emit("update", full) }) }, - [full, setSetting] + [full, setSetting], ) return ( diff --git a/leaky-ships/components/Logo.tsx b/leaky-ships/components/Logo.tsx index c7e5f5e..5f1ef32 100644 --- a/leaky-ships/components/Logo.tsx +++ b/leaky-ships/components/Logo.tsx @@ -1,5 +1,4 @@ import classNames from "classnames" -import React from "react" function Logo({ small }: { small?: boolean }) { return ( @@ -7,7 +6,7 @@ function Logo({ small }: { small?: boolean }) {

Leaky @@ -67,14 +66,14 @@ function Screw({ className={classNames( "absolute flex h-3 w-3 flex-col items-center justify-center rounded-full border-[1px] border-neutral-700 bg-neutral-400 sm:h-5 sm:w-5 sm:border-2 md:h-6 md:w-6", { "xl:h-8 xl:w-8": !small }, - orientation + orientation, )} >
diff --git a/leaky-ships/components/OptionButton.tsx b/leaky-ships/components/OptionButton.tsx index 44d1e71..41ff4bf 100644 --- a/leaky-ships/components/OptionButton.tsx +++ b/leaky-ships/components/OptionButton.tsx @@ -23,7 +23,7 @@ function OptionButton({ "flex w-full flex-row items-center justify-between rounded-xl py-2 pl-8 pr-4 text-lg text-grayish duration-100 first:mt-4 last:mt-4 sm:py-4 sm:pl-16 sm:pr-8 sm:text-4xl sm:first:mt-8 sm:last:mt-8", !disabled ? "border-b-4 border-shield-gray bg-voidDark active:border-b-0 active:border-t-4" - : "border-4 border-dashed border-slate-600 bg-red-950" + : "border-4 border-dashed border-slate-600 bg-red-950", )} onClick={() => callback && setTimeout(callback, 200)} disabled={disabled} diff --git a/leaky-ships/components/profileImg.tsx b/leaky-ships/components/profileImg.tsx index c18fa94..756e432 100644 --- a/leaky-ships/components/profileImg.tsx +++ b/leaky-ships/components/profileImg.tsx @@ -1,5 +1,3 @@ -import React from "react" - function profileImg(src: string) { return ( ()( set( produce((state) => { state.color = color - }) + }), ), reset: () => { set(initialState) @@ -35,6 +35,6 @@ export const useDrawProps = create()( }), { name: "gameState", - } - ) + }, + ), ) diff --git a/leaky-ships/hooks/useGameProps.ts b/leaky-ships/hooks/useGameProps.ts index 3c2873e..b7536a1 100644 --- a/leaky-ships/hooks/useGameProps.ts +++ b/leaky-ships/hooks/useGameProps.ts @@ -1,11 +1,3 @@ -import { - MoveDispatchProps, - EventBarModes, - MouseCursor, - ShipProps, - Target, - TargetPreview, -} from "../interfaces/frontend" import { GameSettings } from "@components/Lobby/SettingsFrame/Setting" import { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum" import { socket } from "@lib/socket" @@ -27,6 +19,14 @@ import { SetStateAction } from "react" import { toast } from "react-toastify" import { create } from "zustand" import { devtools } from "zustand/middleware" +import { + EventBarModes, + MouseCursor, + MoveDispatchProps, + ShipProps, + Target, + TargetPreview, +} from "../interfaces/frontend" const initialState: optionalGamePropsSchema & { userStates: { @@ -88,7 +88,7 @@ export const useGameProps = create()( state.menu = "main" state.mode = -1 } - }) + }), ), DispatchMove: (move, i) => set( @@ -108,12 +108,12 @@ export const useGameProps = create()( }).fields.length, x, y, - })) + })), ) return e }) - }) + }), ), setTarget: (dispatch) => set( @@ -121,7 +121,7 @@ export const useGameProps = create()( if (typeof dispatch === "function") state.target = dispatch(state.target) else state.target = dispatch - }) + }), ), setTargetPreview: (dispatch) => set( @@ -129,7 +129,7 @@ export const useGameProps = create()( if (typeof dispatch === "function") state.targetPreview = dispatch(state.targetPreview) else state.targetPreview = dispatch - }) + }), ), setMouseCursor: (dispatch) => set( @@ -137,7 +137,7 @@ export const useGameProps = create()( if (typeof dispatch === "function") state.mouseCursor = dispatch(state.mouseCursor) else state.mouseCursor = dispatch - }) + }), ), setShips: (ships, index) => set( @@ -148,7 +148,7 @@ export const useGameProps = create()( e.ships = ships return e }) - }) + }), ), removeShip: ({ size, variant, x, y }, index) => set( @@ -160,12 +160,12 @@ export const useGameProps = create()( ship.size === size && ship.variant === variant && ship.x === x && - ship.y === y + ship.y === y, ) e.ships.splice(indexToRemove, 1) return e }) - }) + }), ), setPlayer: (payload) => { let hash: string | null = null @@ -183,7 +183,7 @@ export const useGameProps = create()( } hash = body.hash state.hash = hash - }) + }), ) return hash }, @@ -203,7 +203,7 @@ export const useGameProps = create()( } hash = body.hash state.hash = hash - }) + }), ) return hash }, @@ -221,7 +221,7 @@ export const useGameProps = create()( console.warn( "Different gameId detected on update: ", state.payload?.game?.id, - newGameProps.payload?.game?.id + newGameProps.payload?.game?.id, ) } @@ -242,7 +242,7 @@ export const useGameProps = create()( produce((state: State) => { state.userStates[i].isReady = isReady state.userStates[i].isConnected = true - }) + }), ), gameState: (newState: GameState) => set( @@ -253,7 +253,7 @@ export const useGameProps = create()( ...e, isReady: false, })) - }) + }), ), setIsConnected: ({ i, isConnected }) => set( @@ -261,7 +261,7 @@ export const useGameProps = create()( state.userStates[i].isConnected = isConnected if (isConnected) return state.userStates[i].isReady = false - }) + }), ), reset: () => { set(initialState) @@ -269,6 +269,6 @@ export const useGameProps = create()( }), { name: "gameState", - } - ) + }, + ), ) diff --git a/leaky-ships/hooks/useIndex.ts b/leaky-ships/hooks/useIndex.ts index 699973f..81924be 100644 --- a/leaky-ships/hooks/useIndex.ts +++ b/leaky-ships/hooks/useIndex.ts @@ -1,5 +1,5 @@ -import { useGameProps } from "./useGameProps" import { useSession } from "next-auth/react" +import { useGameProps } from "./useGameProps" function useIndex() { const { payload } = useGameProps() diff --git a/leaky-ships/hooks/useShips.ts b/leaky-ships/hooks/useShips.ts index 9c55213..54d7ab4 100644 --- a/leaky-ships/hooks/useShips.ts +++ b/leaky-ships/hooks/useShips.ts @@ -1,7 +1,7 @@ +import { useCallback, useMemo } from "react" import { ShipProps } from "../interfaces/frontend" import { useGameProps } from "./useGameProps" import useIndex from "./useIndex" -import { useCallback, useMemo } from "react" function useShips() { const gameProps = useGameProps() @@ -10,15 +10,15 @@ function useShips() { const ships = useMemo( () => gameProps.payload?.users.find((e) => e?.index === selfIndex)?.ships ?? [], - [gameProps.payload?.users, selfIndex] + [gameProps.payload?.users, selfIndex], ) const setShips = useCallback( (ships: ShipProps[]) => gameProps.setShips(ships, selfIndex), - [gameProps, selfIndex] + [gameProps, selfIndex], ) const removeShip = useCallback( (ship: ShipProps) => gameProps.removeShip(ship, selfIndex), - [gameProps, selfIndex] + [gameProps, selfIndex], ) return { ships, setShips, removeShip } diff --git a/leaky-ships/hooks/useSocket.ts b/leaky-ships/hooks/useSocket.ts index dcb7958..a64f181 100644 --- a/leaky-ships/hooks/useSocket.ts +++ b/leaky-ships/hooks/useSocket.ts @@ -1,12 +1,12 @@ -import { isAuthenticated } from "../pages/start" -import { useGameProps } from "./useGameProps" -import useIndex from "./useIndex" import { socket } from "@lib/socket" import { GamePropsSchema } from "@lib/zodSchemas" import status from "http-status" import { useRouter } from "next/router" import { useEffect, useMemo, useState } from "react" import { toast } from "react-toastify" +import { isAuthenticated } from "../pages/start" +import { useGameProps } from "./useGameProps" +import useIndex from "./useIndex" /** This function should only be called once per page, otherwise there will be multiple socket connections and duplicate event listeners. */ function useSocket() { @@ -30,7 +30,7 @@ function useSocket() { const isConnected = useMemo( () => selfIndex >= 0 ? userStates[selfIndex].isConnected : isConnectedState, - [selfIndex, isConnectedState, userStates] + [selfIndex, isConnectedState, userStates], ) useEffect(() => { diff --git a/leaky-ships/interfaces/NextApiSocket.ts b/leaky-ships/interfaces/NextApiSocket.ts index 24aa7f9..835ecbe 100644 --- a/leaky-ships/interfaces/NextApiSocket.ts +++ b/leaky-ships/interfaces/NextApiSocket.ts @@ -1,4 +1,3 @@ -import { MoveDispatchProps, DrawLineProps, ShipProps } from "./frontend" import { GameSettings } from "@components/Lobby/SettingsFrame/Setting" import { GamePropsSchema, PlayerSchema } from "@lib/zodSchemas" import { GameState } from "@prisma/client" @@ -12,6 +11,7 @@ import type { Socket as SocketforServer, } from "socket.io" import type { Socket as SocketforClient } from "socket.io-client" +import { DrawLineProps, MoveDispatchProps, ShipProps } from "./frontend" interface SocketServer extends HTTPServer { io?: IOServer @@ -41,7 +41,7 @@ export interface ServerToClientEvents { | { type: "disconnect" i: number - } + }, ) => void isReady: (payload: { i: number; isReady: boolean }) => void isConnected: (payload: { i: number; isConnected: boolean }) => void diff --git a/leaky-ships/lib/backend/getPinFromBody.ts b/leaky-ships/lib/backend/getPinFromBody.ts index fdb6722..dc0c949 100644 --- a/leaky-ships/lib/backend/getPinFromBody.ts +++ b/leaky-ships/lib/backend/getPinFromBody.ts @@ -1,6 +1,6 @@ -import sendError from "./sendError" import { NextApiRequest, NextApiResponse } from "next" import { z } from "zod" +import sendError from "./sendError" const pinBodySchema = z.object({ pin: z.string(), diff --git a/leaky-ships/lib/backend/logging.ts b/leaky-ships/lib/backend/logging.ts index 82b491b..8bc7231 100644 --- a/leaky-ships/lib/backend/logging.ts +++ b/leaky-ships/lib/backend/logging.ts @@ -39,7 +39,7 @@ async function logStartup() { async function logging( message: string, types: Logging[], - req?: NextApiRequest | IncomingMessage + req?: NextApiRequest | IncomingMessage, ) { if (!started) await logStartup() const messages = { console: message, file: message } @@ -60,7 +60,7 @@ async function logging( const ip = (forwardedFor || "127.0.0.1, 192.168.178.1").split(",") const route = req.url messages.console = [ip[0].yellow, route?.green, messages.console].join( - " - " + " - ", ) messages.file = [ip[0], route, messages.file].join(" - ") } diff --git a/leaky-ships/lib/backend/sendError.ts b/leaky-ships/lib/backend/sendError.ts index 36391d5..b23bf6e 100644 --- a/leaky-ships/lib/backend/sendError.ts +++ b/leaky-ships/lib/backend/sendError.ts @@ -1,11 +1,11 @@ +import type { NextApiRequest, NextApiResponse } from "next" import { rejectionError } from "./errors" import logging from "./logging" -import type { NextApiRequest, NextApiResponse } from "next" export default function sendError( req: NextApiRequest, res: NextApiResponse, - err: rejectionError | Error + err: rejectionError | Error, ) { // If something went wrong, let the client know with status 500 res.status("statusCode" in err ? err.statusCode : 500).end() @@ -14,7 +14,7 @@ export default function sendError( "type" in err && err.type ? err.type : ["solved" in err && err.solved ? "debug" : "error"], - req + req, ) if ("name" in err) console.log(err) } diff --git a/leaky-ships/lib/backend/sendResponse.ts b/leaky-ships/lib/backend/sendResponse.ts index cc24cc5..e4d4b7d 100644 --- a/leaky-ships/lib/backend/sendResponse.ts +++ b/leaky-ships/lib/backend/sendResponse.ts @@ -1,5 +1,5 @@ -import logging, { Logging } from "./logging" import { NextApiRequest, NextApiResponse } from "next" +import logging, { Logging } from "./logging" export interface Result { message: string @@ -12,7 +12,7 @@ export interface Result { export default function sendResponse( req: NextApiRequest, res: NextApiResponse, - result: Result + result: Result, ) { if (result.redirectUrl) { res.redirect(result.statusCode ?? 307, result.redirectUrl) diff --git a/leaky-ships/lib/getPayloadwithChecksum.ts b/leaky-ships/lib/getPayloadwithChecksum.ts index 5b6b1bd..97541f2 100644 --- a/leaky-ships/lib/getPayloadwithChecksum.ts +++ b/leaky-ships/lib/getPayloadwithChecksum.ts @@ -1,8 +1,8 @@ -import { GamePropsSchema } from "./zodSchemas" import crypto from "crypto" +import { GamePropsSchema } from "./zodSchemas" export function getPayloadwithChecksum( - payload: GamePropsSchema["payload"] + payload: GamePropsSchema["payload"], ): GamePropsSchema { const objString = JSON.stringify(payload) const hash = crypto.createHash("md5").update(objString).digest("hex") diff --git a/leaky-ships/lib/socket.ts b/leaky-ships/lib/socket.ts index cd10517..64d0c98 100644 --- a/leaky-ships/lib/socket.ts +++ b/leaky-ships/lib/socket.ts @@ -1,5 +1,5 @@ -import { cSocket } from "../interfaces/NextApiSocket" import { io } from "socket.io-client" +import { cSocket } from "../interfaces/NextApiSocket" export const socket: cSocket = io({ path: "/api/ws", diff --git a/leaky-ships/lib/utils/helpers.ts b/leaky-ships/lib/utils/helpers.ts index 73429c9..8a6002d 100644 --- a/leaky-ships/lib/utils/helpers.ts +++ b/leaky-ships/lib/utils/helpers.ts @@ -1,3 +1,5 @@ +import { count } from "@components/Gamefield/Gamefield" +import { Orientation } from "@prisma/client" import type { Hit, IndexedPosition, @@ -8,8 +10,6 @@ import type { Target, TargetList, } from "../../interfaces/frontend" -import { count } from "@components/Gamefield/Gamefield" -import { Orientation } from "@prisma/client" export function borderCN(count: number, x: number, y: number) { if (x === 0) return "left" @@ -58,7 +58,7 @@ export function isAlreadyHit(x: number, y: number, hits: Hit[]) { export function targetList( { x: targetX, y: targetY }: Position, - modeInput: number | string + modeInput: number | string, ): TargetList[] { const mode = typeof modeInput === "number" @@ -98,7 +98,7 @@ export function overlapsWithAnyBorder(target: Position, mode: number) { export function composeTargetTiles( target: Target, mode: number, - hits: Hit[] + hits: Hit[], ): PointerProps[] { const { show } = target return targetList(target, mode).map((targetItem) => { @@ -132,7 +132,7 @@ export const initlialMouseCursor = { export const shipProps = ( ships: ShipProps[], mode: number, - targetPreview: Position & { orientation: Orientation } + targetPreview: Position & { orientation: Orientation }, ) => ({ size: mode + 2, variant: @@ -190,7 +190,7 @@ export function shipFields(ship: ShipProps, i?: number) { export function intersectingShip( ships: ShipProps[], ship: ShipProps, - withBorder?: boolean + withBorder?: boolean, ) { const thisShip = shipFields(ship) const reducedShips = ships.reduce( @@ -201,17 +201,17 @@ export function intersectingShip( borders: [...prev.borders, ...borders], } }, - { fields: [] as IndexedPosition[], borders: [] as IndexedPosition[] } + { fields: [] as IndexedPosition[], borders: [] as IndexedPosition[] }, ) const fields = reducedShips.fields.filter( - (e) => thisShip.fields.filter((e2) => e2.x === e.x && e2.y === e.y).length + (e) => thisShip.fields.filter((e2) => e2.x === e.x && e2.y === e.y).length, ) const borders = thisShip.fields.filter( (e) => - reducedShips.borders.filter((e2) => e2.x === e.x && e2.y === e.y).length + reducedShips.borders.filter((e2) => e2.x === e.x && e2.y === e.y).length, ) const isInBorder = thisShip.fields.filter( - (e) => withBorder && isBorder(e.x, e.y) + (e) => withBorder && isBorder(e.x, e.y), ) return { score: isInBorder.length ? 2 : fields.length || borders.length ? 1 : 0, diff --git a/leaky-ships/pages/_app.tsx b/leaky-ships/pages/_app.tsx index 97c6cf2..39f833e 100644 --- a/leaky-ships/pages/_app.tsx +++ b/leaky-ships/pages/_app.tsx @@ -1,12 +1,12 @@ -import "../styles/App.scss" -import "../styles/globals.scss" -import "../styles/grid2.scss" -import "../styles/grid.scss" import "@fortawesome/fontawesome-svg-core/styles.css" import { SessionProvider } from "next-auth/react" import type { AppProps } from "next/app" import { ToastContainer } from "react-toastify" import "react-toastify/dist/ReactToastify.css" +import "../styles/App.scss" +import "../styles/globals.scss" +import "../styles/grid.scss" +import "../styles/grid2.scss" export default function App({ Component, diff --git a/leaky-ships/pages/_document.tsx b/leaky-ships/pages/_document.tsx index 097cb7f..519bd99 100644 --- a/leaky-ships/pages/_document.tsx +++ b/leaky-ships/pages/_document.tsx @@ -1,4 +1,4 @@ -import { Html, Head, Main, NextScript } from "next/document" +import { Head, Html, Main, NextScript } from "next/document" export default function Document() { return ( diff --git a/leaky-ships/pages/api/auth/[...nextauth].ts b/leaky-ships/pages/api/auth/[...nextauth].ts index 00da0f3..b2c893b 100644 --- a/leaky-ships/pages/api/auth/[...nextauth].ts +++ b/leaky-ships/pages/api/auth/[...nextauth].ts @@ -5,10 +5,10 @@ import NextAuth, { NextAuthOptions } from "next-auth" import AzureADProvider from "next-auth/providers/azure-ad" import EmailProvider from "next-auth/providers/email" import { - uniqueNamesGenerator, - Config, animals, + Config, NumberDictionary, + uniqueNamesGenerator, } from "unique-names-generator" const numberDictionary = NumberDictionary.generate({ min: 0, max: 9999 }) diff --git a/leaky-ships/pages/api/game/[id].ts b/leaky-ships/pages/api/game/[id].ts index b826263..6428d5f 100644 --- a/leaky-ships/pages/api/game/[id].ts +++ b/leaky-ships/pages/api/game/[id].ts @@ -1,10 +1,10 @@ -import { authOptions } from "../auth/[...nextauth]" import { rejectionErrors } from "@lib/backend/errors" import sendResponse from "@lib/backend/sendResponse" import prisma from "@lib/prisma" import { Game } from "@prisma/client" import type { NextApiRequest, NextApiResponse } from "next" import { getServerSession } from "next-auth" +import { authOptions } from "../auth/[...nextauth]" interface Data { game: Game @@ -12,7 +12,7 @@ interface Data { export default async function id( req: NextApiRequest, - res: NextApiResponse + res: NextApiResponse, ) { const gameId = req.query.id const session = await getServerSession(req, res, authOptions) diff --git a/leaky-ships/pages/api/game/create.ts b/leaky-ships/pages/api/game/create.ts index 25de46a..80db044 100644 --- a/leaky-ships/pages/api/game/create.ts +++ b/leaky-ships/pages/api/game/create.ts @@ -1,15 +1,15 @@ -import { authOptions } from "../auth/[...nextauth]" -import { composeBody, gameSelects, getAnyRunningGame } from "./running" import sendResponse from "@backend/sendResponse" import { rejectionErrors } from "@lib/backend/errors" import prisma from "@lib/prisma" import { GamePropsSchema } from "@lib/zodSchemas" import type { NextApiRequest, NextApiResponse } from "next" import { getServerSession } from "next-auth" +import { authOptions } from "../auth/[...nextauth]" +import { composeBody, gameSelects, getAnyRunningGame } from "./running" export default async function create( req: NextApiRequest, - res: NextApiResponse + res: NextApiResponse, ) { const session = await getServerSession(req, res, authOptions) diff --git a/leaky-ships/pages/api/game/join.ts b/leaky-ships/pages/api/game/join.ts index fb5adb7..91d5e68 100644 --- a/leaky-ships/pages/api/game/join.ts +++ b/leaky-ships/pages/api/game/join.ts @@ -1,5 +1,3 @@ -import { authOptions } from "../auth/[...nextauth]" -import running, { composeBody, gameSelects } from "./running" import sendError from "@backend/sendError" import sendResponse from "@backend/sendResponse" import { rejectionErrors } from "@lib/backend/errors" @@ -9,10 +7,12 @@ import prisma from "@lib/prisma" import { GamePropsSchema } from "@lib/zodSchemas" import type { NextApiRequest, NextApiResponse } from "next" import { getServerSession } from "next-auth" +import { authOptions } from "../auth/[...nextauth]" +import { composeBody, gameSelects } from "./running" export default async function join( req: NextApiRequest, - res: NextApiResponse + res: NextApiResponse, ) { const session = await getServerSession(req, res, authOptions) const pin = await getPinFromBody(req, res) @@ -82,7 +82,7 @@ export default async function join( await logging( "HERE".red + err.code + err.meta + err.message, ["error"], - req + req, ) throw sendError(req, res, rejectionErrors.gameNotFound) } diff --git a/leaky-ships/pages/api/game/running.ts b/leaky-ships/pages/api/game/running.ts index ac45d36..ba7212f 100644 --- a/leaky-ships/pages/api/game/running.ts +++ b/leaky-ships/pages/api/game/running.ts @@ -1,4 +1,3 @@ -import { authOptions } from "../auth/[...nextauth]" import sendResponse from "@backend/sendResponse" import { rejectionErrors } from "@lib/backend/errors" import { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum" @@ -6,6 +5,7 @@ import prisma from "@lib/prisma" import { GamePropsSchema } from "@lib/zodSchemas" import type { NextApiRequest, NextApiResponse } from "next" import { getServerSession } from "next-auth" +import { authOptions } from "../auth/[...nextauth]" export const gameSelects = { select: { @@ -99,7 +99,7 @@ export const getAnyRunningGame = (userId: string) => { } export function composeBody( - gameDB: NonNullable>> + gameDB: NonNullable>>, ): GamePropsSchema { const { gamePin, ...game } = gameDB const users = gameDB.users @@ -125,7 +125,7 @@ export function composeBody( export default async function running( req: NextApiRequest, - res: NextApiResponse + res: NextApiResponse, ) { const session = await getServerSession(req, res, authOptions) diff --git a/leaky-ships/pages/api/ws.ts b/leaky-ships/pages/api/ws.ts index 965b13f..8cef0d8 100644 --- a/leaky-ships/pages/api/ws.ts +++ b/leaky-ships/pages/api/ws.ts @@ -1,3 +1,11 @@ +import logging from "@lib/backend/logging" +import prisma from "@lib/prisma" +import { GamePropsSchema } from "@lib/zodSchemas" +import colors from "colors" +import status from "http-status" +import { NextApiRequest } from "next" +import { getSession } from "next-auth/react" +import { Server } from "socket.io" import { NextApiResponseWithSocket, sServer, @@ -8,20 +16,12 @@ import { getAnyGame, getAnyRunningGame, } from "./game/running" -import logging from "@lib/backend/logging" -import prisma from "@lib/prisma" -import { GamePropsSchema } from "@lib/zodSchemas" -import colors from "colors" -import status from "http-status" -import { NextApiRequest } from "next" -import { getSession } from "next-auth/react" -import { Server } from "socket.io" colors.enable() const SocketHandler = async ( req: NextApiRequest, - res: NextApiResponseWithSocket + res: NextApiResponseWithSocket, ) => { if (res.socket.server.io) { logging("Socket is already running " + req.url, ["infoCyan"], req) @@ -51,7 +51,7 @@ const SocketHandler = async ( "Forbidden, no game found: " + JSON.stringify(Array.from(socket.rooms)), ["debug"], - socket.request + socket.request, ) return next(new Error(status["403"])) } @@ -59,7 +59,7 @@ const SocketHandler = async ( const { payload, hash } = composeBody(game) // let index: number | null = null const index = payload.users.findIndex( - (user) => socket.data.user?.id === user?.id + (user) => socket.data.user?.id === user?.id, ) if (index < 0) return next(new Error(status["401"])) socket.data.index = index @@ -85,7 +85,7 @@ const SocketHandler = async ( ", " + socket.id.cyan, ["infoGreen"], - socket.request + socket.request, ) socket.on("update", async (cb) => { @@ -196,7 +196,7 @@ const SocketHandler = async ( .emit( "draw-line", { prevPoint, currentPoint, color }, - socket.data.index + socket.data.index, ) }) @@ -279,7 +279,7 @@ const SocketHandler = async ( logging( "Disconnecting: " + JSON.stringify(Array.from(socket.rooms)), ["debug"], - socket.request + socket.request, ) if (socket.data.index === undefined || !socket.data.gameId) return socket.to(socket.data.gameId).emit("playerEvent", { diff --git a/leaky-ships/pages/game.tsx b/leaky-ships/pages/game.tsx index b1fa9b3..8402397 100644 --- a/leaky-ships/pages/game.tsx +++ b/leaky-ships/pages/game.tsx @@ -1,7 +1,7 @@ import { useGameProps } from "@hooks/useGameProps" import { useSession } from "next-auth/react" import { useRouter } from "next/router" -import React, { useEffect } from "react" +import { useEffect } from "react" import { toast } from "react-toastify" export default function Game() { diff --git a/leaky-ships/pages/lobby.tsx b/leaky-ships/pages/lobby.tsx index 53f32ca..7632a48 100644 --- a/leaky-ships/pages/lobby.tsx +++ b/leaky-ships/pages/lobby.tsx @@ -26,7 +26,7 @@ export default function Lobby() {
diff --git a/leaky-ships/pages/signout.tsx b/leaky-ships/pages/signout.tsx index 5621e9d..e945862 100644 --- a/leaky-ships/pages/signout.tsx +++ b/leaky-ships/pages/signout.tsx @@ -1,6 +1,6 @@ import { signOut, useSession } from "next-auth/react" import { useRouter } from "next/router" -import React, { useEffect } from "react" +import { useEffect } from "react" function Logout() { const { status } = useSession() diff --git a/leaky-ships/pages/start.tsx b/leaky-ships/pages/start.tsx index 2d7ebfb..1e241f8 100644 --- a/leaky-ships/pages/start.tsx +++ b/leaky-ships/pages/start.tsx @@ -11,8 +11,7 @@ import { useSession } from "next-auth/react" import { useRouter } from "next/router" import { useCallback, useEffect, useMemo, useState } from "react" import OtpInput from "react-otp-input" -import { toast } from "react-toastify" -import { Icons } from "react-toastify" +import { Icons, toast } from "react-toastify" export function isAuthenticated(res: Response) { switch (status[`${res.status}_CLASS`]) { @@ -40,7 +39,7 @@ const handleConfirmation = () => { or
, - { autoClose: false, toastId } + { autoClose: false, toastId }, ) } @@ -68,7 +67,7 @@ export default function Start() { { method: "POST", body: JSON.stringify({ pin }), - } + }, ) .then(isAuthenticated) .then((game) => GamePropsSchema.parse(game)) @@ -91,7 +90,7 @@ export default function Start() { autoClose: 5000, hideProgressBar: false, closeButton: true, - }) + }), ) if (!res) return full(res) @@ -110,7 +109,7 @@ export default function Start() { autoClose: 5000, hideProgressBar: false, closeButton: true, - }) + }), ) .catch(() => toast.update(toastId, { @@ -121,10 +120,10 @@ export default function Start() { autoClose: 5000, hideProgressBar: false, closeButton: true, - }) + }), ) }, - [router, full] + [router, full], ) useEffect(() => { diff --git a/leaky-ships/prisma/generated/zod/index.ts b/leaky-ships/prisma/generated/zod/index.ts index c7da076..2a6d385 100644 --- a/leaky-ships/prisma/generated/zod/index.ts +++ b/leaky-ships/prisma/generated/zod/index.ts @@ -10,33 +10,35 @@ import type { Prisma } from '@prisma/client'; // ENUMS ///////////////////////////////////////// +export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']); + export const AccountScalarFieldEnumSchema = z.enum(['id','userId','type','provider','providerAccountId','refresh_token','access_token','expires_at','ext_expires_in','token_type','scope','id_token','session_state','oauth_token_secret','oauth_token']); -export const ChatScalarFieldEnumSchema = z.enum(['id','createdAt','message','event','user_game_id']); +export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']); + +export const UserScalarFieldEnumSchema = z.enum(['id','name','email','emailVerified','image','createdAt','updatedAt']); + +export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']); export const GameScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','state','allowSpectators','allowSpecials','allowChat','allowMarkDraw']); export const GamepinScalarFieldEnumSchema = z.enum(['id','createdAt','pin','gameId']); -export const HitScalarFieldEnumSchema = z.enum(['id','x','y','hit','user_GameId']); - -export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','type','x','y','orientation','user_game_id']); - -export const QueryModeSchema = z.enum(['default','insensitive']); - -export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']); - export const ShipScalarFieldEnumSchema = z.enum(['id','size','variant','x','y','orientation','user_GameId']); -export const SortOrderSchema = z.enum(['asc','desc']); - -export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']); - -export const UserScalarFieldEnumSchema = z.enum(['id','name','email','emailVerified','image','createdAt','updatedAt']); +export const HitScalarFieldEnumSchema = z.enum(['id','x','y','hit','user_GameId']); export const User_GameScalarFieldEnumSchema = z.enum(['id','createdAt','gameId','userId','index']); -export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']); +export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','type','x','y','orientation','user_game_id']); + +export const ChatScalarFieldEnumSchema = z.enum(['id','createdAt','message','event','user_game_id']); + +export const SortOrderSchema = z.enum(['asc','desc']); + +export const QueryModeSchema = z.enum(['default','insensitive']); + +export const NullsOrderSchema = z.enum(['first','last']); export const GameStateSchema = z.enum(['lobby','starting','running','ended','aborted']); @@ -549,16 +551,16 @@ export const AccountOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), provider: z.lazy(() => SortOrderSchema).optional(), providerAccountId: z.lazy(() => SortOrderSchema).optional(), - refresh_token: z.lazy(() => SortOrderSchema).optional(), - access_token: z.lazy(() => SortOrderSchema).optional(), - expires_at: z.lazy(() => SortOrderSchema).optional(), - ext_expires_in: z.lazy(() => SortOrderSchema).optional(), - token_type: z.lazy(() => SortOrderSchema).optional(), - scope: z.lazy(() => SortOrderSchema).optional(), - id_token: z.lazy(() => SortOrderSchema).optional(), - session_state: z.lazy(() => SortOrderSchema).optional(), - oauth_token_secret: z.lazy(() => SortOrderSchema).optional(), - oauth_token: z.lazy(() => SortOrderSchema).optional(), + refresh_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + access_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + expires_at: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + ext_expires_in: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + token_type: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + scope: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + id_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + session_state: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + oauth_token_secret: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + oauth_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), user: z.lazy(() => UserOrderByWithRelationInputSchema).optional() }).strict(); @@ -573,16 +575,16 @@ export const AccountOrderByWithAggregationInputSchema: z.ZodType SortOrderSchema).optional(), provider: z.lazy(() => SortOrderSchema).optional(), providerAccountId: z.lazy(() => SortOrderSchema).optional(), - refresh_token: z.lazy(() => SortOrderSchema).optional(), - access_token: z.lazy(() => SortOrderSchema).optional(), - expires_at: z.lazy(() => SortOrderSchema).optional(), - ext_expires_in: z.lazy(() => SortOrderSchema).optional(), - token_type: z.lazy(() => SortOrderSchema).optional(), - scope: z.lazy(() => SortOrderSchema).optional(), - id_token: z.lazy(() => SortOrderSchema).optional(), - session_state: z.lazy(() => SortOrderSchema).optional(), - oauth_token_secret: z.lazy(() => SortOrderSchema).optional(), - oauth_token: z.lazy(() => SortOrderSchema).optional(), + refresh_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + access_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + expires_at: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + ext_expires_in: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + token_type: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + scope: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + id_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + session_state: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + oauth_token_secret: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + oauth_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), _count: z.lazy(() => AccountCountOrderByAggregateInputSchema).optional(), _avg: z.lazy(() => AccountAvgOrderByAggregateInputSchema).optional(), _max: z.lazy(() => AccountMaxOrderByAggregateInputSchema).optional(), @@ -673,10 +675,10 @@ export const UserWhereInputSchema: z.ZodType = z.object({ export const UserOrderByWithRelationInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), - name: z.lazy(() => SortOrderSchema).optional(), - email: z.lazy(() => SortOrderSchema).optional(), - emailVerified: z.lazy(() => SortOrderSchema).optional(), - image: z.lazy(() => SortOrderSchema).optional(), + name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + email: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + emailVerified: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + image: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), updatedAt: z.lazy(() => SortOrderSchema).optional(), games: z.lazy(() => User_GameOrderByRelationAggregateInputSchema).optional(), @@ -691,10 +693,10 @@ export const UserWhereUniqueInputSchema: z.ZodType export const UserOrderByWithAggregationInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), - name: z.lazy(() => SortOrderSchema).optional(), - email: z.lazy(() => SortOrderSchema).optional(), - emailVerified: z.lazy(() => SortOrderSchema).optional(), - image: z.lazy(() => SortOrderSchema).optional(), + name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + email: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + emailVerified: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + image: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), updatedAt: z.lazy(() => SortOrderSchema).optional(), _count: z.lazy(() => UserCountOrderByAggregateInputSchema).optional(), @@ -1102,8 +1104,8 @@ export const ChatWhereInputSchema: z.ZodType = z.object({ export const ChatOrderByWithRelationInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), - message: z.lazy(() => SortOrderSchema).optional(), - event: z.lazy(() => SortOrderSchema).optional(), + message: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + event: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), user_game_id: z.lazy(() => SortOrderSchema).optional(), user_game: z.lazy(() => User_GameOrderByWithRelationInputSchema).optional() }).strict(); @@ -1115,8 +1117,8 @@ export const ChatWhereUniqueInputSchema: z.ZodType export const ChatOrderByWithAggregationInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), - message: z.lazy(() => SortOrderSchema).optional(), - event: z.lazy(() => SortOrderSchema).optional(), + message: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), + event: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(), user_game_id: z.lazy(() => SortOrderSchema).optional(), _count: z.lazy(() => ChatCountOrderByAggregateInputSchema).optional(), _max: z.lazy(() => ChatMaxOrderByAggregateInputSchema).optional(), @@ -1931,8 +1933,13 @@ export const IntNullableFilterSchema: z.ZodType = z.ob }).strict(); export const UserRelationFilterSchema: z.ZodType = z.object({ - is: z.lazy(() => UserWhereInputSchema).optional(), - isNot: z.lazy(() => UserWhereInputSchema).optional() + is: z.lazy(() => UserWhereInputSchema).optional().nullable(), + isNot: z.lazy(() => UserWhereInputSchema).optional().nullable() +}).strict(); + +export const SortOrderInputSchema: z.ZodType = z.object({ + sort: z.lazy(() => SortOrderSchema), + nulls: z.lazy(() => NullsOrderSchema).optional() }).strict(); export const AccountProviderProviderAccountIdCompoundUniqueInputSchema: z.ZodType = z.object({ @@ -2279,8 +2286,8 @@ export const BoolWithAggregatesFilterSchema: z.ZodType = z.object({ - is: z.lazy(() => GameWhereInputSchema).optional(), - isNot: z.lazy(() => GameWhereInputSchema).optional() + is: z.lazy(() => GameWhereInputSchema).optional().nullable(), + isNot: z.lazy(() => GameWhereInputSchema).optional().nullable() }).strict(); export const GamepinCountOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -2323,8 +2330,8 @@ export const EnumOrientationFilterSchema: z.ZodType = z.object({ - is: z.lazy(() => User_GameWhereInputSchema).optional(), - isNot: z.lazy(() => User_GameWhereInputSchema).optional() + is: z.lazy(() => User_GameWhereInputSchema).optional().nullable(), + isNot: z.lazy(() => User_GameWhereInputSchema).optional().nullable() }).strict(); export const ShipCountOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -4696,7 +4703,7 @@ export const AccountFindFirstArgsSchema: z.ZodType cursor: AccountWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: AccountScalarFieldEnumSchema.array().optional(), + distinct: z.union([ AccountScalarFieldEnumSchema,AccountScalarFieldEnumSchema.array() ]).optional(), }).strict() export const AccountFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -4707,7 +4714,7 @@ export const AccountFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -4718,7 +4725,7 @@ export const AccountFindManyArgsSchema: z.ZodType = cursor: AccountWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: AccountScalarFieldEnumSchema.array().optional(), + distinct: z.union([ AccountScalarFieldEnumSchema,AccountScalarFieldEnumSchema.array() ]).optional(), }).strict() export const AccountAggregateArgsSchema: z.ZodType = z.object({ @@ -4758,7 +4765,7 @@ export const SessionFindFirstArgsSchema: z.ZodType cursor: SessionWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: SessionScalarFieldEnumSchema.array().optional(), + distinct: z.union([ SessionScalarFieldEnumSchema,SessionScalarFieldEnumSchema.array() ]).optional(), }).strict() export const SessionFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -4769,7 +4776,7 @@ export const SessionFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -4780,7 +4787,7 @@ export const SessionFindManyArgsSchema: z.ZodType = cursor: SessionWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: SessionScalarFieldEnumSchema.array().optional(), + distinct: z.union([ SessionScalarFieldEnumSchema,SessionScalarFieldEnumSchema.array() ]).optional(), }).strict() export const SessionAggregateArgsSchema: z.ZodType = z.object({ @@ -4820,7 +4827,7 @@ export const UserFindFirstArgsSchema: z.ZodType = z.ob cursor: UserWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: UserScalarFieldEnumSchema.array().optional(), + distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(), }).strict() export const UserFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -4831,7 +4838,7 @@ export const UserFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -4842,7 +4849,7 @@ export const UserFindManyArgsSchema: z.ZodType = z.obje cursor: UserWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: UserScalarFieldEnumSchema.array().optional(), + distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(), }).strict() export const UserAggregateArgsSchema: z.ZodType = z.object({ @@ -4881,7 +4888,7 @@ export const VerificationTokenFindFirstArgsSchema: z.ZodType = z.object({ @@ -4891,7 +4898,7 @@ export const VerificationTokenFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -4901,7 +4908,7 @@ export const VerificationTokenFindManyArgsSchema: z.ZodType = z.object({ @@ -4939,7 +4946,7 @@ export const GameFindFirstArgsSchema: z.ZodType = z.ob cursor: GameWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: GameScalarFieldEnumSchema.array().optional(), + distinct: z.union([ GameScalarFieldEnumSchema,GameScalarFieldEnumSchema.array() ]).optional(), }).strict() export const GameFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -4950,7 +4957,7 @@ export const GameFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -4961,7 +4968,7 @@ export const GameFindManyArgsSchema: z.ZodType = z.obje cursor: GameWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: GameScalarFieldEnumSchema.array().optional(), + distinct: z.union([ GameScalarFieldEnumSchema,GameScalarFieldEnumSchema.array() ]).optional(), }).strict() export const GameAggregateArgsSchema: z.ZodType = z.object({ @@ -5001,7 +5008,7 @@ export const GamepinFindFirstArgsSchema: z.ZodType cursor: GamepinWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: GamepinScalarFieldEnumSchema.array().optional(), + distinct: z.union([ GamepinScalarFieldEnumSchema,GamepinScalarFieldEnumSchema.array() ]).optional(), }).strict() export const GamepinFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5012,7 +5019,7 @@ export const GamepinFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5023,7 +5030,7 @@ export const GamepinFindManyArgsSchema: z.ZodType = cursor: GamepinWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: GamepinScalarFieldEnumSchema.array().optional(), + distinct: z.union([ GamepinScalarFieldEnumSchema,GamepinScalarFieldEnumSchema.array() ]).optional(), }).strict() export const GamepinAggregateArgsSchema: z.ZodType = z.object({ @@ -5063,7 +5070,7 @@ export const ShipFindFirstArgsSchema: z.ZodType = z.ob cursor: ShipWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: ShipScalarFieldEnumSchema.array().optional(), + distinct: z.union([ ShipScalarFieldEnumSchema,ShipScalarFieldEnumSchema.array() ]).optional(), }).strict() export const ShipFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5074,7 +5081,7 @@ export const ShipFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5085,7 +5092,7 @@ export const ShipFindManyArgsSchema: z.ZodType = z.obje cursor: ShipWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: ShipScalarFieldEnumSchema.array().optional(), + distinct: z.union([ ShipScalarFieldEnumSchema,ShipScalarFieldEnumSchema.array() ]).optional(), }).strict() export const ShipAggregateArgsSchema: z.ZodType = z.object({ @@ -5125,7 +5132,7 @@ export const HitFindFirstArgsSchema: z.ZodType = z.obje cursor: HitWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: HitScalarFieldEnumSchema.array().optional(), + distinct: z.union([ HitScalarFieldEnumSchema,HitScalarFieldEnumSchema.array() ]).optional(), }).strict() export const HitFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5136,7 +5143,7 @@ export const HitFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5147,7 +5154,7 @@ export const HitFindManyArgsSchema: z.ZodType = z.object cursor: HitWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: HitScalarFieldEnumSchema.array().optional(), + distinct: z.union([ HitScalarFieldEnumSchema,HitScalarFieldEnumSchema.array() ]).optional(), }).strict() export const HitAggregateArgsSchema: z.ZodType = z.object({ @@ -5187,7 +5194,7 @@ export const User_GameFindFirstArgsSchema: z.ZodType = z.object({ @@ -5198,7 +5205,7 @@ export const User_GameFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5209,7 +5216,7 @@ export const User_GameFindManyArgsSchema: z.ZodType = z.object({ @@ -5249,7 +5256,7 @@ export const MoveFindFirstArgsSchema: z.ZodType = z.ob cursor: MoveWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: MoveScalarFieldEnumSchema.array().optional(), + distinct: z.union([ MoveScalarFieldEnumSchema,MoveScalarFieldEnumSchema.array() ]).optional(), }).strict() export const MoveFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5260,7 +5267,7 @@ export const MoveFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5271,7 +5278,7 @@ export const MoveFindManyArgsSchema: z.ZodType = z.obje cursor: MoveWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: MoveScalarFieldEnumSchema.array().optional(), + distinct: z.union([ MoveScalarFieldEnumSchema,MoveScalarFieldEnumSchema.array() ]).optional(), }).strict() export const MoveAggregateArgsSchema: z.ZodType = z.object({ @@ -5311,7 +5318,7 @@ export const ChatFindFirstArgsSchema: z.ZodType = z.ob cursor: ChatWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: ChatScalarFieldEnumSchema.array().optional(), + distinct: z.union([ ChatScalarFieldEnumSchema,ChatScalarFieldEnumSchema.array() ]).optional(), }).strict() export const ChatFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5322,7 +5329,7 @@ export const ChatFindFirstOrThrowArgsSchema: z.ZodType = z.object({ @@ -5333,7 +5340,7 @@ export const ChatFindManyArgsSchema: z.ZodType = z.obje cursor: ChatWhereUniqueInputSchema.optional(), take: z.number().optional(), skip: z.number().optional(), - distinct: ChatScalarFieldEnumSchema.array().optional(), + distinct: z.union([ ChatScalarFieldEnumSchema,ChatScalarFieldEnumSchema.array() ]).optional(), }).strict() export const ChatAggregateArgsSchema: z.ZodType = z.object({ diff --git a/leaky-ships/public/index.html b/leaky-ships/public/index.html index 962e547..ff4e1b5 100644 --- a/leaky-ships/public/index.html +++ b/leaky-ships/public/index.html @@ -1,4 +1,4 @@ - + diff --git a/leaky-ships/types/next-auth.d.ts b/leaky-ships/types/next-auth.d.ts index 1949d47..7576620 100644 --- a/leaky-ships/types/next-auth.d.ts +++ b/leaky-ships/types/next-auth.d.ts @@ -1,4 +1,4 @@ -import NextAuth, { DefaultSession } from "next-auth" +import { DefaultSession } from "next-auth" declare module "next-auth" { /**