* feat: extract core booking audit infrastructure from PR 25125 This PR contains only the core booking audit infrastructure changes from PR 25125, excluding integration changes with booking flows. Included: - All packages/features/booking-audit/* (core audit services, actions, repository) - packages/features/di/containers/BookingAuditViewerService.container.ts - packages/features/tasker/tasker.ts (audit task types) - packages/features/bookings/lib/types/actor.ts (actor types for audit) - packages/features/bookings/repositories/BookingRepository.ts (getFromRescheduleUid method) - apps/web/modules/booking/logs/views/booking-logs-view.tsx (UI for viewing audit logs) - apps/web/public/static/locales/en/common.json (translations) Excluded (integration changes): - packages/trpc/server/* (tRPC handlers) - packages/features/ee/round-robin/* (round-robin integration) - packages/features/bookings/lib/handleCancelBooking.ts - packages/features/bookings/lib/handleConfirmation.ts - packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.ts - packages/features/bookings/lib/service/RegularBookingService.ts - apps/api/v2/* (API v2 integration) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: make booking audit interfaces backwards-compatible with main - Add queueAudit method back to BookingAuditProducerService interface for backwards compatibility - Implement queueAudit method in BookingAuditTaskerProducerService - Make userTimeZone parameter optional in BookingAuditViewerService - Add BookingAuditTaskProducerActionData type for legacy queueAudit method - Use any generics in BookingAuditActionServiceRegistry (matching PR 25125) - Fix type assertions in BookingAuditTaskConsumer Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix switch eslint and ts * feat: enhance BookingAuditViewerService with logging and type improvements - Added ISimpleLogger dependency to BookingAuditViewerService for better error handling. - Updated actor type in enriched audit logs to use AuditActorType for improved type safety. - Replaced console.error with logger for error reporting when no rescheduled log is found. --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
56 lines
2.4 KiB
TypeScript
56 lines
2.4 KiB
TypeScript
import type { z } from "zod";
|
|
|
|
import type { FORM_SUBMITTED_WEBHOOK_RESPONSES } from "@calcom/app-store/routing-forms/lib/formSubmissionUtils";
|
|
import type { BookingAuditTaskBasePayload } from "@calcom/features/booking-audit/lib/types/bookingAuditTask";
|
|
export type TaskerTypes = "internal" | "redis";
|
|
type TaskPayloads = {
|
|
sendWebhook: string;
|
|
sendSms: string;
|
|
triggerHostNoShowWebhook: z.infer<
|
|
typeof import("./tasks/triggerNoShow/schema").ZSendNoShowWebhookPayloadSchema
|
|
>;
|
|
triggerGuestNoShowWebhook: z.infer<
|
|
typeof import("./tasks/triggerNoShow/schema").ZSendNoShowWebhookPayloadSchema
|
|
>;
|
|
triggerFormSubmittedNoEventWebhook: z.infer<
|
|
typeof import("./tasks/triggerFormSubmittedNoEvent/triggerFormSubmittedNoEventWebhook").ZTriggerFormSubmittedNoEventWebhookPayloadSchema
|
|
>;
|
|
triggerFormSubmittedNoEventWorkflow: z.infer<
|
|
typeof import("./tasks/triggerFormSubmittedNoEvent/triggerFormSubmittedNoEventWorkflow").ZTriggerFormSubmittedNoEventWorkflowPayloadSchema
|
|
>;
|
|
translateEventTypeData: z.infer<
|
|
typeof import("./tasks/translateEventTypeData").ZTranslateEventDataPayloadSchema
|
|
>;
|
|
createCRMEvent: z.infer<typeof import("./tasks/crm/schema").createCRMEventSchema>;
|
|
sendWorkflowEmails: z.infer<typeof import("./tasks/sendWorkflowEmails").ZSendWorkflowEmailsSchema>;
|
|
scanWorkflowBody: z.infer<typeof import("./tasks/scanWorkflowBody").scanWorkflowBodySchema>;
|
|
sendAnalyticsEvent: z.infer<typeof import("./tasks/analytics/schema").sendAnalyticsEventSchema>;
|
|
executeAIPhoneCall: {
|
|
workflowReminderId: number;
|
|
agentId: string;
|
|
fromNumber: string;
|
|
toNumber: string;
|
|
bookingUid: string | null;
|
|
userId: number | null;
|
|
teamId: number | null;
|
|
providerAgentId: string;
|
|
responses?: FORM_SUBMITTED_WEBHOOK_RESPONSES | null;
|
|
routedEventTypeId?: number | null;
|
|
};
|
|
bookingAudit: BookingAuditTaskBasePayload;
|
|
};
|
|
export type TaskTypes = keyof TaskPayloads;
|
|
export type TaskHandler = (payload: string, taskId?: string) => Promise<void>;
|
|
export type TaskerCreate = <TaskKey extends keyof TaskPayloads>(
|
|
type: TaskKey,
|
|
payload: TaskPayloads[TaskKey],
|
|
options?: { scheduledAt?: Date; maxAttempts?: number; referenceUid?: string }
|
|
) => Promise<string>;
|
|
export interface Tasker {
|
|
/** Create a new task with the given type and payload. */
|
|
create: TaskerCreate;
|
|
cleanup(): Promise<void>;
|
|
cancel(id: string): Promise<string>;
|
|
cancelWithReference(referenceUid: string, type: TaskTypes): Promise<string | null>;
|
|
}
|