From 688dc25990612c5f8d3410d0df112e822142254b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20H=C3=B6benreich?= <64426524+jonas-hoebenreich@users.noreply.github.com> Date: Thu, 12 Sep 2024 12:26:33 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20cuid=20validation=20=F0=9F=9A=A8=20(#313?= =?UTF-8?q?0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/types/displays.ts | 20 ++++++++++---------- packages/types/js.ts | 22 +++++++++++----------- packages/types/storage.ts | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/types/displays.ts b/packages/types/displays.ts index 9c37c80fdc1..9943e99ff54 100644 --- a/packages/types/displays.ts +++ b/packages/types/displays.ts @@ -1,30 +1,30 @@ import { z } from "zod"; export const ZDisplay = z.object({ - id: z.string().cuid(), + id: z.string().cuid2(), createdAt: z.date(), updatedAt: z.date(), - personId: z.string().cuid().nullable(), - surveyId: z.string().cuid(), - responseId: z.string().cuid().nullable(), + personId: z.string().cuid2().nullable(), + surveyId: z.string().cuid2(), + responseId: z.string().cuid2().nullable(), status: z.enum(["seen", "responded"]).nullable(), }); export type TDisplay = z.infer; export const ZDisplayCreateInput = z.object({ - environmentId: z.string().cuid(), - surveyId: z.string().cuid(), + environmentId: z.string().cuid2(), + surveyId: z.string().cuid2(), userId: z.string().optional(), - responseId: z.string().cuid().optional(), + responseId: z.string().cuid2().optional(), }); export type TDisplayCreateInput = z.infer; export const ZDisplayUpdateInput = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), userId: z.string().optional(), - responseId: z.string().cuid().optional(), + responseId: z.string().cuid2().optional(), }); export type TDisplayUpdateInput = z.infer; @@ -42,7 +42,7 @@ export const ZDisplayFilters = z.object({ max: z.date().optional(), }) .optional(), - responseIds: z.array(z.string().cuid()).optional(), + responseIds: z.array(z.string().cuid2()).optional(), }); export type TDisplayFilters = z.infer; diff --git a/packages/types/js.ts b/packages/types/js.ts index d9dc9022ff9..4b532bc27bd 100644 --- a/packages/types/js.ts +++ b/packages/types/js.ts @@ -24,7 +24,7 @@ export type TSurveyWithTriggers = z.infer; export const ZJSWebsiteStateDisplay = z.object({ createdAt: z.date(), - surveyId: z.string().cuid(), + surveyId: z.string().cuid2(), responded: z.boolean(), }); @@ -65,14 +65,14 @@ export const ZJsWebsiteState = z.object({ export type TJsWebsiteState = z.infer; export const ZJsWebsiteSyncInput = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), version: z.string().optional(), }); export type TJsWebsiteSyncInput = z.infer; export const ZJsWebsiteConfig = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), apiHost: z.string(), state: ZJsWebsiteState, expiresAt: z.date(), @@ -82,7 +82,7 @@ export const ZJsWebsiteConfig = z.object({ export type TJsWebsiteConfig = z.infer; export const ZJSAppConfig = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), apiHost: z.string(), userId: z.string(), state: ZJsAppState, @@ -93,7 +93,7 @@ export const ZJSAppConfig = z.object({ export type TJSAppConfig = z.infer; export const ZJsWebsiteConfigUpdateInput = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), apiHost: z.string(), state: ZJsWebsiteState, expiresAt: z.date(), @@ -103,7 +103,7 @@ export const ZJsWebsiteConfigUpdateInput = z.object({ export type TJsWebsiteConfigUpdateInput = z.infer; export const ZJsAppConfigUpdateInput = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), apiHost: z.string(), userId: z.string(), state: ZJsAppState, @@ -114,7 +114,7 @@ export const ZJsAppConfigUpdateInput = z.object({ export type TJsAppConfigUpdateInput = z.infer; export const ZJsWebsiteConfigInput = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), apiHost: z.string(), errorHandler: z.function().args(z.any()).returns(z.void()).optional(), attributes: z.record(z.string()).optional(), @@ -123,7 +123,7 @@ export const ZJsWebsiteConfigInput = z.object({ export type TJsWebsiteConfigInput = z.infer; export const ZJsAppConfigInput = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), apiHost: z.string(), errorHandler: z.function().args(z.any()).returns(z.void()).optional(), userId: z.string(), @@ -133,7 +133,7 @@ export const ZJsAppConfigInput = z.object({ export type TJsAppConfigInput = z.infer; export const ZJsPeopleUserIdInput = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), userId: z.string().min(1).max(255), version: z.string().optional(), }); @@ -154,7 +154,7 @@ export const ZJsPeopleAttributeInput = z.object({ export type TJsPeopleAttributeInput = z.infer; export const ZJsActionInput = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), userId: z.string().optional(), name: z.string(), }); @@ -166,7 +166,7 @@ export const ZJsWesbiteActionInput = ZJsActionInput.omit({ userId: true }); export type TJsWesbiteActionInput = z.infer; export const ZJsAppSyncParams = z.object({ - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), apiHost: z.string(), userId: z.string(), attributes: ZAttributes.optional(), diff --git a/packages/types/storage.ts b/packages/types/storage.ts index 554df0661c5..974fef89f65 100644 --- a/packages/types/storage.ts +++ b/packages/types/storage.ts @@ -5,7 +5,7 @@ export type TAccessType = z.infer; export const ZStorageRetrievalParams = z.object({ fileName: z.string(), - environmentId: z.string().cuid(), + environmentId: z.string().cuid2(), accessType: ZAccessType, });