* 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
68 lines
2.7 KiB
TypeScript
68 lines
2.7 KiB
TypeScript
import { createModule } from "@evyweb/ioctopus";
|
|
|
|
import { createPayloadBuilderFactory } from "@calcom/features/webhooks/lib/factory/versioned/registry";
|
|
import { WebhookRepository } from "@calcom/features/webhooks/lib/repository/WebhookRepository";
|
|
import { BookingWebhookService } from "@calcom/features/webhooks/lib/service/BookingWebhookService";
|
|
import { FormWebhookService } from "@calcom/features/webhooks/lib/service/FormWebhookService";
|
|
import { OOOWebhookService } from "@calcom/features/webhooks/lib/service/OOOWebhookService";
|
|
import { RecordingWebhookService } from "@calcom/features/webhooks/lib/service/RecordingWebhookService";
|
|
import { WebhookNotificationHandler } from "@calcom/features/webhooks/lib/service/WebhookNotificationHandler";
|
|
import { WebhookNotifier } from "@calcom/features/webhooks/lib/service/WebhookNotifier";
|
|
import { WebhookService } from "@calcom/features/webhooks/lib/service/WebhookService";
|
|
|
|
import { SHARED_TOKENS } from "../../shared/shared.tokens";
|
|
import { WEBHOOK_TOKENS } from "../Webhooks.tokens";
|
|
|
|
export const webhookModule = createModule();
|
|
|
|
// Bind repository
|
|
webhookModule.bind(WEBHOOK_TOKENS.WEBHOOK_REPOSITORY).toClass(WebhookRepository);
|
|
|
|
// Bind services
|
|
webhookModule
|
|
.bind(WEBHOOK_TOKENS.WEBHOOK_SERVICE)
|
|
.toClass(WebhookService, [WEBHOOK_TOKENS.WEBHOOK_REPOSITORY, SHARED_TOKENS.TASKER, SHARED_TOKENS.LOGGER]);
|
|
|
|
webhookModule
|
|
.bind(WEBHOOK_TOKENS.BOOKING_WEBHOOK_SERVICE)
|
|
.toClass(BookingWebhookService, [
|
|
WEBHOOK_TOKENS.WEBHOOK_NOTIFIER,
|
|
WEBHOOK_TOKENS.WEBHOOK_SERVICE,
|
|
SHARED_TOKENS.TASKER,
|
|
SHARED_TOKENS.LOGGER,
|
|
]);
|
|
|
|
webhookModule
|
|
.bind(WEBHOOK_TOKENS.FORM_WEBHOOK_SERVICE)
|
|
.toClass(FormWebhookService, [WEBHOOK_TOKENS.WEBHOOK_NOTIFIER, WEBHOOK_TOKENS.WEBHOOK_SERVICE]);
|
|
|
|
webhookModule
|
|
.bind(WEBHOOK_TOKENS.RECORDING_WEBHOOK_SERVICE)
|
|
.toClass(RecordingWebhookService, [WEBHOOK_TOKENS.WEBHOOK_NOTIFIER]);
|
|
|
|
webhookModule
|
|
.bind(WEBHOOK_TOKENS.OOO_WEBHOOK_SERVICE)
|
|
.toClass(OOOWebhookService, [
|
|
WEBHOOK_TOKENS.WEBHOOK_NOTIFIER,
|
|
WEBHOOK_TOKENS.WEBHOOK_REPOSITORY,
|
|
SHARED_TOKENS.TASKER,
|
|
SHARED_TOKENS.LOGGER,
|
|
]);
|
|
|
|
// Bind payload builder factory (composition root for versioning)
|
|
webhookModule.bind(WEBHOOK_TOKENS.PAYLOAD_BUILDER_FACTORY).toFactory(() => createPayloadBuilderFactory());
|
|
|
|
// Bind notification handler with factory
|
|
webhookModule
|
|
.bind(WEBHOOK_TOKENS.WEBHOOK_NOTIFICATION_HANDLER)
|
|
.toClass(WebhookNotificationHandler, [
|
|
WEBHOOK_TOKENS.WEBHOOK_SERVICE,
|
|
WEBHOOK_TOKENS.PAYLOAD_BUILDER_FACTORY,
|
|
SHARED_TOKENS.LOGGER,
|
|
]);
|
|
|
|
// Bind notifier
|
|
webhookModule
|
|
.bind(WEBHOOK_TOKENS.WEBHOOK_NOTIFIER)
|
|
.toClass(WebhookNotifier, [WEBHOOK_TOKENS.WEBHOOK_NOTIFICATION_HANDLER, SHARED_TOKENS.LOGGER]);
|