ad137fbf9c
* ci(companion): add separate typecheck workflow to catch type errors This adds a new companion-typecheck.yml workflow that runs TypeScript type checking for the companion app. This would have caught the missing useEffect import issue in PR #26931. Changes: - Add new companion-typecheck.yml workflow file - Update pr.yml to call the new workflow when companion files change - Add typecheck-companion to the required jobs list Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> * add lint checks * test * remove * update typecheck * address review * chore:- hide apps with missing required keys from app store * update * Delete packages/app-store/_utils/hasRequiredAppKeys.test.ts * Update validateAppKeys.ts * Update validateAppKeys.ts * Update validateAppKeys.test.ts --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { appKeysSchemas } from "@calcom/app-store/apps.keys-schemas.generated";
|
|
import type { Prisma } from "@calcom/prisma/client";
|
|
/**
|
|
* Determines if an app should be enabled based on whether it has valid keys.
|
|
* This is used by app registration scripts to prevent enabling apps without proper configuration.
|
|
*
|
|
* @param dirName - The directory name of the app
|
|
* @param keys - The keys object (can be undefined/null)
|
|
*/
|
|
export function shouldEnableApp(dirName: string, keys?: Prisma.JsonValue | null): boolean {
|
|
const keySchema = appKeysSchemas[dirName as keyof typeof appKeysSchemas];
|
|
|
|
// If no schema, the app doesn't require keys - can be enabled
|
|
if (!keySchema) {
|
|
return true;
|
|
}
|
|
|
|
// If keys is null/undefined, check if the schema accepts an empty object.
|
|
if (keys === null || keys === undefined) {
|
|
const emptyObjectResult = keySchema.safeParse({});
|
|
return emptyObjectResult.success;
|
|
}
|
|
|
|
|
|
// Validate keys against schema
|
|
const result = keySchema.safeParse(keys);
|
|
return result.success;
|
|
}
|