Files
calendar/packages/features/apps/repository/PrismaAppRepository.ts
T
Anik Dhabal BabuGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ad137fbf9c chore: disable apps with missing required keys (#27012)
* 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>
2026-01-19 19:32:30 +00:00

38 lines
1.1 KiB
TypeScript

import { captureException } from "@sentry/nextjs";
import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData";
import { shouldEnableApp } from "@calcom/app-store/_utils/validateAppKeys";
import { prisma } from "@calcom/prisma";
import type { Prisma } from "@calcom/prisma/client";
export class PrismaAppRepository {
static async seedApp(dirName: string, keys?: Prisma.InputJsonValue) {
const appMetadata = appStoreMetadata[dirName as keyof typeof appStoreMetadata];
if (!appMetadata) {
throw new Error(`App ${dirName} not found`);
}
// Only enable if keys are valid (or app doesn't require keys)
const enabled = shouldEnableApp(dirName, keys as Prisma.JsonValue);
await prisma.app.create({
data: {
slug: appMetadata.slug,
categories: appMetadata.categories,
dirName: dirName,
keys,
enabled,
},
});
}
static async findAppStore() {
try {
return await prisma.app.findMany({ select: { slug: true } });
} catch (error) {
captureException(error);
throw error;
}
}
}