* feat: Cal.diy — community-driven MIT-licensed fork of Cal.com This squashed commit contains all Cal.diy changes applied on top of calcom/cal.com main: - Rebrand Cal.com to Cal.diy across the entire codebase - Remove Enterprise Edition (EE) features, license checks, and AGPL restrictions - Switch license from AGPL-3.0 to MIT - Remove docs/ directory (migrated to Nextra at cal.diy) - Remove dead code: org tests, EE tips, platform nav, premium username, SAML/SSO, etc. - Clean up .env.example for self-hosted Cal.diy - Update Docker image references to calcom/cal.diy - Update README, CONTRIBUTING.md, and issue templates for Cal.diy community fork - Add PR welcome bot for Cal.diy contributors - Fix API v2 breaking changes oasdiff ignore entries - Replace Blacksmith CI runners with default GitHub Actions 3893 files changed, 20789 insertions(+), 411020 deletions(-) Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: remove org-specific /organizations/:orgId endpoints from API v2 atoms controllers (#1701) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: revert Cal.diy Inc to Cal.com, Inc. in license files, copyright notices, and package metadata (#1702) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * rip out org related comments in api v2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
123 lines
3.2 KiB
TypeScript
123 lines
3.2 KiB
TypeScript
import type { IWebhookRepository } from "../interface/IWebhookRepository";
|
|
import type {
|
|
IBookingWebhookService,
|
|
IOOOWebhookService,
|
|
IRecordingWebhookService,
|
|
IWebhookService,
|
|
} from "../interface/services";
|
|
import type { IWebhookProducerService } from "../interface/WebhookProducerService";
|
|
import type { IWebhookNotifier } from "../interface/webhook";
|
|
import type { WebhookTaskConsumer } from "../service/WebhookTaskConsumer";
|
|
|
|
/**
|
|
* WebhookFeature Facade
|
|
*
|
|
* Unified, type-safe API surface for the entire Webhooks feature.
|
|
*
|
|
* This facade provides access to:
|
|
* - Producer: Lightweight service for queueing webhook tasks
|
|
* - Consumer: Heavy service for processing webhook tasks
|
|
* - Core: Low-level webhook service (repository, processing, scheduling)
|
|
* - Event-specific services: Booking, Form, Recording, OOO webhooks
|
|
* - Notifier: High-level notification handler
|
|
* - Repository: Direct data access (use sparingly)
|
|
*
|
|
* Usage (recommended):
|
|
* ```typescript
|
|
* import { getWebhookFeature } from "@calcom/features/webhooks/di";
|
|
*
|
|
* const webhooks = getWebhookFeature();
|
|
*
|
|
* // Queue a webhook (lightweight, fast)
|
|
* await webhooks.producer.queueBookingCreatedWebhook({
|
|
* triggerEvent: WebhookTriggerEvents.BOOKING_CREATED,
|
|
* bookingUid: booking.uid,
|
|
* eventTypeId: eventType.id,
|
|
* });
|
|
*
|
|
* // Or use event-specific services (direct emission)
|
|
* await webhooks.booking.emitBookingCreated({
|
|
* booking,
|
|
* eventType,
|
|
* evt,
|
|
* });
|
|
* ```
|
|
*/
|
|
export interface WebhookFeature {
|
|
/**
|
|
* Producer Service (lightweight)
|
|
*
|
|
* Queue webhook delivery tasks. No heavy dependencies.
|
|
* Use this for async webhook processing via task queue.
|
|
*/
|
|
producer: IWebhookProducerService;
|
|
|
|
/**
|
|
* Consumer Service (heavy)
|
|
*
|
|
* Process webhook delivery tasks from queue.
|
|
* Fetches data, builds payloads, sends HTTP requests.
|
|
*
|
|
* Note: Typically called by task queue handler, not directly.
|
|
*/
|
|
consumer: WebhookTaskConsumer;
|
|
|
|
/**
|
|
* Core Webhook Service
|
|
*
|
|
* Low-level webhook operations: get subscribers, process webhooks, schedule.
|
|
* Use this for advanced/custom webhook logic.
|
|
*/
|
|
core: IWebhookService;
|
|
|
|
/**
|
|
* Booking Webhook Service
|
|
*
|
|
* Handle all booking-related webhook events:
|
|
* - BOOKING_CREATED
|
|
* - BOOKING_REQUESTED (pending confirmation)
|
|
* - BOOKING_RESCHEDULED
|
|
* - BOOKING_CANCELLED
|
|
* - BOOKING_REJECTED
|
|
* - BOOKING_PAYMENT_INITIATED
|
|
* - BOOKING_PAID
|
|
* - BOOKING_NO_SHOW_UPDATED
|
|
*/
|
|
booking: IBookingWebhookService;
|
|
|
|
/**
|
|
* Recording Webhook Service
|
|
*
|
|
* Handle recording-related webhook events:
|
|
* - RECORDING_READY
|
|
* - RECORDING_TRANSCRIPTION_GENERATED
|
|
*/
|
|
recording: IRecordingWebhookService;
|
|
|
|
/**
|
|
* Out-of-Office (OOO) Webhook Service
|
|
*
|
|
* Handle OOO-related webhook events:
|
|
* - OOO_CREATED
|
|
*/
|
|
ooo: IOOOWebhookService;
|
|
|
|
/**
|
|
* Webhook Notifier
|
|
*
|
|
* High-level webhook notification handler.
|
|
* Orchestrates payload building and delivery.
|
|
*/
|
|
notifier: IWebhookNotifier;
|
|
|
|
/**
|
|
* Webhook Repository
|
|
*
|
|
* @internal
|
|
* Direct data access for webhooks.
|
|
* Use sparingly - prefer services for business logic.
|
|
* Only exposed for advanced use cases and testing.
|
|
*/
|
|
repository: IWebhookRepository;
|
|
}
|