From 5f475242a9036e9e246350684c09bb62c23ca689 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 22 Jul 2025 00:00:24 +0000 Subject: [PATCH 1/2] chore(deps): update dependency zod to v4 --- pnpm-lock.yaml | 173 ++++------------------------------------------- src/package.json | 2 +- 2 files changed, 14 insertions(+), 161 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3ae287d9a7..7e4a9c1eea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -242,7 +242,7 @@ importers: version: 1.4.3(@urql/core@5.2.0(graphql@16.11.0))(vue@3.5.17(typescript@5.8.3)) '@vee-validate/zod': specifier: 4.15.1 - version: 4.15.1(vue@3.5.17(typescript@5.8.3))(zod@3.25.76) + version: 4.15.1(vue@3.5.17(typescript@5.8.3))(zod@4.0.5) '@vite-pwa/nuxt': specifier: 1.0.4 version: 1.0.4(magicast@0.3.5)(rolldown-vite@7.0.9(@types/node@24.0.15)(esbuild@0.25.8)(jiti@2.4.2)(terser@5.43.1)(yaml@2.8.0))(workbox-build@7.3.0)(workbox-window@7.3.0) @@ -368,7 +368,7 @@ importers: version: 1.12.0(magicast@0.3.5)(typescript@5.8.3) openai: specifier: 5.10.1 - version: 5.10.1(ws@8.18.3)(zod@3.25.76) + version: 5.10.1(ws@8.18.3)(zod@4.0.5) pinia: specifier: 3.0.3 version: 3.0.3(typescript@5.8.3)(vue@3.5.17(typescript@5.8.3)) @@ -502,8 +502,8 @@ importers: specifier: 7.3.0 version: 7.3.0 zod: - specifier: 3.25.76 - version: 3.25.76 + specifier: 4.0.5 + version: 4.0.5 tests: dependencies: @@ -5010,14 +5010,6 @@ packages: '@types/yauzl@2.10.3': resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} - '@typescript-eslint/eslint-plugin@8.37.0': - resolution: {integrity: sha512-jsuVWeIkb6ggzB+wPCsR4e6loj+rM72ohW6IBn2C+5NCvfUVY8s33iFPySSVXqtm5Hu29Ne/9bnA0JmyLmgenA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - '@typescript-eslint/parser': ^8.37.0 - eslint: ^8.57.0 || ^9.0.0 - typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/eslint-plugin@8.38.0': resolution: {integrity: sha512-CPoznzpuAnIOl4nhj4tRr4gIPj5AfKgkiJmGQDaq+fQnRJTYlcBjbX3wbciGmpoPf8DREufuPRe1tNMZnGdanA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -5026,13 +5018,6 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/parser@8.37.0': - resolution: {integrity: sha512-kVIaQE9vrN9RLCQMQ3iyRlVJpTiDUY6woHGb30JDkfJErqrQEmtdWH3gV0PBAfGZgQXoqzXOO0T3K6ioApbbAA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/parser@8.38.0': resolution: {integrity: sha512-Zhy8HCvBUEfBECzIl1PKqF4p11+d0aUJS1GeUiuqK9WmOug8YCmC4h4bjyBvMyAMI9sbRczmrYL5lKg/YMbrcQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -5040,45 +5025,22 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/project-service@8.37.0': - resolution: {integrity: sha512-BIUXYsbkl5A1aJDdYJCBAo8rCEbAvdquQ8AnLb6z5Lp1u3x5PNgSSx9A/zqYc++Xnr/0DVpls8iQ2cJs/izTXA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/project-service@8.38.0': resolution: {integrity: sha512-dbK7Jvqcb8c9QfH01YB6pORpqX1mn5gDZc9n63Ak/+jD67oWXn3Gs0M6vddAN+eDXBCS5EmNWzbSxsn9SzFWWg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/scope-manager@8.37.0': - resolution: {integrity: sha512-0vGq0yiU1gbjKob2q691ybTg9JX6ShiVXAAfm2jGf3q0hdP6/BruaFjL/ManAR/lj05AvYCH+5bbVo0VtzmjOA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/scope-manager@8.38.0': resolution: {integrity: sha512-WJw3AVlFFcdT9Ri1xs/lg8LwDqgekWXWhH3iAF+1ZM+QPd7oxQ6jvtW/JPwzAScxitILUIFs0/AnQ/UWHzbATQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/tsconfig-utils@8.37.0': - resolution: {integrity: sha512-1/YHvAVTimMM9mmlPvTec9NP4bobA1RkDbMydxG8omqwJJLEW/Iy2C4adsAESIXU3WGLXFHSZUU+C9EoFWl4Zg==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/tsconfig-utils@8.38.0': resolution: {integrity: sha512-Lum9RtSE3EroKk/bYns+sPOodqb2Fv50XOl/gMviMKNvanETUuUcC9ObRbzrJ4VSd2JalPqgSAavwrPiPvnAiQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/type-utils@8.37.0': - resolution: {integrity: sha512-SPkXWIkVZxhgwSwVq9rqj/4VFo7MnWwVaRNznfQDc/xPYHjXnPfLWn+4L6FF1cAz6e7dsqBeMawgl7QjUMj4Ow==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/type-utils@8.38.0': resolution: {integrity: sha512-c7jAvGEZVf0ao2z+nnz8BUaHZD09Agbh+DY7qvBQqLiz8uJzRgVPj5YvOh8I8uEiH8oIUGIfHzMwUcGVco/SJg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -5086,33 +5048,16 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/types@8.37.0': - resolution: {integrity: sha512-ax0nv7PUF9NOVPs+lmQ7yIE7IQmAf8LGcXbMvHX5Gm+YJUYNAl340XkGnrimxZ0elXyoQJuN5sbg6C4evKA4SQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/types@8.38.0': resolution: {integrity: sha512-wzkUfX3plUqij4YwWaJyqhiPE5UCRVlFpKn1oCRn2O1bJ592XxWJj8ROQ3JD5MYXLORW84063z3tZTb/cs4Tyw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.37.0': - resolution: {integrity: sha512-zuWDMDuzMRbQOM+bHyU4/slw27bAUEcKSKKs3hcv2aNnc/tvE/h7w60dwVw8vnal2Pub6RT1T7BI8tFZ1fE+yg==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/typescript-estree@8.38.0': resolution: {integrity: sha512-fooELKcAKzxux6fA6pxOflpNS0jc+nOQEEOipXFNjSlBS6fqrJOVY/whSn70SScHrcJ2LDsxWrneFoWYSVfqhQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/utils@8.37.0': - resolution: {integrity: sha512-TSFvkIW6gGjN2p6zbXo20FzCABbyUAuq6tBvNRGsKdsSQ6a7rnV6ADfZ7f4iI3lIiXc4F4WWvtUfDw9CJ9pO5A==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/utils@8.38.0': resolution: {integrity: sha512-hHcMA86Hgt+ijJlrD8fX0j1j8w4C92zue/8LOPAFioIno+W0+L7KqE8QZKCcPGc/92Vs9x36w/4MPTJhqXdyvg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -5120,10 +5065,6 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/visitor-keys@8.37.0': - resolution: {integrity: sha512-YzfhzcTnZVPiLfP/oeKtDp2evwvHLMe0LOy7oe+hb9KKIumLNohYS9Hgp1ifwpu42YWxhZE8yieggz6JpqO/1w==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/visitor-keys@8.38.0': resolution: {integrity: sha512-pWrTcoFNWuwHlA9CvlfSsGWs14JxfN1TH25zM5L7o0pRLhsoZkDnTsXfQRJBEWJoV5DL0jf+Z+sxiud+K0mq1g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -12774,6 +12715,9 @@ packages: zod@3.25.76: resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==} + zod@4.0.5: + resolution: {integrity: sha512-/5UuuRPStvHXu7RS+gmvRf4NXrNxpSllGwDnCBcJZtQsKrviYXm54yDGV2KYNLT5kq0lHGcl7lqWJLgSaG+tgA==} + zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} @@ -18883,23 +18827,6 @@ snapshots: '@types/node': 24.0.15 optional: true - '@typescript-eslint/eslint-plugin@8.37.0(@typescript-eslint/parser@8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)': - dependencies: - '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3) - '@typescript-eslint/scope-manager': 8.37.0 - '@typescript-eslint/type-utils': 8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3) - '@typescript-eslint/utils': 8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3) - '@typescript-eslint/visitor-keys': 8.37.0 - eslint: 9.31.0(jiti@2.4.2) - graphemer: 1.4.0 - ignore: 7.0.5 - natural-compare: 1.4.0 - ts-api-utils: 2.1.0(typescript@5.8.3) - typescript: 5.8.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/eslint-plugin@8.38.0(@typescript-eslint/parser@8.38.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)': dependencies: '@eslint-community/regexpp': 4.12.1 @@ -18917,18 +18844,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)': - dependencies: - '@typescript-eslint/scope-manager': 8.37.0 - '@typescript-eslint/types': 8.37.0 - '@typescript-eslint/typescript-estree': 8.37.0(typescript@5.8.3) - '@typescript-eslint/visitor-keys': 8.37.0 - debug: 4.4.1 - eslint: 9.31.0(jiti@2.4.2) - typescript: 5.8.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/parser@8.38.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)': dependencies: '@typescript-eslint/scope-manager': 8.38.0 @@ -18941,15 +18856,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/project-service@8.37.0(typescript@5.8.3)': - dependencies: - '@typescript-eslint/tsconfig-utils': 8.37.0(typescript@5.8.3) - '@typescript-eslint/types': 8.37.0 - debug: 4.4.1 - typescript: 5.8.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/project-service@8.38.0(typescript@5.8.3)': dependencies: '@typescript-eslint/tsconfig-utils': 8.38.0(typescript@5.8.3) @@ -18959,36 +18865,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.37.0': - dependencies: - '@typescript-eslint/types': 8.37.0 - '@typescript-eslint/visitor-keys': 8.37.0 - '@typescript-eslint/scope-manager@8.38.0': dependencies: '@typescript-eslint/types': 8.38.0 '@typescript-eslint/visitor-keys': 8.38.0 - '@typescript-eslint/tsconfig-utils@8.37.0(typescript@5.8.3)': - dependencies: - typescript: 5.8.3 - '@typescript-eslint/tsconfig-utils@8.38.0(typescript@5.8.3)': dependencies: typescript: 5.8.3 - '@typescript-eslint/type-utils@8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)': - dependencies: - '@typescript-eslint/types': 8.37.0 - '@typescript-eslint/typescript-estree': 8.37.0(typescript@5.8.3) - '@typescript-eslint/utils': 8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3) - debug: 4.4.1 - eslint: 9.31.0(jiti@2.4.2) - ts-api-utils: 2.1.0(typescript@5.8.3) - typescript: 5.8.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/type-utils@8.38.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)': dependencies: '@typescript-eslint/types': 8.38.0 @@ -19001,26 +18886,8 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/types@8.37.0': {} - '@typescript-eslint/types@8.38.0': {} - '@typescript-eslint/typescript-estree@8.37.0(typescript@5.8.3)': - dependencies: - '@typescript-eslint/project-service': 8.37.0(typescript@5.8.3) - '@typescript-eslint/tsconfig-utils': 8.37.0(typescript@5.8.3) - '@typescript-eslint/types': 8.37.0 - '@typescript-eslint/visitor-keys': 8.37.0 - debug: 4.4.1 - fast-glob: 3.3.3 - is-glob: 4.0.3 - minimatch: 9.0.5 - semver: 7.7.2 - ts-api-utils: 2.1.0(typescript@5.8.3) - typescript: 5.8.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/typescript-estree@8.38.0(typescript@5.8.3)': dependencies: '@typescript-eslint/project-service': 8.38.0(typescript@5.8.3) @@ -19037,17 +18904,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)': - dependencies: - '@eslint-community/eslint-utils': 4.7.0(eslint@9.31.0(jiti@2.4.2)) - '@typescript-eslint/scope-manager': 8.37.0 - '@typescript-eslint/types': 8.37.0 - '@typescript-eslint/typescript-estree': 8.37.0(typescript@5.8.3) - eslint: 9.31.0(jiti@2.4.2) - typescript: 5.8.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/utils@8.38.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)': dependencies: '@eslint-community/eslint-utils': 4.7.0(eslint@9.31.0(jiti@2.4.2)) @@ -19059,11 +18915,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/visitor-keys@8.37.0': - dependencies: - '@typescript-eslint/types': 8.37.0 - eslint-visitor-keys: 4.2.1 - '@typescript-eslint/visitor-keys@8.38.0': dependencies: '@typescript-eslint/types': 8.38.0 @@ -19184,11 +19035,11 @@ snapshots: vue: 3.5.17(typescript@5.8.3) wonka: 6.3.5 - '@vee-validate/zod@4.15.1(vue@3.5.17(typescript@5.8.3))(zod@3.25.76)': + '@vee-validate/zod@4.15.1(vue@3.5.17(typescript@5.8.3))(zod@4.0.5)': dependencies: type-fest: 4.41.0 vee-validate: 4.15.1(vue@3.5.17(typescript@5.8.3)) - zod: 3.25.76 + zod: 4.0.5 transitivePeerDependencies: - vue @@ -24798,10 +24649,10 @@ snapshots: is-docker: 2.2.1 is-wsl: 2.2.0 - openai@5.10.1(ws@8.18.3)(zod@3.25.76): + openai@5.10.1(ws@8.18.3)(zod@4.0.5): optionalDependencies: ws: 8.18.3 - zod: 3.25.76 + zod: 4.0.5 optionator@0.9.4: dependencies: @@ -28297,6 +28148,8 @@ snapshots: zod@3.25.76: {} + zod@4.0.5: {} + zwitch@2.0.4: {} zxing-wasm@1.1.3: diff --git a/src/package.json b/src/package.json index 9790c4ff0e..0b6c46d4df 100644 --- a/src/package.json +++ b/src/package.json @@ -149,7 +149,7 @@ "vue-router": "4.5.1", "vue-tsc": "3.0.3", "workbox-precaching": "7.3.0", - "zod": "3.25.76" + "zod": "4.0.5" }, "engines": { "node": "^24.0.0" From fa36ad38cb197b88dc7acdebb5698649ed484085 Mon Sep 17 00:00:00 2001 From: Jonas Thelemann Date: Tue, 15 Jul 2025 12:00:14 +0200 Subject: [PATCH 2/2] feat(event): upgrade zod to v4 --- .../components/preference/form/PreferenceFormSize.vue | 2 +- src/server/api/model/event/ical.post.ts | 10 +++++----- src/server/api/model/event/ingest/image.post.ts | 6 +++--- src/server/api/model/event/ingest/url.post.ts | 4 ++-- src/server/api/test/email.get.ts | 2 +- src/server/utils/i18n.ts | 2 +- src/server/utils/validation.ts | 8 ++++---- src/shared/utils/schema.ts | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/app/components/preference/form/PreferenceFormSize.vue b/src/app/components/preference/form/PreferenceFormSize.vue index d3b8e9a96c..5dd434b868 100644 --- a/src/app/components/preference/form/PreferenceFormSize.vue +++ b/src/app/components/preference/form/PreferenceFormSize.vue @@ -103,7 +103,7 @@ const { handleSubmit } = useForm({ initialValues: { items: initialSelectedItems }, validationSchema: toTypedSchema( z.object({ - items: z.array(z.nativeEnum(EventSize)), + items: z.array(z.enum(EventSize)), }), ), }) diff --git a/src/server/api/model/event/ical.post.ts b/src/server/api/model/event/ical.post.ts index cabf75a836..36d0af6215 100644 --- a/src/server/api/model/event/ical.post.ts +++ b/src/server/api/model/event/ical.post.ts @@ -11,22 +11,22 @@ const icalPostBodySchema = z.object({ }) .optional(), event: z.object({ - id: z.string(), + id: z.uuidv4(), description: z.string().optional().nullable(), - end: z.string().optional().nullable(), + end: z.iso.datetime({ offset: true }).optional().nullable(), location: z.string().optional().nullable(), name: z.string(), - start: z.string(), + start: z.iso.datetime({ offset: true }), accountByCreatedBy: z.object({ id: z.string(), username: z.string(), }), slug: z.string(), - visibility: z.nativeEnum(EventVisibility), + visibility: z.enum(EventVisibility), }), invitation: z .object({ - id: z.string(), + id: z.uuidv4(), }) .optional(), }) diff --git a/src/server/api/model/event/ingest/image.post.ts b/src/server/api/model/event/ingest/image.post.ts index 7a1382127e..4628d79650 100644 --- a/src/server/api/model/event/ingest/image.post.ts +++ b/src/server/api/model/event/ingest/image.post.ts @@ -7,12 +7,12 @@ const eventIngestImagePostBodySchema = z.object({ }) const eventSchema = z.object({ description: z.string(), - end: z.string().optional(), + end: z.string().optional(), // TODO: z.iso.datetime({ offset: true }) when OpenAI supports it is_event: z.boolean(), location: z.string().optional(), name: z.string().optional(), - start: z.string().optional(), - url: z.string().optional(), + start: z.string().optional(), // TODO: z.iso.datetime({ offset: true }) when OpenAI supports it + url: z.string().optional(), // TODO: z.url() when OpenAI supports it }) const prompt = `You are a data extraction specialist responsible for identifying and accurately cataloging event information. Only accept images. Only if the image is an event poster containing event information, extract that information into JSON. In all other cases, set \`is_event\` to \`false\`. diff --git a/src/server/api/model/event/ingest/url.post.ts b/src/server/api/model/event/ingest/url.post.ts index e02a61a1b1..ae5bbe635e 100644 --- a/src/server/api/model/event/ingest/url.post.ts +++ b/src/server/api/model/event/ingest/url.post.ts @@ -7,11 +7,11 @@ const eventIngestUrlPostBodySchema = z.object({ }) const eventSchema = z.object({ description: z.string(), - end: z.string().optional(), + end: z.string().optional(), // TODO: z.iso.datetime({ offset: true }) when OpenAI supports it is_event: z.boolean(), location: z.string().optional(), name: z.string().optional(), - start: z.string().optional(), + start: z.string().optional(), // TODO: z.iso.datetime({ offset: true }) when OpenAI supports it }) const prompt = `You are a data extraction specialist responsible for identifying and cataloging event information. Only accept html. Only if the html contains event information, extract that information into JSON. For dates, use ISO 8601 and the current year (${new Date().getFullYear()}) if no year is given. In all other cases, set all fields to an empty string and \`is_event\` to \`false\`.` diff --git a/src/server/api/test/email.get.ts b/src/server/api/test/email.get.ts index 6e4b8a898d..69edc01fef 100644 --- a/src/server/api/test/email.get.ts +++ b/src/server/api/test/email.get.ts @@ -7,7 +7,7 @@ import { Locale } from '~~/server/utils/i18n' import { getQuerySafe } from '~~/server/utils/validation' const emailGetQuerySchema = z.object({ - locale: z.nativeEnum(Locale).default(Locale.EN), + locale: z.enum(Locale).default(Locale.EN), name: EMAIL_NAMES.optional(), }) diff --git a/src/server/utils/i18n.ts b/src/server/utils/i18n.ts index b75bfe98ab..29aa446f76 100644 --- a/src/server/utils/i18n.ts +++ b/src/server/utils/i18n.ts @@ -6,4 +6,4 @@ export enum Locale { DE = 'de', EN = 'en', } -export const LocaleSchema = z.nativeEnum(Locale) +export const LocaleSchema = z.enum(Locale) diff --git a/src/server/utils/validation.ts b/src/server/utils/validation.ts index f705a6cdb5..7885cdb060 100644 --- a/src/server/utils/validation.ts +++ b/src/server/utils/validation.ts @@ -1,7 +1,7 @@ import type { H3Event } from 'h3' -import type { ZodSchema, infer as Infer } from 'zod' +import type { ZodType, infer as Infer } from 'zod' -export const getBodySafe = async ({ +export const getBodySafe = async ({ event, schema, }: { @@ -9,7 +9,7 @@ export const getBodySafe = async ({ schema: T }) => getSafe({ event, schema, validator: readValidatedBody }) -export const getQuerySafe = async ({ +export const getQuerySafe = async ({ event, schema, }: { @@ -17,7 +17,7 @@ export const getQuerySafe = async ({ schema: T }) => getSafe({ event, schema, validator: getValidatedQuery }) -const getSafe = async ({ +const getSafe = async ({ event, schema, validator, diff --git a/src/shared/utils/schema.ts b/src/shared/utils/schema.ts index 4f2f21829f..08833bec4a 100644 --- a/src/shared/utils/schema.ts +++ b/src/shared/utils/schema.ts @@ -2,12 +2,12 @@ import { z } from 'zod' export const schemaFormContact = z.object({ consent: z.boolean().refine((value) => value === true), - emailAddress: z.string().email().max(1000), + emailAddress: z.email().max(1000), name: z.string().max(100), message: z.string().max(10000), }) export const schemaFormEarlyBird = z.object({ agreement: z.boolean().refine((value) => value === true), - emailAddress: z.string().email().max(1000), + emailAddress: z.email().max(1000), name: z.string().max(100), })