From 563d054ea5e878e0995208186a7eec16ac9a459f Mon Sep 17 00:00:00 2001 From: VariableVince <24507472+VariableVince@users.noreply.github.com> Date: Wed, 23 Jul 2025 20:28:38 +0200 Subject: [PATCH] Zod v4 update (#1546) ## Description: This contains the update from zod 3.25 to 4. Change imports back from zod/v4 to just zod. No errors in VSCode. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I have read and accepted the CLA aggreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: tryout33 --- package-lock.json | 8 ++++---- package.json | 2 +- src/client/LocalServer.ts | 2 +- src/client/Transport.ts | 2 +- src/client/jwt.ts | 2 +- src/core/ApiSchemas.ts | 2 +- src/core/CosmeticSchemas.ts | 2 +- src/core/Schemas.ts | 2 +- src/core/StatsSchemas.ts | 2 +- src/core/WorkerSchemas.ts | 2 +- src/core/configuration/DefaultConfig.ts | 2 +- src/server/GameServer.ts | 2 +- src/server/Worker.ts | 2 +- src/server/jwt.ts | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 50debaf57..6dffefa6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -65,7 +65,7 @@ "winston": "^3.17.0", "winston-transport": "^4.9.0", "ws": "^8.18.0", - "zod": "^3.25.28" + "zod": "^4.0.5" }, "devDependencies": { "@babel/core": "^7.25.2", @@ -24214,9 +24214,9 @@ } }, "node_modules/zod": { - "version": "3.25.67", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.67.tgz", - "integrity": "sha512-idA2YXwpCdqUSKRCACDE6ItZD9TZzy3OZMtpfLoh6oPR47lipysRrJfjzMqFxQ3uJuUPyUeWe1r9vLH33xO/Qw==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.0.5.tgz", + "integrity": "sha512-/5UuuRPStvHXu7RS+gmvRf4NXrNxpSllGwDnCBcJZtQsKrviYXm54yDGV2KYNLT5kq0lHGcl7lqWJLgSaG+tgA==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index 49664d08a..d75e70ef3 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "winston": "^3.17.0", "winston-transport": "^4.9.0", "ws": "^8.18.0", - "zod": "^3.25.28" + "zod": "^4.0.5" }, "type": "module" } diff --git a/src/client/LocalServer.ts b/src/client/LocalServer.ts index 6d4cd8805..113e08ce1 100644 --- a/src/client/LocalServer.ts +++ b/src/client/LocalServer.ts @@ -1,4 +1,4 @@ -import { z } from "zod/v4"; +import { z } from "zod"; import { EventBus } from "../core/EventBus"; import { AllPlayersStats, diff --git a/src/client/Transport.ts b/src/client/Transport.ts index 71cece02b..6abfeb1ce 100644 --- a/src/client/Transport.ts +++ b/src/client/Transport.ts @@ -1,4 +1,4 @@ -import { z } from "zod/v4"; +import { z } from "zod"; import { EventBus, GameEvent } from "../core/EventBus"; import { AllPlayers, diff --git a/src/client/jwt.ts b/src/client/jwt.ts index 87d64c8f9..c6f6ba381 100644 --- a/src/client/jwt.ts +++ b/src/client/jwt.ts @@ -1,5 +1,5 @@ import { decodeJwt } from "jose"; -import { z } from "zod/v4"; +import { z } from "zod"; import { RefreshResponseSchema, TokenPayload, diff --git a/src/core/ApiSchemas.ts b/src/core/ApiSchemas.ts index 1f5bcd2bd..53dbcf597 100644 --- a/src/core/ApiSchemas.ts +++ b/src/core/ApiSchemas.ts @@ -1,4 +1,4 @@ -import { z } from "zod/v4"; +import { z } from "zod"; import { base64urlToUuid } from "./Base64"; export const RefreshResponseSchema = z.object({ diff --git a/src/core/CosmeticSchemas.ts b/src/core/CosmeticSchemas.ts index 1586b208e..144800d57 100644 --- a/src/core/CosmeticSchemas.ts +++ b/src/core/CosmeticSchemas.ts @@ -1,4 +1,4 @@ -import { z } from "zod/v4"; +import { z } from "zod"; import cosmetics_json from "../../resources/cosmetics/cosmetics.json" with { type: "json" }; import { RequiredPatternSchema } from "./Schemas"; diff --git a/src/core/Schemas.ts b/src/core/Schemas.ts index 9c359b41e..a65b084a4 100644 --- a/src/core/Schemas.ts +++ b/src/core/Schemas.ts @@ -1,5 +1,5 @@ import { base64url } from "jose"; -import { z } from "zod/v4"; +import { z } from "zod"; import quickChatData from "../../resources/QuickChat.json" with { type: "json" }; import countries from "../client/data/countries.json" with { type: "json" }; import { diff --git a/src/core/StatsSchemas.ts b/src/core/StatsSchemas.ts index 0974c6237..5d7ed550a 100644 --- a/src/core/StatsSchemas.ts +++ b/src/core/StatsSchemas.ts @@ -1,4 +1,4 @@ -import { z } from "zod/v4"; +import { z } from "zod"; import { UnitType } from "./game/Game"; export const BombUnitSchema = z.union([ diff --git a/src/core/WorkerSchemas.ts b/src/core/WorkerSchemas.ts index aa53eaa9d..0a06b1571 100644 --- a/src/core/WorkerSchemas.ts +++ b/src/core/WorkerSchemas.ts @@ -1,4 +1,4 @@ -import { z } from "zod/v4"; +import { z } from "zod"; import { GameConfigSchema } from "./Schemas"; export const CreateGameInputSchema = GameConfigSchema.or( diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index a801df267..6380aae02 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -1,5 +1,5 @@ import { JWK } from "jose"; -import { z } from "zod/v4"; +import { z } from "zod"; import { Difficulty, Duos, diff --git a/src/server/GameServer.ts b/src/server/GameServer.ts index 1f4956b19..17e6f2af7 100644 --- a/src/server/GameServer.ts +++ b/src/server/GameServer.ts @@ -1,7 +1,7 @@ import ipAnonymize from "ip-anonymize"; import { Logger } from "winston"; import WebSocket from "ws"; -import { z } from "zod/v4"; +import { z } from "zod"; import { ClientID, ClientMessageSchema, diff --git a/src/server/Worker.ts b/src/server/Worker.ts index b15e5262b..628c00295 100644 --- a/src/server/Worker.ts +++ b/src/server/Worker.ts @@ -6,7 +6,7 @@ import { base64url } from "jose"; import path from "path"; import { fileURLToPath } from "url"; import { WebSocket, WebSocketServer } from "ws"; -import { z } from "zod/v4"; +import { z } from "zod"; import { GameEnv } from "../core/configuration/Config"; import { getServerConfigFromServer } from "../core/configuration/ConfigLoader"; import { COSMETICS } from "../core/CosmeticSchemas"; diff --git a/src/server/jwt.ts b/src/server/jwt.ts index 21d2c8486..d8a74384f 100644 --- a/src/server/jwt.ts +++ b/src/server/jwt.ts @@ -1,5 +1,5 @@ import { jwtVerify } from "jose"; -import { z } from "zod/v4"; +import { z } from "zod"; import { TokenPayload, TokenPayloadSchema,