feat: add webhook versioning (#23861)

* add webhook version schema

* version the code

* update version from numeric to date val

* migration

* update schema and build factory

* update string

* move version picker

* tooltip instead of infobadge

* --

* fix type

* --

* fix type

* fix type

* --

* fix messed up merge

* improvements to payloadfactory

* extract version off of DB and instead keep it in IWebhookRepository

* fix webhookform

* fix type safety and routing ambiguity

* scalable with easier factory extensions and base definition

* fix types

* --

* --

* clean up prisma/client type imports

* fix

* type fix

* type fix

* cleanup

* add tests and registry changes

* unintended file inclusion

* type-fix

* select in repo

* --

* explicit return type

* --

* fix type

* fixes

* feedback 1

* feedback 2

* use enum instead of string

* fixes
This commit is contained in:
Syed Ali Shahbaz authored and GitHub committed 2025-12-18 09:36:22 +02:00
1 parent 42bd4b4057
commit 056922b6ee
71 files changed
+3319 -1002

No files matched your search

@@ -6,6 +6,7 @@ import { useRouter } from "next/navigation";
import Shell from "@calcom/features/shell/Shell";
import { WebhookForm } from "@calcom/features/webhooks/components";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { DEFAULT_WEBHOOK_VERSION } from "@calcom/features/webhooks/lib/interface/IWebhookRepository";
import { WebhookTriggerEvents } from "@calcom/prisma/enums";
import { showToast } from "@calcom/ui/components/toast";
@@ -82,6 +83,7 @@ export default function EditOAuthClientWebhooks() {
subscriberUrl: data.subscriberUrl,
triggers: data.eventTriggers,
secret: data.secret ?? undefined,
version: data.version,
};
if (webhook) {
await updateWebhook({
@@ -95,7 +97,7 @@ export default function EditOAuthClientWebhooks() {
}
await refetchWebhooks();
router.push("/settings/platform/");
} catch (err) {
} catch {
showToast(t(webhookId ? "webhook_update_failed" : "webhook_create_failed"), "error");
}
}}
@@ -105,7 +107,12 @@ export default function EditOAuthClientWebhooks() {
noRoutingFormTriggers={true}
webhook={
webhook
? { ...webhook, eventTriggers: webhook.triggers, secret: webhook.secret ?? null }
? {
...webhook,
eventTriggers: webhook.triggers,
secret: webhook.secret ?? null,
version: webhook.version ?? DEFAULT_WEBHOOK_VERSION,
}
: undefined
}
/>