Scheduling infrastructure for absolutely everyone.
Fix: appKeys handling (#8406)
Hariom Balhara986f9dca8dff
diff --git a/packages/app-store/appStoreMetaData.ts b/packages/app-store/appStoreMetaData.tsindex 000861575d9..2b7ba7f5be5 100644--- a/packages/app-store/appStoreMetaData.ts+++ b/packages/app-store/appStoreMetaData.ts@@ -12,6 +12,7 @@ export const appStoreMetadata = {} as AppStoreMetaData;for (const [key, value] of Object.entries(rawAppStoreMetadata)) {appStoreMetadata[key as keyof typeof appStoreMetadata] = {appData: null,+ dirName: "dirName" in value ? value.dirName : value.slug,__template: "",...value,} as AppStoreMetaData[keyof AppStoreMetaData];diff --git a/packages/app-store/apps.keys-schemas.generated.ts b/packages/app-store/apps.keys-schemas.generated.tsindex 403584009b7..ddeffd5d172 100644--- a/packages/app-store/apps.keys-schemas.generated.ts+++ b/packages/app-store/apps.keys-schemas.generated.ts@@ -24,6 +24,7 @@ import { appKeysSchema as event_type_app_card_zod_ts } from "./templates/event-timport { appKeysSchema as vital_zod_ts } from "./vital/zod";import { appKeysSchema as wordpress_zod_ts } from "./wordpress/zod";import { appKeysSchema as zapier_zod_ts } from "./zapier/zod";+import { appKeysSchema as zohocrm_zod_ts } from "./zohocrm/zod";import { appKeysSchema as zoomvideo_zod_ts } from "./zoomvideo/zod";export const appKeysSchemas = {@@ -49,5 +50,6 @@ export const appKeysSchemas = {vital: vital_zod_ts,wordpress: wordpress_zod_ts,zapier: zapier_zod_ts,+ zohocrm: zohocrm_zod_ts,zoomvideo: zoomvideo_zod_ts,};diff --git a/packages/app-store/apps.schemas.generated.ts b/packages/app-store/apps.schemas.generated.tsindex d9d55a918a3..89e0f3dfeac 100644--- a/packages/app-store/apps.schemas.generated.ts+++ b/packages/app-store/apps.schemas.generated.ts@@ -24,6 +24,7 @@ import { appDataSchema as event_type_app_card_zod_ts } from "./templates/event-timport { appDataSchema as vital_zod_ts } from "./vital/zod";import { appDataSchema as wordpress_zod_ts } from "./wordpress/zod";import { appDataSchema as zapier_zod_ts } from "./zapier/zod";+import { appDataSchema as zohocrm_zod_ts } from "./zohocrm/zod";import { appDataSchema as zoomvideo_zod_ts } from "./zoomvideo/zod";export const appDataSchemas = {@@ -49,5 +50,6 @@ export const appDataSchemas = {vital: vital_zod_ts,wordpress: wordpress_zod_ts,zapier: zapier_zod_ts,+ zohocrm: zohocrm_zod_ts,zoomvideo: zoomvideo_zod_ts,};diff --git a/packages/app-store/zohocrm/zod.ts b/packages/app-store/zohocrm/zod.tsnew file mode 100644index 00000000000..fe378bc4bc6--- /dev/null+++ b/packages/app-store/zohocrm/zod.ts@@ -0,0 +1,8 @@+import { z } from "zod";++export const appKeysSchema = z.object({+ client_id: z.string().min(1),+ client_secret: z.string().min(1),+});++export const appDataSchema = z.object({});diff --git a/packages/trpc/server/routers/viewer/apps.tsx b/packages/trpc/server/routers/viewer/apps.tsxindex cc0da323e6d..ffc6d1895c9 100644--- a/packages/trpc/server/routers/viewer/apps.tsx+++ b/packages/trpc/server/routers/viewer/apps.tsx@@ -255,9 +255,7 @@ export const appsRouter = router({})).mutation(async ({ ctx, input }) => {- let appKey = deriveAppDictKeyFromType(input.type, appKeysSchemas);- if (!appKey) appKey = deriveAppDictKeyFromType(input.slug, appKeysSchemas);- const keysSchema = appKeysSchemas[appKey as keyof typeof appKeysSchemas];+ const keysSchema = appKeysSchemas[input.dirName as keyof typeof appKeysSchemas];const keys = keysSchema.parse(input.keys);// Get app name from metadata